Normalize line endings in apply.js

This commit is contained in:
tophf 2015-05-06 19:53:41 +03:00
parent f62ccbc0ca
commit 2faead9732

View File

@ -1,18 +1,18 @@
requestStyles(); requestStyles();
function requestStyles() { function requestStyles() {
// If this is a Stylish page (Edit Style or Manage Styles), // If this is a Stylish page (Edit Style or Manage Styles),
// we'll request the styles directly to minimize delay and flicker, // we'll request the styles directly to minimize delay and flicker,
// unless Chrome still starts up and the background page isn't fully loaded. // unless Chrome still starts up and the background page isn't fully loaded.
// (Note: in this case the function may be invoked again from applyStyles.) // (Note: in this case the function may be invoked again from applyStyles.)
var request = {method: "getStyles", matchUrl: location.href, enabled: true, asHash: true}; var request = {method: "getStyles", matchUrl: location.href, enabled: true, asHash: true};
if (location.href.indexOf(chrome.extension.getURL("")) == 0) { if (location.href.indexOf(chrome.extension.getURL("")) == 0) {
var bg = chrome.extension.getBackgroundPage(); var bg = chrome.extension.getBackgroundPage();
if (bg && bg.getStyles) { if (bg && bg.getStyles) {
bg.getStyles(request, applyStyles); bg.getStyles(request, applyStyles);
return; return;
} }
} }
chrome.extension.sendMessage(request, applyStyles); chrome.extension.sendMessage(request, applyStyles);
} }
@ -36,9 +36,9 @@ chrome.extension.onMessage.addListener(function(request, sender, sendResponse) {
case "styleReplaceAll": case "styleReplaceAll":
replaceAll(request.styles, document); replaceAll(request.styles, document);
break; break;
case "realURL": case "realURL":
sendResponse(location.href); sendResponse(location.href);
break; break;
case "styleDisableAll": case "styleDisableAll":
disableAll(request.disableAll); disableAll(request.disableAll);
break; break;
@ -74,10 +74,10 @@ function removeStyle(id, doc) {
} }
function applyStyles(styleHash) { function applyStyles(styleHash) {
if (!styleHash) { // Chrome is starting up if (!styleHash) { // Chrome is starting up
requestStyles(); requestStyles();
return; return;
} }
if ("disableAll" in styleHash) { if ("disableAll" in styleHash) {
disableAll(styleHash.disableAll); disableAll(styleHash.disableAll);
delete styleHash.disableAll; delete styleHash.disableAll;
@ -162,4 +162,4 @@ var iframeObserver = new MutationObserver(function(mutations) {
}); });
}); });
}); });
iframeObserver.observe(document, {childList: true, subtree: true}); iframeObserver.observe(document, {childList: true, subtree: true});