Reddit Inline Gallery

Add's inline gallery viewmode on reddit.com

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           Reddit Inline Gallery
// @namespace      http://google.dcom
// @description    Add's inline gallery viewmode on reddit.com
// @version        1.2
// @include        http://www.reddit.com/*
// @include        http://*.reddit.com/*
// @exclude        http://www.reddit.com/ads/*
// @require 	   http://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.5/jquery.fancybox.min.js
// ==/UserScript==
//

(function() {
  $('head').append('<link rel="stylesheet" type="text/css" href="http://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.5/jquery.fancybox.css">');

  $('#siteTable div.entry').each(function(index) {
    var gallink = $(this).find('p.title a.title').clone();
    gallink.addClass('fancybox');gallink.removeClass('title');gallink.removeClass('may-blank');
    gallink.attr('data-fancybox-group', 'gallery');
    gallink.attr('title', gallink.html());
    gallink.html('open gallery');

    var extension = gallink.attr('href').substr((gallink.attr('href').lastIndexOf('.') +1));
    if (extension != 'jpg' && gallink.attr('href').indexOf('imgur') != -1) {
      gallink.attr('href', gallink.attr('href') + '.jpg');
      var extension_force = true;
    }

    if (extension == 'jpg' || extension_force == true) {
      $(this).find('ul.flat-list').append('<li>' + gallink.get(0).outerHTML + '</li>');
    }
  });

  $(".fancybox").fancybox({
    openEffect  : 'none',
    closeEffect : 'none'
  });
})();