33 *
44 * Copyright 2008-2011 Georgia Tech Research Corporation, Atlanta, GA 30332-0415, ALL RIGHTS RESERVED
55 * Copyright 2011- Matthew Flaschen
6- * Rewritten and internationalized by Luis Felipe Schenone in 2014
6+ * Rewritten and internationalized by Felipe Schenone in 2014
77 *
88 * ProveIt is available under the GNU Free Documentation License (http://www.gnu.org/copyleft/fdl.html),
99 * the Creative Commons Attribution/Share-Alike License 3.0 (http://creativecommons.org/licenses/by-sa/3.0/),
1414
1515var proveit = {
1616
17+ /**
18+ * URL of the ProveIt logo hosted at Commons
19+ */
20+ LOGO : '//upload.wikimedia.org/wikipedia/commons/0/0d/ProveIt_user_interface_logo.png' ,
21+
22+ /**
23+ * URL of the ProveIt icon hosted at Commons
24+ */
25+ ICON : '//upload.wikimedia.org/wikipedia/commons/thumb/1/19/ProveIt_logo_for_user_boxes.svg/22px-ProveIt_logo_for_user_boxes.svg.png' ,
26+
1727 /**
1828 * Interface messages
1929 */
@@ -59,19 +69,12 @@ var proveit = {
5969 */
6070 templates : { } ,
6171
62- /**
63- * URLs of the logo and icon hosted at Commons
64- */
65- LOGO : '//upload.wikimedia.org/wikipedia/commons/0/0d/ProveIt_user_interface_logo.png' ,
66-
67- ICON : '//upload.wikimedia.org/wikipedia/commons/thumb/1/19/ProveIt_logo_for_user_boxes.svg/22px-ProveIt_logo_for_user_boxes.svg.png' ,
68-
6972 /**
7073 * Content language
7174 *
7275 * @type string
7376 */
74- contentLanguage : null ,
77+ contentLanguage : '' ,
7578
7679 /**
7780 * Interface language
@@ -124,7 +127,7 @@ var proveit = {
124127
125128 // Set the content language
126129 proveit . contentLanguage = mw . config . get ( 'wgContentLanguage' ) ;
127- if ( ! ( proveit . contentLanguage in proveit . settings ) ) {
130+ if ( ! ( proveit . contentLanguage in proveit . settings ) ) {
128131 return ; // Language not supported
129132 }
130133
@@ -177,9 +180,9 @@ var proveit = {
177180
178181 proveit . makeGUI ( ) ;
179182
180- // Only initialize visible for mainspace, user, and Draft pages
181- var namespace = mw . config . get ( 'wgCanonicalNamespace ' ) ;
182- if ( namespace !== '' && namespace !== 'User' && namespace !== 'Draft' ) {
183+ // Only initialize visible for mainspace and user namespaces
184+ var namespace = mw . config . get ( 'wgNamespaceNumber ' ) ;
185+ if ( namespace !== 0 && namespace !== 2 ) {
183186 $ ( '#proveit' ) . hide ( ) ;
184187 }
185188 } ) ;
@@ -393,7 +396,7 @@ var proveit = {
393396 */
394397 addTag : function ( ) {
395398 if ( $ ( '#wpChangeTags' ) . length > 0 ) {
396- return ;
399+ return ; // Don't add it twice
397400 }
398401 var tagInput = $ ( '<input>' ) . attr ( {
399402 'id' : 'wpChangeTags' ,
@@ -441,8 +444,8 @@ var proveit = {
441444 * @return {void }
442445 */
443446 this . highlight = function ( ) {
444- var textbox = proveit . getTextbox ( ) [ 0 ] ;
445- var text = textbox . value ;
447+ var textbox = proveit . getTextbox ( ) [ 0 ] ,
448+ text = textbox . value ;
446449
447450 // Scroll to the string
448451 textbox . value = text . substring ( 0 , this . index ) ;
@@ -455,8 +458,8 @@ var proveit = {
455458 }
456459
457460 // Highlight the string
458- var start = this . index ;
459- var end = this . index + this . string . length ;
461+ var start = this . index ,
462+ end = this . index + this . string . length ;
460463 $ ( textbox ) . focus ( ) . textSelection ( 'setSelection' , { 'start' : start , 'end' : end } ) ;
461464 } ;
462465 } ,
0 commit comments