// ==UserScript== // @name 扇贝单词小助手 // @namespace http://tampermonkey.net/ // @version 1.8.14 // @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:隐藏展示柯林斯词典中的英文,专注模式,让你更专注背单词,黑暗模式,更护眼。显示/隐藏扇贝例句和柯林斯例句中文翻译的按钮,并关联数字键8 // @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(){if($(".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(),GM_getValue("check3")){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,b){if(!b){if((99==a.keyCode||51==a.keyCode||79==a.keyCode)&&($(".index_trump__3bTaM:last").click(),$(".Pronounce_audio__3xdMh:last").click()),(100==a.keyCode||52==a.keyCode||73==a.keyCode)&&($(".index_trump__3bTaM:first").click(),$(".Pronounce_audio__3xdMh:first").click()),101==a.keyCode||53==a.keyCode||85==a.keyCode){var c=$(".index_tab__37Cha.index_active__1bHoy").html();h=c==$(".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||70==a.keyCode)&&$(".index_icon__1IK2K").click(),(103==a.keyCode||55==a.keyCode||71==a.keyCode)&&$(".index_audio__1mSVg:first > img").click(),(104==a.keyCode||56==a.keyCode||72==a.keyCode)&&$(".btn.btn-primary.btn-xs").next().toggle(),(96==a.keyCode||48==a.keyCode||86==a.keyCode)&&$(".CollinsTrans_senseEn__17oYf").toggle(),75==a.keyCode&&$(".index_option__1CVr2.index_red__VSPTN").click(),74==a.keyCode&&$(".index_option__1CVr2.index_green__2lFgU").click(),76==a.keyCode&&$(".StudyPage_nextBtn__1ygGn").click()}});var n=document.createElement("div");n.innerHTML="
\u6700\u5C0F\u5316/\u8FD8\u539F


\u5FEB\u6377\u952E\u63D0\u793A
V/0\uFF1A\u9690\u85CF\u5C55\u793A\u67EF\u6797\u65AF\u8BCD\u5178\u4E2D\u7684\u82F1\u6587



J/1\uFF1A\u9009\u62E91
K/2\uFF1A\u9009\u62E92
O/3\uFF1AUS\u53D1\u97F3
I/4\uFF1AUK\u53D1\u97F3
U/5\uFF1A\u6247\u8D1D\u4E0E\u67EF\u6797\u65AF\u5207\u6362
F/6\uFF1A\u4F8B\u53E5\u53D1\u97F3
G/7\uFF1A\u771F\u9898\u4F8B\u53E5\u53D1\u97F3
H/8\uFF1A\u4F8B\u53E5\u7FFB\u8BD1\u663E\u793A\u4E0E\u9690\u85CF
L/. \uFF1A\u4E0B\u4E00\u4E2A
",document.body.appendChild(n),$("#onea").click(()=>{$("#showorhide").toggle("slow")}),$("#open").click(()=>{b()}),$("#close").click(()=>{c()}),$("#change").click(()=>{p()}),$("#oneinput").attr("checked",GM_getValue("check")),$("#oneinput").click(()=>{GM_setValue("check",$("#oneinput").is(":checked"))}),$("#twoinput").attr("checked",GM_getValue("check2")),$("#twoinput").click(()=>{GM_setValue("check2",$("#twoinput").is(":checked"))}),$("#threeinput").attr("checked",GM_getValue("check3")),$("#threeinput").click(()=>{GM_setValue("check3",$("#threeinput").is(":checked"))});let o="light";const p=()=>{"light"===o?(d(),o="dark"):(e(),o="light")};var q=setInterval(()=>{("\u5F00\u59CB\u5B66\u4E60"==$(".index_button__9uno8 > span").html()||"\u7EE7\u7EED\u5B66\u4E60"==$(".index_button__9uno8 > span").html())&&(clearInterval(q),$(".index_button__9uno8").click(()=>{b()}))},800),r=setInterval(()=>{"\u6253\u5361"==$(".StudyDone_checkinBtn__3DuXc").html()&&(clearInterval(r),$(".StudyDone_checkinBtn__3DuXc").click(()=>{c()}))},1e3);(function(){let a=new MutationObserver(function(){f()});a.observe($(".Layout_main__2_zw8").get(0),{childList:!0})})(),function(){GM_xmlhttpRequest({url:k,method:"get",headers:{"Content-type":"application/x-www-form-urlencoded"},onload:function(a){const b=$(a.response).find(".install-link").attr("data-script-version");j!=b&&Swal.fire({icon:"error",title:"\u68C0\u6D4B\u5230\u65B0\u7248\u672C",allowOutsideClick:!1,allowEscapeKey:!1,html:`当前《${l}》不是最新版本
当前版本:${j}

最新版本:${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))})}})}()})();