summaryrefslogtreecommitdiffstats
path: root/theme/list_lib.js
diff options
context:
space:
mode:
authorGravatar Gehad elrobey <gehadelrobey@gmail.com>2014-07-18 16:55:16 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-07-25 07:14:23 -0700
commitbf68a2ece667504e656df15ac333e911961d5f4d (patch)
treecd9d96289094311f1aabde5b246fd54cb33f0e16 /theme/list_lib.js
parent6f6ed864bce317e06ecd0283456b9349fcf9bd02 (diff)
downloadsubsurface-bf68a2ece667504e656df15ac333e911961d5f4d.tar.gz
HTML: fix searching tags from the detailed view.
When clicking a tag in the detailed view a search must take place on the following tag, the search settings must be specified to search for tags only and ignore the advanced search settings chosen by the user. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'theme/list_lib.js')
-rw-r--r--theme/list_lib.js33
1 files changed, 21 insertions, 12 deletions
diff --git a/theme/list_lib.js b/theme/list_lib.js
index dd7be94a9..f40151887 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -206,8 +206,7 @@ function getExpanded(dive)
{
var res = '<table><tr><td class="words">Date: </td><td>' + dive.date +
'</td><td class="words">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Time: </td><td>' + dive.time +
- '</td><td class="words">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Location: </td><td>' + '<a onclick=\"Search_list_Modules(\'' + dive.location + '\')\">' +
- dive.location + '</a>' +
+ '</td><td class="words">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Location: </td><td>' + '<a onclick=\"Search_list_Modules(\'' + dive.location + '\', {location:true, divemaster:false, buddy:false, notes:false, tags:false,})\">' + dive.location + '</a>' +
'</td></tr></table><table><tr><td class="words">Rating:</td><td>' + putRating(dive.rating) +
'</td><td class="words">&nbsp;&nbsp;&nbsp;Visibilty:</td><td>' + putRating(dive.visibility) +
'</td></tr></table>' +
@@ -228,7 +227,7 @@ function putTags(tags)
{
var result = "";
for (var i in tags) {
- result += '<a onclick=\"Search_list_Modules(\'' + tags[i] + '\')\">' + tags[i] + '</a>';
+ result += '<a onclick=\"Search_list_Modules(\'' + tags[i] + '\', {location:false, divemaster:false, buddy:false, notes:false, tags:true,})\">' + tags[i] + '</a>';
if (i < tags.length - 1)
result += ', ';
}
@@ -481,14 +480,15 @@ function Node(value)
this.key = new Set();
}
-function Search_list_Modules(searchfor)
+function Search_list_Modules(searchfor, searchOptions)
{
document.getElementById("search_input").value = searchfor;
- SearchModules(searchfor);
+ SearchModules(searchfor, searchOptions);
}
-function SearchModules(searchfor)
+function SearchModules(searchfor, searchOptions)
{
+ unshowDiveDetails(dive_id);
var resultKeys = new Set(); //set
if (searchfor.length <= 0) {
@@ -502,22 +502,31 @@ function SearchModules(searchfor)
var keywords = searchfor.split(" ");
+ if (searchOptions === null) {
+ searchOptions = {};
+ searchOptions.location = searchingModules["location"].enabled;
+ searchOptions.divemaster = searchingModules["divemaster"].enabled;
+ searchOptions.buddy = searchingModules["buddy"].enabled;
+ searchOptions.notes = searchingModules["notes"].enabled;
+ searchOptions.tags = searchingModules["tags"].enabled;
+ }
+
for (var i = 0; i < keywords.length; i++) {
var keywordResult = new Set();
- if (searchingModules["location"].enabled === true)
+ if (searchOptions.location === true)
keywordResult.Union(searchingModules["location"].search(keywords[i]));
- if (searchingModules["divemaster"].enabled === true)
+ if (searchOptions.divemaster === true)
keywordResult.Union(searchingModules["divemaster"].search(keywords[i]));
- if (searchingModules["buddy"].enabled === true)
+ if (searchOptions.buddy === true)
keywordResult.Union(searchingModules["buddy"].search(keywords[i]));
- if (searchingModules["notes"].enabled === true)
+ if (searchOptions.notes === true)
keywordResult.Union(searchingModules["notes"].search(keywords[i]));
- if (searchingModules["tags"].enabled === true)
+ if (searchOptions.tags === true)
keywordResult.Union(searchingModules["tags"].search(keywords[i]));
if (resultKeys.isEmpty()) {
@@ -764,7 +773,7 @@ function get_dive_HTML(dive)
{
return '<h2 class="det_hed">Dive Information</h2><table><tr><td class="words">Date: </td><td>' + dive.date +
'</td><td class="words">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Time: </td><td>' + dive.time +
- '</td><td class="words">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Location: </td><td>' + '<a onclick=\"Search_list_Modules(\'' + dive.location + '\')\">' +
+ '</td><td class="words">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Location: </td><td>' + '<a onclick=\"Search_list_Modules(\'' + dive.location + '\', {location:true, divemaster:false, buddy:false, notes:false, tags:false,})\">' +
dive.location + '</a>' +
'</td></tr></table><table><tr><td class="words">Rating:</td><td>' + putRating(dive.rating) +
'</td><td class="words">&nbsp;&nbsp;&nbsp;Visibilty:</td><td>' + putRating(dive.visibility) +