Skip to content

Instantly share code, notes, and snippets.

@dlukes
Last active August 29, 2015 14:16
Show Gist options
  • Save dlukes/28b5ba4a3dff284797fb to your computer and use it in GitHub Desktop.
Save dlukes/28b5ba4a3dff284797fb to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name KonText vertical menu v2
// @namespace https://trnka.korpus.cz/~lukes
// @version 0.1
// @description enter something useful
// @author David Lukeš
// @match https://kontext.korpus.cz/*
// @grant none
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @require https://code.jquery.com/jquery-1.11.2.min.js
// ==/UserScript==
function addGlobalStyle(css) {
var head, style;
head = document.getElementsByTagName('head')[0];
if (!head) return;
style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = css;
head.appendChild(style);
}
style = '\
ul.submenu {\
list-style: none !important;\
}\
#menu-level-2 ul li {\
display: list-item !important;\
}\
ul.submenu li.separ {\
border-width: 0 !important;\
}\
ul.submenu li:not(.disabled) a:hover {\
color: #009EE0 !important;\
}\
';
addGlobalStyle(style);
waitForKeyElements("body", function() {
function docCallback(doc) {
var self = doc.mainMenu;
self.jqMenuBar.on('mouseleave', function (event) {
var prevMenuId = self.getActiveSubmenuId();
self.closeSubmenu(prevMenuId);
});
};
require(["tpl/document"], docCallback);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment