Created
December 8, 2010 23:58
-
-
Save bradhintze/734138 to your computer and use it in GitHub Desktop.
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
ruleset a876x14 { | |
meta { | |
name "Sweetter Search" | |
author "Cid Dennis" | |
logging on | |
key twitter { | |
"consumer_key" : "REDACTED", | |
"consumer_secret" : "REDACTED" | |
} | |
} | |
dispatch { | |
domain "apple.com" | |
domain "ebay.com" | |
domain "www.apple.com" | |
} | |
global { | |
tweets = twitter:authorized() => twitter:search({"q":"#addoncon","rpp": 40}) | {}; | |
; css <<.kGrowl-notification a { color: #0099CC; } .kGrowl-notification { color: #737373; } .KOBJ_tweetItems { margin: 10px; border-bottom: 1px dashed #D2DADA; padding-bottom: 10px; } #KOBJ_tweetList { list-style-position:outside; margin: 0; padding: 0; list-style-type: none; list-style-image: none; } .KOBJ_tweetDiv { height: 300px; overflow-x: auto; overflow-y: auto; background-color: #222; opacity: 0.8; } .KOBJ_tweetDiv p { background: none; color: #FFFFFF; font-family:arial,sans-serif; font-size: 9pt; } .KOBJ_tweetDiv a { color: #0099CC; } .KOBJ_tweetDiv li { list-style-position; list-style-type: none; padding-left: none } #KOBJ_tweetLogo { background-image: url("http:\/\/frag.kobj.net/kntx/images/header_sweetter.jpg"); height: 102px; display: block; margin-bottom: 10px; } .KOBJ_tweetedImage { float: left; margin-right: 10px; margin-top: 5px; } .KOBJ_tweetedUser { } .KOBJ_tweetedTweet { } >> | |
; } | |
rule authorize is active { | |
select using ".*" setting () | |
if not twitter:authorized() | |
then | |
twitter:authorize() | |
with | |
opacity = 1 and | |
sticky = true; | |
fired { | |
last; | |
} | |
} | |
rule backtweets is active { | |
select using ".*" setting() | |
pre { | |
url = page:env("caller"); | |
domain = url.replace(re/http:\/\/([A-Za-z0-9.-]+)\/.*/, "$1"); | |
results = tweets.pick("$..results"); | |
tweetIds = results.pick("$..id_str"); | |
tweetImages = results.pick("$..profile_image_url"); | |
tweetUsers = results.pick("$..from_user"); | |
tweetTexts = results.pick("$..text"); | |
tweetTimes = results.pick("$..created_at"); | |
image = << | |
<a href="http://www.kynetx.com"><span id="KOBJ_tweetLogo"/></a> | |
>>; | |
message = << | |
<div id="KOBJ_tweetLoading" style="text-align: center;"> <img src="http:\/\/frag.kobj.net/kntx/images/loading.gif" alt="Loading..." style="margin: 0 auto; "/> </div> <div class="KOBJ_tweetDiv" style="display: none; background-color: #222222;"> <ul id="KOBJ_tweetList" style="background-color: #222222;"> </ul> </div> | |
>>; | |
} | |
every { | |
notify(image, message) | |
with | |
sticky = true and | |
width = "300px" and | |
opacity = ".98"; | |
emit << | |
var tweets = $K(tweetTexts); var users = $K(tweetUsers); var images = $K(tweetImages); var DateObject = new Date(); var epochNow = DateObject.getTime()/1000.0; var offset = DateObject.getTimezoneOffset() * 60; $K(tweets).each(function(i) { var timeTest = tweetTimes[i]; var testDate = new Date(timeTest); var timeOutput = testDate; var tweet = this; $K("#KOBJ_tweetList").append('<li class="KOBJ_tweetItems"><p><span class="KOBJ_tweetedImage"><a href="http://www.twitter.com/'+users[i]+'"><img width="48px" height="48px" border="none" src="'+images[i]+'" /></a></span><span class="KOBJ_tweetedUser"><a href="http://www.twitter.com/'+users[i]+'">'+users[i]+'</a></span></p><span class="KOBJ_tweetedTweet"><p>'+tweet+'</p><p style="font-size:8pt; font-style:italic; margin-top:5px;">'+timeOutput+'</p></span></li>'); }); $K("#KOBJ_tweetLoading").slideUp("slow"); $K(".KOBJ_tweetDiv").slideDown("slow"); $K(".KOBJ_tweetDiv").css("background-color","#222222"); $K(".close").css("font-size", "22px"); $K(".close").css("margin-right","5px"); $K(".close").css("margin-top","2px"); >> | |
; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment