您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
new features for PttChrome
当前为
// ==UserScript== // @name PttChrome Add-on // @namespace http://tampermonkey.net/ // @version 1.0 // @description new features for PttChrome // @author avan // @match iamchucky.github.io/PttChrome/* // @grant none // ==/UserScript== var option = { // For BlackList isHideAll : false, //隱藏黑名單推文 isHideViewImg : true, //隱藏黑名單圖片預覽 isHideViewVideo : true, //隱藏黑名單影片預覽 isReduceHeight : true, //是否調降黑名單推文高度 reduceHeight : "0.4", //設定高度值(單位em) isReduceOpacity : true, //是否調降黑名單推文透明值 reduceOpacity : "0.05", //設定透明值(單位em) // For General isAddFloorNum : true, //是否顯示推文樓層 }; var timerArray = []; var timestamp = Math.floor(Date.now() / 1000); (function() { 'use strict'; $("body").on('DOMSubtreeModified', "#mainContainer", function() { execInterval(); }); })(); function excute() { console.log("do excute"); var currentTS = Math.floor(Date.now() / 1000); var blackSpan = 'span[style="opacity:0.2"]'; if ($(blackSpan).length > 0) { if (option.isHideAll) { $(blackSpan).hide(); } else { option.isHideViewImg && $(blackSpan + ' img').hide(); option.isHideViewVideo && $(blackSpan + ' .easyReadingVideo').hide(); option.isReduceHeight && $(blackSpan).css({ 'height': option.reduceHeight + 'em', 'font-size': (option.reduceHeight/2) + 'em', 'line-height': option.reduceHeight + 'em' }); option.isReduceOpacity && $(blackSpan).css('opacity', option.reduceOpacity); } } if (option.isAddFloorNum && $("div#BBSWindow > div.main > div#mainContainer[style^='padding']").length > 0) { var $floor; var floorNum; if ($("span > span:contains('※ 文章網址:')").length > 0) { $floor = $("span[type='bbsrow'] > span:contains('※ 文章網址:')").parent().nextAll("span[type='bbsrow'][class^='blu_'][done!='true']"); floorNum = $("span[type='bbsrow'] > span:contains('※ 文章網址:')").parent().nextAll("span[type='bbsrow'][class^='blu_'][done='true']").length; } else { $floor = $("span[type='bbsrow'][class^='blu_'][done!='true']"); floorNum = $("span[type='bbsrow'][class^='blu_'][done='true']").length; } $floor.each(function ( index, element) { var $e = $(element); if ($e.find("span").length > 2) { var $div = $("<div>" + (index+1+floorNum) + "</div>"); $div.css({ 'float':'right', 'margin-right': '96.2%', 'height': '0em', 'font-size': '0.4em', 'font-weight':'bold', }); $e.prepend($div); $e.attr('done', 'true'); timestamp = Math.floor(Date.now() / 1000); } }); } if ((currentTS - timestamp) > 5) { stopInterval(); } } function execInterval() { if (timerArray.length === 0) { excute(); timerArray.push(setInterval(excute, 3000)); } } function stopInterval() { while (timerArray.length > 0) { clearInterval(timerArray .shift()); } }