您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds a gallery mode and title to customBoardList.
当前为
// ==UserScript== // @name 4chan Gallery // @version 1.0.3 // @description Adds a gallery mode and title to customBoardList. // @include *://boards.4chan.org/* // @namespace https://greasyfork.org/users/3159 // ==/UserScript== function s(q){var b = document.getElementById(q);return b} setTimeout(function(){ var boardname = document.getElementsByClassName('boardTitle')[0].innerHTML.split('/ - ')[1]; var boardlink = document.location.href.split('thread/')[0]; var cb = document.getElementsByClassName('customBoardList'),a = 0; cb[0].insertAdjacentHTML('afterbegin','[<a href="' + boardlink + '">' + boardname + '</a>] '); cb[1].insertAdjacentHTML('afterbegin','[<a href="' + boardlink + '">' + boardname + '</a>] '); if (document.location.href.indexOf('/thread/') > 0){ cb[0].insertAdjacentHTML('beforeend','[<a id="glink" href="#">Gallery</a>]'); cb[1].insertAdjacentHTML('beforeend','[<a id="glink2" href="#">Gallery</a>]'); s("glink").onclick=function(){view()}; s("glink2").onclick=function(){view()}; s('bottom').insertAdjacentHTML('afterend','<div id="bg" style="opacity:0.9;position:fixed;top:0;left:0;z-index:9999;background-color:black;width:100%;height:100%;display:none"></div><div id="inner""></div>'); var imgs = document.getElementsByClassName('fileThumb'); var arw = 'position:absolute;z-index:10000;top:calc(50% - 30px);border-top: 15px solid transparent;border-bottom: 15px solid transparent;display:none;' s('inner').insertAdjacentHTML('afterend','<div id="larrow" style="' + arw + 'border-right: 20px solid #bababa;left:5px"></div>'); s('inner').insertAdjacentHTML('afterend','<div id="rarrow" style="' + arw + 'border-left: 20px solid #bababa;right:5px"></div>'); s('larrow').onclick=function(){if(a>0){a--;s('inner').children[0].src = imgs[a].getAttribute('href');nbr()}}; s('rarrow').onclick=function(){if(a<(imgs.length-1)){a++;s('inner').children[0].src = imgs[a].getAttribute('href');nbr()}}; s('larrow').insertAdjacentHTML('afterend','<p id="n" style="color:white;margin:0;position:absolute;bottom:0;right:0;z-index:10000;display:none">[' + (a+1) + '/' + imgs.length + ']</p>'); s('bg').onclick=function(){this.style.display = 'none';s('inner').style.display = 'none';s('larrow').style.display = 'none';s('rarrow').style.display = 'none';s('n').style.display = 'none'}; function view(){ s('bg').style.display = 'block'; s('inner').style.display = 'block'; s('larrow').style.display = 'block'; s('rarrow').style.display = 'block'; s('n').style.display = 'block'; if (a<1){ var img = new Image(); img.style.cssText="position:absolute;z-index:10000;max-height:calc(100% - 40px);max-width:calc(100% - 60px);top:0;bottom:0;margin-top:auto;margin-bottom:auto;margin-left:auto;margin-right:auto;left:0;right:0"; img.src = imgs[0].getAttribute('href'); img.onclick = function(){ if (a < (imgs.length - 1)){ a++; img.src = imgs[a].getAttribute('href'); nbr(); } } s('inner').appendChild(img); } } function nbr(){ s('n').innerHTML = '[' + (a+1) + '/' + imgs.length + ']'; } } }, 1000);