// ==UserScript== // @name 扇贝单词小助手 // @namespace http://tampermonkey.net/ // @version 1.8.20 // @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 // @grant GM_registerMenuCommand // @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(a){$(".BayTrans_paraphrase__2JMIz,.CollinsTrans_pos__3szum,.CollinsTrans_paraphraseList__3SZ3y > li > span:nth-child(3),.index_name__1gkfJ").css({"font-size":a+`px`,"font-weight":"bold"});var b=$(".BayTrans_paraphrase__2JMIz > p");console.log(b);let c=1;for(let d of b)console.log("s",$(d)),$(d).children().first().before(""+c+". "),c++;b.css({"margin-top":"6px"})}function b(){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 c(){$(".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 d(){$(".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 e(){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 f(){document.querySelector("#theme-css-dark").remove()}function g(a){return null!=a&&-1 span").click():void(a=$(".index_unfold__3BwCB > span").html(),g(a))}function h(){let b=new MutationObserver(function(){function b(a){let b=new MutationObserver(function(){g(a)});b.observe($(".span12.block-center > div > div:last > div:last").get(0),{childList:!0})}if(p=r.getValue("current_val"),$(".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()}),$(".CollinsTrans_paraphraseList__3SZ3y > li > span:nth-child(3)").after("  "),$(".btn.btn-link.btn-xs").click(a=>{var b=$(a.target);b.prev().prev().toggle()}),$(".BayTrans_paraphrase__2JMIz > p").css({"font-size":`inherit`}),a(p),GM_getValue("check")&&$(".CollinsTrans_senseEn__17oYf").hide(),GM_getValue("check3")){var c=$(".index_tab__37Cha.index_active__1bHoy").html();l=c==$(".index_tabNavs__3tWev:eq(0) > p:eq(1)").html(),l&&$(".index_audio__1mSVg:first > img").click()}if($(".AppletTip_close__2lEIB").click(),GM_getValue("check4")){q=$(".index_unfold__3BwCB > span").html();try{b(q)}catch(a){}}});b.observe($(".StudyPage_studyPage__1Ri5C").get(0),{childList:!0})}function i(){let a=new MutationObserver(function(){try{h()}catch(a){}});a.observe($(".Layout_main__2_zw8").get(0),{childList:!0})}var j=Math.abs;$(document.head).append(``),$(document.head).append(``);var k,l;const m=GM_info.script.version,n=GM_info.script.homepage,o=GM_info.script.name;var p,q;let r={getValue(a){return GM_getValue(a)},setValue(a,b){GM_setValue(a,b)}};({initValue(){[{name:"current_val",value:15},{name:"has_init",value:!1}].forEach(a=>{r.getValue(a.name)===void 0&&r.setValue(a.name,a.value)})},showSetting(){Swal.fire({title:"\u8BF7\u9009\u62E9\u5B57\u4F53\u5927\u5C0F",icon:"info",input:"range",showCancelButton:!0,confirmButtonText:"\u4FDD\u5B58",cancelButtonText:"\u8FD8\u539F",showCloseButton:!0,inputLabel:"\u62D6\u52A8\u6ED1\u5757\u89C2\u5BDF\u5B57\u4F53\u5927\u5C0F\u53D8\u5316",inputAttributes:{min:15,max:25,step:.1},footer:"
\u53EF\u70B9\u51FB \u56FE\u6807 -> \u6247\u8D1D\u5355\u8BCD\u5C0F\u52A9\u624B -> \u5B57\u4F53\u5927\u5C0F\u8BBE\u7F6E \u6253\u5F00\u672C\u9875\u9762
",inputValue:r.getValue("current_val")}).then(b=>{r.setValue("has_init",!0),b.isConfirmed&&(p=r.getValue("current_val"),r.setValue("current_val",b.value),a(p)),b.isDismissed&&"cancel"===b.dismiss&&(r.setValue("current_val",15),p=r.getValue("current_val"),a(p))}),document.getElementById("swal2-input").addEventListener("change",b=>{r.setValue("current_val",b.target.value),p=r.getValue("current_val"),a(p)})},registerMenuCommand(){GM_registerMenuCommand("\u5B57\u4F53\u5927\u5C0F\u8BBE\u7F6E",()=>{this.showSetting()})},init(){this.initValue(),r.getValue("has_init")||this.showSetting(),this.registerMenuCommand()}}).init(),toastr.options={positionClass:"toast-center-center"};var s=17>=j(window.screen.height-window.document.documentElement.clientHeight);window.onresize=function(){s=17>=j(window.screen.height-window.document.documentElement.clientHeight)},window.addEventListener("keydown",function(a){a=a||window.event,122!=a.keyCode||s||(a.preventDefault(),c(),document.addEventListener("webkitfullscreenchange",b,!0),document.addEventListener("mozfullscreenchange",b,!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();k=c==$(".index_tabNavs__3tWev:eq(0) > p:eq(0)").html(),k?($(".index_tabNavs__3tWev:eq(0) > p:eq(1)").click(),k=!k):($(".index_tabNavs__3tWev:eq(0) > p:eq(0)").click(),k=!k)}(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(),13==a.keyCode&&(0==$(".index_tenseAnswer__2o47S").length?$(".index_continueBtn__34NqT").click():$(".index_tenseAnswer__2o47S").click())}});var u=document.createElement("div");u.innerHTML="
\u6700\u5C0F\u5316/\u8FD8\u539F


