PageSourceSearch

https://isai.kr/JS/re_setmode.js?v=1783403343

js isai.kr collected 2026-09-30 04:19:42 UTC 3,595 bytes, 97 lines download raw bytes

1
2function setMode(mode) {
3    try { stopVoiceMode(true); } catch (e) {}
4
5    currentMode = mode;
6    if (document.body) document.body.setAttribute('data-ui-mode', mode);
7    // ¹öư Ȱ¼ºÈ­ UI ó¸®
8    document.querySelectorAll('.btn-icon').forEach(b => {
9        if(b.id!=='btn-download' && b.id !== 'btn-menu') b.classList.remove('active'); 
10    });
11    const activeBtn = document.getElementById('btn-'+mode);
12    if(activeBtn) activeBtn.classList.add('active');
13    
14    // UI ¿ä¼Ò ÂüÁ¶
15    const musicWrapper = document.getElementById('music-duration-wrapper');
16    const transLeftWrapper = document.getElementById('translation-left-wrapper');
17    const transRightWrapper = document.getElementById('translation-right-wrapper');
18    const commTools = document.getElementById('community-tools');
19    const commPreview = document.getElementById('comm-img-preview-box');
20    const btnLeft = document.getElementById('btn-submit-left');
21    const ratioWrapper = document.getElementById('image-ratio-wrapper'); // [Ãß°¡µÊ]
22
23    // 1. ÃʱâÈ­: ¸ðµç Ư¼ö Åø ¼û±è
24    if (musicWrapper) musicWrapper.classList.add('hidden');
25    if (transLeftWrapper) transLeftWrapper.classList.add('hidden');
26    if (transRightWrapper) transRightWrapper.classList.add('hidden');
27    if (commTools) commTools.classList.add('hidden');
28    if (commPreview) commPreview.classList.add('hidden');
29    if (ratioWrapper) ratioWrapper.classList.add('hidden'); // [Ãß°¡µÊ]
30    if (btnLeft) {
31        btnLeft.classList.add('hidden');
32        btnLeft.style.display = 'none';
33    }
34
35    // 2. ¸ðµåº° Ç¥½Ã ·ÎÁ÷
36    if (mode === 'music' && musicWrapper) musicWrapper.classList.remove('hidden');
37    
38    // [ÇÙ½É] À̹ÌÁö ¸ðµåÀÏ ¶§ ºñÀ² Åä±Û ¾ÆÀÌÄÜÀ» º¸¿©ÁÜ
39    if (mode === 'image' && ratioWrapper) {
40        ratioWrapper.classList.remove('hidden');
41    }
42
43    if (mode === 'translate') {
44        if (transLeftWrapper) transLeftWrapper.classList.remove('hidden');
45        if (transRightWrapper) transRightWrapper.classList.remove('hidden');
46        if (btnLeft) {
47            btnLeft.classList.remove('hidden');
48            btnLeft.style.display = 'flex';
49        }
50        setVoiceState('right', 'idle');
51    }
52    
53    if (mode === 'community') {
54        if (commTools) commTools.classList.remove('hidden');
55        const fileInput = document.getElementById('comm-file-input');
56        if (fileInput && fileInput.files.length > 0 && commPreview) {
57            commPreview.classList.remove('hidden');
58        }
59    }
60    
61    if (mode === 'voice') {
62        startExperience();
63        setVoiceState('right', 'idle');
64    } else if (mode !== 'translate') {
65        startExperience();
66        const iconRight = document.getElementById('icon-submit');
67        if(iconRight) iconRight.className = "ri-arrow-up-s-line text-lg";
68    }
69
70    if (mode !== 'voice' && mode !== 'translate') {
71        const input = document.getElementById('prompt-input');
72        if(input) input.focus();
73    }
74
75    if (mode === 'code') {
76        document.body.classList.add('mode-code');
77        startExperience();
78    } else {
79        document.body.classList.remove('mode-code');
80    }
81
82    if (mode === 'app') {
83        document.body.classList.remove('started'); 
84        document.getElementById('custom-scrollbar').style.display = 'none';
85        fetchApps(""); 
86    } else if (mode !== 'code') {
87        if(isStarted) {
88            document.body.classList.add('started');
89            document.getElementById('custom-scrollbar').style.display = 'block';
90        }
91        fetchApps(""); 
92    }
93
94    if (mode === 'voice') {
95        initVoiceMode();
96    }
97}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.