diff --git a/app/contentscript.js b/app/contentscript.js index 88b4ffc..40406fb 100644 --- a/app/contentscript.js +++ b/app/contentscript.js @@ -31,6 +31,16 @@ function getFrzFlags() { return document.body.dataset.frzFlags && JSON.parse(document.body.dataset.frzFlags); } +function getTargetLabel() { + return document.body.dataset.frzTargetLabel; +} + +function getPageType() { + const beaconScript = document.getElementById('frz-beacon-script'); + + return beaconScript ? beaconScript.getAttribute('data-page-type') || '' : 'Missing beacon script'; +} + browser.runtime.onMessage.addListener((request, sender) => { switch (request.action) { case 'highlight_fragments': @@ -49,6 +59,10 @@ browser.runtime.onMessage.addListener((request, sender) => { case 'get_frz_flags': return Promise.resolve(getFrzFlags()); break; + case 'get_target_label': + return Promise.resolve(getTargetLabel()); + case 'get_page_type': + return Promise.resolve(getPageType()); default: return Promise.reject('unexpected message'); } diff --git a/app/frz-request.js b/app/frz-request.js index b817f06..c6900cc 100644 --- a/app/frz-request.js +++ b/app/frz-request.js @@ -269,10 +269,18 @@ class FRZRequest { getFrzFlags() { return this.browserApi.tabs.sendMessage(this.details.tabId, { action: 'get_frz_flags' }).catch((e) => this.logError('get_frz_flags', e)); } - + showLazyloadedImages() { this.browserApi.tabs.sendMessage(this.details.tabId, { action: 'show_lazyloaded_image' }).catch((e) => this.logError('show_lazyloaded_image', e)); } + + async getTargetLabel() { + return this.browserApi.tabs.sendMessage(this.details.tabId, { action: 'get_target_label' }).catch((e) => this.logError('get_target_label', e)); + } + + async getPageType() { + return this.browserApi.tabs.sendMessage(this.details.tabId, { action: 'get_page_type' }).catch((e) => this.logError('get_page_type', e)); + } } // window.FRZRequest = FRZRequest; diff --git a/app/popup/popup.html b/app/popup/popup.html index dc70c5d..e4dce8b 100644 --- a/app/popup/popup.html +++ b/app/popup/popup.html @@ -30,20 +30,7 @@

/>
- -
-
- -
-
-
+
 EdgeSEO +
+ +
@@ -117,6 +110,41 @@

>
+ +
+
+ Page type +
+ +
+ +
+
+
+
+ Target +
+ +
+ +
+
Cookie fstrz diff --git a/app/popup/popup.js b/app/popup/popup.js index 93e6195..750b846 100644 --- a/app/popup/popup.js +++ b/app/popup/popup.js @@ -159,6 +159,15 @@ function reloadPopup(tabID) { }) .catch(logError); + request.getTargetLabel().then(targetLabel => { + $('#target-fstrz').val(targetLabel); + }).catch(logError); + + request.getPageType().then(pageType => { + $('#page-type-fstrz').val(pageType); + }).catch(logError); + + getDebugCookie(request.details.url) .then(debugCookie => { if (debugCookie && debugCookie.value === 'true') {