Reddit - auto pause NeverEndingReddit every X pages

Pauses NER every X pages for you to reload Reddit at the new position and unpauses it after the reload. Helps stopping the ressources-guzzling which slows down the browser.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name           Reddit - auto pause NeverEndingReddit every X pages
// @namespace      https://greasyfork.org/users/5174-jesuis-parapluie
// @author         jesuis-parapluie
// @version        0.0.1
// @description    Pauses NER every X pages for you to reload Reddit at the new position and unpauses it after the reload. Helps stopping the ressources-guzzling which slows down the browser.
//
// @require        http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js
// @grant          none
// @include        /^https?:\/\/(.+\.)?reddit\.com\/?.*$/
// @exclude        /^https?:\/\/(.+\.)?reddit\.com\/.+\/comments\/.*$/
// ==/UserScript==


(function ($) {
    'use strict';
    /*jslint browser: true */
    /*global jQuery */

    $.noConflict();

    var options = {
            pauseAtPage: 5,
            restartNER: true
        },

        restarter = function () {
            if ($('div#NREPause').size()) {
                $('div#NREPause').click();
            } else {
                setTimeout(restarter, 300);
            }
        };


    if (options.restartNER && $('div#NREPause').hasClass('paused') && document.location.search.search("after=") > 0) { restarter(); }

    $(document).bind('DOMNodeInserted', function (e) {
        if (e.target.tagName === 'DIV' && e.target.hasAttribute('class') && e.target.getAttribute('class') === 'NERPageMarker') {
            if (!$('div#NREPause').hasClass('paused') && parseInt($(e.target).text().split(' ').pop(), 10) >= options.pauseAtPage) {
                $('div#NREPause').click();
            }
        }
    });

}(jQuery));