Open Links in New Tabs

Change the target attribute of specific anchor object to '_blank'

Verze ze dne 21. 01. 2017. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name            Open Links in New Tabs
// @description     Change the target attribute of specific anchor object to '_blank'
// @include         http://exhentai.org/*
// @include         https://exhentai.org/*
// @include         http://e-hentai.org/*
// @include         https://e-hentai.org/*
// @include         http://g.e-hentai.org/*
// @include         https://g.e-hentai.org/*
// @version 0.0.1.20170121224917
// @namespace https://greasyfork.org/users/2233
// ==/UserScript==

var wnd = window
var doc = wnd.document
var loc = location
var href = loc.href

var $  = function(e, css) { if(!css) { css=e; e=doc }; return e.querySelector(css) }
var $$ = function(e, css) { if(!css) { css=e; e=doc }; return e.querySelectorAll(css) }

if(/^https?:\/\/((ex)|(e-)|(g\.))/.test(href)) {
    var lnks = $$('.itg a')
    if(lnks) { for(var i=lnks.length-1; i>=0; i--) { lnks[i].target = '_blank' } }
    var lnks = $$('#gdt a')
    if(lnks) { for(var i=lnks.length-1; i>=0; i--) { lnks[i].target = '_blank' } }
}