From 279c5a232878ed4401a67e59395c8be35dbe99a4 Mon Sep 17 00:00:00 2001 From: hideheader Date: Wed, 4 Mar 2015 12:03:28 -0500 Subject: [PATCH] Create new styles with `url-prefix()` `url-prefix()` is used ca. 100 times as often as `url()`. --- edit.js | 2 ++ popup.js | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/edit.js b/edit.js index e0f87d5f..c44b41c8 100644 --- a/edit.js +++ b/edit.js @@ -162,6 +162,8 @@ function init() { section.domains = [params.domain]; } else if (params.url) { section.urls = [params.url]; + } else if (params["url-prefix"]) { + section.urlPrefixes = [params["url-prefix"]]; } addSection(section); // default to enabled diff --git a/popup.js b/popup.js index 6623b85c..e981a610 100644 --- a/popup.js +++ b/popup.js @@ -25,13 +25,13 @@ chrome.tabs.getSelected(null, function(tab) { // For this URL var urlLink = writeStyleTemplate.cloneNode(true); - urlLink.href = "edit.html?url=" + encodeURIComponent(tab.url); + urlLink.href = "edit.html?url-prefix=" + encodeURIComponent(tab.url); urlLink.appendChild(document.createTextNode( // switchable; default="this URL" localStorage["popup.breadcrumbs.usePath"] !== "true" ? t("writeStyleForURL").replace(/ /g, "\u00a0") : /\/\/[^/]+\/(.*)/.exec(tab.url)[1] )); - urlLink.title = "url(\"$\")".replace("$", tab.url); + urlLink.title = "url-prefix(\"$\")".replace("$", tab.url); writeStyleLinks.push(urlLink); document.querySelector("#write-style").appendChild(urlLink) if (localStorage["popup.breadcrumbs"] !== "false") { // switchable; default=enabled