MediaWiki:Mobile.js
Внешний вид
Замечание: Возможно, после публикации вам придётся очистить кэш своего браузера, чтобы увидеть изменения.
- Firefox / Safari: Удерживая клавишу Shift, нажмите на панели инструментов Обновить либо нажмите Ctrl+F5 или Ctrl+R (⌘+R на Mac)
- Google Chrome: Нажмите Ctrl+Shift+R (⌘+Shift+R на Mac)
- Edge: Удерживая Ctrl, нажмите Обновить либо нажмите Ctrl+F5
- Opera: Нажмите Ctrl+F5.
/* Any JavaScript here will be loaded for users using the mobile site */
window.importScript = function ( scriptPageName ) {
/* Disable the importScript function for now.
See [[Special:Permalink/36946424#טעינת_סקריפטים_אישיים_בנייד]] for details. */
'use strict';
mw.log.warn( 'Script "' + ( scriptPageName || '' ) + '" was not loaded because the importScript() function is not currently supported on the mobile interface. If the script was adapted to work properly on the mobile interface, please load it using mw.loader.load() instead.' );
};
window.importUserScript = function () {
/* Allow user scripts from [[חב:ס]] to load only if adapted
to work properly on the mobile interface.
To designate a user script from [[חב:ס]] as mobile-supported,
add its number to the mobileSupportedScriptNumbers array.
See [[Special:Permalink/36946424#טעינת_סקריפטים_אישיים_בנייד]] for details. */
'use strict';
var mobileSupportedScriptNumbers = [ 16, 107, 111, 112 ];
try {
var args = arguments;
for ( var i = 0; i < args.length; i++ ) {
if ( typeof args[ i ] !== 'number' ) {
continue;
}
if ( mobileSupportedScriptNumbers.indexOf( args[ i ] ) >= 0 ) {
mw.loader.load( '//index.php?title=מדיה_ויקי:סקריפטים/' + args[ i ] + '.js&action=raw&ctype=text/javascript' );
} else {
mw.log.warn( 'Script number ' + args[ i ] + ' was not loaded because it is not included in the list of scripts supported on the mobile interface, as defined at [[MediaWiki:Mobile.js]]. If the script was adapted to work properly on the mobile interface, it should be added to that list.' );
}
}
} catch ( e ) {
return;
}
};
if ( mw.config.get( 'wgUserName' ) ) { // only registred users. load is harmless if page does not exist
mw.loader.load( '/index.php?title=User:' + mw.config.get('wgUserName') + '/mobile.js&action=raw&ctype=text/javascript');
}
$(function(){
// simplified version of report on error for mobile
if ( mw.config.get( 'wgNamespaceNumber' ) % 2 === 0 ) {
var reportPage = '[['+ mw.config.get('wgPageName')
.replace( /_/g, ' ' )
.replace(/^(קטגוריה|קובץ)/, ':$1')
.replace(/"/g, '"')
+ ']]';
var RepotEditinto = 'חב"דפדיה:דיווח על טעויות/נייד';
if ( mw.config.get( 'wgNamespaceNumber' ) === 14 ) RepotEditinto = 'חב"דפדיה:דיווח על טעויות/נייד/קטגוריה';
$('#page-secondary-actions').append('<form name="commentbox" class="commentbox" action="/index.php" method="get"><input value="edit" name="action" type="hidden"><input name="preloadtitle" type="hidden" value="' + reportPage + '"><input value="'+RepotEditinto+'" name="editintro" type="hidden"><input value="new" name="section" type="hidden"><input value="חב"דפדיה:דיווח על טעויות" name="title" type="hidden"><input name="create" class="mw-ui-button button" value="משוב ודיווח על טעות" type="submit"></form>');
}
});
$(function () {
// הוספת ב"ה במובייל מיד אחרי כפתור התפריט הראשי בצד ימין
if ($('#mw-navigation, .minerva-header').length && $('#bh-mobile-label').length === 0) {
var bhElement = '<span id="bh-mobile-label" style="font-weight: bold; font-size: 14px; color: #54595d; margin-right: 10px; display: inline-flex; align-items: center;">ב"ה</span>';
// מוסיף את הטקסט מיד בתחילת אזור ההדר העליון בצד ימין
$('.minerva-header header, .header-container').first().prepend(bhElement);
}
});