Apply styles to Stylish pages

This commit is contained in:
Jason Barnabe 2015-02-08 22:25:35 -06:00
parent 0006e001b4
commit 5e3efb3df6
5 changed files with 6 additions and 3 deletions

View File

@ -144,8 +144,8 @@ function getApplicableSections(style, url) {
} }
function sectionAppliesToUrl(section, url) { function sectionAppliesToUrl(section, url) {
// only http, https, and file allowed // only http, https, file, and chrome-extension allowed
if (url.indexOf("http") != 0 && url.indexOf("file") != 0) { if (url.indexOf("http") != 0 && url.indexOf("file") != 0 && url.indexOf("chrome-extension") != 0) {
return false; return false;
} }
if (!section.urls && !section.domains && !section.urlPrefixes && !section.regexps) { if (!section.urls && !section.domains && !section.urlPrefixes && !section.regexps) {

View File

@ -89,6 +89,7 @@
<script src="storage.js"></script> <script src="storage.js"></script>
<script src="messaging.js"></script> <script src="messaging.js"></script>
<script src="localization.js"></script> <script src="localization.js"></script>
<script src="apply.js"></script>
</head> </head>
<body id="stylish-edit"> <body id="stylish-edit">
<div id="header"> <div id="header">

View File

@ -88,6 +88,7 @@
<script src="health.js"></script> <script src="health.js"></script>
<script src="storage.js"></script> <script src="storage.js"></script>
<script src="messaging.js"></script> <script src="messaging.js"></script>
<script src="apply.js"></script>
</head> </head>
<body id="stylish-manage"> <body id="stylish-manage">

View File

@ -41,6 +41,7 @@
<script src="health.js"></script> <script src="health.js"></script>
<script src="storage.js"></script> <script src="storage.js"></script>
<script src="messaging.js"></script> <script src="messaging.js"></script>
<script src="apply.js"></script>
</head> </head>
<body id="stylish-popup"> <body id="stylish-popup">

View File

@ -5,7 +5,7 @@ var writeStyleTemplate = document.createElement("a");
writeStyleTemplate.className = "write-style-link"; writeStyleTemplate.className = "write-style-link";
chrome.tabs.getSelected(null, function(tab) { chrome.tabs.getSelected(null, function(tab) {
var urlWillWork = /^(file|http|https):.*/.test(tab.url); var urlWillWork = /^(file|http|https|chrome\-extension):.*/.test(tab.url);
if (!urlWillWork) { if (!urlWillWork) {
["installed", "find-styles", "write-style"].forEach(function(id) { ["installed", "find-styles", "write-style"].forEach(function(id) {