Skip to content

Instantly share code, notes, and snippets.

@jackysee
Created January 22, 2009 03:00
Show Gist options
  • Save jackysee/50394 to your computer and use it in GitHub Desktop.
Save jackysee/50394 to your computer and use it in GitHub Desktop.
CmdUtils.CreateCommand({
name: "css-insert",
author: { name: "Jacky", email: "jackysee at gmail"},
license: "GPL",
description: "Insert CSS",
help: "css body{line-height:1.5em;}",
takes: {"input": noun_arb_text},
preview: function( pblock, input ) {
pblock.innerHTML = "Insert CSS rule: " + input.text ;
},
execute: function(input) {
var doc = Application.activeWindow.activeTab.document;
var tag = doc.createElement("style");
tag.type = "text/css";
doc.getElementsByTagName("head")[0].appendChild(tag);
tag.innerHTML = input.text;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment