Difference between revisions 137877 and 137888 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:  { faviconICO: "https://secure.wikimedia.org/favicon.ico",
                                 favicon: "https://secure.wikimedia.org/favicon.ico",
                                 leave: true /*,
                                 faviconPNG: false */ }
                       };
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.321",
               "text/javascript");


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