« get me outta code hell

interactive-bgm - Browser extension that adds background music based on the site you're browsing
about summary refs log tree commit diff
path: root/extension/popup
diff options
context:
space:
mode:
Diffstat (limited to 'extension/popup')
-rw-r--r--extension/popup/main.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/extension/popup/main.js b/extension/popup/main.js
index 1dc39f4..5b95db8 100644
--- a/extension/popup/main.js
+++ b/extension/popup/main.js
@@ -127,11 +127,11 @@ function loadTrackList(opts) {
     });
 }
 
-function getWildcardRepresentation(rule, urlString = rule.sourceURL) {
+function getWildcardRepresentation(rule, verbose = false) {
     const {hostnameMatch, pathnameMatch} = rule;
-    const {hostnameParts, pathnameParts} = getURLParts(urlString);
+    const {hostnameParts, pathnameParts} = getURLParts(rule.sourceURL);
 
-    let string = 'http(s)://';
+    let string = verbose ? 'http(s)://' : '';
 
     if (hostnameMatch.length !== hostnameParts.length) {
         if (hostnameMatch.length > 0) {
@@ -180,7 +180,7 @@ function loadRuleScreen({tab, rule, saveRule, deleteRule}) {
     };
 
     const updateWildcardRepresentation = () => {
-        const string = getWildcardRepresentation(rule, rule.sourceURL);
+        const string = getWildcardRepresentation(rule, true);
 
         const el = document.getElementById('wildcard-representation');
         while (el.firstChild) {
@@ -297,7 +297,7 @@ function loadRuleList({tab, siteSettings, selectRule}) {
         const li = document.createElement('li');
 
         li.classList.add('rule');
-        li.dataset.wildcardRepresentation = getWildcardRepresentation(rule, rule.sourceURL || tab.url);
+        li.dataset.wildcardRepresentation = getWildcardRepresentation(rule);
         li.appendChild(document.createTextNode(li.dataset.wildcardRepresentation));
         li.title = li.dataset.wildcardRepresentation;