diff options
author | Allan Wang <me@allanwang.ca> | 2019-02-05 22:44:47 -0500 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2019-02-05 22:44:47 -0500 |
commit | 8b850711ceb7c38f9368ce840831c1c0bdb4ba74 (patch) | |
tree | fb0bbd6a5428f344497858b7c4ca54954226f113 /app/src/web/assets | |
parent | 87469aba96cee61b4252d9a6d023324598355244 (diff) | |
download | frost-8b850711ceb7c38f9368ce840831c1c0bdb4ba74.tar.gz frost-8b850711ceb7c38f9368ce840831c1c0bdb4ba74.tar.bz2 frost-8b850711ceb7c38f9368ce840831c1c0bdb4ba74.zip |
Add log and strict equality
Diffstat (limited to 'app/src/web/assets')
-rw-r--r-- | app/src/web/assets/js/context_a.js | 11 | ||||
-rw-r--r-- | app/src/web/assets/js/context_a.ts | 11 | ||||
-rw-r--r-- | app/src/web/assets/js/textarea_listener.js | 2 | ||||
-rw-r--r-- | app/src/web/assets/js/textarea_listener.ts | 2 |
4 files changed, 14 insertions, 12 deletions
diff --git a/app/src/web/assets/js/context_a.js b/app/src/web/assets/js/context_a.js index 0573a17a..d0f5c622 100644 --- a/app/src/web/assets/js/context_a.js +++ b/app/src/web/assets/js/context_a.js @@ -2,11 +2,11 @@ (function () { var longClick = false; var _frostCopyPost = function (e, target) { - if (target.tagName != 'A') { + if (target.tagName !== 'A') { return false; } var parent1 = target.parentElement; - if (!parent1 || parent1.tagName != 'DIV') { + if (!parent1 || parent1.tagName !== 'DIV') { return false; } var parent2 = parent1.parentElement; @@ -15,21 +15,22 @@ } var url = target.getAttribute('href'); var text = parent1.innerText; + console.log("Copy post " + url + " " + text); Frost.contextMenu(url, text); return true; }; var _frostImage = function (e, target) { var element = target; for (var i = 0; i < 2; i++) { - if (element.tagName != 'A') { + if (element.tagName !== 'A') { element = element.parentElement; } } - if (element.tagName != 'A') { + if (element.tagName !== 'A') { return false; } var url = element.getAttribute('href'); - if (!url || url == '#') { + if (!url || url === '#') { return false; } var text = element.parentElement.innerText; diff --git a/app/src/web/assets/js/context_a.ts b/app/src/web/assets/js/context_a.ts index 06d2f4a2..2a079f39 100644 --- a/app/src/web/assets/js/context_a.ts +++ b/app/src/web/assets/js/context_a.ts @@ -15,11 +15,11 @@ * Posts should click a tag, with two parents up being div.story_body_container */ const _frostCopyPost: EventHandler = (e, target) => { - if (target.tagName != 'A') { + if (target.tagName !== 'A') { return false; } const parent1 = target.parentElement; - if (!parent1 || parent1.tagName != 'DIV') { + if (!parent1 || parent1.tagName !== 'DIV') { return false; } const parent2 = parent1.parentElement; @@ -28,6 +28,7 @@ } const url = target.getAttribute('href')!; const text = parent1.innerText; + console.log(`Copy post ${url} ${text}`); Frost.contextMenu(url, text); return true; }; @@ -36,15 +37,15 @@ let element: Element = target; // Notifications are two layers under for (let i = 0; i < 2; i++) { - if (element.tagName != 'A') { + if (element.tagName !== 'A') { element = <Element>element.parentElement; } } - if (element.tagName != 'A') { + if (element.tagName !== 'A') { return false } const url = element.getAttribute('href'); - if (!url || url == '#') { + if (!url || url === '#') { return false } const text = (<HTMLElement>element.parentElement).innerText; diff --git a/app/src/web/assets/js/textarea_listener.js b/app/src/web/assets/js/textarea_listener.js index 02336382..1ec9b663 100644 --- a/app/src/web/assets/js/textarea_listener.js +++ b/app/src/web/assets/js/textarea_listener.js @@ -6,7 +6,7 @@ return; } console.log("FrostJSI focus, " + element.tagName); - if (element.tagName == 'TEXTAREA') { + if (element.tagName === 'TEXTAREA') { Frost.disableSwipeRefresh(true); } }; diff --git a/app/src/web/assets/js/textarea_listener.ts b/app/src/web/assets/js/textarea_listener.ts index 9d5fd388..062f5bf6 100644 --- a/app/src/web/assets/js/textarea_listener.ts +++ b/app/src/web/assets/js/textarea_listener.ts @@ -13,7 +13,7 @@ return } console.log(`FrostJSI focus, ${element.tagName}`); - if (element.tagName == 'TEXTAREA') { + if (element.tagName === 'TEXTAREA') { Frost.disableSwipeRefresh(true); } }; |