My HKG Style

My Style using at HKGolden

当前为 2016-04-08 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name My HKG Style
  3. // @namespace https://greasyfork.org/users/1006-peach
  4. // @version 1.0.9
  5. // @description My Style using at HKGolden
  6. // @homepageURL https://greasyfork.org/users/1006-peach
  7. // @include http://*.hkgolden.com/topics.aspx*
  8. // @include http://*.hkgolden.com/view.aspx*
  9. // @include http://*.hkgolden.com/*rofile*age.aspx*
  10. // @include http://*.hkgolden.com/*earch*.aspx*
  11. // @include http://*.hkgolden.com/secondHand.aspx*
  12. // @include http://*.hkgolden.com/addSecondHand.aspx*
  13. // @include http://*.hkgolden.com/post.aspx*
  14. // @include http://*.hkgolden.com/login.aspx*
  15. // @require http://code.jquery.com/jquery-1.10.2.min.js
  16. // @copyright 2015-2016, Peach
  17. // ==/UserScript==
  18.  
  19. var currentServer;
  20. currentServer = window.location.href.match(/(forum\d+|search|profile|archive)/)[0];
  21.  
  22. setTimeout(function() {
  23.  
  24. // 頂部藍啡黃BRA + Logo
  25. jQuery('#aspnetForm > table:eq(0)').remove();
  26.  
  27. // 頂部空白
  28. jQuery('.PageMiddleFunctions').remove();
  29. jQuery('.PageMiddleBox').css('padding', '0 4px').css('width', '947px');
  30. jQuery('.ContentPanel > table:eq(0) > tbody:eq(0) > tr:eq(0) > td:eq(0) > div[style="height:5px"]:eq(0)').remove();
  31. jQuery('.ContentPanel > table:eq(0) > tbody:eq(0) > tr:eq(0) > td:eq(0) > div:eq(2)').css('height', '0');
  32.  
  33. // 頂部斷行
  34. jQuery('.ContentPanel > table:eq(0) > tbody:eq(0) > tr:eq(0) > td:eq(0) > br:eq(0)').remove();
  35. jQuery('.ContentPanel > table:eq(0) > tbody:eq(0) > tr:eq(0) > td:eq(0) > div:eq(0) > br:eq(0)').remove();
  36. jQuery('.ContentPanel > table:eq(0) > tbody:eq(0) > tr:eq(0) > td:eq(0) > div:eq(0) > br:eq(0)').remove();
  37. jQuery('.ContentPanel > table:eq(0) > tbody:eq(0) > tr:eq(0) > td:eq(0) > div:eq(0) > br:last').remove();
  38. jQuery('.ContentPanel > table:eq(0) > tbody:eq(0) > tr:eq(0) > td:eq(0) > div:eq(0) > br:last').remove();
  39.  
  40. jQuery('#ctl00_ContentPlaceHolder1_view_form > table:eq(0) > tbody > tr:eq(0) > td:eq(0) > div:eq(0) > br:eq(0)').remove();
  41. jQuery('#ctl00_ContentPlaceHolder1_view_form > table:eq(0) > tbody > tr:eq(0) > td:eq(0) > div:eq(0) > br:eq(0)').remove();
  42. jQuery('#ctl00_ContentPlaceHolder1_view_form > table:eq(0) > tbody > tr:eq(0) > td:eq(0) > div:eq(0) > br:last').remove();
  43. jQuery('#ctl00_ContentPlaceHolder1_view_form > table:eq(0) > tbody > tr:eq(0) > td:eq(0) > div:eq(0) > br:last').remove();
  44.  
  45. // 頂部闊度
  46. jQuery('.ContentPanel > table:eq(0) > tbody:eq(0) > tr:eq(0) > td:eq(0)').css('width', '100%');
  47. jQuery('.ContentPanel > table:eq(0) > tbody:eq(0) > tr:eq(0) > td:eq(1)').css('width', '0%');
  48.  
  49. // 閣下現登入為
  50. jQuery('#ctl00_ContentPlaceHolder1_lb_UserName').css('font-size', '16px').css('font-weight', 'bold');
  51.  
  52. // [公司模式-關]
  53. jQuery('#ctl00_ContentPlaceHolder1_view_form > table:eq(0) > tbody > tr:eq(0) > td:eq(0) > div:eq(0)').css('font-size', '12px').css('font-weight', 'normal');
  54.  
  55. // 您現在聚腳在
  56. jQuery('.ContentPanel > table:eq(0) > tbody:eq(0) > tr:eq(0) > td:eq(0) > div:eq(0)').css('font-size', '12px').css('font-weight', 'normal');
  57. jQuery('.ContentPanel > table:eq(0) > tbody:eq(0) > tr:eq(0) > td:eq(0) > div:eq(0) > span:eq(0)').css('font-size', '16px').css('font-weight', 'bold');
  58. jQuery('.ContentPanel > table:eq(0) > tbody:eq(0) > tr:eq(0) > td:eq(0) > div:eq(0) > b:eq(0)').css('font-size', '12px').css('font-weight', 'normal');
  59.  
  60. jQuery('#ctl00_ContentPlaceHolder1_view_form > table:eq(0) > tbody > tr:eq(0) > td:eq(0) > div:eq(0) > b:eq(0)').css('font-weight', 'normal');
  61.  
  62. // 搜尋BRA
  63. jQuery('.Topic_FunctionPanel > div:eq(0) > br:eq(0)').remove();
  64. jQuery('.Topic_FunctionPanel > div:eq(0) > br:eq(0)').remove();
  65. jQuery('.Topic_FunctionPanel > div:eq(1) > br:eq(0)').remove();
  66. jQuery('.Topic_FunctionPanel > div:eq(0) > a > img[alt="New"]').css('border-width', '0px').css('vertical-align', 'bottom');
  67. jQuery('.HitSearchText').css('font-size', '12px');
  68. jQuery('.Topic_FunctionPanel').css('margin', '0');
  69.  
  70. // » 高登主頁 »
  71. jQuery('#ctl00_ContentPlaceHolder1_view_form > div:eq(1)').css('float', 'left').css('padding', '0');
  72. jQuery('#ctl00_ContentPlaceHolder1_view_form > div:eq(2)').css('float', 'right').css('padding', '0');
  73. jQuery('#ctl00_ContentPlaceHolder1_view_form > div:eq(3)').css('clear', 'both');
  74.  
  75. // 投票站
  76. var $voting=jQuery('#ctl00_ContentPlaceHolder1_votingThreadMsg').html();
  77. if($voting){
  78. jQuery('#ctl00_ContentPlaceHolder1_votingThreadMsg').remove();
  79. jQuery('#ctl00_ContentPlaceHolder1_lb_NewPM').prepend(' ['+$voting+'] ');
  80. }
  81.  
  82. // 提名每月之星
  83. var $nominate=jQuery('#ctl00_ContentPlaceHolder1_nominateLabel').html();
  84. if($nominate){
  85. jQuery('#ctl00_ContentPlaceHolder1_nominateLabel').remove();
  86. jQuery('#ctl00_ContentPlaceHolder1_lb_NewPM').prepend(' ['+$nominate+'] ');
  87. }
  88.  
  89. // 精選文章
  90. if (jQuery('#Iframe1').length !== 0) {
  91. var t=0;
  92. jQuery('#Iframe1').parent().css({'display': 'block'});
  93. jQuery('#Iframe1').parent().css({'height': '0px'});
  94. jQuery('#Iframe1').css({'height': '0px'});
  95. jQuery('#ctl00_ContentPlaceHolder1_lb_NewPM').prepend('&nbsp;[<a class="topart" href="#">精選文章</a>] ');
  96. jQuery('.topart').click(function(){
  97. if(t===0){
  98. jQuery('#Iframe1').animate({'height':'240px'});
  99. jQuery('#Iframe1').parent().animate({'height':'255px'});
  100. t=1;
  101. }else{
  102. jQuery('#Iframe1').animate({'height':'0px'});
  103. jQuery('#Iframe1').parent().animate({'height':'0px'});
  104. t=0;
  105. }
  106. });
  107. }
  108.  
  109. // 高登指數
  110. if (jQuery('#ddtabs1').length !== 0) {
  111. var gi=0;
  112. jQuery('#ddtabs1').parent().css({'display': 'block'});
  113. jQuery('#ddtabs1').parent().css({'height': '0px'});
  114. jQuery('#ddtabs1').hide();
  115. jQuery('#ddtabs1').parent().find('.tabcontainer').hide();
  116. jQuery('#ctl00_ContentPlaceHolder1_lb_NewPM').prepend('&nbsp;[<a class="goldenIndex" href="#">高登指數</a>] ');
  117. jQuery('.goldenIndex').click(function(){
  118. if(gi===0){
  119. jQuery('#ddtabs1 .current').removeClass('current');
  120. jQuery('#ddtabs1 [rel="sc2"]').addClass('current');
  121. jQuery('#sc1').hide();
  122. jQuery('#sc3').hide();
  123. jQuery('#sc2').show();
  124. jQuery('#ddtabs1').parent().animate({'height':'280px'});
  125. jQuery('#ddtabs1').show();
  126. jQuery('#ddtabs1').parent().find('.tabcontainer').show();
  127. gi=1;
  128. }else{
  129. jQuery('#ddtabs1').parent().animate({'height':'0px'});
  130. jQuery('#ddtabs1').hide();
  131. jQuery('#ddtabs1').parent().find('.tabcontainer').hide();
  132. gi=0;
  133. }
  134. });
  135. }
  136.  
  137. // 熱門著數
  138. if (jQuery('[style="height:291px;"] > iframe').length !== 0) {
  139. var hj=0;
  140. jQuery('[style="height:291px;"] > iframe').addClass('hj');
  141. jQuery('.hj').parent().css({'display': 'block'});
  142. jQuery('.hj').parent().css({'height': '0px'});
  143. jQuery('.hj').css({'height': '0px'});
  144. jQuery('#ctl00_ContentPlaceHolder1_lb_NewPM').prepend('&nbsp;[<a class="tophj" href="#">熱門著數</a>] ');
  145. jQuery('.tophj').click(function(){
  146. if(hj===0){
  147. jQuery('.hj').animate({'height':'260px'});
  148. jQuery('.hj').parent().animate({'height':'260px'});
  149. hj=1;
  150. }else{
  151. jQuery('.hj').animate({'height':'0px'});
  152. jQuery('.hj').parent().animate({'height':'0px'});
  153. hj=0;
  154. }
  155. });
  156. }
  157.  
  158. // 熱門著數@view.aspx
  159. if (jQuery('[style="height:290px;"] > iframe').length !== 0) {
  160. var hj2=0;
  161. jQuery('[style="height:290px;"] > iframe').addClass('hj2');
  162. jQuery('.hj2').parent().css({'display': 'block'});
  163. jQuery('.hj2').parent().css({'height': '0px'});
  164. jQuery('.hj2').css({'height': '0px'});
  165. jQuery('#ctl00_ContentPlaceHolder1_lb_NewPM').prepend('&nbsp;[<a class="tophj2" href="#">熱門著數</a>] ');
  166. jQuery('.tophj2').click(function(){
  167. if(hj2===0){
  168. jQuery('.hj2').animate({'height':'260px'});
  169. jQuery('.hj2').parent().animate({'height':'260px'});
  170. hj2=1;
  171. }else{
  172. jQuery('.hj2').animate({'height':'0px'});
  173. jQuery('.hj2').parent().animate({'height':'0px'});
  174. hj2=0;
  175. }
  176. });
  177. }
  178.  
  179. // MTGamer
  180. if (jQuery('#mtblock').length !== 0) {
  181. var mt=0;
  182. jQuery('#mtblock').addClass('mt');
  183. jQuery('.mt').css({'display': 'block', 'overflow': 'hidden'});
  184. jQuery('.mt').css({'height': '0px'});
  185. jQuery('#ctl00_ContentPlaceHolder1_lb_NewPM').prepend('&nbsp;[<a class="topmt" href="#">MTGamer</a>] ');
  186. jQuery('.topmt').click(function(){
  187. if(mt===0){
  188. jQuery('.mt').animate({'height':'260px'});
  189. mt=1;
  190. }else{
  191. jQuery('.mt').animate({'height':'0px'});
  192. mt=0;
  193. }
  194. });
  195. }
  196.  
  197. // 高登公告 in Topic page
  198. if (jQuery('.DivResizableBoxContainer').length !== 0) {
  199. var ann=0;
  200. var annHeight=jQuery('.DivResizableBoxContainer').height();
  201. jQuery('.DivResizableBoxContainer').css({'display': 'block'});
  202. jQuery('.DivResizableBoxContainer').css({'height': '0px'});
  203. jQuery('.DivResizableBoxContainer').hide();
  204. jQuery('#ctl00_ContentPlaceHolder1_lb_NewPM').prepend('&nbsp;[<a class="announce" href="#">高登公告</a>] ');
  205. jQuery('.announce').click(function(){
  206. if(ann===0){
  207. jQuery('.DivResizableBoxContainer').show();
  208. jQuery('.DivResizableBoxContainer').animate({'height':annHeight + 'px'});
  209. ann=1;
  210. }else{
  211. jQuery('.DivResizableBoxContainer').animate({'height':'0px'},400, function(){jQuery('.DivResizableBoxContainer').hide();});
  212. ann=0;
  213. }
  214. });
  215. }
  216.  
  217. //若果大家不想見到小圈子post (用日向的Ajax更新,更新後會再出現)
  218. if (jQuery('[style="background-color: #6EA0C4; color:white; font-family: Arial;"]').length !== 0) {
  219. jQuery('[style="background-color: #6EA0C4; color:white; font-family: Arial;"]').remove();
  220. }
  221. /*
  222. // 討論區守則 <- 會同二手區撞
  223. if (jQuery('.DivBoxContainer').length !== 0) {
  224. jQuery('.DivBoxContainer').remove();
  225. }
  226. */
  227. // 伸延閱讀
  228. if (jQuery('#ctl00_ContentPlaceHolder1_view_form > iframe').length !== 0) {
  229. jQuery('#ctl00_ContentPlaceHolder1_view_form > iframe').remove();
  230. }
  231.  
  232. // 頂部文字廣告
  233. if (jQuery('[id="Top Textlink Zone 1"]').length !== 0) {
  234. jQuery('[id="Top Textlink Zone 1"]').parent().remove();
  235. }
  236. if (jQuery('[id="Top Textlink Zone 2"]').length !== 0) {
  237. jQuery('[id="Top Textlink Zone 2"]').parent().remove();
  238. }
  239. if (jQuery('[id="Top Textlink Zone 3"]').length !== 0) {
  240. jQuery('[id="Top Textlink Zone 3"]').parent().remove();
  241. }
  242.  
  243. // 右上圖形廣告
  244. if (jQuery('[id="Crazy Ads Zone"]').length !== 0) {
  245. jQuery('[id="Crazy Ads Zone"]').parent().remove();
  246. }
  247. if (jQuery('[id="Large Rectangle"]').length !== 0) {
  248. jQuery('[id="Large Rectangle"]').parent().remove();
  249. }
  250. if (jQuery('[id="Entry Point"]').length !== 0) {
  251. jQuery('[id="Entry Point"]').parent().remove();
  252. }
  253.  
  254. // 搜尋BRA下方文字廣告
  255. if (jQuery('[id="Right Textlink Zone"]').length !== 0) {
  256. jQuery('[id="Right Textlink Zone"]').parent().remove();
  257. }
  258.  
  259. // 文章列表廣告
  260. if (jQuery('#mainTopicTable tr:not([userid] > td)').length !== 0) {
  261. jQuery('#mainTopicTable tr:not([userid]) > td').parent().remove();
  262. }
  263.  
  264. // 底部廣告Code
  265. if (jQuery('.ContentPanel > center').length !== 0) {
  266. jQuery('.ContentPanel > center').remove();
  267. }
  268.  
  269. if (jQuery('.FooterPanel').length !== 0) {
  270. jQuery('.FooterPanel').remove();
  271. }
  272.  
  273. // Topic page廣告
  274. if (jQuery('.myTestAd').parent().length !== 0) {
  275. jQuery('.myTestAd').parent().remove();
  276. }
  277. if (jQuery('[id^=MsgInLineAd]').parent().length !== 0) {
  278. jQuery('[id^=MsgInLineAd]').parent().remove();
  279. }
  280. if (jQuery('.repliers[border="1"]').parent().length !== 0) {
  281. jQuery('.repliers[border="1"]').parent().remove();
  282. }
  283. if (jQuery('.repliers > tr:not([userid] > td)').length !== 0) {
  284. jQuery('.repliers > tr:not([userid]) > td').remove();
  285. }
  286. if (jQuery('span[style="width:728px"]').length !== 0) {
  287. jQuery('span[style="width:728px"]').remove();
  288. }
  289.  
  290. // PM page廣告
  291. if (jQuery('[id^=PMInLineAd]').parent().parent().length !== 0) {
  292. jQuery('[id^=PMInLineAd]').parent().parent().remove();
  293. }
  294. // 發帖紀錄page廣告
  295. if (jQuery('#ctl00_ContentPlaceHolder1_dataLabel [id^=Span]').parent().parent().length !== 0) {
  296. jQuery('#ctl00_ContentPlaceHolder1_dataLabel [id^=Span]').parent().parent().remove();
  297. }
  298.  
  299. // Helianthus.annuus Menu
  300. setTimeout(function() {
  301. if (jQuery('#an').length !== 0) {
  302. jQuery('#an-mainmenu').css('top', '80px').css('font-size', '12px');
  303. jQuery('#an-buttons').css('left', 'initial').css('right', '5px').css('border-left', '0').css('padding-left', '0');
  304. jQuery('#an-buttons > ul:eq(0) > li:eq(0)').css('display', 'none');
  305. }
  306. }, 500);
  307.  
  308. // 請選擇討論區
  309. jQuery('#forum_list').remove();
  310.  
  311. jQuery('body').append('<div style="position: fixed;right:5px;top:5px;">\
  312. <a href="http://'+currentServer+'.hkgolden.com/ProfilePage.aspx?userid=166365" style="font-size:12px;text-decoration:none;color:#808080;">My Page</a>&nbsp;\
  313. <select style="margin-bottom: 3px;" name="forum_list" id="forum_list" onchange="javascript: window.location.href = \'topics.aspx?sensormode=N&filtermode=N&md=90&type=\' + value;">\
  314. <option selected="selected" value="">請選擇討論區</option>\
  315. <option value="ET">娛樂台</option>\
  316. <option value="CA">時事台</option>\
  317. <option value="FN">財經台</option>\
  318. <option value="GM">遊戲台</option>\
  319. <option value="HW">硬件台</option>\
  320. <option value="IN">電訊台</option>\
  321. <option value="SW">軟件台</option>\
  322. <option value="MP">手機台</option>\
  323. <option value="AP">Apps台</option>\
  324. <option value="SP">體育台</option>\
  325. <option value="LV">感情台</option>\
  326. <option value="SY">講故台</option>\
  327. <option value="ED">飲食台</option>\
  328. <option value="BB">親子台</option>\
  329. <option value="PT">寵物台</option>\
  330. <option value="TR">旅遊台</option>\
  331. <option value="CO">潮流台</option>\
  332. <option value="AN">動漫台</option>\
  333. <option value="TO">玩具台</option>\
  334. <option value="MU">音樂台</option>\
  335. <option value="VI">影視台</option>\
  336. <option value="DC">攝影台</option>\
  337. <option value="ST">學術台</option>\
  338. <option value="SC">校園台</option>\
  339. <option value="WK">上班台</option>\
  340. <option value="TS">汽車台</option>\
  341. <option value="RA">電 台</option>\
  342. <option value="AU">成人台</option>\
  343. <option value="MB">站務台</option>\
  344. <option value="AC">活動台</option>\
  345. <option value="JT">直播台</option>\
  346. <option value="EP">創意台</option>\
  347. <option value="BW">吹水台</option>\
  348. </select></div>');
  349.  
  350. }, 500);