Also built-in support for distribution through a TestSwarm instance.
* (bug 29036) For cascade-protected pages, the mw-textarea-cprotected class is
added to the textarea on the edit form.
+* mw.util.getScript has been implemented (like wfScript in GlobalFunctions.php)
+
=== Bug fixes in 1.19 ===
* (bug 10154) Don't allow user to specify days beyond $wgRCMaxAge.
also in RTL text.
* (bug 29055) Make don't send email on minor edits preference apply to
changes to talk page in addition to watchlist edits.
+* (bug 29071) mediawiki.action.watch.ajax.js should pass uselang to API.
=== API changes in 1.19 ===
* (bug 27790) add query type for querymodules to action=paraminfo
}
setLinkText( $link, $link.data( 'action' ) + 'ing' );
-
+
var reqData = {
'action': 'watch',
'format': 'json',
- 'title': $link.data( 'target' )
+ 'title': $link.data( 'target' ),
+ // API return contains a localized data.watch.message string.
+ 'uselang': mw.config.get( 'wgUserLanguage' )
};
if ( $link.data( 'action' ) == 'unwatch' ) {
- reqData['unwatch'] = '';
+ reqData.unwatch = '';
}
- $.getJSON( mw.config.get( 'wgScriptPath' )
- + '/api' + mw.config.get( 'wgScriptExtension' ),
+ $.getJSON( mw.util.wikiScript( 'api' ),
reqData,
function( data, textStatus, xhr ) {
processResult( data, $link );
.replace( /%20/g, '_' ).replace( /%3A/g, ':' ).replace( /%2F/g, '/' );
},
+ /**
+ * Get the link to a page name (relative to wgServer)
+ *
+ * @param str Page name to get the link for.
+ * @return string Location for a page with name of 'str' or boolean false on error.
+ */
+ 'wikiGetlink' : function( str ) {
+
+ return mw.config.get( 'wgArticlePath' ).replace( '$1', this.wikiUrlencode( str ) );
+ },
+
+ /**
+ * Get address to a script in the wiki root.
+ * For index.php use mw.config.get( 'wgScript' )
+ *
+ * @param str Name of script (eg. 'api'), defaults to 'index'
+ * @return str Address to script (eg. '/w/api.php' )
+ */
+ 'wikiScript' : function( str ) {
+ return mw.config.get( 'wgScriptPath' ) + '/' + ( str || 'index' ) + mw.config.get( 'wgScriptExtension' );
+ },
+
/**
* Append a new style block to the head
*
}
},
- /**
- * Get the link to a page name (relative to wgServer)
- *
- * @param str Page name to get the link for.
- * @return string Location for a page with name of 'str' or boolean false on error.
- */
- 'wikiGetlink' : function( str ) {
-
- return mw.config.get( 'wgArticlePath' ).replace( '$1', this.wikiUrlencode( str ) );
- },
-
/**
* Grab the URL parameter value for the given parameter.
* Returns null if not found.
});
-test( 'addCSS', function(){
+test( 'wikiGetlink', function(){
- var a = mw.util.addCSS( '#bodyContent { visibility: hidden; }' );
- ok( a, 'function works' );
- deepEqual( a.disabled, false, 'property "disabled" is available and set to false' );
+ // Not part of startUp module
+ mw.config.set( 'wgArticlePath', '/wiki/$1' );
- var $b = $('#bodyContent');
- equal( $b.css('visibility'), 'hidden', 'Added style properties are in effect.' );
+ var hrefA = mw.util.wikiGetlink( 'Sandbox' );
+ equal( hrefA, '/wiki/Sandbox', 'Simple title; Get link for "Sandbox"' );
+
+ var hrefB = mw.util.wikiGetlink( 'Foo:Sandbox ? 5+5=10 ! (test)/subpage' );
+
+ equal( hrefB, '/wiki/Foo:Sandbox_%3F_5%2B5%3D10_%21_%28test%29/subpage', 'Advanced title; Get link for "Foo:Sandbox ? 5+5=10 ! (test)/subpage"' );
});
-test( 'toggleToc', function(){
+test( 'wikiScript', function(){
- ok( mw.util.toggleToc );
+ mw.config.set({
+ 'wgScript': '/w/index.php',
+ 'wgScriptPath': '/w',
+ 'wgScriptExtension': '.php',
+ });
+
+ equal( mw.util.wikiScript(), mw.config.get( 'wgScript' ), 'Defaults to index.php and is equal to wgScript.' );
});
-test( 'wikiGetlink', function(){
+test( 'addCSS', function(){
- // Not part of startUp module
- mw.config.set( 'wgArticlePath', '/wiki/$1' );
+ var a = mw.util.addCSS( '#bodyContent { visibility: hidden; }' );
+ ok( a, 'function works' );
+ deepEqual( a.disabled, false, 'property "disabled" is available and set to false' );
- var hrefA = mw.util.wikiGetlink( 'Sandbox' );
+ var $b = $('#bodyContent');
+ equal( $b.css('visibility'), 'hidden', 'Added style properties are in effect.' );
- equal( hrefA, '/wiki/Sandbox', 'Simple title; Get link for "Sandbox"' );
- var hrefB = mw.util.wikiGetlink( 'Foo:Sandbox ? 5+5=10 ! (test)/subpage' );
+});
- equal( hrefB, '/wiki/Foo:Sandbox_%3F_5%2B5%3D10_%21_%28test%29/subpage', 'Advanced title; Get link for "Foo:Sandbox ? 5+5=10 ! (test)/subpage"' );
+test( 'toggleToc', function(){
+
+ ok( mw.util.toggleToc );
});