r56010 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r56009‎ | r56010 | r56011 >
Date:03:12, 8 September 2009
Author:dale
Status:resolved (Comments)
Tags:
Comment:
* some documentation updates
* parseURI raw code ( will be minified by script-loader)
Modified paths:
  • /trunk/phase3/js2/mwEmbed/mv_embed.js (modified) (history)

Diff [purge]

Index: trunk/phase3/js2/mwEmbed/mv_embed.js
@@ -53,10 +53,40 @@
5454 var mv_init_done = false;
5555 var global_cb_count = 0;
5656
57 -/*parseUri class parses URIs:*/
58 -var parseUri=function(d){var o=parseUri.options,value=o.parser[o.strictMode?"strict":"loose"].exec(d);for(var i=0,uri={};i<14;i++){uri[o.key[i]]=value[i]||""}uri[o.q.name]={};uri[o.key[12]].replace(o.q.parser,function(a,b,c){if(b)uri[o.q.name][b]=c});return uri};parseUri.options={strictMode:false,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}};
5957
 58+// parseUri 1.2.2
 59+// (c) Steven Levithan <stevenlevithan.com>
 60+// MIT License
 61+function parseUri (str) {
 62+ var o = parseUri.options,
 63+ m = o.parser[o.strictMode ? "strict" : "loose"].exec(str),
 64+ uri = {},
 65+ i = 14;
6066
 67+ while (i--) uri[o.key[i]] = m[i] || "";
 68+
 69+ uri[o.q.name] = {};
 70+ uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) {
 71+ if ($1) uri[o.q.name][$1] = $2;
 72+ });
 73+
 74+ return uri;
 75+};
 76+parseUri.options = {
 77+ strictMode: false,
 78+ key: ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],
 79+ q: {
 80+ name: "queryKey",
 81+ parser: /(?:^|&)([^&=]*)=?([^&]*)/g
 82+ },
 83+ parser: {
 84+ strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
 85+ loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
 86+ }
 87+};
 88+
 89+
 90+
6191 // Get the mv_embed location if it has not been set
6292 if( !mv_embed_path ) {
6393 var mv_embed_path = getMvEmbedPath();
@@ -87,7 +117,8 @@
88118 "mwe-size-gigabytes" : "$1 GB",
89119 "mwe-size-megabytes" : "$1 MB",
90120 "mwe-size-kilobytes" : "$1 K",
91 - "mwe-size-bytes" : "$1 B"
 121+ "mwe-size-bytes" : "$1 B",
 122+ "mwe-error_load_lib" : "Error: mv_embed was unable to load required JavaScript libraries.\nInsert script via DOM has failed. Please try reloading this page.",
92123 });
93124
94125 /**
@@ -223,7 +254,6 @@
224255 '$j.Jcrop' : 'libClipEdit/Jcrop/css/jquery.Jcrop.css',
225256 '$j.fn.ColorPicker' : 'libClipEdit/colorpicker/css/colorpicker.css'
226257 })
227 -
228258 /**
229259 * Language Functions:
230260 *
@@ -248,9 +278,11 @@
249279 return '&lt;' + key + '&gt;';
250280 }
251281 }
252 -/*
253 - * msgSet is either a string corresponding to a single message to load, or an
254 - * array with a set of messages to load.
 282+/**
 283+ * gMsgLoadRemote loads remote msg strings
 284+ *
 285+ * @param mixed msgSet the set of msg to load remotely
 286+ * @param function callback the callback to pass loaded msg to
255287 */
256288 function gMsgLoadRemote( msgSet, callback ) {
257289 var ammessages = '';
@@ -462,9 +494,6 @@
463495 }
464496 this.ptime = this.ctime;
465497 },
466 - doLoadFullPaths: function( loadObj, callback ) {
467 -
468 - },
469498 doLoadDepMode: function( loadChain, callback ) {
470499 // Firefox executes JS in the order in which it is included, so just directly issue the request
471500 if( $j.browser.firefox ) {
@@ -654,7 +683,7 @@
655684 function js2AddOnloadHook( func ) {
656685 // Make sure the skin/style sheets are always available:
657686 loadExternalCss( mv_jquery_skin_path + 'jquery-ui-1.7.1.custom.css' );
658 - loadExternalCss( mv_embed_path + 'skins/'+mwConfig['skin_name'] + '/styles.css' );
 687+ loadExternalCss( mv_embed_path + 'skins/' + mwConfig['skin_name'] + '/styles.css' );
659688
660689 // If we have already run the DOM-ready function, just run the function directly:
661690 if( mvJsLoader.doneReadyEvents ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r56031r56010#c3896 (extra comma)dale13:54, 8 September 2009

Comments

#Comment by Nikerabbit (talk | contribs)   09:51, 8 September 2009

Maybe caused by this: _Error With ScriptLoader.php ::Could not parse JSON language msg in File: js2/mwEmbed/mv_embed.js

#Comment by Mdale (talk | contribs)   13:54, 8 September 2009

opps... did not see the extra comma there :( .. fixed with r56031

Status & tagging log