moped / pc.sk RSS ticker

// ==UserScript==
// @name         pc.sk RSS ticker
// @namespace    pretaktovanie.sk
// @version      1.0
// @description  RSS parser/ticker pre forum
// @author       moped
// @license      MIT
// @match        https://pretaktovanie.zoznam.sk/*
// @exclude      https://pretaktovanie.zoznam.sk/ucp.php*
// @icon         https://pretaktovanie.zoznam.sk/favicon.ico
// @grant        GM_xmlhttpRequest
// @grant        GM_addStyle
// @grant        GM_setValue
// @grant        GM_getValue
// @connect      pc.zoznam.sk
// ==/UserScript==

(function () {
  'use strict';

  var lastCheck = GM_getValue('lastCheck');
  var rssList = GM_getValue('rssList');
  var currTime = Date.now();

  if ((lastCheck === undefined && rssList === undefined) || (lastCheck + 300000) < currTime) {
    GM_xmlhttpRequest({
      method: "GET",
      url: "https://pc.zoznam.sk/rss",
      onload: function (response) {
        if (response.status === 200) {
          var item = response.responseXML.getElementsByTagName('item');
          var list = "<div id=\"pc-rss\"><h4>Novinky <a target=\"_blank\" href=\"https://pc.zoznam.sk\">pc.sk</a></h4><ul>";
          for (var i = 0; i < item.length; i++) {
            var d = new Date(item[i].children[3].textContent);
            var utcString = d.toUTCString();
            var iDate = utcString.substring(5, 11);
            var iTime = utcString.substring(17, 22);
            var title = item[i].children[0].textContent;
            var link = item[i].children[1].textContent;
            list += "<li><a target=\"_blank\" href=\"" + link + "\" title=\"" + title + "\"><b>" + iDate + "</b> <i>" + iTime + "</i> " + title + "</a></li>";
          }
          list += "</ul></div>";
          GM_setValue('rssList', list);
          GM_setValue('lastCheck', currTime);
        }
      }
    });
  }

  if (rssList !== undefined) {
    GM_addStyle('\
#pc-rss { \
  width: 100%; \
  height: 30px; \
  overflow: hidden; \
  border-top: 1px solid #FFF; \
  -webkit-user-select: none; \
} \
#pc-rss h4 { \
  float: left; \
  position: relative; \
  font: 16px; \
  line-height: 30px; \
  width: 20%; \
  font-weight: bold; \
} \
#pc-rss ul { \
  float: left; \
  text-align: center; \
  width: 75%; \
  animation: ticker 30s cubic-bezier(1, 0, .5, 0) infinite; \
  -webkit-user-select: none; \
} \
#pc-rss ul li {line-height: 30px; list-style: none } \
#pc-rss ul:hover { animation-play-state: paused } \
@keyframes ticker {\
  0%   {margin-top: 0}\
  10%  {margin-top: -30px}\
  20%  {margin-top: -60px}\
  30%  {margin-top: -90px}\
  40%  {margin-top: -120px}\
  50%  {margin-top: -150px}\
  60%  {margin-top: -180px}\
  70%  {margin-top: -210px}\
  80%  {margin-top: -240px}\
  90%  {margin-top: -270px}\
  100% {margin-top: 0}\
}\
');
    document.querySelector("#nav-main").insertAdjacentHTML('afterend', rssList);
  }
})();