Commit 998949ba authored by Gradl, Tobias's avatar Gradl, Tobias
Browse files

1245: Implement DARIAH-DE Styleguide

Task-Url: https://pm.winseda.de/issues/1245
parent 176f2856
......@@ -170,3 +170,12 @@
.wordcloud {
text-align: center; }
#search-loading-indicator {
position: absolute;
right: 0; }
#search-results-container #search-results .tab-pane {
border-right: 1px solid #dee2e6;
border-bottom: 1px solid #dee2e6;
border-left: 1px solid #dee2e6; }
var dariahMenu = null;
$(document).ready(function() {
dariahMenu = new DariahMenu({});
});
var DariahMenu = function(options) {
this.options = {
fetchUrl : "https://res.de.dariah.eu/globalmenu/menu.json",
menuSelector : "div#dariah-global-menu"
};
$.extend(true, this.options, options);
this.fetchMenu();
};
DariahMenu.prototype.fetchMenu = function() {
var _this = this;
$.ajax({
url: this.options.fetchUrl,
dataType: 'json',
error: function(jqXHR, textStatus, errorThrown) { console.log("Failed to load global menu (" + errorThrown +")"); },
success: function(data, textStatus, jqXHR) { _this.setupMenu(data.menu, $(_this.options.menuSelector)); }
});
};
DariahMenu.prototype.setupMenu = function(menu, container) {
for (var i=0; i<menu.length; i++) {
if (menu[i].divider!==undefined) {
continue;
}
var menublock = $("<div>").addClass("dropdown-menu-block");
var header;
if (menu[i].link===undefined) {
header = $("<span>");
} else {
header = $("<a>").prop("href", menu[i].link);
}
header.addClass("dropdown-header");
header.text(menu[i].title);
menublock.append(header);
if (menu[i].submenu!==undefined) {
this.setupSubmenu(menu[i].submenu, menublock);
}
container.append(menublock);
}
};
DariahMenu.prototype.setupSubmenu = function(submenu, container) {
for (var i=0; i<submenu.length; i++) {
if (submenu[i].divider!==undefined) {
container.append("<div class='dropdown-divider'></div>");
} else {
container.append($("<a>")
.addClass("dropdown-item")
.prop("href", submenu[i].link)
.text(submenu[i].title));
}
}
};
\ No newline at end of file
var editorSidebar = null;
$(document).ready(function() {
editorSidebar = new EditorSidebar({});
});
$(window).resize(function() {
editorSidebar.resize();
});
var EditorSidebar = function(data) {
this.data = {
sidebar: $("#editor-sidebar"),
sidebarContainer: $("#editor-sidebar").parent(),
sizeBlockSelector: "#editor-nav-sidebar"
};
$.extend(true, this.data, data);
this.resize();
this.data.sidebar.css("visibility", "visible");
};
EditorSidebar.prototype.resize = function() {
this.showEditorLinkLists();
this.showEditorLinkBlocks();
if (this.getContainerHeight() > $(window).height()) {
this.hideEditorLinkLists();
if (this.getContainerHeight() > $(window).height()) {
this.hideEditorLinkBlocks();
}
}
};
EditorSidebar.prototype.getContainerHeight = function() {
return this.data.sidebarContainer.height();
};
EditorSidebar.prototype.getSidebarHeight = function() {
return this.data.sidebar.height();
};
EditorSidebar.prototype.hideEditorLinkLists = function() {
this.data.sidebar.find(this.data.sizeBlockSelector + " ul").css("display", "none");
};
EditorSidebar.prototype.showEditorLinkLists = function() {
this.data.sidebar.find(this.data.sizeBlockSelector + " ul").css("display", "");
};
EditorSidebar.prototype.hideEditorLinkBlocks = function() {
this.data.sidebar.find(this.data.sizeBlockSelector).css("display", "none");
};
EditorSidebar.prototype.showEditorLinkBlocks = function() {
this.data.sidebar.find(this.data.sizeBlockSelector).css("display", "");
};
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment