MediaWiki:Common.js: Różnice pomiędzy wersjami

Z Altaron Wiki
Nie podano opisu zmian
Nie podano opisu zmian
Linia 4: Linia 4:




var linksData = [
var linksData = [ { text: 'mainpage', icon: 'fas fa-home' }, { text: 'Poradniki', icon: 'fas fa-book' }, { text: 'Przedmioty', icon: 'fas fa-cube' }, { text: 'Potwory', icon: 'fas fa-dragon' }, { text: 'Czary', icon: 'fas fa-magic' }, { text: 'Transport', icon: 'fas fa-train' }, { text: 'Questy', icon: 'fas fa-map' }, { text: 'Żywioły', icon: 'fas fa-tint' }, { text: 'NPC', icon: 'fas fa-user' }, { text: 'Stroje', icon: 'fas fa-tshirt' }, { text: 'Miasta i osady', icon: 'fas fa-building' }, { text: 'Pozyskiwanie', icon: 'fas fa-tree' }, { text: 'Przepisy', icon: 'fas fa-scroll' }, { text: 'TODO', icon: 'fas fa-tasks' }, { text: 'Szablony', icon: 'fas fa-file-code' }, { text: 'Losowa strona', icon: 'fas fa-random' }, { text: 'Ostatnie zmiany', icon: 'fas fa-history' },];
  { text: ' mainpage', icon: 'fas fa-home' },
  { text: ' Poradniki', icon: 'fas fa-book' },
  { text: ' Przedmioty', icon: 'fas fa-cube' },
  { text: ' Potwory', icon: 'fas fa-dragon' },
  { text: ' Czary', icon: 'fas fa-magic' },
  { text: ' Transport', icon: 'fas fa-train' },
  { text: ' Questy', icon: 'fas fa-map' },
  { text: ' Żywioły', icon: 'fas fa-tint' },
  { text: ' NPC', icon: 'fas fa-user' },
  { text: ' Stroje', icon: 'fas fa-tshirt' },
  { text: ' Miasta i osady', icon: 'fas fa-building' },
  { text: ' Pozyskiwanie', icon: 'fas fa-tree' },
  { text: ' Przepisy', icon: 'fas fa-scroll' },
  { text: ' TODO', icon: 'fas fa-tasks' },
  { text: ' Szablony', icon: 'fas fa-file-code' },
  { text: ' Losowa strona', icon: 'fas fa-random' },
  { text: ' Ostatnie zmiany', icon: 'fas fa-history' },
];


var links = document.querySelectorAll('#mw-panel ul li a');
var links = document.querySelectorAll('#mw-panel ul li a');
Linia 32: Linia 14:
    
    
   var iconName = linksData[i].icon;
   var iconName = linksData[i].icon;
   icon.className = iconName;
   icon.className = 'icon ' + iconName;
   link.innerHTML = '';
   link.innerHTML = '';
   link.appendChild(icon);
   link.appendChild(icon);
   link.appendChild(document.createTextNode(' ' + text));
   link.appendChild(document.createTextNode(text));
}
}

Wersja z 22:25, 16 lut 2023

/* Umieszczony tutaj kod JavaScript zostanie załadowany przez każdego użytkownika, podczas każdego ładowania strony. */

mw.loader.load("https://wiki.altaron.pl/custom/table-sorter/jquery.tablesorter.js");


var linksData = [  { text: 'mainpage', icon: 'fas fa-home' },  { text: 'Poradniki', icon: 'fas fa-book' },  { text: 'Przedmioty', icon: 'fas fa-cube' },  { text: 'Potwory', icon: 'fas fa-dragon' },  { text: 'Czary', icon: 'fas fa-magic' },  { text: 'Transport', icon: 'fas fa-train' },  { text: 'Questy', icon: 'fas fa-map' },  { text: 'Żywioły', icon: 'fas fa-tint' },  { text: 'NPC', icon: 'fas fa-user' },  { text: 'Stroje', icon: 'fas fa-tshirt' },  { text: 'Miasta i osady', icon: 'fas fa-building' },  { text: 'Pozyskiwanie', icon: 'fas fa-tree' },  { text: 'Przepisy', icon: 'fas fa-scroll' },  { text: 'TODO', icon: 'fas fa-tasks' },  { text: 'Szablony', icon: 'fas fa-file-code' },  { text: 'Losowa strona', icon: 'fas fa-random' },  { text: 'Ostatnie zmiany', icon: 'fas fa-history' },];

var links = document.querySelectorAll('#mw-panel ul li a');

for (var i = 0; i < links.length; i++) {
  var link = links[i];
  var text = link.innerText;
  var icon = document.createElement('span');
  
  var iconName = linksData[i].icon;
  icon.className = 'icon ' + iconName;
  link.innerHTML = '';
  link.appendChild(icon);
  link.appendChild(document.createTextNode(text));
}