Skip to content

Instantly share code, notes, and snippets.

@hui-shao
Last active December 12, 2022 09:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hui-shao/e860c1a5d4ac35d09fb646b7e665db86 to your computer and use it in GitHub Desktop.
Save hui-shao/e860c1a5d4ac35d09fb646b7e665db86 to your computer and use it in GitHub Desktop.
雨课堂显示PPT-去掉"当前页面有动画"提示
// ==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