// ==UserScript== // @license MIT // @name ata 演示模式 // @namespace http://tampermonkey.net/ // @version 0.2 // @description 给 ata 添加演示模式按钮 // @author You // @match https://ata.alibaba-inc.com/articles/* // @icon https://www.google.com/s2/favicons?sz=64&domain=alibaba-inc.com // @grant unsafeWindow // @downloadURL none // ==/UserScript== (function() { console.log("好的,我们开始添加全屏按钮。"); let myId="guangfeng_fullscreen" function hook(){ var fullscreenButton=document.createElement('a'); fullscreenButton.id=myId fullscreenButton.text="📺 进入演示模式"; fullscreenButton.href="javascript:document.querySelectorAll('div[class^=left_],div[class^=nav_]').forEach(el => el.style.display = 'none');document.body.style.zoom = '200%';document.documentElement.requestFullscreen()"; document.querySelector('div[class^=meta-action_]').appendChild(fullscreenButton); }; var hookInterval = setInterval(function(){ console.log("开始检查,失败重试。"); if(document.querySelector("#"+myId)){ clearInterval(hookInterval); }else{ hook(); } }, 200); })();