检查重复.js
1016 Bytes
// ==UserScript==
// @name 检查重复
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://dpcms8.sysu.edu.cn/gp-dev/manage/menu/main
// @grant none
// ==/UserScript==
(function($) {
var getRandomColor = function() {
return '#' + (function(color) {
return (color += '0123456789abcdef' [Math.floor(Math.random() * 16)]) && (color.length == 6) ? color : arguments.callee(color);
})('');
}
$('a.menu-item__link').each(function(parentIndex, e) {
var color = getRandomColor();
var parent = $(this);
$('a.menu-item__link').each(function(index, e) {
if (parentIndex == index) {
return true;
}
if (parent.attr('href') == '/gp-dev/') {
return false;
}
if ($(this).attr('href') == parent.attr('href')) {
$(this).css('background', color);
parent.css('background', color);
}
});
});
})(jQuery);