ข้ามไปเนื้อหา

ผลต่างระหว่างรุ่นของ "มีเดียวิกิ:Common.js"

จาก วิกิซอร์ซ
เนื้อหาที่ลบ เนื้อหาที่เพิ่ม
มี PageNumbers ที่เป็นแบบในนี้กับแบบ gadget เลยเพิ่มให้ไม่โหลดจากที่นี่สำหรับผมคนเดียว ทั้งบัญชีนี้และบัญชีทดสอบ
 
(ไม่แสดง 1 รุ่นระหว่างกลางโดยผู้ใช้คนเดียวกัน)
บรรทัดที่ 25: บรรทัดที่ 25:
*/
*/
mw.loader.load('//wikisource.org/w/index.php?title=MediaWiki:InterWikiTransclusion.js&action=raw&ctype=text/javascript');
mw.loader.load('//wikisource.org/w/index.php?title=MediaWiki:InterWikiTransclusion.js&action=raw&ctype=text/javascript');

// PageNumbers // there's this and there's gadget, I'm checking to see which to keep and will be manually loading them in
if (["Bebiezaza", "Bebiezaza2"].indexOf(mw.config.get('wgUserName')) === -1) {
mw.loader.load('//th.wikisource.org/w/index.php?title=MediaWiki:PageNumbers.js&action=raw&ctype=text/javascript');
}


/**
/**
บรรทัดที่ 49: บรรทัดที่ 44:
'iwtrans2':'Its text comes from other Wikisource subdomains.',
'iwtrans2':'Its text comes from other Wikisource subdomains.',
};
};

/* stop faux red links on fresh links */
$( 'div.mw-body a' ).removeClass( 'stub' );


/**
/**

รุ่นแก้ไขปัจจุบันเมื่อ 00:44, 10 พฤศจิกายน 2565

/* จาวาสคริปต์ในหน้านี้จะถูกใช้งานต่อผู้ใช้ทุกคน */

//<syntaxhighlight lang="javascript">
/**
 * Keep code in MediaWiki:Common.js to a minimum as it is unconditionally
 * loaded for all users on every wiki page. If possible create a gadget that is
 * enabled by default instead of adding it here (since gadgets are fully
 * optimized ResourceLoader modules with possibility to add dependencies etc.)
 *
 * Since Common.js isn't a gadget, there is no place to declare its
 * dependencies, so we have to lazy load them with mw.loader.using on demand and
 * then execute the rest in the callback. In most cases these dependencies will
 * be loaded (or loading) already and the callback will not be delayed. In case a
 * dependency hasn't arrived yet it'll make sure those are loaded before this.
 */
/* global mw, $, importStylesheet, importScript */
/* jshint curly:false, strict:false, eqnull:true, browser:true */

mw.loader.using( ['mediawiki.user', 'mediawiki.util', 'jquery.client'] ).done( function () {
/* Begin of mw.loader.using callback */

/**
 * Scripts imported from wikisource.org
 * see [[oldwikisource:Wikisource:Shared Scripts]] for details
 */
mw.loader.load('//wikisource.org/w/index.php?title=MediaWiki:InterWikiTransclusion.js&action=raw&ctype=text/javascript');

/**
 * Messages are configurable here
 */
if(!self.ws_messages) self.ws_messages = { };

window.ws_msg = function (name) {
	var m = self.ws_messages[name];
	if(m) return m; else return name;
};

self.ws_messages = {
	// MediaWiki:Gadget-DisplayFooter.js
	'▲':'กลับไปที่ด้านบนของหน้า',

	// :mul:MediaWiki:InterWikiTransclusion.js
	'iwtrans':'Its text comes from',
	'iwtrans2':'Its text comes from other Wikisource subdomains.',
};

/**
 * Envelope subNotes found in main navigation header derivatives
 * Namespace coverage: Main (ns-0), Translation (ns-114)
 * See also _____
 * 
 * Ver 0.10, 2015-01-31
 */
jQuery( document ).ready( function ( $ ) {
	var nsSubNotes = [ 0, 114 ];
	if ( $.inArray( mw.config.get( 'wgNamespaceNumber' ), nsSubNotes ) !== -1 ) {
		$( 'div.subNote' ).insertBefore( $( 'div#ws-data' ) ); 
	}
} );
/**
 * Envelope hatNotes & similar into main navigation header container
 * Namespace coverage: Main (ns-0), Translation (ns-114)
 * See also _____
 * 
 * Ver 0.30, 2015-12-31
 */
jQuery( document ).ready( function ( $ ) {
	var nsHatNotes = [ 0, 114 ];
	if ( $.inArray( mw.config.get( 'wgNamespaceNumber' ), nsHatNotes ) !== -1 ) {
		$( 'div.similar' ).prependTo( $( 'div#headerContainer' ) ); 
		$( 'table.ambox' ).prependTo( $( 'div#headerContainer' ) );
	}
} );
/**
 * PageNumbers   Dynamic Layouts helper
 *
 * removes sidebar Display Options menu from all ns except Main and Translation
 *
 */
jQuery( document ).ready( function ( $ ) {
	var nsDynamicLayouts = [ -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 100, 101, 102, 103, 104, 105, 106, 107, 115, 828, 829 ];
	if ( $.inArray( mw.config.get( 'wgNamespaceNumber' ), nsDynamicLayouts ) !== -1 ) {
		$( 'div' ).remove( '#p-do' );
	}
} );
/* End of mw.loader.using callback */
} );

// -------------------------------------------------------------------------------
//  Force Preview  JavaScript code - Start
//
//  To allow any group to bypass being forced to preview,
//  enter the group name in the permittedGroups array.
//  E.g.
//    var permittedGroups = [];                        // force everyone
//    var permittedGroups = [ "user" ];                // permit logged-in users
//    var permittedGroups = [ "sysop", "bureaucrat" ]; // permit sysop, bureaucrat
// -------------------------------------------------------------------------------
var permittedGroups = [ "user" ];

function forcePreview()
{
  if( mw.config.get('wgAction') != "edit") return;
  if( mw.config.get('wgUserGroups') === null) {
    mw.config.set('wgUserGroups', []);
  }
  if ( mw.config.get( "wgUserGroups" ).filter(function(group) {
    return permittedGroups.indexOf(group) > -1;
  }).length ) return;
  var saveButton = document.getElementById("wpSave");
  if( !saveButton )
    return;
  saveButton.disabled = true;
  saveButton.value = "กรุณาดูตัวอย่างก่อนบันทึก";
  saveButton.style.fontWeight = "normal";
  document.getElementById("wpPreview").style.fontWeight = "bold";
}

$(forcePreview);
// -----------------------------------------------------
//  Force Preview  JavaScript code - End
// -----------------------------------------------------

/* DO NOT ADD CODE BELOW THIS LINE */
//</source>