您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
为导航栏新添加一个最新发表标签和点亮url
当前为
// ==UserScript== // @name MT论坛 // @namespace http://tampermonkey.net/ // @version 0.4 // @description 为导航栏新添加一个最新发表标签和点亮url // @author MT-戒酒的李白染 // @match *://bbs.binmt.cc/* // @icon https://bbs.binmt.cc/favicon.ico // @grant none // ==/UserScript== (function() { 'use strict'; //$.unique(yearArray); var ele = document.createElement('li'); var url = window.location.href; ele.id = "latest_publication" ele.innerHTML = '<a href="https:\/\/bbs.binmt.cc\/forum.php?mod=guide&view=newthread" hidefocus="true" title="最新发表">最新发表<\/a>'; document.getElementsByClassName("wp comiis_nvbox cl")[0].children[1].appendChild(ele); if(url=='https:\/\/bbs.binmt.cc\/forum.php?mod=guide&view=newthread') { ele.style.cssText='background: url("https:\/\/cdn2.bbs.binmt.cc\/template\/comiis_mi\/img\/nv_a.png") repeat-x 50% -50px;'; } var a = document.getElementsByClassName("t_f"); var i = 0; for(i=0;i<a.length;i++){ try{ var b = a[i].innerHTML; var c = b.replace(/\s/g,''); var d = /(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/g; var e = /="(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/g; var f = c.match(d).map(function(v) { return v.match(d);}); var g = c.match(e).map(function(v) { return v.match(e);}); var j = 0; var m = 0; var l = new Array(); var o = new Array(); for(j=0;j<g.length;j++){ var k = new Array(); k.push(g[j][0]); k[0] = k[0].replace('="',''); l.push(k[0]); } for(m =0;m<f.length;m++){ var n = new Array(); n.push(f[m][0]) o.push(n[0]); } console.log('1'+o) console.log('2'+l) function getArrDifference(arr1, arr2) { return arr1.concat(arr2).filter(function(v, i, arr) { return arr.indexOf(v) === arr.lastIndexOf(v); }); } var p = getArrDifference(l,o)[0] var q = '<a target="_blank" href="'+p+'" style="text-decoration:none;border: 1px solid #e74c3c;color: #c0392b;">'+p+'</a>'; a[i].innerHTML = b.replace(p,q) }catch(err){} } })();