【发布时间】:2011-06-30 15:17:15
【问题描述】:
如何自定义默认twitter小部件的javascript默认html输出?
http://twitter.com/about/resources/widgets/widget_profile
在默认小部件中,我想从输出源中删除页眉和页脚(**不是在 css 中使用display:none)** (**绿色交叉 )** 这个,只想保留推文区。
这是默认的推特代码。
<script src="http://widgets.twimg.com/j/2/widget.js"></script>
<script>
new TWTR.Widget({
version: 2,
type: 'profile',
rpp: 1,
interval: 6000,
width: 'auto',
height: 300,
theme: {
shell: {
background: '#333333',
color: '#ffffff'
},
tweets: {
background: 'transparent',
color: '#ffffff',
links: '#4aed05'
}
},
features: {
scrollbar: false,
loop: false,
live: false,
hashtags: false,
timestamp: false,
avatars: false,
behavior: 'all'
}
}).render().setUser('tutsplus').start();
</script>
这是默认代码的输出
<div id="twtr-widget-1" class="twtr-widget twtr-widget-profile">
<div style="width: 100%;" class="twtr-doc">
<div class="twtr-hd">
<a class="twtr-profile-img-anchor" href="http://twitter.com/tutsplus" target="_blank">
<img src="http://a2.twimg.com/profile_images/63581538/tutsplus_normal.jpg" class="twtr-profile-img" alt="profile"></a>
<h3>
Tuts+</h3>
<h4>
<a href="http://twitter.com/tutsplus" target="_blank">tutsplus</a></h4>
</div>
<div class="twtr-bd">
<div style="height: auto;" class="twtr-timeline">
<div class="twtr-tweets">
<div class="twtr-reference-tweet">
</div>
<div id="tweet-id-1" class="twtr-tweet">
<div class="twtr-tweet-wrap">
<div class="twtr-avatar">
<div class="twtr-img">
<a href="http://twitter.com/tutsplus" target="_blank">
<img src="http://a2.twimg.com/profile_images/63581538/tutsplus_normal.jpg" alt="tutsplus profile"></a></div>
</div>
<div class="twtr-tweet-text">
<p>
<a class="twtr-user" href="http://twitter.com/tutsplus" target="_blank">tutsplus</a> If you like Rockable books, consider following Rockable on Twitter (@<a href="http://twitter.com/rockablepress" class="twtr-atreply" target="_blank">rockablepress</a>) or Facebook (<a href="http://www.facebook.com/rockablepress" target="_blank" class="twtr-hyperlink">http://www.facebook.com/...</a>) <em><a href="http://twitter.com/tutsplus/status/38368449310760960" time="Thu Feb 17 22:45:25 +0000 2011" class="twtr-timestamp" target="_blank">2 days ago</a> · <a href="http://twitter.com/?status=@tutsplus%20&in_reply_to_status_id=38368449310760960&in_reply_to=tutsplus" class="twtr-reply" target="_blank">reply</a> </em>
</p>
</div>
</div>
</div>
<!-- tweets show here -->
</div>
</div>
</div>
<div class="twtr-ft">
<div>
<a href="http://twitter.com" target="_blank">
<img src="http://widgets.twimg.com/i/widget-logo.png" alt=""></a> <span><a href="http://twitter.com/tutsplus" style="color: rgb(255, 255, 255);" class="twtr-join-conv" target="_blank">Join the conversation</a></span>
</div>
</div>
</div>
</div>
而且我只想将这部分作为上述默认源的源输出。
<div class="twtr-tweet-text">
<p>
<a class="twtr-user" href="http://twitter.com/tutsplus" target="_blank">tutsplus</a> If you like Rockable books, consider following Rockable on Twitter (@<a href="http://twitter.com/rockablepress" class="twtr-atreply" target="_blank">rockablepress</a>) or Facebook (<a href="http://www.facebook.com/rockablepress" target="_blank" class="twtr-hyperlink">http://www.facebook.com/...</a>) <em><a href="http://twitter.com/tutsplus/status/38368449310760960" time="Thu Feb 17 22:45:25 +0000 2011" class="twtr-timestamp" target="_blank">2 days ago</a> · <a href="http://twitter.com/?status=@tutsplus%20&in_reply_to_status_id=38368449310760960&in_reply_to=tutsplus" class="twtr-reply" target="_blank">reply</a> </em>
</p>
</div>
这个http://jsfiddle.net/ZUVzd/的JsFiddle示例链接
【问题讨论】:
标签: javascript css xhtml twitter