MediaWiki:Gadget-GirisDegistirme.js

Vikisöz, özgür söz dizini

Not: Yayımladıktan sonra değişiklikleri görmek için tarayıcınızın önbelleğini temizlemeniz gerekebilir.

  • Firefox / Safari: Shift tuşuna basılıyken Yeniden Yükle'ye tıklayın ya da Ctrl-F5 ya da Ctrl-R tıklayın (Mac için ⌘-R).
  • Google Chrome: Ctrl-Shift-R'ye basın. (Mac için ⌘-Shift-R)
  • Internet Explorer / Edge: Ctrl basılıyken Yenile'ye tıklayın ya da Ctrl-F5 yapın.
  • Opera: Ctrl-F5 tıklayın.
/*
source: http://hu.wikipedia.org/wiki/MediaWiki:Vector.js
== Ek bağlantılar ==
*/

function moveSectionEditLinks() {
   if (window.oldEditsectionLinks) return;
   var headings = mw.util.$content.find('h1,h2,h3,h4,h5,h6').find('span.mw-headline'),
       sectioneditlinks = mw.util.$content.find('h1,h2,h3,h4,h5,h6').find('span.editsection');
   /* add lead section edit link */
   var edit = $('#ca-edit');
   if (headings.length && !sectioneditlinks.length) return; // if sections are not editable, don't add
   else if (!headings.length) {
      // try to guess whether sections would be editable; don't add if
      // 1) article is protected or otherwise uneditable
      // 2) user is viewing page history, edit/move/delete interface, etc.
      // 3) user is viewing a special page
      // 4) user is viewing a diff, unless it's a diff to the current revision
      // 5) user is viewing a permalink to a revision, unless it's the current revision
      if (!edit.length || mw.config.get('wgAction') != 'view' || document.location.href.match('/wiki/Speci%C3%A1lis:')) return;
      var diffMatch = document.location.href.match(/diff=([^&]*)/),
          oldidMatch = document.location.href.match(/oldid=([^&]*)/);
      var diff = diffMatch ? diffMatch[1] : null,
          oldid = oldidMatch ? oldidMatch[1] : null;
      if (oldid && diff) {
        if (diff != mw.config.get('wgCurRevisionId') && !(diff == "prev" && oldid == mw.config.get('wgCurRevisionId'))) return;
      } else if (oldid) {
        if (oldid != mw.config.get('wgCurRevisionId')) return;
      }
      // covers most cases, "diff=next&oldid=<last before current>" is impossible to catch
   }

   var href = edit.find('a').attr('href') + "&section=0";
   if (headings.length) href += "&editintro=Template:Giriş değiştir"; // no need to show info about how to edit the whole page if there are no sections
   var edit0 = $('<span>').addClass('editsectionmoved');
      edit0.css({
         fontSize: 'x-small',
         fontWeight: 'normal',
         marginLeft: '0.5em',
         verticalAlign: 'baseline',
         lineHeight: '1em'
      });
   edit0.html('[<a href="' + href + '">değiştir</a>]');
   $('h1.firstHeading').append(' ').append(edit0);
}
$(moveSectionEditLinks);