Permalink
Browse files

weibo done

  • Loading branch information...
1 parent f58c7a8 commit bf3c81202bd36c6b0c6d3dff0d010facd1d716de @caiqingfeng committed May 16, 2012
View
4 app/assets/javascripts/home.js.coffee
@@ -1,3 +1,7 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
+
+$(document).ready ->
+ sina_weibo_login()
+ setInterval("get_last_weibo()", 60*1000)
View
8 app/assets/javascripts/sinaweibo.js
@@ -5,10 +5,12 @@ function sina_weibo_login () {
function get_last_weibo () {
WB2.anyWhere(function(W) {
- W.parseCMD("/statuses/home_timeline.json", function(sResult, bStatus) {
+ W.parseCMD("/statuses/friends_timeline.json", function(sResult, bStatus) {
//alert (JSON.stringify(sResult, null, '\t'));
- alert(sResult[0].text);
- }, {}, {
+ alert(sResult.statuses[0].text);
+ }, {
+ //screename: "深圳交警"
+ }, {
method: "get"
});
});
View
9 app/assets/javascripts/sinaweibo.js~
@@ -1,15 +1,16 @@
-function aaaa() {alert("kkk"); return;}
function sina_weibo_login () {
WB2.login(function() {
});
}
function get_last_weibo () {
WB2.anyWhere(function(W) {
- W.parseCMD("/statuses/home_timeline.json", function(sResult, bStatus) {
+ W.parseCMD("/statuses/friends_timeline.json", function(sResult, bStatus) {
//alert (JSON.stringify(sResult, null, '\t'));
- alert(sResult[0].text);
- }, {}, {
+ alert(sResult.statuses[0].text);
+ }, {
+ screename: "深圳交警"
+ }, {
method: "get"
});
});
View
3 app/assets/javascripts/users.js.coffee
@@ -3,6 +3,3 @@
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
$ = jQuery
-$(document).ready ->
- sina_weibo_login()
-#get_last_weibo()
View
4 app/assets/stylesheets/home.css.scss
@@ -1,3 +1,7 @@
// Place all the styles related to the home controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
+
+.hiddenOptions {
+ display: none;
+}
View
6 app/views/home/index.html.haml
@@ -1,3 +1,3 @@
-%h3 Home
-- @users.each do |user|
- %p User: #{link_to user.name, user}
+%h3 Live broadcast from Shenzhen Transport Police
+.hiddenOptions
+ %p#lastWeiboID
View
15 app/views/layouts/_navigation.html.haml
@@ -1,14 +1 @@
-= link_to "Probewb", root_path, :class => 'brand'
-%ul.nav
- - if user_signed_in?
- %li
- = link_to('Logout', destroy_user_session_path, :method=>'delete')
- - else
- %li
- = link_to('Login', new_user_session_path)
- - if user_signed_in?
- %li
- = link_to('Edit account', edit_user_registration_path)
- - else
- %li
- = link_to('Sign up', new_user_registration_path)
+= link_to "Traffice Event", root_path, :class => 'brand'
View
4 app/views/layouts/application.html.haml
@@ -10,8 +10,7 @@
== <meta property="wb:webmaster" content="790e8dee79827e57" />
= stylesheet_link_tag "application", :media => "all"
= javascript_include_tag "application"
- == <iframe id="openframe" src="" width="0" height="0"> </iframe>
- == <script src=" http://tjs.sjs.sinajs.cn/open/api/js/wb.js?appkey=2129160143" type="text/javascript" charset="utf-8"></script>
+ == <script src=" http://tjs.sjs.sinajs.cn/open/api/js/wb.js?appkey=3566330256" type="text/javascript" charset="utf-8"></script>
= csrf_meta_tags
= yield(:head)
%body
@@ -26,5 +25,4 @@
.span12
= render 'layouts/messages'
= yield
- == <iframe width="100%" height="550" class="share_self" frameborder="0" scrolling="no" src="http://widget.weibo.com/weiboshow/index.php?language=&width=0&height=550&fansRow=2&ptype=1&speed=0&skin=1&isTitle=1&noborder=1&isWeibo=1&isFans=1&uid=1932249351&verifier=a0fe8b1d&dpc=1"></iframe>
%footer

0 comments on commit bf3c812

Please sign in to comment.