Index: trunk/phase3/js2/mwEmbed/mv_embed.js |
— | — | @@ -53,10 +53,40 @@ |
54 | 54 | var mv_init_done = false; |
55 | 55 | var global_cb_count = 0; |
56 | 56 | |
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*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}}; |
59 | 57 | |
| 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; |
60 | 66 | |
| 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 | + |
61 | 91 | // Get the mv_embed location if it has not been set |
62 | 92 | if( !mv_embed_path ) { |
63 | 93 | var mv_embed_path = getMvEmbedPath(); |
— | — | @@ -87,7 +117,8 @@ |
88 | 118 | "mwe-size-gigabytes" : "$1 GB", |
89 | 119 | "mwe-size-megabytes" : "$1 MB", |
90 | 120 | "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.", |
92 | 123 | }); |
93 | 124 | |
94 | 125 | /** |
— | — | @@ -223,7 +254,6 @@ |
224 | 255 | '$j.Jcrop' : 'libClipEdit/Jcrop/css/jquery.Jcrop.css', |
225 | 256 | '$j.fn.ColorPicker' : 'libClipEdit/colorpicker/css/colorpicker.css' |
226 | 257 | }) |
227 | | - |
228 | 258 | /** |
229 | 259 | * Language Functions: |
230 | 260 | * |
— | — | @@ -248,9 +278,11 @@ |
249 | 279 | return '<' + key + '>'; |
250 | 280 | } |
251 | 281 | } |
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 |
255 | 287 | */ |
256 | 288 | function gMsgLoadRemote( msgSet, callback ) { |
257 | 289 | var ammessages = ''; |
— | — | @@ -462,9 +494,6 @@ |
463 | 495 | } |
464 | 496 | this.ptime = this.ctime; |
465 | 497 | }, |
466 | | - doLoadFullPaths: function( loadObj, callback ) { |
467 | | - |
468 | | - }, |
469 | 498 | doLoadDepMode: function( loadChain, callback ) { |
470 | 499 | // Firefox executes JS in the order in which it is included, so just directly issue the request |
471 | 500 | if( $j.browser.firefox ) { |
— | — | @@ -654,7 +683,7 @@ |
655 | 684 | function js2AddOnloadHook( func ) { |
656 | 685 | // Make sure the skin/style sheets are always available: |
657 | 686 | 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' ); |
659 | 688 | |
660 | 689 | // If we have already run the DOM-ready function, just run the function directly: |
661 | 690 | if( mvJsLoader.doneReadyEvents ) { |