inmac thumbs fixer

Fix broken thumbnails

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

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.

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

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

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.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

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