User:PerfektesChaos/vector.js

// 2013-10-06

function editJS { $("#wpTextbox1").change(sourceVersion, sourceDebugPath); // sourceDebugPath; }  // editJS

function sourceDebugPath { var got; var $textarea =  $("#wpTextbox1"); if ($textarea.length) { var source =  $textarea.val; var story  =  false; if (source.indexOf("/// ") === 0) { var re    =  /(\/\/\/ .*[a-z]\/)\?([-a-zA-Z_0-9]*\.js\n?)/g; var shift =  source.replace(re, "$1d$2"); if (shift !== source) { $textarea.val(shift); }     }   } }   // sourceDebugPath

function sourceVersion { // 2013-10-06  var got; var re        =  /(?:       |,|[a-z]\.|\[ *[a-zA-Z0-9]+ *\]+\.)(?:version|vsn) *= *(-?[0-9]+\.?[0-9]*);/; var source; var $summary; var $textarea =  $("#wpTextbox1"); if ($textarea.length) { source =  $textarea.val; if (source.length) { got =  re.exec(source); if (got) { $summary =  $("#wpSummary"); if ($summary.length) { source =  $summary.val; if (source.length) { re =  /^(-?[0-9]+\.?[0-9]*)$/; if (re.test(source)) { source =  ""; }              }               if (! source.length) { $summary.val(got[1]); }           }         }      }   } }   // sourceVersion

function sourceYW { var got; var source; var $textarea =  $("#wpTextbox1"); if ($textarea.length) { source =  $textarea.val; if (source.length) { re  =  /(\.main\.wait\(\")Y\"/;         got  =  re.exec(source);         if (got) {            source  =  source.replace(re, "$1W\"");            $textarea.val(source);         }      }   } }   // sourceYW

if (mw.config.get("wgNamespaceNumber") === 2) { var re; var subject =  mw.config.get("wgTitle"); if (subject.substr(-3, 3) === ".js") { if (! mw.config.get("wgIsArticle")) { var s =  mw.config.get("wgAction"); if (s === "edit" ||  s === "submit") { re =  /\/d.*\.js$/; if (re.test(subject)) { jQuery(editJS); }           sourceVersion; }     }   } }