cdnhost 2.6.1 → 2.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cdnhost",
3
- "version": "2.6.1",
3
+ "version": "2.6.3",
4
4
  "description": "cdnhost",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/wbs.png CHANGED
Binary file
package/wbs2.png CHANGED
Binary file
package/ws_cdn.js CHANGED
@@ -280,28 +280,8 @@
280
280
  const appendNextPage = () => { if (isLoadingNextPage) return; isLoadingNextPage = true; const startIndex = (currentPage - 1) * ITEMS_PER_PAGE; const endIndex = currentPage * ITEMS_PER_PAGE; if (startIndex >= currentDisplayItems.length) { isLoadingNextPage = false; return; } const itemsToAppend = currentDisplayItems.slice(startIndex, endIndex); itemsToAppend.forEach(item => { searchResultsContainer.appendChild(createIconItem(item, 'search')); }); currentPage++; isLoadingNextPage = false; };
281
281
  const renderInitialResults = (items) => { searchResultsContainer.innerHTML = ''; currentPage = 1; currentDisplayItems = items; appendNextPage(); };
282
282
  const openSearch = async () => { widgetContainer.classList.add('search-mode'); widgetWrapper.classList.add('search-mode'); searchInput.focus(); if (fullApiItemsData === null) { try { const response = await fetch('https://isai.kr/appapi2.php'); if (!response.ok) throw new Error('API 응답 오류'); fullApiItemsData = await response.json(); } catch (error) { console.error('전체 앱 목록 로드 실패:', error); searchResultsContainer.innerHTML = '<p>목록 로드 실패</p>'; fullApiItemsData = []; return; } } renderInitialResults(fullApiItemsData); };
283
-
284
- const initialRender = () => {
285
- const t = translations[currentLang] || translations['en'];
286
- const initialItemsData = [
287
- { name: t.search, url: 'https://isai.kr', icon: 'ph-sparkle' },
288
- { name: t.question, url: 'https://isai.kr/#chat', icon: 'ph-question-mark' },
289
- { name: t.forum, url: 'https://logig.im', icon: 'ph-chats-circle' },
290
- { name: t.blog, url: 'https://blog.099.kr', icon: 'ph-article-medium' },
291
- { name: t.characterChat, url: 'https://zoai.oduc.kr/ko/character/select', icon: 'ph-chats-circle' },
292
- { name: t.translate, url: 'https://translato.isai.kr/', icon: 'ph-translate' },
293
- { name: t.tarot, url: 'https://tarot.isai.kr/', icon: 'ph-cards' },
294
- { name: t.psychology, url: 'https://simpong.oduc.kr/', img: 'http://cdn.jsdelivr.net/npm/cdnhost@2.2.0/_simpong.png' },
295
- { name: t.ads, url: 'https://gig.snapp.im/', icon: 'ph-currency-circle-dollar' },
296
- ];
297
- listContainer.innerHTML = '';
298
- const storedItems = shortcutManager.get();
299
- let combinedItems = [...initialItemsData];
300
- combinedItems.splice(2, 0, ...storedItems);
301
- combinedItems.forEach(item => { const isLocal = storedItems.some(stored => stored.url === item.url); const itemType = isLocal && !item.icon && !item.img ? 'local' : 'default'; listContainer.appendChild(createIconItem(item, itemType)); });
302
- checkScrollability();
303
- updateAllWidgetLinks();
304
- };
283
+
284
+ const initialRender=()=>{const a=translations[currentLang]||translations['en'];const b=[{name:a.search,url:'https://isai.kr',icon:'ph-sparkle'},{name:a.question,url:'https://isai.kr/#chat',icon:'ph-question-mark'},{name:a.forum,url:'https://logig.im',icon:'ph-chats-circle'},{name:a.blog,url:'https://blog.099.kr',icon:'ph-article-medium'},{name:a.characterChat,url:'https://zoai.oduc.kr/ko/character/select',icon:'ph-chats-circle'},{name:a.translate,url:'https://translato.isai.kr/',icon:'ph-translate'},{name:a.tarot,url:'https://tarot.isai.kr/',icon:'ph-cards'},{name:a.psychology,url:'https://simpong.oduc.kr/',img:'http://cdn.jsdelivr.net/npm/cdnhost@2.2.0/_simpong.png'},{name:a.ads,url:'https://gig.snapp.im/',icon:'ph-currency-circle-dollar'},];listContainer.innerHTML='';const c=shortcutManager.get();let d=[...b];d.splice(2,0,...c);d.forEach(e=>{const f=c.some(g=>g.url===e.url);const h=f&&!e.icon&&!e.img?'local':'default';listContainer.appendChild(createIconItem(e,h));});checkScrollability();updateAllWidgetLinks();};
305
285
 
306
286
  const updateScrollIndicator = () => { const scrollLeft = listContainer.scrollLeft; const maxScrollLeft = listContainer.scrollWidth - listContainer.clientWidth; if (maxScrollLeft <= 0) return; const scrollFraction = scrollLeft / maxScrollLeft; const trackWidth = indicatorTrack.clientWidth; const indicatorWidth = scrollIndicator.clientWidth; const maxIndicatorLeft = trackWidth - indicatorWidth; const indicatorLeft = scrollFraction * maxIndicatorLeft; scrollIndicator.style.transform = `translateY(-50%) translateX(${indicatorLeft}px)`; };
307
287
  const checkScrollability = () => { const isScrollable = listContainer.scrollWidth > listContainer.clientWidth; widgetContainer.classList.toggle('scrollable', isScrollable); if (isScrollable) updateScrollIndicator(); };
@@ -323,33 +303,11 @@
323
303
  searchClose.addEventListener('click', closeSearch);
324
304
  document.addEventListener('keydown', (e) => { if (e.key === 'Escape' && widgetWrapper.classList.contains('search-mode')) { closeSearch(); } });
325
305
 
326
- const addCurrentPageToWidget = async (e) => {
327
- e.preventDefault();
328
- const t = translations[currentLang] || translations['en'];
329
- const baseUrl = getProcessedUrl(window.location.href);
330
- let iconName = document.title || t.currentPage;
331
- try {
332
- const response = await fetch(`https://isai.kr/get_title.php?url=${encodeURIComponent(baseUrl)}`);
333
- if (response.ok) { const data = await response.json(); if (data.title) { iconName = data.title; } }
334
- } catch (error) { console.error('Failed to fetch title:', error); }
335
- const newIcon = { name: iconName, url: baseUrl };
336
- let storedItems = shortcutManager.get();
337
- const isAlreadyAdded = storedItems.some(item => getProcessedUrl(item.url) === getProcessedUrl(newIcon.url));
338
- if (!isAlreadyAdded) {
339
- if (storedItems.length >= 10) { storedItems.shift(); }
340
- storedItems.push(newIcon);
341
- shortcutManager.set(storedItems);
342
- try { await fetch('https://isai.kr/register_app.php', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(newIcon) }); } catch (error) { console.error('DB 등록/갱신 실패:', error); }
343
- initialRender();
344
- if (widgetWrapper.classList.contains('search-mode')) { closeSearch(); }
345
- } else {
346
- showToast(t.alreadyAdded);
347
- }
348
- };
306
+ const addCurrentPageToWidget=async a=>{a.preventDefault();const b=translations[currentLang]||translations.en,c=getProcessedUrl(window.location.href);let d=document.title||b.currentPage;try{const e=await fetch(`https://isai.kr/get_title.php?url=${encodeURIComponent(c)}`);if(e.ok){const f=await e.json();f.title&&(d=f.title)}}catch(g){console.error("Failed to fetch title:",g)}const h={name:d,url:c};let i=shortcutManager.get();if(!i.some(j=>getProcessedUrl(j.url)===getProcessedUrl(h.url))){i.length>=10&&i.shift(),i.push(h),shortcutManager.set(i);try{await fetch("https://isai.kr/register_app.php",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(h)})}catch(k){console.error("DB 등록/갱신 실패:",k)}initialRender(),widgetWrapper.classList.contains("search-mode")&&closeSearch()}else showToast(b.alreadyAdded)};
349
307
 
350
308
  const copyWidgetScript = (e) => {
351
309
  e.preventDefault();
352
- const textToCopy = "<script src='https://cdn.jsdelivr.net/npm/cdnhost@latest/ws_cdn.js'><\/script>";
310
+ const textToCopy = '<script src="https://unpkg.com/@phosphor-icons/web"><\/script> <script src="https://cdn.jsdelivr.net/npm/cdnhost@latest/ws_lg.js"><\/script> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/cdnhost@latest/ws_css.css"> <div id="app"></div> <script src="https://cdn.jsdelivr.net/npm/cdnhost@latest/ws_cdnhtml.js"><\/script> <script src="https://cdn.jsdelivr.net/npm/cdnhost@latest/ws_cdn.js"><\/script>';
353
311
  const t = translations[currentLang] || translations['en'];
354
312
  const fallbackCopy = () => { const textArea = document.createElement("textarea"); textArea.value = textToCopy; textArea.style.position = "fixed"; textArea.style.top = 0; textArea.style.left = "-9999px"; document.body.appendChild(textArea); textArea.focus(); textArea.select(); try { document.execCommand('copy'); showToast(t.codeCopied); } catch (err) { console.error('Fallback: Oops, unable to copy', err); } document.body.removeChild(textArea); };
355
313
  if (navigator.clipboard && window.isSecureContext) { navigator.clipboard.writeText(textToCopy).then(() => { showToast(t.codeCopied); }).catch(() => { fallbackCopy(); }); } else { fallbackCopy(); }
package/ws_cdnhtml.js CHANGED
@@ -26,10 +26,11 @@ const widgetHTML = `
26
26
  <div class="fhl-search-content">
27
27
  <div class="fhl-search-results" id="fhl-search-results"></div>
28
28
  <div class="fhl-fixed-panel">
29
- <a href="#" id="fhl-search-add-btn" class="fhl-fixed-item"><i class="ph-bold ph-download-simple"></i></a>
30
- <a href="#" id="fhl-fixed-image" class="fhl-fixed-item"><i class="ph-bold ph-image"></i></a>
31
- <a href="https://zoai.oduc.kr/ko/character/select" id="fhl-fixed-chat" class="fhl-fixed-item"><i class="ph-bold ph-smiley"></i></a>
32
- <a href="https://gig.snapp.im/" id="fhl-fixed-ad" class="fhl-fixed-item"><i class="ph-bold ph-megaphone"></i></a>
29
+ <a href="#" id="fhl-search-add-btn" class="fhl-fixed-item"><i class="ph-bold ph-code"></i></a>
30
+ <a href="https://isai.kr/#chat" id="fhl-fixed-image" class="fhl-fixed-item"><i class="ph-bold ph-question-mark"></i></a>
31
+ <a href="https://zoai.oduc.kr/ko/character/select" id="fhl-fixed-chat" class="fhl-fixed-item"><i class="ph-bold ph-chats-circle"></i></a>
32
+ <a href="https://gig.snapp.im/" id="fhl-fixed-ad" class="fhl-fixed-item"><i class="ph-bold ph-currency-circle-dollar"></i></a>
33
+ <a href="https://webstore.isai.kr/" id="fhl-fixed-ad" class="fhl-fixed-item"><i class="ph-bold ph-info"></i></a>
33
34
  </div>
34
35
  </div>
35
36
  </div>