Guest User

timeline.html

a guest
Aug 8th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 7.54 KB | None | 0 0
  1. <html>
  2. <head>
  3.     <link rel="stylesheet" type="text/css" href="/nis.css">
  4.     <link rel="stylesheet" type="text/css" href="/alt1-currentskin/skinstyle.css">
  5.     <script type="text/javascript" src="runeappslib.js"></script>
  6.     <script type="text/javascript" src="Alarm.js"></script>
  7.     <script type="text/javascript" src="Alerter.js"></script>
  8.     <style>
  9.         #settingsbutton{background-image:url(settingsbutton2.png);}
  10.         #alarmvolume{width:45px; height:20px; background:url(volumeslider.png) 0px 0px;}
  11.         #alarmvolumeinner{width:0%; height:20px; background:url(volumeslider.png) 0px -20px;}
  12.         #alarmname{float:right;}
  13.         #timelineroot{color:white; margin-top:5px;}
  14.         .text,.time,.popover{
  15.             display:inline;
  16.             font-size:12px;
  17.         }
  18.         .time{
  19.             color:lightgray;
  20.             margin-right:5px;
  21.         }
  22.         .text{
  23.             color:#FDFDFD;
  24.         }
  25.     </style>
  26.     <script>
  27.         var interval = null;
  28.         var alerts = [];
  29.         var playingalarm = null;
  30.         var tickcount = 0;
  31.         var currenttooltip = "";
  32.         var currentTaskbar = 0;
  33.         var currentTriggered = false;
  34.         var globalAlarmSound = null;
  35.         var settings = {
  36.             globalAlarm: { sound: "bell", repeat: false },
  37.             activeSuppress: true,
  38.             showTaskbarOverlay: true,
  39.             suppressDelay: 3000,
  40.             volume: 0.5,
  41.             cache: true,
  42.             warband: true,
  43.             goebies: true,
  44.             prifddinas: true,
  45.             Cadarn: true,
  46.             Amlodd: true,
  47.             Crwys: true,
  48.             Ithell: true,
  49.             Hefin: true,
  50.             Meilyr: true,
  51.             Trahaearn: true,
  52.             Iorwerth: true
  53.         };
  54.         var alarmplayer = new SoundPlayer();
  55.         var url = "timeline.php";
  56.         var timelineroot = null;
  57.         var districts = {
  58.             Cadarn: {alarm: false, text:"Magic and Ranged"},
  59.             Amlodd: {alarm: false, text:"Summoning and Division"},
  60.             Crwys: {alarm: false, text:"Farming and Woodcutting"},
  61.             Ithell: {alarm: false, text:"Crafting and Construction"},
  62.             Hefin: {alarm: false, text:"Agility and Prayer"},
  63.             Meilyr: {alarm: false, text:"Dungeoneering and Herblore"},
  64.             Trahaearn: {alarm: false, text:"Mining and Smithing"},
  65.             Iorwerth: {alarm: false, text:"Melee and Slayer"},
  66.             prifddinas: {alarm: false, text:"N/A"},
  67.             cache: {alarm: false, text:"N/A"},
  68.             goebies: {alarm: false, text:"N/A"},
  69.             warband: {alarm: false, text:"N/A"},
  70.         };
  71.  
  72.         function start() {
  73.             tickcount = 0;
  74.             //elid("alarmvolume").onmousedown = function (e) { newdraghandler(setvolume, setvolume); e.preventDefault(); }
  75.             timelineroot = document.getElementById("timelineroot");
  76.             retrieveTimeline();
  77.             setInterval(retrieveTimeline,30*1000);
  78.             updateClock();
  79.             setInterval(updateClock,1000);
  80.         }
  81.  
  82.         function setvolume(mouseloc) {
  83.             var bounds, part;
  84.             bounds = elid("alarmvolume").getBoundingClientRect();
  85.             part = (mouseloc.x - bounds.left) / (bounds.right - bounds.left);
  86.             if (part < 0) { part = 0; }
  87.             if (part > 1) { part = 1; }
  88.             elid("alarmvolumeinner").style.width = 100 * part + "%";
  89.             settings.volume = part;
  90.         }
  91.  
  92.         function settingsMenu() {
  93.             var buttons = [].concat(
  94.                 // { t: "header", text: "Alarms" },
  95.                 // createUservarInput("suppress", settings.activeSuppress, { t: "bool", n: "Suppress alarms when rs is active" }),
  96.                 // createUservarInput("alarm",settings.globalAlarm, { t: "alarm", n: "Enable global alarm" }),
  97.                 { t: "header", text: "Display Alerts" },
  98.                 createUservarInput("cache",settings.cache, { t: "bool", n: "Display Guthix Cache" }),
  99.                 createUservarInput("warband",settings.warband, { t: "bool", n: "Display Warbands" }),
  100.                 createUservarInput("goebies",settings.goebies, { t: "bool", n: "Display Geoby Suply Runs" }),
  101.                 createUservarInput("prifddinas",settings.prifddinas, { t: "bool", n: "Display All Prifddinas Hours" }),
  102.                 createUservarInput("Cadarn",settings.Cadarn, { t: "bool", n: "Display Cadarn Hours" }),
  103.                 createUservarInput("Amlodd",settings.Amlodd, { t: "bool", n: "Display Amlodd Hours" }),
  104.                 createUservarInput("Crwys",settings.Crwys, { t: "bool", n: "Display Crwys Hours" }),
  105.                 createUservarInput("Ithell",settings.Ithell, { t: "bool", n: "Display Ithell Hours" }),
  106.                 createUservarInput("Hefin",settings.Hefin, { t: "bool", n: "Display Hefin Hours" }),
  107.                 createUservarInput("Meilyr",settings.Meilyr, { t: "bool", n: "Display Meilyr Hours" }),
  108.                 createUservarInput("Trahaearn",settings.Trahaearn, { t: "bool", n: "Display Trahaearn Hours" }),
  109.                 createUservarInput("Iorwerth",settings.Iorwerth, { t: "bool", n: "Display Iorwerth Hours" }),
  110.                 { t: "h/11" },
  111.                 { t: "button:confirm", text: "Confirm" },
  112.                 { t: "button:cancel", text: "cancel" }
  113.             );
  114.  
  115.             var box = promptbox2({ title: "Settings", style: "popup", width: 300, stylesheets: ["style.css"] }, buttons);
  116.             box.cancel.onclick = box.frame.close.b();
  117.             box.confirm.onclick = function () {
  118.                 // settings.activeSuppress = box.suppress.getValue();
  119.                 // settings.globalAlarm = box.alarm.getValue();
  120.  
  121.                 settings.cache = box.cache.getValue();
  122.                 settings.warband = box.warband.getValue();
  123.                 settings.goebies = box.goebies.getValue();
  124.                 settings.prifddinas = box.prifddinas.getValue();
  125.  
  126.                 settings.Cadarn = box.Cadarn.getValue();
  127.                 settings.Amlodd = box.Amlodd.getValue();
  128.                 settings.Crwys = box.Crwys.getValue();
  129.                 settings.Ithell = box.Ithell.getValue();
  130.                 settings.Hefin = box.Hefin.getValue();
  131.                 settings.Meilyr = box.Meilyr.getValue();
  132.                 settings.Trahaearn = box.Trahaearn.getValue();
  133.                 settings.Iorwerth = box.Iorwerth.getValue();
  134.                 box.frame.close();
  135.                 retrieveTimeline();
  136.             };
  137.         }
  138.  
  139.         function retrieveTimeline(){
  140.             var Httpreq = new XMLHttpRequest(); // a new request
  141.             Httpreq.open("GET","timeline.php",false);
  142.             Httpreq.send(null);
  143.             displayTimeline(JSON.parse(Httpreq.responseText));
  144.         }
  145.         function displayTimeline(data){
  146.             var length = 10;
  147.             var entry = "";
  148.             var date;
  149.  
  150.             if(data.length < 10){
  151.                 length = data.length;
  152.             }
  153.  
  154.             timelineroot.innerHTML = "";
  155.             for(var count = 0; count < length; count++){
  156.                 if((data[count].type === "prifddinas" && settings['prifddinas'] && (settings[data[count].districts[0]] || settings[data[count].districts[1]])) || settings[data[count].type]) {
  157.                     entry = "<div class=\"entry\"><div class=\"time\">";
  158.                     date = new Date(data[count].time.date.substr(0,19).replace(" ","T"));
  159.                     entry += date.getUTCHours() + ":" + (date.getUTCMinutes()<10?'0':'') + date.getUTCMinutes();
  160.                     entry += "</div><div class=\"text\">";
  161.  
  162.                     if(data[count].type === "prifddinas"){
  163.                         entry += "Prifddinas: ";
  164.                         entry += "<div class=\"popover\" title=\"" + districts[data[count].districts[0]].text + "\">" + data[count].districts[0] + "</div> and ";
  165.                         entry += "<div class=\"popover\" title=\"" + districts[data[count].districts[1]].text + "\">" + data[count].districts[1] + "</div> districts";
  166.                     } else {
  167.                         entry += data[count].text;
  168.                     }
  169.  
  170.                     entry += "</div></div>";
  171.                     timelineroot.innerHTML += entry;
  172.                 }
  173.             }
  174.         }
  175.    
  176.         function updateClock(){
  177.             var clock = document.getElementById("clock");
  178.             var d1 = new Date();
  179.             clock.innerHTML = d1.getUTCHours() + ":" + d1.getUTCMinutes() + ":" + d1.getUTCSeconds();
  180.         }
  181.     </script>
  182. </head>
  183. <body class="nis" onload="start();">
  184.     <div id="settingsbar">
  185.         <div style="display:flex; flex-direction:row; align-items:center; float:clear;">
  186.             <div id="settingsbutton" onclick="settingsMenu();" title="Settings" class="nissmallimagebutton menubutton"></div>
  187.             <div id="clock" style="padding-left:5px;color:white;">0:00:00</div>
  188.             <!-- <div id="alarmvolume" title="Alarm volume"><div id="alarmvolumeinner" style="width: 50%;"></div></div> -->
  189.         </div>
  190.         <div class="nisseperator"></div>
  191.     </div>
  192.     <div id="timelinewrapper">
  193.         <div id="timelineroot"></div>
  194.     </div>
  195. </body>
Add Comment
Please, Sign In to add comment