From 366ed2325db12aec1f92fa26e6d7315144c13c44 Mon Sep 17 00:00:00 2001 From: jspenguin2017 Date: Thu, 21 Dec 2017 13:45:41 -0700 Subject: [PATCH] https://github.com/NanoAdblocker/NanoCore/issues/54 hopefully works --- platform/chromium/manifest.json | 2 +- platform/chromium/nano-platform-vars.js | 1 + platform/chromium/vapi-common.js | 10 ++++++++-- src/js/nano-dashboard-bootstrap.js | 8 ++++++++ src/nano-dashboard.html | 1 + 5 files changed, 19 insertions(+), 3 deletions(-) diff --git a/platform/chromium/manifest.json b/platform/chromium/manifest.json index 6ab118a5eb3c0..8c65bd327c943 100644 --- a/platform/chromium/manifest.json +++ b/platform/chromium/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "Nano Adblocker", - "version": "1.0.0.16", + "version": "1.0.0.17", "commands": { "launch-element-zapper": { diff --git a/platform/chromium/nano-platform-vars.js b/platform/chromium/nano-platform-vars.js index d08f015c4c5cf..1297024e81eeb 100644 --- a/platform/chromium/nano-platform-vars.js +++ b/platform/chromium/nano-platform-vars.js @@ -24,4 +24,5 @@ /******************************************************************************/ window.NanoDefenderExtensionID = 'ggolfgbegefeeoocgjbmkembbncoadlb'; +window.NanoAdblockerDeveloperModeExtensionID = 'jdcnenncdjlhclmdpjeplfefbkimfalp'; window.NanoReIsDashboardURL = /^chrome-extension:\/\/[a-z]+\/(?:nano-)?dashboard\.html/; diff --git a/platform/chromium/vapi-common.js b/platform/chromium/vapi-common.js index e6ace50e8f672..b3f3d529144ac 100644 --- a/platform/chromium/vapi-common.js +++ b/platform/chromium/vapi-common.js @@ -65,8 +65,14 @@ vAPI.getURL = chrome.runtime.getURL; /******************************************************************************/ -// Patch 2017-12-07: Add a couple placeholders, might need a real i18n system -// soon... +vAPI.getExtensionID = function() { + return chrome.runtime.id; +}; + +/******************************************************************************/ + +// Patch 2017-12-07: Add a couple placeholders +// The new and robust i18n system is coming after the new dashboard var i18nPlaceholders = { 'genericYes': 'Yes', 'genericNo': 'No', diff --git a/src/js/nano-dashboard-bootstrap.js b/src/js/nano-dashboard-bootstrap.js index b77f3ce848114..8582fd5d1eda8 100644 --- a/src/js/nano-dashboard-bootstrap.js +++ b/src/js/nano-dashboard-bootstrap.js @@ -2,6 +2,14 @@ "use strict"; (async () => { + // I got an email saying it does not work at all, well, the new dashboard does not always work as it + // is not done yet, I don't think I have any link that leads to it in user-accessible UI + // Automatically bump back to old dashboard if not loaded in developer mode + if (vAPI.getExtensionID() !== NanoAdblockerDeveloperModeExtensionID) { + location.href = "dashboard.html"; + return; + } + allowTextSelection = await readOneSettings("nanoDashboardAllowSelection"); disableTooltips = await readOneSettings("tooltipsDisabled"); updateCSS(); // Assertion inside diff --git a/src/nano-dashboard.html b/src/nano-dashboard.html index ddff36cb95deb..1d9b0fa9f66ce 100644 --- a/src/nano-dashboard.html +++ b/src/nano-dashboard.html @@ -445,6 +445,7 @@

+