fbpx
วิกิพีเดีย

คุยเรื่องมีเดียวิกิ:Common.js

โค้ดแทนที่ชื่อบทความ & pickUpTextInternal()

โค้ดแทนที่ชื่อบทความ และ ฟังก์ชัน pickUpTextInternal นำมาจาก http://en.wikipedia.org/w/index.php?title=MediaWiki:Common.js&action=raw&ctype=text/javascript

-- bact' 07:51, 11 เมษายน 2007 (UTC)

Give search results even when page doesn't exist

 
Screenshot of the Earth test search, with this script adding links to Wikidata, Reasonator, Commons, and Wikipedia.

Hello, I propose to enable the tool created by Magnus Manske (creator of MediaWiki) to provide results from other languages and Commons (via Wikidata) when a page doesn't exist here: links are added to Special:Search and noarticletext. This helps to encourage translation and to make readers use your wiki more, because they can be sure to find something even if it's not local (rather than searching directly on the biggest wiki). The Italian and Polish Wikipedias, among others already enabled it by default.
Examples: [1] [2] [3]. More information: Magnus blog.
How to: just add the following line at the end of Common.js.

// Results from Wikidata // [[File:Wdsearch_script_screenshot.png]] if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Search' || ( mw.config.get( 'wgArticleId' ) === 0 && mw.config.get( 'wgCanonicalSpecialPageName' ) === false ) ) { importScriptURI("//en.wikipedia.org/w/index.php?title=MediaWiki:Wdsearch.js&action=raw&ctype=text/javascript"); } 

--Nemo 21:37, 12 ธันวาคม 2556 (ICT) (comments, translations and last instructions)

  --Nullzero (พูดคุย) 21:37, 12 ธันวาคม 2556 (ICT)

Announced JavaScript change for badges implementation

Hi! I want to let you know that in near future badges will be deployed on Wikidata and the Wikipedias. They help us with displaying the good and featured article icons next to the sitelinks and will replace the javascript hack which is used at the moment together with the Link GA and Link FA templates. To avoid an overlap where the current system and the new feature conflict, I will add a minor fix to your Common.js which adds the class names to the interwiki links. This is part of my task as a global edit interface editor for the Wikidata team. Thanks, Bene* (พูดคุย) 02:22, 12 สิงหาคม 2557 (ICT)

Thank you :) --Nullzero (พูดคุย) 02:35, 12 สิงหาคม 2557 (ICT)

แจ้งโค้ดที่ไม่ได้ใช้ที่ควรจะลบออก (1)

บรรทัด 55 ถึง 81 (linkFA)

ซึ่งก็คือ

/** Interwiki links to featured articles ***************************************  *  * Description: Highlights interwiki links to featured articles (or  * equivalents) by changing the bullet before the interwiki link  * into a star.  * Maintainers: [[User:R. Koot]]  */ function LinkFA() { if ( document.getElementById( "p-lang" ) ) { var InterwikiLinks = document.getElementById( "p-lang" ).getElementsByTagName( "li" ); for ( var i = 0; i < InterwikiLinks.length; i++ ) { var className = InterwikiLinks[i].className.match(/interwiki-[-\w]+/); if ( document.getElementById( className + '-fa' ) && InterwikiLinks[i].className.indexOf( 'badge-featuredarticle' ) === -1 ) { InterwikiLinks[i].className += " FA"; InterwikiLinks[i].title = "บทความนี้เป็นบทความคัดสรรในภาษาอื่น"; } else if ( document.getElementById( className + '-ga' ) && InterwikiLinks[i].className.indexOf( 'badge-goodarticle' ) === -1 ) { InterwikiLinks[i].className += " GA"; InterwikiLinks[i].title = "บทความนี้เป็นบทความคุณภาพในภาษาอื่น"; } } } } mw.hook( 'wikipage.content' ).add( LinkFA ); 

