Create new styles with url-prefix()
`url-prefix()` is used ca. 100 times as often as `url()`.
This commit is contained in:
parent
1920a5e890
commit
279c5a2328
2
edit.js
2
edit.js
|
@ -162,6 +162,8 @@ function init() {
|
||||||
section.domains = [params.domain];
|
section.domains = [params.domain];
|
||||||
} else if (params.url) {
|
} else if (params.url) {
|
||||||
section.urls = [params.url];
|
section.urls = [params.url];
|
||||||
|
} else if (params["url-prefix"]) {
|
||||||
|
section.urlPrefixes = [params["url-prefix"]];
|
||||||
}
|
}
|
||||||
addSection(section);
|
addSection(section);
|
||||||
// default to enabled
|
// default to enabled
|
||||||
|
|
4
popup.js
4
popup.js
|
@ -25,13 +25,13 @@ chrome.tabs.getSelected(null, function(tab) {
|
||||||
|
|
||||||
// For this URL
|
// For this URL
|
||||||
var urlLink = writeStyleTemplate.cloneNode(true);
|
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"
|
urlLink.appendChild(document.createTextNode( // switchable; default="this URL"
|
||||||
localStorage["popup.breadcrumbs.usePath"] !== "true"
|
localStorage["popup.breadcrumbs.usePath"] !== "true"
|
||||||
? t("writeStyleForURL").replace(/ /g, "\u00a0")
|
? t("writeStyleForURL").replace(/ /g, "\u00a0")
|
||||||
: /\/\/[^/]+\/(.*)/.exec(tab.url)[1]
|
: /\/\/[^/]+\/(.*)/.exec(tab.url)[1]
|
||||||
));
|
));
|
||||||
urlLink.title = "url(\"$\")".replace("$", tab.url);
|
urlLink.title = "url-prefix(\"$\")".replace("$", tab.url);
|
||||||
writeStyleLinks.push(urlLink);
|
writeStyleLinks.push(urlLink);
|
||||||
document.querySelector("#write-style").appendChild(urlLink)
|
document.querySelector("#write-style").appendChild(urlLink)
|
||||||
if (localStorage["popup.breadcrumbs"] !== "false") { // switchable; default=enabled
|
if (localStorage["popup.breadcrumbs"] !== "false") { // switchable; default=enabled
|
||||||
|
|
Loading…
Reference in New Issue
Block a user