LukasLohoff / _Adding a live button

// ==UserScript==
// @name        _Adding a live button
// @description Adds live example button, with styling.
// @include     https://uni-muenster.sciebo.de/index.php/*
// @grant       GM_addStyle
// ==/UserScript==

/*--- Create a button in a container div.  It will be styled and
    positioned with CSS.
*/

//nav-icon-favorites svg
//menuitem action action-delete permanent

var menu = document.getElementsByClassName("fileActionsMenu popovermenu bubble open menu")[0];
var list = menu.getElementsByTagName("UL")[0];

var node = document.createElement("LI");
var link = document.createElement("LINK");
link.className = "menuitem action action-download permanent";
link.href="https://o2r.uni-muenster.de/foo";
var imageSpan = document.createElement("SPAN");
imageSpan.className = "icon icon-delete";
var textSpan = document.createElement("SPAN");
textSpan.innerHTML = "Upload to O2R...";

link.appendChild(imageSpan);
link.appendChild(textSpan);
node.appendChild(link);

list.appendChild(node);

GM_addStyle('                                                               \
    .popovermenu .menuitem,                                                 \
    .popovermenu .menuitem>span {                                           \
        cursor: pointer;                                                    \
        vertical-align: middle;                                             \
    }                                                                       \
    }                                                                       \
                                                                            \
    .popovermenu .menuitem { \
        -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; \
        filter: alpha(opacity=50); \
        opacity: .5; \
    } \
                                                                            \
    .popovermenu .menuitem:hover, \
    .popovermenu .menuitem:focus { \
        -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; \
        filter: alpha(opacity=100); \
        opacity: 1; \
    } \
\
    .popovermenu { \
        padding: 4px 12px; \
    } \
\
\
' );




.popovermenu .menuitem {
	-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
	filter: alpha(opacity=50);
	opacity: .5;
}

.popovermenu .menuitem:hover,
.popovermenu .menuitem:focus {
	-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
	filter: alpha(opacity=100);
	opacity: 1;
}

.popovermenu {
	padding: 4px 12px;
}

GM_addStyle ( "                                     \
    .banner_url {                                   \
        background: url('http://www.pxleyes.com/images/contests/kiwis/fullsize/sourceimage.jpg') no-repeat center center fixed !important; \
        -webkit-background-size: cover !important;  \
        -moz-background-size: cover !important;     \
        -o-background-size: cover !important;       \
        background-size: cover !important;          \
    }                                               \
" );






textnode.href="https://google.de";
textnode.className = "menuitem action action-download permanent";
list.appendChild(textnode);
console.log(list);

/*
list.getElementsByClassName("child")[0].innerHTML = "Milk";

var textnode = document.createTextNode("Upload to O2R");         // Create a text node
textnode.href="https://google.de";
var elements = document.getElementByClassName("menuitem action action-delete permanent");
console.log(typeof(elements));
console.log("FOOOOOO");
document.getElementByClassName("menuitem action action-delete permanent").appendChild(node);
*/