// ==UserScript==
// @name tiss_developer_tweaks
// @namespace https://gf.qytechs.cn/de/users/157797-lual
// @include *tiss.tuwien.ac.at*
// @include http://localhost:3*
// @version 0.12
// @author lual
// @description a better tiss for tiss-developers
// @author fg (csd)
// @grant GM_addStyle
// ==/UserScript==
// changes: 2017-11-01 publish on greasyfork
// https://gf.qytechs.cn/de/scripts/34721-tiss-developer-tweaks
// 2017-11-03 mark current menu entry
// fill unused space - use whole screen width
// 2017-11-06 production warning border also for chrome
// 2018-08-03 bugfix - production warning border - for tiss-help-system
// 2018-08-03 add next.devcloud
///////////////////////////////////////////////////////////////////////////////
// list of links to environments
var linkListHref = ['localhost:3001','localhost:3002','localhost:3003','next.devcloud.tiss.tuwien.ac.at','dev1.tiss.tuwien.ac.at','test.tiss.tuwien.ac.at','tiss.tuwien.ac.at'];
var linkListProt = ['http://', 'http://', 'http://', 'https://', 'https://', 'https://', 'https://' ];
var linkListText = ['lh:3001', 'lh:3002', 'lh:3003', 'next', 'dev1', 'test', 'Echtsystem!' ];
function populateMenu() {
var menu;
menu = document.getElementsByClassName("clearfix toolNav")[0];
if (menu == null){
return
}
var li;
var newLink;
var text;
var newSpan;
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();
////////////////////////////////////////////////////////////////////////////////
//ECHTSYSTEM! - warning-bar
//(kopiert von userstyle tiss-env-border https://userstyles.org/styles/121958/tiss-env-border)
//@-moz-document regexp(".*[^\.]tiss[\.]tuwien[\.]ac[\.]at.*"){ body:before... } funktioniert leider nur im ff
if (window.location.host == 'tiss.tuwien.ac.at')
{
GM_addStyle(`
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;}");