User:PerfektesChaos/js/paneMarker/dialog/d.js

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
/// mw:User:PerfektesChaos/js/paneMarker/dialog/d.js
/// 2016-10-21 PerfektesChaos@de.wikipedia
// Equip Special:Gadgets dialog form of paneMarker
/// Fingerprint: #0#0#
/// @license GPL [//www.mediawiki.org/w/COPYING] (+GFDL, LGPL, CC-BY-SA)
/// <nowiki>
/* global window:false                                                 */
/* jshint bitwise:true, curly:true, eqeqeq:true, latedef:true,
          laxbreak:true,
          nocomma:true, strict:true, undef:true, unused:true           */



( function ( mw ) {
   "use strict";
   var PaneMk  =  "paneMarker";
   if ( typeof mw.libs[ PaneMk ]  !==  "object"
        ||   ! mw.libs[ PaneMk ] ) {
      mw.libs[ PaneMk ]  =  {  prefs:  { }  };
   }
   PaneMk  =  mw.libs[ PaneMk ];
   if ( ! PaneMk.prefs ) {
      PaneMk.prefs  =  { };
   }
   PaneMk.prefs.vsn    = -2.6;
   PaneMk.prefs.texts  =  {
      // 2014-09-08 PerfektesChaos@de.wikipedia
      "suffix":      {"en": "&#8211; emphasize"
                            + " browser windows or tabs"
                            + " currently used for input activities",
                      "de": "&#8211; Browser-Fenster oder Tabs"
                            + " hervorheben,"
                            + " in denen Bearbeitung offen"},
      "?icon":       {"en": "<ul style='margin-left:3em'>"
                            + "<li>URL of alternative icon</li>"
                            + "<li><code>0</code> &#8211;"
                            + " regular page icon</li>"
                            + "<li>empty: use red favicon</li>"
                            + "</ul>",
                      "de": "<ul style='margin-left:3em'>"
                            + "<li>URL eines alternativen Icons</li>"
                            + "<li><code>0</code> &#8211;"
                            + " hier kein abweichender Icon</li>"
                            + "<li>leer: Roter Standard-Favicon</li>"
                            + "</ul>"},
      "?mark":       {"en": "<ul style='margin-left:3em'>"
                            + "<li>marker string as desired</li>"
                            + "<li><code>U+</code><i>nnnn</i> &#8211;"
                            + " Unicode of specific marker</li>"
                            + "<li><code>U+0</code> &#8211;"
                            + " do not prepend any marker</li>"
                            + "<li>empty: use default marker</li>"
                            + "</ul>",
                      "de": "<ul style='margin-left:3em'>"
                            + "<li>Gewünschter Marker (direkt)</li>"
                            + "<li><code>U+</code><i>nnnn</i> &#8211;"
                            + " Unicode des gewünschten Markers</li>"
                            + "<li><code>U+0</code> &#8211;"
                            + " keinen Marker voranstellen</li>"
                            + "<li>leer: Standard-Marker</li>"
                            + "</ul>"},
      "^appleIcon":  {"en": "Alternative red apple-touch-icon,"
                            + " or disabled",
                      "de": "Alternativer apple-touch-icon,"
                            + " oder deaktiviert"},
      "^faviconICO": {"en": "Alternative red favicon in .ICO format,"
                            + " or disabled",
                      "de": "Alternativer Favicon im .ICO-Format,"
                            + " oder deaktiviert"},
      "^faviconPNG": {"en": "Alternative red favicon in .PNG format,"
                            + " or disabled",
                      "de": "Alternativer Favicon im .PNG-Format,"
                            + " oder deaktiviert"},
      "^lazy":       {"en": "Always keep standard icon",
                      "de": "Konventionellen Icon immer beibehalten"},
      "^chars":      {"en": "Distinguishing mark: "
                            + " general activation/deactivation",
                      "de": "Unterscheidungszeichen"
                            + " allgemein aktivieren/deaktivieren"},
      "^charDiff":   {"en": "Marker for diffpages",
                      "de": "Marker für diffpages"},
      "^charHistory":{"en": "Marker for history pages",
                      "de": "Marker für Versionsgeschichte"},
      "^charLinks":  {"en": "Marker for “Whatlinkshere”",
                      "de": "Marker für Links auf diese Seite"},
      "^charVitally":{"en": "Marker for important pages",
                      "de": "Marker für wichtige Seiten-Aktivitäten"},
      "^lowChar":    {"en": "Use ANSI characters",
                      "de": "ANSI-Zeichen benutzen"},
      "^favicon":    {"en": "Alternative default favicon"
                            + " for this project",
                      "de": "Alternativer Favicon"
                            + " für dieses Projekt"},
      "^leave":      {"en": "Create window titles"
                            + " as short as possible",
                      "de": "(Benutze kurzen Seitentitel)"},
      "^shortcut":   {"en": "Use shortcuts on page",
                      "de": "Benutze Shortcuts auf der Seite"}
   };   // .prefs.texts
   PaneMk.prefs.userlang  =  {
      // 2012-12-19 PerfektesChaos@de.wikipedia
      "de" :   "de",
      "als" :  "de",
      "bar" :  "de",
      "dsb" :  "de",
      "frr" :  "de",
      "gsw" :  "de",
      "hsb" :  "de",
      "ksh" :  "de",
      "lb" :   "de",
      "nds" :  "de",
      "pdc" :  "de",
      "pdt" :  "de",
      "pfl" :  "de",
      "sli" :  "de",
      "stq" :  "de",
      "vmf" :  "de"
   };   // .prefs.userlang



   /*
    * This program is free software; you can redistribute it and/or
    * modify it under the terms of the GNU General Public License as
    * published by the Free Software Foundation; either version 2 of the
    * License, or (at your option) any later version.
    *
    * This program is distributed in the hope that it will be useful,
    * but WITHOUT ANY WARRANTY; without even the implied warranty of
    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    * GNU General Public License for more details.
    *
    * You should have received a copy of the GNU General Public License
    * along with this program;
    * if not, write to the Free Software Foundation, Inc.,
    * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
    * http://www.gnu.org/copyleft/gpl.html
    */



   PaneMk.prefs.favorite  =  function () {
      // Detect appropriate language, and support page in user language
      // Postcondition:
      //    Returns language code
      // Uses:
      //    >  .prefs.userlang
      //    >  .support
      //     < .prefs.support
      //    mw.config.get()
      // 2016-10-21 PerfektesChaos@de.wikipedia
      var r  =  mw.config.get( "wgUserLanguage" ).toLowerCase();
      if ( r.length > 4 ) {   // Remove RFC 1766 subtag from code
         if ( r.charCodeAt( 2 )  ===  45 ) {   // '-'
            r  =  r.substr( 0, 2 );
         }
      }
      r  =  this.userlang[ r ];
      r  =  ( r ? r : "en" );
      switch ( r ) {
         case "de" :
            this.support  =  r + ".wikipedia.org";
            break;
         default:
            this.support  =  "www.mediawiki.org";
      }   // switch .slang
      this.support  =  "//" + this.support + "/wiki/" + PaneMk.support;
      return r;
   };   // .prefs.favorite()



   PaneMk.prefs.furnish  =  function () {
      // Equip Special:Gadgets page with entry and form
      // Uses:
      //    >  .type
      //    >  .prefs.support
      //    >  .prefs.texts
      //    >  .prefs.supply
      //    .prefs.favorite()
      //    .prefs.fetch()
      //    .prefs.fiat()
      //    mw.libs.preferencesGadgetOptions.form()
      // 2014-09-09 PerfektesChaos@de.wikipedia
      var dialog,
          slang  =  this.favorite();
      this.fetch();
      dialog  =
       { script:  PaneMk.type,
         support: this.support,
         suffix:  this.texts.suffix[ slang ],
         opts:    [ { signature: "appleIcon",
                      type:      "text",
                      show:      this.texts[ "^appleIcon" ][ slang ],
                      suffix:    this.texts[ "?icon" ][ slang ],
                      val:       this.fiat( "appleIcon" )
                    },
                    { signature: "faviconICO",
                      type:      "text",
                      show:      this.texts[ "^faviconICO" ][ slang ],
                      suffix:    this.texts[ "?icon" ][ slang ],
                      val:       this.fiat( "faviconICO" )
                    },
                    { signature: "faviconPNG",
                      type:      "text",
                      show:      this.texts[ "^faviconPNG" ][ slang ],
                      suffix:    this.texts[ "?icon" ][ slang ],
                      val:       this.fiat( "faviconPNG" )
                    },
                    { signature: "lazy",
                      type:      "checkbox",
                      show:      this.texts[ "^lazy" ][ slang ],
                      val:       this.fiat( "lazy", false )
                    },
                    { signature: "chars",
                      type:      "checkbox",
                      show:      this.texts[ "^chars" ][ slang ],
                      val:       this.fiat( "chars", false )
                    },
                    { signature: "charDiff",
                      type:      "text",
                      show:      this.texts[ "^charDiff" ][ slang ],
                      suffix:    this.texts[ "?mark" ][ slang ],
                      val:       this.fiat( "charDiff" )
                    },
                    { signature: "charHistory",
                      type:      "text",
                      show:      this.texts[ "^charHistory" ][ slang ],
                      suffix:    this.texts[ "?mark" ][ slang ],
                      val:       this.fiat( "charHistory" )
                    },
                    { signature: "charLinks",
                      type:      "text",
                      show:      this.texts[ "^charLinks" ][ slang ],
                      suffix:    this.texts[ "?mark" ][ slang ],
                      val:       this.fiat( "charLinks" )
                    },
                    { signature: "charVitally",
                      type:      "text",
                      show:      this.texts[ "^charVitally" ][ slang ],
                      suffix:    this.texts[ "?mark" ][ slang ],
                      val:       this.fiat( "charVitally" )
                    },
                    { signature: "lowChar",
                      type:      "checkbox",
                      show:      this.texts[ "^lowChar" ][ slang ],
                      val:       this.fiat( "lowChar", false )
                    },
                    { signature: "favicon",
                      type:      "text",
                      show:      this.texts[ "^favicon" ][ slang ],
                      val:       this.fiat( "favicon" )
                    },
                    { signature: "leave",
                      type:      "checkbox",
                      show:      this.texts[ "^leave" ][ slang ],
                      val:       this.fiat( "leave", false )
                    },
                    { signature: "shortcut",
                      type:      "checkbox",
                      show:      this.texts[ "^shortcut" ][ slang ],
                      val:       this.fiat( "shortcut", true )
                    }
                  ] };
      mw.libs[ this.supply ].form( dialog );
   };   // .prefs.furnish()



   if ( mw.config.get( "wgCanonicalSpecialPageName" )  ===  "Blankpage" ) {
      //                                                    "Gadgets"
      PaneMk.prefs.furnish();
   }
}( window.mediaWiki ) );



// Emacs
// Local Variables:
// coding: utf-8-dos
// fill-column: 80
// End:

/// EOF </nowiki>   paneMarker/dialog/d.js