Skip to content

Commit

Permalink
#1 修改微博显示样式
Browse files Browse the repository at this point in the history
  • Loading branch information
pob986 committed Aug 29, 2013
1 parent 0baf972 commit a19e2ad
Show file tree
Hide file tree
Showing 2 changed files with 145 additions and 23 deletions.
45 changes: 28 additions & 17 deletions assets/screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
settings = {
prefix : '$ ',
max : 50
}, lines = [], sp = $('<span class="sp" />');
}, lines = [], bk = [], sp = $('<span class="sp" />');

function rand(l, u) {
return Math.floor((Math.random() * (u-l+1))+l);
Expand All @@ -18,7 +18,9 @@
}

function println(str) {
bk.push(str);
lines.push(str);
if (bk.length > 50) {bk.shift();};
}

function getWeibo() {
Expand All @@ -38,7 +40,7 @@
}, 500);

function strWalk() {
var str, state = 0, el, i, j;
var str, state = 0, wd, rt, wt, el, i, j;

var interval = setInterval(function () {
switch (state) {
Expand All @@ -50,35 +52,44 @@
$('.str:first').remove();
}

el = $('<div class="str" />').appendTo(document.body);
el = $('<div class="str WB_feed_datail S_line2 clearfix" />').appendTo(document.body);
$('<div class="WB_face"><img width="50" height="50" src="'+ str.image_url +'" alt="" title="'+ str.user +'" ></div>').appendTo(el);
wd = $('<div class="WB_detail" />').appendTo(el);
$('<div class="WB_info">'+ str.user +'</div>').appendTo(wd);
wt = $('<div node-type="feed_list_content" class="WB_text" />').appendTo(wd);
state = 1;
i = 0;
str.text = str.user + ' : ' + str.text;
if (str.origin != '') {
if (str.origin.type == 1) {
str.text += ' (转)@' + str.origin.user + ':' + str.origin.text;
}else{
str.text += ' (评)//@' + str.origin.user + ':' + str.origin.text;
}
};
}
break;
case 1:
// print
el.html('<span class="head">' + settings.prefix + '</span>' + str.text.substring(0, i)).append(sp);
document.body.scrollTop = document.body.scrollHeight;
wt.html(str.text.substring(0, i));
if (i >= str.text.length) {
if (str.thumb != '') {
el.append('<br><img src="'+ str.thumb +'">');
wd.append('<img src="'+ str.thumb +'">');
}
if (str.origin != ''){
if (str.origin.type == 1){
rt = '<div class="WB_media_expand SW_fun2 S_line1 S_bg1"><div class="WB_arrow"><em class="S_line1_c">◆</em><span class="S_bg1_c">◆</span></div>';
rt += '<div><div class="WB_name"><span class="blue">@'+ str.origin.user +'</span></div><div node-type="feed_list_reason" class="WB_text"><em>'+ str.origin.text +'</em></div></div></div>';
$(rt).appendTo(wd);
}else if (str.origin.type == 2) {
rt = '<div class="WB_media_expand SW_fun2 S_line1 S_bg1"><div class="WB_arrow"><em class="S_line1_c">◆</em><span class="S_bg1_c">◆</span></div>';
rt += '<div><div node-type="feed_list_reason" class="WB_text"><em>评论 <span class="blue">@' + str.origin.user + '</span> 的微博 “' + str.origin.text.substr(0, 20) + '...“</em></div></div></div>';
$(rt).appendTo(wd);
}
}
state = 2;
j = 0;
};
};
document.body.scrollTop = document.body.scrollHeight;
wd.append(sp);
i ++;
break;
case 2:
if (j >= 150) {
if (j >= 300) {
state = 0;
if (lines.length == 0) {lines = bk.slice(0)};
}
j ++;
break;
Expand All @@ -102,6 +113,6 @@
}

getWeibo();
}, 15000);
}, 60000);
});
})();
123 changes: 117 additions & 6 deletions assets/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ body {
padding: 0;
margin: 0;
overflow: hidden;
font-family: "Source Code Pro";
font-family: "Arial,Helvetica,sans-serif";
}

.str {
color: #000;
color: #333;
width: 100%;
padding: 5px 5px;
line-height: 35px;
Expand All @@ -26,7 +26,7 @@ body {
.head {
color: #000;
}
.str img{
.WB_detail img{
max-width: 60%;
max-height: 216px;
margin-left: 20%;
Expand All @@ -42,13 +42,12 @@ body {
height: 55px;
line-height: 55px;
font-size: 35px;
background: #90d100;
color: #004f00;
background: #00a299;
color: #ffffff;
}
.follow {
line-height: 55px;
font-size: 25px;
color: #004f00;
padding-left: 20px;
}

Expand Down Expand Up @@ -103,3 +102,115 @@ table{
width: 100%;
}

.WB_feed_datail{
border-bottom-style:solid;
border-bottom-width:1px;
overflow:hidden;
padding:10px 0 10px;
color: #333;
}

.S_line2{
border-color:#E6E6E6;
}

.S_line1 {
border-color: #D9D9D9;
}

.S_bg1 {
background-color: #F2F2F2;
}

.S_line1_c {
color: #D9D9D9;
}

.S_bg1_c {
color: #F2F2F2;
}

address, caption, cite, code, dfn, em, i, th, var, b {
font-style: normal;
font-weight: normal;
}

.clearfix:after {
clear: both;
content: ".";
display: block;
height: 0;
visibility: hidden;
}
.clearfix {
display: inline-block;
}
.clearfix {
display: block;
}

.WB_face {
float: left;
position: relative;
width: 60px;
}
.WB_face img{
padding-left: 20px;
padding-top: 10px;
}

.WB_detail {
margin-left: 90px;
margin-right: 20px;
}

.WB_text {
padding: 4px 0;
font-size: 22px;
line-height: 28px;
}

.WB_info {
font-weight: bold;
}

.WB_media_expand {
border-radius: 3px 3px 3px 3px;
border-style: solid;
border-width: 1px;
margin-right: 20px;
padding: 5px 15px;
}

.WB_media_expand .WB_text{
font-size: 18px;
}

.WB_arrow {
cursor: default;
margin: -13px 0 0;
position: absolute;
width: 22px;
}

.WB_arrow * {
display: block;
font-family: "SimSun";
font-size: 12px;
height: 12px;
line-height: 1.231;
overflow: hidden;
}

.WB_arrow span {
margin: -11px 0 0;
}

.WB_name{
font-size: 20px;
line-height: 25px;
}

.blue{
color: #0A8CD2;
}

0 comments on commit a19e2ad

Please sign in to comment.