Last active
December 12, 2022 09:35
-
-
Save hui-shao/e860c1a5d4ac35d09fb646b7e665db86 to your computer and use it in GitHub Desktop.
雨课堂显示PPT-去掉"当前页面有动画"提示
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name 雨课堂显示PPT-去掉"当前页面有动画"提示 | |
// @namespace https://github.com/hui-shao | |
// @homepage https://greasyfork.org/zh-CN/scripts/447478 | |
// @homepageURL https://greasyfork.org/zh-CN/scripts/447478 | |
// @license GPLv3 | |
// @version 0.3 | |
// @description 自动移除"当前页面有动画,请听老师讲解"的遮罩(在雨课堂上课界面右上角也添加了按钮,也可手动点击) | |
// @author hui-shao | |
// @match https://*.yuketang.cn/lesson/fullscreen/v* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=yuketang.cn | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
// Your code here... | |
function createButton() { | |
//alert("btn"); | |
var button = document.createElement("button"); | |
button.id = "btn001"; | |
button.textContent = "移除"; | |
button.style.color = "black"; | |
button.style.width = "100px"; | |
button.style.height = "80%"; | |
button.style.align = "center"; | |
button.style.marginTop = "0.2%"; | |
button.style.marginRight = "1.5%"; | |
document.querySelector(".lesson__header").appendChild(button); | |
button.onclick = function () { | |
console.log("[Script] Pressed the button."); | |
myRemove(); | |
}; | |
} | |
function myRemove() { | |
console.log("[Script] Tried to remove."); | |
document.querySelector(".slide__cmp").style.display=""; | |
document.querySelector(".ppt__modal.box-center").style.display="none"; | |
} | |
document.onreadystatechange = ()=>{ | |
if(document.readyState == "complete") { | |
console.log("[Script] Tried to Create Btn"); | |
createButton(); | |
const targetNode = document.querySelector(".slide__wrap.box-center"); | |
const config = { attributes: true, childList: true, subtree: true }; | |
const callback = function(mutationsList, observer) { | |
// Use traditional 'for loops' for IE 11 | |
for(let mutation of mutationsList) { | |
if (mutation.type === 'childList') { | |
console.log('[Script] A child node has been added or removed.'); | |
} | |
else if (mutation.type === 'attributes') { | |
console.log('[Script] The ' + mutation.attributeName + ' attribute was modified.'); | |
} | |
} | |
myRemove(); // Auto Remove when DOM changes | |
}; | |
const observer = new MutationObserver(callback); | |
observer.observe(targetNode, config); | |
} | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment