fbpx
วิกิพีเดีย

มีเดียวิกิ:Common.js

หมายเหตุ: หลังเผยแพร่ คุณอาจต้องล้างแคชเว็บเบราว์เซอร์ของคุณเพื่อดูการเปลี่ยนแปลง

  • ไฟร์ฟอกซ์ / ซาฟารี: กด Shift ค้างขณะคลิก Reload หรือกด Ctrl-F5 หรือ Ctrl-R (⌘-R บนแมค)
  • กูเกิล โครม: กด Ctrl-Shift-R (⌘-Shift-R บนแมค)
  • อินเทอร์เน็ตเอกซ์พลอเรอร์ และ Edge: กด Ctrl ค้างขณะคลิก Refresh หรือกด Ctrl-F5
  • โอเปร่า: กด Ctrl-F5
// <source lang="javascript"> mw.loader.using( ['mediawiki.util', 'jquery.client'], function () {  /* แก้ไข/เพิ่มโค้ดด้านล่างนี้ */  /**  * Redirect User:Name/skin.js and skin.css to the current skin's pages  * (unless the 'skin' page really exists)  * @source: //www.mediawiki.org/wiki/Snippets/Redirect_skin.js  * @rev: 2  */ if ( mw.config.get( 'wgArticleId' ) === 0 && mw.config.get( 'wgNamespaceNumber' ) == 2 ) {  var titleParts = mw.config.get( 'wgPageName' ).split( '/' );  // Make sure there was a part before and after the slash  // And that the latter is 'skin.js' or 'skin.css'  if ( titleParts.length == 2 ) {  var userSkinPage = titleParts.shift() + '/' + mw.config.get( 'skin' );  if ( titleParts.slice(-1) == 'skin.js' ) {  window.location.href = mw.util.getUrl( userSkinPage + '.js' );  } else if ( titleParts.slice(-1) == 'skin.css' ) {  window.location.href = mw.util.getUrl( userSkinPage + '.css' );  }  } }  /** Preview before save changes *************************************************************  *  * Description: Force IP to preview before saving changes.  * Copyright Marc Mongenet, 2006. Modified by Jutiphan to apply only article namespace  * Maintainers: [[User:Jutiphan]]  * Source [[mediawiki:Manual:Force preview]]  */ var permittedGroups = ["user"];  function forcePreview() {  if( mw.config.get('wgAction') != "edit") return;  if( mw.config.get('wgUserGroups') === null) {  mw.config.get('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);  /**  * Main Page layout fixes  *  * Description: Adds an additional link to the complete list of languages available.  * Maintainers: [[User:AzaToth]], [[User:R. Koot]], [[User:Alex Smotrov]]  */ if ( mw.config.get( 'wgPageName' ) === 'หน้าหลัก') {  $( document ).ready( function () {  mw.util.addPortletLink( 'p-lang', '//meta.wikimedia.org/wiki/List_of_Wikipedias',  'ทุกภาษา', 'interwiki-completelist', 'รายชื่อวิกิพีเดียทุกภาษา' );  } ); }  /* เริ่มคำสั่งที่จะทำให้ แม่แบบ:Metabox ทำงาน */ /*  สร้างโดย: [[:ca:Usuari:Peleguer]] */ importScript('MediaWiki:Common.js/metabox.js');  /**  * @source www.mediawiki.org/wiki/Snippets/Load_JS_and_CSS_by_URL  * @rev 5  */ // CSS var extraCSS = mw.util.getParamValue( 'withCSS' ); if ( extraCSS ) {  if ( extraCSS.match( /^MediaWiki:[^&<>=%#]*\.css$/ ) ) {  importStylesheet( extraCSS );  } else {  mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withCSS value' } );  } }  // JS var extraJS = mw.util.getParamValue( 'withJS' ); if ( extraJS ) {  if ( extraJS.match( /^MediaWiki:[^&<>=%#]*\.js$/ ) ) {  importScript( extraJS );  } else {  mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withJS value' } );  } }  /* Import more specific scripts if necessary */ if (mw.config.get('wgAction') == 'edit' || mw.config.get('wgAction') == 'submit') { //scripts specific to editing pages  importScript('MediaWiki:Common.js/edit.js'); }else if(mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Watchlist'){  importScript( 'MediaWiki:Common.js/watchlist.js' ); }else if ( mw.config.get( 'wgNamespaceNumber' ) === 4 && mw.config.get( 'wgTitle' ) === 'อัปโหลด' && mw.config.get( 'wgAction' ) === 'view' ) {  /**  * Uploadwizard_newusers  * Switches in a message for non-autoconfirmed users at [[Wikipedia:Upload]]  *  * Maintainers: [[User:Krimpet]]  */  importScript('MediaWiki:Common.js/uploadWizard.js'); }  /**  * WikiMiniAtlas  *  * Description: WikiMiniAtlas is a popup click and drag world map.  * This script causes all of our coordinate links to display the WikiMiniAtlas popup button.  * The script itself is located on meta because it is used by many projects.  * See [[Meta:WikiMiniAtlas]] for more information.   * Maintainers: [[User:Dschwen]]  */ ( function () {  var require_wikiminiatlas = false;  var coord_filter = /geohack/;  $( function () {  $( 'a.external.text' ).each( function( key, link ) {  if ( link.href && coord_filter.exec( link.href ) ) {  require_wikiminiatlas = true;  // break from loop  return false;  }  } );  if ( $( 'div.kmldata' ).length ) {  require_wikiminiatlas = true;  }  if ( require_wikiminiatlas ) {  mw.loader.load( '//meta.wikimedia.org/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript' );  }  } ); } )();   /**  * Collapsible tables; reimplemented with mw-collapsible  * Styling is also in place to avoid FOUC  *  * Allows tables to be collapsed, showing only the header. See [[Help:Collapsing]].  * @version 3.0.0 (2018-05-20)  * @source https://www.mediawiki.org/wiki/MediaWiki:Gadget-collapsibleTables.js  * @author [[User:R. Koot]]  * @author [[User:Krinkle]]  * @author [[User:TheDJ]]  * @added by [[User:Jutiphan]]  * @deprecated Since MediaWiki 1.20: Use class="mw-collapsible" instead which  * is supported in MediaWiki core. Shimmable since MediaWiki 1.32  *  * @param {jQuery} $content  */  function makeCollapsibleMwCollapsible( $content ) {  var $tables = $content  .find( 'table.collapsible:not(.mw-collapsible)' )  .addClass( 'mw-collapsible' );   $.each( $tables, function ( index, table ) {  // mw.log.warn( 'This page is using the deprecated class collapsible. Please replace it with mw-collapsible.');  if ( $( table ).hasClass( 'collapsed' ) ) {  $( table ).addClass( 'mw-collapsed' );  // mw.log.warn( 'This page is using the deprecated class collapsed. Please replace it with mw-collapsed.');  }  } );  if ( $tables.length > 0 ) {  mw.loader.using( 'jquery.makeCollapsible' ).then( function () {  $tables.makeCollapsible();  } );  }  }  mw.hook( 'wikipage.content' ).add( makeCollapsibleMwCollapsible );   /**  * Add support to mw-collapsible for autocollapse, innercollapse and outercollapse  *  * Maintainers: TheDJ  */  function mwCollapsibleSetup( $collapsibleContent ) {  var $element,  $toggle,  autoCollapseThreshold = 2;  $.each( $collapsibleContent, function ( index, element ) {  $element = $( element );  if ( $element.hasClass( 'collapsible' ) ) {  $element.find( 'tr:first > th:first' ).prepend( $element.find( 'tr:first > * > .mw-collapsible-toggle' ) );  }  if ( $collapsibleContent.length >= autoCollapseThreshold && $element.hasClass( 'autocollapse' ) ) {  $element.data( 'mw-collapsible' ).collapse();  } else if ( $element.hasClass( 'innercollapse' ) ) {  if ( $element.parents( '.outercollapse' ).length > 0 ) {  $element.data( 'mw-collapsible' ).collapse();  }  }  // because of colored backgrounds, style the link in the text color  // to ensure accessible contrast  $toggle = $element.find( '.mw-collapsible-toggle' );  if ( $toggle.length ) {  // Make the toggle inherit text color  if ( $toggle.parent()[ 0 ].style.color ) {  $toggle.find( 'a' ).css( 'color', 'inherit' );  }  }  } );  }   mw.hook( 'wikipage.collapsibleContent' ).add( mwCollapsibleSetup );   /**  * Dynamic Navigation Bars (experimental)  *  * Description: See [[Wikipedia:NavFrame]].  * Maintainers: UNMAINTAINED  */   var collapseCaption = 'ซ่อน';  var expandCaption = 'แสดง';   // Set up the words in your language  var navigationBarHide = '[' + collapseCaption + ']';  var navigationBarShow = '[' + expandCaption + ']';   /**  * Shows and hides content and picture (if available) of navigation bars.  *  * @param {number} indexNavigationBar The index of navigation bar to be toggled  * @param {jQuery.Event} event Event object  * @return {boolean}  */  function toggleNavigationBar( indexNavigationBar, event ) {  var navToggle = document.getElementById( 'NavToggle' + indexNavigationBar );  var navFrame = document.getElementById( 'NavFrame' + indexNavigationBar );  var navChild;   if ( !navFrame || !navToggle ) {  return false;  }   // If shown now  if ( navToggle.firstChild.data === navigationBarHide ) {  for ( navChild = navFrame.firstChild; navChild !== null; navChild = navChild.nextSibling ) {  if ( $( navChild ).hasClass( 'NavContent' ) ) {  navChild.style.display = 'none';  }  }  navToggle.firstChild.data = navigationBarShow;   // If hidden now  } else if ( navToggle.firstChild.data === navigationBarShow ) {  for ( navChild = navFrame.firstChild; navChild !== null; navChild = navChild.nextSibling ) {  if ( $( navChild ).hasClass( 'NavContent' ) ) {  navChild.style.display = 'block';  }  }  navToggle.firstChild.data = navigationBarHide;  }   event.preventDefault();  }   /**  * Adds show/hide-button to navigation bars.  *  * @param {jQuery} $content  */  function createNavigationBarToggleButton( $content ) {  var j, navChild, navToggle, navToggleText, isCollapsed,  indexNavigationBar = 0;  // Iterate over all < div >-elements  var $divs = $content.find( 'div.NavFrame:not(.mw-collapsible)' );  $divs.each( function ( i, navFrame ) {  indexNavigationBar++;  navToggle = document.createElement( 'a' );  navToggle.className = 'NavToggle';  navToggle.setAttribute( 'id', 'NavToggle' + indexNavigationBar );  navToggle.setAttribute( 'href', '#' );  $( navToggle ).on( 'click', $.proxy( toggleNavigationBar, null, indexNavigationBar ) );   isCollapsed = $( navFrame ).hasClass( 'collapsed' );  /**  * Check if any children are already hidden. This loop is here for backwards compatibility:  * the old way of making NavFrames start out collapsed was to manually add style="display:none"  * to all the NavPic/NavContent elements. Since this was bad for accessibility (no way to make  * the content visible without JavaScript support), the new recommended way is to add the class  * "collapsed" to the NavFrame itself, just like with collapsible tables.  */  for ( navChild = navFrame.firstChild; navChild !== null && !isCollapsed; navChild = navChild.nextSibling ) {  if ( $( navChild ).hasClass( 'NavPic' ) || $( navChild ).hasClass( 'NavContent' ) ) {  if ( navChild.style.display === 'none' ) {  isCollapsed = true;  }  }  }  if ( isCollapsed ) {  for ( navChild = navFrame.firstChild; navChild !== null; navChild = navChild.nextSibling ) {  if ( $( navChild ).hasClass( 'NavPic' ) || $( navChild ).hasClass( 'NavContent' ) ) {  navChild.style.display = 'none';  }  }  }  navToggleText = document.createTextNode( isCollapsed ? navigationBarShow : navigationBarHide );  navToggle.appendChild( navToggleText );   // Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked)  for ( j = 0; j < navFrame.childNodes.length; j++ ) {  if ( $( navFrame.childNodes[ j ] ).hasClass( 'NavHead' ) ) {  navToggle.style.color = navFrame.childNodes[ j ].style.color;  navFrame.childNodes[ j ].appendChild( navToggle );  }  }  navFrame.setAttribute( 'id', 'NavFrame' + indexNavigationBar );  } );  }   mw.hook( 'wikipage.content' ).add( createNavigationBarToggleButton );  // Results from Wikidata // [[File:Wdsearch_script_screenshot.png]] if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Search' || ( mw.config.get( 'wgArticleId' ) === 0 && mw.config.get( 'wgCanonicalSpecialPageName' ) === false ) ) {  mw.loader.load("//en.wikipedia.org/w/index.php?title=MediaWiki:Wdsearch.js&action=raw&ctype=text/javascript"); }  /* แก้ไข/เพิ่มโค้ดข้างบนนี้ */ }); // </source> 

