initial commit, functional, needs proofing

This commit is contained in:
RossAscends
2024-09-29 21:47:18 +09:00
parent 53424d4c8e
commit 034a5a48c2
3 changed files with 75 additions and 8 deletions

View File

@ -290,6 +290,7 @@ let power_user = {
restore_user_input: true,
reduced_motion: false,
compact_input_area: true,
show_swipe_num_all_messages: false,
auto_connect: false,
auto_load_chat: false,
forbid_external_media: true,
@ -469,6 +470,35 @@ function switchCompactInputArea() {
$('#compact_input_area').prop('checked', power_user.compact_input_area);
}
export function switchSwipeNumAllMessages() {
console.error('switching branch button initialted, function start!');
$('#show_swipe_num_all_messages').prop('checked', power_user.show_swipe_num_all_messages);
if (power_user.show_swipe_num_all_messages) {
$('.mes').each(function () {
//if the div also has the .lst_mes class, skip the loop for that item
if ($(this).hasClass('last_mes')) {
return;
}
//add the cloned button to every .mes .swipe_right EXCLUDING .mes.last_mes
$(this).find('.swipe_right').css('display', 'flex');
});
} else if (!power_user.show_swipe_num_all_messages) {
$('.mes:not(.last_mes)').each(function () {
if ($(this).hasClass('last_mes')) {
return;
}
//add the cloned button back to its original spot
$(this).find('.swipe_right').css('display', 'none');
});
}
}
var originalSliderValues = [];
async function switchLabMode() {
@ -1283,6 +1313,13 @@ function applyTheme(name) {
switchCompactInputArea();
},
},
{
key: 'show_swipe_num_all_messages',
action: () => {
$('#show_swipe_num_all_messages').prop('checked', power_user.show_swipe_num_all_messages);
switchSwipeNumAllMessages();
},
},
];
for (const { key, selector, type, action } of themeProperties) {
@ -1352,6 +1389,7 @@ function applyPowerUserSettings() {
switchHideChatAvatars();
switchTokenCount();
switchMessageActions();
switchSwipeNumAllMessages();
}
function getExampleMessagesBehavior() {
@ -2296,6 +2334,7 @@ function getThemeObject(name) {
zoomed_avatar_magnification: power_user.zoomed_avatar_magnification,
reduced_motion: power_user.reduced_motion,
compact_input_area: power_user.compact_input_area,
show_swipe_num_all_messages: power_user.show_swipe_num_all_messages,
};
}
@ -3755,6 +3794,12 @@ $(document).ready(() => {
saveSettingsDebounced();
});
$('#show_swipe_num_all_messages').on('input', function () {
power_user.show_swipe_num_all_messages = !!$(this).prop('checked');
switchSwipeNumAllMessages();
saveSettingsDebounced();
});
$('#auto-connect-checkbox').on('input', function () {
power_user.auto_connect = !!$(this).prop('checked');
saveSettingsDebounced();