From 12f1f292f6ada00b301aef466a587d20cc1b583f Mon Sep 17 00:00:00 2001 From: Jonathan Wilkes <jon.w.wilkes@gmail.com> Date: Wed, 19 Oct 2016 17:25:34 -0400 Subject: [PATCH] change id to the document's full path-- this will make it easier to fetch specific documents from the index when displaying directory contents --- pd/nw/dialog_search.html | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/pd/nw/dialog_search.html b/pd/nw/dialog_search.html index 2edbc23be..9d3981dc6 100644 --- a/pd/nw/dialog_search.html +++ b/pd/nw/dialog_search.html @@ -24,7 +24,6 @@ index.addField("description"); //index.addField("body"); index.addField("path"); index.setRef("id"); -var doc_id = 0; // Stop-gap translator function translate_form() { @@ -61,12 +60,11 @@ function add_doc_to_index(filename, data) { title = title.slice(0, -5); } index.addDoc({ - "id": doc_id++, + "id": filename, "title": title, "keywords": keywords, - "description": desc, + "description": desc //"body": big_line, - "path": filename }); } @@ -353,8 +351,8 @@ function doc_search() { div = document.createElement("div"); a = document.createElement("a"); a.href = "javascript: pdgui.doc_open('" + - pdgui.defunkify_windows_path(path.dirname(doc.path)) + "', '" + - pdgui.defunkify_windows_path(path.basename(doc.path)) + "');" + pdgui.defunkify_windows_path(path.dirname(doc.id)) + "', '" + + pdgui.defunkify_windows_path(path.basename(doc.id)) + "');" a.textContent = doc.title; header = document.createElement("h3"); header.appendChild(a); @@ -370,7 +368,7 @@ function doc_search() { </script> </head> <body class="search_body"> - <input type="file" id="file_browser" style="display: none;" onchange="file_browser_callback(this);"></input> + <input type="file" id="file_browser" style="display: none;" onchange="file_browser_callback(this);" accept=".pd,.txt,.htm,.html,.pdf"></input> <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="220" height="50" viewBox="0 0 140 31.81"> <g stroke-linecap="square" fill="none" stroke-width="3"> -- GitLab