\u5FEB\u6377\u952E\u63D0\u793A




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
V/0\uFF1A\u9690\u85CF\u5C55\u793A\u67EF\u6797\u65AF\u8BCD\u5178\u4E2D\u7684\u82F1\u6587
Enter\uFF1A\u62FC\u5199\u6A21\u5F0F\u4E0B\u67E5\u770B\u6B63\u786E\u7B54\u6848/\u7EE7\u7EED
\u53EF\u70B9\u51FB \u56FE\u6807->\u6247\u8D1D\u5355\u8BCD\u5C0F\u52A9\u624B->\u5B57\u4F53\u5927\u5C0F\u8BBE\u7F6E
\u66F4\u65B0\u65E5\u5FD7\u4E0E\u4F7F\u7528\u8BF4\u660E
",document.body.appendChild(u),$(".onea").click(()=>{$("#showorhide").toggle("slow")}),$("#open").click(()=>{c()}),$("#close").click(()=>{d()}),$("#change").click(()=>{w()}),$("#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"))}),$("#fourinput").attr("checked",GM_getValue("check4")),$("#fourinput").click(()=>{GM_setValue("check4",$("#fourinput").is(":checked"))});let v="light";const w=()=>{"light"===v?(e(),v="dark"):(f(),v="light")};var x=setInterval(()=>{("\u5F00\u59CB\u5B66\u4E60"==$(".index_button__9uno8 > span").html()||"\u7EE7\u7EED\u5B66\u4E60"==$(".index_button__9uno8 > span").html())&&(clearInterval(x),$(".index_button__9uno8").click(()=>{c()}))},800),t=setInterval(()=>{"\u6253\u5361"==$(".StudyDone_checkinBtn__3DuXc").html()&&(clearInterval(t),$(".StudyDone_checkinBtn__3DuXc").click(()=>{d()}))},1e3);try{i()}catch(a){}(function(){GM_xmlhttpRequest({url:n,method:"get",headers:{"Content-type":"application/x-www-form-urlencoded"},onload:function(a){const b=$(a.response).find(".install-link").attr("data-script-version");m!=b&&Swal.fire({icon:"info",title:"\u68C0\u6D4B\u5230\u65B0\u7248\u672C",allowOutsideClick:!1,allowEscapeKey:!1,html:`当前《${o}》不是最新版本
当前版本:${m}

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