您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
functions: shows how many new words in past 2 weeks, automatically refreshes when you are almost out of time, changes accuracy percantages (locally obviously) on home page
当前为
// ==UserScript== // @name Membean Tools // @version 0.696969 // @description functions: shows how many new words in past 2 weeks, automatically refreshes when you are almost out of time, changes accuracy percantages (locally obviously) on home page // @author You // @match *://*.membean.com/dashboard/training-sessions/* // @match *://*.membean.com/dashboard/training-history* // @match *://*.membean.com/training_sessions/* // @match *://*.membean.com/dashboard // @match *://*.membean.com/dashboard?* // @grant GM_setValue // @grant GM_getValue // @grant window.close // @require https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js // @namespace https://gf.qytechs.cn/users/706584 // ==/UserScript== (function() { 'use strict'; var $ = window.jQuery; var url=window.location.href; var jqNewButton="html>body>div:eq(0)>div>div>div>div>div:eq(1)>main>div>div>div>ul>li:eq(4)>span"; var jqNewWords="html>body>div:eq(0)>div>div>div>div>div:eq(1)>main>div>div>div>div:eq(4)>div>div>div:eq(0)>div>span>strong>span"; $( document ).ready(()=>{ // Your code here... if(url.indexOf("dashboard")>-1&&url.indexOf("training-sessions")<=-1&&url.indexOf("training-history")<=-1){ let i=0; let I=setInterval(()=>{ if($("html>body>div:eq(0)>div>div>main>div:eq(1)>div:eq(0)>section>div:eq(1)>ul>li:eq(0)>div:eq(1)>p>span:eq(0)").width()!=null){ if($("html>body>div:eq(0)>div>div>main>div:eq(1)>div:eq(0)>section>div:eq(1)>ul>li:eq("+i+")>div:eq(1)>p>span:eq(0)").width()!=null){ i++; } else{ clearInterval(I); callBack(i); } } function callBack(param){ for(let i=0;i<=param;i++){ $("html>body>div:eq(0)>div>div>main>div:eq(1)>div:eq(0)>section>div:eq(1)>ul>li:eq("+i+")>div:eq(1)>p>span:eq(0)").css("color","#6d6e71"); $("html>body>div:eq(0)>div>div>main>div:eq(1)>div:eq(0)>section>div:eq(1)>ul>li:eq("+i+")>div:eq(1)>p>span:eq(0)").text(randInt(79,95)+"% accuracy"); $("html>body>div:eq(0)>div>div>main>div:eq(1)>div:eq(0)>section>div:eq(1)>ul>li:eq("+i+")>p>button").html(""); } } },10); } if(url.indexOf("user_state")>-1){ let i=setInterval(()=>{ var timeElapsed=$("html>body>div:eq(0)>div:eq(1)>div>div:eq(1)>div:eq(3)>div>div:eq(3)>div>div>div:eq(0)>div").width(); if(timeElapsed!=null){ //alert(""); $("html>body>div:eq(0)>div:eq(1)>div>div:eq(1)>div:eq(3)>div>div:eq(3)>div>div>div:eq(1)>div").text(timeElapsed); if(timeElapsed>150){ location.reload(); clearInterval(i); } } //else{alert("aa");} },50); } if(url.indexOf("training-sessions")>-1){ var interval=setInterval(()=>{ if($(jqNewButton).length){//if exists $(jqNewButton).click(); var newWords; if($(jqNewWords).text().indexOf("new words")>-1){ newWords=parseInt($(jqNewWords).text().split(" new words")[0],10);//i.e. get "10" in "10 new words were introduced in this session." as int }else{ newWords=0; } if(GM_getValue("subtract",false)!=true){ GM_setValue("total",parseInt(GM_getValue("total",0),10)+newWords); }else{ GM_setValue("total",parseInt(GM_getValue("total",0),10)-newWords); } GM_setValue("closed",true); window.close(); clearInterval(interval); } },50); } function twoDigits(n){return n<10? '0'+n:''+n;} if(url.indexOf("training-history")>-1){ //GM_setValue("checkedSessions","{}"); //GM_setValue("total",0); var twbt = new Date();//(two weeks before today) var cd=new Date();//(current date) var urlParam="";//?startAt=2020-11-03T00:00:00-05:00&endAt=2020-11-17T11:05:22-05:00 encoded: ?startAt=2020-11-03T00%3A00%3A00-05%3A00&endAt=2020-11-17T11%3A05%3A22-05%3A00 twbt.setDate(twbt.getDate() - (7*2)); urlParam="?startAt="+twbt.getFullYear()+"-"+twoDigits(twbt.getMonth()+1)+"-"+twoDigits(twbt.getDate())+"T00:00:00-05:00&endAt="+cd.getFullYear()+"-"+twoDigits(cd.getMonth()+1)+"-"+twoDigits(cd.getDate())+"T11:05:22-05:00"; if(!(url.indexOf(urlParam)>-1)){ window.location.href="https://membean.com/dashboard/training-history"+urlParam; } var intrval = setInterval(()=>{ var currentHrefs={};//will store the ids on the current page if($("html>body>div:eq(0)>div>div>div>div>div:eq(1)>main>div>div>div:eq(1)>ul>li:eq(0)>a").length){ //makeButton(); var i=0; var intervaal=setInterval(()=>{ if($("html>body>div:eq(0)>div>div>div>div>div:eq(1)>main>div>div>div:eq(1)>ul>li:eq("+i+")>a").length){ if(GM_getValue("closed",true)==true){ var linkHref=$("html>body>div:eq(0)>div>div>div>div>div:eq(1)>main>div>div>div:eq(1)>ul>li:eq("+i+")>a").attr("href"); var sessionID=linkHref.split("/training-sessions/")[1];//the number after /training-sessions/ var checkedSessionsJSON=JSON.parse(GM_getValue("checkedSessions","{}")); currentHrefs[sessionID]=="checked"; if(!(checkedSessionsJSON[sessionID]=="checked")){//if didnt check session already checkedSessionsJSON[sessionID]="checked";//add current sessionID to JSON GM_setValue("checkedSessions",JSON.stringify(checkedSessionsJSON));//GM_setValue can not store arrays so stringify and parse are used. ///////// window.open(linkHref); GM_setValue("closed",false); updateText(parseInt(GM_getValue("total",0),10)); } i++; updateText(parseInt(GM_getValue("total",0),10)); } } else{ for(var id in checkedSessionsJSON){ //check if there are sessions that are contributing to the total word counter but are from a time before two days ago if(!(currentHrefs[id]=="checked")){ //subtract minutes in that session from total GM_setValue("subtract",true); window.open("https://membean.com/dashboard/training-sessions/"+id); delete checkedSessionsJSON[id]; GM_setValue("checkedSessions",JSON.stringify(checkedSessionsJSON)); updateText(parseInt(GM_getValue("total",0),10)); } } clearInterval(intervaal); } },50); clearInterval(intrval); } },1000); } function updateText(a){ var jqTHText="html>body>div:eq(0)>div>div>div>div>div:eq(0)>div>div:eq(1)>h1"; if($(jqTHText).text!="Training History |\n"+a+" new words in the past 2 weeks"){ $(jqTHText).text("Training History |\n"+a+" new words in the past 2 weeks"); } } function makeButton(){ var button = document.createElement('button'); button.style.top = 0; button.style.left = 0; button.style.width = 50; button.style.height = 50; button.style.position = "fixed"; button.innerHTML="click to check words again"; document.body.appendChild(button); } function randInt(min, max) { return Math.floor(Math.random() * (max - min + 1) ) + min; } function rand(min,max){ return (Math.random() * (min - max) + max).toFixed(2); } }); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址