Index: branches/wmf-deployment/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -20,17 +20,17 @@ |
21 | 21 | 'raw' => array( |
22 | 22 | array( 'src' => 'css/suggestions.css', 'version' => 6 ), |
23 | 23 | array( 'src' => 'css/wikiEditor.css', 'version' => 4 ), |
24 | | - array( 'src' => 'css/wikiEditor.toolbar.css', 'version' => 6 ), |
| 24 | + array( 'src' => 'css/wikiEditor.toolbar.css', 'version' => 5 ), |
25 | 25 | array( 'src' => 'css/wikiEditor.dialogs.css', 'version' => 2 ), |
26 | | - array( 'src' => 'css/wikiEditor.toc.css', 'version' => 6 ), |
| 26 | + array( 'src' => 'css/wikiEditor.toc.css', 'version' => 5 ), |
27 | 27 | array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2' ), |
28 | 28 | ), |
29 | 29 | 'combined' => array( |
30 | | - array( 'src' => 'css/combined.css', 'version' => 11 ), |
| 30 | + array( 'src' => 'css/combined.css', 'version' => 9 ), |
31 | 31 | array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2' ), |
32 | 32 | ), |
33 | 33 | 'minified' => array( |
34 | | - array( 'src' => 'css/combined.min.css', 'version' => 11 ), |
| 34 | + array( 'src' => 'css/combined.min.css', 'version' => 9 ), |
35 | 35 | array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2' ), |
36 | 36 | ), |
37 | 37 | ) |
— | — | @@ -44,37 +44,39 @@ |
45 | 45 | 'no_js2' => array( |
46 | 46 | 'raw' => array( |
47 | 47 | array( 'src' => 'js/js2/jquery-1.3.2.js', 'version' => '1.3.2' ), |
48 | | - array( 'src' => 'js/js2/jquery-ui-1.7.2.js', 'version' => '1.7.2y' ), |
49 | | - array( 'src' => 'js/js2/js2.js', 'version' => 4 ), |
| 48 | + array( 'src' => 'js/js2/js2.js', 'version' => 3 ), |
50 | 49 | ), |
51 | 50 | 'combined' => array( |
52 | | - array( 'src' => 'js/js2.combined.js', 'version' => 7 ), |
| 51 | + array( 'src' => 'js/js2.combined.js', 'version' => 6 ), |
53 | 52 | ), |
54 | 53 | 'minified' => array( |
55 | | - array( 'src' => 'js/js2.combined.min.js', 'version' => 7 ), |
| 54 | + array( 'src' => 'js/js2.combined.min.js', 'version' => 6 ), |
56 | 55 | ), |
57 | 56 | ), |
58 | 57 | // Core functionality of extension |
59 | 58 | 'base_sets' => array( |
60 | 59 | 'raw' => array( |
61 | 60 | array( 'src' => 'js/plugins/jquery.async.js', 'version' => 3 ), |
62 | | - array( 'src' => 'js/plugins/jquery.autoEllipse.js', 'version' => 3 ), |
| 61 | + array( 'src' => 'js/plugins/jquery.autoEllipse.js', 'version' => 2 ), |
63 | 62 | array( 'src' => 'js/plugins/jquery.browser.js', 'version' => 3 ), |
64 | 63 | array( 'src' => 'js/plugins/jquery.cookie.js', 'version' => 3 ), |
65 | 64 | array( 'src' => 'js/plugins/jquery.delayedBind.js', 'version' => 1 ), |
66 | 65 | array( 'src' => 'js/plugins/jquery.namespaceSelect.js', 'version' => 1 ), |
67 | 66 | array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 4 ), |
68 | | - array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 16 ), |
69 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 12 ), |
70 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 12 ), |
71 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 5 ), |
72 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 19 ), |
| 67 | + array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 14 ), |
| 68 | + array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 8 ), |
| 69 | + array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 11 ), |
| 70 | + array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 4 ), |
| 71 | + array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 15 ), |
| 72 | + // FIXME: jQuery UI doesn't belong here, should move to no_js2 |
| 73 | + // once we figure out how to do jQuery UI properly in JS2 |
| 74 | + array( 'src' => 'js/js2/jquery-ui-1.7.2.js', 'version' => '1.7.2y' ), |
73 | 75 | ), |
74 | 76 | 'combined' => array( |
75 | | - array( 'src' => 'js/plugins.combined.js', 'version' => 43 ), |
| 77 | + array( 'src' => 'js/plugins.combined.js', 'version' => 36 ), |
76 | 78 | ), |
77 | 79 | 'minified' => array( |
78 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 43 ), |
| 80 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 36 ), |
79 | 81 | ), |
80 | 82 | ), |
81 | 83 | ); |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/EditToolbar/EditToolbar.php |
— | — | @@ -19,7 +19,7 @@ |
20 | 20 | /* Configuration */ |
21 | 21 | |
22 | 22 | // Bump the version number every time you change any of the .css/.js files |
23 | | -$wgEditToolbarStyleVersion = 58; |
| 23 | +$wgEditToolbarStyleVersion = 47; |
24 | 24 | |
25 | 25 | // Set this to true to simply override the stock toolbar for everyone |
26 | 26 | $wgEditToolbarGlobalEnable = false; |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/EditToolbar/EditToolbar.hooks.php |
— | — | @@ -120,8 +120,6 @@ |
121 | 121 | 'edittoolbar-tool-replace-close', |
122 | 122 | 'edittoolbar-tool-replace-nomatch', |
123 | 123 | 'edittoolbar-tool-replace-success', |
124 | | - 'edittoolbar-tool-replace-emptysearch', |
125 | | - 'edittoolbar-tool-replace-invalidregex', |
126 | 124 | /* Special Characters Section */ |
127 | 125 | 'edittoolbar-section-characters', |
128 | 126 | 'edittoolbar-characters-page-latin', |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js |
— | — | @@ -839,9 +839,7 @@ |
840 | 840 | $j(this).text( gM( $j(this).attr( 'rel' ) ) ); |
841 | 841 | }); |
842 | 842 | // Build tabs |
843 | | - mvJsLoader.doLoad( [ '$j.ui', '$j.ui.tabs' ], function() { |
844 | | - $j( '#edittoolbar-link-tabs' ).tabs(); |
845 | | - }); |
| 843 | + $j( '#edittoolbar-link-tabs' ).tabs(); |
846 | 844 | // Automatically copy the value of the internal link page title field to the link text field unless the user |
847 | 845 | // has changed the link text field - this is a convience thing since most link texts are going to be the |
848 | 846 | // the same as the page title |
— | — | @@ -985,8 +983,9 @@ |
986 | 984 | var escTarget = escapeExternalTarget( target ); |
987 | 985 | var escText = escapeExternalText( text ); |
988 | 986 | whitespace = $j( '#edittoolbar-link-dialog-tab-ext' ).data( 'whitespace' ); |
989 | | - if ( !target.match( /^[a-z]+:\/\/./ ) ) { |
| 987 | + if ( target == '' || target == 'http://' ) { |
990 | 988 | // Refuse to add links to invalid URLs |
| 989 | + // TODO: More elaborate regex here? |
991 | 990 | alert( gM( 'edittoolbar-tool-link-ext-invalid' ) ); |
992 | 991 | return; |
993 | 992 | } |
— | — | @@ -1068,7 +1067,6 @@ |
1069 | 1068 | $j(this) |
1070 | 1069 | .find( 'button:first' ) |
1071 | 1070 | .click(); |
1072 | | - e.preventDefault(); |
1073 | 1071 | } |
1074 | 1072 | }); |
1075 | 1073 | } |
— | — | @@ -1086,27 +1084,34 @@ |
1087 | 1085 | </tr></table><table><tr>\ |
1088 | 1086 | <td class="label"><label for="edittoolbar-table-dimensions-columns"\ |
1089 | 1087 | rel="edittoolbar-tool-table-dimensions-columns"></label></td>\ |
1090 | | - <td><input type="text" id="edittoolbar-table-dimensions-columns" size="4" /></td>\ |
| 1088 | + <td><input type="text" id="edittoolbar-table-dimensions-columns" size="2" /></td>\ |
1091 | 1089 | <td class="label"><label for="edittoolbar-table-dimensions-rows"\ |
1092 | 1090 | rel="edittoolbar-tool-table-dimensions-rows"></label></td>\ |
1093 | | - <td><input type="text" id="edittoolbar-table-dimensions-rows" size="4" /></td>\ |
| 1091 | + <td><input type="text" id="edittoolbar-table-dimensions-rows" size="2" /></td>\ |
1094 | 1092 | </tr></table></fieldset>', |
1095 | 1093 | init: function() { |
1096 | 1094 | $j(this).find( '[rel]' ).each( function() { |
1097 | 1095 | $j(this).text( gM( $j(this).attr( 'rel' ) ) ); |
1098 | 1096 | }); |
| 1097 | + // Execute the action associated with the first button |
| 1098 | + // when the user presses Enter |
| 1099 | + $j(this).closest( '.ui-dialog' ).keypress( function( e ) { |
| 1100 | + if ( ( e.keyCode || e.which ) == 13 ) { |
| 1101 | + $j(this) |
| 1102 | + .find( 'button:first' ) |
| 1103 | + .click(); |
| 1104 | + } |
| 1105 | + }); |
1099 | 1106 | $j( '#edittoolbar-table-dimensions-rows' ).val( 2 ); |
1100 | 1107 | $j( '#edittoolbar-table-dimensions-columns' ).val( 2 ); |
1101 | 1108 | }, |
1102 | 1109 | dialog: { |
1103 | 1110 | buttons: { |
1104 | 1111 | 'edittoolbar-tool-table-insert': function() { |
1105 | | - var rowsVal = $j( '#edittoolbar-table-dimensions-rows' ).val(); |
1106 | | - var colsVal = $j( '#edittoolbar-table-dimensions-columns' ).val(); |
1107 | | - var rows = parseInt( rowsVal, 10 ); |
1108 | | - var cols = parseInt( colsVal, 10 ); |
| 1112 | + var rows = parseInt( $j( '#edittoolbar-table-dimensions-rows' ).val() ); |
| 1113 | + var cols = parseInt( $j( '#edittoolbar-table-dimensions-columns' ).val() ); |
1109 | 1114 | var header = Math.min( 1, $j( '#edittoolbar-table-dimensions-header:checked' ).size() ); |
1110 | | - if ( isNaN( rows ) || isNaN( cols ) || rows != rowsVal || cols != colsVal ) { |
| 1115 | + if ( isNaN( rows ) || isNaN( cols ) ) { |
1111 | 1116 | alert( gM( 'edittoolbar-tool-table-invalidnumber' ) ); |
1112 | 1117 | return; |
1113 | 1118 | } |
— | — | @@ -1139,9 +1144,9 @@ |
1140 | 1145 | $j.wikiEditor.modules.toolbar.fn.doAction( |
1141 | 1146 | $j(this).data( 'context' ), |
1142 | 1147 | { |
1143 | | - type: 'replace', |
| 1148 | + type: 'encapsulate', |
1144 | 1149 | options: { |
1145 | | - pre: "{| class=\"wikitable\"\n", |
| 1150 | + pre: "{|\n", |
1146 | 1151 | peri: table, |
1147 | 1152 | post: "|}", |
1148 | 1153 | ownline: true |
— | — | @@ -1166,7 +1171,6 @@ |
1167 | 1172 | $j(this) |
1168 | 1173 | .find( 'button:first' ) |
1169 | 1174 | .click(); |
1170 | | - e.preventDefault(); |
1171 | 1175 | } |
1172 | 1176 | }); |
1173 | 1177 | } |
— | — | @@ -1180,8 +1184,6 @@ |
1181 | 1185 | <div id="edittoolbar-replace-message">\ |
1182 | 1186 | <div id="edittoolbar-replace-nomatch" rel="edittoolbar-tool-replace-nomatch"></div>\ |
1183 | 1187 | <div id="edittoolbar-replace-success"></div>\ |
1184 | | - <div id="edittoolbar-replace-emptysearch" rel="edittoolbar-tool-replace-emptysearch"></div>\ |
1185 | | - <div id="edittoolbar-replace-invalidregex"></div>\ |
1186 | 1188 | </div>\ |
1187 | 1189 | <fieldset><table><tr>\ |
1188 | 1190 | <td><label for="edittoolbar-replace-search" rel="edittoolbar-tool-replace-search"></label></td>\ |
— | — | @@ -1200,15 +1202,20 @@ |
1201 | 1203 | $j(this).find( '[rel]' ).each( function() { |
1202 | 1204 | $j(this).text( gM( $j(this).attr( 'rel' ) ) ); |
1203 | 1205 | }); |
| 1206 | + // Execute the action associated with the first button |
| 1207 | + // when the user presses Enter |
| 1208 | + $j(this).closest( '.ui-dialog' ).keypress( function( e ) { |
| 1209 | + if ( ( e.keyCode || e.which ) == 13 ) { |
| 1210 | + $j(this) |
| 1211 | + .find( 'button:first' ) |
| 1212 | + .click(); |
| 1213 | + } |
| 1214 | + }); |
1204 | 1215 | |
1205 | 1216 | // TODO: Find a cleaner way to share this function |
1206 | 1217 | $j(this).data( 'replaceCallback', function( mode ) { |
1207 | | - $j( '#edittoolbar-replace-nomatch, #edittoolbar-replace-success, #edittoolbar-replace-emptysearch, #edittoolbar-replace-invalidregex' ).hide(); |
| 1218 | + $j( '#edittoolbar-replace-nomatch, #edittoolbar-replace-success' ).hide(); |
1208 | 1219 | var searchStr = $j( '#edittoolbar-replace-search' ).val(); |
1209 | | - if ( searchStr == '' ) { |
1210 | | - $j( '#edittoolbar-replace-emptysearch' ).show(); |
1211 | | - return; |
1212 | | - } |
1213 | 1220 | var replaceStr = $j( '#edittoolbar-replace-replace' ).val(); |
1214 | 1221 | var flags = ''; |
1215 | 1222 | var matchCase = $j( '#edittoolbar-replace-case' ).is( ':checked' ); |
— | — | @@ -1222,38 +1229,20 @@ |
1223 | 1230 | if ( !isRegex ) { |
1224 | 1231 | searchStr = RegExp.escape( searchStr ); |
1225 | 1232 | } |
1226 | | - try { |
1227 | | - var regex = new RegExp( searchStr, flags ); |
1228 | | - } catch( e ) { |
1229 | | - $j( '#edittoolbar-replace-invalidregex' ) |
1230 | | - .text( gM( 'edittoolbar-tool-replace-invalidregex', |
1231 | | - e.message ) ) |
1232 | | - .show(); |
1233 | | - return; |
1234 | | - } |
| 1233 | + var regex = new RegExp( searchStr, flags ); |
1235 | 1234 | var $textarea = $j(this).data( 'context' ).$textarea; |
1236 | 1235 | var text = $j.wikiEditor.fixOperaBrokenness( $textarea.val() ); |
1237 | | - var matches = false; |
1238 | | - if ( mode != 'replaceAll' ) |
1239 | | - matches = text.substr( $j(this).data( 'offset' ) ).match( regex ); |
1240 | | - if ( !matches ) |
1241 | | - // Search hit BOTTOM, continuing at TOP |
1242 | | - matches = text.match( regex ); |
1243 | | - |
1244 | | - if ( !matches ) |
| 1236 | + var matches = text.match( regex ); |
| 1237 | + if ( !matches ) { |
1245 | 1238 | $j( '#edittoolbar-replace-nomatch' ).show(); |
1246 | | - else if ( mode == 'replaceAll' ) { |
| 1239 | + } else if ( mode == 'replaceAll' ) { |
1247 | 1240 | // Prepare to select the last match |
1248 | 1241 | var start = text.lastIndexOf( matches[matches.length - 1] ); |
1249 | 1242 | var end = start + replaceStr.length; |
1250 | | - |
1251 | | - // Calculate how much the last match will move |
1252 | | - var replaced = text.replace( regex, replaceStr ); |
1253 | | - var corr = replaced.length - text.length - replaceStr.length + matches[matches.length - 1].length; |
| 1243 | + var corr = ( matches.length - 1 ) * ( replaceStr.length - searchStr.length ); |
1254 | 1244 | $textarea |
1255 | | - .val( replaced ) |
| 1245 | + .val( $textarea.val().replace( regex, replaceStr ) ) |
1256 | 1246 | .change() |
1257 | | - .focus() |
1258 | 1247 | .setSelection( start + corr, end + corr ) |
1259 | 1248 | .scrollToCaretPosition(); |
1260 | 1249 | |
— | — | @@ -1269,7 +1258,7 @@ |
1270 | 1259 | start = text.indexOf( matches[0] ); |
1271 | 1260 | var end = start + matches[0].length; |
1272 | 1261 | var newEnd = start + replaceStr.length; |
1273 | | - $textarea.focus().setSelection( start, end ); |
| 1262 | + $textarea.setSelection( start, end ); |
1274 | 1263 | if ( mode == 'replace' ) { |
1275 | 1264 | $textarea |
1276 | 1265 | .encapsulateSelection( '', replaceStr, '', false, true ) |
— | — | @@ -1282,52 +1271,36 @@ |
1283 | 1272 | }, |
1284 | 1273 | dialog: { |
1285 | 1274 | buttons: { |
1286 | | - 'edittoolbar-tool-replace-button-findnext': function( e ) { |
1287 | | - $j(this).closest( '.ui-dialog' ).data( 'dialogaction', e.target ); |
| 1275 | + 'edittoolbar-tool-replace-button-findnext': function() { |
1288 | 1276 | $j(this).data( 'replaceCallback' ).call( this, 'find' ); |
1289 | 1277 | }, |
1290 | | - 'edittoolbar-tool-replace-button-replacenext': function( e ) { |
1291 | | - $j(this).closest( '.ui-dialog' ).data( 'dialogaction', e.target ); |
| 1278 | + 'edittoolbar-tool-replace-button-replacenext': function() { |
1292 | 1279 | $j(this).data( 'replaceCallback' ).call( this, 'replace' ); |
1293 | 1280 | }, |
1294 | | - 'edittoolbar-tool-replace-button-replaceall': function( e ) { |
1295 | | - $j(this).closest( '.ui-dialog' ).data( 'dialogaction', e.target ); |
| 1281 | + 'edittoolbar-tool-replace-button-replaceall': function() { |
1296 | 1282 | $j(this).data( 'replaceCallback' ).call( this, 'replaceAll' ); |
1297 | 1283 | }, |
1298 | 1284 | 'edittoolbar-tool-replace-close': function() { |
1299 | 1285 | $j(this).dialog( 'close' ); |
| 1286 | + $j(this).data( 'context' ).$textarea.focus(); |
1300 | 1287 | } |
1301 | 1288 | }, |
1302 | 1289 | open: function() { |
1303 | 1290 | $j(this).data( 'offset', 0 ); |
1304 | 1291 | $j( '#edittoolbar-replace-search' ).focus(); |
1305 | | - $j( '#edittoolbar-replace-nomatch, #edittoolbar-replace-success, #edittoolbar-replace-emptysearch, #edittoolbar-replace-invalidregex' ).hide(); |
| 1292 | + $j( '#edittoolbar-replace-nomatch, #edittoolbar-replace-success' ).hide(); |
1306 | 1293 | if ( !( $j(this).data( 'dialogkeypressset' ) ) ) { |
1307 | 1294 | $j(this).data( 'dialogkeypressset', true ); |
1308 | 1295 | // Execute the action associated with the first button |
1309 | 1296 | // when the user presses Enter |
1310 | 1297 | $j(this).closest( '.ui-dialog' ).keypress( function( e ) { |
1311 | 1298 | if ( ( e.keyCode || e.which ) == 13 ) { |
1312 | | - var button = $j(this).data( 'dialogaction' ) || $j(this).find( 'button:first' ); |
1313 | | - button.click(); |
1314 | | - e.preventDefault(); |
| 1299 | + $j(this) |
| 1300 | + .find( 'button:first' ) |
| 1301 | + .click(); |
1315 | 1302 | } |
1316 | 1303 | }); |
1317 | 1304 | } |
1318 | | - var dialog = $j(this).closest( '.ui-dialog' ); |
1319 | | - $j(this).data( 'context' ).$textarea.bind( 'keypress.srdialog', function( e ) { |
1320 | | - if ( ( e.keyCode || e.which ) == 13 ) { |
1321 | | - var button = dialog.data( 'dialogaction' ) || dialog.find( 'button:first' ); |
1322 | | - button.click(); |
1323 | | - e.preventDefault(); |
1324 | | - } |
1325 | | - }); |
1326 | | - }, |
1327 | | - close: function() { |
1328 | | - $j(this).data( 'context' ).$textarea |
1329 | | - .unbind( 'keypress.srdialog' ) |
1330 | | - .focus(); |
1331 | | - $j(this).closest( '.ui-dialog' ).data( 'dialogaction', false ); |
1332 | 1305 | } |
1333 | 1306 | } |
1334 | 1307 | } |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/EditToolbar/EditToolbar.i18n.php |
— | — | @@ -15,7 +15,7 @@ |
16 | 16 | 'edittoolbar' => 'Editing toolbar', |
17 | 17 | 'edittoolbar-desc' => 'Edit page toolbar with enhanced usability', |
18 | 18 | 'edittoolbar-preference' => 'Enable enhanced editing toolbar', |
19 | | - 'edittoolbar-cgd-preference' => 'Enable dialogs for inserting links, tables and more', |
| 19 | + 'edittoolbar-cgd-preference' => 'Enable help for adding advanced wiki text', |
20 | 20 | 'edittoolbar-loading' => 'Loading...', |
21 | 21 | /* Main Section */ |
22 | 22 | 'edittoolbar-tool-bold' => 'Bold', |
— | — | @@ -114,8 +114,6 @@ |
115 | 115 | 'edittoolbar-tool-replace-close' => 'Cancel', |
116 | 116 | 'edittoolbar-tool-replace-nomatch' => 'Your search did not match anything.', |
117 | 117 | 'edittoolbar-tool-replace-success' => '$1 replacement(s) made.', |
118 | | - 'edittoolbar-tool-replace-emptysearch' => 'You did not enter anything to search for.', |
119 | | - 'edittoolbar-tool-replace-invalidregex' => 'The regular expression you entered is invalid: $1', |
120 | 118 | /* Special characters Section */ |
121 | 119 | 'edittoolbar-section-characters' => 'Special characters', |
122 | 120 | 'edittoolbar-characters-page-latin' => 'Latin', |
— | — | @@ -250,7 +248,6 @@ |
251 | 249 | 'edittoolbar-tool-replace-close' => '{{Identical|Cancel}}', |
252 | 250 | 'edittoolbar-tool-replace-success' => '[[file:Bulbgraph.png|left|22px]] |
253 | 251 | This message does not support PLURAL on $1.', |
254 | | - 'edittoolbar-tool-replace-invalidregex' => '$1 is a browser-supplied error message, probably in English, possibly in the browser language.', |
255 | 252 | 'edittoolbar-characters-page-latin' => 'This is the name of a script, or alphabet, not a language', |
256 | 253 | 'edittoolbar-characters-page-ipa' => 'IPA means a script: "international phonetic alphabet" here, and not "international phonetic association", the organization behind it.', |
257 | 254 | 'edittoolbar-characters-page-greek' => 'This is the name of a script, or alphabet, not a language.', |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/EditWarning/EditWarning.js |
— | — | @@ -24,7 +24,6 @@ |
25 | 25 | if( |
26 | 26 | $j( '#wpTextbox1' ).data( 'origtext' ) != $j( '#wpTextbox1' ).val() |
27 | 27 | || $j( '#wpSummary' ).data( 'origtext' ) != $j( '#wpSummary' ).val() |
28 | | - || $j( '#wikiPreview' ).size() != 0 |
29 | 28 | ) { |
30 | 29 | // Return our message |
31 | 30 | return gM( 'editwarning-warning' ); |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/EditWarning/EditWarning.php |
— | — | @@ -19,7 +19,7 @@ |
20 | 20 | /* Configuration */ |
21 | 21 | |
22 | 22 | // Bump the version number every time you change any of the .css/.js files |
23 | | -$wgEditWarningStyleVersion = 4; |
| 23 | +$wgEditWarningStyleVersion = 3; |
24 | 24 | |
25 | 25 | /* Setup */ |
26 | 26 | |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/js2.combined.min.js |
— | — | @@ -778,5 +778,4 @@ |
779 | 779 | return $.datepicker['_'+options+'Datepicker'].apply($.datepicker,[this[0]].concat(otherArgs));return this.each(function(){typeof options=='string'?$.datepicker['_'+options+'Datepicker'].apply($.datepicker,[this].concat(otherArgs)):$.datepicker._attachDatepicker(this,options);});};$.datepicker=new Datepicker();$.datepicker.initialized=false;$.datepicker.uuid=new Date().getTime();$.datepicker.version="1.7.2";window.DP_jQuery=$;})(jQuery);if(!gMsg)var gMsg={};function loadGM(msgSet){for(var i in msgSet){gMsg[i]=msgSet[i];}} |
780 | 780 | function gM(key,args){var ms='';if(key in gMsg){ms=gMsg[key];if(typeof args=='object'||typeof args=='array'){for(var v in args){var rep='\$'+(parseInt(v)+1);ms=ms.replace(rep,args[v]);}}else if(typeof args=='string'||typeof args=='number'){ms=ms.replace(/\$1/,args);} |
781 | 781 | return ms;}else{return'['+key+']';}} |
782 | | -$j=jQuery.noConflict();function js2AddOnloadHook(func){$j(document).ready(func);} |
783 | | -mvJsLoader={doLoad:function(deps,callback){callback();}}; |
\ No newline at end of file |
| 782 | +$j=jQuery.noConflict();function js2AddOnloadHook(func){$j(document).ready(func);} |
\ No newline at end of file |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/js2/js2.js |
— | — | @@ -50,7 +50,4 @@ |
51 | 51 | */ |
52 | 52 | function js2AddOnloadHook( func ) { |
53 | 53 | $j(document).ready( func ); |
54 | | -} |
55 | | - |
56 | | -// Define a dummy mvJsLoader.doLoad() function |
57 | | -mvJsLoader = { doLoad: function( deps, callback ) { callback(); } }; |
\ No newline at end of file |
| 54 | +} |
\ No newline at end of file |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/jquery.codepress.js |
— | — | @@ -1,13 +0,0 @@ |
2 | | -/* |
3 | | - * |
4 | | - */ |
5 | | -(function ($) { |
6 | | - |
7 | | -$.fn.codePress = function() { |
8 | | - $(this).each( function { |
9 | | - CodePress(this) |
10 | | - } ); |
11 | | -}; |
12 | | - |
13 | | - |
14 | | -})(jQuery); |
\ No newline at end of file |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/jquery.textSelection.js |
— | — | @@ -118,9 +118,9 @@ |
119 | 119 | * Get the position (in resolution of bytes not nessecarily characters) |
120 | 120 | * in a textarea |
121 | 121 | */ |
122 | | - getCaretPosition: function( startAndEnd ) { |
| 122 | + getCaretPosition: function() { |
123 | 123 | function getCaret( e ) { |
124 | | - var caretPos = 0, endPos = 0; |
| 124 | + var caretPos = 0; |
125 | 125 | if ( $.browser.msie ) { |
126 | 126 | // IE Support |
127 | 127 | var postFinished = false; |
— | — | @@ -190,13 +190,11 @@ |
191 | 191 | } |
192 | 192 | } while ( ( !postFinished || !periFinished || !postFinished ) ); |
193 | 193 | caretPos = rawPreText.replace( /\r\n/g, "\n" ).length; |
194 | | - endPos = caretPos + rawPeriText.replace( /\r\n/g, "\n" ).length; |
195 | 194 | } else if ( e.selectionStart || e.selectionStart == '0' ) { |
196 | 195 | // Firefox support |
197 | 196 | caretPos = e.selectionStart; |
198 | | - endPos = e.selectionEnd; |
199 | 197 | } |
200 | | - return startAndEnd ? [ caretPos, endPos ] : caretPos; |
| 198 | + return caretPos; |
201 | 199 | } |
202 | 200 | return getCaret( this.get( 0 ) ); |
203 | 201 | }, |
— | — | @@ -205,16 +203,8 @@ |
206 | 204 | end = start; |
207 | 205 | return this.each( function() { |
208 | 206 | if ( this.selectionStart || this.selectionStart == '0' ) { |
209 | | - // Opera 9.0 doesn't allow setting selectionStart past |
210 | | - // selectionEnd; any attempts to do that will be ignored |
211 | | - // Make sure to set them in the right order |
212 | | - if ( start > this.selectionEnd ) { |
213 | | - this.selectionEnd = end; |
214 | | - this.selectionStart = start; |
215 | | - } else { |
216 | | - this.selectionStart = start; |
217 | | - this.selectionEnd = end; |
218 | | - } |
| 207 | + this.selectionStart = start; |
| 208 | + this.selectionEnd = end; |
219 | 209 | } else if ( document.body.createTextRange ) { |
220 | 210 | var selection = document.body.createTextRange(); |
221 | 211 | selection.moveToElementText( this ); |
— | — | @@ -282,6 +272,7 @@ |
283 | 273 | return ( $.os.name == 'mac' ? 13 : ( $.os.name == 'linux' ? 15 : 16 ) ) * row; |
284 | 274 | } |
285 | 275 | return this.each(function() { |
| 276 | + $(this).focus(); |
286 | 277 | if ( this.selectionStart || this.selectionStart == '0' ) { |
287 | 278 | // Mozilla |
288 | 279 | var scroll = getCaretScrollPosition( this ); |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js |
— | — | @@ -15,38 +15,9 @@ |
16 | 16 | $.wikiEditor = { |
17 | 17 | 'modules': {}, |
18 | 18 | 'instances': [], |
19 | | - /** |
20 | | - * For each browser name, an array of conditions that must be met are supplied in [operaton, value] form where |
21 | | - * operation is a string containing a JavaScript compatible binary operator and value is either a number to be |
22 | | - * compared with $.browser.versionNumber or a string to be compared with $.browser.version |
23 | | - */ |
24 | | - 'browsers': { |
25 | | - 'ltr': { |
26 | | - 'msie': [['>=', 7]], |
27 | | - 'firefox': [ |
28 | | - ['>=', 2], |
29 | | - ['!=', '2.0'], |
30 | | - ['!=', '2.0.0.1'], |
31 | | - ['!=', '2.0.0.2'], |
32 | | - ['!=', '2.0.0.3'], |
33 | | - ['!=', '2.0.0.4'] |
34 | | - ], |
35 | | - 'opera': [['>=', 9.6]], |
36 | | - 'safari': [['>=', 3.1]] |
37 | | - }, |
38 | | - 'rtl': { |
39 | | - 'msie': [['>=', 8]], |
40 | | - 'firefox': [ |
41 | | - ['>=', 2], |
42 | | - ['!=', '2.0'], |
43 | | - ['!=', '2.0.0.1'], |
44 | | - ['!=', '2.0.0.2'], |
45 | | - ['!=', '2.0.0.3'], |
46 | | - ['!=', '2.0.0.4'] |
47 | | - ], |
48 | | - 'opera': [['>=', 9.6]], |
49 | | - 'safari': [['>=', 3.1]] |
50 | | - } |
| 19 | + 'supportedBrowsers': { |
| 20 | + 'ltr': { 'msie': 7, 'firefox': 2, 'opera': 9, 'safari': 3, 'chrome': 1, 'camino': 1 }, |
| 21 | + 'rtl': { 'msie': 8, 'firefox': 2, 'opera': 9, 'safari': 3, 'chrome': 1, 'camino': 1 } |
51 | 22 | }, |
52 | 23 | /** |
53 | 24 | * Path to images - this is a bit messy, and it would need to change if |
— | — | @@ -57,28 +28,14 @@ |
58 | 29 | }; |
59 | 30 | |
60 | 31 | $.wikiEditor.isSupportKnown = function() { |
61 | | - return $.browser.name in $.wikiEditor.browsers[$( 'body.rtl' ).size() ? 'rtl' : 'ltr']; |
| 32 | + return ( function( supportedBrowsers ) { |
| 33 | + return $.browser.name in supportedBrowsers; |
| 34 | + } )( $.wikiEditor.supportedBrowsers[$( 'body.rtl' ).size() ? 'rtl' : 'ltr'] ); |
62 | 35 | }; |
63 | 36 | $.wikiEditor.isSupported = function() { |
64 | | - if ( !$.wikiEditor.isSupportKnown ) { |
65 | | - // Assume good faith :) |
66 | | - return true; |
67 | | - } |
68 | | - var browser = $.wikiEditor.browsers[$( 'body.rtl' ).size() ? 'rtl' : 'ltr'][$.browser.name]; |
69 | | - for ( condition in browser ) { |
70 | | - var op = browser[condition][0]; |
71 | | - var val = browser[condition][1]; |
72 | | - if ( typeof val == 'string' ) { |
73 | | - if ( !( eval( '$.browser.version' + op + '"' + val + '"' ) ) ) { |
74 | | - return false; |
75 | | - } |
76 | | - } else if ( typeof val == 'number' ) { |
77 | | - if ( !( eval( '$.browser.versionNumber' + op + val ) ) ) { |
78 | | - return false; |
79 | | - } |
80 | | - } |
81 | | - } |
82 | | - return true; |
| 37 | + return ( function( supportedBrowsers ) { |
| 38 | + return $.browser.name in supportedBrowsers && $.browser.versionNumber >= supportedBrowsers[$.browser.name]; |
| 39 | + } )( $.wikiEditor.supportedBrowsers[$( 'body.rtl' ).size() ? 'rtl' : 'ltr'] ); |
83 | 40 | }; |
84 | 41 | // Wraps gM from js2, but allows raw text to supercede |
85 | 42 | $.wikiEditor.autoMsg = function( object, property ) { |
— | — | @@ -113,7 +70,7 @@ |
114 | 71 | .height( 0 ) |
115 | 72 | .width( 0 ) |
116 | 73 | .insertBefore( $.wikiEditor.instances[0] ); |
117 | | - var textarea = $( '<textarea />' ) |
| 74 | + var textarea = $( '<textarea></textarea' ) |
118 | 75 | .height( 0 ) |
119 | 76 | .appendTo( div ) |
120 | 77 | .val( "foo\r\nbar" ); |
— | — | @@ -123,10 +80,10 @@ |
124 | 81 | textarea.select(); |
125 | 82 | textarea.setSelection( index, index + 3 ); |
126 | 83 | textarea.encapsulateSelection( '', 'BAR', '', false, true ); |
127 | | - if ( textarea.val().substr( -4 ) != 'BARr' ) |
| 84 | + if ( textarea.val().substr( -1 ) == 'R' ) |
128 | 85 | $.isOperaBroken = false; |
129 | 86 | else |
130 | | - $.isOperaBroken = true; |
| 87 | + $.isOperaBroken = true; |
131 | 88 | div.remove(); |
132 | 89 | } |
133 | 90 | if ( $.isOperaBroken ) |
— | — | @@ -161,19 +118,6 @@ |
162 | 119 | // Attach a container in the top |
163 | 120 | context.$ui.prepend( $( '<div></div>' ).addClass( 'wikiEditor-ui-top' ).attr( 'id', 'wikiEditor-ui-top' ) ); |
164 | 121 | |
165 | | - // Some browsers don't restore the cursor position on refocus properly |
166 | | - // Do it for them |
167 | | - $(this) |
168 | | - .focus( function() { |
169 | | - var pos = $(this).data( 'wikiEditor-cursor' ); |
170 | | - if ( pos ) |
171 | | - $(this).setSelection( pos[0], pos[1] ); |
172 | | - $(this).data( 'wikiEditor-cursor', false ); |
173 | | - }) |
174 | | - .blur( function() { |
175 | | - $(this).data( 'wikiEditor-cursor', $(this).getCaretPosition( true ) ); |
176 | | - }); |
177 | | - |
178 | 122 | // Create a set of standard methods for internal and external use |
179 | 123 | context.api = { |
180 | 124 | /** |
— | — | @@ -237,4 +181,4 @@ |
238 | 182 | // Store the context for next time, and support chaining |
239 | 183 | return $(this).data( 'wikiEditor-context', context ); |
240 | 184 | |
241 | | -};})(jQuery); |
| 185 | +};})(jQuery); |
\ No newline at end of file |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.dialogs.js |
— | — | @@ -43,63 +43,60 @@ |
44 | 44 | $.wikiEditor.modules.dialogs.modules[module] = config[module]; |
45 | 45 | } |
46 | 46 | // Build out modules immediately |
47 | | - mvJsLoader.doLoad( ['$j.ui', '$j.ui.dialog', '$j.ui.draggable', '$j.ui.resizable' ], function() { |
48 | | - for ( module in $.wikiEditor.modules.dialogs.modules ) { |
49 | | - var module = $.wikiEditor.modules.dialogs.modules[module]; |
50 | | - // Only create the dialog if it doesn't exist yet |
51 | | - if ( $( '#' + module.id ).size() == 0 ) { |
52 | | - var configuration = module.dialog; |
53 | | - // Add some stuff to configuration |
54 | | - configuration.bgiframe = true; |
55 | | - configuration.autoOpen = false; |
56 | | - configuration.modal = true; |
57 | | - configuration.title = $.wikiEditor.autoMsg( module, 'title' ); |
58 | | - // Transform messages in keys |
59 | | - // Stupid JS won't let us do stuff like |
60 | | - // foo = { gM ('bar'): baz } |
61 | | - configuration.newButtons = {}; |
62 | | - for ( msg in configuration.buttons ) |
63 | | - configuration.newButtons[gM( msg )] = configuration.buttons[msg]; |
64 | | - configuration.buttons = configuration.newButtons; |
65 | | - // Create the dialog <div> |
66 | | - $( '<div /> ' ) |
67 | | - .attr( 'id', module.id ) |
68 | | - .html( module.html ) |
69 | | - .data( 'context', context ) |
70 | | - .appendTo( $( 'body' ) ) |
71 | | - .each( module.init ) |
72 | | - .dialog( configuration ) |
73 | | - .bind( 'dialogopen', $.wikiEditor.modules.dialogs.fn.resize ) |
74 | | - .find( '.ui-tabs' ).bind( 'tabsshow', function() { |
75 | | - $(this).closest( '.ui-dialog-content' ).each( |
76 | | - $.wikiEditor.modules.dialogs.fn.resize ); |
77 | | - }); |
78 | | - |
79 | | - // Add tabindexes to dialog form elements |
80 | | - // Find the highest tabindex in use |
81 | | - var maxTI = 0; |
82 | | - $j( '[tabindex]' ).each( function() { |
83 | | - var ti = parseInt( $j(this).attr( 'tabindex' ) ); |
84 | | - if ( ti > maxTI ) |
85 | | - maxTI = ti; |
| 47 | + for ( module in $.wikiEditor.modules.dialogs.modules ) { |
| 48 | + var module = $.wikiEditor.modules.dialogs.modules[module]; |
| 49 | + // Only create the dialog if it doesn't exist yet |
| 50 | + if ( $( '#' + module.id ).size() == 0 ) { |
| 51 | + var configuration = module.dialog; |
| 52 | + // Add some stuff to configuration |
| 53 | + configuration.bgiframe = true; |
| 54 | + configuration.autoOpen = false; |
| 55 | + configuration.modal = true; |
| 56 | + configuration.title = $.wikiEditor.autoMsg( module, 'title' ); |
| 57 | + // Transform messages in keys |
| 58 | + // Stupid JS won't let us do stuff like |
| 59 | + // foo = { gM ('bar'): baz } |
| 60 | + configuration.newButtons = {}; |
| 61 | + for ( msg in configuration.buttons ) |
| 62 | + configuration.newButtons[gM( msg )] = configuration.buttons[msg]; |
| 63 | + configuration.buttons = configuration.newButtons; |
| 64 | + // Create the dialog <div> |
| 65 | + $( '<div /> ' ) |
| 66 | + .attr( 'id', module.id ) |
| 67 | + .html( module.html ) |
| 68 | + .data( 'context', context ) |
| 69 | + .appendTo( $( 'body' ) ) |
| 70 | + .each( module.init ) |
| 71 | + .dialog( configuration ) |
| 72 | + .bind( 'dialogopen', $.wikiEditor.modules.dialogs.fn.resize ) |
| 73 | + .find( '.ui-tabs' ).bind( 'tabsshow', function() { |
| 74 | + $(this).closest( '.ui-dialog-content' ).each( |
| 75 | + $.wikiEditor.modules.dialogs.fn.resize ); |
86 | 76 | }); |
87 | | - |
88 | | - var tabIndex = maxTI + 1; |
89 | | - $j( '.ui-dialog input, .ui-dialog button' ) |
90 | | - .not( '[tabindex]' ) |
91 | | - .each( function() { |
92 | | - $j(this).attr( 'tabindex', tabIndex++ ); |
93 | | - }); |
94 | | - } |
| 77 | + |
| 78 | + // Add tabindexes to dialog form elements |
| 79 | + // Find the highest tabindex in use |
| 80 | + var maxTI = 0; |
| 81 | + $j( '[tabindex]' ).each( function() { |
| 82 | + var ti = parseInt( $j(this).attr( 'tabindex' ) ); |
| 83 | + if ( ti > maxTI ) |
| 84 | + maxTI = ti; |
| 85 | + }); |
| 86 | + |
| 87 | + var tabIndex = maxTI + 1; |
| 88 | + $j( '.ui-dialog input, .ui-dialog button' ) |
| 89 | + .not( '[tabindex]' ) |
| 90 | + .each( function() { |
| 91 | + $j(this).attr( 'tabindex', tabIndex++ ); |
| 92 | + }); |
95 | 93 | } |
96 | | - }); |
| 94 | + } |
97 | 95 | }, |
98 | 96 | |
99 | 97 | /** |
100 | 98 | * Resize a dialog so its contents fit |
101 | 99 | * |
102 | 100 | * Usage: dialog.each( resize ); or dialog.bind( 'blah', resize ); |
103 | | - * NOTE: This function assumes $j.ui.dialog has already been loaded |
104 | 101 | */ |
105 | 102 | resize: function() { |
106 | 103 | var wrapper = $(this).closest( '.ui-dialog' ); |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toolbar.js |
— | — | @@ -34,11 +34,6 @@ |
35 | 35 | $tabs.append( |
36 | 36 | $.wikiEditor.modules.toolbar.fn.buildTab( context, section, data[type][section] ) |
37 | 37 | ); |
38 | | - // Update visibility of section |
39 | | - $section = $sections.find( '.section:visible' ); |
40 | | - if ( $section.size() ) { |
41 | | - $sections.animate( { 'height': $section.outerHeight() }, 'fast' ); |
42 | | - } |
43 | 38 | } |
44 | 39 | break; |
45 | 40 | case 'groups': |
— | — | @@ -442,44 +437,40 @@ |
443 | 438 | } |
444 | 439 | }, |
445 | 440 | buildTab : function( context, id, section ) { |
446 | | - var selected = $.cookie( 'wikiEditor-' + context.instance + '-toolbar-section' ); |
| 441 | + var selected = $ |
| 442 | + .cookie( 'wikiEditor-' + context.instance + '-toolbar-section' ); |
447 | 443 | return $( '<span />' ) |
448 | | - .attr( { 'class' : 'tab tab-' + id, 'rel' : id } ) |
449 | | - .append( |
450 | | - $( '<a />' ) |
451 | | - .addClass( selected == id ? 'current' : null ) |
452 | | - .attr( 'href', '#' ) |
453 | | - .text( $.wikiEditor.autoMsg( section, 'label' ) ) |
454 | | - .data( 'context', context ) |
455 | | - .click( function() { |
456 | | - var $sections = $(this).data( 'context' ).$ui.find( '.sections' ); |
457 | | - var $section = |
458 | | - $(this).data( 'context' ).$ui.find( '.section-' + $(this).parent().attr( 'rel' ) ); |
459 | | - $(this).blur(); |
460 | | - var show = $section.css( 'display' ) == 'none'; |
461 | | - $previousSections = $section.parent().find( '.section:visible' ); |
462 | | - $previousSections.css( 'position', 'absolute' ); |
463 | | - $previousSections.fadeOut( 'fast', function() { $(this).css( 'position', 'relative' ); } ); |
464 | | - $(this).parent().parent().find( 'a' ).removeClass( 'current' ); |
465 | | - if ( show ) { |
466 | | - $section.fadeIn( 'fast' ); |
467 | | - $sections.animate( { 'height': $section.outerHeight() }, 'fast' ); |
468 | | - $(this).addClass( 'current' ); |
469 | | - } else { |
470 | | - $sections.animate( { 'height': 0 } ); |
471 | | - } |
472 | | - // Click tracking |
473 | | - if($.trackAction != undefined){ |
474 | | - $.trackAction($section.attr('rel') + '.' + ( show ? 'show': 'hide' ) ); |
475 | | - } |
476 | | - // |
477 | | - $.cookie( |
478 | | - 'wikiEditor-' + $(this).data( 'context' ).instance + '-toolbar-section', |
479 | | - show ? $section.attr( 'rel' ) : null |
480 | | - ); |
481 | | - return false; |
482 | | - } ) |
483 | | - ); |
| 444 | + .attr( { 'class' : 'tab tab-' + id, 'rel' : id } ) |
| 445 | + .append( |
| 446 | + $( '<a />' ) |
| 447 | + .addClass( selected == id ? 'current' : null ) |
| 448 | + .attr( 'href', '#' ) |
| 449 | + .text( $.wikiEditor.autoMsg( section, 'label' ) ) |
| 450 | + .data( 'context', context ) |
| 451 | + .click( function() { |
| 452 | + var $section = |
| 453 | + $(this).data( 'context' ).$ui.find( '.section-' + $(this).parent().attr( 'rel' ) ); |
| 454 | + $(this).blur(); |
| 455 | + var show = $section.css( 'display' ) == 'none'; |
| 456 | + $section.parent().children().hide("fast"); |
| 457 | + $(this).parent().parent().find( 'a' ).removeClass( 'current' ); |
| 458 | + if ( show ) { |
| 459 | + $section.show("fast"); |
| 460 | + $(this).addClass( 'current' ); |
| 461 | + } |
| 462 | + |
| 463 | + //click tracking |
| 464 | + if($.trackAction != undefined){ |
| 465 | + $.trackAction($section.attr('rel') + '.' + ( show ? 'show': 'hide' ) ); |
| 466 | + } |
| 467 | + |
| 468 | + $.cookie( |
| 469 | + 'wikiEditor-' + $(this).data( 'context' ).instance + '-toolbar-section', |
| 470 | + show ? $section.attr( 'rel' ) : null |
| 471 | + ); |
| 472 | + return false; |
| 473 | + } ) |
| 474 | + ); |
484 | 475 | }, |
485 | 476 | buildSection : function( context, id, section ) { |
486 | 477 | context.$textarea.trigger( 'wikiEditor-toolbar-buildSection-' + id, [section] ); |
— | — | @@ -516,8 +507,7 @@ |
517 | 508 | break; |
518 | 509 | } |
519 | 510 | if ( $section !== null && id !== 'main' ) { |
520 | | - var show = selected == id; |
521 | | - $section.css( 'display', show ? 'block' : 'none' ); |
| 511 | + $section.css( 'display', selected == id ? 'block' : 'none' ); |
522 | 512 | } |
523 | 513 | return $section; |
524 | 514 | }, |
— | — | @@ -565,10 +555,6 @@ |
566 | 556 | }, |
567 | 557 | 'loop' : function( i, s ) { |
568 | 558 | s.$sections.append( $.wikiEditor.modules.toolbar.fn.buildSection( s.context, s.id, s.config ) ); |
569 | | - var $section = s.$sections.find( '.section:visible' ); |
570 | | - if ( $section.size() ) { |
571 | | - $sections.animate( { 'height': $section.outerHeight() }, 'fast' ); |
572 | | - } |
573 | 559 | } |
574 | 560 | } ); |
575 | 561 | } |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js |
— | — | @@ -23,11 +23,10 @@ |
24 | 24 | if ( '$toc' in context.modules ) { |
25 | 25 | return; |
26 | 26 | } |
27 | | - context.modules.$toc = $( '<div />' ) |
| 27 | + context.modules.$toc = $( '<div></div>' ) |
28 | 28 | .addClass( 'wikiEditor-ui-toc' ) |
29 | 29 | .attr( 'id', 'wikiEditor-ui-toc' ); |
30 | | - // If we ask for this later (after we insert the TOC) then in IE this measurement will be incorrect |
31 | | - var height = context.$ui.find( '.wikiEditor-ui-bottom' ).height() |
| 30 | + $.wikiEditor.modules.toc.fn.build( context, config ); |
32 | 31 | context.$ui.find( '.wikiEditor-ui-bottom' ) |
33 | 32 | .append( context.modules.$toc ); |
34 | 33 | context.modules.$toc.height( |
— | — | @@ -35,11 +34,13 @@ |
36 | 35 | ); |
37 | 36 | // Make some css modifications to make room for the toc on the right... |
38 | 37 | // Perhaps this could be configurable? |
39 | | - context.modules.$toc.css( { 'width': '12em', 'marginTop': -( height ) } ); |
| 38 | + context.modules.$toc |
| 39 | + .css( 'width', '12em' ) |
| 40 | + .css( 'marginTop', -( context.$ui.find( '.wikiEditor-ui-bottom' ).height() ) ); |
40 | 41 | context.$ui.find( '.wikiEditor-ui-text' ) |
41 | 42 | .css( ( $( 'body.rtl' ).size() ? 'marginLeft' : 'marginRight' ), '12em' ); |
42 | 43 | // Add the TOC to the document |
43 | | - $.wikiEditor.modules.toc.fn.build( context, config ); |
| 44 | + $.wikiEditor.modules.toc.fn.build( context ); |
44 | 45 | context.$textarea |
45 | 46 | .delayedBind( 1000, 'keyup encapsulateSelection change', |
46 | 47 | function( event ) { |
— | — | @@ -145,18 +146,17 @@ |
146 | 147 | * @param {Object} structure Structured outline |
147 | 148 | */ |
148 | 149 | function buildList( structure ) { |
149 | | - var list = $( '<ul />' ); |
| 150 | + var list = $( '<ul></ul>' ); |
150 | 151 | for ( i in structure ) { |
151 | | - var item = $( '<li />' ) |
| 152 | + var item = $( '<li></li>' ) |
152 | 153 | .append( |
153 | | - $( '<a />' ) |
| 154 | + $( '<a></a>' ) |
154 | 155 | .attr( 'href', '#' ) |
155 | 156 | .addClass( 'section-' + structure[i].index ) |
156 | 157 | .data( 'textbox', context.$textarea ) |
157 | 158 | .data( 'position', structure[i].position ) |
158 | 159 | .click( function( event ) { |
159 | 160 | $(this).data( 'textbox' ) |
160 | | - .focus() |
161 | 161 | .setSelection( $(this).data( 'position' ) ) |
162 | 162 | .scrollToCaretPosition( true ); |
163 | 163 | event.preventDefault(); |
— | — | @@ -172,22 +172,23 @@ |
173 | 173 | } |
174 | 174 | // Build outline from wikitext |
175 | 175 | var outline = []; |
176 | | - var wikitext = $.wikiEditor.fixOperaBrokenness( context.$textarea.val() ); |
| 176 | + var wikitext = '\n' + $.wikiEditor.fixOperaBrokenness( context.$textarea.val() ) + '\n'; |
177 | 177 | var headings = wikitext.match( /^={1,6}.+={1,6}\s*$/gm ); |
178 | 178 | var offset = 0; |
179 | 179 | headings = $.makeArray( headings ); |
180 | 180 | for ( var h = 0; h < headings.length; h++ ) { |
181 | | - text = $.trim( headings[h] ); |
| 181 | + text = headings[h]; |
182 | 182 | // Get position of first occurence |
183 | 183 | var position = wikitext.indexOf( text, offset ); |
184 | 184 | // Update offset to avoid stumbling on duplicate headings |
185 | | - if ( position >= offset ) { |
186 | | - offset = position + text.length; |
| 185 | + if ( position > offset ) { |
| 186 | + offset = position + 1; |
187 | 187 | } else if ( position == -1 ) { |
188 | 188 | // Not sure this is possible, or what should happen |
189 | 189 | continue; |
190 | 190 | } |
191 | | - |
| 191 | + // Trim off whitespace |
| 192 | + text = $.trim( text ); |
192 | 193 | // Detect the starting and ending heading levels |
193 | 194 | var startLevel = 0; |
194 | 195 | for ( var c = 0; c < text.length; c++ ) { |
— | — | @@ -236,15 +237,7 @@ |
237 | 238 | if ( $( 'input[name=wpSection]' ).val() == '' ) |
238 | 239 | structure.unshift( { 'text': wgPageName.replace(/_/g, ' '), 'level': 1, 'index': 0, 'position': 0 } ); |
239 | 240 | context.modules.$toc.html( buildList( structure ) ); |
240 | | - |
241 | | - context.modules.$toc.find( 'ul' ).css( 'width', '10em' ); |
242 | | - |
243 | | - var links = context.modules.$toc.find( 'ul a' ); |
244 | | - // Highlighted links are wider; autoEllipse links in |
245 | | - // highlighted state |
246 | | - links.addClass( 'currentSelection' ); |
247 | | - links.autoEllipse( { 'position': 'right', 'tooltip': true } ); |
248 | | - links.removeClass( 'currentSelection' ); |
| 241 | + context.modules.$toc.find( 'ul a' ).autoEllipse( { 'position': 'right', 'tooltip': true } ); |
249 | 242 | // Cache the outline for later use |
250 | 243 | context.data.outline = outline; |
251 | 244 | } |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/jquery.autoEllipse.js |
— | — | @@ -15,24 +15,13 @@ |
16 | 16 | if ( $text.outerWidth() > $(this).innerWidth() ) { |
17 | 17 | switch ( options.position ) { |
18 | 18 | case 'right': |
19 | | - // Use binary search-like technique for |
20 | | - // efficiency |
21 | | - var l = 0, r = text.length; |
22 | | - var ow, iw; |
23 | | - do { |
24 | | - var m = Math.ceil( ( l + r ) / 2 ); |
25 | | - $text.text( text.substr( 0, m ) + '...' ); |
26 | | - ow = $text.outerWidth(); |
27 | | - iw = $(this).innerWidth(); |
28 | | - if ( ow > iw ) |
29 | | - // Text is too long |
30 | | - r = m - 1; |
31 | | - else |
32 | | - l = m; |
33 | | - } while ( l < r ); |
| 19 | + var l = text.length; |
| 20 | + while ( $text.outerWidth() > $(this).innerWidth() && l > 0 ) { |
| 21 | + $text.text( text.substr( 0, l ) + '...' ); |
| 22 | + l--; |
| 23 | + } |
34 | 24 | break; |
35 | 25 | case 'center': |
36 | | - // TODO: Use binary search like for 'right' |
37 | 26 | var i = [Math.round( text.length / 2 ), Math.round( text.length / 2 )]; |
38 | 27 | var side = 1; // Begin with making the end shorter |
39 | 28 | while ( $text.outerWidth() > ( $(this).innerWidth() ) && i[0] > 0 ) { |
— | — | @@ -50,7 +39,6 @@ |
51 | 40 | } |
52 | 41 | break; |
53 | 42 | case 'left': |
54 | | - // TODO: Use binary search like for 'right' |
55 | 43 | var r = 0; |
56 | 44 | while ( $text.outerWidth() > $(this).innerWidth() && r < text.length ) { |
57 | 45 | $text.text( '...' + text.substr( r ) ); |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/tests/wikiEditor.toolbar.js |
— | — | @@ -210,7 +210,7 @@ |
211 | 211 | } |
212 | 212 | var messages = [ 'Running tests for wikiEditor API' ]; |
213 | 213 | var $target = $j( textareaId ); |
214 | | - var $ui = $target.data( 'wikiEditor-context' ).$ui; |
| 214 | + var $ui = $target.data( 'context' ).$ui; |
215 | 215 | var passes = 0; |
216 | 216 | var tests = 0; |
217 | 217 | for ( test in wikiEditorTests ) { |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/js2.combined.js |
— | — | @@ -9503,7 +9503,4 @@ |
9504 | 9504 | */ |
9505 | 9505 | function js2AddOnloadHook( func ) { |
9506 | 9506 | $j(document).ready( func ); |
9507 | | -} |
9508 | | - |
9509 | | -// Define a dummy mvJsLoader.doLoad() function |
9510 | | -mvJsLoader = { doLoad: function( deps, callback ) { callback(); } }; |
\ No newline at end of file |
| 9507 | +} |
\ No newline at end of file |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/combine.sh |
— | — | @@ -0,0 +1,15 @@ |
| 2 | +echo "Removing combined scripts and styles" |
| 3 | +rm js/js2.combined.* |
| 4 | +rm js/plugins.combined.* |
| 5 | +rm css/combined.* |
| 6 | +echo "Merging raw scripts and styles" |
| 7 | +# Explicitly including scripts is important, because loading order is important |
| 8 | +cat js/js2/jquery-1.3.2.js js/js2/jquery-ui-1.7.2.js js/js2/js2.js > js/js2.combined.js |
| 9 | +cat js/plugins/jquery.async.js js/plugins/jquery.autoEllipse.js js/plugins/jquery.browser.js js/plugins/jquery.cookie.js js/plugins/jquery.delayedBind.js js/plugins/jquery.namespaceSelect.js js/plugins/jquery.suggestions.js js/plugins/jquery.textSelection.js js/plugins/jquery.wikiEditor.js js/plugins/jquery.wikiEditor.dialogs.js js/plugins/jquery.wikiEditor.toolbar.js js/plugins/jquery.wikiEditor.toc.js > js/plugins.combined.js |
| 10 | +# Styles can be loaded in any order |
| 11 | +cat css/*.css > css/combined.css |
| 12 | +# For more info on JSMin, see: http://www.crockford.com/javascript/jsmin.html |
| 13 | +echo "Minifying merged scripts and styles" |
| 14 | +jsmin < js/js2.combined.js > js/js2.combined.min.js |
| 15 | +jsmin < js/plugins.combined.js > js/plugins.combined.min.js |
| 16 | +cat css/combined.css | sed -e 's/^[ ]*//g; s/[ ]*$//g; s/\([:{;,]\) /\1/g; s/ {/{/g; s/\/\*.*\*\///g; /^$/d' >css/combined.min.css |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/combine.sh |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 17 | + native |
Added: svn:executable |
2 | 18 | + * |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/css/wikiEditor.toolbar.css |
— | — | @@ -10,8 +10,6 @@ |
11 | 11 | float: left; |
12 | 12 | width: 100%; |
13 | 13 | clear: both; |
14 | | - height: 0; |
15 | | - overflow: hidden; |
16 | 14 | } |
17 | 15 | body.rtl .wikiEditor-ui-toolbar .sections { |
18 | 16 | float: right; |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/css/wikiEditor.toc.css |
— | — | @@ -12,7 +12,6 @@ |
13 | 13 | float: right; |
14 | 14 | padding: 0; |
15 | 15 | overflow: auto; |
16 | | - overflow-x: hidden; |
17 | 16 | } |
18 | 17 | body.rtl .wikiEditor-ui-toc { |
19 | 18 | right: auto; |
— | — | @@ -23,10 +22,6 @@ |
24 | 23 | padding: 0; |
25 | 24 | margin: 0.5em 1em; |
26 | 25 | list-style: none; |
27 | | - /* IE needs to be told in great detail how to act, or it misbehaves */ |
28 | | - list-style-image: none; |
29 | | - list-style-position: outside; |
30 | | - list-style-type: none; |
31 | 26 | } |
32 | 27 | .wikiEditor-ui-toc ul ul { |
33 | 28 | padding: 0; |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/css/combined.css |
— | — | @@ -117,7 +117,6 @@ |
118 | 118 | float: right; |
119 | 119 | padding: 0; |
120 | 120 | overflow: auto; |
121 | | - overflow-x: hidden; |
122 | 121 | } |
123 | 122 | body.rtl .wikiEditor-ui-toc { |
124 | 123 | right: auto; |
— | — | @@ -128,10 +127,6 @@ |
129 | 128 | padding: 0; |
130 | 129 | margin: 0.5em 1em; |
131 | 130 | list-style: none; |
132 | | - /* IE needs to be told in great detail how to act, or it misbehaves */ |
133 | | - list-style-image: none; |
134 | | - list-style-position: outside; |
135 | | - list-style-type: none; |
136 | 131 | } |
137 | 132 | .wikiEditor-ui-toc ul ul { |
138 | 133 | padding: 0; |
— | — | @@ -167,8 +162,6 @@ |
168 | 163 | float: left; |
169 | 164 | width: 100%; |
170 | 165 | clear: both; |
171 | | - height: 0; |
172 | | - overflow: hidden; |
173 | 166 | } |
174 | 167 | body.rtl .wikiEditor-ui-toolbar .sections { |
175 | 168 | float: right; |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/css/combined.min.css |
— | — | @@ -105,7 +105,6 @@ |
106 | 106 | float:right; |
107 | 107 | padding:0; |
108 | 108 | overflow:auto; |
109 | | -overflow-x:hidden; |
110 | 109 | } |
111 | 110 | body.rtl .wikiEditor-ui-toc{ |
112 | 111 | right:auto; |
— | — | @@ -116,9 +115,6 @@ |
117 | 116 | padding:0; |
118 | 117 | margin:0.5em 1em; |
119 | 118 | list-style:none; |
120 | | -list-style-image:none; |
121 | | -list-style-position:outside; |
122 | | -list-style-type:none; |
123 | 119 | } |
124 | 120 | .wikiEditor-ui-toc ul ul{ |
125 | 121 | padding:0; |
— | — | @@ -151,8 +147,6 @@ |
152 | 148 | float:left; |
153 | 149 | width:100%; |
154 | 150 | clear:both; |
155 | | -height:0; |
156 | | -overflow:hidden; |
157 | 151 | } |
158 | 152 | body.rtl .wikiEditor-ui-toolbar .sections{ |
159 | 153 | float:right; |