4chan Gallery

Adds a gallery mode and title to customBoardList.

Stan na 27-09-2014. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==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);
	}
	
}
}