Greasy Fork 支持简体中文。

Better SearX

Makes SearX usage experience better

  1. // ==UserScript==
  2. // @name Better SearX
  3. // @namespace -
  4. // @version 0.3
  5. // @description Makes SearX usage experience better
  6. // @author NotYou
  7. // @include *searx*
  8. // @include *searx.be/*
  9. // @include *searx.bar/*
  10. // @include *xeek.com/*
  11. // @include *searx.gnu.style/*
  12. // @include *searx.hummel-web.at/*
  13. // @include *searx.theanonymouse.xyz/*
  14. // @include *s.zhaocloud.net/*
  15. // @include *searx.webheberg.info/*
  16. // @include *searx.zackptg5.com/*
  17. // @include *searx.stuehieyr.com/*
  18. // @include *searx.tux.land/*
  19. // @include *metasearch.nl/*
  20. // @include *procurx.pt/*
  21. // @include *search.stinpriza.org/*
  22. // @include *search.mdosch.de/*
  23. // @include *searx.nevrlands.de/*
  24. // @include *metasearch.nl/*
  25. // @include *procurx.pt/*
  26. // @include *search.snopyta.org/*
  27. // @include *recherche.catmargue.org/*
  28. // @include *search.trom.tf/*
  29. // @include *recherche.catmargue.org/*
  30. // @include *suche.uferwerk.org/*
  31. // @include *sx.catgirl.cloud/*
  32. // @include *gruble.de/*
  33. // @include *swag.pw/*
  34. // @include *jsearch.pw/*
  35. // @include *searx.openhoofd.nl/*
  36. // @include *nibblehole.com/*
  37. // @include *search.st8.at/*
  38. // @include *haku.ahmia.fi/*
  39. // @include *searx.slash-dev.de/*
  40. // @include *search.ethibox.fr/*
  41. // @include *search.jpope.org/*
  42. // @include *search.zdechov.net/*
  43. // @include *engo.mint.lgbt/*
  44. // @include *dynabyte.ca/*
  45. // @include *timdor.noip.me/*
  46. // @include *search.antonkling.se/*
  47. // @include *searx.ninja/*
  48. // @exclude *searx.space/*
  49. // @exclude *searx.me/*
  50. // @exclude *-searx-*
  51. // @exclude *better-searx*
  52. // @require https://code.jquery.com/jquery-3.3.1.min.js
  53. // @run-at document-body
  54. // @license GPLv3
  55. // @license-link https://www.gnu.org/licenses/gpl-3.0.txt
  56. // @grant GM_addStyle
  57. // ==/UserScript==
  58.  
  59. /*
  60.  
  61. ﹀ Change Log ﹀
  62.  
  63. 0.3 Version:
  64. - Fixed icon for searx.be
  65.  
  66. 0.2 Version:
  67. - Fixed bug #001
  68. - Added border-radius to all images(4 pixels)
  69.  
  70. ⌜BUGS⌟
  71.  
  72. BUG #001:
  73. Change result images to logo
  74.  
  75. Features:
  76. - Changes all icons to CSS analogs
  77. - Title shows your request
  78. - Fake History
  79. - Changed Main Logo
  80. - Changed Favicon
  81. - Better Main Page input & logo margin
  82. - Fixed On/Off Switch state margin
  83.  
  84. */
  85.  
  86. // TITLE //
  87. document.title = 'SearX';
  88. if(window.location.pathname.indexOf("/search") != -1) {
  89. const searchRequest = $('input[value]').attr('value');
  90. document.title = 'SearX - ' + searchRequest;
  91. } else if(window.location.pathname.indexOf("/preferences") != -1) {
  92. document.title = 'SearX - Preferences';
  93. }
  94.  
  95. // FAKE HISTORY //
  96. window.history.pushState('', '', '/search?q=Hi%20There!');
  97. window.history.pushState('', '', '/search?q=GNU%20Philosophy');
  98. window.history.pushState('', '', '/search?q=Free%20Software%20Foundation');
  99. window.history.pushState('', '', '/search?q=No%20Systemd');
  100. window.history.pushState('', '', '/search?q=Open%20BSD');
  101. window.history.pushState('', '', '/search');
  102.  
  103. // LOGO //
  104. if(window.location.pathname.indexOf('/') != -1) {
  105. $('#main-logo > .center-block.img-responsive').attr('src', 'https://searx.bar/static/themes/oscar/img/logo_searx_a.png',);
  106. }
  107.  
  108. // FAVICON //
  109. $('link[rel*="icon"]').prop('href','https://searx.bar/static/themes/oscar/img/favicon.png');
  110.  
  111. // ICONS //
  112. $('span > a[href="/"]').text('').attr('class', 'home-icon'); // Home Icon
  113. $('a[href="/about"]').text('').attr('class', 'info-icon'); // Info Icon
  114. $('a[href="/help/en/about"]').text('').attr('class', 'info-icon'); // Info Icon(2)
  115. $('a[href="/donate"]').text('').attr('class', 'dollar-icon'); // Donate Icon
  116. $('a[href="/preferences"]').text('').attr('class', 'options-icon'); // Preferences Icon
  117. $('button[aria-label="Start search"]').text('').addClass('search-icon'); // Search Icon
  118. $('button[aria-label="Clear search"]').text('').addClass('erase-icon'); // Erase Icon
  119. $('label[for="check-advanced"]').text('').addClass('more-icon'); // Advanced Icon
  120. $('.glyphicon.glyphicon-backward').text('').addClass('left-icon'); // Backward Icon
  121. $('.glyphicon.glyphicon-forward').text('').addClass('right-icon'); // Forward Icon
  122.  
  123. // CSS //
  124.  
  125. if(window.location.pathname.indexOf("/search") != -1) {
  126. (function() {
  127. let css = `
  128. button[aria-label="Start search"] {
  129. top: 0px;
  130. }
  131. .search-icon::after {
  132. top: 21px;
  133. }
  134. .search-icon::before {
  135. top: 8px;
  136. }
  137. `;
  138. if (typeof GM_addStyle !== 'undefined') {
  139. GM_addStyle(css);
  140. } else {
  141. let styleNode = document.createElement("style");
  142. styleNode.appendChild(document.createTextNode(css));
  143. (document.querySelector("head") || document.documentElement).appendChild(styleNode);
  144. }
  145. })(); }
  146.  
  147. (function() {
  148. let css = `
  149.  
  150. img {
  151. border-radius: 4px !important;
  152. }
  153.  
  154. #clear_search {
  155. height: 34px;
  156. }
  157.  
  158. .pull-right {
  159. display: flex !important;
  160. }
  161.  
  162. .searxng-navbar {
  163. background: rgb(19, 19, 19) none repeat scroll 0% 0%;
  164. padding: 7px 0px;
  165. }
  166.  
  167. #main-logo {
  168. margin-top: 16vh;
  169. }
  170.  
  171. .glyphicon-search::before, .glyphicon-remove::before, .glyphicon-cog::before, .glyphicon-link::before, .glyphicon-forward::before, .glyphicon-backward::before {
  172. content: "";
  173. }
  174.  
  175. .glyphicon-sort::before {
  176. content: "⠀";
  177. }
  178.  
  179. .btn.btn-default.input-lg.erase-icon {
  180. height: 46px;
  181. }
  182.  
  183. .btn.btn-default.input-lg.search-icon {
  184. height: 46px;
  185. top: 0px;
  186. }
  187.  
  188. #search_form .input-group-btn .btn:hover {
  189. color: rgb(36, 36, 36);
  190. }
  191.  
  192. button[aria-label="Start search"] {
  193. border-radius: 0px !important;
  194. height: 34px;
  195. top: 0px;
  196. }
  197.  
  198. .btn.btn-default.input-lg, button[aria-label] {
  199. border: 1px solid;
  200. }
  201.  
  202. .onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch {
  203. right: 73px !important;
  204. }
  205.  
  206. .search-icon::after, .search-icon::before {
  207. position: absolute;
  208. content: "";
  209. }
  210.  
  211. .search-icon::before {
  212. top: 13px;
  213. left: 2px;
  214. width: 12px;
  215. height: 12px;
  216. border: 2px solid currentColor;
  217. border-radius: 50%;
  218. }
  219.  
  220. .search-icon::after {
  221. top: 26px;
  222. left: 8px;
  223. width: 11px;
  224. height: 2.5px;
  225. border-radius: 1px;
  226. transform: rotate(53deg);
  227. box-shadow: 0px 0px 0px 0.1944em inset;
  228. }
  229.  
  230. .right-icon {
  231. box-sizing: border-box;
  232. position: relative;
  233. transform: scale(var(--ggs,1));
  234. width: 16px;
  235. height: 2px;
  236. top: -3px;
  237. left: -3px;
  238. background: currentColor;
  239. }
  240.  
  241. .right-icon::after, .right-icon::before {
  242. content: "";
  243. display: block;
  244. box-sizing: border-box;
  245. position: absolute;
  246. width: 2px;
  247. height: 12px;
  248. border-right: 2px solid;
  249. right: -5px;
  250. top: -5px;
  251. }
  252.  
  253. .right-icon::after {
  254. width: 8px;
  255. height: 8px;
  256. border-top: 2px solid;
  257. transform: rotate(45deg);
  258. top: -3px;
  259. right: 0;
  260. }
  261.  
  262. .left-icon {
  263. box-sizing: border-box;
  264. position: relative;
  265. transform: scale(var(--ggs,1));
  266. width: 16px;
  267. height: 2px;
  268. top: -3px;
  269. background: currentColor;
  270. }
  271.  
  272. .left-icon::after, .left-icon::before {
  273. content: "";
  274. display: block;
  275. box-sizing: border-box;
  276. position: absolute;
  277. width: 2px;
  278. height: 12px;
  279. border-left: 2px solid;
  280. left: -5px;
  281. top: -5px;
  282. }
  283.  
  284. .left-icon::after {
  285. width: 8px;
  286. height: 8px;
  287. border-bottom: 2px solid;
  288. transform: rotate(45deg);
  289. top: -3px;
  290. left: 0;
  291. }
  292.  
  293. .more-icon {
  294. transform: scale(var(--ggs,1));
  295. }
  296.  
  297. .more-icon, .more-icon::after, .more-icon::before {
  298. box-sizing: border-box;
  299. position: relative;
  300. display: block;
  301. width: 9px;
  302. height: 9px;
  303. background: currentColor;
  304. border-radius: 100% !important;
  305. margin-bottom: 7px;
  306. float: right;
  307. }
  308.  
  309. .more-icon {
  310. left: -20px;
  311. top: 2px;
  312. }
  313.  
  314. .more-icon::after, .more-icon::before {
  315. content: "";
  316. position: absolute;
  317. top: 0;
  318. }
  319.  
  320. .more-icon::after {
  321. left: -12px;
  322. }
  323.  
  324. .more-icon::before {
  325. right: -12px;
  326. }
  327.  
  328. .erase-icon {
  329. box-sizing: border-box;
  330. position: relative;
  331. display: inline;
  332. transform: scale(var(--ggs,1));
  333. width: 22px;
  334. height: 18px;
  335. }
  336.  
  337. .erase-icon::after, .erase-icon::before {
  338. content: "";
  339. display: block;
  340. box-sizing: border-box;
  341. position: absolute;
  342. }
  343.  
  344. .erase-icon::before {
  345. width: 6px;
  346. height: 14px;
  347. border-bottom: 4px solid transparent;
  348. border-radius: 1px;
  349. box-shadow: 0 0 0 2px, inset 0 -2px 0 0;
  350. left: 8px;
  351. top: 15px;
  352. transform: rotate(45deg);
  353. }
  354.  
  355. .options-icon {
  356. box-sizing: border-box;
  357. position: relative;
  358. display: block;
  359. transform: scale(var(--ggs,1));
  360. width: 10px;
  361. height: 2px;
  362. box-shadow: -3px 4px 0 0, 3px -4px 0 0;
  363. margin-top: 3px;
  364. }
  365.  
  366. .options-icon::after, .options-icon::before {
  367. content: "";
  368. display: block;
  369. box-sizing: border-box;
  370. position: absolute;
  371. width: 8px;
  372. height: 8px;
  373. border: 2px solid;
  374. border-radius: 100% !important;
  375. }
  376.  
  377. .options-icon::before {
  378. top: -7px;
  379. left: -4px;
  380. }
  381.  
  382. .options-icon::after {
  383. bottom: -7px;
  384. right: -4px;
  385. }
  386.  
  387. .dollar-icon {
  388. box-sizing: border-box;
  389. position: relative;
  390. display: block;
  391. transform: scale(var(--ggs,1));
  392. width: 2px;
  393. height: 20px;
  394. background: currentColor;
  395. margin-top: -5px;
  396. }
  397.  
  398. .dollar-icon::after, .dollar-icon::before {
  399. content: "";
  400. display: block;
  401. box-sizing: border-box;
  402. position: absolute;
  403. width: 10px;
  404. height: 8px;
  405. border: 2px solid;
  406. }
  407.  
  408. .dollar-icon::before {
  409. border-right: 0;
  410. border-top-left-radius: 100px;
  411. border-bottom-left-radius: 100px;
  412. top: 3px;
  413. left: -6px;
  414. box-shadow: 4px -2px 0 -2px;
  415. }
  416.  
  417. .dollar-icon::after {
  418. border-left: 0;
  419. border-top-right-radius: 100px;
  420. border-bottom-right-radius: 100px;
  421. bottom: 3px;
  422. right: -6px;
  423. box-shadow: -4px 2px 0 -2px;
  424. }
  425.  
  426. .info-icon {
  427. box-sizing: border-box;
  428. position: relative;
  429. display: block;
  430. transform: scale(var(--ggs,1));
  431. width: 20px;
  432. height: 20px;
  433. border: 2px solid;
  434. border-radius: 40px !important;
  435. margin-top: -5px;
  436. }
  437.  
  438. .info-icon::after, .info-icon::before {
  439. content: "";
  440. display: block;
  441. box-sizing: border-box;
  442. position: absolute;
  443. border-radius: 3px !important;
  444. width: 2px;
  445. background: currentColor;
  446. left: 7px;
  447. }
  448.  
  449. .info-icon::after {
  450. bottom: 2px;
  451. height: 8px;
  452. }
  453.  
  454. .info-icon::before {
  455. height: 2px;
  456. top: 2px;
  457. }
  458.  
  459. .home-icon {
  460. background: linear-gradient(to left, currentColor 5px,transparent 0) no-repeat 0 bottom/4px 2px, linear-gradient(to left, currentColor 5px,transparent 0) no-repeat right bottom/4px 2px;
  461. box-sizing: border-box;
  462. position: relative;
  463. display: block;
  464. transform: scale(var(--ggs,1));
  465. width: 18px;
  466. height: 14px;
  467. border: 2px solid;
  468. border-top: 0;
  469. border-bottom: 0;
  470. border-top-right-radius: 3px;
  471. border-top-left-radius: 3px;
  472. border-bottom-right-radius: 0;
  473. border-bottom-left-radius: 0;
  474. border-radius: 4px 4px 0px 0px !important;
  475. margin-bottom: -2px;
  476. }
  477.  
  478. .home-icon::after, .home-icon::before {
  479. content: "";
  480. display: block;
  481. box-sizing: border-box;
  482. position: absolute;
  483. }
  484.  
  485. .home-icon::before {
  486. border-top: 2px solid;
  487. border-left: 2px solid;
  488. border-top-left-radius: 4px;
  489. transform: rotate(45deg);
  490. top: -5px;
  491. border-radius: 3px !important;
  492. width: 14px;
  493. height: 14px;
  494. left: 0;
  495. }
  496.  
  497. .home-icon::after {
  498. width: 8px;
  499. height: 10px;
  500. border: 2px solid;
  501. border-radius: 100px 100px 0px 0px !important;
  502. border-bottom-left-radius: 0;
  503. border-bottom-right-radius: 0;
  504. border-bottom: 0;
  505. left: 3px;
  506. bottom: 0;
  507. }
  508.  
  509. `;
  510. if (typeof GM_addStyle !== 'undefined') {
  511. GM_addStyle(css);
  512. } else {
  513. let styleNode = document.createElement("style");
  514. styleNode.appendChild(document.createTextNode(css));
  515. (document.querySelector("head") || document.documentElement).appendChild(styleNode);
  516. }
  517. })();
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.