User:Annabel/Interwiki.js

From Wiktionary, the free dictionary
Jump to navigation Jump to search

Note: You may have to bypass your browser’s cache to see the changes. In addition, after saving a sitewide CSS file such as MediaWiki:Common.css, it will take 5-10 minutes before the changes take effect, even if you clear your cache.

  • Mozilla / Firefox / Safari: hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (Command-R on a Macintosh);
  • Konqueror and Chrome: click Reload or press F5;
  • Opera: clear the cache in Tools → Preferences;
  • Internet Explorer: hold Ctrl while clicking Refresh, or press Ctrl-F5.


/*
%InterwikiSuggest: a tool for listing interwikilinks for wiktionary.
%   All pages with the same name, as well as interwikilinks on these
%   pages are collected and listed.
%
%C 2008-2010, Annabel
%
%This is free software: you can redistribute it and/or modify
%it under the terms of the GNU General Public License as published by
%the Free Software Foundation, either version 3 of the License, or
%(at your option) any later version.
%
%InterwikiSuggest is distributed in the hope that it will be useful,
%but WITHOUT ANY WARRANTY; without even the implied warranty of
%MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%GNU General Public License for more details.
%
%You should have received a copy of the GNU General Public License
%along with this interwiki tool.  If not, see <http://www.gnu.org/licenses/>.
*/
//<pre>
var buttonIWText = "Interwiki list";

function GetIW()
{
    var url2 = "http://tools.wikimedia.de/~annabel/InterwikiOnWikt.php?Lang=en&Article=";
    url2 += wgArticleId;
    var IWWindow = window.open (url2);
}

function AddInterwikiBtn()
{
    var navigationBox = document.getElementById('p-navigation');
    var revBox = document.createElement("div");
    var revBox = navigationBox.parentNode.insertBefore(document.createElement("div"),navigationBox);
    revBox.id = "p-rev";
    revBox.className = "portlet";
    revContent = revBox.appendChild(document.createElement("div"));
    revContent.id = "recRevContent";
    revContent.className = "pBody";
    revContent.style.padding = "0 .3em .3em .3em";
    revContent.style.lineHeight = "1.2em";
    revContent.style.fontFamily = "Verdana, sans-serif";
    var divNode = revContent.appendChild(document.createElement("div"));
    divNode.id = "showButton";
    divNode.style.textAlign = "center";   
    var button = divNode.appendChild(document.createElement("button"));
    button.innerHTML = buttonIWText;
    button.onclick = GetIW;
    button.style.fontSize = "90%";
    button.style.marginTop = ".3em";
    button.style.padding = "0";
}

if (wgNamespaceNumber >= 0) addOnloadHook(AddInterwikiBtn);

// </pre>