Skip to content
Snippets Groups Projects
Commit 3b46febd authored by Christopher Pietsch's avatar Christopher Pietsch
Browse files

fixed deep hierarchical deselect on keywords

parent b9faa5fa
No related branches found
No related tags found
No related merge requests found
...@@ -254,10 +254,13 @@ function Tags() { ...@@ -254,10 +254,13 @@ function Tags() {
tags.mouseclick = function (d) { tags.mouseclick = function (d) {
lock = true; lock = true;
console.log("clikc", d)
if(filterWords.indexOf(d.key)>-1){ if(filterWords.indexOf(d.key)>-1){
console.log(d.key, filterWords)
_.remove(filterWords,function(d2){ return d2 == d.key; }); _.remove(filterWords,function(d2){ return d2 == d.key; });
// if hierarchical keywords, could turn those into an array instead of strings
if(d.key.indexOf(":")){
filterWords = filterWords.filter(f => !f.startsWith(d.key))
}
} else { } else {
filterWords.push(d.key); filterWords.push(d.key);
} }
......
...@@ -149,3 +149,60 @@ utils.simulateLargeDatasets = function(data){ ...@@ -149,3 +149,60 @@ utils.simulateLargeDatasets = function(data){
Array.prototype.push.apply(data, _.clone(data, true).slice(0,1036)) Array.prototype.push.apply(data, _.clone(data, true).slice(0,1036))
} }
if (!String.prototype.startsWith) {
(function() {
'use strict'; // needed to support `apply`/`call` with `undefined`/`null`
var defineProperty = (function() {
// IE 8 only supports `Object.defineProperty` on DOM elements
try {
var object = {};
var $defineProperty = Object.defineProperty;
var result = $defineProperty(object, object, object) && $defineProperty;
} catch(error) {}
return result;
}());
var toString = {}.toString;
var startsWith = function(search) {
if (this == null) {
throw TypeError();
}
var string = String(this);
if (search && toString.call(search) == '[object RegExp]') {
throw TypeError();
}
var stringLength = string.length;
var searchString = String(search);
var searchLength = searchString.length;
var position = arguments.length > 1 ? arguments[1] : undefined;
// `ToInteger`
var pos = position ? Number(position) : 0;
if (pos != pos) { // better `isNaN`
pos = 0;
}
var start = Math.min(Math.max(pos, 0), stringLength);
// Avoid the `indexOf` call if no match is possible
if (searchLength + start > stringLength) {
return false;
}
var index = -1;
while (++index < searchLength) {
if (string.charCodeAt(start + index) != searchString.charCodeAt(index)) {
return false;
}
}
return true;
};
if (defineProperty) {
defineProperty(String.prototype, 'startsWith', {
'value': startsWith,
'configurable': true,
'writable': true
});
} else {
String.prototype.startsWith = startsWith;
}
}());
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment