Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -20,6 +20,7 @@ |
21 | 21 | '/extensions/UsabilityInitiative/Resources/jquery.js', |
22 | 22 | '/extensions/UsabilityInitiative/Resources/jquery.textSelection.js', |
23 | 23 | '/extensions/UsabilityInitiative/Resources/jquery.cookie.js', |
| 24 | + '/extensions/UsabilityInitiative/Resources/messages.js', |
24 | 25 | ); |
25 | 26 | foreach ( $scripts as $script ) { |
26 | 27 | // Add javascript resources to document |
Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js |
— | — | @@ -1,46 +1,6 @@ |
2 | 2 | /* JavaScript for EditToolbar extension */ |
3 | 3 | |
4 | 4 | /** |
5 | | - * This is designed to be directly compatible with (and is essentially taken |
6 | | - * directly from) the mv_embed code for bringing internationalized messages into |
7 | | - * the JavaScript space. As such, if we get to the point of merging that stuff |
8 | | - * into the main branch this code will be uneeded and probably cause issues. |
9 | | - */ |
10 | | -// Creates global message object if not already in existence |
11 | | -if ( !gMsg ) var gMsg = {}; |
12 | | -/** |
13 | | - * Caches a list of messages for later retieval |
14 | | - * @param {Object} msgSet Hash of key:value pairs of messages to cache |
15 | | - */ |
16 | | -function loadGM( msgSet ){ |
17 | | - for ( var i in msgSet ){ |
18 | | - gMsg[ i ] = msgSet[i]; |
19 | | - } |
20 | | -} |
21 | | -/** |
22 | | - * Retieves a message from the global message cache, performing on-the-fly |
23 | | - * replacements using MediaWiki message syntax ($1, $2, etc.) |
24 | | - * @param {String} key Name of message as it is in MediaWiki |
25 | | - * @param {Array} args Array of replacment arguments |
26 | | - */ |
27 | | -function gM( key, args ) { |
28 | | - var ms = ''; |
29 | | - if ( key in gMsg ) { |
30 | | - ms = gMsg[ key ]; |
31 | | - if ( typeof args == 'object' || typeof args == 'array' ) { |
32 | | - for ( var v in args ){ |
33 | | - var rep = '\$'+ ( parseInt(v) + 1 ); |
34 | | - ms = ms.replace( rep, args[v]); |
35 | | - } |
36 | | - } else if ( typeof args =='string' || typeof args =='number' ) { |
37 | | - ms = ms.replace( /\$1/, args ); |
38 | | - } |
39 | | - return ms; |
40 | | - } else { |
41 | | - return '[' + key + ']'; |
42 | | - } |
43 | | -} |
44 | | -/** |
45 | 5 | * This is the toolbar plugin, which can be used like |
46 | 6 | * $( 'div#edittoolbar' ).toolbar( '#wpTextbox1', tools ); |
47 | 7 | * Where tools is an array of objects which describe each tool (see below for |
Index: trunk/extensions/UsabilityInitiative/Resources/messages.js |
— | — | @@ -0,0 +1,42 @@ |
| 2 | +/* JavaScript for UsabilityInitiative extensions */ |
| 3 | + |
| 4 | +/** |
| 5 | + * This is designed to be directly compatible with (and is essentially taken |
| 6 | + * directly from) the mv_embed code for bringing internationalized messages into |
| 7 | + * the JavaScript space. As such, if we get to the point of merging that stuff |
| 8 | + * into the main branch this code will be uneeded and probably cause issues. |
| 9 | + */ |
| 10 | +// Creates global message object if not already in existence |
| 11 | +if ( !gMsg ) var gMsg = {}; |
| 12 | +/** |
| 13 | + * Caches a list of messages for later retrieval |
| 14 | + * @param {Object} msgSet Hash of key:value pairs of messages to cache |
| 15 | + */ |
| 16 | +function loadGM( msgSet ){ |
| 17 | + for ( var i in msgSet ){ |
| 18 | + gMsg[ i ] = msgSet[i]; |
| 19 | + } |
| 20 | +} |
| 21 | +/** |
| 22 | + * Retieves a message from the global message cache, performing on-the-fly |
| 23 | + * replacements using MediaWiki message syntax ($1, $2, etc.) |
| 24 | + * @param {String} key Name of message as it is in MediaWiki |
| 25 | + * @param {Array} args Array of replacement arguments |
| 26 | + */ |
| 27 | +function gM( key, args ) { |
| 28 | + var ms = ''; |
| 29 | + if ( key in gMsg ) { |
| 30 | + ms = gMsg[ key ]; |
| 31 | + if ( typeof args == 'object' || typeof args == 'array' ) { |
| 32 | + for ( var v in args ){ |
| 33 | + var rep = '\$'+ ( parseInt(v) + 1 ); |
| 34 | + ms = ms.replace( rep, args[v]); |
| 35 | + } |
| 36 | + } else if ( typeof args =='string' || typeof args =='number' ) { |
| 37 | + ms = ms.replace( /\$1/, args ); |
| 38 | + } |
| 39 | + return ms; |
| 40 | + } else { |
| 41 | + return '[' + key + ']'; |
| 42 | + } |
| 43 | +} |
Index: trunk/extensions/UsabilityInitiative/EditWarning/EditWarning.js |
— | — | @@ -1,46 +1,5 @@ |
2 | | -/* JavaScript for EditToolbar extension */ |
| 2 | +/* JavaScript for EditWarning extension */ |
3 | 3 | |
4 | | -/** |
5 | | - * This is designed to be directly compatible with (and is essentially taken |
6 | | - * directly from) the mv_embed code for bringing internationalized messages into |
7 | | - * the JavaScript space. As such, if we get to the point of merging that stuff |
8 | | - * into the main branch this code will be uneeded and probably cause issues. |
9 | | - */ |
10 | | -// Creates global message object if not already in existence |
11 | | -if ( !gMsg ) var gMsg = {}; |
12 | | -/** |
13 | | - * Caches a list of messages for later retrieval |
14 | | - * @param {Object} msgSet Hash of key:value pairs of messages to cache |
15 | | - */ |
16 | | -function loadGM( msgSet ){ |
17 | | - for ( var i in msgSet ){ |
18 | | - gMsg[ i ] = msgSet[i]; |
19 | | - } |
20 | | -} |
21 | | -/** |
22 | | - * Retieves a message from the global message cache, performing on-the-fly |
23 | | - * replacements using MediaWiki message syntax ($1, $2, etc.) |
24 | | - * @param {String} key Name of message as it is in MediaWiki |
25 | | - * @param {Array} args Array of replacement arguments |
26 | | - */ |
27 | | -function gM( key, args ) { |
28 | | - var ms = ''; |
29 | | - if ( key in gMsg ) { |
30 | | - ms = gMsg[ key ]; |
31 | | - if ( typeof args == 'object' || typeof args == 'array' ) { |
32 | | - for ( var v in args ){ |
33 | | - var rep = '\$'+ ( parseInt(v) + 1 ); |
34 | | - ms = ms.replace( rep, args[v]); |
35 | | - } |
36 | | - } else if ( typeof args =='string' || typeof args =='number' ) { |
37 | | - ms = ms.replace( /\$1/, args ); |
38 | | - } |
39 | | - return ms; |
40 | | - } else { |
41 | | - return '[' + key + ']'; |
42 | | - } |
43 | | -} |
44 | | - |
45 | 4 | function editWarningSetWarning() { |
46 | 5 | $(window).bind('beforeunload', function(event) { |
47 | 6 | if(!confirm(gM('editwarning-warning'))) |