Adds a gallery mode and title to customBoardList.
当前为
// ==UserScript==
// @name 4chan Gallery
// @version 1.0.0
// @description Adds a gallery mode and title to customBoardList.
// @include *://boards.4chan.org/*
// @namespace https://greasyfork.org/users/3159
// ==/UserScript==
var boardname = document.getElementsByClassName('boardTitle')[0].innerHTML.split('/ - ')[1];
var boardlink = document.location.href.split('thread/')[0];
var cb = document.getElementsByClassName('customBoardList');
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>]');
document.getElementById("glink").onclick=function(){view()};
document.getElementById('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>');
document.getElementById("bg").onclick=function(){this.style.display = 'none';document.getElementById("inner").style.display = 'none'};
var a = 0;
function view(){
document.getElementById("bg").style.display = 'block';
document.getElementById("inner").style.display = 'block';
if (a<1){
a++;
var imgs = document.getElementsByClassName('fileThumb');
var img = new Image();
img.style.cssText="position:absolute;z-index:10000;max-height:95%;max-width:95%;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(){
img.src = imgs[a].getAttribute('href');
a++;
}
document.getElementById("inner").appendChild(img);
}
}
}