http://www.mediawiki.org/wiki/Special:Code/MediaWiki/96105
Revision: 96105
Author: nikerabbit
Date: 2011-09-02 15:35:55 +0000 (Fri, 02 Sep 2011)
Log Message:
-----------
Renamed js to resources, because it also contains css
Modified Paths:
--------------
trunk/extensions/Translate/Translate.php
Added Paths:
-----------
trunk/extensions/Translate/resources/
trunk/extensions/Translate/resources/ext.translate.css
trunk/extensions/Translate/resources/ext.translate.quickedit.js
Removed Paths:
-------------
trunk/extensions/Translate/js/
trunk/extensions/Translate/resources/quickedit.js
Modified: trunk/extensions/Translate/Translate.php
===================================================================
--- trunk/extensions/Translate/Translate.php 2011-09-02 15:34:55 UTC (rev
96104)
+++ trunk/extensions/Translate/Translate.php 2011-09-02 15:35:55 UTC (rev
96105)
@@ -131,18 +131,18 @@
// Client-side resource modules
$wgResourceModules['ext.translate'] = array(
- 'styles' => 'js/ext.translate.css',
+ 'styles' => 'resources/ext.translate.css',
) + $resourcePaths;
$wgResourceModules['ext.translate.special.languagestats'] = array(
- 'scripts' => 'js/ext.translate.special.languagestats.js',
- 'styles' => 'js/ext.translate.special.languagestats.css',
+ 'scripts' => 'resources/ext.translate.special.languagestats.js',
+ 'styles' => 'resources/ext.translate.special.languagestats.css',
'messages' => array( 'translate-langstats-expandall',
'translate-langstats-collapseall', 'translate-langstats-expand',
'translate-langstats-collapse' ),
) + $resourcePaths;
$wgResourceModules['ext.translate.quickedit'] = array(
- 'scripts' => 'js/ext.translate.quickedit.js',
- 'styles' => 'js/ext.translate.quickedit.css',
+ 'scripts' => 'resources/ext.translate.quickedit.js',
+ 'styles' => 'resources/ext.translate.quickedit.css',
'messages' => array( 'translate-js-nonext', 'translate-js-save-failed'
),
'dependencies' => array(
'jquery.form',
@@ -152,26 +152,26 @@
) + $resourcePaths;
$wgResourceModules['ext.translate.messagetable'] = array(
- 'styles' => 'js/ext.translate.messagetable.css',
+ 'styles' => 'resources/ext.translate.messagetable.css',
'position' => 'top',
) + $resourcePaths;
$wgResourceModules['ext.translate.special.translate'] = array(
- 'styles' => 'js/ext.translate.special.translate.css',
+ 'styles' => 'resources/ext.translate.special.translate.css',
) + $resourcePaths;
$wgResourceModules['ext.translate.special.supportedlanguages'] = array(
- 'styles' => 'js/ext.translate.special.supportedlanguages.css',
+ 'styles' => 'resources/ext.translate.special.supportedlanguages.css',
) + $resourcePaths;
$wgResourceModules['jquery.autoresize'] = array(
- 'scripts' => 'js/jquery.autoresize.js',
+ 'scripts' => 'resources/jquery.autoresize.js',
) + $resourcePaths;
// Doesn't exist in 1.17, but declaring twice causes an error
if ( version_compare( $wgVersion, '1.18', '<' ) ) {
$wgResourceModules['jquery.form'] = array(
- 'scripts' => 'js/jquery.form.js',
+ 'scripts' => 'resources/jquery.form.js',
) + $resourcePaths;
}
Copied: trunk/extensions/Translate/resources/ext.translate.css (from rev 96102,
trunk/extensions/Translate/js/ext.translate.css)
===================================================================
--- trunk/extensions/Translate/resources/ext.translate.css
(rev 0)
+++ trunk/extensions/Translate/resources/ext.translate.css 2011-09-02
15:35:55 UTC (rev 96105)
@@ -0,0 +1,62 @@
+.mw-translate-fuzzy {
+ background-color: #FDD;
+}
+
+.mw-translate-page-info {
+ font-size: x-small;
+ text-align: center;
+ direction: ltr;
+}
+
+.mw-translate-definition-preview {
+ font-family: monospace;
+ background-color: #F3F3FF;
+ border: 1px solid black;
+}
+
+.mw-pt-languages table {
+ direction: ltr;
+ border: 1px solid rgb(170, 170, 170);
+ background: rgb(246, 249, 237) none repeat scroll 0% 0%;
+ border-collapse: collapse;
+ line-height: 1.2;
+ width: 100%;
+}
+
+.mw-pt-languages-label {
+ border-right: 1px solid rgb(170, 170, 170);
+ padding: 0.5em;
+ background: rgb(238, 243, 226) none repeat scroll 0% 0%;
+ width: 200px;
+}
+
+.mw-pt-languages-list {
+ padding: 0.5em;
+}
+
+.mw-tpt-sp-legend {
+ font-weight: bold;
+}
+
+.mw-tpt-sp-content {
+ font-size: small;
+ padding-left: 2em;
+ padding-right: 2em;
+ padding-bottom: 2ex;
+}
+
+/* First Steps '*/
+#translate-fs-signup {
+ display: block;
+ margin: 1em;
+ font-weight: bold;
+ font-size: 200%;
+}
+
+#translate-fs-signup a {
+ border: 2px dotted gray;
+ border-radius: 10px;
+ -moz-border-radius: 10px;
+ -webkit-border-radius: 10px;
+ background-color: #D1E231 !important;
+}
\ No newline at end of file
Copied: trunk/extensions/Translate/resources/ext.translate.quickedit.js (from
rev 96102, trunk/extensions/Translate/js/ext.translate.quickedit.js)
===================================================================
--- trunk/extensions/Translate/resources/ext.translate.quickedit.js
(rev 0)
+++ trunk/extensions/Translate/resources/ext.translate.quickedit.js
2011-09-02 15:35:55 UTC (rev 96105)
@@ -0,0 +1,202 @@
+/**
+ * JavaScript that implements the Ajax translation interface, which was at the
+ * time of writing this probably the biggest usability problem in the
extension.
+ * Most importantly, it speeds up translating and keeps the list of
translatable
+ * messages open. It also allows multiple translation dialogs, for doing quick
+ * updates to other messages or documentation, or translating multiple
languages
+ * simultaneously together with the "In other languages" display included in
+ * translation helpers and implemented by utils/TranslationhHelpers.php.
+ * The form itself is implemented by utils/TranslationEditPage.php, which is
+ * called from Special:Translate/editpage?page=Namespace:pagename.
+ *
+ * TODO list:
+ * * On succesful save, update the MessageTable display too.
+ * * Autoload ui classes
+ * * Instead of hc'd onscript, give them a class and use necessary triggers
+ *
+ * @author Niklas Laxström
+ * @copyright Copyright © 2009-2011 Niklas Laxström
+ * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
2.0 or later
+ */
+
+(function($) {
+
+function MessageCheckUpdater( callback ) {
+
+ this.act = function() {
+ callback();
+ delete this.timeoutID;
+ };
+
+ this.setup = function() {
+ this.cancel();
+ var self = this;
+ this.timeoutID = window.setTimeout( self.act, 1000 );
+ };
+
+ this.cancel = function() {
+ if ( typeof this.timeoutID === 'number' ) {
+ window.clearTimeout( this.timeoutID );
+ delete this.timeoutID;
+ }
+ };
+}
+
+function trlVpWidth() {
+ return window.innerWidth || document.documentElement.clientWidth ||
document.body.clientWidth;
+}
+
+function addAccessKeys(dialog) {
+ $( '[accesskey=a], [accesskey=s], [accesskey=d], [accesskey=h]' ).each(
+ function( i ) {
+ $(this).removeAttr( 'accesskey' );
+ }
+ );
+ dialog.find( '.mw-translate-save' ).attr( 'accesskey', 'a' ).attr(
'title', '[' + tooltipAccessKeyPrefix + 'a]' );
+ dialog.find( '.mw-translate-next' ).attr( 'accesskey', 's' ).attr(
'title', '[' + tooltipAccessKeyPrefix + 's]' );
+ dialog.find( '.mw-translate-skip' ).attr( 'accesskey', 'd' ).attr(
'title', '[' + tooltipAccessKeyPrefix + 'd]' );
+ dialog.find( '.mw-translate-history' ).attr( 'accesskey', 'h' ).attr(
'title', '[' + tooltipAccessKeyPrefix + 'h]' );
+}
+
+var dialogwidth = false;
+
+window.trlOpenJsEdit = function( page, group ) {
+ var url = wgScript +
'?title=Special:Translate/editpage&suggestions=async&page=$1&loadgroup=$2';
+ url = url.replace( '$1', encodeURIComponent( page ) ).replace( '$2',
encodeURIComponent( group ) );
+ var id = 'jsedit' + page.replace( /[^a-zA-Z0-9_]/g, '_' );
+
+ var dialog = $( '#' + id );
+ if ( dialog.size() > 0 ) {
+ dialog.dialog( 'option', 'position', 'top' );
+ dialog.dialog( 'open' );
+ return false;
+ }
+
+ $( '<div/>' ).attr( 'id', id ).appendTo( $( 'body' ) );
+ dialog = $( '#' + id );
+
+ var spinner = $( '<div/>' ).attr( 'class', 'mw-ajax-loader' );
+ dialog.html( $( '<div/>' ).attr( 'class', 'mw-ajax-dialog' ).html(
spinner ) );
+
+ dialog.load(url, false, function() {
+ var form = $( '#' + id + ' form' );
+
+ form.hide().slideDown();
+
+ // Enable the collapsible element
+ var $identical = $( '.mw-identical-title' );
+ if ( $.isFunction( $identical.makeCollapsible ) ) {
+ $identical.makeCollapsible();
+ }
+
+ form.find( '.mw-translate-next' ).click( function() {
+ trlLoadNext( page );
+ } );
+
+ form.find( '.mw-translate-skip' ).click( function() {
+ trlLoadNext( page );
+ dialog.dialog( 'close' );
+ return false;
+ } );
+
+ form.find( '.mw-translate-history' ).click( function() {
+ window.open( wgServer + wgScript +
'?action=history&title=' + form.find( 'input[name=title]' ).val() );
+ return false;
+ } );
+
+ form.find( '.mw-translate-support' ).click( function() {
+ // Can use .data() only with 1.4.3 or newer
+ window.open( $(this).attr('data-load-url') );
+ return false;
+ } );
+
+ form.find( 'input#summary' ).focus( function() {
+ $(this).css('width', '85%');
+ });
+
+ var textarea = form.find( '.mw-translate-edit-area' );
+ textarea.css( 'display', 'block' );
+ textarea.autoResize({extraSpace: 15, limit: 200}).trigger(
'change' );
+ textarea.focus();
+
+ if ( form.find( '.mw-translate-messagechecks' ) ) {
+ var checker = new MessageCheckUpdater( function() {
+ var url = wgScript +
'?title=Special:Translate/editpage&suggestions=checks&page=$1&loadgroup=$2';
+ url = url.replace( '$1', encodeURIComponent(
page ) ).replace( '$2', encodeURIComponent( group ) );
+ $.post( url, { translation: textarea.val() },
function( mydata ) {
+ form.find(
'.mw-translate-messagechecks' ).replaceWith( mydata );
+ } );
+ } );
+
+ textarea.keyup( function() {
+ checker.setup();
+ } );
+ }
+
+ addAccessKeys( form );
+ var b = null;
+ b = form.find( '.mw-translate-save' );
+ b.val( b.val() + ' (a)' );
+ b = form.find( '.mw-translate-next' );
+ b.val( b.val() + ' (s)' );
+ b = form.find( '.mw-translate-skip' );
+ b.val( b.val() + ' (d)' );
+ b = form.find( '.mw-translate-history' );
+ b.val( b.val() + ' (h)' );
+
+ form.ajaxForm( {
+ dataType: 'json',
+ success: function(json) {
+ if ( json.error ) {
+ alert( json.error.info + ' (' +
json.error.code +')' );
+ } else if ( json.edit.result === 'Failure' ) {
+ alert( mw.msg(
'translate-js-save-failed' ) );
+ } else if ( json.edit.result === 'Success' ) {
+ dialog.dialog( 'close' );
+ } else {
+ alert( mw.msg(
'translate-js-save-failed' ) );
+ }
+ }
+ } );
+ } );
+
+ dialog.dialog( {
+ bgiframe: true,
+ width: dialogwidth ? dialogwidth : parseInt( trlVpWidth()*0.8,
10 ),
+ title: page,
+ position: 'top',
+ resize: function(event, ui) {
+ $( '#' + id + ' textarea' ).width( '100%' );
+ },
+ resizeStop: function(event, ui) {
+ dialogwidth = $( '#' + id ).width();
+ },
+ focus: function(event, ui) {
+ addAccessKeys( dialog );
+ },
+ close: function(event, ui) {
+ addAccessKeys( $([]) );
+ }
+ } );
+
+ return false;
+}
+
+function trlLoadNext( title ) {
+ var page = title.replace( /[^:]+:/, '' );
+ var namespace = title.replace( /:.*/, '' );
+ var found = false;
+ for ( var key in trlKeys ) {
+ if ( !trlKeys.hasOwnProperty(key) ) { continue; }
+ var value = trlKeys[key];
+ if (found) {
+ return trlOpenJsEdit( namespace + ':' + value );
+ } else if( page === value ) {
+ found = true;
+ }
+ }
+ alert( mw.msg( 'translate-js-nonext' ) );
+ return;
+}
+
+})(jQuery);
\ No newline at end of file
Deleted: trunk/extensions/Translate/resources/quickedit.js
===================================================================
--- trunk/extensions/Translate/js/quickedit.js 2011-09-02 15:08:57 UTC (rev
96100)
+++ trunk/extensions/Translate/resources/quickedit.js 2011-09-02 15:35:55 UTC
(rev 96105)
@@ -1,202 +0,0 @@
-/**
- * JavaScript that implements the Ajax translation interface, which was at the
- * time of writing this probably the biggest usability problem in the
extension.
- * Most importantly, it speeds up translating and keeps the list of
translatable
- * messages open. It also allows multiple translation dialogs, for doing quick
- * updates to other messages or documentation, or translating multiple
languages
- * simultaneously together with the "In other languages" display included in
- * translation helpers and implemented by utils/TranslationhHelpers.php.
- * The form itself is implemented by utils/TranslationEditPage.php, which is
- * called from Special:Translate/editpage?page=Namespace:pagename.
- *
- * TODO list:
- * * On succesful save, update the MessageTable display too.
- * * Autoload ui classes
- * * Instead of hc'd onscript, give them a class and use necessary triggers
- *
- * @author Niklas Laxström
- * @copyright Copyright © 2009-2011 Niklas Laxström
- * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
2.0 or later
- */
-
-(function($) {
-
-function MessageCheckUpdater( callback ) {
-
- this.act = function() {
- callback();
- delete this.timeoutID;
- };
-
- this.setup = function() {
- this.cancel();
- var self = this;
- this.timeoutID = window.setTimeout( self.act, 1000 );
- };
-
- this.cancel = function() {
- if ( typeof this.timeoutID === 'number' ) {
- window.clearTimeout( this.timeoutID );
- delete this.timeoutID;
- }
- };
-}
-
-function trlVpWidth() {
- return window.innerWidth || document.documentElement.clientWidth ||
document.body.clientWidth;
-}
-
-function addAccessKeys(dialog) {
- $( '[accesskey=a], [accesskey=s], [accesskey=d], [accesskey=h]' ).each(
- function( i ) {
- $(this).removeAttr( 'accesskey' );
- }
- );
- dialog.find( '.mw-translate-save' ).attr( 'accesskey', 'a' ).attr(
'title', '[' + tooltipAccessKeyPrefix + 'a]' );
- dialog.find( '.mw-translate-next' ).attr( 'accesskey', 's' ).attr(
'title', '[' + tooltipAccessKeyPrefix + 's]' );
- dialog.find( '.mw-translate-skip' ).attr( 'accesskey', 'd' ).attr(
'title', '[' + tooltipAccessKeyPrefix + 'd]' );
- dialog.find( '.mw-translate-history' ).attr( 'accesskey', 'h' ).attr(
'title', '[' + tooltipAccessKeyPrefix + 'h]' );
-}
-
-var dialogwidth = false;
-
-window.trlOpenJsEdit = function( page, group ) {
- var url = wgScript +
'?title=Special:Translate/editpage&suggestions=async&page=$1&loadgroup=$2';
- url = url.replace( '$1', encodeURIComponent( page ) ).replace( '$2',
encodeURIComponent( group ) );
- var id = 'jsedit' + page.replace( /[^a-zA-Z0-9_]/g, '_' );
-
- var dialog = $( '#' + id );
- if ( dialog.size() > 0 ) {
- dialog.dialog( 'option', 'position', 'top' );
- dialog.dialog( 'open' );
- return false;
- }
-
- $( '<div/>' ).attr( 'id', id ).appendTo( $( 'body' ) );
- dialog = $( '#' + id );
-
- var spinner = $( '<div/>' ).attr( 'class', 'mw-ajax-loader' );
- dialog.html( $( '<div/>' ).attr( 'class', 'mw-ajax-dialog' ).html(
spinner ) );
-
- dialog.load(url, false, function() {
- var form = $( '#' + id + ' form' );
-
- form.hide().slideDown();
-
- // Enable the collapsible element
- var $identical = $( '.mw-identical-title' );
- if ( $.isFunction( $identical.makeCollapsible ) ) {
- $identical.makeCollapsible();
- }
-
- form.find( '.mw-translate-next' ).click( function() {
- trlLoadNext( page );
- } );
-
- form.find( '.mw-translate-skip' ).click( function() {
- trlLoadNext( page );
- dialog.dialog( 'close' );
- return false;
- } );
-
- form.find( '.mw-translate-history' ).click( function() {
- window.open( wgServer + wgScript +
'?action=history&title=' + form.find( 'input[name=title]' ).val() );
- return false;
- } );
-
- form.find( '.mw-translate-support' ).click( function() {
- // Can use .data() only with 1.4.3 or newer
- window.open( $(this).attr('data-load-url') );
- return false;
- } );
-
- form.find( 'input#summary' ).focus( function() {
- $(this).css('width', '85%');
- });
-
- var textarea = form.find( '.mw-translate-edit-area' );
- textarea.css( 'display', 'block' );
- textarea.autoResize({extraSpace: 15, limit: 200}).trigger(
'change' );
- textarea.focus();
-
- if ( form.find( '.mw-translate-messagechecks' ) ) {
- var checker = new MessageCheckUpdater( function() {
- var url = wgScript +
'?title=Special:Translate/editpage&suggestions=checks&page=$1&loadgroup=$2';
- url = url.replace( '$1', encodeURIComponent(
page ) ).replace( '$2', encodeURIComponent( group ) );
- $.post( url, { translation: textarea.val() },
function( mydata ) {
- form.find(
'.mw-translate-messagechecks' ).replaceWith( mydata );
- } );
- } );
-
- textarea.keyup( function() {
- checker.setup();
- } );
- }
-
- addAccessKeys( form );
- var b = null;
- b = form.find( '.mw-translate-save' );
- b.val( b.val() + ' (a)' );
- b = form.find( '.mw-translate-next' );
- b.val( b.val() + ' (s)' );
- b = form.find( '.mw-translate-skip' );
- b.val( b.val() + ' (d)' );
- b = form.find( '.mw-translate-history' );
- b.val( b.val() + ' (h)' );
-
- form.ajaxForm( {
- dataType: 'json',
- success: function(json) {
- if ( json.error ) {
- alert( json.error.info + ' (' +
json.error.code +')' );
- } else if ( json.edit.result === 'Failure' ) {
- alert( mw.msg(
'translate-js-save-failed' ) );
- } else if ( json.edit.result === 'Success' ) {
- dialog.dialog( 'close' );
- } else {
- alert( mw.msg(
'translate-js-save-failed' ) );
- }
- }
- } );
- } );
-
- dialog.dialog( {
- bgiframe: true,
- width: dialogwidth ? dialogwidth : parseInt( trlVpWidth()*0.8,
10 ),
- title: page,
- position: 'top',
- resize: function(event, ui) {
- $( '#' + id + ' textarea' ).width( '100%' );
- },
- resizeStop: function(event, ui) {
- dialogwidth = $( '#' + id ).width();
- },
- focus: function(event, ui) {
- addAccessKeys( dialog );
- },
- close: function(event, ui) {
- addAccessKeys( $([]) );
- }
- } );
-
- return false;
-}
-
-function trlLoadNext( title ) {
- var page = title.replace( /[^:]+:/, '' );
- var namespace = title.replace( /:.*/, '' );
- var found = false;
- for ( var key in trlKeys ) {
- if ( !trlKeys.hasOwnProperty(key) ) { continue; }
- var value = trlKeys[key];
- if (found) {
- return trlOpenJsEdit( namespace + ':' + value );
- } else if( page === value ) {
- found = true;
- }
- }
- alert( mw.msg( 'translate-js-nonext' ) );
- return;
-}
-
-})(jQuery);
\ No newline at end of file
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs