Melding:Common.js
Útlit
Athugaðu: Eftir útgáfu kann að vera að þú þurfir að komast hjá skyndiminni vafrans þíns til að sjá breytingarnar.
- Firefox / Safari: Haltu Shift samtímis og þú smellir á Endurhlaða (Reload), eða ýttu á annaðhvort Ctrl-F5 eða Ctrl-R (⌘-R á Mac)
- Google Chrome: Ýttu á Ctrl-Shift-R (⌘-Shift-R á Mac)
- Internet Explorer / Edge: Haltu Ctrl samtímis og þú smellir á Endurnýja (Refresh), eða ýttu á Ctrl-F5
- Opera: Farðu í Verkfæri (Tools) → Stillingar (Preferences) og svo Friðhelgi og öryggi (Privacy & security) → Hreinsa vafragögn (Clear browsing data) → Myndir og skrár í skyndiminni (Chached images and files)
/* Allt JavaScript sem sett er hér mun virka í hvert skipti sem að síða hleðst. */
url = document.URL;
//********öll tungumál, http://en.wikipedia.org/wiki/MediaWiki:Common.js ********************
function mainPageAppendCompleteListLink() {
try {
var node = document.getElementById( "p-lang" )
.getElementsByTagName('div')[0]
.getElementsByTagName('ul')[0];
var aNode = document.createElement( 'a' );
var liNode = document.createElement( 'li' );
aNode.appendChild( document.createTextNode( 'Öll tungumál' ) );
aNode.setAttribute( 'href' , '//meta.wikimedia.org/wiki/List_of_Wiktionaries' );
liNode.appendChild( aNode );
liNode.className = 'interwiki-completelist';
liNode.style.fontWeight = 'bold';
node.appendChild( liNode );
} catch(e) {
// lets just ignore what's happened
return;
}
}
if ( mw.config.get('wgTitle') == 'Forsíða' && mw.config.get('wgNamespaceNumber') == 4 ) {
$(document).ready( mainPageAppendCompleteListLink );
}
//********öll tungumál ********************
/* Hlaða inn skrám inn á Commons */
function makeDownloadLink() {
try {
var node = document.getElementById( "p-tb" )
.getElementsByTagName('div')[0]
.getElementsByTagName('ul')[0];
var aNode = document.createElement( 'a' );
var liNode = document.createElement( 'li' );
aNode.appendChild( document.createTextNode( 'Hlaða inn skrá' ) );
aNode.setAttribute( 'href' , '//commons.wikimedia.org/wiki/Special:UploadWizard?lang=is' );
aNode.setAttribute( 'title' , 'Hlaða skrám inn á Commons til notkunar á Wikiorðabók [u]' );
aNode.setAttribute( 'accesskey' , 'u' );
liNode.appendChild( aNode );
node.appendChild( liNode );
} catch(e) {
return;
}
}
$( makeDownloadLink );
/*
==Subset menue of special characters==
*/
/* add menu for selecting subsets of secial characters */
/***** must match MediaWiki:Edittools *****/
function addCharSubsetMenu() {
var specialchars = document.getElementById('specialchars');
if (specialchars) {
var menu = "<select id=\"charSubsetControl\" style=\"display:inline\" onChange=\"chooseCharSubset(selectedIndex)\">";
menu += "<option>IPA</option>";
menu += "<option>AHD</option>";
menu += "<option>Eistneska</option>";
menu += "<option>Engilsaxneska</option>";
menu += "<option>Esperantó</option>";
menu += "<option>Franska</option>";
menu += "<option>Galíanska</option>";
menu += "<option>Gotneska</option>";
menu += "<option>Gríska</option>";
menu += "<option>Hawaiiíska</option>";
menu += "<option>Íslenska</option>";
menu += "<option>Ítalska</option>";
menu += "<option>Jiddíska</option>";
menu += "<option>Katalónska</option>";
menu += "<option>Króatíska</option>";
menu += "<option>Kyrillískur</option>";
menu += "<option>Latína/Rómverji</option>";
menu += "<option>Maltesíska</option>";
menu += "<option>Pinyin</option>";
menu += "<option>Portúgalska</option>";
menu += "<option>Romansh</option>";
menu += "<option>Rúmenska</option>";
menu += "<option>Scaníanska</option>";
menu += "<option>Serbneska</option>";
menu += "<option>Tékkneska</option>";
menu += "<option>Víetnamíska</option>";
menu += "<option>Spænska</option>";
menu += "<option>Þýska</option>";
menu += "</select>";
specialchars.innerHTML = menu + specialchars.innerHTML;
/* default subset from cookie */
var s = parseInt( $.cookie('edittoolscharsubset') );
if ( isNaN(s) ) s = 0;
/* update dropdown control to value of cookie */
document.getElementById('charSubsetControl').selectedIndex = s;
/* display the subset indicated by the cookie */
chooseCharSubset( s );
}
}
/* select subsection of special characters */
function chooseCharSubset(s) {
var l = document.getElementById('specialchars').getElementsByTagName('p');
for (var i = 0; i < l.length ; i++) {
l[i].style.display = i == s ? 'inline' : 'none';
l[i].style.visibility = i == s ? 'visible' : 'hidden';
}
$.cookie('edittoolscharsubset', s);
}
/* do any Wiktionary-specific customizations */
function customizeWiktionary() {
addCharSubsetMenu();
}
$(customizeWiktionary);
/*
==Dynamic Navigation Bars (experimental)==
*/
// ============================================================
// BEGIN Dynamic Navigation Bars
// NEEDS Enable multiple onload functions
// set up the words in your language
var NavigationBarHide = 'fela ▲';
var NavigationBarShow = 'sýna ▼';
if (typeof NavigationBarShowDefault == 'undefined' ) {
var NavigationBarShowDefault = 1;
}
// adds show/hide-button to navigation bars
$(document).ready(function() {
// shows and hides content and picture (if available) of navigation bars
// Parameters:
// indexNavigationBar: the index of navigation bar to be toggled
function toggleNavigationBar(indexNavigationBar)
{
var NavToggle = document.getElementById("NavToggle" + indexNavigationBar);
var NavFrame = document.getElementById("NavFrame" + indexNavigationBar);
if (!NavFrame || !NavToggle) {
return false;
}
// if shown now
if (NavToggle.firstChild.data == NavigationBarHide) {
for (
var NavChild = NavFrame.firstChild;
NavChild != null;
NavChild = NavChild.nextSibling
) {
if (NavChild.className == 'NavPic') {
NavChild.style.display = 'none';
}
if (NavChild.className == 'NavContent') {
NavChild.style.display = 'none';
}
if (NavChild.className == 'NavToggle') {
NavChild.firstChild.data = NavigationBarShow;
}
}
// if hidden now
} else if (NavToggle.firstChild.data == NavigationBarShow) {
for (
var NavChild = NavFrame.firstChild;
NavChild != null;
NavChild = NavChild.nextSibling
) {
if (NavChild.className == 'NavPic') {
NavChild.style.display = 'block';
}
if (NavChild.className == 'NavContent') {
NavChild.style.display = 'block';
}
if (NavChild.className == 'NavToggle') {
NavChild.firstChild.data = NavigationBarHide;
}
}
}
}
function toggleNavigationBarFunction(indexNavigationBar) {
return function() {
toggleNavigationBar(indexNavigationBar);
return false;
};
}
var indexNavigationBar = 0;
// iterate over all < div >-elements
var divs = document.getElementsByTagName("div");
for (var i=0; i<divs.length; i++) {
var NavFrame = divs[i];
// if found a navigation bar
if (NavFrame.className == "NavFrame") {
indexNavigationBar++;
var NavToggle = document.createElement("a");
NavToggle.className = 'NavToggle';
NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar);
NavToggle.setAttribute('href', '#');
NavToggle.onclick = toggleNavigationBarFunction(indexNavigationBar);
var NavToggleText = document.createTextNode(NavigationBarHide);
NavToggle.appendChild(NavToggleText);
// add NavToggle-Button as first div-element
// in < div class="NavFrame" >
NavFrame.insertBefore(
NavToggle,
NavFrame.firstChild
);
NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);
}
}
});
// END Dynamic Navigation Bars
// ============================================================
/*
==remove title from main page==
*/
// Überschrift der Hauptseite nicht mehr anzeigen (aus w:en:MediaWiki:Monobook.js)
var isDiff = (document.location.search && (document.location.search.indexOf("diff=") != -1 || document.location.search.indexOf("oldid=") != -1));
if (mw.config.get('wgIsMainPage') && !isDiff) {
mw.util.addCSS('#lastmod, #siteSub, #contentSub, h1.firstHeading { display: none !important; }');
}
/*
==insert onlyifsystem.js==
*/
// onlyifsystem.js<pre>
if (document.URL.indexOf("Kerfissíða:") > 0 || document.URL.indexOf("Melding:") > 0 || document.URL.indexOf("=Kerfissíða") > 0 || document.URL.indexOf("=Melding") > 0) {
mw.loader.load('//is.wiktionary.org/w/index.php?title=Melding:Onlyifsystem.js&action=raw&ctype=text/javascript');
}
mw.loader.load('//is.wiktionary.org/w/index.php?title=Melding:Wikiorðabók-Stillingar.js&action=raw&ctype=text/javascript');
//------------------- end specialchars for search-------------------------
// Handle {{InterProject}}
importScript('MediaWiki:InterProject.js');
// sjá einnig (from de.wiktionary, by [[de:User:Melancholie]])
mw.util.addCSS('#showSeeAlso {display: none;}');
function showSeeAlso() {
if (mw.config.get('wgNamespaceNumber') == 0 && document.getElementById("showSeeAlso") && !document.getElementById("snid_sja_einnig") && url.indexOf("oldid=") < 0) {
document.getElementById("contentSub").style.margin = "0";
document.getElementById("contentSub").innerHTML += document.getElementById("showSeeAlso").innerHTML;
}
}
$(showSeeAlso);
// ----------------------------------------
// eftir [[de:User:Melancholie]]
// ----------------------------------------
var groupArray = '#'+mw.config.get('wgUserGroups');
if (groupArray.indexOf("sysop") > 0) {
mw.loader.load('//is.wiktionary.org/w/index.php?title=MediaWiki:If-sidebar-bug.js&action=raw&ctype=text/javascript');
}
//----------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------
// Sjálf-tilvísað frá ...
//frá [[en:MediaWiki:Common.js]] höfundur: [[:en:User:Connel MacKenzie]], hjálparmaður: [[:de:User:Melancholie]]