Index: trunk/phase3/skins/common/edit.js |
— | — | @@ -1,238 +0,0 @@ |
2 | | -// This file is still referenced from |
3 | | -// tests/selenium/data/SimpleSeleniumTestDB.sql |
4 | | -// includes/specials/SpecialUpload.php |
5 | | -// /extensions/SemanticForms/specials/SF_UploadWindow2.php |
6 | | -window.currentFocused = undefined; |
7 | | - |
8 | | -// this function adds a toolbar button to the mwEditButtons list |
9 | | -window.addButton = function( imageFile, speedTip, tagOpen, tagClose, sampleText, imageId, selectText ) { |
10 | | - // Don't generate buttons for browsers which don't fully |
11 | | - // support it. |
12 | | - mwEditButtons.push({ |
13 | | - 'imageId': imageId, |
14 | | - 'imageFile': imageFile, |
15 | | - 'speedTip': speedTip, |
16 | | - 'tagOpen': tagOpen, |
17 | | - 'tagClose': tagClose, |
18 | | - 'sampleText': sampleText, |
19 | | - 'selectText': selectText |
20 | | - }); |
21 | | -}; |
22 | | - |
23 | | -// this function adds one toolbar button from a mwEditButtons/mwCustomEditButtons item |
24 | | -window.mwInsertEditButton = function( parent, item ) { |
25 | | - var image = document.createElement( 'img' ); |
26 | | - image.width = 23; |
27 | | - image.height = 22; |
28 | | - image.className = 'mw-toolbar-editbutton'; |
29 | | - if ( item.imageId ) { |
30 | | - image.id = item.imageId; |
31 | | - } |
32 | | - image.src = item.imageFile; |
33 | | - image.border = 0; |
34 | | - image.alt = item.speedTip; |
35 | | - image.title = item.speedTip; |
36 | | - image.style.cursor = 'pointer'; |
37 | | - image.onclick = function() { |
38 | | - insertTags( item.tagOpen, item.tagClose, item.sampleText, item.selectText ); |
39 | | - // click tracking |
40 | | - if ( ( typeof $ != 'undefined' ) && ( typeof $.trackAction != 'undefined' ) ) { |
41 | | - $.trackAction( 'oldedit.' + item.speedTip.replace(/ /g, '-') ); |
42 | | - } |
43 | | - return false; |
44 | | - }; |
45 | | - |
46 | | - parent.appendChild( image ); |
47 | | - return true; |
48 | | -}; |
49 | | - |
50 | | -// this function generates the actual toolbar buttons with localized text |
51 | | -// we use it to avoid creating the toolbar where javascript is not enabled |
52 | | -window.mwSetupToolbar = function() { |
53 | | - var toolbar = document.getElementById( 'toolbar' ); |
54 | | - var i = 0; |
55 | | - if ( !toolbar ) { |
56 | | - return false; |
57 | | - } |
58 | | - |
59 | | - // Don't generate buttons for browsers which don't fully |
60 | | - // support it. |
61 | | - // but don't assume wpTextbox1 is always here |
62 | | - var textboxes = document.getElementsByTagName( 'textarea' ); |
63 | | - if ( !textboxes.length ) { |
64 | | - // No toolbar if we can't find any textarea |
65 | | - return false; |
66 | | - } |
67 | | - // Only check for selection capability if the textarea is visible - errors will occur otherwise - just because |
68 | | - // the textarea is not visible, doesn't mean we shouldn't build out the toolbar though - it might have been replaced |
69 | | - // with some other kind of control |
70 | | - if ( textboxes[0].style.display != 'none' ) { |
71 | | - if ( !( document.selection && document.selection.createRange ) |
72 | | - && textboxes[0].selectionStart === null ) { |
73 | | - return false; |
74 | | - } |
75 | | - } |
76 | | - for ( i = 0; i < mwEditButtons.length; i++ ) { |
77 | | - mwInsertEditButton( toolbar, mwEditButtons[i] ); |
78 | | - } |
79 | | - for ( i = 0; i < mwCustomEditButtons.length; i++ ) { |
80 | | - mwInsertEditButton( toolbar, mwCustomEditButtons[i] ); |
81 | | - } |
82 | | - return true; |
83 | | -}; |
84 | | - |
85 | | -// apply tagOpen/tagClose to selection in textarea, |
86 | | -// use sampleText instead of selection if there is none |
87 | | -window.insertTags = function( tagOpen, tagClose, sampleText, selectText) { |
88 | | - if ( typeof $ != 'undefined' && typeof $.fn.textSelection != 'undefined' && currentFocused && |
89 | | - ( currentFocused.nodeName.toLowerCase() == 'iframe' || currentFocused.id == 'wpTextbox1' ) ) { |
90 | | - $( '#wpTextbox1' ).textSelection( |
91 | | - 'encapsulateSelection', { 'pre': tagOpen, 'peri': sampleText, 'post': tagClose } |
92 | | - ); |
93 | | - return; |
94 | | - } |
95 | | - var txtarea; |
96 | | - if ( document.editform ) { |
97 | | - txtarea = currentFocused; |
98 | | - } else { |
99 | | - // some alternate form? take the first one we can find |
100 | | - var areas = document.getElementsByTagName( 'textarea' ); |
101 | | - txtarea = areas[0]; |
102 | | - } |
103 | | - var selText, isSample = false; |
104 | | - |
105 | | - function checkSelectedText() { |
106 | | - if ( !selText ) { |
107 | | - selText = sampleText; |
108 | | - isSample = true; |
109 | | - } else if ( selText.charAt(selText.length - 1) == ' ' ) { // exclude ending space char |
110 | | - selText = selText.substring(0, selText.length - 1); |
111 | | - tagClose += ' '; |
112 | | - } |
113 | | - } |
114 | | - |
115 | | - if ( document.selection && document.selection.createRange ) { // IE/Opera |
116 | | - // save window scroll position |
117 | | - var winScroll = null; |
118 | | - if ( document.documentElement && document.documentElement.scrollTop ) { |
119 | | - winScroll = document.documentElement.scrollTop; |
120 | | - } else if ( document.body ) { |
121 | | - winScroll = document.body.scrollTop; |
122 | | - } |
123 | | - // get current selection |
124 | | - txtarea.focus(); |
125 | | - var range = document.selection.createRange(); |
126 | | - selText = range.text; |
127 | | - // insert tags |
128 | | - checkSelectedText(); |
129 | | - range.text = tagOpen + selText + tagClose; |
130 | | - // mark sample text as selected if not switched off by option |
131 | | - if ( selectText !== false ) { |
132 | | - if ( isSample && range.moveStart ) { |
133 | | - if ( window.opera ) { |
134 | | - tagClose = tagClose.replace(/\n/g,''); |
135 | | - } |
136 | | - range.moveStart('character', - tagClose.length - selText.length); |
137 | | - range.moveEnd('character', - tagClose.length); |
138 | | - } |
139 | | - range.select(); |
140 | | - } |
141 | | - // restore window scroll position |
142 | | - if ( document.documentElement && document.documentElement.scrollTop ) { |
143 | | - document.documentElement.scrollTop = winScroll; |
144 | | - } else if ( document.body ) { |
145 | | - document.body.scrollTop = winScroll; |
146 | | - } |
147 | | - |
148 | | - } else if ( txtarea.selectionStart || txtarea.selectionStart == '0' ) { // Mozilla |
149 | | - // save textarea scroll position |
150 | | - var textScroll = txtarea.scrollTop; |
151 | | - // get current selection |
152 | | - txtarea.focus(); |
153 | | - var startPos = txtarea.selectionStart; |
154 | | - var endPos = txtarea.selectionEnd; |
155 | | - selText = txtarea.value.substring( startPos, endPos ); |
156 | | - // insert tags |
157 | | - checkSelectedText(); |
158 | | - txtarea.value = txtarea.value.substring(0, startPos) |
159 | | - + tagOpen + selText + tagClose |
160 | | - + txtarea.value.substring(endPos, txtarea.value.length); |
161 | | - // set new selection |
162 | | - if ( isSample && ( selectText !== false )) { |
163 | | - txtarea.selectionStart = startPos + tagOpen.length; |
164 | | - txtarea.selectionEnd = startPos + tagOpen.length + selText.length; |
165 | | - } else { |
166 | | - txtarea.selectionStart = startPos + tagOpen.length + selText.length + tagClose.length; |
167 | | - txtarea.selectionEnd = txtarea.selectionStart; |
168 | | - } |
169 | | - // restore textarea scroll position |
170 | | - txtarea.scrollTop = textScroll; |
171 | | - } |
172 | | - |
173 | | -}; |
174 | | - |
175 | | -/** |
176 | | - * Restore the edit box scroll state following a preview operation, |
177 | | - * and set up a form submission handler to remember this state |
178 | | - */ |
179 | | -window.scrollEditBox = function() { |
180 | | - var editBox = document.getElementById( 'wpTextbox1' ); |
181 | | - var scrollTop = document.getElementById( 'wpScrolltop' ); |
182 | | - var editForm = document.getElementById( 'editform' ); |
183 | | - if( editForm && editBox && scrollTop ) { |
184 | | - if( scrollTop.value ) { |
185 | | - editBox.scrollTop = scrollTop.value; |
186 | | - } |
187 | | - addHandler( editForm, 'submit', function() { |
188 | | - scrollTop.value = editBox.scrollTop; |
189 | | - } ); |
190 | | - } |
191 | | -}; |
192 | | -hookEvent( 'load', scrollEditBox ); |
193 | | -hookEvent( 'load', mwSetupToolbar ); |
194 | | -hookEvent( 'load', function() { |
195 | | - currentFocused = document.getElementById( 'wpTextbox1' ); |
196 | | - // http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html |
197 | | - // focus does not bubble normally, but using a trick we can do event delegation |
198 | | - // on the focus event on all text inputs to make the toolbox usable on all of them |
199 | | - var editForm = document.getElementById( 'editform' ); |
200 | | - if ( !editForm ) { |
201 | | - return; |
202 | | - } |
203 | | - function onfocus( e ) { |
204 | | - var elm = e.target || e.srcElement; |
205 | | - if ( !elm ) { |
206 | | - return; |
207 | | - } |
208 | | - var tagName = elm.tagName.toLowerCase(); |
209 | | - var type = elm.type || ''; |
210 | | - if ( tagName !== 'textarea' && tagName !== 'input' ) { |
211 | | - return; |
212 | | - } |
213 | | - if ( tagName === 'input' && type.toLowerCase() !== 'text' ) { |
214 | | - return; |
215 | | - } |
216 | | - |
217 | | - currentFocused = elm; |
218 | | - } |
219 | | - |
220 | | - if ( editForm.addEventListener ) { |
221 | | - // Gecko, WebKit, Opera, etc... (all standards compliant browsers) |
222 | | - editForm.addEventListener( 'focus', onfocus, true ); // This MUST be true to work |
223 | | - } else if ( editForm.attachEvent ) { |
224 | | - // IE needs a specific trick here since it doesn't support the standard |
225 | | - editForm.attachEvent( 'onfocusin', function() { onfocus( event ); } ); |
226 | | - } |
227 | | - |
228 | | - // HACK: make currentFocused work with the usability iframe |
229 | | - // With proper focus detection support (HTML 5!) this'll be much cleaner |
230 | | - if ( typeof $ != 'undefined' ) { |
231 | | - var iframe = $( '.wikiEditor-ui-text iframe' ); |
232 | | - if ( iframe.length > 0 ) { |
233 | | - $( iframe.get( 0 ).contentWindow.document ) |
234 | | - .add( iframe.get( 0 ).contentWindow.document.body ) // for IE |
235 | | - .focus( function() { currentFocused = iframe.get( 0 ); } ); |
236 | | - } |
237 | | - } |
238 | | - |
239 | | -} ); |
\ No newline at end of file |
Index: trunk/phase3/includes/specials/SpecialUpload.php |
— | — | @@ -1126,7 +1126,7 @@ |
1127 | 1127 | |
1128 | 1128 | |
1129 | 1129 | $wgOut->addModules( array( |
1130 | | - 'mediawiki.legacy.edit', // For <charinsert> support |
| 1130 | + 'mediawiki.action.edit', // For <charinsert> support |
1131 | 1131 | 'mediawiki.legacy.upload', // Old form stuff... |
1132 | 1132 | 'mediawiki.special.upload', // Newer extras for thumbnail preview. |
1133 | 1133 | ) ); |
Index: trunk/phase3/resources/Resources.php |
— | — | @@ -641,12 +641,6 @@ |
642 | 642 | 'localBasePath' => $GLOBALS['wgStyleDirectory'], |
643 | 643 | 'dependencies' => 'mediawiki.legacy.wikibits', |
644 | 644 | ), |
645 | | - 'mediawiki.legacy.edit' => array( |
646 | | - 'scripts' => 'common/edit.js', |
647 | | - 'remoteBasePath' => $GLOBALS['wgStylePath'], |
648 | | - 'localBasePath' => $GLOBALS['wgStyleDirectory'], |
649 | | - 'dependencies' => 'mediawiki.legacy.wikibits', |
650 | | - ), |
651 | 645 | 'mediawiki.legacy.IEFixes' => array( |
652 | 646 | 'scripts' => 'common/IEFixes.js', |
653 | 647 | 'remoteBasePath' => $GLOBALS['wgStylePath'], |