Difference between revisions 137889 and 137891 on testwiki

/// mw:User:PerfektesChaos/js/paneMarker/?.js
/// 2012-06-19 [email protected]
/// Fingerprint: #0#0#
// Mark browser panes (tabbed or window) if particular action taken.
// Try to exchange wiki-favicon for a red one if editing a wiki page.
// Insert indicating character before document title.

// Requires: JavaScript 1.3
(contracted; show full)            }
         }   // $favicon.length
      }   // $head
   };   // .favicon()




   mw.libs.paneMarker.facilitate  =  function () {
      // Set document title to relevant page name and site name
      // Postcondition:
      //    document.title has been set
      // Uses:
      //     < document.title
      // Remark: Available since MW 1.20
      // 2012-06-07 [email protected]
      document.title  =  mw.config.get( "wgRelevantPageName" )
                                                .replace( /_/g, " " )   +
                         " * "  +  mw.config.get( "wgSiteName" );
   };   // .facilitate()



   mw.libs.paneMarker.file  =  function ( album, assign, access ) {
      // Retrieve PNG file URL at commons
      // Precondition:
      //    album   -- apple or favicon prefix
      //    assign  -- site
      //    access  -- hashcode octet
      // Postcondition:
      //    Returns URL
      // 2012-06-07 [email protected]
      var r  =  "//upload.wikimedia.org/wikipedia/commons/"
                +  access.substr( 0, 1 )  +  "/"  +  access  +  "/"
                +  album  +  assign  +  ".png";
      return r;
   };   // .file()



   mw.libs.paneMarker.flag  =  function ( action ) {
      // Put character together with document title
      // Precondition:
      //    action  -- "Diff", "History", "Links", "Vitally", "*"
      // Uses:
      //    >  this
      //    >  .config.leave
      //    >  .site
      //    >  .heads
      //    >  .config.charDiff
      //    >  .config.charHistory
      //    >  .config.charLinks
      //    >  .config.charVitally
      //    >  .config.chars
      //    >  .config.lowChar
      //    >  .lazy
      //    >  .config.rightleft
      //    >< document.title
      //     < .leave
      //    mw.config.get.facilitate()
      // Requires: JavaScript 1.3   String.fromCharCode()
      // 2012-06-19 [email protected]
      var c       =  true,
          learn   =  true;
      if ( this.config.leave ) {
         document.title  =
                    mw.config.get( "wgPageName" ).replace( /_/g, " " )  +
                    " * "  +  mw.config.get( "wgSiteName" this.facilitate();
      } else if ( this.heads.indexOf( this.site )  <  0 ) {
         c      =  this.config[ "char" + action ];
         learn  =  false;
      }
      if ( typeof this.config.chars === "boolean" ) {
         if ( c === true ) {
            c  =  this.config.chars;
         }
      }
      if ( c ) {
         if ( learn ) {
            c  =  this.config[ "char" + action ];
            if ( c !== undefined ) {
               learn  =  false;
            }
         }
         if ( learn ) {
            switch ( action ) {
               case "Diff" :
                  c  =  ( this.config.lowChar ? "±" :  916 );   // 'Δ'
                  break;
               case "History" :
                  c  =  ( this.config.lowChar ? "^" : 8595 );   // '↓'
                  break;
               case "Links" :
                  c  =  ( this.config.lowChar ? ">" : 8594 );   // '→'
                  if ( ! this.config.leave ) {
                     this.facilitate();
                  }
                  break;
               case "Vitally" :
                  if ( c  &&  ! this.lazy ) {
                     c  =  false;
                     break;
                  }
                  c  =  "*";
                  break;
(contracted; show full)// Emacs
// Local Variables:
// encoding: utf-8-dos
// coding: utf-8-dos
// fill-column: 80
// End:

/// EOF </nowiki>   paneMarker/?.js