Power user mode by default

This commit is contained in:
SillyLossy
2023-04-07 13:45:47 +03:00
parent 27a8163d4e
commit c1f3fb49ca
2 changed files with 31 additions and 45 deletions

View File

@@ -263,20 +263,6 @@
<input id="your_name_button" class="menu_button" type="submit" title="Click to set a new User Name (reloads page)" value="Change Name"> <input id="your_name_button" class="menu_button" type="submit" title="Click to set a new User Name (reloads page)" value="Change Name">
</form> </form>
<div class="ui-settings"> <div class="ui-settings">
<div class="range-block" title="Blur can cause browser lag, especially in Bubble Chat mode.
To fix: Turn on your browser's Hardware Acceleration, and restart your browser.
or simply disable the blur effect with this toggle.
">
<div class="range-block-title" >
<h4>No Blur Effect</h4>
</div>
<div class="range-block-range">
<label for="fast_ui_mode" class="checkbox_label">
<input id="fast_ui_mode" type="checkbox" />
Enabled
</label>
</div>
</div>
<div id="avatars-style" class="range-block"> <div id="avatars-style" class="range-block">
<div class="range-block-title"> <div class="range-block-title">
<h4>Avatars Style</h4> <h4>Avatars Style</h4>
@@ -316,6 +302,11 @@
Auto-load Last Chat Auto-load Last Chat
</label> </label>
<label for="fast_ui_mode" class="checkbox_label" title="Blur can cause browser lag, especially in Bubble Chat mode. To fix: Turn on your browser's Hardware Acceleration, and restart your browser or simply disable the blur effect with this toggle.">
<input id="fast_ui_mode" type="checkbox" />
No Blur Effect
</label>
<label for="swipes-checkbox"><input id="swipes-checkbox" type="checkbox" /> <label for="swipes-checkbox"><input id="swipes-checkbox" type="checkbox" />
Swipes Swipes
</label> </label>

View File

@@ -6,6 +6,16 @@ export {
power_user, power_user,
}; };
const avatar_styles = {
ROUND: 0,
RECTANGULAR: 1,
}
const chat_styles = {
DEFAULT: 0,
BUBBLES: 1,
}
let power_user = { let power_user = {
collapse_newlines: false, collapse_newlines: false,
force_pygmalion_formatting: false, force_pygmalion_formatting: false,
@@ -16,9 +26,9 @@ let power_user = {
always_force_name2: false, always_force_name2: false,
multigen: false, multigen: false,
custom_chat_separator: '', custom_chat_separator: '',
fast_ui_mode: false, fast_ui_mode: true,
avatar_style: 0, avatar_style: avatar_styles.ROUND,
chat_display: 0 chat_display: chat_styles.DEFAULT,
}; };
const storage_keys = { const storage_keys = {
@@ -41,37 +51,19 @@ function collapseNewlines(x) {
} }
function switchUiMode() { function switchUiMode() {
power_user.fast_ui_mode = localStorage.getItem(storage_keys.fast_ui_mode) == "true"; const fastUi = localStorage.getItem(storage_keys.fast_ui_mode);
if (power_user.fast_ui_mode) { power_user.fast_ui_mode = fastUi === null ? true : fastUi == "true";
$("body").addClass("no-blur"); $("body").toggleClass("no-blur", power_user.fast_ui_mode);
}
else {
$("body").removeClass("no-blur");
}
} }
function applyAvatarStyle() { function applyAvatarStyle() {
power_user.avatar_style = Number(localStorage.getItem(storage_keys.avatar_style) ?? 0); power_user.avatar_style = Number(localStorage.getItem(storage_keys.avatar_style) ?? avatar_styles.ROUND);
switch (power_user.avatar_style) { $("body").toggleClass("big-avatars", power_user.avatar_style === avatar_styles.RECTANGULAR);
case 0:
$("body").removeClass("big-avatars");
break;
case 1:
$("body").addClass("big-avatars");
break;
}
} }
function applyChatDisplay() { function applyChatDisplay() {
power_user.chat_display = Number(localStorage.getItem(storage_keys.chat_display) ?? 0); power_user.chat_display = Number(localStorage.getItem(storage_keys.chat_display) ?? chat_styles.DEFAULT);
switch (power_user.chat_display) { $("body").toggleClass("bubblechat", power_user.chat_display === chat_styles.BUBBLES);
case 0:
$("body").removeClass("bubblechat");
break;
case 1:
$("body").addClass("bubblechat");
break;
}
} }
applyAvatarStyle(); applyAvatarStyle();
@@ -101,9 +93,10 @@ function loadPowerUserSettings(settings) {
} }
// These are still local storage // These are still local storage
power_user.fast_ui_mode = localStorage.getItem(storage_keys.fast_ui_mode) == "true"; const fastUi = localStorage.getItem(storage_keys.fast_ui_mode);
power_user.avatar_style = Number(localStorage.getItem(storage_keys.avatar_style) ?? 0); power_user.fast_ui_mode = fastUi === null ? true : fastUi == "true";
power_user.chat_display = Number(localStorage.getItem(storage_keys.chat_display) ?? 0); power_user.avatar_style = Number(localStorage.getItem(storage_keys.avatar_style) ?? avatar_styles.ROUND);
power_user.chat_display = Number(localStorage.getItem(storage_keys.chat_display) ?? chat_styles.DEFAULT);
$("#force-pygmalion-formatting-checkbox").prop("checked", power_user.force_pygmalion_formatting); $("#force-pygmalion-formatting-checkbox").prop("checked", power_user.force_pygmalion_formatting);
$("#collapse-newlines-checkbox").prop("checked", power_user.collapse_newlines); $("#collapse-newlines-checkbox").prop("checked", power_user.collapse_newlines);
@@ -160,6 +153,7 @@ $(document).ready(() => {
power_user.custom_chat_separator = $(this).val(); power_user.custom_chat_separator = $(this).val();
saveSettingsDebounced(); saveSettingsDebounced();
}); });
$("#multigen").change(function () { $("#multigen").change(function () {
power_user.multigen = $(this).prop("checked"); power_user.multigen = $(this).prop("checked");
saveSettingsDebounced(); saveSettingsDebounced();
@@ -177,6 +171,7 @@ $(document).ready(() => {
localStorage.setItem(storage_keys.avatar_style, power_user.avatar_style); localStorage.setItem(storage_keys.avatar_style, power_user.avatar_style);
applyAvatarStyle(); applyAvatarStyle();
}); });
$(`input[name="chat_display"]`).on('input', function (e) { $(`input[name="chat_display"]`).on('input', function (e) {
power_user.chat_display = Number(e.target.value); power_user.chat_display = Number(e.target.value);
localStorage.setItem(storage_keys.chat_display, power_user.chat_display); localStorage.setItem(storage_keys.chat_display, power_user.chat_display);