From 0562c71cd8426d16ec48a920293c47f76bf8f682 Mon Sep 17 00:00:00 2001 From: kipz Date: Wed, 29 Sep 2010 02:50:06 -0400 Subject: [PATCH] kickoff - just something to look over for now **do not use this in a production enviroment** --- README | 4 + css/comment-arrow.gif | Bin 0 -> 552 bytes css/comment-reply.gif | Bin 0 -> 453 bytes css/signin.png | Bin 0 -> 4066 bytes css/tritium4.css | 349 +++++++++++++++++++++++++++++++++++++++++++++ css/tritium4.min.css | 1 + index.lp | 30 ++++ lib/tritium4/config.lua | 166 +++++++++++++++++++++ lib/tritium4/functions.lua | 140 ++++++++++++++++++ script/tritium4.js | 163 +++++++++++++++++++++ script/tritium4.min.js | 1 + 11 files changed, 854 insertions(+) create mode 100644 README create mode 100644 css/comment-arrow.gif create mode 100644 css/comment-reply.gif create mode 100644 css/signin.png create mode 100644 css/tritium4.css create mode 100644 css/tritium4.min.css create mode 100644 index.lp create mode 100644 lib/tritium4/config.lua create mode 100644 lib/tritium4/functions.lua create mode 100644 script/tritium4.js create mode 100644 script/tritium4.min.js diff --git a/README b/README new file mode 100644 index 0000000..879ba05 --- /dev/null +++ b/README @@ -0,0 +1,4 @@ +tritium4 - a browser based twitter client for CGILua +------------------------------------------------------ + +TODO: this file diff --git a/css/comment-arrow.gif b/css/comment-arrow.gif new file mode 100644 index 0000000000000000000000000000000000000000..69c9ac6951a5f9dd008f41fa664d6e8c0a5147fb GIT binary patch literal 552 zcwTe&bhEHblx2`*c*el+<;$0M@7}$9`SSDU&+p&A|MuCq2NNSlZ(sj}i4&W8CQX~p!8&EeoPN$(>{I8? z;G92u@${w37Ot4KYW1SEed|}VY?`-)m6?6pc8)DeckS7C;Nb4PYmXi~eDc)%<7dwu zIx*+ms>_S7UB7Vk*6Ayg?%h7K?$P~~&z?Vg`D((O#}D?uf7|={!;Wv~pZxs(>Cdli L{|<7qFjxZsIzw@J literal 0 HcwPel00001 diff --git a/css/comment-reply.gif b/css/comment-reply.gif new file mode 100644 index 0000000000000000000000000000000000000000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KhLj%4i^Lm9~;UXdjI~tRiXukrkG;$ z%dc`_a~se(u@!my_HBntm+YOKoa7=-?gB~M3g6A;+rMdu$vE#y5Rc9sSD z@6%;Zo90)ww6x4sQgU;1&87zbc+U^jI%^a$AL>g?oHjg%W49Mr!(A*fNemWu?if@YgMU_E93afm^IO~0{R zd(>KZBE40u=CO-4oB+!lUXbm8DP(mTZ{D;sb5{3H#YDHwr`f#p@bo13YkNlKuv_9a zFfl2=n-X;cOHQUG9;=Vo5&m&~!d{&?&}qXZMn{B?yu3--z4YhH+pIdrzi$xZ@zXwf z;;nT-BLY3d}EVD-9865B7>vrubp+->)Ly;@6z!s0uLhT*!eT&D|0Qsw#hbW~Q{EO#D9B3Sq_j<(j?Cw$U!KGVA#t9p0fE>z9si z(oH?rkpD(-_ofcf7ZA9eX3q3Ze0tS>&ri`D&@WUXE=1RL$~kV zvg_(WG#X9jG2}LiY;`5iE2RB6FY3+PJGHA6w%p?gEv>BB@aOE&qb`hQPh<OyM!%q*tk3AX>8-K{Ng7R6@dfBz4aR=>pn literal 0 HcwPel00001 diff --git a/css/tritium4.css b/css/tritium4.css new file mode 100644 index 0000000..d6f3ad1 --- /dev/null +++ b/css/tritium4.css @@ -0,0 +1,349 @@ +html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, +p, blockquote, pre, a, abbr, address, cite, code, del, dfn, em, +img, ins, q, small, strong, sub, sup, dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td +{ + margin: 0; + padding: 0; + border: 0; +} + +article, aside, figure, figure img, figcaption, hgroup, +footer, header, nav, section, video, object +{ + display: block; +} + +a img +{ + border: 0; +} + +a:focus,a:hover +{ + color: #039; +} + +a +{ + color: #456; + text-decoration: none; +} + +a:hover +{ + text-decoration: underline; +} + +.hr +{ + border-bottom: 1px solid #DDDDDD; + margin-bottom: 3px; + margin-top: 2px; + margin-left: -3px; +} + +.huge, h1 +{ + text-shadow: rgba(215,215,215,0.3) 5px 5px 8px; + -moz-user-select: none; + -khtml-user-select: none; + -webkit-user-select: none; + cursor: default; + font: normal 90% "Lobster", sans-serif; + font-size: 68px; + color: #555; + letter-spacing: -1px; + padding: 0 20px; + text-align: center; +} + +.large, h2 +{ + text-shadow: rgba(215,215,215,0.3) 4px 4px 7px; + -moz-user-select: none; + -khtml-user-select: none; + -webkit-user-select: none; + cursor: default; + font: normal 90% "Lobster", sans-serif; + font-size: 42px; + color: #555; + line-height: 48px; + letter-spacing: -1px; + text-align: center; +} + +.big, h3 +{ + font-size: 26px; + line-height: 36px; +} + +.normal, body +{ + font: normal 80% "Cantrell", sans-serif; +} + +.small, small +{ + font-size: 13px; + line-height: 18px; +} + +.left,.alignleft +{ + float: left; +} + +.right,.alignright +{ + float: right; +} + +.clear,.clearer +{ + clear: both; +} + +.clearer +{ + display: block; + font-size: 0; + line-height: 0; + height: 0; +} + +.comment-parent, .comment-single +{ + margin-top: 15px; + margin-bottom: 15px; +} + +.comment-list ul.children, #comments #respond ul +{ + margin: 0 0 0 130px; +} + +.comment-list ul.children ul.children +{ + margin-left: 15px; +} + +.comment-list ul.children li +{ + background: url('/css/comment-reply.gif') no-repeat left top; + margin: 0; + padding: 10px 0 0 15px; +} + +.comment-list ul.children .comment-body +{ + background: #FCFCFC; +} + +.comment-author +{ + padding-top: 2px; +} + +.comment-text p +{ + margin-bottom: 0.8em; + padding-left: 4px; +} + +.comment .post-date, .comment-author +{ + font-size: 0.85em; +} + +.comment .post-date .right a +{ + color: #BBB; +} + +.comment .post-date .right a:hover +{ + color: #234; +} + +.comment-body +{ + border-radius: 0px 10px 10px 10px; + box-shadow: 2px 2px 5px rgba(15,15,15,0.1); + -moz-border-radius: 0px 10px 10px 10px; + -moz-box-shadow: 2px 2px 5px rgba(15,15,15,0.1); + -webkit-border-radius: 0px 10px 10px 10px; + -webkit-box-shadow: 2px 2px 5px rgba(15,15,15,0.1); + background: #FFF; + border: 1px solid #DDD; + padding: 1px 12px 0 3px; +} + +.comment-arrow +{ + background: url('/css/comment-arrow.gif') no-repeat left top; + display: block; + float: left; + height: 35px; + margin: 15px 0 -45px -23px; + position: absolute; + width: 20px; +} + +.comment-list-wrapper +{ + border-radius: 15px; + box-shadow: 3px 3px 7px rgba(15,15,15,0.3); + -moz-border-radius: 15px; + -moz-box-shadow: 3px 3px 7px rgba(15,15,15,0.3); + -webkit-border-radius: 15px; + -webkit-box-shadow: 3px 3px 7px rgba(15,15,15,0.3); + background: #F6F6F6; + margin: 10px 0 0; + padding: 5px 12px 10px 7px; +} + +.comment-input-text textarea +{ + width: 80%; +} + +.comment-list +{ + margin: 0; + padding: 0; +} + +.comment-list li +{ + list-style: none; +} + +.comment-list ul +{ + margin-bottom: 0; +} + +.comment-gravatar +{ + margin-bottom: 3px; +} + +.comment-content-wrapper +{ + float: right; + width: 552px; +} +.comment-profile-wrapper +{ + text-align: center; + width: 105px; +} + +::selection {background: rgba(175,175,175,0.4);} +::-moz-selection {background: rgba(175,175,175,0.4);} + +body +{ + -webkit-font-smoothing: subpixel-antialiased; + height: 100%; + margin: 0; + padding: 36px 36px 0; + background: #888888; + position: relative; + margin: 0 auto; + width: 696px; +} + +/* + 2-column, 320 px layout for smartphones + --------------------------------------- + 1 2 + 120px 264px (24px gutters) +*/ +@media only screen and (max-width: 767px) +{ + body + { + padding: 18px 18px 0; + width: 264px; + } + .comment-arrow + { + margin: 15px 0 -45px -18px; + width: 15px; + } + .comment-content-wrapper + { + float: right; + width: 165px; + } + .comment-profile-wrapper + { + text-align: center; + width: 55px; + } + .normal, body + { + font: normal 67% "Cantrell", sans-serif; + } +} + +/* + 8-column, 1224 px layout for desktops and laptops + ------------------------------------------------------------------------ + 1 2 3 4 5 6 7 8 + 120px 264px 408px 552px 696px 840px 984px 1128px (24px gutters) +*/ +@media only screen and (min-width: 1224px) +{ + body + { + padding: 28px 28px 0; + width: 1128px; + } + .comment-content-wrapper + { + float: right; + width: 984px; + } + .comment-profile-wrapper + { + text-align: center; + width: 105px; + } + .normal, body + { + font: normal 80% "Cantrell", sans-serif; + } +} + +/* + 12-column, 1824 px layout for gigantic screens (24px gutters) + --------------------------------------------------------------------------------------- + 1 2 3 4 5 6 7 8 9 10 11 12 + 120px 264px 408px 552px 696px 840px 984px 1128px 1272px 1416px 1560px 1704px +*/ +@media only screen and (min-width: 1824px) +{ + body + { + padding: 48px 48px 0; + width: 1704px; + } + .comment-content-wrapper + { + float: right; + width: 1560px; + } + .comment-profile-wrapper + { + text-align: center; + width: 105px; + } + .normal, body + { + font: normal 90% "Cantrell", sans-serif; + } +} diff --git a/css/tritium4.min.css b/css/tritium4.min.css new file mode 100644 index 0000000..6100686 --- /dev/null +++ b/css/tritium4.min.css @@ -0,0 +1 @@ +html,body,div,span,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,address,cite,code,del,dfn,em,img,ins,q,small,strong,sub,sup,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;}article,aside,figure,figure img,figcaption,hgroup,footer,header,nav,section,video,object{display:block;}a img{border:0;}a:focus,a:hover{color:#039;}a{color:#456;text-decoration:none;}a:hover{text-decoration:underline;}.hr{border-bottom:1px solid #DDD;margin-bottom:3px;margin-top:2px;margin-left:-3px;}.huge,h1{text-shadow:rgba(215,215,215,0.3) 5px 5px 8px;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;cursor:default;font:normal 90% "Lobster",sans-serif;font-size:68px;color:#555;letter-spacing:-1px;padding:0 20px;text-align:center;}.large,h2{text-shadow:rgba(215,215,215,0.3) 4px 4px 7px;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;cursor:default;font:normal 90% "Lobster",sans-serif;font-size:42px;color:#555;line-height:48px;letter-spacing:-1px;text-align:center;}.big,h3{font-size:26px;line-height:36px;}.normal,body{font:normal 80% "Cantrell",sans-serif;}.small,small{font-size:13px;line-height:18px;}.left,.alignleft{float:left;}.right,.alignright{float:right;}.clear,.clearer{clear:both;}.clearer{display:block;font-size:0;line-height:0;height:0;}.comment-parent,.comment-single{margin-top:15px;margin-bottom:15px;}.comment-list ul.children,#comments #respond ul{margin:0 0 0 130px;}.comment-list ul.children ul.children{margin-left:15px;}.comment-list ul.children li{background:url('/css/comment-reply.gif') no-repeat left top;margin:0;padding:10px 0 0 15px;}.comment-list ul.children .comment-body{background:#FCFCFC;}.comment-author{padding-top:2px;}.comment-text p{margin-bottom:.8em;padding-left:4px;}.comment .post-date,.comment-author{font-size:.85em;}.comment .post-date .right a{color:#BBB;}.comment .post-date .right a:hover{color:#234;}.comment-body{border-radius:0 10px 10px 10px;box-shadow:2px 2px 5px rgba(15,15,15,0.1);-moz-border-radius:0 10px 10px 10px;-moz-box-shadow:2px 2px 5px rgba(15,15,15,0.1);-webkit-border-radius:0 10px 10px 10px;-webkit-box-shadow:2px 2px 5px rgba(15,15,15,0.1);background:#FFF;border:1px solid #DDD;padding:1px 12px 0 3px;}.comment-arrow{background:url('/css/comment-arrow.gif') no-repeat left top;display:block;float:left;height:35px;margin:15px 0 -45px -23px;position:absolute;width:20px;}.comment-list-wrapper{border-radius:15px;box-shadow:3px 3px 7px rgba(15,15,15,0.3);-moz-border-radius:15px;-moz-box-shadow:3px 3px 7px rgba(15,15,15,0.3);-webkit-border-radius:15px;-webkit-box-shadow:3px 3px 7px rgba(15,15,15,0.3);background:#F6F6F6;margin:10px 0 0;padding:5px 12px 10px 7px;}.comment-input-text textarea{width:80%;}.comment-list{margin:0;padding:0;}.comment-list li{list-style:none;}.comment-list ul{margin-bottom:0;}.comment-gravatar{margin-bottom:3px;}.comment-content-wrapper{float:right;width:552px;}.comment-profile-wrapper{text-align:center;width:105px;}::selection{background:rgba(175,175,175,0.4);}::-moz-selection{background:rgba(175,175,175,0.4);}body{-webkit-font-smoothing:subpixel-antialiased;height:100%;margin:0;padding:36px 36px 0;background:#888;position:relative;margin:0 auto;width:696px;}@media only screen and(max-width:767px){body{padding:18px 18px 0;width:264px;}.comment-arrow{margin:15px 0 -45px -18px;width:15px;}.comment-content-wrapper{float:right;width:165px;}.comment-profile-wrapper{text-align:center;width:55px;}.normal,body{font:normal 67% "Cantrell",sans-serif;}}@media only screen and(min-width:1224px){body{padding:28px 28px 0;width:1128px;}.comment-content-wrapper{float:right;width:984px;}.comment-profile-wrapper{text-align:center;width:105px;}.normal,body{font:normal 80% "Cantrell",sans-serif;}}@media only screen and(min-width:1824px){body{padding:48px 48px 0;width:1704px;}.comment-content-wrapper{float:right;width:1560px;}.comment-profile-wrapper{text-align:center;width:105px;}.normal,body{font:normal 90% "Cantrell",sans-serif;}} \ No newline at end of file diff --git a/index.lp b/index.lp new file mode 100644 index 0000000..aeb06ea --- /dev/null +++ b/index.lp @@ -0,0 +1,30 @@ + +
+ +
+ diff --git a/lib/tritium4/config.lua b/lib/tritium4/config.lua new file mode 100644 index 0000000..8bfca1f --- /dev/null +++ b/lib/tritium4/config.lua @@ -0,0 +1,166 @@ +--[[ +consumer information (register your app at twitter.com/apps +]]-- +consumer_key = "" +consumer_secret = "" + +--[[ +google stuff +]]-- +google_api_key = "ABQIAAAAIwuVMEXuk-m6djJbJCi-rRT14FIEZj_Ds5A1V-U72dB9nZ-JhhRbwLjsZsmS26Y4LwwSwnLojbdgvg" + + +--[[ +tritium4 stuff +]]-- +redirection = "" + +--[[ +tthe below contains some base information about where we will make requests to at twitter +]]-- +access_token = "https://api.twitter.com/oauth/access_token" +authorize_user = "https://api.twitter.com/oauth/authorize" +request_token = "https://api.twitter.com/oauth/request_token" + +--[[ +the below contains +]]-- +oauth_token = tostring(cgilua.cookies.get("oauth_token")) +oauth_token_secret = tostring(cgilua.cookies.get("oauth_token_secret")) +temp_oauth_token = tostring(cgilua.cookies.get("temp_oauth_token")) +temp_oauth_token_secret = tostring(cgilua.cookies.get("temp_oauth_token_secret")) +screen_name = tostring(cgilua.cookies.get("screen_name")) +user_id = tostring(cgilua.cookies.get("user_id")) + +--[[ +twitter resources (from ltwitter) +]]-- +resources = { + -- Timeline resources + publicTimeline = {"GET", "statuses/public_timeline"}, + homeTimeline = {"GET", "statuses/home_timeline"}, + friendsTimeline = {"GET", "statuses/friends_timeline"}, + userTimeline = {"GET", "statuses/user_timeline"}, + mentions = {"GET", "statuses/mentions"}, + retweetedByMe = {"GET", "statuses/retweeted_by_me"}, + retweetedToMe = {"GET", "statuses/retweeted_to_me"}, + -- Tweets resources + retweetsOfMe = {"GET", "statuses/retweets_of_me"}, + showStatus = {"GET", "statuses/show"}, + updateStatus = {"POST", "statuses/update"}, + destroyStatus = {"POST", "statuses/destroy"}, + retweetStatus = {"POST", "statuses/retweet/:id"}, + retweets = {"GET", "statuses/retweets"}, + retweetedBy = {"GET", "statuses/:id/retweeted_by"}, + retweetedByIds = {"GET", "statuses/:id/retweeted_by/ids"}, + -- User resources + showUser = {"GET", "users/show"}, + lookupUsers = {"GET", "users/lookup"}, + searchUsers = {"GET", "users/search"}, + suggestedUserGroups = {"GET", "users/suggestions"}, + suggestedUsers = {"GET", "users/suggestions/:slug"}, + profileImage = {"GET", "users/profile_image/:screen_name"}, + friends = {"GET", "statuses/friends"}, + followers = {"GET", "statuses/followers"}, + -- Trends resources + trends = {"GET", "trends"}, + currentTrends = {"GET", "trends/current"}, + dailyTrends = {"GET", "trends/daily"}, + weeklyTrends = {"GET", "trends/weekly"}, + -- List resources + newList = {"POST", ":user/lists"}, + updateList = {"POST", ":user/lists/:id"}, + userLists = {"GET", ":user/lists"}, + showList = {"GET", ":user/lists/:id"}, + deleteList = {"DELETE", ":user/lists/:id"}, + listTimeline = {"GET", ":user/lists/:id/statuses"}, + listMemberships = {"GET", ":user/lists/memberships"}, + listSubscriptions = {"GET", ":user/lists/subscriptions"}, + -- List Members resources + getListMembers = {"GET", ":user/:list_id/members"}, + addListMember = {"POST", ":user/:list_id/members"}, + delListMember = {"DELETE", ":user/:list_id/members"}, + chkListMember = {"GET", ":user/:list_id/members/:id"}, + -- List Subscribers resources + getListSubscribers = {"GET", ":user/:list_id/subscribers"}, + addListSubscriber = {"POST", ":user/:list_id/subscribers"}, + delListSubscriber = {"DELETE", ":user/:list_id/subscribers"}, + chkListSubscriber = {"GET", ":user/:list_id/subscribers/:id"}, + -- Direct Messages resources + listMessages = {"GET", "direct_messages"}, + sentMessages = {"GET", "direct_messages/sent"}, + sendMessage = {"POST", "direct_messages/new"}, + removeMessage = {"POST", "direct_messages/destroy"}, + -- Friendship resources + follow = {"POST", "friendships/create/:id"}, + unfollow = {"POST", "friendships/destroy/:id"}, + isFollowing = {"GET", "friendships/exists"}, + showRelation = {"GET", "friendships/show"}, + inFriendships = {"GET", "friendships/incoming"}, + outFriendships = {"GET", "friendships/outgoing"}, + -- Friends and Followers resources + following = {"GET", "friends/ids"}, + followers = {"GET", "followers/ids"}, + -- Account resources + rateLimitStatus = {"GET", "account/rate_limit_status"}, + updateDeliveryDevice = {"POST", "account/update_delivery_device"}, + updateProfileColors = {"POST", "account/update_profile_colors"}, + updateProfileImage = {"POST", "account/update_profile_image"}, + updateProfileBackground = {"POST", "account/update_profile_background"}, + updateProfile = {"POST", "account/update_profile"}, + -- Favorites resources + favorites = {"GET", "favorites"}, + addFavorite = {"POST", "favorites/:id/create"}, + delFavorite = {"POST", "favorites/destroy"}, + -- Notifications resources + enableNotifications = {"POST", "notifications/follow"}, + disableNotifications = {"POST", "notifications/unfollow"}, + -- Block resources + addBlock = {"POST", "blocks/create"}, + delBlock = {"POST", "blocks/destroy"}, + chkBlock = {"GET", "blocks/exists"}, + blocking = {"GET", "blocks/blocking"}, + blockingIds = {"GET", "blocks/blocking/ids"}, + -- Spam Reporting resources + reportSpam = {"POST", "report_spam"}, + -- Saved Searches resources + savedSearches = {"GET", "saved_searches"}, + doSavedSearch = {"GET", "saved_searches/show"}, + addSavedSearch = {"POST", "saved_searches/create"}, + delSavedSearch = {"POST", "saved_searches/destroy"}, + -- Local Trends resources + availableLocations = {"GET", "trends/available"}, + locationTrends = {"GET", "trends/locations/:woeid"}, + -- Geo resources + reverseGeocode = {"GET", "geo/reverse_geocode"}, + placeInfo = {"GET", "geo/id/:place_id"} +} + +--[[ +after merging the above table, we callback to this to make the request +this make its easier to do future toggling between sites such as twitter, identica, etc. +]]-- +twitter = { + __index = function(tbl, method) + if not resources[method] then return nil end + local resource = resources[method] + local url = "https://api.twitter.com/1/"..resource[2]..".json" + return function(self, args) + args = args or {} + local url = url:gsub(":([%w_-]+)", function (s) + if args[s] then + local ret = args[s] + args[s] = nil + return ret + else + return s + end + end) + for k,v in pairs(args) do + args[k] = tostring(v) + end + local _, _, _, body = self.oauth_client:PerformRequest(resource[1], url, args) + return body + end + end +} diff --git a/lib/tritium4/functions.lua b/lib/tritium4/functions.lua new file mode 100644 index 0000000..55f1f2e --- /dev/null +++ b/lib/tritium4/functions.lua @@ -0,0 +1,140 @@ +json = require("json") +oauth = require("OAuth") + +function connect() + local request = request1() + values = request:RequestToken() + local new_oauth_token = tostring(values.oauth_token) + local new_oauth_token_secret = tostring(values.oauth_token_secret) + local new_url = request:BuildAuthorizationUrl() + cgilua.cookies.set("temp_oauth_token",new_oauth_token) + cgilua.cookies.set("temp_oauth_token_secret",new_oauth_token_secret) + cgilua.redirect(new_url) +end + +function callback(move) + local request = request1() + request:SetToken(temp_oauth_token) + request:SetTokenSecret(temp_oauth_token_secret) + values = request:GetAccessToken() + local new_oauth_token = tostring(values.oauth_token) + local new_oauth_token_secret = tostring(values.oauth_token_secret) + local user_id = tostring(values.user_id) + local screen_name = tostring(values.screen_name) + cgilua.cookies.set("oauth_token",new_oauth_token) + cgilua.cookies.set("oauth_token_secret",new_oauth_token_secret) + cgilua.cookies.set("screen_name",screen_name) + cgilua.cookies.set("user_id",user_id) + cgilua.cookies.delete("temp_oauth_token") + cgilua.cookies.delete("temp_oauth_token_secret") + cgilua.redirect(move) +end + +function footer() + cgilua.put([[]]) +end + +function header(title,header) + cgilua.put([[ + + + + + + + + + + + + ]]) + if header ~= "nil" then + cgilua.put("@"..header.." on tritium4") + else + cgilua.put("tritium4") + end + cgilua.put([[ + + +

]]) + if header ~= "nil" then + cgilua.put("@"..header) + else + cgilua.put("tritium4") + end + cgilua.put([[

+ ]]) +end + +function loggedin() + cgilua.put('
') + if (oauth_token ~= "nil" and oauth_token_secret ~= "nil") then + cgilua.put('') + else + cgilua.put('') + end + cgilua.put('
') +end + +function logout(move) + cgilua.cookies.delete("oauth_token") + cgilua.cookies.delete("oauth_token_secret") + cgilua.cookies.delete("screen_name") + cgilua.cookies.delete("temp_oauth_token") + cgilua.cookies.delete("temp_oauth_token_secret") + cgilua.cookies.delete("user_id") + cgilua.redirect(move) +end + +function request1() + local oauth_client = oauth.new(consumer_key,consumer_secret, + { + AccessToken = access_token, + AuthorizeUser = authorize_user, + RequestToken = request_token + }) + return oauth_client +end + +function request2() + local o = setmetatable({}, twitter) + o.oauth_client = oauth.new(consumer_key,consumer_secret, + { + AccessToken = access_token, + AuthorizeUser = authorize_user, + RequestToken = request_token + }, + { + OAuthToken = oauth_token, + OAuthTokenSecret = oauth_token_secret + }) + return o +end + +function switch(case) + return function(codetable) + local f = codetable[case] or codetable.default + if f then + if type(f) == "function" then + return f(case) + else + error("case "..tostring(case).." not a function") + end + end + end +end + +function timeline(method,params) + local request = request2() + switch(method) + { + ["home"] = function() rx = request:homeTimeline{params} end, + ["profile"] = function() rx = request:userTimeline{params} end, + ["replies"] = function() rx = request:mentions{params} end, + default = function() local rx = request:homeTimeline{params} end + } + cgilua.contentheader("application","json") + cgilua.put(tostring(rx)) +end diff --git a/script/tritium4.js b/script/tritium4.js new file mode 100644 index 0000000..e70826b --- /dev/null +++ b/script/tritium4.js @@ -0,0 +1,163 @@ +function json_request(url,method,params,output,type) +{ + new Ajax.Request("./?show="+url, + { + method: method, + parameters: params, + evalScripts: true, + onSuccess: function(data) + { + var json = data.responseText.evalJSON(); + var content = '
    '; + for (i = 0; i < json.length; ++i) + { + if (typeof json[i]["retweeted_status"] != 'undefined') + { + var chunk = "retweeted_status"; + } + else + { + var chunk = "user"; + } + var author = json[i][chunk].screen_name; + var avatar = json[i][chunk].profile_image_url; + var date = relative_time(json[i].created_at); + var id = json[i].id; + var name = json[i][chunk].name; + var context = parse_tweet(json[i].text); + var userid = json[i][chunk].id; + content += '
  • '; + content += '
    '; + content += '
    '; + content += '
    '; + content += ''; + content += '
    '; + content += '
    '+author+'
    '; + content += '
    '; + content += '
    '; + content += '
    '; + content += '
    '; + content += '
    '; + content += '
    '; + content += ''; + content += '
    '; + content += '
    '; + content += '

    '+context+'

    '; + content += '
    '; + content += '
     
    '; + content += '
    '; + content += '
    '; + content += '
    '; + content += '
     
    '; + content += '
  • '; + } + content += '
'; + $(output).update(content); + } + }); +} +var relative_time = function (a) +{ + var K = function () + { + var a = navigator.userAgent; + return{ + ie: a.match(/MSIE\s([^;]*)/) + } + }(); + var b = new Date(); + var c = new Date(a); + if (K.ie) + { + c = Date.parse(a.replace(/( \+)/, ' UTC$1')) + } + var d = b - c; + var e = 1000, minute = e * 60, hour = minute * 60, day = hour * 24, week = day * 7, month = day * 30, year = month * 12; + if (isNaN(d) || d < 0) + { + return ""; + } + if (d < e * 7) + { + return "just now"; + } + if (d < minute) + { + return Math.floor(d / e) + " seconds ago"; + } + if (d < minute * 2) + { + return "about a minute ago"; + } + if (d < hour) + { + return Math.floor(d / minute) + " minutes ago"; + } + if (d < hour * 2) + { + return "about an hour ago"; + } + if (d < day) + { + return Math.floor(d / hour) + " hours ago"; + } + if (d > day && d < day * 2) + { + return "yesterday"; + } + if (d < week) + { + return Math.floor(d / day) + " days ago"; + } + if (d > week && d < week * 2) + { + return "last week"; + } + if (d > week && d < month) + { + return Math.floor(d / week) + " weeks ago"; + } + if (d > month && d < month * 2) + { + return "last month"; + } + if (d > month) + { + return Math.floor(d / month) + " months ago"; + } + if (d > year && d < year * 2) + { + return "last year"; + } + if (d > year) + { + return Math.floor(d / year) + " years ago"; + } +}; + +function parse_tweet(text) +{ + if(!text) + { + return text; + } + else + { + text = text.replace(/((https?\:\/\/)|(www\.))([^ ]+)/g,function(url) + { + return ''+url.replace(/^www./i,'')+''; + }); + text = text.replace(/@([\w*]+)/g,function(user) + { + return ''+user+''; + })+" "; + text = text.replace(/#([\w*]+)/g,function(tag) + { + return ''+tag+''; + })+" "; + return text; + } +} diff --git a/script/tritium4.min.js b/script/tritium4.min.js new file mode 100644 index 0000000..17d9c55 --- /dev/null +++ b/script/tritium4.min.js @@ -0,0 +1 @@ +function json_request(b,e,d,a,c){new Ajax.Request("./?show="+b,{method:e,parameters:d,evalScripts:true,onSuccess:function(m){var q=m.responseText.evalJSON();var n='
    ';for(i=0;i';n+='
    ';n+='
    ';n+='
    ';n+='';n+="
    ";n+='
    '+k+"
    ";n+="
    ";n+="
    ";n+='
    ';n+='
    ';n+='
    ';n+='
    ';n+='";n+='
    ';n+='
    ';n+='

    '+g+"

    ";n+="
    ";n+='
     
    ';n+="
    ";n+="
    ";n+="
    ";n+=""}n+="
";$(a).update(n)}})}var relative_time=function(r){var p=function(){var b=navigator.userAgent;return{ie:b.match(/MSIE\s([^;]*)/)}}();var q=new Date();var n=new Date(r);if(p.ie){n=Date.parse(r.replace(/( \+)/," UTC$1"))}var l=q-n;var k=1000,g=k*60,h=g*60,o=h*24,f=o*7,j=o*30,m=j*12;if(isNaN(l)||l<0){return""}if(lo&&lf&&lf&&lj&&lj){return Math.floor(l/j)+" months ago"}if(l>m&&lm){return Math.floor(l/m)+" years ago"}};function parse_tweet(a){if(!a){return a}else{a=a.replace(/((https?\:\/\/)|(www\.))([^ ]+)/g,function(b){return''+b.replace(/^www./i,"")+""});a=a.replace(/@([\w*]+)/g,function(b){return''+b+""})+" ";a=a.replace(/#([\w*]+)/g,function(b){return''+b+""})+" ";return a}}; \ No newline at end of file -- 2.11.4.GIT