/*
* Todd Willey <todd@rubidine.com>
*
* Completed at Collexion OpenHack 7/2/2009.
*
* Lessons Learned:
* * Don't use jquery's .append("<script>...</script>")
* * Don't use jquery's $(contentDocument).find('body').appned(domNode)
* * Only use vanilla javascript on the contentDocument
* (or it may show up on the about:jetpack page)
*/
jetpack.tabs.onReady(
function() {
function linkJS(doc) {
var script = doc.createElement('script');
script.setAttribute('src', 'http://cornify.com/js/cornify.js');
doc.body.appendChild(script);
}
function callJS(doc) {
var script = doc.createElement('script');
script.type = "text/javascript";
script.appendChild(doc.createTextNode('cornify_add()'));
doc.body.appendChild(script);
}
if ($(this.contentDocument).text().match(/pretty/i)) {
// console.log("MAKE " + this.contentWindow.location + " EVEN PRETTIER!");
linkJS(this.contentDocument);
callJS(this.contentDocument);
} else {
// console.log(this.contentWindow.location + " IS DESTINED FOR HOMLINESS")
}
}
)