מדיה ויקי:Mobile.js – הבדלי גרסאות

מתוך ויקיפדיה, האנציקלופדיה החופשית
תוכן שנמחק תוכן שנוסף
Jon (WMF) (שיחה | תרומות)
אין תקציר עריכה
Jon (WMF) (שיחה | תרומות)
maintenance: production errors related to this bug
שורה 1: שורה 1:
/* Any JavaScript here will be loaded for users using the mobile site */
/* Any JavaScript here will be loaded for users using the mobile site */
// $(function() { if ( $('.pgn-source-wrapper').length ) mw.loader.load( '//he.m.wikipedia.org/w/index.php?title=מדיה_ויקי:Common.js/pgn.js&action=raw&ctype=text/javascript' ) } )
// $(function() { if ( $('.pgn-source-wrapper').length ) mw.loader.load( '//he.m.wikipedia.org/w/index.php?title=מדיה_ויקי:Common.js/pgn.js&action=raw&ctype=text/javascript' ) } )

// Many user scripts are using this.
window.importScript = function () {
// @todo - let gadget developers know that they need to fix this.
//mw.notify('');
};


/* פונקציה לייבוא סקריפט מ[[ויקיפדיה:סקריפטים]] */
/* פונקציה לייבוא סקריפט מ[[ויקיפדיה:סקריפטים]] */

גרסה מ־18:43, 27 באוגוסט 2020

/* Any JavaScript here will be loaded for users using the mobile site */
// $(function() { if ( $('.pgn-source-wrapper').length ) mw.loader.load( '//he.m.wikipedia.org/w/index.php?title=מדיה_ויקי:Common.js/pgn.js&action=raw&ctype=text/javascript' ) } )

// Many user scripts are using this.
window.importScript = function () {
	// @todo - let gadget developers know that they need to fix this.
	//mw.notify('');
};

/* פונקציה לייבוא סקריפט מ[[ויקיפדיה:סקריפטים]] */
window.importUserScript = function () {
	'use strict';

	var args = arguments;

	mw.loader.using( 'mediawiki.util', function () {
		for ( var arg = 0; arg < args.length; arg++ ) {
			try {
				importScript( 'MediaWiki:סקריפטים/' + args[arg] + '.js' );
			}
			catch( e ) {
			}
		}
	} );
};

if ( mw.config.get( 'wgUserName' ) ) { // only registred users. load is harmless if page does not exist
	mw.loader.load( '//he.wikipedia.org/w/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, '&quot;')
			+ ']]';
		$('#page-secondary-actions').append('<form name="commentbox" class="commentbox" action="/w/index.php" method="get"><input value="edit" name="action" type="hidden"><input name="preloadtitle" type="hidden" value="' + reportPage + '"><input value="ויקיפדיה:דיווח על טעויות/נייד" 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>');	
	}
});

if ( mw.config.get('wgCanonicalNamespace') !== 'Special' ) 
mw.hook( 'wikipage.content' ).add( function( content ) {
	$( '.executeJS', content ).each( function () {
		var gadget = $( this ).data( 'mobilegadget' );
		if ( gadget && $.trim( gadget ) ) mw.loader.load( 'ext.gadget.ondemand-' + $.trim( gadget ) ); // np repetitions - resourceloader takes care
	} );
} );