Widget:TriviaText: Difference between revisions

From Unforgotten Realms Wiki
Jump to navigationJump to search
imported>Pillowkeeper
No edit summary
Render trivia widget wiki links through restored skin helper
 
(12 intermediate revisions by one other user not shown)
Line 6: Line 6:
<li id="trivia5"></li>
<li id="trivia5"></li>
<script>
<script>
function boldHTML() {
 
  var element = document.createElement("b");
  element.innerHTML = "Bold text";
  return element;
}
window.addEventListener("load", function () {
window.addEventListener("load", function () {
var list = new Array();
var list = new Array();
list[0] = "The term <b>\"No Tricks\"</b> originated in the season one campaign </b><a href=\"/wiki/The_Jewel_of_the_Dingo_Isles\">\"The Jewel of the Dingo Isles\"</a></b>"
list[1] = "<a href=\"/wiki/Kallark\">Kallark</a> has a pot puppy named <b>Annihilus the Living Death That Walks</b>";
list[2] = "<b><a href=\"/wiki/Kallark\">Slippery Knuckles Malone</a></b> does not recall his original name";
list[3] = "</b><a href=\"/wiki/Thor\">Thor</a></b> is the son of <a href=\"/wiki/Dragon_Aspect\">Dragon Aspect</a> <a href=\"/wiki/Ouro'ras\">Ouro'ras</a> and is the creator of many races in the Realms";
list[4] = "<a href=\"/wiki/Alessa_Stonemason\">Alessa Stonemason</a> is a reference to <b>Alessa Gillespie</b> of the Silent Hill franchise";
list[5] = "No one knows how <a href=\"/wiki/Gnome\">Gnomes</a> came to be";
list[6] = "Before the <a href=\"/wiki/Lore#The_Great_Hatching\">Birth of Magic</a>, the world was a <i>Utopia</i> in which no one could die";
list[7] = "<a href=\"/wiki/Ghana_Ens_Sin\">Ghana Ens Sin</a> is an anagram of <i>shenanigans</i>.";
list[8] = "<a href=\"/wiki/Coestar\">Coestar</a>  has been a player in every campaign (Side Quests included)";


var fin = list.length;
<!--{foreach from=$text item=info}-->
for (j = 0; j < 6; j++){
list.push("<!--{$info|escape:'javascript'}-->");
<!--{/foreach}-->
 
for (var j = 0; j < 6; j++){
var ul = document.getElementById("trivia" + j);
var ul = document.getElementById("trivia" + j);
var i = Math.floor(Math.random() * list.length);
var d = new Date();
var t = d.getTime();
var days = Math.floor(t / (86400000));
var i = days % list.length;


ul.insertAdjacentHTML( 'beforeend', list[i] );
if (window.urwikiAppendInlineWikitext) {
window.urwikiAppendInlineWikitext(ul, list[i]);
} else {
ul.insertAdjacentHTML('beforeend', list[i]);
}


var index = list.indexOf(list[i]);
var index = list.indexOf(list[i]);

Latest revision as of 00:50, 26 April 2026

  • <script> window.addEventListener("load", function () { var list = new Array(); list.push(""); for (var j = 0; j < 6; j++){ var ul = document.getElementById("trivia" + j); var d = new Date(); var t = d.getTime(); var days = Math.floor(t / (86400000)); var i = days % list.length; if (window.urwikiAppendInlineWikitext) { window.urwikiAppendInlineWikitext(ul, list[i]); } else { ul.insertAdjacentHTML('beforeend', list[i]); } var index = list.indexOf(list[i]); if (index > -1){ list.splice(index, 1); } } }); </script>