🏠 返回首頁 

Greasy Fork is available in English.

搜索页面美化

支持的搜索引擎有1.百度;2.搜狗;3.谷歌;4.必应。兼容“AC-baidu”脚本【支持自定义背景】【支持随机背景图】【支持背景图分类】【支持屏蔽广告】【支持透明度调节】


安装此脚本?
作者推荐脚本

您可能也喜欢AC-baidu-重定向优化百度搜狗谷歌必应搜索_favicon_双列


安装此脚本
  1. /*========================================如 有 自 定 义 代 码 里 面 的 图 片 注 意 备 份 !!!========================================*/
  2. /*========================================如 有 自 定 义 代 码 里 面 的 图 片 注 意 备 份 !!!========================================*/
  3. /*========================================如 有 自 定 义 代 码 里 面 的 图 片 注 意 备 份 !!!========================================*/
  4. /*========================================如 有 自 定 义 代 码 里 面 的 图 片 注 意 备 份 !!!========================================*/
  5. // ==UserScript==
  6. // @name 搜索页面美化
  7. // @name:zh 搜索页面美化
  8. // @name:en Search page beautification
  9. // @name:ja 検索ページの美化
  10. // @description 支持的搜索引擎有1.百度;2.搜狗;3.谷歌;4.必应。兼容“AC-baidu”脚本【支持自定义背景】【支持随机背景图】【支持背景图分类】【支持屏蔽广告】【支持透明度调节】
  11. // @description:zh 支持的搜索引擎有1.百度;2.搜狗;3.谷歌;4.必应。兼容“AC-baidu”脚本【支持自定义背景】【支持随机背景图】【支持背景图分类】【支持屏蔽广告】【支持透明度调节】
  12. // @description:en Supported search engines are 1. Baidu; 2. Sogou; 3. Google; 4. Bing. Compatible with "AC-baidu" script[Support custom background] [Support random background image] [Support background image classification] [Support shielding ads] [Support transparency adjustment]
  13. // @description:ja サポートされている検索エンジンは、1。Baidu、2。Sogou、3。Google、4。Bingです。 「AC-baidu」スクリプトと互換性があります[カスタム背景のサポート] [ランダムな背景画像のサポート] [背景画像の分類のサポート] [シールド広告のサポート] [透明度の調整のサポート]
  14. // @icon https://upyun.calendarli.com/logo.png
  15. // @author 只为你收集世间云朵
  16. // @license MIT License
  17. // @version 4.1.3
  18. // @namespace https://www.calendarli.com
  19. // @match *://www.google.com/search?*
  20. // @match *://www.google.com.hk/search?*
  21. // @match *://cn.bing.com/search?*
  22. // @match *://www.bing.com/search?*
  23. // @match *://www.baidu.com/s?*
  24. // @match *://www.baidu.com/baidu?*
  25. // @match *://www.sogou.com/web?*
  26. // @grant GM_log
  27. // @connect google.com
  28. // @connect baidu.com
  29. // @connect sogou.com
  30. // @connect bing.com
  31. // @require http://cdn.staticfile.org/jquery/2.0.0/jquery.min.js
  32. // @require https://greasyfork.org/scripts/422038-%E5%8F%96%E8%89%B2%E5%99%A8js%E8%84%9A%E6%9C%AC/code/%E5%8F%96%E8%89%B2%E5%99%A8JS%E8%84%9A%E6%9C%AC.js?version=902518
  33. // @copyright 该脚本完全由 只为你收集世间云朵@greasyfork 原创,谢绝抄袭部分或全部代码!如有借鉴代码,请声明并标注脚本链接。
  34. // @copyright:en This script is completely original by 你收集世间云朵@greasyfork, please do not copy part or all of the code! If you have reference code, please declare and mark the script link.
  35. // @copyright:ja このスクリプトは你收集世间云朵@ greasyforkによって完全にオリジナルです。コードの一部または全部をコピーしないでください。 参照コードがある場合は、スクリプトリンクを宣言してマークを付けてください。
  36. // ==/UserScript==
  37. (function() {
  38. setTimeout(function() {
  39. $('html').append($('<style>').append("@media only screen and (min-width: 321px) and (max-width: 1300px){div#rcnt>div:nth-child(2) {display: none;}}div#center_col {margin-left: 132px;}body.b_lbShow #b_header{position: relative;z-index: 9999;} /*Main container*/ #wrapper #content_left .r###lt[tpl='soft'] .op-soft-title, #wrapper #content_left .r###lt h3, #wrapper #content_left .c-container h3{ background-color: #ffffffa8;}#wrapper #rs, #wrapper #content_left .r###lt, #wrapper #content_left .c-container,#rso .g{background: rgba(243 243 243 / " + getVariable('ListTransparencyNumberValue') + ");backdrop-filter: blur(2px);padding: 10px 20px;border-radius: 6px;}div.colpick_dark{z-index: 99;}#b_r###lts>.b_algo{margin-top: 10px;}.search_tool_conter.new_search_tool_conter span,div#b_tween span,.b_underSearchbox span{color: #e9a2b0;}.s_tab_inner {margin-top: 10px;background: #ffffffa8;width: 591px;padding: 0 5px;margin-left: -10px;}.container_s>div#content_right{position: relative;right: -72px;}.colpick { position: absolute; width: 346px; height: 170px; overflow: hidden; display: none; font-family: Arial, Helvetica, sans-serif; background:#ebebeb; border: 1px solid #bbb; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; /*Prevents selecting text when dragging the selectors*/ -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; -o-user-select: none; user-select: none; } .colpick, .colpick * { -moz-box-sizing: content-box; -webkit-box-sizing: content-box; box-sizing: content-box; } /*Color selection box*/ .colpick_color { position: absolute; left: 7px; top: 7px; width: 156px; height: 156px; overflow: hidden; outline: 1px solid #aaa; cursor: crosshair; } .colpick_color_overlay1 { position: absolute; left:0; top:0; width: 156px; height: 156px; filter: progid:DXImageTransform.Microsoft.gradient(GradientType=1,startColorstr='#ffffff', endColorstr='#00ffffff'); /* IE6 & IE7 */ -ms-filter: 'progid:DXImageTransform.Microsoft.gradient(GradientType=1,startColorstr='#ffffff', endColorstr='#00ffffff')'; /* IE8 */ background: linear-gradient(to right, rgba(255,255,255,1), rgba(255,255,255,0)); } .colpick_color_overlay2 { position: absolute; left:0; top:0; width: 156px; height: 156px; filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#00000000', endColorstr='#000000'); /* IE6 & IE7 */ -ms-filter: 'progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#00000000', endColorstr='#000000')'; /* IE8 */ background: linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,1)); } /*HSL gradients are different*/ .colpick_hsl .colpick_color_overlay1 { background: linear-gradient(to right, rgba(128,128,128,1) 0%, rgba(128,128,128,0) 100%); } .colpick_hsl .colpick_color_overlay2 { background: linear-gradient(to bottom, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 50%, rgba(0,0,0,0) 50%, rgba(0,0,0,1) 100%); } /*Circular color selector*/ .colpick_selector_outer { background:none; position: absolute; width: 11px; height: 11px; margin: -6px 0 0 -6px; border: 1px solid black; border-radius: 50%; } .colpick_selector_inner{ position: absolute; width: 9px; height: 9px; border: 1px solid white; border-radius: 50%; } /*Vertical hue bar*/ .colpick_hue { position: absolute; top: 6px; left: 175px; width: 19px; height: 156px; border: 1px solid #aaa; cursor: n-resize; } /*Hue bar sliding indicator*/ .colpick_hue_arrs { position: absolute; left: -8px; width: 35px; height: 7px; margin: -7px 0 0 0; } .colpick_hue_larr { position:absolute; width: 0; height: 0; border-top: 6px solid transparent; border-bottom: 6px solid transparent; border-left: 7px solid #858585; } .colpick_hue_rarr { position:absolute; right:0; width: 0; height: 0; border-top: 6px solid transparent; border-bottom: 6px solid transparent; border-right: 7px solid #858585; } /*New color box*/ .colpick_new_color { position: absolute; left: 207px; top: 6px; width: 60px; height: 27px; background: #f00; border: 1px solid #8f8f8f; } /*Current color box*/ .colpick_current_color { position: absolute; left: 277px; top: 6px; width: 60px; height: 27px; background: #f00; border: 1px solid #8f8f8f; } /*Input field containers*/ .colpick_field, .colpick_hex_field { position: absolute; height: 20px; width: 60px; overflow:hidden; background:#f3f3f3; color:#b8b8b8; font-size:12px; border:1px solid #bdbdbd; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; } .colpick_rgb_r { top: 40px; left: 207px; } .colpick_rgb_g { top: 67px; left: 207px; } .colpick_rgb_b { top: 94px; left: 207px; } .colpick_hsx_h { top: 40px; left: 277px; } .colpick_hsx_s { top: 67px; left: 277px; } .colpick_hsx_x { top: 94px; left: 277px; } .colpick_hex_field { width: 68px; left: 207px; top: 121px; } /*Text field container on focus*/ .colpick_focus { border-color: #999; } /*Field label container*/ .colpick_field_letter { position: absolute; width: 12px; height: 20px; line-height: 20px; padding-left: 4px; background: #efefef; border-right: 1px solid #bdbdbd; font-weight: bold; color:#777; } /*Text inputs*/ .colpick_field input, .colpick_hex_field input { position: absolute; right: 11px; margin: 0; padding: 0; height: 20px; line-height: 20px; background: transparent; border: none; font-size: 12px; font-family: Arial, Helvetica, sans-serif; color: #555; text-align: right; outline: none; } .colpick_hex_field input { right: 4px; } /*Field up/down arrows*/ .colpick_field_arrs { position: absolute; top: 0; right: 0; width: 9px; height: 21px; cursor: n-resize; } .colpick_field_uarr { position: absolute; top: 5px; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-bottom: 4px solid #959595; } .colpick_field_darr { position: absolute; bottom:5px; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 4px solid #959595; } /*Submit/Select button*/ .colpick_submit { position: absolute; left: 207px; top: 149px; width: 130px; height: 22px; line-height:22px; background: #efefef; text-align: center; color: #555; font-size: 12px; font-weight:bold; border: 1px solid #bdbdbd; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; } .colpick_submit:hover { background:#f3f3f3; border-color:#999; cursor: pointer; } /*full layout with no submit button*/ .colpick_full_ns .colpick_submit, .colpick_full_ns .colpick_current_color{ display:none; } .colpick_full_ns .colpick_new_color { width: 130px; height: 25px; } .colpick_full_ns .colpick_rgb_r, .colpick_full_ns .colpick_hsx_h { top: 42px; } .colpick_full_ns .colpick_rgb_g, .colpick_full_ns .colpick_hsx_s { top: 73px; } .colpick_full_ns .colpick_rgb_b, .colpick_full_ns .colpick_hsx_x { top: 104px; } .colpick_full_ns .colpick_hex_field { top: 135px; } /*rgbhex layout*/ .colpick_rgbhex .colpick_hsx_h, .colpick_rgbhex .colpick_hsx_s, .colpick_rgbhex .colpick_hsx_x { display:none; } .colpick_rgbhex { width:282px; } .colpick_rgbhex .colpick_field, .colpick_rgbhex .colpick_submit { width:68px; } .colpick_rgbhex .colpick_new_color { width:34px; border-right:none; } .colpick_rgbhex .colpick_current_color { width:34px; left:240px; border-left:none; } /*rgbhex layout, no submit button*/ .colpick_rgbhex_ns .colpick_submit, .colpick_rgbhex_ns .colpick_current_color{ display:none; } .colpick_rgbhex_ns .colpick_new_color{ width:68px; border: 1px solid #8f8f8f; } .colpick_rgbhex_ns .colpick_rgb_r { top: 42px; } .colpick_rgbhex_ns .colpick_rgb_g { top: 73px; } .colpick_rgbhex_ns .colpick_rgb_b { top: 104px; } .colpick_rgbhex_ns .colpick_hex_field { top: 135px; } /*hex layout*/ .colpick_hex .colpick_hsx_h, .colpick_hex .colpick_hsx_s, .colpick_hex .colpick_hsx_x, .colpick_hex .colpick_rgb_r, .colpick_hex .colpick_rgb_g, .colpick_hex .colpick_rgb_b { display:none; } .colpick_hex { width:206px; height:201px; } .colpick_hex .colpick_hex_field { width:72px; height:25px; top:168px; left:80px; } .colpick_hex .colpick_hex_field div, .colpick_hex .colpick_hex_field input { height: 25px; line-height: 25px; } .colpick_hex .colpick_new_color { left:9px; top:168px; width:30px; border-right:none; } .colpick_hex .colpick_current_color { left:39px; top:168px; width:30px; border-left:none; } .colpick_hex .colpick_submit { left:164px; top: 168px; width:30px; height:25px; line-height: 25px; } /*hex layout, no submit button*/ .colpick_hex_ns .colpick_submit, .colpick_hex_ns .colpick_current_color { display:none; } .colpick_hex_ns .colpick_hex_field { width:80px; } .colpick_hex_ns .colpick_new_color{ width:60px; border: 1px solid #8f8f8f; } /*Dark color scheme*/ .colpick_dark { background: #161616; border-color: #2a2a2a; } .colpick_dark .colpick_color { outline-color: #333; } .colpick_dark .colpick_hue { border-color: #555; } .colpick_dark .colpick_field, .colpick_dark .colpick_hex_field { background: #101010; border-color: #2d2d2d; } .colpick_dark .colpick_field_letter { background: #131313; border-color: #2d2d2d; color: #696969; } .colpick_dark .colpick_field input, .colpick_dark .colpick_hex_field input { color: #7a7a7a; } .colpick_dark .colpick_field_uarr { border-bottom-color:#696969; } .colpick_dark .colpick_field_darr { border-top-color:#696969; } .colpick_dark .colpick_focus { border-color:#444; } .colpick_dark .colpick_submit { background: #131313; border-color:#2d2d2d; color:#7a7a7a; } .colpick_dark .colpick_submit:hover { background-color:#101010; border-color:#444; }"))
  40. }, 1000)
  41. /**
  42. * 图片数据
  43. */
  44. var GroupList = {
  45. Anime: {
  46. Name: "动漫",
  47. ImgList: [
  48. "https://upyun.calendarli.com/Anime/063f89738882f07b08aaebaeaff23510.jpg",
  49. "https://upyun.calendarli.com/Anime/1fa0ed09fe6ef8a09b114ba40b8c22f3.jpg",
  50. "https://upyun.calendarli.com/Anime/5bc35d75b52b852d12544b7d8c1b88c6.jpg",
  51. "https://upyun.calendarli.com/Anime/11fed6086ab5ee4cd24989a2a816db77.jpg"
  52. ]
  53. },
  54. landscape: {
  55. Name: "自然风景",
  56. ImgList: [
  57. "https://upyun.calendarli.com/Landscape/150909a21756042f3a38e0db3d47c2c5.jpg",
  58. "https://upyun.calendarli.com/Landscape/4940e494d71f9400a85f63288cefe8de.jpeg",
  59. "https://upyun.calendarli.com/Landscape/d5603970a58c68cb2e758f8e4924487a.jpeg",
  60. "https://upyun.calendarli.com/Landscape/db27f9d0e53d7571926c05faf63ce9a0.jpg"
  61. ]
  62. }
  63. };
  64. /**
  65. * localStorage数据储存的封装
  66. */
  67. // eslint-disable-next-line camelcase
  68. var CL_LocalStorage = ((function() {
  69. var currentLocalKey = "__CLKZB__STORAGE__KEY__";
  70. var currentLocal = localStorage.getItem(currentLocalKey);
  71. var currentLocalObject;
  72. if (currentLocal === null) {
  73. currentLocalObject = {};
  74. } else {
  75. currentLocalObject = JSON.parse(currentLocal);
  76. }
  77. return {
  78. getRawObj: function() {
  79. return currentLocalObject;
  80. },
  81. /**
  82. * 获取元素
  83. * @param key 要获取的值的key
  84. * @param defaultValue 若不存在相应的key,则应该返回的默认值,默认为undefined
  85. */
  86. getItem: function(key, defaultValue) {
  87. if (defaultValue === void 0) { defaultValue = undefined; }
  88. var value = currentLocalObject[key];
  89. if (value) {
  90. return value;
  91. } else {
  92. return defaultValue;
  93. }
  94. },
  95. /**
  96. * 设置元素
  97. * @param key 要设置的key
  98. * @param value 要设置的值内容
  99. */
  100. setItem: function(key, value) {
  101. currentLocalObject[key] = value;
  102. },
  103. /**
  104. * 保存数据到localStorage
  105. */
  106. save: function() {
  107. localStorage.setItem(currentLocalKey, JSON.stringify(currentLocalObject));
  108. },
  109. /**
  110. * 移除元素
  111. * @param key 要移除的key
  112. */
  113. removeItem: function(key) {
  114. delete currentLocalObject[key];
  115. },
  116. /**
  117. * 清空元素
  118. */
  119. clear: function() {
  120. currentLocalObject = {};
  121. }
  122. };
  123. })());
  124. var getVariable = (function(name) {
  125. /* 获取localStorage数据*/
  126. window.BackgroundTransparencyNumberValue = CL_LocalStorage.getItem('BackgroundTransparencyNumberValue', '0.4') //背景透明
  127. window.ListTransparencyNumberValue = CL_LocalStorage.getItem('ListTransparencyNumberValue', '0.6') //列表透明
  128. window.PureColorBackgroundChecked = CL_LocalStorage.getItem('PureColorBackgroundChecked', false) //自定义纯色背景
  129. window.CustomizeUrlValueChecked = CL_LocalStorage.getItem('CustomizeUrlValueChecked', '') //自定义URL值
  130. window.CustomizeURLChecked = CL_LocalStorage.getItem('CustomizeURLChecked', false) //自定义URL
  131. window.CustomBackgroundCode = CL_LocalStorage.getItem('CustomBackgroundCode', '#FFF') //纯色背景代码
  132. window.RandomPicturesChecked = CL_LocalStorage.getItem('RandomPicturesChecked', false) //随机图片
  133. window.picGroupSelectValue = CL_LocalStorage.getItem('picGroupSelectValue', 'Anime') //分组
  134. window.advertisingChecked = CL_LocalStorage.getItem('advertisingChecked', false) //清除广告
  135. window.SideColumnChecked = CL_LocalStorage.getItem('SideColumnChecked', false) //删除侧栏
  136. window.PictureURLIndex = CL_LocalStorage.getItem('PictureURLIndex', '0') //图片当前索引
  137. window.len = GroupList[picGroupSelectValue].ImgList.length - 1 //图片索引数量
  138. n = window[name]
  139. return n
  140. })
  141. /* 获取localStorage数据 */
  142. // var CustomBackgroundCode = CL_LocalStorage.getItem("CustomBackgroundCode", "#FFF"); // 纯色背景代码
  143. /* 输出localStorage数据到控制台 */
  144. console.log(CL_LocalStorage.getRawObj());
  145. /**
  146. * CSS数据
  147. */
  148. var cssContent = {
  149. 'body': {
  150. "background-position-x": "center",
  151. "background-attachment": "fixed",
  152. "background-size": "cover",
  153. 'z-index': '-1000',
  154. 'position': 'relative'
  155. },
  156. "div#CL_Console": {
  157. "-moz-user-select": "none",
  158. "-webkit-user-select": "none",
  159. "-ms-user-select": "none",
  160. "-khtml-user-select": "none",
  161. "user-select": "none",
  162. 'position': "fixed",
  163. 'top': "35%",
  164. 'left': "1",
  165. 'z-index': '99'
  166. },
  167. "img#CL_img": {
  168. 'width': "35px",
  169. "border-radius": "20px",
  170. 'cursor': "pointer"
  171. },
  172. ".none": {
  173. 'display': "none"
  174. },
  175. ".block": {
  176. 'display': "block"
  177. },
  178. "div#CL_OperationPanel": {
  179. 'width': "300px",
  180. 'height': "300px",
  181. 'background': "rgb(232 240 255 / 70%)",
  182. 'backdrop-filter': 'blur(3px)',
  183. 'position': "absolute",
  184. 'top': "20px",
  185. 'left': "35px",
  186. "box-shadow": "1px 1px 4px 0px #747698",
  187. "border-radius": "6px",
  188. 'padding': "10px"
  189. },
  190. "div#CL_OperationPanel>div": {
  191. 'height': "30px",
  192. "line-height": "30px",
  193. "margin-top": "10px"
  194. },
  195. ".Button": {
  196. 'width': "49%",
  197. 'display': "inline-block",
  198. "text-align": "center",
  199. 'background': "#fbfbfb",
  200. "box-shadow": "1px 1px 3px 0px #5e8796",
  201. "border-radius": "7px",
  202. 'cursor': "pointer",
  203. 'background': 'rgba(240, 248, 255, 0)'
  204. },
  205. ".functional>p": {
  206. 'margin': "0px",
  207. 'display': "inline-block",
  208. 'width': "31%"
  209. },
  210. ".color-box": {
  211. 'float': "left",
  212. 'width': "30px",
  213. 'height': "20px",
  214. 'margin': "5px",
  215. 'border': "1px solid white",
  216. 'cursor': "pointer"
  217. },
  218. "p.RandomPictures": {
  219. 'float': "left",
  220. 'margin': "0"
  221. },
  222. "span#save,span#Reset": {
  223. 'margin': "auto",
  224. 'display': "inline-block",
  225. 'width': "50px",
  226. "margin-left": "10px"
  227. },
  228. ".OperationButton": {
  229. 'position': "absolute",
  230. 'left': "50%",
  231. "margin-left": "-66px",
  232. 'bottom': "10px"
  233. },
  234. "#panelDOM select": {
  235. "border-color": "#7b7b7b"
  236. },
  237. ".checkboxWrap": {
  238. 'cursor': "pointer"
  239. },
  240. '.wrapper_new #foot': {
  241. 'background-color': '#f5f5f6a8'
  242. },
  243. "div#s_tab": {
  244. 'background': '#f8f8f8'
  245. },
  246. '.s_tab_inner': {
  247. 'background': 'none'
  248. },
  249. 'div#fbar,.appbar,.yg51vc,#hdtb': {
  250. 'background': '#f2f2f29e'
  251. },
  252. '.MXl0lf.mtqGb,div#pagebar_container': {
  253. 'background': '#ffffffc9',
  254. 'margin-top': '19px'
  255. },
  256. 'div#b_content': {
  257. 'padding-left': '140px'
  258. },
  259. 'p.Customize.checkboxWrap': {
  260. 'float': 'left',
  261. 'margin': '0px',
  262. 'cursor': 'pointer'
  263. },
  264. 'div#CL_OperationPanel input[type="text"]': {
  265. 'width': '190px',
  266. 'margin-top': '4.3px',
  267. 'height': '20px'
  268. },
  269. 'span#help':{
  270. 'background':'none'
  271. }
  272. };
  273. /**
  274. * 加载控制面板
  275. */
  276. $('body').append(
  277. $('<div id="CL_Console">').append(
  278. $('<img id="CL_img" src="https://upyun.calendarli.com/logo.png" title="MOD控制台"/>')
  279. ).append(
  280. $('<div id="CL_OperationPanel" class="none">').append(
  281. $('<div class="ChangePicture">').append('<span id="before" class="Button">上一张</span><span id="Rear" class="Button">下一张</span>')
  282. ).append(
  283. $('<div class="DropDownGroup">').append($('<span>切换分组:')).append($('<select class="select" name="picGroup" id="pic-group-selector">'))
  284. ).append(
  285. $('<div class="CustomizeURL">').append('<div><p class="Customize checkboxWrap" title="可填写图床URL"><input type="checkbox" name="CustomizeURL" value="自定义URL" default="false">自定义URL</p><input type="text" name="CustomizeUrlValue"></div>')
  286. ).append(
  287. $('<div class="transparency">').append(
  288. $('<span>').append('背景透明度:')
  289. ).append('<select class="BackgroundSelector" name="BackgroundTransparency" cl-select-number defaultValue="0.4" maxValue="1" minValue="0" stepValue="0.1"></select>').append(
  290. $('<span>').append('列表透明度:')
  291. ).append('<select class="ListSelector" name="ListTransparency" cl-select-number defaultValue="0.4" maxValue="1" minValue="0" stepValue="0.1"></select>')
  292. ).append(
  293. $('<div class="functional">').append('<p class="advertising checkboxWrap"><input type="checkbox" name="advertising" default="false" value="清除广告"/>清除广告</p><p class="SideColumn checkboxWrap"><input type="checkbox" name="SideColumn" default="false" value="删除侧栏"/>删除侧栏</p><p class="RandomPictures checkboxWrap"><input type="checkbox" name="RandomPictures" default="false" value="随机图片" title="启用后将禁用手动切换"/>随机图片</p>')
  294. ).append(
  295. $('<div class="PureColorBackground">').append(
  296. $('<p class="RandomPictures checkboxWrap">').append('<input type="checkbox" name="PureColorBackground" value="纯色背景" default="false" title="启用后背景透明度将不可用"/>纯色背景')
  297. ).append('<div class="color-box"></div>')
  298. ).append(
  299. $('<div class="OperationButton">').append('<span id="save" class="Button">保存</span><span id="Reset" class="Button">重置</span>')
  300. )
  301. )
  302. )
  303. $('#CL_OperationPanel input[name=CustomizeUrlValue]').val(getVariable('CustomizeUrlValueChecked'))
  304. $('#CL_Console').siblings().on('click',()=>{
  305. $('#CL_OperationPanel').hide(200)
  306. })
  307. /**
  308. * 启用调色器
  309. */
  310. // @ts-ignore
  311. /*$(".color-box").colpick({
  312. colorScheme: "dark",
  313. layout: "rgbhex",
  314. color: "fff",
  315. onSubmit: function(hsb, hex, rgb, el) {
  316. $(el).css("background-color", "#" + hex);
  317. // @ts-ignore
  318. $(el).colpickHide();
  319. }
  320. });*/
  321. /**
  322. * 加载自定义的背景色
  323. */
  324. $(".color-box").css("background-color", getVariable('CustomBackgroundCode')); // 纯色背景代码
  325. /**
  326. * 把固定CSS数据绑定到相应的元素上
  327. */
  328. for (var selector in cssContent) {
  329. $(selector).css(cssContent[selector]);
  330. }
  331. /**
  332. * 加载分组选项
  333. */
  334. for (var group in GroupList) {
  335. $("#pic-group-selector").append("<option value=\"" + group + "\">" + GroupList[group].Name + "</option>");
  336. }
  337. /**
  338. * 加载checkbox的选中
  339. */
  340. $.each($("#CL_OperationPanel input[type=checkbox]"), function(_, item) {
  341. var jqDOM = $(item);
  342. var key = jqDOM.attr("name") + "Checked";
  343. var defaultValue = JSON.parse(jqDOM.attr("default"));
  344. jqDOM.prop("checked", CL_LocalStorage.getItem(key, defaultValue));
  345. });
  346. /**
  347. * 加载number下拉选项的选项内容
  348. */
  349. $.each($("select[cl-select-number]"), function(_, item) {
  350. var jqDOM = $(item);
  351. var key = jqDOM.attr("name") + "NumberValue";
  352. var defaultValue = parseFloat(JSON.parse(jqDOM.attr("defaultValue")));
  353. var minValue = parseFloat(jqDOM.attr("minValue"));
  354. var maxValue = parseFloat(jqDOM.attr("maxValue"));
  355. var stepValue = parseFloat(jqDOM.attr("stepValue"));
  356. var targetValue = CL_LocalStorage.getItem(key, defaultValue);
  357. for (var i = minValue; i <= maxValue; i = parseFloat((i + stepValue).toPrecision(12))) {
  358. if (Math.abs(targetValue - i) < 0.0001) {
  359. jqDOM.append("<option value=\"" + i + "\" selected>" + i + "</option>");
  360. } else {
  361. jqDOM.append("<option value=\"" + i + "\">" + i + "</option>");
  362. }
  363. }
  364. });
  365. (function() {
  366. var key = $("#pic-group-selector").attr("name") + "SelectValue";
  367. var targetValue = CL_LocalStorage.getItem(key);
  368. if (targetValue) {
  369. $("#pic-group-selector").val(targetValue);
  370. }
  371. })();
  372. $('body').prepend($('<div class="Masklayer" style="background: #fff;width: 10090px;height: 10080px;z-index: -999;position: fixed;top: 0px;left: 0px; opacity:0.4;">'))
  373. var Output = function() {
  374. var obj = new Image();
  375. /**
  376. * 输出背景
  377. */
  378. if (getVariable('CustomizeURLChecked') == true) {
  379. obj.src = getVariable('CustomizeUrlValueChecked')
  380. } else {
  381. if (getVariable('RandomPicturesChecked') == true) {
  382. obj.src = GroupList[getVariable('picGroupSelectValue')].ImgList[parseInt(Math.random() * getVariable('len') + 1)]
  383. } else {
  384. obj.src = GroupList[getVariable('picGroupSelectValue')].ImgList[getVariable('PictureURLIndex')];
  385. }
  386. }
  387. /**
  388. * 输出纯色背景
  389. */
  390. if (getVariable('PureColorBackgroundChecked') == true) {
  391. $('body')[0].style.backgroundColor = getVariable('CustomBackgroundCode')
  392. $('body')[0].style.backgroundImage = ''
  393. } else {
  394. obj.onload = function() {
  395. $('body')[0].style.backgroundImage = 'url(' + this.src + ')'
  396. $('body')[0].style.backgroundColor = ''
  397. console.log(getVariable('PictureURLIndex') + '/' + getVariable('len'))
  398. }
  399. }
  400. /**
  401. * 清除侧栏
  402. */
  403. if (getVariable('SideColumnChecked') == true) {
  404. $('div#content_right,div#rhs[jscontroller],aside[aria-label],div#right[class="right"],div#rcnt>div:nth-child(2)').hide()
  405. } else {
  406. $('div#content_right,div#rhs[jscontroller],aside[aria-label],div#right[class="right"],div#rcnt>div:nth-child(2)').show()
  407. }
  408. /**div#rhs
  409. * 清除广告
  410. */
  411. if (getVariable('advertisingChecked') == true) {
  412. setInterval(function() { $('.new-pmd.c-container[data-ecimtimesign],div[class="r###lt c-container"],#bottomads,div#center_col>#taw').hide() }, 1000)
  413. } else {
  414. $('.new-pmd.c-container[data-ecimtimesign]').show()
  415. }
  416. /**
  417. * 设置背景透明
  418. */
  419. $('.Masklayer')[0].style.opacity = getVariable('BackgroundTransparencyNumberValue')
  420. /**
  421. * 设置列表透明
  422. */
  423. $('div[class ^= r###lt],div[data-ecimtimesign],div#rhs[jscontroller],.kp-blk.knowledge-panel.Wnoohf.OJXvsb,div.hlcw0c>.g,.ccBEnf,.MGqjK,ol#b_r###lts li[class],#b_context li,header#b_header,#wrapper div#right,#taw,#bottomads>div').attr({ style: 'background: rgba(243 243 243 / ' + getVariable('ListTransparencyNumberValue') + ');backdrop-filter: blur(2px);padding: 10px 20px;border-radius: 6px;' })
  424. }
  425. /**适应搜索动态刷新列表 */
  426. $(document).on('change', '#b_context li', Output())
  427. /**
  428. * 默认调整样式
  429. */
  430. $('div#rs,span.fk,#bres,#b_r###lts>.b_ans,div#promotion_adv_container,.hintBox,#leftbottomleadContainer').hide()
  431. $('h3[class="t"],h3[class="LC20lb DKV0Md"]').after('<hr/>')
  432. $('#page a,.page-inner strong').attr({ style: 'height: 36px; background: #ffffffb8;' })
  433. $('.r###lt-molecule.new-pmd[tpl="app/page"]').css('height','73px')
  434. $('div#page').css({'background':'none','margin':'0'})
  435. setTimeout(function(){
  436. $('.r###lt-molecule.new-pmd[tpl="app/rs"]').css('width','58%')
  437. },500)
  438. Output()
  439. /**
  440. * 操作板的显示/隐藏
  441. */
  442. $(document).on("click", "#CL_img", function() {
  443. $("#CL_OperationPanel").toggle(200);
  444. });
  445. /**
  446. * 自定义按钮的按下动态特效
  447. */
  448. $(document).on("mousedown", ".Button", function() {
  449. $(this).css("box-shadow", "1px 1px 1px 0px #5e8796");
  450. });
  451. /**
  452. * 自定义按钮的松开动态特效
  453. */
  454. $(document).on("mouseup", ".Button", function() {
  455. $(this).css("box-shadow", "1px 1px 3px 0px #5e8796");
  456. });
  457. /**
  458. * 背景前后切换
  459. */
  460. $(document).on('click', '#before', function() {
  461. var xn = getVariable('PictureURLIndex') ? Number(getVariable('PictureURLIndex')) - 1 : getVariable('len');
  462. xn = xn < '0' ? getVariable('len') : xn
  463. CL_LocalStorage.setItem("PictureURLIndex", String(xn))
  464. CL_LocalStorage.save()
  465. // window.location.reload();
  466. Output()
  467. })
  468. $(document).on('click', '#Rear', function() {
  469. var xn = getVariable('PictureURLIndex') ? Number(getVariable('PictureURLIndex')) + 1 : 1;
  470. console.log(picGroupSelectValue + ':' + xn + '/' + getVariable('len'))
  471. xn = xn > getVariable('len') ? '0' : xn
  472. CL_LocalStorage.setItem("PictureURLIndex", String(xn))
  473. CL_LocalStorage.save()
  474. // window.location.reload();
  475. Output()
  476. })
  477. /**
  478. * 重置
  479. */
  480. $(document).on("click", "#Reset", function() {
  481. CL_LocalStorage.clear();
  482. CL_LocalStorage.save()
  483. window.location.reload();
  484. });
  485. /**
  486. * 保存
  487. */
  488. $(document).on("click", "#save", function() {
  489. /**
  490. * 保存数字选项的值
  491. */
  492. $.each($("select[cl-select-number]"), function(_, item) {
  493. var jqDOM = $(item);
  494. var key = jqDOM.attr("name") + "NumberValue";
  495. var value = jqDOM.val();
  496. CL_LocalStorage.setItem(key, value);
  497. });
  498. /**
  499. * 保存picGroup的值
  500. */
  501. (function() {
  502. var key = $("#pic-group-selector").attr("name") + "SelectValue";
  503. var value = $("#pic-group-selector").val();
  504. CL_LocalStorage.setItem(key, value);
  505. })();
  506. /**
  507. * 保存Checkbox的值
  508. */
  509. $.each($("#CL_OperationPanel input[type=checkbox]"), function(_, item) {
  510. var jqDOM = $(item);
  511. var key = jqDOM.attr("name") + "Checked";
  512. var value = jqDOM.prop("checked");
  513. CL_LocalStorage.setItem(key, value);
  514. });
  515. /**
  516. * 保存text的值
  517. */
  518. $.each($("#CL_OperationPanel input[type=text]"), function(_, item) {
  519. var jqDOM = $(item);
  520. var key = jqDOM[0].name + "Checked";
  521. var value = jqDOM.val();
  522. CL_LocalStorage.setItem(key, value);
  523. })
  524. /**
  525. * 保存自定义颜色代码
  526. */
  527. CL_LocalStorage.setItem("CustomBackgroundCode", $(".color-box")[0].style.backgroundColor);
  528. /**
  529. * 保存默认图片索引
  530. */
  531. var PX = CL_LocalStorage.getItem("PictureURLIndex") ? function() {} : function() { CL_LocalStorage.setItem("PictureURLIndex", '0') }
  532. PX();
  533. CL_LocalStorage.save();
  534. // window.location.reload();
  535. Output()
  536. });
  537. /**
  538. * 点击checkbox的外部,也相当于点击了checkbox内部
  539. */
  540. $(document).on("click", ".checkboxWrap", function(event) {
  541. $.each($(event.target).children("input[type=checkbox]"), function(_, item) {
  542. $(item).prop("checked", !$(item).prop("checked"));
  543. });
  544. });
  545. })();