The URI of TUHH Docker Registry changed from "docker.rz.tu-harburg.de:5000" to "docker.rz.tu-harburg.de". Please update your gitlab-ci.yml files if you use images from this registry.

Commit d5c4c358 authored by Tobias Zeumer's avatar Tobias Zeumer

Don't always switch to ground floor when highlighting even though there are...

Don't always switch to ground floor when highlighting even though there are matches at currently displayed level; resolves #53
parent cd6da075
......@@ -665,32 +665,40 @@ function process_url_params() {
/**
* Get count of elements for all levels by css selector(s) of element
*
* @todo: Refactored (2019-01-02). Still, the second loop "might" be unecessary/
* redundant even if there were (really) more then two levels.
*/
function find_and_highlight(cssSelector) {
var result = {};
var matchedLevels = new Array();
// Count matches for each ID with class mainlayer
$(".mainlayer").each(function(index, elem) {
var numResults = $(this).find(cssSelector).length;
if (numResults > 0) {
var level = $(elem).attr('id');
result[level] = numResults;
// Make sure the currently visible level is at the beginning of the array
if ($("#"+level).css('display') !== 'none') {
matchedLevels.unshift(level);
} else {
matchedLevels.push(level);
}
result[level] = numResults;
}
});
// If multiple levels have matches, prefer the levels in this order
var prefLvl = ["EG", "OG1", "UG", "OG2"];
var prefFound = false;
for (var i = 0; i < prefLvl.length; i++) {
var lvl = prefLvl[i];
if (typeof result[lvl] !== 'undefined' && prefFound == false) {
// Loop the results again, do some highlighting
for (var i = 0; i < matchedLevels.length; i++) {
var lvl = matchedLevels[i];
// Switch to level (in case not currently active level) and highlight
if (i === 0) {
toggleLevel(lvl);
prefFound = true;
// Do the actual highlighting for preferred level
highlight(cssSelector);
}
// indicate, that there is more on another level;
// @todo: currently there is only an up button to OG1, so
// for now we really want to match 'OG1' instead of not 'undefined'
else if (typeof result[lvl] !== 'undefined' && prefFound == true) {
// @todo: (currently?) only EG and OG1 should have anything in common
else if (i > 0 && $('.iconbutton.level_'+lvl).length > 0) {
$('.iconbutton.level_'+lvl).addClass('highlight');
}
}
......
Markdown is supported
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