Index: branches/resourceloader/phase3/resources/mw/mw.legacy.htmlform.js |
— | — | @@ -1,19 +0,0 @@ |
2 | | -/* |
3 | | - * Legacy emulation for the now depricated skins/common/htmlform.js |
4 | | - */ |
5 | | - |
6 | | -( function( $, mw ) { |
7 | | - |
8 | | -/* Extension */ |
9 | | - |
10 | | -$.extend( mw.legacy, { |
11 | | - // |
12 | | -} ); |
13 | | - |
14 | | -/* Initialization */ |
15 | | - |
16 | | -$( document ).ready( function() { |
17 | | - // |
18 | | -} ); |
19 | | - |
20 | | -} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Index: branches/resourceloader/phase3/resources/mw/mw.legacy.rightclickedit.js |
— | — | @@ -1,19 +0,0 @@ |
2 | | -/* |
3 | | - * Legacy emulation for the now depricated skins/common/rightclick.js |
4 | | - */ |
5 | | - |
6 | | -( function( $, mw ) { |
7 | | - |
8 | | -/* Extension */ |
9 | | - |
10 | | -$.extend( mw.legacy, { |
11 | | - // |
12 | | -} ); |
13 | | - |
14 | | -/* Initialization */ |
15 | | - |
16 | | -$( document ).ready( function() { |
17 | | - // |
18 | | -} ); |
19 | | - |
20 | | -} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Index: branches/resourceloader/phase3/resources/mw/mw.legacy.block.js |
— | — | @@ -1,44 +0,0 @@ |
2 | | -/* |
3 | | - * Legacy emulation for the now depricated skins/common/block.js |
4 | | - */ |
5 | | - |
6 | | -( function( $, mw ) { |
7 | | - |
8 | | -/* Extension */ |
9 | | - |
10 | | -$.extend( mw.legacy, { |
11 | | - |
12 | | - /* Functions */ |
13 | | - |
14 | | - 'considerChangingExpiryFocus': function() { |
15 | | - var $expiry = $( '#wpBlockExpiry' ); |
16 | | - var $other = $( '#wpBlockOther' ); |
17 | | - if ( $expiry.length && $other.length ) { |
18 | | - if ( $expiry.val() == 'other' ) { |
19 | | - $other.css( 'display', '' ); |
20 | | - } else { |
21 | | - $other.css( 'display', 'none' ); |
22 | | - } |
23 | | - } |
24 | | - }, |
25 | | - 'updateBlockOptions': function() { |
26 | | - var $target = $( '#mw-bi-target' ); |
27 | | - if ( $target.length ) { |
28 | | - var address = $target.val(); |
29 | | - var isEmpty = address.match( /^\s*$/ ); |
30 | | - var isIp = address.match( /^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|:(:[0-9A-Fa-f]{1,4}){1,7}|[0-9A-Fa-f]{1,4}(:{1,2}[0-9A-Fa-f]{1,4}|::$){1,7})(\/\d+)?$/ ); |
31 | | - var isIpRange = isIp && address.match( /\/\d+$/ ); |
32 | | - $( '#wpAnonOnlyRow' ).css( 'display', !isIp && !isEmpty ? 'none' : '' ); |
33 | | - $( '#wpEnableAutoblockRow,#wpEnableHideUser' ).css( 'display', isIp && !isEmpty ? 'none' : '' ); |
34 | | - $( '#wpEnableWatchUser' ).css( 'display', isIpRange && !isEmpty ? 'none' : '' ); |
35 | | - } |
36 | | - } |
37 | | -} ); |
38 | | - |
39 | | -/* Initialization */ |
40 | | - |
41 | | -$( document ).ready( function() { |
42 | | - mw.legacy.considerChangingExpiryFocus(); |
43 | | -} ); |
44 | | - |
45 | | -} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Index: branches/resourceloader/phase3/resources/mw/mw.legacy.IEFixes.js |
— | — | @@ -1,19 +0,0 @@ |
2 | | -/* |
3 | | - * Legacy emulation for the now depricated skins/common/IEFixes.js |
4 | | - */ |
5 | | - |
6 | | -( function( $, mw ) { |
7 | | - |
8 | | -/* Extension */ |
9 | | - |
10 | | -$.extend( mw.legacy, { |
11 | | - // |
12 | | -} ); |
13 | | - |
14 | | -/* Initialization */ |
15 | | - |
16 | | -$( document ).ready( function() { |
17 | | - // |
18 | | -} ); |
19 | | - |
20 | | -} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Index: branches/resourceloader/phase3/resources/mw/mw.legacy.enhancedchanges.js |
— | — | @@ -1,46 +0,0 @@ |
2 | | -/* |
3 | | - * Legacy emulation for the now depricated skins/common/enhancedchanges.js |
4 | | - */ |
5 | | - |
6 | | -( function( $, mw ) { |
7 | | - |
8 | | -/* Extension */ |
9 | | - |
10 | | -$.extend( mw.legacy, { |
11 | | - |
12 | | - /* Functions */ |
13 | | - |
14 | | - /** |
15 | | - * Switch an RC line between hidden/shown |
16 | | - * |
17 | | - * @param integer idNumber : the id number of the RC group |
18 | | - */ |
19 | | - 'toggleVisibility': function( idNumber ) { |
20 | | - var elements = [ |
21 | | - '#mw-rc-openarrow-' + idNumber, |
22 | | - '#mw-rc-closearrow-' + idNumber, |
23 | | - '#mw-rc-subentries-' + idNumber |
24 | | - ]; |
25 | | - $( elements.join( ',' ) ).toggleClass( 'mw-changeslist-hidden' ).toggleClass( 'mw-changeslist-expanded' ); |
26 | | - } |
27 | | -} ); |
28 | | - |
29 | | -/* Initialization */ |
30 | | - |
31 | | -$( document ).ready( function() { |
32 | | - /* |
33 | | - * Add the CSS to hide parts that should be collapsed |
34 | | - * |
35 | | - * We do this with JS so everything will be expanded by default |
36 | | - * if JS is disabled |
37 | | - */ |
38 | | - $( 'head' ).append( |
39 | | - '<style type="text/css">\ |
40 | | - .mw-changeslist-hidden { display:none; }\ |
41 | | - div.mw-changeslist-expanded { display:block; }\ |
42 | | - span.mw-changeslist-expanded { display:inline !important; visibility:visible !important; }\ |
43 | | - </style>' |
44 | | - ); |
45 | | -} ); |
46 | | - |
47 | | -} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Index: branches/resourceloader/phase3/resources/mw/mw.views.diff.js |
— | — | @@ -1,28 +0,0 @@ |
2 | | -/* |
3 | | - * Diff-view progressive enhancement (ported from skins/common/diff.js) |
4 | | - */ |
5 | | - |
6 | | -( function( $, mw ) { |
7 | | - |
8 | | -/* Initialization */ |
9 | | - |
10 | | -$( document ).ready( function() { |
11 | | - /* |
12 | | - * Workaround for overflow bug in Mozilla 1.1 and earlier, where scrolling <div>s in <td> cells collapse their |
13 | | - * height to a single line. |
14 | | - * |
15 | | - * Known to be fixed in 1.2.1 (Gecko 20021130), but the CSS hacks I've tried with overflow-x disable the scrolling |
16 | | - * all the way until Mozilla 1.8 / FF 1.5 and break Opera as well. |
17 | | - * |
18 | | - * So... we check for reaaaally old Gecko and hack in an alternate rule to let the wide cells spill instead of |
19 | | - * scrolling them. Not ideal as it won't work if JS is disabled, of course. |
20 | | - */ |
21 | | - if ( window.navigator && window.navigator.product == 'Gecko' && window.navigator.productSub < '20021130' ) { |
22 | | - document.styleSheets[document.styleSheets.length - 1].insertRule( |
23 | | - 'table.diff td div { overflow: visible; }', |
24 | | - document.styleSheets[document.styleSheets.length - 1].cssRules.length |
25 | | - ); |
26 | | - } |
27 | | -} ); |
28 | | - |
29 | | -} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Index: branches/resourceloader/phase3/resources/mw/mw.legacy.history.js |
— | — | @@ -1,115 +0,0 @@ |
2 | | -/* |
3 | | - * Legacy emulation for the now depricated skins/common/history.js |
4 | | - */ |
5 | | - |
6 | | -( function( $, mw ) { |
7 | | - |
8 | | -/* Extension */ |
9 | | - |
10 | | -$.extend( mw.legacy, { |
11 | | - |
12 | | - /* Functions */ |
13 | | - |
14 | | - 'historyRadios': function( parent ) { |
15 | | - var inputs = parent.getElementsByTagName('input'); |
16 | | - var radios = []; |
17 | | - for (var i = 0; i < inputs.length; i++) { |
18 | | - if (inputs[i].name == "diff" || inputs[i].name == "oldid") { |
19 | | - radios[radios.length] = inputs[i]; |
20 | | - } |
21 | | - } |
22 | | - return radios; |
23 | | - }, |
24 | | - /* |
25 | | - * Check selection and tweak visibility/class onclick |
26 | | - */ |
27 | | - 'diffcheck': function() { |
28 | | - var dli = false; // the li where the diff radio is checked |
29 | | - var oli = false; // the li where the oldid radio is checked |
30 | | - var hf = document.getElementById('pagehistory'); |
31 | | - if (!hf) { |
32 | | - return true; |
33 | | - } |
34 | | - var lis = hf.getElementsByTagName('li'); |
35 | | - for (var i=0;i<lis.length;i++) { |
36 | | - var inputs = historyRadios(lis[i]); |
37 | | - if (inputs[1] && inputs[0]) { |
38 | | - if (inputs[1].checked || inputs[0].checked) { // this row has a checked radio button |
39 | | - if (inputs[1].checked && inputs[0].checked && inputs[0].value == inputs[1].value) { |
40 | | - return false; |
41 | | - } |
42 | | - if (oli) { // it's the second checked radio |
43 | | - if (inputs[1].checked) { |
44 | | - if ( (typeof oli.className) != 'undefined') { |
45 | | - oli.classNameOriginal = oli.className.replace( 'selected', '' ); |
46 | | - } else { |
47 | | - oli.classNameOriginal = ''; |
48 | | - } |
49 | | - |
50 | | - oli.className = "selected "+oli.classNameOriginal; |
51 | | - return false; |
52 | | - } |
53 | | - } else if (inputs[0].checked) { |
54 | | - return false; |
55 | | - } |
56 | | - if (inputs[0].checked) { |
57 | | - dli = lis[i]; |
58 | | - } |
59 | | - if (!oli) { |
60 | | - inputs[0].style.visibility = 'hidden'; |
61 | | - } |
62 | | - if (dli) { |
63 | | - inputs[1].style.visibility = 'hidden'; |
64 | | - } |
65 | | - if ( (typeof lis[i].className) != 'undefined') { |
66 | | - lis[i].classNameOriginal = lis[i].className.replace( 'selected', '' ); |
67 | | - } else { |
68 | | - lis[i].classNameOriginal = ''; |
69 | | - } |
70 | | - |
71 | | - lis[i].className = "selected "+lis[i].classNameOriginal; |
72 | | - oli = lis[i]; |
73 | | - } else { // no radio is checked in this row |
74 | | - if (!oli) { |
75 | | - inputs[0].style.visibility = 'hidden'; |
76 | | - } else { |
77 | | - inputs[0].style.visibility = 'visible'; |
78 | | - } |
79 | | - if (dli) { |
80 | | - inputs[1].style.visibility = 'hidden'; |
81 | | - } else { |
82 | | - inputs[1].style.visibility = 'visible'; |
83 | | - } |
84 | | - if ( typeof lis[i].classNameOriginal != 'undefined' ) { |
85 | | - lis[i].className = lis[i].classNameOriginal; |
86 | | - } |
87 | | - } |
88 | | - } |
89 | | - } |
90 | | - return true; |
91 | | - }, |
92 | | - /* |
93 | | - * Attach event handlers to the input elements on history page |
94 | | - */ |
95 | | - 'histrowinit': function() { |
96 | | - var hf = document.getElementById('pagehistory'); |
97 | | - if (!hf) return; |
98 | | - var lis = hf.getElementsByTagName('li'); |
99 | | - for (var i = 0; i < lis.length; i++) { |
100 | | - var inputs = historyRadios(lis[i]); |
101 | | - if (inputs[0] && inputs[1]) { |
102 | | - inputs[0].onclick = diffcheck; |
103 | | - inputs[1].onclick = diffcheck; |
104 | | - } |
105 | | - } |
106 | | - diffcheck(); |
107 | | - } |
108 | | -} ); |
109 | | - |
110 | | -/* Initialization */ |
111 | | - |
112 | | -$( document ).ready( function() { |
113 | | - mw.legacy.histrowinit(); |
114 | | -} ); |
115 | | - |
116 | | -} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Index: branches/resourceloader/phase3/resources/mw/mw.legacy.search.js |
— | — | @@ -1,19 +0,0 @@ |
2 | | -/* |
3 | | - * Legacy emulation for the now depricated skins/common/search.js |
4 | | - */ |
5 | | - |
6 | | -( function( $, mw ) { |
7 | | - |
8 | | -/* Extension */ |
9 | | - |
10 | | -$.extend( mw.legacy, { |
11 | | - // |
12 | | -} ); |
13 | | - |
14 | | -/* Initialization */ |
15 | | - |
16 | | -$( document ).ready( function() { |
17 | | - // |
18 | | -} ); |
19 | | - |
20 | | -} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Index: branches/resourceloader/phase3/resources/mw/mw.legacy.changepassword.js |
— | — | @@ -1,29 +0,0 @@ |
2 | | -/* |
3 | | - * Legacy emulation for the now depricated skins/common/changepassword.js |
4 | | - */ |
5 | | - |
6 | | -( function( $, mw ) { |
7 | | - |
8 | | -/* Extension */ |
9 | | - |
10 | | -$.extend( mw.legacy, { |
11 | | - |
12 | | - /* Functions */ |
13 | | - |
14 | | - 'onNameChange': function() { |
15 | | - var state = mw.legacy.wgUserName != $( '#wpName' ).val(); |
16 | | - $( '#wpPassword' ).attr( 'disabled', state ); |
17 | | - $( '#wpComment' ).attr( 'disabled', !state ); |
18 | | - }, |
19 | | - 'onNameChangeHook': function() { |
20 | | - $( '#wpName' ).blur( mw.legacy.onNameChange ); |
21 | | - } |
22 | | -} ); |
23 | | - |
24 | | -/* Initialization */ |
25 | | - |
26 | | -$( document ).ready( function() { |
27 | | - mw.legacy.onNameChangeHook(); |
28 | | -} ); |
29 | | - |
30 | | -} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Index: branches/resourceloader/phase3/resources/mw/mw.legacy.ajaxwatch.js |
— | — | @@ -1,136 +0,0 @@ |
2 | | -/* |
3 | | - * Legacy emulation for the now depricated skins/common/ajaxwatch.js |
4 | | - * |
5 | | - * AJAX functionality for the watch/unwatch link |
6 | | - * |
7 | | - * @depends mw.legacy.jsMsg() from mw.legacy.wikibits.js |
8 | | - */ |
9 | | - |
10 | | -( function( $, mw ) { |
11 | | - |
12 | | -/* Extension */ |
13 | | - |
14 | | -$.extend( mw.legacy, { |
15 | | - |
16 | | - /* Global Variables */ |
17 | | - |
18 | | - 'wgAjaxWatch': { |
19 | | - |
20 | | - /* Global Variables */ |
21 | | - |
22 | | - 'watchMsg': 'Watch', |
23 | | - 'unwatchMsg': 'Unwatch', |
24 | | - 'watchingMsg': 'Watching...', |
25 | | - 'unwatchingMsg': 'Unwatching...', |
26 | | - 'tooltip-ca-watchMsg': 'Add this page to your watchlist', |
27 | | - 'tooltip-ca-unwatchMsg': 'Remove this page from your watchlist', |
28 | | - |
29 | | - /* Functions */ |
30 | | - |
31 | | - /** |
32 | | - * Sets the text of the watch/unwatch link |
33 | | - * |
34 | | - * @param object link DOM node or jQuery selection of link to set text of |
35 | | - * @param string action message to use ('watch', 'unwatch', 'watching' or 'unwatching') |
36 | | - */ |
37 | | - 'setLinkText': function( link, action ) { |
38 | | - var $link = $( link ); |
39 | | - if ( action == 'watch' || action == 'unwatch' ) { |
40 | | - // save the accesskey from the title |
41 | | - var keyCommand = $link.attr( 'title' ).match( /\[.*?\]$/ ) ? |
42 | | - $link.attr( 'title' ).match( /\[.*?\]$/ )[0] : ''; |
43 | | - $link.attr( 'title', wgAjaxWatch['tooltip-ca-' + action + 'Msg'] + ' ' + keyCommand ); |
44 | | - } |
45 | | - if ( $link.data( 'icon' ) ) { |
46 | | - $link.attr( 'alt', wgAjaxWatch[action + 'Msg'] ); |
47 | | - if ( action == 'watching' || action == 'unwatching' ) { |
48 | | - $link.addClass( 'loading' ); |
49 | | - } else { |
50 | | - $link.removeClass( 'loading' ); |
51 | | - } |
52 | | - } else { |
53 | | - $link.html( wgAjaxWatch[action+'Msg'] ); |
54 | | - } |
55 | | - }, |
56 | | - /** |
57 | | - * Processes responses from the server |
58 | | - * |
59 | | - * @param object response data from server |
60 | | - */ |
61 | | - 'processResult': function( response ) { |
62 | | - response = response.watch; |
63 | | - var $link = $(this); |
64 | | - // To ensure we set the same status for all watch links with the same target we trigger a custom event on |
65 | | - // *all* watch links. |
66 | | - if ( response.watched !== undefined ) { |
67 | | - wgAjaxWatch.$links.trigger( 'mw-ajaxwatch', [response.title, 'watch'] ); |
68 | | - } else if ( response.unwatched !== undefined ){ |
69 | | - wgAjaxWatch.$links.trigger( 'mw-ajaxwatch', [response.title, 'unwatch'] ); |
70 | | - } else { |
71 | | - // Either we got an error code or it just plain broke. |
72 | | - window.location.href = $link.attr( 'href' ); |
73 | | - return; |
74 | | - } |
75 | | - mw.legacy.jsMsg( response.message, 'watch' ); |
76 | | - // Bug 12395 - update the watch checkbox on edit pages when the page is watched or unwatched via the tab. |
77 | | - if ( response.watched !== undefined ) { |
78 | | - $j("#wpWatchthis").attr( 'checked', '1' ); |
79 | | - } else { |
80 | | - $j("#wpWatchthis").removeAttr( 'checked' ); |
81 | | - } |
82 | | - } |
83 | | - } ); |
84 | | -} ); |
85 | | - |
86 | | -/* Initialization */ |
87 | | - |
88 | | -$( document ).ready( function() { |
89 | | - var $links = $( '.mw-watchlink a, a.mw-watchlink' ); |
90 | | - // BC with older skins... |
91 | | - $links = $links |
92 | | - .add( $( '#ca-watch a, #ca-unwatch a, a#mw-unwatch-link1' ) ) |
93 | | - .add( $( 'a#mw-unwatch-link2, a#mw-watch-link2, a#mw-watch-link1' ) ); |
94 | | - // ...allowing people to add inline animated links is a little scary |
95 | | - $links = $links.filter( ':not( #bodyContent *, #content * )' ); |
96 | | - $links.each( function() { |
97 | | - var $link = $(this); |
98 | | - $link |
99 | | - .data( 'icon', $link.parent().hasClass( 'icon' ) ) |
100 | | - .data( 'action', $link.attr( 'href' ).match( /[\?\&]action=unwatch/i ) ? 'unwatch' : 'watch' ); |
101 | | - var title = $link.attr( 'href' ).match( /[\?\&]title=(.*?)&/i )[1]; |
102 | | - $link.data( 'target', decodeURIComponent( title ).replace( /_/g, ' ' ) ); |
103 | | - } ); |
104 | | - $links.click( function( event ) { |
105 | | - var $link = $(this); |
106 | | - if ( mw.legacy.wgAjaxWatch.supported === false || !mw.legacy.wgEnableWriteAPI || !mw.legacy.wfSupportsAjax() ) { |
107 | | - // Lazy initialization so we don't toss up ActiveX warnings on initial page load for IE 6 users with |
108 | | - // security settings. |
109 | | - mw.legacy.wgAjaxWatch.$links.unbind( 'click' ); |
110 | | - return true; |
111 | | - } |
112 | | - mw.legacy.wgAjaxWatch.setLinkText( $link, $link.data( 'action' ) + 'ing' ); |
113 | | - var url = mw.legacy.wgScriptPath + '/api' + mw.legacy.wgScriptExtension + '?action=watch&format=json&title=' |
114 | | - + encodeURIComponent( $link.data( 'target' ) ) + ( $link.data( 'action' ) == 'unwatch' ? '&unwatch' : '' ); |
115 | | - $.get( url, {}, mw.legacy.wgAjaxWatch.processResult, 'json' ); |
116 | | - return false; |
117 | | - } ); |
118 | | - // When a request returns, a custom event 'mw-ajaxwatch' is triggered on *all* watch links, so they can be updated |
119 | | - // if necessary |
120 | | - $links.bind( 'mw-ajaxwatch', function( event, target, action ) { |
121 | | - var $link = $(this); |
122 | | - var foo = $link.data( 'target' ); |
123 | | - if ( $link.data( 'target' ) == target ) { |
124 | | - var otheraction = action == 'watch' ? 'unwatch' : 'watch'; |
125 | | - $link.data( 'action', otheraction ); |
126 | | - wgAjaxWatch.setLinkText( $link, otheraction ); |
127 | | - $link.attr( 'href', $link.attr( 'href' ).replace( '/&action=' + action + '/', '&action=' + otheraction ) ); |
128 | | - if ( $link.parent().attr( 'id' ) == 'ca-' + action ){ |
129 | | - $link.parent().attr( 'id', 'ca-' + otheraction ); |
130 | | - } |
131 | | - } |
132 | | - return false; |
133 | | - } ); |
134 | | - mw.legacy.wgAjaxWatch.$links = $links; |
135 | | -} ); |
136 | | - |
137 | | -} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Index: branches/resourceloader/phase3/resources/mw/mw.legacy.prefs.js |
— | — | @@ -1,19 +0,0 @@ |
2 | | -/* |
3 | | - * Legacy emulation for the now depricated skins/common/prefs.js |
4 | | - */ |
5 | | - |
6 | | -( function( $, mw ) { |
7 | | - |
8 | | -/* Extension */ |
9 | | - |
10 | | -$.extend( mw.legacy, { |
11 | | - // |
12 | | -} ); |
13 | | - |
14 | | -/* Initialization */ |
15 | | - |
16 | | -$( document ).ready( function() { |
17 | | - // |
18 | | -} ); |
19 | | - |
20 | | -} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Index: branches/resourceloader/phase3/resources/mw/mw.legacy.protect.js |
— | — | @@ -1,19 +0,0 @@ |
2 | | -/* |
3 | | - * Legacy emulation for the now depricated skins/common/protect.js |
4 | | - */ |
5 | | - |
6 | | -( function( $, mw ) { |
7 | | - |
8 | | -/* Extension */ |
9 | | - |
10 | | -$.extend( mw.legacy, { |
11 | | - // |
12 | | -} ); |
13 | | - |
14 | | -/* Initialization */ |
15 | | - |
16 | | -$( document ).ready( function() { |
17 | | - // |
18 | | -} ); |
19 | | - |
20 | | -} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Index: branches/resourceloader/phase3/resources/mw/mw.legacy.metadata.js |
— | — | @@ -1,19 +0,0 @@ |
2 | | -/* |
3 | | - * Legacy emulation for the now depricated skins/common/metadata.js |
4 | | - */ |
5 | | - |
6 | | -( function( $, mw ) { |
7 | | - |
8 | | -/* Extension */ |
9 | | - |
10 | | -$.extend( mw.legacy, { |
11 | | - // |
12 | | -} ); |
13 | | - |
14 | | -/* Initialization */ |
15 | | - |
16 | | -$( document ).ready( function() { |
17 | | - // |
18 | | -} ); |
19 | | - |
20 | | -} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Index: branches/resourceloader/phase3/resources/mw/mw.legacy.preview.js |
— | — | @@ -1,19 +0,0 @@ |
2 | | -/* |
3 | | - * Legacy emulation for the now depricated skins/common/preview.js |
4 | | - */ |
5 | | - |
6 | | -( function( $, mw ) { |
7 | | - |
8 | | -/* Extension */ |
9 | | - |
10 | | -$.extend( mw.legacy, { |
11 | | - // |
12 | | -} ); |
13 | | - |
14 | | -/* Initialization */ |
15 | | - |
16 | | -$( document ).ready( function() { |
17 | | - // |
18 | | -} ); |
19 | | - |
20 | | -} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Index: branches/resourceloader/phase3/resources/mw/mw.legacy.ajax.js |
— | — | @@ -1,176 +0,0 @@ |
2 | | -/* |
3 | | - * Legacy emulation for the now depricated skins/common/ajax.js |
4 | | - * |
5 | | - * Original licensing information: |
6 | | - * Remote Scripting Library |
7 | | - * (c) Copyright 2005 ModernMethod, Inc. |
8 | | - */ |
9 | | - |
10 | | -( function( $, mw ) { |
11 | | - |
12 | | -/* Extension */ |
13 | | - |
14 | | -$.extend( mw.legacy, { |
15 | | - |
16 | | - /* Global Variables */ |
17 | | - |
18 | | - 'sajax_debug_mode': false, |
19 | | - 'sajax_debug_mode': "GET", |
20 | | - |
21 | | - /* Functions */ |
22 | | - |
23 | | - /** |
24 | | - * If sajax_debug_mode is true, this function outputs given the message into the element with id = sajax_debug; if no |
25 | | - * such element exists in the document, it is injected |
26 | | - * |
27 | | - * @param string text debug message to append to log |
28 | | - * @return boolean true when in debug mode, false when not |
29 | | - */ |
30 | | - 'sajax_debug': function( text ) { |
31 | | - if ( mw.legacy.sajax_debug_mode ) { |
32 | | - var $e = $( '#sajax_debug' ); |
33 | | - if ( !$e.length ) { |
34 | | - $e = $( '<p class="sajax_debug" id="sajax_debug"></p>' ).prependTo( $( 'body' ) ); |
35 | | - } |
36 | | - $e.append( $( '<div></div>' ).text( text ) ); |
37 | | - return true; |
38 | | - } |
39 | | - return false; |
40 | | - }, |
41 | | - /** |
42 | | - * Gets an XMLHttpRequest or equivilant ActiveXObject |
43 | | - * |
44 | | - * @reuturn mixed request object on success, boolean false on failure |
45 | | - */ |
46 | | - 'sajax_init_object': function() { |
47 | | - mw.legacy.sajax_debug( 'sajax_init_object() called..' ); |
48 | | - var request = false; |
49 | | - try { |
50 | | - // Try the "new" style before ActiveX so we don't unnecessarily trigger warnings in IE 7 when the user's |
51 | | - // security settings are set to prompt about ActiveX usage |
52 | | - request = new XMLHttpRequest(); |
53 | | - } catch ( e ) { |
54 | | - try { |
55 | | - request = new ActiveXObject( 'Msxml2.XMLHTTP' ); |
56 | | - } catch ( e ) { |
57 | | - try { |
58 | | - request = new ActiveXObject( 'Microsoft.XMLHTTP' ); |
59 | | - } catch ( oc ) { |
60 | | - request = null; |
61 | | - } |
62 | | - } |
63 | | - } |
64 | | - if ( !request ) { |
65 | | - mw.legacy.sajax_debug( 'Could not create connection object.' ); |
66 | | - } |
67 | | - return request; |
68 | | - }, |
69 | | - /** |
70 | | - * Performs an ajax call to mediawiki. Calls are handeled by AjaxDispatcher.php |
71 | | - * |
72 | | - * @param string method name of the function to call. Must be registered in $wgAjaxExportList |
73 | | - * @param array arguments arguments to that function |
74 | | - * @param mixed target the target that will handle the result of the call. If this is a function, if will be called |
75 | | - * with the XMLHttpRequest as a parameter; if it's an input element, its value will be set to the resultText; if |
76 | | - * it's another type of element, its innerHTML will be set to the resultText. |
77 | | - * |
78 | | - * @example |
79 | | - * // This will call the doFoo function via MediaWiki's AjaxDispatcher, with (1, 2, 3) as the parameter list, |
80 | | - * // and will show the result in the element with id = showFoo |
81 | | - * sajax_do_call( 'doFoo', [1, 2, 3], document.getElementById( 'showFoo' ) ); |
82 | | - */ |
83 | | - 'sajax_do_call': function( method, arguments, target ) { |
84 | | - var post_data; |
85 | | - var uri = mw.legacy.wgServer + |
86 | | - ( ( mw.legacy.wgScript == null ) ? ( mw.legacy.wgScriptPath + '/index.php' ) : mw.legacy.wgScript ) + |
87 | | - '?action=ajax'; |
88 | | - if ( mw.legacy.sajax_request_type == 'GET' ) { |
89 | | - if ( uri.indexOf( '?' ) == -1 ) { |
90 | | - uri = uri + '?rs=' + encodeURIComponent( method ); |
91 | | - } else { |
92 | | - uri = uri + '&rs=' + encodeURIComponent( method ); |
93 | | - } |
94 | | - for ( var i = 0; i < arguments.length; i++ ) { |
95 | | - uri = uri + '&rsargs[]=' + encodeURIComponent( arguments[i] ); |
96 | | - } |
97 | | - post_data = null; |
98 | | - } else { |
99 | | - post_data = 'rs=' + encodeURIComponent( method ); |
100 | | - for ( var i = 0; i < arguments.length; i++ ) { |
101 | | - post_data = post_data + '&rsargs[]=' + encodeURIComponent( arguments[i] ); |
102 | | - } |
103 | | - } |
104 | | - var request = mw.legacy.sajax_init_object(); |
105 | | - if ( !request ) { |
106 | | - alert( 'AJAX not supported' ); |
107 | | - return false; |
108 | | - } |
109 | | - try { |
110 | | - request.open( mw.legacy.sajax_request_type, uri, true ); |
111 | | - } catch ( e ) { |
112 | | - if ( window.location.hostname == "localhost" ) { |
113 | | - alert( |
114 | | - 'Your browser blocks XMLHttpRequest to \'localhost\', ' + |
115 | | - 'try using a real hostname for development/testing.' |
116 | | - ); |
117 | | - } |
118 | | - throw e; |
119 | | - } |
120 | | - if ( mw.legacy.sajax_request_type == 'POST' ) { |
121 | | - request.setRequestHeader( 'Method', 'POST ' + uri + ' HTTP/1.1' ); |
122 | | - request.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded' ); |
123 | | - } |
124 | | - request.setRequestHeader( 'Pragma', 'cache=yes' ); |
125 | | - request.setRequestHeader( 'Cache-Control', 'no-transform' ); |
126 | | - request.onreadystatechange = function() { |
127 | | - if ( request.readyState != 4 ) { |
128 | | - return; |
129 | | - } |
130 | | - mw.legacy.sajax_debug( |
131 | | - 'received (' + request.status + ' ' + request.statusText + ') ' + request.responseText |
132 | | - ); |
133 | | - if ( typeof( target ) == 'function' ) { |
134 | | - target( request ); |
135 | | - } else if ( typeof( target ) == 'object' ) { |
136 | | - $target = $( target ); |
137 | | - if ( $target.is( 'input' ) ) { |
138 | | - if ( request.status == 200 ) { |
139 | | - $target.val(); |
140 | | - } |
141 | | - } else { |
142 | | - if ( request.status == 200 ) { |
143 | | - $target.html( request.responseText ); |
144 | | - } else { |
145 | | - $target.html( |
146 | | - '<div class="error">' + |
147 | | - 'Error: ' + request.status + ' ' + request.statusText + |
148 | | - ' (' + request.responseText + ')' + |
149 | | - '</div>' |
150 | | - ); |
151 | | - } |
152 | | - } |
153 | | - } else { |
154 | | - alert( 'Bad target for sajax_do_call: not a function or object: ' + target ); |
155 | | - } |
156 | | - return; |
157 | | - } |
158 | | - mw.legacy.sajax_debug( method + ' uri = ' + uri + ' / post = ' + post_data ); |
159 | | - request.send( post_data ); |
160 | | - mw.legacy.sajax_debug( method + ' waiting..' ); |
161 | | - delete x; |
162 | | - return true; |
163 | | - }, |
164 | | - /** |
165 | | - * Ajax compatibility test |
166 | | - * |
167 | | - * @return boolean whether the browser supports XMLHttpRequest |
168 | | - */ |
169 | | - 'wfSupportsAjax': function() { |
170 | | - var request = mw.legacy.sajax_init_object(); |
171 | | - var result = request ? true : false; |
172 | | - delete request; |
173 | | - return result; |
174 | | - } |
175 | | -} ); |
176 | | - |
177 | | -} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Index: branches/resourceloader/phase3/resources/mw/mw.legacy.upload.js |
— | — | @@ -1,19 +0,0 @@ |
2 | | -/* |
3 | | - * Legacy emulation for the now depricated skins/common/upload.js |
4 | | - */ |
5 | | - |
6 | | -( function( $, mw ) { |
7 | | - |
8 | | -/* Extension */ |
9 | | - |
10 | | -$.extend( mw.legacy, { |
11 | | - // |
12 | | -} ); |
13 | | - |
14 | | -/* Initialization */ |
15 | | - |
16 | | -$( document ).ready( function() { |
17 | | - // |
18 | | -} ); |
19 | | - |
20 | | -} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Index: branches/resourceloader/phase3/resources/mw/mw.legacy.wikibits.js |
— | — | @@ -1,19 +0,0 @@ |
2 | | -/* |
3 | | - * Legacy emulation for the now depricated skins/common/wikibits.js |
4 | | - */ |
5 | | - |
6 | | -( function( $, mw ) { |
7 | | - |
8 | | -/* Extension */ |
9 | | - |
10 | | -$.extend( mw.legacy, { |
11 | | - // |
12 | | -} ); |
13 | | - |
14 | | -/* Initialization */ |
15 | | - |
16 | | -$( document ).ready( function() { |
17 | | - // |
18 | | -} ); |
19 | | - |
20 | | -} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Index: branches/resourceloader/phase3/resources/mw/mw.legacy.edit.js |
— | — | @@ -1,264 +0,0 @@ |
2 | | -/* |
3 | | - * Legacy emulation for the now depricated skins/common/edit.js |
4 | | - */ |
5 | | - |
6 | | -( function( $, mw ) { |
7 | | - |
8 | | -/* Extension */ |
9 | | - |
10 | | -$.extend( mw.legacy, { |
11 | | - |
12 | | - /* Global Variables */ |
13 | | - |
14 | | - 'currentFocused': null, |
15 | | - |
16 | | - /* Functions */ |
17 | | - |
18 | | - /** |
19 | | - * Generates the actual toolbar buttons with localized text we use it to avoid creating the toolbar |
20 | | - * where javascript is not enabled |
21 | | - */ |
22 | | - 'addButton': function( imageFile, speedTip, tagOpen, tagClose, sampleText, imageId ) { |
23 | | - // Don't generate buttons for browsers which don't fully support it. |
24 | | - mw.legacy.mwEditButtons.push( { |
25 | | - 'imageId': imageId, |
26 | | - 'imageFile': imageFile, |
27 | | - 'speedTip': speedTip, |
28 | | - 'tagOpen': tagOpen, |
29 | | - 'tagClose': tagClose, |
30 | | - 'sampleText': sampleText |
31 | | - } ); |
32 | | - }, |
33 | | - /** |
34 | | - * Generates the actual toolbar buttons with localized text we use it to avoid creating the toolbar where JavaScript |
35 | | - * is not enabled |
36 | | - */ |
37 | | - 'mwInsertEditButton': function( parent, item ) { |
38 | | - var $image = $( '<img />' ) |
39 | | - .attr( { |
40 | | - 'width': 23, |
41 | | - 'height': 22, |
42 | | - 'class': 'mw-toolbar-editbutton', |
43 | | - 'id': item.imageId ? item.imageId : null, |
44 | | - 'src': = item.imageFile, |
45 | | - 'border': 0, |
46 | | - 'alt': item.speedTip, |
47 | | - 'title': item.speedTip |
48 | | - } ) |
49 | | - .css( 'cursor', 'pointer' ) |
50 | | - .click( function() { |
51 | | - mw.legacy.insertTags( item.tagOpen, item.tagClose, item.sampleText ); |
52 | | - // Click tracking |
53 | | - if ( typeof $.trackAction != 'undefined' ) { |
54 | | - $.trackAction( 'oldedit.' + item.speedTip.replace( / /g, "-" ) ); |
55 | | - } |
56 | | - return false; |
57 | | - } ) |
58 | | - .appendTo( $( parent ) ); |
59 | | - return true; |
60 | | - }, |
61 | | - /** |
62 | | - * Sets up the toolbar |
63 | | - */ |
64 | | - 'mwSetupToolbar': function() { |
65 | | - var $toolbar = $( '#toolbar' ); |
66 | | - var $textbox = $( 'textarea' ).get( 0 ); |
67 | | - if ( !$toolbar.length || !$textbox.length ) { |
68 | | - return false; |
69 | | - } |
70 | | - // Only check for selection capability if the textarea is visible - errors will occur otherwise - just because |
71 | | - // the textarea is not visible, doesn't mean we shouldn't build out the toolbar though - it might have been |
72 | | - // replaced with some other kind of control |
73 | | - if ( |
74 | | - $textbox.is( ':visible' ) && |
75 | | - !( document.selection && document.selection.createRange ) && |
76 | | - textboxes[0].selectionStart === null |
77 | | - ) { |
78 | | - return false; |
79 | | - } |
80 | | - for ( var i = 0; i < mw.legacy.mwEditButtons.length; i++ ) { |
81 | | - mw.legacy.mwInsertEditButton( $toolbar, mw.legacy.mwEditButtons[i] ); |
82 | | - } |
83 | | - for ( var i = 0; i < mw.legacy.mwCustomEditButtons.length; i++ ) { |
84 | | - mw.legacy.mwInsertEditButton( $toolbar, mw.legacy.mwCustomEditButtons[i] ); |
85 | | - } |
86 | | - return true; |
87 | | - }, |
88 | | - /** |
89 | | - * Apply tagOpen/tagClose to selection in textarea, use sampleText instead of selection if there is none |
90 | | - */ |
91 | | - 'insertTags': function( tagOpen, tagClose, sampleText ) { |
92 | | - function checkSelectedText() { |
93 | | - if ( !selText ) { |
94 | | - selText = sampleText; |
95 | | - isSample = true; |
96 | | - } else if ( selText.charAt( selText.length - 1 ) == ' ' ) { // exclude ending space char |
97 | | - selText = selText.substring( 0, selText.length - 1 ); |
98 | | - tagClose += ' '; |
99 | | - } |
100 | | - } |
101 | | - var currentFocused = $( mw.legacy.currentFocused ); |
102 | | - if ( |
103 | | - typeof $.fn.textSelection != 'undefined' && |
104 | | - ( $currentFocused.name().toLowerCase() == 'iframe' || $currentFocused.attr( 'id' ) == 'wpTextbox1' ) |
105 | | - ) { |
106 | | - $j( '#wpTextbox1' ).textSelection( |
107 | | - 'encapsulateSelection', { 'pre': tagOpen, 'peri': sampleText, 'post': tagClose } |
108 | | - ); |
109 | | - return; |
110 | | - } |
111 | | - var $textarea; |
112 | | - if ( $( 'form[name=editform]' ) { |
113 | | - $textarea = $currentFocused; |
114 | | - } else { |
115 | | - // Some alternate form? take the first one we can find |
116 | | - $textarea = $( 'textarea' ).get( 0 ); |
117 | | - } |
118 | | - var selText, isSample = false; |
119 | | - // Text selection implementation for IE and Opera |
120 | | - if ( document.selection && document.selection.createRange ) { |
121 | | - // Save window scroll position |
122 | | - if ( document.documentElement && document.documentElement.scrollTop ) { |
123 | | - var winScroll = document.documentElement.scrollTop |
124 | | - } else if ( document.body ) { |
125 | | - var winScroll = document.body.scrollTop; |
126 | | - } |
127 | | - // Get current selection |
128 | | - $textarea.focus(); |
129 | | - var range = document.selection.createRange(); |
130 | | - selText = range.text; |
131 | | - // Insert tags |
132 | | - checkSelectedText(); |
133 | | - range.text = tagOpen + selText + tagClose; |
134 | | - // Mark sample text as selected |
135 | | - if ( isSample && range.moveStart ) { |
136 | | - if ( window.opera ) { |
137 | | - tagClose = tagClose.replace( /\n/g,'' ); |
138 | | - } |
139 | | - range.moveStart( 'character', - tagClose.length - selText.length ); |
140 | | - range.moveEnd( 'character', - tagClose.length ); |
141 | | - } |
142 | | - range.select(); |
143 | | - // Restore window scroll position |
144 | | - if ( document.documentElement && document.documentElement.scrollTop ) { |
145 | | - document.documentElement.scrollTop = winScroll; |
146 | | - } else if ( document.body ) { |
147 | | - document.body.scrollTop = winScroll; |
148 | | - } |
149 | | - } |
150 | | - // Text selection implementation for Mozilla, Chrome and Safari |
151 | | - else if ( $textarea[0].selectionStart || $textarea[0].selectionStart == '0' ) { |
152 | | - // Save textarea scroll position |
153 | | - var textScroll = $textarea.scrollTop; |
154 | | - // Get current selection |
155 | | - $textarea.focus(); |
156 | | - var startPos = $textarea[0].selectionStart; |
157 | | - var endPos = $textarea[0].selectionEnd; |
158 | | - selText = $textarea.value.substring( startPos, endPos ); |
159 | | - // Insert tags |
160 | | - checkSelectedText(); |
161 | | - $textarea.val( |
162 | | - $textarea.val().substring( 0, startPos ) + |
163 | | - tagOpen + selText + tagClose + |
164 | | - $textarea.val().substring( endPos, $textarea.val().length ) |
165 | | - ); |
166 | | - // Set new selection |
167 | | - if ( isSample ) { |
168 | | - $textarea[0].selectionStart = startPos + tagOpen.length; |
169 | | - $textarea[0].selectionEnd = startPos + tagOpen.length + selText.length; |
170 | | - } else { |
171 | | - $textarea[0].selectionStart = startPos + tagOpen.length + selText.length + tagClose.length; |
172 | | - $textarea[0].selectionEnd = $textarea[0].selectionStart; |
173 | | - } |
174 | | - // Restore textarea scroll position |
175 | | - $textarea[0].scrollTop = textScroll; |
176 | | - } |
177 | | - }, |
178 | | - /** |
179 | | - * Restore the edit box scroll state following a preview operation, |
180 | | - * and set up a form submission handler to remember this state |
181 | | - */ |
182 | | - 'scrollEditBox': function() { |
183 | | - var $textbox = $( '#wpTextbox1' ); |
184 | | - var $scrollTop = $( '#wpScrolltop' ); |
185 | | - var $editForm = $( '#editform' ); |
186 | | - if ( $editForm.length && $textbox.length && $scrollTop.length ) { |
187 | | - if ( scrollTop.val() ) { |
188 | | - $textbox.scrollTop = $scrollTop.val(); |
189 | | - } |
190 | | - $editForm.submit( function() { |
191 | | - $scrollTop.val( $textbox.scrollTop ); |
192 | | - } ); |
193 | | - } |
194 | | - } |
195 | | -} ); |
196 | | - |
197 | | -/* Initialization */ |
198 | | - |
199 | | -$( document ).ready( function() { |
200 | | - mw.legacy.scrollEditBox(); |
201 | | - mw.legacy.mwSetupToolbar(); |
202 | | - mw.legacy.currentFocused = $( '#wpTextbox1' ).get( 0 ); |
203 | | - // http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html focus does not bubble normally, but using a |
204 | | - // trick we can do event delegation on the focus event on all text inputs to make the toolbox usable on all of them |
205 | | - $( '#editform' ).focus( function() { |
206 | | - $(this).each( function( e ) { |
207 | | - var elm = e.target || e.srcElement; |
208 | | - if ( !elm ) { |
209 | | - return; |
210 | | - } |
211 | | - var tagName = elm.tagName.toLowerCase(); |
212 | | - var type = elm.type || ''; |
213 | | - if ( tagName !== 'textarea' && tagName !== 'input' ) { |
214 | | - return; |
215 | | - } |
216 | | - if ( tagName === 'input' && type.toLowerCase() !== 'text' ) { |
217 | | - return; |
218 | | - } |
219 | | - mw.legacy.currentFocused = elm; |
220 | | - } ); |
221 | | - } ); |
222 | | - // HACK: make currentFocused work with the usability iframe - with proper focus detection support (HTML 5!) this'll |
223 | | - // be much cleaner |
224 | | - var $iframe = $j( '.wikiEditor-ui-text iframe' ); |
225 | | - if ( $iframe.length > 0 ) { |
226 | | - $j( $iframe.get( 0 ).contentWindow.document ) |
227 | | - // For IE |
228 | | - .add( $iframe.get( 0 ).contentWindow.document.body ) |
229 | | - .focus( function() { mw.legacy.currentFocused = $iframe.get( 0 ); } ); |
230 | | - } |
231 | | - // Make sure edit summary does not exceed byte limit |
232 | | - var $summary = $( '#wpSummary' ); |
233 | | - if ( !$summary.length ) { |
234 | | - return; |
235 | | - } |
236 | | - // L must be capitalized in length |
237 | | - $summary.get( 0 ).maxLength = 250; |
238 | | - $summary.keypress( function( e ) { |
239 | | - // First check to see if this is actually a character key being pressed. Based on key-event info from |
240 | | - // http://unixpapa.com/js/key.html note === sign, if undefined, still could be a real key |
241 | | - if ( e.which === 0 || e.charCode === 0 || e.ctrlKey || e.altKey || e.metaKey ) { |
242 | | - // A special key (backspace, etc) so don't interefere. |
243 | | - return true; |
244 | | - } |
245 | | - // This basically figures out how many bytes a utf-16 string (which is what js sees) will take in utf-8 by |
246 | | - // replacing a 2 byte character with 2 *'s, etc, and counting that. Note, surogate (\uD800-\uDFFF) characters |
247 | | - // are counted as 2 bytes, since theres two of them and the actual character takes 4 bytes in utf-8 (2*2=4). |
248 | | - // Might not work perfectly in edge cases such as such as illegal sequences, but that should never happen. |
249 | | - len = summary.value |
250 | | - .replace(/[\u0080-\u07FF\uD800-\uDFFF]/g, '**') |
251 | | - .replace(/[\u0800-\uD7FF\uE000-\uFFFF]/g, '***') |
252 | | - .length; |
253 | | - // 247 as this doesn't count character about to be inserted. |
254 | | - if ( len > 247 ) { |
255 | | - if ( e.preventDefault ) { |
256 | | - e.preventDefault(); |
257 | | - } |
258 | | - // IE |
259 | | - e.returnValue = false; |
260 | | - return false; |
261 | | - } |
262 | | - } ); |
263 | | -} ); |
264 | | - |
265 | | -} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Index: branches/resourceloader/phase3/resources/mw/mw.legacy.mwsuggest.js |
— | — | @@ -1,19 +0,0 @@ |
2 | | -/* |
3 | | - * Legacy emulation for the now depricated skins/common/mwsuggest.js |
4 | | - */ |
5 | | - |
6 | | -( function( $, mw ) { |
7 | | - |
8 | | -/* Extension */ |
9 | | - |
10 | | -$.extend( mw.legacy, { |
11 | | - // |
12 | | -} ); |
13 | | - |
14 | | -/* Initialization */ |
15 | | - |
16 | | -$( document ).ready( function() { |
17 | | - // |
18 | | -} ); |
19 | | - |
20 | | -} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Index: branches/resourceloader/phase3/resources/mw/mw.views.installer.js |
— | — | @@ -1,100 +0,0 @@ |
2 | | -/* |
3 | | - * Web-installer progressive enhancement (ported from skins/common/config.js) |
4 | | - * |
5 | | - * Makes elements in the configuration form interactive and hides portions of the form when not in-use |
6 | | - */ |
7 | | - |
8 | | -( function( $, mw ) { |
9 | | - |
10 | | -/* Initialization */ |
11 | | - |
12 | | -$( document ).ready( function() { |
13 | | - // Show/hide code for help text |
14 | | - $( '.config-show-help a' ).click( function() { |
15 | | - $(this).parent().siblings( '.config-help-message' ).show( 'slow' ); |
16 | | - $(this).parent().siblings( '.config-hide-help' ).show(); |
17 | | - $(this).parent().hide(); |
18 | | - return false; |
19 | | - } ); |
20 | | - $( '.config-hide-help a' ).click( function() { |
21 | | - $(this).parent().siblings( '.config-help-message' ).hide( 'slow' ); |
22 | | - $(this).parent().siblings( '.config-show-help' ).show(); |
23 | | - $(this).parent().hide(); |
24 | | - return false; |
25 | | - } ); |
26 | | - // Show/hide code for DB-specific options |
27 | | - // FIXME: Do we want slow, fast, or even non-animated (instantaneous) showing/hiding here? |
28 | | - $( '.dbRadio' ).each( function() { $( '#' + $(this).attr( 'rel' ) ).hide(); } ); |
29 | | - $( '#' + $( '.dbRadio:checked' ).attr( 'rel' ) ).show(); |
30 | | - $( '.dbRadio' ).click( function() { |
31 | | - var $checked = $( '.dbRadio:checked' ); |
32 | | - var $wrapper = $( '#' + $checked.attr( 'rel' ) ); |
33 | | - if ( !$wrapper.is( ':visible' ) ) { |
34 | | - $( '.dbWrapper' ).hide( 'slow' ); |
35 | | - $wrapper.show( 'slow' ); |
36 | | - } |
37 | | - } ); |
38 | | - // Scroll to the bottom of upgrade log |
39 | | - $( "#config-update-log" ).each( function() { this.scrollTop = this.scrollHeight; } ); |
40 | | - // Show/hide Creative Commons thingy |
41 | | - $( '.licenseRadio' ).click( function() { |
42 | | - var $wrapper = $( '#config-cc-wrapper' ); |
43 | | - if ( $( '#config__LicenseCode_cc-choose' ).is( ':checked' ) ) { |
44 | | - $wrapper.show( 'slow' ); |
45 | | - } else { |
46 | | - $wrapper.hide( 'slow' ); |
47 | | - } |
48 | | - } ); |
49 | | - // Show/hide random stuff (email, upload) |
50 | | - $( '.showHideRadio' ).click( function() { |
51 | | - var $wrapper = $( '#' + $(this).attr( 'rel' ) ); |
52 | | - if ( $(this).is( ':checked' ) ) { |
53 | | - $wrapper.show( 'slow' ); |
54 | | - } else { |
55 | | - $wrapper.hide( 'slow' ); |
56 | | - } |
57 | | - } ); |
58 | | - $( '.hideShowRadio' ).click( function() { |
59 | | - var $wrapper = $( '#' + $(this).attr( 'rel' ) ); |
60 | | - if ( $(this).is( ':checked' ) ) { |
61 | | - $wrapper.hide( 'slow' ); |
62 | | - } else { |
63 | | - $wrapper.show( 'slow' ); |
64 | | - } |
65 | | - } ); |
66 | | - // Enable/disable "other" textboxes |
67 | | - $( '.enableForOther' ).click( function() { |
68 | | - var $textbox = $( '#' + $(this).attr( 'rel' ) ); |
69 | | - if ( $(this).val() == 'other' ) { // FIXME: Ugh, this is ugly |
70 | | - $textbox.removeAttr( 'disabled' ); |
71 | | - } else { |
72 | | - $textbox.attr( 'disabled', 'disabled' ); |
73 | | - } |
74 | | - } ); |
75 | | - // Synchronize radio button label for sitename with textbox |
76 | | - $label = $( 'label[for=config__NamespaceType_site-name]' ); |
77 | | - labelText = $label.text(); |
78 | | - $label.text( labelText.replace( '$1', '' ) ); |
79 | | - $( '#config_wgSitename' ).bind( 'keyup change', syncText ).each( syncText ); |
80 | | - function syncText() { |
81 | | - var value = $(this).val() |
82 | | - .replace( /[\[\]\{\}|#<>%+? ]/g, '_' ) |
83 | | - .replace( /&/, '&' ) |
84 | | - .replace( /__+/g, '_' ) |
85 | | - .replace( /^_+/, '' ) |
86 | | - .replace( /_+$/, '' ); |
87 | | - value = value.substr( 0, 1 ).toUpperCase() + value.substr( 1 ); |
88 | | - $label.text( labelText.replace( '$1', value ) ); |
89 | | - } |
90 | | - // Show/Hide memcached servers when needed |
91 | | - $( "input[name$='config_wgMainCacheType']" ).change( function() { |
92 | | - var $memc = $( "#config-memcachewrapper" ); |
93 | | - if ( $( "input[name$='config_wgMainCacheType']:checked" ).val() == 'memcached' ) { |
94 | | - $memc.show( 'slow' ); |
95 | | - } else { |
96 | | - $memc.hide( 'slow' ); |
97 | | - } |
98 | | - } ); |
99 | | -} ); |
100 | | - |
101 | | -} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Index: branches/resourceloader/phase3/resources/mw/views/mw.views.diff.js |
— | — | @@ -0,0 +1,30 @@ |
| 2 | +/* |
| 3 | + * Diff-view progressive enhancement (ported from skins/common/diff.js) |
| 4 | + * |
| 5 | + * Fixes an overflow bug in old versions of Firefox |
| 6 | + */ |
| 7 | + |
| 8 | +( function( $, mw ) { |
| 9 | + |
| 10 | +/* Initialization */ |
| 11 | + |
| 12 | +$( document ).ready( function() { |
| 13 | + /* |
| 14 | + * Workaround for overflow bug in Mozilla 1.1 and earlier, where scrolling <div>s in <td> cells collapse their |
| 15 | + * height to a single line. |
| 16 | + * |
| 17 | + * Known to be fixed in 1.2.1 (Gecko 20021130), but the CSS hacks I've tried with overflow-x disable the scrolling |
| 18 | + * all the way until Mozilla 1.8 / FF 1.5 and break Opera as well. |
| 19 | + * |
| 20 | + * So... we check for reaaaally old Gecko and hack in an alternate rule to let the wide cells spill instead of |
| 21 | + * scrolling them. Not ideal as it won't work if JS is disabled, of course. |
| 22 | + */ |
| 23 | + if ( window.navigator && window.navigator.product == 'Gecko' && window.navigator.productSub < '20021130' ) { |
| 24 | + document.styleSheets[document.styleSheets.length - 1].insertRule( |
| 25 | + 'table.diff td div { overflow: visible; }', |
| 26 | + document.styleSheets[document.styleSheets.length - 1].cssRules.length |
| 27 | + ); |
| 28 | + } |
| 29 | +} ); |
| 30 | + |
| 31 | +} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Property changes on: branches/resourceloader/phase3/resources/mw/views/mw.views.diff.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 32 | + native |
Index: branches/resourceloader/phase3/resources/mw/views/mw.views.installer.js |
— | — | @@ -0,0 +1,100 @@ |
| 2 | +/* |
| 3 | + * Web-installer progressive enhancement (ported from skins/common/config.js) |
| 4 | + * |
| 5 | + * Makes elements in the configuration form interactive and hides portions of the form when not in-use |
| 6 | + */ |
| 7 | + |
| 8 | +( function( $, mw ) { |
| 9 | + |
| 10 | +/* Initialization */ |
| 11 | + |
| 12 | +$( document ).ready( function() { |
| 13 | + // Show/hide code for help text |
| 14 | + $( '.config-show-help a' ).click( function() { |
| 15 | + $(this).parent().siblings( '.config-help-message' ).show( 'slow' ); |
| 16 | + $(this).parent().siblings( '.config-hide-help' ).show(); |
| 17 | + $(this).parent().hide(); |
| 18 | + return false; |
| 19 | + } ); |
| 20 | + $( '.config-hide-help a' ).click( function() { |
| 21 | + $(this).parent().siblings( '.config-help-message' ).hide( 'slow' ); |
| 22 | + $(this).parent().siblings( '.config-show-help' ).show(); |
| 23 | + $(this).parent().hide(); |
| 24 | + return false; |
| 25 | + } ); |
| 26 | + // Show/hide code for DB-specific options |
| 27 | + // FIXME: Do we want slow, fast, or even non-animated (instantaneous) showing/hiding here? |
| 28 | + $( '.dbRadio' ).each( function() { $( '#' + $(this).attr( 'rel' ) ).hide(); } ); |
| 29 | + $( '#' + $( '.dbRadio:checked' ).attr( 'rel' ) ).show(); |
| 30 | + $( '.dbRadio' ).click( function() { |
| 31 | + var $checked = $( '.dbRadio:checked' ); |
| 32 | + var $wrapper = $( '#' + $checked.attr( 'rel' ) ); |
| 33 | + if ( !$wrapper.is( ':visible' ) ) { |
| 34 | + $( '.dbWrapper' ).hide( 'slow' ); |
| 35 | + $wrapper.show( 'slow' ); |
| 36 | + } |
| 37 | + } ); |
| 38 | + // Scroll to the bottom of upgrade log |
| 39 | + $( "#config-update-log" ).each( function() { this.scrollTop = this.scrollHeight; } ); |
| 40 | + // Show/hide Creative Commons thingy |
| 41 | + $( '.licenseRadio' ).click( function() { |
| 42 | + var $wrapper = $( '#config-cc-wrapper' ); |
| 43 | + if ( $( '#config__LicenseCode_cc-choose' ).is( ':checked' ) ) { |
| 44 | + $wrapper.show( 'slow' ); |
| 45 | + } else { |
| 46 | + $wrapper.hide( 'slow' ); |
| 47 | + } |
| 48 | + } ); |
| 49 | + // Show/hide random stuff (email, upload) |
| 50 | + $( '.showHideRadio' ).click( function() { |
| 51 | + var $wrapper = $( '#' + $(this).attr( 'rel' ) ); |
| 52 | + if ( $(this).is( ':checked' ) ) { |
| 53 | + $wrapper.show( 'slow' ); |
| 54 | + } else { |
| 55 | + $wrapper.hide( 'slow' ); |
| 56 | + } |
| 57 | + } ); |
| 58 | + $( '.hideShowRadio' ).click( function() { |
| 59 | + var $wrapper = $( '#' + $(this).attr( 'rel' ) ); |
| 60 | + if ( $(this).is( ':checked' ) ) { |
| 61 | + $wrapper.hide( 'slow' ); |
| 62 | + } else { |
| 63 | + $wrapper.show( 'slow' ); |
| 64 | + } |
| 65 | + } ); |
| 66 | + // Enable/disable "other" textboxes |
| 67 | + $( '.enableForOther' ).click( function() { |
| 68 | + var $textbox = $( '#' + $(this).attr( 'rel' ) ); |
| 69 | + if ( $(this).val() == 'other' ) { // FIXME: Ugh, this is ugly |
| 70 | + $textbox.removeAttr( 'disabled' ); |
| 71 | + } else { |
| 72 | + $textbox.attr( 'disabled', 'disabled' ); |
| 73 | + } |
| 74 | + } ); |
| 75 | + // Synchronize radio button label for sitename with textbox |
| 76 | + $label = $( 'label[for=config__NamespaceType_site-name]' ); |
| 77 | + labelText = $label.text(); |
| 78 | + $label.text( labelText.replace( '$1', '' ) ); |
| 79 | + $( '#config_wgSitename' ).bind( 'keyup change', syncText ).each( syncText ); |
| 80 | + function syncText() { |
| 81 | + var value = $(this).val() |
| 82 | + .replace( /[\[\]\{\}|#<>%+? ]/g, '_' ) |
| 83 | + .replace( /&/, '&' ) |
| 84 | + .replace( /__+/g, '_' ) |
| 85 | + .replace( /^_+/, '' ) |
| 86 | + .replace( /_+$/, '' ); |
| 87 | + value = value.substr( 0, 1 ).toUpperCase() + value.substr( 1 ); |
| 88 | + $label.text( labelText.replace( '$1', value ) ); |
| 89 | + } |
| 90 | + // Show/Hide memcached servers when needed |
| 91 | + $( "input[name$='config_wgMainCacheType']" ).change( function() { |
| 92 | + var $memc = $( "#config-memcachewrapper" ); |
| 93 | + if ( $( "input[name$='config_wgMainCacheType']:checked" ).val() == 'memcached' ) { |
| 94 | + $memc.show( 'slow' ); |
| 95 | + } else { |
| 96 | + $memc.hide( 'slow' ); |
| 97 | + } |
| 98 | + } ); |
| 99 | +} ); |
| 100 | + |
| 101 | +} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Property changes on: branches/resourceloader/phase3/resources/mw/views/mw.views.installer.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 102 | + native |
Index: branches/resourceloader/phase3/resources/mw/legacy/mw.legacy.rightclickedit.js |
— | — | @@ -0,0 +1,19 @@ |
| 2 | +/* |
| 3 | + * Legacy emulation for the now depricated skins/common/rightclick.js |
| 4 | + */ |
| 5 | + |
| 6 | +( function( $, mw ) { |
| 7 | + |
| 8 | +/* Extension */ |
| 9 | + |
| 10 | +$.extend( mw.legacy, { |
| 11 | + // |
| 12 | +} ); |
| 13 | + |
| 14 | +/* Initialization */ |
| 15 | + |
| 16 | +$( document ).ready( function() { |
| 17 | + // |
| 18 | +} ); |
| 19 | + |
| 20 | +} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Property changes on: branches/resourceloader/phase3/resources/mw/legacy/mw.legacy.rightclickedit.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 21 | + native |
Index: branches/resourceloader/phase3/resources/mw/legacy/mw.legacy.block.js |
— | — | @@ -0,0 +1,44 @@ |
| 2 | +/* |
| 3 | + * Legacy emulation for the now depricated skins/common/block.js |
| 4 | + */ |
| 5 | + |
| 6 | +( function( $, mw ) { |
| 7 | + |
| 8 | +/* Extension */ |
| 9 | + |
| 10 | +$.extend( mw.legacy, { |
| 11 | + |
| 12 | + /* Functions */ |
| 13 | + |
| 14 | + 'considerChangingExpiryFocus': function() { |
| 15 | + var $expiry = $( '#wpBlockExpiry' ); |
| 16 | + var $other = $( '#wpBlockOther' ); |
| 17 | + if ( $expiry.length && $other.length ) { |
| 18 | + if ( $expiry.val() == 'other' ) { |
| 19 | + $other.css( 'display', '' ); |
| 20 | + } else { |
| 21 | + $other.css( 'display', 'none' ); |
| 22 | + } |
| 23 | + } |
| 24 | + }, |
| 25 | + 'updateBlockOptions': function() { |
| 26 | + var $target = $( '#mw-bi-target' ); |
| 27 | + if ( $target.length ) { |
| 28 | + var address = $target.val(); |
| 29 | + var isEmpty = address.match( /^\s*$/ ); |
| 30 | + var isIp = address.match( /^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|:(:[0-9A-Fa-f]{1,4}){1,7}|[0-9A-Fa-f]{1,4}(:{1,2}[0-9A-Fa-f]{1,4}|::$){1,7})(\/\d+)?$/ ); |
| 31 | + var isIpRange = isIp && address.match( /\/\d+$/ ); |
| 32 | + $( '#wpAnonOnlyRow' ).css( 'display', !isIp && !isEmpty ? 'none' : '' ); |
| 33 | + $( '#wpEnableAutoblockRow,#wpEnableHideUser' ).css( 'display', isIp && !isEmpty ? 'none' : '' ); |
| 34 | + $( '#wpEnableWatchUser' ).css( 'display', isIpRange && !isEmpty ? 'none' : '' ); |
| 35 | + } |
| 36 | + } |
| 37 | +} ); |
| 38 | + |
| 39 | +/* Initialization */ |
| 40 | + |
| 41 | +$( document ).ready( function() { |
| 42 | + mw.legacy.considerChangingExpiryFocus(); |
| 43 | +} ); |
| 44 | + |
| 45 | +} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Property changes on: branches/resourceloader/phase3/resources/mw/legacy/mw.legacy.block.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 46 | + native |
Index: branches/resourceloader/phase3/resources/mw/legacy/mw.legacy.IEFixes.js |
— | — | @@ -0,0 +1,19 @@ |
| 2 | +/* |
| 3 | + * Legacy emulation for the now depricated skins/common/IEFixes.js |
| 4 | + */ |
| 5 | + |
| 6 | +( function( $, mw ) { |
| 7 | + |
| 8 | +/* Extension */ |
| 9 | + |
| 10 | +$.extend( mw.legacy, { |
| 11 | + // |
| 12 | +} ); |
| 13 | + |
| 14 | +/* Initialization */ |
| 15 | + |
| 16 | +$( document ).ready( function() { |
| 17 | + // |
| 18 | +} ); |
| 19 | + |
| 20 | +} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Property changes on: branches/resourceloader/phase3/resources/mw/legacy/mw.legacy.IEFixes.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 21 | + native |
Index: branches/resourceloader/phase3/resources/mw/legacy/mw.legacy.enhancedchanges.js |
— | — | @@ -0,0 +1,46 @@ |
| 2 | +/* |
| 3 | + * Legacy emulation for the now depricated skins/common/enhancedchanges.js |
| 4 | + */ |
| 5 | + |
| 6 | +( function( $, mw ) { |
| 7 | + |
| 8 | +/* Extension */ |
| 9 | + |
| 10 | +$.extend( mw.legacy, { |
| 11 | + |
| 12 | + /* Functions */ |
| 13 | + |
| 14 | + /** |
| 15 | + * Switch an RC line between hidden/shown |
| 16 | + * |
| 17 | + * @param integer idNumber : the id number of the RC group |
| 18 | + */ |
| 19 | + 'toggleVisibility': function( idNumber ) { |
| 20 | + var elements = [ |
| 21 | + '#mw-rc-openarrow-' + idNumber, |
| 22 | + '#mw-rc-closearrow-' + idNumber, |
| 23 | + '#mw-rc-subentries-' + idNumber |
| 24 | + ]; |
| 25 | + $( elements.join( ',' ) ).toggleClass( 'mw-changeslist-hidden' ).toggleClass( 'mw-changeslist-expanded' ); |
| 26 | + } |
| 27 | +} ); |
| 28 | + |
| 29 | +/* Initialization */ |
| 30 | + |
| 31 | +$( document ).ready( function() { |
| 32 | + /* |
| 33 | + * Add the CSS to hide parts that should be collapsed |
| 34 | + * |
| 35 | + * We do this with JS so everything will be expanded by default |
| 36 | + * if JS is disabled |
| 37 | + */ |
| 38 | + $( 'head' ).append( |
| 39 | + '<style type="text/css">\ |
| 40 | + .mw-changeslist-hidden { display:none; }\ |
| 41 | + div.mw-changeslist-expanded { display:block; }\ |
| 42 | + span.mw-changeslist-expanded { display:inline !important; visibility:visible !important; }\ |
| 43 | + </style>' |
| 44 | + ); |
| 45 | +} ); |
| 46 | + |
| 47 | +} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Property changes on: branches/resourceloader/phase3/resources/mw/legacy/mw.legacy.enhancedchanges.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 48 | + native |
Index: branches/resourceloader/phase3/resources/mw/legacy/mw.legacy.history.js |
— | — | @@ -0,0 +1,115 @@ |
| 2 | +/* |
| 3 | + * Legacy emulation for the now depricated skins/common/history.js |
| 4 | + */ |
| 5 | + |
| 6 | +( function( $, mw ) { |
| 7 | + |
| 8 | +/* Extension */ |
| 9 | + |
| 10 | +$.extend( mw.legacy, { |
| 11 | + |
| 12 | + /* Functions */ |
| 13 | + |
| 14 | + 'historyRadios': function( parent ) { |
| 15 | + var inputs = parent.getElementsByTagName('input'); |
| 16 | + var radios = []; |
| 17 | + for (var i = 0; i < inputs.length; i++) { |
| 18 | + if (inputs[i].name == "diff" || inputs[i].name == "oldid") { |
| 19 | + radios[radios.length] = inputs[i]; |
| 20 | + } |
| 21 | + } |
| 22 | + return radios; |
| 23 | + }, |
| 24 | + /* |
| 25 | + * Check selection and tweak visibility/class onclick |
| 26 | + */ |
| 27 | + 'diffcheck': function() { |
| 28 | + var dli = false; // the li where the diff radio is checked |
| 29 | + var oli = false; // the li where the oldid radio is checked |
| 30 | + var hf = document.getElementById('pagehistory'); |
| 31 | + if (!hf) { |
| 32 | + return true; |
| 33 | + } |
| 34 | + var lis = hf.getElementsByTagName('li'); |
| 35 | + for (var i=0;i<lis.length;i++) { |
| 36 | + var inputs = historyRadios(lis[i]); |
| 37 | + if (inputs[1] && inputs[0]) { |
| 38 | + if (inputs[1].checked || inputs[0].checked) { // this row has a checked radio button |
| 39 | + if (inputs[1].checked && inputs[0].checked && inputs[0].value == inputs[1].value) { |
| 40 | + return false; |
| 41 | + } |
| 42 | + if (oli) { // it's the second checked radio |
| 43 | + if (inputs[1].checked) { |
| 44 | + if ( (typeof oli.className) != 'undefined') { |
| 45 | + oli.classNameOriginal = oli.className.replace( 'selected', '' ); |
| 46 | + } else { |
| 47 | + oli.classNameOriginal = ''; |
| 48 | + } |
| 49 | + |
| 50 | + oli.className = "selected "+oli.classNameOriginal; |
| 51 | + return false; |
| 52 | + } |
| 53 | + } else if (inputs[0].checked) { |
| 54 | + return false; |
| 55 | + } |
| 56 | + if (inputs[0].checked) { |
| 57 | + dli = lis[i]; |
| 58 | + } |
| 59 | + if (!oli) { |
| 60 | + inputs[0].style.visibility = 'hidden'; |
| 61 | + } |
| 62 | + if (dli) { |
| 63 | + inputs[1].style.visibility = 'hidden'; |
| 64 | + } |
| 65 | + if ( (typeof lis[i].className) != 'undefined') { |
| 66 | + lis[i].classNameOriginal = lis[i].className.replace( 'selected', '' ); |
| 67 | + } else { |
| 68 | + lis[i].classNameOriginal = ''; |
| 69 | + } |
| 70 | + |
| 71 | + lis[i].className = "selected "+lis[i].classNameOriginal; |
| 72 | + oli = lis[i]; |
| 73 | + } else { // no radio is checked in this row |
| 74 | + if (!oli) { |
| 75 | + inputs[0].style.visibility = 'hidden'; |
| 76 | + } else { |
| 77 | + inputs[0].style.visibility = 'visible'; |
| 78 | + } |
| 79 | + if (dli) { |
| 80 | + inputs[1].style.visibility = 'hidden'; |
| 81 | + } else { |
| 82 | + inputs[1].style.visibility = 'visible'; |
| 83 | + } |
| 84 | + if ( typeof lis[i].classNameOriginal != 'undefined' ) { |
| 85 | + lis[i].className = lis[i].classNameOriginal; |
| 86 | + } |
| 87 | + } |
| 88 | + } |
| 89 | + } |
| 90 | + return true; |
| 91 | + }, |
| 92 | + /* |
| 93 | + * Attach event handlers to the input elements on history page |
| 94 | + */ |
| 95 | + 'histrowinit': function() { |
| 96 | + var hf = document.getElementById('pagehistory'); |
| 97 | + if (!hf) return; |
| 98 | + var lis = hf.getElementsByTagName('li'); |
| 99 | + for (var i = 0; i < lis.length; i++) { |
| 100 | + var inputs = historyRadios(lis[i]); |
| 101 | + if (inputs[0] && inputs[1]) { |
| 102 | + inputs[0].onclick = diffcheck; |
| 103 | + inputs[1].onclick = diffcheck; |
| 104 | + } |
| 105 | + } |
| 106 | + diffcheck(); |
| 107 | + } |
| 108 | +} ); |
| 109 | + |
| 110 | +/* Initialization */ |
| 111 | + |
| 112 | +$( document ).ready( function() { |
| 113 | + mw.legacy.histrowinit(); |
| 114 | +} ); |
| 115 | + |
| 116 | +} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Property changes on: branches/resourceloader/phase3/resources/mw/legacy/mw.legacy.history.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 117 | + native |
Index: branches/resourceloader/phase3/resources/mw/legacy/mw.legacy.search.js |
— | — | @@ -0,0 +1,19 @@ |
| 2 | +/* |
| 3 | + * Legacy emulation for the now depricated skins/common/search.js |
| 4 | + */ |
| 5 | + |
| 6 | +( function( $, mw ) { |
| 7 | + |
| 8 | +/* Extension */ |
| 9 | + |
| 10 | +$.extend( mw.legacy, { |
| 11 | + // |
| 12 | +} ); |
| 13 | + |
| 14 | +/* Initialization */ |
| 15 | + |
| 16 | +$( document ).ready( function() { |
| 17 | + // |
| 18 | +} ); |
| 19 | + |
| 20 | +} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Property changes on: branches/resourceloader/phase3/resources/mw/legacy/mw.legacy.search.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 21 | + native |
Index: branches/resourceloader/phase3/resources/mw/legacy/mw.legacy.changepassword.js |
— | — | @@ -0,0 +1,29 @@ |
| 2 | +/* |
| 3 | + * Legacy emulation for the now depricated skins/common/changepassword.js |
| 4 | + */ |
| 5 | + |
| 6 | +( function( $, mw ) { |
| 7 | + |
| 8 | +/* Extension */ |
| 9 | + |
| 10 | +$.extend( mw.legacy, { |
| 11 | + |
| 12 | + /* Functions */ |
| 13 | + |
| 14 | + 'onNameChange': function() { |
| 15 | + var state = mw.legacy.wgUserName != $( '#wpName' ).val(); |
| 16 | + $( '#wpPassword' ).attr( 'disabled', state ); |
| 17 | + $( '#wpComment' ).attr( 'disabled', !state ); |
| 18 | + }, |
| 19 | + 'onNameChangeHook': function() { |
| 20 | + $( '#wpName' ).blur( mw.legacy.onNameChange ); |
| 21 | + } |
| 22 | +} ); |
| 23 | + |
| 24 | +/* Initialization */ |
| 25 | + |
| 26 | +$( document ).ready( function() { |
| 27 | + mw.legacy.onNameChangeHook(); |
| 28 | +} ); |
| 29 | + |
| 30 | +} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Property changes on: branches/resourceloader/phase3/resources/mw/legacy/mw.legacy.changepassword.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 31 | + native |
Index: branches/resourceloader/phase3/resources/mw/legacy/mw.legacy.ajaxwatch.js |
— | — | @@ -0,0 +1,136 @@ |
| 2 | +/* |
| 3 | + * Legacy emulation for the now depricated skins/common/ajaxwatch.js |
| 4 | + * |
| 5 | + * AJAX functionality for the watch/unwatch link |
| 6 | + * |
| 7 | + * @depends mw.legacy.jsMsg() from mw.legacy.wikibits.js |
| 8 | + */ |
| 9 | + |
| 10 | +( function( $, mw ) { |
| 11 | + |
| 12 | +/* Extension */ |
| 13 | + |
| 14 | +$.extend( mw.legacy, { |
| 15 | + |
| 16 | + /* Global Variables */ |
| 17 | + |
| 18 | + 'wgAjaxWatch': { |
| 19 | + |
| 20 | + /* Global Variables */ |
| 21 | + |
| 22 | + 'watchMsg': 'Watch', |
| 23 | + 'unwatchMsg': 'Unwatch', |
| 24 | + 'watchingMsg': 'Watching...', |
| 25 | + 'unwatchingMsg': 'Unwatching...', |
| 26 | + 'tooltip-ca-watchMsg': 'Add this page to your watchlist', |
| 27 | + 'tooltip-ca-unwatchMsg': 'Remove this page from your watchlist', |
| 28 | + |
| 29 | + /* Functions */ |
| 30 | + |
| 31 | + /** |
| 32 | + * Sets the text of the watch/unwatch link |
| 33 | + * |
| 34 | + * @param object link DOM node or jQuery selection of link to set text of |
| 35 | + * @param string action message to use ('watch', 'unwatch', 'watching' or 'unwatching') |
| 36 | + */ |
| 37 | + 'setLinkText': function( link, action ) { |
| 38 | + var $link = $( link ); |
| 39 | + if ( action == 'watch' || action == 'unwatch' ) { |
| 40 | + // save the accesskey from the title |
| 41 | + var keyCommand = $link.attr( 'title' ).match( /\[.*?\]$/ ) ? |
| 42 | + $link.attr( 'title' ).match( /\[.*?\]$/ )[0] : ''; |
| 43 | + $link.attr( 'title', wgAjaxWatch['tooltip-ca-' + action + 'Msg'] + ' ' + keyCommand ); |
| 44 | + } |
| 45 | + if ( $link.data( 'icon' ) ) { |
| 46 | + $link.attr( 'alt', wgAjaxWatch[action + 'Msg'] ); |
| 47 | + if ( action == 'watching' || action == 'unwatching' ) { |
| 48 | + $link.addClass( 'loading' ); |
| 49 | + } else { |
| 50 | + $link.removeClass( 'loading' ); |
| 51 | + } |
| 52 | + } else { |
| 53 | + $link.html( wgAjaxWatch[action+'Msg'] ); |
| 54 | + } |
| 55 | + }, |
| 56 | + /** |
| 57 | + * Processes responses from the server |
| 58 | + * |
| 59 | + * @param object response data from server |
| 60 | + */ |
| 61 | + 'processResult': function( response ) { |
| 62 | + response = response.watch; |
| 63 | + var $link = $(this); |
| 64 | + // To ensure we set the same status for all watch links with the same target we trigger a custom event on |
| 65 | + // *all* watch links. |
| 66 | + if ( response.watched !== undefined ) { |
| 67 | + wgAjaxWatch.$links.trigger( 'mw-ajaxwatch', [response.title, 'watch'] ); |
| 68 | + } else if ( response.unwatched !== undefined ){ |
| 69 | + wgAjaxWatch.$links.trigger( 'mw-ajaxwatch', [response.title, 'unwatch'] ); |
| 70 | + } else { |
| 71 | + // Either we got an error code or it just plain broke. |
| 72 | + window.location.href = $link.attr( 'href' ); |
| 73 | + return; |
| 74 | + } |
| 75 | + mw.legacy.jsMsg( response.message, 'watch' ); |
| 76 | + // Bug 12395 - update the watch checkbox on edit pages when the page is watched or unwatched via the tab. |
| 77 | + if ( response.watched !== undefined ) { |
| 78 | + $j("#wpWatchthis").attr( 'checked', '1' ); |
| 79 | + } else { |
| 80 | + $j("#wpWatchthis").removeAttr( 'checked' ); |
| 81 | + } |
| 82 | + } |
| 83 | + } ); |
| 84 | +} ); |
| 85 | + |
| 86 | +/* Initialization */ |
| 87 | + |
| 88 | +$( document ).ready( function() { |
| 89 | + var $links = $( '.mw-watchlink a, a.mw-watchlink' ); |
| 90 | + // BC with older skins... |
| 91 | + $links = $links |
| 92 | + .add( $( '#ca-watch a, #ca-unwatch a, a#mw-unwatch-link1' ) ) |
| 93 | + .add( $( 'a#mw-unwatch-link2, a#mw-watch-link2, a#mw-watch-link1' ) ); |
| 94 | + // ...allowing people to add inline animated links is a little scary |
| 95 | + $links = $links.filter( ':not( #bodyContent *, #content * )' ); |
| 96 | + $links.each( function() { |
| 97 | + var $link = $(this); |
| 98 | + $link |
| 99 | + .data( 'icon', $link.parent().hasClass( 'icon' ) ) |
| 100 | + .data( 'action', $link.attr( 'href' ).match( /[\?\&]action=unwatch/i ) ? 'unwatch' : 'watch' ); |
| 101 | + var title = $link.attr( 'href' ).match( /[\?\&]title=(.*?)&/i )[1]; |
| 102 | + $link.data( 'target', decodeURIComponent( title ).replace( /_/g, ' ' ) ); |
| 103 | + } ); |
| 104 | + $links.click( function( event ) { |
| 105 | + var $link = $(this); |
| 106 | + if ( mw.legacy.wgAjaxWatch.supported === false || !mw.legacy.wgEnableWriteAPI || !mw.legacy.wfSupportsAjax() ) { |
| 107 | + // Lazy initialization so we don't toss up ActiveX warnings on initial page load for IE 6 users with |
| 108 | + // security settings. |
| 109 | + mw.legacy.wgAjaxWatch.$links.unbind( 'click' ); |
| 110 | + return true; |
| 111 | + } |
| 112 | + mw.legacy.wgAjaxWatch.setLinkText( $link, $link.data( 'action' ) + 'ing' ); |
| 113 | + var url = mw.legacy.wgScriptPath + '/api' + mw.legacy.wgScriptExtension + '?action=watch&format=json&title=' |
| 114 | + + encodeURIComponent( $link.data( 'target' ) ) + ( $link.data( 'action' ) == 'unwatch' ? '&unwatch' : '' ); |
| 115 | + $.get( url, {}, mw.legacy.wgAjaxWatch.processResult, 'json' ); |
| 116 | + return false; |
| 117 | + } ); |
| 118 | + // When a request returns, a custom event 'mw-ajaxwatch' is triggered on *all* watch links, so they can be updated |
| 119 | + // if necessary |
| 120 | + $links.bind( 'mw-ajaxwatch', function( event, target, action ) { |
| 121 | + var $link = $(this); |
| 122 | + var foo = $link.data( 'target' ); |
| 123 | + if ( $link.data( 'target' ) == target ) { |
| 124 | + var otheraction = action == 'watch' ? 'unwatch' : 'watch'; |
| 125 | + $link.data( 'action', otheraction ); |
| 126 | + wgAjaxWatch.setLinkText( $link, otheraction ); |
| 127 | + $link.attr( 'href', $link.attr( 'href' ).replace( '/&action=' + action + '/', '&action=' + otheraction ) ); |
| 128 | + if ( $link.parent().attr( 'id' ) == 'ca-' + action ){ |
| 129 | + $link.parent().attr( 'id', 'ca-' + otheraction ); |
| 130 | + } |
| 131 | + } |
| 132 | + return false; |
| 133 | + } ); |
| 134 | + mw.legacy.wgAjaxWatch.$links = $links; |
| 135 | +} ); |
| 136 | + |
| 137 | +} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Property changes on: branches/resourceloader/phase3/resources/mw/legacy/mw.legacy.ajaxwatch.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 138 | + native |
Index: branches/resourceloader/phase3/resources/mw/legacy/mw.legacy.prefs.js |
— | — | @@ -0,0 +1,19 @@ |
| 2 | +/* |
| 3 | + * Legacy emulation for the now depricated skins/common/prefs.js |
| 4 | + */ |
| 5 | + |
| 6 | +( function( $, mw ) { |
| 7 | + |
| 8 | +/* Extension */ |
| 9 | + |
| 10 | +$.extend( mw.legacy, { |
| 11 | + // |
| 12 | +} ); |
| 13 | + |
| 14 | +/* Initialization */ |
| 15 | + |
| 16 | +$( document ).ready( function() { |
| 17 | + // |
| 18 | +} ); |
| 19 | + |
| 20 | +} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Property changes on: branches/resourceloader/phase3/resources/mw/legacy/mw.legacy.prefs.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 21 | + native |
Index: branches/resourceloader/phase3/resources/mw/legacy/mw.legacy.metadata.js |
— | — | @@ -0,0 +1,19 @@ |
| 2 | +/* |
| 3 | + * Legacy emulation for the now depricated skins/common/metadata.js |
| 4 | + */ |
| 5 | + |
| 6 | +( function( $, mw ) { |
| 7 | + |
| 8 | +/* Extension */ |
| 9 | + |
| 10 | +$.extend( mw.legacy, { |
| 11 | + // |
| 12 | +} ); |
| 13 | + |
| 14 | +/* Initialization */ |
| 15 | + |
| 16 | +$( document ).ready( function() { |
| 17 | + // |
| 18 | +} ); |
| 19 | + |
| 20 | +} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Property changes on: branches/resourceloader/phase3/resources/mw/legacy/mw.legacy.metadata.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 21 | + native |
Index: branches/resourceloader/phase3/resources/mw/legacy/mw.legacy.protect.js |
— | — | @@ -0,0 +1,19 @@ |
| 2 | +/* |
| 3 | + * Legacy emulation for the now depricated skins/common/protect.js |
| 4 | + */ |
| 5 | + |
| 6 | +( function( $, mw ) { |
| 7 | + |
| 8 | +/* Extension */ |
| 9 | + |
| 10 | +$.extend( mw.legacy, { |
| 11 | + // |
| 12 | +} ); |
| 13 | + |
| 14 | +/* Initialization */ |
| 15 | + |
| 16 | +$( document ).ready( function() { |
| 17 | + // |
| 18 | +} ); |
| 19 | + |
| 20 | +} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Property changes on: branches/resourceloader/phase3/resources/mw/legacy/mw.legacy.protect.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 21 | + native |
Index: branches/resourceloader/phase3/resources/mw/legacy/mw.legacy.preview.js |
— | — | @@ -0,0 +1,19 @@ |
| 2 | +/* |
| 3 | + * Legacy emulation for the now depricated skins/common/preview.js |
| 4 | + */ |
| 5 | + |
| 6 | +( function( $, mw ) { |
| 7 | + |
| 8 | +/* Extension */ |
| 9 | + |
| 10 | +$.extend( mw.legacy, { |
| 11 | + // |
| 12 | +} ); |
| 13 | + |
| 14 | +/* Initialization */ |
| 15 | + |
| 16 | +$( document ).ready( function() { |
| 17 | + // |
| 18 | +} ); |
| 19 | + |
| 20 | +} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Property changes on: branches/resourceloader/phase3/resources/mw/legacy/mw.legacy.preview.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 21 | + native |
Index: branches/resourceloader/phase3/resources/mw/legacy/mw.legacy.ajax.js |
— | — | @@ -0,0 +1,176 @@ |
| 2 | +/* |
| 3 | + * Legacy emulation for the now depricated skins/common/ajax.js |
| 4 | + * |
| 5 | + * Original licensing information: |
| 6 | + * Remote Scripting Library |
| 7 | + * (c) Copyright 2005 ModernMethod, Inc. |
| 8 | + */ |
| 9 | + |
| 10 | +( function( $, mw ) { |
| 11 | + |
| 12 | +/* Extension */ |
| 13 | + |
| 14 | +$.extend( mw.legacy, { |
| 15 | + |
| 16 | + /* Global Variables */ |
| 17 | + |
| 18 | + 'sajax_debug_mode': false, |
| 19 | + 'sajax_debug_mode': "GET", |
| 20 | + |
| 21 | + /* Functions */ |
| 22 | + |
| 23 | + /** |
| 24 | + * If sajax_debug_mode is true, this function outputs given the message into the element with id = sajax_debug; if no |
| 25 | + * such element exists in the document, it is injected |
| 26 | + * |
| 27 | + * @param string text debug message to append to log |
| 28 | + * @return boolean true when in debug mode, false when not |
| 29 | + */ |
| 30 | + 'sajax_debug': function( text ) { |
| 31 | + if ( mw.legacy.sajax_debug_mode ) { |
| 32 | + var $e = $( '#sajax_debug' ); |
| 33 | + if ( !$e.length ) { |
| 34 | + $e = $( '<p class="sajax_debug" id="sajax_debug"></p>' ).prependTo( $( 'body' ) ); |
| 35 | + } |
| 36 | + $e.append( $( '<div></div>' ).text( text ) ); |
| 37 | + return true; |
| 38 | + } |
| 39 | + return false; |
| 40 | + }, |
| 41 | + /** |
| 42 | + * Gets an XMLHttpRequest or equivilant ActiveXObject |
| 43 | + * |
| 44 | + * @reuturn mixed request object on success, boolean false on failure |
| 45 | + */ |
| 46 | + 'sajax_init_object': function() { |
| 47 | + mw.legacy.sajax_debug( 'sajax_init_object() called..' ); |
| 48 | + var request = false; |
| 49 | + try { |
| 50 | + // Try the "new" style before ActiveX so we don't unnecessarily trigger warnings in IE 7 when the user's |
| 51 | + // security settings are set to prompt about ActiveX usage |
| 52 | + request = new XMLHttpRequest(); |
| 53 | + } catch ( e ) { |
| 54 | + try { |
| 55 | + request = new ActiveXObject( 'Msxml2.XMLHTTP' ); |
| 56 | + } catch ( e ) { |
| 57 | + try { |
| 58 | + request = new ActiveXObject( 'Microsoft.XMLHTTP' ); |
| 59 | + } catch ( oc ) { |
| 60 | + request = null; |
| 61 | + } |
| 62 | + } |
| 63 | + } |
| 64 | + if ( !request ) { |
| 65 | + mw.legacy.sajax_debug( 'Could not create connection object.' ); |
| 66 | + } |
| 67 | + return request; |
| 68 | + }, |
| 69 | + /** |
| 70 | + * Performs an ajax call to mediawiki. Calls are handeled by AjaxDispatcher.php |
| 71 | + * |
| 72 | + * @param string method name of the function to call. Must be registered in $wgAjaxExportList |
| 73 | + * @param array arguments arguments to that function |
| 74 | + * @param mixed target the target that will handle the result of the call. If this is a function, if will be called |
| 75 | + * with the XMLHttpRequest as a parameter; if it's an input element, its value will be set to the resultText; if |
| 76 | + * it's another type of element, its innerHTML will be set to the resultText. |
| 77 | + * |
| 78 | + * @example |
| 79 | + * // This will call the doFoo function via MediaWiki's AjaxDispatcher, with (1, 2, 3) as the parameter list, |
| 80 | + * // and will show the result in the element with id = showFoo |
| 81 | + * sajax_do_call( 'doFoo', [1, 2, 3], document.getElementById( 'showFoo' ) ); |
| 82 | + */ |
| 83 | + 'sajax_do_call': function( method, arguments, target ) { |
| 84 | + var post_data; |
| 85 | + var uri = mw.legacy.wgServer + |
| 86 | + ( ( mw.legacy.wgScript == null ) ? ( mw.legacy.wgScriptPath + '/index.php' ) : mw.legacy.wgScript ) + |
| 87 | + '?action=ajax'; |
| 88 | + if ( mw.legacy.sajax_request_type == 'GET' ) { |
| 89 | + if ( uri.indexOf( '?' ) == -1 ) { |
| 90 | + uri = uri + '?rs=' + encodeURIComponent( method ); |
| 91 | + } else { |
| 92 | + uri = uri + '&rs=' + encodeURIComponent( method ); |
| 93 | + } |
| 94 | + for ( var i = 0; i < arguments.length; i++ ) { |
| 95 | + uri = uri + '&rsargs[]=' + encodeURIComponent( arguments[i] ); |
| 96 | + } |
| 97 | + post_data = null; |
| 98 | + } else { |
| 99 | + post_data = 'rs=' + encodeURIComponent( method ); |
| 100 | + for ( var i = 0; i < arguments.length; i++ ) { |
| 101 | + post_data = post_data + '&rsargs[]=' + encodeURIComponent( arguments[i] ); |
| 102 | + } |
| 103 | + } |
| 104 | + var request = mw.legacy.sajax_init_object(); |
| 105 | + if ( !request ) { |
| 106 | + alert( 'AJAX not supported' ); |
| 107 | + return false; |
| 108 | + } |
| 109 | + try { |
| 110 | + request.open( mw.legacy.sajax_request_type, uri, true ); |
| 111 | + } catch ( e ) { |
| 112 | + if ( window.location.hostname == "localhost" ) { |
| 113 | + alert( |
| 114 | + 'Your browser blocks XMLHttpRequest to \'localhost\', ' + |
| 115 | + 'try using a real hostname for development/testing.' |
| 116 | + ); |
| 117 | + } |
| 118 | + throw e; |
| 119 | + } |
| 120 | + if ( mw.legacy.sajax_request_type == 'POST' ) { |
| 121 | + request.setRequestHeader( 'Method', 'POST ' + uri + ' HTTP/1.1' ); |
| 122 | + request.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded' ); |
| 123 | + } |
| 124 | + request.setRequestHeader( 'Pragma', 'cache=yes' ); |
| 125 | + request.setRequestHeader( 'Cache-Control', 'no-transform' ); |
| 126 | + request.onreadystatechange = function() { |
| 127 | + if ( request.readyState != 4 ) { |
| 128 | + return; |
| 129 | + } |
| 130 | + mw.legacy.sajax_debug( |
| 131 | + 'received (' + request.status + ' ' + request.statusText + ') ' + request.responseText |
| 132 | + ); |
| 133 | + if ( typeof( target ) == 'function' ) { |
| 134 | + target( request ); |
| 135 | + } else if ( typeof( target ) == 'object' ) { |
| 136 | + $target = $( target ); |
| 137 | + if ( $target.is( 'input' ) ) { |
| 138 | + if ( request.status == 200 ) { |
| 139 | + $target.val(); |
| 140 | + } |
| 141 | + } else { |
| 142 | + if ( request.status == 200 ) { |
| 143 | + $target.html( request.responseText ); |
| 144 | + } else { |
| 145 | + $target.html( |
| 146 | + '<div class="error">' + |
| 147 | + 'Error: ' + request.status + ' ' + request.statusText + |
| 148 | + ' (' + request.responseText + ')' + |
| 149 | + '</div>' |
| 150 | + ); |
| 151 | + } |
| 152 | + } |
| 153 | + } else { |
| 154 | + alert( 'Bad target for sajax_do_call: not a function or object: ' + target ); |
| 155 | + } |
| 156 | + return; |
| 157 | + } |
| 158 | + mw.legacy.sajax_debug( method + ' uri = ' + uri + ' / post = ' + post_data ); |
| 159 | + request.send( post_data ); |
| 160 | + mw.legacy.sajax_debug( method + ' waiting..' ); |
| 161 | + delete x; |
| 162 | + return true; |
| 163 | + }, |
| 164 | + /** |
| 165 | + * Ajax compatibility test |
| 166 | + * |
| 167 | + * @return boolean whether the browser supports XMLHttpRequest |
| 168 | + */ |
| 169 | + 'wfSupportsAjax': function() { |
| 170 | + var request = mw.legacy.sajax_init_object(); |
| 171 | + var result = request ? true : false; |
| 172 | + delete request; |
| 173 | + return result; |
| 174 | + } |
| 175 | +} ); |
| 176 | + |
| 177 | +} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Property changes on: branches/resourceloader/phase3/resources/mw/legacy/mw.legacy.ajax.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 178 | + native |
Index: branches/resourceloader/phase3/resources/mw/legacy/mw.legacy.upload.js |
— | — | @@ -0,0 +1,19 @@ |
| 2 | +/* |
| 3 | + * Legacy emulation for the now depricated skins/common/upload.js |
| 4 | + */ |
| 5 | + |
| 6 | +( function( $, mw ) { |
| 7 | + |
| 8 | +/* Extension */ |
| 9 | + |
| 10 | +$.extend( mw.legacy, { |
| 11 | + // |
| 12 | +} ); |
| 13 | + |
| 14 | +/* Initialization */ |
| 15 | + |
| 16 | +$( document ).ready( function() { |
| 17 | + // |
| 18 | +} ); |
| 19 | + |
| 20 | +} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Property changes on: branches/resourceloader/phase3/resources/mw/legacy/mw.legacy.upload.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 21 | + native |
Index: branches/resourceloader/phase3/resources/mw/legacy/mw.legacy.wikibits.js |
— | — | @@ -0,0 +1,19 @@ |
| 2 | +/* |
| 3 | + * Legacy emulation for the now depricated skins/common/wikibits.js |
| 4 | + */ |
| 5 | + |
| 6 | +( function( $, mw ) { |
| 7 | + |
| 8 | +/* Extension */ |
| 9 | + |
| 10 | +$.extend( mw.legacy, { |
| 11 | + // |
| 12 | +} ); |
| 13 | + |
| 14 | +/* Initialization */ |
| 15 | + |
| 16 | +$( document ).ready( function() { |
| 17 | + // |
| 18 | +} ); |
| 19 | + |
| 20 | +} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Property changes on: branches/resourceloader/phase3/resources/mw/legacy/mw.legacy.wikibits.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 21 | + native |
Index: branches/resourceloader/phase3/resources/mw/legacy/mw.legacy.edit.js |
— | — | @@ -0,0 +1,264 @@ |
| 2 | +/* |
| 3 | + * Legacy emulation for the now depricated skins/common/edit.js |
| 4 | + */ |
| 5 | + |
| 6 | +( function( $, mw ) { |
| 7 | + |
| 8 | +/* Extension */ |
| 9 | + |
| 10 | +$.extend( mw.legacy, { |
| 11 | + |
| 12 | + /* Global Variables */ |
| 13 | + |
| 14 | + 'currentFocused': null, |
| 15 | + |
| 16 | + /* Functions */ |
| 17 | + |
| 18 | + /** |
| 19 | + * Generates the actual toolbar buttons with localized text we use it to avoid creating the toolbar |
| 20 | + * where javascript is not enabled |
| 21 | + */ |
| 22 | + 'addButton': function( imageFile, speedTip, tagOpen, tagClose, sampleText, imageId ) { |
| 23 | + // Don't generate buttons for browsers which don't fully support it. |
| 24 | + mw.legacy.mwEditButtons.push( { |
| 25 | + 'imageId': imageId, |
| 26 | + 'imageFile': imageFile, |
| 27 | + 'speedTip': speedTip, |
| 28 | + 'tagOpen': tagOpen, |
| 29 | + 'tagClose': tagClose, |
| 30 | + 'sampleText': sampleText |
| 31 | + } ); |
| 32 | + }, |
| 33 | + /** |
| 34 | + * Generates the actual toolbar buttons with localized text we use it to avoid creating the toolbar where JavaScript |
| 35 | + * is not enabled |
| 36 | + */ |
| 37 | + 'mwInsertEditButton': function( parent, item ) { |
| 38 | + var $image = $( '<img />' ) |
| 39 | + .attr( { |
| 40 | + 'width': 23, |
| 41 | + 'height': 22, |
| 42 | + 'class': 'mw-toolbar-editbutton', |
| 43 | + 'id': item.imageId ? item.imageId : null, |
| 44 | + 'src': = item.imageFile, |
| 45 | + 'border': 0, |
| 46 | + 'alt': item.speedTip, |
| 47 | + 'title': item.speedTip |
| 48 | + } ) |
| 49 | + .css( 'cursor', 'pointer' ) |
| 50 | + .click( function() { |
| 51 | + mw.legacy.insertTags( item.tagOpen, item.tagClose, item.sampleText ); |
| 52 | + // Click tracking |
| 53 | + if ( typeof $.trackAction != 'undefined' ) { |
| 54 | + $.trackAction( 'oldedit.' + item.speedTip.replace( / /g, "-" ) ); |
| 55 | + } |
| 56 | + return false; |
| 57 | + } ) |
| 58 | + .appendTo( $( parent ) ); |
| 59 | + return true; |
| 60 | + }, |
| 61 | + /** |
| 62 | + * Sets up the toolbar |
| 63 | + */ |
| 64 | + 'mwSetupToolbar': function() { |
| 65 | + var $toolbar = $( '#toolbar' ); |
| 66 | + var $textbox = $( 'textarea' ).get( 0 ); |
| 67 | + if ( !$toolbar.length || !$textbox.length ) { |
| 68 | + return false; |
| 69 | + } |
| 70 | + // Only check for selection capability if the textarea is visible - errors will occur otherwise - just because |
| 71 | + // the textarea is not visible, doesn't mean we shouldn't build out the toolbar though - it might have been |
| 72 | + // replaced with some other kind of control |
| 73 | + if ( |
| 74 | + $textbox.is( ':visible' ) && |
| 75 | + !( document.selection && document.selection.createRange ) && |
| 76 | + textboxes[0].selectionStart === null |
| 77 | + ) { |
| 78 | + return false; |
| 79 | + } |
| 80 | + for ( var i = 0; i < mw.legacy.mwEditButtons.length; i++ ) { |
| 81 | + mw.legacy.mwInsertEditButton( $toolbar, mw.legacy.mwEditButtons[i] ); |
| 82 | + } |
| 83 | + for ( var i = 0; i < mw.legacy.mwCustomEditButtons.length; i++ ) { |
| 84 | + mw.legacy.mwInsertEditButton( $toolbar, mw.legacy.mwCustomEditButtons[i] ); |
| 85 | + } |
| 86 | + return true; |
| 87 | + }, |
| 88 | + /** |
| 89 | + * Apply tagOpen/tagClose to selection in textarea, use sampleText instead of selection if there is none |
| 90 | + */ |
| 91 | + 'insertTags': function( tagOpen, tagClose, sampleText ) { |
| 92 | + function checkSelectedText() { |
| 93 | + if ( !selText ) { |
| 94 | + selText = sampleText; |
| 95 | + isSample = true; |
| 96 | + } else if ( selText.charAt( selText.length - 1 ) == ' ' ) { // exclude ending space char |
| 97 | + selText = selText.substring( 0, selText.length - 1 ); |
| 98 | + tagClose += ' '; |
| 99 | + } |
| 100 | + } |
| 101 | + var currentFocused = $( mw.legacy.currentFocused ); |
| 102 | + if ( |
| 103 | + typeof $.fn.textSelection != 'undefined' && |
| 104 | + ( $currentFocused.name().toLowerCase() == 'iframe' || $currentFocused.attr( 'id' ) == 'wpTextbox1' ) |
| 105 | + ) { |
| 106 | + $j( '#wpTextbox1' ).textSelection( |
| 107 | + 'encapsulateSelection', { 'pre': tagOpen, 'peri': sampleText, 'post': tagClose } |
| 108 | + ); |
| 109 | + return; |
| 110 | + } |
| 111 | + var $textarea; |
| 112 | + if ( $( 'form[name=editform]' ) { |
| 113 | + $textarea = $currentFocused; |
| 114 | + } else { |
| 115 | + // Some alternate form? take the first one we can find |
| 116 | + $textarea = $( 'textarea' ).get( 0 ); |
| 117 | + } |
| 118 | + var selText, isSample = false; |
| 119 | + // Text selection implementation for IE and Opera |
| 120 | + if ( document.selection && document.selection.createRange ) { |
| 121 | + // Save window scroll position |
| 122 | + if ( document.documentElement && document.documentElement.scrollTop ) { |
| 123 | + var winScroll = document.documentElement.scrollTop |
| 124 | + } else if ( document.body ) { |
| 125 | + var winScroll = document.body.scrollTop; |
| 126 | + } |
| 127 | + // Get current selection |
| 128 | + $textarea.focus(); |
| 129 | + var range = document.selection.createRange(); |
| 130 | + selText = range.text; |
| 131 | + // Insert tags |
| 132 | + checkSelectedText(); |
| 133 | + range.text = tagOpen + selText + tagClose; |
| 134 | + // Mark sample text as selected |
| 135 | + if ( isSample && range.moveStart ) { |
| 136 | + if ( window.opera ) { |
| 137 | + tagClose = tagClose.replace( /\n/g,'' ); |
| 138 | + } |
| 139 | + range.moveStart( 'character', - tagClose.length - selText.length ); |
| 140 | + range.moveEnd( 'character', - tagClose.length ); |
| 141 | + } |
| 142 | + range.select(); |
| 143 | + // Restore window scroll position |
| 144 | + if ( document.documentElement && document.documentElement.scrollTop ) { |
| 145 | + document.documentElement.scrollTop = winScroll; |
| 146 | + } else if ( document.body ) { |
| 147 | + document.body.scrollTop = winScroll; |
| 148 | + } |
| 149 | + } |
| 150 | + // Text selection implementation for Mozilla, Chrome and Safari |
| 151 | + else if ( $textarea[0].selectionStart || $textarea[0].selectionStart == '0' ) { |
| 152 | + // Save textarea scroll position |
| 153 | + var textScroll = $textarea.scrollTop; |
| 154 | + // Get current selection |
| 155 | + $textarea.focus(); |
| 156 | + var startPos = $textarea[0].selectionStart; |
| 157 | + var endPos = $textarea[0].selectionEnd; |
| 158 | + selText = $textarea.value.substring( startPos, endPos ); |
| 159 | + // Insert tags |
| 160 | + checkSelectedText(); |
| 161 | + $textarea.val( |
| 162 | + $textarea.val().substring( 0, startPos ) + |
| 163 | + tagOpen + selText + tagClose + |
| 164 | + $textarea.val().substring( endPos, $textarea.val().length ) |
| 165 | + ); |
| 166 | + // Set new selection |
| 167 | + if ( isSample ) { |
| 168 | + $textarea[0].selectionStart = startPos + tagOpen.length; |
| 169 | + $textarea[0].selectionEnd = startPos + tagOpen.length + selText.length; |
| 170 | + } else { |
| 171 | + $textarea[0].selectionStart = startPos + tagOpen.length + selText.length + tagClose.length; |
| 172 | + $textarea[0].selectionEnd = $textarea[0].selectionStart; |
| 173 | + } |
| 174 | + // Restore textarea scroll position |
| 175 | + $textarea[0].scrollTop = textScroll; |
| 176 | + } |
| 177 | + }, |
| 178 | + /** |
| 179 | + * Restore the edit box scroll state following a preview operation, |
| 180 | + * and set up a form submission handler to remember this state |
| 181 | + */ |
| 182 | + 'scrollEditBox': function() { |
| 183 | + var $textbox = $( '#wpTextbox1' ); |
| 184 | + var $scrollTop = $( '#wpScrolltop' ); |
| 185 | + var $editForm = $( '#editform' ); |
| 186 | + if ( $editForm.length && $textbox.length && $scrollTop.length ) { |
| 187 | + if ( scrollTop.val() ) { |
| 188 | + $textbox.scrollTop = $scrollTop.val(); |
| 189 | + } |
| 190 | + $editForm.submit( function() { |
| 191 | + $scrollTop.val( $textbox.scrollTop ); |
| 192 | + } ); |
| 193 | + } |
| 194 | + } |
| 195 | +} ); |
| 196 | + |
| 197 | +/* Initialization */ |
| 198 | + |
| 199 | +$( document ).ready( function() { |
| 200 | + mw.legacy.scrollEditBox(); |
| 201 | + mw.legacy.mwSetupToolbar(); |
| 202 | + mw.legacy.currentFocused = $( '#wpTextbox1' ).get( 0 ); |
| 203 | + // http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html focus does not bubble normally, but using a |
| 204 | + // trick we can do event delegation on the focus event on all text inputs to make the toolbox usable on all of them |
| 205 | + $( '#editform' ).focus( function() { |
| 206 | + $(this).each( function( e ) { |
| 207 | + var elm = e.target || e.srcElement; |
| 208 | + if ( !elm ) { |
| 209 | + return; |
| 210 | + } |
| 211 | + var tagName = elm.tagName.toLowerCase(); |
| 212 | + var type = elm.type || ''; |
| 213 | + if ( tagName !== 'textarea' && tagName !== 'input' ) { |
| 214 | + return; |
| 215 | + } |
| 216 | + if ( tagName === 'input' && type.toLowerCase() !== 'text' ) { |
| 217 | + return; |
| 218 | + } |
| 219 | + mw.legacy.currentFocused = elm; |
| 220 | + } ); |
| 221 | + } ); |
| 222 | + // HACK: make currentFocused work with the usability iframe - with proper focus detection support (HTML 5!) this'll |
| 223 | + // be much cleaner |
| 224 | + var $iframe = $j( '.wikiEditor-ui-text iframe' ); |
| 225 | + if ( $iframe.length > 0 ) { |
| 226 | + $j( $iframe.get( 0 ).contentWindow.document ) |
| 227 | + // For IE |
| 228 | + .add( $iframe.get( 0 ).contentWindow.document.body ) |
| 229 | + .focus( function() { mw.legacy.currentFocused = $iframe.get( 0 ); } ); |
| 230 | + } |
| 231 | + // Make sure edit summary does not exceed byte limit |
| 232 | + var $summary = $( '#wpSummary' ); |
| 233 | + if ( !$summary.length ) { |
| 234 | + return; |
| 235 | + } |
| 236 | + // L must be capitalized in length |
| 237 | + $summary.get( 0 ).maxLength = 250; |
| 238 | + $summary.keypress( function( e ) { |
| 239 | + // First check to see if this is actually a character key being pressed. Based on key-event info from |
| 240 | + // http://unixpapa.com/js/key.html note === sign, if undefined, still could be a real key |
| 241 | + if ( e.which === 0 || e.charCode === 0 || e.ctrlKey || e.altKey || e.metaKey ) { |
| 242 | + // A special key (backspace, etc) so don't interefere. |
| 243 | + return true; |
| 244 | + } |
| 245 | + // This basically figures out how many bytes a utf-16 string (which is what js sees) will take in utf-8 by |
| 246 | + // replacing a 2 byte character with 2 *'s, etc, and counting that. Note, surogate (\uD800-\uDFFF) characters |
| 247 | + // are counted as 2 bytes, since theres two of them and the actual character takes 4 bytes in utf-8 (2*2=4). |
| 248 | + // Might not work perfectly in edge cases such as such as illegal sequences, but that should never happen. |
| 249 | + len = summary.value |
| 250 | + .replace(/[\u0080-\u07FF\uD800-\uDFFF]/g, '**') |
| 251 | + .replace(/[\u0800-\uD7FF\uE000-\uFFFF]/g, '***') |
| 252 | + .length; |
| 253 | + // 247 as this doesn't count character about to be inserted. |
| 254 | + if ( len > 247 ) { |
| 255 | + if ( e.preventDefault ) { |
| 256 | + e.preventDefault(); |
| 257 | + } |
| 258 | + // IE |
| 259 | + e.returnValue = false; |
| 260 | + return false; |
| 261 | + } |
| 262 | + } ); |
| 263 | +} ); |
| 264 | + |
| 265 | +} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Property changes on: branches/resourceloader/phase3/resources/mw/legacy/mw.legacy.edit.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 266 | + native |
Index: branches/resourceloader/phase3/resources/mw/legacy/mw.legacy.mwsuggest.js |
— | — | @@ -0,0 +1,19 @@ |
| 2 | +/* |
| 3 | + * Legacy emulation for the now depricated skins/common/mwsuggest.js |
| 4 | + */ |
| 5 | + |
| 6 | +( function( $, mw ) { |
| 7 | + |
| 8 | +/* Extension */ |
| 9 | + |
| 10 | +$.extend( mw.legacy, { |
| 11 | + // |
| 12 | +} ); |
| 13 | + |
| 14 | +/* Initialization */ |
| 15 | + |
| 16 | +$( document ).ready( function() { |
| 17 | + // |
| 18 | +} ); |
| 19 | + |
| 20 | +} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Property changes on: branches/resourceloader/phase3/resources/mw/legacy/mw.legacy.mwsuggest.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 21 | + native |
Index: branches/resourceloader/phase3/resources/mw/legacy/mw.legacy.htmlform.js |
— | — | @@ -0,0 +1,19 @@ |
| 2 | +/* |
| 3 | + * Legacy emulation for the now depricated skins/common/htmlform.js |
| 4 | + */ |
| 5 | + |
| 6 | +( function( $, mw ) { |
| 7 | + |
| 8 | +/* Extension */ |
| 9 | + |
| 10 | +$.extend( mw.legacy, { |
| 11 | + // |
| 12 | +} ); |
| 13 | + |
| 14 | +/* Initialization */ |
| 15 | + |
| 16 | +$( document ).ready( function() { |
| 17 | + // |
| 18 | +} ); |
| 19 | + |
| 20 | +} )( jQuery, MediaWiki ); |
\ No newline at end of file |
Property changes on: branches/resourceloader/phase3/resources/mw/legacy/mw.legacy.htmlform.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 21 | + native |