Index: branches/wmf-deployment/extensions/UsabilityInitiative/combine.sh |
— | — | @@ -1,15 +0,0 @@ |
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 |
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 help for adding advanced wiki text', |
| 19 | + 'edittoolbar-cgd-preference' => 'Enable dialogs for inserting links, tables and more', |
20 | 20 | 'edittoolbar-loading' => 'Loading...', |
21 | 21 | /* Main Section */ |
22 | 22 | 'edittoolbar-tool-bold' => 'Bold', |
— | — | @@ -114,6 +114,8 @@ |
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', |
118 | 120 | /* Special characters Section */ |
119 | 121 | 'edittoolbar-section-characters' => 'Special characters', |
120 | 122 | 'edittoolbar-characters-page-latin' => 'Latin', |
— | — | @@ -248,6 +250,7 @@ |
249 | 251 | 'edittoolbar-tool-replace-close' => '{{Identical|Cancel}}', |
250 | 252 | 'edittoolbar-tool-replace-success' => '[[file:Bulbgraph.png|left|22px]] |
251 | 253 | 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.', |
252 | 255 | 'edittoolbar-characters-page-latin' => 'This is the name of a script, or alphabet, not a language', |
253 | 256 | 'edittoolbar-characters-page-ipa' => 'IPA means a script: "international phonetic alphabet" here, and not "international phonetic association", the organization behind it.', |
254 | 257 | 'edittoolbar-characters-page-greek' => 'This is the name of a script, or alphabet, not a language.', |
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 = 47; |
| 23 | +$wgEditToolbarStyleVersion = 58; |
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,6 +120,8 @@ |
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', |
124 | 126 | /* Special Characters Section */ |
125 | 127 | 'edittoolbar-section-characters', |
126 | 128 | 'edittoolbar-characters-page-latin', |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js |
— | — | @@ -839,7 +839,9 @@ |
840 | 840 | $j(this).text( gM( $j(this).attr( 'rel' ) ) ); |
841 | 841 | }); |
842 | 842 | // Build tabs |
843 | | - $j( '#edittoolbar-link-tabs' ).tabs(); |
| 843 | + mvJsLoader.doLoad( [ '$j.ui', '$j.ui.tabs' ], function() { |
| 844 | + $j( '#edittoolbar-link-tabs' ).tabs(); |
| 845 | + }); |
844 | 846 | // Automatically copy the value of the internal link page title field to the link text field unless the user |
845 | 847 | // has changed the link text field - this is a convience thing since most link texts are going to be the |
846 | 848 | // the same as the page title |
— | — | @@ -983,9 +985,8 @@ |
984 | 986 | var escTarget = escapeExternalTarget( target ); |
985 | 987 | var escText = escapeExternalText( text ); |
986 | 988 | whitespace = $j( '#edittoolbar-link-dialog-tab-ext' ).data( 'whitespace' ); |
987 | | - if ( target == '' || target == 'http://' ) { |
| 989 | + if ( !target.match( /^[a-z]+:\/\/./ ) ) { |
988 | 990 | // Refuse to add links to invalid URLs |
989 | | - // TODO: More elaborate regex here? |
990 | 991 | alert( gM( 'edittoolbar-tool-link-ext-invalid' ) ); |
991 | 992 | return; |
992 | 993 | } |
— | — | @@ -1067,6 +1068,7 @@ |
1068 | 1069 | $j(this) |
1069 | 1070 | .find( 'button:first' ) |
1070 | 1071 | .click(); |
| 1072 | + e.preventDefault(); |
1071 | 1073 | } |
1072 | 1074 | }); |
1073 | 1075 | } |
— | — | @@ -1084,34 +1086,27 @@ |
1085 | 1087 | </tr></table><table><tr>\ |
1086 | 1088 | <td class="label"><label for="edittoolbar-table-dimensions-columns"\ |
1087 | 1089 | rel="edittoolbar-tool-table-dimensions-columns"></label></td>\ |
1088 | | - <td><input type="text" id="edittoolbar-table-dimensions-columns" size="2" /></td>\ |
| 1090 | + <td><input type="text" id="edittoolbar-table-dimensions-columns" size="4" /></td>\ |
1089 | 1091 | <td class="label"><label for="edittoolbar-table-dimensions-rows"\ |
1090 | 1092 | rel="edittoolbar-tool-table-dimensions-rows"></label></td>\ |
1091 | | - <td><input type="text" id="edittoolbar-table-dimensions-rows" size="2" /></td>\ |
| 1093 | + <td><input type="text" id="edittoolbar-table-dimensions-rows" size="4" /></td>\ |
1092 | 1094 | </tr></table></fieldset>', |
1093 | 1095 | init: function() { |
1094 | 1096 | $j(this).find( '[rel]' ).each( function() { |
1095 | 1097 | $j(this).text( gM( $j(this).attr( 'rel' ) ) ); |
1096 | 1098 | }); |
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 | | - }); |
1106 | 1099 | $j( '#edittoolbar-table-dimensions-rows' ).val( 2 ); |
1107 | 1100 | $j( '#edittoolbar-table-dimensions-columns' ).val( 2 ); |
1108 | 1101 | }, |
1109 | 1102 | dialog: { |
1110 | 1103 | buttons: { |
1111 | 1104 | 'edittoolbar-tool-table-insert': function() { |
1112 | | - var rows = parseInt( $j( '#edittoolbar-table-dimensions-rows' ).val() ); |
1113 | | - var cols = parseInt( $j( '#edittoolbar-table-dimensions-columns' ).val() ); |
| 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 ); |
1114 | 1109 | var header = Math.min( 1, $j( '#edittoolbar-table-dimensions-header:checked' ).size() ); |
1115 | | - if ( isNaN( rows ) || isNaN( cols ) ) { |
| 1110 | + if ( isNaN( rows ) || isNaN( cols ) || rows != rowsVal || cols != colsVal ) { |
1116 | 1111 | alert( gM( 'edittoolbar-tool-table-invalidnumber' ) ); |
1117 | 1112 | return; |
1118 | 1113 | } |
— | — | @@ -1144,9 +1139,9 @@ |
1145 | 1140 | $j.wikiEditor.modules.toolbar.fn.doAction( |
1146 | 1141 | $j(this).data( 'context' ), |
1147 | 1142 | { |
1148 | | - type: 'encapsulate', |
| 1143 | + type: 'replace', |
1149 | 1144 | options: { |
1150 | | - pre: "{|\n", |
| 1145 | + pre: "{| class=\"wikitable\"\n", |
1151 | 1146 | peri: table, |
1152 | 1147 | post: "|}", |
1153 | 1148 | ownline: true |
— | — | @@ -1171,6 +1166,7 @@ |
1172 | 1167 | $j(this) |
1173 | 1168 | .find( 'button:first' ) |
1174 | 1169 | .click(); |
| 1170 | + e.preventDefault(); |
1175 | 1171 | } |
1176 | 1172 | }); |
1177 | 1173 | } |
— | — | @@ -1184,6 +1180,8 @@ |
1185 | 1181 | <div id="edittoolbar-replace-message">\ |
1186 | 1182 | <div id="edittoolbar-replace-nomatch" rel="edittoolbar-tool-replace-nomatch"></div>\ |
1187 | 1183 | <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>\ |
1188 | 1186 | </div>\ |
1189 | 1187 | <fieldset><table><tr>\ |
1190 | 1188 | <td><label for="edittoolbar-replace-search" rel="edittoolbar-tool-replace-search"></label></td>\ |
— | — | @@ -1202,20 +1200,15 @@ |
1203 | 1201 | $j(this).find( '[rel]' ).each( function() { |
1204 | 1202 | $j(this).text( gM( $j(this).attr( 'rel' ) ) ); |
1205 | 1203 | }); |
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 | | - }); |
1215 | 1204 | |
1216 | 1205 | // TODO: Find a cleaner way to share this function |
1217 | 1206 | $j(this).data( 'replaceCallback', function( mode ) { |
1218 | | - $j( '#edittoolbar-replace-nomatch, #edittoolbar-replace-success' ).hide(); |
| 1207 | + $j( '#edittoolbar-replace-nomatch, #edittoolbar-replace-success, #edittoolbar-replace-emptysearch, #edittoolbar-replace-invalidregex' ).hide(); |
1219 | 1208 | var searchStr = $j( '#edittoolbar-replace-search' ).val(); |
| 1209 | + if ( searchStr == '' ) { |
| 1210 | + $j( '#edittoolbar-replace-emptysearch' ).show(); |
| 1211 | + return; |
| 1212 | + } |
1220 | 1213 | var replaceStr = $j( '#edittoolbar-replace-replace' ).val(); |
1221 | 1214 | var flags = ''; |
1222 | 1215 | var matchCase = $j( '#edittoolbar-replace-case' ).is( ':checked' ); |
— | — | @@ -1229,20 +1222,38 @@ |
1230 | 1223 | if ( !isRegex ) { |
1231 | 1224 | searchStr = RegExp.escape( searchStr ); |
1232 | 1225 | } |
1233 | | - var regex = new RegExp( searchStr, flags ); |
| 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 | + } |
1234 | 1235 | var $textarea = $j(this).data( 'context' ).$textarea; |
1235 | 1236 | var text = $j.wikiEditor.fixOperaBrokenness( $textarea.val() ); |
1236 | | - var matches = text.match( regex ); |
1237 | | - if ( !matches ) { |
| 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 ) |
1238 | 1245 | $j( '#edittoolbar-replace-nomatch' ).show(); |
1239 | | - } else if ( mode == 'replaceAll' ) { |
| 1246 | + else if ( mode == 'replaceAll' ) { |
1240 | 1247 | // Prepare to select the last match |
1241 | 1248 | var start = text.lastIndexOf( matches[matches.length - 1] ); |
1242 | 1249 | var end = start + replaceStr.length; |
1243 | | - var corr = ( matches.length - 1 ) * ( replaceStr.length - searchStr.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; |
1244 | 1254 | $textarea |
1245 | | - .val( $textarea.val().replace( regex, replaceStr ) ) |
| 1255 | + .val( replaced ) |
1246 | 1256 | .change() |
| 1257 | + .focus() |
1247 | 1258 | .setSelection( start + corr, end + corr ) |
1248 | 1259 | .scrollToCaretPosition(); |
1249 | 1260 | |
— | — | @@ -1258,7 +1269,7 @@ |
1259 | 1270 | start = text.indexOf( matches[0] ); |
1260 | 1271 | var end = start + matches[0].length; |
1261 | 1272 | var newEnd = start + replaceStr.length; |
1262 | | - $textarea.setSelection( start, end ); |
| 1273 | + $textarea.focus().setSelection( start, end ); |
1263 | 1274 | if ( mode == 'replace' ) { |
1264 | 1275 | $textarea |
1265 | 1276 | .encapsulateSelection( '', replaceStr, '', false, true ) |
— | — | @@ -1271,36 +1282,52 @@ |
1272 | 1283 | }, |
1273 | 1284 | dialog: { |
1274 | 1285 | buttons: { |
1275 | | - 'edittoolbar-tool-replace-button-findnext': function() { |
| 1286 | + 'edittoolbar-tool-replace-button-findnext': function( e ) { |
| 1287 | + $j(this).closest( '.ui-dialog' ).data( 'dialogaction', e.target ); |
1276 | 1288 | $j(this).data( 'replaceCallback' ).call( this, 'find' ); |
1277 | 1289 | }, |
1278 | | - 'edittoolbar-tool-replace-button-replacenext': function() { |
| 1290 | + 'edittoolbar-tool-replace-button-replacenext': function( e ) { |
| 1291 | + $j(this).closest( '.ui-dialog' ).data( 'dialogaction', e.target ); |
1279 | 1292 | $j(this).data( 'replaceCallback' ).call( this, 'replace' ); |
1280 | 1293 | }, |
1281 | | - 'edittoolbar-tool-replace-button-replaceall': function() { |
| 1294 | + 'edittoolbar-tool-replace-button-replaceall': function( e ) { |
| 1295 | + $j(this).closest( '.ui-dialog' ).data( 'dialogaction', e.target ); |
1282 | 1296 | $j(this).data( 'replaceCallback' ).call( this, 'replaceAll' ); |
1283 | 1297 | }, |
1284 | 1298 | 'edittoolbar-tool-replace-close': function() { |
1285 | 1299 | $j(this).dialog( 'close' ); |
1286 | | - $j(this).data( 'context' ).$textarea.focus(); |
1287 | 1300 | } |
1288 | 1301 | }, |
1289 | 1302 | open: function() { |
1290 | 1303 | $j(this).data( 'offset', 0 ); |
1291 | 1304 | $j( '#edittoolbar-replace-search' ).focus(); |
1292 | | - $j( '#edittoolbar-replace-nomatch, #edittoolbar-replace-success' ).hide(); |
| 1305 | + $j( '#edittoolbar-replace-nomatch, #edittoolbar-replace-success, #edittoolbar-replace-emptysearch, #edittoolbar-replace-invalidregex' ).hide(); |
1293 | 1306 | if ( !( $j(this).data( 'dialogkeypressset' ) ) ) { |
1294 | 1307 | $j(this).data( 'dialogkeypressset', true ); |
1295 | 1308 | // Execute the action associated with the first button |
1296 | 1309 | // when the user presses Enter |
1297 | 1310 | $j(this).closest( '.ui-dialog' ).keypress( function( e ) { |
1298 | 1311 | if ( ( e.keyCode || e.which ) == 13 ) { |
1299 | | - $j(this) |
1300 | | - .find( 'button:first' ) |
1301 | | - .click(); |
| 1312 | + var button = $j(this).data( 'dialogaction' ) || $j(this).find( 'button:first' ); |
| 1313 | + button.click(); |
| 1314 | + e.preventDefault(); |
1302 | 1315 | } |
1303 | 1316 | }); |
1304 | 1317 | } |
| 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 ); |
1305 | 1332 | } |
1306 | 1333 | } |
1307 | 1334 | } |
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 = 3; |
| 23 | +$wgEditWarningStyleVersion = 4; |
24 | 24 | |
25 | 25 | /* Setup */ |
26 | 26 | |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/EditWarning/EditWarning.js |
— | — | @@ -24,6 +24,7 @@ |
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 |
28 | 29 | ) { |
29 | 30 | // Return our message |
30 | 31 | return gM( 'editwarning-warning' ); |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/js2/js2.js |
— | — | @@ -50,4 +50,7 @@ |
51 | 51 | */ |
52 | 52 | function js2AddOnloadHook( func ) { |
53 | 53 | $j(document).ready( func ); |
54 | | -} |
\ No newline at end of file |
| 54 | +} |
| 55 | + |
| 56 | +// Define a dummy mvJsLoader.doLoad() function |
| 57 | +mvJsLoader = { doLoad: function( deps, callback ) { callback(); } }; |
\ No newline at end of file |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/jquery.autoEllipse.js |
— | — | @@ -15,13 +15,24 @@ |
16 | 16 | if ( $text.outerWidth() > $(this).innerWidth() ) { |
17 | 17 | switch ( options.position ) { |
18 | 18 | case 'right': |
19 | | - var l = text.length; |
20 | | - while ( $text.outerWidth() > $(this).innerWidth() && l > 0 ) { |
21 | | - $text.text( text.substr( 0, l ) + '...' ); |
22 | | - l--; |
23 | | - } |
| 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 ); |
24 | 34 | break; |
25 | 35 | case 'center': |
| 36 | + // TODO: Use binary search like for 'right' |
26 | 37 | var i = [Math.round( text.length / 2 ), Math.round( text.length / 2 )]; |
27 | 38 | var side = 1; // Begin with making the end shorter |
28 | 39 | while ( $text.outerWidth() > ( $(this).innerWidth() ) && i[0] > 0 ) { |
— | — | @@ -39,6 +50,7 @@ |
40 | 51 | } |
41 | 52 | break; |
42 | 53 | case 'left': |
| 54 | + // TODO: Use binary search like for 'right' |
43 | 55 | var r = 0; |
44 | 56 | while ( $text.outerWidth() > $(this).innerWidth() && r < text.length ) { |
45 | 57 | $text.text( '...' + text.substr( r ) ); |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/jquery.codepress.js |
— | — | @@ -0,0 +1,13 @@ |
| 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 |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/jquery.codepress.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 15 | + native |
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() { |
| 122 | + getCaretPosition: function( startAndEnd ) { |
123 | 123 | function getCaret( e ) { |
124 | | - var caretPos = 0; |
| 124 | + var caretPos = 0, endPos = 0; |
125 | 125 | if ( $.browser.msie ) { |
126 | 126 | // IE Support |
127 | 127 | var postFinished = false; |
— | — | @@ -190,11 +190,13 @@ |
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; |
194 | 195 | } else if ( e.selectionStart || e.selectionStart == '0' ) { |
195 | 196 | // Firefox support |
196 | 197 | caretPos = e.selectionStart; |
| 198 | + endPos = e.selectionEnd; |
197 | 199 | } |
198 | | - return caretPos; |
| 200 | + return startAndEnd ? [ caretPos, endPos ] : caretPos; |
199 | 201 | } |
200 | 202 | return getCaret( this.get( 0 ) ); |
201 | 203 | }, |
— | — | @@ -203,8 +205,16 @@ |
204 | 206 | end = start; |
205 | 207 | return this.each( function() { |
206 | 208 | if ( this.selectionStart || this.selectionStart == '0' ) { |
207 | | - this.selectionStart = start; |
208 | | - this.selectionEnd = end; |
| 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 | + } |
209 | 219 | } else if ( document.body.createTextRange ) { |
210 | 220 | var selection = document.body.createTextRange(); |
211 | 221 | selection.moveToElementText( this ); |
— | — | @@ -272,7 +282,6 @@ |
273 | 283 | return ( $.os.name == 'mac' ? 13 : ( $.os.name == 'linux' ? 15 : 16 ) ) * row; |
274 | 284 | } |
275 | 285 | return this.each(function() { |
276 | | - $(this).focus(); |
277 | 286 | if ( this.selectionStart || this.selectionStart == '0' ) { |
278 | 287 | // Mozilla |
279 | 288 | var scroll = getCaretScrollPosition( this ); |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js |
— | — | @@ -15,9 +15,38 @@ |
16 | 16 | $.wikiEditor = { |
17 | 17 | 'modules': {}, |
18 | 18 | 'instances': [], |
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 } |
| 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 | + } |
22 | 51 | }, |
23 | 52 | /** |
24 | 53 | * Path to images - this is a bit messy, and it would need to change if |
— | — | @@ -28,14 +57,28 @@ |
29 | 58 | }; |
30 | 59 | |
31 | 60 | $.wikiEditor.isSupportKnown = function() { |
32 | | - return ( function( supportedBrowsers ) { |
33 | | - return $.browser.name in supportedBrowsers; |
34 | | - } )( $.wikiEditor.supportedBrowsers[$( 'body.rtl' ).size() ? 'rtl' : 'ltr'] ); |
| 61 | + return $.browser.name in $.wikiEditor.browsers[$( 'body.rtl' ).size() ? 'rtl' : 'ltr']; |
35 | 62 | }; |
36 | 63 | $.wikiEditor.isSupported = function() { |
37 | | - return ( function( supportedBrowsers ) { |
38 | | - return $.browser.name in supportedBrowsers && $.browser.versionNumber >= supportedBrowsers[$.browser.name]; |
39 | | - } )( $.wikiEditor.supportedBrowsers[$( 'body.rtl' ).size() ? 'rtl' : 'ltr'] ); |
| 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; |
40 | 83 | }; |
41 | 84 | // Wraps gM from js2, but allows raw text to supercede |
42 | 85 | $.wikiEditor.autoMsg = function( object, property ) { |
— | — | @@ -70,7 +113,7 @@ |
71 | 114 | .height( 0 ) |
72 | 115 | .width( 0 ) |
73 | 116 | .insertBefore( $.wikiEditor.instances[0] ); |
74 | | - var textarea = $( '<textarea></textarea' ) |
| 117 | + var textarea = $( '<textarea />' ) |
75 | 118 | .height( 0 ) |
76 | 119 | .appendTo( div ) |
77 | 120 | .val( "foo\r\nbar" ); |
— | — | @@ -80,10 +123,10 @@ |
81 | 124 | textarea.select(); |
82 | 125 | textarea.setSelection( index, index + 3 ); |
83 | 126 | textarea.encapsulateSelection( '', 'BAR', '', false, true ); |
84 | | - if ( textarea.val().substr( -1 ) == 'R' ) |
| 127 | + if ( textarea.val().substr( -4 ) != 'BARr' ) |
85 | 128 | $.isOperaBroken = false; |
86 | 129 | else |
87 | | - $.isOperaBroken = true; |
| 130 | + $.isOperaBroken = true; |
88 | 131 | div.remove(); |
89 | 132 | } |
90 | 133 | if ( $.isOperaBroken ) |
— | — | @@ -118,6 +161,19 @@ |
119 | 162 | // Attach a container in the top |
120 | 163 | context.$ui.prepend( $( '<div></div>' ).addClass( 'wikiEditor-ui-top' ).attr( 'id', 'wikiEditor-ui-top' ) ); |
121 | 164 | |
| 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 | + |
122 | 178 | // Create a set of standard methods for internal and external use |
123 | 179 | context.api = { |
124 | 180 | /** |
— | — | @@ -181,4 +237,4 @@ |
182 | 238 | // Store the context for next time, and support chaining |
183 | 239 | return $(this).data( 'wikiEditor-context', context ); |
184 | 240 | |
185 | | -};})(jQuery); |
\ No newline at end of file |
| 241 | +};})(jQuery); |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.dialogs.js |
— | — | @@ -43,60 +43,63 @@ |
44 | 44 | $.wikiEditor.modules.dialogs.modules[module] = config[module]; |
45 | 45 | } |
46 | 46 | // Build out modules immediately |
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 ); |
| 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; |
76 | 86 | }); |
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 | | - }); |
| 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 | + } |
93 | 95 | } |
94 | | - } |
| 96 | + }); |
95 | 97 | }, |
96 | 98 | |
97 | 99 | /** |
98 | 100 | * Resize a dialog so its contents fit |
99 | 101 | * |
100 | 102 | * Usage: dialog.each( resize ); or dialog.bind( 'blah', resize ); |
| 103 | + * NOTE: This function assumes $j.ui.dialog has already been loaded |
101 | 104 | */ |
102 | 105 | resize: function() { |
103 | 106 | var wrapper = $(this).closest( '.ui-dialog' ); |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toolbar.js |
— | — | @@ -34,6 +34,11 @@ |
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 | + } |
38 | 43 | } |
39 | 44 | break; |
40 | 45 | case 'groups': |
— | — | @@ -437,40 +442,44 @@ |
438 | 443 | } |
439 | 444 | }, |
440 | 445 | buildTab : function( context, id, section ) { |
441 | | - var selected = $ |
442 | | - .cookie( 'wikiEditor-' + context.instance + '-toolbar-section' ); |
| 446 | + var selected = $.cookie( 'wikiEditor-' + context.instance + '-toolbar-section' ); |
443 | 447 | return $( '<span />' ) |
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 | | - ); |
| 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 | + ); |
475 | 484 | }, |
476 | 485 | buildSection : function( context, id, section ) { |
477 | 486 | context.$textarea.trigger( 'wikiEditor-toolbar-buildSection-' + id, [section] ); |
— | — | @@ -507,7 +516,8 @@ |
508 | 517 | break; |
509 | 518 | } |
510 | 519 | if ( $section !== null && id !== 'main' ) { |
511 | | - $section.css( 'display', selected == id ? 'block' : 'none' ); |
| 520 | + var show = selected == id; |
| 521 | + $section.css( 'display', show ? 'block' : 'none' ); |
512 | 522 | } |
513 | 523 | return $section; |
514 | 524 | }, |
— | — | @@ -555,6 +565,10 @@ |
556 | 566 | }, |
557 | 567 | 'loop' : function( i, s ) { |
558 | 568 | 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 | + } |
559 | 573 | } |
560 | 574 | } ); |
561 | 575 | } |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/engines/older.js |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/engines/older.js |
___________________________________________________________________ |
Added: svn:eol-style |
562 | 576 | + native |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/engines/opera.js |
— | — | @@ -0,0 +1,260 @@ |
| 2 | +/* |
| 3 | + * CodePress - Real Time Syntax Highlighting Editor written in JavaScript - http://codepress.org/ |
| 4 | + * |
| 5 | + * Copyright (C) 2007 Fernando M.A.d.S. <fermads@gmail.com> |
| 6 | + * |
| 7 | + * Contributors : |
| 8 | + * |
| 9 | + * Michael Hurni <michael.hurni@gmail.com> |
| 10 | + * |
| 11 | + * This program is free software; you can redistribute it and/or modify it under the terms of the |
| 12 | + * GNU Lesser General Public License as published by the Free Software Foundation. |
| 13 | + * |
| 14 | + * Read the full licence: http://www.opensource.org/licenses/lgpl-license.php |
| 15 | + */ |
| 16 | + |
| 17 | + |
| 18 | +CodePress = { |
| 19 | + scrolling : false, |
| 20 | + autocomplete : true, |
| 21 | + |
| 22 | + // set initial vars and start sh |
| 23 | + initialize : function() { |
| 24 | + if(typeof(editor)=='undefined' && !arguments[0]) return; |
| 25 | + chars = '|32|46|62|'; // charcodes that trigger syntax highlighting |
| 26 | + cc = '\u2009'; // control char |
| 27 | + editor = document.getElementsByTagName('body')[0]; |
| 28 | + document.designMode = 'on'; |
| 29 | + document.addEventListener('keyup', this.keyHandler, true); |
| 30 | + window.addEventListener('scroll', function() { if(!CodePress.scrolling) CodePress.syntaxHighlight('scroll') }, false); |
| 31 | + completeChars = this.getCompleteChars(); |
| 32 | +// CodePress.syntaxHighlight('init'); |
| 33 | + }, |
| 34 | + |
| 35 | + // treat key bindings |
| 36 | + keyHandler : function(evt) { |
| 37 | + keyCode = evt.keyCode; |
| 38 | + charCode = evt.charCode; |
| 39 | + |
| 40 | + if((evt.ctrlKey || evt.metaKey) && evt.shiftKey && charCode!=90) { // shortcuts = ctrl||appleKey+shift+key!=z(undo) |
| 41 | + CodePress.shortcuts(charCode?charCode:keyCode); |
| 42 | + } |
| 43 | + else if(completeChars.indexOf('|'+String.fromCharCode(charCode)+'|')!=-1 && CodePress.autocomplete) { // auto complete |
| 44 | + CodePress.complete(String.fromCharCode(charCode)); |
| 45 | + } |
| 46 | + else if(chars.indexOf('|'+charCode+'|')!=-1||keyCode==13) { // syntax highlighting |
| 47 | + CodePress.syntaxHighlight('generic'); |
| 48 | + } |
| 49 | + else if(keyCode==9 || evt.tabKey) { // snippets activation (tab) |
| 50 | + CodePress.snippets(evt); |
| 51 | + } |
| 52 | + else if(keyCode==46||keyCode==8) { // save to history when delete or backspace pressed |
| 53 | + CodePress.actions.history[CodePress.actions.next()] = editor.innerHTML; |
| 54 | + } |
| 55 | + else if((charCode==122||charCode==121||charCode==90) && evt.ctrlKey) { // undo and redo |
| 56 | + (charCode==121||evt.shiftKey) ? CodePress.actions.redo() : CodePress.actions.undo(); |
| 57 | + evt.preventDefault(); |
| 58 | + } |
| 59 | + else if(keyCode==86 && evt.ctrlKey) { // paste |
| 60 | + // TODO: pasted text should be parsed and highlighted |
| 61 | + } |
| 62 | + }, |
| 63 | + |
| 64 | + // put cursor back to its original position after every parsing |
| 65 | + findString : function() { |
| 66 | + var sel = window.getSelection(); |
| 67 | + var range = window.document.createRange(); |
| 68 | + var span = window.document.getElementsByTagName('span')[0]; |
| 69 | + |
| 70 | + range.selectNode(span); |
| 71 | + sel.removeAllRanges(); |
| 72 | + sel.addRange(range); |
| 73 | + span.parentNode.removeChild(span); |
| 74 | + //if(self.find(cc)) |
| 75 | + //window.getSelection().getRangeAt(0).deleteContents(); |
| 76 | + }, |
| 77 | + |
| 78 | + // split big files, highlighting parts of it |
| 79 | + split : function(code,flag) { |
| 80 | + if(flag=='scroll') { |
| 81 | + this.scrolling = true; |
| 82 | + return code; |
| 83 | + } |
| 84 | + else { |
| 85 | + this.scrolling = false; |
| 86 | + mid = code.indexOf('<SPAN>'); |
| 87 | + if(mid-2000<0) {ini=0;end=4000;} |
| 88 | + else if(mid+2000>code.length) {ini=code.length-4000;end=code.length;} |
| 89 | + else {ini=mid-2000;end=mid+2000;} |
| 90 | + code = code.substring(ini,end); |
| 91 | + return code; |
| 92 | + } |
| 93 | + }, |
| 94 | + |
| 95 | + // syntax highlighting parser |
| 96 | + syntaxHighlight : function(flag) { |
| 97 | + //if(document.designMode=='off') document.designMode='on' |
| 98 | + if(flag!='init') { |
| 99 | + var span = document.createElement('span'); |
| 100 | + window.getSelection().getRangeAt(0).insertNode(span); |
| 101 | + } |
| 102 | + |
| 103 | + o = editor.innerHTML; |
| 104 | +// o = o.replace(/<br>/g,'\r\n'); |
| 105 | +// o = o.replace(/<(b|i|s|u|a|em|tt|ins|big|cite|strong)?>/g,''); |
| 106 | + //alert(o) |
| 107 | + o = o.replace(/<(?!span|\/span|br).*?>/gi,''); |
| 108 | +// alert(o) |
| 109 | +// x = o; |
| 110 | + x = z = this.split(o,flag); |
| 111 | + //alert(z) |
| 112 | +// x = x.replace(/\r\n/g,'<br>'); |
| 113 | + x = x.replace(/\t/g, ' '); |
| 114 | + |
| 115 | + |
| 116 | + if(arguments[1]&&arguments[2]) x = x.replace(arguments[1],arguments[2]); |
| 117 | + |
| 118 | + for(i=0;i<Language.syntax.length;i++) |
| 119 | + x = x.replace(Language.syntax[i].input,Language.syntax[i].output); |
| 120 | + |
| 121 | + editor.innerHTML = this.actions.history[this.actions.next()] = (flag=='scroll') ? x : o.split(z).join(x); |
| 122 | + |
| 123 | + if(flag!='init') this.findString(); |
| 124 | + }, |
| 125 | + |
| 126 | + getLastWord : function() { |
| 127 | + var rangeAndCaret = CodePress.getRangeAndCaret(); |
| 128 | + words = rangeAndCaret[0].substring(rangeAndCaret[1]-40,rangeAndCaret[1]); |
| 129 | + words = words.replace(/[\s\n\r\);\W]/g,'\n').split('\n'); |
| 130 | + return words[words.length-1].replace(/[\W]/gi,'').toLowerCase(); |
| 131 | + }, |
| 132 | + |
| 133 | + snippets : function(evt) { |
| 134 | + var snippets = Language.snippets; |
| 135 | + var trigger = this.getLastWord(); |
| 136 | + for (var i=0; i<snippets.length; i++) { |
| 137 | + if(snippets[i].input == trigger) { |
| 138 | + var content = snippets[i].output.replace(/</g,'<'); |
| 139 | + content = content.replace(/>/g,'>'); |
| 140 | + if(content.indexOf('$0')<0) content += cc; |
| 141 | + else content = content.replace(/\$0/,cc); |
| 142 | + content = content.replace(/\n/g,'<br>'); |
| 143 | + var pattern = new RegExp(trigger+cc,'gi'); |
| 144 | + evt.preventDefault(); // prevent the tab key from being added |
| 145 | + this.syntaxHighlight('snippets',pattern,content); |
| 146 | + } |
| 147 | + } |
| 148 | + }, |
| 149 | + |
| 150 | + readOnly : function() { |
| 151 | + document.designMode = (arguments[0]) ? 'off' : 'on'; |
| 152 | + }, |
| 153 | + |
| 154 | + complete : function(trigger) { |
| 155 | + window.getSelection().getRangeAt(0).deleteContents(); |
| 156 | + var complete = Language.complete; |
| 157 | + for (var i=0; i<complete.length; i++) { |
| 158 | + if(complete[i].input == trigger) { |
| 159 | + var pattern = new RegExp('\\'+trigger+cc); |
| 160 | + var content = complete[i].output.replace(/\$0/g,cc); |
| 161 | + parent.setTimeout(function () { CodePress.syntaxHighlight('complete',pattern,content)},0); // wait for char to appear on screen |
| 162 | + } |
| 163 | + } |
| 164 | + }, |
| 165 | + |
| 166 | + getCompleteChars : function() { |
| 167 | + var cChars = ''; |
| 168 | + for(var i=0;i<Language.complete.length;i++) |
| 169 | + cChars += '|'+Language.complete[i].input; |
| 170 | + return cChars+'|'; |
| 171 | + }, |
| 172 | + |
| 173 | + shortcuts : function() { |
| 174 | + var cCode = arguments[0]; |
| 175 | + if(cCode==13) cCode = '[enter]'; |
| 176 | + else if(cCode==32) cCode = '[space]'; |
| 177 | + else cCode = '['+String.fromCharCode(charCode).toLowerCase()+']'; |
| 178 | + for(var i=0;i<Language.shortcuts.length;i++) |
| 179 | + if(Language.shortcuts[i].input == cCode) |
| 180 | + this.insertCode(Language.shortcuts[i].output,false); |
| 181 | + }, |
| 182 | + |
| 183 | + getRangeAndCaret : function() { |
| 184 | + var range = window.getSelection().getRangeAt(0); |
| 185 | + var range2 = range.cloneRange(); |
| 186 | + var node = range.endContainer; |
| 187 | + var caret = range.endOffset; |
| 188 | + range2.selectNode(node); |
| 189 | + return [range2.toString(),caret]; |
| 190 | + }, |
| 191 | + |
| 192 | + insertCode : function(code,replaceCursorBefore) { |
| 193 | + var range = window.getSelection().getRangeAt(0); |
| 194 | + var node = window.document.createTextNode(code); |
| 195 | + var selct = window.getSelection(); |
| 196 | + var range2 = range.cloneRange(); |
| 197 | + // Insert text at cursor position |
| 198 | + selct.removeAllRanges(); |
| 199 | + range.deleteContents(); |
| 200 | + range.insertNode(node); |
| 201 | + // Move the cursor to the end of text |
| 202 | + range2.selectNode(node); |
| 203 | + range2.collapse(replaceCursorBefore); |
| 204 | + selct.removeAllRanges(); |
| 205 | + selct.addRange(range2); |
| 206 | + }, |
| 207 | + |
| 208 | + // get code from editor |
| 209 | + getCode : function() { |
| 210 | + var code = editor.innerHTML; |
| 211 | + code = code.replace(/<br>/g,'\n'); |
| 212 | + code = code.replace(/\u2009/g,''); |
| 213 | + code = code.replace(/<.*?>/g,''); |
| 214 | + code = code.replace(/</g,'<'); |
| 215 | + code = code.replace(/>/g,'>'); |
| 216 | + code = code.replace(/&/gi,'&'); |
| 217 | + return code; |
| 218 | + }, |
| 219 | + |
| 220 | + // put code inside editor |
| 221 | + setCode : function() { |
| 222 | + var code = arguments[0]; |
| 223 | + code = code.replace(/\u2009/gi,''); |
| 224 | + code = code.replace(/&/gi,'&'); |
| 225 | + code = code.replace(/</g,'<'); |
| 226 | + code = code.replace(/>/g,'>'); |
| 227 | + editor.innerHTML = code; |
| 228 | + }, |
| 229 | + |
| 230 | + // undo and redo methods |
| 231 | + actions : { |
| 232 | + pos : -1, // actual history position |
| 233 | + history : [], // history vector |
| 234 | + |
| 235 | + undo : function() { |
| 236 | + if(editor.innerHTML.indexOf(cc)==-1){ |
| 237 | + window.getSelection().getRangeAt(0).insertNode(document.createTextNode(cc)); |
| 238 | + this.history[this.pos] = editor.innerHTML; |
| 239 | + } |
| 240 | + this.pos--; |
| 241 | + if(typeof(this.history[this.pos])=='undefined') this.pos++; |
| 242 | + editor.innerHTML = this.history[this.pos]; |
| 243 | + CodePress.findString(); |
| 244 | + }, |
| 245 | + |
| 246 | + redo : function() { |
| 247 | + this.pos++; |
| 248 | + if(typeof(this.history[this.pos])=='undefined') this.pos--; |
| 249 | + editor.innerHTML = this.history[this.pos]; |
| 250 | + CodePress.findString(); |
| 251 | + }, |
| 252 | + |
| 253 | + next : function() { // get next vector position and clean old ones |
| 254 | + if(this.pos>20) this.history[this.pos-21] = undefined; |
| 255 | + return ++this.pos; |
| 256 | + } |
| 257 | + } |
| 258 | +} |
| 259 | + |
| 260 | +Language={}; |
| 261 | +window.addEventListener('load', function() { CodePress.initialize('new'); }, true); |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/engines/opera.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 262 | + native |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/engines/gecko.js |
— | — | @@ -0,0 +1,293 @@ |
| 2 | +/* |
| 3 | + * CodePress - Real Time Syntax Highlighting Editor written in JavaScript - http://codepress.org/ |
| 4 | + * |
| 5 | + * Copyright (C) 2007 Fernando M.A.d.S. <fermads@gmail.com> |
| 6 | + * |
| 7 | + * Developers: |
| 8 | + * Fernando M.A.d.S. <fermads@gmail.com> |
| 9 | + * Michael Hurni <michael.hurni@gmail.com> |
| 10 | + * Contributors: |
| 11 | + * Martin D. Kirk |
| 12 | + * |
| 13 | + * This program is free software; you can redistribute it and/or modify it under the terms of the |
| 14 | + * GNU Lesser General Public License as published by the Free Software Foundation. |
| 15 | + * |
| 16 | + * Read the full licence: http://www.opensource.org/licenses/lgpl-license.php |
| 17 | + */ |
| 18 | + |
| 19 | +CodePress = { |
| 20 | + scrolling : false, |
| 21 | + autocomplete : true, |
| 22 | + |
| 23 | + // set initial vars and start sh |
| 24 | + initialize : function() { |
| 25 | + if(typeof(editor)=='undefined' && !arguments[0]) return; |
| 26 | + body = document.getElementsByTagName('body')[0]; |
| 27 | + body.innerHTML = body.innerHTML.replace(/\n/g,""); |
| 28 | + chars = '|32|46|62|8|'; // charcodes that trigger syntax highlighting |
| 29 | + cc = '\u2009'; // carret char |
| 30 | + editor = document.getElementsByTagName('pre')[0]; |
| 31 | + document.designMode = 'on'; |
| 32 | + document.addEventListener('keypress', this.keyHandler, true); |
| 33 | + window.addEventListener('scroll', function() { if(!CodePress.scrolling) CodePress.syntaxHighlight('scroll') }, false); |
| 34 | + completeChars = this.getCompleteChars(); |
| 35 | + completeEndingChars = this.getCompleteEndingChars(); |
| 36 | + }, |
| 37 | + |
| 38 | + // treat key bindings |
| 39 | + keyHandler : function(evt) { |
| 40 | + keyCode = evt.keyCode; |
| 41 | + charCode = evt.charCode; |
| 42 | + fromChar = String.fromCharCode(charCode); |
| 43 | + |
| 44 | + if((evt.ctrlKey || evt.metaKey) && evt.shiftKey && charCode!=90) { // shortcuts = ctrl||appleKey+shift+key!=z(undo) |
| 45 | + CodePress.shortcuts(charCode?charCode:keyCode); |
| 46 | + } |
| 47 | + else if( (completeEndingChars.indexOf('|'+fromChar+'|')!= -1 || completeChars.indexOf('|'+fromChar+'|')!=-1) && CodePress.autocomplete) { // auto complete |
| 48 | + if(!CodePress.completeEnding(fromChar)) |
| 49 | + CodePress.complete(fromChar); |
| 50 | + } |
| 51 | + else if(chars.indexOf('|'+charCode+'|')!=-1||keyCode==13) { // syntax highlighting |
| 52 | + top.setTimeout(function(){CodePress.syntaxHighlight('generic');},100); |
| 53 | + } |
| 54 | + else if(keyCode==9 || evt.tabKey) { // snippets activation (tab) |
| 55 | + CodePress.snippets(evt); |
| 56 | + } |
| 57 | + else if(keyCode==46||keyCode==8) { // save to history when delete or backspace pressed |
| 58 | + CodePress.actions.history[CodePress.actions.next()] = editor.innerHTML; |
| 59 | + } |
| 60 | + else if((charCode==122||charCode==121||charCode==90) && evt.ctrlKey) { // undo and redo |
| 61 | + (charCode==121||evt.shiftKey) ? CodePress.actions.redo() : CodePress.actions.undo(); |
| 62 | + evt.preventDefault(); |
| 63 | + } |
| 64 | + else if(charCode==118 && evt.ctrlKey) { // handle paste |
| 65 | + top.setTimeout(function(){CodePress.syntaxHighlight('generic');},100); |
| 66 | + } |
| 67 | + else if(charCode==99 && evt.ctrlKey) { // handle cut |
| 68 | + //alert(window.getSelection().getRangeAt(0).toString().replace(/\t/g,'FFF')); |
| 69 | + } |
| 70 | + |
| 71 | + }, |
| 72 | + |
| 73 | + // put cursor back to its original position after every parsing |
| 74 | + findString : function() { |
| 75 | + if(self.find(cc)) |
| 76 | + window.getSelection().getRangeAt(0).deleteContents(); |
| 77 | + }, |
| 78 | + |
| 79 | + // split big files, highlighting parts of it |
| 80 | + split : function(code,flag) { |
| 81 | + if(flag=='scroll') { |
| 82 | + this.scrolling = true; |
| 83 | + return code; |
| 84 | + } |
| 85 | + else { |
| 86 | + this.scrolling = false; |
| 87 | + mid = code.indexOf(cc); |
| 88 | + if(mid-2000<0) {ini=0;end=4000;} |
| 89 | + else if(mid+2000>code.length) {ini=code.length-4000;end=code.length;} |
| 90 | + else {ini=mid-2000;end=mid+2000;} |
| 91 | + code = code.substring(ini,end); |
| 92 | + return code; |
| 93 | + } |
| 94 | + }, |
| 95 | + |
| 96 | + getEditor : function() { |
| 97 | + if(!document.getElementsByTagName('pre')[0]) { |
| 98 | + body = document.getElementsByTagName('body')[0]; |
| 99 | + if(!body.innerHTML) return body; |
| 100 | + if(body.innerHTML=="<br>") body.innerHTML = "<pre> </pre>"; |
| 101 | + else body.innerHTML = "<pre>"+body.innerHTML+"</pre>"; |
| 102 | + } |
| 103 | + return document.getElementsByTagName('pre')[0]; |
| 104 | + }, |
| 105 | + |
| 106 | + // syntax highlighting parser |
| 107 | + syntaxHighlight : function(flag) { |
| 108 | + //if(document.designMode=='off') document.designMode='on' |
| 109 | + if(flag != 'init') { window.getSelection().getRangeAt(0).insertNode(document.createTextNode(cc));} |
| 110 | + editor = CodePress.getEditor(); |
| 111 | + o = editor.innerHTML; |
| 112 | + o = o.replace(/<br>/g,'\n'); |
| 113 | + o = o.replace(/<.*?>/g,''); |
| 114 | + x = z = this.split(o,flag); |
| 115 | + x = x.replace(/\n/g,'<br>'); |
| 116 | + |
| 117 | + if(arguments[1]&&arguments[2]) x = x.replace(arguments[1],arguments[2]); |
| 118 | + |
| 119 | + for(i=0;i<Language.syntax.length;i++) |
| 120 | + x = x.replace(Language.syntax[i].input,Language.syntax[i].output); |
| 121 | + |
| 122 | + editor.innerHTML = this.actions.history[this.actions.next()] = (flag=='scroll') ? x : o.split(z).join(x); |
| 123 | + if(flag!='init') this.findString(); |
| 124 | + }, |
| 125 | + |
| 126 | + getLastWord : function() { |
| 127 | + var rangeAndCaret = CodePress.getRangeAndCaret(); |
| 128 | + words = rangeAndCaret[0].substring(rangeAndCaret[1]-40,rangeAndCaret[1]); |
| 129 | + words = words.replace(/[\s\n\r\);\W]/g,'\n').split('\n'); |
| 130 | + return words[words.length-1].replace(/[\W]/gi,'').toLowerCase(); |
| 131 | + }, |
| 132 | + |
| 133 | + snippets : function(evt) { |
| 134 | + var snippets = Language.snippets; |
| 135 | + var trigger = this.getLastWord(); |
| 136 | + for (var i=0; i<snippets.length; i++) { |
| 137 | + if(snippets[i].input == trigger) { |
| 138 | + var content = snippets[i].output.replace(/</g,'<'); |
| 139 | + content = content.replace(/>/g,'>'); |
| 140 | + if(content.indexOf('$0')<0) content += cc; |
| 141 | + else content = content.replace(/\$0/,cc); |
| 142 | + content = content.replace(/\n/g,'<br>'); |
| 143 | + var pattern = new RegExp(trigger+cc,'gi'); |
| 144 | + evt.preventDefault(); // prevent the tab key from being added |
| 145 | + this.syntaxHighlight('snippets',pattern,content); |
| 146 | + } |
| 147 | + } |
| 148 | + }, |
| 149 | + |
| 150 | + readOnly : function() { |
| 151 | + document.designMode = (arguments[0]) ? 'off' : 'on'; |
| 152 | + }, |
| 153 | + |
| 154 | + complete : function(trigger) { |
| 155 | + window.getSelection().getRangeAt(0).deleteContents(); |
| 156 | + var complete = Language.complete; |
| 157 | + for (var i=0; i<complete.length; i++) { |
| 158 | + if(complete[i].input == trigger) { |
| 159 | + var pattern = new RegExp('\\'+trigger+cc); |
| 160 | + var content = complete[i].output.replace(/\$0/g,cc); |
| 161 | + parent.setTimeout(function () { CodePress.syntaxHighlight('complete',pattern,content)},0); // wait for char to appear on screen |
| 162 | + } |
| 163 | + } |
| 164 | + }, |
| 165 | + |
| 166 | + getCompleteChars : function() { |
| 167 | + var cChars = ''; |
| 168 | + for(var i=0;i<Language.complete.length;i++) |
| 169 | + cChars += '|'+Language.complete[i].input; |
| 170 | + return cChars+'|'; |
| 171 | + }, |
| 172 | + |
| 173 | + getCompleteEndingChars : function() { |
| 174 | + var cChars = ''; |
| 175 | + for(var i=0;i<Language.complete.length;i++) |
| 176 | + cChars += '|'+Language.complete[i].output.charAt(Language.complete[i].output.length-1); |
| 177 | + return cChars+'|'; |
| 178 | + }, |
| 179 | + |
| 180 | + completeEnding : function(trigger) { |
| 181 | + var range = window.getSelection().getRangeAt(0); |
| 182 | + try { |
| 183 | + range.setEnd(range.endContainer, range.endOffset+1) |
| 184 | + } |
| 185 | + catch(e) { |
| 186 | + return false; |
| 187 | + } |
| 188 | + var next_character = range.toString() |
| 189 | + range.setEnd(range.endContainer, range.endOffset-1) |
| 190 | + if(next_character != trigger) return false; |
| 191 | + else { |
| 192 | + range.setEnd(range.endContainer, range.endOffset+1) |
| 193 | + range.deleteContents(); |
| 194 | + return true; |
| 195 | + } |
| 196 | + }, |
| 197 | + |
| 198 | + shortcuts : function() { |
| 199 | + var cCode = arguments[0]; |
| 200 | + if(cCode==13) cCode = '[enter]'; |
| 201 | + else if(cCode==32) cCode = '[space]'; |
| 202 | + else cCode = '['+String.fromCharCode(charCode).toLowerCase()+']'; |
| 203 | + for(var i=0;i<Language.shortcuts.length;i++) |
| 204 | + if(Language.shortcuts[i].input == cCode) |
| 205 | + this.insertCode(Language.shortcuts[i].output,false); |
| 206 | + }, |
| 207 | + |
| 208 | + getRangeAndCaret : function() { |
| 209 | + var range = window.getSelection().getRangeAt(0); |
| 210 | + var range2 = range.cloneRange(); |
| 211 | + var node = range.endContainer; |
| 212 | + var caret = range.endOffset; |
| 213 | + range2.selectNode(node); |
| 214 | + return [range2.toString(),caret]; |
| 215 | + }, |
| 216 | + |
| 217 | + insertCode : function(code,replaceCursorBefore) { |
| 218 | + var range = window.getSelection().getRangeAt(0); |
| 219 | + var node = window.document.createTextNode(code); |
| 220 | + var selct = window.getSelection(); |
| 221 | + var range2 = range.cloneRange(); |
| 222 | + // Insert text at cursor position |
| 223 | + selct.removeAllRanges(); |
| 224 | + range.deleteContents(); |
| 225 | + range.insertNode(node); |
| 226 | + // Move the cursor to the end of text |
| 227 | + range2.selectNode(node); |
| 228 | + range2.collapse(replaceCursorBefore); |
| 229 | + selct.removeAllRanges(); |
| 230 | + selct.addRange(range2); |
| 231 | + }, |
| 232 | + |
| 233 | + // get code from editor |
| 234 | + getCode : function() { |
| 235 | + if(!document.getElementsByTagName('pre')[0] || editor.innerHTML == '') |
| 236 | + editor = CodePress.getEditor(); |
| 237 | + var code = editor.innerHTML; |
| 238 | + code = code.replace(/<br>/g,'\n'); |
| 239 | + code = code.replace(/\u2009/g,''); |
| 240 | + code = code.replace(/<.*?>/g,''); |
| 241 | + code = code.replace(/</g,'<'); |
| 242 | + code = code.replace(/>/g,'>'); |
| 243 | + code = code.replace(/&/gi,'&'); |
| 244 | + return code; |
| 245 | + }, |
| 246 | + |
| 247 | + // put code inside editor |
| 248 | + setCode : function() { |
| 249 | + var code = arguments[0]; |
| 250 | + code = code.replace(/\u2009/gi,''); |
| 251 | + code = code.replace(/&/gi,'&'); |
| 252 | + code = code.replace(/</g,'<'); |
| 253 | + code = code.replace(/>/g,'>'); |
| 254 | + editor.innerHTML = code; |
| 255 | + if (code == '') |
| 256 | + document.getElementsByTagName('body')[0].innerHTML = ''; |
| 257 | + }, |
| 258 | + |
| 259 | + // undo and redo methods |
| 260 | + actions : { |
| 261 | + pos : -1, // actual history position |
| 262 | + history : [], // history vector |
| 263 | + |
| 264 | + undo : function() { |
| 265 | + editor = CodePress.getEditor(); |
| 266 | + if(editor.innerHTML.indexOf(cc)==-1){ |
| 267 | + if(editor.innerHTML != " ") |
| 268 | + window.getSelection().getRangeAt(0).insertNode(document.createTextNode(cc)); |
| 269 | + this.history[this.pos] = editor.innerHTML; |
| 270 | + } |
| 271 | + this.pos --; |
| 272 | + if(typeof(this.history[this.pos])=='undefined') this.pos ++; |
| 273 | + editor.innerHTML = this.history[this.pos]; |
| 274 | + if(editor.innerHTML.indexOf(cc)>-1) editor.innerHTML+=cc; |
| 275 | + CodePress.findString(); |
| 276 | + }, |
| 277 | + |
| 278 | + redo : function() { |
| 279 | + // editor = CodePress.getEditor(); |
| 280 | + this.pos++; |
| 281 | + if(typeof(this.history[this.pos])=='undefined') this.pos--; |
| 282 | + editor.innerHTML = this.history[this.pos]; |
| 283 | + CodePress.findString(); |
| 284 | + }, |
| 285 | + |
| 286 | + next : function() { // get next vector position and clean old ones |
| 287 | + if(this.pos>20) this.history[this.pos-21] = undefined; |
| 288 | + return ++this.pos; |
| 289 | + } |
| 290 | + } |
| 291 | +} |
| 292 | + |
| 293 | +Language={}; |
| 294 | +window.addEventListener('load', function() { CodePress.initialize('new'); }, true); |
\ No newline at end of file |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/engines/gecko.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 295 | + native |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/engines/msie.js |
— | — | @@ -0,0 +1,304 @@ |
| 2 | +/* |
| 3 | + * CodePress - Real Time Syntax Highlighting Editor written in JavaScript - http://codepress.org/ |
| 4 | + * |
| 5 | + * Copyright (C) 2007 Fernando M.A.d.S. <fermads@gmail.com> |
| 6 | + * |
| 7 | + * Developers: |
| 8 | + * Fernando M.A.d.S. <fermads@gmail.com> |
| 9 | + * Michael Hurni <michael.hurni@gmail.com> |
| 10 | + * Contributors: |
| 11 | + * Martin D. Kirk |
| 12 | + * |
| 13 | + * This program is free software; you can redistribute it and/or modify it under the terms of the |
| 14 | + * GNU Lesser General Public License as published by the Free Software Foundation. |
| 15 | + * |
| 16 | + * Read the full licence: http://www.opensource.org/licenses/lgpl-license.php |
| 17 | + */ |
| 18 | + |
| 19 | +CodePress = { |
| 20 | + scrolling : false, |
| 21 | + autocomplete : true, |
| 22 | + |
| 23 | + // set initial vars and start sh |
| 24 | + initialize : function() { |
| 25 | + if(typeof(editor)=='undefined' && !arguments[0]) return; |
| 26 | + chars = '|32|46|62|'; // charcodes that trigger syntax highlighting |
| 27 | + cc = '\u2009'; // carret char |
| 28 | + editor = document.getElementsByTagName('pre')[0]; |
| 29 | + editor.contentEditable = 'true'; |
| 30 | + document.getElementsByTagName('body')[0].onfocus = function() {editor.focus();} |
| 31 | + document.attachEvent('onkeydown', this.metaHandler); |
| 32 | + document.attachEvent('onkeypress', this.keyHandler); |
| 33 | + window.attachEvent('onscroll', function() { if(!CodePress.scrolling) setTimeout(function(){CodePress.syntaxHighlight('scroll')},1)}); |
| 34 | + completeChars = this.getCompleteChars(); |
| 35 | + completeEndingChars = this.getCompleteEndingChars(); |
| 36 | + setTimeout(function() { window.scroll(0,0) },50); // scroll IE to top |
| 37 | + }, |
| 38 | + |
| 39 | + // treat key bindings |
| 40 | + keyHandler : function(evt) { |
| 41 | + charCode = evt.keyCode; |
| 42 | + fromChar = String.fromCharCode(charCode); |
| 43 | + |
| 44 | + if( (completeEndingChars.indexOf('|'+fromChar+'|')!= -1 || completeChars.indexOf('|'+fromChar+'|')!=-1 )&& CodePress.autocomplete) { // auto complete |
| 45 | + if(!CodePress.completeEnding(fromChar)) |
| 46 | + CodePress.complete(fromChar); |
| 47 | + } |
| 48 | + else if(chars.indexOf('|'+charCode+'|')!=-1||charCode==13) { // syntax highlighting |
| 49 | + CodePress.syntaxHighlight('generic'); |
| 50 | + } |
| 51 | + }, |
| 52 | + |
| 53 | + metaHandler : function(evt) { |
| 54 | + keyCode = evt.keyCode; |
| 55 | + |
| 56 | + if(keyCode==9 || evt.tabKey) { |
| 57 | + CodePress.snippets(); |
| 58 | + } |
| 59 | + else if((keyCode==122||keyCode==121||keyCode==90) && evt.ctrlKey) { // undo and redo |
| 60 | + (keyCode==121||evt.shiftKey) ? CodePress.actions.redo() : CodePress.actions.undo(); |
| 61 | + evt.returnValue = false; |
| 62 | + } |
| 63 | + else if(keyCode==34||keyCode==33) { // handle page up/down for IE |
| 64 | + self.scrollBy(0, (keyCode==34) ? 200 : -200); |
| 65 | + evt.returnValue = false; |
| 66 | + } |
| 67 | + else if(keyCode==46||keyCode==8) { // save to history when delete or backspace pressed |
| 68 | + CodePress.actions.history[CodePress.actions.next()] = editor.innerHTML; |
| 69 | + } |
| 70 | + else if((evt.ctrlKey || evt.metaKey) && evt.shiftKey && keyCode!=90) { // shortcuts = ctrl||appleKey+shift+key!=z(undo) |
| 71 | + CodePress.shortcuts(keyCode); |
| 72 | + evt.returnValue = false; |
| 73 | + } |
| 74 | + else if(keyCode==86 && evt.ctrlKey) { // handle paste |
| 75 | + window.clipboardData.setData('Text',window.clipboardData.getData('Text').replace(/\t/g,'\u2008')); |
| 76 | + top.setTimeout(function(){CodePress.syntaxHighlight('paste');},10); |
| 77 | + } |
| 78 | + else if(keyCode==67 && evt.ctrlKey) { // handle cut |
| 79 | + // window.clipboardData.setData('Text',x[0]); |
| 80 | + // code = window.clipboardData.getData('Text'); |
| 81 | + } |
| 82 | + }, |
| 83 | + |
| 84 | + // put cursor back to its original position after every parsing |
| 85 | + |
| 86 | + |
| 87 | + findString : function() { |
| 88 | + range = self.document.body.createTextRange(); |
| 89 | + if(range.findText(cc)){ |
| 90 | + range.select(); |
| 91 | + range.text = ''; |
| 92 | + } |
| 93 | + }, |
| 94 | + |
| 95 | + // split big files, highlighting parts of it |
| 96 | + split : function(code,flag) { |
| 97 | + if(flag=='scroll') { |
| 98 | + this.scrolling = true; |
| 99 | + return code; |
| 100 | + } |
| 101 | + else { |
| 102 | + this.scrolling = false; |
| 103 | + mid = code.indexOf(cc); |
| 104 | + if(mid-2000<0) {ini=0;end=4000;} |
| 105 | + else if(mid+2000>code.length) {ini=code.length-4000;end=code.length;} |
| 106 | + else {ini=mid-2000;end=mid+2000;} |
| 107 | + code = code.substring(ini,end); |
| 108 | + return code.substring(code.indexOf('<P>'),code.lastIndexOf('</P>')+4); |
| 109 | + } |
| 110 | + }, |
| 111 | + |
| 112 | + // syntax highlighting parser |
| 113 | + syntaxHighlight : function(flag) { |
| 114 | + if(flag!='init') document.selection.createRange().text = cc; |
| 115 | + o = editor.innerHTML; |
| 116 | + if(flag=='paste') { // fix pasted text |
| 117 | + o = o.replace(/<BR>/g,'\r\n'); |
| 118 | + o = o.replace(/\u2008/g,'\t'); |
| 119 | + } |
| 120 | + o = o.replace(/<P>/g,'\n'); |
| 121 | + o = o.replace(/<\/P>/g,'\r'); |
| 122 | + o = o.replace(/<.*?>/g,''); |
| 123 | + o = o.replace(/ /g,''); |
| 124 | + o = '<PRE><P>'+o+'</P></PRE>'; |
| 125 | + o = o.replace(/\n\r/g,'<P></P>'); |
| 126 | + o = o.replace(/\n/g,'<P>'); |
| 127 | + o = o.replace(/\r/g,'<\/P>'); |
| 128 | + o = o.replace(/<P>(<P>)+/,'<P>'); |
| 129 | + o = o.replace(/<\/P>(<\/P>)+/,'</P>'); |
| 130 | + o = o.replace(/<P><\/P>/g,'<P><BR/></P>'); |
| 131 | + x = z = this.split(o,flag); |
| 132 | + |
| 133 | + if(arguments[1]&&arguments[2]) x = x.replace(arguments[1],arguments[2]); |
| 134 | + |
| 135 | + for(i=0;i<Language.syntax.length;i++) |
| 136 | + x = x.replace(Language.syntax[i].input,Language.syntax[i].output); |
| 137 | + |
| 138 | + editor.innerHTML = this.actions.history[this.actions.next()] = (flag=='scroll') ? x : o.replace(z,x); |
| 139 | + if(flag!='init') this.findString(); |
| 140 | + }, |
| 141 | + |
| 142 | + snippets : function(evt) { |
| 143 | + var snippets = Language.snippets; |
| 144 | + var trigger = this.getLastWord(); |
| 145 | + for (var i=0; i<snippets.length; i++) { |
| 146 | + if(snippets[i].input == trigger) { |
| 147 | + var content = snippets[i].output.replace(/</g,'<'); |
| 148 | + content = content.replace(/>/g,'>'); |
| 149 | + if(content.indexOf('$0')<0) content += cc; |
| 150 | + else content = content.replace(/\$0/,cc); |
| 151 | + content = content.replace(/\n/g,'</P><P>'); |
| 152 | + var pattern = new RegExp(trigger+cc,"gi"); |
| 153 | + this.syntaxHighlight('snippets',pattern,content); |
| 154 | + } |
| 155 | + } |
| 156 | + }, |
| 157 | + |
| 158 | + readOnly : function() { |
| 159 | + editor.contentEditable = (arguments[0]) ? 'false' : 'true'; |
| 160 | + }, |
| 161 | + |
| 162 | + complete : function(trigger) { |
| 163 | + var complete = Language.complete; |
| 164 | + for (var i=0; i<complete.length; i++) { |
| 165 | + if(complete[i].input == trigger) { |
| 166 | + var pattern = new RegExp('\\'+trigger+cc); |
| 167 | + var content = complete[i].output.replace(/\$0/g,cc); |
| 168 | + setTimeout(function () { CodePress.syntaxHighlight('complete',pattern,content)},0); // wait for char to appear on screen |
| 169 | + } |
| 170 | + } |
| 171 | + }, |
| 172 | + |
| 173 | + getCompleteChars : function() { |
| 174 | + var cChars = ''; |
| 175 | + for(var i=0;i<Language.complete.length;i++) |
| 176 | + cChars += '|'+Language.complete[i].input; |
| 177 | + return cChars+'|'; |
| 178 | + }, |
| 179 | + |
| 180 | + getCompleteEndingChars : function() { |
| 181 | + var cChars = ''; |
| 182 | + for(var i=0;i<Language.complete.length;i++) |
| 183 | + cChars += '|'+Language.complete[i].output.charAt(Language.complete[i].output.length-1); |
| 184 | + return cChars+'|'; |
| 185 | + }, |
| 186 | + |
| 187 | + completeEnding : function(trigger) { |
| 188 | + var range = document.selection.createRange(); |
| 189 | + try { |
| 190 | + range.moveEnd('character', 1) |
| 191 | + } |
| 192 | + catch(e) { |
| 193 | + return false; |
| 194 | + } |
| 195 | + var next_character = range.text |
| 196 | + range.moveEnd('character', -1) |
| 197 | + if(next_character != trigger ) return false; |
| 198 | + else { |
| 199 | + range.moveEnd('character', 1) |
| 200 | + range.text='' |
| 201 | + return true; |
| 202 | + } |
| 203 | + }, |
| 204 | + |
| 205 | + shortcuts : function() { |
| 206 | + var cCode = arguments[0]; |
| 207 | + if(cCode==13) cCode = '[enter]'; |
| 208 | + else if(cCode==32) cCode = '[space]'; |
| 209 | + else cCode = '['+String.fromCharCode(keyCode).toLowerCase()+']'; |
| 210 | + for(var i=0;i<Language.shortcuts.length;i++) |
| 211 | + if(Language.shortcuts[i].input == cCode) |
| 212 | + this.insertCode(Language.shortcuts[i].output,false); |
| 213 | + }, |
| 214 | + |
| 215 | + getLastWord : function() { |
| 216 | + var rangeAndCaret = CodePress.getRangeAndCaret(); |
| 217 | + words = rangeAndCaret[0].substring(rangeAndCaret[1]-40,rangeAndCaret[1]); |
| 218 | + words = words.replace(/[\s\n\r\);\W]/g,'\n').split('\n'); |
| 219 | + return words[words.length-1].replace(/[\W]/gi,'').toLowerCase(); |
| 220 | + }, |
| 221 | + |
| 222 | + getRangeAndCaret : function() { |
| 223 | + var range = document.selection.createRange(); |
| 224 | + var caret = Math.abs(range.moveStart('character', -1000000)+1); |
| 225 | + range = this.getCode(); |
| 226 | + range = range.replace(/\n\r/gi,' '); |
| 227 | + range = range.replace(/\n/gi,''); |
| 228 | + return [range.toString(),caret]; |
| 229 | + }, |
| 230 | + |
| 231 | + insertCode : function(code,replaceCursorBefore) { |
| 232 | + var repdeb = ''; |
| 233 | + var repfin = ''; |
| 234 | + |
| 235 | + if(replaceCursorBefore) { repfin = code; } |
| 236 | + else { repdeb = code; } |
| 237 | + |
| 238 | + if(typeof document.selection != 'undefined') { |
| 239 | + var range = document.selection.createRange(); |
| 240 | + range.text = repdeb + repfin; |
| 241 | + range = document.selection.createRange(); |
| 242 | + range.move('character', -repfin.length); |
| 243 | + range.select(); |
| 244 | + } |
| 245 | + }, |
| 246 | + |
| 247 | + // get code from editor |
| 248 | + getCode : function() { |
| 249 | + var code = editor.innerHTML; |
| 250 | + code = code.replace(/<br>/g,'\n'); |
| 251 | + code = code.replace(/<\/p>/gi,'\r'); |
| 252 | + code = code.replace(/<p>/i,''); // IE first line fix |
| 253 | + code = code.replace(/<p>/gi,'\n'); |
| 254 | + code = code.replace(/ /gi,''); |
| 255 | + code = code.replace(/\u2009/g,''); |
| 256 | + code = code.replace(/<.*?>/g,''); |
| 257 | + code = code.replace(/</g,'<'); |
| 258 | + code = code.replace(/>/g,'>'); |
| 259 | + code = code.replace(/&/gi,'&'); |
| 260 | + return code; |
| 261 | + }, |
| 262 | + |
| 263 | + // put code inside editor |
| 264 | + setCode : function() { |
| 265 | + var code = arguments[0]; |
| 266 | + code = code.replace(/\u2009/gi,''); |
| 267 | + code = code.replace(/&/gi,'&'); |
| 268 | + code = code.replace(/</g,'<'); |
| 269 | + code = code.replace(/>/g,'>'); |
| 270 | + editor.innerHTML = '<pre>'+code+'</pre>'; |
| 271 | + }, |
| 272 | + |
| 273 | + |
| 274 | + // undo and redo methods |
| 275 | + actions : { |
| 276 | + pos : -1, // actual history position |
| 277 | + history : [], // history vector |
| 278 | + |
| 279 | + undo : function() { |
| 280 | + if(editor.innerHTML.indexOf(cc)==-1){ |
| 281 | + document.selection.createRange().text = cc; |
| 282 | + this.history[this.pos] = editor.innerHTML; |
| 283 | + } |
| 284 | + this.pos--; |
| 285 | + if(typeof(this.history[this.pos])=='undefined') this.pos++; |
| 286 | + editor.innerHTML = this.history[this.pos]; |
| 287 | + CodePress.findString(); |
| 288 | + }, |
| 289 | + |
| 290 | + redo : function() { |
| 291 | + this.pos++; |
| 292 | + if(typeof(this.history[this.pos])=='undefined') this.pos--; |
| 293 | + editor.innerHTML = this.history[this.pos]; |
| 294 | + CodePress.findString(); |
| 295 | + }, |
| 296 | + |
| 297 | + next : function() { // get next vector position and clean old ones |
| 298 | + if(this.pos>20) this.history[this.pos-21] = undefined; |
| 299 | + return ++this.pos; |
| 300 | + } |
| 301 | + } |
| 302 | +} |
| 303 | + |
| 304 | +Language={}; |
| 305 | +window.attachEvent('onload', function() { CodePress.initialize('new');}); |
\ No newline at end of file |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/engines/msie.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 306 | + native |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/engines/khtml.js |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/engines/khtml.js |
___________________________________________________________________ |
Added: svn:eol-style |
2 | 307 | + native |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/codepress.html |
— | — | @@ -0,0 +1,35 @@ |
| 2 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
| 3 | +<html>
|
| 4 | +<head>
|
| 5 | + <title>CodePress - Real Time Syntax Highlighting Editor written in JavaScript</title>
|
| 6 | + <meta name="description" content="CodePress - source code editor window" />
|
| 7 | +
|
| 8 | + <script type="text/javascript">
|
| 9 | + var language = 'generic';
|
| 10 | + var engine = 'older';
|
| 11 | + var ua = navigator.userAgent;
|
| 12 | + var ts = (new Date).getTime(); // timestamp to avoid cache
|
| 13 | + var lh = location.href;
|
| 14 | +
|
| 15 | + if(ua.match('MSIE')) engine = 'msie';
|
| 16 | + else if(ua.match('KHTML')) engine = 'khtml';
|
| 17 | + else if(ua.match('Opera')) engine = 'opera';
|
| 18 | + else if(ua.match('Gecko')) engine = 'gecko';
|
| 19 | +
|
| 20 | + if(lh.match('language=')) language = lh.replace(/.*language=(.*?)(&.*)?$/,'$1');
|
| 21 | +
|
| 22 | + document.write('<link type="text/css" href="codepress.css?ts='+ts+'" rel="stylesheet" />');
|
| 23 | + document.write('<link type="text/css" href="languages/'+language+'.css?ts='+ts+'" rel="stylesheet" id="cp-lang-style" />');
|
| 24 | + document.write('<scr'+'ipt type="text/javascript" src="engines/'+engine+'.js?ts='+ts+'"></scr'+'ipt>');
|
| 25 | + document.write('<scr'+'ipt type="text/javascript" src="languages/'+language+'.js?ts='+ts+'"></scr'+'ipt>');
|
| 26 | + </script>
|
| 27 | +
|
| 28 | +</head>
|
| 29 | +
|
| 30 | +<script type="text/javascript">
|
| 31 | +if(engine == "msie" || engine == "gecko") document.write('<body><pre> </pre></body>');
|
| 32 | +else if(engine == "opera") document.write('<body></body>');
|
| 33 | +// else if(engine == "khtml") document.write('<body> </body>');
|
| 34 | +</script>
|
| 35 | +
|
| 36 | +</html>
|
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/codepress.css |
— | — | @@ -0,0 +1,21 @@ |
| 2 | +body { |
| 3 | + margin-top:13px; |
| 4 | + _margin-top:14px; |
| 5 | + background:white; |
| 6 | + margin-left:32px; |
| 7 | + font-family:monospace; |
| 8 | + font-size:13px; |
| 9 | + white-space:pre; |
| 10 | + background-image:url("images/line-numbers.png"); |
| 11 | + background-repeat:repeat-y; |
| 12 | + background-position:0 3px; |
| 13 | + line-height:16px; |
| 14 | + height:100%; |
| 15 | +} |
| 16 | +pre {margin:0;} |
| 17 | +html>body{background-position:0 2px;} |
| 18 | +P {margin:0;padding:0;border:0;outline:0;display:block;white-space:pre;} |
| 19 | +b, i, s, u, a, em, tt, ins, big, cite, strong, var, dfn {text-decoration:none;font-weight:normal;font-style:normal;font-size:13px;} |
| 20 | + |
| 21 | +body.hide-line-numbers {background:white;margin-left:16px;} |
| 22 | +body.show-line-numbers {background-image:url("images/line-numbers.png");margin-left:32px;} |
\ No newline at end of file |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/codepress.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 23 | + native |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/license.txt |
— | — | @@ -0,0 +1,458 @@ |
| 2 | + GNU LESSER GENERAL PUBLIC LICENSE
|
| 3 | + Version 2.1, February 1999
|
| 4 | +
|
| 5 | + Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
| 6 | + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
| 7 | + Everyone is permitted to copy and distribute verbatim copies
|
| 8 | + of this license document, but changing it is not allowed.
|
| 9 | +
|
| 10 | +[This is the first released version of the Lesser GPL. It also counts
|
| 11 | + as the successor of the GNU Library Public License, version 2, hence
|
| 12 | + the version number 2.1.]
|
| 13 | +
|
| 14 | + Preamble
|
| 15 | +
|
| 16 | + The licenses for most software are designed to take away your
|
| 17 | +freedom to share and change it. By contrast, the GNU General Public
|
| 18 | +Licenses are intended to guarantee your freedom to share and change
|
| 19 | +free software--to make sure the software is free for all its users.
|
| 20 | +
|
| 21 | + This license, the Lesser General Public License, applies to some
|
| 22 | +specially designated software packages--typically libraries--of the
|
| 23 | +Free Software Foundation and other authors who decide to use it. You
|
| 24 | +can use it too, but we suggest you first think carefully about whether
|
| 25 | +this license or the ordinary General Public License is the better
|
| 26 | +strategy to use in any particular case, based on the explanations below.
|
| 27 | +
|
| 28 | + When we speak of free software, we are referring to freedom of use,
|
| 29 | +not price. Our General Public Licenses are designed to make sure that
|
| 30 | +you have the freedom to distribute copies of free software (and charge
|
| 31 | +for this service if you wish); that you receive source code or can get
|
| 32 | +it if you want it; that you can change the software and use pieces of
|
| 33 | +it in new free programs; and that you are informed that you can do
|
| 34 | +these things.
|
| 35 | +
|
| 36 | + To protect your rights, we need to make restrictions that forbid
|
| 37 | +distributors to deny you these rights or to ask you to surrender these
|
| 38 | +rights. These restrictions translate to certain responsibilities for
|
| 39 | +you if you distribute copies of the library or if you modify it.
|
| 40 | +
|
| 41 | + For example, if you distribute copies of the library, whether gratis
|
| 42 | +or for a fee, you must give the recipients all the rights that we gave
|
| 43 | +you. You must make sure that they, too, receive or can get the source
|
| 44 | +code. If you link other code with the library, you must provide
|
| 45 | +complete object files to the recipients, so that they can relink them
|
| 46 | +with the library after making changes to the library and recompiling
|
| 47 | +it. And you must show them these terms so they know their rights.
|
| 48 | +
|
| 49 | + We protect your rights with a two-step method: (1) we copyright the
|
| 50 | +library, and (2) we offer you this license, which gives you legal
|
| 51 | +permission to copy, distribute and/or modify the library.
|
| 52 | +
|
| 53 | + To protect each distributor, we want to make it very clear that
|
| 54 | +there is no warranty for the free library. Also, if the library is
|
| 55 | +modified by someone else and passed on, the recipients should know
|
| 56 | +that what they have is not the original version, so that the original
|
| 57 | +author's reputation will not be affected by problems that might be
|
| 58 | +introduced by others.
|
| 59 | +
|
| 60 | + Finally, software patents pose a constant threat to the existence of
|
| 61 | +any free program. We wish to make sure that a company cannot
|
| 62 | +effectively restrict the users of a free program by obtaining a
|
| 63 | +restrictive license from a patent holder. Therefore, we insist that
|
| 64 | +any patent license obtained for a version of the library must be
|
| 65 | +consistent with the full freedom of use specified in this license.
|
| 66 | +
|
| 67 | + Most GNU software, including some libraries, is covered by the
|
| 68 | +ordinary GNU General Public License. This license, the GNU Lesser
|
| 69 | +General Public License, applies to certain designated libraries, and
|
| 70 | +is quite different from the ordinary General Public License. We use
|
| 71 | +this license for certain libraries in order to permit linking those
|
| 72 | +libraries into non-free programs.
|
| 73 | +
|
| 74 | + When a program is linked with a library, whether statically or using
|
| 75 | +a shared library, the combination of the two is legally speaking a
|
| 76 | +combined work, a derivative of the original library. The ordinary
|
| 77 | +General Public License therefore permits such linking only if the
|
| 78 | +entire combination fits its criteria of freedom. The Lesser General
|
| 79 | +Public License permits more lax criteria for linking other code with
|
| 80 | +the library.
|
| 81 | +
|
| 82 | + We call this license the "Lesser" General Public License because it
|
| 83 | +does Less to protect the user's freedom than the ordinary General
|
| 84 | +Public License. It also provides other free software developers Less
|
| 85 | +of an advantage over competing non-free programs. These disadvantages
|
| 86 | +are the reason we use the ordinary General Public License for many
|
| 87 | +libraries. However, the Lesser license provides advantages in certain
|
| 88 | +special circumstances.
|
| 89 | +
|
| 90 | + For example, on rare occasions, there may be a special need to
|
| 91 | +encourage the widest possible use of a certain library, so that it becomes
|
| 92 | +a de-facto standard. To achieve this, non-free programs must be
|
| 93 | +allowed to use the library. A more frequent case is that a free
|
| 94 | +library does the same job as widely used non-free libraries. In this
|
| 95 | +case, there is little to gain by limiting the free library to free
|
| 96 | +software only, so we use the Lesser General Public License.
|
| 97 | +
|
| 98 | + In other cases, permission to use a particular library in non-free
|
| 99 | +programs enables a greater number of people to use a large body of
|
| 100 | +free software. For example, permission to use the GNU C Library in
|
| 101 | +non-free programs enables many more people to use the whole GNU
|
| 102 | +operating system, as well as its variant, the GNU/Linux operating
|
| 103 | +system.
|
| 104 | +
|
| 105 | + Although the Lesser General Public License is Less protective of the
|
| 106 | +users' freedom, it does ensure that the user of a program that is
|
| 107 | +linked with the Library has the freedom and the wherewithal to run
|
| 108 | +that program using a modified version of the Library.
|
| 109 | +
|
| 110 | + The precise terms and conditions for copying, distribution and
|
| 111 | +modification follow. Pay close attention to the difference between a
|
| 112 | +"work based on the library" and a "work that uses the library". The
|
| 113 | +former contains code derived from the library, whereas the latter must
|
| 114 | +be combined with the library in order to run.
|
| 115 | +
|
| 116 | + GNU LESSER GENERAL PUBLIC LICENSE
|
| 117 | + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
| 118 | +
|
| 119 | + 0. This License Agreement applies to any software library or other
|
| 120 | +program which contains a notice placed by the copyright holder or
|
| 121 | +other authorized party saying it may be distributed under the terms of
|
| 122 | +this Lesser General Public License (also called "this License").
|
| 123 | +Each licensee is addressed as "you".
|
| 124 | +
|
| 125 | + A "library" means a collection of software functions and/or data
|
| 126 | +prepared so as to be conveniently linked with application programs
|
| 127 | +(which use some of those functions and data) to form executables.
|
| 128 | +
|
| 129 | + The "Library", below, refers to any such software library or work
|
| 130 | +which has been distributed under these terms. A "work based on the
|
| 131 | +Library" means either the Library or any derivative work under
|
| 132 | +copyright law: that is to say, a work containing the Library or a
|
| 133 | +portion of it, either verbatim or with modifications and/or translated
|
| 134 | +straightforwardly into another language. (Hereinafter, translation is
|
| 135 | +included without limitation in the term "modification".)
|
| 136 | +
|
| 137 | + "Source code" for a work means the preferred form of the work for
|
| 138 | +making modifications to it. For a library, complete source code means
|
| 139 | +all the source code for all modules it contains, plus any associated
|
| 140 | +interface definition files, plus the scripts used to control compilation
|
| 141 | +and installation of the library.
|
| 142 | +
|
| 143 | + Activities other than copying, distribution and modification are not
|
| 144 | +covered by this License; they are outside its scope. The act of
|
| 145 | +running a program using the Library is not restricted, and output from
|
| 146 | +such a program is covered only if its contents constitute a work based
|
| 147 | +on the Library (independent of the use of the Library in a tool for
|
| 148 | +writing it). Whether that is true depends on what the Library does
|
| 149 | +and what the program that uses the Library does.
|
| 150 | +
|
| 151 | + 1. You may copy and distribute verbatim copies of the Library's
|
| 152 | +complete source code as you receive it, in any medium, provided that
|
| 153 | +you conspicuously and appropriately publish on each copy an
|
| 154 | +appropriate copyright notice and disclaimer of warranty; keep intact
|
| 155 | +all the notices that refer to this License and to the absence of any
|
| 156 | +warranty; and distribute a copy of this License along with the
|
| 157 | +Library.
|
| 158 | +
|
| 159 | + You may charge a fee for the physical act of transferring a copy,
|
| 160 | +and you may at your option offer warranty protection in exchange for a
|
| 161 | +fee.
|
| 162 | +
|
| 163 | + 2. You may modify your copy or copies of the Library or any portion
|
| 164 | +of it, thus forming a work based on the Library, and copy and
|
| 165 | +distribute such modifications or work under the terms of Section 1
|
| 166 | +above, provided that you also meet all of these conditions:
|
| 167 | +
|
| 168 | + a) The modified work must itself be a software library.
|
| 169 | +
|
| 170 | + b) You must cause the files modified to carry prominent notices
|
| 171 | + stating that you changed the files and the date of any change.
|
| 172 | +
|
| 173 | + c) You must cause the whole of the work to be licensed at no
|
| 174 | + charge to all third parties under the terms of this License.
|
| 175 | +
|
| 176 | + d) If a facility in the modified Library refers to a function or a
|
| 177 | + table of data to be supplied by an application program that uses
|
| 178 | + the facility, other than as an argument passed when the facility
|
| 179 | + is invoked, then you must make a good faith effort to ensure that,
|
| 180 | + in the event an application does not supply such function or
|
| 181 | + table, the facility still operates, and performs whatever part of
|
| 182 | + its purpose remains meaningful.
|
| 183 | +
|
| 184 | + (For example, a function in a library to compute square roots has
|
| 185 | + a purpose that is entirely well-defined independent of the
|
| 186 | + application. Therefore, Subsection 2d requires that any
|
| 187 | + application-supplied function or table used by this function must
|
| 188 | + be optional: if the application does not supply it, the square
|
| 189 | + root function must still compute square roots.)
|
| 190 | +
|
| 191 | +These requirements apply to the modified work as a whole. If
|
| 192 | +identifiable sections of that work are not derived from the Library,
|
| 193 | +and can be reasonably considered independent and separate works in
|
| 194 | +themselves, then this License, and its terms, do not apply to those
|
| 195 | +sections when you distribute them as separate works. But when you
|
| 196 | +distribute the same sections as part of a whole which is a work based
|
| 197 | +on the Library, the distribution of the whole must be on the terms of
|
| 198 | +this License, whose permissions for other licensees extend to the
|
| 199 | +entire whole, and thus to each and every part regardless of who wrote
|
| 200 | +it.
|
| 201 | +
|
| 202 | +Thus, it is not the intent of this section to claim rights or contest
|
| 203 | +your rights to work written entirely by you; rather, the intent is to
|
| 204 | +exercise the right to control the distribution of derivative or
|
| 205 | +collective works based on the Library.
|
| 206 | +
|
| 207 | +In addition, mere aggregation of another work not based on the Library
|
| 208 | +with the Library (or with a work based on the Library) on a volume of
|
| 209 | +a storage or distribution medium does not bring the other work under
|
| 210 | +the scope of this License.
|
| 211 | +
|
| 212 | + 3. You may opt to apply the terms of the ordinary GNU General Public
|
| 213 | +License instead of this License to a given copy of the Library. To do
|
| 214 | +this, you must alter all the notices that refer to this License, so
|
| 215 | +that they refer to the ordinary GNU General Public License, version 2,
|
| 216 | +instead of to this License. (If a newer version than version 2 of the
|
| 217 | +ordinary GNU General Public License has appeared, then you can specify
|
| 218 | +that version instead if you wish.) Do not make any other change in
|
| 219 | +these notices.
|
| 220 | +
|
| 221 | + Once this change is made in a given copy, it is irreversible for
|
| 222 | +that copy, so the ordinary GNU General Public License applies to all
|
| 223 | +subsequent copies and derivative works made from that copy.
|
| 224 | +
|
| 225 | + This option is useful when you wish to copy part of the code of
|
| 226 | +the Library into a program that is not a library.
|
| 227 | +
|
| 228 | + 4. You may copy and distribute the Library (or a portion or
|
| 229 | +derivative of it, under Section 2) in object code or executable form
|
| 230 | +under the terms of Sections 1 and 2 above provided that you accompany
|
| 231 | +it with the complete corresponding machine-readable source code, which
|
| 232 | +must be distributed under the terms of Sections 1 and 2 above on a
|
| 233 | +medium customarily used for software interchange.
|
| 234 | +
|
| 235 | + If distribution of object code is made by offering access to copy
|
| 236 | +from a designated place, then offering equivalent access to copy the
|
| 237 | +source code from the same place satisfies the requirement to
|
| 238 | +distribute the source code, even though third parties are not
|
| 239 | +compelled to copy the source along with the object code.
|
| 240 | +
|
| 241 | + 5. A program that contains no derivative of any portion of the
|
| 242 | +Library, but is designed to work with the Library by being compiled or
|
| 243 | +linked with it, is called a "work that uses the Library". Such a
|
| 244 | +work, in isolation, is not a derivative work of the Library, and
|
| 245 | +therefore falls outside the scope of this License.
|
| 246 | +
|
| 247 | + However, linking a "work that uses the Library" with the Library
|
| 248 | +creates an executable that is a derivative of the Library (because it
|
| 249 | +contains portions of the Library), rather than a "work that uses the
|
| 250 | +library". The executable is therefore covered by this License.
|
| 251 | +Section 6 states terms for distribution of such executables.
|
| 252 | +
|
| 253 | + When a "work that uses the Library" uses material from a header file
|
| 254 | +that is part of the Library, the object code for the work may be a
|
| 255 | +derivative work of the Library even though the source code is not.
|
| 256 | +Whether this is true is especially significant if the work can be
|
| 257 | +linked without the Library, or if the work is itself a library. The
|
| 258 | +threshold for this to be true is not precisely defined by law.
|
| 259 | +
|
| 260 | + If such an object file uses only numerical parameters, data
|
| 261 | +structure layouts and accessors, and small macros and small inline
|
| 262 | +functions (ten lines or less in length), then the use of the object
|
| 263 | +file is unrestricted, regardless of whether it is legally a derivative
|
| 264 | +work. (Executables containing this object code plus portions of the
|
| 265 | +Library will still fall under Section 6.)
|
| 266 | +
|
| 267 | + Otherwise, if the work is a derivative of the Library, you may
|
| 268 | +distribute the object code for the work under the terms of Section 6.
|
| 269 | +Any executables containing that work also fall under Section 6,
|
| 270 | +whether or not they are linked directly with the Library itself.
|
| 271 | +
|
| 272 | + 6. As an exception to the Sections above, you may also combine or
|
| 273 | +link a "work that uses the Library" with the Library to produce a
|
| 274 | +work containing portions of the Library, and distribute that work
|
| 275 | +under terms of your choice, provided that the terms permit
|
| 276 | +modification of the work for the customer's own use and reverse
|
| 277 | +engineering for debugging such modifications.
|
| 278 | +
|
| 279 | + You must give prominent notice with each copy of the work that the
|
| 280 | +Library is used in it and that the Library and its use are covered by
|
| 281 | +this License. You must supply a copy of this License. If the work
|
| 282 | +during execution displays copyright notices, you must include the
|
| 283 | +copyright notice for the Library among them, as well as a reference
|
| 284 | +directing the user to the copy of this License. Also, you must do one
|
| 285 | +of these things:
|
| 286 | +
|
| 287 | + a) Accompany the work with the complete corresponding
|
| 288 | + machine-readable source code for the Library including whatever
|
| 289 | + changes were used in the work (which must be distributed under
|
| 290 | + Sections 1 and 2 above); and, if the work is an executable linked
|
| 291 | + with the Library, with the complete machine-readable "work that
|
| 292 | + uses the Library", as object code and/or source code, so that the
|
| 293 | + user can modify the Library and then relink to produce a modified
|
| 294 | + executable containing the modified Library. (It is understood
|
| 295 | + that the user who changes the contents of definitions files in the
|
| 296 | + Library will not necessarily be able to recompile the application
|
| 297 | + to use the modified definitions.)
|
| 298 | +
|
| 299 | + b) Use a suitable shared library mechanism for linking with the
|
| 300 | + Library. A suitable mechanism is one that (1) uses at run time a
|
| 301 | + copy of the library already present on the user's computer system,
|
| 302 | + rather than copying library functions into the executable, and (2)
|
| 303 | + will operate properly with a modified version of the library, if
|
| 304 | + the user installs one, as long as the modified version is
|
| 305 | + interface-compatible with the version that the work was made with.
|
| 306 | +
|
| 307 | + c) Accompany the work with a written offer, valid for at
|
| 308 | + least three years, to give the same user the materials
|
| 309 | + specified in Subsection 6a, above, for a charge no more
|
| 310 | + than the cost of performing this distribution.
|
| 311 | +
|
| 312 | + d) If distribution of the work is made by offering access to copy
|
| 313 | + from a designated place, offer equivalent access to copy the above
|
| 314 | + specified materials from the same place.
|
| 315 | +
|
| 316 | + e) Verify that the user has already received a copy of these
|
| 317 | + materials or that you have already sent this user a copy.
|
| 318 | +
|
| 319 | + For an executable, the required form of the "work that uses the
|
| 320 | +Library" must include any data and utility programs needed for
|
| 321 | +reproducing the executable from it. However, as a special exception,
|
| 322 | +the materials to be distributed need not include anything that is
|
| 323 | +normally distributed (in either source or binary form) with the major
|
| 324 | +components (compiler, kernel, and so on) of the operating system on
|
| 325 | +which the executable runs, unless that component itself accompanies
|
| 326 | +the executable.
|
| 327 | +
|
| 328 | + It may happen that this requirement contradicts the license
|
| 329 | +restrictions of other proprietary libraries that do not normally
|
| 330 | +accompany the operating system. Such a contradiction means you cannot
|
| 331 | +use both them and the Library together in an executable that you
|
| 332 | +distribute.
|
| 333 | +
|
| 334 | + 7. You may place library facilities that are a work based on the
|
| 335 | +Library side-by-side in a single library together with other library
|
| 336 | +facilities not covered by this License, and distribute such a combined
|
| 337 | +library, provided that the separate distribution of the work based on
|
| 338 | +the Library and of the other library facilities is otherwise
|
| 339 | +permitted, and provided that you do these two things:
|
| 340 | +
|
| 341 | + a) Accompany the combined library with a copy of the same work
|
| 342 | + based on the Library, uncombined with any other library
|
| 343 | + facilities. This must be distributed under the terms of the
|
| 344 | + Sections above.
|
| 345 | +
|
| 346 | + b) Give prominent notice with the combined library of the fact
|
| 347 | + that part of it is a work based on the Library, and explaining
|
| 348 | + where to find the accompanying uncombined form of the same work.
|
| 349 | +
|
| 350 | + 8. You may not copy, modify, sublicense, link with, or distribute
|
| 351 | +the Library except as expressly provided under this License. Any
|
| 352 | +attempt otherwise to copy, modify, sublicense, link with, or
|
| 353 | +distribute the Library is void, and will automatically terminate your
|
| 354 | +rights under this License. However, parties who have received copies,
|
| 355 | +or rights, from you under this License will not have their licenses
|
| 356 | +terminated so long as such parties remain in full compliance.
|
| 357 | +
|
| 358 | + 9. You are not required to accept this License, since you have not
|
| 359 | +signed it. However, nothing else grants you permission to modify or
|
| 360 | +distribute the Library or its derivative works. These actions are
|
| 361 | +prohibited by law if you do not accept this License. Therefore, by
|
| 362 | +modifying or distributing the Library (or any work based on the
|
| 363 | +Library), you indicate your acceptance of this License to do so, and
|
| 364 | +all its terms and conditions for copying, distributing or modifying
|
| 365 | +the Library or works based on it.
|
| 366 | +
|
| 367 | + 10. Each time you redistribute the Library (or any work based on the
|
| 368 | +Library), the recipient automatically receives a license from the
|
| 369 | +original licensor to copy, distribute, link with or modify the Library
|
| 370 | +subject to these terms and conditions. You may not impose any further
|
| 371 | +restrictions on the recipients' exercise of the rights granted herein.
|
| 372 | +You are not responsible for enforcing compliance by third parties with
|
| 373 | +this License.
|
| 374 | +
|
| 375 | + 11. If, as a consequence of a court judgment or allegation of patent
|
| 376 | +infringement or for any other reason (not limited to patent issues),
|
| 377 | +conditions are imposed on you (whether by court order, agreement or
|
| 378 | +otherwise) that contradict the conditions of this License, they do not
|
| 379 | +excuse you from the conditions of this License. If you cannot
|
| 380 | +distribute so as to satisfy simultaneously your obligations under this
|
| 381 | +License and any other pertinent obligations, then as a consequence you
|
| 382 | +may not distribute the Library at all. For example, if a patent
|
| 383 | +license would not permit royalty-free redistribution of the Library by
|
| 384 | +all those who receive copies directly or indirectly through you, then
|
| 385 | +the only way you could satisfy both it and this License would be to
|
| 386 | +refrain entirely from distribution of the Library.
|
| 387 | +
|
| 388 | +If any portion of this section is held invalid or unenforceable under any
|
| 389 | +particular circumstance, the balance of the section is intended to apply,
|
| 390 | +and the section as a whole is intended to apply in other circumstances.
|
| 391 | +
|
| 392 | +It is not the purpose of this section to induce you to infringe any
|
| 393 | +patents or other property right claims or to contest validity of any
|
| 394 | +such claims; this section has the sole purpose of protecting the
|
| 395 | +integrity of the free software distribution system which is
|
| 396 | +implemented by public license practices. Many people have made
|
| 397 | +generous contributions to the wide range of software distributed
|
| 398 | +through that system in reliance on consistent application of that
|
| 399 | +system; it is up to the author/donor to decide if he or she is willing
|
| 400 | +to distribute software through any other system and a licensee cannot
|
| 401 | +impose that choice.
|
| 402 | +
|
| 403 | +This section is intended to make thoroughly clear what is believed to
|
| 404 | +be a consequence of the rest of this License.
|
| 405 | +
|
| 406 | + 12. If the distribution and/or use of the Library is restricted in
|
| 407 | +certain countries either by patents or by copyrighted interfaces, the
|
| 408 | +original copyright holder who places the Library under this License may add
|
| 409 | +an explicit geographical distribution limitation excluding those countries,
|
| 410 | +so that distribution is permitted only in or among countries not thus
|
| 411 | +excluded. In such case, this License incorporates the limitation as if
|
| 412 | +written in the body of this License.
|
| 413 | +
|
| 414 | + 13. The Free Software Foundation may publish revised and/or new
|
| 415 | +versions of the Lesser General Public License from time to time.
|
| 416 | +Such new versions will be similar in spirit to the present version,
|
| 417 | +but may differ in detail to address new problems or concerns.
|
| 418 | +
|
| 419 | +Each version is given a distinguishing version number. If the Library
|
| 420 | +specifies a version number of this License which applies to it and
|
| 421 | +"any later version", you have the option of following the terms and
|
| 422 | +conditions either of that version or of any later version published by
|
| 423 | +the Free Software Foundation. If the Library does not specify a
|
| 424 | +license version number, you may choose any version ever published by
|
| 425 | +the Free Software Foundation.
|
| 426 | +
|
| 427 | + 14. If you wish to incorporate parts of the Library into other free
|
| 428 | +programs whose distribution conditions are incompatible with these,
|
| 429 | +write to the author to ask for permission. For software which is
|
| 430 | +copyrighted by the Free Software Foundation, write to the Free
|
| 431 | +Software Foundation; we sometimes make exceptions for this. Our
|
| 432 | +decision will be guided by the two goals of preserving the free status
|
| 433 | +of all derivatives of our free software and of promoting the sharing
|
| 434 | +and reuse of software generally.
|
| 435 | +
|
| 436 | + NO WARRANTY
|
| 437 | +
|
| 438 | + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
| 439 | +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
| 440 | +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
| 441 | +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
| 442 | +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
| 443 | +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
| 444 | +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
| 445 | +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
| 446 | +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
| 447 | +
|
| 448 | + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
| 449 | +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
| 450 | +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
| 451 | +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
| 452 | +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
| 453 | +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
| 454 | +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
| 455 | +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
| 456 | +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
| 457 | +DAMAGES.
|
| 458 | +
|
| 459 | + END OF TERMS AND CONDITIONS
|
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/codepress.js |
— | — | @@ -0,0 +1,138 @@ |
| 2 | +/* |
| 3 | + * CodePress - Real Time Syntax Highlighting Editor written in JavaScript - http://codepress.org/ |
| 4 | + * |
| 5 | + * Copyright (C) 2006 Fernando M.A.d.S. <fermads@gmail.com> |
| 6 | + * |
| 7 | + * This program is free software; you can redistribute it and/or modify it under the terms of the |
| 8 | + * GNU Lesser General Public License as published by the Free Software Foundation. |
| 9 | + * |
| 10 | + * Read the full licence: http://www.opensource.org/licenses/lgpl-license.php |
| 11 | + */ |
| 12 | + |
| 13 | +CodePress = function(obj) { |
| 14 | + var self = document.createElement('iframe'); |
| 15 | + self.textarea = obj; |
| 16 | + self.textarea.disabled = true; |
| 17 | + self.textarea.style.overflow = 'hidden'; |
| 18 | + self.style.height = self.textarea.clientHeight +'px'; |
| 19 | + self.style.width = self.textarea.clientWidth +'px'; |
| 20 | + self.textarea.style.overflow = 'auto'; |
| 21 | + self.style.border = '1px solid gray'; |
| 22 | + self.frameBorder = 0; // remove IE internal iframe border |
| 23 | + self.style.visibility = 'hidden'; |
| 24 | + self.style.position = 'absolute'; |
| 25 | + self.options = self.textarea.className; |
| 26 | + |
| 27 | + self.initialize = function() { |
| 28 | + self.editor = self.contentWindow.CodePress; |
| 29 | + self.editor.body = self.contentWindow.document.getElementsByTagName('body')[0]; |
| 30 | + self.editor.setCode(self.textarea.value); |
| 31 | + self.setOptions(); |
| 32 | + self.editor.syntaxHighlight('init'); |
| 33 | + self.textarea.style.display = 'none'; |
| 34 | + self.style.position = 'static'; |
| 35 | + self.style.visibility = 'visible'; |
| 36 | + self.style.display = 'inline'; |
| 37 | + } |
| 38 | + |
| 39 | + // obj can by a textarea id or a string (code) |
| 40 | + self.edit = function(obj,language) { |
| 41 | + if(obj) self.textarea.value = document.getElementById(obj) ? document.getElementById(obj).value : obj; |
| 42 | + if(!self.textarea.disabled) return; |
| 43 | + self.language = language ? language : self.getLanguage(); |
| 44 | + self.src = CodePress.path+'codepress.html?language='+self.language+'&ts='+(new Date).getTime(); |
| 45 | + if(self.attachEvent) self.attachEvent('onload',self.initialize); |
| 46 | + else self.addEventListener('load',self.initialize,false); |
| 47 | + } |
| 48 | + |
| 49 | + self.getLanguage = function() { |
| 50 | + for (language in CodePress.languages) |
| 51 | + if(self.options.match('\\b'+language+'\\b')) |
| 52 | + return CodePress.languages[language] ? language : 'generic'; |
| 53 | + } |
| 54 | + |
| 55 | + self.setOptions = function() { |
| 56 | + if(self.options.match('autocomplete-off')) self.toggleAutoComplete(); |
| 57 | + if(self.options.match('readonly-on')) self.toggleReadOnly(); |
| 58 | + if(self.options.match('linenumbers-off')) self.toggleLineNumbers(); |
| 59 | + } |
| 60 | + |
| 61 | + self.getCode = function() { |
| 62 | + return self.textarea.disabled ? self.editor.getCode() : self.textarea.value; |
| 63 | + } |
| 64 | + |
| 65 | + self.setCode = function(code) { |
| 66 | + self.textarea.disabled ? self.editor.setCode(code) : self.textarea.value = code; |
| 67 | + } |
| 68 | + |
| 69 | + self.toggleAutoComplete = function() { |
| 70 | + self.editor.autocomplete = (self.editor.autocomplete) ? false : true; |
| 71 | + } |
| 72 | + |
| 73 | + self.toggleReadOnly = function() { |
| 74 | + self.textarea.readOnly = (self.textarea.readOnly) ? false : true; |
| 75 | + if(self.style.display != 'none') // prevent exception on FF + iframe with display:none |
| 76 | + self.editor.readOnly(self.textarea.readOnly ? true : false); |
| 77 | + } |
| 78 | + |
| 79 | + self.toggleLineNumbers = function() { |
| 80 | + var cn = self.editor.body.className; |
| 81 | + self.editor.body.className = (cn==''||cn=='show-line-numbers') ? 'hide-line-numbers' : 'show-line-numbers'; |
| 82 | + } |
| 83 | + |
| 84 | + self.toggleEditor = function() { |
| 85 | + if(self.textarea.disabled) { |
| 86 | + self.textarea.value = self.getCode(); |
| 87 | + self.textarea.disabled = false; |
| 88 | + self.style.display = 'none'; |
| 89 | + self.textarea.style.display = 'inline'; |
| 90 | + } |
| 91 | + else { |
| 92 | + self.textarea.disabled = true; |
| 93 | + self.setCode(self.textarea.value); |
| 94 | + self.editor.syntaxHighlight('init'); |
| 95 | + self.style.display = 'inline'; |
| 96 | + self.textarea.style.display = 'none'; |
| 97 | + } |
| 98 | + } |
| 99 | + |
| 100 | + self.edit(); |
| 101 | + return self; |
| 102 | +} |
| 103 | + |
| 104 | +CodePress.languages = { |
| 105 | + csharp : 'C#', |
| 106 | + css : 'CSS', |
| 107 | + generic : 'Generic', |
| 108 | + html : 'HTML', |
| 109 | + java : 'Java', |
| 110 | + javascript : 'JavaScript', |
| 111 | + perl : 'Perl', |
| 112 | + ruby : 'Ruby', |
| 113 | + php : 'PHP', |
| 114 | + text : 'Text', |
| 115 | + sql : 'SQL', |
| 116 | + vbscript : 'VBScript' |
| 117 | +} |
| 118 | + |
| 119 | + |
| 120 | +CodePress.run = function() { |
| 121 | + s = document.getElementsByTagName('script'); |
| 122 | + for(var i=0,n=s.length;i<n;i++) { |
| 123 | + if(s[i].src.match('codepress.js')) { |
| 124 | + CodePress.path = s[i].src.replace('codepress.js',''); |
| 125 | + } |
| 126 | + } |
| 127 | + t = document.getElementsByTagName('textarea'); |
| 128 | + for(var i=0,n=t.length;i<n;i++) { |
| 129 | + if(t[i].className.match('codepress')) { |
| 130 | + id = t[i].id; |
| 131 | + t[i].id = id+'_cp'; |
| 132 | + eval(id+' = new CodePress(t[i])'); |
| 133 | + t[i].parentNode.insertBefore(eval(id), t[i]); |
| 134 | + } |
| 135 | + } |
| 136 | +} |
| 137 | + |
| 138 | +if(window.attachEvent) window.attachEvent('onload',CodePress.run); |
| 139 | +else window.addEventListener('DOMContentLoaded',CodePress.run,false); |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/codepress.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 140 | + native |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/images/line-numbers.png |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/images/line-numbers.png |
___________________________________________________________________ |
Added: svn:mime-type |
2 | 141 | + application/octet-stream |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/csharp.css |
— | — | @@ -0,0 +1,9 @@ |
| 2 | +/* |
| 3 | + * CodePress color styles for Java syntax highlighting |
| 4 | + * By Edwin de Jonge |
| 5 | + */ |
| 6 | + |
| 7 | +b {color:#7F0055;font-weight:bold;font-style:normal;} /* reserved words */ |
| 8 | +a {color:#2A0088;font-weight:bold;font-style:normal;} /* types */ |
| 9 | +i, i b, i s {color:#3F7F5F;font-weight:bold;} /* comments */ |
| 10 | +s, s b {color:#2A00FF;font-weight:normal;} /* strings */ |
\ No newline at end of file |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/csharp.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 11 | + native |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/vbscript.js |
— | — | @@ -0,0 +1,117 @@ |
| 2 | +/* |
| 3 | + * CodePress regular expressions for ASP-vbscript syntax highlighting |
| 4 | + */ |
| 5 | + |
| 6 | +// ASP VBScript |
| 7 | +Language.syntax = [ |
| 8 | +// all tags |
| 9 | + { input : /(<[^!%|!%@]*?>)/g, output : '<b>$1</b>' }, |
| 10 | +// style tags |
| 11 | + { input : /(<style.*?>)(.*?)(<\/style>)/g, output : '<em>$1</em><em>$2</em><em>$3</em>' }, |
| 12 | +// script tags |
| 13 | + { input : /(<script.*?>)(.*?)(<\/script>)/g, output : '<ins>$1</ins><ins>$2</ins><ins>$3</ins>' }, |
| 14 | +// strings "" and attributes |
| 15 | + { input : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>' }, |
| 16 | +// ASP Comment |
| 17 | + { input : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<dfn>\'$1$2</dfn>'}, |
| 18 | +// <%.* |
| 19 | + { input : /(<%)/g, output : '<strong>$1' }, |
| 20 | +// .*%> |
| 21 | + { input : /(%>)/g, output : '$1</strong>' }, |
| 22 | +// <%@...%> |
| 23 | + { input : /(<%@)(.+?)(%>)/gi, output : '$1<span>$2</span>$3' }, |
| 24 | +//Numbers |
| 25 | + { input : /\b([\d]+)\b/g, output : '<var>$1</var>' }, |
| 26 | +// Reserved Words 1 (Blue) |
| 27 | + { input : /\b(And|As|ByRef|ByVal|Call|Case|Class|Const|Dim|Do|Each|Else|ElseIf|Empty|End|Eqv|Exit|False|For|Function)\b/gi, output : '<a>$1</a>' }, |
| 28 | + { input : /\b(Get|GoTo|If|Imp|In|Is|Let|Loop|Me|Mod|Enum|New|Next|Not|Nothing|Null|On|Option|Or|Private|Public|ReDim|Rem)\b/gi, output : '<a>$1</a>' }, |
| 29 | + { input : /\b(Resume|Select|Set|Stop|Sub|Then|To|True|Until|Wend|While|With|Xor|Execute|Randomize|Erase|ExecuteGlobal|Explicit|step)\b/gi, output : '<a>$1</a>' }, |
| 30 | +// Reserved Words 2 (Purple) |
| 31 | + { input : /\b(Abandon|Abs|AbsolutePage|AbsolutePosition|ActiveCommand|ActiveConnection|ActualSize|AddHeader|AddNew|AppendChunk)\b/gi, output : '<u>$1</u>' }, |
| 32 | + { input : /\b(AppendToLog|Application|Array|Asc|Atn|Attributes|BeginTrans|BinaryRead|BinaryWrite|BOF|Bookmark|Boolean|Buffer|Byte)\b/gi, output : '<u>$1</u>' }, |
| 33 | + { input : /\b(CacheControl|CacheSize|Cancel|CancelBatch|CancelUpdate|CBool|CByte|CCur|CDate|CDbl|Charset|Chr|CInt|Clear)\b/gi, output : '<u>$1</u>' }, |
| 34 | + { input : /\b(ClientCertificate|CLng|Clone|Close|CodePage|CommandText|CommandType|CommandTimeout|CommitTrans|CompareBookmarks|ConnectionString|ConnectionTimeout)\b/gi, output : '<u>$1</u>' }, |
| 35 | + { input : /\b(Contents|ContentType|Cookies|Cos|CreateObject|CreateParameter|CSng|CStr|CursorLocation|CursorType|DataMember|DataSource|Date|DateAdd|DateDiff)\b/gi, output : '<u>$1</u>' }, |
| 36 | + { input : /\b(DatePart|DateSerial|DateValue|Day|DefaultDatabase|DefinedSize|Delete|Description|Double|EditMode|Eof|EOF|err|Error)\b/gi, output : '<u>$1</u>' }, |
| 37 | + { input : /\b(Exp|Expires|ExpiresAbsolute|Filter|Find|Fix|Flush|Form|FormatCurrency|FormatDateTime|FormatNumber|FormatPercent)\b/gi, output : '<u>$1</u>' }, |
| 38 | + { input : /\b(GetChunk|GetLastError|GetRows|GetString|Global|HelpContext|HelpFile|Hex|Hour|HTMLEncode|IgnoreCase|Index|InStr|InStrRev)\b/gi, output : '<u>$1</u>' }, |
| 39 | + { input : /\b(Int|Integer|IsArray|IsClientConnected|IsDate|IsolationLevel|Join|LBound|LCase|LCID|Left|Len|Lock|LockType|Log|Long|LTrim)\b/gi, output : '<u>$1</u>' }, |
| 40 | + { input : /\b(MapPath|MarshalOptions|MaxRecords|Mid|Minute|Mode|Month|MonthName|Move|MoveFirst|MoveLast|MoveNext|MovePrevious|Name|NextRecordset)\b/gi, output : '<u>$1</u>' }, |
| 41 | + { input : /\b(Now|Number|NumericScale|ObjectContext|Oct|Open|OpenSchema|OriginalValue|PageCount|PageSize|Pattern|PICS|Precision|Prepared|Property)\b/gi, output : '<u>$1</u>' }, |
| 42 | + { input : /\b(Provider|QueryString|RecordCount|Redirect|RegExp|Remove|RemoveAll|Replace|Requery|Request|Response|Resync|Right|Rnd)\b/gi, output : '<u>$1</u>' }, |
| 43 | + { input : /\b(RollbackTrans|RTrim|Save|ScriptTimeout|Second|Seek|Server|ServerVariables|Session|SessionID|SetAbort|SetComplete|Sgn)\b/gi, output : '<u>$1</u>' }, |
| 44 | + { input : /\b(Sin|Size|Sort|Source|Space|Split|Sqr|State|StaticObjects|Status|StayInSync|StrComp|String|StrReverse|Supports|Tan|Time)\b/gi, output : '<u>$1</u>' }, |
| 45 | + { input : /\b(Timeout|Timer|TimeSerial|TimeValue|TotalBytes|Transfer|Trim|Type|Type|UBound|UCase|UnderlyingValue|UnLock|Update|UpdateBatch)\b/gi, output : '<u>$1</u>' }, |
| 46 | + { input : /\b(URLEncode|Value|Value|Version|Weekday|WeekdayName|Write|Year)\b/gi, output : '<u>$1</u>' }, |
| 47 | +// Reserved Words 3 (Turquis) |
| 48 | + { input : /\b(vbBlack|vbRed|vbGreen|vbYellow|vbBlue|vbMagenta|vbCyan|vbWhite|vbBinaryCompare|vbTextCompare)\b/gi, output : '<i>$1</i>' }, |
| 49 | + { input : /\b(vbSunday|vbMonday|vbTuesday|vbWednesday|vbThursday|vbFriday|vbSaturday|vbUseSystemDayOfWeek)\b/gi, output : '<i>$1</i>' }, |
| 50 | + { input : /\b(vbFirstJan1|vbFirstFourDays|vbFirstFullWeek|vbGeneralDate|vbLongDate|vbShortDate|vbLongTime|vbShortTime)\b/gi, output : '<i>$1</i>' }, |
| 51 | + { input : /\b(vbObjectError|vbCr|VbCrLf|vbFormFeed|vbLf|vbNewLine|vbNullChar|vbNullString|vbTab|vbVerticalTab|vbUseDefault|vbTrue)\b/gi, output : '<i>$1</i>' }, |
| 52 | + { input : /\b(vbFalse|vbEmpty|vbNull|vbInteger|vbLong|vbSingle|vbDouble|vbCurrency|vbDate|vbString|vbObject|vbError|vbBoolean|vbVariant)\b/gi, output : '<i>$1</i>' }, |
| 53 | + { input : /\b(vbDataObject|vbDecimal|vbByte|vbArray)\b/gi, output : '<i>$1</i>' }, |
| 54 | +// html comments |
| 55 | + { input : /(<!--.*?-->.)/g, output : '<big>$1</big>' } |
| 56 | +] |
| 57 | + |
| 58 | +Language.Functions = [ |
| 59 | + // Output at index 0, must be the desired tagname surrounding a $1 |
| 60 | + // Name is the index from the regex that marks the functionname |
| 61 | + {input : /(function|sub)([ ]*?)(\w+)([ ]*?\()/gi , output : '<ins>$1</ins>', name : '$3'} |
| 62 | +] |
| 63 | + |
| 64 | +Language.snippets = [ |
| 65 | +//Conditional |
| 66 | + { input : 'if', output : 'If $0 Then\n\t\nEnd If' }, |
| 67 | + { input : 'ifelse', output : 'If $0 Then\n\t\n\nElse\n\t\nEnd If' }, |
| 68 | + { input : 'case', output : 'Select Case $0\n\tCase ?\n\tCase Else\nEnd Select'}, |
| 69 | +//Response |
| 70 | + { input : 'rw', output : 'Response.Write( $0 )' }, |
| 71 | + { input : 'resc', output : 'Response.Cookies( $0 )' }, |
| 72 | + { input : 'resb', output : 'Response.Buffer'}, |
| 73 | + { input : 'resflu', output : 'Response.Flush()'}, |
| 74 | + { input : 'resend', output : 'Response.End'}, |
| 75 | +//Request |
| 76 | + { input : 'reqc', output : 'Request.Cookies( $0 )' }, |
| 77 | + { input : 'rq', output : 'Request.Querystring("$0")' }, |
| 78 | + { input : 'rf', output : 'Request.Form("$0")' }, |
| 79 | +//FSO |
| 80 | + { input : 'fso', output : 'Set fso = Server.CreateObject("Scripting.FileSystemObject")\n$0' }, |
| 81 | + { input : 'setfo', output : 'Set fo = fso.getFolder($0)' }, |
| 82 | + { input : 'setfi', output : 'Set fi = fso.getFile($0)' }, |
| 83 | + { input : 'twr', output : 'Set f = fso.CreateTextFile($0,true)\'overwrite\nf.WriteLine()\nf.Close'}, |
| 84 | + { input : 'tre', output : 'Set f = fso.OpenTextFile($0, 1)\nf.ReadAll\nf.Close'}, |
| 85 | +//Server |
| 86 | + { input : 'mapp', output : 'Server.Mappath($0)' }, |
| 87 | +//Loops |
| 88 | + { input : 'foreach', output : 'For Each $0 in ?\n\t\nNext' }, |
| 89 | + { input : 'for', output : 'For $0 to ? step ?\n\t\nNext' }, |
| 90 | + { input : 'do', output : 'Do While($0)\n\t\nLoop' }, |
| 91 | + { input : 'untilrs', output : 'do until rs.eof\n\t\nrs.movenext\nloop' }, |
| 92 | +//ADO |
| 93 | + { input : 'adorec', output : 'Set rs = Server.CreateObject("ADODB.Recordset")' }, |
| 94 | + { input : 'adocon', output : 'Set Conn = Server.CreateObject("ADODB.Connection")' }, |
| 95 | + { input : 'adostr', output : 'Set oStr = Server.CreateObject("ADODB.Stream")' }, |
| 96 | +//Http Request |
| 97 | + { input : 'xmlhttp', output : 'Set xmlHttp = Server.CreateObject("Microsoft.XMLHTTP")\nxmlHttp.open("GET", $0, false)\nxmlHttp.send()\n?=xmlHttp.responseText' }, |
| 98 | + { input : 'xmldoc', output : 'Set xmldoc = Server.CreateObject("Microsoft.XMLDOM")\nxmldoc.async=false\nxmldoc.load(request)'}, |
| 99 | +//Functions |
| 100 | + { input : 'func', output : 'Function $0()\n\t\n\nEnd Function'}, |
| 101 | + { input : 'sub', output : 'Sub $0()\n\t\nEnd Sub'} |
| 102 | + |
| 103 | +] |
| 104 | + |
| 105 | +Language.complete = [ |
| 106 | + //{ input : '\'', output : '\'$0\'' }, |
| 107 | + { input : '"', output : '"$0"' }, |
| 108 | + { input : '(', output : '\($0\)' }, |
| 109 | + { input : '[', output : '\[$0\]' }, |
| 110 | + { input : '{', output : '{\n\t$0\n}' } |
| 111 | +] |
| 112 | + |
| 113 | +Language.shortcuts = [ |
| 114 | + { input : '[space]', output : ' ' }, |
| 115 | + { input : '[enter]', output : '<br />' } , |
| 116 | + { input : '[j]', output : 'testing' }, |
| 117 | + { input : '[7]', output : '&' } |
| 118 | +] |
\ No newline at end of file |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/vbscript.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 119 | + native |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/java.css |
— | — | @@ -0,0 +1,7 @@ |
| 2 | +/* |
| 3 | + * CodePress color styles for Java syntax highlighting |
| 4 | + */ |
| 5 | + |
| 6 | +b {color:#7F0055;font-weight:bold;font-style:normal;} /* reserved words */ |
| 7 | +i, i b, i s {color:#3F7F5F;font-weight:bold;} /* comments */ |
| 8 | +s, s b {color:#2A00FF;font-weight:normal;} /* strings */ |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/java.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 9 | + native |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/ruby.css |
— | — | @@ -0,0 +1,10 @@ |
| 2 | +/* |
| 3 | + * CodePress color styles for Ruby syntax highlighting |
| 4 | + */ |
| 5 | + |
| 6 | +b {color:#7F0055;font-weight:bold;} /* reserved words */ |
| 7 | +i, i b, i s, i em, i a, i u {color:gray;font-weight:normal;} /* comments */ |
| 8 | +s, s b, s a, s em, s u {color:#2A00FF;font-weight:normal;} /* strings */ |
| 9 | +a {color:#006700;font-weight:bold;} /* variables */ |
| 10 | +em {color:darkblue;font-weight:bold;} /* functions */ |
| 11 | +u {font-weight:bold;} /* special chars */ |
\ No newline at end of file |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/ruby.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 12 | + native |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/asp.css |
— | — | @@ -0,0 +1,71 @@ |
| 2 | +/* |
| 3 | + * CodePress color styles for ASP-VB syntax highlighting |
| 4 | + * By Martin D. Kirk |
| 5 | + */ |
| 6 | +/* tags */ |
| 7 | + |
| 8 | +b { |
| 9 | + color:#000080; |
| 10 | +} |
| 11 | +/* comments */ |
| 12 | +big, big b, big em, big ins, big s, strong i, strong i b, strong i s, strong i u, strong i a, strong i a u, strong i s u { |
| 13 | + color:gray; |
| 14 | + font-weight:normal; |
| 15 | +} |
| 16 | +/* ASP comments */ |
| 17 | +strong dfn, strong dfn a,strong dfn var, strong dfn a u, strong dfn u{ |
| 18 | + color:gray; |
| 19 | + font-weight:normal; |
| 20 | +} |
| 21 | + /* attributes */ |
| 22 | +s, s b, span s u, span s cite, strong span s { |
| 23 | + color:#5656fa ; |
| 24 | + font-weight:normal; |
| 25 | +} |
| 26 | + /* strings */ |
| 27 | +strong s,strong s b, strong s u, strong s cite { |
| 28 | + color:#009900; |
| 29 | + font-weight:normal; |
| 30 | +} |
| 31 | +strong ins{ |
| 32 | + color:#000000; |
| 33 | + font-weight:bold; |
| 34 | +} |
| 35 | + /* Syntax */ |
| 36 | +strong a, strong a u { |
| 37 | + color:#0000FF; |
| 38 | + font-weight:; |
| 39 | +} |
| 40 | + /* Native Keywords */ |
| 41 | +strong u { |
| 42 | + color:#990099; |
| 43 | + font-weight:bold; |
| 44 | +} |
| 45 | +/* Numbers */ |
| 46 | +strong var{ |
| 47 | + color:#FF0000; |
| 48 | +} |
| 49 | +/* ASP Language */ |
| 50 | +span{ |
| 51 | + color:#990000; |
| 52 | + font-weight:bold; |
| 53 | +} |
| 54 | +strong i,strong a i, strong u i { |
| 55 | + color:#009999; |
| 56 | +} |
| 57 | +/* style */ |
| 58 | +em { |
| 59 | + color:#800080; |
| 60 | + font-style:normal; |
| 61 | +} |
| 62 | + /* script */ |
| 63 | +ins { |
| 64 | + color:#800000; |
| 65 | + font-weight:bold; |
| 66 | +} |
| 67 | + |
| 68 | +/* <?php and ?> */ |
| 69 | +cite, s cite { |
| 70 | + color:red; |
| 71 | + font-weight:bold; |
| 72 | +} |
\ No newline at end of file |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/asp.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 73 | + native |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/sql.js |
— | — | @@ -0,0 +1,30 @@ |
| 2 | +/* |
| 3 | + * CodePress regular expressions for SQL syntax highlighting |
| 4 | + * By Merlin Moncure |
| 5 | + */ |
| 6 | + |
| 7 | +// SQL |
| 8 | +Language.syntax = [ |
| 9 | + { input : /\'(.*?)(\')/g, output : '<s>\'$1$2</s>' }, // strings single quote |
| 10 | + { input : /\b(add|after|aggregate|alias|all|and|as|authorization|between|by|cascade|cache|cache|called|case|check|column|comment|constraint|createdb|createuser|cycle|database|default|deferrable|deferred|diagnostics|distinct|domain|each|else|elseif|elsif|encrypted|except|exception|for|foreign|from|from|full|function|get|group|having|if|immediate|immutable|in|increment|initially|increment|index|inherits|inner|input|intersect|into|invoker|is|join|key|language|left|like|limit|local|loop|match|maxvalue|minvalue|natural|nextval|no|nocreatedb|nocreateuser|not|null|of|offset|oids|on|only|operator|or|order|outer|owner|partial|password|perform|plpgsql|primary|record|references|replace|restrict|return|returns|right|row|rule|schema|security|sequence|session|sql|stable|statistics|table|temp|temporary|then|time|to|transaction|trigger|type|unencrypted|union|unique|user|using|valid|value|values|view|volatile|when|where|with|without|zone)\b/gi, output : '<b>$1</b>' }, // reserved words |
| 11 | + { input : /\b(bigint|bigserial|bit|boolean|box|bytea|char|character|cidr|circle|date|decimal|double|float4|float8|inet|int2|int4|int8|integer|interval|line|lseg|macaddr|money|numeric|oid|path|point|polygon|precision|real|refcursor|serial|serial4|serial8|smallint|text|timestamp|varbit|varchar)\b/gi, output : '<u>$1</u>' }, // types |
| 12 | + { input : /\b(abort|alter|analyze|begin|checkpoint|close|cluster|comment|commit|copy|create|deallocate|declare|delete|drop|end|execute|explain|fetch|grant|insert|listen|load|lock|move|notify|prepare|reindex|reset|restart|revoke|rollback|select|set|show|start|truncate|unlisten|update)\b/gi, output : '<a>$1</a>' }, // commands |
| 13 | + { input : /([^:]|^)\-\-(.*?)(<br|<\/P)/g, output: '$1<i>--$2</i>$3' } // comments // |
| 14 | +] |
| 15 | + |
| 16 | +Language.snippets = [ |
| 17 | + { input : 'select', output : 'select $0 from where ' } |
| 18 | +] |
| 19 | + |
| 20 | +Language.complete = [ |
| 21 | + { input : '\'', output : '\'$0\'' }, |
| 22 | + { input : '"', output : '"$0"' }, |
| 23 | + { input : '(', output : '\($0\)' }, |
| 24 | + { input : '[', output : '\[$0\]' }, |
| 25 | + { input : '{', output : '{\n\t$0\n}' } |
| 26 | +] |
| 27 | + |
| 28 | +Language.shortcuts = [] |
| 29 | + |
| 30 | + |
| 31 | + |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/sql.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 32 | + native |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/text.css |
— | — | @@ -0,0 +1,5 @@ |
| 2 | +/* |
| 3 | + * CodePress color styles for Text syntax highlighting |
| 4 | + */ |
| 5 | + |
| 6 | +/* do nothing as expected */ |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/text.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 7 | + native |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/perl.js |
— | — | @@ -0,0 +1,27 @@ |
| 2 | +/* |
| 3 | + * CodePress regular expressions for Perl syntax highlighting |
| 4 | + * By J. Nick Koston |
| 5 | + */ |
| 6 | + |
| 7 | +// Perl |
| 8 | +Language.syntax = [ |
| 9 | + { input : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>' }, // strings double quote |
| 10 | + { input : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<s>\'$1$2</s>' }, // strings single quote |
| 11 | + { input : /([\$\@\%][\w\.]*)/g, output : '<a>$1</a>' }, // vars |
| 12 | + { input : /(sub\s+)([\w\.]*)/g, output : '$1<em>$2</em>' }, // functions |
| 13 | + { input : /\b(abs|accept|alarm|atan2|bind|binmode|bless|caller|chdir|chmod|chomp|chop|chown|chr|chroot|close|closedir|connect|continue|cos|crypt|dbmclose|dbmopen|defined|delete|die|do|dump|each|else|elsif|endgrent|endhostent|endnetent|endprotoent|endpwent|eof|eval|exec|exists|exit|fcntl|fileno|find|flock|for|foreach|fork|format|formlinegetc|getgrent|getgrgid|getgrnam|gethostbyaddr|gethostbyname|gethostent|getlogin|getnetbyaddr|getnetbyname|getnetent|getpeername|getpgrp|getppid|getpriority|getprotobyname|getprotobynumber|getprotoent|getpwent|getpwnam|getpwuid|getservbyaddr|getservbyname|getservbyport|getservent|getsockname|getsockopt|glob|gmtime|goto|grep|hex|hostname|if|import|index|int|ioctl|join|keys|kill|last|lc|lcfirst|length|link|listen|LoadExternals|local|localtime|log|lstat|map|mkdir|msgctl|msgget|msgrcv|msgsnd|my|next|no|oct|open|opendir|ordpack|package|pipe|pop|pos|print|printf|push|pwd|qq|quotemeta|qw|rand|read|readdir|readlink|recv|redo|ref|rename|require|reset|return|reverse|rewinddir|rindex|rmdir|scalar|seek|seekdir|select|semctl|semget|semop|send|setgrent|sethostent|setnetent|setpgrp|setpriority|setprotoent|setpwent|setservent|setsockopt|shift|shmctl|shmget|shmread|shmwrite|shutdown|sin|sleep|socket|socketpair|sort|splice|split|sprintf|sqrt|srand|stat|stty|study|sub|substr|symlink|syscall|sysopen|sysread|system|syswritetell|telldir|tie|tied|time|times|tr|truncate|uc|ucfirst|umask|undef|unless|unlink|until|unpack|unshift|untie|use|utime|values|vec|waitpid|wantarray|warn|while|write)\b/g, output : '<b>$1</b>' }, // reserved words |
| 14 | + { input : /([\(\){}])/g, output : '<u>$1</u>' }, // special chars |
| 15 | + { input : /#(.*?)(<br>|<\/P>)/g, output : '<i>#$1</i>$2' } // comments |
| 16 | +] |
| 17 | + |
| 18 | +Language.snippets = [] |
| 19 | + |
| 20 | +Language.complete = [ |
| 21 | + { input : '\'',output : '\'$0\'' }, |
| 22 | + { input : '"', output : '"$0"' }, |
| 23 | + { input : '(', output : '\($0\)' }, |
| 24 | + { input : '[', output : '\[$0\]' }, |
| 25 | + { input : '{', output : '{\n\t$0\n}' } |
| 26 | +] |
| 27 | + |
| 28 | +Language.shortcuts = [] |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/perl.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 29 | + native |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/php.css |
— | — | @@ -0,0 +1,12 @@ |
| 2 | +/* |
| 3 | + * CodePress color styles for PHP syntax highlighting |
| 4 | + */ |
| 5 | + |
| 6 | +b {color:#000080;} /* tags */ |
| 7 | +big, big b, big em, big ins, big s, strong i, strong i b, strong i s, strong i u, strong i a, strong i a u, strong i s u {color:gray;font-weight:normal;} /* comments */ |
| 8 | +s, s b, strong s u, strong s cite {color:#5656fa;font-weight:normal;} /* attributes and strings */ |
| 9 | +strong a, strong a u {color:#006700;font-weight:bold;} /* variables */ |
| 10 | +em {color:#800080;font-style:normal;} /* style */ |
| 11 | +ins {color:#800000;} /* script */ |
| 12 | +strong u {color:#7F0055;font-weight:bold;} /* reserved words */ |
| 13 | +cite, s cite {color:red;font-weight:bold;} /* <?php and ?> */ |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/php.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 14 | + native |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/css.css |
— | — | @@ -0,0 +1,10 @@ |
| 2 | +/* |
| 3 | + * CodePress color styles for CSS syntax highlighting |
| 4 | + */ |
| 5 | + |
| 6 | +b, b a, b u {color:#000080;} /* tags, ids, classes */ |
| 7 | +i, i b, i s, i a, i u {color:gray;} /* comments */ |
| 8 | +s, s b {color:#a0a0dd;} /* parameters */ |
| 9 | +a {color:#0000ff;} /* keys */ |
| 10 | +u {color:red;} /* values */ |
| 11 | + |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/css.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 12 | + native |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/html.js |
— | — | @@ -0,0 +1,59 @@ |
| 2 | +/* |
| 3 | + * CodePress regular expressions for HTML syntax highlighting |
| 4 | + */ |
| 5 | + |
| 6 | +// HTML |
| 7 | +Language.syntax = [ |
| 8 | + { input : /(<[^!]*?>)/g, output : '<b>$1</b>' }, // all tags |
| 9 | + { input : /(<a .*?>|<\/a>)/g, output : '<a>$1</a>' }, // links |
| 10 | + { input : /(<img .*?>)/g, output : '<big>$1</big>' }, // images |
| 11 | + { input : /(<\/?(button|textarea|form|input|select|option|label).*?>)/g, output : '<u>$1</u>' }, // forms |
| 12 | + { input : /(<style.*?>)(.*?)(<\/style>)/g, output : '<em>$1</em><em>$2</em><em>$3</em>' }, // style tags |
| 13 | + { input : /(<script.*?>)(.*?)(<\/script>)/g, output : '<strong>$1</strong><tt>$2</tt><strong>$3</strong>' }, // script tags |
| 14 | + { input : /=(".*?")/g, output : '=<s>$1</s>' }, // atributes double quote |
| 15 | + { input : /=('.*?')/g, output : '=<s>$1</s>' }, // atributes single quote |
| 16 | + { input : /(<!--.*?-->.)/g, output : '<ins>$1</ins>' }, // comments |
| 17 | + { input : /\b(alert|window|document|break|continue|do|for|new|this|void|case|default|else|function|return|typeof|while|if|label|switch|var|with|catch|boolean|int|try|false|throws|null|true|goto)\b/g, output : '<i>$1</i>' } // script reserved words |
| 18 | +] |
| 19 | + |
| 20 | +Language.snippets = [ |
| 21 | + { input : 'aref', output : '<a href="$0"></a>' }, |
| 22 | + { input : 'h1', output : '<h1>$0</h1>' }, |
| 23 | + { input : 'h2', output : '<h2>$0</h2>' }, |
| 24 | + { input : 'h3', output : '<h3>$0</h3>' }, |
| 25 | + { input : 'h4', output : '<h4>$0</h4>' }, |
| 26 | + { input : 'h5', output : '<h5>$0</h5>' }, |
| 27 | + { input : 'h6', output : '<h6>$0</h6>' }, |
| 28 | + { input : 'html', output : '<html>\n\t$0\n</html>' }, |
| 29 | + { input : 'head', output : '<head>\n\t<meta http-equiv="content-type" content="text/html; charset=utf-8" />\n\t<title>$0</title>\n\t\n</head>' }, |
| 30 | + { input : 'img', output : '<img src="$0" alt="" />' }, |
| 31 | + { input : 'input', output : '<input name="$0" id="" type="" value="" />' }, |
| 32 | + { input : 'label', output : '<label for="$0"></label>' }, |
| 33 | + { input : 'legend', output : '<legend>\n\t$0\n</legend>' }, |
| 34 | + { input : 'link', output : '<link rel="stylesheet" href="$0" type="text/css" media="screen" charset="utf-8" />' }, |
| 35 | + { input : 'base', output : '<base href="$0" />' }, |
| 36 | + { input : 'body', output : '<body>\n\t$0\n</body>' }, |
| 37 | + { input : 'css', output : '<link rel="stylesheet" href="$0" type="text/css" media="screen" charset="utf-8" />' }, |
| 38 | + { input : 'div', output : '<div>\n\t$0\n</div>' }, |
| 39 | + { input : 'divid', output : '<div id="$0">\n\t\n</div>' }, |
| 40 | + { input : 'dl', output : '<dl>\n\t<dt>\n\t\t$0\n\t</dt>\n\t<dd></dd>\n</dl>' }, |
| 41 | + { input : 'fieldset', output : '<fieldset>\n\t$0\n</fieldset>' }, |
| 42 | + { input : 'form', output : '<form action="$0" method="" name="">\n\t\n</form>' }, |
| 43 | + { input : 'meta', output : '<meta name="$0" content="" />' }, |
| 44 | + { input : 'p', output : '<p>$0</p>' }, |
| 45 | + { input : 'script', output : '<script type="text/javascript" language="javascript" charset="utf-8">\n\t$0\t\n</script>' }, |
| 46 | + { input : 'scriptsrc', output : '<script src="$0" type="text/javascript" language="javascript" charset="utf-8"></script>' }, |
| 47 | + { input : 'span', output : '<span>$0</span>' }, |
| 48 | + { input : 'table', output : '<table border="$0" cellspacing="" cellpadding="">\n\t<tr><th></th></tr>\n\t<tr><td></td></tr>\n</table>' }, |
| 49 | + { input : 'style', output : '<style type="text/css" media="screen">\n\t$0\n</style>' } |
| 50 | +] |
| 51 | + |
| 52 | +Language.complete = [ |
| 53 | + { input : '\'',output : '\'$0\'' }, |
| 54 | + { input : '"', output : '"$0"' }, |
| 55 | + { input : '(', output : '\($0\)' }, |
| 56 | + { input : '[', output : '\[$0\]' }, |
| 57 | + { input : '{', output : '{\n\t$0\n}' } |
| 58 | +] |
| 59 | + |
| 60 | +Language.shortcuts = [] |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/html.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 61 | + native |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/autoit.js |
— | — | @@ -0,0 +1,32 @@ |
| 2 | +/** |
| 3 | + * CodePress regular expressions for AutoIt syntax highlighting |
| 4 | + * @author: James Brooks, Michael HURNI |
| 5 | + */ |
| 6 | + |
| 7 | +// AutoIt |
| 8 | +Language.syntax = [ |
| 9 | + { input : /({|}|\(|\))/g, output : '<b>$1</b>' }, // Brackets |
| 10 | + { input : /(\*|\+|-)/g, output : '<b>$1</b>' }, // Operator |
| 11 | + { input : /\"(.*?)(\"|<br>|<\/P>)/g, output : "<s>\"$1$2</s>" }, // strings double |
| 12 | + { input : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<s>\'$1$2</s>' }, // strings single |
| 13 | + { input : /\b([\d]+)\b/g, output : '<ins>$1</ins>' }, // Numbers |
| 14 | + { input : /#(.*?)(<br>|<\/P>)/g, output : '<i>#$1</i>$2' }, // Directives and Includes |
| 15 | + { input : /(\$[\w\.]*)/g, output : '<var>$1</var>' }, // vars |
| 16 | + { input : /(_[\w\.]*)/g, output : '<a>$1</a>' }, // underscored word |
| 17 | + { input : /(\@[\w\.]*)/g, output : '<em>$1</em>' }, // Macros |
| 18 | + { input : /\b(Abs|ACos|AdlibDisable|AdlibEnable|Asc|AscW|ASin|Assign|ATan|AutoItSetOption|AutoItWinGetTitle|AutoItWinSetTitle|Beep|Binary|BinaryLen|BinaryMid|BinaryToString|BitAND|BitNOT|BitOR|BitSHIFT|BitXOR|BlockInput|Break|Call|CDTray|Ceiling|Chr|ChrW|ClipGet|ClipPut|ConsoleRead|ConsoleWrite|ConsoleWriteError|ControlClick|ControlCommand|ControlDisable|ControlEnable|ControlFocus|ControlGetFocus|ControlGetHandle|ControlGetPos|ControlGetText|ControlHide|ControlListView|ControlMove|ControlSend|ControlSetText|ControlShow|Cos|Dec|DirCopy|DirCreate|DirGetSize|DirMove|DirRemove|DllCall|DllCall|DllClose|DllOpen|DllStructCreate|DllStructGetData|DllStructGetPtr|DllStructGetSize|DllStructSetData|DriveGetDrive|DriveGetFileSystem|DriveGetLabel|DriveGetSerial|DriveGetType|DriveMapAdd|DriveMapDel|DriveMapGet|DriveSetLabel|DriveSpaceFree|DriveSpaceTotal|DriveStatus|EnvGet|EnvSet|EnvUpdate|Eval|Execute|Exp|FileChangeDir|FileClose|FileCopy|FileCreateNTFS|FileCreateShortcut|FileDelete|FileExists|FileFindFirstFile|FileFindNextFile|FileGetAttrib|FileGetLongName|FileGetShortcut|FileGetShortName|FileGetSize|FileGetTime|FileGetVersion|FileInstall|FileMove|FileOpen|FileOpenDialog|FileRead|FileReadLine|FileRecycle|FileRecycleEmpty|FileSaveDialog|FileSelectFolder|FileSetAttrib|FileSetTime|FileWrite|FileWriteLine|Floor|FtpSetProxy|GuiCreate|GuiCtrlCreateAvi|GuiCtrlCreateButton|GuiCtrlCreateCheckbox|GuiCtrlCreateCombo|GuiCtrlCreateContextMenu|GuiCtrlCreateDate|GuiCtrlCreateDummy|GuiCtrlCreateEdit|GuiCtrlCreateGraphic|GuiCtrlCreateGroup|GuiCtrlCreateIcon|GuiCtrlCreateInput|GuiCtrlCreateLabel|GuiCtrlCreateList|GuiCtrlCreateListView|GuiCtrlCreateListViewItem|GuiCtrlCreateMenu|GuiCtrlCreateMenuItem|GuiCtrlCreateMonthCal|GuiCtrlCreateObj|GuiCtrlCreatePic|GuiCtrlCreateProgress|GuiCtrlCreateRadio|GuiCtrlCreateSlider|GuiCtrlCreateTab|GuiCtrlCreateTabItem|GuiCtrlCreateUpdown|GuiCtrlDelete|GuiCtrlGetHandle|GuiCtrlGetState|GuiCtrlRead|GuiCtrlRecvMsg|GuiCtrlSentMsg|GuiCtrlSendToDummy|GuiCtrlSetBkColor|GuiCtrlSetColor|GuiCtrlSetCursor|GuiCtrlSetData|GuiCtrlSetFont|GuiCtrlSetGraphic|GuiCtrlSetImage|GuiCtrlSetLimit|GuiCtrlSetOnEvent|GuiCtrlSetPos|GuiCtrlResizing|GuiCtrlSetState|GuiCtrlSetTip|GuiDelete|GuiGetCursorInfo|GuiGetMsg|GuiGetStyle|GuiRegisterMsg|GuiSetBkColor|GuiSetCoord|GuiSetCursor|GuiSetFont|GuiSetHelp|GuiSetIcon|GuiSetOnEvent|GuiSetStat|GuiSetStyle|GuiStartGroup|GuiSwitch|Hex|HotKeySet|HttpSetProxy|HWnd|InetGet|InetGetSize|IniDelete|IniRead|IniReadSection|IniReadSectionNames|IniRenameSection|IniWrite|IniWriteSection|InputBox|Int|IsAdmin|IsArray|IsBinary|IsBool|IsDeclared|IsDllStruct|IsFloat|IsHWnd|IsInt|IsKeyword|IsNumber|IsObj|IsString|Log|MemGetStats|Mod|MouseClick|MouseClickDrag|MouseDown|MouseGetCursor|MouseGetPos|MouseMove|MouseUp|MouseWheel|MsgBox|Number|ObjCreate|ObjEvent|ObjGet|ObjName|Ping|PixelCheckSum|PixelGetColor|PixelSearch|ProcessClose|ProcessExists|ProcessList|ProcessSetPriority|ProcessWait|ProcessWaitClose|ProgressOff|ProcessOn|ProgressSet|Random|RegDelete|RegEnumKey|RegEnumVal|RegRead|RegWrite|Round|Run|RunAsSet|RunWait|Send|SetError|SetExtended|ShellExecute|ShellExecuteWait|Shutdown|Sin|Sleep|SoundPlay|SoundSetWaveVolume|SplashImageOn|SplashOff|SplashTextOn|Sqrt|SRandom|StatusbarGetText|StderrRead|StdinWrite|StdoutRead|String|StringAddCR|StringCompare|StringFormat|StringInStr|StringIsAlNum|StringIsAlpha|StringIsASCII|StringIsDigit|StringIsFloat|StringIsInt|StringIsLower|StringIsSpace|StringIsUpper|StringIsXDigit|StringLeft|StringLen|StringLower|StringMid|StringRegExp|StringRegExpReplace|StringReplace|StringRight|StringSplit|StringStripCR|StringStripWS|StringToBinary|StringTrimLeft|StringTrimRight|StringUpper|Tan|TCPAccept|TCPCloseSocket|TCPConnect|TCPListen|TCPNameToIP|TCPrecv|TCPSend|TCPShutdown|TCPStartup|TimerDiff|TimerInit|ToolTip|TrayCreateItem|TrayCreateMenu|TrayGetMenu|TrayGetMsg|TrayItemDelete|TrayItemGetHandle|TrayItemGetState|TrayItemGetText|TrayItemSetOnEvent|TrayItemSetState|TrayItemSetText|TraySetClick|TraySetIcon|TraySetOnEvent|TraySetPauseIcon|TraySetState|TraySetToolTip|TrayTip|UBound|UDPBind|UDPCloseSocket|UDPOpen|UDPRecv|UDPSend|WinActivate|WinActive|WinClose|WinExists|WinFlash|WinGetCaretPos|WinGetClassList|WinGetClientSize|WinGetHandle|WinGetPos|WinGetProcess|WinGetState|WinGetText|WinGetTitle|WinKill|WinList|WinMenuSelectItem|WinMinimizeAll|WinMinimizeAllUndo|WinMove|WinSetOnTop|WinSetState|WinSetTitle|WinSetTrans|WinWait|WinWaitActive|WinWaitClose|WinWaitNotActive)\b/g, output : '<u>$1</u>' } ,// reserved words |
| 19 | + { input : /\B;(.*?)(<br>|<\/P>)/g, output : '<cite>;$1</cite>$2' }, // comments |
| 20 | + { input : /#CS(.*?)#CE/g, output : '<cite>#CS$1#CE</cite>' } // Block Comments |
| 21 | +] |
| 22 | + |
| 23 | +Language.snippets = [] |
| 24 | + |
| 25 | +Language.complete = [ |
| 26 | +{ input : '\'',output : '\'$0\'' }, |
| 27 | +{ input : '"', output : '"$0"' }, |
| 28 | +{ input : '(', output : '\($0\)' }, |
| 29 | +{ input : '[', output : '\[$0\]' }, |
| 30 | +{ input : '{', output : '{\n\t$0\n}' } |
| 31 | +] |
| 32 | + |
| 33 | +Language.shortcuts = [] |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/autoit.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 34 | + native |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/xsl.js |
— | — | @@ -0,0 +1,103 @@ |
| 2 | +/* |
| 3 | + * CodePress regular expressions for XSL syntax highlighting |
| 4 | + * By RJ Bruneel |
| 5 | + */ |
| 6 | + |
| 7 | +Language.syntax = [ // XSL |
| 8 | + { |
| 9 | + input : /(<[^!]*?>)/g, |
| 10 | + output : '<b>$1</b>' // all tags |
| 11 | + },{ |
| 12 | + input : /(<a.*?>|<\/a>)/g, |
| 13 | + output : '<a>$1</a>' // links |
| 14 | + },{ |
| 15 | + input : /(<img .*?>)/g, |
| 16 | + output : '<big>$1</big>' // images |
| 17 | + },{ |
| 18 | + input : /(<\/?(button|textarea|form|input|select|option|label).*?>)/g, |
| 19 | + output : '<u>$1</u>' // forms |
| 20 | + },{ |
| 21 | + input : /(<style.*?>)(.*?)(<\/style>)/g, |
| 22 | + output : '<em>$1</em><em>$2</em><em>$3</em>' // style tags |
| 23 | + },{ |
| 24 | + input : /(<script.*?>)(.*?)(<\/script>)/g, |
| 25 | + output : '<strong>$1</strong><tt>$2</tt><strong>$3</strong>' // script tags |
| 26 | + },{ |
| 27 | + input : /(<xsl.*?>|<\/xsl.*?>)/g, |
| 28 | + output : '<xsl>$1</xsl>' // xsl |
| 29 | + },{ |
| 30 | + input : /=(".*?")/g, |
| 31 | + output : '=<s>$1</s>' // atributes double quote |
| 32 | + },{ |
| 33 | + input : /=('.*?')/g, |
| 34 | + output : '=<s>$1</s>' // atributes single quote |
| 35 | + },{ |
| 36 | + input : /(<!--.*?-->.)/g, |
| 37 | + output : '<ins>$1</ins>' // comments |
| 38 | + },{ |
| 39 | + input : /\b(alert|window|document|break|continue|do|for|new|this|void|case|default|else|function|return|typeof|while|if|label|switch|var|with|catch|boolean|int|try|false|throws|null|true|goto)\b/g, |
| 40 | + output : '<i>$1</i>' // script reserved words |
| 41 | + } |
| 42 | +]; |
| 43 | + |
| 44 | +Language.snippets = [ |
| 45 | + {input : 'aref', output : '<a href="$0"></a>' }, |
| 46 | + {input : 'h1', output : '<h1>$0</h1>' }, |
| 47 | + {input : 'h2', output : '<h2>$0</h2>' }, |
| 48 | + {input : 'h3', output : '<h3>$0</h3>' }, |
| 49 | + {input : 'h4', output : '<h4>$0</h4>' }, |
| 50 | + {input : 'h5', output : '<h5>$0</h5>' }, |
| 51 | + {input : 'h6', output : '<h6>$0</h6>' }, |
| 52 | + {input : 'html', output : '<html>\n\t$0\n</html>' }, |
| 53 | + {input : 'head', output : '<head>\n\t<meta http-equiv="content-type" content="text/html; charset=utf-8" />\n\t<title>$0</title>\n\t\n</head>' }, |
| 54 | + {input : 'img', output : '<img src="$0" width="" height="" alt="" border="0" />' }, |
| 55 | + {input : 'input', output : '<input name="$0" id="" type="" value="" />' }, |
| 56 | + {input : 'label', output : '<label for="$0"></label>' }, |
| 57 | + {input : 'legend', output : '<legend>\n\t$0\n</legend>' }, |
| 58 | + {input : 'link', output : '<link rel="stylesheet" href="$0" type="text/css" media="screen" charset="utf-8" />' }, |
| 59 | + {input : 'base', output : '<base href="$0" />' }, |
| 60 | + {input : 'body', output : '<body>\n\t$0\n</body>' }, |
| 61 | + {input : 'css', output : '<link rel="stylesheet" href="$0" type="text/css" media="screen" charset="utf-8" />' }, |
| 62 | + {input : 'div', output : '<div>\n\t$0\n</div>' }, |
| 63 | + {input : 'divid', output : '<div id="$0">\n\t\n</div>' }, |
| 64 | + {input : 'dl', output : '<dl>\n\t<dt>\n\t\t$0\n\t</dt>\n\t<dd></dd>\n</dl>' }, |
| 65 | + {input : 'fieldset', output : '<fieldset>\n\t$0\n</fieldset>' }, |
| 66 | + {input : 'form', output : '<form action="$0" method="" name="">\n\t\n</form>' }, |
| 67 | + {input : 'meta', output : '<meta name="$0" content="" />' }, |
| 68 | + {input : 'p', output : '<p>$0</p>' }, |
| 69 | + {input : 'b', output : '<b>$0</b>' }, |
| 70 | + {input : 'li', output : '<li>$0</li>' }, |
| 71 | + {input : 'ul', output : '<ul>$0</ul>' }, |
| 72 | + {input : 'ol', output : '<ol>$0</ol>' }, |
| 73 | + {input : 'strong', output : '<strong>$0</strong>' }, |
| 74 | + {input : 'br', output : '<br />' }, |
| 75 | + {input : 'script', output : '<script type="text/javascript" language="javascript" charset="utf-8">\n\t$0\t\n</script>' }, |
| 76 | + {input : 'scriptsrc', output : '<script src="$0" type="text/javascript" language="javascript" charset="utf-8"></script>' }, |
| 77 | + {input : 'span', output : '<span>$0</span>' }, |
| 78 | + {input : 'table', output : '<table border="$0" cellspacing="" cellpadding="">\n\t<tr><th></th></tr>\n\t<tr><td></td></tr>\n</table>' }, |
| 79 | + {input : 'style', output : '<style type="text/css" media="screen">\n\t$0\n</style>' }, |
| 80 | + {input : 'xsl:stylesheet', output : '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">' }, |
| 81 | + {input : 'xsl:template', output : '<xsl:template>$0</xsl:template>' }, |
| 82 | + {input : 'xsl:for-each', output : '<xsl:for-each select="$0"></xsl:for-each>' }, |
| 83 | + {input : 'xsl:choose', output : '<xsl:choose>$0<\xsl:choose>' }, |
| 84 | + {input : 'xsl:param', output : '<xsl:param name="$0" />' }, |
| 85 | + {input : 'xsl:variable', output : '<xsl:variable name="$0"></xsl:variable>' }, |
| 86 | + {input : 'xsl:if', output : '<xsl:if test="$0"></xsl:if>' }, |
| 87 | + {input : 'xsl:when', output : '<xsl:when test="$0"></xsl:when>' }, |
| 88 | + {input : 'xsl:otherwise', output : '<xsl:otherwise>$0</xsl:otherwise>' }, |
| 89 | + {input : 'xsl:attribute', output : '<xsl:attribute name="$0"></xsl:attribute>' }, |
| 90 | + {input : 'xsl:value-of', output : '<xsl:value-of select="$0"/>' }, |
| 91 | + {input : 'xsl:with-param', output : '<xsl:with-param name="$0" select="" />' }, |
| 92 | + {input : 'xsl:call-template', output : '<xsl:call-template name="$0">' } |
| 93 | + |
| 94 | +]; |
| 95 | + |
| 96 | +Language.complete = [ // Auto complete only for 1 character |
| 97 | + {input : '\'',output : '\'$0\'' }, |
| 98 | + {input : '"', output : '"$0"' }, |
| 99 | + {input : '(', output : '\($0\)' }, |
| 100 | + {input : '[', output : '\[$0\]' }, |
| 101 | + {input : '{', output : '{\n\t$0\n}' } |
| 102 | +]; |
| 103 | + |
| 104 | +Language.shortcuts = []; |
\ No newline at end of file |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/xsl.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 105 | + native |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/javascript.js |
— | — | @@ -0,0 +1,30 @@ |
| 2 | +/* |
| 3 | + * CodePress regular expressions for JavaScript syntax highlighting |
| 4 | + */ |
| 5 | + |
| 6 | +// JavaScript |
| 7 | +Language.syntax = [ |
| 8 | + { input : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>' }, // strings double quote |
| 9 | + { input : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<s>\'$1$2</s>' }, // strings single quote |
| 10 | + { input : /\b(break|continue|do|for|new|this|void|case|default|else|function|return|typeof|while|if|label|switch|var|with|catch|boolean|int|try|false|throws|null|true|goto)\b/g, output : '<b>$1</b>' }, // reserved words |
| 11 | + { input : /\b(alert|isNaN|parent|Array|parseFloat|parseInt|blur|clearTimeout|prompt|prototype|close|confirm|length|Date|location|Math|document|element|name|self|elements|setTimeout|navigator|status|String|escape|Number|submit|eval|Object|event|onblur|focus|onerror|onfocus|onclick|top|onload|toString|onunload|unescape|open|valueOf|window|onmouseover)\b/g, output : '<u>$1</u>' }, // special words |
| 12 | + { input : /([^:]|^)\/\/(.*?)(<br|<\/P)/g, output : '$1<i>//$2</i>$3' }, // comments // |
| 13 | + { input : /\/\*(.*?)\*\//g, output : '<i>/*$1*/</i>' } // comments /* */ |
| 14 | +] |
| 15 | + |
| 16 | +Language.snippets = [ |
| 17 | + { input : 'dw', output : 'document.write(\'$0\');' }, |
| 18 | + { input : 'getid', output : 'document.getElementById(\'$0\')' }, |
| 19 | + { input : 'fun', output : 'function $0(){\n\t\n}' }, |
| 20 | + { input : 'func', output : 'function $0(){\n\t\n}' } |
| 21 | +] |
| 22 | + |
| 23 | +Language.complete = [ |
| 24 | + { input : '\'',output : '\'$0\'' }, |
| 25 | + { input : '"', output : '"$0"' }, |
| 26 | + { input : '(', output : '\($0\)' }, |
| 27 | + { input : '[', output : '\[$0\]' }, |
| 28 | + { input : '{', output : '{\n\t$0\n}' } |
| 29 | +] |
| 30 | + |
| 31 | +Language.shortcuts = [] |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/javascript.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 32 | + native |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/vbscript.css |
— | — | @@ -0,0 +1,71 @@ |
| 2 | +/* |
| 3 | + * CodePress color styles for ASP-VB syntax highlighting |
| 4 | + * By Martin D. Kirk |
| 5 | + */ |
| 6 | + |
| 7 | +/* tags */ |
| 8 | +b { |
| 9 | + color:#000080; |
| 10 | +} |
| 11 | +/* comments */ |
| 12 | +big, big b, big em, big ins, big s, strong i, strong i b, strong i s, strong i u, strong i a, strong i a u, strong i s u { |
| 13 | + color:gray; |
| 14 | + font-weight:normal; |
| 15 | +} |
| 16 | +/* ASP comments */ |
| 17 | +strong dfn, strong dfn a,strong dfn var, strong dfn a u, strong dfn u{ |
| 18 | + color:gray; |
| 19 | + font-weight:normal; |
| 20 | +} |
| 21 | + /* attributes */ |
| 22 | +s, s b, span s u, span s cite, strong span s { |
| 23 | + color:#5656fa ; |
| 24 | + font-weight:normal; |
| 25 | +} |
| 26 | + /* strings */ |
| 27 | +strong s,strong s b, strong s u, strong s cite { |
| 28 | + color:#009900; |
| 29 | + font-weight:normal; |
| 30 | +} |
| 31 | +strong ins{ |
| 32 | + color:#000000; |
| 33 | + font-weight:bold; |
| 34 | +} |
| 35 | + /* Syntax */ |
| 36 | +strong a, strong a u { |
| 37 | + color:#0000FF; |
| 38 | + font-weight:; |
| 39 | +} |
| 40 | + /* Native Keywords */ |
| 41 | +strong u { |
| 42 | + color:#990099; |
| 43 | + font-weight:bold; |
| 44 | +} |
| 45 | +/* Numbers */ |
| 46 | +strong var{ |
| 47 | + color:#FF0000; |
| 48 | +} |
| 49 | +/* ASP Language */ |
| 50 | +span{ |
| 51 | + color:#990000; |
| 52 | + font-weight:bold; |
| 53 | +} |
| 54 | +strong i,strong a i, strong u i { |
| 55 | + color:#009999; |
| 56 | +} |
| 57 | +/* style */ |
| 58 | +em { |
| 59 | + color:#800080; |
| 60 | + font-style:normal; |
| 61 | +} |
| 62 | + /* script */ |
| 63 | +ins { |
| 64 | + color:#800000; |
| 65 | + font-weight:bold; |
| 66 | +} |
| 67 | + |
| 68 | +/* <?php and ?> */ |
| 69 | +cite, s cite { |
| 70 | + color:red; |
| 71 | + font-weight:bold; |
| 72 | +} |
\ No newline at end of file |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/vbscript.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 73 | + native |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/sql.css |
— | — | @@ -0,0 +1,10 @@ |
| 2 | +/* |
| 3 | + * CodePress color styles for SQL syntax highlighting |
| 4 | + * By Merlin Moncure |
| 5 | + */ |
| 6 | + |
| 7 | +b {color:#0000FF;font-style:normal;font-weight:bold;} /* reserved words */ |
| 8 | +u {color:#FF0000;font-style:normal;} /* types */ |
| 9 | +a {color:#CD6600;font-style:normal;font-weight:bold;} /* commands */ |
| 10 | +i, i b, i u, i a, i s {color:#A9A9A9;font-weight:normal;font-style:italic;} /* comments */ |
| 11 | +s, s b, s u, s a, s i {color:#2A00FF;font-weight:normal;} /* strings */ |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/sql.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 12 | + native |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/generic.js |
— | — | @@ -0,0 +1,25 @@ |
| 2 | +/* |
| 3 | + * CodePress regular expressions for generic syntax highlighting |
| 4 | + */ |
| 5 | + |
| 6 | +// generic languages |
| 7 | +Language.syntax = [ |
| 8 | + { input : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>' }, // strings double quote |
| 9 | + { input : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<s>\'$1$2</s>' }, // strings single quote |
| 10 | + { input : /\b(abstract|continue|for|new|switch|default|goto|boolean|do|if|private|this|break|double|protected|throw|byte|else|import|public|throws|case|return|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|const|float|while|function|label)\b/g, output : '<b>$1</b>' }, // reserved words |
| 11 | + { input : /([\(\){}])/g, output : '<em>$1</em>' }, // special chars; |
| 12 | + { input : /([^:]|^)\/\/(.*?)(<br|<\/P)/g, output : '$1<i>//$2</i>$3' }, // comments // |
| 13 | + { input : /\/\*(.*?)\*\//g, output : '<i>/*$1*/</i>' } // comments /* */ |
| 14 | +] |
| 15 | + |
| 16 | +Language.snippets = [] |
| 17 | + |
| 18 | +Language.complete = [ |
| 19 | + { input : '\'', output : '\'$0\'' }, |
| 20 | + { input : '"', output : '"$0"' }, |
| 21 | + { input : '(', output : '\($0\)' }, |
| 22 | + { input : '[', output : '\[$0\]' }, |
| 23 | + { input : '{', output : '{\n\t$0\n}' } |
| 24 | +] |
| 25 | + |
| 26 | +Language.shortcuts = [] |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/generic.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 27 | + native |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/perl.css |
— | — | @@ -0,0 +1,11 @@ |
| 2 | +/* |
| 3 | + * CodePress color styles for Perl syntax highlighting |
| 4 | + * By J. Nick Koston |
| 5 | + */ |
| 6 | + |
| 7 | +b {color:#7F0055;font-weight:bold;} /* reserved words */ |
| 8 | +i, i b, i s, i em, i a, i u {color:gray;font-weight:normal;} /* comments */ |
| 9 | +s, s b, s a, s em, s u {color:#2A00FF;font-weight:normal;} /* strings */ |
| 10 | +a {color:#006700;font-weight:bold;} /* variables */ |
| 11 | +em {color:darkblue;font-weight:bold;} /* functions */ |
| 12 | +u {font-weight:bold;} /* special chars */ |
\ No newline at end of file |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/perl.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 13 | + native |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/csharp.js |
— | — | @@ -0,0 +1,25 @@ |
| 2 | +/* |
| 3 | + * CodePress regular expressions for C# syntax highlighting |
| 4 | + * By Edwin de Jonge |
| 5 | + */ |
| 6 | + |
| 7 | +Language.syntax = [ // C# |
| 8 | + { input : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>' }, // strings double quote |
| 9 | + { input : /\'(.?)(\'|<br>|<\/P>)/g, output : '<s>\'$1$2</s>' }, // strings single quote |
| 10 | + { input : /\b(abstract|as|base|break|case|catch|checked|continue|default|delegate|do|else|event|explicit|extern|false|finally|fixed|for|foreach|get|goto|if|implicit|in|interface|internal|is|lock|namespace|new|null|object|operator|out|override|params|partial|private|protected|public|readonly|ref|return|set|sealed|sizeof|static|stackalloc|switch|this|throw|true|try|typeof|unchecked|unsafe|using|value|virtual|while)\b/g, output : '<b>$1</b>' }, // reserved words |
| 11 | + { input : /\b(bool|byte|char|class|double|float|int|interface|long|string|struct|void)\b/g, output : '<a>$1</a>' }, // types |
| 12 | + { input : /([^:]|^)\/\/(.*?)(<br|<\/P)/g, output : '$1<i>//$2</i>$3' }, // comments // |
| 13 | + { input : /\/\*(.*?)\*\//g, output : '<i>/*$1*/</i>' } // comments /* */ |
| 14 | +]; |
| 15 | + |
| 16 | +Language.snippets = []; |
| 17 | + |
| 18 | +Language.complete = [ // Auto complete only for 1 character |
| 19 | + {input : '\'',output : '\'$0\'' }, |
| 20 | + {input : '"', output : '"$0"' }, |
| 21 | + {input : '(', output : '\($0\)' }, |
| 22 | + {input : '[', output : '\[$0\]' }, |
| 23 | + {input : '{', output : '{\n\t$0\n}' } |
| 24 | +]; |
| 25 | + |
| 26 | +Language.shortcuts = []; |
\ No newline at end of file |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/csharp.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 27 | + native |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/html.css |
— | — | @@ -0,0 +1,13 @@ |
| 2 | +/* |
| 3 | + * CodePress color styles for HTML syntax highlighting |
| 4 | + */ |
| 5 | + |
| 6 | +b {color:#000080;} /* tags */ |
| 7 | +ins, ins b, ins s, ins em {color:gray;} /* comments */ |
| 8 | +s, s b {color:#7777e4;} /* attribute values */ |
| 9 | +a {color:green;} /* links */ |
| 10 | +u {color:#E67300;} /* forms */ |
| 11 | +big {color:#db0000;} /* images */ |
| 12 | +em, em b {color:#800080;} /* style */ |
| 13 | +strong {color:#800000;} /* script */ |
| 14 | +tt i {color:darkblue;font-weight:bold;} /* script reserved words */ |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/html.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 15 | + native |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/autoit.css |
— | — | @@ -0,0 +1,13 @@ |
| 2 | +/** |
| 3 | + * CodePress color styles for AutoIt syntax highlighting |
| 4 | + */ |
| 5 | + |
| 6 | +u {font-style:normal;color:#000090;font-weight:bold;font-family:Monospace;} |
| 7 | +var {color:#AA0000;font-weight:bold;font-style:normal;} |
| 8 | +em {color:#FF33FF;} |
| 9 | +ins {color:#AC00A9;} |
| 10 | +i {color:#F000FF;} |
| 11 | +b {color:#FF0000;} |
| 12 | +a {color:#0080FF;font-weight:bold;} |
| 13 | +s, s u, s b {color:#9999CC;font-weight:normal;} |
| 14 | +cite, cite *{color:#009933;font-weight:normal;} |
\ No newline at end of file |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/autoit.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 15 | + native |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/java.js |
— | — | @@ -0,0 +1,24 @@ |
| 2 | +/* |
| 3 | + * CodePress regular expressions for Java syntax highlighting |
| 4 | + */ |
| 5 | + |
| 6 | +// Java |
| 7 | +Language.syntax = [ |
| 8 | + { input : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>'}, // strings double quote |
| 9 | + { input : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<s>\'$1$2</s>'}, // strings single quote |
| 10 | + { input : /\b(abstract|continue|for|new|switch|assert|default|goto|package|synchronized|boolean|do|if|private|this|break|double|implements|protected|throw|byte|else|import|public|throws|case|enum|instanceof|return|transient|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|strictfp|volatile|const|float|native|super|while)\b/g, output : '<b>$1</b>'}, // reserved words |
| 11 | + { input : /([^:]|^)\/\/(.*?)(<br|<\/P)/g, output : '$1<i>//$2</i>$3'}, // comments // |
| 12 | + { input : /\/\*(.*?)\*\//g, output : '<i>/*$1*/</i>' }// comments /* */ |
| 13 | +] |
| 14 | + |
| 15 | +Language.snippets = [] |
| 16 | + |
| 17 | +Language.complete = [ |
| 18 | + { input : '\'',output : '\'$0\'' }, |
| 19 | + { input : '"', output : '"$0"' }, |
| 20 | + { input : '(', output : '\($0\)' }, |
| 21 | + { input : '[', output : '\[$0\]' }, |
| 22 | + { input : '{', output : '{\n\t$0\n}' } |
| 23 | +] |
| 24 | + |
| 25 | +Language.shortcuts = [] |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/java.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 26 | + native |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/ruby.js |
— | — | @@ -0,0 +1,26 @@ |
| 2 | +/* |
| 3 | + * CodePress regular expressions for Perl syntax highlighting |
| 4 | + */ |
| 5 | + |
| 6 | +// Ruby |
| 7 | +Language.syntax = [ |
| 8 | + { input : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>' }, // strings double quote |
| 9 | + { input : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<s>\'$1$2</s>' }, // strings single quote |
| 10 | + { input : /([\$\@\%]+)([\w\.]*)/g, output : '<a>$1$2</a>' }, // vars |
| 11 | + { input : /(def\s+)([\w\.]*)/g, output : '$1<em>$2</em>' }, // functions |
| 12 | + { input : /\b(alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|false|for|if|in|module|next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)\b/g, output : '<b>$1</b>' }, // reserved words |
| 13 | + { input : /([\(\){}])/g, output : '<u>$1</u>' }, // special chars |
| 14 | + { input : /#(.*?)(<br>|<\/P>)/g, output : '<i>#$1</i>$2' } // comments |
| 15 | +]; |
| 16 | + |
| 17 | +Language.snippets = [] |
| 18 | + |
| 19 | +Language.complete = [ |
| 20 | + { input : '\'',output : '\'$0\'' }, |
| 21 | + { input : '"', output : '"$0"' }, |
| 22 | + { input : '(', output : '\($0\)' }, |
| 23 | + { input : '[', output : '\[$0\]' }, |
| 24 | + { input : '{', output : '{\n\t$0\n}' } |
| 25 | +] |
| 26 | + |
| 27 | +Language.shortcuts = [] |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/ruby.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 28 | + native |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/javascript.css |
— | — | @@ -0,0 +1,8 @@ |
| 2 | +/* |
| 3 | + * CodePress color styles for JavaScript syntax highlighting |
| 4 | + */ |
| 5 | + |
| 6 | +b {color:#7F0055;font-weight:bold;} /* reserved words */ |
| 7 | +u {color:darkblue;font-weight:bold;} /* special words */ |
| 8 | +i, i b, i s, i u {color:green;font-weight:normal;} /* comments */ |
| 9 | +s, s b, s u {color:#2A00FF;font-weight:normal;} /* strings */ |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/javascript.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 10 | + native |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/xsl.css |
— | — | @@ -0,0 +1,15 @@ |
| 2 | +/* |
| 3 | + * CodePress color styles for HTML syntax highlighting |
| 4 | + * By RJ Bruneel |
| 5 | + */ |
| 6 | + |
| 7 | +b {color:#000080;} /* tags */ |
| 8 | +ins, ins b, ins s, ins em {color:gray;} /* comments */ |
| 9 | +s, s b {color:#7777e4;} /* attribute values */ |
| 10 | +a {color:#E67300;} /* links */ |
| 11 | +u {color:#CC66CC;} /* forms */ |
| 12 | +big {color:#db0000;} /* images */ |
| 13 | +em, em b {color:#800080;} /* style */ |
| 14 | +strong {color:#800000;} /* script */ |
| 15 | +tt i {color:darkblue;font-weight:bold;} /* script reserved words */ |
| 16 | +xsl {color:green;} /* xsl */ |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/xsl.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 17 | + native |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/asp.js |
— | — | @@ -0,0 +1,117 @@ |
| 2 | +/* |
| 3 | + * CodePress regular expressions for ASP-vbscript syntax highlighting |
| 4 | + */ |
| 5 | + |
| 6 | +// ASP VBScript |
| 7 | +Language.syntax = [ |
| 8 | +// all tags |
| 9 | + { input : /(<[^!%|!%@]*?>)/g, output : '<b>$1</b>' }, |
| 10 | +// style tags |
| 11 | + { input : /(<style.*?>)(.*?)(<\/style>)/g, output : '<em>$1</em><em>$2</em><em>$3</em>' }, |
| 12 | +// script tags |
| 13 | + { input : /(<script.*?>)(.*?)(<\/script>)/g, output : '<ins>$1</ins><ins>$2</ins><ins>$3</ins>' }, |
| 14 | +// strings "" and attributes |
| 15 | + { input : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>' }, |
| 16 | +// ASP Comment |
| 17 | + { input : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<dfn>\'$1$2</dfn>'}, |
| 18 | +// <%.* |
| 19 | + { input : /(<%)/g, output : '<strong>$1' }, |
| 20 | +// .*%> |
| 21 | + { input : /(%>)/g, output : '$1</strong>' }, |
| 22 | +// <%@...%> |
| 23 | + { input : /(<%@)(.+?)(%>)/gi, output : '$1<span>$2</span>$3' }, |
| 24 | +//Numbers |
| 25 | + { input : /\b([\d]+)\b/g, output : '<var>$1</var>' }, |
| 26 | +// Reserved Words 1 (Blue) |
| 27 | + { input : /\b(And|As|ByRef|ByVal|Call|Case|Class|Const|Dim|Do|Each|Else|ElseIf|Empty|End|Eqv|Exit|False|For|Function)\b/gi, output : '<a>$1</a>' }, |
| 28 | + { input : /\b(Get|GoTo|If|Imp|In|Is|Let|Loop|Me|Mod|Enum|New|Next|Not|Nothing|Null|On|Option|Or|Private|Public|ReDim|Rem)\b/gi, output : '<a>$1</a>' }, |
| 29 | + { input : /\b(Resume|Select|Set|Stop|Sub|Then|To|True|Until|Wend|While|With|Xor|Execute|Randomize|Erase|ExecuteGlobal|Explicit|step)\b/gi, output : '<a>$1</a>' }, |
| 30 | +// Reserved Words 2 (Purple) |
| 31 | + { input : /\b(Abandon|Abs|AbsolutePage|AbsolutePosition|ActiveCommand|ActiveConnection|ActualSize|AddHeader|AddNew|AppendChunk)\b/gi, output : '<u>$1</u>' }, |
| 32 | + { input : /\b(AppendToLog|Application|Array|Asc|Atn|Attributes|BeginTrans|BinaryRead|BinaryWrite|BOF|Bookmark|Boolean|Buffer|Byte)\b/gi, output : '<u>$1</u>' }, |
| 33 | + { input : /\b(CacheControl|CacheSize|Cancel|CancelBatch|CancelUpdate|CBool|CByte|CCur|CDate|CDbl|Charset|Chr|CInt|Clear)\b/gi, output : '<u>$1</u>' }, |
| 34 | + { input : /\b(ClientCertificate|CLng|Clone|Close|CodePage|CommandText|CommandType|CommandTimeout|CommitTrans|CompareBookmarks|ConnectionString|ConnectionTimeout)\b/gi, output : '<u>$1</u>' }, |
| 35 | + { input : /\b(Contents|ContentType|Cookies|Cos|CreateObject|CreateParameter|CSng|CStr|CursorLocation|CursorType|DataMember|DataSource|Date|DateAdd|DateDiff)\b/gi, output : '<u>$1</u>' }, |
| 36 | + { input : /\b(DatePart|DateSerial|DateValue|Day|DefaultDatabase|DefinedSize|Delete|Description|Double|EditMode|Eof|EOF|err|Error)\b/gi, output : '<u>$1</u>' }, |
| 37 | + { input : /\b(Exp|Expires|ExpiresAbsolute|Filter|Find|Fix|Flush|Form|FormatCurrency|FormatDateTime|FormatNumber|FormatPercent)\b/gi, output : '<u>$1</u>' }, |
| 38 | + { input : /\b(GetChunk|GetLastError|GetRows|GetString|Global|HelpContext|HelpFile|Hex|Hour|HTMLEncode|IgnoreCase|Index|InStr|InStrRev)\b/gi, output : '<u>$1</u>' }, |
| 39 | + { input : /\b(Int|Integer|IsArray|IsClientConnected|IsDate|IsolationLevel|Join|LBound|LCase|LCID|Left|Len|Lock|LockType|Log|Long|LTrim)\b/gi, output : '<u>$1</u>' }, |
| 40 | + { input : /\b(MapPath|MarshalOptions|MaxRecords|Mid|Minute|Mode|Month|MonthName|Move|MoveFirst|MoveLast|MoveNext|MovePrevious|Name|NextRecordset)\b/gi, output : '<u>$1</u>' }, |
| 41 | + { input : /\b(Now|Number|NumericScale|ObjectContext|Oct|Open|OpenSchema|OriginalValue|PageCount|PageSize|Pattern|PICS|Precision|Prepared|Property)\b/gi, output : '<u>$1</u>' }, |
| 42 | + { input : /\b(Provider|QueryString|RecordCount|Redirect|RegExp|Remove|RemoveAll|Replace|Requery|Request|Response|Resync|Right|Rnd)\b/gi, output : '<u>$1</u>' }, |
| 43 | + { input : /\b(RollbackTrans|RTrim|Save|ScriptTimeout|Second|Seek|Server|ServerVariables|Session|SessionID|SetAbort|SetComplete|Sgn)\b/gi, output : '<u>$1</u>' }, |
| 44 | + { input : /\b(Sin|Size|Sort|Source|Space|Split|Sqr|State|StaticObjects|Status|StayInSync|StrComp|String|StrReverse|Supports|Tan|Time)\b/gi, output : '<u>$1</u>' }, |
| 45 | + { input : /\b(Timeout|Timer|TimeSerial|TimeValue|TotalBytes|Transfer|Trim|Type|Type|UBound|UCase|UnderlyingValue|UnLock|Update|UpdateBatch)\b/gi, output : '<u>$1</u>' }, |
| 46 | + { input : /\b(URLEncode|Value|Value|Version|Weekday|WeekdayName|Write|Year)\b/gi, output : '<u>$1</u>' }, |
| 47 | +// Reserved Words 3 (Turquis) |
| 48 | + { input : /\b(vbBlack|vbRed|vbGreen|vbYellow|vbBlue|vbMagenta|vbCyan|vbWhite|vbBinaryCompare|vbTextCompare)\b/gi, output : '<i>$1</i>' }, |
| 49 | + { input : /\b(vbSunday|vbMonday|vbTuesday|vbWednesday|vbThursday|vbFriday|vbSaturday|vbUseSystemDayOfWeek)\b/gi, output : '<i>$1</i>' }, |
| 50 | + { input : /\b(vbFirstJan1|vbFirstFourDays|vbFirstFullWeek|vbGeneralDate|vbLongDate|vbShortDate|vbLongTime|vbShortTime)\b/gi, output : '<i>$1</i>' }, |
| 51 | + { input : /\b(vbObjectError|vbCr|VbCrLf|vbFormFeed|vbLf|vbNewLine|vbNullChar|vbNullString|vbTab|vbVerticalTab|vbUseDefault|vbTrue)\b/gi, output : '<i>$1</i>' }, |
| 52 | + { input : /\b(vbFalse|vbEmpty|vbNull|vbInteger|vbLong|vbSingle|vbDouble|vbCurrency|vbDate|vbString|vbObject|vbError|vbBoolean|vbVariant)\b/gi, output : '<i>$1</i>' }, |
| 53 | + { input : /\b(vbDataObject|vbDecimal|vbByte|vbArray)\b/gi, output : '<i>$1</i>' }, |
| 54 | +// html comments |
| 55 | + { input : /(<!--.*?-->.)/g, output : '<big>$1</big>' } |
| 56 | +] |
| 57 | + |
| 58 | +Language.Functions = [ |
| 59 | + // Output at index 0, must be the desired tagname surrounding a $1 |
| 60 | + // Name is the index from the regex that marks the functionname |
| 61 | + {input : /(function|sub)([ ]*?)(\w+)([ ]*?\()/gi , output : '<ins>$1</ins>', name : '$3'} |
| 62 | +] |
| 63 | + |
| 64 | +Language.snippets = [ |
| 65 | +//Conditional |
| 66 | + { input : 'if', output : 'If $0 Then\n\t\nEnd If' }, |
| 67 | + { input : 'ifelse', output : 'If $0 Then\n\t\n\nElse\n\t\nEnd If' }, |
| 68 | + { input : 'case', output : 'Select Case $0\n\tCase ?\n\tCase Else\nEnd Select'}, |
| 69 | +//Response |
| 70 | + { input : 'rw', output : 'Response.Write( $0 )' }, |
| 71 | + { input : 'resc', output : 'Response.Cookies( $0 )' }, |
| 72 | + { input : 'resb', output : 'Response.Buffer'}, |
| 73 | + { input : 'resflu', output : 'Response.Flush()'}, |
| 74 | + { input : 'resend', output : 'Response.End'}, |
| 75 | +//Request |
| 76 | + { input : 'reqc', output : 'Request.Cookies( $0 )' }, |
| 77 | + { input : 'rq', output : 'Request.Querystring("$0")' }, |
| 78 | + { input : 'rf', output : 'Request.Form("$0")' }, |
| 79 | +//FSO |
| 80 | + { input : 'fso', output : 'Set fso = Server.CreateObject("Scripting.FileSystemObject")\n$0' }, |
| 81 | + { input : 'setfo', output : 'Set fo = fso.getFolder($0)' }, |
| 82 | + { input : 'setfi', output : 'Set fi = fso.getFile($0)' }, |
| 83 | + { input : 'twr', output : 'Set f = fso.CreateTextFile($0,true)\'overwrite\nf.WriteLine()\nf.Close'}, |
| 84 | + { input : 'tre', output : 'Set f = fso.OpenTextFile($0, 1)\nf.ReadAll\nf.Close'}, |
| 85 | +//Server |
| 86 | + { input : 'mapp', output : 'Server.Mappath($0)' }, |
| 87 | +//Loops |
| 88 | + { input : 'foreach', output : 'For Each $0 in ?\n\t\nNext' }, |
| 89 | + { input : 'for', output : 'For $0 to ? step ?\n\t\nNext' }, |
| 90 | + { input : 'do', output : 'Do While($0)\n\t\nLoop' }, |
| 91 | + { input : 'untilrs', output : 'do until rs.eof\n\t\nrs.movenext\nloop' }, |
| 92 | +//ADO |
| 93 | + { input : 'adorec', output : 'Set rs = Server.CreateObject("ADODB.Recordset")' }, |
| 94 | + { input : 'adocon', output : 'Set Conn = Server.CreateObject("ADODB.Connection")' }, |
| 95 | + { input : 'adostr', output : 'Set oStr = Server.CreateObject("ADODB.Stream")' }, |
| 96 | +//Http Request |
| 97 | + { input : 'xmlhttp', output : 'Set xmlHttp = Server.CreateObject("Microsoft.XMLHTTP")\nxmlHttp.open("GET", $0, false)\nxmlHttp.send()\n?=xmlHttp.responseText' }, |
| 98 | + { input : 'xmldoc', output : 'Set xmldoc = Server.CreateObject("Microsoft.XMLDOM")\nxmldoc.async=false\nxmldoc.load(request)'}, |
| 99 | +//Functions |
| 100 | + { input : 'func', output : 'Function $0()\n\t\n\nEnd Function'}, |
| 101 | + { input : 'sub', output : 'Sub $0()\n\t\nEnd Sub'} |
| 102 | + |
| 103 | +] |
| 104 | + |
| 105 | +Language.complete = [ |
| 106 | + //{ input : '\'', output : '\'$0\'' }, |
| 107 | + { input : '"', output : '"$0"' }, |
| 108 | + { input : '(', output : '\($0\)' }, |
| 109 | + { input : '[', output : '\[$0\]' }, |
| 110 | + { input : '{', output : '{\n\t$0\n}' } |
| 111 | +] |
| 112 | + |
| 113 | +Language.shortcuts = [ |
| 114 | + { input : '[space]', output : ' ' }, |
| 115 | + { input : '[enter]', output : '<br />' } , |
| 116 | + { input : '[j]', output : 'testing' }, |
| 117 | + { input : '[7]', output : '&' } |
| 118 | +] |
\ No newline at end of file |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/asp.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 119 | + native |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/text.js |
— | — | @@ -0,0 +1,9 @@ |
| 2 | +/* |
| 3 | + * CodePress regular expressions for Text syntax highlighting |
| 4 | + */ |
| 5 | + |
| 6 | +// plain text |
| 7 | +Language.syntax = [] |
| 8 | +Language.snippets = [] |
| 9 | +Language.complete = [] |
| 10 | +Language.shortcuts = [] |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/text.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 11 | + native |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/php.js |
— | — | @@ -0,0 +1,61 @@ |
| 2 | +/* |
| 3 | + * CodePress regular expressions for PHP syntax highlighting |
| 4 | + */ |
| 5 | + |
| 6 | +// PHP |
| 7 | +Language.syntax = [ |
| 8 | + { input : /(<[^!\?]*?>)/g, output : '<b>$1</b>' }, // all tags |
| 9 | + { input : /(<style.*?>)(.*?)(<\/style>)/g, output : '<em>$1</em><em>$2</em><em>$3</em>' }, // style tags |
| 10 | + { input : /(<script.*?>)(.*?)(<\/script>)/g, output : '<ins>$1</ins><ins>$2</ins><ins>$3</ins>' }, // script tags |
| 11 | + { input : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>' }, // strings double quote |
| 12 | + { input : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<s>\'$1$2</s>'}, // strings single quote |
| 13 | + { input : /(<\?)/g, output : '<strong>$1' }, // <?.* |
| 14 | + { input : /(\?>)/g, output : '$1</strong>' }, // .*?> |
| 15 | + { input : /(<\?php|<\?=|<\?|\?>)/g, output : '<cite>$1</cite>' }, // php tags |
| 16 | + { input : /(\$[\w\.]*)/g, output : '<a>$1</a>' }, // vars |
| 17 | + { input : /\b(false|true|and|or|xor|__FILE__|exception|__LINE__|array|as|break|case|class|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|eval|exit|extends|for|foreach|function|global|if|include|include_once|isset|list|new|print|require|require_once|return|static|switch|unset|use|while|__FUNCTION__|__CLASS__|__METHOD__|final|php_user_filter|interface|implements|extends|public|private|protected|abstract|clone|try|catch|throw|this)\b/g, output : '<u>$1</u>' }, // reserved words |
| 18 | + { input : /([^:])\/\/(.*?)(<br|<\/P)/g, output : '$1<i>//$2</i>$3' }, // php comments // |
| 19 | + { input : /([^:])#(.*?)(<br|<\/P)/g, output : '$1<i>#$2</i>$3' }, // php comments # |
| 20 | + { input : /\/\*(.*?)\*\//g, output : '<i>/*$1*/</i>' }, // php comments /* */ |
| 21 | + { input : /(<!--.*?-->.)/g, output : '<big>$1</big>' } // html comments |
| 22 | +] |
| 23 | + |
| 24 | +Language.snippets = [ |
| 25 | + { input : 'if', output : 'if($0){\n\t\n}' }, |
| 26 | + { input : 'ifelse', output : 'if($0){\n\t\n}\nelse{\n\t\n}' }, |
| 27 | + { input : 'else', output : '}\nelse {\n\t' }, |
| 28 | + { input : 'elseif', output : '}\nelseif($0) {\n\t' }, |
| 29 | + { input : 'do', output : 'do{\n\t$0\n}\nwhile();' }, |
| 30 | + { input : 'inc', output : 'include_once("$0");' }, |
| 31 | + { input : 'fun', output : 'function $0(){\n\t\n}' }, |
| 32 | + { input : 'func', output : 'function $0(){\n\t\n}' }, |
| 33 | + { input : 'while', output : 'while($0){\n\t\n}' }, |
| 34 | + { input : 'for', output : 'for($0,,){\n\t\n}' }, |
| 35 | + { input : 'fore', output : 'foreach($0 as ){\n\t\n}' }, |
| 36 | + { input : 'foreach', output : 'foreach($0 as ){\n\t\n}' }, |
| 37 | + { input : 'echo', output : 'echo \'$0\';' }, |
| 38 | + { input : 'switch', output : 'switch($0) {\n\tcase "": break;\n\tdefault: ;\n}' }, |
| 39 | + { input : 'case', output : 'case "$0" : break;' }, |
| 40 | + { input : 'ret0', output : 'return false;' }, |
| 41 | + { input : 'retf', output : 'return false;' }, |
| 42 | + { input : 'ret1', output : 'return true;' }, |
| 43 | + { input : 'rett', output : 'return true;' }, |
| 44 | + { input : 'ret', output : 'return $0;' }, |
| 45 | + { input : 'def', output : 'define(\'$0\',\'\');' }, |
| 46 | + { input : '<?', output : 'php\n$0\n?>' } |
| 47 | +] |
| 48 | + |
| 49 | +Language.complete = [ |
| 50 | + { input : '\'', output : '\'$0\'' }, |
| 51 | + { input : '"', output : '"$0"' }, |
| 52 | + { input : '(', output : '\($0\)' }, |
| 53 | + { input : '[', output : '\[$0\]' }, |
| 54 | + { input : '{', output : '{\n\t$0\n}' } |
| 55 | +] |
| 56 | + |
| 57 | +Language.shortcuts = [ |
| 58 | + { input : '[space]', output : ' ' }, |
| 59 | + { input : '[enter]', output : '<br />' } , |
| 60 | + { input : '[j]', output : 'testing' }, |
| 61 | + { input : '[7]', output : '&' } |
| 62 | +] |
\ No newline at end of file |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/php.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 63 | + native |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/generic.css |
— | — | @@ -0,0 +1,9 @@ |
| 2 | +/* |
| 3 | + * CodePress color styles for generic syntax highlighting |
| 4 | + */ |
| 5 | + |
| 6 | +b {color:#7F0055;font-weight:bold;} /* reserved words */ |
| 7 | +u {color:darkblue;font-weight:bold;} /* special words */ |
| 8 | +i, i b, i s, i u, i em {color:green;font-weight:normal;} /* comments */ |
| 9 | +s, s b, s em {color:#2A00FF;font-weight:normal;} /* strings */ |
| 10 | +em {font-weight:bold;} /* special chars */ |
\ No newline at end of file |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/generic.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 11 | + native |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/css.js |
— | — | @@ -0,0 +1,23 @@ |
| 2 | +/* |
| 3 | + * CodePress regular expressions for CSS syntax highlighting |
| 4 | + */ |
| 5 | + |
| 6 | +// CSS |
| 7 | +Language.syntax = [ |
| 8 | + { input : /(.*?){(.*?)}/g,output : '<b>$1</b>{<u>$2</u>}' }, // tags, ids, classes, values |
| 9 | + { input : /([\w-]*?):([^\/])/g,output : '<a>$1</a>:$2' }, // keys |
| 10 | + { input : /\((.*?)\)/g,output : '(<s>$1</s>)' }, // parameters |
| 11 | + { input : /\/\*(.*?)\*\//g,output : '<i>/*$1*/</i>'} // comments |
| 12 | +] |
| 13 | + |
| 14 | +Language.snippets = [] |
| 15 | + |
| 16 | +Language.complete = [ |
| 17 | + { input : '\'',output : '\'$0\'' }, |
| 18 | + { input : '"', output : '"$0"' }, |
| 19 | + { input : '(', output : '\($0\)' }, |
| 20 | + { input : '[', output : '\[$0\]' }, |
| 21 | + { input : '{', output : '{\n\t$0\n}' } |
| 22 | +] |
| 23 | + |
| 24 | +Language.shortcuts = [] |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/codepress/languages/css.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 25 | + native |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js |
— | — | @@ -23,10 +23,11 @@ |
24 | 24 | if ( '$toc' in context.modules ) { |
25 | 25 | return; |
26 | 26 | } |
27 | | - context.modules.$toc = $( '<div></div>' ) |
| 27 | + context.modules.$toc = $( '<div />' ) |
28 | 28 | .addClass( 'wikiEditor-ui-toc' ) |
29 | 29 | .attr( 'id', 'wikiEditor-ui-toc' ); |
30 | | - $.wikiEditor.modules.toc.fn.build( context, config ); |
| 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() |
31 | 32 | context.$ui.find( '.wikiEditor-ui-bottom' ) |
32 | 33 | .append( context.modules.$toc ); |
33 | 34 | context.modules.$toc.height( |
— | — | @@ -34,13 +35,11 @@ |
35 | 36 | ); |
36 | 37 | // Make some css modifications to make room for the toc on the right... |
37 | 38 | // Perhaps this could be configurable? |
38 | | - context.modules.$toc |
39 | | - .css( 'width', '12em' ) |
40 | | - .css( 'marginTop', -( context.$ui.find( '.wikiEditor-ui-bottom' ).height() ) ); |
| 39 | + context.modules.$toc.css( { 'width': '12em', 'marginTop': -( height ) } ); |
41 | 40 | context.$ui.find( '.wikiEditor-ui-text' ) |
42 | 41 | .css( ( $( 'body.rtl' ).size() ? 'marginLeft' : 'marginRight' ), '12em' ); |
43 | 42 | // Add the TOC to the document |
44 | | - $.wikiEditor.modules.toc.fn.build( context ); |
| 43 | + $.wikiEditor.modules.toc.fn.build( context, config ); |
45 | 44 | context.$textarea |
46 | 45 | .delayedBind( 1000, 'keyup encapsulateSelection change', |
47 | 46 | function( event ) { |
— | — | @@ -146,17 +145,18 @@ |
147 | 146 | * @param {Object} structure Structured outline |
148 | 147 | */ |
149 | 148 | function buildList( structure ) { |
150 | | - var list = $( '<ul></ul>' ); |
| 149 | + var list = $( '<ul />' ); |
151 | 150 | for ( i in structure ) { |
152 | | - var item = $( '<li></li>' ) |
| 151 | + var item = $( '<li />' ) |
153 | 152 | .append( |
154 | | - $( '<a></a>' ) |
| 153 | + $( '<a />' ) |
155 | 154 | .attr( 'href', '#' ) |
156 | 155 | .addClass( 'section-' + structure[i].index ) |
157 | 156 | .data( 'textbox', context.$textarea ) |
158 | 157 | .data( 'position', structure[i].position ) |
159 | 158 | .click( function( event ) { |
160 | 159 | $(this).data( 'textbox' ) |
| 160 | + .focus() |
161 | 161 | .setSelection( $(this).data( 'position' ) ) |
162 | 162 | .scrollToCaretPosition( true ); |
163 | 163 | event.preventDefault(); |
— | — | @@ -172,23 +172,22 @@ |
173 | 173 | } |
174 | 174 | // Build outline from wikitext |
175 | 175 | var outline = []; |
176 | | - var wikitext = '\n' + $.wikiEditor.fixOperaBrokenness( context.$textarea.val() ) + '\n'; |
| 176 | + var wikitext = $.wikiEditor.fixOperaBrokenness( context.$textarea.val() ); |
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 = headings[h]; |
| 181 | + text = $.trim( 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 + 1; |
| 185 | + if ( position >= offset ) { |
| 186 | + offset = position + text.length; |
187 | 187 | } else if ( position == -1 ) { |
188 | 188 | // Not sure this is possible, or what should happen |
189 | 189 | continue; |
190 | 190 | } |
191 | | - // Trim off whitespace |
192 | | - text = $.trim( text ); |
| 191 | + |
193 | 192 | // Detect the starting and ending heading levels |
194 | 193 | var startLevel = 0; |
195 | 194 | for ( var c = 0; c < text.length; c++ ) { |
— | — | @@ -237,7 +236,15 @@ |
238 | 237 | if ( $( 'input[name=wpSection]' ).val() == '' ) |
239 | 238 | structure.unshift( { 'text': wgPageName.replace(/_/g, ' '), 'level': 1, 'index': 0, 'position': 0 } ); |
240 | 239 | context.modules.$toc.html( buildList( structure ) ); |
241 | | - context.modules.$toc.find( 'ul a' ).autoEllipse( { 'position': 'right', 'tooltip': true } ); |
| 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' ); |
242 | 249 | // Cache the outline for later use |
243 | 250 | context.data.outline = outline; |
244 | 251 | } |
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( 'context' ).$ui; |
| 214 | + var $ui = $target.data( 'wikiEditor-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,4 +9503,7 @@ |
9504 | 9504 | */ |
9505 | 9505 | function js2AddOnloadHook( func ) { |
9506 | 9506 | $j(document).ready( func ); |
9507 | | -} |
\ No newline at end of file |
| 9507 | +} |
| 9508 | + |
| 9509 | +// Define a dummy mvJsLoader.doLoad() function |
| 9510 | +mvJsLoader = { doLoad: function( deps, callback ) { callback(); } }; |
\ No newline at end of file |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/js2.combined.min.js |
— | — | @@ -778,4 +778,5 @@ |
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);} |
\ No newline at end of file |
| 782 | +$j=jQuery.noConflict();function js2AddOnloadHook(func){$j(document).ready(func);} |
| 783 | +mvJsLoader={doLoad:function(deps,callback){callback();}}; |
\ No newline at end of file |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/Makefile |
— | — | @@ -0,0 +1,60 @@ |
| 2 | +# |
| 3 | +# Handy makefile to combine and minify css and javascript files |
| 4 | +# |
| 5 | +# For more info on JSMin, see: http://www.crockford.com/javascript/jsmin.html |
| 6 | +# |
| 7 | + |
| 8 | +CSS := css/suggestions.css\ |
| 9 | + css/wikiEditor.css\ |
| 10 | + css/wikiEditor.dialogs.css\ |
| 11 | + css/wikiEditor.toc.css\ |
| 12 | + css/wikiEditor.toolbar.css |
| 13 | + |
| 14 | +JS2 := js/js2/jquery-1.3.2.js\ |
| 15 | + js/js2/jquery-ui-1.7.2.js\ |
| 16 | + js/js2/js2.js |
| 17 | + |
| 18 | +PLUGINS := js/plugins/jquery.async.js\ |
| 19 | + js/plugins/jquery.autoEllipse.js\ |
| 20 | + js/plugins/jquery.browser.js\ |
| 21 | + js/plugins/jquery.cookie.js\ |
| 22 | + js/plugins/jquery.delayedBind.js\ |
| 23 | + js/plugins/jquery.namespaceSelect.js\ |
| 24 | + js/plugins/jquery.suggestions.js\ |
| 25 | + js/plugins/jquery.textSelection.js\ |
| 26 | + js/plugins/jquery.wikiEditor.js\ |
| 27 | + js/plugins/jquery.wikiEditor.dialogs.js\ |
| 28 | + js/plugins/jquery.wikiEditor.toolbar.js\ |
| 29 | + js/plugins/jquery.wikiEditor.toc.js |
| 30 | + |
| 31 | +all: css/combined.css\ |
| 32 | + css/combined.min.css\ |
| 33 | + js/js2.combined.js\ |
| 34 | + js/js2.combined.min.js\ |
| 35 | + js/plugins.combined.js\ |
| 36 | + js/plugins.combined.min.js |
| 37 | + |
| 38 | +css/combined.css: $(CSS) |
| 39 | + cat $(CSS) > css/combined.css |
| 40 | + |
| 41 | +js/js2.combined.js: $(JS2) |
| 42 | + cat $(JS2) > js/js2.combined.js |
| 43 | + |
| 44 | +js/plugins.combined.js: $(PLUGINS) |
| 45 | + cat $(PLUGINS) > js/plugins.combined.js |
| 46 | + |
| 47 | +js/js2.combined.min.js : js/js2.combined.js |
| 48 | + jsmin < js/js2.combined.js > js/js2.combined.min.js |
| 49 | + |
| 50 | +js/plugins.combined.min.js : js/plugins.combined.js |
| 51 | + jsmin < js/plugins.combined.js > js/plugins.combined.min.js |
| 52 | + |
| 53 | +css/combined.min.css : css/combined.css |
| 54 | + cat css/combined.css |\ |
| 55 | + sed -e 's/^[ ]*//g; s/[ ]*$$//g; s/\([:{;,]\) /\1/g; s/ {/{/g; s/\/\*.*\*\///g; /^$$/d'\ |
| 56 | + > css/combined.min.css |
| 57 | + |
| 58 | +clean: |
| 59 | + rm -f js/js2.combined.* |
| 60 | + rm -f js/plugins.combined.* |
| 61 | + rm -f css/combined.* |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/css/combined.min.css |
— | — | @@ -105,6 +105,7 @@ |
106 | 106 | float:right; |
107 | 107 | padding:0; |
108 | 108 | overflow:auto; |
| 109 | +overflow-x:hidden; |
109 | 110 | } |
110 | 111 | body.rtl .wikiEditor-ui-toc{ |
111 | 112 | right:auto; |
— | — | @@ -115,6 +116,9 @@ |
116 | 117 | padding:0; |
117 | 118 | margin:0.5em 1em; |
118 | 119 | list-style:none; |
| 120 | +list-style-image:none; |
| 121 | +list-style-position:outside; |
| 122 | +list-style-type:none; |
119 | 123 | } |
120 | 124 | .wikiEditor-ui-toc ul ul{ |
121 | 125 | padding:0; |
— | — | @@ -147,6 +151,8 @@ |
148 | 152 | float:left; |
149 | 153 | width:100%; |
150 | 154 | clear:both; |
| 155 | +height:0; |
| 156 | +overflow:hidden; |
151 | 157 | } |
152 | 158 | body.rtl .wikiEditor-ui-toolbar .sections{ |
153 | 159 | float:right; |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/css/wikiEditor.toolbar.css |
— | — | @@ -10,6 +10,8 @@ |
11 | 11 | float: left; |
12 | 12 | width: 100%; |
13 | 13 | clear: both; |
| 14 | + height: 0; |
| 15 | + overflow: hidden; |
14 | 16 | } |
15 | 17 | body.rtl .wikiEditor-ui-toolbar .sections { |
16 | 18 | float: right; |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/css/wikiEditor.toc.css |
— | — | @@ -12,6 +12,7 @@ |
13 | 13 | float: right; |
14 | 14 | padding: 0; |
15 | 15 | overflow: auto; |
| 16 | + overflow-x: hidden; |
16 | 17 | } |
17 | 18 | body.rtl .wikiEditor-ui-toc { |
18 | 19 | right: auto; |
— | — | @@ -22,6 +23,10 @@ |
23 | 24 | padding: 0; |
24 | 25 | margin: 0.5em 1em; |
25 | 26 | 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; |
26 | 31 | } |
27 | 32 | .wikiEditor-ui-toc ul ul { |
28 | 33 | padding: 0; |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/css/combined.css |
— | — | @@ -117,6 +117,7 @@ |
118 | 118 | float: right; |
119 | 119 | padding: 0; |
120 | 120 | overflow: auto; |
| 121 | + overflow-x: hidden; |
121 | 122 | } |
122 | 123 | body.rtl .wikiEditor-ui-toc { |
123 | 124 | right: auto; |
— | — | @@ -127,6 +128,10 @@ |
128 | 129 | padding: 0; |
129 | 130 | margin: 0.5em 1em; |
130 | 131 | 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; |
131 | 136 | } |
132 | 137 | .wikiEditor-ui-toc ul ul { |
133 | 138 | padding: 0; |
— | — | @@ -162,6 +167,8 @@ |
163 | 168 | float: left; |
164 | 169 | width: 100%; |
165 | 170 | clear: both; |
| 171 | + height: 0; |
| 172 | + overflow: hidden; |
166 | 173 | } |
167 | 174 | body.rtl .wikiEditor-ui-toolbar .sections { |
168 | 175 | float: right; |
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' => 5 ), |
| 24 | + array( 'src' => 'css/wikiEditor.toolbar.css', 'version' => 6 ), |
25 | 25 | array( 'src' => 'css/wikiEditor.dialogs.css', 'version' => 2 ), |
26 | | - array( 'src' => 'css/wikiEditor.toc.css', 'version' => 5 ), |
| 26 | + array( 'src' => 'css/wikiEditor.toc.css', 'version' => 6 ), |
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' => 9 ), |
| 30 | + array( 'src' => 'css/combined.css', 'version' => 11 ), |
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' => 9 ), |
| 34 | + array( 'src' => 'css/combined.min.css', 'version' => 11 ), |
35 | 35 | array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2' ), |
36 | 36 | ), |
37 | 37 | ) |
— | — | @@ -44,39 +44,37 @@ |
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/js2.js', 'version' => 3 ), |
| 48 | + array( 'src' => 'js/js2/jquery-ui-1.7.2.js', 'version' => '1.7.2y' ), |
| 49 | + array( 'src' => 'js/js2/js2.js', 'version' => 4 ), |
49 | 50 | ), |
50 | 51 | 'combined' => array( |
51 | | - array( 'src' => 'js/js2.combined.js', 'version' => 6 ), |
| 52 | + array( 'src' => 'js/js2.combined.js', 'version' => 7 ), |
52 | 53 | ), |
53 | 54 | 'minified' => array( |
54 | | - array( 'src' => 'js/js2.combined.min.js', 'version' => 6 ), |
| 55 | + array( 'src' => 'js/js2.combined.min.js', 'version' => 7 ), |
55 | 56 | ), |
56 | 57 | ), |
57 | 58 | // Core functionality of extension |
58 | 59 | 'base_sets' => array( |
59 | 60 | 'raw' => array( |
60 | 61 | array( 'src' => 'js/plugins/jquery.async.js', 'version' => 3 ), |
61 | | - array( 'src' => 'js/plugins/jquery.autoEllipse.js', 'version' => 2 ), |
| 62 | + array( 'src' => 'js/plugins/jquery.autoEllipse.js', 'version' => 3 ), |
62 | 63 | array( 'src' => 'js/plugins/jquery.browser.js', 'version' => 3 ), |
63 | 64 | array( 'src' => 'js/plugins/jquery.cookie.js', 'version' => 3 ), |
64 | 65 | array( 'src' => 'js/plugins/jquery.delayedBind.js', 'version' => 1 ), |
65 | 66 | array( 'src' => 'js/plugins/jquery.namespaceSelect.js', 'version' => 1 ), |
66 | 67 | array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 4 ), |
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' ), |
| 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 ), |
75 | 73 | ), |
76 | 74 | 'combined' => array( |
77 | | - array( 'src' => 'js/plugins.combined.js', 'version' => 36 ), |
| 75 | + array( 'src' => 'js/plugins.combined.js', 'version' => 43 ), |
78 | 76 | ), |
79 | 77 | 'minified' => array( |
80 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 36 ), |
| 78 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 43 ), |
81 | 79 | ), |
82 | 80 | ), |
83 | 81 | ); |