Index: trunk/phase3/skins/common/edit.js |
— | — | @@ -33,7 +33,7 @@ |
34 | 34 | insertTags( item.tagOpen, item.tagClose, item.sampleText, item.selectText ); |
35 | 35 | // click tracking |
36 | 36 | if ( ( typeof $ != 'undefined' ) && ( typeof $.trackAction != 'undefined' ) ) { |
37 | | - $.trackAction( 'oldedit.' + item.speedTip.replace(/ /g, "-") ); |
| 37 | + $.trackAction( 'oldedit.' + item.speedTip.replace(/ /g, '-') ); |
38 | 38 | } |
39 | 39 | return false; |
40 | 40 | }; |
— | — | @@ -46,6 +46,7 @@ |
47 | 47 | // we use it to avoid creating the toolbar where javascript is not enabled |
48 | 48 | window.mwSetupToolbar = function() { |
49 | 49 | var toolbar = document.getElementById( 'toolbar' ); |
| 50 | + var i = 0; |
50 | 51 | if ( !toolbar ) { |
51 | 52 | return false; |
52 | 53 | } |
— | — | @@ -67,10 +68,10 @@ |
68 | 69 | return false; |
69 | 70 | } |
70 | 71 | } |
71 | | - for ( var i = 0; i < mwEditButtons.length; i++ ) { |
| 72 | + for ( i = 0; i < mwEditButtons.length; i++ ) { |
72 | 73 | mwInsertEditButton( toolbar, mwEditButtons[i] ); |
73 | 74 | } |
74 | | - for ( var i = 0; i < mwCustomEditButtons.length; i++ ) { |
| 75 | + for ( i = 0; i < mwCustomEditButtons.length; i++ ) { |
75 | 76 | mwInsertEditButton( toolbar, mwCustomEditButtons[i] ); |
76 | 77 | } |
77 | 78 | return true; |
— | — | @@ -96,12 +97,23 @@ |
97 | 98 | } |
98 | 99 | var selText, isSample = false; |
99 | 100 | |
| 101 | + function checkSelectedText() { |
| 102 | + if ( !selText ) { |
| 103 | + selText = sampleText; |
| 104 | + isSample = true; |
| 105 | + } else if ( selText.charAt(selText.length - 1) == ' ' ) { // exclude ending space char |
| 106 | + selText = selText.substring(0, selText.length - 1); |
| 107 | + tagClose += ' '; |
| 108 | + } |
| 109 | + } |
| 110 | + |
100 | 111 | if ( document.selection && document.selection.createRange ) { // IE/Opera |
101 | 112 | // save window scroll position |
| 113 | + var winScroll = null; |
102 | 114 | if ( document.documentElement && document.documentElement.scrollTop ) { |
103 | | - var winScroll = document.documentElement.scrollTop |
| 115 | + winScroll = document.documentElement.scrollTop; |
104 | 116 | } else if ( document.body ) { |
105 | | - var winScroll = document.body.scrollTop; |
| 117 | + winScroll = document.body.scrollTop; |
106 | 118 | } |
107 | 119 | // get current selection |
108 | 120 | txtarea.focus(); |
— | — | @@ -153,16 +165,6 @@ |
154 | 166 | txtarea.scrollTop = textScroll; |
155 | 167 | } |
156 | 168 | |
157 | | - function checkSelectedText() { |
158 | | - if ( !selText ) { |
159 | | - selText = sampleText; |
160 | | - isSample = true; |
161 | | - } else if ( selText.charAt(selText.length - 1) == ' ' ) { // exclude ending space char |
162 | | - selText = selText.substring(0, selText.length - 1); |
163 | | - tagClose += ' '; |
164 | | - } |
165 | | - } |
166 | | - |
167 | 169 | }; |
168 | 170 | |
169 | 171 | /** |
— | — | @@ -229,6 +231,4 @@ |
230 | 232 | } |
231 | 233 | } |
232 | 234 | |
233 | | - editForm |
234 | | -} ); |
235 | | - |
| 235 | +} ); |
\ No newline at end of file |