เนื่องจาก

  1. มี wikidata แทนแล้ว
  2. ในการเรียกโค้ดนี้ ต้องใช้ class ซึ่งเดิมสร้างขึ้นมาผ่าน {{Link GA}} และ {{Link FA}} แต่ปัจจุบันไม่มีทั้งสองแม่แบบแล้วทำให้ไม่ได้ใช้งาน
  3. ทดสอบด้วยการเปิด ?safemode=1 แล้วไม่พบผลกระทบที่เกิดจากการที่โค้ดนี้หายไป

บรรทัด 286 ถึง 290

ซึ่งก็คือ

/* Fixes for Windows XP font rendering */ if (navigator.appVersion.search(/windows nt 5/i) != -1) { mw.util.addCSS('.IPA {font-family: "Lucida Sans Unicode", "Arial Unicode MS";} ' + '.Unicode {font-family: "Arial Unicode MS", "Lucida Sans Unicode";}'); } 

เนื่องจาก Windows XP ไม่มีคนใช้แล้ว (หรือมีใช้ก็น้อยมาก ๆ) จึงคิดว่าถึงเวลาสมควรที่จะยกเลิก

บรรทัด 500 ถึง 507

ซึ่งก็คือ

/**  * Description: Stay on the secure server as much as possible  * Maintainers: [[User:TheDJ]]  */ if ( document.location && document.location.protocol === 'https:' ) { /* New secure servers */ mw.loader.load("//en.wikipedia.org/w/index.php?title=MediaWiki:Common.js/secure new.js&action=raw&ctype=text/javascript"); } 

เนื่องจากไม่มีแล้ว

Bebiezaza (คุย) 22:54, 18 ตุลาคม 2565 (+07)Reply[ตอบกลับ]

  ขอบคุณมากครับ --Geonuch (คุย) 22:50, 20 ตุลาคม 2565 (+07)Reply[ตอบกลับ]

แจ้งโค้ดไม่ได้ใช้ที่สมควรจะลบออก (2) : บรรทัดที่ 55 ถึง 198 (Caractères spéciaux/Special Characters/Charinsert ยุคเก่า)

ซึ่งก็คือ

