// ==UserScript== // @name 粉笔课堂显示暂停遮罩 // @namespace http://tampermonkey.net/ // @version 0.5 // @description 暂停时显示遮罩,可点击的图标在鼠标悬停时变为手形 // @author AN drew // @match https://pc.fenbi.com/webclass/class/* // @require http://libs.baidu.com/jquery/2.0.0/jquery.min.js // @require http://cdn.bootcss.com/jquery-cookie/1.4.1/jquery.cookie.min.js // @grant none // @downloadURL none // ==/UserScript== (function() { 'use strict'; if($.cookie("maskon")==undefined) $.cookie('maskon', "1", { expires: 365, path: "/", domain: "fenbi.com" }); var maskon = $.cookie("maskon") var styles=".switcher {"+ " width:160px;"+ " position:absolute;"+ " left:880px;"+ " user-select:none;"+ " cursor:pointer;"+ "}"+ ".btn_fath {"+ " margin-top:12px;"+ " position:relative;"+ " border-radius:16px;"+ " margin-top:15px;"+ " float:left;"+ "}"+ ".tip{"+ " float:left;"+ " font-size:14px;"+ " line-height: 50px;"+ "}"+ ".btn1 {"+ " float:left;"+ "}"+ ".btn2 {"+ " float:right;"+ "}"+ ".btnSwitch {"+ " height:20px;"+ " width:25px;"+ " border:none;"+ " color:#fff;"+ " line-height:20px;"+ " font-size:12px;"+ " text-align:center;"+ " z-index:1;"+ "}"+ ".move {"+ " z-index:100;"+ " width:18px;"+ " border-radius:18px;"+ " height:18px;"+ " position:absolute;"+ " cursor:pointer;"+ " border:1px solid #828282;"+ " background-color:#f1eff0;"+ " box-shadow:1px 2px 2px 1px #fff inset,0 0 5px 1px #999;"+ "}"+ ".on .move {"+ " left:30px;"+ "}"+ ".on.btn_fath {"+ " background-color:#44b549;"+ " height:20px"+ "}"+ ".off.btn_fath {"+ " background-color:#828282;"+ " height:20px"+ "}"+ ".toolbtn.speed{color:black!important}"+ ".toolbtn.speed:hover{color:white!important}"+ ".progress-bg{z-index:5000}"+ "#breviary{z-index:5000}"+ ".wrap.push{z-index:5000}"+ ".wrap.pull{z-index:5000}"+ "#rightBlock{z-index:5000}"+ ".breviary-bottom-panel{height:17px!important;margin-top:-4px!important}"+ ".toolbtn-big{cursor:pointer}"+ ".keynote-btn{cursor:pointer}"+ ".toolbtn{cursor:pointer}"+ ".pull{cursor:pointer}"+ ".push{cursor:pointer}"+ ".nav-link{cursor:pointer}"+ "#playBtn{cursor:pointer}"+ ".header-wrapper h3{color:black!important}"+ "p.ng-star-inserted span, .clock.ng-star-inserted{color:black!important}"+ ".keynote-btn.pre+span{color:black!important}"+ ".like, .unlike:hover{cursor:pointer;background:url(https://nodestatic.fbstatic.cn/weblts_spa_online/webclass/static/star.00c51cc376f8088c8f23.svg)!important;width:20px;height:20px}"+ ".unlike{cursor:pointer;background:url(https://gitee.com/AN_drew/picBed/raw/master/img/empty-star.svg)!important}"+ ".icon-close{cursor:pointer}" $("head").append("") var $switcher = $('
'+ ' 显示暂停遮罩 '+ '
'+ '
'+ '
'+ '
'+ '
'+ '
') if($.cookie("maskon")=="0") { $switcher.find(".btn_fath").removeClass("on").addClass("off"); $switcher.find(".move").attr("data-state", "off"); } $switcher.click(function(){ var ele = $(this).find(".move"); var fath = $(this).find(".btn_fath"); if (ele.attr("data-state") == "on") { ele.animate({ left: "0" }, 100, function() { ele.attr("data-state", "off"); }); fath.removeClass("on").addClass("off"); $.cookie('maskon', "0", { expires: 365, path: "/", domain: "fenbi.com" }); } else if (ele.attr("data-state") == "off") { ele.animate({ left: '30px' }, 100, function() { ele.attr("data-state", "on"); }); fath.removeClass("off").addClass("on"); $.cookie('maskon', "1", { expires: 365, path: "/", domain: "fenbi.com" }); } }) setInterval(function(){ if($(".switcher").length==0) $(".jubao").before($switcher); }) $(".progress-bg").click(function(){ $(".toolbtn-big").removeClass("play") }) $(".canvas_container").click(function(){ $(".toolbtn-big").get(0).click() }) $(".mask").click(function(){ $(".toolbtn-big").get(0).click() }) $(".toolbtn-big").click(function(){ if($(".toolbtn-big").hasClass("play") && $.cookie("maskon")=="1") $("#playWrap").show() else $("#playWrap").hide() }) $(".toolbtn.fullScreen").click(function(e){ var el = e.srcElement || e.target; //target兼容Firefox var isFullscreen = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen; if (!isFullscreen) { //进入全屏,多重短路表达式 (el.requestFullscreen && el.requestFullscreen()) || (el.mozRequestFullScreen && el.mozRequestFullScreen()) || (el.webkitRequestFullscreen && el.webkitRequestFullscreen()) || (el.msRequestFullscreen && el.msRequestFullscreen()); } else { //退出全屏,三目运算符 document.exitFullscreen ? document.exitFullscreen() : document.mozCancelFullScreen ? document.mozCancelFullScreen() : document.webkitExitFullscreen ? document.webkitExitFullscreen() : ''; } }) setInterval(function(){ if($(".nav-item:nth-of-type(1)").find(".nav-link").hasClass("active")) $(".nav-item:nth-of-type(1)").find("span").css({"color":"black"}) else $(".nav-item:nth-of-type(1)").find("span").css({"color":"#999"}) if($(".toolbtn-big").hasClass("play") && $.cookie("maskon")=="1") $("#playWrap").show() else $("#playWrap").hide() $(".pull").click(); $(".toolbtn.volume").parent().css({"z-index":"6000"}) $(".toolbtn.speed").parent().css({"z-index":"6000"}) },100) // Your code here... })();