MediaViki müzakirəsi:Common.js Haqqinda Melumat - Vikipedia

MediaViki müzakirəsi:Common.js Haqqinda Melumat - Vikipedia


Siz Geniş ensklopediyada istədiyinizi tapa bilərsiniz

MediaViki müzakirəsi:Common.js

Ən son rəy:1 il öncə, ABreault (WMF) tərəfindən "Prepare for T314318" mövzusunda

Cekli, xahiş edirəm bunu səhifəyə əlavə edəsiniz:

var mpTitle = "Halaman Utama";
 var isMainPage = (document.title.substr(0, mpTitle.length) == mpTitle)
 var isDiff = (document.location.search && (
     document.location.search.indexOf("diff=") != -1 ||
     document.location.search.indexOf("oldid=") != -1 ||
     document.location.search.indexOf("action=history") != -1
 ));
 if ( isMainPage && !isDiff && (wgCanonicalNamespace != 'Special') ) 
 {
     document.write('<style type="text/css"> #siteSub, #contentSub, h1.firstHeading { display: none!important; } #content, #content div.thumb, #p-cactions li a, #p-cactions li a:hover, #p-cactions li.selected a { background: #fff!important; } </style>');
     var mpSmallEnabled;
     var mpMinWidth = 700;
     function mainPageTransform()
     {
          var mpContentEl = document.getElementById("bodyContent");
          var mpBrowseEl = document.getElementById("EnWpMpBrowse");
          var mpContainEl = document.getElementById("EnWpMpBrowseContainer");
          var mpMarginEl = document.getElementById("EnWpMpMargin");
          var mpEl = document.getElementById("EnWpMainPage");
          if (!mpContentEl || !mpBrowseEl || !mpContainEl || !mpMarginEl || !mpEl)
               return;
          if (!mpSmallEnabled && mpContentEl.offsetWidth < mpMinWidth)
          {
               mpContainEl.insertBefore(mpBrowseEl, mpContainEl.firstChild);
               mpBrowseEl.className = "EnWpMpBrowseBottom";
               mpMarginEl.style.marginRight = 0;
               mpSmallEnabled = true;
          }
          else if (mpSmallEnabled && mpContentEl.offsetWidth > mpMinWidth)
          {
               mpEl.insertBefore(mpBrowseEl, mpEl.firstChild);
               mpBrowseEl.className = "EnWpMpBrowseRight";
               mpMarginEl.style.marginRight = "13.8em";
               mpSmallEnabled = false;
          }
     }
     var onloadFuncts = [ mainPageTransform ];
     if (window.addEventListener) 
          window.addEventListener("resize", mainPageTransform, false);
     else if (window.attachEvent) 
          window.attachEvent("onresize", mainPageTransform);
 }
 function mainpg() {
     if ((isMainPage || /[\/=:]Halaman_Utama/.test(document.location)) && document.getElementById('ca-nstab-main')) {
          document.getElementById('ca-nstab-main').firstChild.innerHTML = '<span>Utama<\/span>';
     }   
 }
 addOnloadHook(mainpg);
 
/**
== LowcaseTitle ==
 
 Judul dengan [[Template:Judul|huruf pertama kecil]]. */
 
 if (document.URL.indexOf("=edit") > 0 || document.URL.indexOf("=submit") > 0) {var noJS;}
 else {
      document.write('<style type="text/css">#title-override {display: none; speak: none;}<\/style>');
      function pTitle() {
           if (document.getElementById("title-override")) {
                var pTitle = document.getElementById("pTitle").innerHTML;
                document.getElementsByTagName("h1")[0].innerHTML = pTitle;
           }
      }
      hookEvent("load", pTitle);
 }

Vago ms 06:43, 5 oktyabr 2011 (UTC)Cavabla

HəY Əlavə olundu. --►Safir yüzüklü Ceklimesaj 06:49, 5 oktyabr 2011 (UTC)Cavabla


Cekli bunu da zəhmət olmasa, yerləşdirərsiniz, deyəsən tapmışam :)


var hasClass = (function (){
 var reCache = {}
 return function (element, className){
   return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className)
  }
})()
 
function collapsibleTables(){
 var Table, HRow,  HCell, btn, a, tblIdx = 0, colTables = []
 var allTables = document.getElementsByTagName('table')
 for (var i=0; Table = allTables[i]; i++){
   if (!hasClass(Table, 'collapsible')) continue
   if (!(HRow=Table.rows[0])) continue
   if (!(HCell=HRow.getElementsByTagName('th')[0])) continue
   Table.id = 'collapsibleTable' + tblIdx
   btn = document.createElement('span')
   btn.style.cssText = 'float:right; font-weight:normal; font-size:smaller'
   a = document.createElement('a')
   a.id = 'collapseButton' + tblIdx
   a.href = 'javascript:collapseTable(' + tblIdx + ');'
   a.style.color = HCell.style.color
   a.appendChild(document.createTextNode(NavigationBarHide))
   btn.appendChild(a)
   HCell.insertBefore(btn, HCell.childNodes[0])
   colTables[tblIdx++] = Table
 }
 for (var i=0; i < tblIdx; i++)
   if ((tblIdx > NavigationBarShowDefault && hasClass(colTables[i], 'autocollapse')) || hasClass(colTables[i], 'collapsed'))
     collapseTable(i)
}
 
