MediaWiki:Gadget-I18n-js.js: Difference between revisions

From Tardis Wiki, the free Doctor Who reference
add msg().exists; don't duplicate escape code
(prevent xss via parsed messages by using separate empty document for jquery calls)
(add msg().exists; don't duplicate escape code)
Line 4: Line 4:
  *
  *
  * @author Cqm <https://dev.wikia.com/User:Cqm>
  * @author Cqm <https://dev.wikia.com/User:Cqm>
  * @version 0.4.1
  * @version 0.4.2
  *
  *
  * @notes Also used by VSTF wiki for their reporting forms (with a non-dev i18n.json page)
  * @notes Also used by VSTF wiki for their reporting forms (with a non-dev i18n.json page)
Line 465: Line 465:


         return {
         return {
            /*
            * Boolean representing whether the message exists.
            */
            exists: msg !== noMsg,
             /*
             /*
             * Parse wikitext links in the message and return the result.
             * Parse wikitext links in the message and return the result.
Line 473: Line 478:
                 // skip parsing if the message wasn't found otherwise
                 // skip parsing if the message wasn't found otherwise
                 // the sanitisation will mess with it
                 // the sanitisation will mess with it
                 if (msg === noMsg) {
                 if (!this.exists) {
                     return mw.html.escape(msg);
                     return this.escape();
                 }
                 }


Line 488: Line 493:
                 // skip parsing if the message wasn't found otherwise
                 // skip parsing if the message wasn't found otherwise
                 // the sanitisation will mess with it
                 // the sanitisation will mess with it
                 if (msg === noMsg) {
                 if (!this.exists) {
                     return mw.html.escape(msg);
                     return this.escape();
                 }
                 }


Cookies help us deliver our services. By using our services, you agree to our use of cookies.