inmac thumbs fixer

Fix broken thumbnails

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

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

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

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

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

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

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.

(I already have a user style manager, let me install it!)

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