inmac thumbs fixer

Fix broken thumbnails

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

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

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         inmac thumbs fixer
// @version      0.6
// @description  Fix broken thumbnails
// @author       Nightforge & DevMan
// @include      https://inmac.org/*
// @grant        none
// @require      https://code.jquery.com/jquery-2.1.1.min.js
// @namespace    https://greatest.deepsurf.us/users/7303
// ==/UserScript==

(function() {
	var $ = jQuery.noConflict();

	$('head').append( $('<link rel="stylesheet" type="text/css" />').attr('href', '//cdn.rawgit.com/gilbitron/Nivo-Lightbox/master/nivo-lightbox.css') );
	$('head').append( $('<link rel="stylesheet" type="text/css" />').attr('href', '//cdn.rawgit.com/gilbitron/Nivo-Lightbox/master/themes/default/default.css') );

	$.getScript("//cdn.rawgit.com/gilbitron/Nivo-Lightbox/master/nivo-lightbox.js").done(function() {
        $.each($('tbody[id^="post_"]'), function(i, el) {
            var thumbs = $('a.nivoLightbox', el);
            if(thumbs.length === 0) {
                return;
            }
            else if(thumbs.length > 1) {
                thumbs.attr('data-lightbox-gallery', 'g' + i);
            }
            else {
                thumbs.removeAttr('data-lightbox-gallery');
            }
        });

        $('a[class="nivoLightbox"]').nivoLightbox({
            effect: 'fadeScale',
            theme: 'default',
            keyboardNav: true,
            clickOverlayToClose: true
        });
	}).fail(function() {
		console.error("nivo-lightbox downloading fail");
	});
})();