Last active
August 29, 2015 13:56
-
-
Save LouCypher/8979461 to your computer and use it in GitHub Desktop.
Stylish codes for keyconfig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stylishOverlay.addCode(""); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const TITLE = "Write style for domain\u2026"; | |
const promptSvc = Services.prompt; | |
function selectItems(aText, aArray) { | |
var selected = {}; | |
var result = promptSvc.select(null, TITLE, aText, aArray.length, aArray, selected); | |
if (result) | |
return selected.value; | |
return false; | |
} | |
var domain = null; | |
try { | |
domain = content.document.domain; | |
} catch (ex) {} | |
if (!domain) { // URL has no domain (file/data/about/chrome scheme) | |
stylishOverlay.addSite(); // Write style for current URL | |
return; | |
} | |
var domains = []; | |
stylishOverlay.getDomainList(content.document.domain, domains); // Get sub-domain(s) | |
if (domains.length === 1) { // If no sub-domain(s) | |
stylishOverlay.addDomain(domains[0]); // Write style for current domain | |
return; | |
} | |
// Select sub-domains | |
var index = selectItems("Select domain:", domains); | |
if (domains[index] !== undefined) | |
stylishOverlay.addDomain(domains[index]); // Write style for selected domain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stylishOverlay.addSite(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment