// ==UserScript==// @name My QNAP// @namespace https://qnap.lan/// @version 2025-05-31// @description try to take over the QNAP!// @author You// @match https://qnap.lan/*// @icon https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net// @grant none// ==/UserScript==(function(){'use strict';// Configuration for the observerconstobserverConfig={ childList:true, subtree:true, attributes:false, characterData:false};// Create an observer instanceconstobserver=newMutationObserver(mutations=>{requestIdleCallback(()=>{// DEBUG: Get all label elementsconstallLabels=Array.from(document.querySelectorAll('label.x-form-item-label'));// DEBUG: Find Local IP labelconstlocalIPLabel=allLabels.find(it=>it.innerText==='Local IP');console.debug('[DEBUG] localIPLabel:',localIPLabel);if (localIPLabel==null) {console.warn('[DEBUG] Local IP label not found');return;}constlocalIP=localIPLabel.nextElementSibling.innerText.trim();console.debug('[DEBUG] localIP:',localIP);if(localIP==null||localIP==='') {console.warn('[DEBUG] localIP is null or empty');return;}constquery=newURL(localIP).search;console.debug('[DEBUG] query:',query);// DEBUG: Find SmartShare labelconstsmartShareLabel=allLabels.find(it=>it.innerText==='SmartShare');if (smartShareLabel==null) {console.warn('[DEBUG] SmartShare label not found');return;}constcopyButton=smartShareLabel.nextElementSibling.querySelector('button');if (copyButton==null) {console.warn('[DEBUG] Copy button not found');return;}copyButton.addEventListener('click',()=>{constshareUrl='https://smartshare.zeeko.dev/share.cgi'+query;navigator.clipboard.writeText(shareUrl);});});});// Start observing the document bodyobserver.observe(document.body,observerConfig);// Cleanup observer when page unloadswindow.addEventListener('unload',()=>{observer.disconnect();});})();