Created
September 4, 2012 10:03
-
-
Save icyleaf/3619416 to your computer and use it in GitHub Desktop.
Pure New Weibo Mod By icyleaf (Chrome Only version: http://t.cn/zWgW1nw)
This file contains hidden or 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
// ==UserScript== | |
// @name Pure New Weibo Mod By icyleaf | |
// @description this script support both firefox and chrome, you need to install the Greasemonkey add-on for Firefox. A minor revision based on roamlog's style: http://stylebot.me/styles/669. | |
// @version 5.0.6 (2012.09.05) | |
// @include http://weibo.com/* | |
// @include https://weibo.com/* | |
// @include http://t.sina.com.cn/* | |
// @include https://t.sina.com.cn/* | |
// @include http://www.weibo.com/* | |
// @include https://www.weibo.com/* | |
// @author icyleaf | |
// ==/UserScript== | |
var pure = { | |
init: function() | |
{ | |
var ver = pure.parse_url(window.location.href).query.wvr; | |
if (ver == null) | |
ver = document.getElementsByClassName('gn_logo')[0].getAttribute('href').match(/wvr=(\d+)/)[1]; | |
if (ver == 3 || ver == 4) | |
{ | |
pure.clearly_for_v3(); | |
} | |
else if (ver == 5) | |
{ | |
pure.clearly_for_v5(); | |
pure.alawys_show_all_user_groups(); | |
pure.change_two_columns(); | |
} | |
pure.is_debug_mode(); | |
// Debug infos (only in debug mode) | |
pure.debug('ua: ' + navigator.userAgent); | |
pure.debug('weibo version: ' + ver); | |
}, | |
clearly_for_v3: function() | |
{ | |
var styleEl = document.createElement('style'); | |
styleEl.type = 'text/css'; | |
styleEl.innerHTML = '.declist, .send_weibo .title,#pl_content_userInfo,#pl_content_commentTopNav,#pl_content_hisTags,#pl_content_favoritesTopNav,#pl_relation_recommendAttUsers,#pl_content_chainFollowers,.M_activities,#pl_content_sameFriends,#pl_content_myTags,#pl_common_thirdmodule_1003,#pl_content_hisOperationPlate,#pl_content_weibodesk,#pl_content_medal,#pl_common_noticeboard,#pl_content_userTips,#pl_content_followStatus,#pl_content_interestgroup,#ads_bottom_1, dd.settings,.tipsinvite,.level,#base_scrollToTop, #trustPagelet_recom_member, #Pl_Rightmod_Littlehelp, #pl_content_hisFans,#pl_leftNav_game,#pl_rightmod_medal, #pl_content_topic,.W_other_app, #pl_common_fun, #pl_content_pullylist, #pl_content_mood, #ads_37,#pl_content_promoteto, #pic pl_common_feedback,.footer_adv,.border, #pl_leftNav_app, #trustPagelet_member_zone, .global_footer,#trustPagelet_yunying_olympic, #trustPagelete_recom_interest,#trustPagelete_recom_allinone,#pl_rightmod_help,#pl_rightmod_noticeboard,#trustPagelete_zt_hottopic,.f_pro,.nfTagB_group,.deal_view2,#pl_content_promotetopic, #pl_content_homeInterest, #pl_relation_recommendPopularUsers, #pl_content_allInOne, #pl_content_topic, #pl_common_help, #pl_common_feedback, #pl_common_reportentry,.rightTxtList { display: none;}.W_linedot, .W_rightModule { border-bottom: none;}#pl_content_liteFacePersonInfo .W_rightModule, #pl_content_litePersonInfo .W_rightModule, #pl_content_personInfo .W_rightModule { padding-bottom: 0;}.nfTagB_sec { border-top: none; padding: 2px 0;}.left_nav .user_atten { margin: 0 0 0 17px;}.send_weibo .kind { padding: 5px 0 10px 0;}.send_weibo .kind a { margin: 0 15px 0 0; padding: 2px 0 2px 20px; }.left_nav .user_atten li { margin: 0 5px 0 0;}.B_index .feed_lists { margin-top: 10px;}.left_nav .border, .nfTagB_sec { background: none;}.border:nth-child(1), .border:nth-child(2),.W_main_narrow #Box_right { display: block;}.W_main { width: 750px;}.W_main .W_main_c{ float: none;}.W_main_c { padding: 0 30px 30px; }.W_main_bg { min-height: 1000px;}#wbim_box { right: 0;}.W_main .left_nav .border{ padding: 0;}.W_main_r .left_nav { border-bottom-color: none; border-bottom-style: none;} .W_main_r .user_atten { border-bottom-color: none; border-bottom-style: none; border-bottom: none; margin: 0; padding:0 10px 10px; }'; | |
document.documentElement.appendChild(styleEl); | |
}, | |
clearly_for_v5: function() | |
{ | |
var styleElement = document.createElement('style'); | |
styleElement.type = 'text/css'; | |
styleElement.innerHTML = 'a.W_gotop{margin-left:415px}.WB_left_nav .lev a:hover, .WB_left_nav .lev2 a:hover, .WB_left_nav .lev2 a.lev_curr, .WB_left_nav .lev2 a.lev_curr:hover {background-image:none}.S_bg4, .WB_left_nav a.lev_curr, .WB_left_nav a.lev_curr:hover, a.W_gotop:hover{background:#EEE}.WB_left_nav .level_1_Box .lev a{margin-left:1px}div.WB_global_nav div.gn_search{margin:7px 0 0 120px}div.W_main{background-position:-150px 0px}div.W_main{width:830px}div.W_main_a{float:left;width:830px;overflow:hidden}div.profile_right_module{border:none}.WB_global_nav .gn_bg{background-image:none;} div.gn_title,div#pl_profile_modulePublicGroupRecommend,div#trustPagelet_mblog_music,div#pl_rightmod_recommblog,div.global_footer,div#pl_leftnav_app,div#trustPagelet_recom_interestv5,div#trustPagelet_zt_hottopicv5,div#trustPagelet_recom_memberv5,div#trustPagelet_recom_allinonev5,div#pl_rightmod_noticeboard,div.S_textb,div#pl_rightmod_yunying,div#pl_rightmod_ads35,div.tips_wrapper,div.prm_app_con{display:none}'; | |
document.documentElement.appendChild(styleElement); | |
}, | |
change_two_columns: function() | |
{ | |
var leftElement = document.getElementsByClassName('W_main_l')[0]; | |
var rightElement = document.getElementById('Box_right'); | |
rightElement.innerHTML += leftElement.innerHTML; | |
leftElement.parentNode.removeChild(leftElement); | |
}, | |
alawys_show_all_user_groups: function() | |
{ | |
var groupElement = document.getElementById('pl_leftnav_group'); | |
var groups = groupElement.getElementsByTagName('div'); | |
for (var i = 0; i < groups.length; i++) | |
{ | |
var levElement = groups[i]; | |
if (levElement.getAttribute('node-type') == 'moreList') | |
{ | |
levElement.setAttribute('style', 'display:block'); | |
} | |
else if (levElement.getAttribute('class') == 'levmore') | |
{ | |
levElement.setAttribute('style', 'display:none'); | |
} | |
} | |
}, | |
is_debug_mode: function() | |
{ | |
var enable = false; | |
var debug = pure.parse_url(window.location.href).query.debug; | |
if (debug == 1) enable = true; | |
var aElements = document.getElementsByTagName('a'); | |
for (var i = 0; i < aElements.length; i++) | |
{ | |
var ae = aElements[i]; | |
var href = as.getAttribute('href'); | |
if (enable) | |
href += (href.match(/\?/g) ? '&' : '?') + 'debug=1'; | |
else | |
href = href.replace(/debug=\d+/g, ''); | |
ae.setAttribute('href', href); | |
} | |
}, | |
debug: function(o) | |
{ | |
var debug = pure.parse_url(window.location.href).query.debug; | |
if (debug == 1) | |
{ | |
console.debug(o); | |
} | |
}, | |
parse_url: function(url) | |
{ | |
var parser = document.createElement('a'); | |
parser.href = url; | |
var query = {}; | |
var params = parser.search.replace('?', '').split('&'); | |
for (var i = 0; i < params.length; i++) | |
{ | |
keyValue = params[i].split('='); | |
query[keyValue[0]] = keyValue[1]; | |
} | |
return { | |
'protocol': parser.protocol, | |
'hostname': parser.hostname, | |
'port': parser.port, | |
'path': parser.path, | |
'search': parser.search, | |
'query': query, | |
'hash': parser.hash, | |
'host': parser.host | |
}; | |
} | |
}; | |
// execute it! | |
window.addEventListener ("load", function(){ | |
pure.init(); | |
}, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
更新历史
5.0.6
5.0.5
5.0.4
5.0.3
5.0.2
5.0.1
5.0