function collapseTable (idx){
 var Table = document.getElementById('collapsibleTable' + idx)
 var btn = document.getElementById('collapseButton' + idx)
 if (!Table || !btn) return false
 var Rows = Table.rows
 var isShown = (btn.firstChild.data == NavigationBarHide)
 btn.firstChild.data = isShown ?  NavigationBarShow : NavigationBarHide
 var disp = isShown ? 'none' : Rows[0].style.display
 for (var i=1; i < Rows.length; i++)
    Rows[i].style.display = disp
}
 
function collapsibleDivs(){
 var navIdx = 0, colNavs = [], i, NavFrame
 var divs = document.getElementById('content').getElementsByTagName('div')
 for (i=0; NavFrame = divs[i]; i++) {
   if (!hasClass(NavFrame, 'NavFrame')) continue
   NavFrame.id = 'NavFrame' + navIdx
   var a = document.createElement('a')
   a.className = 'NavToggle'
   a.id = 'NavToggle' + navIdx
   a.href = 'javascript:collapseDiv(' + navIdx + ');'
   a.appendChild(document.createTextNode(NavigationBarHide))
   for (var j=0; j < NavFrame.childNodes.length; j++)
     if (hasClass(NavFrame.childNodes[j], 'NavHead'))
       NavFrame.childNodes[j].appendChild(a)
   colNavs[navIdx++] = NavFrame
 }
 for (i=0; i < navIdx; i++)
  if ((navIdx > NavigationBarShowDefault && !hasClass(colNavs[i], 'expanded')) || hasClass(colNavs[i], 'collapsed'))
     collapseDiv(i)
}
 
function collapseDiv(idx) {
 var div = document.getElementById('NavFrame' + idx)
 var btn = document.getElementById('NavToggle' + idx)
 if (!div || !btn) return false
 var isShown = (btn.firstChild.data == NavigationBarHide)
 btn.firstChild.data = isShown ? NavigationBarShow : NavigationBarHide
 var disp = isShown ? 'none' : 'block'
 for (var child = div.firstChild;  child != null;  child = child.nextSibling)
   if (hasClass(child, 'NavPic') || hasClass(child, 'NavContent'))
      child.style.display = disp
}

Vago ms 15:33, 7 oktyabr 2011 (UTC)Cavabla

HəY Əlavə olundu. --►Safir yüzüklü Ceklimesaj 07:01, 8 oktyabr 2011 (UTC)Cavabla


LinkFA redaktə

Həmin hissəni bu cür yazıb yoxlayın:

function LinkFA() 
{
    if ( document.getElementById( "p-lang" ) ) {
        var InterwikiLinks = document.getElementById( "p-lang" ).getElementsByTagName( "li" );
 
        for ( var i = 0; i < InterwikiLinks.length; i++ ) {
            if ( document.getElementById( InterwikiLinks[i].className + "-fa" ) ) {
                InterwikiLinks[i].className += " FA"
                InterwikiLinks[i].title = "Bu başqa dildəki seçilmiş məqalədir.";
            } else if ( document.getElementById( InterwikiLinks[i].className + "-ga" ) ) {
                InterwikiLinks[i].className += " GA"
                InterwikiLinks[i].title = "Bu başqa dildəki yaxşı məqalədir.";
            } else if ( document.getElementById( InterwikiLinks[i].className + "-fl" ) ) {
                InterwikiLinks[i].className += " FL"
                InterwikiLinks[i].title = "Bu başqa dildəki seçilmiş siyahı və ya portaldır.";
            }
        }
    }
} 
 addOnloadHook( LinkFA );

Vago ms 13:46, 8 iyun 2012 (UTC)Cavabla

Give search results even when page doesn't exist redaktə

 
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 11:02, 12 dekabr 2013 (UTC) (comments, translations and last instructions)Cavabla

Hə Y OK. --►Cekli829 09:14, 12 dekabr 2013 (UTC)Cavabla
Nice! Sorry for the wrong pre above, you need to remove the lines you added to the common.js after the last }. --Nemo bis (talk) 06:26, 13 dekabr 2013 (UTC)Cavabla
Hə Y OK. Thanks for the information.   --►Cekli829 08:33, 13 dekabr 2013 (UTC)Cavabla
Great, it works. :) --Nemo bis (talk) 10:41, 14 dekabr 2013 (UTC)Cavabla

Announced JavaScript change for badges implementation redaktə

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* (talk) 20:24, 18 avqust 2014 (UTC)Cavabla

importMW is not defined redaktə

I'm getting this error due to the importMW call introduced by Wertuose on 16 August 2014. Was that code copied from somewhere else? Helder 00:16, 9 iyul 2015 (UTC)Cavabla

Prepare for T314318 redaktə

Please make changes like the following,

https://ca.wikipedia.org/wiki/Especial:ComparePages?page1=MediaWiki%3ACommon.js&rev1=24309161&page2=Usuari%3AArlolra%2Fsandbox%2FMediaWiki%3ACommon.js&rev2=31054319&action=&unhide=

https://ca.wikipedia.org/wiki/Especial:ComparePages?page1=MediaWiki%3ACommon.js&rev1=31055727&page2=Usuari%3AArlolra%2Fsandbox%2FMediaWiki%3ACommon.js&rev2=31058458&action=&unhide=

For more information, see mw:Parsoid/Parser_Unification/Media_structure/FAQ

Thanks, Arlolra (müzakirə) 15:37, 31 yanvar 2023 (UTC)Cavabla

Done in Special:Diff/6899438 ABreault (WMF) (müzakirə) 23:01, 23 fevral 2023 (UTC)Cavabla
"Common.js" səhifəsinə qayıt.

Saytda 86 nəfər
Top.Mail.Ru
©Tatli.Biz 2010-2024