เด, ยว, common, หมายเหต, หล, งเผยแพร, ณอาจต, องล, างแคชเว, บเบราว, เซอร, ของค, ณเพ, อด, การเปล, ยนแปลง, ไฟร, ฟอกซ, ซาฟาร, กด, shift, างขณะคล, reload, หร, อกด, ctrl, หร, ctrl, บนแมค, เก, โครม, กด, ctrl, shift, shift, บนแมค, นเทอร, เน, ตเอกซ, พลอเรอร, และ, edge,. hmayehtu hlngephyaephr khunxactxnglangaekhchewbebrawesxrkhxngkhunephuxdukarepliynaeplng ifrfxks safari kd Shift khangkhnakhlik Reload hruxkd Ctrl F5 hrux Ctrl R R bnaemkh kuekil okhrm kd Ctrl Shift R Shift R bnaemkh xinethxrentexksphlxerxr aela Edge kd Ctrl khangkhnakhlik Refresh hruxkd Ctrl F5 oxepra kd Ctrl F5 lt source lang javascript gt mw loader using mediawiki util jquery client function aekikh ephimokhddanlangni Redirect User Name skin js and skin css to the current skin s pages unless the skin page really exists source www mediawiki org wiki Snippets Redirect skin js rev 2 if mw config get wgArticleId 0 amp amp mw config get wgNamespaceNumber 2 var titleParts mw config get wgPageName split Make sure there was a part before and after the slash And that the latter is skin js or skin css if titleParts length 2 var userSkinPage titleParts shift mw config get skin if titleParts slice 1 skin js window location href mw util getUrl userSkinPage js else if titleParts slice 1 skin css window location href mw util getUrl userSkinPage css Preview before save changes Description Force IP to preview before saving changes Copyright Marc Mongenet 2006 Modified by Jutiphan to apply only article namespace Maintainers User Jutiphan Source mediawiki Manual Force preview var permittedGroups user function forcePreview if mw config get wgAction edit return if mw config get wgUserGroups null mw config get wgUserGroups if mw config get wgUserGroups filter function group return permittedGroups indexOf group gt 1 length return var saveButton document getElementById wpSave if saveButton return saveButton disabled true saveButton value bnthukkaraekikh kdaesdngtwxyangephuxtrwcsxbkhwamthuktxngkxnbnthuk saveButton style fontWeight normal document getElementById wpPreview style fontWeight bold forcePreview Main Page layout fixes Description Adds an additional link to the complete list of languages available Maintainers User AzaToth User R Koot User Alex Smotrov if mw config get wgPageName hnahlk document ready function mw util addPortletLink p lang meta wikimedia org wiki List of Wikipedias thukphasa interwiki completelist raychuxwikiphiediythukphasa erimkhasngthicathaih aemaebb Metabox thangan srangody ca Usuari Peleguer importScript MediaWiki Common js metabox js source www mediawiki org wiki Snippets Load JS and CSS by URL rev 5 CSS var extraCSS mw util getParamValue withCSS if extraCSS if extraCSS match MediaWiki amp lt gt css importStylesheet extraCSS else mw notify Only pages from the MediaWiki namespace are allowed title Invalid withCSS value JS var extraJS mw util getParamValue withJS if extraJS if extraJS match MediaWiki amp lt gt js importScript extraJS else mw notify Only pages from the MediaWiki namespace are allowed title Invalid withJS value Import more specific scripts if necessary if mw config get wgAction edit mw config get wgAction submit scripts specific to editing pages importScript MediaWiki Common js edit js else if mw config get wgCanonicalSpecialPageName Watchlist importScript MediaWiki Common js watchlist js else if mw config get wgNamespaceNumber 4 amp amp mw config get wgTitle xpohld amp amp mw config get wgAction view Uploadwizard newusers Switches in a message for non autoconfirmed users at Wikipedia Upload Maintainers User Krimpet importScript MediaWiki Common js uploadWizard js WikiMiniAtlas Description WikiMiniAtlas is a popup click and drag world map This script causes all of our coordinate links to display the WikiMiniAtlas popup button The script itself is located on meta because it is used by many projects See Meta WikiMiniAtlas for more information Maintainers User Dschwen function var require wikiminiatlas false var coord filter geohack function a external text each function key link if link href amp amp coord filter exec link href require wikiminiatlas true break from loop return false if div kmldata length require wikiminiatlas true if require wikiminiatlas mw loader load meta wikimedia org w index php title MediaWiki Wikiminiatlas js amp action raw amp ctype text javascript Collapsible tables reimplemented with mw collapsible Styling is also in place to avoid FOUC Allows tables to be collapsed showing only the header See Help Collapsing version 3 0 0 2018 05 20 source https www mediawiki org wiki MediaWiki Gadget collapsibleTables js author User R Koot author User Krinkle author User TheDJ added by User Jutiphan deprecated Since MediaWiki 1 20 Use class mw collapsible instead which is supported in MediaWiki core Shimmable since MediaWiki 1 32 param jQuery content function makeCollapsibleMwCollapsible content var tables content find table collapsible not mw collapsible addClass mw collapsible each tables function index table mw log warn This page is using the deprecated class collapsible Please replace it with mw collapsible if table hasClass collapsed table addClass mw collapsed mw log warn This page is using the deprecated class collapsed Please replace it with mw collapsed if tables length gt 0 mw loader using jquery makeCollapsible then function tables makeCollapsible mw hook wikipage content add makeCollapsibleMwCollapsible Add support to mw collapsible for autocollapse innercollapse and outercollapse Maintainers TheDJ function mwCollapsibleSetup collapsibleContent var element toggle autoCollapseThreshold 2 each collapsibleContent function index element element element if element hasClass collapsible element find tr first gt th first prepend element find tr first gt gt mw collapsible toggle if collapsibleContent length gt autoCollapseThreshold amp amp element hasClass autocollapse element data mw collapsible collapse else if element hasClass innercollapse if element parents outercollapse length gt 0 element data mw collapsible collapse because of colored backgrounds style the link in the text color to ensure accessible contrast toggle element find mw collapsible toggle if toggle length Make the toggle inherit text color if toggle parent 0 style color toggle find a css color inherit mw hook wikipage collapsibleContent add mwCollapsibleSetup Dynamic Navigation Bars experimental Description See Wikipedia NavFrame Maintainers UNMAINTAINED var collapseCaption sxn var expandCaption aesdng Set up the words in your language var navigationBarHide collapseCaption var navigationBarShow expandCaption Shows and hides content and picture if available of navigation bars param number indexNavigationBar The index of navigation bar to be toggled param jQuery Event event Event object return boolean function toggleNavigationBar indexNavigationBar event var navToggle document getElementById NavToggle indexNavigationBar var navFrame document getElementById NavFrame indexNavigationBar var navChild if navFrame navToggle return false If shown now if navToggle firstChild data navigationBarHide for navChild navFrame firstChild navChild null navChild navChild nextSibling if navChild hasClass NavContent navChild style display none navToggle firstChild data navigationBarShow If hidden now else if navToggle firstChild data navigationBarShow for navChild navFrame firstChild navChild null navChild navChild nextSibling if navChild hasClass NavContent navChild style display block navToggle firstChild data navigationBarHide event preventDefault Adds show hide button to navigation bars param jQuery content function createNavigationBarToggleButton content var j navChild navToggle navToggleText isCollapsed indexNavigationBar 0 Iterate over all lt div gt elements var divs content find div NavFrame not mw collapsible divs each function i navFrame indexNavigationBar navToggle document createElement a navToggle className NavToggle navToggle setAttribute id NavToggle indexNavigationBar navToggle setAttribute href navToggle on click proxy toggleNavigationBar null indexNavigationBar isCollapsed navFrame hasClass collapsed Check if any children are already hidden This loop is here for backwards compatibility the old way of making NavFrames start out collapsed was to manually add style display none to all the NavPic NavContent elements Since this was bad for accessibility no way to make the content visible without JavaScript support the new recommended way is to add the class collapsed to the NavFrame itself just like with collapsible tables for navChild navFrame firstChild navChild null amp amp isCollapsed navChild navChild nextSibling if navChild hasClass NavPic navChild hasClass NavContent if navChild style display none isCollapsed true if isCollapsed for navChild navFrame firstChild navChild null navChild navChild nextSibling if navChild hasClass NavPic navChild hasClass NavContent navChild style display none navToggleText document createTextNode isCollapsed navigationBarShow navigationBarHide navToggle appendChild navToggleText Find the NavHead and attach the toggle link Must be this complicated because Moz s firstChild handling is borked for j 0 j lt navFrame childNodes length j if navFrame childNodes j hasClass NavHead navToggle style color navFrame childNodes j style color navFrame childNodes j appendChild navToggle navFrame setAttribute id NavFrame indexNavigationBar mw hook wikipage content add createNavigationBarToggleButton Results from Wikidata File Wdsearch script screenshot png if mw config get wgCanonicalSpecialPageName Search mw config get wgArticleId 0 amp amp mw config get wgCanonicalSpecialPageName false mw loader load en wikipedia org w index php title MediaWiki Wdsearch js amp action raw amp ctype text javascript aekikh ephimokhdkhangbnni lt source gt ekhathungcak https th wikipedia org w index php title miediywiki Common js amp oldid 10362172, wikipedia, วิกิ หนังสือ, หนังสือ, ห้องสมุด,

บทความ

, อ่าน, ดาวน์โหลด, ฟรี, ดาวน์โหลดฟรี, mp3, วิดีโอ, mp4, 3gp, jpg, jpeg, gif, png, รูปภาพ, เพลง, เพลง, หนัง, หนังสือ, เกม, เกม