Merge branch 'staging' into del-swipe-fix

This commit is contained in:
Wolfsblvt
2024-09-01 23:27:25 +02:00
5 changed files with 183 additions and 214 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
import { humanizedDateTime, favsToHotswap, getMessageTimeStamp, dragElement, isMobile, initRossMods, shouldSendOnEnter } from './scripts/RossAscends-mods.js';
import { humanizedDateTime, favsToHotswap, getMessageTimeStamp, dragElement, isMobile, initRossMods, shouldSendOnEnter, addSafariPatch } from './scripts/RossAscends-mods.js';
import { userStatsHandler, statMesProcess, initStats } from './scripts/stats.js';
import {
generateKoboldWithStreaming,
@ -916,6 +916,7 @@ async function firstLoadInit() {
throw new Error('Initialization failed');
}
addSafariPatch();
await getClientVersion();
await readSecretState();
initLocales();
@ -6322,7 +6323,7 @@ export function setUserName(value) {
async function doOnboarding(avatarId) {
const template = $('#onboarding_template .onboarding');
let userName = await callGenericPopup(template, POPUP_TYPE.INPUT, currentUser?.name || name1, { rows: 2, wide: true, large: true });
let userName = await callGenericPopup(template, POPUP_TYPE.INPUT, currentUser?.name || name1, { rows: 2, wider: true, cancelButton: false });
if (userName) {
userName = String(userName).replace('\n', ' ');

View File

@ -711,6 +711,18 @@ export const autoFitSendTextAreaDebounced = debounce(autoFitSendTextArea, deboun
// ---------------------------------------------------
export function addSafariPatch() {
const userAgent = getParsedUA();
console.debug('User Agent', userAgent);
const isMobileSafari = /iPad|iPhone|iPod/.test(navigator.platform) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1);
const isDesktopSafari = userAgent?.browser?.name === 'Safari' && userAgent?.platform?.type === 'desktop';
const isIOS = userAgent?.os?.name === 'iOS';
if (isIOS || isMobileSafari || isDesktopSafari) {
document.body.classList.add('safari');
}
}
export function initRossMods() {
// initial status check
setTimeout(() => {
@ -725,16 +737,6 @@ export function initRossMods() {
RA_autoconnect();
}
const userAgent = getParsedUA();
console.debug('User Agent', userAgent);
const isMobileSafari = /iPad|iPhone|iPod/.test(navigator.platform) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1);
const isDesktopSafari = userAgent?.browser?.name === 'Safari' && userAgent?.platform?.type === 'desktop';
const isIOS = userAgent?.os?.name === 'iOS';
if (isIOS || isMobileSafari || isDesktopSafari) {
document.body.classList.add('safari');
}
$('#main_api').change(function () {
var PrevAPI = main_api;
setTimeout(() => RA_autoconnect(PrevAPI), 100);

View File

@ -281,6 +281,7 @@ export class Popup {
case POPUP_TYPE.INPUT: {
this.mainInput.style.display = 'block';
if (!okButton) this.okButton.textContent = template.getAttribute('popup-button-save');
if (cancelButton === false) this.cancelButton.style.display = 'none';
break;
}
case POPUP_TYPE.DISPLAY: {

View File

@ -75,11 +75,6 @@ const defaultStoryString = '{{#if system}}{{system}}\n{{/if}}{{#if description}}
const defaultExampleSeparator = '***';
const defaultChatStart = '***';
export const ui_mode = {
SIMPLE: 0,
POWER: 1,
};
const avatar_styles = {
ROUND: 0,
RECTANGULAR: 1,
@ -132,7 +127,6 @@ let power_user = {
smooth_streaming: false,
smooth_streaming_speed: 50,
ui_mode: ui_mode.POWER,
fast_ui_mode: true,
avatar_style: avatar_styles.ROUND,
chat_display: chat_styles.DEFAULT,
@ -331,12 +325,6 @@ const debug_functions = [];
const setHotswapsDebounced = debounce(favsToHotswap);
export function switchSimpleMode() {
$('[data-newbie-hidden]').each(function () {
$(this).toggleClass('displayNone', power_user.ui_mode === ui_mode.SIMPLE);
});
}
function playMessageSound() {
if (!power_user.play_message_sound) {
return;
@ -1586,7 +1574,6 @@ async function loadPowerUserSettings(settings, data) {
$('#bot-mes-blur-tint-color-picker').attr('color', power_user.bot_mes_blur_tint_color);
$('#shadow-color-picker').attr('color', power_user.shadow_color);
$('#border-color-picker').attr('color', power_user.border_color);
$('#ui_mode_select').val(power_user.ui_mode).find(`option[value="${power_user.ui_mode}"]`).attr('selected', true);
$('#reduced_motion').prop('checked', power_user.reduced_motion);
$('#auto-connect-checkbox').prop('checked', power_user.auto_connect);
$('#auto-load-chat-checkbox').prop('checked', power_user.auto_load_chat);
@ -1620,7 +1607,6 @@ async function loadPowerUserSettings(settings, data) {
switchSpoilerMode();
loadMovingUIState();
loadCharListState();
switchSimpleMode();
}
async function loadCharListState() {
@ -3683,13 +3669,6 @@ $(document).ready(() => {
showDebugMenu();
});
$('#ui_mode_select').on('change', function () {
const value = $(this).find(':selected').val();
power_user.ui_mode = Number(value);
switchSimpleMode();
saveSettingsDebounced();
});
$('#bogus_folders').on('input', function () {
power_user.bogus_folders = !!$(this).prop('checked');
printCharactersDebounced();