aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/assets/js/search.js
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-07-06 19:26:38 -0400
committerGitHub <noreply@github.com>2017-07-06 19:26:38 -0400
commitbb70ed737d98abbd6164b66ac5bd667553b312bd (patch)
tree1899d7adefe3fbf67e6fd26a4da0837898bd6d7a /app/src/main/assets/js/search.js
parent2586e947f769740dd8cb8bf8b1dd0473b51e50e4 (diff)
downloadfrost-bb70ed737d98abbd6164b66ac5bd667553b312bd.tar.gz
frost-bb70ed737d98abbd6164b66ac5bd667553b312bd.tar.bz2
frost-bb70ed737d98abbd6164b66ac5bd667553b312bd.zip
Dev 1.1.5 - JS fixes & sharing intents (#32)v1.1.5
* Add sharing intents * Fix up multiple js instances
Diffstat (limited to 'app/src/main/assets/js/search.js')
-rw-r--r--app/src/main/assets/js/search.js33
1 files changed, 18 insertions, 15 deletions
diff --git a/app/src/main/assets/js/search.js b/app/src/main/assets/js/search.js
index 5f0f0e0a..0a8954ef 100644
--- a/app/src/main/assets/js/search.js
+++ b/app/src/main/assets/js/search.js
@@ -1,16 +1,19 @@
//binds callbacks to an invisible webview to take in the search events
-console.log('Binding Search');
-var _f_page = document.querySelector('#page');
-// var _f_input = document.querySelector('#main-search-input')
-if (!_f_page) Frost.emit(1);
-// else {
- Frost.emit(0);
- var x = new MutationObserver(function(mutations) {
- Frost.handleHtml(page.innerHTML);
- Frost.emit(2);
- });
- x.observe(_f_page, {
- childList: true,
- subtree: true
- });
-// }
+if (!window.hasOwnProperty('frost_search')) {
+ console.log('Registering frost_search');
+ window.frost_search = true;
+ var _f_page = document.querySelector('#page');
+ // var _f_input = document.querySelector('#main-search-input')
+ if (!_f_page) Frost.emit(1);
+ else {
+ Frost.emit(0);
+ var x = new MutationObserver(function(mutations) {
+ Frost.handleHtml(page.innerHTML);
+ Frost.emit(2);
+ });
+ x.observe(_f_page, {
+ childList: true,
+ subtree: true
+ });
+ }
+}