Widget:TriviaText: Difference between revisions

From Unforgotten Realms Wiki
Jump to navigationJump to search
imported>Pillowkeeper
mNo edit summary
Render trivia widget wiki links through restored skin helper
 
(22 intermediate revisions by one other user not shown)
Line 1: Line 1:
<ul><li type="disc" id="trivia0"></li>
<li id="trivia1"></li>
<li id="trivia2"></li>
<li id="trivia3"></li>
<li id="trivia4"></li>
<li id="trivia5"></li>
<script>
<script>
    window.addEventListener("load", function () {  
 
      var quotes = [
window.addEventListener("load", function () {
        {
var list = new Array();
          text: "text1",
 
        },
<!--{foreach from=$text item=info}-->
        {
list.push("<!--{$info|escape:'javascript'}-->");
          text: "text2",
<!--{/foreach}-->
        },
 
        {
for (var j = 0; j < 6; j++){
          text: "text3",
var ul = document.getElementById("trivia" + j);
        },
var d = new Date();
        {
var t = d.getTime();
          text: "text4",
var days = Math.floor(t / (86400000));
        },
var i = days % list.length;
        {
 
          text: "text5",
if (window.urwikiAppendInlineWikitext) {
        }
window.urwikiAppendInlineWikitext(ul, list[i]);
      ];
} else {
      var quote = quotes[Math.floor(Math.random() * quotes.length)];
ul.insertAdjacentHTML('beforeend', list[i]);
      document.getElementById("text").innerHTML =
}
        '<p>' + quote.text + '</p>';
 
    })();
var index = list.indexOf(list[i]);
  </script>
if (index > -1){
<div id="text"></div>
list.splice(index, 1);
}
}
});
</script>

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>