/* Caractères spéciaux ------------------- Ajouter un menu pour choisir des sous-ensembles de caractères spéciaux. Ecrit par Zelda, voir sur [[Utilisateur:Zelda/Edittools.js]]. Remplace l'ancienne fonction par une variante plus rapide. */ /**  * Ajoute un menu déroulant permettant de choisir un jeu de caractères spéciaux  * Les caractères spéciaux sont définis dans Mediawiki:Edittools  */ function addCharSubsetMenu() { var specialchars = document.getElementById('specialcharsets'); if (!specialchars) return; // Construction du menu de selection var charSubsetSelect = document.createElement("select"); charSubsetSelect.setAttribute("style", "display:inline"); charSubsetSelect.onchange = function () { chooseCharSubset(this.selectedIndex); }; . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . /**  * Permet d'ajouter d'un jeu de caractères spéciaux dans le menu déroulant  * paramètres :  * - nom du jeu de caractères  * - caractères spéciaux  * exemple d'utilisation : addSpecialCharset("Français", "â ê î ô û");  */ function addSpecialCharset(title, chars) { addSpecialCharsetHTML(title, "<span>" + chars + "</span>"); } 

เนื่องจาก

  1. ในปัจจุบัน MediaWiki:Edittools ได้มีการปรับปรุงใหม่ ทำให้โค้ดดังกล่าวไม่สามารถจับ HTMLElement ที่ต้องการได้ โค้ดจึงหยุดทำงานตั้งแต่เริ่มแรก (หยุดที่บรรทัด 70)
  2. ถึงจะมีการปรับปรุง MediaWiki:Edittools แต่จากที่ตรวจสอบดูก็เหมือนว่าไม่ได้มีการใช้งาน เพราะมีแกเจ็ต MediaWiki:Gadget-charinsert เข้ามาทำหน้าที่แทนไปแล้ว ยิ่งทำให้โค้ดนี้ดูไร้บทบาทไปใหญ่

ทั้งนี้ แจ้งลบเพื่อลดจำนวนองค์ประกอบที่ต้องโหลดในทุกหน้าเช่นเคยครับ --Bebiezaza (คุย) 23:28, 21 ตุลาคม 2565 (+07)Reply[ตอบกลับ]

  --Geonuch (คุย) 12:39, 22 ตุลาคม 2565 (+07)Reply[ตอบกลับ]
กลับไปที่หน้า "Common.js"

ยเร, องม, เด, ยว, common, เน, อหา, โค, ดแทนท, อบทความ, pickuptextinternal, give, search, results, even, when, page, doesn, exist, announced, javascript, change, badges, implementation, แจ, งโค, ดท, ไม, ได, ใช, ควรจะลบออก, บรรท, linkfa, บรรท, บรรท, แจ, งโค, ดไม. enuxha 1 okhdaethnthichuxbthkhwam amp pickUpTextInternal 2 Give search results even when page doesn t exist 3 Announced JavaScript change for badges implementation 4 aecngokhdthiimidichthikhwrcalbxxk 1 4 1 brrthd 55 thung 81 linkFA 4 2 brrthd 286 thung 290 4 3 brrthd 500 thung 507 5 aecngokhdimidichthismkhwrcalbxxk 2 brrthdthi 55 thung 198 Caracteres speciaux Special Characters Charinsert yukheka okhdaethnthichuxbthkhwam amp pickUpTextInternal aekikhokhdaethnthichuxbthkhwam aela fngkchn pickUpTextInternal namacak http en wikipedia org w index php title MediaWiki Common js amp action raw amp ctype text javascript bact 07 51 11 emsayn 2007 UTC Give search results even when page doesn t exist aekikh Screenshot of the Earth test search with this script adding links to Wikidata Reasonator Commons and Wikipedia Hello I propose to enable the tool created by Magnus Manske creator of MediaWiki to provide results from other languages and Commons via Wikidata when a page doesn t exist here links are added to Special Search and noarticletext This helps to encourage translation and to make readers use your wiki more because they can be sure to find something even if it s not local rather than searching directly on the biggest wiki The Italian and Polish Wikipedias among others already enabled it by default Examples 1 2 3 More information Magnus blog How to just add the following line at the end of Common js 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 importScriptURI en wikipedia org w index php title MediaWiki Wdsearch js amp action raw amp ctype text javascript Nemo 21 37 12 thnwakhm 2556 ICT comments translations and last instructions Nullzero phudkhuy 21 37 12 thnwakhm 2556 ICT dd dd Announced JavaScript change for badges implementation aekikhHi I want to let you know that in near future badges will be deployed on Wikidata and the Wikipedias They help us with displaying the good and featured article icons next to the sitelinks and will replace the javascript hack which is used at the moment together with the Link GA and Link FA templates To avoid an overlap where the current system and the new feature conflict I will add a minor fix to your Common js which adds the class names to the interwiki links This is part of my task as a global edit interface editor for the Wikidata team Thanks Bene phudkhuy 02 22 12 singhakhm 2557 ICT Thank you Nullzero phudkhuy 02 35 12 singhakhm 2557 ICT dd aecngokhdthiimidichthikhwrcalbxxk 1 aekikh khwamkhidehnlasud 3 eduxnthiphanma 2 khwamkhidehn 2 khninkarxphipraybrrthd 55 thung 81 linkFA aekikh sungkkhux Interwiki links to featured articles Description Highlights interwiki links to featured articles or equivalents by changing the bullet before the interwiki link into a star Maintainers User R Koot function LinkFA if document getElementById p lang var InterwikiLinks document getElementById p lang getElementsByTagName li for var i 0 i lt InterwikiLinks length i var className InterwikiLinks i className match interwiki w if document getElementById className fa amp amp InterwikiLinks i className indexOf badge featuredarticle 1 InterwikiLinks i className FA InterwikiLinks i title bthkhwamniepnbthkhwamkhdsrrinphasaxun else if document getElementById className ga amp amp InterwikiLinks i className indexOf badge goodarticle 1 InterwikiLinks i className GA InterwikiLinks i title bthkhwamniepnbthkhwamkhunphaphinphasaxun mw hook wikipage content add LinkFA enuxngcak mi wikidata aethnaelw inkareriykokhdni txngich class sungedimsrangkhunmaphan Link GA aela Link FA aetpccubnimmithngsxngaemaebbaelwthaihimidichngan thdsxbdwykarepid safemode 1 aelwimphbphlkrathbthiekidcakkarthiokhdnihayipbrrthd 286 thung 290 aekikh sungkkhux Fixes for Windows XP font rendering if navigator appVersion search windows nt 5 i 1 mw util addCSS IPA font family Lucida Sans Unicode Arial Unicode MS Unicode font family Arial Unicode MS Lucida Sans Unicode enuxngcak Windows XP immikhnichaelw hruxmiichknxymak cungkhidwathungewlasmkhwrthicaykelik brrthd 500 thung 507 aekikh sungkkhux Description Stay on the secure server as much as possible Maintainers User TheDJ if document location amp amp document location protocol https New secure servers mw loader load en wikipedia org w index php title MediaWiki Common js secure new js amp action raw amp ctype text javascript enuxngcakimmiaelwBebiezaza khuy 22 54 18 tulakhm 2565 07 Reply txbklb khxbkhunmakkhrb Geonuch khuy 22 50 20 tulakhm 2565 07 Reply txbklb dd aecngokhdimidichthismkhwrcalbxxk 2 brrthdthi 55 thung 198 Caracteres speciaux Special Characters Charinsert yukheka aekikh khwamkhidehnlasud 2 eduxnthiphanma 2 khwamkhidehn 2 khninkarxphipraysungkkhux Caracteres speciaux Ajouter un menu pour choisir des sous ensembles de caracteres speciaux Ecrit par Zelda voir sur Utilisateur Zelda Edittools js Remplace l ancienne fonction par une variante plus rapide Ajoute un menu deroulant permettant de choisir un jeu de caracteres speciaux Les caracteres speciaux sont definis dans Mediawiki Edittools function addCharSubsetMenu var specialchars document getElementById specialcharsets if specialchars return Construction du menu de selection var charSubsetSelect document createElement select charSubsetSelect setAttribute style display inline charSubsetSelect onchange function chooseCharSubset this selectedIndex Permet d ajouter d un jeu de caracteres speciaux dans le menu deroulant parametres nom du jeu de caracteres caracteres speciaux exemple d utilisation addSpecialCharset Francais a e i o u function addSpecialCharset title chars addSpecialCharsetHTML title lt span gt chars lt span gt enuxngcak inpccubn MediaWiki Edittools idmikarprbprungihm thaihokhddngklawimsamarthcb HTMLElement thitxngkarid okhdcunghyudthangantngaeterimaerk hyudthibrrthd 70 thungcamikarprbprung MediaWiki Edittools aetcakthitrwcsxbdukehmuxnwaimidmikarichngan ephraamiaekect MediaWiki Gadget charinsert ekhamathahnathiaethnipaelw yingthaihokhdniduirbthbathipihythngni aecnglbephuxldcanwnxngkhprakxbthitxngohldinthukhnaechnekhykhrb Bebiezaza khuy 23 28 21 tulakhm 2565 07 Reply txbklb Geonuch khuy 12 39 22 tulakhm 2565 07 Reply txbklb dd ephimhwkhx ekhathungcak https th wikipedia org w index php title khuyeruxngmiediywiki Common js amp oldid 10362175 klbipthihna Common js, wikipedia, วิกิ หนังสือ, หนังสือ, ห้องสมุด,

บทความ

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