MCPcopy Create free account
hub / github.com/XIU2/UserScript / callback

Function callback

Lanzou-Enhanced.user.js:605–624  ·  view source on GitHub ↗
(mutationsList, observer)

Source from the content-addressed store, hash-verified

603 // 监听并修改右键菜单 [外链分享地址] 为 [复制并打开分享链接] / [复制分享链接] / [打开分享链接] 之一
604 function viewTop() {
605 const callback = (mutationsList, observer) => {
606 for (const mutation of mutationsList) {
607 for (const target of mutation.addedNodes) {
608 if (target.nodeType != 1) return
609 if (target.className === 'f_view') {
610 //console.log(target)
611 let f_viewtop = target.querySelector('.f_viewtop');
612 if (f_viewtop && f_viewtop.textContent === '外链分享地址') {
613 if (menu_value('menu_open_fileSha') && menu_value('menu_copy_fileSha')) {
614 f_viewtop.textContent = '复制并打开分享链接';
615 } else if (menu_value('menu_open_fileSha')) {
616 f_viewtop.textContent = '打开分享链接';
617 } else if (menu_value('menu_copy_fileSha')) {
618 f_viewtop.textContent = '复制分享链接';
619 }
620 }
621 }
622 }
623 }
624 };
625 const observer = new MutationObserver(callback);
626 observer.observe(mainframe.document, { childList: true, subtree: true });
627 }

Callers

nothing calls this directly

Calls 1

menu_valueFunction · 0.70

Tested by

no test coverage detected