Участник:Mike Novikoff/common.js: различия между версиями

Материал из Википедии — свободной энциклопедии
Перейти к навигации Перейти к поиску
Содержимое удалено Содержимое добавлено
chances are that the default Gadget-directLinkToCommons.js will be usable at long last
oops, includes() is not compatible with Opera Presto
(не показана 1 промежуточная версия этого же участника)
Строка 19: Строка 19:
//
//
mw.loader.using(['jquery.confirmable'],function(){ $('.mw-rollback-link > a').confirmable(); });
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]
//
// Load the former (it will be used by Wikificator) and pretend
// that the latter is loaded as well (since Wikificator checks it)
// see <https://ru.wikipedia.org/?diff=96161584>
//
$.when( mw.loader.using([ 'ext.gadget.mediawiki.toolbar' ]) ).then( function() {
mw.hook( 'legacy.toolbar.ready' ).fire();
});
}

Версия от 11:00, 26 ноября 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]
	// 
	// Load the former (it will be used by Wikificator) and pretend
	// that the latter is loaded as well (since Wikificator checks it)
	// see <https://ru.wikipedia.org/?diff=96161584>
	//
	$.when( mw.loader.using([ 'ext.gadget.mediawiki.toolbar' ]) ).then( function() {
		mw.hook( 'legacy.toolbar.ready' ).fire();
	});
}