您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
Try to make some useful functions to help bihu users. Changed the store position from cookie to localstorge.
当前为
// ==UserScript== // @name Bihu Addons // @namespace https://bihu.com/people/112225 // @version 0.3 // @description Try to make some useful functions to help bihu users. Changed the store position from cookie to localstorge. // @author Riley Ge // @match https://bihu.com/edit // @match https://bihu.com/people/* // @require https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js // @require https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js // @grant none // ==/UserScript== (function() { // Your code here... // add a button to the page and position it in the top left corner //var jqCookie = Cookies.noConflict(); $('body').append('<div id="rg_autosave_msg">自动保存已经开启,每5秒保存一次!</div>'); $("#rg_autosave_msg").css("position", "fixed").css("top", 50).css("left", 10).css("opacity", 0.4); $('body').append('<input article=0 type="button" value="加载草稿" id="rg_autosave_load">'); $("#rg_autosave_load").css("position", "fixed").css("top", 10).css("left", 10).css("opacity", 0.4); $('body').append('<input article=0 type="button" value="加载关注" id="rg_auto_load_unfollow">'); $("#rg_auto_load_unfollow").css("position", "fixed").css("top", 90).css("left", 10).css("opacity", 0.4); $('body').append('<input article=0 type="button" value="删除关注" id="rg_auto_unfollow">'); $("#rg_auto_unfollow").css("position", "fixed").css("top", 130).css("left", 10).css("opacity", 0.4); if(!window.localStorage){ //不支持localStorage的时候用Cookie来保存数据 $('#rg_autosave_load').click(function(){ $("#title")[0].value = Cookies.get('bihu_title'); // => 'value'; $("div.w-e-text").html(decodeURI(Cookies.get('bihu_content'))); }); var clks = setInterval(function(){ var title = $("#title")[0].value; if(title.length > 0) Cookies.set('bihu_title', title, { expires: 365 }); var content = $("div.w-e-text").html(); if(content != "<p><br></p>") Cookies.set('bihu_content', encodeURI(content), { expires: 365 }); },5000); }else{ var storage=window.localStorage; $('#rg_autosave_load').click(function(){ $("#title")[0].value = storage.getItem("bihu_title"); $("div.w-e-text").html(decodeURI(storage.getItem('bihu_content'))); }); var clks2 = setInterval(function(){ var title = $("#title")[0].value; if(title.length > 0) storage.setItem("bihu_title", title); var content = $("div.w-e-text").html(); if(content != "<p><br></p>") storage.setItem('bihu_content', encodeURI(content)); },5000); } var count = 1; $('#rg_auto_load_unfollow').click(function(){ //$("#title")[0].value = Cookies.get('bihu_title'); // => 'value'; //$("div.w-e-text").html(decodeURI(Cookies.get('bihu_content'))); var btn; if(count > 1 && count%5 ==0) { count++; btn=$("button.LoaderButton.load"); btn.click(); } $("#rg_autosave_msg").empty(); $("#rg_autosave_msg").append('加载更多关注。。。\r\n'); var clks = setInterval(function(){ btn=$("button.LoaderButton.load"); if(!btn.is(':visible') || count%5 == 0) { $("#rg_autosave_msg").empty(); $("#rg_autosave_msg").append('加载完成!'); loading = false; clearInterval(clks); //btn.hide(); }else{ count++; btn.click(); } },8000); }); $('#rg_auto_unfollow').click(function(){ //alert("cp button"); var lis; if(count == 5) lis=$("li.attention-item");//获取类名为attention-item-btn的Button所有标签 else lis=$("li.attention-item:gt("+((count-5)*20-1)+")");//获取类名为attention-item-btn的Button所有标签 var licount = 0; var clks2 = setInterval(function(){ while(true) { var value = lis[licount]; if(value == null) { clearInterval(clks2); $("#rg_autosave_msg").empty(); $("#rg_autosave_msg").append('删除完成!'); break; } if(value.children[0].src === "https://bihu2001.oss-cn-shanghai.aliyuncs.com/img/bihu_user_default_icon.png?x-oss-process=style/size_head" && value.children[1].children[0].innerText.substring(0,3) === "币友_") { value.children[2].click(); licount++; break; }else { licount++; continue; } } },1000*8); }); })();