Run Safari patch before loading settings
| @@ -1,4 +1,4 @@ | ||
| 1 | 1 | import { humanizedDateTime, favsToHotswap, getMessageTimeStamp, dragElement, isMobile, initRossMods, shouldSendOnEnter, addSafariPatch } from './scripts/RossAscends-mods.js'; |
| 2 | 2 | import { userStatsHandler, statMesProcess, initStats } from './scripts/stats.js'; |
| 3 | 3 | import { |
| 4 | 4 | generateKoboldWithStreaming, |
| @@ -916,6 +916,7 @@ async function firstLoadInit() { | ||
| 916 | 916 | throw new Error('Initialization failed'); |
| 917 | 917 | } |
| 918 | 918 | |
| 919 | + addSafariPatch(); | |
| 919 | 920 | await getClientVersion(); |
| 920 | 921 | await readSecretState(); |
| 921 | 922 | initLocales(); |
| @@ -6322,7 +6323,7 @@ export function setUserName(value) { | ||
| 6322 | 6323 | |
| 6323 | 6324 | async function doOnboarding(avatarId) { |
| 6324 | 6325 | const template = $('#onboarding_template .onboarding'); |
| 6325 | 6326 | let userName = await callGenericPopup(template, POPUP_TYPE.INPUT, currentUser?.name || name1, { rows: 2, widewider: true, largecancelButton: truefalse }); |
| 6326 | 6327 | |
| 6327 | 6328 | if (userName) { |
| 6328 | 6329 | userName = String(userName).replace('\n', ' '); |
| @@ -711,6 +711,18 @@ export const autoFitSendTextAreaDebounced = debounce(autoFitSendTextArea, deboun | ||
| 711 | 711 | |
| 712 | 712 | // --------------------------------------------------- |
| 713 | 713 | |
| 714 | +export function addSafariPatch() { | |
| 715 | + const userAgent = getParsedUA(); | |
| 716 | + console.debug('User Agent', userAgent); | |
| 717 | + const isMobileSafari = /iPad|iPhone|iPod/.test(navigator.platform) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1); | |
| 718 | + const isDesktopSafari = userAgent?.browser?.name === 'Safari' && userAgent?.platform?.type === 'desktop'; | |
| 719 | + const isIOS = userAgent?.os?.name === 'iOS'; | |
| 720 | + | |
| 721 | + if (isIOS || isMobileSafari || isDesktopSafari) { | |
| 722 | + document.body.classList.add('safari'); | |
| 723 | + } | |
| 724 | +} | |
| 725 | + | |
| 714 | 726 | export function initRossMods() { |
| 715 | 727 | // initial status check |
| 716 | 728 | setTimeout(() => { |
| @@ -725,16 +737,6 @@ export function initRossMods() { | ||
| 725 | 737 | RA_autoconnect(); |
| 726 | 738 | } |
| 727 | 739 | |
| 728 | - const userAgent = getParsedUA(); | |
| 729 | - console.debug('User Agent', userAgent); | |
| 730 | - const isMobileSafari = /iPad|iPhone|iPod/.test(navigator.platform) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1); | |
| 731 | - const isDesktopSafari = userAgent?.browser?.name === 'Safari' && userAgent?.platform?.type === 'desktop'; | |
| 732 | - const isIOS = userAgent?.os?.name === 'iOS'; | |
| 733 | - | |
| 734 | - if (isIOS || isMobileSafari || isDesktopSafari) { | |
| 735 | - document.body.classList.add('safari'); | |
| 736 | - } | |
| 737 | - | |
| 738 | 740 | $('#main_api').change(function () { |
| 739 | 741 | var PrevAPI = main_api; |
| 740 | 742 | setTimeout(() => RA_autoconnect(PrevAPI), 100); |