Участник:Mike Novikoff/common.js: различия между версиями
Перейти к навигации
Перейти к поиску
Содержимое удалено Содержимое добавлено
u:ØM/quotes.js, and I'll even use importScript() to be counted |
Wikificator: code from Jack |
||
Строка 28: | Строка 28: | ||
// [https://ru.wikipedia.org/wiki/MediaWiki:Gadget-LegacyToolbar2006.js] |
// [https://ru.wikipedia.org/wiki/MediaWiki:Gadget-LegacyToolbar2006.js] |
||
// |
// |
||
// Load the former (it will be used by Wikificator) and pretend |
|||
// that the latter is loaded as well (since Wikificator checks it) |
|||
⚫ | |||
⚫ | |||
$.when( mw.loader.using([ 'ext.gadget.mediawiki.toolbar' ]) ).then( function() { |
$.when( mw.loader.using([ 'ext.gadget.mediawiki.toolbar' ]) ).then( function() { |
||
mw.hook( 'legacy.toolbar.ready' ).fire(); |
|||
⚫ | |||
⚫ | |||
var $toolbar = $( '#toolbar' ); |
|||
if ( !$toolbar.length ) { |
|||
var $textBox = $( '#wpTextbox1' ); |
|||
if ( $textBox.length ) { |
|||
$toolbar = $( '<div>' ) |
|||
.attr( 'id', 'toolbar' ) |
|||
.css( 'clear', 'none' ) |
|||
.insertBefore( $textBox ); |
|||
} |
|||
} |
|||
$( '<div>' ) |
|||
.addClass( 'mw-toolbar-editbutton' ) |
|||
.attr( 'alt', 'Викификатор' ) |
|||
.attr( 'title', 'Викификатор — автоматический обработчик текста' ) |
|||
.css( { |
|||
width: '69px', |
|||
backgroundImage: 'url(//upload.wikimedia.org/wikipedia/commons/3/38/Button_wikify.png)' |
|||
} ) |
|||
.appendTo( $toolbar ) |
|||
.click( Wikify ); |
|||
}); |
}); |
||
Версия от 04:10, 20 декабря 2018
// See also: [https://meta.wikimedia.org/wiki/User:Mike_Novikoff/global.js]
// 'Reference Tooltips' gadget from enwiki instead of ruwiki's one which is now broken for Opera Presto
// NB: be sure to turn OFF the default one!
// [https://ru.wikipedia.org/wiki/Special:Preferences#mw-prefsection-gadgets]
// ("Включённые по умолчанию" => "Всплывающая подсказка с примечаниями")
//
mw.loader.load('//en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-ReferenceTooltips.js&action=raw&ctype=text/javascript');
mw.loader.load('//en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-ReferenceTooltips.css&action=raw&ctype=text/css', 'text/css');
// 'Gadget-edittop' ("Add an [edit] link for the lead section of a page") in *this hell* is kind of buggy, too
// NB: be sure to turn OFF the default one!
// [https://ru.wikipedia.org/wiki/Special:Preferences#mw-prefsection-gadgets]
// ("Включённые по умолчанию" => "Добавить ссылку «[править]» редактирования первой секции статьи")
//
mw.loader.load('//en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-edittop.js&action=raw&ctype=text/javascript');
// Rollback confirmation using Echo thanking mechanism [https://ru.wikipedia.org/?oldid=81485962]
//
mw.loader.using(['jquery.confirmable'],function(){ $('.mw-rollback-link > a').confirmable(); });
// Try to get Wikificator running without any (visible) toolbars
if ($.inArray( mw.config.get('wgAction'), ['edit', 'submit'] ) !== -1) {
// [https://ru.wikipedia.org/wiki/MediaWiki:Gadget-mediawiki.toolbar.js]
// is an API for the actual "old toolbar" which is
// [https://ru.wikipedia.org/wiki/MediaWiki:Gadget-LegacyToolbar2006.js]
//
$.when( mw.loader.using([ 'ext.gadget.mediawiki.toolbar' ]) ).then( function() {
// Code from Jack [https://ru.wikipedia.org/?diff=96950416]
//
var $toolbar = $( '#toolbar' );
if ( !$toolbar.length ) {
var $textBox = $( '#wpTextbox1' );
if ( $textBox.length ) {
$toolbar = $( '<div>' )
.attr( 'id', 'toolbar' )
.css( 'clear', 'none' )
.insertBefore( $textBox );
}
}
$( '<div>' )
.addClass( 'mw-toolbar-editbutton' )
.attr( 'alt', 'Викификатор' )
.attr( 'title', 'Викификатор — автоматический обработчик текста' )
.css( {
width: '69px',
backgroundImage: 'url(//upload.wikimedia.org/wikipedia/commons/3/38/Button_wikify.png)'
} )
.appendTo( $toolbar )
.click( Wikify );
});
// Who said "no consensus"?
importScript('u:ØM/quotes.js'); // yes, it links there: [[u:ØM/quotes.js]]
}