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
function extend(target) { | |
// Run through rest parameters | |
Array.prototype.slice.call(arguments, 1).forEach(function (source) { | |
if (source) { | |
// If source is an array, only copy enumerable properties | |
var keys = (Array.isArray(source) ? Object.keys(source) : Object.getOwnPropertyNames(source)); | |
// Iterate over keys | |
keys.forEach(function (key) { | |
// Standards-compliant awesomeness |
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
// Get the current active tab | |
chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) { | |
// Send message to check whether the script has already been injected | |
chrome.tabs.sendMessage(tabs[0].id, "ping", function (response) { | |
// If no message handler exists (i.e. content-script hasn't been injected before), | |
// this callback is called right away with no arguments, so ... | |
if (typeof response === "undefined") { | |
// ... inject content-script (null means current active tab) | |
chrome.tabs.executeScript(null, { file: "content_script.js" }); | |
} |
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
/* | |
Set position like margin/padding shorthand - rules with null value | |
are removed from output (standard) | |
Example: | |
@include position(0 20px null, fixed); | |
Output: | |
position: fixed; | |
top: 0; |
NewerOlder