Revision 144215 of "User:PerfektesChaos/common.js" on testwiki

mw.log  =  function (assign, apply, action, add) {
   // Popup message, if under development
   //    assign  -- debugging object
   //               >  .max     number of message boxes
   //               >  .say     identification of app
   //               >< .loud    false: silent
   //               >< .man     current message box count
   //    apply   -- message string
   //    action  -- level: 0=log 1=debug 2=info 3=warn 4=error
   //    add     -- additional object;  true: trace
   // Uses:
   //    Firebug support
   // 2012-06-07
   var s;
   var wc;
   if (typeof(assign) === "object") {
      if (assign) {
         if (typeof(assign.loud) !== "undefined") {
            if (assign.loud) {
               if (typeof(assign.max) !== "number") {
                  assign.max =  20;
               }
               if (typeof(assign.man) !== "number") {
                  assign.man =  0;
               }
               if (typeof(assign.say) === "string") {
                  s  =  assign.say + " ";
               } else {
                  s  =  "";
               }
               wc  =  window.console;
               if (typeof(wc) === "object") {
                  s  =  s + apply;
                  switch (action) {
                  case 1 :
                     if (typeof(wc.debug) === "function") {
                        wc.debug(s);
                        break;
                     }
                  case 2 :
                     if (typeof(wc.info) === "function") {
                        wc.info(s);
                        break;
                     }
                  case 3 :
                     if (typeof(wc.warn) === "function") {
                        wc.warn(s);
                        break;
                     }
                  case 4 :
                     if (typeof(wc.error) === "function") {
                        wc.error(s);
                        break;
                     }
                  default :
                     if (typeof(wc.log) === "function") {
                        wc.log(s);
                     }
                  }   // switch action
                  if (add) {
                     switch (typeof(add)) {
                        case "function" :
                        case "object" :
                           if (typeof(wc.dir) === "function") {
                              wc.dir(add);
                              break;
                           }
                        case  "string":
                           if (typeof(wc.debug) === "function") {
                              wc.debug(add);
                              break;
                           }
                        default :
                           if (typeof(wc.trace) === "function") {
                              wc.trace();
                              break;
                           } else {
                              wc.log(add);
                           }
                     }   // switch typeof(add)
                  }
                  if (action) {
                     if ( ! assign.man
                          &&  typeof(action) === "number") {
                        if (action > 2) {
                           window.alert("Firebug console");
                           assign.man  =  -1;
                        }
                     }
                  }
               } else {   // Fallback
                  if (typeof(assign.man) !== "number") {
                     assign.man  =  -1;
                  }
                  if (assign.man > assign.max) {
                     assign.loud  =  false;
                  } else {
                     assign.man++;
                     s  =  s + "   #" + assign.man;
                     if (typeof(action) === "number") {
                        s  =  s + "     " + action;
                     }
                     if (typeof(apply) !== "number") {
                        s  =  s + "\n" + apply;
                     }
                     if ( ! window.confirm(s) ) {
                        assign.loud  =  false;
                     }
                  }
               }
            }   // assign.loud
         }   // typeof assign.loud
      }   // assign
   }   // assign object
};   // mw.log()



window.debugging  =  { loud: true,
                       say:  "## (test.PC) ##" };

mw.libs.paneMarker  =  { opt:  { lazy:    true,
                                 leave:   true,
                                 xlowChar: false  }
                       };
//mw.libs.paneMarker.opt.faviconICO="https://secure.wikimedia.org/favicon.ico";
//mw.libs.paneMarker.opt.faviconICO="//meta.wikimedia.org/favicon.ico";
mw.loader.load("//test.wikipedia.org/w/index.php?title="
               + "User:PerfektesChaos/js/paneMarker/r.js"
               + "&action=raw&ctype=text/javascript&maxage=3600&smaxage=3600&vsn=0.148",
               "text/javascript");


/*
mw.loader.using( [ "mediawiki.util" ],
                 function() {
mw.loader.load("//test.wikipedia.org/w/index.php?title="
               + "User:PerfektesChaos/js/purgePortlet.js"
               + "&action=raw&ctype=text/javascript&maxage=60&smaxage=3600&vsn=0.1",
               "text/javascript");                       
                 } );
*/

if (mw.config.get("wgAction")==="edit"  ||  mw.config.get("wgAction")==="submit") {
alert("pre "+mw.config.get("wgAction"));
}


if (mw.config.get("wgIsArticle")||1) {
   wgPageName  =  mw.config.get("wgPageName");
   if (wgPageName.substr(-3, 3)  ===  ".js") {
      if (wgPageName.substr(0, 23)  ===  "User:PerfektesChaos/js/"  ||
          wgPageName.substr(0, 37)  ===  "User:PerfektesChaos/versionControl.js") {
if (mw.config.get("wgAction")==="edit"  ||  mw.config.get("wgAction")==="submit") {
alert(mw.config.get("wgAction"));
}
         mw.libs.versionControl  =  {  proj: { testwiki: {PerfektesChaos: {}} }  };
         mw.loader.load("//test.wikipedia.org/w/index.php?title="
                        + "User:PerfektesChaos/js/versionControl/d.js"
                        + "&action=raw&ctype=text/javascript"
                        + "&maxage=60",
                        "text/javascript"); 
      }
   }
}
mw.libs.resultListSort  =  { auto: true };
mw.loader.load("//test.wikipedia.org/w/index.php?title="
               + "User:PerfektesChaos/js/resultListSort/d.js"
               + "&action=raw&ctype=text/javascript"
               + "&maxage=60",
               "text/javascript");