Greasy Fork is available in English.

百度去广告,blur(毛玻璃)搜索框,美化

百度搜索框背景模糊,去广告,美化

目前為 2020-05-18 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name 百度去广告,blur(毛玻璃)搜索框,美化
  3. // @version 20.5.18.1
  4. // @description 百度搜索框背景模糊,去广告,美化
  5. // @author L
  6. // @include *://www.baidu.com/
  7. // @include *://www.baidu.com/?tn*
  8. // @include *://www.baidu.com/s?*
  9. // @include *://www.baidu.com/*wd*
  10. // @include *://www.baidu.com/search/*
  11. // @include *://baidu.com/
  12. // @include *://baidu.com/s?*
  13. // @include *://baidu.com/*wd*
  14. // @include *://baidu.com/search/*
  15. // @grant none
  16. // @namespace L-BaiduBlur
  17. // @homepage https://www.ihawo.com
  18. // @run-at document-body
  19. // ==/UserScript==
  20. (function() {
  21. class Blur {
  22. constructor() {
  23. var _this = this;
  24. this.updata = 1;
  25. this.attrNum = 1;
  26. this.initStatus = 1;
  27. this.right = localStorage.getItem('blur-right');
  28. this.beautify = localStorage.getItem('blur-beautify');
  29. this.tab = localStorage.getItem('blur-tab');
  30. this.indexHide = localStorage.getItem('blur-index-hide');
  31. this.browser = myBrowser();
  32. this.css = 0;
  33. this.showSetting = 0;
  34. this.removeAdTimer = '';
  35. this.removeAdTimes = 0;
  36. this.init = function () {
  37. _this.addBaseStyle();
  38. window.onload = function () {
  39. if (_this.browser == 'Chrome') {
  40. var version = getChromeVersion();
  41. if (version >= 76) {
  42. _this.css = 1;
  43. }
  44. }
  45. else if (_this.browser == 'Safari') {
  46. _this.css = 1;
  47. }
  48. _this.removeAd();
  49. _this.addSettingDiv();
  50. _this.initTab();
  51. _this.initBlur();
  52. _this.initShowRight();
  53. _this.initBeautify();
  54. _this.initIndexHide();
  55. _this.initStatus = 0;
  56. };
  57. };
  58. this.addSettingDiv = function () {
  59. $('html').append('<div style="width:210px;height:200px;background:white;position: fixed;z-index: 999999999999999999999;top:15%;left:0;right:0;margin-right: auto;margin-left:auto;box-shadow:0px 0px 10px 2px #ccc;border-radius: 10px;display:none;padding: 10px;" id="bsetting"><div style="font-size:18px;padding: 15px;">blur插件设置</div></div>');
  60. var option = '<span class="c-gap-left" id="showBsetting"><label><span>显示插件设置</span></label></span>';
  61. $(".search_tool_conter").append(option);
  62. $("html").on('click', '#showBsetting', function () {
  63. $("#bsetting").fadeIn(300);
  64. $("#wrapper").css("filter", 'blur(15px)');
  65. $("#wrapper *").css("pointer-events", 'none');
  66. setTimeout(function () {
  67. _this.showSetting = 1;
  68. }, 500);
  69. });
  70. $("html").on('click', '#wrapper', function () {
  71. if (_this.showSetting) {
  72. $("#bsetting").fadeOut(300);
  73. $("#wrapper").css("filter", '');
  74. $("#wrapper *").css("pointer-events", 'auto');
  75. _this.showSetting = 0;
  76. }
  77. });
  78. };
  79. this.addBaseStyle = function () {
  80. var style = document.createElement('style');
  81. style.type = 'text/css';
  82. style.innerHTML = ".result,.c-container,.result div,.c-container div,#t_tab,#head,#u,.s_form,#content_right{transition:all 0.3s ease} #content_right>div{display:none} .wrapper_s .s_ipt_wr,.s_ipt_wr.bg{background:rgba(255,255,255,0.7)}.soutu-btn{background: url(https://ss1.bdstatic.com/5eN1bjq8AAUYm2zgoY3K/r/www/cache/static/protocol/https/soutu/img/camera_new_5606e8f.png) no-repeat;}#pageBulrBg{pointer-events:none}";
  83. document.getElementsByTagName('body').item(0).appendChild(style);
  84. if (_this.beautify == 1 || _this.beautify == null) {
  85. var style = document.createElement('style');
  86. style.type = 'text/css';
  87. style.className = 'mainStyle';
  88. style.innerHTML = "document,html,body,.c-table th,#page{background:#eee} #page .fk,a .fk,.qrcodeCon{display:none} #s_tab{height:47px} .result:hover,.c-container:hover,.result-op:hover{box-shadow: 5px 5px 7px #ccc;} .result>div,.c-container>div,.result-op>div{margin:10px 0} .result,.c-container,.result-op{background:#fafafa;padding:20px;border-radius: 5px;box-shadow: 5px 5px 7px #ddd;transition:all 0.3s;margin: 0 15px 25px 0!important;} em{ color: #ce4343;} .result a,.c-container a,.result-op a,.result em,.c-container em,.result-op em,#u a{text-decoration:none!important;} a{color:#4879BD} #rs{background:none;padding:20px} #rs a{text-decoration:none} #page a, #page strong{height:auto;background:none;border:none} #page .pc,#page .n{border: 1px solid #eee;} #s_tab{background:none} .c-border{border: none; box-shadow: none;} #foot,#help{background:none}#u{margin-top:30px} #s_tab{padding-top:86px } .c-border{padding:0;background:none}.result-op>tbody>tr>td{padding:20px!important}@media screen and (max-width: 1216px){.result,.c-container,.result-op,.result-op>tbody>tr>td{padding:15px;}}";
  89. if (document.URL.indexOf('wd=') != -1) {
  90. style.innerHTML = "document,html,body,.c-table th,#page{background:#eee} #page .fk,a .fk,.qrcodeCon{display:none} #s_tab{height:47px} .result:hover,.c-container:hover,.result-op:hover{box-shadow: 5px 5px 7px #ccc;} .result>div,.c-container>div,.result-op>div{margin:10px 0} .result,.c-container,.result-op{background:#fafafa;padding:20px;border-radius: 5px;box-shadow: 5px 5px 7px #ddd;transition:all 0.3s;margin: 0 15px 25px 0!important;} em{ color: #ce4343;} .result a,.c-container a,.result-op a,.result em,.c-container em,.result-op em,#u a{text-decoration:none!important;} a{color:#4879BD} #rs{background:none;padding:20px} #rs a{text-decoration:none} #page a, #page strong{height:auto;background:none;border:none} #page .pc,#page .n{border: 1px solid #eee;} #s_tab{background:none} .c-border{border: none; box-shadow: none;} #foot,#help{background:none}#u{margin-top:30px} #s_tab{padding-top:86px }body,#head{background:#eee}#head{height: 86px;top:0} .c-border{padding:0;background:none}.result-op>tbody>tr>td{padding:20px!important}@media screen and (max-width: 1216px){.result,.c-container,.result-op>tbody>tr>td{padding:15px;}}";
  91. }
  92. document.getElementsByTagName('body').item(0).appendChild(style);
  93. }
  94. };
  95. this.initShowRight = function () {
  96. if (_this.right == undefined || _this.right == null) {
  97. _this.right = 1;
  98. localStorage.setItem('blur-right', 1);
  99. }
  100. _this.isShowRight();
  101. $(function () {
  102. _this.addShowRightTool();
  103. });
  104. };
  105. this.initBeautify = function () {
  106. if (_this.beautify == undefined || _this.beautify == null || _this.beautify == 1) {
  107. _this.beautify = 1;
  108. localStorage.setItem('blur-beautify', 1);
  109. }
  110. _this.doBeautify();
  111. $(function () {
  112. _this.addBeautifyTool();
  113. _this.doBeautify();
  114. $(".head_wrapper").on('DOMNodeInserted', function (e) {
  115. if (e.target.id == 'ent_sug') {
  116. setTimeout(function () {
  117. _this.doBeautify();
  118. }, 100);
  119. }
  120. });
  121. $(document).ajaxSuccess(function (_e, _xhr, opt) {
  122. var url = opt.url;
  123. if (url.indexOf('submit/setuskin') != -1) {
  124. _this.doBeautify();
  125. }
  126. });
  127. $('#kw').on('change', function () {
  128. if ($('.s-skin-container').length > 0) {
  129. setTimeout(function () {
  130. _this.doBeautify();
  131. }, 50);
  132. }
  133. });
  134. });
  135. };
  136. this.initBlur = function () {
  137. if (_this.css) {
  138. $(function () {
  139. _this.blur();
  140. });
  141. }
  142. else {
  143. $('html').append('<style></style>');
  144. $(function () {
  145. $(window).scroll(function () {
  146. var top = $(window).scrollTop();
  147. $("#headerBulrBg").css('top', -top + "px");
  148. });
  149. $(document).ajaxSend(function (_e, _xhr, opt) {
  150. var url = opt.url;
  151. if (url.indexOf('/s?') != -1 && (url.indexOf('&wd=') != -1 || url.indexOf('?wd=') != -1) && url.indexOf('&_ck=') == -1) {
  152. $(".headBgDiv").remove();
  153. }
  154. });
  155. _this.blur();
  156. });
  157. }
  158. $(function () {
  159. $(document).ajaxSuccess(function (_e, _xhr, opt) {
  160. var url = opt.url;
  161. if (url.indexOf('/s?') != -1 && (url.indexOf('&wd=') != -1 || url.indexOf('?wd=') != -1) && url.indexOf('&_ck=') == -1) {
  162. setTimeout(function () {
  163. _this.addSettingDiv();
  164. _this.addShowRightTool();
  165. _this.addBeautifyTool();
  166. _this.addTabTool();
  167. _this.addIndexHideTool();
  168. _this.doBeautify();
  169. $("#bIndexHide").remove();
  170. $("#s_upfunc_menus,#u_sp,#s_upfunc_menus *,#u_sp *").unbind('mouseover').unbind('mouseout');
  171. setTimeout(function () {
  172. _this.removeAd();
  173. }, 2300);
  174. _this.removeAd();
  175. _this.blur();
  176. }, 100);
  177. }
  178. });
  179. $("#wrapper_wrapper").on('DOMNodeInserted', function (e) {
  180. if (e.target.id == "container" && e.target.class == undefined) {
  181. setTimeout(function () {
  182. _this.addShowRightTool();
  183. _this.addBeautifyTool();
  184. _this.addTabTool();
  185. _this.addIndexHideTool();
  186. _this.doBeautify();
  187. _this.removeAd();
  188. _this.blur();
  189. $("#bIndexHide").remove();
  190. $("#s_upfunc_menus,#u_sp,#s_upfunc_menus *,#u_sp *").unbind('mouseover').unbind('mouseout');
  191. }, 100);
  192. }
  193. });
  194. });
  195. };
  196. this.initTab = function () {
  197. if (_this.tab == undefined || _this.tab == null) {
  198. _this.tab = 0;
  199. localStorage.setItem('blur-tab', 0);
  200. }
  201. _this.setTab();
  202. $(function () {
  203. _this.addTabTool();
  204. });
  205. };
  206. this.addShowRightTool = function () {
  207. if ($('.blur-right').length == 0) {
  208. var checked = 'checked';
  209. if (_this.right == 0) {
  210. checked = '';
  211. }
  212. var option = '<div class="c-gap-left" style="font-size:14px;padding: 5px 0;"><label><input type="checkbox" class="blur-right" style="margin-top:3px;vertical-align:middle; " ' + checked + ' ><span style="vertical-align:middle;cursor: pointer;">显示右侧</span></label></div>';
  213. $("#bsetting").append(option);
  214. setTimeout(function () {
  215. $(".blur-right").change(_this.toggleRight);
  216. }, 50);
  217. }
  218. };
  219. this.isShowRight = function () {
  220. if (_this.right == 0) {
  221. $('html').append("<style class='bright'>#content_right{opacity:0} </style>");
  222. setTimeout(function () {
  223. if (_this.right == 0) {
  224. $(".bright").text('#content_right{display:none}');
  225. }
  226. }, 500);
  227. }
  228. else {
  229. $(".bright").text('#content_right{opacity:0}');
  230. setTimeout(function () {
  231. if (_this.right == 1) {
  232. $(".bright").text('#content_right{opacity:1}');
  233. }
  234. }, 100);
  235. setTimeout(function () {
  236. if (_this.right == 1) {
  237. $(".bright").remove();
  238. }
  239. }, 500);
  240. }
  241. _this.setTab();
  242. };
  243. this.toggleRight = function () {
  244. if (this.checked) {
  245. _this.right = 1;
  246. localStorage.setItem('blur-right', 1);
  247. }
  248. else {
  249. _this.right = 0;
  250. localStorage.setItem('blur-right', 0);
  251. }
  252. _this.isShowRight();
  253. };
  254. this.beautifyLogo = function () {
  255. if (_this.isNotHaveBackGround()) {
  256. if (_this.beautify != 0) {
  257. $("#lg img,#result_logo img").attr('src', 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMSwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IuWbvuWxgl8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIKCSB2aWV3Qm94PSIwIDAgMTAxIDMzIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCAxMDEgMzM7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDojNDg3OUJEO30KCS5zdDF7ZmlsbDojREQ0NDM2O30KCS5zdDJ7ZmlsbDojRkZGRkZGO30KPC9zdHlsZT4KPHBhdGggY2xhc3M9InN0MCIgZD0iTTUwLjQsMTUuM2MtMy44LDAuMy00LDIuNi01LjcsNC43Yy0xLjgsMi4yLTUuNSw0LjEtNiw2LjdjLTAuNiwzLjMsMS4zLDUuMSwzLDUuN2MxLjksMC42LDYuMi0wLjUsOC40LTAuNWgwLjIKCWgwLjJjMi4yLDAsNi40LDEuMSw4LjQsMC41YzEuOC0wLjYsMy41LTMuMi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MS4xLDYuN2wxLjksMC42CglDODcuOSwyOS45LDg4LjMsMjcuNiw4OC4zLDI1LjJ6Ii8+CjxwYXRoIGNsYXNzPSJzdDIiIGQ9Ik00Ni4zLDI0LjJjMC42LDAsMS4yLDAuMSwxLjcsMC40djMuNGMwLDAuMy0wLjYsMS0xLjksMWMtMS41LDAtMS44LTAuNi0xLjgtMi4xdi0wLjYKCUM0NC4yLDI0LjgsNDQuNywyNC4yLDQ2LjMsMjQuMnogTTQ5LjIsMjAuN0g0OHYyLjVDNDcuNiwyMy4xLDQ3LDIzLDQ2LjMsMjNjLTIuNywwLTMuMywxLTMuMywzLjV2MC4zYzAsMi40LDAuOSwzLjMsMy4yLDMuMwoJYzAuOCwwLDEuMy0wLjEsMS44LTAuNWwwLjEsMC42aDEuMUw0OS4yLDIwLjdMNDkuMiwyMC43eiIvPgo8cGF0aCBjbGFzcz0ic3QyIiBkPSJNNTYuNywyM2gtMS4ydjUuMmMtMC42LDAuNC0xLjcsMC42LTIuNCwwLjZjLTAuOCwwLTEtMC40LTEtMS4zdi00LjZoLTEuMXY0LjhjMCwxLjYsMC41LDIuMywyLjEsMi4zCgljMSwwLDIuMS0wLjMsMi42LTAuNmwwLjEsMC42aDEuMVYyM3oiLz4KPHBhdGggY2xhc3M9InN0MSIgZD0iTTkyLjcsMTUuN2MwLTAuNywwLjYtMS4zLDEuMi0xLjNjMC42LDAsMS4yLDAuNiwxLjIsMS4zUzk0LjUsMTcsOTMuOSwxN0M5My4zLDE2LjksOTIuNywxNi4zLDkyLjcsMTUuN3oiLz4KPC9zdmc+Cg==');
  258. }
  259. else {
  260. $("#lg img,#result_logo img").attr('src', '//www.baidu.com/img/bd_logo1.png?where=super');
  261. }
  262. }
  263. };
  264. this.addBeautifyTool = function () {
  265. var checked = 'checked';
  266. if (_this.beautify == 0) {
  267. checked = '';
  268. }
  269. if ($('.blur-beautify').length == 0) {
  270. var option = '<div class="c-gap-left" style="font-size:14px;padding: 5px 0;"><label><input type="checkbox" class="blur-beautify" style="margin-top:3px;vertical-align:middle;" ' + checked + ' ><span style="vertical-align:middle;cursor: pointer;">美化</span></label></div>';
  271. $("#bsetting").append(option);
  272. setTimeout(function () {
  273. $(".blur-beautify").change(_this.toggleBeautify);
  274. }, 50);
  275. }
  276. };
  277. this.toggleBeautify = function () {
  278. if (this.checked) {
  279. _this.beautify = 1;
  280. localStorage.setItem('blur-beautify', 1);
  281. }
  282. else {
  283. _this.beautify = 0;
  284. localStorage.setItem('blur-beautify', 0);
  285. }
  286. _this.doBeautify();
  287. };
  288. this.doBeautify = function () {
  289. $(".headBgDiv").remove();
  290. if (_this.beautify == 1 || _this.beautify == null) {
  291. _this.beautifyLogo();
  292. $(function () {
  293. _this.beautifyLogo();
  294. });
  295. var style = "<style class='mainStyle'>document,html,body,.c-table th,#page,#s_top_wrap{background:#eee} #page .fk,a .fk,.qrcodeCon{display:none} #s_tab{height:47px} .result:hover,.c-container:hover,.result-op:hover{box-shadow: 5px 5px 7px #ccc;} .result>div,.c-container>div,.result-op>div{margin:10px 0} .result,.c-container,.result-op{background:#fafafa;padding:20px;border-radius: 5px;box-shadow: 5px 5px 7px #ddd;transition:all 0.3s;margin: 0 15px 25px 0!important;} em{color: #ce4343;} .result a,.c-container a,.result-op a,.result em,.c-container em,.result-op em,#u a{text-decoration:none!important;} a{color:#4879BD} #rs{background:none;padding:20px} #rs a{text-decoration:none} #page a, #page strong{height:auto;background:none;border:none} #page .pc,#page .n{border: 1px solid #eee;} #s_tab{background:none} .c-border{border: none; box-shadow: none;} #foot,#help{background:none}#u{margin-top:30px} #s_tab{padding-top:86px } .c-border{padding:0;background:none}.result-op>tbody>tr>td{padding:20px!important}@media screen and (max-width: 1216px){.result,.c-container,.result-op,.result-op>tbody>tr>td{padding:15px;!important}} #s_kw_wrap,#bottom_layer{background:#eee!important}";
  296. if (_this.isNotHaveBackGround() && (_this.initStatus == 0 || document.URL.indexOf('wd=') != -1 || document.URL.indexOf('word=') != -1)) {
  297. style += 'body,#head{background:#eee} .s_form{padding-top: 15px}#s_kw_wrap,#s_top_wrap,#bottom_layer{background:none!important}';
  298. }
  299. if (!_this.isNotHaveBackGround()) {
  300. style += '#s_top_wrap,#bottom_layer,#s_kw_wrap{background:none!important}';
  301. }
  302. if ((!$("#u_sp").length || $("#u_sp").is(':hidden')) && (!$("#u1").length || $("#u1").is(':hidden'))) {
  303. style += '#head{height: 86px;top:0}';
  304. }
  305. style += '</style>';
  306. $(".mainStyle").remove();
  307. $("html").append(style);
  308. }
  309. else {
  310. $(".mainStyle").remove();
  311. }
  312. setTimeout(function () {
  313. _this.setTab();
  314. _this.blur();
  315. }, 350);
  316. };
  317. this.isNotHaveBackGround = function () {
  318. return ($('.s-skin-container').length == 0 || $('.s-skin-container').attr('style') == null || $('.s-skin-container').attr('style').indexOf('background-image') == -1);
  319. };
  320. this.removeAd = function () {
  321. if ($('.tab-wrapper b').text() != '资讯') {
  322. $('#content_left>div:not(.c-container):not(#super_se_tip):not(.video_list_container):not(.result)').remove();
  323. }
  324. if (_this.removeAdTimer) {
  325. clearInterval(_this.removeAdTimer);
  326. _this.removeAdTimes = 0;
  327. }
  328. _this.removeAdTimer = setInterval(function(){
  329. $(".c-container>.f13").each(function () {
  330. var text = $(this).text();
  331. if (text.indexOf('广告') != -1) {
  332. $(this).parents('.c-container').remove();
  333. }
  334. });
  335. _this.removeAdTimes++;
  336. if ( _this.removeAdTimes > 50) {
  337. clearInterval(_this.removeAdTimer);
  338. _this.removeAdTimes = 0;
  339. }
  340. }, 300)
  341.  
  342. $(".c-container>.f13").each(function () {
  343. var text = $(this).text();
  344. if (text.indexOf('广告') != -1) {
  345. $(this).parents('.c-container').remove();
  346. }
  347. });
  348.  
  349. $("#ecomScript").remove();
  350. $('#content_right>div').remove();
  351. $("#con-ar").next().remove();
  352. $(".t>a").unbind('click').click(function () { window.open($(this).attr('href')); return false; });
  353. };
  354. this.blur = function () {
  355. if (_this.css) {
  356. if (_this.isNotHaveBackGround() && ((!$("#u_sp").length || $("#u_sp").is(':hidden')) && (!$("#u1").length || $("#u1").is(':hidden')))) {
  357. $('#head').css({ 'backdrop-filter': 'blur(15px)' });
  358. if (_this.tab && _this.beautify) {
  359. $('#page').css({ 'backdrop-filter': 'blur(15px)', 'background': 'rgba(0, 0, 0, 0)' });
  360. }
  361. }
  362. setTimeout(function () {
  363. $('#head').css({ 'background': 'rgba(0,0,0,0)' });
  364. }, 1000);
  365. $("#s_kw_wrap").css({ 'background': 'rgba(255,255,255,0.8)' });
  366. _this.removeAd();
  367. }
  368. else {
  369. var top = -$(window).scrollTop();
  370. var subHeight = $('#head').outerHeight();
  371. var headBgDiv = '<div style="height:' + subHeight + 'px;width:100%;overflow:hidden;position: absolute;top:0;z-index:-1;display: inline-block;left:0" id="headBgDiv" class="headBgDiv"><div style="position: absolute;top: ' + top + 'px;left: 0;width:100%;filter: blur(13px);z-index: -1" class="bulrBg" id="headerBulrBg"></div>';
  372. if (_this.isNotHaveBackGround() && ((!$("#u_sp").length || $("#u_sp").is(':hidden')) && (!$("#u1").length || $("#u1").is(':hidden')))) {
  373. $(".headBgDiv").remove();
  374. $('#head').prepend(headBgDiv);
  375. }
  376. else {
  377. $(".headBgDiv").remove();
  378. }
  379. $('#wrapper_wrapper #container').addClass('container_l');
  380. _this.removeAd();
  381. $(".bulrBg").append($('#s_tab').clone());
  382. $(".bulrBg").append($('#wrapper_wrapper').clone());
  383. $(".headBgDiv #c-tips-container").remove();
  384. }
  385. };
  386. this.addTabTool = function () {
  387. var checked = 'checked';
  388. if (_this.tab == 0) {
  389. checked = '';
  390. }
  391. if ($('.blur-tab').length == 0) {
  392. var option = '<div class="c-gap-left" style="font-size:14px;padding: 5px 0;"><label><input type="checkbox" class="blur-tab" style="margin-top:3px;vertical-align:middle;" ' + checked + ' ><span style="vertical-align:middle;cursor: pointer;">多列显示(只对大屏幕有效)</span></label></div>';
  393. $("#bsetting").append(option);
  394. setTimeout(function () {
  395. $(".blur-tab").change(_this.toggleTab);
  396. }, 50);
  397. }
  398. };
  399. this.toggleTab = function () {
  400. if (this.checked) {
  401. _this.tab = 1;
  402. localStorage.setItem('blur-tab', 1);
  403. }
  404. else {
  405. _this.tab = 0;
  406. localStorage.setItem('blur-tab', 0);
  407. }
  408. _this.setTab();
  409. };
  410. this.setTab = function () {
  411. $("#bTab").remove();
  412. if ($('.s_tab_inner b').text() == '视频') {
  413. return;
  414. }
  415. if (_this.tab == 1) {
  416. var column = _this.right == 1 ? 2 : 3;
  417. if ($('.tab-wrapper b').text() == '资讯') {
  418. column = 3;
  419. }
  420. var style = '<style id="bTab">@media screen and (min-width: 1216px){#content_left,#rs_top_new{width:1215px;}.cr-offset{padding-left: 35px;}';
  421. if (column == 3) {
  422. var style = '<style id="bTab">@media screen and (min-width: 1216px){.result, .c-container{padding:15px}#content_left,#rs_top_new{width:1750px;}';
  423. }
  424. if (_this.isNotHaveBackGround() && ((!$("#u_sp").length || $("#u_sp").is(':hidden')) && (!$("#u1").length || $("#u1").is(':hidden')))) {
  425. style += 'html{padding-bottom:50px}';
  426. }
  427. if (_this.beautify == 1) {
  428. style += '#page{position: fixed;bottom: 0;width: 100%;padding: 15px 0;text-align: center;margin: 0;}html #page .pc, #page .n{border-color:rgba(200,200,200,0.55);}#page a{ color: rgba(100,100,100,0.95);}#page strong{background: rgba(51,136,255,0.7)!important;color: white;}';
  429. }
  430. style += '#container{width:1775px}#content_left{column-count: ' + column + ';column-width:570px}.result,.c-container{-moz-page-break-inside:avoid;-webkit-column-break-inside:avoid;break-inside:avoid;margin:15px}}</style>';
  431. $('html').append(style);
  432. }
  433. };
  434. this.initIndexHide = function () {
  435. if (_this.indexHide == undefined || _this.indexHide == null) {
  436. _this.indexHide = 0;
  437. localStorage.setItem('blur-index-hide', 0);
  438. }
  439. _this.doIndexHide();
  440. $(function () {
  441. _this.addIndexHideTool();
  442. });
  443. };
  444. this.addIndexHideTool = function () {
  445. if ($('.blur-index-hide').length == 0) {
  446. var checked = 'checked';
  447. if (_this.indexHide == 0) {
  448. checked = '';
  449. }
  450. var option = '<div class="c-gap-left" style="font-size:14px;padding: 5px 0;"><label><input type="checkbox" class="blur-index-hide" style="margin-top:3px;vertical-align:middle; " ' + checked + ' ><span style="vertical-align:middle;cursor: pointer;">首页简化</span></label></div>';
  451. $("#bsetting").append(option);
  452. setTimeout(function () {
  453. $(".blur-index-hide").change(_this.toggleIndexHide);
  454. }, 50);
  455. }
  456. };
  457. this.doIndexHide = function () {
  458. $("#bIndexHide").remove();
  459. $("#s_upfunc_menus,#u_sp,#s_upfunc_menus *,#u_sp *").unbind('mouseover').unbind('mouseout');
  460. if (_this.indexHide == 1 && !(document.URL.indexOf('wd=') != -1 || document.URL.indexOf('word=') != -1)) {
  461. var style = "<style id='bIndexHide'>#s_btn_wr .s_btn{background:#3385ff;color:#fff}#s_kw_wrap{background:rgba(255, 255, 255, 0.3)!important}#kw{background:none!important}#s_upfunc_menus,#u_sp,#bottom_layer,.soutu-btn,#lg,#s_top_wrap,#u1,#s-top-left{opacity: 0; transition: all 0.3s}#s_upfunc_menus:hover,#u_sp:hover,#bottom_layer:hover,.soutu-btn:hover,#lg:hover,#u1:hover,#s-top-left:hover{opacity: 1;}#s_upfunc_menus:hover #s_top_wrap{opacity: 1;}#u_sp:hover #s_top_wrap{opacity: 1;}</style>";
  462. $("#s_upfunc_menus,#u_sp,#s_upfunc_menus *,#u_sp *").mouseover(function () { $("#s_top_wrap").css("opacity", 1); });
  463. $("#s_upfunc_menus,#u_sp,#s_upfunc_menus *,#u_sp *").mouseout(function () { $("#s_top_wrap").css("opacity", 0); });
  464. $('html').append(style);
  465. }
  466. };
  467. this.toggleIndexHide = function () {
  468. if (this.checked) {
  469. _this.indexHide = 1;
  470. localStorage.setItem('blur-index-hide', 1);
  471. }
  472. else {
  473. _this.indexHide = 0;
  474. localStorage.setItem('blur-index-hide', 0);
  475. }
  476. _this.doIndexHide();
  477. };
  478. }
  479. }
  480.  
  481. Blur = new Blur,Blur.init();
  482.  
  483. function myBrowser(){
  484. var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
  485. var isOpera = userAgent.indexOf("Opera") > -1;
  486. if (isOpera) {
  487. return "Opera"
  488. }; //判断是否Opera浏览器
  489. if (userAgent.indexOf("Firefox") > -1) {
  490. return "FF";
  491. } //判断是否Firefox浏览器
  492. if (userAgent.indexOf("Chrome") > -1){
  493. return "Chrome";
  494. }
  495. if (userAgent.indexOf("Safari") > -1) {
  496. return "Safari";
  497. } //判断是否Safari浏览器
  498. if (userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1 && !isOpera) {
  499. return "IE";
  500. }; //判断是否IE浏览器
  501. }
  502.  
  503. function getChromeVersion() {
  504. var arr = navigator.userAgent.split(' ');
  505. var chromeVersion = '';
  506. for(var i=0;i < arr.length;i++){
  507. if(/chrome/i.test(arr[i]))
  508. chromeVersion = arr[i]
  509. }
  510. if(chromeVersion){
  511. return Number(chromeVersion.split('/')[1].split('.')[0]);
  512. } else {
  513. return false;
  514. }
  515. }
  516. })();