// ==UserScript== // @name 扇贝单词小助手 // @namespace http://tampermonkey.net/ // @version 1.8.12 // @homepageURL https://greasyfork.org/zh-CN/scripts/419996-%E6%89%87%E8%B4%9D%E5%8D%95%E8%AF%8D%E5%B0%8F%E5%8A%A9%E6%89%8B // @description 数字小键盘快捷键,数字键3:US发音,数字键4:UK发音,数字5:扇贝单词与柯林斯词典的切换,数字6:例句发音,数字7:真题例句发音,数字0:隐藏展示柯林斯词典中的英文,专注模式,让你更专注背单词,黑暗模式,更护眼 // @author ddrrcc // @match https://web.shanbay.com/wordsweb/* // @grant GM_info // @grant GM_setValue // @grant GM_getValue // @connect greasyfork.org // @grant GM_xmlhttpRequest // @icon https://static.baydn.com/static/img/shanbay_favicon.png // @require https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js // @require https://cdn.bootcdn.net/ajax/libs/toastr.js/latest/js/toastr.min.js // @require https://cdn.bootcdn.net/ajax/libs/limonte-sweetalert2/10.12.5/sweetalert2.all.min.js // @grant unsafeWindow // @downloadURL none // ==/UserScript== (function(){function a(){document.webkitIsFullScreen||($(".Nav_nav__3kyeO").show(),$(".Nav_container__sBZA1").show(),$(".SubNav_itemsWrapper__1mM4u").show(),toastr.warning("\u9000\u51FA\u4E13\u6CE8\u6A21\u5F0F\uFF0C\u4E0D\u8981\u88AB\u5916\u754C\u5E72\u6270\u54DF\uFF01\u5EFA\u8BAE\u5F00\u542F\u4E13\u6CE8\u6A21\u5F0F\uFF01"))}function b(){$(".Nav_nav__3kyeO").hide(),$(".Nav_container__sBZA1").hide(),$(".SubNav_itemsWrapper__1mM4u").hide(),toastr.success("\u8FDB\u5165\u4E13\u6CE8\u6A21\u5F0F\uFF0C\u66F4\u4E13\u6CE8\u4E8E\u80CC\u5355\u8BCD\uFF01");let a=document.documentElement,b=a.requestFullScreen||a.webkitRequestFullScreen||a.mozRequestFullScreen||a.msRequestFullscreen;if(b)b.call(a);else if("undefined"!=typeof window.ActiveXObject){let a=new ActiveXObject("WScript.Shell");null!=a&&a.SendKeys("{F11}")}}function c(){$(".Nav_nav__3kyeO").show(),$(".Nav_container__sBZA1").show(),$(".SubNav_itemsWrapper__1mM4u").show(),toastr.warning("\u9000\u51FA\u4E13\u6CE8\u6A21\u5F0F\uFF0C\u4E0D\u8981\u88AB\u5916\u754C\u5E72\u6270\u54DF\uFF01\u5EFA\u8BAE\u5F00\u542F\u4E13\u6CE8\u6A21\u5F0F\uFF01");let a=document,b=a.cancelFullScreen||a.mozCancelFullScreen||a.msExitFullscreen||a.webkitExitFullscreen||a.exitFullscreen;if(b)b.call(a);else if("undefined"!=typeof window.ActiveXObject){let a=new ActiveXObject("WScript.Shell");null!=a&&a.SendKeys("{F11}")}}function d(){const a=document.createElement("style");a.id="theme-css-dark",a.innerHTML=` html{filter: invert(100%) hue-rotate(180deg);scrollbar-width: none;} ::-webkit-scrollbar{display:none} img,video {filter: invert(100%) hue-rotate(180deg);}`,document.querySelector("head").appendChild(a)}function e(){document.querySelector("#theme-css-dark").remove()}function f(){let a=new MutationObserver(function(a){a.forEach(function(){$(".index_exampleEN__3OIEA,.index_sentenceEn__1Qjgx").after(""),GM_getValue("check2")&&$(".btn.btn-primary.btn-xs").next().hide(),$(".btn.btn-primary.btn-xs").click(a=>{var b=$(a.target);b.next().toggle()}),$(".BayTrans_paraphrase__2JMIz,.CollinsTrans_pos__3szum,.CollinsTrans_paraphraseList__3SZ3y > li > span:nth-child(3),.index_name__1gkfJ").css({"font-weight":"bold"}),GM_getValue("check")&&$(".CollinsTrans_senseEn__17oYf").hide();var a=$(".index_tab__37Cha.index_active__1bHoy").html();i=!(a!=$(".index_tabNavs__3tWev:eq(0) > p:eq(1)").html()),i&&$(".index_audio__1mSVg:first > img").click(),$(".AppletTip_close__2lEIB").click()})});a.observe($(".StudyPage_studyPage__1Ri5C").get(0),{childList:!0})}var g=Math.abs;$(document.head).append(``),$(document.head).append(``);var h,i;const j=GM_info.script.version,k=GM_info.script.homepage,l=GM_info.script.name;toastr.options={positionClass:"toast-center-center"};var m=17>=g(window.screen.height-window.document.documentElement.clientHeight);window.onresize=function(){m=17>=g(window.screen.height-window.document.documentElement.clientHeight)},window.addEventListener("keydown",function(c){c=c||window.event,122!=c.keyCode||m||(c.preventDefault(),b(),document.addEventListener("webkitfullscreenchange",a,!0),document.addEventListener("mozfullscreenchange",a,!0))}),$(document).keydown(function(a){if((99==a.keyCode||51==a.keyCode)&&($(".index_trump__3bTaM:last").click(),$(".Pronounce_audio__3xdMh:last").click()),(100==a.keyCode||52==a.keyCode)&&($(".index_trump__3bTaM:first").click(),$(".Pronounce_audio__3xdMh:first").click()),101==a.keyCode||53==a.keyCode){var b=$(".index_tab__37Cha.index_active__1bHoy").html();h=b==$(".index_tabNavs__3tWev:eq(0) > p:eq(0)").html(),h?($(".index_tabNavs__3tWev:eq(0) > p:eq(1)").click(),h=!h):($(".index_tabNavs__3tWev:eq(0) > p:eq(0)").click(),h=!h)}(102==a.keyCode||54==a.keyCode)&&$(".index_icon__1IK2K").click(),(103==a.keyCode||55==a.keyCode)&&$(".index_audio__1mSVg:first > img").click(),(104==a.keyCode||56==a.keyCode)&&$(".btn.btn-primary.btn-xs").next().toggle(),(96==a.keyCode||48==a.keyCode)&&$(".CollinsTrans_senseEn__17oYf").toggle()});var n=document.createElement("div");n.innerHTML="
最新版本:${b}
`,footer:"\u4FDD\u6301\u6700\u65B0\u7248\u672C\uFF0C\u66F4\u597D\u7684\u4F53\u9A8C",confirmButtonText:"\u66F4\u65B0"}).then(b=>{b.value&&(window.open("https://greasyfork.org/"+$(a.response).find(".install-link").attr("href"),"_self"),setTimeout(()=>{Swal.fire({icon:"success",title:"\u63D0\u793A",allowOutsideClick:!1,allowEscapeKey:!1,html:"\u66F4\u65B0\u540E\uFF0C\u8BF7\u70B9\u51FB\u5237\u65B0",footer:"\u70B9\u51FB\u5237\u65B0\uFF0C\u52A0\u8F7D\u6700\u65B0\u7248\u672C",confirmButtonText:"\u5237\u65B0"}).then(a=>{a.value&&window.location.reload()})},500))})}})}()})();