Jump to content

User:PerfektesChaos/js/localEdit/Firefox/chrome/content/permissions.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/// chrome://wikilocaledit/content/permissions.js
/// Provide RegExp to check whether a URL is welcome.
//  Used by windows:
//     * content/config.xul
//     * content/wikilocaledit.xul
// Uses:
//     < .reDomain
//     < .reUserURL
/// 2012-12-08 PerfektesChaos@de.wikipedia
/// Fingerprint: #0#0#
/// <nowiki>
/*jshint curly:true, eqeqeq:true, strict:true, undef:true, white:false */
/*global window                                                        */
/*jslint white: true                                                   */
/*globals window: true                                                 */



( function ( w ) {
   "use strict";
   var WLE;
   if ( ! w.wikiLocalEdit ) {
      w.wikiLocalEdit  =  { };
   }
   WLE  =  w.wikiLocalEdit;
   if ( !WLE .reDomain ) {
      var reUser      =  "[^ \t\r\f\n:/#]+:[^ \t\r\f\n/#]+";
      WLE.reDomain    =  "^https?://(?:[-a-z0-9]+\\.)*"
                         + "(?:"
                            + "(?:"
                              + "(?:"
                                 + "mediawiki"
                                 + "|wikibooks"
                                 + "|wikidata"
                                 + "|wikimedia"
                                 + "|wikinews"
                                 + "|wikipedia"
                                 + "|wikiquote"
                                 + "|wikisource"
                                 + "|wikiversity"
                                 + "|wikivoyage"
                                 + "|wiktionary"
                                 + "|wmflabs"
                                 + ")"
                               + "\\.org)"
                            + "|"
                            + "(?:wikia\\.com)"
                         + ")/";
      WLE.reUserURL   =  WLE.reDomain + "wiki/" + reUser + "$";
      WLE.reDomain    =  new RegExp( WLE.reDomain, "" );
      WLE.reUserURL   =  new RegExp( WLE.reUserURL, "" );
   }
} ( window ) );



/// EOF </nowiki>   content/permissions.js