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/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 | ); |
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 | } |
— | — | @@ -1084,10 +1085,10 @@ |
1085 | 1086 | </tr></table><table><tr>\ |
1086 | 1087 | <td class="label"><label for="edittoolbar-table-dimensions-columns"\ |
1087 | 1088 | rel="edittoolbar-tool-table-dimensions-columns"></label></td>\ |
1088 | | - <td><input type="text" id="edittoolbar-table-dimensions-columns" size="2" /></td>\ |
| 1089 | + <td><input type="text" id="edittoolbar-table-dimensions-columns" size="3" /></td>\ |
1089 | 1090 | <td class="label"><label for="edittoolbar-table-dimensions-rows"\ |
1090 | 1091 | rel="edittoolbar-tool-table-dimensions-rows"></label></td>\ |
1091 | | - <td><input type="text" id="edittoolbar-table-dimensions-rows" size="2" /></td>\ |
| 1092 | + <td><input type="text" id="edittoolbar-table-dimensions-rows" size="3" /></td>\ |
1092 | 1093 | </tr></table></fieldset>', |
1093 | 1094 | init: function() { |
1094 | 1095 | $j(this).find( '[rel]' ).each( function() { |
— | — | @@ -1108,8 +1109,10 @@ |
1109 | 1110 | dialog: { |
1110 | 1111 | buttons: { |
1111 | 1112 | '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() ); |
| 1113 | + var rowsVal = $j( '#edittoolbar-table-dimensions-rows' ).val(); |
| 1114 | + var colsVal = $j( '#edittoolbar-table-dimensions-columns' ).val(); |
| 1115 | + var rows = parseInt( rowsVal, 10 ); |
| 1116 | + var cols = parseInt( colsVal, 10 ); |
1114 | 1117 | var header = Math.min( 1, $j( '#edittoolbar-table-dimensions-header:checked' ).size() ); |
1115 | 1118 | if ( isNaN( rows ) || isNaN( cols ) ) { |
1116 | 1119 | alert( gM( 'edittoolbar-tool-table-invalidnumber' ) ); |
— | — | @@ -1144,9 +1147,9 @@ |
1145 | 1148 | $j.wikiEditor.modules.toolbar.fn.doAction( |
1146 | 1149 | $j(this).data( 'context' ), |
1147 | 1150 | { |
1148 | | - type: 'encapsulate', |
| 1151 | + type: 'replace', |
1149 | 1152 | options: { |
1150 | | - pre: "{|\n", |
| 1153 | + pre: "{| class=\"wikitable\"\n", |
1151 | 1154 | peri: table, |
1152 | 1155 | post: "|}", |
1153 | 1156 | ownline: true |
— | — | @@ -1184,6 +1187,8 @@ |
1185 | 1188 | <div id="edittoolbar-replace-message">\ |
1186 | 1189 | <div id="edittoolbar-replace-nomatch" rel="edittoolbar-tool-replace-nomatch"></div>\ |
1187 | 1190 | <div id="edittoolbar-replace-success"></div>\ |
| 1191 | + <div id="edittoolbar-replace-emptysearch" rel="edittoolbar-tool-replace-emptysearch"></div>\ |
| 1192 | + <div id="edittoolbar-replace-invalidregex"></div>\ |
1188 | 1193 | </div>\ |
1189 | 1194 | <fieldset><table><tr>\ |
1190 | 1195 | <td><label for="edittoolbar-replace-search" rel="edittoolbar-tool-replace-search"></label></td>\ |
— | — | @@ -1214,8 +1219,12 @@ |
1215 | 1220 | |
1216 | 1221 | // TODO: Find a cleaner way to share this function |
1217 | 1222 | $j(this).data( 'replaceCallback', function( mode ) { |
1218 | | - $j( '#edittoolbar-replace-nomatch, #edittoolbar-replace-success' ).hide(); |
| 1223 | + $j( '#edittoolbar-replace-nomatch, #edittoolbar-replace-success, #edittoolbar-replace-emptysearch, #edittoolbar-replace-invalidregex' ).hide(); |
1219 | 1224 | var searchStr = $j( '#edittoolbar-replace-search' ).val(); |
| 1225 | + if ( searchStr == '' ) { |
| 1226 | + $j( '#edittoolbar-replace-emptysearch' ).show(); |
| 1227 | + return; |
| 1228 | + } |
1220 | 1229 | var replaceStr = $j( '#edittoolbar-replace-replace' ).val(); |
1221 | 1230 | var flags = ''; |
1222 | 1231 | var matchCase = $j( '#edittoolbar-replace-case' ).is( ':checked' ); |
— | — | @@ -1229,20 +1238,38 @@ |
1230 | 1239 | if ( !isRegex ) { |
1231 | 1240 | searchStr = RegExp.escape( searchStr ); |
1232 | 1241 | } |
1233 | | - var regex = new RegExp( searchStr, flags ); |
| 1242 | + try { |
| 1243 | + var regex = new RegExp( searchStr, flags ); |
| 1244 | + } catch( e ) { |
| 1245 | + $j( '#edittoolbar-replace-invalidregex' ) |
| 1246 | + .text( gM( 'edittoolbar-tool-replace-invalidregex', |
| 1247 | + e.message ) ) |
| 1248 | + .show(); |
| 1249 | + return; |
| 1250 | + } |
1234 | 1251 | var $textarea = $j(this).data( 'context' ).$textarea; |
1235 | 1252 | var text = $j.wikiEditor.fixOperaBrokenness( $textarea.val() ); |
1236 | | - var matches = text.match( regex ); |
1237 | | - if ( !matches ) { |
| 1253 | + var matches = false; |
| 1254 | + if ( mode != 'replaceAll' ) |
| 1255 | + matches = text.substr( $j(this).data( 'offset' ) ).match( regex ); |
| 1256 | + if ( !matches ) |
| 1257 | + // Search hit BOTTOM, continuing at TOP |
| 1258 | + matches = text.match( regex ); |
| 1259 | + |
| 1260 | + if ( !matches ) |
1238 | 1261 | $j( '#edittoolbar-replace-nomatch' ).show(); |
1239 | | - } else if ( mode == 'replaceAll' ) { |
| 1262 | + else if ( mode == 'replaceAll' ) { |
1240 | 1263 | // Prepare to select the last match |
1241 | 1264 | var start = text.lastIndexOf( matches[matches.length - 1] ); |
1242 | 1265 | var end = start + replaceStr.length; |
1243 | | - var corr = ( matches.length - 1 ) * ( replaceStr.length - searchStr.length ); |
| 1266 | + |
| 1267 | + // Calculate how much the last match will move |
| 1268 | + var replaced = text.replace( regex, replaceStr ); |
| 1269 | + var corr = replaced.length - text.length - replaceStr.length + matches[matches.length - 1].length; |
1244 | 1270 | $textarea |
1245 | | - .val( $textarea.val().replace( regex, replaceStr ) ) |
| 1271 | + .val( replaced ) |
1246 | 1272 | .change() |
| 1273 | + .focus() |
1247 | 1274 | .setSelection( start + corr, end + corr ) |
1248 | 1275 | .scrollToCaretPosition(); |
1249 | 1276 | |
— | — | @@ -1258,7 +1285,7 @@ |
1259 | 1286 | start = text.indexOf( matches[0] ); |
1260 | 1287 | var end = start + matches[0].length; |
1261 | 1288 | var newEnd = start + replaceStr.length; |
1262 | | - $textarea.setSelection( start, end ); |
| 1289 | + $textarea.focus().setSelection( start, end ); |
1263 | 1290 | if ( mode == 'replace' ) { |
1264 | 1291 | $textarea |
1265 | 1292 | .encapsulateSelection( '', replaceStr, '', false, true ) |
— | — | @@ -1282,25 +1309,42 @@ |
1283 | 1310 | }, |
1284 | 1311 | 'edittoolbar-tool-replace-close': function() { |
1285 | 1312 | $j(this).dialog( 'close' ); |
1286 | | - $j(this).data( 'context' ).$textarea.focus(); |
| 1313 | +<<<<<<< .working |
| 1314 | + $j(this).data( 'context' ).$textarea |
| 1315 | + .unbind( 'keypress.srdialog' ) |
| 1316 | + .focus(); |
| 1317 | +======= |
| 1318 | +>>>>>>> .merge-right.r57707 |
1287 | 1319 | } |
1288 | 1320 | }, |
1289 | 1321 | open: function() { |
1290 | 1322 | $j(this).data( 'offset', 0 ); |
1291 | 1323 | $j( '#edittoolbar-replace-search' ).focus(); |
1292 | | - $j( '#edittoolbar-replace-nomatch, #edittoolbar-replace-success' ).hide(); |
| 1324 | + $j( '#edittoolbar-replace-nomatch, #edittoolbar-replace-success, #edittoolbar-replace-emptysearch, #edittoolbar-replace-invalidregex' ).hide(); |
1293 | 1325 | if ( !( $j(this).data( 'dialogkeypressset' ) ) ) { |
1294 | 1326 | $j(this).data( 'dialogkeypressset', true ); |
1295 | 1327 | // Execute the action associated with the first button |
1296 | 1328 | // when the user presses Enter |
1297 | 1329 | $j(this).closest( '.ui-dialog' ).keypress( function( e ) { |
1298 | 1330 | if ( ( e.keyCode || e.which ) == 13 ) { |
1299 | | - $j(this) |
1300 | | - .find( 'button:first' ) |
1301 | | - .click(); |
| 1331 | + $j(this).find( 'button:first' ).click(); |
| 1332 | + e.preventDefault(); |
1302 | 1333 | } |
1303 | 1334 | }); |
1304 | 1335 | } |
| 1336 | + var dialog = $j(this).closest( '.ui-dialog' ); |
| 1337 | + $j(this).data( 'context' ).$textarea.bind( 'keypress.srdialog', function( e ) { |
| 1338 | + if ( ( e.keyCode || e.which ) == 13 ) { |
| 1339 | + dialog.find( 'button:first' ).click(); |
| 1340 | + e.preventDefault(); |
| 1341 | + } |
| 1342 | + }); |
| 1343 | + }, |
| 1344 | + close: function() { |
| 1345 | + $j(this).data( 'context' ).$textarea |
| 1346 | + .unbind( 'keypress.srdialog' ) |
| 1347 | + .focus(); |
| 1348 | + $j(this).closest( '.ui-dialog' ).data( 'dialogaction', false ); |
1305 | 1349 | } |
1306 | 1350 | } |
1307 | 1351 | } |
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/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.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 |
— | — | @@ -1,781 +0,0 @@ |
2 | | - |
3 | | -(function(){var |
4 | | -window=this,undefined,_jQuery=window.jQuery,_$=window.$,jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context);},quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,isSimple=/^.[^:#\[\.,]*$/;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;this.context=selector;return this;} |
5 | | -if(typeof selector==="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1]) |
6 | | -selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem&&elem.id!=match[3]) |
7 | | -return jQuery().find(selector);var ret=jQuery(elem||[]);ret.context=document;ret.selector=selector;return ret;}}else |
8 | | -return jQuery(context).find(selector);}else if(jQuery.isFunction(selector)) |
9 | | -return jQuery(document).ready(selector);if(selector.selector&&selector.context){this.selector=selector.selector;this.context=selector.context;} |
10 | | -return this.setArray(jQuery.isArray(selector)?selector:jQuery.makeArray(selector));},selector:"",jquery:"1.3.2",size:function(){return this.length;},get:function(num){return num===undefined?Array.prototype.slice.call(this):this[num];},pushStack:function(elems,name,selector){var ret=jQuery(elems);ret.prevObject=this;ret.context=this.context;if(name==="find") |
11 | | -ret.selector=this.selector+(this.selector?" ":"")+selector;else if(name) |
12 | | -ret.selector=this.selector+"."+name+"("+selector+")";return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this);},attr:function(name,value,type){var options=name;if(typeof name==="string") |
13 | | -if(value===undefined) |
14 | | -return this[0]&&jQuery[type||"attr"](this[0],name);else{options={};options[name]=value;} |
15 | | -return this.each(function(i){for(name in options) |
16 | | -jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0) |
17 | | -value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!=="object"&&text!=null) |
18 | | -return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8) |
19 | | -ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0]){var wrap=jQuery(html,this[0].ownerDocument).clone();if(this[0].parentNode) |
20 | | -wrap.insertBefore(this[0]);wrap.map(function(){var elem=this;while(elem.firstChild) |
21 | | -elem=elem.firstChild;return elem;}).append(this);} |
22 | | -return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,function(elem){if(this.nodeType==1) |
23 | | -this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,function(elem){if(this.nodeType==1) |
24 | | -this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},push:[].push,sort:[].sort,splice:[].splice,find:function(selector){if(this.length===1){var ret=this.pushStack([],"find",selector);ret.length=0;jQuery.find(selector,this[0],ret);return ret;}else{return this.pushStack(jQuery.unique(jQuery.map(this,function(elem){return jQuery.find(selector,elem);})),"find",selector);}},clone:function(events){var ret=this.map(function(){if(!jQuery.support.noCloneEvent&&!jQuery.isXMLDoc(this)){var html=this.outerHTML;if(!html){var div=this.ownerDocument.createElement("div");div.appendChild(this.cloneNode(true));html=div.innerHTML;} |
25 | | -return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0];}else |
26 | | -return this.cloneNode(true);});if(events===true){var orig=this.find("*").andSelf(),i=0;ret.find("*").andSelf().each(function(){if(this.nodeName!==orig[i].nodeName) |
27 | | -return;var events=jQuery.data(orig[i],"events");for(var type in events){for(var handler in events[type]){jQuery.event.add(this,type,events[type][handler],events[type][handler].data);}} |
28 | | -i++;});} |
29 | | -return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,jQuery.grep(this,function(elem){return elem.nodeType===1;})),"filter",selector);},closest:function(selector){var pos=jQuery.expr.match.POS.test(selector)?jQuery(selector):null,closer=0;return this.map(function(){var cur=this;while(cur&&cur.ownerDocument){if(pos?pos.index(cur)>-1:jQuery(cur).is(selector)){jQuery.data(cur,"closest",closer);return cur;} |
30 | | -cur=cur.parentNode;closer++;}});},not:function(selector){if(typeof selector==="string") |
31 | | -if(isSimple.test(selector)) |
32 | | -return this.pushStack(jQuery.multiFilter(selector,this,true),"not",selector);else |
33 | | -selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector==="string"?jQuery(selector):jQuery.makeArray(selector))));},is:function(selector){return!!selector&&jQuery.multiFilter(selector,this).length>0;},hasClass:function(selector){return!!selector&&this.is("."+selector);},val:function(value){if(value===undefined){var elem=this[0];if(elem){if(jQuery.nodeName(elem,'option')) |
34 | | -return(elem.attributes.value||{}).specified?elem.value:elem.text;if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0) |
35 | | -return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery(option).val();if(one) |
36 | | -return value;values.push(value);}} |
37 | | -return values;} |
38 | | -return(elem.value||"").replace(/\r/g,"");} |
39 | | -return undefined;} |
40 | | -if(typeof value==="number") |
41 | | -value+='';return this.each(function(){if(this.nodeType!=1) |
42 | | -return;if(jQuery.isArray(value)&&/radio|checkbox/.test(this.type)) |
43 | | -this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length) |
44 | | -this.selectedIndex=-1;}else |
45 | | -this.value=value;});},html:function(value){return value===undefined?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,+i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},domManip:function(args,table,callback){if(this[0]){var fragment=(this[0].ownerDocument||this[0]).createDocumentFragment(),scripts=jQuery.clean(args,(this[0].ownerDocument||this[0]),fragment),first=fragment.firstChild;if(first) |
46 | | -for(var i=0,l=this.length;i<l;i++) |
47 | | -callback.call(root(this[i],first),this.length>1||i>0?fragment.cloneNode(true):fragment);if(scripts) |
48 | | -jQuery.each(scripts,evalScript);} |
49 | | -return this;function root(elem,cur){return table&&jQuery.nodeName(elem,"table")&&jQuery.nodeName(cur,"tr")?(elem.getElementsByTagName("tbody")[0]||elem.appendChild(elem.ownerDocument.createElement("tbody"))):elem;}}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src) |
50 | | -jQuery.ajax({url:elem.src,async:false,dataType:"script"});else |
51 | | -jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode) |
52 | | -elem.parentNode.removeChild(elem);} |
53 | | -function now(){return+new Date;} |
54 | | -jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(typeof target==="boolean"){deep=target;target=arguments[1]||{};i=2;} |
55 | | -if(typeof target!=="object"&&!jQuery.isFunction(target)) |
56 | | -target={};if(length==i){target=this;--i;} |
57 | | -for(;i<length;i++) |
58 | | -if((options=arguments[i])!=null) |
59 | | -for(var name in options){var src=target[name],copy=options[name];if(target===copy) |
60 | | -continue;if(deep&©&&typeof copy==="object"&&!copy.nodeType) |
61 | | -target[name]=jQuery.extend(deep,src||(copy.length!=null?[]:{}),copy);else if(copy!==undefined) |
62 | | -target[name]=copy;} |
63 | | -return target;};var exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{},toString=Object.prototype.toString;jQuery.extend({noConflict:function(deep){window.$=_$;if(deep) |
64 | | -window.jQuery=_jQuery;return jQuery;},isFunction:function(obj){return toString.call(obj)==="[object Function]";},isArray:function(obj){return toString.call(obj)==="[object Array]";},isXMLDoc:function(elem){return elem.nodeType===9&&elem.documentElement.nodeName!=="HTML"||!!elem.ownerDocument&&jQuery.isXMLDoc(elem.ownerDocument);},globalEval:function(data){if(data&&/\S/.test(data)){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.support.scriptEval) |
65 | | -script.appendChild(document.createTextNode(data));else |
66 | | -script.text=data;head.insertBefore(script,head.firstChild);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},each:function(object,callback,args){var name,i=0,length=object.length;if(args){if(length===undefined){for(name in object) |
67 | | -if(callback.apply(object[name],args)===false) |
68 | | -break;}else |
69 | | -for(;i<length;) |
70 | | -if(callback.apply(object[i++],args)===false) |
71 | | -break;}else{if(length===undefined){for(name in object) |
72 | | -if(callback.call(object[name],name,object[name])===false) |
73 | | -break;}else |
74 | | -for(var value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}} |
75 | | -return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value)) |
76 | | -value=value.call(elem,i);return typeof value==="number"&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className)) |
77 | | -elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1) |
78 | | -elem.className=classNames!==undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return elem&&jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];} |
79 | | -callback.call(elem);for(var name in options) |
80 | | -elem.style[name]=old[name];},css:function(elem,name,force,extra){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;if(extra==="border") |
81 | | -return;jQuery.each(which,function(){if(!extra) |
82 | | -val-=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;if(extra==="margin") |
83 | | -val+=parseFloat(jQuery.curCSS(elem,"margin"+this,true))||0;else |
84 | | -val-=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});} |
85 | | -if(elem.offsetWidth!==0) |
86 | | -getWH();else |
87 | | -jQuery.swap(elem,props,getWH);return Math.max(0,Math.round(val));} |
88 | | -return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=elem.style;if(name=="opacity"&&!jQuery.support.opacity){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret;} |
89 | | -if(name.match(/float/i)) |
90 | | -name=styleFloat;if(!force&&style&&style[name]) |
91 | | -ret=style[name];else if(defaultView.getComputedStyle){if(name.match(/float/i)) |
92 | | -name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle) |
93 | | -ret=computedStyle.getPropertyValue(name);if(name=="opacity"&&ret=="") |
94 | | -ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var left=style.left,rsLeft=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;style.left=ret||0;ret=style.pixelLeft+"px";style.left=left;elem.runtimeStyle.left=rsLeft;}} |
95 | | -return ret;},clean:function(elems,context,fragment){context=context||document;if(typeof context.createElement==="undefined") |
96 | | -context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;if(!fragment&&elems.length===1&&typeof elems[0]==="string"){var match=/^<(\w+)\s*\/?>$/.exec(elems[0]);if(match) |
97 | | -return[context.createElement(match[1])];} |
98 | | -var ret=[],scripts=[],div=context.createElement("div");jQuery.each(elems,function(i,elem){if(typeof elem==="number") |
99 | | -elem+='';if(!elem) |
100 | | -return;if(typeof elem==="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=elem.replace(/^\s+/,"").substring(0,10).toLowerCase();var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!jQuery.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--) |
101 | | -div=div.lastChild;if(!jQuery.support.tbody){var hasBody=/<tbody/i.test(elem),tbody=!tags.indexOf("<table")&&!hasBody?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&!hasBody?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j) |
102 | | -if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length) |
103 | | -tbody[j].parentNode.removeChild(tbody[j]);} |
104 | | -if(!jQuery.support.leadingWhitespace&&/^\s/.test(elem)) |
105 | | -div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);elem=jQuery.makeArray(div.childNodes);} |
106 | | -if(elem.nodeType) |
107 | | -ret.push(elem);else |
108 | | -ret=jQuery.merge(ret,elem);});if(fragment){for(var i=0;ret[i];i++){if(jQuery.nodeName(ret[i],"script")&&(!ret[i].type||ret[i].type.toLowerCase()==="text/javascript")){scripts.push(ret[i].parentNode?ret[i].parentNode.removeChild(ret[i]):ret[i]);}else{if(ret[i].nodeType===1) |
109 | | -ret.splice.apply(ret,[i+1,0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))));fragment.appendChild(ret[i]);}} |
110 | | -return scripts;} |
111 | | -return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8) |
112 | | -return undefined;var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&elem.parentNode) |
113 | | -elem.parentNode.selectedIndex;if(name in elem&¬xml&&!special){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode) |
114 | | -throw"type property can't be changed";elem[name]=value;} |
115 | | -if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name)) |
116 | | -return elem.getAttributeNode(name).nodeValue;if(name=="tabIndex"){var attributeNode=elem.getAttributeNode("tabIndex");return attributeNode&&attributeNode.specified?attributeNode.value:elem.nodeName.match(/(button|input|object|select|textarea)/i)?0:elem.nodeName.match(/^(a|area)$/i)&&elem.href?0:undefined;} |
117 | | -return elem[name];} |
118 | | -if(!jQuery.support.style&¬xml&&name=="style") |
119 | | -return jQuery.attr(elem.style,"cssText",value);if(set) |
120 | | -elem.setAttribute(name,""+value);var attr=!jQuery.support.hrefNormalized&¬xml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr;} |
121 | | -if(!jQuery.support.opacity&&name=="opacity"){if(set){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+ |
122 | | -(parseInt(value)+''=="NaN"?"":"alpha(opacity="+value*100+")");} |
123 | | -return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+'':"";} |
124 | | -name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(set) |
125 | | -elem[name]=value;return elem[name];},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||typeof array==="string"||jQuery.isFunction(array)||array.setInterval) |
126 | | -ret[0]=array;else |
127 | | -while(i) |
128 | | -ret[--i]=array[i];} |
129 | | -return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++) |
130 | | -if(array[i]===elem) |
131 | | -return i;return-1;},merge:function(first,second){var i=0,elem,pos=first.length;if(!jQuery.support.getAll){while((elem=second[i++])!=null) |
132 | | -if(elem.nodeType!=8) |
133 | | -first[pos++]=elem;}else |
134 | | -while((elem=second[i++])!=null) |
135 | | -first[pos++]=elem;return first;},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;} |
136 | | -return ret;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++) |
137 | | -if(!inv!=!callback(elems[i],i)) |
138 | | -ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!=null) |
139 | | -ret[ret.length]=value;} |
140 | | -return ret.concat.apply([],ret);}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,'0'])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};jQuery.each({parent:function(elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string") |
141 | | -ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret),name,selector);};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(selector){var ret=[],insert=jQuery(selector);for(var i=0,l=insert.length;i<l;i++){var elems=(i>0?this.clone(true):this).get();jQuery.fn[original].apply(jQuery(insert[i]),elems);ret=ret.concat(elems);} |
142 | | -return this.pushStack(ret,name,selector);};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1) |
143 | | -this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames,state){if(typeof state!=="boolean") |
144 | | -state=!jQuery.className.has(this,classNames);jQuery.className[state?"add":"remove"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).length){jQuery("*",this).add([this]).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode) |
145 | | -this.parentNode.removeChild(this);}},empty:function(){jQuery(this).children().remove();while(this.firstChild) |
146 | | -this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0;} |
147 | | -var expando="jQuery"+now(),uuid=0,windowData={};jQuery.extend({cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id) |
148 | | -id=elem[expando]=++uuid;if(name&&!jQuery.cache[id]) |
149 | | -jQuery.cache[id]={};if(data!==undefined) |
150 | | -jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id]) |
151 | | -break;if(!name) |
152 | | -jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute) |
153 | | -elem.removeAttribute(expando);} |
154 | | -delete jQuery.cache[id];}},queue:function(elem,type,data){if(elem){type=(type||"fx")+"queue";var q=jQuery.data(elem,type);if(!q||jQuery.isArray(data)) |
155 | | -q=jQuery.data(elem,type,jQuery.makeArray(data));else if(data) |
156 | | -q.push(data);} |
157 | | -return q;},dequeue:function(elem,type){var queue=jQuery.queue(elem,type),fn=queue.shift();if(!type||type==="fx") |
158 | | -fn=queue[0];if(fn!==undefined) |
159 | | -fn.call(elem);}});jQuery.fn.extend({data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length) |
160 | | -data=jQuery.data(this[0],key);return data===undefined&&parts[1]?this.data(parts[0]):data;}else |
161 | | -return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},queue:function(type,data){if(typeof type!=="string"){data=type;type="fx";} |
162 | | -if(data===undefined) |
163 | | -return jQuery.queue(this[0],type);return this.each(function(){var queue=jQuery.queue(this,type,data);if(type=="fx"&&queue.length==1) |
164 | | -queue[0].call(this);});},dequeue:function(type){return this.each(function(){jQuery.dequeue(this,type);});}});(function(){var chunker=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,done=0,toString=Object.prototype.toString;var Sizzle=function(selector,context,results,seed){results=results||[];context=context||document;if(context.nodeType!==1&&context.nodeType!==9) |
165 | | -return[];if(!selector||typeof selector!=="string"){return results;} |
166 | | -var parts=[],m,set,checkSet,check,mode,extra,prune=true;chunker.lastIndex=0;while((m=chunker.exec(selector))!==null){parts.push(m[1]);if(m[2]){extra=RegExp.rightContext;break;}} |
167 | | -if(parts.length>1&&origPOS.exec(selector)){if(parts.length===2&&Expr.relative[parts[0]]){set=posProcess(parts[0]+parts[1],context);}else{set=Expr.relative[parts[0]]?[context]:Sizzle(parts.shift(),context);while(parts.length){selector=parts.shift();if(Expr.relative[selector]) |
168 | | -selector+=parts.shift();set=posProcess(selector,set);}}}else{var ret=seed?{expr:parts.pop(),set:makeArray(seed)}:Sizzle.find(parts.pop(),parts.length===1&&context.parentNode?context.parentNode:context,isXML(context));set=Sizzle.filter(ret.expr,ret.set);if(parts.length>0){checkSet=makeArray(set);}else{prune=false;} |
169 | | -while(parts.length){var cur=parts.pop(),pop=cur;if(!Expr.relative[cur]){cur="";}else{pop=parts.pop();} |
170 | | -if(pop==null){pop=context;} |
171 | | -Expr.relative[cur](checkSet,pop,isXML(context));}} |
172 | | -if(!checkSet){checkSet=set;} |
173 | | -if(!checkSet){throw"Syntax error, unrecognized expression: "+(cur||selector);} |
174 | | -if(toString.call(checkSet)==="[object Array]"){if(!prune){results.push.apply(results,checkSet);}else if(context.nodeType===1){for(var i=0;checkSet[i]!=null;i++){if(checkSet[i]&&(checkSet[i]===true||checkSet[i].nodeType===1&&contains(context,checkSet[i]))){results.push(set[i]);}}}else{for(var i=0;checkSet[i]!=null;i++){if(checkSet[i]&&checkSet[i].nodeType===1){results.push(set[i]);}}}}else{makeArray(checkSet,results);} |
175 | | -if(extra){Sizzle(extra,context,results,seed);if(sortOrder){hasDuplicate=false;results.sort(sortOrder);if(hasDuplicate){for(var i=1;i<results.length;i++){if(results[i]===results[i-1]){results.splice(i--,1);}}}}} |
176 | | -return results;};Sizzle.matches=function(expr,set){return Sizzle(expr,null,null,set);};Sizzle.find=function(expr,context,isXML){var set,match;if(!expr){return[];} |
177 | | -for(var i=0,l=Expr.order.length;i<l;i++){var type=Expr.order[i],match;if((match=Expr.match[type].exec(expr))){var left=RegExp.leftContext;if(left.substr(left.length-1)!=="\\"){match[1]=(match[1]||"").replace(/\\/g,"");set=Expr.find[type](match,context,isXML);if(set!=null){expr=expr.replace(Expr.match[type],"");break;}}}} |
178 | | -if(!set){set=context.getElementsByTagName("*");} |
179 | | -return{set:set,expr:expr};};Sizzle.filter=function(expr,set,inplace,not){var old=expr,result=[],curLoop=set,match,anyFound,isXMLFilter=set&&set[0]&&isXML(set[0]);while(expr&&set.length){for(var type in Expr.filter){if((match=Expr.match[type].exec(expr))!=null){var filter=Expr.filter[type],found,item;anyFound=false;if(curLoop==result){result=[];} |
180 | | -if(Expr.preFilter[type]){match=Expr.preFilter[type](match,curLoop,inplace,result,not,isXMLFilter);if(!match){anyFound=found=true;}else if(match===true){continue;}} |
181 | | -if(match){for(var i=0;(item=curLoop[i])!=null;i++){if(item){found=filter(item,match,i,curLoop);var pass=not^!!found;if(inplace&&found!=null){if(pass){anyFound=true;}else{curLoop[i]=false;}}else if(pass){result.push(item);anyFound=true;}}}} |
182 | | -if(found!==undefined){if(!inplace){curLoop=result;} |
183 | | -expr=expr.replace(Expr.match[type],"");if(!anyFound){return[];} |
184 | | -break;}}} |
185 | | -if(expr==old){if(anyFound==null){throw"Syntax error, unrecognized expression: "+expr;}else{break;}} |
186 | | -old=expr;} |
187 | | -return curLoop;};var Expr=Sizzle.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(elem){return elem.getAttribute("href");}},relative:{"+":function(checkSet,part,isXML){var isPartStr=typeof part==="string",isTag=isPartStr&&!/\W/.test(part),isPartStrNotTag=isPartStr&&!isTag;if(isTag&&!isXML){part=part.toUpperCase();} |
188 | | -for(var i=0,l=checkSet.length,elem;i<l;i++){if((elem=checkSet[i])){while((elem=elem.previousSibling)&&elem.nodeType!==1){} |
189 | | -checkSet[i]=isPartStrNotTag||elem&&elem.nodeName===part?elem||false:elem===part;}} |
190 | | -if(isPartStrNotTag){Sizzle.filter(part,checkSet,true);}},">":function(checkSet,part,isXML){var isPartStr=typeof part==="string";if(isPartStr&&!/\W/.test(part)){part=isXML?part:part.toUpperCase();for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){var parent=elem.parentNode;checkSet[i]=parent.nodeName===part?parent:false;}}}else{for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){checkSet[i]=isPartStr?elem.parentNode:elem.parentNode===part;}} |
191 | | -if(isPartStr){Sizzle.filter(part,checkSet,true);}}},"":function(checkSet,part,isXML){var doneName=done++,checkFn=dirCheck;if(!part.match(/\W/)){var nodeCheck=part=isXML?part:part.toUpperCase();checkFn=dirNodeCheck;} |
192 | | -checkFn("parentNode",part,doneName,checkSet,nodeCheck,isXML);},"~":function(checkSet,part,isXML){var doneName=done++,checkFn=dirCheck;if(typeof part==="string"&&!part.match(/\W/)){var nodeCheck=part=isXML?part:part.toUpperCase();checkFn=dirNodeCheck;} |
193 | | -checkFn("previousSibling",part,doneName,checkSet,nodeCheck,isXML);}},find:{ID:function(match,context,isXML){if(typeof context.getElementById!=="undefined"&&!isXML){var m=context.getElementById(match[1]);return m?[m]:[];}},NAME:function(match,context,isXML){if(typeof context.getElementsByName!=="undefined"){var ret=[],results=context.getElementsByName(match[1]);for(var i=0,l=results.length;i<l;i++){if(results[i].getAttribute("name")===match[1]){ret.push(results[i]);}} |
194 | | -return ret.length===0?null:ret;}},TAG:function(match,context){return context.getElementsByTagName(match[1]);}},preFilter:{CLASS:function(match,curLoop,inplace,result,not,isXML){match=" "+match[1].replace(/\\/g,"")+" ";if(isXML){return match;} |
195 | | -for(var i=0,elem;(elem=curLoop[i])!=null;i++){if(elem){if(not^(elem.className&&(" "+elem.className+" ").indexOf(match)>=0)){if(!inplace) |
196 | | -result.push(elem);}else if(inplace){curLoop[i]=false;}}} |
197 | | -return false;},ID:function(match){return match[1].replace(/\\/g,"");},TAG:function(match,curLoop){for(var i=0;curLoop[i]===false;i++){} |
198 | | -return curLoop[i]&&isXML(curLoop[i])?match[1]:match[1].toUpperCase();},CHILD:function(match){if(match[1]=="nth"){var test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(match[2]=="even"&&"2n"||match[2]=="odd"&&"2n+1"||!/\D/.test(match[2])&&"0n+"+match[2]||match[2]);match[2]=(test[1]+(test[2]||1))-0;match[3]=test[3]-0;} |
199 | | -match[0]=done++;return match;},ATTR:function(match,curLoop,inplace,result,not,isXML){var name=match[1].replace(/\\/g,"");if(!isXML&&Expr.attrMap[name]){match[1]=Expr.attrMap[name];} |
200 | | -if(match[2]==="~="){match[4]=" "+match[4]+" ";} |
201 | | -return match;},PSEUDO:function(match,curLoop,inplace,result,not){if(match[1]==="not"){if(match[3].match(chunker).length>1||/^\w/.test(match[3])){match[3]=Sizzle(match[3],null,null,curLoop);}else{var ret=Sizzle.filter(match[3],curLoop,inplace,true^not);if(!inplace){result.push.apply(result,ret);} |
202 | | -return false;}}else if(Expr.match.POS.test(match[0])||Expr.match.CHILD.test(match[0])){return true;} |
203 | | -return match;},POS:function(match){match.unshift(true);return match;}},filters:{enabled:function(elem){return elem.disabled===false&&elem.type!=="hidden";},disabled:function(elem){return elem.disabled===true;},checked:function(elem){return elem.checked===true;},selected:function(elem){elem.parentNode.selectedIndex;return elem.selected===true;},parent:function(elem){return!!elem.firstChild;},empty:function(elem){return!elem.firstChild;},has:function(elem,i,match){return!!Sizzle(match[3],elem).length;},header:function(elem){return/h\d/i.test(elem.nodeName);},text:function(elem){return"text"===elem.type;},radio:function(elem){return"radio"===elem.type;},checkbox:function(elem){return"checkbox"===elem.type;},file:function(elem){return"file"===elem.type;},password:function(elem){return"password"===elem.type;},submit:function(elem){return"submit"===elem.type;},image:function(elem){return"image"===elem.type;},reset:function(elem){return"reset"===elem.type;},button:function(elem){return"button"===elem.type||elem.nodeName.toUpperCase()==="BUTTON";},input:function(elem){return/input|select|textarea|button/i.test(elem.nodeName);}},setFilters:{first:function(elem,i){return i===0;},last:function(elem,i,match,array){return i===array.length-1;},even:function(elem,i){return i%2===0;},odd:function(elem,i){return i%2===1;},lt:function(elem,i,match){return i<match[3]-0;},gt:function(elem,i,match){return i>match[3]-0;},nth:function(elem,i,match){return match[3]-0==i;},eq:function(elem,i,match){return match[3]-0==i;}},filter:{PSEUDO:function(elem,match,i,array){var name=match[1],filter=Expr.filters[name];if(filter){return filter(elem,i,match,array);}else if(name==="contains"){return(elem.textContent||elem.innerText||"").indexOf(match[3])>=0;}else if(name==="not"){var not=match[3];for(var i=0,l=not.length;i<l;i++){if(not[i]===elem){return false;}} |
204 | | -return true;}},CHILD:function(elem,match){var type=match[1],node=elem;switch(type){case'only':case'first':while(node=node.previousSibling){if(node.nodeType===1)return false;} |
205 | | -if(type=='first')return true;node=elem;case'last':while(node=node.nextSibling){if(node.nodeType===1)return false;} |
206 | | -return true;case'nth':var first=match[2],last=match[3];if(first==1&&last==0){return true;} |
207 | | -var doneName=match[0],parent=elem.parentNode;if(parent&&(parent.sizcache!==doneName||!elem.nodeIndex)){var count=0;for(node=parent.firstChild;node;node=node.nextSibling){if(node.nodeType===1){node.nodeIndex=++count;}} |
208 | | -parent.sizcache=doneName;} |
209 | | -var diff=elem.nodeIndex-last;if(first==0){return diff==0;}else{return(diff%first==0&&diff/first>=0);}}},ID:function(elem,match){return elem.nodeType===1&&elem.getAttribute("id")===match;},TAG:function(elem,match){return(match==="*"&&elem.nodeType===1)||elem.nodeName===match;},CLASS:function(elem,match){return(" "+(elem.className||elem.getAttribute("class"))+" ").indexOf(match)>-1;},ATTR:function(elem,match){var name=match[1],result=Expr.attrHandle[name]?Expr.attrHandle[name](elem):elem[name]!=null?elem[name]:elem.getAttribute(name),value=result+"",type=match[2],check=match[4];return result==null?type==="!=":type==="="?value===check:type==="*="?value.indexOf(check)>=0:type==="~="?(" "+value+" ").indexOf(check)>=0:!check?value&&result!==false:type==="!="?value!=check:type==="^="?value.indexOf(check)===0:type==="$="?value.substr(value.length-check.length)===check:type==="|="?value===check||value.substr(0,check.length+1)===check+"-":false;},POS:function(elem,match,i,array){var name=match[2],filter=Expr.setFilters[name];if(filter){return filter(elem,i,match,array);}}}};var origPOS=Expr.match.POS;for(var type in Expr.match){Expr.match[type]=RegExp(Expr.match[type].source+/(?![^\[]*\])(?![^\(]*\))/.source);} |
210 | | -var makeArray=function(array,results){array=Array.prototype.slice.call(array);if(results){results.push.apply(results,array);return results;} |
211 | | -return array;};try{Array.prototype.slice.call(document.documentElement.childNodes);}catch(e){makeArray=function(array,results){var ret=results||[];if(toString.call(array)==="[object Array]"){Array.prototype.push.apply(ret,array);}else{if(typeof array.length==="number"){for(var i=0,l=array.length;i<l;i++){ret.push(array[i]);}}else{for(var i=0;array[i];i++){ret.push(array[i]);}}} |
212 | | -return ret;};} |
213 | | -var sortOrder;if(document.documentElement.compareDocumentPosition){sortOrder=function(a,b){var ret=a.compareDocumentPosition(b)&4?-1:a===b?0:1;if(ret===0){hasDuplicate=true;} |
214 | | -return ret;};}else if("sourceIndex"in document.documentElement){sortOrder=function(a,b){var ret=a.sourceIndex-b.sourceIndex;if(ret===0){hasDuplicate=true;} |
215 | | -return ret;};}else if(document.createRange){sortOrder=function(a,b){var aRange=a.ownerDocument.createRange(),bRange=b.ownerDocument.createRange();aRange.selectNode(a);aRange.collapse(true);bRange.selectNode(b);bRange.collapse(true);var ret=aRange.compareBoundaryPoints(Range.START_TO_END,bRange);if(ret===0){hasDuplicate=true;} |
216 | | -return ret;};} |
217 | | -(function(){var form=document.createElement("form"),id="script"+(new Date).getTime();form.innerHTML="<input name='"+id+"'/>";var root=document.documentElement;root.insertBefore(form,root.firstChild);if(!!document.getElementById(id)){Expr.find.ID=function(match,context,isXML){if(typeof context.getElementById!=="undefined"&&!isXML){var m=context.getElementById(match[1]);return m?m.id===match[1]||typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id").nodeValue===match[1]?[m]:undefined:[];}};Expr.filter.ID=function(elem,match){var node=typeof elem.getAttributeNode!=="undefined"&&elem.getAttributeNode("id");return elem.nodeType===1&&node&&node.nodeValue===match;};} |
218 | | -root.removeChild(form);})();(function(){var div=document.createElement("div");div.appendChild(document.createComment(""));if(div.getElementsByTagName("*").length>0){Expr.find.TAG=function(match,context){var results=context.getElementsByTagName(match[1]);if(match[1]==="*"){var tmp=[];for(var i=0;results[i];i++){if(results[i].nodeType===1){tmp.push(results[i]);}} |
219 | | -results=tmp;} |
220 | | -return results;};} |
221 | | -div.innerHTML="<a href='#'></a>";if(div.firstChild&&typeof div.firstChild.getAttribute!=="undefined"&&div.firstChild.getAttribute("href")!=="#"){Expr.attrHandle.href=function(elem){return elem.getAttribute("href",2);};}})();if(document.querySelectorAll)(function(){var oldSizzle=Sizzle,div=document.createElement("div");div.innerHTML="<p class='TEST'></p>";if(div.querySelectorAll&&div.querySelectorAll(".TEST").length===0){return;} |
222 | | -Sizzle=function(query,context,extra,seed){context=context||document;if(!seed&&context.nodeType===9&&!isXML(context)){try{return makeArray(context.querySelectorAll(query),extra);}catch(e){}} |
223 | | -return oldSizzle(query,context,extra,seed);};Sizzle.find=oldSizzle.find;Sizzle.filter=oldSizzle.filter;Sizzle.selectors=oldSizzle.selectors;Sizzle.matches=oldSizzle.matches;})();if(document.getElementsByClassName&&document.documentElement.getElementsByClassName)(function(){var div=document.createElement("div");div.innerHTML="<div class='test e'></div><div class='test'></div>";if(div.getElementsByClassName("e").length===0) |
224 | | -return;div.lastChild.className="e";if(div.getElementsByClassName("e").length===1) |
225 | | -return;Expr.order.splice(1,0,"CLASS");Expr.find.CLASS=function(match,context,isXML){if(typeof context.getElementsByClassName!=="undefined"&&!isXML){return context.getElementsByClassName(match[1]);}};})();function dirNodeCheck(dir,cur,doneName,checkSet,nodeCheck,isXML){var sibDir=dir=="previousSibling"&&!isXML;for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){if(sibDir&&elem.nodeType===1){elem.sizcache=doneName;elem.sizset=i;} |
226 | | -elem=elem[dir];var match=false;while(elem){if(elem.sizcache===doneName){match=checkSet[elem.sizset];break;} |
227 | | -if(elem.nodeType===1&&!isXML){elem.sizcache=doneName;elem.sizset=i;} |
228 | | -if(elem.nodeName===cur){match=elem;break;} |
229 | | -elem=elem[dir];} |
230 | | -checkSet[i]=match;}}} |
231 | | -function dirCheck(dir,cur,doneName,checkSet,nodeCheck,isXML){var sibDir=dir=="previousSibling"&&!isXML;for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){if(sibDir&&elem.nodeType===1){elem.sizcache=doneName;elem.sizset=i;} |
232 | | -elem=elem[dir];var match=false;while(elem){if(elem.sizcache===doneName){match=checkSet[elem.sizset];break;} |
233 | | -if(elem.nodeType===1){if(!isXML){elem.sizcache=doneName;elem.sizset=i;} |
234 | | -if(typeof cur!=="string"){if(elem===cur){match=true;break;}}else if(Sizzle.filter(cur,[elem]).length>0){match=elem;break;}} |
235 | | -elem=elem[dir];} |
236 | | -checkSet[i]=match;}}} |
237 | | -var contains=document.compareDocumentPosition?function(a,b){return a.compareDocumentPosition(b)&16;}:function(a,b){return a!==b&&(a.contains?a.contains(b):true);};var isXML=function(elem){return elem.nodeType===9&&elem.documentElement.nodeName!=="HTML"||!!elem.ownerDocument&&isXML(elem.ownerDocument);};var posProcess=function(selector,context){var tmpSet=[],later="",match,root=context.nodeType?[context]:context;while((match=Expr.match.PSEUDO.exec(selector))){later+=match[0];selector=selector.replace(Expr.match.PSEUDO,"");} |
238 | | -selector=Expr.relative[selector]?selector+"*":selector;for(var i=0,l=root.length;i<l;i++){Sizzle(selector,root[i],tmpSet);} |
239 | | -return Sizzle.filter(later,tmpSet);};jQuery.find=Sizzle;jQuery.filter=Sizzle.filter;jQuery.expr=Sizzle.selectors;jQuery.expr[":"]=jQuery.expr.filters;Sizzle.selectors.filters.hidden=function(elem){return elem.offsetWidth===0||elem.offsetHeight===0;};Sizzle.selectors.filters.visible=function(elem){return elem.offsetWidth>0||elem.offsetHeight>0;};Sizzle.selectors.filters.animated=function(elem){return jQuery.grep(jQuery.timers,function(fn){return elem===fn.elem;}).length;};jQuery.multiFilter=function(expr,elems,not){if(not){expr=":not("+expr+")";} |
240 | | -return Sizzle.matches(expr,elems);};jQuery.dir=function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1) |
241 | | -matched.push(cur);cur=cur[dir];} |
242 | | -return matched;};jQuery.nth=function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir]) |
243 | | -if(cur.nodeType==1&&++num==result) |
244 | | -break;return cur;};jQuery.sibling=function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem) |
245 | | -r.push(n);} |
246 | | -return r;};return;window.Sizzle=Sizzle;})();jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8) |
247 | | -return;if(elem.setInterval&&elem!=window) |
248 | | -elem=window;if(!handler.guid) |
249 | | -handler.guid=this.guid++;if(data!==undefined){var fn=handler;handler=this.proxy(fn);handler.data=data;} |
250 | | -var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){return typeof jQuery!=="undefined"&&!jQuery.event.triggered?jQuery.event.handle.apply(arguments.callee.elem,arguments):undefined;});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var namespaces=type.split(".");type=namespaces.shift();handler.type=namespaces.slice().sort().join(".");var handlers=events[type];if(jQuery.event.specialAll[type]) |
251 | | -jQuery.event.specialAll[type].setup.call(elem,data,namespaces);if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem,data,namespaces)===false){if(elem.addEventListener) |
252 | | -elem.addEventListener(type,handle,false);else if(elem.attachEvent) |
253 | | -elem.attachEvent("on"+type,handle);}} |
254 | | -handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8) |
255 | | -return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types===undefined||(typeof types==="string"&&types.charAt(0)==".")) |
256 | | -for(var type in events) |
257 | | -this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;} |
258 | | -jQuery.each(types.split(/\s+/),function(index,type){var namespaces=type.split(".");type=namespaces.shift();var namespace=RegExp("(^|\\.)"+namespaces.slice().sort().join(".*\\.")+"(\\.|$)");if(events[type]){if(handler) |
259 | | -delete events[type][handler.guid];else |
260 | | -for(var handle in events[type]) |
261 | | -if(namespace.test(events[type][handle].type)) |
262 | | -delete events[type][handle];if(jQuery.event.specialAll[type]) |
263 | | -jQuery.event.specialAll[type].teardown.call(elem,namespaces);for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem,namespaces)===false){if(elem.removeEventListener) |
264 | | -elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent) |
265 | | -elem.detachEvent("on"+type,jQuery.data(elem,"handle"));} |
266 | | -ret=null;delete events[type];}}});} |
267 | | -for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(event,data,elem,bubbling){var type=event.type||event;if(!bubbling){event=typeof event==="object"?event[expando]?event:jQuery.extend(jQuery.Event(type),event):jQuery.Event(type);if(type.indexOf("!")>=0){event.type=type=type.slice(0,-1);event.exclusive=true;} |
268 | | -if(!elem){event.stopPropagation();if(this.global[type]) |
269 | | -jQuery.each(jQuery.cache,function(){if(this.events&&this.events[type]) |
270 | | -jQuery.event.trigger(event,data,this.handle.elem);});} |
271 | | -if(!elem||elem.nodeType==3||elem.nodeType==8) |
272 | | -return undefined;event.result=undefined;event.target=elem;data=jQuery.makeArray(data);data.unshift(event);} |
273 | | -event.currentTarget=elem;var handle=jQuery.data(elem,"handle");if(handle) |
274 | | -handle.apply(elem,data);if((!elem[type]||(jQuery.nodeName(elem,'a')&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false) |
275 | | -event.result=false;if(!bubbling&&elem[type]&&!event.isDefaultPrevented()&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}} |
276 | | -this.triggered=false;if(!event.isPropagationStopped()){var parent=elem.parentNode||elem.ownerDocument;if(parent) |
277 | | -jQuery.event.trigger(event,data,parent,true);}},handle:function(event){var all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);event.currentTarget=this;var namespaces=event.type.split(".");event.type=namespaces.shift();all=!namespaces.length&&!event.exclusive;var namespace=RegExp("(^|\\.)"+namespaces.slice().sort().join(".*\\.")+"(\\.|$)");handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||namespace.test(handler.type)){event.handler=handler;event.data=handler.data;var ret=handler.apply(this,arguments);if(ret!==undefined){event.result=ret;if(ret===false){event.preventDefault();event.stopPropagation();}} |
278 | | -if(event.isImmediatePropagationStopped()) |
279 | | -break;}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(event){if(event[expando]) |
280 | | -return event;var originalEvent=event;event=jQuery.Event(originalEvent);for(var i=this.props.length,prop;i;){prop=this.props[--i];event[prop]=originalEvent[prop];} |
281 | | -if(!event.target) |
282 | | -event.target=event.srcElement||document;if(event.target.nodeType==3) |
283 | | -event.target=event.target.parentNode;if(!event.relatedTarget&&event.fromElement) |
284 | | -event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);} |
285 | | -if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode)) |
286 | | -event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey) |
287 | | -event.metaKey=event.ctrlKey;if(!event.which&&event.button) |
288 | | -event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},proxy:function(fn,proxy){proxy=proxy||function(){return fn.apply(this,arguments);};proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy;},special:{ready:{setup:bindReady,teardown:function(){}}},specialAll:{live:{setup:function(selector,namespaces){jQuery.event.add(this,namespaces[0],liveHandler);},teardown:function(namespaces){if(namespaces.length){var remove=0,name=RegExp("(^|\\.)"+namespaces[0]+"(\\.|$)");jQuery.each((jQuery.data(this,"events").live||{}),function(){if(name.test(this.type)) |
289 | | -remove++;});if(remove<1) |
290 | | -jQuery.event.remove(this,namespaces[0],liveHandler);}}}}};jQuery.Event=function(src){if(!this.preventDefault) |
291 | | -return new jQuery.Event(src);if(src&&src.type){this.originalEvent=src;this.type=src.type;}else |
292 | | -this.type=src;this.timeStamp=now();this[expando]=true;};function returnFalse(){return false;} |
293 | | -function returnTrue(){return true;} |
294 | | -jQuery.Event.prototype={preventDefault:function(){this.isDefaultPrevented=returnTrue;var e=this.originalEvent;if(!e) |
295 | | -return;if(e.preventDefault) |
296 | | -e.preventDefault();e.returnValue=false;},stopPropagation:function(){this.isPropagationStopped=returnTrue;var e=this.originalEvent;if(!e) |
297 | | -return;if(e.stopPropagation) |
298 | | -e.stopPropagation();e.cancelBubble=true;},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=returnTrue;this.stopPropagation();},isDefaultPrevented:returnFalse,isPropagationStopped:returnFalse,isImmediatePropagationStopped:returnFalse};var withinElement=function(event){var parent=event.relatedTarget;while(parent&&parent!=this) |
299 | | -try{parent=parent.parentNode;} |
300 | | -catch(e){parent=this;} |
301 | | -if(parent!=this){event.type=event.data;jQuery.event.handle.apply(this,arguments);}};jQuery.each({mouseover:'mouseenter',mouseout:'mouseleave'},function(orig,fix){jQuery.event.special[fix]={setup:function(){jQuery.event.add(this,orig,withinElement,fix);},teardown:function(){jQuery.event.remove(this,orig,withinElement);}};});jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);return(fn||data).apply(this,arguments);});return this.each(function(){jQuery.event.add(this,type,one,fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data){return this.each(function(){jQuery.event.trigger(type,data,this);});},triggerHandler:function(type,data){if(this[0]){var event=jQuery.Event(type);event.preventDefault();event.stopPropagation();jQuery.event.trigger(event,data,this[0]);return event.result;}},toggle:function(fn){var args=arguments,i=1;while(i<args.length) |
302 | | -jQuery.event.proxy(fn,args[i++]);return this.click(jQuery.event.proxy(fn,function(event){this.lastToggle=(this.lastToggle||0)%i;event.preventDefault();return args[this.lastToggle++].apply(this,arguments)||false;}));},hover:function(fnOver,fnOut){return this.mouseenter(fnOver).mouseleave(fnOut);},ready:function(fn){bindReady();if(jQuery.isReady) |
303 | | -fn.call(document,jQuery);else |
304 | | -jQuery.readyList.push(fn);return this;},live:function(type,fn){var proxy=jQuery.event.proxy(fn);proxy.guid+=this.selector+type;jQuery(document).bind(liveConvert(type,this.selector),this.selector,proxy);return this;},die:function(type,fn){jQuery(document).unbind(liveConvert(type,this.selector),fn?{guid:fn.guid+this.selector+type}:null);return this;}});function liveHandler(event){var check=RegExp("(^|\\.)"+event.type+"(\\.|$)"),stop=true,elems=[];jQuery.each(jQuery.data(this,"events").live||[],function(i,fn){if(check.test(fn.type)){var elem=jQuery(event.target).closest(fn.data)[0];if(elem) |
305 | | -elems.push({elem:elem,fn:fn});}});elems.sort(function(a,b){return jQuery.data(a.elem,"closest")-jQuery.data(b.elem,"closest");});jQuery.each(elems,function(){if(this.fn.call(this.elem,event,this.fn.data)===false) |
306 | | -return(stop=false);});return stop;} |
307 | | -function liveConvert(type,selector){return["live",type,selector.replace(/\./g,"`").replace(/ /g,"|")].join(".");} |
308 | | -jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.call(document,jQuery);});jQuery.readyList=null;} |
309 | | -jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);jQuery.ready();},false);}else if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);jQuery.ready();}});if(document.documentElement.doScroll&&window==window.top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;} |
310 | | -jQuery.ready();})();} |
311 | | -jQuery.event.add(window,"load",jQuery.ready);} |
312 | | -jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,"+"change,select,submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});jQuery(window).bind('unload',function(){for(var id in jQuery.cache) |
313 | | -if(id!=1&&jQuery.cache[id].handle) |
314 | | -jQuery.event.remove(jQuery.cache[id].handle.elem);});(function(){jQuery.support={};var root=document.documentElement,script=document.createElement("script"),div=document.createElement("div"),id="script"+(new Date).getTime();div.style.display="none";div.innerHTML=' <link/><table></table><a href="https://www.mediawiki.org/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var all=div.getElementsByTagName("*"),a=div.getElementsByTagName("a")[0];if(!all||!all.length||!a){return;} |
315 | | -jQuery.support={leadingWhitespace:div.firstChild.nodeType==3,tbody:!div.getElementsByTagName("tbody").length,objectAll:!!div.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!div.getElementsByTagName("link").length,style:/red/.test(a.getAttribute("style")),hrefNormalized:a.getAttribute("href")==="/a",opacity:a.style.opacity==="0.5",cssFloat:!!a.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};script.type="text/javascript";try{script.appendChild(document.createTextNode("window."+id+"=1;"));}catch(e){} |
316 | | -root.insertBefore(script,root.firstChild);if(window[id]){jQuery.support.scriptEval=true;delete window[id];} |
317 | | -root.removeChild(script);if(div.attachEvent&&div.fireEvent){div.attachEvent("onclick",function(){jQuery.support.noCloneEvent=false;div.detachEvent("onclick",arguments.callee);});div.cloneNode(true).fireEvent("onclick");} |
318 | | -jQuery(function(){var div=document.createElement("div");div.style.width=div.style.paddingLeft="1px";document.body.appendChild(div);jQuery.boxModel=jQuery.support.boxModel=div.offsetWidth===2;document.body.removeChild(div).style.display='none';});})();var styleFloat=jQuery.support.cssFloat?"cssFloat":"styleFloat";jQuery.props={"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};jQuery.fn.extend({_load:jQuery.fn.load,load:function(url,params,callback){if(typeof url!=="string") |
319 | | -return this._load(url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);} |
320 | | -var type="GET";if(params) |
321 | | -if(jQuery.isFunction(params)){callback=params;params=null;}else if(typeof params==="object"){params=jQuery.param(params);type="POST";} |
322 | | -var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified") |
323 | | -self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);if(callback) |
324 | | -self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return this.elements?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:jQuery.isArray(val)?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;} |
325 | | -return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};} |
326 | | -return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!=="string") |
327 | | -s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre)) |
328 | | -s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre)) |
329 | | -s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";} |
330 | | -if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data) |
331 | | -s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){} |
332 | | -if(head) |
333 | | -head.removeChild(script);};} |
334 | | -if(s.dataType=="script"&&s.cache==null) |
335 | | -s.cache=false;if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");} |
336 | | -if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;} |
337 | | -if(s.global&&!jQuery.active++) |
338 | | -jQuery.event.trigger("ajaxStart");var parts=/^(\w+:)?\/\/([^\/?#]+)/.exec(s.url);if(s.dataType=="script"&&type=="GET"&&parts&&(parts[1]&&parts[1]!=location.protocol||parts[2]!=location.host)){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset) |
339 | | -script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();script.onload=script.onreadystatechange=null;head.removeChild(script);}};} |
340 | | -head.appendChild(script);return undefined;} |
341 | | -var requestDone=false;var xhr=s.xhr();if(s.username) |
342 | | -xhr.open(type,s.url,s.async,s.username,s.password);else |
343 | | -xhr.open(type,s.url,s.async);try{if(s.data) |
344 | | -xhr.setRequestHeader("Content-Type",s.contentType);if(s.ifModified) |
345 | | -xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){} |
346 | | -if(s.beforeSend&&s.beforeSend(xhr,s)===false){if(s.global&&!--jQuery.active) |
347 | | -jQuery.event.trigger("ajaxStop");xhr.abort();return false;} |
348 | | -if(s.global) |
349 | | -jQuery.event.trigger("ajaxSend",[xhr,s]);var onreadystatechange=function(isTimeout){if(xhr.readyState==0){if(ival){clearInterval(ival);ival=null;if(s.global&&!--jQuery.active) |
350 | | -jQuery.event.trigger("ajaxStop");}}else if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;} |
351 | | -status=isTimeout=="timeout"?"timeout":!jQuery.httpSuccess(xhr)?"error":s.ifModified&&jQuery.httpNotModified(xhr,s.url)?"notmodified":"success";if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s);}catch(e){status="parsererror";}} |
352 | | -if(status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified");}catch(e){} |
353 | | -if(s.ifModified&&modRes) |
354 | | -jQuery.lastModified[s.url]=modRes;if(!jsonp) |
355 | | -success();}else |
356 | | -jQuery.handleError(s,xhr,status);complete();if(isTimeout) |
357 | | -xhr.abort();if(s.async) |
358 | | -xhr=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0) |
359 | | -setTimeout(function(){if(xhr&&!requestDone) |
360 | | -onreadystatechange("timeout");},s.timeout);} |
361 | | -try{xhr.send(s.data);}catch(e){jQuery.handleError(s,xhr,null,e);} |
362 | | -if(!s.async) |
363 | | -onreadystatechange();function success(){if(s.success) |
364 | | -s.success(data,status);if(s.global) |
365 | | -jQuery.event.trigger("ajaxSuccess",[xhr,s]);} |
366 | | -function complete(){if(s.complete) |
367 | | -s.complete(xhr,status);if(s.global) |
368 | | -jQuery.event.trigger("ajaxComplete",[xhr,s]);if(s.global&&!--jQuery.active) |
369 | | -jQuery.event.trigger("ajaxStop");} |
370 | | -return xhr;},handleError:function(s,xhr,status,e){if(s.error)s.error(xhr,status,e);if(s.global) |
371 | | -jQuery.event.trigger("ajaxError",[xhr,s,e]);},active:0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223;}catch(e){} |
372 | | -return false;},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url];}catch(e){} |
373 | | -return false;},httpData:function(xhr,type,s){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.tagName=="parsererror") |
374 | | -throw"parsererror";if(s&&s.dataFilter) |
375 | | -data=s.dataFilter(data,type);if(typeof data==="string"){if(type=="script") |
376 | | -jQuery.globalEval(data);if(type=="json") |
377 | | -data=window["eval"]("("+data+")");} |
378 | | -return data;},param:function(a){var s=[];function add(key,value){s[s.length]=encodeURIComponent(key)+'='+encodeURIComponent(value);};if(jQuery.isArray(a)||a.jquery) |
379 | | -jQuery.each(a,function(){add(this.name,this.value);});else |
380 | | -for(var j in a) |
381 | | -if(jQuery.isArray(a[j])) |
382 | | -jQuery.each(a[j],function(){add(j,this);});else |
383 | | -add(j,jQuery.isFunction(a[j])?a[j]():a[j]);return s.join("&").replace(/%20/g,"+");}});var elemdisplay={},timerId,fxAttrs=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function genFx(type,num){var obj={};jQuery.each(fxAttrs.concat.apply([],fxAttrs.slice(0,num)),function(){obj[this]=type;});return obj;} |
384 | | -jQuery.fn.extend({show:function(speed,callback){if(speed){return this.animate(genFx("show",3),speed,callback);}else{for(var i=0,l=this.length;i<l;i++){var old=jQuery.data(this[i],"olddisplay");this[i].style.display=old||"";if(jQuery.css(this[i],"display")==="none"){var tagName=this[i].tagName,display;if(elemdisplay[tagName]){display=elemdisplay[tagName];}else{var elem=jQuery("<"+tagName+" />").appendTo("body");display=elem.css("display");if(display==="none") |
385 | | -display="block";elem.remove();elemdisplay[tagName]=display;} |
386 | | -jQuery.data(this[i],"olddisplay",display);}} |
387 | | -for(var i=0,l=this.length;i<l;i++){this[i].style.display=jQuery.data(this[i],"olddisplay")||"";} |
388 | | -return this;}},hide:function(speed,callback){if(speed){return this.animate(genFx("hide",3),speed,callback);}else{for(var i=0,l=this.length;i<l;i++){var old=jQuery.data(this[i],"olddisplay");if(!old&&old!=="none") |
389 | | -jQuery.data(this[i],"olddisplay",jQuery.css(this[i],"display"));} |
390 | | -for(var i=0,l=this.length;i<l;i++){this[i].style.display="none";} |
391 | | -return this;}},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){var bool=typeof fn==="boolean";return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn==null||bool?this.each(function(){var state=bool?fn:jQuery(this).is(":hidden");jQuery(this)[state?"show":"hide"]();}):this.animate(genFx("toggle",3),fn,fn2);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){var opt=jQuery.extend({},optall),p,hidden=this.nodeType==1&&jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden) |
392 | | -return opt.complete.call(this);if((p=="height"||p=="width")&&this.style){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}} |
393 | | -if(opt.overflow!=null) |
394 | | -this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val)) |
395 | | -e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;} |
396 | | -if(parts[1]) |
397 | | -end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else |
398 | | -e.custom(start,val,"");}});return true;});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue) |
399 | | -this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--) |
400 | | -if(timers[i].elem==this){if(gotoEnd) |
401 | | -timers[i](true);timers.splice(i,1);}});if(!gotoEnd) |
402 | | -this.dequeue();return this;}});jQuery.each({slideDown:genFx("show",1),slideUp:genFx("hide",1),slideToggle:genFx("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(name,props){jQuery.fn[name]=function(speed,callback){return this.animate(props,speed,callback);};});jQuery.extend({speed:function(speed,easing,fn){var opt=typeof speed==="object"?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&!jQuery.isFunction(easing)&&easing};opt.duration=jQuery.fx.off?0:typeof opt.duration==="number"?opt.duration:jQuery.fx.speeds[opt.duration]||jQuery.fx.speeds._default;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false) |
403 | | -jQuery(this).dequeue();if(jQuery.isFunction(opt.old)) |
404 | | -opt.old.call(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig) |
405 | | -options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step) |
406 | | -this.options.step.call(this.elem,this.now,this);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style) |
407 | | -this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)) |
408 | | -return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;var self=this;function t(gotoEnd){return self.step(gotoEnd);} |
409 | | -t.elem=this.elem;if(t()&&jQuery.timers.push(t)&&!timerId){timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++) |
410 | | -if(!timers[i]()) |
411 | | -timers.splice(i--,1);if(!timers.length){clearInterval(timerId);timerId=undefined;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=now();if(gotoEnd||t>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim) |
412 | | -if(this.options.curAnim[i]!==true) |
413 | | -done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none") |
414 | | -this.elem.style.display="block";} |
415 | | -if(this.options.hide) |
416 | | -jQuery(this.elem).hide();if(this.options.hide||this.options.show) |
417 | | -for(var p in this.options.curAnim) |
418 | | -jQuery.attr(this.elem.style,p,this.options.orig[p]);this.options.complete.call(this.elem);} |
419 | | -return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();} |
420 | | -return true;}};jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){if(fx.elem.style&&fx.elem.style[fx.prop]!=null) |
421 | | -fx.elem.style[fx.prop]=fx.now+fx.unit;else |
422 | | -fx.elem[fx.prop]=fx.now;}}});if(document.documentElement["getBoundingClientRect"]) |
423 | | -jQuery.fn.offset=function(){if(!this[0])return{top:0,left:0};if(this[0]===this[0].ownerDocument.body)return jQuery.offset.bodyOffset(this[0]);var box=this[0].getBoundingClientRect(),doc=this[0].ownerDocument,body=doc.body,docElem=doc.documentElement,clientTop=docElem.clientTop||body.clientTop||0,clientLeft=docElem.clientLeft||body.clientLeft||0,top=box.top+(self.pageYOffset||jQuery.boxModel&&docElem.scrollTop||body.scrollTop)-clientTop,left=box.left+(self.pageXOffset||jQuery.boxModel&&docElem.scrollLeft||body.scrollLeft)-clientLeft;return{top:top,left:left};};else |
424 | | -jQuery.fn.offset=function(){if(!this[0])return{top:0,left:0};if(this[0]===this[0].ownerDocument.body)return jQuery.offset.bodyOffset(this[0]);jQuery.offset.initialized||jQuery.offset.initialize();var elem=this[0],offsetParent=elem.offsetParent,prevOffsetParent=elem,doc=elem.ownerDocument,computedStyle,docElem=doc.documentElement,body=doc.body,defaultView=doc.defaultView,prevComputedStyle=defaultView.getComputedStyle(elem,null),top=elem.offsetTop,left=elem.offsetLeft;while((elem=elem.parentNode)&&elem!==body&&elem!==docElem){computedStyle=defaultView.getComputedStyle(elem,null);top-=elem.scrollTop,left-=elem.scrollLeft;if(elem===offsetParent){top+=elem.offsetTop,left+=elem.offsetLeft;if(jQuery.offset.doesNotAddBorder&&!(jQuery.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(elem.tagName))) |
425 | | -top+=parseInt(computedStyle.borderTopWidth,10)||0,left+=parseInt(computedStyle.borderLeftWidth,10)||0;prevOffsetParent=offsetParent,offsetParent=elem.offsetParent;} |
426 | | -if(jQuery.offset.subtractsBorderForOverflowNotVisible&&computedStyle.overflow!=="visible") |
427 | | -top+=parseInt(computedStyle.borderTopWidth,10)||0,left+=parseInt(computedStyle.borderLeftWidth,10)||0;prevComputedStyle=computedStyle;} |
428 | | -if(prevComputedStyle.position==="relative"||prevComputedStyle.position==="static") |
429 | | -top+=body.offsetTop,left+=body.offsetLeft;if(prevComputedStyle.position==="fixed") |
430 | | -top+=Math.max(docElem.scrollTop,body.scrollTop),left+=Math.max(docElem.scrollLeft,body.scrollLeft);return{top:top,left:left};};jQuery.offset={initialize:function(){if(this.initialized)return;var body=document.body,container=document.createElement('div'),innerDiv,checkDiv,table,td,rules,prop,bodyMarginTop=body.style.marginTop,html='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';rules={position:'absolute',top:0,left:0,margin:0,border:0,width:'1px',height:'1px',visibility:'hidden'};for(prop in rules)container.style[prop]=rules[prop];container.innerHTML=html;body.insertBefore(container,body.firstChild);innerDiv=container.firstChild,checkDiv=innerDiv.firstChild,td=innerDiv.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(checkDiv.offsetTop!==5);this.doesAddBorderForTableAndCells=(td.offsetTop===5);innerDiv.style.overflow='hidden',innerDiv.style.position='relative';this.subtractsBorderForOverflowNotVisible=(checkDiv.offsetTop===-5);body.style.marginTop='1px';this.doesNotIncludeMarginInBodyOffset=(body.offsetTop===0);body.style.marginTop=bodyMarginTop;body.removeChild(container);this.initialized=true;},bodyOffset:function(body){jQuery.offset.initialized||jQuery.offset.initialize();var top=body.offsetTop,left=body.offsetLeft;if(jQuery.offset.doesNotIncludeMarginInBodyOffset) |
431 | | -top+=parseInt(jQuery.curCSS(body,'marginTop',true),10)||0,left+=parseInt(jQuery.curCSS(body,'marginLeft',true),10)||0;return{top:top,left:left};}};jQuery.fn.extend({position:function(){var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,'marginTop');offset.left-=num(this,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};} |
432 | | -return results;},offsetParent:function(){var offsetParent=this[0].offsetParent||document.body;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,'position')=='static')) |
433 | | -offsetParent=offsetParent.offsetParent;return jQuery(offsetParent);}});jQuery.each(['Left','Top'],function(i,name){var method='scroll'+name;jQuery.fn[method]=function(val){if(!this[0])return null;return val!==undefined?this.each(function(){this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val;}):this[0]==window||this[0]==document?self[i?'pageYOffset':'pageXOffset']||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method];};});jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":"Bottom",lower=name.toLowerCase();jQuery.fn["inner"+name]=function(){return this[0]?jQuery.css(this[0],lower,false,"padding"):null;};jQuery.fn["outer"+name]=function(margin){return this[0]?jQuery.css(this[0],lower,false,margin?"margin":"border"):null;};var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(document.documentElement["client"+name],document.body["scroll"+name],document.documentElement["scroll"+name],document.body["offset"+name],document.documentElement["offset"+name]):size===undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,typeof size==="string"?size:size+"px");};});})();;jQuery.ui||(function($){var _remove=$.fn.remove,isFF2=$.browser.mozilla&&(parseFloat($.browser.version)<1.9);$.ui={version:"1.7.2",plugin:{add:function(module,option,set){var proto=$.ui[module].prototype;for(var i in set){proto.plugins[i]=proto.plugins[i]||[];proto.plugins[i].push([option,set[i]]);}},call:function(instance,name,args){var set=instance.plugins[name];if(!set||!instance.element[0].parentNode){return;} |
434 | | -for(var i=0;i<set.length;i++){if(instance.options[set[i][0]]){set[i][1].apply(instance.element,args);}}}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b);},hasScroll:function(el,a){if($(el).css('overflow')=='hidden'){return false;} |
435 | | -var scroll=(a&&a=='left')?'scrollLeft':'scrollTop',has=false;if(el[scroll]>0){return true;} |
436 | | -el[scroll]=1;has=(el[scroll]>0);el[scroll]=0;return has;},isOverAxis:function(x,reference,size){return(x>reference)&&(x<(reference+size));},isOver:function(y,x,top,left,height,width){return $.ui.isOverAxis(y,top,height)&&$.ui.isOverAxis(x,left,width);},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(isFF2){var attr=$.attr,removeAttr=$.fn.removeAttr,ariaNS="http://www.w3.org/2005/07/aaa",ariaState=/^aria-/,ariaRole=/^wairole:/;$.attr=function(elem,name,value){var set=value!==undefined;return(name=='role'?(set?attr.call(this,elem,name,"wairole:"+value):(attr.apply(this,arguments)||"").replace(ariaRole,"")):(ariaState.test(name)?(set?elem.setAttributeNS(ariaNS,name.replace(ariaState,"aaa:"),value):attr.call(this,elem,name.replace(ariaState,"aaa:"))):attr.apply(this,arguments)));};$.fn.removeAttr=function(name){return(ariaState.test(name)?this.each(function(){this.removeAttributeNS(ariaNS,name.replace(ariaState,""));}):removeAttr.call(this,name));};} |
437 | | -$.fn.extend({remove:function(){$("*",this).add(this).each(function(){$(this).triggerHandler("remove");});return _remove.apply(this,arguments);},enableSelection:function(){return this.attr('unselectable','off').css('MozUserSelect','').unbind('selectstart.ui');},disableSelection:function(){return this.attr('unselectable','on').css('MozUserSelect','none').bind('selectstart.ui',function(){return false;});},scrollParent:function(){var scrollParent;if(($.browser.msie&&(/(static|relative)/).test(this.css('position')))||(/absolute/).test(this.css('position'))){scrollParent=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test($.curCSS(this,'position',1))&&(/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));}).eq(0);}else{scrollParent=this.parents().filter(function(){return(/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));}).eq(0);} |
438 | | -return(/fixed/).test(this.css('position'))||!scrollParent.length?$(document):scrollParent;}});$.extend($.expr[':'],{data:function(elem,i,match){return!!$.data(elem,match[3]);},focusable:function(element){var nodeName=element.nodeName.toLowerCase(),tabIndex=$.attr(element,'tabindex');return(/input|select|textarea|button|object/.test(nodeName)?!element.disabled:'a'==nodeName||'area'==nodeName?element.href||!isNaN(tabIndex):!isNaN(tabIndex))&&!$(element)['area'==nodeName?'parents':'closest'](':hidden').length;},tabbable:function(element){var tabIndex=$.attr(element,'tabindex');return(isNaN(tabIndex)||tabIndex>=0)&&$(element).is(':focusable');}});function getter(namespace,plugin,method,args){function getMethods(type){var methods=$[namespace][plugin][type]||[];return(typeof methods=='string'?methods.split(/,?\s+/):methods);} |
439 | | -var methods=getMethods('getter');if(args.length==1&&typeof args[0]=='string'){methods=methods.concat(getMethods('getterSetter'));} |
440 | | -return($.inArray(method,methods)!=-1);} |
441 | | -$.widget=function(name,prototype){var namespace=name.split(".")[0];name=name.split(".")[1];$.fn[name]=function(options){var isMethodCall=(typeof options=='string'),args=Array.prototype.slice.call(arguments,1);if(isMethodCall&&options.substring(0,1)=='_'){return this;} |
442 | | -if(isMethodCall&&getter(namespace,name,options,args)){var instance=$.data(this[0],name);return(instance?instance[options].apply(instance,args):undefined);} |
443 | | -return this.each(function(){var instance=$.data(this,name);(!instance&&!isMethodCall&&$.data(this,name,new $[namespace][name](this,options))._init());(instance&&isMethodCall&&$.isFunction(instance[options])&&instance[options].apply(instance,args));});};$[namespace]=$[namespace]||{};$[namespace][name]=function(element,options){var self=this;this.namespace=namespace;this.widgetName=name;this.widgetEventPrefix=$[namespace][name].eventPrefix||name;this.widgetBaseClass=namespace+'-'+name;this.options=$.extend({},$.widget.defaults,$[namespace][name].defaults,$.metadata&&$.metadata.get(element)[name],options);this.element=$(element).bind('setData.'+name,function(event,key,value){if(event.target==element){return self._setData(key,value);}}).bind('getData.'+name,function(event,key){if(event.target==element){return self._getData(key);}}).bind('remove',function(){return self.destroy();});};$[namespace][name].prototype=$.extend({},$.widget.prototype,prototype);$[namespace][name].getterSetter='option';};$.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+'-disabled'+' '+this.namespace+'-state-disabled').removeAttr('aria-disabled');},option:function(key,value){var options=key,self=this;if(typeof key=="string"){if(value===undefined){return this._getData(key);} |
444 | | -options={};options[key]=value;} |
445 | | -$.each(options,function(key,value){self._setData(key,value);});},_getData:function(key){return this.options[key];},_setData:function(key,value){this.options[key]=value;if(key=='disabled'){this.element |
446 | | -[value?'addClass':'removeClass'](this.widgetBaseClass+'-disabled'+' '+ |
447 | | -this.namespace+'-state-disabled').attr("aria-disabled",value);}},enable:function(){this._setData('disabled',false);},disable:function(){this._setData('disabled',true);},_trigger:function(type,event,data){var callback=this.options[type],eventName=(type==this.widgetEventPrefix?type:this.widgetEventPrefix+type);event=$.Event(event);event.type=eventName;if(event.originalEvent){for(var i=$.event.props.length,prop;i;){prop=$.event.props[--i];event[prop]=event.originalEvent[prop];}} |
448 | | -this.element.trigger(event,data);return!($.isFunction(callback)&&callback.call(this.element[0],event,data)===false||event.isDefaultPrevented());}};$.widget.defaults={disabled:false};$.ui.mouse={_mouseInit:function(){var self=this;this.element.bind('mousedown.'+this.widgetName,function(event){return self._mouseDown(event);}).bind('click.'+this.widgetName,function(event){if(self._preventClickEvent){self._preventClickEvent=false;event.stopImmediatePropagation();return false;}});if($.browser.msie){this._mouseUnselectable=this.element.attr('unselectable');this.element.attr('unselectable','on');} |
449 | | -this.started=false;},_mouseDestroy:function(){this.element.unbind('.'+this.widgetName);($.browser.msie&&this.element.attr('unselectable',this._mouseUnselectable));},_mouseDown:function(event){event.originalEvent=event.originalEvent||{};if(event.originalEvent.mouseHandled){return;} |
450 | | -(this._mouseStarted&&this._mouseUp(event));this._mouseDownEvent=event;var self=this,btnIsLeft=(event.which==1),elIsCancel=(typeof this.options.cancel=="string"?$(event.target).parents().add(event.target).filter(this.options.cancel).length:false);if(!btnIsLeft||elIsCancel||!this._mouseCapture(event)){return true;} |
451 | | -this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){self.mouseDelayMet=true;},this.options.delay);} |
452 | | -if(this._mouseDistanceMet(event)&&this._mouseDelayMet(event)){this._mouseStarted=(this._mouseStart(event)!==false);if(!this._mouseStarted){event.preventDefault();return true;}} |
453 | | -this._mouseMoveDelegate=function(event){return self._mouseMove(event);};this._mouseUpDelegate=function(event){return self._mouseUp(event);};$(document).bind('mousemove.'+this.widgetName,this._mouseMoveDelegate).bind('mouseup.'+this.widgetName,this._mouseUpDelegate);($.browser.safari||event.preventDefault());event.originalEvent.mouseHandled=true;return true;},_mouseMove:function(event){if($.browser.msie&&!event.button){return this._mouseUp(event);} |
454 | | -if(this._mouseStarted){this._mouseDrag(event);return event.preventDefault();} |
455 | | -if(this._mouseDistanceMet(event)&&this._mouseDelayMet(event)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,event)!==false);(this._mouseStarted?this._mouseDrag(event):this._mouseUp(event));} |
456 | | -return!this._mouseStarted;},_mouseUp:function(event){$(document).unbind('mousemove.'+this.widgetName,this._mouseMoveDelegate).unbind('mouseup.'+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(event.target==this._mouseDownEvent.target);this._mouseStop(event);} |
457 | | -return false;},_mouseDistanceMet:function(event){return(Math.max(Math.abs(this._mouseDownEvent.pageX-event.pageX),Math.abs(this._mouseDownEvent.pageY-event.pageY))>=this.options.distance);},_mouseDelayMet:function(event){return this.mouseDelayMet;},_mouseStart:function(event){},_mouseDrag:function(event){},_mouseStop:function(event){},_mouseCapture:function(event){return true;}};$.ui.mouse.defaults={cancel:null,distance:1,delay:0};})(jQuery);(function($){$.widget("ui.draggable",$.extend({},$.ui.mouse,{_init:function(){if(this.options.helper=='original'&&!(/^(?:r|a|f)/).test(this.element.css("position"))) |
458 | | -this.element[0].style.position='relative';(this.options.addClasses&&this.element.addClass("ui-draggable"));(this.options.disabled&&this.element.addClass("ui-draggable-disabled"));this._mouseInit();},destroy:function(){if(!this.element.data('draggable'))return;this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable" |
459 | | -+" ui-draggable-dragging" |
460 | | -+" ui-draggable-disabled");this._mouseDestroy();},_mouseCapture:function(event){var o=this.options;if(this.helper||o.disabled||$(event.target).is('.ui-resizable-handle')) |
461 | | -return false;this.handle=this._getHandle(event);if(!this.handle) |
462 | | -return false;return true;},_mouseStart:function(event){var o=this.options;this.helper=this._createHelper(event);this._cacheHelperProportions();if($.ui.ddmanager) |
463 | | -$.ui.ddmanager.current=this;this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};$.extend(this.offset,{click:{left:event.pageX-this.offset.left,top:event.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(event);this.originalPageX=event.pageX;this.originalPageY=event.pageY;if(o.cursorAt) |
464 | | -this._adjustOffsetFromHelper(o.cursorAt);if(o.containment) |
465 | | -this._setContainment();this._trigger("start",event);this._cacheHelperProportions();if($.ui.ddmanager&&!o.dropBehaviour) |
466 | | -$.ui.ddmanager.prepareOffsets(this,event);this.helper.addClass("ui-draggable-dragging");this._mouseDrag(event,true);return true;},_mouseDrag:function(event,noPropagation){this.position=this._generatePosition(event);this.positionAbs=this._convertPositionTo("absolute");if(!noPropagation){var ui=this._uiHash();this._trigger('drag',event,ui);this.position=ui.position;} |
467 | | -if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+'px';if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+'px';if($.ui.ddmanager)$.ui.ddmanager.drag(this,event);return false;},_mouseStop:function(event){var dropped=false;if($.ui.ddmanager&&!this.options.dropBehaviour) |
468 | | -dropped=$.ui.ddmanager.drop(this,event);if(this.dropped){dropped=this.dropped;this.dropped=false;} |
469 | | -if((this.options.revert=="invalid"&&!dropped)||(this.options.revert=="valid"&&dropped)||this.options.revert===true||($.isFunction(this.options.revert)&&this.options.revert.call(this.element,dropped))){var self=this;$(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){self._trigger("stop",event);self._clear();});}else{this._trigger("stop",event);this._clear();} |
470 | | -return false;},_getHandle:function(event){var handle=!this.options.handle||!$(this.options.handle,this.element).length?true:false;$(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==event.target)handle=true;});return handle;},_createHelper:function(event){var o=this.options;var helper=$.isFunction(o.helper)?$(o.helper.apply(this.element[0],[event])):(o.helper=='clone'?this.element.clone():this.element);if(!helper.parents('body').length) |
471 | | -helper.appendTo((o.appendTo=='parent'?this.element[0].parentNode:o.appendTo));if(helper[0]!=this.element[0]&&!(/(fixed|absolute)/).test(helper.css("position"))) |
472 | | -helper.css("position","absolute");return helper;},_adjustOffsetFromHelper:function(obj){if(obj.left!=undefined)this.offset.click.left=obj.left+this.margins.left;if(obj.right!=undefined)this.offset.click.left=this.helperProportions.width-obj.right+this.margins.left;if(obj.top!=undefined)this.offset.click.top=obj.top+this.margins.top;if(obj.bottom!=undefined)this.offset.click.top=this.helperProportions.height-obj.bottom+this.margins.top;},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var po=this.offsetParent.offset();if(this.cssPosition=='absolute'&&this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0])){po.left+=this.scrollParent.scrollLeft();po.top+=this.scrollParent.scrollTop();} |
473 | | -if((this.offsetParent[0]==document.body)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=='html'&&$.browser.msie)) |
474 | | -po={top:0,left:0};return{top:po.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:po.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)};},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var p=this.element.position();return{top:p.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:p.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()};}else{return{top:0,left:0};}},_cacheMargins:function(){this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0)};},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};},_setContainment:function(){var o=this.options;if(o.containment=='parent')o.containment=this.helper[0].parentNode;if(o.containment=='document'||o.containment=='window')this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,$(o.containment=='document'?document:window).width()-this.helperProportions.width-this.margins.left,($(o.containment=='document'?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!(/^(document|window|parent)$/).test(o.containment)&&o.containment.constructor!=Array){var ce=$(o.containment)[0];if(!ce)return;var co=$(o.containment).offset();var over=($(ce).css("overflow")!='hidden');this.containment=[co.left+(parseInt($(ce).css("borderLeftWidth"),10)||0)+(parseInt($(ce).css("paddingLeft"),10)||0)-this.margins.left,co.top+(parseInt($(ce).css("borderTopWidth"),10)||0)+(parseInt($(ce).css("paddingTop"),10)||0)-this.margins.top,co.left+(over?Math.max(ce.scrollWidth,ce.offsetWidth):ce.offsetWidth)-(parseInt($(ce).css("borderLeftWidth"),10)||0)-(parseInt($(ce).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,co.top+(over?Math.max(ce.scrollHeight,ce.offsetHeight):ce.offsetHeight)-(parseInt($(ce).css("borderTopWidth"),10)||0)-(parseInt($(ce).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top];}else if(o.containment.constructor==Array){this.containment=o.containment;}},_convertPositionTo:function(d,pos){if(!pos)pos=this.position;var mod=d=="absolute"?1:-1;var o=this.options,scroll=this.cssPosition=='absolute'&&!(this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=(/(html|body)/i).test(scroll[0].tagName);return{top:(pos.top |
475 | | -+this.offset.relative.top*mod |
476 | | -+this.offset.parent.top*mod |
477 | | --($.browser.safari&&this.cssPosition=='fixed'?0:(this.cssPosition=='fixed'?-this.scrollParent.scrollTop():(scrollIsRootNode?0:scroll.scrollTop()))*mod)),left:(pos.left |
478 | | -+this.offset.relative.left*mod |
479 | | -+this.offset.parent.left*mod |
480 | | --($.browser.safari&&this.cssPosition=='fixed'?0:(this.cssPosition=='fixed'?-this.scrollParent.scrollLeft():scrollIsRootNode?0:scroll.scrollLeft())*mod))};},_generatePosition:function(event){var o=this.options,scroll=this.cssPosition=='absolute'&&!(this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=(/(html|body)/i).test(scroll[0].tagName);if(this.cssPosition=='relative'&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])){this.offset.relative=this._getRelativeOffset();} |
481 | | -var pageX=event.pageX;var pageY=event.pageY;if(this.originalPosition){if(this.containment){if(event.pageX-this.offset.click.left<this.containment[0])pageX=this.containment[0]+this.offset.click.left;if(event.pageY-this.offset.click.top<this.containment[1])pageY=this.containment[1]+this.offset.click.top;if(event.pageX-this.offset.click.left>this.containment[2])pageX=this.containment[2]+this.offset.click.left;if(event.pageY-this.offset.click.top>this.containment[3])pageY=this.containment[3]+this.offset.click.top;} |
482 | | -if(o.grid){var top=this.originalPageY+Math.round((pageY-this.originalPageY)/o.grid[1])*o.grid[1];pageY=this.containment?(!(top-this.offset.click.top<this.containment[1]||top-this.offset.click.top>this.containment[3])?top:(!(top-this.offset.click.top<this.containment[1])?top-o.grid[1]:top+o.grid[1])):top;var left=this.originalPageX+Math.round((pageX-this.originalPageX)/o.grid[0])*o.grid[0];pageX=this.containment?(!(left-this.offset.click.left<this.containment[0]||left-this.offset.click.left>this.containment[2])?left:(!(left-this.offset.click.left<this.containment[0])?left-o.grid[0]:left+o.grid[0])):left;}} |
483 | | -return{top:(pageY |
484 | | --this.offset.click.top |
485 | | --this.offset.relative.top |
486 | | --this.offset.parent.top |
487 | | -+($.browser.safari&&this.cssPosition=='fixed'?0:(this.cssPosition=='fixed'?-this.scrollParent.scrollTop():(scrollIsRootNode?0:scroll.scrollTop())))),left:(pageX |
488 | | --this.offset.click.left |
489 | | --this.offset.relative.left |
490 | | --this.offset.parent.left |
491 | | -+($.browser.safari&&this.cssPosition=='fixed'?0:(this.cssPosition=='fixed'?-this.scrollParent.scrollLeft():scrollIsRootNode?0:scroll.scrollLeft())))};},_clear:function(){this.helper.removeClass("ui-draggable-dragging");if(this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval)this.helper.remove();this.helper=null;this.cancelHelperRemoval=false;},_trigger:function(type,event,ui){ui=ui||this._uiHash();$.ui.plugin.call(this,type,[event,ui]);if(type=="drag")this.positionAbs=this._convertPositionTo("absolute");return $.widget.prototype._trigger.call(this,type,event,ui);},plugins:{},_uiHash:function(event){return{helper:this.helper,position:this.position,absolutePosition:this.positionAbs,offset:this.positionAbs};}}));$.extend($.ui.draggable,{version:"1.7.2",eventPrefix:"drag",defaults:{addClasses:true,appendTo:"parent",axis:false,cancel:":input,option",connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,delay:0,distance:1,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false}});$.ui.plugin.add("draggable","connectToSortable",{start:function(event,ui){var inst=$(this).data("draggable"),o=inst.options,uiSortable=$.extend({},ui,{item:inst.element});inst.sortables=[];$(o.connectToSortable).each(function(){var sortable=$.data(this,'sortable');if(sortable&&!sortable.options.disabled){inst.sortables.push({instance:sortable,shouldRevert:sortable.options.revert});sortable._refreshItems();sortable._trigger("activate",event,uiSortable);}});},stop:function(event,ui){var inst=$(this).data("draggable"),uiSortable=$.extend({},ui,{item:inst.element});$.each(inst.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;inst.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert)this.instance.options.revert=true;this.instance._mouseStop(event);this.instance.options.helper=this.instance.options._helper;if(inst.options.helper=='original') |
492 | | -this.instance.currentItem.css({top:'auto',left:'auto'});}else{this.instance.cancelHelperRemoval=false;this.instance._trigger("deactivate",event,uiSortable);}});},drag:function(event,ui){var inst=$(this).data("draggable"),self=this;var checkPos=function(o){var dyClick=this.offset.click.top,dxClick=this.offset.click.left;var helperTop=this.positionAbs.top,helperLeft=this.positionAbs.left;var itemHeight=o.height,itemWidth=o.width;var itemTop=o.top,itemLeft=o.left;return $.ui.isOver(helperTop+dyClick,helperLeft+dxClick,itemTop,itemLeft,itemHeight,itemWidth);};$.each(inst.sortables,function(i){this.instance.positionAbs=inst.positionAbs;this.instance.helperProportions=inst.helperProportions;this.instance.offset.click=inst.offset.click;if(this.instance._intersectsWith(this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=$(self).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return ui.helper[0];};event.target=this.instance.currentItem[0];this.instance._mouseCapture(event,true);this.instance._mouseStart(event,true,true);this.instance.offset.click.top=inst.offset.click.top;this.instance.offset.click.left=inst.offset.click.left;this.instance.offset.parent.left-=inst.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=inst.offset.parent.top-this.instance.offset.parent.top;inst._trigger("toSortable",event);inst.dropped=this.instance.element;inst.currentItem=inst.element;this.instance.fromOutside=inst;} |
493 | | -if(this.instance.currentItem)this.instance._mouseDrag(event);}else{if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance._trigger('out',event,this.instance._uiHash(this.instance));this.instance._mouseStop(event,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();if(this.instance.placeholder)this.instance.placeholder.remove();inst._trigger("fromSortable",event);inst.dropped=false;}};});}});$.ui.plugin.add("draggable","cursor",{start:function(event,ui){var t=$('body'),o=$(this).data('draggable').options;if(t.css("cursor"))o._cursor=t.css("cursor");t.css("cursor",o.cursor);},stop:function(event,ui){var o=$(this).data('draggable').options;if(o._cursor)$('body').css("cursor",o._cursor);}});$.ui.plugin.add("draggable","iframeFix",{start:function(event,ui){var o=$(this).data('draggable').options;$(o.iframeFix===true?"iframe":o.iframeFix).each(function(){$('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css($(this).offset()).appendTo("body");});},stop:function(event,ui){$("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this);});}});$.ui.plugin.add("draggable","opacity",{start:function(event,ui){var t=$(ui.helper),o=$(this).data('draggable').options;if(t.css("opacity"))o._opacity=t.css("opacity");t.css('opacity',o.opacity);},stop:function(event,ui){var o=$(this).data('draggable').options;if(o._opacity)$(ui.helper).css('opacity',o._opacity);}});$.ui.plugin.add("draggable","scroll",{start:function(event,ui){var i=$(this).data("draggable");if(i.scrollParent[0]!=document&&i.scrollParent[0].tagName!='HTML')i.overflowOffset=i.scrollParent.offset();},drag:function(event,ui){var i=$(this).data("draggable"),o=i.options,scrolled=false;if(i.scrollParent[0]!=document&&i.scrollParent[0].tagName!='HTML'){if(!o.axis||o.axis!='x'){if((i.overflowOffset.top+i.scrollParent[0].offsetHeight)-event.pageY<o.scrollSensitivity) |
494 | | -i.scrollParent[0].scrollTop=scrolled=i.scrollParent[0].scrollTop+o.scrollSpeed;else if(event.pageY-i.overflowOffset.top<o.scrollSensitivity) |
495 | | -i.scrollParent[0].scrollTop=scrolled=i.scrollParent[0].scrollTop-o.scrollSpeed;} |
496 | | -if(!o.axis||o.axis!='y'){if((i.overflowOffset.left+i.scrollParent[0].offsetWidth)-event.pageX<o.scrollSensitivity) |
497 | | -i.scrollParent[0].scrollLeft=scrolled=i.scrollParent[0].scrollLeft+o.scrollSpeed;else if(event.pageX-i.overflowOffset.left<o.scrollSensitivity) |
498 | | -i.scrollParent[0].scrollLeft=scrolled=i.scrollParent[0].scrollLeft-o.scrollSpeed;}}else{if(!o.axis||o.axis!='x'){if(event.pageY-$(document).scrollTop()<o.scrollSensitivity) |
499 | | -scrolled=$(document).scrollTop($(document).scrollTop()-o.scrollSpeed);else if($(window).height()-(event.pageY-$(document).scrollTop())<o.scrollSensitivity) |
500 | | -scrolled=$(document).scrollTop($(document).scrollTop()+o.scrollSpeed);} |
501 | | -if(!o.axis||o.axis!='y'){if(event.pageX-$(document).scrollLeft()<o.scrollSensitivity) |
502 | | -scrolled=$(document).scrollLeft($(document).scrollLeft()-o.scrollSpeed);else if($(window).width()-(event.pageX-$(document).scrollLeft())<o.scrollSensitivity) |
503 | | -scrolled=$(document).scrollLeft($(document).scrollLeft()+o.scrollSpeed);}} |
504 | | -if(scrolled!==false&&$.ui.ddmanager&&!o.dropBehaviour) |
505 | | -$.ui.ddmanager.prepareOffsets(i,event);}});$.ui.plugin.add("draggable","snap",{start:function(event,ui){var i=$(this).data("draggable"),o=i.options;i.snapElements=[];$(o.snap.constructor!=String?(o.snap.items||':data(draggable)'):o.snap).each(function(){var $t=$(this);var $o=$t.offset();if(this!=i.element[0])i.snapElements.push({item:this,width:$t.outerWidth(),height:$t.outerHeight(),top:$o.top,left:$o.left});});},drag:function(event,ui){var inst=$(this).data("draggable"),o=inst.options;var d=o.snapTolerance;var x1=ui.offset.left,x2=x1+inst.helperProportions.width,y1=ui.offset.top,y2=y1+inst.helperProportions.height;for(var i=inst.snapElements.length-1;i>=0;i--){var l=inst.snapElements[i].left,r=l+inst.snapElements[i].width,t=inst.snapElements[i].top,b=t+inst.snapElements[i].height;if(!((l-d<x1&&x1<r+d&&t-d<y1&&y1<b+d)||(l-d<x1&&x1<r+d&&t-d<y2&&y2<b+d)||(l-d<x2&&x2<r+d&&t-d<y1&&y1<b+d)||(l-d<x2&&x2<r+d&&t-d<y2&&y2<b+d))){if(inst.snapElements[i].snapping)(inst.options.snap.release&&inst.options.snap.release.call(inst.element,event,$.extend(inst._uiHash(),{snapItem:inst.snapElements[i].item})));inst.snapElements[i].snapping=false;continue;} |
506 | | -if(o.snapMode!='inner'){var ts=Math.abs(t-y2)<=d;var bs=Math.abs(b-y1)<=d;var ls=Math.abs(l-x2)<=d;var rs=Math.abs(r-x1)<=d;if(ts)ui.position.top=inst._convertPositionTo("relative",{top:t-inst.helperProportions.height,left:0}).top-inst.margins.top;if(bs)ui.position.top=inst._convertPositionTo("relative",{top:b,left:0}).top-inst.margins.top;if(ls)ui.position.left=inst._convertPositionTo("relative",{top:0,left:l-inst.helperProportions.width}).left-inst.margins.left;if(rs)ui.position.left=inst._convertPositionTo("relative",{top:0,left:r}).left-inst.margins.left;} |
507 | | -var first=(ts||bs||ls||rs);if(o.snapMode!='outer'){var ts=Math.abs(t-y1)<=d;var bs=Math.abs(b-y2)<=d;var ls=Math.abs(l-x1)<=d;var rs=Math.abs(r-x2)<=d;if(ts)ui.position.top=inst._convertPositionTo("relative",{top:t,left:0}).top-inst.margins.top;if(bs)ui.position.top=inst._convertPositionTo("relative",{top:b-inst.helperProportions.height,left:0}).top-inst.margins.top;if(ls)ui.position.left=inst._convertPositionTo("relative",{top:0,left:l}).left-inst.margins.left;if(rs)ui.position.left=inst._convertPositionTo("relative",{top:0,left:r-inst.helperProportions.width}).left-inst.margins.left;} |
508 | | -if(!inst.snapElements[i].snapping&&(ts||bs||ls||rs||first)) |
509 | | -(inst.options.snap.snap&&inst.options.snap.snap.call(inst.element,event,$.extend(inst._uiHash(),{snapItem:inst.snapElements[i].item})));inst.snapElements[i].snapping=(ts||bs||ls||rs||first);};}});$.ui.plugin.add("draggable","stack",{start:function(event,ui){var o=$(this).data("draggable").options;var group=$.makeArray($(o.stack.group)).sort(function(a,b){return(parseInt($(a).css("zIndex"),10)||o.stack.min)-(parseInt($(b).css("zIndex"),10)||o.stack.min);});$(group).each(function(i){this.style.zIndex=o.stack.min+i;});this[0].style.zIndex=o.stack.min+group.length;}});$.ui.plugin.add("draggable","zIndex",{start:function(event,ui){var t=$(ui.helper),o=$(this).data("draggable").options;if(t.css("zIndex"))o._zIndex=t.css("zIndex");t.css('zIndex',o.zIndex);},stop:function(event,ui){var o=$(this).data("draggable").options;if(o._zIndex)$(ui.helper).css('zIndex',o._zIndex);}});})(jQuery);(function($){$.widget("ui.resizable",$.extend({},$.ui.mouse,{_init:function(){var self=this,o=this.options;this.element.addClass("ui-resizable");$.extend(this,{_aspectRatio:!!(o.aspectRatio),aspectRatio:o.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:o.helper||o.ghost||o.animate?o.helper||'ui-resizable-helper':null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){if(/relative/.test(this.element.css('position'))&&$.browser.opera) |
510 | | -this.element.css({position:'relative',top:'auto',left:'auto'});this.element.wrap($('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css('position'),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css('top'),left:this.element.css('left')}));this.element=this.element.parent().data("resizable",this.element.data('resizable'));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=this.originalElement.css('resize');this.originalElement.css('resize','none');this._proportionallyResizeElements.push(this.originalElement.css({position:'static',zoom:1,display:'block'}));this.originalElement.css({margin:this.originalElement.css('margin')});this._proportionallyResize();} |
511 | | -this.handles=o.handles||(!$('.ui-resizable-handle',this.element).length?"e,s,se":{n:'.ui-resizable-n',e:'.ui-resizable-e',s:'.ui-resizable-s',w:'.ui-resizable-w',se:'.ui-resizable-se',sw:'.ui-resizable-sw',ne:'.ui-resizable-ne',nw:'.ui-resizable-nw'});if(this.handles.constructor==String){if(this.handles=='all')this.handles='n,e,s,w,se,sw,ne,nw';var n=this.handles.split(",");this.handles={};for(var i=0;i<n.length;i++){var handle=$.trim(n[i]),hname='ui-resizable-'+handle;var axis=$('<div class="ui-resizable-handle '+hname+'"></div>');if(/sw|se|ne|nw/.test(handle))axis.css({zIndex:++o.zIndex});if('se'==handle){axis.addClass('ui-icon ui-icon-gripsmall-diagonal-se');};this.handles[handle]='.ui-resizable-'+handle;this.element.append(axis);}} |
512 | | -this._renderAxis=function(target){target=target||this.element;for(var i in this.handles){if(this.handles[i].constructor==String) |
513 | | -this.handles[i]=$(this.handles[i],this.element).show();if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var axis=$(this.handles[i],this.element),padWrapper=0;padWrapper=/sw|ne|nw|se|n|s/.test(i)?axis.outerHeight():axis.outerWidth();var padPos=['padding',/ne|nw|n/.test(i)?'Top':/se|sw|s/.test(i)?'Bottom':/^e$/.test(i)?'Right':'Left'].join("");target.css(padPos,padWrapper);this._proportionallyResize();} |
514 | | -if(!$(this.handles[i]).length) |
515 | | -continue;}};this._renderAxis(this.element);this._handles=$('.ui-resizable-handle',this.element).disableSelection();this._handles.mouseover(function(){if(!self.resizing){if(this.className) |
516 | | -var axis=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);self.axis=axis&&axis[1]?axis[1]:'se';}});if(o.autoHide){this._handles.hide();$(this.element).addClass("ui-resizable-autohide").hover(function(){$(this).removeClass("ui-resizable-autohide");self._handles.show();},function(){if(!self.resizing){$(this).addClass("ui-resizable-autohide");self._handles.hide();}});} |
517 | | -this._mouseInit();},destroy:function(){this._mouseDestroy();var _destroy=function(exp){$(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find('.ui-resizable-handle').remove();};if(this.elementIsWrapper){_destroy(this.element);var wrapper=this.element;wrapper.parent().append(this.originalElement.css({position:wrapper.css('position'),width:wrapper.outerWidth(),height:wrapper.outerHeight(),top:wrapper.css('top'),left:wrapper.css('left')})).end().remove();} |
518 | | -this.originalElement.css('resize',this.originalResizeStyle);_destroy(this.originalElement);},_mouseCapture:function(event){var handle=false;for(var i in this.handles){if($(this.handles[i])[0]==event.target)handle=true;} |
519 | | -return this.options.disabled||!!handle;},_mouseStart:function(event){var o=this.options,iniPos=this.element.position(),el=this.element;this.resizing=true;this.documentScroll={top:$(document).scrollTop(),left:$(document).scrollLeft()};if(el.is('.ui-draggable')||(/absolute/).test(el.css('position'))){el.css({position:'absolute',top:iniPos.top,left:iniPos.left});} |
520 | | -if($.browser.opera&&(/relative/).test(el.css('position'))) |
521 | | -el.css({position:'relative',top:'auto',left:'auto'});this._renderProxy();var curleft=num(this.helper.css('left')),curtop=num(this.helper.css('top'));if(o.containment){curleft+=$(o.containment).scrollLeft()||0;curtop+=$(o.containment).scrollTop()||0;} |
522 | | -this.offset=this.helper.offset();this.position={left:curleft,top:curtop};this.size=this._helper?{width:el.outerWidth(),height:el.outerHeight()}:{width:el.width(),height:el.height()};this.originalSize=this._helper?{width:el.outerWidth(),height:el.outerHeight()}:{width:el.width(),height:el.height()};this.originalPosition={left:curleft,top:curtop};this.sizeDiff={width:el.outerWidth()-el.width(),height:el.outerHeight()-el.height()};this.originalMousePosition={left:event.pageX,top:event.pageY};this.aspectRatio=(typeof o.aspectRatio=='number')?o.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);var cursor=$('.ui-resizable-'+this.axis).css('cursor');$('body').css('cursor',cursor=='auto'?this.axis+'-resize':cursor);el.addClass("ui-resizable-resizing");this._propagate("start",event);return true;},_mouseDrag:function(event){var el=this.helper,o=this.options,props={},self=this,smp=this.originalMousePosition,a=this.axis;var dx=(event.pageX-smp.left)||0,dy=(event.pageY-smp.top)||0;var trigger=this._change[a];if(!trigger)return false;var data=trigger.apply(this,[event,dx,dy]),ie6=$.browser.msie&&$.browser.version<7,csdif=this.sizeDiff;if(this._aspectRatio||event.shiftKey) |
523 | | -data=this._updateRatio(data,event);data=this._respectSize(data,event);this._propagate("resize",event);el.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!this._helper&&this._proportionallyResizeElements.length) |
524 | | -this._proportionallyResize();this._updateCache(data);this._trigger('resize',event,this.ui());return false;},_mouseStop:function(event){this.resizing=false;var o=this.options,self=this;if(this._helper){var pr=this._proportionallyResizeElements,ista=pr.length&&(/textarea/i).test(pr[0].nodeName),soffseth=ista&&$.ui.hasScroll(pr[0],'left')?0:self.sizeDiff.height,soffsetw=ista?0:self.sizeDiff.width;var s={width:(self.size.width-soffsetw),height:(self.size.height-soffseth)},left=(parseInt(self.element.css('left'),10)+(self.position.left-self.originalPosition.left))||null,top=(parseInt(self.element.css('top'),10)+(self.position.top-self.originalPosition.top))||null;if(!o.animate) |
525 | | -this.element.css($.extend(s,{top:top,left:left}));self.helper.height(self.size.height);self.helper.width(self.size.width);if(this._helper&&!o.animate)this._proportionallyResize();} |
526 | | -$('body').css('cursor','auto');this.element.removeClass("ui-resizable-resizing");this._propagate("stop",event);if(this._helper)this.helper.remove();return false;},_updateCache:function(data){var o=this.options;this.offset=this.helper.offset();if(isNumber(data.left))this.position.left=data.left;if(isNumber(data.top))this.position.top=data.top;if(isNumber(data.height))this.size.height=data.height;if(isNumber(data.width))this.size.width=data.width;},_updateRatio:function(data,event){var o=this.options,cpos=this.position,csize=this.size,a=this.axis;if(data.height)data.width=(csize.height*this.aspectRatio);else if(data.width)data.height=(csize.width/this.aspectRatio);if(a=='sw'){data.left=cpos.left+(csize.width-data.width);data.top=null;} |
527 | | -if(a=='nw'){data.top=cpos.top+(csize.height-data.height);data.left=cpos.left+(csize.width-data.width);} |
528 | | -return data;},_respectSize:function(data,event){var el=this.helper,o=this.options,pRatio=this._aspectRatio||event.shiftKey,a=this.axis,ismaxw=isNumber(data.width)&&o.maxWidth&&(o.maxWidth<data.width),ismaxh=isNumber(data.height)&&o.maxHeight&&(o.maxHeight<data.height),isminw=isNumber(data.width)&&o.minWidth&&(o.minWidth>data.width),isminh=isNumber(data.height)&&o.minHeight&&(o.minHeight>data.height);if(isminw)data.width=o.minWidth;if(isminh)data.height=o.minHeight;if(ismaxw)data.width=o.maxWidth;if(ismaxh)data.height=o.maxHeight;var dw=this.originalPosition.left+this.originalSize.width,dh=this.position.top+this.size.height;var cw=/sw|nw|w/.test(a),ch=/nw|ne|n/.test(a);if(isminw&&cw)data.left=dw-o.minWidth;if(ismaxw&&cw)data.left=dw-o.maxWidth;if(isminh&&ch)data.top=dh-o.minHeight;if(ismaxh&&ch)data.top=dh-o.maxHeight;var isNotwh=!data.width&&!data.height;if(isNotwh&&!data.left&&data.top)data.top=null;else if(isNotwh&&!data.top&&data.left)data.left=null;return data;},_proportionallyResize:function(){var o=this.options;if(!this._proportionallyResizeElements.length)return;var element=this.helper||this.element;for(var i=0;i<this._proportionallyResizeElements.length;i++){var prel=this._proportionallyResizeElements[i];if(!this.borderDif){var b=[prel.css('borderTopWidth'),prel.css('borderRightWidth'),prel.css('borderBottomWidth'),prel.css('borderLeftWidth')],p=[prel.css('paddingTop'),prel.css('paddingRight'),prel.css('paddingBottom'),prel.css('paddingLeft')];this.borderDif=$.map(b,function(v,i){var border=parseInt(v,10)||0,padding=parseInt(p[i],10)||0;return border+padding;});} |
529 | | -if($.browser.msie&&!(!($(element).is(':hidden')||$(element).parents(':hidden').length))) |
530 | | -continue;prel.css({height:(element.height()-this.borderDif[0]-this.borderDif[2])||0,width:(element.width()-this.borderDif[1]-this.borderDif[3])||0});};},_renderProxy:function(){var el=this.element,o=this.options;this.elementOffset=el.offset();if(this._helper){this.helper=this.helper||$('<div style="overflow:hidden;"></div>');var ie6=$.browser.msie&&$.browser.version<7,ie6offset=(ie6?1:0),pxyoffset=(ie6?2:-1);this.helper.addClass(this._helper).css({width:this.element.outerWidth()+pxyoffset,height:this.element.outerHeight()+pxyoffset,position:'absolute',left:this.elementOffset.left-ie6offset+'px',top:this.elementOffset.top-ie6offset+'px',zIndex:++o.zIndex});this.helper.appendTo("body").disableSelection();}else{this.helper=this.element;}},_change:{e:function(event,dx,dy){return{width:this.originalSize.width+dx};},w:function(event,dx,dy){var o=this.options,cs=this.originalSize,sp=this.originalPosition;return{left:sp.left+dx,width:cs.width-dx};},n:function(event,dx,dy){var o=this.options,cs=this.originalSize,sp=this.originalPosition;return{top:sp.top+dy,height:cs.height-dy};},s:function(event,dx,dy){return{height:this.originalSize.height+dy};},se:function(event,dx,dy){return $.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[event,dx,dy]));},sw:function(event,dx,dy){return $.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[event,dx,dy]));},ne:function(event,dx,dy){return $.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[event,dx,dy]));},nw:function(event,dx,dy){return $.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[event,dx,dy]));}},_propagate:function(n,event){$.ui.plugin.call(this,n,[event,this.ui()]);(n!="resize"&&this._trigger(n,event,this.ui()));},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition};}}));$.extend($.ui.resizable,{version:"1.7.2",eventPrefix:"resize",defaults:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,cancel:":input,option",containment:false,delay:0,distance:1,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1000}});$.ui.plugin.add("resizable","alsoResize",{start:function(event,ui){var self=$(this).data("resizable"),o=self.options;_store=function(exp){$(exp).each(function(){$(this).data("resizable-alsoresize",{width:parseInt($(this).width(),10),height:parseInt($(this).height(),10),left:parseInt($(this).css('left'),10),top:parseInt($(this).css('top'),10)});});};if(typeof(o.alsoResize)=='object'&&!o.alsoResize.parentNode){if(o.alsoResize.length){o.alsoResize=o.alsoResize[0];_store(o.alsoResize);} |
531 | | -else{$.each(o.alsoResize,function(exp,c){_store(exp);});}}else{_store(o.alsoResize);}},resize:function(event,ui){var self=$(this).data("resizable"),o=self.options,os=self.originalSize,op=self.originalPosition;var delta={height:(self.size.height-os.height)||0,width:(self.size.width-os.width)||0,top:(self.position.top-op.top)||0,left:(self.position.left-op.left)||0},_alsoResize=function(exp,c){$(exp).each(function(){var el=$(this),start=$(this).data("resizable-alsoresize"),style={},css=c&&c.length?c:['width','height','top','left'];$.each(css||['width','height','top','left'],function(i,prop){var sum=(start[prop]||0)+(delta[prop]||0);if(sum&&sum>=0) |
532 | | -style[prop]=sum||null;});if(/relative/.test(el.css('position'))&&$.browser.opera){self._revertToRelativePosition=true;el.css({position:'absolute',top:'auto',left:'auto'});} |
533 | | -el.css(style);});};if(typeof(o.alsoResize)=='object'&&!o.alsoResize.nodeType){$.each(o.alsoResize,function(exp,c){_alsoResize(exp,c);});}else{_alsoResize(o.alsoResize);}},stop:function(event,ui){var self=$(this).data("resizable");if(self._revertToRelativePosition&&$.browser.opera){self._revertToRelativePosition=false;el.css({position:'relative'});} |
534 | | -$(this).removeData("resizable-alsoresize-start");}});$.ui.plugin.add("resizable","animate",{stop:function(event,ui){var self=$(this).data("resizable"),o=self.options;var pr=self._proportionallyResizeElements,ista=pr.length&&(/textarea/i).test(pr[0].nodeName),soffseth=ista&&$.ui.hasScroll(pr[0],'left')?0:self.sizeDiff.height,soffsetw=ista?0:self.sizeDiff.width;var style={width:(self.size.width-soffsetw),height:(self.size.height-soffseth)},left=(parseInt(self.element.css('left'),10)+(self.position.left-self.originalPosition.left))||null,top=(parseInt(self.element.css('top'),10)+(self.position.top-self.originalPosition.top))||null;self.element.animate($.extend(style,top&&left?{top:top,left:left}:{}),{duration:o.animateDuration,easing:o.animateEasing,step:function(){var data={width:parseInt(self.element.css('width'),10),height:parseInt(self.element.css('height'),10),top:parseInt(self.element.css('top'),10),left:parseInt(self.element.css('left'),10)};if(pr&&pr.length)$(pr[0]).css({width:data.width,height:data.height});self._updateCache(data);self._propagate("resize",event);}});}});$.ui.plugin.add("resizable","containment",{start:function(event,ui){var self=$(this).data("resizable"),o=self.options,el=self.element;var oc=o.containment,ce=(oc instanceof $)?oc.get(0):(/parent/.test(oc))?el.parent().get(0):oc;if(!ce)return;self.containerElement=$(ce);if(/document/.test(oc)||oc==document){self.containerOffset={left:0,top:0};self.containerPosition={left:0,top:0};self.parentData={element:$(document),left:0,top:0,width:$(document).width(),height:$(document).height()||document.body.parentNode.scrollHeight};} |
535 | | -else{var element=$(ce),p=[];$(["Top","Right","Left","Bottom"]).each(function(i,name){p[i]=num(element.css("padding"+name));});self.containerOffset=element.offset();self.containerPosition=element.position();self.containerSize={height:(element.innerHeight()-p[3]),width:(element.innerWidth()-p[1])};var co=self.containerOffset,ch=self.containerSize.height,cw=self.containerSize.width,width=($.ui.hasScroll(ce,"left")?ce.scrollWidth:cw),height=($.ui.hasScroll(ce)?ce.scrollHeight:ch);self.parentData={element:ce,left:co.left,top:co.top,width:width,height:height};}},resize:function(event,ui){var self=$(this).data("resizable"),o=self.options,ps=self.containerSize,co=self.containerOffset,cs=self.size,cp=self.position,pRatio=self._aspectRatio||event.shiftKey,cop={top:0,left:0},ce=self.containerElement;if(ce[0]!=document&&(/static/).test(ce.css('position')))cop=co;if(cp.left<(self._helper?co.left:0)){self.size.width=self.size.width+(self._helper?(self.position.left-co.left):(self.position.left-cop.left));if(pRatio)self.size.height=self.size.width/o.aspectRatio;self.position.left=o.helper?co.left:0;} |
536 | | -if(cp.top<(self._helper?co.top:0)){self.size.height=self.size.height+(self._helper?(self.position.top-co.top):self.position.top);if(pRatio)self.size.width=self.size.height*o.aspectRatio;self.position.top=self._helper?co.top:0;} |
537 | | -self.offset.left=self.parentData.left+self.position.left;self.offset.top=self.parentData.top+self.position.top;var woset=Math.abs((self._helper?self.offset.left-cop.left:(self.offset.left-cop.left))+self.sizeDiff.width),hoset=Math.abs((self._helper?self.offset.top-cop.top:(self.offset.top-co.top))+self.sizeDiff.height);var isParent=self.containerElement.get(0)==self.element.parent().get(0),isOffsetRelative=/relative|absolute/.test(self.containerElement.css('position'));if(isParent&&isOffsetRelative)woset-=self.parentData.left;if(woset+self.size.width>=self.parentData.width){self.size.width=self.parentData.width-woset;if(pRatio)self.size.height=self.size.width/self.aspectRatio;} |
538 | | -if(hoset+self.size.height>=self.parentData.height){self.size.height=self.parentData.height-hoset;if(pRatio)self.size.width=self.size.height*self.aspectRatio;}},stop:function(event,ui){var self=$(this).data("resizable"),o=self.options,cp=self.position,co=self.containerOffset,cop=self.containerPosition,ce=self.containerElement;var helper=$(self.helper),ho=helper.offset(),w=helper.outerWidth()-self.sizeDiff.width,h=helper.outerHeight()-self.sizeDiff.height;if(self._helper&&!o.animate&&(/relative/).test(ce.css('position'))) |
539 | | -$(this).css({left:ho.left-cop.left-co.left,width:w,height:h});if(self._helper&&!o.animate&&(/static/).test(ce.css('position'))) |
540 | | -$(this).css({left:ho.left-cop.left-co.left,width:w,height:h});}});$.ui.plugin.add("resizable","ghost",{start:function(event,ui){var self=$(this).data("resizable"),o=self.options,cs=self.size;self.ghost=self.originalElement.clone();self.ghost.css({opacity:.25,display:'block',position:'relative',height:cs.height,width:cs.width,margin:0,left:0,top:0}).addClass('ui-resizable-ghost').addClass(typeof o.ghost=='string'?o.ghost:'');self.ghost.appendTo(self.helper);},resize:function(event,ui){var self=$(this).data("resizable"),o=self.options;if(self.ghost)self.ghost.css({position:'relative',height:self.size.height,width:self.size.width});},stop:function(event,ui){var self=$(this).data("resizable"),o=self.options;if(self.ghost&&self.helper)self.helper.get(0).removeChild(self.ghost.get(0));}});$.ui.plugin.add("resizable","grid",{resize:function(event,ui){var self=$(this).data("resizable"),o=self.options,cs=self.size,os=self.originalSize,op=self.originalPosition,a=self.axis,ratio=o._aspectRatio||event.shiftKey;o.grid=typeof o.grid=="number"?[o.grid,o.grid]:o.grid;var ox=Math.round((cs.width-os.width)/(o.grid[0]||1))*(o.grid[0]||1),oy=Math.round((cs.height-os.height)/(o.grid[1]||1))*(o.grid[1]||1);if(/^(se|s|e)$/.test(a)){self.size.width=os.width+ox;self.size.height=os.height+oy;} |
541 | | -else if(/^(ne)$/.test(a)){self.size.width=os.width+ox;self.size.height=os.height+oy;self.position.top=op.top-oy;} |
542 | | -else if(/^(sw)$/.test(a)){self.size.width=os.width+ox;self.size.height=os.height+oy;self.position.left=op.left-ox;} |
543 | | -else{self.size.width=os.width+ox;self.size.height=os.height+oy;self.position.top=op.top-oy;self.position.left=op.left-ox;}}});var num=function(v){return parseInt(v,10)||0;};var isNumber=function(value){return!isNaN(parseInt(value,10));};})(jQuery);(function($){var setDataSwitch={dragStart:"start.draggable",drag:"drag.draggable",dragStop:"stop.draggable",maxHeight:"maxHeight.resizable",minHeight:"minHeight.resizable",maxWidth:"maxWidth.resizable",minWidth:"minWidth.resizable",resizeStart:"start.resizable",resize:"drag.resizable",resizeStop:"stop.resizable"},uiDialogClasses='ui-dialog '+'ui-widget '+'ui-widget-content '+'ui-corner-all ';$.widget("ui.dialog",{_init:function(){this.originalTitle=this.element.attr('title');var self=this,options=this.options,title=options.title||this.originalTitle||' ',titleId=$.ui.dialog.getTitleId(this.element),uiDialog=(this.uiDialog=$('<div/>')).appendTo(document.body).hide().addClass(uiDialogClasses+options.dialogClass).css({position:'absolute',overflow:'hidden',zIndex:options.zIndex}).attr('tabIndex',-1).css('outline',0).keydown(function(event){(options.closeOnEscape&&event.keyCode&&event.keyCode==$.ui.keyCode.ESCAPE&&self.close(event));}).attr({role:'dialog','aria-labelledby':titleId}).mousedown(function(event){self.moveToTop(false,event);}),uiDialogContent=this.element.show().removeAttr('title').addClass('ui-dialog-content '+'ui-widget-content').appendTo(uiDialog),uiDialogTitlebar=(this.uiDialogTitlebar=$('<div></div>')).addClass('ui-dialog-titlebar '+'ui-widget-header '+'ui-corner-all '+'ui-helper-clearfix').prependTo(uiDialog),uiDialogTitlebarClose=$('<a href="#"/>').addClass('ui-dialog-titlebar-close '+'ui-corner-all').attr('role','button').hover(function(){uiDialogTitlebarClose.addClass('ui-state-hover');},function(){uiDialogTitlebarClose.removeClass('ui-state-hover');}).focus(function(){uiDialogTitlebarClose.addClass('ui-state-focus');}).blur(function(){uiDialogTitlebarClose.removeClass('ui-state-focus');}).mousedown(function(ev){ev.stopPropagation();}).click(function(event){self.close(event);return false;}).appendTo(uiDialogTitlebar),uiDialogTitlebarCloseText=(this.uiDialogTitlebarCloseText=$('<span/>')).addClass('ui-icon '+'ui-icon-closethick').text(options.closeText).appendTo(uiDialogTitlebarClose),uiDialogTitle=$('<span/>').addClass('ui-dialog-title').attr('id',titleId).html(title).prependTo(uiDialogTitlebar);uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection();(options.draggable&&$.fn.draggable&&this._makeDraggable());(options.resizable&&$.fn.resizable&&this._makeResizable());this._createButtons(options.buttons);this._isOpen=false;(options.bgiframe&&$.fn.bgiframe&&uiDialog.bgiframe());(options.autoOpen&&this.open());},destroy:function(){(this.overlay&&this.overlay.destroy());this.uiDialog.hide();this.element.unbind('.dialog').removeData('dialog').removeClass('ui-dialog-content ui-widget-content').hide().appendTo('body');this.uiDialog.remove();(this.originalTitle&&this.element.attr('title',this.originalTitle));},close:function(event){var self=this;if(false===self._trigger('beforeclose',event)){return;} |
544 | | -(self.overlay&&self.overlay.destroy());self.uiDialog.unbind('keypress.ui-dialog');(self.options.hide?self.uiDialog.hide(self.options.hide,function(){self._trigger('close',event);}):self.uiDialog.hide()&&self._trigger('close',event));$.ui.dialog.overlay.resize();self._isOpen=false;if(self.options.modal){var maxZ=0;$('.ui-dialog').each(function(){if(this!=self.uiDialog[0]){maxZ=Math.max(maxZ,$(this).css('z-index'));}});$.ui.dialog.maxZ=maxZ;}},isOpen:function(){return this._isOpen;},moveToTop:function(force,event){if((this.options.modal&&!force)||(!this.options.stack&&!this.options.modal)){return this._trigger('focus',event);} |
545 | | -if(this.options.zIndex>$.ui.dialog.maxZ){$.ui.dialog.maxZ=this.options.zIndex;} |
546 | | -(this.overlay&&this.overlay.$el.css('z-index',$.ui.dialog.overlay.maxZ=++$.ui.dialog.maxZ));var saveScroll={scrollTop:this.element.attr('scrollTop'),scrollLeft:this.element.attr('scrollLeft')};this.uiDialog.css('z-index',++$.ui.dialog.maxZ);this.element.attr(saveScroll);this._trigger('focus',event);},open:function(){if(this._isOpen){return;} |
547 | | -var options=this.options,uiDialog=this.uiDialog;this.overlay=options.modal?new $.ui.dialog.overlay(this):null;(uiDialog.next().length&&uiDialog.appendTo('body'));this._size();this._position(options.position);uiDialog.show(options.show);this.moveToTop(true);(options.modal&&uiDialog.bind('keypress.ui-dialog',function(event){if(event.keyCode!=$.ui.keyCode.TAB){return;} |
548 | | -var tabbables=$(':tabbable',this),first=tabbables.filter(':first')[0],last=tabbables.filter(':last')[0];if(event.target==last&&!event.shiftKey){setTimeout(function(){first.focus();},1);}else if(event.target==first&&event.shiftKey){setTimeout(function(){last.focus();},1);}}));$([]).add(uiDialog.find('.ui-dialog-content :tabbable:first')).add(uiDialog.find('.ui-dialog-buttonpane :tabbable:first')).add(uiDialog).filter(':first').focus();this._trigger('open');this._isOpen=true;},_createButtons:function(buttons){var self=this,hasButtons=false,uiDialogButtonPane=$('<div></div>').addClass('ui-dialog-buttonpane '+'ui-widget-content '+'ui-helper-clearfix');this.uiDialog.find('.ui-dialog-buttonpane').remove();(typeof buttons=='object'&&buttons!==null&&$.each(buttons,function(){return!(hasButtons=true);}));if(hasButtons){$.each(buttons,function(name,fn){$('<button type="button"></button>').addClass('ui-state-default '+'ui-corner-all').text(name).click(function(){fn.apply(self.element[0],arguments);}).hover(function(){$(this).addClass('ui-state-hover');},function(){$(this).removeClass('ui-state-hover');}).focus(function(){$(this).addClass('ui-state-focus');}).blur(function(){$(this).removeClass('ui-state-focus');}).appendTo(uiDialogButtonPane);});uiDialogButtonPane.appendTo(this.uiDialog);}},_makeDraggable:function(){var self=this,options=this.options,heightBeforeDrag;this.uiDialog.draggable({cancel:'.ui-dialog-content',handle:'.ui-dialog-titlebar',containment:'document',start:function(){heightBeforeDrag=options.height;$(this).height($(this).height()).addClass("ui-dialog-dragging");(options.dragStart&&options.dragStart.apply(self.element[0],arguments));},drag:function(){(options.drag&&options.drag.apply(self.element[0],arguments));},stop:function(){$(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag);(options.dragStop&&options.dragStop.apply(self.element[0],arguments));$.ui.dialog.overlay.resize();}});},_makeResizable:function(handles){handles=(handles===undefined?this.options.resizable:handles);var self=this,options=this.options,resizeHandles=typeof handles=='string'?handles:'n,e,s,w,se,sw,ne,nw';this.uiDialog.resizable({cancel:'.ui-dialog-content',alsoResize:this.element,maxWidth:options.maxWidth,maxHeight:options.maxHeight,minWidth:options.minWidth,minHeight:options.minHeight,start:function(){$(this).addClass("ui-dialog-resizing");(options.resizeStart&&options.resizeStart.apply(self.element[0],arguments));},resize:function(){(options.resize&&options.resize.apply(self.element[0],arguments));},handles:resizeHandles,stop:function(){$(this).removeClass("ui-dialog-resizing");options.height=$(this).height();options.width=$(this).width();(options.resizeStop&&options.resizeStop.apply(self.element[0],arguments));$.ui.dialog.overlay.resize();}}).find('.ui-resizable-se').addClass('ui-icon ui-icon-grip-diagonal-se');},_position:function(pos){var wnd=$(window),doc=$(document),pTop=doc.scrollTop(),pLeft=doc.scrollLeft(),minTop=pTop;if($.inArray(pos,['center','top','right','bottom','left'])>=0){pos=[pos=='right'||pos=='left'?pos:'center',pos=='top'||pos=='bottom'?pos:'middle'];} |
549 | | -if(pos.constructor!=Array){pos=['center','middle'];} |
550 | | -if(pos[0].constructor==Number){pLeft+=pos[0];}else{switch(pos[0]){case'left':pLeft+=0;break;case'right':pLeft+=wnd.width()-this.uiDialog.outerWidth();break;default:case'center':pLeft+=(wnd.width()-this.uiDialog.outerWidth())/2;}} |
551 | | -if(pos[1].constructor==Number){pTop+=pos[1];}else{switch(pos[1]){case'top':pTop+=0;break;case'bottom':pTop+=wnd.height()-this.uiDialog.outerHeight();break;default:case'middle':pTop+=(wnd.height()-this.uiDialog.outerHeight())/2;}} |
552 | | -pTop=Math.max(pTop,minTop);this.uiDialog.css({top:pTop,left:pLeft});},_setData:function(key,value){(setDataSwitch[key]&&this.uiDialog.data(setDataSwitch[key],value));switch(key){case"buttons":this._createButtons(value);break;case"closeText":this.uiDialogTitlebarCloseText.text(value);break;case"dialogClass":this.uiDialog.removeClass(this.options.dialogClass).addClass(uiDialogClasses+value);break;case"draggable":(value?this._makeDraggable():this.uiDialog.draggable('destroy'));break;case"height":this.uiDialog.height(value);break;case"position":this._position(value);break;case"resizable":var uiDialog=this.uiDialog,isResizable=this.uiDialog.is(':data(resizable)');(isResizable&&!value&&uiDialog.resizable('destroy'));(isResizable&&typeof value=='string'&&uiDialog.resizable('option','handles',value));(isResizable||this._makeResizable(value));break;case"title":$(".ui-dialog-title",this.uiDialogTitlebar).html(value||' ');break;case"width":this.uiDialog.width(value);break;} |
553 | | -$.widget.prototype._setData.apply(this,arguments);},_size:function(){var options=this.options;this.element.css({height:0,minHeight:0,width:'auto'});var nonContentHeight=this.uiDialog.css({height:'auto',width:options.width}).height();this.element.css({minHeight:Math.max(options.minHeight-nonContentHeight,0),height:options.height=='auto'?'auto':Math.max(options.height-nonContentHeight,0)});}});$.extend($.ui.dialog,{version:"1.7.2",defaults:{autoOpen:true,bgiframe:false,buttons:{},closeOnEscape:true,closeText:'close',dialogClass:'',draggable:true,hide:null,height:'auto',maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false,position:'center',resizable:true,show:null,stack:true,title:'',width:300,zIndex:1000},getter:'isOpen',uuid:0,maxZ:0,getTitleId:function($el){return'ui-dialog-title-'+($el.attr('id')||++this.uuid);},overlay:function(dialog){this.$el=$.ui.dialog.overlay.create(dialog);}});$.extend($.ui.dialog.overlay,{instances:[],maxZ:0,events:$.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','),function(event){return event+'.dialog-overlay';}).join(' '),create:function(dialog){if(this.instances.length===0){setTimeout(function(){if($.ui.dialog.overlay.instances.length){$(document).bind($.ui.dialog.overlay.events,function(event){var dialogZ=$(event.target).parents('.ui-dialog').css('zIndex')||0;return(dialogZ>$.ui.dialog.overlay.maxZ);});}},1);$(document).bind('keydown.dialog-overlay',function(event){(dialog.options.closeOnEscape&&event.keyCode&&event.keyCode==$.ui.keyCode.ESCAPE&&dialog.close(event));});$(window).bind('resize.dialog-overlay',$.ui.dialog.overlay.resize);} |
554 | | -var $el=$('<div></div>').appendTo(document.body).addClass('ui-widget-overlay').css({width:this.width(),height:this.height()});(dialog.options.bgiframe&&$.fn.bgiframe&&$el.bgiframe());this.instances.push($el);return $el;},destroy:function($el){this.instances.splice($.inArray(this.instances,$el),1);if(this.instances.length===0){$([document,window]).unbind('.dialog-overlay');} |
555 | | -$el.remove();var maxZ=0;$.each(this.instances,function(){maxZ=Math.max(maxZ,this.css('z-index'));});this.maxZ=maxZ;},height:function(){if($.browser.msie&&$.browser.version<7){var scrollHeight=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);var offsetHeight=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);if(scrollHeight<offsetHeight){return $(window).height()+'px';}else{return scrollHeight+'px';}}else{return $(document).height()+'px';}},width:function(){if($.browser.msie&&$.browser.version<7){var scrollWidth=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth);var offsetWidth=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);if(scrollWidth<offsetWidth){return $(window).width()+'px';}else{return scrollWidth+'px';}}else{return $(document).width()+'px';}},resize:function(){var $overlays=$([]);$.each($.ui.dialog.overlay.instances,function(){$overlays=$overlays.add(this);});$overlays.css({width:0,height:0}).css({width:$.ui.dialog.overlay.width(),height:$.ui.dialog.overlay.height()});}});$.extend($.ui.dialog.overlay.prototype,{destroy:function(){$.ui.dialog.overlay.destroy(this.$el);}});})(jQuery);(function($){$.widget("ui.tabs",{_init:function(){if(this.options.deselectable!==undefined){this.options.collapsible=this.options.deselectable;} |
556 | | -this._tabify(true);},_setData:function(key,value){if(key=='selected'){if(this.options.collapsible&&value==this.options.selected){return;} |
557 | | -this.select(value);} |
558 | | -else{this.options[key]=value;if(key=='deselectable'){this.options.collapsible=value;} |
559 | | -this._tabify();}},_tabId:function(a){return a.title&&a.title.replace(/\s/g,'_').replace(/[^A-Za-z0-9\-_:\.]/g,'')||this.options.idPrefix+$.data(a);},_sanitizeSelector:function(hash){return hash.replace(/:/g,'\\:');},_cookie:function(){var cookie=this.cookie||(this.cookie=this.options.cookie.name||'ui-tabs-'+$.data(this.list[0]));return $.cookie.apply(null,[cookie].concat($.makeArray(arguments)));},_ui:function(tab,panel){return{tab:tab,panel:panel,index:this.anchors.index(tab)};},_cleanup:function(){this.lis.filter('.ui-state-processing').removeClass('ui-state-processing').find('span:data(label.tabs)').each(function(){var el=$(this);el.html(el.data('label.tabs')).removeData('label.tabs');});},_tabify:function(init){this.list=this.element.children('ul:first');this.lis=$('li:has(a[href])',this.list);this.anchors=this.lis.map(function(){return $('a',this)[0];});this.panels=$([]);var self=this,o=this.options;var fragmentId=/^#.+/;this.anchors.each(function(i,a){var href=$(a).attr('href');var hrefBase=href.split('#')[0],baseEl;if(hrefBase&&(hrefBase===location.toString().split('#')[0]||(baseEl=$('base')[0])&&hrefBase===baseEl.href)){href=a.hash;a.href=href;} |
560 | | -if(fragmentId.test(href)){self.panels=self.panels.add(self._sanitizeSelector(href));} |
561 | | -else if(href!='#'){$.data(a,'href.tabs',href);$.data(a,'load.tabs',href.replace(/#.*$/,''));var id=self._tabId(a);a.href='#'+id;var $panel=$('#'+id);if(!$panel.length){$panel=$(o.panelTemplate).attr('id',id).addClass('ui-tabs-panel ui-widget-content ui-corner-bottom').insertAfter(self.panels[i-1]||self.list);$panel.data('destroy.tabs',true);} |
562 | | -self.panels=self.panels.add($panel);} |
563 | | -else{o.disabled.push(i);}});if(init){this.element.addClass('ui-tabs ui-widget ui-widget-content ui-corner-all');this.list.addClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all');this.lis.addClass('ui-state-default ui-corner-top');this.panels.addClass('ui-tabs-panel ui-widget-content ui-corner-bottom');if(o.selected===undefined){if(location.hash){this.anchors.each(function(i,a){if(a.hash==location.hash){o.selected=i;return false;}});} |
564 | | -if(typeof o.selected!='number'&&o.cookie){o.selected=parseInt(self._cookie(),10);} |
565 | | -if(typeof o.selected!='number'&&this.lis.filter('.ui-tabs-selected').length){o.selected=this.lis.index(this.lis.filter('.ui-tabs-selected'));} |
566 | | -o.selected=o.selected||0;} |
567 | | -else if(o.selected===null){o.selected=-1;} |
568 | | -o.selected=((o.selected>=0&&this.anchors[o.selected])||o.selected<0)?o.selected:0;o.disabled=$.unique(o.disabled.concat($.map(this.lis.filter('.ui-state-disabled'),function(n,i){return self.lis.index(n);}))).sort();if($.inArray(o.selected,o.disabled)!=-1){o.disabled.splice($.inArray(o.selected,o.disabled),1);} |
569 | | -this.panels.addClass('ui-tabs-hide');this.lis.removeClass('ui-tabs-selected ui-state-active');if(o.selected>=0&&this.anchors.length){this.panels.eq(o.selected).removeClass('ui-tabs-hide');this.lis.eq(o.selected).addClass('ui-tabs-selected ui-state-active');self.element.queue("tabs",function(){self._trigger('show',null,self._ui(self.anchors[o.selected],self.panels[o.selected]));});this.load(o.selected);} |
570 | | -$(window).bind('unload',function(){self.lis.add(self.anchors).unbind('.tabs');self.lis=self.anchors=self.panels=null;});} |
571 | | -else{o.selected=this.lis.index(this.lis.filter('.ui-tabs-selected'));} |
572 | | -this.element[o.collapsible?'addClass':'removeClass']('ui-tabs-collapsible');if(o.cookie){this._cookie(o.selected,o.cookie);} |
573 | | -for(var i=0,li;(li=this.lis[i]);i++){$(li)[$.inArray(i,o.disabled)!=-1&&!$(li).hasClass('ui-tabs-selected')?'addClass':'removeClass']('ui-state-disabled');} |
574 | | -if(o.cache===false){this.anchors.removeData('cache.tabs');} |
575 | | -this.lis.add(this.anchors).unbind('.tabs');if(o.event!='mouseover'){var addState=function(state,el){if(el.is(':not(.ui-state-disabled)')){el.addClass('ui-state-'+state);}};var removeState=function(state,el){el.removeClass('ui-state-'+state);};this.lis.bind('mouseover.tabs',function(){addState('hover',$(this));});this.lis.bind('mouseout.tabs',function(){removeState('hover',$(this));});this.anchors.bind('focus.tabs',function(){addState('focus',$(this).closest('li'));});this.anchors.bind('blur.tabs',function(){removeState('focus',$(this).closest('li'));});} |
576 | | -var hideFx,showFx;if(o.fx){if($.isArray(o.fx)){hideFx=o.fx[0];showFx=o.fx[1];} |
577 | | -else{hideFx=showFx=o.fx;}} |
578 | | -function resetStyle($el,fx){$el.css({display:''});if($.browser.msie&&fx.opacity){$el[0].style.removeAttribute('filter');}} |
579 | | -var showTab=showFx?function(clicked,$show){$(clicked).closest('li').removeClass('ui-state-default').addClass('ui-tabs-selected ui-state-active');$show.hide().removeClass('ui-tabs-hide').animate(showFx,showFx.duration||'normal',function(){resetStyle($show,showFx);self._trigger('show',null,self._ui(clicked,$show[0]));});}:function(clicked,$show){$(clicked).closest('li').removeClass('ui-state-default').addClass('ui-tabs-selected ui-state-active');$show.removeClass('ui-tabs-hide');self._trigger('show',null,self._ui(clicked,$show[0]));};var hideTab=hideFx?function(clicked,$hide){$hide.animate(hideFx,hideFx.duration||'normal',function(){self.lis.removeClass('ui-tabs-selected ui-state-active').addClass('ui-state-default');$hide.addClass('ui-tabs-hide');resetStyle($hide,hideFx);self.element.dequeue("tabs");});}:function(clicked,$hide,$show){self.lis.removeClass('ui-tabs-selected ui-state-active').addClass('ui-state-default');$hide.addClass('ui-tabs-hide');self.element.dequeue("tabs");};this.anchors.bind(o.event+'.tabs',function(){var el=this,$li=$(this).closest('li'),$hide=self.panels.filter(':not(.ui-tabs-hide)'),$show=$(self._sanitizeSelector(this.hash));if(($li.hasClass('ui-tabs-selected')&&!o.collapsible)||$li.hasClass('ui-state-disabled')||$li.hasClass('ui-state-processing')||self._trigger('select',null,self._ui(this,$show[0]))===false){this.blur();return false;} |
580 | | -o.selected=self.anchors.index(this);self.abort();if(o.collapsible){if($li.hasClass('ui-tabs-selected')){o.selected=-1;if(o.cookie){self._cookie(o.selected,o.cookie);} |
581 | | -self.element.queue("tabs",function(){hideTab(el,$hide);}).dequeue("tabs");this.blur();return false;} |
582 | | -else if(!$hide.length){if(o.cookie){self._cookie(o.selected,o.cookie);} |
583 | | -self.element.queue("tabs",function(){showTab(el,$show);});self.load(self.anchors.index(this));this.blur();return false;}} |
584 | | -if(o.cookie){self._cookie(o.selected,o.cookie);} |
585 | | -if($show.length){if($hide.length){self.element.queue("tabs",function(){hideTab(el,$hide);});} |
586 | | -self.element.queue("tabs",function(){showTab(el,$show);});self.load(self.anchors.index(this));} |
587 | | -else{throw'jQuery UI Tabs: Mismatching fragment identifier.';} |
588 | | -if($.browser.msie){this.blur();}});this.anchors.bind('click.tabs',function(){return false;});},destroy:function(){var o=this.options;this.abort();this.element.unbind('.tabs').removeClass('ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible').removeData('tabs');this.list.removeClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all');this.anchors.each(function(){var href=$.data(this,'href.tabs');if(href){this.href=href;} |
589 | | -var $this=$(this).unbind('.tabs');$.each(['href','load','cache'],function(i,prefix){$this.removeData(prefix+'.tabs');});});this.lis.unbind('.tabs').add(this.panels).each(function(){if($.data(this,'destroy.tabs')){$(this).remove();} |
590 | | -else{$(this).removeClass(['ui-state-default','ui-corner-top','ui-tabs-selected','ui-state-active','ui-state-hover','ui-state-focus','ui-state-disabled','ui-tabs-panel','ui-widget-content','ui-corner-bottom','ui-tabs-hide'].join(' '));}});if(o.cookie){this._cookie(null,o.cookie);}},add:function(url,label,index){if(index===undefined){index=this.anchors.length;} |
591 | | -var self=this,o=this.options,$li=$(o.tabTemplate.replace(/#\{href\}/g,url).replace(/#\{label\}/g,label)),id=!url.indexOf('#')?url.replace('#',''):this._tabId($('a',$li)[0]);$li.addClass('ui-state-default ui-corner-top').data('destroy.tabs',true);var $panel=$('#'+id);if(!$panel.length){$panel=$(o.panelTemplate).attr('id',id).data('destroy.tabs',true);} |
592 | | -$panel.addClass('ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide');if(index>=this.lis.length){$li.appendTo(this.list);$panel.appendTo(this.list[0].parentNode);} |
593 | | -else{$li.insertBefore(this.lis[index]);$panel.insertBefore(this.panels[index]);} |
594 | | -o.disabled=$.map(o.disabled,function(n,i){return n>=index?++n:n;});this._tabify();if(this.anchors.length==1){$li.addClass('ui-tabs-selected ui-state-active');$panel.removeClass('ui-tabs-hide');this.element.queue("tabs",function(){self._trigger('show',null,self._ui(self.anchors[0],self.panels[0]));});this.load(0);} |
595 | | -this._trigger('add',null,this._ui(this.anchors[index],this.panels[index]));},remove:function(index){var o=this.options,$li=this.lis.eq(index).remove(),$panel=this.panels.eq(index).remove();if($li.hasClass('ui-tabs-selected')&&this.anchors.length>1){this.select(index+(index+1<this.anchors.length?1:-1));} |
596 | | -o.disabled=$.map($.grep(o.disabled,function(n,i){return n!=index;}),function(n,i){return n>=index?--n:n;});this._tabify();this._trigger('remove',null,this._ui($li.find('a')[0],$panel[0]));},enable:function(index){var o=this.options;if($.inArray(index,o.disabled)==-1){return;} |
597 | | -this.lis.eq(index).removeClass('ui-state-disabled');o.disabled=$.grep(o.disabled,function(n,i){return n!=index;});this._trigger('enable',null,this._ui(this.anchors[index],this.panels[index]));},disable:function(index){var self=this,o=this.options;if(index!=o.selected){this.lis.eq(index).addClass('ui-state-disabled');o.disabled.push(index);o.disabled.sort();this._trigger('disable',null,this._ui(this.anchors[index],this.panels[index]));}},select:function(index){if(typeof index=='string'){index=this.anchors.index(this.anchors.filter('[href$='+index+']'));} |
598 | | -else if(index===null){index=-1;} |
599 | | -if(index==-1&&this.options.collapsible){index=this.options.selected;} |
600 | | -this.anchors.eq(index).trigger(this.options.event+'.tabs');},load:function(index){var self=this,o=this.options,a=this.anchors.eq(index)[0],url=$.data(a,'load.tabs');this.abort();if(!url||this.element.queue("tabs").length!==0&&$.data(a,'cache.tabs')){this.element.dequeue("tabs");return;} |
601 | | -this.lis.eq(index).addClass('ui-state-processing');if(o.spinner){var span=$('span',a);span.data('label.tabs',span.html()).html(o.spinner);} |
602 | | -this.xhr=$.ajax($.extend({},o.ajaxOptions,{url:url,success:function(r,s){$(self._sanitizeSelector(a.hash)).html(r);self._cleanup();if(o.cache){$.data(a,'cache.tabs',true);} |
603 | | -self._trigger('load',null,self._ui(self.anchors[index],self.panels[index]));try{o.ajaxOptions.success(r,s);} |
604 | | -catch(e){} |
605 | | -self.element.dequeue("tabs");}}));},abort:function(){this.element.queue([]);this.panels.stop(false,true);if(this.xhr){this.xhr.abort();delete this.xhr;} |
606 | | -this._cleanup();},url:function(index,url){this.anchors.eq(index).removeData('cache.tabs').data('load.tabs',url);},length:function(){return this.anchors.length;}});$.extend($.ui.tabs,{version:'1.7.2',getter:'length',defaults:{ajaxOptions:null,cache:false,cookie:null,collapsible:false,disabled:[],event:'click',fx:null,idPrefix:'ui-tabs-',panelTemplate:'<div></div>',spinner:'<em>Loading…</em>',tabTemplate:'<li><a href="#{href}"><span>#{label}</span></a></li>'}});$.extend($.ui.tabs.prototype,{rotation:null,rotate:function(ms,continuing){var self=this,o=this.options;var rotate=self._rotate||(self._rotate=function(e){clearTimeout(self.rotation);self.rotation=setTimeout(function(){var t=o.selected;self.select(++t<self.anchors.length?t:0);},ms);if(e){e.stopPropagation();}});var stop=self._unrotate||(self._unrotate=!continuing?function(e){if(e.clientX){self.rotate(null);}}:function(e){t=o.selected;rotate();});if(ms){this.element.bind('tabsshow',rotate);this.anchors.bind(o.event+'.tabs',stop);rotate();} |
607 | | -else{clearTimeout(self.rotation);this.element.unbind('tabsshow',rotate);this.anchors.unbind(o.event+'.tabs',stop);delete this._rotate;delete this._unrotate;}}});})(jQuery);(function($){$.extend($.ui,{datepicker:{version:"1.7.2"}});var PROP_NAME='datepicker';function Datepicker(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._datepickerShowing=false;this._inDialog=false;this._mainDivId='ui-datepicker-div';this._inlineClass='ui-datepicker-inline';this._appendClass='ui-datepicker-append';this._triggerClass='ui-datepicker-trigger';this._dialogClass='ui-datepicker-dialog';this._disableClass='ui-datepicker-disabled';this._unselectableClass='ui-datepicker-unselectable';this._currentClass='ui-datepicker-current-day';this._dayOverClass='ui-datepicker-days-cell-over';this.regional=[];this.regional['']={closeText:'Done',prevText:'Prev',nextText:'Next',currentText:'Today',monthNames:['January','February','March','April','May','June','July','August','September','October','November','December'],monthNamesShort:['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],dayNames:['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],dayNamesShort:['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],dayNamesMin:['Su','Mo','Tu','We','Th','Fr','Sa'],dateFormat:'mm/dd/yy',firstDay:0,isRTL:false};this._defaults={showOn:'focus',showAnim:'show',showOptions:{},defaultDate:null,appendText:'',buttonText:'...',buttonImage:'',buttonImageOnly:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:false,changeYear:false,showMonthAfterYear:false,yearRange:'-10:+10',showOtherMonths:false,calculateWeek:this.iso8601Week,shortYearCutoff:'+10',minDate:null,maxDate:null,duration:'normal',beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:'',altFormat:'',constrainInput:true,showButtonPanel:false};$.extend(this._defaults,this.regional['']);this.dpDiv=$('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible"></div>');} |
608 | | -$.extend(Datepicker.prototype,{markerClassName:'hasDatepicker',log:function(){if(this.debug) |
609 | | -console.log.apply('',arguments);},setDefaults:function(settings){extendRemove(this._defaults,settings||{});return this;},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute('date:'+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue);}catch(err){inlineSettings[attrName]=attrValue;}}} |
610 | | -var nodeName=target.nodeName.toLowerCase();var inline=(nodeName=='div'||nodeName=='span');if(!target.id) |
611 | | -target.id='dp'+(++this.uuid);var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{});if(nodeName=='input'){this._connectDatepicker(target,inst);}else if(inline){this._inlineDatepicker(target,inst);}},_newInst:function(target,inline){var id=target[0].id.replace(/([:\[\]\.])/g,'\\\\$1');return{id:id,input:target,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:inline,dpDiv:(!inline?this.dpDiv:$('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))};},_connectDatepicker:function(target,inst){var input=$(target);inst.append=$([]);inst.trigger=$([]);if(input.hasClass(this.markerClassName)) |
612 | | -return;var appendText=this._get(inst,'appendText');var isRTL=this._get(inst,'isRTL');if(appendText){inst.append=$('<span class="'+this._appendClass+'">'+appendText+'</span>');input[isRTL?'before':'after'](inst.append);} |
613 | | -var showOn=this._get(inst,'showOn');if(showOn=='focus'||showOn=='both') |
614 | | -input.focus(this._showDatepicker);if(showOn=='button'||showOn=='both'){var buttonText=this._get(inst,'buttonText');var buttonImage=this._get(inst,'buttonImage');inst.trigger=$(this._get(inst,'buttonImageOnly')?$('<img/>').addClass(this._triggerClass).attr({src:buttonImage,alt:buttonText,title:buttonText}):$('<button type="button"></button>').addClass(this._triggerClass).html(buttonImage==''?buttonText:$('<img/>').attr({src:buttonImage,alt:buttonText,title:buttonText})));input[isRTL?'before':'after'](inst.trigger);inst.trigger.click(function(){if($.datepicker._datepickerShowing&&$.datepicker._lastInput==target) |
615 | | -$.datepicker._hideDatepicker();else |
616 | | -$.datepicker._showDatepicker(target);return false;});} |
617 | | -input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value;}).bind("getData.datepicker",function(event,key){return this._get(inst,key);});$.data(target,PROP_NAME,inst);},_inlineDatepicker:function(target,inst){var divSpan=$(target);if(divSpan.hasClass(this.markerClassName)) |
618 | | -return;divSpan.addClass(this.markerClassName).append(inst.dpDiv).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value;}).bind("getData.datepicker",function(event,key){return this._get(inst,key);});$.data(target,PROP_NAME,inst);this._setDate(inst,this._getDefaultDate(inst));this._updateDatepicker(inst);this._updateAlternate(inst);},_dialogDatepicker:function(input,dateText,onSelect,settings,pos){var inst=this._dialogInst;if(!inst){var id='dp'+(++this.uuid);this._dialogInput=$('<input type="text" id="'+id+'" size="1" style="position: absolute; top: -100px;"/>');this._dialogInput.keydown(this._doKeyDown);$('body').append(this._dialogInput);inst=this._dialogInst=this._newInst(this._dialogInput,false);inst.settings={};$.data(this._dialogInput[0],PROP_NAME,inst);} |
619 | | -extendRemove(inst.settings,settings||{});this._dialogInput.val(dateText);this._pos=(pos?(pos.length?pos:[pos.pageX,pos.pageY]):null);if(!this._pos){var browserWidth=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;var browserHeight=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[(browserWidth/2)-100+scrollX,(browserHeight/2)-150+scrollY];} |
620 | | -this._dialogInput.css('left',this._pos[0]+'px').css('top',this._pos[1]+'px');inst.settings.onSelect=onSelect;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);if($.blockUI) |
621 | | -$.blockUI(this.dpDiv);$.data(this._dialogInput[0],PROP_NAME,inst);return this;},_destroyDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return;} |
622 | | -var nodeName=target.nodeName.toLowerCase();$.removeData(target,PROP_NAME);if(nodeName=='input'){inst.append.remove();inst.trigger.remove();$target.removeClass(this.markerClassName).unbind('focus',this._showDatepicker).unbind('keydown',this._doKeyDown).unbind('keypress',this._doKeyPress);}else if(nodeName=='div'||nodeName=='span') |
623 | | -$target.removeClass(this.markerClassName).empty();},_enableDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return;} |
624 | | -var nodeName=target.nodeName.toLowerCase();if(nodeName=='input'){target.disabled=false;inst.trigger.filter('button').each(function(){this.disabled=false;}).end().filter('img').css({opacity:'1.0',cursor:''});} |
625 | | -else if(nodeName=='div'||nodeName=='span'){var inline=$target.children('.'+this._inlineClass);inline.children().removeClass('ui-state-disabled');} |
626 | | -this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value);});},_disableDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return;} |
627 | | -var nodeName=target.nodeName.toLowerCase();if(nodeName=='input'){target.disabled=true;inst.trigger.filter('button').each(function(){this.disabled=true;}).end().filter('img').css({opacity:'0.5',cursor:'default'});} |
628 | | -else if(nodeName=='div'||nodeName=='span'){var inline=$target.children('.'+this._inlineClass);inline.children().addClass('ui-state-disabled');} |
629 | | -this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value);});this._disabledInputs[this._disabledInputs.length]=target;},_isDisabledDatepicker:function(target){if(!target){return false;} |
630 | | -for(var i=0;i<this._disabledInputs.length;i++){if(this._disabledInputs[i]==target) |
631 | | -return true;} |
632 | | -return false;},_getInst:function(target){try{return $.data(target,PROP_NAME);} |
633 | | -catch(err){throw'Missing instance data for this datepicker';}},_optionDatepicker:function(target,name,value){var inst=this._getInst(target);if(arguments.length==2&&typeof name=='string'){return(name=='defaults'?$.extend({},$.datepicker._defaults):(inst?(name=='all'?$.extend({},inst.settings):this._get(inst,name)):null));} |
634 | | -var settings=name||{};if(typeof name=='string'){settings={};settings[name]=value;} |
635 | | -if(inst){if(this._curInst==inst){this._hideDatepicker(null);} |
636 | | -var date=this._getDateDatepicker(target);extendRemove(inst.settings,settings);this._setDateDatepicker(target,date);this._updateDatepicker(inst);}},_changeDatepicker:function(target,name,value){this._optionDatepicker(target,name,value);},_refreshDatepicker:function(target){var inst=this._getInst(target);if(inst){this._updateDatepicker(inst);}},_setDateDatepicker:function(target,date,endDate){var inst=this._getInst(target);if(inst){this._setDate(inst,date,endDate);this._updateDatepicker(inst);this._updateAlternate(inst);}},_getDateDatepicker:function(target){var inst=this._getInst(target);if(inst&&!inst.inline) |
637 | | -this._setDateFromField(inst);return(inst?this._getDate(inst):null);},_doKeyDown:function(event){var inst=$.datepicker._getInst(event.target);var handled=true;var isRTL=inst.dpDiv.is('.ui-datepicker-rtl');inst._keyEvent=true;if($.datepicker._datepickerShowing) |
638 | | -switch(event.keyCode){case 9:$.datepicker._hideDatepicker(null,'');break;case 13:var sel=$('td.'+$.datepicker._dayOverClass+', td.'+$.datepicker._currentClass,inst.dpDiv);if(sel[0]) |
639 | | -$.datepicker._selectDay(event.target,inst.selectedMonth,inst.selectedYear,sel[0]);else |
640 | | -$.datepicker._hideDatepicker(null,$.datepicker._get(inst,'duration'));return false;break;case 27:$.datepicker._hideDatepicker(null,$.datepicker._get(inst,'duration'));break;case 33:$.datepicker._adjustDate(event.target,(event.ctrlKey?-$.datepicker._get(inst,'stepBigMonths'):-$.datepicker._get(inst,'stepMonths')),'M');break;case 34:$.datepicker._adjustDate(event.target,(event.ctrlKey?+$.datepicker._get(inst,'stepBigMonths'):+$.datepicker._get(inst,'stepMonths')),'M');break;case 35:if(event.ctrlKey||event.metaKey)$.datepicker._clearDate(event.target);handled=event.ctrlKey||event.metaKey;break;case 36:if(event.ctrlKey||event.metaKey)$.datepicker._gotoToday(event.target);handled=event.ctrlKey||event.metaKey;break;case 37:if(event.ctrlKey||event.metaKey)$.datepicker._adjustDate(event.target,(isRTL?+1:-1),'D');handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey)$.datepicker._adjustDate(event.target,(event.ctrlKey?-$.datepicker._get(inst,'stepBigMonths'):-$.datepicker._get(inst,'stepMonths')),'M');break;case 38:if(event.ctrlKey||event.metaKey)$.datepicker._adjustDate(event.target,-7,'D');handled=event.ctrlKey||event.metaKey;break;case 39:if(event.ctrlKey||event.metaKey)$.datepicker._adjustDate(event.target,(isRTL?-1:+1),'D');handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey)$.datepicker._adjustDate(event.target,(event.ctrlKey?+$.datepicker._get(inst,'stepBigMonths'):+$.datepicker._get(inst,'stepMonths')),'M');break;case 40:if(event.ctrlKey||event.metaKey)$.datepicker._adjustDate(event.target,+7,'D');handled=event.ctrlKey||event.metaKey;break;default:handled=false;} |
641 | | -else if(event.keyCode==36&&event.ctrlKey) |
642 | | -$.datepicker._showDatepicker(this);else{handled=false;} |
643 | | -if(handled){event.preventDefault();event.stopPropagation();}},_doKeyPress:function(event){var inst=$.datepicker._getInst(event.target);if($.datepicker._get(inst,'constrainInput')){var chars=$.datepicker._possibleChars($.datepicker._get(inst,'dateFormat'));var chr=String.fromCharCode(event.charCode==undefined?event.keyCode:event.charCode);return event.ctrlKey||(chr<' '||!chars||chars.indexOf(chr)>-1);}},_showDatepicker:function(input){input=input.target||input;if(input.nodeName.toLowerCase()!='input') |
644 | | -input=$('input',input.parentNode)[0];if($.datepicker._isDisabledDatepicker(input)||$.datepicker._lastInput==input) |
645 | | -return;var inst=$.datepicker._getInst(input);var beforeShow=$.datepicker._get(inst,'beforeShow');extendRemove(inst.settings,(beforeShow?beforeShow.apply(input,[input,inst]):{}));$.datepicker._hideDatepicker(null,'');$.datepicker._lastInput=input;$.datepicker._setDateFromField(inst);if($.datepicker._inDialog) |
646 | | -input.value='';if(!$.datepicker._pos){$.datepicker._pos=$.datepicker._findPos(input);$.datepicker._pos[1]+=input.offsetHeight;} |
647 | | -var isFixed=false;$(input).parents().each(function(){isFixed|=$(this).css('position')=='fixed';return!isFixed;});if(isFixed&&$.browser.opera){$.datepicker._pos[0]-=document.documentElement.scrollLeft;$.datepicker._pos[1]-=document.documentElement.scrollTop;} |
648 | | -var offset={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null;inst.rangeStart=null;inst.dpDiv.css({position:'absolute',display:'block',top:'-1000px'});$.datepicker._updateDatepicker(inst);offset=$.datepicker._checkOffset(inst,offset,isFixed);inst.dpDiv.css({position:($.datepicker._inDialog&&$.blockUI?'static':(isFixed?'fixed':'absolute')),display:'none',left:offset.left+'px',top:offset.top+'px'});if(!inst.inline){var showAnim=$.datepicker._get(inst,'showAnim')||'show';var duration=$.datepicker._get(inst,'duration');var postProcess=function(){$.datepicker._datepickerShowing=true;if($.browser.msie&&parseInt($.browser.version,10)<7) |
649 | | -$('iframe.ui-datepicker-cover').css({width:inst.dpDiv.width()+4,height:inst.dpDiv.height()+4});};if($.effects&&$.effects[showAnim]) |
650 | | -inst.dpDiv.show(showAnim,$.datepicker._get(inst,'showOptions'),duration,postProcess);else |
651 | | -inst.dpDiv[showAnim](duration,postProcess);if(duration=='') |
652 | | -postProcess();if(inst.input[0].type!='hidden') |
653 | | -inst.input[0].focus();$.datepicker._curInst=inst;}},_updateDatepicker:function(inst){var dims={width:inst.dpDiv.width()+4,height:inst.dpDiv.height()+4};var self=this;inst.dpDiv.empty().append(this._generateHTML(inst)).find('iframe.ui-datepicker-cover').css({width:dims.width,height:dims.height}).end().find('button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a').bind('mouseout',function(){$(this).removeClass('ui-state-hover');if(this.className.indexOf('ui-datepicker-prev')!=-1)$(this).removeClass('ui-datepicker-prev-hover');if(this.className.indexOf('ui-datepicker-next')!=-1)$(this).removeClass('ui-datepicker-next-hover');}).bind('mouseover',function(){if(!self._isDisabledDatepicker(inst.inline?inst.dpDiv.parent()[0]:inst.input[0])){$(this).parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover');$(this).addClass('ui-state-hover');if(this.className.indexOf('ui-datepicker-prev')!=-1)$(this).addClass('ui-datepicker-prev-hover');if(this.className.indexOf('ui-datepicker-next')!=-1)$(this).addClass('ui-datepicker-next-hover');}}).end().find('.'+this._dayOverClass+' a').trigger('mouseover').end();var numMonths=this._getNumberOfMonths(inst);var cols=numMonths[1];var width=17;if(cols>1){inst.dpDiv.addClass('ui-datepicker-multi-'+cols).css('width',(width*cols)+'em');}else{inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width('');} |
654 | | -inst.dpDiv[(numMonths[0]!=1||numMonths[1]!=1?'add':'remove')+'Class']('ui-datepicker-multi');inst.dpDiv[(this._get(inst,'isRTL')?'add':'remove')+'Class']('ui-datepicker-rtl');if(inst.input&&inst.input[0].type!='hidden'&&inst==$.datepicker._curInst) |
655 | | -$(inst.input[0]).focus();},_checkOffset:function(inst,offset,isFixed){var dpWidth=inst.dpDiv.outerWidth();var dpHeight=inst.dpDiv.outerHeight();var inputWidth=inst.input?inst.input.outerWidth():0;var inputHeight=inst.input?inst.input.outerHeight():0;var viewWidth=(window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth)+$(document).scrollLeft();var viewHeight=(window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight)+$(document).scrollTop();offset.left-=(this._get(inst,'isRTL')?(dpWidth-inputWidth):0);offset.left-=(isFixed&&offset.left==inst.input.offset().left)?$(document).scrollLeft():0;offset.top-=(isFixed&&offset.top==(inst.input.offset().top+inputHeight))?$(document).scrollTop():0;offset.left-=(offset.left+dpWidth>viewWidth&&viewWidth>dpWidth)?Math.abs(offset.left+dpWidth-viewWidth):0;offset.top-=(offset.top+dpHeight>viewHeight&&viewHeight>dpHeight)?Math.abs(offset.top+dpHeight+inputHeight*2-viewHeight):0;return offset;},_findPos:function(obj){while(obj&&(obj.type=='hidden'||obj.nodeType!=1)){obj=obj.nextSibling;} |
656 | | -var position=$(obj).offset();return[position.left,position.top];},_hideDatepicker:function(input,duration){var inst=this._curInst;if(!inst||(input&&inst!=$.data(input,PROP_NAME))) |
657 | | -return;if(inst.stayOpen) |
658 | | -this._selectDate('#'+inst.id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear));inst.stayOpen=false;if(this._datepickerShowing){duration=(duration!=null?duration:this._get(inst,'duration'));var showAnim=this._get(inst,'showAnim');var postProcess=function(){$.datepicker._tidyDialog(inst);};if(duration!=''&&$.effects&&$.effects[showAnim]) |
659 | | -inst.dpDiv.hide(showAnim,$.datepicker._get(inst,'showOptions'),duration,postProcess);else |
660 | | -inst.dpDiv[(duration==''?'hide':(showAnim=='slideDown'?'slideUp':(showAnim=='fadeIn'?'fadeOut':'hide')))](duration,postProcess);if(duration=='') |
661 | | -this._tidyDialog(inst);var onClose=this._get(inst,'onClose');if(onClose) |
662 | | -onClose.apply((inst.input?inst.input[0]:null),[(inst.input?inst.input.val():''),inst]);this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:'absolute',left:'0',top:'-100px'});if($.blockUI){$.unblockUI();$('body').append(this.dpDiv);}} |
663 | | -this._inDialog=false;} |
664 | | -this._curInst=null;},_tidyDialog:function(inst){inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker-calendar');},_checkExternalClick:function(event){if(!$.datepicker._curInst) |
665 | | -return;var $target=$(event.target);if(($target.parents('#'+$.datepicker._mainDivId).length==0)&&!$target.hasClass($.datepicker.markerClassName)&&!$target.hasClass($.datepicker._triggerClass)&&$.datepicker._datepickerShowing&&!($.datepicker._inDialog&&$.blockUI)) |
666 | | -$.datepicker._hideDatepicker(null,'');},_adjustDate:function(id,offset,period){var target=$(id);var inst=this._getInst(target[0]);if(this._isDisabledDatepicker(target[0])){return;} |
667 | | -this._adjustInstDate(inst,offset+ |
668 | | -(period=='M'?this._get(inst,'showCurrentAtPos'):0),period);this._updateDatepicker(inst);},_gotoToday:function(id){var target=$(id);var inst=this._getInst(target[0]);if(this._get(inst,'gotoCurrent')&&inst.currentDay){inst.selectedDay=inst.currentDay;inst.drawMonth=inst.selectedMonth=inst.currentMonth;inst.drawYear=inst.selectedYear=inst.currentYear;} |
669 | | -else{var date=new Date();inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();} |
670 | | -this._notifyChange(inst);this._adjustDate(target);},_selectMonthYear:function(id,select,period){var target=$(id);var inst=this._getInst(target[0]);inst._selectingMonthYear=false;inst['selected'+(period=='M'?'Month':'Year')]=inst['draw'+(period=='M'?'Month':'Year')]=parseInt(select.options[select.selectedIndex].value,10);this._notifyChange(inst);this._adjustDate(target);},_clickMonthYear:function(id){var target=$(id);var inst=this._getInst(target[0]);if(inst.input&&inst._selectingMonthYear&&!$.browser.msie) |
671 | | -inst.input[0].focus();inst._selectingMonthYear=!inst._selectingMonthYear;},_selectDay:function(id,month,year,td){var target=$(id);if($(td).hasClass(this._unselectableClass)||this._isDisabledDatepicker(target[0])){return;} |
672 | | -var inst=this._getInst(target[0]);inst.selectedDay=inst.currentDay=$('a',td).html();inst.selectedMonth=inst.currentMonth=month;inst.selectedYear=inst.currentYear=year;if(inst.stayOpen){inst.endDay=inst.endMonth=inst.endYear=null;} |
673 | | -this._selectDate(id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear));if(inst.stayOpen){inst.rangeStart=this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay));this._updateDatepicker(inst);}},_clearDate:function(id){var target=$(id);var inst=this._getInst(target[0]);inst.stayOpen=false;inst.endDay=inst.endMonth=inst.endYear=inst.rangeStart=null;this._selectDate(target,'');},_selectDate:function(id,dateStr){var target=$(id);var inst=this._getInst(target[0]);dateStr=(dateStr!=null?dateStr:this._formatDate(inst));if(inst.input) |
674 | | -inst.input.val(dateStr);this._updateAlternate(inst);var onSelect=this._get(inst,'onSelect');if(onSelect) |
675 | | -onSelect.apply((inst.input?inst.input[0]:null),[dateStr,inst]);else if(inst.input) |
676 | | -inst.input.trigger('change');if(inst.inline) |
677 | | -this._updateDatepicker(inst);else if(!inst.stayOpen){this._hideDatepicker(null,this._get(inst,'duration'));this._lastInput=inst.input[0];if(typeof(inst.input[0])!='object') |
678 | | -inst.input[0].focus();this._lastInput=null;}},_updateAlternate:function(inst){var altField=this._get(inst,'altField');if(altField){var altFormat=this._get(inst,'altFormat')||this._get(inst,'dateFormat');var date=this._getDate(inst);dateStr=this.formatDate(altFormat,date,this._getFormatConfig(inst));$(altField).each(function(){$(this).val(dateStr);});}},noWeekends:function(date){var day=date.getDay();return[(day>0&&day<6),''];},iso8601Week:function(date){var checkDate=new Date(date.getFullYear(),date.getMonth(),date.getDate());var firstMon=new Date(checkDate.getFullYear(),1-1,4);var firstDay=firstMon.getDay()||7;firstMon.setDate(firstMon.getDate()+1-firstDay);if(firstDay<4&&checkDate<firstMon){checkDate.setDate(checkDate.getDate()-3);return $.datepicker.iso8601Week(checkDate);}else if(checkDate>new Date(checkDate.getFullYear(),12-1,28)){firstDay=new Date(checkDate.getFullYear()+1,1-1,4).getDay()||7;if(firstDay>4&&(checkDate.getDay()||7)<firstDay-3){return 1;}} |
679 | | -return Math.floor(((checkDate-firstMon)/86400000)/7)+1;},parseDate:function(format,value,settings){if(format==null||value==null) |
680 | | -throw'Invalid arguments';value=(typeof value=='object'?value.toString():value+'');if(value=='') |
681 | | -return null;var shortYearCutoff=(settings?settings.shortYearCutoff:null)||this._defaults.shortYearCutoff;var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var year=-1;var month=-1;var day=-1;var doy=-1;var literal=false;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches) |
682 | | -iFormat++;return matches;};var getNumber=function(match){lookAhead(match);var origSize=(match=='@'?14:(match=='y'?4:(match=='o'?3:2)));var size=origSize;var num=0;while(size>0&&iValue<value.length&&value.charAt(iValue)>='0'&&value.charAt(iValue)<='9'){num=num*10+parseInt(value.charAt(iValue++),10);size--;} |
683 | | -if(size==origSize) |
684 | | -throw'Missing number at position '+iValue;return num;};var getName=function(match,shortNames,longNames){var names=(lookAhead(match)?longNames:shortNames);var size=0;for(var j=0;j<names.length;j++) |
685 | | -size=Math.max(size,names[j].length);var name='';var iInit=iValue;while(size>0&&iValue<value.length){name+=value.charAt(iValue++);for(var i=0;i<names.length;i++) |
686 | | -if(name==names[i]) |
687 | | -return i+1;size--;} |
688 | | -throw'Unknown name at position '+iInit;};var checkLiteral=function(){if(value.charAt(iValue)!=format.charAt(iFormat)) |
689 | | -throw'Unexpected literal at position '+iValue;iValue++;};var iValue=0;for(var iFormat=0;iFormat<format.length;iFormat++){if(literal) |
690 | | -if(format.charAt(iFormat)=="'"&&!lookAhead("'")) |
691 | | -literal=false;else |
692 | | -checkLiteral();else |
693 | | -switch(format.charAt(iFormat)){case'd':day=getNumber('d');break;case'D':getName('D',dayNamesShort,dayNames);break;case'o':doy=getNumber('o');break;case'm':month=getNumber('m');break;case'M':month=getName('M',monthNamesShort,monthNames);break;case'y':year=getNumber('y');break;case'@':var date=new Date(getNumber('@'));year=date.getFullYear();month=date.getMonth()+1;day=date.getDate();break;case"'":if(lookAhead("'")) |
694 | | -checkLiteral();else |
695 | | -literal=true;break;default:checkLiteral();}} |
696 | | -if(year==-1) |
697 | | -year=new Date().getFullYear();else if(year<100) |
698 | | -year+=new Date().getFullYear()-new Date().getFullYear()%100+ |
699 | | -(year<=shortYearCutoff?0:-100);if(doy>-1){month=1;day=doy;do{var dim=this._getDaysInMonth(year,month-1);if(day<=dim) |
700 | | -break;month++;day-=dim;}while(true);} |
701 | | -var date=this._daylightSavingAdjust(new Date(year,month-1,day));if(date.getFullYear()!=year||date.getMonth()+1!=month||date.getDate()!=day) |
702 | | -throw'Invalid date';return date;},ATOM:'yy-mm-dd',COOKIE:'D, dd M yy',ISO_8601:'yy-mm-dd',RFC_822:'D, d M y',RFC_850:'DD, dd-M-y',RFC_1036:'D, d M y',RFC_1123:'D, d M yy',RFC_2822:'D, d M yy',RSS:'D, d M y',TIMESTAMP:'@',W3C:'yy-mm-dd',formatDate:function(format,date,settings){if(!date) |
703 | | -return'';var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches) |
704 | | -iFormat++;return matches;};var formatNumber=function(match,value,len){var num=''+value;if(lookAhead(match)) |
705 | | -while(num.length<len) |
706 | | -num='0'+num;return num;};var formatName=function(match,value,shortNames,longNames){return(lookAhead(match)?longNames[value]:shortNames[value]);};var output='';var literal=false;if(date) |
707 | | -for(var iFormat=0;iFormat<format.length;iFormat++){if(literal) |
708 | | -if(format.charAt(iFormat)=="'"&&!lookAhead("'")) |
709 | | -literal=false;else |
710 | | -output+=format.charAt(iFormat);else |
711 | | -switch(format.charAt(iFormat)){case'd':output+=formatNumber('d',date.getDate(),2);break;case'D':output+=formatName('D',date.getDay(),dayNamesShort,dayNames);break;case'o':var doy=date.getDate();for(var m=date.getMonth()-1;m>=0;m--) |
712 | | -doy+=this._getDaysInMonth(date.getFullYear(),m);output+=formatNumber('o',doy,3);break;case'm':output+=formatNumber('m',date.getMonth()+1,2);break;case'M':output+=formatName('M',date.getMonth(),monthNamesShort,monthNames);break;case'y':output+=(lookAhead('y')?date.getFullYear():(date.getYear()%100<10?'0':'')+date.getYear()%100);break;case'@':output+=date.getTime();break;case"'":if(lookAhead("'")) |
713 | | -output+="'";else |
714 | | -literal=true;break;default:output+=format.charAt(iFormat);}} |
715 | | -return output;},_possibleChars:function(format){var chars='';var literal=false;for(var iFormat=0;iFormat<format.length;iFormat++) |
716 | | -if(literal) |
717 | | -if(format.charAt(iFormat)=="'"&&!lookAhead("'")) |
718 | | -literal=false;else |
719 | | -chars+=format.charAt(iFormat);else |
720 | | -switch(format.charAt(iFormat)){case'd':case'm':case'y':case'@':chars+='0123456789';break;case'D':case'M':return null;case"'":if(lookAhead("'")) |
721 | | -chars+="'";else |
722 | | -literal=true;break;default:chars+=format.charAt(iFormat);} |
723 | | -return chars;},_get:function(inst,name){return inst.settings[name]!==undefined?inst.settings[name]:this._defaults[name];},_setDateFromField:function(inst){var dateFormat=this._get(inst,'dateFormat');var dates=inst.input?inst.input.val():null;inst.endDay=inst.endMonth=inst.endYear=null;var date=defaultDate=this._getDefaultDate(inst);var settings=this._getFormatConfig(inst);try{date=this.parseDate(dateFormat,dates,settings)||defaultDate;}catch(event){this.log(event);date=defaultDate;} |
724 | | -inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();inst.currentDay=(dates?date.getDate():0);inst.currentMonth=(dates?date.getMonth():0);inst.currentYear=(dates?date.getFullYear():0);this._adjustInstDate(inst);},_getDefaultDate:function(inst){var date=this._determineDate(this._get(inst,'defaultDate'),new Date());var minDate=this._getMinMaxDate(inst,'min',true);var maxDate=this._getMinMaxDate(inst,'max');date=(minDate&&date<minDate?minDate:date);date=(maxDate&&date>maxDate?maxDate:date);return date;},_determineDate:function(date,defaultDate){var offsetNumeric=function(offset){var date=new Date();date.setDate(date.getDate()+offset);return date;};var offsetString=function(offset,getDaysInMonth){var date=new Date();var year=date.getFullYear();var month=date.getMonth();var day=date.getDate();var pattern=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;var matches=pattern.exec(offset);while(matches){switch(matches[2]||'d'){case'd':case'D':day+=parseInt(matches[1],10);break;case'w':case'W':day+=parseInt(matches[1],10)*7;break;case'm':case'M':month+=parseInt(matches[1],10);day=Math.min(day,getDaysInMonth(year,month));break;case'y':case'Y':year+=parseInt(matches[1],10);day=Math.min(day,getDaysInMonth(year,month));break;} |
725 | | -matches=pattern.exec(offset);} |
726 | | -return new Date(year,month,day);};date=(date==null?defaultDate:(typeof date=='string'?offsetString(date,this._getDaysInMonth):(typeof date=='number'?(isNaN(date)?defaultDate:offsetNumeric(date)):date)));date=(date&&date.toString()=='Invalid Date'?defaultDate:date);if(date){date.setHours(0);date.setMinutes(0);date.setSeconds(0);date.setMilliseconds(0);} |
727 | | -return this._daylightSavingAdjust(date);},_daylightSavingAdjust:function(date){if(!date)return null;date.setHours(date.getHours()>12?date.getHours()+2:0);return date;},_setDate:function(inst,date,endDate){var clear=!(date);var origMonth=inst.selectedMonth;var origYear=inst.selectedYear;date=this._determineDate(date,new Date());inst.selectedDay=inst.currentDay=date.getDate();inst.drawMonth=inst.selectedMonth=inst.currentMonth=date.getMonth();inst.drawYear=inst.selectedYear=inst.currentYear=date.getFullYear();if(origMonth!=inst.selectedMonth||origYear!=inst.selectedYear) |
728 | | -this._notifyChange(inst);this._adjustInstDate(inst);if(inst.input){inst.input.val(clear?'':this._formatDate(inst));}},_getDate:function(inst){var startDate=(!inst.currentYear||(inst.input&&inst.input.val()=='')?null:this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return startDate;},_generateHTML:function(inst){var today=new Date();today=this._daylightSavingAdjust(new Date(today.getFullYear(),today.getMonth(),today.getDate()));var isRTL=this._get(inst,'isRTL');var showButtonPanel=this._get(inst,'showButtonPanel');var hideIfNoPrevNext=this._get(inst,'hideIfNoPrevNext');var navigationAsDateFormat=this._get(inst,'navigationAsDateFormat');var numMonths=this._getNumberOfMonths(inst);var showCurrentAtPos=this._get(inst,'showCurrentAtPos');var stepMonths=this._get(inst,'stepMonths');var stepBigMonths=this._get(inst,'stepBigMonths');var isMultiMonth=(numMonths[0]!=1||numMonths[1]!=1);var currentDate=this._daylightSavingAdjust((!inst.currentDay?new Date(9999,9,9):new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));var minDate=this._getMinMaxDate(inst,'min',true);var maxDate=this._getMinMaxDate(inst,'max');var drawMonth=inst.drawMonth-showCurrentAtPos;var drawYear=inst.drawYear;if(drawMonth<0){drawMonth+=12;drawYear--;} |
729 | | -if(maxDate){var maxDraw=this._daylightSavingAdjust(new Date(maxDate.getFullYear(),maxDate.getMonth()-numMonths[1]+1,maxDate.getDate()));maxDraw=(minDate&&maxDraw<minDate?minDate:maxDraw);while(this._daylightSavingAdjust(new Date(drawYear,drawMonth,1))>maxDraw){drawMonth--;if(drawMonth<0){drawMonth=11;drawYear--;}}} |
730 | | -inst.drawMonth=drawMonth;inst.drawYear=drawYear;var prevText=this._get(inst,'prevText');prevText=(!navigationAsDateFormat?prevText:this.formatDate(prevText,this._daylightSavingAdjust(new Date(drawYear,drawMonth-stepMonths,1)),this._getFormatConfig(inst)));var prev=(this._canAdjustMonth(inst,-1,drawYear,drawMonth)?'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery.datepicker._adjustDate(\'#'+inst.id+'\', -'+stepMonths+', \'M\');"'+' title="'+prevText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?'e':'w')+'">'+prevText+'</span></a>':(hideIfNoPrevNext?'':'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+prevText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?'e':'w')+'">'+prevText+'</span></a>'));var nextText=this._get(inst,'nextText');nextText=(!navigationAsDateFormat?nextText:this.formatDate(nextText,this._daylightSavingAdjust(new Date(drawYear,drawMonth+stepMonths,1)),this._getFormatConfig(inst)));var next=(this._canAdjustMonth(inst,+1,drawYear,drawMonth)?'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery.datepicker._adjustDate(\'#'+inst.id+'\', +'+stepMonths+', \'M\');"'+' title="'+nextText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?'w':'e')+'">'+nextText+'</span></a>':(hideIfNoPrevNext?'':'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+nextText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?'w':'e')+'">'+nextText+'</span></a>'));var currentText=this._get(inst,'currentText');var gotoDate=(this._get(inst,'gotoCurrent')&&inst.currentDay?currentDate:today);currentText=(!navigationAsDateFormat?currentText:this.formatDate(currentText,gotoDate,this._getFormatConfig(inst)));var controls=(!inst.inline?'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery.datepicker._hideDatepicker();">'+this._get(inst,'closeText')+'</button>':'');var buttonPanel=(showButtonPanel)?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(isRTL?controls:'')+ |
731 | | -(this._isInRange(inst,gotoDate)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery.datepicker._gotoToday(\'#'+inst.id+'\');"'+'>'+currentText+'</button>':'')+(isRTL?'':controls)+'</div>':'';var firstDay=parseInt(this._get(inst,'firstDay'),10);firstDay=(isNaN(firstDay)?0:firstDay);var dayNames=this._get(inst,'dayNames');var dayNamesShort=this._get(inst,'dayNamesShort');var dayNamesMin=this._get(inst,'dayNamesMin');var monthNames=this._get(inst,'monthNames');var monthNamesShort=this._get(inst,'monthNamesShort');var beforeShowDay=this._get(inst,'beforeShowDay');var showOtherMonths=this._get(inst,'showOtherMonths');var calculateWeek=this._get(inst,'calculateWeek')||this.iso8601Week;var endDate=inst.endDay?this._daylightSavingAdjust(new Date(inst.endYear,inst.endMonth,inst.endDay)):currentDate;var defaultDate=this._getDefaultDate(inst);var html='';for(var row=0;row<numMonths[0];row++){var group='';for(var col=0;col<numMonths[1];col++){var selectedDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,inst.selectedDay));var cornerClass=' ui-corner-all';var calender='';if(isMultiMonth){calender+='<div class="ui-datepicker-group ui-datepicker-group-';switch(col){case 0:calender+='first';cornerClass=' ui-corner-'+(isRTL?'right':'left');break;case numMonths[1]-1:calender+='last';cornerClass=' ui-corner-'+(isRTL?'left':'right');break;default:calender+='middle';cornerClass='';break;} |
732 | | -calender+='">';} |
733 | | -calender+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+cornerClass+'">'+ |
734 | | -(/all|left/.test(cornerClass)&&row==0?(isRTL?next:prev):'')+ |
735 | | -(/all|right/.test(cornerClass)&&row==0?(isRTL?prev:next):'')+ |
736 | | -this._generateMonthYearHeader(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,row>0||col>0,monthNames,monthNamesShort)+'</div><table class="ui-datepicker-calendar"><thead>'+'<tr>';var thead='';for(var dow=0;dow<7;dow++){var day=(dow+firstDay)%7;thead+='<th'+((dow+firstDay+6)%7>=5?' class="ui-datepicker-week-end"':'')+'>'+'<span title="'+dayNames[day]+'">'+dayNamesMin[day]+'</span></th>';} |
737 | | -calender+=thead+'</tr></thead><tbody>';var daysInMonth=this._getDaysInMonth(drawYear,drawMonth);if(drawYear==inst.selectedYear&&drawMonth==inst.selectedMonth) |
738 | | -inst.selectedDay=Math.min(inst.selectedDay,daysInMonth);var leadDays=(this._getFirstDayOfMonth(drawYear,drawMonth)-firstDay+7)%7;var numRows=(isMultiMonth?6:Math.ceil((leadDays+daysInMonth)/7));var printDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,1-leadDays));for(var dRow=0;dRow<numRows;dRow++){calender+='<tr>';var tbody='';for(var dow=0;dow<7;dow++){var daySettings=(beforeShowDay?beforeShowDay.apply((inst.input?inst.input[0]:null),[printDate]):[true,'']);var otherMonth=(printDate.getMonth()!=drawMonth);var unselectable=otherMonth||!daySettings[0]||(minDate&&printDate<minDate)||(maxDate&&printDate>maxDate);tbody+='<td class="'+ |
739 | | -((dow+firstDay+6)%7>=5?' ui-datepicker-week-end':'')+ |
740 | | -(otherMonth?' ui-datepicker-other-month':'')+ |
741 | | -((printDate.getTime()==selectedDate.getTime()&&drawMonth==inst.selectedMonth&&inst._keyEvent)||(defaultDate.getTime()==printDate.getTime()&&defaultDate.getTime()==selectedDate.getTime())?' '+this._dayOverClass:'')+ |
742 | | -(unselectable?' '+this._unselectableClass+' ui-state-disabled':'')+ |
743 | | -(otherMonth&&!showOtherMonths?'':' '+daySettings[1]+ |
744 | | -(printDate.getTime()>=currentDate.getTime()&&printDate.getTime()<=endDate.getTime()?' '+this._currentClass:'')+ |
745 | | -(printDate.getTime()==today.getTime()?' ui-datepicker-today':''))+'"'+ |
746 | | -((!otherMonth||showOtherMonths)&&daySettings[2]?' title="'+daySettings[2]+'"':'')+ |
747 | | -(unselectable?'':' onclick="DP_jQuery.datepicker._selectDay(\'#'+ |
748 | | -inst.id+'\','+drawMonth+','+drawYear+', this);return false;"')+'>'+ |
749 | | -(otherMonth?(showOtherMonths?printDate.getDate():' '):(unselectable?'<span class="ui-state-default">'+printDate.getDate()+'</span>':'<a class="ui-state-default'+ |
750 | | -(printDate.getTime()==today.getTime()?' ui-state-highlight':'')+ |
751 | | -(printDate.getTime()>=currentDate.getTime()&&printDate.getTime()<=endDate.getTime()?' ui-state-active':'')+'" href="#">'+printDate.getDate()+'</a>'))+'</td>';printDate.setDate(printDate.getDate()+1);printDate=this._daylightSavingAdjust(printDate);} |
752 | | -calender+=tbody+'</tr>';} |
753 | | -drawMonth++;if(drawMonth>11){drawMonth=0;drawYear++;} |
754 | | -calender+='</tbody></table>'+(isMultiMonth?'</div>'+ |
755 | | -((numMonths[0]>0&&col==numMonths[1]-1)?'<div class="ui-datepicker-row-break"></div>':''):'');group+=calender;} |
756 | | -html+=group;} |
757 | | -html+=buttonPanel+($.browser.msie&&parseInt($.browser.version,10)<7&&!inst.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':'');inst._keyEvent=false;return html;},_generateMonthYearHeader:function(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,secondary,monthNames,monthNamesShort){minDate=(inst.rangeStart&&minDate&&selectedDate<minDate?selectedDate:minDate);var changeMonth=this._get(inst,'changeMonth');var changeYear=this._get(inst,'changeYear');var showMonthAfterYear=this._get(inst,'showMonthAfterYear');var html='<div class="ui-datepicker-title">';var monthHtml='';if(secondary||!changeMonth) |
758 | | -monthHtml+='<span class="ui-datepicker-month">'+monthNames[drawMonth]+'</span> ';else{var inMinYear=(minDate&&minDate.getFullYear()==drawYear);var inMaxYear=(maxDate&&maxDate.getFullYear()==drawYear);monthHtml+='<select class="ui-datepicker-month" '+'onchange="DP_jQuery.datepicker._selectMonthYear(\'#'+inst.id+'\', this, \'M\');" '+'onclick="DP_jQuery.datepicker._clickMonthYear(\'#'+inst.id+'\');"'+'>';for(var month=0;month<12;month++){if((!inMinYear||month>=minDate.getMonth())&&(!inMaxYear||month<=maxDate.getMonth())) |
759 | | -monthHtml+='<option value="'+month+'"'+ |
760 | | -(month==drawMonth?' selected="selected"':'')+'>'+monthNamesShort[month]+'</option>';} |
761 | | -monthHtml+='</select>';} |
762 | | -if(!showMonthAfterYear) |
763 | | -html+=monthHtml+((secondary||changeMonth||changeYear)&&(!(changeMonth&&changeYear))?' ':'');if(secondary||!changeYear) |
764 | | -html+='<span class="ui-datepicker-year">'+drawYear+'</span>';else{var years=this._get(inst,'yearRange').split(':');var year=0;var endYear=0;if(years.length!=2){year=drawYear-10;endYear=drawYear+10;}else if(years[0].charAt(0)=='+'||years[0].charAt(0)=='-'){year=drawYear+parseInt(years[0],10);endYear=drawYear+parseInt(years[1],10);}else{year=parseInt(years[0],10);endYear=parseInt(years[1],10);} |
765 | | -year=(minDate?Math.max(year,minDate.getFullYear()):year);endYear=(maxDate?Math.min(endYear,maxDate.getFullYear()):endYear);html+='<select class="ui-datepicker-year" '+'onchange="DP_jQuery.datepicker._selectMonthYear(\'#'+inst.id+'\', this, \'Y\');" '+'onclick="DP_jQuery.datepicker._clickMonthYear(\'#'+inst.id+'\');"'+'>';for(;year<=endYear;year++){html+='<option value="'+year+'"'+ |
766 | | -(year==drawYear?' selected="selected"':'')+'>'+year+'</option>';} |
767 | | -html+='</select>';} |
768 | | -if(showMonthAfterYear) |
769 | | -html+=(secondary||changeMonth||changeYear?' ':'')+monthHtml;html+='</div>';return html;},_adjustInstDate:function(inst,offset,period){var year=inst.drawYear+(period=='Y'?offset:0);var month=inst.drawMonth+(period=='M'?offset:0);var day=Math.min(inst.selectedDay,this._getDaysInMonth(year,month))+ |
770 | | -(period=='D'?offset:0);var date=this._daylightSavingAdjust(new Date(year,month,day));var minDate=this._getMinMaxDate(inst,'min',true);var maxDate=this._getMinMaxDate(inst,'max');date=(minDate&&date<minDate?minDate:date);date=(maxDate&&date>maxDate?maxDate:date);inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();if(period=='M'||period=='Y') |
771 | | -this._notifyChange(inst);},_notifyChange:function(inst){var onChange=this._get(inst,'onChangeMonthYear');if(onChange) |
772 | | -onChange.apply((inst.input?inst.input[0]:null),[inst.selectedYear,inst.selectedMonth+1,inst]);},_getNumberOfMonths:function(inst){var numMonths=this._get(inst,'numberOfMonths');return(numMonths==null?[1,1]:(typeof numMonths=='number'?[1,numMonths]:numMonths));},_getMinMaxDate:function(inst,minMax,checkRange){var date=this._determineDate(this._get(inst,minMax+'Date'),null);return(!checkRange||!inst.rangeStart?date:(!date||inst.rangeStart>date?inst.rangeStart:date));},_getDaysInMonth:function(year,month){return 32-new Date(year,month,32).getDate();},_getFirstDayOfMonth:function(year,month){return new Date(year,month,1).getDay();},_canAdjustMonth:function(inst,offset,curYear,curMonth){var numMonths=this._getNumberOfMonths(inst);var date=this._daylightSavingAdjust(new Date(curYear,curMonth+(offset<0?offset:numMonths[1]),1));if(offset<0) |
773 | | -date.setDate(this._getDaysInMonth(date.getFullYear(),date.getMonth()));return this._isInRange(inst,date);},_isInRange:function(inst,date){var newMinDate=(!inst.rangeStart?null:this._daylightSavingAdjust(new Date(inst.selectedYear,inst.selectedMonth,inst.selectedDay)));newMinDate=(newMinDate&&inst.rangeStart<newMinDate?inst.rangeStart:newMinDate);var minDate=newMinDate||this._getMinMaxDate(inst,'min');var maxDate=this._getMinMaxDate(inst,'max');return((!minDate||date>=minDate)&&(!maxDate||date<=maxDate));},_getFormatConfig:function(inst){var shortYearCutoff=this._get(inst,'shortYearCutoff');shortYearCutoff=(typeof shortYearCutoff!='string'?shortYearCutoff:new Date().getFullYear()%100+parseInt(shortYearCutoff,10));return{shortYearCutoff:shortYearCutoff,dayNamesShort:this._get(inst,'dayNamesShort'),dayNames:this._get(inst,'dayNames'),monthNamesShort:this._get(inst,'monthNamesShort'),monthNames:this._get(inst,'monthNames')};},_formatDate:function(inst,day,month,year){if(!day){inst.currentDay=inst.selectedDay;inst.currentMonth=inst.selectedMonth;inst.currentYear=inst.selectedYear;} |
774 | | -var date=(day?(typeof day=='object'?day:this._daylightSavingAdjust(new Date(year,month,day))):this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return this.formatDate(this._get(inst,'dateFormat'),date,this._getFormatConfig(inst));}});function extendRemove(target,props){$.extend(target,props);for(var name in props) |
775 | | -if(props[name]==null||props[name]==undefined) |
776 | | -target[name]=props[name];return target;};function isArray(a){return(a&&(($.browser.safari&&typeof a=='object'&&a.length)||(a.constructor&&a.constructor.toString().match(/\Array\(\)/))));};$.fn.datepicker=function(options){if(!$.datepicker.initialized){$(document).mousedown($.datepicker._checkExternalClick).find('body').append($.datepicker.dpDiv);$.datepicker.initialized=true;} |
777 | | -var otherArgs=Array.prototype.slice.call(arguments,1);if(typeof options=='string'&&(options=='isDisabled'||options=='getDate')) |
778 | | -return $.datepicker['_'+options+'Datepicker'].apply($.datepicker,[this[0]].concat(otherArgs));if(options=='option'&&arguments.length==2&&typeof arguments[1]=='string') |
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 | | -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 | | -return ms;}else{return'['+key+']';}} |
782 | | -$j=jQuery.noConflict();function js2AddOnloadHook(func){$j(document).ready(func);} |
\ No newline at end of file |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -93,13 +93,24 @@ |
94 | 94 | if ( $text.outerWidth() > $(this).innerWidth() ) { |
95 | 95 | switch ( options.position ) { |
96 | 96 | case 'right': |
97 | | - var l = text.length; |
98 | | - while ( $text.outerWidth() > $(this).innerWidth() && l > 0 ) { |
99 | | - $text.text( text.substr( 0, l ) + '...' ); |
100 | | - l--; |
101 | | - } |
| 97 | + // Use binary search-like technique for |
| 98 | + // efficiency |
| 99 | + var l = 0, r = text.length; |
| 100 | + var ow, iw; |
| 101 | + do { |
| 102 | + var m = Math.ceil( ( l + r ) / 2 ); |
| 103 | + $text.text( text.substr( 0, m ) + '...' ); |
| 104 | + ow = $text.outerWidth(); |
| 105 | + iw = $(this).innerWidth(); |
| 106 | + if ( ow > iw ) |
| 107 | + // Text is too long |
| 108 | + r = m - 1; |
| 109 | + else |
| 110 | + l = m; |
| 111 | + } while ( l < r ); |
102 | 112 | break; |
103 | 113 | case 'center': |
| 114 | + // TODO: Use binary search like for 'right' |
104 | 115 | var i = [Math.round( text.length / 2 ), Math.round( text.length / 2 )]; |
105 | 116 | var side = 1; // Begin with making the end shorter |
106 | 117 | while ( $text.outerWidth() > ( $(this).innerWidth() ) && i[0] > 0 ) { |
— | — | @@ -117,6 +128,7 @@ |
118 | 129 | } |
119 | 130 | break; |
120 | 131 | case 'left': |
| 132 | + // TODO: Use binary search like for 'right' |
121 | 133 | var r = 0; |
122 | 134 | while ( $text.outerWidth() > $(this).innerWidth() && r < text.length ) { |
123 | 135 | $text.text( '...' + text.substr( r ) ); |
— | — | @@ -930,9 +942,9 @@ |
931 | 943 | * Get the position (in resolution of bytes not nessecarily characters) |
932 | 944 | * in a textarea |
933 | 945 | */ |
934 | | - getCaretPosition: function() { |
| 946 | + getCaretPosition: function( startAndEnd ) { |
935 | 947 | function getCaret( e ) { |
936 | | - var caretPos = 0; |
| 948 | + var caretPos = 0, endPos = 0; |
937 | 949 | if ( $.browser.msie ) { |
938 | 950 | // IE Support |
939 | 951 | var postFinished = false; |
— | — | @@ -1002,11 +1014,13 @@ |
1003 | 1015 | } |
1004 | 1016 | } while ( ( !postFinished || !periFinished || !postFinished ) ); |
1005 | 1017 | caretPos = rawPreText.replace( /\r\n/g, "\n" ).length; |
| 1018 | + endPos = caretPos + rawPeriText.replace( /\r\n/g, "\n" ).length; |
1006 | 1019 | } else if ( e.selectionStart || e.selectionStart == '0' ) { |
1007 | 1020 | // Firefox support |
1008 | 1021 | caretPos = e.selectionStart; |
| 1022 | + endPos = e.selectionEnd; |
1009 | 1023 | } |
1010 | | - return caretPos; |
| 1024 | + return startAndEnd ? [ caretPos, endPos ] : caretPos; |
1011 | 1025 | } |
1012 | 1026 | return getCaret( this.get( 0 ) ); |
1013 | 1027 | }, |
— | — | @@ -1015,8 +1029,16 @@ |
1016 | 1030 | end = start; |
1017 | 1031 | return this.each( function() { |
1018 | 1032 | if ( this.selectionStart || this.selectionStart == '0' ) { |
1019 | | - this.selectionStart = start; |
1020 | | - this.selectionEnd = end; |
| 1033 | + // Opera 9.0 doesn't allow setting selectionStart past |
| 1034 | + // selectionEnd; any attempts to do that will be ignored |
| 1035 | + // Make sure to set them in the right order |
| 1036 | + if ( start > this.selectionEnd ) { |
| 1037 | + this.selectionEnd = end; |
| 1038 | + this.selectionStart = start; |
| 1039 | + } else { |
| 1040 | + this.selectionStart = start; |
| 1041 | + this.selectionEnd = end; |
| 1042 | + } |
1021 | 1043 | } else if ( document.body.createTextRange ) { |
1022 | 1044 | var selection = document.body.createTextRange(); |
1023 | 1045 | selection.moveToElementText( this ); |
— | — | @@ -1084,7 +1106,6 @@ |
1085 | 1107 | return ( $.os.name == 'mac' ? 13 : ( $.os.name == 'linux' ? 15 : 16 ) ) * row; |
1086 | 1108 | } |
1087 | 1109 | return this.each(function() { |
1088 | | - $(this).focus(); |
1089 | 1110 | if ( this.selectionStart || this.selectionStart == '0' ) { |
1090 | 1111 | // Mozilla |
1091 | 1112 | var scroll = getCaretScrollPosition( this ); |
— | — | @@ -1136,9 +1157,38 @@ |
1137 | 1158 | $.wikiEditor = { |
1138 | 1159 | 'modules': {}, |
1139 | 1160 | 'instances': [], |
1140 | | - 'supportedBrowsers': { |
1141 | | - 'ltr': { 'msie': 7, 'firefox': 2, 'opera': 9, 'safari': 3, 'chrome': 1, 'camino': 1 }, |
1142 | | - 'rtl': { 'msie': 8, 'firefox': 2, 'opera': 9, 'safari': 3, 'chrome': 1, 'camino': 1 } |
| 1161 | + /** |
| 1162 | + * For each browser name, an array of conditions that must be met are supplied in [operaton, value] form where |
| 1163 | + * operation is a string containing a JavaScript compatible binary operator and value is either a number to be |
| 1164 | + * compared with $.browser.versionNumber or a string to be compared with $.browser.version |
| 1165 | + */ |
| 1166 | + 'browsers': { |
| 1167 | + 'ltr': { |
| 1168 | + 'msie': [['>=', 7]], |
| 1169 | + 'firefox': [ |
| 1170 | + ['>=', 2], |
| 1171 | + ['!=', '2.0'], |
| 1172 | + ['!=', '2.0.0.1'], |
| 1173 | + ['!=', '2.0.0.2'], |
| 1174 | + ['!=', '2.0.0.3'], |
| 1175 | + ['!=', '2.0.0.4'] |
| 1176 | + ], |
| 1177 | + 'opera': [['>=', 9.6]], |
| 1178 | + 'safari': [['>=', 3.1]] |
| 1179 | + }, |
| 1180 | + 'rtl': { |
| 1181 | + 'msie': [['>=', 8]], |
| 1182 | + 'firefox': [ |
| 1183 | + ['>=', 2], |
| 1184 | + ['!=', '2.0'], |
| 1185 | + ['!=', '2.0.0.1'], |
| 1186 | + ['!=', '2.0.0.2'], |
| 1187 | + ['!=', '2.0.0.3'], |
| 1188 | + ['!=', '2.0.0.4'] |
| 1189 | + ], |
| 1190 | + 'opera': [['>=', 9.6]], |
| 1191 | + 'safari': [['>=', 3.1]] |
| 1192 | + } |
1143 | 1193 | }, |
1144 | 1194 | /** |
1145 | 1195 | * Path to images - this is a bit messy, and it would need to change if |
— | — | @@ -1149,14 +1199,28 @@ |
1150 | 1200 | }; |
1151 | 1201 | |
1152 | 1202 | $.wikiEditor.isSupportKnown = function() { |
1153 | | - return ( function( supportedBrowsers ) { |
1154 | | - return $.browser.name in supportedBrowsers; |
1155 | | - } )( $.wikiEditor.supportedBrowsers[$( 'body.rtl' ).size() ? 'rtl' : 'ltr'] ); |
| 1203 | + return $.browser.name in $.wikiEditor.browsers[$( 'body.rtl' ).size() ? 'rtl' : 'ltr']; |
1156 | 1204 | }; |
1157 | 1205 | $.wikiEditor.isSupported = function() { |
1158 | | - return ( function( supportedBrowsers ) { |
1159 | | - return $.browser.name in supportedBrowsers && $.browser.versionNumber >= supportedBrowsers[$.browser.name]; |
1160 | | - } )( $.wikiEditor.supportedBrowsers[$( 'body.rtl' ).size() ? 'rtl' : 'ltr'] ); |
| 1206 | + if ( !$.wikiEditor.isSupportKnown ) { |
| 1207 | + // Assume good faith :) |
| 1208 | + return true; |
| 1209 | + } |
| 1210 | + var browser = $.wikiEditor.browsers[$( 'body.rtl' ).size() ? 'rtl' : 'ltr'][$.browser.name]; |
| 1211 | + for ( condition in browser ) { |
| 1212 | + var op = browser[condition][0]; |
| 1213 | + var val = browser[condition][1]; |
| 1214 | + if ( typeof val == 'string' ) { |
| 1215 | + if ( !( eval( '$.browser.version' + op + '"' + val + '"' ) ) ) { |
| 1216 | + return false; |
| 1217 | + } |
| 1218 | + } else if ( typeof val == 'number' ) { |
| 1219 | + if ( !( eval( '$.browser.versionNumber' + op + val ) ) ) { |
| 1220 | + return false; |
| 1221 | + } |
| 1222 | + } |
| 1223 | + } |
| 1224 | + return true; |
1161 | 1225 | }; |
1162 | 1226 | // Wraps gM from js2, but allows raw text to supercede |
1163 | 1227 | $.wikiEditor.autoMsg = function( object, property ) { |
— | — | @@ -1191,7 +1255,7 @@ |
1192 | 1256 | .height( 0 ) |
1193 | 1257 | .width( 0 ) |
1194 | 1258 | .insertBefore( $.wikiEditor.instances[0] ); |
1195 | | - var textarea = $( '<textarea></textarea' ) |
| 1259 | + var textarea = $( '<textarea />' ) |
1196 | 1260 | .height( 0 ) |
1197 | 1261 | .appendTo( div ) |
1198 | 1262 | .val( "foo\r\nbar" ); |
— | — | @@ -1201,10 +1265,10 @@ |
1202 | 1266 | textarea.select(); |
1203 | 1267 | textarea.setSelection( index, index + 3 ); |
1204 | 1268 | textarea.encapsulateSelection( '', 'BAR', '', false, true ); |
1205 | | - if ( textarea.val().substr( -1 ) == 'R' ) |
| 1269 | + if ( textarea.val().substr( -4 ) != 'BARr' ) |
1206 | 1270 | $.isOperaBroken = false; |
1207 | 1271 | else |
1208 | | - $.isOperaBroken = true; |
| 1272 | + $.isOperaBroken = true; |
1209 | 1273 | div.remove(); |
1210 | 1274 | } |
1211 | 1275 | if ( $.isOperaBroken ) |
— | — | @@ -1239,6 +1303,19 @@ |
1240 | 1304 | // Attach a container in the top |
1241 | 1305 | context.$ui.prepend( $( '<div></div>' ).addClass( 'wikiEditor-ui-top' ).attr( 'id', 'wikiEditor-ui-top' ) ); |
1242 | 1306 | |
| 1307 | + // Some browsers don't restore the cursor position on refocus properly |
| 1308 | + // Do it for them |
| 1309 | + $(this) |
| 1310 | + .focus( function() { |
| 1311 | + var pos = $(this).data( 'wikiEditor-cursor' ); |
| 1312 | + if ( pos ) |
| 1313 | + $(this).setSelection( pos[0], pos[1] ); |
| 1314 | + $(this).data( 'wikiEditor-cursor', false ); |
| 1315 | + }) |
| 1316 | + .blur( function() { |
| 1317 | + $(this).data( 'wikiEditor-cursor', $(this).getCaretPosition( true ) ); |
| 1318 | + }); |
| 1319 | + |
1243 | 1320 | // Create a set of standard methods for internal and external use |
1244 | 1321 | context.api = { |
1245 | 1322 | /** |
— | — | @@ -1347,60 +1424,63 @@ |
1348 | 1425 | $.wikiEditor.modules.dialogs.modules[module] = config[module]; |
1349 | 1426 | } |
1350 | 1427 | // Build out modules immediately |
1351 | | - for ( module in $.wikiEditor.modules.dialogs.modules ) { |
1352 | | - var module = $.wikiEditor.modules.dialogs.modules[module]; |
1353 | | - // Only create the dialog if it doesn't exist yet |
1354 | | - if ( $( '#' + module.id ).size() == 0 ) { |
1355 | | - var configuration = module.dialog; |
1356 | | - // Add some stuff to configuration |
1357 | | - configuration.bgiframe = true; |
1358 | | - configuration.autoOpen = false; |
1359 | | - configuration.modal = true; |
1360 | | - configuration.title = $.wikiEditor.autoMsg( module, 'title' ); |
1361 | | - // Transform messages in keys |
1362 | | - // Stupid JS won't let us do stuff like |
1363 | | - // foo = { gM ('bar'): baz } |
1364 | | - configuration.newButtons = {}; |
1365 | | - for ( msg in configuration.buttons ) |
1366 | | - configuration.newButtons[gM( msg )] = configuration.buttons[msg]; |
1367 | | - configuration.buttons = configuration.newButtons; |
1368 | | - // Create the dialog <div> |
1369 | | - $( '<div /> ' ) |
1370 | | - .attr( 'id', module.id ) |
1371 | | - .html( module.html ) |
1372 | | - .data( 'context', context ) |
1373 | | - .appendTo( $( 'body' ) ) |
1374 | | - .each( module.init ) |
1375 | | - .dialog( configuration ) |
1376 | | - .bind( 'dialogopen', $.wikiEditor.modules.dialogs.fn.resize ) |
1377 | | - .find( '.ui-tabs' ).bind( 'tabsshow', function() { |
1378 | | - $(this).closest( '.ui-dialog-content' ).each( |
1379 | | - $.wikiEditor.modules.dialogs.fn.resize ); |
| 1428 | + mvJsLoader.doLoad( ['$j.ui', '$j.ui.dialog', '$j.ui.draggable', '$j.ui.resizable' ], function() { |
| 1429 | + for ( module in $.wikiEditor.modules.dialogs.modules ) { |
| 1430 | + var module = $.wikiEditor.modules.dialogs.modules[module]; |
| 1431 | + // Only create the dialog if it doesn't exist yet |
| 1432 | + if ( $( '#' + module.id ).size() == 0 ) { |
| 1433 | + var configuration = module.dialog; |
| 1434 | + // Add some stuff to configuration |
| 1435 | + configuration.bgiframe = true; |
| 1436 | + configuration.autoOpen = false; |
| 1437 | + configuration.modal = true; |
| 1438 | + configuration.title = $.wikiEditor.autoMsg( module, 'title' ); |
| 1439 | + // Transform messages in keys |
| 1440 | + // Stupid JS won't let us do stuff like |
| 1441 | + // foo = { gM ('bar'): baz } |
| 1442 | + configuration.newButtons = {}; |
| 1443 | + for ( msg in configuration.buttons ) |
| 1444 | + configuration.newButtons[gM( msg )] = configuration.buttons[msg]; |
| 1445 | + configuration.buttons = configuration.newButtons; |
| 1446 | + // Create the dialog <div> |
| 1447 | + $( '<div /> ' ) |
| 1448 | + .attr( 'id', module.id ) |
| 1449 | + .html( module.html ) |
| 1450 | + .data( 'context', context ) |
| 1451 | + .appendTo( $( 'body' ) ) |
| 1452 | + .each( module.init ) |
| 1453 | + .dialog( configuration ) |
| 1454 | + .bind( 'dialogopen', $.wikiEditor.modules.dialogs.fn.resize ) |
| 1455 | + .find( '.ui-tabs' ).bind( 'tabsshow', function() { |
| 1456 | + $(this).closest( '.ui-dialog-content' ).each( |
| 1457 | + $.wikiEditor.modules.dialogs.fn.resize ); |
| 1458 | + }); |
| 1459 | + |
| 1460 | + // Add tabindexes to dialog form elements |
| 1461 | + // Find the highest tabindex in use |
| 1462 | + var maxTI = 0; |
| 1463 | + $j( '[tabindex]' ).each( function() { |
| 1464 | + var ti = parseInt( $j(this).attr( 'tabindex' ) ); |
| 1465 | + if ( ti > maxTI ) |
| 1466 | + maxTI = ti; |
1380 | 1467 | }); |
1381 | | - |
1382 | | - // Add tabindexes to dialog form elements |
1383 | | - // Find the highest tabindex in use |
1384 | | - var maxTI = 0; |
1385 | | - $j( '[tabindex]' ).each( function() { |
1386 | | - var ti = parseInt( $j(this).attr( 'tabindex' ) ); |
1387 | | - if ( ti > maxTI ) |
1388 | | - maxTI = ti; |
1389 | | - }); |
1390 | | - |
1391 | | - var tabIndex = maxTI + 1; |
1392 | | - $j( '.ui-dialog input, .ui-dialog button' ) |
1393 | | - .not( '[tabindex]' ) |
1394 | | - .each( function() { |
1395 | | - $j(this).attr( 'tabindex', tabIndex++ ); |
1396 | | - }); |
| 1468 | + |
| 1469 | + var tabIndex = maxTI + 1; |
| 1470 | + $j( '.ui-dialog input, .ui-dialog button' ) |
| 1471 | + .not( '[tabindex]' ) |
| 1472 | + .each( function() { |
| 1473 | + $j(this).attr( 'tabindex', tabIndex++ ); |
| 1474 | + }); |
| 1475 | + } |
1397 | 1476 | } |
1398 | | - } |
| 1477 | + }); |
1399 | 1478 | }, |
1400 | 1479 | |
1401 | 1480 | /** |
1402 | 1481 | * Resize a dialog so its contents fit |
1403 | 1482 | * |
1404 | 1483 | * Usage: dialog.each( resize ); or dialog.bind( 'blah', resize ); |
| 1484 | + * NOTE: This function assumes $j.ui.dialog has already been loaded |
1405 | 1485 | */ |
1406 | 1486 | resize: function() { |
1407 | 1487 | var wrapper = $(this).closest( '.ui-dialog' ); |
— | — | @@ -1477,6 +1557,11 @@ |
1478 | 1558 | $tabs.append( |
1479 | 1559 | $.wikiEditor.modules.toolbar.fn.buildTab( context, section, data[type][section] ) |
1480 | 1560 | ); |
| 1561 | + // Update visibility of section |
| 1562 | + $section = $sections.find( '.section:visible' ); |
| 1563 | + if ( $section.size() ) { |
| 1564 | + $sections.animate( { 'height': $section.outerHeight() }, 'fast' ); |
| 1565 | + } |
1481 | 1566 | } |
1482 | 1567 | break; |
1483 | 1568 | case 'groups': |
— | — | @@ -1880,40 +1965,44 @@ |
1881 | 1966 | } |
1882 | 1967 | }, |
1883 | 1968 | buildTab : function( context, id, section ) { |
1884 | | - var selected = $ |
1885 | | - .cookie( 'wikiEditor-' + context.instance + '-toolbar-section' ); |
| 1969 | + var selected = $.cookie( 'wikiEditor-' + context.instance + '-toolbar-section' ); |
1886 | 1970 | return $( '<span />' ) |
1887 | | - .attr( { 'class' : 'tab tab-' + id, 'rel' : id } ) |
1888 | | - .append( |
1889 | | - $( '<a />' ) |
1890 | | - .addClass( selected == id ? 'current' : null ) |
1891 | | - .attr( 'href', '#' ) |
1892 | | - .text( $.wikiEditor.autoMsg( section, 'label' ) ) |
1893 | | - .data( 'context', context ) |
1894 | | - .click( function() { |
1895 | | - var $section = |
1896 | | - $(this).data( 'context' ).$ui.find( '.section-' + $(this).parent().attr( 'rel' ) ); |
1897 | | - $(this).blur(); |
1898 | | - var show = $section.css( 'display' ) == 'none'; |
1899 | | - $section.parent().children().hide("fast"); |
1900 | | - $(this).parent().parent().find( 'a' ).removeClass( 'current' ); |
1901 | | - if ( show ) { |
1902 | | - $section.show("fast"); |
1903 | | - $(this).addClass( 'current' ); |
1904 | | - } |
1905 | | - |
1906 | | - //click tracking |
1907 | | - if($.trackAction != undefined){ |
1908 | | - $.trackAction($section.attr('rel') + '.' + ( show ? 'show': 'hide' ) ); |
1909 | | - } |
1910 | | - |
1911 | | - $.cookie( |
1912 | | - 'wikiEditor-' + $(this).data( 'context' ).instance + '-toolbar-section', |
1913 | | - show ? $section.attr( 'rel' ) : null |
1914 | | - ); |
1915 | | - return false; |
1916 | | - } ) |
1917 | | - ); |
| 1971 | + .attr( { 'class' : 'tab tab-' + id, 'rel' : id } ) |
| 1972 | + .append( |
| 1973 | + $( '<a />' ) |
| 1974 | + .addClass( selected == id ? 'current' : null ) |
| 1975 | + .attr( 'href', '#' ) |
| 1976 | + .text( $.wikiEditor.autoMsg( section, 'label' ) ) |
| 1977 | + .data( 'context', context ) |
| 1978 | + .click( function() { |
| 1979 | + var $sections = $(this).data( 'context' ).$ui.find( '.sections' ); |
| 1980 | + var $section = |
| 1981 | + $(this).data( 'context' ).$ui.find( '.section-' + $(this).parent().attr( 'rel' ) ); |
| 1982 | + $(this).blur(); |
| 1983 | + var show = $section.css( 'display' ) == 'none'; |
| 1984 | + $previousSections = $section.parent().find( '.section:visible' ); |
| 1985 | + $previousSections.css( 'position', 'absolute' ); |
| 1986 | + $previousSections.fadeOut( 'fast', function() { $(this).css( 'position', 'relative' ); } ); |
| 1987 | + $(this).parent().parent().find( 'a' ).removeClass( 'current' ); |
| 1988 | + if ( show ) { |
| 1989 | + $section.fadeIn( 'fast' ); |
| 1990 | + $sections.animate( { 'height': $section.outerHeight() }, 'fast' ); |
| 1991 | + $(this).addClass( 'current' ); |
| 1992 | + } else { |
| 1993 | + $sections.animate( { 'height': 0 } ); |
| 1994 | + } |
| 1995 | + // Click tracking |
| 1996 | + if($.trackAction != undefined){ |
| 1997 | + $.trackAction($section.attr('rel') + '.' + ( show ? 'show': 'hide' ) ); |
| 1998 | + } |
| 1999 | + // |
| 2000 | + $.cookie( |
| 2001 | + 'wikiEditor-' + $(this).data( 'context' ).instance + '-toolbar-section', |
| 2002 | + show ? $section.attr( 'rel' ) : null |
| 2003 | + ); |
| 2004 | + return false; |
| 2005 | + } ) |
| 2006 | + ); |
1918 | 2007 | }, |
1919 | 2008 | buildSection : function( context, id, section ) { |
1920 | 2009 | context.$textarea.trigger( 'wikiEditor-toolbar-buildSection-' + id, [section] ); |
— | — | @@ -1950,7 +2039,8 @@ |
1951 | 2040 | break; |
1952 | 2041 | } |
1953 | 2042 | if ( $section !== null && id !== 'main' ) { |
1954 | | - $section.css( 'display', selected == id ? 'block' : 'none' ); |
| 2043 | + var show = selected == id; |
| 2044 | + $section.css( 'display', show ? 'block' : 'none' ); |
1955 | 2045 | } |
1956 | 2046 | return $section; |
1957 | 2047 | }, |
— | — | @@ -1998,6 +2088,10 @@ |
1999 | 2089 | }, |
2000 | 2090 | 'loop' : function( i, s ) { |
2001 | 2091 | s.$sections.append( $.wikiEditor.modules.toolbar.fn.buildSection( s.context, s.id, s.config ) ); |
| 2092 | + var $section = s.$sections.find( '.section:visible' ); |
| 2093 | + if ( $section.size() ) { |
| 2094 | + $sections.animate( { 'height': $section.outerHeight() }, 'fast' ); |
| 2095 | + } |
2002 | 2096 | } |
2003 | 2097 | } ); |
2004 | 2098 | } |
— | — | @@ -2029,10 +2123,11 @@ |
2030 | 2124 | if ( '$toc' in context.modules ) { |
2031 | 2125 | return; |
2032 | 2126 | } |
2033 | | - context.modules.$toc = $( '<div></div>' ) |
| 2127 | + context.modules.$toc = $( '<div />' ) |
2034 | 2128 | .addClass( 'wikiEditor-ui-toc' ) |
2035 | 2129 | .attr( 'id', 'wikiEditor-ui-toc' ); |
2036 | | - $.wikiEditor.modules.toc.fn.build( context, config ); |
| 2130 | + // If we ask for this later (after we insert the TOC) then in IE this measurement will be incorrect |
| 2131 | + var height = context.$ui.find( '.wikiEditor-ui-bottom' ).height() |
2037 | 2132 | context.$ui.find( '.wikiEditor-ui-bottom' ) |
2038 | 2133 | .append( context.modules.$toc ); |
2039 | 2134 | context.modules.$toc.height( |
— | — | @@ -2040,13 +2135,11 @@ |
2041 | 2136 | ); |
2042 | 2137 | // Make some css modifications to make room for the toc on the right... |
2043 | 2138 | // Perhaps this could be configurable? |
2044 | | - context.modules.$toc |
2045 | | - .css( 'width', '12em' ) |
2046 | | - .css( 'marginTop', -( context.$ui.find( '.wikiEditor-ui-bottom' ).height() ) ); |
| 2139 | + context.modules.$toc.css( { 'width': '12em', 'marginTop': -( height ) } ); |
2047 | 2140 | context.$ui.find( '.wikiEditor-ui-text' ) |
2048 | 2141 | .css( ( $( 'body.rtl' ).size() ? 'marginLeft' : 'marginRight' ), '12em' ); |
2049 | 2142 | // Add the TOC to the document |
2050 | | - $.wikiEditor.modules.toc.fn.build( context ); |
| 2143 | + $.wikiEditor.modules.toc.fn.build( context, config ); |
2051 | 2144 | context.$textarea |
2052 | 2145 | .delayedBind( 1000, 'keyup encapsulateSelection change', |
2053 | 2146 | function( event ) { |
— | — | @@ -2152,17 +2245,18 @@ |
2153 | 2246 | * @param {Object} structure Structured outline |
2154 | 2247 | */ |
2155 | 2248 | function buildList( structure ) { |
2156 | | - var list = $( '<ul></ul>' ); |
| 2249 | + var list = $( '<ul />' ); |
2157 | 2250 | for ( i in structure ) { |
2158 | | - var item = $( '<li></li>' ) |
| 2251 | + var item = $( '<li />' ) |
2159 | 2252 | .append( |
2160 | | - $( '<a></a>' ) |
| 2253 | + $( '<a />' ) |
2161 | 2254 | .attr( 'href', '#' ) |
2162 | 2255 | .addClass( 'section-' + structure[i].index ) |
2163 | 2256 | .data( 'textbox', context.$textarea ) |
2164 | 2257 | .data( 'position', structure[i].position ) |
2165 | 2258 | .click( function( event ) { |
2166 | 2259 | $(this).data( 'textbox' ) |
| 2260 | + .focus() |
2167 | 2261 | .setSelection( $(this).data( 'position' ) ) |
2168 | 2262 | .scrollToCaretPosition( true ); |
2169 | 2263 | event.preventDefault(); |
— | — | @@ -2178,23 +2272,22 @@ |
2179 | 2273 | } |
2180 | 2274 | // Build outline from wikitext |
2181 | 2275 | var outline = []; |
2182 | | - var wikitext = '\n' + $.wikiEditor.fixOperaBrokenness( context.$textarea.val() ) + '\n'; |
| 2276 | + var wikitext = $.wikiEditor.fixOperaBrokenness( context.$textarea.val() ); |
2183 | 2277 | var headings = wikitext.match( /^={1,6}.+={1,6}\s*$/gm ); |
2184 | 2278 | var offset = 0; |
2185 | 2279 | headings = $.makeArray( headings ); |
2186 | 2280 | for ( var h = 0; h < headings.length; h++ ) { |
2187 | | - text = headings[h]; |
| 2281 | + text = $.trim( headings[h] ); |
2188 | 2282 | // Get position of first occurence |
2189 | 2283 | var position = wikitext.indexOf( text, offset ); |
2190 | 2284 | // Update offset to avoid stumbling on duplicate headings |
2191 | | - if ( position > offset ) { |
2192 | | - offset = position + 1; |
| 2285 | + if ( position >= offset ) { |
| 2286 | + offset = position + text.length; |
2193 | 2287 | } else if ( position == -1 ) { |
2194 | 2288 | // Not sure this is possible, or what should happen |
2195 | 2289 | continue; |
2196 | 2290 | } |
2197 | | - // Trim off whitespace |
2198 | | - text = $.trim( text ); |
| 2291 | + |
2199 | 2292 | // Detect the starting and ending heading levels |
2200 | 2293 | var startLevel = 0; |
2201 | 2294 | for ( var c = 0; c < text.length; c++ ) { |
— | — | @@ -2243,7 +2336,15 @@ |
2244 | 2337 | if ( $( 'input[name=wpSection]' ).val() == '' ) |
2245 | 2338 | structure.unshift( { 'text': wgPageName.replace(/_/g, ' '), 'level': 1, 'index': 0, 'position': 0 } ); |
2246 | 2339 | context.modules.$toc.html( buildList( structure ) ); |
2247 | | - context.modules.$toc.find( 'ul a' ).autoEllipse( { 'position': 'right', 'tooltip': true } ); |
| 2340 | + |
| 2341 | + context.modules.$toc.find( 'ul' ).css( 'width', '10em' ); |
| 2342 | + |
| 2343 | + var links = context.modules.$toc.find( 'ul a' ); |
| 2344 | + // Highlighted links are wider; autoEllipse links in |
| 2345 | + // highlighted state |
| 2346 | + links.addClass( 'currentSelection' ); |
| 2347 | + links.autoEllipse( { 'position': 'right', 'tooltip': true } ); |
| 2348 | + links.removeClass( 'currentSelection' ); |
2248 | 2349 | // Cache the outline for later use |
2249 | 2350 | context.data.outline = outline; |
2250 | 2351 | } |
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -11,8 +11,9 @@ |
12 | 12 | {var i=0,l=array.length,loop=opts.loop||function(){};$.whileAsync($.extend(opts,{test:function(){return i<l;},loop:function() |
13 | 13 | {var val=array[i];return loop.call(val,i++,val);}}));} |
14 | 14 | $.fn.eachAsync=function(opts) |
15 | | -{$.eachAsync(this,opts);return this;}})(jQuery);(function($){$.fn.autoEllipse=function(options){$(this).each(function(){options=$.extend({'position':'center','tooltip':false},options);var text=$(this).text();var $text=$('<span />').text(text).css('whiteSpace','nowrap');$(this).empty().append($text);if($text.outerWidth()>$(this).innerWidth()){switch(options.position){case'right':var l=text.length;while($text.outerWidth()>$(this).innerWidth()&&l>0){$text.text(text.substr(0,l)+'...');l--;} |
16 | | -break;case'center':var i=[Math.round(text.length/2),Math.round(text.length/2)];var side=1;while($text.outerWidth()>($(this).innerWidth())&&i[0]>0){$text.text(text.substr(0,i[0])+'...'+text.substr(i[1]));if(side==0){i[0]--;side=1;}else{i[1]++;side=0;}} |
| 15 | +{$.eachAsync(this,opts);return this;}})(jQuery);(function($){$.fn.autoEllipse=function(options){$(this).each(function(){options=$.extend({'position':'center','tooltip':false},options);var text=$(this).text();var $text=$('<span />').text(text).css('whiteSpace','nowrap');$(this).empty().append($text);if($text.outerWidth()>$(this).innerWidth()){switch(options.position){case'right':var l=0,r=text.length;var ow,iw;do{var m=Math.ceil((l+r)/2);$text.text(text.substr(0,m)+'...');ow=$text.outerWidth();iw=$(this).innerWidth();if(ow>iw) |
| 16 | +r=m-1;else |
| 17 | +l=m;}while(l<r);break;case'center':var i=[Math.round(text.length/2),Math.round(text.length/2)];var side=1;while($text.outerWidth()>($(this).innerWidth())&&i[0]>0){$text.text(text.substr(0,i[0])+'...'+text.substr(i[1]));if(side==0){i[0]--;side=1;}else{i[1]++;side=0;}} |
17 | 18 | break;case'left':var r=0;while($text.outerWidth()>$(this).innerWidth()&&r<text.length){$text.text('...'+text.substr(r));r++;} |
18 | 19 | break;} |
19 | 20 | if(options.tooltip) |
— | — | @@ -60,38 +61,41 @@ |
61 | 62 | var range3=document.selection.createRange();range3.collapse(false);range3.moveEnd('character',1);if(range3.text!="\r"&&range3.text!="\n"&&range3.text!=""){post+="\n";}} |
62 | 63 | checkSelectedText();range.text=pre+selText+post;if(isSample&&range.moveStart){range.moveStart('character',-post.length-selText.length);range.moveEnd('character',-post.length);} |
63 | 64 | range.select();} |
64 | | -$(this).scrollToCaretPosition();$(this).trigger('encapsulateSelection',[pre,peri,post,ownline,replace]);});},getCaretPosition:function(){function getCaret(e){var caretPos=0;if($.browser.msie){var postFinished=false;var periFinished=false;var postFinished=false;var preText,rawPreText,periText;var rawPeriText,postText,rawPostText;var periRange=document.selection.createRange().duplicate();var preRange=document.body.createTextRange();preRange.moveToElementText(e);preRange.setEndPoint("EndToStart",periRange);var postRange=document.body.createTextRange();postRange.moveToElementText(e);postRange.setEndPoint("StartToEnd",periRange);preText=rawPreText=preRange.text;periText=rawPeriText=periRange.text;postText=rawPostText=postRange.text;do{if(!postFinished){if(preRange.compareEndPoints("StartToEnd",preRange)==0){postFinished=true;}else{preRange.moveEnd("character",-1) |
| 65 | +$(this).scrollToCaretPosition();$(this).trigger('encapsulateSelection',[pre,peri,post,ownline,replace]);});},getCaretPosition:function(startAndEnd){function getCaret(e){var caretPos=0,endPos=0;if($.browser.msie){var postFinished=false;var periFinished=false;var postFinished=false;var preText,rawPreText,periText;var rawPeriText,postText,rawPostText;var periRange=document.selection.createRange().duplicate();var preRange=document.body.createTextRange();preRange.moveToElementText(e);preRange.setEndPoint("EndToStart",periRange);var postRange=document.body.createTextRange();postRange.moveToElementText(e);postRange.setEndPoint("StartToEnd",periRange);preText=rawPreText=preRange.text;periText=rawPeriText=periRange.text;postText=rawPostText=postRange.text;do{if(!postFinished){if(preRange.compareEndPoints("StartToEnd",preRange)==0){postFinished=true;}else{preRange.moveEnd("character",-1) |
65 | 66 | if(preRange.text==preText){rawPreText+="\r\n";}else{postFinished=true;}}} |
66 | 67 | if(!periFinished){if(periRange.compareEndPoints("StartToEnd",periRange)==0){periFinished=true;}else{periRange.moveEnd("character",-1) |
67 | 68 | if(periRange.text==periText){rawPeriText+="\r\n";}else{periFinished=true;}}} |
68 | 69 | if(!postFinished){if(postRange.compareEndPoints("StartToEnd",postRange)==0){postFinished=true;}else{postRange.moveEnd("character",-1) |
69 | | -if(postRange.text==postText){rawPostText+="\r\n";}else{postFinished=true;}}}}while((!postFinished||!periFinished||!postFinished));caretPos=rawPreText.replace(/\r\n/g,"\n").length;}else if(e.selectionStart||e.selectionStart=='0'){caretPos=e.selectionStart;} |
70 | | -return caretPos;} |
| 70 | +if(postRange.text==postText){rawPostText+="\r\n";}else{postFinished=true;}}}}while((!postFinished||!periFinished||!postFinished));caretPos=rawPreText.replace(/\r\n/g,"\n").length;endPos=caretPos+rawPeriText.replace(/\r\n/g,"\n").length;}else if(e.selectionStart||e.selectionStart=='0'){caretPos=e.selectionStart;endPos=e.selectionEnd;} |
| 71 | +return startAndEnd?[caretPos,endPos]:caretPos;} |
71 | 72 | return getCaret(this.get(0));},setSelection:function(start,end){if(typeof end=='undefined') |
72 | | -end=start;return this.each(function(){if(this.selectionStart||this.selectionStart=='0'){this.selectionStart=start;this.selectionEnd=end;}else if(document.body.createTextRange){var selection=document.body.createTextRange();selection.moveToElementText(this);var length=selection.text.length;selection.moveStart('character',start);selection.moveEnd('character',-length+end);selection.select();}});},scrollToCaretPosition:function(force){function getLineLength(e){return Math.floor(e.scrollWidth/($.os.name=='linux'?7:8));} |
| 73 | +end=start;return this.each(function(){if(this.selectionStart||this.selectionStart=='0'){if(start>this.selectionEnd){this.selectionEnd=end;this.selectionStart=start;}else{this.selectionStart=start;this.selectionEnd=end;}}else if(document.body.createTextRange){var selection=document.body.createTextRange();selection.moveToElementText(this);var length=selection.text.length;selection.moveStart('character',start);selection.moveEnd('character',-length+end);selection.select();}});},scrollToCaretPosition:function(force){function getLineLength(e){return Math.floor(e.scrollWidth/($.os.name=='linux'?7:8));} |
73 | 74 | function getCaretScrollPosition(e){var text=e.value.replace(/\r/g,"");var caret=$(e).getCaretPosition();var lineLength=getLineLength(e);var row=0;var charInLine=0;var lastSpaceInLine=0;for(i=0;i<caret;i++){charInLine++;if(text.charAt(i)==" "){lastSpaceInLine=charInLine;}else if(text.charAt(i)=="\n"){lastSpaceInLine=0;charInLine=0;row++;} |
74 | 75 | if(charInLine>lineLength){if(lastSpaceInLine>0){charInLine=charInLine-lastSpaceInLine;lastSpaceInLine=0;row++;}}} |
75 | 76 | var nextSpace=0;for(j=caret;j<caret+lineLength;j++){if(text.charAt(j)==" "||text.charAt(j)=="\n"||caret==text.length){nextSpace=j;break;}} |
76 | 77 | if(nextSpace>lineLength&&caret<=lineLength){charInLine=caret-lastSpaceInLine;row++;} |
77 | 78 | return($.os.name=='mac'?13:($.os.name=='linux'?15:16))*row;} |
78 | | -return this.each(function(){$(this).focus();if(this.selectionStart||this.selectionStart=='0'){var scroll=getCaretScrollPosition(this);if(force||scroll<$(this).scrollTop()||scroll>$(this).scrollTop()+$(this).height()) |
| 79 | +return this.each(function(){if(this.selectionStart||this.selectionStart=='0'){var scroll=getCaretScrollPosition(this);if(force||scroll<$(this).scrollTop()||scroll>$(this).scrollTop()+$(this).height()) |
79 | 80 | $(this).scrollTop(scroll);}else if(document.selection&&document.selection.createRange){var range=document.selection.createRange();var pos=$(this).getCaretPosition();var oldScrollTop=this.scrollTop;range.moveToElementText(this);range.collapse();range.move('character',pos+1);range.select();if(this.scrollTop!=oldScrollTop) |
80 | 81 | this.scrollTop+=range.offsetTop;else if(force){range.move('character',-1);range.select();}} |
81 | | -$(this).trigger('scrollToPosition');});}});})(jQuery);(function($){$.wikiEditor={'modules':{},'instances':[],'supportedBrowsers':{'ltr':{'msie':7,'firefox':2,'opera':9,'safari':3,'chrome':1,'camino':1},'rtl':{'msie':8,'firefox':2,'opera':9,'safari':3,'chrome':1,'camino':1}},imgPath:wgScriptPath+'/extensions/UsabilityInitiative/images/wikiEditor/'};$.wikiEditor.isSupportKnown=function(){return(function(supportedBrowsers){return $.browser.name in supportedBrowsers;})($.wikiEditor.supportedBrowsers[$('body.rtl').size()?'rtl':'ltr']);};$.wikiEditor.isSupported=function(){return(function(supportedBrowsers){return $.browser.name in supportedBrowsers&&$.browser.versionNumber>=supportedBrowsers[$.browser.name];})($.wikiEditor.supportedBrowsers[$('body.rtl').size()?'rtl':'ltr']);};$.wikiEditor.autoMsg=function(object,property){if(typeof property=='object'){for(i in property){if(property[i]in object||property[i]+'Msg'in object){property=property[i];break;}}} |
82 | | -if(property in object){return object[property];}else if(property+'Msg'in object){return gM(object[property+'Msg']);}else{return'';}};$.wikiEditor.fixOperaBrokenness=function(s){if(typeof $.isOperaBroken=='undefined'&&$.wikiEditor.instances.length>0){var div=$('<div />').height(0).width(0).insertBefore($.wikiEditor.instances[0]);var textarea=$('<textarea></textarea').height(0).appendTo(div).val("foo\r\nbar");var index=textarea.val().indexOf('bar');textarea.select();textarea.setSelection(index,index+3);textarea.encapsulateSelection('','BAR','',false,true);if(textarea.val().substr(-1)=='R') |
| 82 | +$(this).trigger('scrollToPosition');});}});})(jQuery);(function($){$.wikiEditor={'modules':{},'instances':[],'browsers':{'ltr':{'msie':[['>=',7]],'firefox':[['>=',2],['!=','2.0'],['!=','2.0.0.1'],['!=','2.0.0.2'],['!=','2.0.0.3'],['!=','2.0.0.4']],'opera':[['>=',9.6]],'safari':[['>=',3.1]]},'rtl':{'msie':[['>=',8]],'firefox':[['>=',2],['!=','2.0'],['!=','2.0.0.1'],['!=','2.0.0.2'],['!=','2.0.0.3'],['!=','2.0.0.4']],'opera':[['>=',9.6]],'safari':[['>=',3.1]]}},imgPath:wgScriptPath+'/extensions/UsabilityInitiative/images/wikiEditor/'};$.wikiEditor.isSupportKnown=function(){return $.browser.name in $.wikiEditor.browsers[$('body.rtl').size()?'rtl':'ltr'];};$.wikiEditor.isSupported=function(){if(!$.wikiEditor.isSupportKnown){return true;} |
| 83 | +var browser=$.wikiEditor.browsers[$('body.rtl').size()?'rtl':'ltr'][$.browser.name];for(condition in browser){var op=browser[condition][0];var val=browser[condition][1];if(typeof val=='string'){if(!(eval('$.browser.version'+op+'"'+val+'"'))){return false;}}else if(typeof val=='number'){if(!(eval('$.browser.versionNumber'+op+val))){return false;}}} |
| 84 | +return true;};$.wikiEditor.autoMsg=function(object,property){if(typeof property=='object'){for(i in property){if(property[i]in object||property[i]+'Msg'in object){property=property[i];break;}}} |
| 85 | +if(property in object){return object[property];}else if(property+'Msg'in object){return gM(object[property+'Msg']);}else{return'';}};$.wikiEditor.fixOperaBrokenness=function(s){if(typeof $.isOperaBroken=='undefined'&&$.wikiEditor.instances.length>0){var div=$('<div />').height(0).width(0).insertBefore($.wikiEditor.instances[0]);var textarea=$('<textarea />').height(0).appendTo(div).val("foo\r\nbar");var index=textarea.val().indexOf('bar');textarea.select();textarea.setSelection(index,index+3);textarea.encapsulateSelection('','BAR','',false,true);if(textarea.val().substr(-4)!='BARr') |
83 | 86 | $.isOperaBroken=false;else |
84 | 87 | $.isOperaBroken=true;div.remove();} |
85 | 88 | if($.isOperaBroken) |
86 | | -s=s.replace(/\n/g,"\r\n");return s;};$.fn.wikiEditor=function(){var context=$(this).data('wikiEditor-context');if(typeof context=='undefined'){var instance=$.wikiEditor.instances.length;context={'$textarea':$(this),'modules':{},'data':{},'instance':instance};$.wikiEditor.instances[instance]=$(this);$(this).wrap($('<div></div>').addClass('wikiEditor-ui').attr('id','wikiEditor-ui')).wrap($('<div></div>').addClass('wikiEditor-ui-bottom').attr('id','wikiEditor-ui-bottom')).wrap($('<div></div>').addClass('wikiEditor-ui-text').attr('id','wikiEditor-ui-text'));context.$ui=$(this).parent().parent().parent();context.$ui.after($('<div style="clear:both;"></div>'));context.$ui.prepend($('<div></div>').addClass('wikiEditor-ui-top').attr('id','wikiEditor-ui-top'));context.api={addModule:function(context,data){function callModuleApi(module,call,data){if(module in $.wikiEditor.modules&&'fn'in $.wikiEditor.modules[module]&&call in $.wikiEditor.modules[module].fn){$.wikiEditor.modules[module].fn[call](context,data);}} |
| 89 | +s=s.replace(/\n/g,"\r\n");return s;};$.fn.wikiEditor=function(){var context=$(this).data('wikiEditor-context');if(typeof context=='undefined'){var instance=$.wikiEditor.instances.length;context={'$textarea':$(this),'modules':{},'data':{},'instance':instance};$.wikiEditor.instances[instance]=$(this);$(this).wrap($('<div></div>').addClass('wikiEditor-ui').attr('id','wikiEditor-ui')).wrap($('<div></div>').addClass('wikiEditor-ui-bottom').attr('id','wikiEditor-ui-bottom')).wrap($('<div></div>').addClass('wikiEditor-ui-text').attr('id','wikiEditor-ui-text'));context.$ui=$(this).parent().parent().parent();context.$ui.after($('<div style="clear:both;"></div>'));context.$ui.prepend($('<div></div>').addClass('wikiEditor-ui-top').attr('id','wikiEditor-ui-top'));$(this).focus(function(){var pos=$(this).data('wikiEditor-cursor');if(pos) |
| 90 | +$(this).setSelection(pos[0],pos[1]);$(this).data('wikiEditor-cursor',false);}).blur(function(){$(this).data('wikiEditor-cursor',$(this).getCaretPosition(true));});context.api={addModule:function(context,data){function callModuleApi(module,call,data){if(module in $.wikiEditor.modules&&'fn'in $.wikiEditor.modules[module]&&call in $.wikiEditor.modules[module].fn){$.wikiEditor.modules[module].fn[call](context,data);}} |
87 | 91 | if(typeof data=='string'){callModuleApi(data,'create',{});}else if(typeof data=='object'){for(module in data){if(typeof module=='string'){callModuleApi(module,'create',data[module]);}}}}};for(module in $.wikiEditor.modules){if('api'in $.wikiEditor.modules[module]){for(call in $.wikiEditor.modules[module].api){if(!(call in context.api)){context.api[call]=$.wikiEditor.modules[module].api[call];}}}}} |
88 | 92 | if(arguments.length>0&&typeof arguments[0]=='object'){context.api.addModule(context,arguments[0]);}else{arguments=$.makeArray(arguments);if(arguments.length>0){var call=arguments.shift();if(call in context.api){context.api[call](context,arguments[0]==undefined?{}:arguments[0]);}}} |
89 | 93 | return $(this).data('wikiEditor-context',context);};})(jQuery);RegExp.escape=function(s){return s.replace(/([.*+?^${}()|\/\\[\]])/g,'\\$1');};(function($){$.wikiEditor.modules.dialogs={api:{addDialog:function(context,data){$.wikiEditor.modules.dialogs.fn.create(context,{'modules':data})},openDialog:function(context,data){if(data.dialog in $.wikiEditor.modules.dialogs.modules){$('#'+$.wikiEditor.modules.dialogs.modules[data.dialog].id).dialog('open');}},closeDialog:function(context,data){if(data.dialog in $.wikiEditor.modules.dialogs.modules){$('#'+$.wikiEditor.modules.dialogs.modules[data.dialog].id).dialog('close');}}},fn:{create:function(context,config){for(module in config){$.wikiEditor.modules.dialogs.modules[module]=config[module];} |
90 | | -for(module in $.wikiEditor.modules.dialogs.modules){var module=$.wikiEditor.modules.dialogs.modules[module];if($('#'+module.id).size()==0){var configuration=module.dialog;configuration.bgiframe=true;configuration.autoOpen=false;configuration.modal=true;configuration.title=$.wikiEditor.autoMsg(module,'title');configuration.newButtons={};for(msg in configuration.buttons) |
| 94 | +mvJsLoader.doLoad(['$j.ui','$j.ui.dialog','$j.ui.draggable','$j.ui.resizable'],function(){for(module in $.wikiEditor.modules.dialogs.modules){var module=$.wikiEditor.modules.dialogs.modules[module];if($('#'+module.id).size()==0){var configuration=module.dialog;configuration.bgiframe=true;configuration.autoOpen=false;configuration.modal=true;configuration.title=$.wikiEditor.autoMsg(module,'title');configuration.newButtons={};for(msg in configuration.buttons) |
91 | 95 | configuration.newButtons[gM(msg)]=configuration.buttons[msg];configuration.buttons=configuration.newButtons;$('<div /> ').attr('id',module.id).html(module.html).data('context',context).appendTo($('body')).each(module.init).dialog(configuration).bind('dialogopen',$.wikiEditor.modules.dialogs.fn.resize).find('.ui-tabs').bind('tabsshow',function(){$(this).closest('.ui-dialog-content').each($.wikiEditor.modules.dialogs.fn.resize);});var maxTI=0;$j('[tabindex]').each(function(){var ti=parseInt($j(this).attr('tabindex'));if(ti>maxTI) |
92 | | -maxTI=ti;});var tabIndex=maxTI+1;$j('.ui-dialog input, .ui-dialog button').not('[tabindex]').each(function(){$j(this).attr('tabindex',tabIndex++);});}}},resize:function(){var wrapper=$(this).closest('.ui-dialog');var oldWidth=wrapper.width();var oldHidden=$(this).find('*').not(':visible');oldHidden.each(function(){$(this).data('oldstyle',$(this).attr('style'));});oldHidden.show();var oldWS=$(this).css('white-space');$(this).css('white-space','nowrap');if(wrapper.width()<=$(this).get(0).scrollWidth){$(this).width($(this).get(0).scrollWidth);wrapper.width(wrapper.get(0).scrollWidth);$(this).dialog({'width':wrapper.width()});wrapper.css('left',parseInt(wrapper.css('left'))- |
| 96 | +maxTI=ti;});var tabIndex=maxTI+1;$j('.ui-dialog input, .ui-dialog button').not('[tabindex]').each(function(){$j(this).attr('tabindex',tabIndex++);});}}});},resize:function(){var wrapper=$(this).closest('.ui-dialog');var oldWidth=wrapper.width();var oldHidden=$(this).find('*').not(':visible');oldHidden.each(function(){$(this).data('oldstyle',$(this).attr('style'));});oldHidden.show();var oldWS=$(this).css('white-space');$(this).css('white-space','nowrap');if(wrapper.width()<=$(this).get(0).scrollWidth){$(this).width($(this).get(0).scrollWidth);wrapper.width(wrapper.get(0).scrollWidth);$(this).dialog({'width':wrapper.width()});wrapper.css('left',parseInt(wrapper.css('left'))- |
93 | 97 | (wrapper.width()-oldWidth)/2);} |
94 | 98 | $(this).css('white-space',oldWS);oldHidden.each(function(){$(this).attr('style',$(this).data('oldstyle'));});}},'modules':{}};})(jQuery);(function($){$.wikiEditor.modules.toolbar={api:{addToToolbar:function(context,data){for(type in data){switch(type){case'sections':var $sections=context.modules.$toolbar.find('div.sections');var $tabs=context.modules.$toolbar.find('div.tabs');for(section in data[type]){if(section=='main'){context.modules.$toolbar.prepend($.wikiEditor.modules.toolbar.fn.buildSection(context,section,data[type][section]));continue;} |
95 | | -$sections.append($.wikiEditor.modules.toolbar.fn.buildSection(context,section,data[type][section]));$tabs.append($.wikiEditor.modules.toolbar.fn.buildTab(context,section,data[type][section]));} |
| 99 | +$sections.append($.wikiEditor.modules.toolbar.fn.buildSection(context,section,data[type][section]));$tabs.append($.wikiEditor.modules.toolbar.fn.buildTab(context,section,data[type][section]));$section=$sections.find('.section:visible');if($section.size()){$sections.animate({'height':$section.outerHeight()},'fast');}} |
96 | 100 | break;case'groups':if(!('section'in data)){continue;} |
97 | 101 | var $section=context.modules.$toolbar.find('div[rel='+data.section+'].section');for(group in data[type]){$section.append($.wikiEditor.modules.toolbar.fn.buildGroup(context,group,data[type][group]));} |
98 | 102 | break;case'tools':if(!('section'in data&&'group'in data)){continue;} |
— | — | @@ -128,27 +132,28 @@ |
129 | 133 | return html;},buildRow:function(context,row){var html='<tr>';for(cell in row){html+='<td class="cell cell-'+cell+'" valign="top"><span>'+ |
130 | 134 | $.wikiEditor.autoMsg(row[cell],['html','text'])+'</span></td>';} |
131 | 135 | html+='</tr>';return html;},buildCharacter:function(character,actions){if(typeof character=='string'){character={'label':character,'action':{'type':'encapsulate','options':{'pre':character}}};}else if(0 in character&&1 in character){character={'label':character[0],'action':{'type':'encapsulate','options':{'pre':character[1]}}};} |
132 | | -if('action'in character&&'label'in character){actions[character.label]=character.action;return'<a rel="'+character.label+'" href="#">'+character.label+'</a>';}},buildTab:function(context,id,section){var selected=$.cookie('wikiEditor-'+context.instance+'-toolbar-section');return $('<span />').attr({'class':'tab tab-'+id,'rel':id}).append($('<a />').addClass(selected==id?'current':null).attr('href','#').text($.wikiEditor.autoMsg(section,'label')).data('context',context).click(function(){var $section=$(this).data('context').$ui.find('.section-'+$(this).parent().attr('rel'));$(this).blur();var show=$section.css('display')=='none';$section.parent().children().hide("fast");$(this).parent().parent().find('a').removeClass('current');if(show){$section.show("fast");$(this).addClass('current');} |
| 136 | +if('action'in character&&'label'in character){actions[character.label]=character.action;return'<a rel="'+character.label+'" href="#">'+character.label+'</a>';}},buildTab:function(context,id,section){var selected=$.cookie('wikiEditor-'+context.instance+'-toolbar-section');return $('<span />').attr({'class':'tab tab-'+id,'rel':id}).append($('<a />').addClass(selected==id?'current':null).attr('href','#').text($.wikiEditor.autoMsg(section,'label')).data('context',context).click(function(){var $sections=$(this).data('context').$ui.find('.sections');var $section=$(this).data('context').$ui.find('.section-'+$(this).parent().attr('rel'));$(this).blur();var show=$section.css('display')=='none';$previousSections=$section.parent().find('.section:visible');$previousSections.css('position','absolute');$previousSections.fadeOut('fast',function(){$(this).css('position','relative');});$(this).parent().parent().find('a').removeClass('current');if(show){$section.fadeIn('fast');$sections.animate({'height':$section.outerHeight()},'fast');$(this).addClass('current');}else{$sections.animate({'height':0});} |
133 | 137 | if($.trackAction!=undefined){$.trackAction($section.attr('rel')+'.'+(show?'show':'hide'));} |
134 | 138 | $.cookie('wikiEditor-'+$(this).data('context').instance+'-toolbar-section',show?$section.attr('rel'):null);return false;}));},buildSection:function(context,id,section){context.$textarea.trigger('wikiEditor-toolbar-buildSection-'+id,[section]);var selected=$.cookie('wikiEditor-'+context.instance+'-toolbar-section');var $section;switch(section.type){case'toolbar':var $section=$('<div />').attr({'class':'toolbar section section-'+id,'rel':id});if('groups'in section){for(group in section.groups){$section.append($.wikiEditor.modules.toolbar.fn.buildGroup(context,group,section.groups[group]));}} |
135 | 139 | break;case'booklet':var $pages=$('<div />').addClass('pages');var $index=$('<div />').addClass('index');if('pages'in section){for(page in section.pages){$pages.append($.wikiEditor.modules.toolbar.fn.buildPage(context,page,section.pages[page]));$index.append($.wikiEditor.modules.toolbar.fn.buildBookmark(context,page,section.pages[page]));}} |
136 | 140 | $section=$('<div />').attr({'class':'booklet section section-'+id,'rel':id}).append($index).append($pages);$.wikiEditor.modules.toolbar.fn.updateBookletSelection(context,page,$pages,$index);break;} |
137 | | -if($section!==null&&id!=='main'){$section.css('display',selected==id?'block':'none');} |
| 141 | +if($section!==null&&id!=='main'){var show=selected==id;$section.css('display',show?'block':'none');} |
138 | 142 | return $section;},updateBookletSelection:function(context,id,$pages,$index){var cookie='wikiEditor-'+context.instance+'-booklet-'+id+'-page';var selected=$.cookie(cookie);var $selectedIndex=$index.find('*[rel='+selected+']');if($selectedIndex.size()==0){selected=$index.children().eq(0).attr('rel');$.cookie(cookie,selected);} |
139 | 143 | $pages.children().hide();$pages.find('*[rel='+selected+']').show();$index.children().removeClass('current');$selectedIndex.addClass('current');},build:function(context,config){var $tabs=$('<div />').addClass('tabs').appendTo(context.modules.$toolbar);var $sections=$('<div />').addClass('sections').appendTo(context.modules.$toolbar);context.modules.$toolbar.append($('<div />').css('clear','both'));var sectionQueue=[];for(section in config){if(section=='main'){context.modules.$toolbar.prepend($.wikiEditor.modules.toolbar.fn.buildSection(context,section,config[section]));}else{sectionQueue.push({'$sections':$sections,'context':context,'id':section,'config':config[section]});$tabs.append($.wikiEditor.modules.toolbar.fn.buildTab(context,section,config[section]));}} |
140 | | -$.eachAsync(sectionQueue,{'bulk':0,'end':function(){$('body').css('position','static');$('body').css('position','relative');},'loop':function(i,s){s.$sections.append($.wikiEditor.modules.toolbar.fn.buildSection(s.context,s.id,s.config));}});}}};})(jQuery);(function($){$.wikiEditor.modules.toc={api:{},fn:{create:function(context,config){if('$toc'in context.modules){return;} |
141 | | -context.modules.$toc=$('<div></div>').addClass('wikiEditor-ui-toc').attr('id','wikiEditor-ui-toc');$.wikiEditor.modules.toc.fn.build(context,config);context.$ui.find('.wikiEditor-ui-bottom').append(context.modules.$toc);context.modules.$toc.height(context.$ui.find('.wikiEditor-ui-bottom').height());context.modules.$toc.css('width','12em').css('marginTop',-(context.$ui.find('.wikiEditor-ui-bottom').height()));context.$ui.find('.wikiEditor-ui-text').css(($('body.rtl').size()?'marginLeft':'marginRight'),'12em');$.wikiEditor.modules.toc.fn.build(context);context.$textarea.delayedBind(1000,'keyup encapsulateSelection change',function(event){var context=$(this).data('wikiEditor-context');$(this).eachAsync({bulk:0,loop:function(){$.wikiEditor.modules.toc.fn.build(context);$.wikiEditor.modules.toc.fn.update(context);}});}).bind('mouseup scrollToPosition focus keyup encapsulateSelection change',function(event){var context=$(this).data('wikiEditor-context');$(this).eachAsync({bulk:0,loop:function(){$.wikiEditor.modules.toc.fn.update(context);}});}).blur(function(){var context=$(this).data('wikiEditor-context');$.wikiEditor.modules.toc.fn.unhighlight(context);});},unhighlight:function(context){context.modules.$toc.find('a').removeClass('currentSelection');},update:function(context){$.wikiEditor.modules.toc.fn.unhighlight(context);var position=context.$textarea.getCaretPosition();var section=0;if(context.data.outline.length>0){if(!(position<context.data.outline[0].position-1)){while(section<context.data.outline.length&&context.data.outline[section].position-1<position){section++;} |
| 144 | +$.eachAsync(sectionQueue,{'bulk':0,'end':function(){$('body').css('position','static');$('body').css('position','relative');},'loop':function(i,s){s.$sections.append($.wikiEditor.modules.toolbar.fn.buildSection(s.context,s.id,s.config));var $section=s.$sections.find('.section:visible');if($section.size()){$sections.animate({'height':$section.outerHeight()},'fast');}}});}}};})(jQuery);(function($){$.wikiEditor.modules.toc={api:{},fn:{create:function(context,config){if('$toc'in context.modules){return;} |
| 145 | +context.modules.$toc=$('<div />').addClass('wikiEditor-ui-toc').attr('id','wikiEditor-ui-toc');var height=context.$ui.find('.wikiEditor-ui-bottom').height() |
| 146 | +context.$ui.find('.wikiEditor-ui-bottom').append(context.modules.$toc);context.modules.$toc.height(context.$ui.find('.wikiEditor-ui-bottom').height());context.modules.$toc.css({'width':'12em','marginTop':-(height)});context.$ui.find('.wikiEditor-ui-text').css(($('body.rtl').size()?'marginLeft':'marginRight'),'12em');$.wikiEditor.modules.toc.fn.build(context,config);context.$textarea.delayedBind(1000,'keyup encapsulateSelection change',function(event){var context=$(this).data('wikiEditor-context');$(this).eachAsync({bulk:0,loop:function(){$.wikiEditor.modules.toc.fn.build(context);$.wikiEditor.modules.toc.fn.update(context);}});}).bind('mouseup scrollToPosition focus keyup encapsulateSelection change',function(event){var context=$(this).data('wikiEditor-context');$(this).eachAsync({bulk:0,loop:function(){$.wikiEditor.modules.toc.fn.update(context);}});}).blur(function(){var context=$(this).data('wikiEditor-context');$.wikiEditor.modules.toc.fn.unhighlight(context);});},unhighlight:function(context){context.modules.$toc.find('a').removeClass('currentSelection');},update:function(context){$.wikiEditor.modules.toc.fn.unhighlight(context);var position=context.$textarea.getCaretPosition();var section=0;if(context.data.outline.length>0){if(!(position<context.data.outline[0].position-1)){while(section<context.data.outline.length&&context.data.outline[section].position-1<position){section++;} |
142 | 147 | section=Math.max(0,section);} |
143 | 148 | var sectionLink=context.modules.$toc.find('a.section-'+section);sectionLink.addClass('currentSelection');var relTop=sectionLink.offset().top-context.modules.$toc.offset().top;var scrollTop=context.modules.$toc.scrollTop();var divHeight=context.modules.$toc.height();var sectionHeight=sectionLink.height();if(relTop<0) |
144 | 149 | context.modules.$toc.scrollTop(scrollTop+relTop);else if(relTop+sectionHeight>divHeight) |
145 | 150 | context.modules.$toc.scrollTop(scrollTop+relTop+sectionHeight-divHeight);}},build:function(context){function buildStructure(outline,offset,level){if(offset==undefined)offset=0;if(level==undefined)level=1;var sections=[];for(var i=offset;i<outline.length;i++){if(outline[i].nLevel==level){var sub=buildStructure(outline,i+1,level+1);if(sub.length){outline[i].sections=sub;} |
146 | 151 | sections[sections.length]=outline[i];}else if(outline[i].nLevel<level){break;}} |
147 | 152 | return sections;} |
148 | | -function buildList(structure){var list=$('<ul></ul>');for(i in structure){var item=$('<li></li>').append($('<a></a>').attr('href','#').addClass('section-'+structure[i].index).data('textbox',context.$textarea).data('position',structure[i].position).click(function(event){$(this).data('textbox').setSelection($(this).data('position')).scrollToCaretPosition(true);event.preventDefault();}).text(structure[i].text));if(structure[i].sections!==undefined){item.append(buildList(structure[i].sections));} |
| 153 | +function buildList(structure){var list=$('<ul />');for(i in structure){var item=$('<li />').append($('<a />').attr('href','#').addClass('section-'+structure[i].index).data('textbox',context.$textarea).data('position',structure[i].position).click(function(event){$(this).data('textbox').focus().setSelection($(this).data('position')).scrollToCaretPosition(true);event.preventDefault();}).text(structure[i].text));if(structure[i].sections!==undefined){item.append(buildList(structure[i].sections));} |
149 | 154 | list.append(item);} |
150 | 155 | return list;} |
151 | | -var outline=[];var wikitext='\n'+$.wikiEditor.fixOperaBrokenness(context.$textarea.val())+'\n';var headings=wikitext.match(/^={1,6}.+={1,6}\s*$/gm);var offset=0;headings=$.makeArray(headings);for(var h=0;h<headings.length;h++){text=headings[h];var position=wikitext.indexOf(text,offset);if(position>offset){offset=position+1;}else if(position==-1){continue;} |
152 | | -text=$.trim(text);var startLevel=0;for(var c=0;c<text.length;c++){if(text.charAt(c)=='='){startLevel++;}else{break;}} |
| 156 | +var outline=[];var wikitext=$.wikiEditor.fixOperaBrokenness(context.$textarea.val());var headings=wikitext.match(/^={1,6}.+={1,6}\s*$/gm);var offset=0;headings=$.makeArray(headings);for(var h=0;h<headings.length;h++){text=$.trim(headings[h]);var position=wikitext.indexOf(text,offset);if(position>=offset){offset=position+text.length;}else if(position==-1){continue;} |
| 157 | +var startLevel=0;for(var c=0;c<text.length;c++){if(text.charAt(c)=='='){startLevel++;}else{break;}} |
153 | 158 | var endLevel=0;for(var c=text.length-1;c>=0;c--){if(text.charAt(c)=='='){endLevel++;}else{break;}} |
154 | 159 | var level=Math.min(startLevel,endLevel);text=$.trim(text.substr(level,text.length-(level*2)));outline[h]={'text':text,'position':position,'level':level,'index':h+1};} |
155 | 160 | var lastLevel=0;var nLevel=0;for(var i=0;i<outline.length;i++){if(outline[i].level>lastLevel){nLevel++;} |
— | — | @@ -156,4 +161,4 @@ |
157 | 162 | if(nLevel<=0){nLevel=1;} |
158 | 163 | outline[i].nLevel=nLevel;lastLevel=outline[i].level;} |
159 | 164 | var structure=buildStructure(outline);if($('input[name=wpSection]').val()=='') |
160 | | -structure.unshift({'text':wgPageName.replace(/_/g,' '),'level':1,'index':0,'position':0});context.modules.$toc.html(buildList(structure));context.modules.$toc.find('ul a').autoEllipse({'position':'right','tooltip':true});context.data.outline=outline;}}};})(jQuery); |
\ No newline at end of file |
| 165 | +structure.unshift({'text':wgPageName.replace(/_/g,' '),'level':1,'index':0,'position':0});context.modules.$toc.html(buildList(structure));context.modules.$toc.find('ul').css('width','10em');var links=context.modules.$toc.find('ul a');links.addClass('currentSelection');links.autoEllipse({'position':'right','tooltip':true});links.removeClass('currentSelection');context.data.outline=outline;}}};})(jQuery); |
\ No newline at end of file |
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.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 | /** |
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/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/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/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/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; |