route.user.js

Exalea - Route générique pour le P.D.O.

Bu script direkt olarak kurulamaz. Başka scriptler için bir kütüphanedir ve meta yönergeleri içerir // @require https://update.greasyfork.org/scripts/4096/13109/routeuserjs.js

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

/**
 *  Prototype d'une route générique
 *
 *  @author Exalea
 */
{
    /**
     *  Constructeur
     *
     *  @param {string} regex Expression régulière permettant de déterminer si le callback doit s'appliquer à la page/URL courante
     *  @param {function} callback Méthode de callback contenant les modifications à effectuer
     *  @returns {Route} this Instance courante (permet l'utilisation de méthodes chaînées)
     *  @constructor
     *
     *  @author Exalea
     */
    var Route = function(regex, callback) {
        this.regex = regex;
        this.callback = callback;
        return this;
    };

    /**
     *  Méthode d'application/test d'une route à une URL donnée
     *
     *  @param {string} url URL à tester
     *  @returns {boolean} true si l'URL passée en paramètre correspond à cette route, false sinon
     *
     *  @author Exalea
     */
    Route.prototype.apply = function(url) {
        if(new RegExp(this.regex).test(url)) {
            this.callback();
            return true;
        }
        return false;
    };
}