From 8b850711ceb7c38f9368ce840831c1c0bdb4ba74 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Tue, 5 Feb 2019 22:44:47 -0500 Subject: Add log and strict equality --- app/src/web/assets/js/context_a.js | 11 ++++++----- app/src/web/assets/js/context_a.ts | 11 ++++++----- app/src/web/assets/js/textarea_listener.js | 2 +- 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.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 = (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); } }; -- cgit v1.2.3