tiss_developer_tweaks

a better tiss for tiss-developers

目前為 2017-11-06 提交的版本,檢視 最新版本

// ==UserScript==
// @name           tiss_developer_tweaks
// @namespace      https://greasyfork.org/de/users/157797-lual
// @include        *tiss.tuwien.ac.at*
// @include        http://localhost:3*
// @version        0.8
// @author         lual
// @description	   a better tiss for tiss-developers
// @author         fg (csd)
// @grant          GM_addStyle
// ==/UserScript==
// changes:        2017-11-01 publish on greasyfork
//                            https://greasyfork.org/de/scripts/34721-tiss-developer-tweaks
//                 2017-11-03 mark current menu entry
//                            fill unused space - use whole screen width
////////////////////////////////////////////////////////////////////////////////
// list of links to environments
var linkListHref = ['localhost:3001','localhost:3002','localhost:3003','dev1.tiss.tuwien.ac.at','mig.tiss.tuwien.ac.at','tiss.tuwien.ac.at'];
var linkListProt = ['http://',       'http://',       'http://',       'https://',              'https://',             'https://'         ];
var linkListText = ['lh:3001',       'lh:3002',       'lh:3003',       'dev1',                  'mig',                  'Echtsystem!'      ];

function populateMenu() {
  var menu = document.getElementsByClassName("clearfix toolNav")[0];
  var li;
  var newLink;
  var text;
  for (var i = 0; i < linkListHref.length; i++ ) {
    li = document.createElement("li");
    newSpan = document.createElement("span");
    if (window.location.host == linkListHref[i])
    {
      text = document.createTextNode(linkListText[i]);
      newSpan.appendChild(text);
      newSpan.setAttribute("style", "color:grey; font-weight: bold;");
      newSpan.setAttribute("style", "color:grey; font-weight: bold; background: #FFFFFF; border-left: 1px solid #CDDAE1; border-right: 1px solid #CDDAE1; border-top: 1px solid #CDDAE1; padding-left:4px; padding-right:4px; background: linear-gradient(to top, #F5FAFD, #FFFFFF);");
    } else {
      newLink = document.createElement("a");
      newLink.setAttribute('href',linkListProt[i] + linkListHref[i] + window.location.pathname + window.location.search + window.location.hash);
      newLink.innerHTML = linkListText[i];
      newSpan.appendChild(newLink);
    }
    li.appendChild(newSpan);
    menu.appendChild(li);
  }
}
populateMenu();
////////////////////////////////////////////////////////////////////////////////
//include userstyle tiss-env-border
//https://userstyles.org/styles/121958/tiss-env-border
GM_addStyle(`
@-moz-document regexp(".*[^\.]tiss[\.]tuwien[\.]ac[\.]at.*") {
  body:before {
    content: "";
    position: fixed;
    background: #FF0000;
    left: 0;
    right: 0;
    height: 11px;
    z-index:100;
    background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' version='1.1' height='11px' width='90px'><text x='9' y='9' fill='white' font-size='10' font-weight='bold' font-family='Arial, Helvetica, sans-serif' >ECHTSYSTEM ! </text></svg>");
    top: 0;
  }
  body {
    margin-top:11px;
  }
}
`);
////////////////////////////////////////////////////////////////////////////////
// mark current menu entry
GM_addStyle(`
  #supNav ul li.currentPageItem > span > a {
    background: #FFFFFF;
    border-bottom: 1px solid #CDDAE1;
    border-top: 1px solid #CDDAE1;
  }
  .organisation #supNav ul li.currentPageItem > span > a {
    background: linear-gradient(to right, #DAC4F3, #F5FAFD, #F5FAFD, #F5FAFD, #F5FAFD, #FFFFFF);
  }
  .lehre #supNav ul li.currentPageItem > span > a {
    background: linear-gradient(to right, #DA923C, #F5FAFD, #F5FAFD, #F5FAFD, #F5FAFD, #FFFFFF);
  }
  .forschung #supNav ul li.currentPageItem > span > a {
    background: linear-gradient(to right, #9FC65A, #F5FAFD, #F5FAFD, #F5FAFD, #F5FAFD, #FFFFFF);
  }
  #shadow_top {
    z-index: 0;}
`);

////////////////////////////////////////////////////////////////////////////////
// fill unused space - use whole screen width
GM_addStyle("body>#wrapper {max-width: 98%!important;}");