Index: trunk/extensions/WikiEditor/WikiEditor.php |
— | — | @@ -10,7 +10,7 @@ |
11 | 11 | * @author Nimish Gautam <nimish@wikimedia.org> |
12 | 12 | * @author Adam Miller <amiller@wikimedia.org> |
13 | 13 | * @license GPL v2 or later |
14 | | - * @version 0.3.0 |
| 14 | + * @version 0.3.1 |
15 | 15 | */ |
16 | 16 | |
17 | 17 | /* Configuration */ |
— | — | @@ -52,7 +52,7 @@ |
53 | 53 | 'path' => __FILE__, |
54 | 54 | 'name' => 'WikiEditor', |
55 | 55 | 'author' => array( 'Trevor Parscal', 'Roan Kattouw', 'Nimish Gautam', 'Adam Miller' ), |
56 | | - 'version' => '0.3.0', |
| 56 | + 'version' => '0.3.1', |
57 | 57 | 'url' => 'http://www.mediawiki.org/wiki/Extension:WikiEditor', |
58 | 58 | 'descriptionmsg' => 'wikieditor-desc', |
59 | 59 | ); |
Index: trunk/extensions/WikiEditor/WikiEditor.hooks.php |
— | — | @@ -1,19 +1,19 @@ |
2 | 2 | <?php |
3 | 3 | /** |
4 | 4 | * Hooks for WikiEditor extension |
5 | | - * |
| 5 | + * |
6 | 6 | * @file |
7 | 7 | * @ingroup Extensions |
8 | 8 | */ |
9 | 9 | |
10 | 10 | class WikiEditorHooks { |
11 | | - |
| 11 | + |
12 | 12 | /* Protected Static Members */ |
13 | | - |
| 13 | + |
14 | 14 | protected static $features = array( |
15 | | - |
| 15 | + |
16 | 16 | /* Beta Features */ |
17 | | - |
| 17 | + |
18 | 18 | 'toolbar' => array( |
19 | 19 | 'preferences' => array( |
20 | 20 | // Ideally this key would be 'wikieditor-toolbar' |
— | — | @@ -63,9 +63,9 @@ |
64 | 64 | 'ext.wikiEditor.toolbar.hideSig', |
65 | 65 | ), |
66 | 66 | ), |
67 | | - |
| 67 | + |
68 | 68 | /* Labs Features */ |
69 | | - |
| 69 | + |
70 | 70 | 'templateEditor' => array( |
71 | 71 | 'preferences' => array( |
72 | 72 | 'wikieditor-template-editor' => array( |
— | — | @@ -158,9 +158,9 @@ |
159 | 159 | ), |
160 | 160 | ), |
161 | 161 | ); |
162 | | - |
| 162 | + |
163 | 163 | /* Static Methods */ |
164 | | - |
| 164 | + |
165 | 165 | /** |
166 | 166 | * Checks if a certain option is enabled |
167 | 167 | * |
— | — | @@ -171,7 +171,7 @@ |
172 | 172 | */ |
173 | 173 | public static function isEnabled( $name ) { |
174 | 174 | global $wgWikiEditorFeatures, $wgUser; |
175 | | - |
| 175 | + |
176 | 176 | // Features with global set to true are always enabled |
177 | 177 | if ( !isset( $wgWikiEditorFeatures[$name] ) || $wgWikiEditorFeatures[$name]['global'] ) { |
178 | 178 | return true; |
— | — | @@ -188,20 +188,20 @@ |
189 | 189 | } |
190 | 190 | return true; |
191 | 191 | } |
192 | | - // Features controlled by $wgWikiEditorFeatures with both global and user set to false are awlways disabled |
| 192 | + // Features controlled by $wgWikiEditorFeatures with both global and user set to false are awlways disabled |
193 | 193 | return false; |
194 | 194 | } |
195 | | - |
| 195 | + |
196 | 196 | /** |
197 | 197 | * EditPage::showEditForm:initial hook |
198 | | - * |
| 198 | + * |
199 | 199 | * Adds the modules to the edit form |
200 | | - * |
| 200 | + * |
201 | 201 | * @param $toolbar array list of toolbar items |
202 | 202 | */ |
203 | 203 | public static function editPageShowEditFormInitial( &$toolbar ) { |
204 | 204 | global $wgOut; |
205 | | - |
| 205 | + |
206 | 206 | // Add modules for enabled features |
207 | 207 | foreach ( self::$features as $name => $feature ) { |
208 | 208 | if ( isset( $feature['modules'] ) && self::isEnabled( $name ) ) { |
— | — | @@ -210,18 +210,18 @@ |
211 | 211 | } |
212 | 212 | return true; |
213 | 213 | } |
214 | | - |
| 214 | + |
215 | 215 | /** |
216 | 216 | * GetPreferences hook |
217 | | - * |
| 217 | + * |
218 | 218 | * Adds WikiEditor-releated items to the preferences |
219 | | - * |
| 219 | + * |
220 | 220 | * @param $user User current user |
221 | 221 | * @param $defaultPreferences array list of default user preference controls |
222 | 222 | */ |
223 | 223 | public static function getPreferences( $user, &$defaultPreferences ) { |
224 | 224 | global $wgWikiEditorFeatures; |
225 | | - |
| 225 | + |
226 | 226 | foreach ( self::$features as $name => $feature ) { |
227 | 227 | if ( |
228 | 228 | isset( $feature['preferences'] ) && |
— | — | @@ -234,15 +234,15 @@ |
235 | 235 | } |
236 | 236 | return true; |
237 | 237 | } |
238 | | - |
| 238 | + |
239 | 239 | /** |
240 | 240 | * MakeGlobalVariablesScript hook |
241 | | - * |
| 241 | + * |
242 | 242 | * Adds enabled/disabled switches for WikiEditor modules |
243 | 243 | */ |
244 | 244 | public static function resourceLoaderGetConfigVars( &$vars ) { |
245 | 245 | global $wgWikiEditorFeatures; |
246 | | - |
| 246 | + |
247 | 247 | $configurations = array(); |
248 | 248 | foreach ( self::$features as $name => $feature ) { |
249 | 249 | if ( |
— | — | @@ -260,16 +260,16 @@ |
261 | 261 | } |
262 | 262 | return true; |
263 | 263 | } |
264 | | - |
| 264 | + |
265 | 265 | public static function makeGlobalVariablesScript( &$vars ) { |
266 | 266 | global $wgWikiEditorFeatures; |
267 | | - |
| 267 | + |
268 | 268 | // Build and export old-style wgWikiEditorEnabledModules object for back compat |
269 | 269 | $enabledModules = array(); |
270 | 270 | foreach ( self::$features as $name => $feature ) { |
271 | 271 | $enabledModules[$name] = self::isEnabled( $name ); |
272 | 272 | } |
273 | | - |
| 273 | + |
274 | 274 | $vars['wgWikiEditorEnabledModules'] = $enabledModules; |
275 | 275 | return true; |
276 | 276 | } |
Index: trunk/extensions/WikiEditor/tests/selenium/WikiEditorSeleniumConfig.php |
— | — | @@ -1,8 +1,8 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | class WikiEditorSeleniumConfig { |
5 | | - |
6 | | - public static function getSettings(&$includeFiles, &$globalConfigs) { |
| 5 | + |
| 6 | + public static function getSettings( &$includeFiles, &$globalConfigs ) { |
7 | 7 | $includes = array( |
8 | 8 | 'extensions/Vector/Vector.php', |
9 | 9 | 'extensions/WikiEditor/WikiEditor.php' |
— | — | @@ -21,7 +21,7 @@ |
22 | 22 | ) |
23 | 23 | ); |
24 | 24 | $includeFiles = array_merge( $includeFiles, $includes ); |
25 | | - $globalConfigs = array_merge( $globalConfigs, $configs); |
26 | | - return true; |
| 25 | + $globalConfigs = array_merge( $globalConfigs, $configs ); |
| 26 | + return true; |
27 | 27 | } |
28 | 28 | } |
\ No newline at end of file |
Index: trunk/extensions/WikiEditor/tests/selenium/WikiEditorTestSuite.php |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -/* |
| 4 | +/* |
5 | 5 | * To configure MW for these tests |
6 | 6 | * 1) If you are running multiple test suites, add the following in LocalSettings.php |
7 | 7 | * require_once("extensions/WikiEditor/tests/selenium/WikiEditorSeleniumConfig.php"); |
— | — | @@ -16,14 +16,14 @@ |
17 | 17 | * $wgWikiEditorFeatures['toc'] = array( 'global' => false, 'user' => false ); |
18 | 18 | * $wgWikiEditorFeatures['highlight'] = array( 'global' => false, 'user' => false ); |
19 | 19 | * $wgWikiEditorFeatures['dialogs'] = array( 'global' => true, 'user' => true ); |
20 | | - * |
| 20 | + * |
21 | 21 | */ |
22 | 22 | class WikiEditorTestSuite extends SeleniumTestSuite |
23 | 23 | { |
24 | 24 | public function setUp() { |
25 | 25 | $this->setLoginBeforeTests( false ); |
26 | 26 | parent::setUp(); |
27 | | - } |
| 27 | + } |
28 | 28 | public function addTests() { |
29 | 29 | $testFiles = array( |
30 | 30 | 'extensions/WikiEditor/tests/selenium/WikiDialogs_Links.php' |
Index: trunk/extensions/WikiEditor/tests/selenium/WikiDialogs_Links.php |
— | — | @@ -4,10 +4,10 @@ |
5 | 5 | * Description of WikiNewPageDialogs |
6 | 6 | * |
7 | 7 | * @author bhagyag, pdhanda |
8 | | - * |
| 8 | + * |
9 | 9 | * This test case is part of the WikiEditorTestSuite. |
10 | 10 | * Configuration for these tests are dosumented as part of extensions/WikiEditor/tests/selenium/WikiEditorTestSuite.php |
11 | | - * |
| 11 | + * |
12 | 12 | */ |
13 | 13 | class WikiDialogs_Links extends WikiDialogs_Links_Setup { |
14 | 14 | // Set up the testing environment |
— | — | @@ -15,13 +15,13 @@ |
16 | 16 | parent::setUp(); |
17 | 17 | parent::doCreateInternalTestPageIfMissing(); |
18 | 18 | } |
19 | | - |
| 19 | + |
20 | 20 | function tearDown() { |
21 | 21 | parent::doLogout(); |
22 | 22 | parent::tearDown(); |
23 | | - } |
| 23 | + } |
24 | 24 | |
25 | | - //Create a new page temporary |
| 25 | + // Create a new page temporary |
26 | 26 | function createNewPage() { |
27 | 27 | parent::doOpenLink(); |
28 | 28 | parent::login(); |
Index: trunk/extensions/WikiEditor/tests/selenium/WikiDialogs_Links_Setup.php |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | <?php |
3 | | -include("WikiEditorConstants.php"); |
| 3 | +include( "WikiEditorConstants.php" ); |
4 | 4 | /** |
5 | 5 | * This test case will be handling the Wiki Tool bar Dialog functions |
6 | 6 | * Date : Apr - 2010 |
— | — | @@ -13,9 +13,9 @@ |
14 | 14 | $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
15 | 15 | } |
16 | 16 | |
17 | | - //Expand advance tool bar section if its not |
| 17 | + // Expand advance tool bar section if its not |
18 | 18 | function doExpandAdvanceSection() { |
19 | | - if ( !$this->isTextPresent( TEXT_HEADING ) ){ |
| 19 | + if ( !$this->isTextPresent( TEXT_HEADING ) ) { |
20 | 20 | $this->click( LINK_ADVANCED ); |
21 | 21 | } |
22 | 22 | } |
— | — | @@ -23,16 +23,16 @@ |
24 | 24 | // Log out from the application |
25 | 25 | function doLogout() { |
26 | 26 | $this->open( $this->getUrl() . '/index.php' ); |
27 | | - if ($this->isTextPresent( TEXT_LOGOUT ) ) { |
| 27 | + if ( $this->isTextPresent( TEXT_LOGOUT ) ) { |
28 | 28 | $this->click( LINK_LOGOUT ); |
29 | 29 | $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
30 | | - $this->assertEquals(TEXT_LOGOUT_CONFIRM, $this->getText( LINK_LOGIN )); |
| 30 | + $this->assertEquals( TEXT_LOGOUT_CONFIRM, $this->getText( LINK_LOGIN ) ); |
31 | 31 | $this->open( $this->getUrl() . '/index.php' ); |
32 | 32 | $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
33 | 33 | } |
34 | 34 | } |
35 | 35 | |
36 | | - //Create a temporary fixture page |
| 36 | + // Create a temporary fixture page |
37 | 37 | function doCreateInternalTestPageIfMissing() { |
38 | 38 | $this->type( INPUT_SEARCH_BOX, WIKI_INTERNAL_LINK ); |
39 | 39 | $this->click( BUTTON_SEARCH ); |
— | — | @@ -40,16 +40,16 @@ |
41 | 41 | $this->click( LINK_START . WIKI_INTERNAL_LINK ); |
42 | 42 | $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
43 | 43 | $location = $this->getLocation() . "\n"; |
44 | | - if ( strpos( $location, '&redlink=1') !== false ) { |
| 44 | + if ( strpos( $location, '&redlink=1' ) !== false ) { |
45 | 45 | $this->type( TEXT_EDITOR, "Test fixture page. No real content here" ); |
46 | 46 | $this->click( BUTTON_SAVE_WATCH ); |
47 | 47 | $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
48 | | - $this->assertTrue( $this->isTextPresent( WIKI_INTERNAL_LINK ), |
| 48 | + $this->assertTrue( $this->isTextPresent( WIKI_INTERNAL_LINK ), |
49 | 49 | $this->getText( TEXT_PAGE_HEADING ) ); |
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
53 | | - //Create a temporary new page |
| 53 | + // Create a temporary new page |
54 | 54 | function doCreateNewPageTemporary() { |
55 | 55 | $this->type( INPUT_SEARCH_BOX, WIKI_TEMP_NEWPAGE ); |
56 | 56 | $this->click( BUTTON_SEARCH ); |
— | — | @@ -59,7 +59,7 @@ |
60 | 60 | } |
61 | 61 | |
62 | 62 | // Add a internal link and verify |
63 | | - function verifyInternalLink(){ |
| 63 | + function verifyInternalLink() { |
64 | 64 | $this->type( TEXT_EDITOR, "" ); |
65 | 65 | $this->click( LINK_ADDLINK ); |
66 | 66 | $this->waitForPopup( 'addLink', WIKI_TEST_WAIT_TIME ); |
— | — | @@ -70,16 +70,16 @@ |
71 | 71 | $this->click( LINK_PREVIEW ); |
72 | 72 | $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
73 | 73 | $this->assertEquals( ( WIKI_INTERNAL_LINK ), $this->getText( LINK_START . WIKI_INTERNAL_LINK ) ); |
74 | | - $this->click( LINK_START. WIKI_INTERNAL_LINK ); |
| 74 | + $this->click( LINK_START . WIKI_INTERNAL_LINK ); |
75 | 75 | $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
76 | | - $this->assertTrue( $this->isTextPresent( WIKI_INTERNAL_LINK ), $this->getText(TEXT_PAGE_HEADING ) ); |
| 76 | + $this->assertTrue( $this->isTextPresent( WIKI_INTERNAL_LINK ), $this->getText( TEXT_PAGE_HEADING ) ); |
77 | 77 | } |
78 | 78 | |
79 | 79 | // Add a internal link with different display text and verify |
80 | | - function verifyInternalLinkWithDisplayText(){ |
| 80 | + function verifyInternalLinkWithDisplayText() { |
81 | 81 | $this->type( TEXT_EDITOR, "" ); |
82 | 82 | $this->click( LINK_ADDLINK ); |
83 | | - $this->waitForPopup('addLink', WIKI_TEST_WAIT_TIME); |
| 83 | + $this->waitForPopup( 'addLink', WIKI_TEST_WAIT_TIME ); |
84 | 84 | $this->type( TEXT_LINKNAME, WIKI_INTERNAL_LINK ); |
85 | 85 | $this->type ( TEXT_LINKDISPLAYNAME, WIKI_INTERNAL_LINK . TEXT_LINKDISPLAYNAME_APPENDTEXT ); |
86 | 86 | $this->assertTrue( $this->isElementPresent( ICON_PAGEEXISTS ) ); |
— | — | @@ -87,27 +87,27 @@ |
88 | 88 | $this->click( BUTTON_INSERTLINK ); |
89 | 89 | $this->click( LINK_PREVIEW ); |
90 | 90 | $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
91 | | - $this->assertEquals( WIKI_INTERNAL_LINK . TEXT_LINKDISPLAYNAME_APPENDTEXT, |
| 91 | + $this->assertEquals( WIKI_INTERNAL_LINK . TEXT_LINKDISPLAYNAME_APPENDTEXT, |
92 | 92 | $this->getText( LINK_START . WIKI_INTERNAL_LINK . TEXT_LINKDISPLAYNAME_APPENDTEXT ) ); |
93 | 93 | $this->click( LINK_START . WIKI_INTERNAL_LINK . TEXT_LINKDISPLAYNAME_APPENDTEXT ); |
94 | 94 | $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
95 | 95 | $this->assertTrue( $this->isTextPresent( WIKI_INTERNAL_LINK ), $this->getText( TEXT_PAGE_HEADING ) ); |
96 | | - |
| 96 | + |
97 | 97 | } |
98 | 98 | |
99 | 99 | // Add a internal link with blank display text and verify |
100 | | - function verifyInternalLinkWithBlankDisplayText(){ |
| 100 | + function verifyInternalLinkWithBlankDisplayText() { |
101 | 101 | $this->type( TEXT_EDITOR, "" ); |
102 | 102 | $this->click( LINK_ADDLINK ); |
103 | 103 | $this->waitForPopup( 'addLink', WIKI_TEST_WAIT_TIME ); |
104 | 104 | $this->type( TEXT_LINKNAME, WIKI_INTERNAL_LINK ); |
105 | 105 | $this->type( TEXT_LINKDISPLAYNAME, "" ); |
106 | 106 | $this->assertTrue( $this->isElementPresent( ICON_PAGEEXISTS ) ); |
107 | | - $this->assertEquals("on", $this->getValue(OPT_INTERNAL)); |
| 107 | + $this->assertEquals( "on", $this->getValue( OPT_INTERNAL ) ); |
108 | 108 | $this->click( BUTTON_INSERTLINK ); |
109 | 109 | $this->click( LINK_PREVIEW ); |
110 | 110 | $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
111 | | - $this->assertEquals( WIKI_INTERNAL_LINK, $this->getText( LINK_START. WIKI_INTERNAL_LINK ) ); |
| 111 | + $this->assertEquals( WIKI_INTERNAL_LINK, $this->getText( LINK_START . WIKI_INTERNAL_LINK ) ); |
112 | 112 | $this->click( LINK_START . WIKI_INTERNAL_LINK ); |
113 | 113 | $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
114 | 114 | $this->assertEquals( WIKI_INTERNAL_LINK, $this->getText( TEXT_PAGE_HEADING ) ); |
— | — | @@ -115,7 +115,7 @@ |
116 | 116 | } |
117 | 117 | |
118 | 118 | // Add external link and verify |
119 | | - function verifyExternalLink(){ |
| 119 | + function verifyExternalLink() { |
120 | 120 | $this->type( LINK_PREVIEW, "" ); |
121 | 121 | $this->click( LINK_ADDLINK ); |
122 | 122 | $this->type( TEXT_LINKNAME, WIKI_EXTERNAL_LINK ); |
— | — | @@ -125,14 +125,14 @@ |
126 | 126 | $this->click( LINK_PREVIEW ); |
127 | 127 | $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
128 | 128 | $this->assertEquals( WIKI_EXTERNAL_LINK, $this->getText( LINK_START . WIKI_EXTERNAL_LINK ) ); |
129 | | - |
| 129 | + |
130 | 130 | $this->click( LINK_START . WIKI_EXTERNAL_LINK ); |
131 | 131 | $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
132 | 132 | $this->assertEquals( WIKI_EXTERNAL_LINK_TITLE, $this->getTitle() ); |
133 | 133 | } |
134 | 134 | |
135 | 135 | // Add external link with different display text and verify |
136 | | - function verifyExternalLinkWithDisplayText(){ |
| 136 | + function verifyExternalLinkWithDisplayText() { |
137 | 137 | $this->type( TEXT_EDITOR, "" ); |
138 | 138 | $this->click( LINK_ADDLINK ); |
139 | 139 | $this->type( TEXT_LINKNAME, WIKI_EXTERNAL_LINK ); |
— | — | @@ -143,13 +143,13 @@ |
144 | 144 | $this->click( LINK_PREVIEW ); |
145 | 145 | $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
146 | 146 | $this->assertEquals( WIKI_EXTERNAL_LINK_TITLE, $this->getText( LINK_START . WIKI_EXTERNAL_LINK_TITLE ) ); |
147 | | - $this->click(LINK_START.(WIKI_EXTERNAL_LINK_TITLE)); |
| 147 | + $this->click( LINK_START . ( WIKI_EXTERNAL_LINK_TITLE ) ); |
148 | 148 | $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
149 | 149 | $this->assertEquals( WIKI_EXTERNAL_LINK_TITLE , $this->getTitle() ); |
150 | 150 | } |
151 | 151 | |
152 | 152 | // Add external link with Blank display text and verify |
153 | | - function verifyExternalLinkWithBlankDisplayText(){ |
| 153 | + function verifyExternalLinkWithBlankDisplayText() { |
154 | 154 | $this->type( TEXT_EDITOR, "" ); |
155 | 155 | $this->click( LINK_ADDLINK ); |
156 | 156 | $this->type( TEXT_LINKNAME, WIKI_EXTERNAL_LINK ); |
— | — | @@ -159,14 +159,14 @@ |
160 | 160 | $this->click( BUTTON_INSERTLINK ); |
161 | 161 | $this->click( LINK_PREVIEW ); |
162 | 162 | $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
163 | | - $this->assertEquals( "[1]", $this->getText(LINK_START . "[1]" ) ); |
| 163 | + $this->assertEquals( "[1]", $this->getText( LINK_START . "[1]" ) ); |
164 | 164 | $this->click( LINK_START . "[1]" ); |
165 | 165 | $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
166 | 166 | $this->assertEquals( WIKI_EXTERNAL_LINK_TITLE, $this->getTitle() ); |
167 | 167 | } |
168 | 168 | |
169 | 169 | // Add a table and verify |
170 | | - function verifyCreateTable(){ |
| 170 | + function verifyCreateTable() { |
171 | 171 | $WIKI_TABLE_ROW = 2; |
172 | 172 | $WIKI_TABLE_COL = "5"; |
173 | 173 | $this->doExpandAdvanceSection(); |
— | — | @@ -187,19 +187,19 @@ |
188 | 188 | } |
189 | 189 | |
190 | 190 | // Add a table and verify only with head row |
191 | | - function verifyCreateTableWithHeadRow(){ |
| 191 | + function verifyCreateTableWithHeadRow() { |
192 | 192 | $WIKI_TABLE_ROW = 3; |
193 | 193 | $WIKI_TABLE_COL = "4"; |
194 | 194 | $this->doExpandAdvanceSection(); |
195 | 195 | $this->type( TEXT_EDITOR, "" ); |
196 | 196 | $this->click( LINK_ADDTABLE ); |
197 | | - $this->click( CHK_BOARDER); |
| 197 | + $this->click( CHK_BOARDER ); |
198 | 198 | $this->type( TEXT_ROW, $WIKI_TABLE_ROW ); |
199 | 199 | $this->type( TEXT_COL, $WIKI_TABLE_COL ); |
200 | 200 | $this->click( BUTTON_INSERTABLE ); |
201 | 201 | $this->click( LINK_PREVIEW ); |
202 | 202 | $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
203 | | - $WIKI_TABLE_ROW = $WIKI_TABLE_ROW+1; |
| 203 | + $WIKI_TABLE_ROW = $WIKI_TABLE_ROW + 1; |
204 | 204 | $this->assertTrue( $this->isElementPresent( TEXT_TABLEID_OTHER . |
205 | 205 | TEXT_VALIDATE_TABLE_PART1 . $WIKI_TABLE_ROW . |
206 | 206 | TEXT_VALIDATE_TABLE_PART2 . $WIKI_TABLE_COL . |
— | — | @@ -207,7 +207,7 @@ |
208 | 208 | } |
209 | 209 | |
210 | 210 | // Add a table and verify only with borders |
211 | | - function verifyCreateTableWithBorders(){ |
| 211 | + function verifyCreateTableWithBorders() { |
212 | 212 | $WIKI_TABLE_ROW = "4"; |
213 | 213 | $WIKI_TABLE_COL = "6"; |
214 | 214 | $this->type( TEXT_EDITOR, "" ); |
— | — | @@ -226,7 +226,7 @@ |
227 | 227 | } |
228 | 228 | |
229 | 229 | // Add a table and verify only with sort row |
230 | | - function verifyCreateTableWithSortRow(){ |
| 230 | + function verifyCreateTableWithSortRow() { |
231 | 231 | $WIKI_TABLE_ROW = "2"; |
232 | 232 | $WIKI_TABLE_COL = "5"; |
233 | 233 | $this->type( TEXT_EDITOR, "" ); |
— | — | @@ -242,14 +242,14 @@ |
243 | 243 | $this->click( CHK_SORT ); |
244 | 244 | $this->click( LINK_PREVIEW ); |
245 | 245 | $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
246 | | - $this->assertTrue( $this->isElementPresent(TEXT_TABLEID_WITHALLFEATURES . |
| 246 | + $this->assertTrue( $this->isElementPresent( TEXT_TABLEID_WITHALLFEATURES . |
247 | 247 | TEXT_VALIDATE_TABLE_PART1 . $WIKI_TABLE_ROW . |
248 | 248 | TEXT_VALIDATE_TABLE_PART2 . $WIKI_TABLE_COL . |
249 | 249 | TEXT_VALIDATE_TABLE_PART3 ) ); |
250 | 250 | } |
251 | 251 | |
252 | 252 | // Add a table without headers,borders and sort rows |
253 | | - function verifyCreateTableWithNoSpecialEffects(){ |
| 253 | + function verifyCreateTableWithNoSpecialEffects() { |
254 | 254 | $WIKI_TABLE_ROW = "6"; |
255 | 255 | $WIKI_TABLE_COL = "2"; |
256 | 256 | $this-> |
— | — | @@ -272,7 +272,7 @@ |
273 | 273 | } |
274 | 274 | |
275 | 275 | // Add a table with headers,borders and sort rows |
276 | | - function verifyCreateTableWithAllSpecialEffects(){ |
| 276 | + function verifyCreateTableWithAllSpecialEffects() { |
277 | 277 | $WIKI_TABLE_ROW = 6; |
278 | 278 | $WIKI_TABLE_COL = "2"; |
279 | 279 | $this->doExpandAdvanceSection(); |
— | — | @@ -285,11 +285,11 @@ |
286 | 286 | $this->click( CHK_SORT ); |
287 | 287 | $this->click( LINK_PREVIEW ); |
288 | 288 | $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
289 | | - $WIKI_TABLE_ROW = $WIKI_TABLE_ROW+1; |
290 | | - $this->assertTrue( $this->isElementPresent(TEXT_TABLEID_WITHALLFEATURES . |
| 289 | + $WIKI_TABLE_ROW = $WIKI_TABLE_ROW + 1; |
| 290 | + $this->assertTrue( $this->isElementPresent( TEXT_TABLEID_WITHALLFEATURES . |
291 | 291 | TEXT_VALIDATE_TABLE_PART1 . $WIKI_TABLE_ROW . |
292 | 292 | TEXT_VALIDATE_TABLE_PART2 . $WIKI_TABLE_COL . |
293 | | - TEXT_VALIDATE_TABLE_PART3)); |
| 293 | + TEXT_VALIDATE_TABLE_PART3 ) ); |
294 | 294 | } |
295 | 295 | |
296 | 296 | } |
Index: trunk/extensions/WikiEditor/tests/selenium/WikiEditorConstants.php |
— | — | @@ -1,84 +1,84 @@ |
2 | 2 | <?php |
3 | | -define ('WIKI_TEST_WAIT_TIME', "3000"); // Waiting time |
| 3 | +define ( 'WIKI_TEST_WAIT_TIME', "3000" ); // Waiting time |
4 | 4 | |
5 | 5 | // tool bar, buttons , links |
6 | 6 | // commonly using links |
7 | | -define ('LINK_MAIN_PAGE',"link=Main page"); |
8 | | -define ('LINK_RANDOM_PAGE',"link=Random article"); |
9 | | -define ('TEXT_PAGE_HEADING',"firstHeading"); |
10 | | -define ('LINK_START',"link="); |
11 | | -define ('LINK_EDITPAGE',"//li[@id='ca-edit']/a/span"); |
12 | | -define ('TEXT_EDITOR',"wpTextbox1"); |
13 | | -define ('LINK_PREVIEW',"wpPreview"); |
| 7 | +define ( 'LINK_MAIN_PAGE', "link=Main page" ); |
| 8 | +define ( 'LINK_RANDOM_PAGE', "link=Random article" ); |
| 9 | +define ( 'TEXT_PAGE_HEADING', "firstHeading" ); |
| 10 | +define ( 'LINK_START', "link=" ); |
| 11 | +define ( 'LINK_EDITPAGE', "//li[@id='ca-edit']/a/span" ); |
| 12 | +define ( 'TEXT_EDITOR', "wpTextbox1" ); |
| 13 | +define ( 'LINK_PREVIEW', "wpPreview" ); |
14 | 14 | |
15 | | -define ('WIKI_SEARCH_PAGE',"Hair (musical)"); // Page name to search |
16 | | -define ('WIKI_TEXT_SEARCH',"TV"); // Text to search |
17 | | -define ('WIKI_INTERNAL_LINK',"Wikieditor-Fixture-Page"); // Exisiting page name to add as an internal tag |
18 | | -define ('WIKI_EXTERNAL_LINK',"www.google.com"); // External web site name |
19 | | -define ('WIKI_EXTERNAL_LINK_TITLE',"Google"); // Page title of the external web site name |
20 | | -define ('WIKI_CODE_PATH',getcwd()); // get the current path of the program |
21 | | -define ('WIKI_SCREENSHOTS_PATH',"screenshots"); // the folder the error screen shots will be saved |
22 | | -define ('WIKI_SCREENSHOTS_TYPE',"png"); // screen print type |
23 | | -define ('WIKI_TEMP_NEWPAGE',"TestWikiPage"); // temporary creating new page name |
| 15 | +define ( 'WIKI_SEARCH_PAGE', "Hair (musical)" ); // Page name to search |
| 16 | +define ( 'WIKI_TEXT_SEARCH', "TV" ); // Text to search |
| 17 | +define ( 'WIKI_INTERNAL_LINK', "Wikieditor-Fixture-Page" ); // Exisiting page name to add as an internal tag |
| 18 | +define ( 'WIKI_EXTERNAL_LINK', "www.google.com" ); // External web site name |
| 19 | +define ( 'WIKI_EXTERNAL_LINK_TITLE', "Google" ); // Page title of the external web site name |
| 20 | +define ( 'WIKI_CODE_PATH', getcwd() ); // get the current path of the program |
| 21 | +define ( 'WIKI_SCREENSHOTS_PATH', "screenshots" ); // the folder the error screen shots will be saved |
| 22 | +define ( 'WIKI_SCREENSHOTS_TYPE', "png" ); // screen print type |
| 23 | +define ( 'WIKI_TEMP_NEWPAGE', "TestWikiPage" ); // temporary creating new page name |
24 | 24 | // for WikiCommonFunction_TC |
25 | 25 | |
26 | 26 | // for WikiSearch_TC |
27 | | -define ('INPUT_SEARCH_BOX', "searchInput"); |
28 | | -define ('BUTTON_SEARCH',"mw-searchButton"); |
29 | | -define ('TEXT_SEARCH_RESULT_HEADING'," - Search results - Wikipedia, the free encyclopedia"); |
| 27 | +define ( 'INPUT_SEARCH_BOX', "searchInput" ); |
| 28 | +define ( 'BUTTON_SEARCH', "mw-searchButton" ); |
| 29 | +define ( 'TEXT_SEARCH_RESULT_HEADING', " - Search results - Wikipedia, the free encyclopedia" ); |
30 | 30 | |
31 | 31 | // for WikiWatchUnWatch_TC |
32 | | -define ('LINK_WATCH_PAGE',"link=Watch"); |
33 | | -define ('LINK_WATCH_LIST',"link=My watchlist"); |
34 | | -define ('LINK_WATCH_EDIT',"link=View and edit watchlist"); |
35 | | -define ('LINK_UNWATCH',"link=Unwatch"); |
36 | | -define ('BUTTON_WATCH',"wpWatchthis"); |
37 | | -define ('BUTTON_SAVE_WATCH',"wpSave"); |
38 | | -define ('TEXT_WATCH',"Watch"); |
39 | | -define ('TEXT_UNWATCH',"Unwatch"); |
| 32 | +define ( 'LINK_WATCH_PAGE', "link=Watch" ); |
| 33 | +define ( 'LINK_WATCH_LIST', "link=My watchlist" ); |
| 34 | +define ( 'LINK_WATCH_EDIT', "link=View and edit watchlist" ); |
| 35 | +define ( 'LINK_UNWATCH', "link=Unwatch" ); |
| 36 | +define ( 'BUTTON_WATCH', "wpWatchthis" ); |
| 37 | +define ( 'BUTTON_SAVE_WATCH', "wpSave" ); |
| 38 | +define ( 'TEXT_WATCH', "Watch" ); |
| 39 | +define ( 'TEXT_UNWATCH', "Unwatch" ); |
40 | 40 | |
41 | 41 | // for WikiCommonFunction_TC |
42 | | -define ('TEXT_LOGOUT',"Log out"); |
43 | | -define ('LINK_LOGOUT',"link=Log out"); |
44 | | -define ('LINK_LOGIN',"link=Log in / create account"); |
45 | | -define ('TEXT_LOGOUT_CONFIRM',"Log in / create account"); |
46 | | -define ('INPUT_USER_NAME', "wpName1"); |
47 | | -define ('INPUT_PASSWD', "wpPassword1"); |
48 | | -define ('BUTTON_LOGIN',"wpLoginAttempt"); |
49 | | -define ('TEXT_HEADING',"Heading"); |
50 | | -define ('LINK_ADVANCED',"link=Advanced"); |
| 42 | +define ( 'TEXT_LOGOUT', "Log out" ); |
| 43 | +define ( 'LINK_LOGOUT', "link=Log out" ); |
| 44 | +define ( 'LINK_LOGIN', "link=Log in / create account" ); |
| 45 | +define ( 'TEXT_LOGOUT_CONFIRM', "Log in / create account" ); |
| 46 | +define ( 'INPUT_USER_NAME', "wpName1" ); |
| 47 | +define ( 'INPUT_PASSWD', "wpPassword1" ); |
| 48 | +define ( 'BUTTON_LOGIN', "wpLoginAttempt" ); |
| 49 | +define ( 'TEXT_HEADING', "Heading" ); |
| 50 | +define ( 'LINK_ADVANCED', "link=Advanced" ); |
51 | 51 | |
52 | 52 | // for WikiDialogs_TC |
53 | | -define ('LINK_ADDLINK',"//div[@id='wikiEditor-ui-toolbar']/div[1]/div[2]/span[2 ]"); |
54 | | -define ('TEXT_LINKNAME',"wikieditor-toolbar-link-int-target"); |
55 | | -define ('TEXT_LINKDISPLAYNAME',"wikieditor-toolbar-link-int-text"); |
56 | | -define ('TEXT_LINKDISPLAYNAME_APPENDTEXT'," Test"); |
57 | | -define ('ICON_PAGEEXISTS',"wikieditor-toolbar-link-int-target-status-exists"); |
58 | | -define ('ICON_PAGEEXTERNAL',"wikieditor-toolbar-link-int-target-status-external"); |
59 | | -define ('OPT_INTERNAL',"wikieditor-toolbar-link-type-int"); |
60 | | -define ('OPT_EXTERNAL',"wikieditor-toolbar-link-type-ext"); |
61 | | -define ('BUTTON_INSERTLINK',"//div[10]/div[11]/button[1]"); |
62 | | -define ('LINK_ADDTABLE',"//div[@id='wikiEditor-ui-toolbar']/div[3]/div[1]/div[4]/span[2]"); |
63 | | -define ('CHK_HEADER',"wikieditor-toolbar-table-dimensions-header"); |
64 | | -define ('CHK_BOARDER',"wikieditor-toolbar-table-wikitable"); |
65 | | -define ('CHK_SORT',"wikieditor-toolbar-table-sortable"); |
66 | | -define ('TEXT_ROW',"wikieditor-toolbar-table-dimensions-rows"); |
67 | | -define ('TEXT_COL',"wikieditor-toolbar-table-dimensions-columns"); |
68 | | -define ('BUTTON_INSERTABLE',"//div[3]/button[1]"); |
69 | | -define ('TEXT_HEADTABLE_TEXT',"Header text"); |
70 | | -define ('TEXT_TABLEID_WITHALLFEATURES', "//table[@id='sortable_table_id_0']/tbody/" ); |
71 | | -define ('TEXT_TABLEID_OTHER', "//div[@id='wikiPreview']/table/tbody/" ); |
72 | | -define ('TEXT_VALIDATE_TABLE_PART1', "tr["); |
73 | | -define ('TEXT_VALIDATE_TABLE_PART2',"]/td["); |
74 | | -define ('TEXT_VALIDATE_TABLE_PART3',"]"); |
75 | | -define ('LINK_SEARCH',"//div[@id='wikiEditor-ui-toolbar']/div[3]/div[1]/div[5]/span"); |
76 | | -define ('INPUT_SEARCH',"wikieditor-toolbar-replace-search"); |
77 | | -define ('INPUT_REPLACE',"wikieditor-toolbar-replace-replace"); |
78 | | -define ('BUTTON_REPLACEALL',"//button[3]"); |
79 | | -define ('BUTTON_REPLACENEXT',"//button[2]"); |
80 | | -define ('BUTTON_CANCEL',"//button[4]"); |
81 | | -define ('TEXT_PREVIEW_TEXT1',"//div[@id='wikiPreview']/p[1]"); |
82 | | -define ('TEXT_PREVIEW_TEXT2',"//div[@id='wikiPreview']/p[2]"); |
83 | | -define ('TEXT_PREVIEW_TEXT3',"//div[@id='wikiPreview']/p[3]"); |
| 53 | +define ( 'LINK_ADDLINK', "//div[@id='wikiEditor-ui-toolbar']/div[1]/div[2]/span[2 ]" ); |
| 54 | +define ( 'TEXT_LINKNAME', "wikieditor-toolbar-link-int-target" ); |
| 55 | +define ( 'TEXT_LINKDISPLAYNAME', "wikieditor-toolbar-link-int-text" ); |
| 56 | +define ( 'TEXT_LINKDISPLAYNAME_APPENDTEXT', " Test" ); |
| 57 | +define ( 'ICON_PAGEEXISTS', "wikieditor-toolbar-link-int-target-status-exists" ); |
| 58 | +define ( 'ICON_PAGEEXTERNAL', "wikieditor-toolbar-link-int-target-status-external" ); |
| 59 | +define ( 'OPT_INTERNAL', "wikieditor-toolbar-link-type-int" ); |
| 60 | +define ( 'OPT_EXTERNAL', "wikieditor-toolbar-link-type-ext" ); |
| 61 | +define ( 'BUTTON_INSERTLINK', "//div[10]/div[11]/button[1]" ); |
| 62 | +define ( 'LINK_ADDTABLE', "//div[@id='wikiEditor-ui-toolbar']/div[3]/div[1]/div[4]/span[2]" ); |
| 63 | +define ( 'CHK_HEADER', "wikieditor-toolbar-table-dimensions-header" ); |
| 64 | +define ( 'CHK_BOARDER', "wikieditor-toolbar-table-wikitable" ); |
| 65 | +define ( 'CHK_SORT', "wikieditor-toolbar-table-sortable" ); |
| 66 | +define ( 'TEXT_ROW', "wikieditor-toolbar-table-dimensions-rows" ); |
| 67 | +define ( 'TEXT_COL', "wikieditor-toolbar-table-dimensions-columns" ); |
| 68 | +define ( 'BUTTON_INSERTABLE', "//div[3]/button[1]" ); |
| 69 | +define ( 'TEXT_HEADTABLE_TEXT', "Header text" ); |
| 70 | +define ( 'TEXT_TABLEID_WITHALLFEATURES', "//table[@id='sortable_table_id_0']/tbody/" ); |
| 71 | +define ( 'TEXT_TABLEID_OTHER', "//div[@id='wikiPreview']/table/tbody/" ); |
| 72 | +define ( 'TEXT_VALIDATE_TABLE_PART1', "tr[" ); |
| 73 | +define ( 'TEXT_VALIDATE_TABLE_PART2', "]/td[" ); |
| 74 | +define ( 'TEXT_VALIDATE_TABLE_PART3', "]" ); |
| 75 | +define ( 'LINK_SEARCH', "//div[@id='wikiEditor-ui-toolbar']/div[3]/div[1]/div[5]/span" ); |
| 76 | +define ( 'INPUT_SEARCH', "wikieditor-toolbar-replace-search" ); |
| 77 | +define ( 'INPUT_REPLACE', "wikieditor-toolbar-replace-replace" ); |
| 78 | +define ( 'BUTTON_REPLACEALL', "//button[3]" ); |
| 79 | +define ( 'BUTTON_REPLACENEXT', "//button[2]" ); |
| 80 | +define ( 'BUTTON_CANCEL', "//button[4]" ); |
| 81 | +define ( 'TEXT_PREVIEW_TEXT1', "//div[@id='wikiPreview']/p[1]" ); |
| 82 | +define ( 'TEXT_PREVIEW_TEXT2', "//div[@id='wikiPreview']/p[2]" ); |
| 83 | +define ( 'TEXT_PREVIEW_TEXT3', "//div[@id='wikiPreview']/p[3]" ); |
84 | 84 | |
85 | 85 | |
Index: trunk/extensions/WikiEditor/modules/jquery.wikiEditor.templateEditor.js |
— | — | @@ -6,9 +6,9 @@ |
7 | 7 | 'nameMappings': { //keep these all lowercase to navigate web of redirects |
8 | 8 | "infobox skyscraper": "building_name", |
9 | 9 | "infobox settlement": "official_name" |
10 | | -}, |
| 10 | +}, |
11 | 11 | |
12 | | - |
| 12 | + |
13 | 13 | /** |
14 | 14 | * Compatability map |
15 | 15 | */ |
— | — | @@ -36,13 +36,13 @@ |
37 | 37 | * Event handlers |
38 | 38 | */ |
39 | 39 | evt: { |
40 | | - |
| 40 | + |
41 | 41 | mark: function( context, event ) { |
42 | 42 | // The markers returned by this function are skipped on realchange, so don't regenerate them in that case |
43 | 43 | if ( context.modules.highlight.currentScope == 'realchange' ) { |
44 | 44 | return; |
45 | 45 | } |
46 | | - |
| 46 | + |
47 | 47 | // Get references to the markers and tokens from the current context |
48 | 48 | var markers = context.modules.highlight.markers; |
49 | 49 | var tokenArray = context.modules.highlight.tokenArray; |
— | — | @@ -96,10 +96,10 @@ |
97 | 97 | // No change |
98 | 98 | return; |
99 | 99 | } |
100 | | - |
| 100 | + |
101 | 101 | // Text changed, regenerate model |
102 | 102 | var model = $.wikiEditor.modules.templateEditor.fn.updateModel( $( node ) ); |
103 | | - |
| 103 | + |
104 | 104 | // Update template name if needed |
105 | 105 | if ( $( node ).parent().hasClass( 'wikiEditor-template' ) ) { |
106 | 106 | var $label = $( node ).parent().find( '.wikiEditor-template-label' ); |
— | — | @@ -108,7 +108,7 @@ |
109 | 109 | $label.text( displayName ); |
110 | 110 | } |
111 | 111 | } |
112 | | - |
| 112 | + |
113 | 113 | // Wrap or unwrap the template if needed |
114 | 114 | if ( $( node ).parent().hasClass( 'wikiEditor-template' ) && |
115 | 115 | !model.isCollapsible() ) { |
— | — | @@ -133,7 +133,7 @@ |
134 | 134 | }//if opentemplates |
135 | 135 | } |
136 | 136 | }, //mark |
137 | | - |
| 137 | + |
138 | 138 | keydown: function( context, event ) { |
139 | 139 | // Reset our ignoreKeypress variable if it's set to true |
140 | 140 | if ( context.$iframe.data( 'ignoreKeypress' ) ) { |
— | — | @@ -156,7 +156,7 @@ |
157 | 157 | case 38:// Up |
158 | 158 | case 39:// Right |
159 | 159 | case 40: //Down |
160 | | - return true; |
| 160 | + return true; |
161 | 161 | default: |
162 | 162 | // Set the ignroreKeypress variable so we don't allow typing if the key is held |
163 | 163 | context.$iframe.data( 'ignoreKeypress', true ); |
— | — | @@ -197,7 +197,7 @@ |
198 | 198 | { 'regex': /}}/, 'label': "TEMPLATE_END", 'markAfter': true } |
199 | 199 | ], |
200 | 200 | /** |
201 | | - * Configuration |
| 201 | + * Configuration |
202 | 202 | */ |
203 | 203 | cfg: { |
204 | 204 | }, |
— | — | @@ -229,7 +229,7 @@ |
230 | 230 | .prepend( |
231 | 231 | '<span class="wikiEditor-template-expand wikiEditor-noinclude"></span>' + |
232 | 232 | '<span class="wikiEditor-template-name wikiEditor-noinclude">' + |
233 | | - '<span class="wikiEditor-template-label wikiEditor-noinclude">' + |
| 233 | + '<span class="wikiEditor-template-label wikiEditor-noinclude">' + |
234 | 234 | $.wikiEditor.modules.templateEditor.fn.getTemplateDisplayName( model ) + '</span>' + |
235 | 235 | '<span class="wikiEditor-template-dialog wikiEditor-noinclude"></span>' + |
236 | 236 | '</span>' |
— | — | @@ -252,21 +252,21 @@ |
253 | 253 | if ( typeof ( opera ) == "undefined" ) { |
254 | 254 | $template.parent().attr('contentEditable', 'false'); |
255 | 255 | } |
256 | | - |
| 256 | + |
257 | 257 | $template.click( function(event) {event.preventDefault(); return false;} ); |
258 | | - |
| 258 | + |
259 | 259 | $template.find( '.wikiEditor-template-name' ) |
260 | | - .click( function( event ) { |
261 | | - $.wikiEditor.modules.templateEditor.fn.createDialog( $wrapper ); |
262 | | - event.stopPropagation(); |
263 | | - return false; |
| 260 | + .click( function( event ) { |
| 261 | + $.wikiEditor.modules.templateEditor.fn.createDialog( $wrapper ); |
| 262 | + event.stopPropagation(); |
| 263 | + return false; |
264 | 264 | } ) |
265 | 265 | .mousedown( function( event ) { event.stopPropagation(); return false; } ); |
266 | 266 | $template.find( '.wikiEditor-template-expand' ) |
267 | | - .click( function( event ) { |
268 | | - $.wikiEditor.modules.templateEditor.fn.toggleWikiTextEditor( $wrapper ); |
| 267 | + .click( function( event ) { |
| 268 | + $.wikiEditor.modules.templateEditor.fn.toggleWikiTextEditor( $wrapper ); |
269 | 269 | event.stopPropagation(); |
270 | | - return false; |
| 270 | + return false; |
271 | 271 | } ) |
272 | 272 | .mousedown( function( event ) { event.stopPropagation(); return false; } ); |
273 | 273 | }, |
— | — | @@ -281,22 +281,22 @@ |
282 | 282 | $template |
283 | 283 | .toggleClass( 'wikiEditor-template-expanded' ) |
284 | 284 | .toggleClass( 'wikiEditor-template-collapsed' ) ; |
285 | | - |
286 | | - var $templateText = $template.find( '.wikiEditor-template-text' ); |
| 285 | + |
| 286 | + var $templateText = $template.find( '.wikiEditor-template-text' ); |
287 | 287 | $templateText.toggleClass( 'wikiEditor-template-text-shrunken' ); |
288 | 288 | $templateText.toggleClass( 'wikiEditor-template-text-visible' ); |
289 | 289 | if( $templateText.hasClass('wikiEditor-template-text-shrunken') ){ |
290 | 290 | //we just closed the template |
291 | | - |
| 291 | + |
292 | 292 | // Update the model if we need to |
293 | 293 | if ( $templateText.html() != $templateText.data( 'oldHTML' ) ) { |
294 | 294 | var templateModel = $.wikiEditor.modules.templateEditor.fn.updateModel( $templateText ); |
295 | | - |
| 295 | + |
296 | 296 | //this is the only place the template name can be changed; keep the template name in sync |
297 | 297 | var $tLabel = $template.find( '.wikiEditor-template-label' ); |
298 | 298 | $tLabel.text( $.wikiEditor.modules.templateEditor.fn.getTemplateDisplayName( templateModel ) ); |
299 | 299 | } |
300 | | - |
| 300 | + |
301 | 301 | } |
302 | 302 | }, |
303 | 303 | /** |
— | — | @@ -424,10 +424,10 @@ |
425 | 425 | // Remove any leftover rows |
426 | 426 | $rows.remove(); |
427 | 427 | $fields.find( 'label' ).autoEllipsis(); |
428 | | - // Ensure our close button doesn't recieve the ui-state-focus class |
| 428 | + // Ensure our close button doesn't recieve the ui-state-focus class |
429 | 429 | $( this ).parent( '.ui-dialog' ).find( '.ui-dialog-titlebar-close' ) |
430 | 430 | .removeClass( 'ui-state-focus' ); |
431 | | - |
| 431 | + |
432 | 432 | // Set tabindexes on form fields if needed |
433 | 433 | // First unset the tabindexes on the buttons and existing form fields |
434 | 434 | // so the order doesn't get messed up |
— | — | @@ -470,7 +470,7 @@ |
471 | 471 | } |
472 | 472 | return model; |
473 | 473 | }, |
474 | | - |
| 474 | + |
475 | 475 | /** |
476 | 476 | * Gets template display name |
477 | 477 | */ |
— | — | @@ -485,24 +485,24 @@ |
486 | 486 | } |
487 | 487 | return tName; |
488 | 488 | }, |
489 | | - |
| 489 | + |
490 | 490 | /** |
491 | 491 | * Builds a template model from given wikitext representation, allowing object-oriented manipulation of the contents |
492 | 492 | * of the template while preserving whitespace and formatting. |
493 | | - * |
| 493 | + * |
494 | 494 | * @param wikitext String of wikitext content |
495 | 495 | */ |
496 | 496 | model: function( wikitext ) { |
497 | | - |
| 497 | + |
498 | 498 | /* Private members */ |
499 | | - |
| 499 | + |
500 | 500 | var collapsible = true; |
501 | | - |
| 501 | + |
502 | 502 | /* Private Functions */ |
503 | | - |
| 503 | + |
504 | 504 | /** |
505 | 505 | * Builds a Param object. |
506 | | - * |
| 506 | + * |
507 | 507 | * @param name |
508 | 508 | * @param value |
509 | 509 | * @param number |
— | — | @@ -520,7 +520,7 @@ |
521 | 521 | } |
522 | 522 | /** |
523 | 523 | * Builds a Range object. |
524 | | - * |
| 524 | + * |
525 | 525 | * @param begin |
526 | 526 | * @param end |
527 | 527 | */ |
— | — | @@ -530,7 +530,7 @@ |
531 | 531 | } |
532 | 532 | /** |
533 | 533 | * Set 'original' to true if you want the original value irrespective of whether the model's been changed |
534 | | - * |
| 534 | + * |
535 | 535 | * @param name |
536 | 536 | * @param value |
537 | 537 | * @param original |
— | — | @@ -567,9 +567,9 @@ |
568 | 568 | } |
569 | 569 | return retVal; |
570 | 570 | }; |
571 | | - |
| 571 | + |
572 | 572 | /* Public Functions */ |
573 | | - |
| 573 | + |
574 | 574 | /** |
575 | 575 | * Get template name |
576 | 576 | */ |
— | — | @@ -582,7 +582,7 @@ |
583 | 583 | }; |
584 | 584 | /** |
585 | 585 | * Set template name (if we want to support this) |
586 | | - * |
| 586 | + * |
587 | 587 | * @param name |
588 | 588 | */ |
589 | 589 | this.setName = function( name ) { |
— | — | @@ -590,7 +590,7 @@ |
591 | 591 | }; |
592 | 592 | /** |
593 | 593 | * Set value for a given param name / number |
594 | | - * |
| 594 | + * |
595 | 595 | * @param name |
596 | 596 | * @param value |
597 | 597 | */ |
— | — | @@ -599,7 +599,7 @@ |
600 | 600 | }; |
601 | 601 | /** |
602 | 602 | * Get value for a given param name / number |
603 | | - * |
| 603 | + * |
604 | 604 | * @param name |
605 | 605 | */ |
606 | 606 | this.getValue = function( name ) { |
— | — | @@ -607,7 +607,7 @@ |
608 | 608 | }; |
609 | 609 | /** |
610 | 610 | * Get original value of a param |
611 | | - * |
| 611 | + * |
612 | 612 | * @param name |
613 | 613 | */ |
614 | 614 | this.getOriginalValue = function( name ) { |
— | — | @@ -645,11 +645,11 @@ |
646 | 646 | } |
647 | 647 | return newText; |
648 | 648 | }; |
649 | | - |
| 649 | + |
650 | 650 | this.isCollapsible = function() { |
651 | 651 | return collapsible; |
652 | 652 | }; |
653 | | - |
| 653 | + |
654 | 654 | /** |
655 | 655 | * Update ranges if there's been a change in one or more 'segments' of the template. |
656 | 656 | * Removes adjustment function so adjustment is only made once ever. |
— | — | @@ -668,7 +668,7 @@ |
669 | 669 | ranges[i].end += adjustment; |
670 | 670 | } |
671 | 671 | }; |
672 | | - |
| 672 | + |
673 | 673 | // Whitespace* {{ whitespace* nonwhitespace: |
674 | 674 | if ( wikitext.match( /\s*{{\s*[^\s|]*:/ ) ) { |
675 | 675 | collapsible = false; // is a parser function |
— | — | @@ -685,8 +685,8 @@ |
686 | 686 | sanatizedStr = sanatizedStr.substring( 0, endBraces.index ) + " " + |
687 | 687 | sanatizedStr.substring( endBraces.index + 2 ); |
688 | 688 | } |
689 | | - |
690 | | - |
| 689 | + |
| 690 | + |
691 | 691 | //treat HTML comments like whitespace |
692 | 692 | while ( sanatizedStr.indexOf( '<!' ) != -1 ) { |
693 | 693 | startIndex = sanatizedStr.indexOf( '<!' ); |
— | — | @@ -698,7 +698,7 @@ |
699 | 699 | sanatizedStr = |
700 | 700 | sanatizedStr.substring( 0, startIndex ) + sanatizedSegment + sanatizedStr.substring( endIndex ); |
701 | 701 | } |
702 | | - |
| 702 | + |
703 | 703 | // Match the open braces we just found with equivalent closing braces note, works for any level of braces |
704 | 704 | while ( sanatizedStr.indexOf( '{{' ) != -1 ) { |
705 | 705 | startIndex = sanatizedStr.indexOf( '{{' ) + 1; |
— | — | @@ -725,7 +725,7 @@ |
726 | 726 | sanatizedStr = |
727 | 727 | sanatizedStr.substring( 0, startIndex ) + sanatizedSegment + sanatizedStr.substring( endIndex ); |
728 | 728 | } |
729 | | - |
| 729 | + |
730 | 730 | /* |
731 | 731 | * Parse 1 param at a time |
732 | 732 | */ |
— | — | @@ -771,11 +771,11 @@ |
772 | 772 | currentField = sanatizedStr.substring( oldDivider+1, divider ); |
773 | 773 | if ( currentField.indexOf( '=' ) == -1 ) { |
774 | 774 | // anonymous field, gets a number |
775 | | - |
| 775 | + |
776 | 776 | //default values, since we'll allow empty values |
777 | 777 | valueBeginIndex = oldDivider + 1; |
778 | 778 | valueEndIndex = oldDivider + 1; |
779 | | - |
| 779 | + |
780 | 780 | valueBegin = currentField.match( /\S+/ ); //first nonwhitespace character |
781 | 781 | if( valueBegin != null ){ |
782 | 782 | valueBeginIndex = valueBegin.index + oldDivider+1; |
— | — | @@ -816,16 +816,16 @@ |
817 | 817 | continue; |
818 | 818 | } |
819 | 819 | nameEndIndex = nameEnd.index + oldDivider + 2; |
820 | | - // All the chars upto now |
| 820 | + // All the chars upto now |
821 | 821 | ranges.push( new Range( ranges[ranges.length-1].end, nameBeginIndex ) ); |
822 | 822 | nameIndex = ranges.push( new Range( nameBeginIndex, nameEndIndex ) ) - 1; |
823 | 823 | currentValue = currentField.substring( currentField.indexOf( '=' ) + 1); |
824 | 824 | oldDivider += currentField.indexOf( '=' ) + 1; |
825 | | - |
| 825 | + |
826 | 826 | //default values, since we'll allow empty values |
827 | 827 | valueBeginIndex = oldDivider + 1; |
828 | 828 | valueEndIndex = oldDivider + 1; |
829 | | - |
| 829 | + |
830 | 830 | // First nonwhitespace character |
831 | 831 | valueBegin = currentValue.match( /\S+/ ); |
832 | 832 | if( valueBegin != null ){ |
— | — | @@ -853,7 +853,7 @@ |
854 | 854 | } |
855 | 855 | // The rest of the string |
856 | 856 | ranges.push( new Range( valueEndIndex, wikitext.length ) ); |
857 | | - |
| 857 | + |
858 | 858 | // Save vars |
859 | 859 | this.ranges = ranges; |
860 | 860 | this.wikitext = wikitext; |
— | — | @@ -861,5 +861,5 @@ |
862 | 862 | this.paramsByName = paramsByName; |
863 | 863 | this.templateNameIndex = templateNameIndex; |
864 | 864 | } //model |
865 | | -} |
| 865 | +} |
866 | 866 | }; } )( jQuery ); |
Index: trunk/extensions/WikiEditor/modules/jquery.wikiEditor.dialogs.js |
— | — | @@ -45,12 +45,12 @@ |
46 | 46 | $.wikiEditor.modules.dialogs.fn.reallyCreate( context, mod, module ); |
47 | 47 | $dialog = $( '#' + mod.id ); |
48 | 48 | } |
49 | | - |
| 49 | + |
50 | 50 | // Workaround for bug in jQuery UI: close button in top right retains focus |
51 | 51 | $dialog.closest( '.ui-dialog' ) |
52 | 52 | .find( '.ui-dialog-titlebar-close' ) |
53 | 53 | .removeClass( 'ui-state-focus' ); |
54 | | - |
| 54 | + |
55 | 55 | $dialog.dialog( 'open' ); |
56 | 56 | } |
57 | 57 | }, |
— | — | @@ -147,7 +147,7 @@ |
148 | 148 | dialogDiv.bind( 'dialogclose', function() { |
149 | 149 | context.fn.restoreSelection(); |
150 | 150 | } ); |
151 | | - |
| 151 | + |
152 | 152 | // Let the outside world know we set up this dialog |
153 | 153 | context.$textarea.trigger( 'wikiEditor-dialogs-loaded-' + name ); |
154 | 154 | }, |
— | — | @@ -187,7 +187,7 @@ |
188 | 188 | $(this).css( 'white-space', oldWS ); |
189 | 189 | oldHidden.each( function() { |
190 | 190 | $(this).attr( 'style', $(this).data( 'oldstyle' ) ); |
191 | | - }); |
| 191 | + }); |
192 | 192 | }, |
193 | 193 | /** |
194 | 194 | * Set the right tabindexes on elements in a dialog |
Index: trunk/extensions/WikiEditor/modules/ext.wikiEditor.tests.toolbar.js |
— | — | @@ -121,7 +121,7 @@ |
122 | 122 | 'pre': 0, |
123 | 123 | 'post': 9 |
124 | 124 | }, |
125 | | - // Add |
| 125 | + // Add |
126 | 126 | 'add_pages_characters': { |
127 | 127 | 'call': 'addToToolbar', |
128 | 128 | 'data': { |
— | — | @@ -141,7 +141,7 @@ |
142 | 142 | 'pre': 0, |
143 | 143 | 'post': 1 |
144 | 144 | }, |
145 | | - // Add |
| 145 | + // Add |
146 | 146 | 'add_characters': { |
147 | 147 | 'call': 'addToToolbar', |
148 | 148 | 'data': { |
Index: trunk/extensions/WikiEditor/modules/contentCollector.js |
— | — | @@ -4,13 +4,13 @@ |
5 | 5 | |
6 | 6 | /** |
7 | 7 | * Copyright 2009 Google Inc. |
8 | | - * |
| 8 | + * |
9 | 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not |
10 | 10 | * use this file except in compliance with the License. You may obtain a copy of |
11 | 11 | * the License at |
12 | | - * |
| 12 | + * |
13 | 13 | * http://www.apache.org/licenses/LICENSE-2.0 |
14 | | - * |
| 14 | + * |
15 | 15 | * Unless required by applicable law or agreed to in writing, software |
16 | 16 | * distributed under the License is distributed on an "AS-IS" BASIS, WITHOUT |
17 | 17 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
— | — | @@ -103,7 +103,7 @@ |
104 | 104 | }, |
105 | 105 | // call flush only when you're done |
106 | 106 | flush : function(withNewline) { |
107 | | - |
| 107 | + |
108 | 108 | } |
109 | 109 | }; |
110 | 110 | self.startNew(); |
— | — | @@ -182,7 +182,7 @@ |
183 | 183 | state.listType = oldListType; |
184 | 184 | } |
185 | 185 | function _produceListMarker(state) { |
186 | | - |
| 186 | + |
187 | 187 | } |
188 | 188 | function _startNewLine(state) { |
189 | 189 | if (state) { |
— | — | @@ -262,14 +262,14 @@ |
263 | 263 | _produceListMarker(state); |
264 | 264 | } |
265 | 265 | lines.appendText(textify(txt2)); |
266 | | - |
| 266 | + |
267 | 267 | x += consumed; |
268 | 268 | txt = rest; |
269 | 269 | if (txt.length > 0) { |
270 | 270 | _startNewLine(state); |
271 | 271 | } |
272 | 272 | } |
273 | | - |
| 273 | + |
274 | 274 | } else { |
275 | 275 | var cls = dom.nodeProp(node, "className"); |
276 | 276 | var tname = (dom.nodeTagName(node) || "").toLowerCase(); |
— | — | @@ -279,7 +279,7 @@ |
280 | 280 | // ignore |
281 | 281 | } else if (!isEmpty) { |
282 | 282 | var styl = dom.nodeAttr(node, "style"); |
283 | | - |
| 283 | + |
284 | 284 | var isPre = (tname == "pre"); |
285 | 285 | if ((!isPre) && browser.safari) { |
286 | 286 | isPre = (styl && /\bwhite-space:\s*pre\b/i.exec(styl)); |
— | — | @@ -301,7 +301,7 @@ |
302 | 302 | |
303 | 303 | if (isPre) |
304 | 304 | _decrementFlag(state, 'preMode'); |
305 | | - |
| 305 | + |
306 | 306 | if (oldListTypeOrNull) { |
307 | 307 | _exitList(state, oldListTypeOrNull); |
308 | 308 | } |
— | — | @@ -384,7 +384,7 @@ |
385 | 385 | lengthToTake = lineLimit; |
386 | 386 | newStrings.push(oldString.substring(0, lengthToTake)); |
387 | 387 | oldString = oldString.substring(lengthToTake); |
388 | | - |
| 388 | + |
389 | 389 | } |
390 | 390 | if (oldString.length > 0) { |
391 | 391 | newStrings.push(oldString); |
— | — | @@ -414,7 +414,7 @@ |
415 | 415 | |
416 | 416 | newStrings.unshift(i, 1); |
417 | 417 | lineStrings.splice.apply(lineStrings, newStrings); |
418 | | - |
| 418 | + |
419 | 419 | } |
420 | 420 | } |
421 | 421 | return { |
Index: trunk/extensions/WikiEditor/modules/jquery.wikiEditor.js |
— | — | @@ -1,12 +1,12 @@ |
2 | 2 | /** |
3 | 3 | * This plugin provides a way to build a wiki-text editing user interface around a textarea. |
4 | | - * |
| 4 | + * |
5 | 5 | * @example To intialize without any modules: |
6 | 6 | * $( 'div#edittoolbar' ).wikiEditor(); |
7 | | - * |
| 7 | + * |
8 | 8 | * @example To initialize with one or more modules, or to add modules after it's already been initialized: |
9 | 9 | * $( 'textarea#wpTextbox1' ).wikiEditor( 'addModule', 'toolbar', { ... config ... } ); |
10 | | - * |
| 10 | + * |
11 | 11 | */ |
12 | 12 | ( function( $ ) { |
13 | 13 | |
— | — | @@ -117,7 +117,7 @@ |
118 | 118 | /** |
119 | 119 | * Provides a way to extract messages from objects. Wraps the mediaWiki.msg() function, which |
120 | 120 | * may eventually become a wrapper for some kind of core MW functionality. |
121 | | - * |
| 121 | + * |
122 | 122 | * @param object Object to extract messages from |
123 | 123 | * @param property String of name of property which contains the message. This should be the base name of the |
124 | 124 | * property, which means that in the case of the object { this: 'that', fooMsg: 'bar' }, passing property as 'this' |
— | — | @@ -152,7 +152,7 @@ |
153 | 153 | * 'default' or 'default-rtl'. If such key doesn't exist, the object itself is considered the actual value, which |
154 | 154 | * should ideally be the case so that you may use a string or object of any number of strings keyed by language |
155 | 155 | * with a default. |
156 | | - * |
| 156 | + * |
157 | 157 | * @param object Object to extract property from |
158 | 158 | * @param lang Language code, defaults to wgUserLanguage |
159 | 159 | */ |
— | — | @@ -163,7 +163,7 @@ |
164 | 164 | /** |
165 | 165 | * Provides a way to extract the path of an icon in a certain language, automatically appending a version number for |
166 | 166 | * caching purposes and prepending an image path when icon paths are relative. |
167 | | - * |
| 167 | + * |
168 | 168 | * @param icon Icon object from e.g. toolbar config |
169 | 169 | * @param path Default icon path, defaults to $.wikiEditor.imgPath |
170 | 170 | * @param lang Language code, defaults to wgUserLanguage |
— | — | @@ -214,7 +214,7 @@ |
215 | 215 | var context = $(this).data( 'wikiEditor-context' ); |
216 | 216 | // On first call, we need to set things up, but on all following calls we can skip right to the API handling |
217 | 217 | if ( !context || typeof context == 'undefined' ) { |
218 | | - |
| 218 | + |
219 | 219 | // Star filling the context with useful data - any jQuery selections, as usual should be named with a preceding $ |
220 | 220 | context = { |
221 | 221 | // Reference to the textarea element which the wikiEditor is being built around |
— | — | @@ -248,18 +248,18 @@ |
249 | 249 | // List of extensions active on this context |
250 | 250 | 'extensions': [] |
251 | 251 | }; |
252 | | - |
| 252 | + |
253 | 253 | /* |
254 | 254 | * Externally Accessible API |
255 | | - * |
| 255 | + * |
256 | 256 | * These are available using calls to $(selection).wikiEditor( call, data ) where selection is a jQuery selection |
257 | 257 | * of the textarea that the wikiEditor instance was built around. |
258 | 258 | */ |
259 | | - |
| 259 | + |
260 | 260 | context.api = { |
261 | 261 | /** |
262 | 262 | * Activates a module on a specific context with optional configuration data. |
263 | | - * |
| 263 | + * |
264 | 264 | * @param data Either a string of the name of a module to add without any additional configuration parameters, |
265 | 265 | * or an object with members keyed with module names and valued with configuration objects. |
266 | 266 | */ |
— | — | @@ -272,7 +272,7 @@ |
273 | 273 | } |
274 | 274 | for ( var module in modules ) { |
275 | 275 | // Check for the existance of an available / supported module with a matching name and a create function |
276 | | - if ( typeof module == 'string' && typeof $.wikiEditor.modules[module] !== 'undefined' && |
| 276 | + if ( typeof module == 'string' && typeof $.wikiEditor.modules[module] !== 'undefined' && |
277 | 277 | $.wikiEditor.isSupported( $.wikiEditor.modules[module] ) ) |
278 | 278 | { |
279 | 279 | // Extend the context's core API with this module's own API calls |
— | — | @@ -295,20 +295,20 @@ |
296 | 296 | } |
297 | 297 | } |
298 | 298 | }; |
299 | | - |
300 | | - /* |
| 299 | + |
| 300 | + /* |
301 | 301 | * Event Handlers |
302 | | - * |
| 302 | + * |
303 | 303 | * These act as filters returning false if the event should be ignored or returning true if it should be passed |
304 | 304 | * on to all modules. This is also where we can attach some extra information to the events. |
305 | 305 | */ |
306 | | - |
| 306 | + |
307 | 307 | context.evt = { |
308 | 308 | /* Empty until extensions add some; see jquery.wikiEditor.iframe.js for examples. */ |
309 | 309 | }; |
310 | | - |
| 310 | + |
311 | 311 | /* Internal Functions */ |
312 | | - |
| 312 | + |
313 | 313 | context.fn = { |
314 | 314 | /** |
315 | 315 | * Executes core event filters as well as event handlers provided by modules. |
— | — | @@ -322,7 +322,7 @@ |
323 | 323 | if ( typeof event.data == 'undefined' ) { |
324 | 324 | event.data = {}; |
325 | 325 | } |
326 | | - |
| 326 | + |
327 | 327 | // Allow filtering to occur |
328 | 328 | if ( name in context.evt ) { |
329 | 329 | if ( !context.evt[name]( event ) ) { |
— | — | @@ -331,7 +331,7 @@ |
332 | 332 | } |
333 | 333 | var returnFromModules = null; //they return null by default |
334 | 334 | // Pass the event around to all modules activated on this context |
335 | | - |
| 335 | + |
336 | 336 | for ( var module in context.modules ) { |
337 | 337 | if ( |
338 | 338 | module in $.wikiEditor.modules && |
— | — | @@ -342,10 +342,10 @@ |
343 | 343 | if (ret != null) { |
344 | 344 | //if 1 returns false, the end result is false |
345 | 345 | if( returnFromModules == null ) { |
346 | | - returnFromModules = ret; |
| 346 | + returnFromModules = ret; |
347 | 347 | } else { |
348 | 348 | returnFromModules = returnFromModules && ret; |
349 | | - } |
| 349 | + } |
350 | 350 | } |
351 | 351 | } |
352 | 352 | } |
— | — | @@ -460,15 +460,15 @@ |
461 | 461 | } |
462 | 462 | } |
463 | 463 | }; |
464 | | - |
| 464 | + |
465 | 465 | /* |
466 | 466 | * Base UI Construction |
467 | | - * |
| 467 | + * |
468 | 468 | * The UI is built from several containers, the outer-most being a div classed as "wikiEditor-ui". These containers |
469 | 469 | * provide a certain amount of "free" layout, but in some situations procedural layout is needed, which is performed |
470 | 470 | * as a response to the "resize" event. |
471 | 471 | */ |
472 | | - |
| 472 | + |
473 | 473 | // Assemble a temporary div to place over the wikiEditor while it's being constructed |
474 | 474 | /* Disabling our loading div for now |
475 | 475 | var $loader = $( '<div></div>' ) |
Index: trunk/extensions/WikiEditor/modules/jquery.wikiEditor.toolbar.js |
— | — | @@ -580,7 +580,7 @@ |
581 | 581 | if ( selected !== null ) { |
582 | 582 | $.cookie( 'wikiEditor-' + context.instance + '-toolbar-section', selected, { expires: 30, path: '/' } ); |
583 | 583 | } |
584 | | - var $link = |
| 584 | + var $link = |
585 | 585 | $( '<a/>' ) |
586 | 586 | .addClass( selected == id ? 'current' : null ) |
587 | 587 | .attr( 'href', '#' ) |
— | — | @@ -661,7 +661,7 @@ |
662 | 662 | var $section = $( '<div/>' ).attr( { 'class': section.type + ' section section-' + id, 'rel': id } ); |
663 | 663 | var selected = $.cookie( 'wikiEditor-' + context.instance + '-toolbar-section' ); |
664 | 664 | var show = selected == id; |
665 | | - |
| 665 | + |
666 | 666 | if ( section.deferLoad !== undefined && section.deferLoad && id !== 'main' && !show ) { |
667 | 667 | // This class shows the spinner and serves as a marker for the click handler in buildTab() |
668 | 668 | $section.addClass( 'loading' ).append( $( '<div/>' ).addClass( 'spinner' ) ); |
— | — | @@ -672,7 +672,7 @@ |
673 | 673 | } else { |
674 | 674 | $.wikiEditor.modules.toolbar.fn.reallyBuildSection( context, id, section, $section ); |
675 | 675 | } |
676 | | - |
| 676 | + |
677 | 677 | // Show or hide section |
678 | 678 | if ( id !== 'main' ) { |
679 | 679 | $section.css( 'display', show ? 'block' : 'none' ); |
Index: trunk/extensions/WikiEditor/modules/jquery.wikiEditor.iframe.js |
— | — | @@ -2,9 +2,9 @@ |
3 | 3 | |
4 | 4 | ( function( $ ) { $.wikiEditor.extensions.iframe = function( context ) { |
5 | 5 | |
6 | | -/* |
| 6 | +/* |
7 | 7 | * Event Handlers |
8 | | - * |
| 8 | + * |
9 | 9 | * These act as filters returning false if the event should be ignored or returning true if it should be passed |
10 | 10 | * on to all modules. This is also where we can attach some extra information to the events. |
11 | 11 | */ |
— | — | @@ -130,13 +130,13 @@ |
131 | 131 | var cursorPos = context.fn.getCaretPosition(); |
132 | 132 | var oldLength = context.fn.getContents().length; |
133 | 133 | var positionFromEnd = oldLength - cursorPos[1]; |
134 | | - |
135 | | - //give everything the wikiEditor class so that we can easily pick out things without that class as pasted |
| 134 | + |
| 135 | + //give everything the wikiEditor class so that we can easily pick out things without that class as pasted |
136 | 136 | context.$content.find( '*' ).addClass( 'wikiEditor' ); |
137 | 137 | if ( $.layout.name !== 'webkit' ) { |
138 | 138 | context.$content.addClass( 'pasting' ); |
139 | 139 | } |
140 | | - |
| 140 | + |
141 | 141 | setTimeout( function() { |
142 | 142 | // Kill stuff we know we don't want |
143 | 143 | context.$content.find( 'script,style,img,input,select,textarea,hr,button,link,meta' ).remove(); |
— | — | @@ -156,7 +156,7 @@ |
157 | 157 | } else { |
158 | 158 | firstDirtyNode = elementAtCursor.node; |
159 | 159 | } |
160 | | - |
| 160 | + |
161 | 161 | //this is ugly but seems like the best way to handle the case where we select and replace all editor contents |
162 | 162 | try { |
163 | 163 | firstDirtyNode.parentNode; |
— | — | @@ -164,11 +164,11 @@ |
165 | 165 | context.$content.prepend( '<p class = wikiEditor></p>' ); |
166 | 166 | firstDirtyNode = context.$content.children()[0]; |
167 | 167 | } |
168 | | - |
| 168 | + |
169 | 169 | while ( firstDirtyNode != null ) { |
170 | | - //we're going to replace the contents of the entire parent node. |
171 | | - while ( firstDirtyNode.parentNode && firstDirtyNode.parentNode.nodeName != 'BODY' |
172 | | - && ! $( firstDirtyNode ).hasClass( 'wikiEditor' ) |
| 170 | + //we're going to replace the contents of the entire parent node. |
| 171 | + while ( firstDirtyNode.parentNode && firstDirtyNode.parentNode.nodeName != 'BODY' |
| 172 | + && ! $( firstDirtyNode ).hasClass( 'wikiEditor' ) |
173 | 173 | ) { |
174 | 174 | firstDirtyNode = firstDirtyNode.parentNode; |
175 | 175 | } |
— | — | @@ -176,33 +176,33 @@ |
177 | 177 | while ( firstDirtyNode.previousSibling != null |
178 | 178 | && ! $( firstDirtyNode.previousSibling ).hasClass( 'wikiEditor' ) |
179 | 179 | ) { |
180 | | - |
| 180 | + |
181 | 181 | if ( $( firstDirtyNode.previousSibling ).hasClass( '#comment' ) ) { |
182 | 182 | $( firstDirtyNode ).remove(); |
183 | 183 | } else { |
184 | 184 | firstDirtyNode = firstDirtyNode.previousSibling; |
185 | 185 | } |
186 | 186 | } |
187 | | - |
| 187 | + |
188 | 188 | if ( firstDirtyNode.previousSibling != null ) { |
189 | 189 | $lastDirtyNode = $( firstDirtyNode.previousSibling ); |
190 | 190 | } else { |
191 | 191 | $lastDirtyNode = $( firstDirtyNode ); |
192 | 192 | } |
193 | | - |
| 193 | + |
194 | 194 | var cc = makeContentCollector( $.browser, null ); |
195 | 195 | while ( firstDirtyNode != null ) { |
196 | 196 | cc.collectContent(firstDirtyNode); |
197 | | - cc.notifyNextNode(firstDirtyNode.nextSibling); |
198 | | - |
| 197 | + cc.notifyNextNode(firstDirtyNode.nextSibling); |
| 198 | + |
199 | 199 | nodeToDelete.push( firstDirtyNode ); |
200 | | - |
| 200 | + |
201 | 201 | firstDirtyNode = firstDirtyNode.nextSibling; |
202 | 202 | if ( $( firstDirtyNode ).hasClass( 'wikiEditor' ) ) { |
203 | 203 | break; |
204 | 204 | } |
205 | 205 | } |
206 | | - |
| 206 | + |
207 | 207 | var ccData = cc.finish(); |
208 | 208 | pastedContent = ccData.lines; |
209 | 209 | var pastedPretty = ''; |
— | — | @@ -216,8 +216,8 @@ |
217 | 217 | leadingSpace = match[0].replace(/[\s]/g, ' '); |
218 | 218 | pastedPretty = leadingSpace + pastedPretty.substring(index, pastedPretty.length); |
219 | 219 | } |
220 | | - |
221 | | - |
| 220 | + |
| 221 | + |
222 | 222 | if( !pastedPretty && $.browser.msie && i == 0 ) { |
223 | 223 | continue; |
224 | 224 | } |
— | — | @@ -228,17 +228,17 @@ |
229 | 229 | $newElement.html( '<br class="wikiEditor">' ); |
230 | 230 | } |
231 | 231 | $newElement.insertAfter( $lastDirtyNode ); |
232 | | - |
| 232 | + |
233 | 233 | $lastDirtyNode = $newElement; |
234 | | - |
| 234 | + |
235 | 235 | } |
236 | | - |
| 236 | + |
237 | 237 | //now delete all the original nodes that we prettified already |
238 | 238 | while ( nodeToDelete.length > 0 ) { |
239 | 239 | $deleteNode = $( nodeToDelete.pop() ); |
240 | 240 | $deleteNode.remove(); |
241 | 241 | } |
242 | | - |
| 242 | + |
243 | 243 | //anything without wikiEditor class was pasted. |
244 | 244 | $selection = context.$content.find( ':not(.wikiEditor)' ); |
245 | 245 | if ( $selection.length == 0 ) { |
— | — | @@ -248,14 +248,14 @@ |
249 | 249 | } |
250 | 250 | } |
251 | 251 | context.$content.find( '.wikiEditor' ).removeClass( 'wikiEditor' ); |
252 | | - |
| 252 | + |
253 | 253 | //now place the cursor at the end of pasted content |
254 | 254 | var newLength = context.fn.getContents().length; |
255 | 255 | var newPos = newLength - positionFromEnd; |
256 | | - |
| 256 | + |
257 | 257 | context.fn.purgeOffsets(); |
258 | 258 | context.fn.setSelection( { start: newPos, end: newPos } ); |
259 | | - |
| 259 | + |
260 | 260 | context.fn.scrollToCaretPosition(); |
261 | 261 | }, 0 ); |
262 | 262 | return true; |
— | — | @@ -289,7 +289,7 @@ |
290 | 290 | return context.htmlToTextMap[html]; |
291 | 291 | } |
292 | 292 | var origHTML = html; |
293 | | - |
| 293 | + |
294 | 294 | // We use this elaborate trickery for cross-browser compatibility |
295 | 295 | // IE does overzealous whitespace collapsing for $( '<pre />' ).html( html ); |
296 | 296 | // We also do <br> and easy cases for <p> conversion here, complicated cases are handled later |
— | — | @@ -320,7 +320,7 @@ |
321 | 321 | // If this <p> is preceded by some text, add a \n at the beginning, and if |
322 | 322 | // it's followed by a textnode, add a \n at the end |
323 | 323 | // We need the traverser because there can be other weird stuff in between |
324 | | - |
| 324 | + |
325 | 325 | // Check for preceding text |
326 | 326 | var t = new context.fn.rawTraverser( this.firstChild, this, $pre.get( 0 ), true ).prev(); |
327 | 327 | while ( t && t.node.nodeName != '#text' && t.node.nodeName != 'BR' && t.node.nodeName != 'P' ) { |
— | — | @@ -329,7 +329,7 @@ |
330 | 330 | if ( t ) { |
331 | 331 | text = "\n" + text; |
332 | 332 | } |
333 | | - |
| 333 | + |
334 | 334 | // Check for following text |
335 | 335 | t = new context.fn.rawTraverser( this.lastChild, this, $pre.get( 0 ), true ).next(); |
336 | 336 | while ( t && t.node.nodeName != '#text' && t.node.nodeName != 'BR' && t.node.nodeName != 'P' ) { |
— | — | @@ -377,7 +377,7 @@ |
378 | 378 | } else { |
379 | 379 | return null; |
380 | 380 | } |
381 | | - |
| 381 | + |
382 | 382 | // When the cursor is on an empty line, Opera gives us a bogus range object with |
383 | 383 | // startContainer=endContainer=body and startOffset=endOffset=1 |
384 | 384 | var body = context.$iframe[0].contentWindow.document.body; |
— | — | @@ -420,7 +420,7 @@ |
421 | 421 | } |
422 | 422 | e = newE || e; |
423 | 423 | } |
424 | | - |
| 424 | + |
425 | 425 | // We'd normally use if( $( e ).hasClass( class ) in the while loop, but running the jQuery |
426 | 426 | // constructor thousands of times is very inefficient |
427 | 427 | var classStr = ' ' + classname + ' '; |
— | — | @@ -641,18 +641,18 @@ |
642 | 642 | * Update the history queue |
643 | 643 | * |
644 | 644 | * @param htmlChange pass true or false to inidicate if there was a text change that should potentially |
645 | | - * be given a new history state. |
| 645 | + * be given a new history state. |
646 | 646 | */ |
647 | 647 | 'updateHistory': function( htmlChange ) { |
648 | 648 | var newHTML = context.$content.html(); |
649 | 649 | var newSel = context.fn.getCaretPosition(); |
650 | | - // Was text changed? Was it because of a REDO or UNDO action? |
| 650 | + // Was text changed? Was it because of a REDO or UNDO action? |
651 | 651 | if ( |
652 | 652 | context.history.length == 0 || |
653 | 653 | ( htmlChange && context.oldDelayedHistoryPosition == context.historyPosition ) |
654 | 654 | ) { |
655 | 655 | context.oldDelayedSel = newSel; |
656 | | - // Do we need to trim extras from our history? |
| 656 | + // Do we need to trim extras from our history? |
657 | 657 | // FIXME: this should really be happing on change, not on the delay |
658 | 658 | if ( context.historyPosition < -1 ) { |
659 | 659 | //clear out the extras |
— | — | @@ -753,7 +753,7 @@ |
754 | 754 | /<span( | )class=("|")wikiEditor-tab("|")><\/span>/g, |
755 | 755 | '<span class="wikiEditor-tab"></span>' |
756 | 756 | ) |
757 | | - // Empty <p> tags need <br> tags in them |
| 757 | + // Empty <p> tags need <br> tags in them |
758 | 758 | .replace( /<p><\/p>/g, '<p><br></p>' ) |
759 | 759 | // Unescape &esc; stuff |
760 | 760 | .replace( /&esc;&amp;nbsp;/g, '&nbsp;' ) |
— | — | @@ -765,7 +765,7 @@ |
766 | 766 | ) |
767 | 767 | .replace( /&esc;esc;/g, '&esc;' ); |
768 | 768 | context.$content.html( html ); |
769 | | - |
| 769 | + |
770 | 770 | // Reflect direction of parent frame into child |
771 | 771 | if ( $( 'body' ).is( '.rtl' ) ) { |
772 | 772 | context.$content.addClass( 'rtl' ).attr( 'dir', 'rtl' ); |
— | — | @@ -789,7 +789,7 @@ |
790 | 790 | .bind( 'keydown', function( event ) { |
791 | 791 | event.jQueryNode = context.fn.getElementAtCursor(); |
792 | 792 | return context.fn.trigger( 'keydown', event ); |
793 | | - |
| 793 | + |
794 | 794 | } ) |
795 | 795 | .bind( 'keyup', function( event ) { |
796 | 796 | event.jQueryNode = context.fn.getElementAtCursor(); |
— | — | @@ -828,12 +828,12 @@ |
829 | 829 | } |
830 | 830 | }; |
831 | 831 | }, |
832 | | - |
| 832 | + |
833 | 833 | /* |
834 | 834 | * Compatibility with the $.textSelection jQuery plug-in. When the iframe is in use, these functions provide |
835 | 835 | * equivilant functionality to the otherwise textarea-based functionality. |
836 | 836 | */ |
837 | | - |
| 837 | + |
838 | 838 | 'getElementAtCursor': function() { |
839 | 839 | if ( context.$iframe[0].contentWindow.getSelection ) { |
840 | 840 | // Firefox and Opera |
— | — | @@ -851,7 +851,7 @@ |
852 | 852 | return $( selection.parentElement() ); |
853 | 853 | } |
854 | 854 | }, |
855 | | - |
| 855 | + |
856 | 856 | /** |
857 | 857 | * Gets the complete contents of the iframe (in plain text, not HTML) |
858 | 858 | */ |
— | — | @@ -948,8 +948,8 @@ |
949 | 949 | if ( context.$iframe[0].contentWindow.getSelection ) { |
950 | 950 | // Firefox and Opera |
951 | 951 | var range = context.$iframe[0].contentWindow.getSelection().getRangeAt( 0 ); |
952 | | - // if our test above indicated that this was a sucessive button press, we need to collapse the |
953 | | - // selection to the end to avoid replacing text |
| 952 | + // if our test above indicated that this was a sucessive button press, we need to collapse the |
| 953 | + // selection to the end to avoid replacing text |
954 | 954 | if ( collapseToEnd ) { |
955 | 955 | // Make sure we're not collapsing ourselves into a BR tag |
956 | 956 | if ( range.endContainer.nodeName == 'BR' ) { |
— | — | @@ -1073,7 +1073,7 @@ |
1074 | 1074 | if ( range2.text != "\r" && range2.text != "\n" && range2.text != "" ) { |
1075 | 1075 | pre = "\n" + pre; |
1076 | 1076 | } |
1077 | | - |
| 1077 | + |
1078 | 1078 | // Check if we're at the end of a line |
1079 | 1079 | // If not, append a newline |
1080 | 1080 | var range3 = context.$iframe[0].contentWindow.document.selection.createRange(); |
— | — | @@ -1095,7 +1095,7 @@ |
1096 | 1096 | for( var j = 0; j < selTextArr.length; j++ ) { |
1097 | 1097 | insertText = insertText + pre + selTextArr[j] + post; |
1098 | 1098 | if( j != selTextArr.length - 1 ) { |
1099 | | - insertText += "\n"; |
| 1099 | + insertText += "\n"; |
1100 | 1100 | } |
1101 | 1101 | } |
1102 | 1102 | } else { |
— | — | @@ -1113,7 +1113,7 @@ |
1114 | 1114 | range.select(); |
1115 | 1115 | } |
1116 | 1116 | } |
1117 | | - |
| 1117 | + |
1118 | 1118 | if ( setSelectionTo ) { |
1119 | 1119 | context.fn.setSelection( setSelectionTo ); |
1120 | 1120 | } |
— | — | @@ -1154,7 +1154,7 @@ |
1155 | 1155 | ec = n; |
1156 | 1156 | eo = 0; |
1157 | 1157 | } |
1158 | | - |
| 1158 | + |
1159 | 1159 | // Make sure sc and ec are leaf nodes |
1160 | 1160 | while ( sc.firstChild ) { |
1161 | 1161 | sc = sc.firstChild; |
— | — | @@ -1292,7 +1292,7 @@ |
1293 | 1293 | // Give up |
1294 | 1294 | return context.$textarea; |
1295 | 1295 | } |
1296 | | - |
| 1296 | + |
1297 | 1297 | var sel = context.$iframe[0].contentWindow.getSelection(); |
1298 | 1298 | while ( sc.firstChild && sc.nodeName != '#text' ) { |
1299 | 1299 | sc = sc.firstChild; |
— | — | @@ -1314,14 +1314,14 @@ |
1315 | 1315 | } |
1316 | 1316 | range.collapse(); |
1317 | 1317 | range.moveEnd( 'character', options.start ); |
1318 | | - |
| 1318 | + |
1319 | 1319 | var range2 = context.$iframe[0].contentWindow.document.body.createTextRange(); |
1320 | 1320 | if ( ec ) { |
1321 | 1321 | range2.moveToElementText( ec ); |
1322 | 1322 | } |
1323 | 1323 | range2.collapse(); |
1324 | 1324 | range2.moveEnd( 'character', options.end ); |
1325 | | - |
| 1325 | + |
1326 | 1326 | // IE does newline emulation for <p>s: <p>foo</p><p>bar</p> becomes foo\nbar just fine |
1327 | 1327 | // but <p>foo</p><br><br><p>bar</p> becomes foo\n\n\n\nbar , one \n too many |
1328 | 1328 | // Correct for this |
Index: trunk/extensions/WikiEditor/modules/jquery.wikiEditor.publish.js |
— | — | @@ -65,7 +65,7 @@ |
66 | 66 | $(this).find( '[rel]' ).each( function() { |
67 | 67 | $(this).text( mediaWiki.msg( $(this).attr( 'rel' ) ) ); |
68 | 68 | }); |
69 | | - |
| 69 | + |
70 | 70 | /* REALLY DIRTY HACK! */ |
71 | 71 | // Reformat the copyright warning stuff |
72 | 72 | var copyWarnHTML = $( '#editpage-copywarn p' ).html(); |
— | — | @@ -80,11 +80,11 @@ |
81 | 81 | } |
82 | 82 | newCopyWarnHTML += '</ul>'; |
83 | 83 | // No list if there's only one element |
84 | | - $(this).find( '.wikiEditor-publish-dialog-copywarn' ).html( |
| 84 | + $(this).find( '.wikiEditor-publish-dialog-copywarn' ).html( |
85 | 85 | copyWarnStatements.length > 1 ? newCopyWarnHTML : copyWarnHTML |
86 | 86 | ); |
87 | 87 | /* END OF REALLY DIRTY HACK */ |
88 | | - |
| 88 | + |
89 | 89 | if ( $( '#wpMinoredit' ).size() == 0 ) |
90 | 90 | $( '#wikiEditor-' + context.instance + '-dialog-minor' ).hide(); |
91 | 91 | else if ( $( '#wpMinoredit' ).is( ':checked' ) ) |
— | — | @@ -95,7 +95,7 @@ |
96 | 96 | else if ( $( '#wpWatchthis' ).is( ':checked' ) ) |
97 | 97 | $( '#wikiEditor-' + context.instance + '-dialog-watch' ) |
98 | 98 | .attr( 'checked', 'checked' ); |
99 | | - |
| 99 | + |
100 | 100 | $(this).find( 'form' ).submit( function( e ) { |
101 | 101 | $(this).closest( '.ui-dialog' ).find( 'button:first' ).click(); |
102 | 102 | e.preventDefault(); |
Index: trunk/extensions/WikiEditor/modules/jquery.wikiEditor.preview.js |
— | — | @@ -78,7 +78,7 @@ |
79 | 79 | ); |
80 | 80 | } |
81 | 81 | } ); |
82 | | - |
| 82 | + |
83 | 83 | context.$changesTab = context.fn.addView( { |
84 | 84 | 'name': 'changes', |
85 | 85 | 'titleMsg': 'wikieditor-preview-changes-tab', |
— | — | @@ -91,7 +91,7 @@ |
92 | 92 | } |
93 | 93 | context.$changesTab.find( 'table.diff tbody' ).empty(); |
94 | 94 | context.$changesTab.find( '.wikiEditor-preview-loading' ).show(); |
95 | | - |
| 95 | + |
96 | 96 | // Call the API. First PST the input, then diff it |
97 | 97 | var postdata = { |
98 | 98 | 'action': 'parse', |
— | — | @@ -99,7 +99,7 @@ |
100 | 100 | 'text': wikitext, |
101 | 101 | 'format': 'json' |
102 | 102 | }; |
103 | | - |
| 103 | + |
104 | 104 | $.post( mw.util.wikiScript( 'api' ), postdata, function( data ) { |
105 | 105 | try { |
106 | 106 | var postdata2 = { |
— | — | @@ -114,7 +114,7 @@ |
115 | 115 | var section = $( '[name=wpSection]' ).val(); |
116 | 116 | if ( section != '' ) |
117 | 117 | postdata2['rvsection'] = section; |
118 | | - |
| 118 | + |
119 | 119 | $.post( mw.util.wikiScript( 'api' ), postdata2, function( data ) { |
120 | 120 | // Add diff CSS |
121 | 121 | mw.loader.load( 'mediawiki.action.history.diff' ); |
— | — | @@ -133,7 +133,7 @@ |
134 | 134 | }, 'json' ); |
135 | 135 | } |
136 | 136 | } ); |
137 | | - |
| 137 | + |
138 | 138 | var loadingMsg = mediaWiki.msg( 'wikieditor-preview-loading' ); |
139 | 139 | context.modules.preview.$preview |
140 | 140 | .add( context.$changesTab ) |
Index: trunk/extensions/WikiEditor/modules/jquery.wikiEditor.toc.js |
— | — | @@ -70,11 +70,11 @@ |
71 | 71 | }, |
72 | 72 | resize: function( context, event ) { |
73 | 73 | var availableWidth = context.$wikitext.width() - parseFloat( $.wikiEditor.modules.toc.cfg.textMinimumWidth ), |
74 | | - totalMinWidth = parseFloat( $.wikiEditor.modules.toc.cfg.minimumWidth ) + |
| 74 | + totalMinWidth = parseFloat( $.wikiEditor.modules.toc.cfg.minimumWidth ) + |
75 | 75 | parseFloat( $.wikiEditor.modules.toc.cfg.textMinimumWidth ); |
76 | 76 | context.$ui.find( '.wikiEditor-ui-right' ) |
77 | 77 | .resizable( 'option', 'maxWidth', availableWidth ); |
78 | | - if ( context.modules.toc.$toc.data( 'positionMode' ) != 'disabled' && |
| 78 | + if ( context.modules.toc.$toc.data( 'positionMode' ) != 'disabled' && |
79 | 79 | context.$wikitext.width() < totalMinWidth ) { |
80 | 80 | $.wikiEditor.modules.toc.fn.disable( context ); |
81 | 81 | } else if ( context.modules.toc.$toc.data( 'positionMode' ) == 'disabled' && |
— | — | @@ -97,7 +97,7 @@ |
98 | 98 | // reset the height of the TOC |
99 | 99 | if ( !context.modules.toc.$toc.data( 'collapsed' ) ){ |
100 | 100 | context.modules.toc.$toc.height( |
101 | | - context.$ui.find( '.wikiEditor-ui-left' ).height() - |
| 101 | + context.$ui.find( '.wikiEditor-ui-left' ).height() - |
102 | 102 | context.$ui.find( '.tab-toc' ).outerHeight() |
103 | 103 | ); |
104 | 104 | } |
— | — | @@ -219,20 +219,20 @@ |
220 | 220 | // store position mode |
221 | 221 | context.modules.toc.$toc.data( 'positionMode', 'goofy' ); |
222 | 222 | // store the width of the TOC, to ensure we dont allow it to be larger than this when switching back |
223 | | - context.modules.toc.$toc.data( 'positionModeChangeAt', |
| 223 | + context.modules.toc.$toc.data( 'positionModeChangeAt', |
224 | 224 | context.$ui.find( '.wikiEditor-ui-right' ).width() ); |
225 | 225 | width = $.wikiEditor.modules.toc.cfg.textMinimumWidth; |
226 | 226 | // set our styles for goofy mode |
227 | 227 | context.$ui.find( '.wikiEditor-ui-left' ) |
228 | 228 | .css( $.wikiEditor.modules.toc.cfg.flexProperty, '') |
229 | 229 | .css( { 'position': 'absolute', 'float': 'none', |
230 | | - 'left': $.wikiEditor.modules.toc.cfg.rtl ? 'auto': 0, |
| 230 | + 'left': $.wikiEditor.modules.toc.cfg.rtl ? 'auto': 0, |
231 | 231 | 'right' : $.wikiEditor.modules.toc.cfg.rtl ? 0 : 'auto' } ) |
232 | 232 | .children() |
233 | 233 | .css( $.wikiEditor.modules.toc.cfg.flexProperty, '' ); |
234 | 234 | context.$ui.find( '.wikiEditor-ui-right' ) |
235 | 235 | .css( { 'width': 'auto', 'position': 'absolute', 'float': 'none', |
236 | | - 'right': $.wikiEditor.modules.toc.cfg.rtl ? 'auto': 0, |
| 236 | + 'right': $.wikiEditor.modules.toc.cfg.rtl ? 'auto': 0, |
237 | 237 | 'left' : $.wikiEditor.modules.toc.cfg.rtl ? 0 : 'auto' } ); |
238 | 238 | context.$wikitext |
239 | 239 | .css( 'position', 'relative' ); |
— | — | @@ -296,7 +296,7 @@ |
297 | 297 | * @param {Object} context |
298 | 298 | */ |
299 | 299 | update: function( context ) { |
300 | | - //temporarily commenting this out because it is causing all kinds of cursor |
| 300 | + //temporarily commenting this out because it is causing all kinds of cursor |
301 | 301 | //and text jumping issues in IE. WIll get back to this --pdhanda |
302 | 302 | /* |
303 | 303 | var div = context.fn.beforeSelection( 'wikiEditor-toc-header' ); |
— | — | @@ -304,16 +304,16 @@ |
305 | 305 | // beforeSelection couldn't figure it out, keep the old highlight state |
306 | 306 | return; |
307 | 307 | } |
308 | | - |
| 308 | + |
309 | 309 | $.wikiEditor.modules.toc.fn.unhighlight( context ); |
310 | 310 | var section = div.data( 'section' ) || 0; |
311 | 311 | if ( context.data.outline.length > 0 ) { |
312 | 312 | var sectionLink = context.modules.toc.$toc.find( 'div.section-' + section ); |
313 | 313 | sectionLink.addClass( 'current' ); |
314 | | - |
| 314 | + |
315 | 315 | // Scroll the highlighted link into view if necessary |
316 | 316 | var relTop = sectionLink.offset().top - context.modules.toc.$toc.offset().top; |
317 | | - |
| 317 | + |
318 | 318 | var scrollTop = context.modules.toc.$toc.scrollTop(); |
319 | 319 | var divHeight = context.modules.toc.$toc.height(); |
320 | 320 | var sectionHeight = sectionLink.height(); |
— | — | @@ -326,14 +326,14 @@ |
327 | 327 | } |
328 | 328 | */ |
329 | 329 | }, |
330 | | - |
| 330 | + |
331 | 331 | /** |
332 | 332 | * Collapse the contents module |
333 | 333 | * |
334 | 334 | * @param {Object} event Event object with context as data |
335 | 335 | */ |
336 | 336 | collapse: function( event ) { |
337 | | - var $this = $( this ), |
| 337 | + var $this = $( this ), |
338 | 338 | context = $this.data( 'context' ); |
339 | 339 | if( context.modules.toc.$toc.data( 'positionMode' ) == 'goofy' ) { |
340 | 340 | $.wikiEditor.modules.toc.fn.switchLayout( context ); |
— | — | @@ -348,15 +348,15 @@ |
349 | 349 | $( this ).css( $.wikiEditor.modules.toc.cfg.flexProperty, 0 ); |
350 | 350 | } ) |
351 | 351 | .children() |
352 | | - .animate( leftChildParam, 'fast', function() { |
353 | | - $( this ).css( $.wikiEditor.modules.toc.cfg.flexProperty, 0 ); |
| 352 | + .animate( leftChildParam, 'fast', function() { |
| 353 | + $( this ).css( $.wikiEditor.modules.toc.cfg.flexProperty, 0 ); |
354 | 354 | } ); |
355 | 355 | context.$ui.find( '.wikiEditor-ui-right' ) |
356 | | - .css( { |
357 | | - 'marginTop' : '1px', |
358 | | - 'position' : 'absolute', |
359 | | - 'left' : $.wikiEditor.modules.toc.cfg.rtl ? 0 : 'auto', |
360 | | - 'right' : $.wikiEditor.modules.toc.cfg.rtl ? 'auto' : 0, |
| 356 | + .css( { |
| 357 | + 'marginTop' : '1px', |
| 358 | + 'position' : 'absolute', |
| 359 | + 'left' : $.wikiEditor.modules.toc.cfg.rtl ? 0 : 'auto', |
| 360 | + 'right' : $.wikiEditor.modules.toc.cfg.rtl ? 'auto' : 0, |
361 | 361 | 'top' : pT } ) |
362 | 362 | .fadeOut( 'fast', function() { |
363 | 363 | $( this ).hide() |
— | — | @@ -366,11 +366,11 @@ |
367 | 367 | context.fn.trigger( 'tocCollapse' ); |
368 | 368 | context.fn.trigger( 'resize' ); |
369 | 369 | } ); |
370 | | - |
| 370 | + |
371 | 371 | $.cookie( 'wikiEditor-' + context.instance + '-toc-width', 0 ); |
372 | 372 | return false; |
373 | 373 | }, |
374 | | - |
| 374 | + |
375 | 375 | /** |
376 | 376 | * Expand the contents module |
377 | 377 | * |
— | — | @@ -472,7 +472,7 @@ |
473 | 473 | $( this ).addClass( 'current' ); |
474 | 474 | //$( this ).removeClass( 'current' ); |
475 | 475 | setTimeout( function() { $.wikiEditor.modules.toc.fn.unhighlight( context ) }, 1000 ); |
476 | | - |
| 476 | + |
477 | 477 | if ( typeof $.trackAction != 'undefined' ) |
478 | 478 | $.trackAction( 'ntoc.heading' ); |
479 | 479 | event.preventDefault(); |
— | — | @@ -541,7 +541,7 @@ |
542 | 542 | .data( 'resizableDone', true ) |
543 | 543 | .find( '.wikiEditor-ui-right' ) |
544 | 544 | .data( 'wikiEditor-ui-left', context.$ui.find( '.wikiEditor-ui-left' ) ) |
545 | | - .resizable( { handles: 'w,e', preventPositionLeftChange: true, |
| 545 | + .resizable( { handles: 'w,e', preventPositionLeftChange: true, |
546 | 546 | minWidth: parseFloat( $.wikiEditor.modules.toc.cfg.minimumWidth ), |
547 | 547 | start: function( e, ui ) { |
548 | 548 | var $this = $( this ); |
— | — | @@ -557,7 +557,7 @@ |
558 | 558 | 'right': 0 |
559 | 559 | } ) |
560 | 560 | .appendTo( context.$ui.find( '.wikiEditor-ui-left' ) ); |
561 | | - $this.resizable( 'option', 'maxWidth', $this.parent().width() - |
| 561 | + $this.resizable( 'option', 'maxWidth', $this.parent().width() - |
562 | 562 | parseFloat( $.wikiEditor.modules.toc.cfg.textMinimumWidth ) ); |
563 | 563 | if(context.modules.toc.$toc.data( 'positionMode' ) == 'goofy' ) { |
564 | 564 | $.wikiEditor.modules.toc.fn.switchLayout( context ); |
— | — | @@ -611,7 +611,7 @@ |
612 | 612 | $.wikiEditor.modules.toc.fn.redraw( context, initialWidth ); |
613 | 613 | } |
614 | 614 | } |
615 | | - |
| 615 | + |
616 | 616 | // Normalize heading levels for list creation |
617 | 617 | // This is based on Linker::generateTOC(), so it should behave like the |
618 | 618 | // TOC on rendered articles does - which is considdered to be correct |
— | — | @@ -640,7 +640,7 @@ |
641 | 641 | structure.unshift( { 'text': mw.config.get( 'wgPageName' ).replace( /_/g, ' ' ), 'level': 1, 'index': 0 } ); |
642 | 642 | } |
643 | 643 | context.modules.toc.$toc.html( buildList( structure ) ); |
644 | | - |
| 644 | + |
645 | 645 | if ( !context.$ui.data( 'resizableDone' ) ) { |
646 | 646 | buildResizeControls(); |
647 | 647 | buildCollapseControls(); |
Index: trunk/extensions/WikiEditor/modules/jquery.wikiEditor.dialogs.config.js |
— | — | @@ -72,7 +72,7 @@ |
73 | 73 | } |
74 | 74 | } ); |
75 | 75 | }, |
76 | | - |
| 76 | + |
77 | 77 | getDefaultConfig: function () { |
78 | 78 | return { 'dialogs': { |
79 | 79 | 'insert-link': { |
— | — | @@ -129,7 +129,7 @@ |
130 | 130 | $( '.ui-dialog:visible .ui-dialog-buttonpane button:first' ) |
131 | 131 | .attr( 'disabled', true ) |
132 | 132 | .addClass( 'disabled' ); |
133 | | - } else { |
| 133 | + } else { |
134 | 134 | $( '.ui-dialog:visible .ui-dialog-buttonpane button:first' ) |
135 | 135 | .removeAttr('disabled') |
136 | 136 | .removeClass('disabled'); |
— | — | @@ -138,7 +138,7 @@ |
139 | 139 | // Updates the UI to show if the page title being inputed by the user exists or not |
140 | 140 | // accepts parameter internal for bypassing external link detection |
141 | 141 | function updateExistence( internal ) { |
142 | | - // ensure the internal parameter is a boolean |
| 142 | + // ensure the internal parameter is a boolean |
143 | 143 | if ( internal != true ) internal = false; |
144 | 144 | // Abort previous request |
145 | 145 | var request = $( '#wikieditor-toolbar-link-int-target-status' ).data( 'request' ); |
— | — | @@ -259,7 +259,7 @@ |
260 | 260 | .data( 'tooltip-mode', true ); |
261 | 261 | } |
262 | 262 | }); |
263 | | - |
| 263 | + |
264 | 264 | // Automatically copy the value of the internal link page title field to the link text field unless the |
265 | 265 | // user has changed the link text field - this is a convenience thing since most link texts are going to |
266 | 266 | // be the the same as the page title - Also change the internal/external radio button accordingly |
— | — | @@ -275,7 +275,7 @@ |
276 | 276 | updateExistence(); |
277 | 277 | } |
278 | 278 | if ( $( '#wikieditor-toolbar-link-int-text' ).data( 'untouched' ) ) |
279 | | - if ( $( '#wikieditor-toolbar-link-int-target' ).val() == |
| 279 | + if ( $( '#wikieditor-toolbar-link-int-target' ).val() == |
280 | 280 | $( '#wikieditor-toolbar-link-int-target' ).data( 'tooltip' ) ) { |
281 | 281 | $( '#wikieditor-toolbar-link-int-text' ) |
282 | 282 | .addClass( 'wikieditor-toolbar-dialog-hint' ) |
— | — | @@ -330,7 +330,7 @@ |
331 | 331 | ) |
332 | 332 | .data( 'existencecache', {} ) |
333 | 333 | .children().hide(); |
334 | | - |
| 334 | + |
335 | 335 | $( '#wikieditor-toolbar-link-int-target' ) |
336 | 336 | .bind( 'keyup paste cut', function() { |
337 | 337 | // Cancel the running timer if applicable |
— | — | @@ -350,24 +350,24 @@ |
351 | 351 | // Fetch right now |
352 | 352 | updateExistence(); |
353 | 353 | } ); |
354 | | - |
| 354 | + |
355 | 355 | // Title suggestions |
356 | 356 | $( '#wikieditor-toolbar-link-int-target' ).data( 'suggcache', {} ).suggestions( { |
357 | 357 | fetch: function( query ) { |
358 | 358 | var that = this; |
359 | 359 | var title = $(this).val(); |
360 | | - |
| 360 | + |
361 | 361 | if ( isExternalLink( title ) || title.indexOf( '|' ) != -1 || title == '') { |
362 | 362 | $(this).suggestions( 'suggestions', [] ); |
363 | 363 | return; |
364 | 364 | } |
365 | | - |
| 365 | + |
366 | 366 | var cache = $(this).data( 'suggcache' ); |
367 | 367 | if ( typeof cache[title] != 'undefined' ) { |
368 | 368 | $(this).suggestions( 'suggestions', cache[title] ); |
369 | 369 | return; |
370 | 370 | } |
371 | | - |
| 371 | + |
372 | 372 | var request = $.ajax( { |
373 | 373 | url: mw.util.wikiScript( 'api' ), |
374 | 374 | data: { |
— | — | @@ -435,7 +435,7 @@ |
436 | 436 | alert( mediaWiki.msg( 'wikieditor-toolbar-tool-link-int-invalid' ) ); |
437 | 437 | return; |
438 | 438 | } |
439 | | - |
| 439 | + |
440 | 440 | if ( target == text || !text.length ) |
441 | 441 | insertText = '[[' + target + ']]'; |
442 | 442 | else |
— | — | @@ -444,7 +444,7 @@ |
445 | 445 | // Prepend http:// if there is no protocol |
446 | 446 | if ( !target.match( /^[a-z]+:\/\/./ ) ) |
447 | 447 | target = 'http://' + target; |
448 | | - |
| 448 | + |
449 | 449 | // Detect if this is really an internal link in disguise |
450 | 450 | var match = target.match( $(this).data( 'articlePathRegex' ) ); |
451 | 451 | if ( match && !$(this).data( 'ignoreLooksInternal' ) ) { |
— | — | @@ -468,10 +468,10 @@ |
469 | 469 | ); |
470 | 470 | return; |
471 | 471 | } |
472 | | - |
| 472 | + |
473 | 473 | var escTarget = escapeExternalTarget( target ); |
474 | 474 | var escText = escapeExternalText( text ); |
475 | | - |
| 475 | + |
476 | 476 | if ( escTarget == escText ) |
477 | 477 | insertText = escTarget; |
478 | 478 | else if ( text == '' ) |
— | — | @@ -488,7 +488,7 @@ |
489 | 489 | pre: insertText |
490 | 490 | } |
491 | 491 | }, $(this) ); |
492 | | - |
| 492 | + |
493 | 493 | // Blank form |
494 | 494 | $( '#wikieditor-toolbar-link-int-target, #wikieditor-toolbar-link-int-text' ).val( '' ); |
495 | 495 | $( '#wikieditor-toolbar-link-type-int, #wikieditor-toolbar-link-type-ext' ) |
— | — | @@ -512,7 +512,7 @@ |
513 | 513 | // Restore and immediately save selection state, needed for inserting stuff later |
514 | 514 | context.fn.restoreCursorAndScrollTop(); |
515 | 515 | context.fn.saveCursorAndScrollTop(); |
516 | | - var selection = context.$textarea.textSelection( 'getSelection' ); |
| 516 | + var selection = context.$textarea.textSelection( 'getSelection' ); |
517 | 517 | $( '#wikieditor-toolbar-link-int-target' ).focus(); |
518 | 518 | // Trigger the change event, so the link status indicator is up to date |
519 | 519 | $( '#wikieditor-toolbar-link-int-target' ).change(); |
— | — | @@ -547,7 +547,7 @@ |
548 | 548 | ); |
549 | 549 | } |
550 | 550 | } |
551 | | - |
| 551 | + |
552 | 552 | // Change the value by calling val() doesn't trigger the change event, so let's do that |
553 | 553 | // ourselves |
554 | 554 | if ( typeof text != 'undefined' ) |
— | — | @@ -563,18 +563,18 @@ |
564 | 564 | $( '#wikieditor-toolbar-link-int-text' ).hasClass( 'wikieditor-toolbar-dialog-hint' ) |
565 | 565 | ); |
566 | 566 | $( '#wikieditor-toolbar-link-int-target' ).suggestions(); |
567 | | - |
| 567 | + |
568 | 568 | //don't overwrite user's text |
569 | 569 | if( selection != '' ){ |
570 | 570 | $( '#wikieditor-toolbar-link-int-text' ).data( 'untouched', false ); |
571 | 571 | } |
572 | | - |
| 572 | + |
573 | 573 | $( '#wikieditor-toolbar-link-int-text, #wikiedit-toolbar-link-int-target' ) |
574 | 574 | .each( function() { |
575 | 575 | if ( $(this).val() == '' ) |
576 | 576 | $(this).parent().find( 'label' ).show(); |
577 | 577 | }); |
578 | | - |
| 578 | + |
579 | 579 | if ( !( $(this).data( 'dialogkeypressset' ) ) ) { |
580 | 580 | $(this).data( 'dialogkeypressset', true ); |
581 | 581 | // Execute the action associated with the first button |
— | — | @@ -586,7 +586,7 @@ |
587 | 587 | e.preventDefault(); |
588 | 588 | } |
589 | 589 | }); |
590 | | - |
| 590 | + |
591 | 591 | // Make tabbing to a button and pressing |
592 | 592 | // Enter do what people expect |
593 | 593 | $(this).closest( '.ui-dialog' ).find( 'button' ).focus( function() { |
— | — | @@ -614,7 +614,7 @@ |
615 | 615 | $( this ).find( '[rel]' ).each( function() { |
616 | 616 | $( this ).text( mediaWiki.msg( $( this ).attr( 'rel' ) ) ); |
617 | 617 | } ); |
618 | | - |
| 618 | + |
619 | 619 | }, |
620 | 620 | dialog: { |
621 | 621 | dialogClass: 'wikiEditor-toolbar-dialog', |
— | — | @@ -654,7 +654,7 @@ |
655 | 655 | // Restore and immediately save selection state, needed for inserting stuff later |
656 | 656 | context.fn.restoreCursorAndScrollTop(); |
657 | 657 | context.fn.saveCursorAndScrollTop(); |
658 | | - var selection = context.$textarea.textSelection( 'getSelection' ); |
| 658 | + var selection = context.$textarea.textSelection( 'getSelection' ); |
659 | 659 | // set focus |
660 | 660 | $( '#wikieditor-toolbar-reference-text' ).focus(); |
661 | 661 | $( '#wikieditor-toolbar-reference-dialog' ) |
— | — | @@ -764,13 +764,13 @@ |
765 | 765 | }); |
766 | 766 | // Set tabindexes on form fields |
767 | 767 | $.wikiEditor.modules.dialogs.fn.setTabindexes( $(this).find( 'input' ).not( '[tabindex]' ) ); |
768 | | - |
| 768 | + |
769 | 769 | $( '#wikieditor-toolbar-table-dimensions-rows' ).val( 3 ); |
770 | 770 | $( '#wikieditor-toolbar-table-dimensions-columns' ).val( 3 ); |
771 | 771 | $( '#wikieditor-toolbar-table-wikitable' ).click( function() { |
772 | 772 | $( '.wikieditor-toolbar-table-preview' ).toggleClass( 'wikitable' ); |
773 | 773 | }); |
774 | | - |
| 774 | + |
775 | 775 | // Hack for sortable preview: dynamically adding |
776 | 776 | // sortable class doesn't work, so we use a clone |
777 | 777 | $( '#wikieditor-toolbar-table-preview' ) |
— | — | @@ -791,7 +791,7 @@ |
792 | 792 | .show(); |
793 | 793 | $( '#wikieditor-toolbar-table-preview3' ).attr( 'id', 'wikieditor-toolbar-table-preview2' ); |
794 | 794 | }); |
795 | | - |
| 795 | + |
796 | 796 | $( '#wikieditor-toolbar-table-dimensions-header' ).click( function() { |
797 | 797 | // Instead of show/hiding, switch the HTML around |
798 | 798 | // We do this because the sortable tables script styles the first row, |
— | — | @@ -867,7 +867,7 @@ |
868 | 868 | }, |
869 | 869 | $(this) |
870 | 870 | ); |
871 | | - |
| 871 | + |
872 | 872 | // Restore form state |
873 | 873 | $( '#wikieditor-toolbar-table-dimensions-rows' ).val( 3 ); |
874 | 874 | $( '#wikieditor-toolbar-table-dimensions-columns' ).val( 3 ); |
— | — | @@ -897,7 +897,7 @@ |
898 | 898 | e.preventDefault(); |
899 | 899 | } |
900 | 900 | }); |
901 | | - |
| 901 | + |
902 | 902 | // Make tabbing to a button and pressing |
903 | 903 | // Enter do what people expect |
904 | 904 | $(this).closest( '.ui-dialog' ).find( 'button' ).focus( function() { |
— | — | @@ -959,7 +959,7 @@ |
960 | 960 | }); |
961 | 961 | // Set tabindexes on form fields |
962 | 962 | $.wikiEditor.modules.dialogs.fn.setTabindexes( $(this).find( 'input' ).not( '[tabindex]' ) ); |
963 | | - |
| 963 | + |
964 | 964 | // TODO: Find a cleaner way to share this function |
965 | 965 | $(this).data( 'replaceCallback', function( mode ) { |
966 | 966 | $( '#wikieditor-toolbar-replace-nomatch, #wikieditor-toolbar-replace-success, #wikieditor-toolbar-replace-emptysearch, #wikieditor-toolbar-replace-invalidregex' ).hide(); |
— | — | @@ -1018,7 +1018,7 @@ |
1019 | 1019 | textRemainder = text; |
1020 | 1020 | match = textRemainder.match( regex ); |
1021 | 1021 | } |
1022 | | - |
| 1022 | + |
1023 | 1023 | if ( !match ) { |
1024 | 1024 | $( '#wikieditor-toolbar-replace-nomatch' ).show(); |
1025 | 1025 | } else if ( mode == 'replaceAll' ) { |
— | — | @@ -1037,7 +1037,7 @@ |
1038 | 1038 | } |
1039 | 1039 | var matchedText = textRemainder.substr( index, match[i].length ); |
1040 | 1040 | textRemainder = textRemainder.substr( index + match[i].length ); |
1041 | | - |
| 1041 | + |
1042 | 1042 | var start = index + offset; |
1043 | 1043 | var end = start + match[i].length; |
1044 | 1044 | // Make regex placeholder substitution ($1) work |
— | — | @@ -1057,7 +1057,7 @@ |
1058 | 1058 | $(this).data( 'offset', 0 ); |
1059 | 1059 | } else { |
1060 | 1060 | var start, end; |
1061 | | - |
| 1061 | + |
1062 | 1062 | if ( mode == 'replace' ) { |
1063 | 1063 | var actualReplacement; |
1064 | 1064 | |
— | — | @@ -1142,7 +1142,7 @@ |
1143 | 1143 | open: function() { |
1144 | 1144 | $(this).data( 'offset', 0 ); |
1145 | 1145 | $(this).data( 'matchIndex', 0 ); |
1146 | | - |
| 1146 | + |
1147 | 1147 | $( '#wikieditor-toolbar-replace-search' ).focus(); |
1148 | 1148 | $( '#wikieditor-toolbar-replace-nomatch, #wikieditor-toolbar-replace-success, #wikieditor-toolbar-replace-emptysearch, #wikieditor-toolbar-replace-invalidregex' ).hide(); |
1149 | 1149 | if ( !( $(this).data( 'onetimeonlystuff' ) ) ) { |
— | — | @@ -1167,7 +1167,7 @@ |
1168 | 1168 | var context = $(this).data( 'context' ); |
1169 | 1169 | var textbox = typeof context.$iframe != 'undefined' ? |
1170 | 1170 | context.$iframe[0].contentWindow.document : context.$textarea; |
1171 | | - |
| 1171 | + |
1172 | 1172 | $( textbox ) |
1173 | 1173 | .bind( 'keypress.srdialog', function( e ) { |
1174 | 1174 | if ( ( e.keyCode || e.which ) == 13 ) { |
Index: trunk/extensions/WikiEditor/modules/jquery.wikiEditor.previewDialog.js |
— | — | @@ -81,7 +81,7 @@ |
82 | 82 | if ( context.modules.preview.previewText == wikitext ) { |
83 | 83 | return; |
84 | 84 | } |
85 | | - |
| 85 | + |
86 | 86 | $dialog.find( '.wikiEditor-preview-dialog-contents' ).empty(); |
87 | 87 | $dialog.find( '.wikiEditor-ui-loading' ).show(); |
88 | 88 | $.post( |
Index: trunk/extensions/WikiEditor/modules/jquery.wikiEditor.highlight.js |
— | — | @@ -33,7 +33,7 @@ |
34 | 34 | 'fn': { |
35 | 35 | /** |
36 | 36 | * Creates a highlight module within a wikiEditor |
37 | | - * |
| 37 | + * |
38 | 38 | * @param config Configuration object to create module from |
39 | 39 | */ |
40 | 40 | 'create': function( context, config ) { |
— | — | @@ -41,7 +41,7 @@ |
42 | 42 | }, |
43 | 43 | /** |
44 | 44 | * Scans text division for tokens |
45 | | - * |
| 45 | + * |
46 | 46 | * @param division |
47 | 47 | */ |
48 | 48 | 'scan': function( context, division ) { |
— | — | @@ -82,7 +82,7 @@ |
83 | 83 | }, |
84 | 84 | /** |
85 | 85 | * Marks up text with HTML |
86 | | - * |
| 86 | + * |
87 | 87 | * @param division |
88 | 88 | * @param tokens |
89 | 89 | */ |
— | — | @@ -91,7 +91,7 @@ |
92 | 92 | 'mark': function( context, division, tokens ) { |
93 | 93 | // Reset markers |
94 | 94 | var markers = []; |
95 | | - |
| 95 | + |
96 | 96 | // Recycle markers that will be skipped in this run |
97 | 97 | if ( context.modules.highlight.markers && division != '' ) { |
98 | 98 | for ( var i = 0; i < context.modules.highlight.markers.length; i++ ) { |
— | — | @@ -101,11 +101,11 @@ |
102 | 102 | } |
103 | 103 | } |
104 | 104 | context.modules.highlight.markers = markers; |
105 | | - |
| 105 | + |
106 | 106 | // Get all markers |
107 | 107 | context.fn.trigger( 'mark' ); |
108 | 108 | markers.sort( function( a, b ) { return a.start - b.start || a.end - b.end; } ); |
109 | | - |
| 109 | + |
110 | 110 | // Serialize the markers array to a string and compare it with the one stored in the previous run - if they're |
111 | 111 | // equal, there's no markers to change |
112 | 112 | var markersStr = ''; |
— | — | @@ -117,15 +117,15 @@ |
118 | 118 | return; |
119 | 119 | } |
120 | 120 | context.modules.highlight.markersStr = markersStr; |
121 | | - |
| 121 | + |
122 | 122 | // Traverse the iframe DOM, inserting markers where they're needed - store visited markers here so we know which |
123 | 123 | // markers should be removed |
124 | 124 | var visited = [], v = 0; |
125 | 125 | for ( var i = 0; i < markers.length; i++ ) { |
126 | | - if ( typeof markers[i].skipDivision !== 'undefined' && ( division == markers[i].skipDivision ) ) { |
| 126 | + if ( typeof markers[i].skipDivision !== 'undefined' && ( division == markers[i].skipDivision ) ) { |
127 | 127 | continue; |
128 | 128 | } |
129 | | - |
| 129 | + |
130 | 130 | // We want to isolate each marker, so we may need to split textNodes if a marker starts or ends halfway one. |
131 | 131 | var start = markers[i].start; |
132 | 132 | var s = context.fn.getOffset( start ); |
— | — | @@ -134,7 +134,7 @@ |
135 | 135 | continue; |
136 | 136 | } |
137 | 137 | var startNode = s.node; |
138 | | - |
| 138 | + |
139 | 139 | // Don't wrap leading BRs, produces undesirable results |
140 | 140 | // FIXME: It's also possible that the offset is a bit high because getOffset() has incremented .length to |
141 | 141 | // fake the newline caused by startNode being in a P. In this case, prevent the textnode splitting below |
— | — | @@ -144,7 +144,7 @@ |
145 | 145 | s = context.fn.getOffset( start ); |
146 | 146 | startNode = s.node; |
147 | 147 | } |
148 | | - |
| 148 | + |
149 | 149 | // The next marker starts somewhere in this textNode or at this BR |
150 | 150 | if ( s.offset > 0 && s.node.nodeName == '#text' ) { |
151 | 151 | // Split off the prefix - this leaves the prefix in the current node and puts the rest in a new node |
— | — | @@ -349,7 +349,7 @@ |
350 | 350 | } |
351 | 351 | context.fn.purgeOffsets(); |
352 | 352 | }); |
353 | | - |
| 353 | + |
354 | 354 | } |
355 | 355 | } |
356 | 356 | |
Index: trunk/extensions/WikiEditor/WikiEditor.i18n.php |
— | — | @@ -359,7 +359,7 @@ |
360 | 360 | 'wikieditor-toolbar-tool-nowiki' => '工具栏注释', |
361 | 361 | 'wikieditor-toolbar-tool-redirect' => "Tooltip for icon to place wiki text for a redirect in the edit box. The label before these icons says 'Insert'. 'Redirect' is a noun here. |
362 | 362 | {{Identical|Redirect}}", |
363 | | - 'wikieditor-toolbar-tool-redirect-example' => "Target is an adjective describing the page name. You could use 'destination' instead of 'target'. 'Target page name' is the destination of the redirect and appears when the wikitext for a redirect is inserted in the text box thus |
| 363 | + 'wikieditor-toolbar-tool-redirect-example' => "Target is an adjective describing the page name. You could use 'destination' instead of 'target'. 'Target page name' is the destination of the redirect and appears when the wikitext for a redirect is inserted in the text box thus |
364 | 364 | <nowiki>#REDIRECT [[target page name]]</nowiki>", |
365 | 365 | 'wikieditor-toolbar-tool-small' => '{{Identical|Small}}', |
366 | 366 | 'wikieditor-toolbar-group-insert' => '{{Identical|Insert}}', |