User:Dani/modern.js

From translatewiki.net
Jump to: navigation, search

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
$(function() {
  if (wgCanonicalSpecialPageName != "Translate") return;
  $('tr.def, tr.orig').each(function() {
    var alnk = $('td:first > a:nth-child(2)', $(this));
    var slnk = alnk.attr('href').match(/title=(MediaWiki:.*?)\/hu&/)[1]
    $('<a>')
      .attr('href', 'http://hu.wikipedia.org/wiki/' + slnk)
      .css('padding-left', '5px')
      .html('[hu]')
      .appendTo($('td:first', $(this)));
    $('<a>')
      .attr('href', '/wiki/' + slnk + '/hu-formal')
      .css('padding-left', '5px')
      .html('[formal]')
      .click(function() {
          return trlOpenJsEdit( slnk + "/hu-formal" );
      })
      .appendTo($('td:first', $(this)));
  })
});

$(function() {
  if (wgPageName.match(/^MediaWiki/) == null) return;
  var linkul = $('.mw-translate-nav-prev-next-list');
  if (linkul.length > 0) {
    $('<li>')
      .html('<a href="http://hu.wikipedia.org/wiki/' + wgPageName.match(/(.*?)\/hu$/)[1] + '">Az üzenet a huwikin</a>')
      .appendTo(linkul[0]);
  }
});