Skip to content

Instantly share code, notes, and snippets.

View azoff's full-sized avatar
🏠
Working from home

Jonathan Azoff azoff

🏠
Working from home
View GitHub Profile
@azoff
azoff / woot.watcher.bookmarklet.js
Created October 20, 2010 07:22
A WootOff Watcher that uses AJAX and alerts to run right in your browser
javascript:(function(win,domain,$){var w={config:{interval:3000,alertOnNew:true,selector:".leadIn"},homePage:"http://"+domain+"/default.aspx ",init:function(){w.element=$(w.config.selector);w.fragment=w.homePage+w.config.selector;w.update();win.WootWatcher=w},getProduct:function(){return w.element.find("h2.fn").html()},isNewProduct:function(item){return w.lastProduct&&w.lastProduct!==item},update:function(){w.element.load(w.fragment,w.parse)},enqueue:function(){w.timeout=setTimeout(w.update,w.config.interval)},dequeue:function(){if(w.timeout){clearTimeout(w.timeout)}},parse:function(newProduct){newProduct=w.getProduct();if(w.isNewProduct(newProduct)){if(w.config.alertOnNew){alert(newProduct)}else{if(console){console.log(newProduct)}}}w.lastProduct=newProduct;w.enqueue()}};$(w.init)})(window,document.domain,jQuery);