GitHub Search Autocomplete

A userscript that adds autocomplete search filters to GitHub

  1. // ==UserScript==
  2. // @name GitHub Search Autocomplete
  3. // @version 1.0.2
  4. // @description A userscript that adds autocomplete search filters to GitHub
  5. // @license MIT
  6. // @author Rob Garrison
  7. // @namespace https://github.com/Mottie
  8. // @match https://github.com/*
  9. // @match https://gist.github.com/*
  10. // @run-at document-idle
  11. // @grant GM_addStyle
  12. // @require https://code.jquery.com/jquery-3.2.1.min.js
  13. // @require https://cdnjs.cloudflare.com/ajax/libs/Caret.js/0.3.1/jquery.caret.min.js
  14. // @require https://cdnjs.cloudflare.com/ajax/libs/at.js/1.5.4/js/jquery.atwho.min.js
  15. // @icon https://github.githubassets.com/pinned-octocat.svg
  16. // @supportURL https://github.com/Mottie/GitHub-userscripts/issues
  17. // ==/UserScript==
  18.  
  19. (($) => {
  20. "use strict";
  21.  
  22. const data = {},
  23.  
  24. // search input classes used by GitHub
  25. selectors = [
  26. ".header-search-input", // main header search
  27. "[aria-label*='Search']", // https://github.com/search
  28. ".search-page-input", // https://github.com/search/advanced
  29. "#js-issues-search", // https://github.com/:user/:repo/issues & pulls
  30. ".js-search-query" // https://gist.github.com/search?q=css
  31. ].join(","),
  32.  
  33. // update examples using current & previous year
  34. year = new Date().getFullYear(),
  35. /**
  36. * This data was manually extracted from the pages listed on
  37. * https://help.github.com/categories/search/
  38. */
  39. filters = {
  40. "AND": {
  41. "": "search operator (max 5 of any operator)"
  42. },
  43. // Issue
  44. "assignee": {
  45. "": "search for issues assigned to the named user",
  46. "fred": 'search for issues assigned to "@fred"'
  47. },
  48. // Commits & Issues
  49. "author": {
  50. "": "search for issues or commits authored by the username",
  51. "fred": 'search for issues or commits authored by "@fred"'
  52. },
  53. "author-date": {
  54. "": "search commits authored before or after a date",
  55. ">${year-1}-12-31": "search commits authored since ${year}",
  56. ">=${year}-01-01": "search commits authored since ${year}",
  57. "<${year}-01-01": "search commits authored before ${year}",
  58. "<=${year-1}-12-31": "search commits authored before ${year}"
  59. },
  60. "author-email": {
  61. "": "search for a commit authored by the specified user email",
  62. "fred@gmail.com": "search for commits authored by gmail fred"
  63. },
  64. "author-name": {
  65. "": "search for a commit created using the author's actual name",
  66. "smith": 'search for commits authored by someone named "smith"'
  67. },
  68. // Issues
  69. "base": {
  70. "": "search pull requests to be merged into the specified branch name",
  71. "gh-pages": 'search pull requests being merged into the "gh-pages" branch'
  72. },
  73. // Issues
  74. "closed": {
  75. "": "search issues & pull requests closed before or after a date",
  76. ">${year-1}-12-31": "search issues & pull requests closed since ${year}",
  77. ">=${year}-01-01": "search issues & pull requests closed since ${year}",
  78. "<${year}-01-01": "search issues & pull requests closed before ${year}",
  79. "<=${year-1}-12-31": "search issues & pull requests closed before ${year}"
  80. },
  81. "commenter": {
  82. "": "search for comments authored by the named user",
  83. "fred": 'search for comments authored by "@fred"'
  84. },
  85. "comments": {
  86. "": "search issues with specified number of comments",
  87. "100": "search issues with exactly 100 comments",
  88. ">100": "search issues with >100 comments",
  89. ">=100": "search issues with >=100 comments",
  90. "10..20": "search issues with 10-20 comments",
  91. "<100": "search issues with <100 comments",
  92. "<=100": "search issues with <=100 comments"
  93. },
  94. "committer": {
  95. "": "search for commits authored by the named user",
  96. "fred": 'search for commits authored by "@fred"'
  97. },
  98. "committer-date": {
  99. "": "search commits authored before or after a date",
  100. ">${year-1}-12-31": "search commits authored since ${year}",
  101. ">=${year}-01-01": "search commits authored since ${year}",
  102. "<${year}-01-01": "search commits authored before ${year}",
  103. "<=${year-1}-12-31": "search commits authored before ${year}"
  104. },
  105. "committer-email": {
  106. "": "search for a commit authored by the specified user email",
  107. "fred@gmail.com": "search for commits authored by gmail fred"
  108. },
  109. "committer-name": {
  110. "": "search for a commit created using the author's actual name",
  111. "smith": 'search for commits authored by someone named "smith"'
  112. },
  113. // Issues & user
  114. "created": {
  115. "": "search issues & user accounts created at the specified date",
  116. ">${year-1}-12-31": "search issues & user accounts created since ${year}",
  117. ">=${year}-01-01": "search issues & user accounts created since ${year}",
  118. "${year}-01-01..*": "search issues & user accounts created since ${year}",
  119. "${year}-01-01..${year}-01-31": "search commits authored in Jan ${year}",
  120. "<${year}-01-01": "search issues & user accounts created before ${year}",
  121. "<=${year-1}-12-31": "search issues & user accounts created before ${year}",
  122. "*..${year-1}-12-31": "search issues & user accounts created before ${year}"
  123. },
  124. // Code
  125. "extension": {
  126. "": "search within file extensions",
  127. "js": "search within JavaScript files",
  128. "rb": "search within Ruby files",
  129. "css": "search within CSS files",
  130. "coffee": "search within CoffeeScript files",
  131. "md": "search within markdown files"
  132. },
  133. "-extension": {
  134. "": "search excludes this file extension",
  135. "js": "search excludes JavaScript files",
  136. "rb": "search excludes Ruby files",
  137. "css": "search excludes CSS files",
  138. "coffee": "search excludes CoffeeScript files",
  139. "md": "search excludes markdown files"
  140. },
  141. // Code
  142. "filename": {
  143. "": "search within code files named as specified",
  144. "test_helper": 'search within the "test_helper" code file(s)',
  145. ".vimrc": 'search "*.vimfc*" code files named as specified'
  146. },
  147. // User
  148. "followers": {
  149. "": "search users & organizations with the specified number of followers",
  150. "100": "search users with exactly 100 followers",
  151. ">100": "search users with >100 followers",
  152. ">=100": "search users with >=100 followers",
  153. "10..20": "search users with 10-20 followers",
  154. "<100": "search users with <100 followers",
  155. "<=100": "search users with <=100 followers"
  156. },
  157. // Code... includes "-fork"?
  158. "fork": {
  159. "": "searches exclude forks when this filter is undefined",
  160. "only": "search only within forked repos",
  161. "true": "search includes forked repos"
  162. },
  163. // Repos, Code
  164. "forks": {
  165. "": "search repos with greater, less, or a range of forks",
  166. "100": "search repos with exactly 100 forks",
  167. ">100": "search repos with >100 forks",
  168. ">=100": "search repos with >=100 forks",
  169. "10..20": "search repos with 10-20 forks",
  170. "<100": "search repos with <100 forks",
  171. "<=100": "search repos with <=100 forks"
  172. },
  173. "-forks": {
  174. "": "search repos outside of the selected number of forks",
  175. "100": "search repos with that do not have exactly 100 forks",
  176. ">100": "search repos with <=100 forks",
  177. ">=100": "search repos with <100 forks",
  178. "10..20": "search repos with <10 or >20 forks",
  179. "<100": "search repos with >=100 forks",
  180. "<=100": "search repos with >100 forks"
  181. },
  182. "fullname": {
  183. "": "search within a user's full name",
  184. "linus": 'search for users with "linus" in their full name',
  185. '"Linus Torvalds"': "search for a full name wrapped in quotes"
  186. },
  187. // Commits
  188. "hash": {
  189. "": "search commits with the specified SHA-1 hash",
  190. "124a9a0ee1d8f1e15e833aff432fbb3b02632105": "search matching hash"
  191. },
  192. // Issues
  193. "head": {
  194. "": "search pull requests opened from the specified branch name",
  195. "fix": 'search pull requests opened from branch names containing the word "fix"'
  196. },
  197. // Repos, Issue, User
  198. "in": {
  199. "": "search within repo, issue or user meta data",
  200. // Repo
  201. "body": "search within an issue or wiki body",
  202. "description": "search within the repo description",
  203. "file": "search within the repo file contents",
  204. "file,path": "search within the repo file contents & path name",
  205. "name": "searh within a user, organization or repo name",
  206. "name,description" : "search within the repo name or description",
  207. "path": "search within the repo path name",
  208. "readme": "search within the repo readme",
  209. // Issue & Wiki
  210. "comments": "search within an issue comments",
  211. "title": "search within an issue or wiki title",
  212. "title,body": "search within an issue or wiki title & body",
  213. // User
  214. "email": "search within a user or organization email (not the domain name)",
  215. "login": "search within a user or organization username",
  216. "fullname": "search within a user's full name"
  217. },
  218. "involves": {
  219. "": "search for issues or commits that involves the named user",
  220. "fred": 'search for issues or commits that involve "@fred"'
  221. },
  222. // Commits
  223. "is": {
  224. "": "search commits and issues of the specified state (multiple allowed)",
  225. "public": "search public commits & issues",
  226. "private": "search private commits & issues",
  227. "open": "search open issues & pull requests",
  228. "closed": "search closed issues & pull requests",
  229. "issue": "search within issues",
  230. "pr": "search within pull requests",
  231. "merged": "search merged pull requests",
  232. "unmerged": "search unmerged pull requests"
  233. },
  234. // Issue
  235. "label": {
  236. "": "search issues & pull requests with the specified label (multiple allowed)",
  237. "bug": 'search for issues & pull requests labeled "bug"',
  238. '"in progress"': "search for multiword labels inside quotes"
  239. },
  240. "-label": {
  241. "": "search issues & pull requests without the specified label",
  242. "bug": 'search for issues & pull requests not labeled "bug"'
  243. },
  244. // Code, Issue, Repos, User
  245. "language": {
  246. "": "search within this language",
  247. "javascript": "search within repos containing JavaScript",
  248. "php": "search within repos containing PHP",
  249. "scss": "search within repos containing SCSS",
  250. "c#": "search within repos containing C#",
  251. "markdown": "search within repos containing markdown (.md, .markdown, etc)",
  252. },
  253. "-language": {
  254. "": "search excludes this language",
  255. "javascript": "search excludes repos with JavaScript",
  256. "php": "search excludes repos with PHP",
  257. "scss": "search excludes repos with SCSS",
  258. "xml": "search excludes repos with XML",
  259. "markdown": "search excludes repos with markdown (.md, .markdown, etc)",
  260. },
  261. "location": {
  262. "": "search users within a location",
  263. '"San Francisco, CA"': "search users in San Francisco",
  264. "london": "search users in london",
  265. "iceland": "search users in Iceland"
  266. },
  267. "-location": {
  268. "": "search users not in a specific location",
  269. '"San Francisco, CA"': "search users not in San Francisco",
  270. "london": "search users not in london",
  271. "iceland": "search users not in Iceland"
  272. },
  273. // Issues
  274. "mentions": {
  275. "": "search for issues mentioning the named user",
  276. "fred": 'search for issues that mention "@fred"'
  277. },
  278. // Commits
  279. "merge": {
  280. "true": "searches that match merge commits",
  281. "false": "searches that match non-merge commits"
  282. },
  283. "merged": {
  284. "": "search pull requests merged at the specified date",
  285. ">${year-1}-12-31": "search pull requests merged since ${year}",
  286. ">=${year}-01-01": "search pull requests merged since ${year}",
  287. "<${year}-01-01": "search pull requests merged before ${year}",
  288. "<=${year-1}-12-31": "search pull requests merged before ${year}"
  289. },
  290. "milestone": {
  291. "": "search for issues & pull requests within the specified milestone",
  292. "sprint-42": 'search for issues & pull requests in the "sprint-42" milestone'
  293. },
  294. "no": {
  295. "": "search issues & pull requests missing the specified association",
  296. "label": "search issues & pull requests that don't have a label",
  297. "assignee": "search issues & pull requests that don't have an assignee",
  298. "milestone": "search issues & pull requests that don't have a milestone",
  299. "project": "search issues & pull requests that don't have a project"
  300. },
  301. "NOT": {
  302. "": "search operator (max 5 of any operator)"
  303. },
  304. "OR": {
  305. "": "search operator (max 5 of any operator)"
  306. },
  307. "org": {
  308. "": "search within the named organization",
  309. "github": "search GitHub's repositories"
  310. },
  311. // Commits
  312. "parent": {
  313. "": "search children of specified SHA-1 hash",
  314. "124a9a0ee1d8f1e15e833aff432fbb3b02632105": "search children of hash"
  315. },
  316. "path": {
  317. "": "search code within the specific file path (directory)",
  318. "cgi-bin": 'search code within the "cgi-bin" folder',
  319. "test/spec": "search code within sub-folders"
  320. },
  321. "project": {
  322. "": "search issues within a specified repository project board",
  323. "github/linguist/1": "search issues in GitHub's linguist repo project board 1"
  324. },
  325. // Repos
  326. "pushed": {
  327. "": "search repo pushes before or after a date (no range)",
  328. ">${year}-01-15": "search repos pushed to after Jan 15, ${year}",
  329. ">=${year}-01-15": "search repos pushed to since Jan 15, ${year}",
  330. "<${year}-02-01": "pushed to before Feb ${year}",
  331. "<=${year}-02-01": "pushed to before and including Feb 1, ${year}"
  332. },
  333. "-pushed": {
  334. "": "search pushes opposite of selected dates (no range)",
  335. ">${year}-01-15": "search repos pushed to after Jan 15, ${year}",
  336. ">=${year}-01-15": "search repos pushed to since Jan 15, ${year}",
  337. "<${year}-02-01": "pushed to before Feb ${year}",
  338. "<=${year}-02-01": "pushed to before and including Feb 1, ${year}"
  339. },
  340. // Commits
  341. "repo": {
  342. "": "search within the specified user's repository",
  343. "torvalds/linux": "search commits within Linus' Linux repository"
  344. },
  345. "repos": {
  346. "": "search user or organization with specified number of repos",
  347. "100": "search user or org with exactly 100 repos",
  348. ">100": "search user or org with >100 repos",
  349. ">=100": "search user or org with >=100 repos",
  350. "10..20": "search user or org with 10-20 repos",
  351. "<100": "search user or org with <100 repos",
  352. "<=100": "search user or org with <=100 repos"
  353. },
  354. "review": {
  355. "": "search pull requests with the specified review state",
  356. "none": "search pull requests that have not been reviewed",
  357. "required": "search pull requests that require a review before merge",
  358. "approved": "search pull requests that have been approved",
  359. "changes_requested": "search pull requests where a reviewer requested changes"
  360. },
  361. "review-requested": {
  362. "": "search pull requests with a requested reviewer, but only before they review the PR",
  363. "fred": 'search pull requests where "@fred" was asked to review'
  364. },
  365. "reviewed-by": {
  366. "": "search pull requests that have been reviewed by the specified user",
  367. "fred": 'search pull requests reviewed by "@fred"'
  368. },
  369. // Repos, Code - include "-size"?
  370. "size": {
  371. "": "search repos or files with a specific size (in KB)",
  372. "1000": "search repos or files that are exactly 1 MB in size",
  373. ">10000": "search repos or files that are more than 10 MB in size",
  374. ">=10000": "search repos or files that are at least 10 MB in size",
  375. "1024..4096": "search repos or files between 1024 and 4096 KB in size",
  376. "<1000": "search repos or files less than 1 MB in size",
  377. "<=100": "search repos or files that are less than or equal to 100 KB in size"
  378. },
  379. "sort": {
  380. "": 'apply an ascending or descending sort to the specified filter; add "-asc" or "-desc"',
  381. "author-date-asc": "sort oldest authored date first",
  382. "author-date-desc": "sort newest authored date first",
  383. "comments-asc": "sort least comments fist",
  384. "comments-desc": "sort most comments first",
  385. "committer-date-asc": "sort oldest committer date first",
  386. "committer-date-desc": "sort newest committer date first",
  387. "created-asc": "sort oldest item first",
  388. "created-desc": "sort newest item first",
  389. "forks-asc": "sort least forks first",
  390. "forks-desc": "sort most forks first",
  391. "reactions-+1-asc": "sort least +1 reactions first",
  392. "reactions-+1-desc": "sort most +1 reactions first",
  393. "reactions--1-asc": "sort least -1 reactions first",
  394. "reactions--1-desc": "sort most -1 reactions first",
  395. "reactions-heart-asc": "sort least heart reactions first",
  396. "reactions-heart-desc": "sort most heart reactions first",
  397. "reactions-smile-asc": "sort least smile reactions first",
  398. "reactions-smile-desc": "sort most smile reactions first",
  399. "reactions-tada-asc": "sort least tada reactions first",
  400. "reactions-tada-desc": "sort most tada reactions first",
  401. "reactions-thinking_face-asc": "sort least thinking face reactions first",
  402. "reactions-thinking_face-desc": "sort most thinking face reactions first",
  403. "stars-asc": "sort least stars first",
  404. "stars-desc": "sort most stars first",
  405. "updated-asc": "sort least recently updated first",
  406. "updated-desc": "sort recently updated first"
  407. },
  408. "stars": {
  409. "": "search repos with greater, less, or a range of stars",
  410. "100": "search repos with exactly 100 stars",
  411. ">100": "search repos with >100 stars",
  412. ">=100": "search repos with >=100 stars",
  413. "10..20": "search repos with 10-20 stars",
  414. "<100": "search repos with <100 stars",
  415. "<=100": "search repos with <=100 stars"
  416. },
  417. "-stars": {
  418. "": "search repos outside of the selected number of stars",
  419. "100": "search repos with that do not have exactly 100 stars",
  420. ">100": "search repos with <=100 stars",
  421. ">=100": "search repos with <100 stars",
  422. "10..20": "search repos with <10 or >20 stars",
  423. "<100": "search repos with >=100 stars",
  424. "<=100": "search repos with >100 stars"
  425. },
  426. "state": {
  427. "closed": "search closed issues",
  428. "open": "search open issues"
  429. },
  430. "status": {
  431. "": "search pull requests with the specified status",
  432. "success": "search pull requests with a successful status",
  433. "pending": "search pull requests with a pending status",
  434. "failed": "search pull requests with a failed status"
  435. },
  436. "team": {
  437. "": "search issues or pull requests mentioning an organization team",
  438. "jekyll/owners": 'search issues or pull requests for team "@jekyll/owners"',
  439. "myorg/ops": 'search issues or pull requests for team "@myorg/ops"'
  440. },
  441. "topic": {
  442. "": "search repos with the specified topic",
  443. "jekyll": 'search for repos classified with a "jekyll" topic'
  444. },
  445. "topics": {
  446. "": "search repos with greater, less, or a range of topics",
  447. "3": "search repos with exactly 3 topics",
  448. ">3": "search repos with more than three topics",
  449. ">=3": "search repos with three or more topics",
  450. "<3": "search repos with less than 3 topics",
  451. "<=2": "search repos with zero to two topics"
  452. },
  453. // Commits
  454. "tree": {
  455. "": "searches commits referring to the specified tree hash",
  456. "99ca967": "search commits of tree hash"
  457. },
  458. "type": {
  459. "": "search for a user, organization, issue or pull request",
  460. "issue": "only search issues",
  461. "pr": "only search pull requests",
  462. "org": "only search organizations",
  463. "user": "only search personal accounts"
  464. },
  465. // Wiki
  466. "updated": {
  467. "": "search issue & wiki updates before or after a date (no range)",
  468. ">${year}-01-31": "search repos pushed to after Jan 31, ${year}",
  469. ">=${year}-01-31": "search repos pushed to since Jan 31, ${year}",
  470. "<${year}-02-01": "pushed to before Feb ${year}",
  471. "<=${year}-02-01": "pushed to before and including Feb 1, ${year}"
  472. },
  473. // User
  474. "user": {
  475. "": "search for a specific user or organization",
  476. "github": "search in github organization repos"
  477. },
  478. "-user": {
  479. "": "search excludes a specific user or organization",
  480. "github": "search does not include github organization repos"
  481. }
  482. },
  483. // array containing items that should not include a trailing colon
  484. noTrailingColon = [
  485. "AND",
  486. "OR",
  487. "NOT"
  488. ],
  489. list = Object.keys(filters);
  490.  
  491. function updateYear(string) {
  492. return string.replace(/(\$\{year(-1)?\})/g, function(str) {
  493. return {
  494. "${year}": year,
  495. "${year-1}": year - 1
  496. }[str];
  497. });
  498. }
  499.  
  500. // copied from atwho.js DEFAULT_CALLBACKS.highlighter
  501. // https://github.com/ichord/At.js/blob/master/dist/js/jquery.atwho.js#L105
  502. // to add a class to the <strong> html
  503. function highlighter(li, query) {
  504. if (!query) {
  505. return li;
  506. }
  507. const regexp = new RegExp(
  508. ">\\s*([^\<]*?)(" + query.replace("+", "\\+") + ")([^\<]*)\\s*<", "ig"
  509. );
  510. return li.replace(regexp, function(str, $1, $2, $3) {
  511. return `>${$1}<strong class="text-emphasized">${$2}</strong>${$3} <`;
  512. });
  513. }
  514.  
  515. function escapeHTML(string) {
  516. return updateYear(string).replace(/[<>"&]/g, function(str) {
  517. return {
  518. "<" : "&lt;",
  519. ">" : "&gt;",
  520. '"' : "&quot;",
  521. "&" : "&amp;"
  522. }[str];
  523. });
  524. }
  525.  
  526. function addAtJs() {
  527. const $selectors = $(selectors);
  528.  
  529. // add "?" to open list of filters
  530. $selectors.atwho({
  531. at: "?",
  532. data: list,
  533. insertTpl: "${name}",
  534. // show everything in dropdown
  535. limit: list.length,
  536. suffix: "",
  537. callbacks: {
  538. highlighter: highlighter,
  539. beforeInsert: function(value) {
  540. // add colon suffix, as needed
  541. return value + (noTrailingColon.includes(value) ? " " : ":");
  542. }
  543. },
  544. });
  545.  
  546. // Add specific filter examples
  547. list.forEach(label => {
  548. $selectors.atwho({
  549. at: label + (noTrailingColon.includes(label) ? " " : ":"),
  550. data: data[label],
  551. limit: 20,
  552. startWithSpace: false,
  553. callbacks: {
  554. highlighter: highlighter,
  555. tplEval: function(tpl, map) {
  556. // look for default displayTpl = "<li>${name}</li>"
  557. if (tpl.indexOf("<li>") > -1) {
  558. // menu template; text-emphasized needed for GitHub-Dark userstyle
  559. return `
  560. <li class="navigation-item">
  561. <strong class="ghsa-key text-emphasized">
  562. ${escapeHTML(map.name)}
  563. </strong>
  564. <small>${escapeHTML(map.description)}</small>
  565. </li>`;
  566. }
  567. // insert text template
  568. return `${map["atwho-at"]}${updateYear(map.name)}`;
  569. },
  570. sorter: function(query, items) {
  571. // reset suffix setting
  572. this.setting.suffix = " ";
  573. return items;
  574. },
  575. beforeInsert: function(value) {
  576. // don't add a space if the user chooses an empty string value
  577. // meaning the filter ends with a colon, e.g. "in:"
  578. this.setting.suffix = value.slice(-1) === ":" ? "" : " ";
  579. return value;
  580. }
  581. }
  582. });
  583. });
  584. // use classes from GitHub-Dark to make theme match GitHub-Dark
  585. document.querySelectorAll(".atwho-view").forEach(el => {
  586. el.classList.add(...["jump-to-suggestions-results-container", "Box"]);
  587. });
  588. }
  589.  
  590. // prevent reinitializing if user clicks in the input multiple times
  591. function init() {
  592. // build data for At.js
  593. let array;
  594. list.forEach(label => {
  595. array = [];
  596. Object.keys(filters[label]).forEach(key => {
  597. array.push({
  598. "name": key,
  599. "description": filters[label][key]
  600. });
  601. });
  602. // sort empty string to top
  603. data[label] = array.sort((a, b) => {
  604. if (a.name === "") {
  605. return -1;
  606. }
  607. return a.name > b.name ? 1 : -1;
  608. });
  609. });
  610.  
  611. document.querySelector("body").addEventListener("click", event => {
  612. const target = event.target;
  613. if (
  614. target.nodeName === "INPUT" &&
  615. target.matches(selectors)
  616. ) {
  617. $(selectors).atwho("destroy");
  618. addAtJs();
  619. }
  620. });
  621. // remove At.js before the page refreshes
  622. document.querySelector("body").addEventListener("pjax:start", event => {
  623. const target = event.target;
  624. if (target.nodeName === "INPUT" && target.matches(selectors)) {
  625. $(selectors).atwho("destroy");
  626. }
  627. });
  628. }
  629.  
  630. GM_addStyle(`
  631. .atwho-view { position:absolute; top:0; left:0; display:none;
  632. margin-top:18px; border:1px solid #ddd; border-radius:3px;
  633. box-shadow:0 0 5px rgba(0,0,0,0.1); max-height:225px; min-width:300px;
  634. max-width:none !important; overflow: auto; z-index: 11110 !important; }
  635. .atwho-view .cur { background:#36F; color:#fff; }
  636. .atwho-view .cur small { color:#fff; }
  637. .atwho-view strong { color:#36F; }
  638. .atwho-view .cur strong { color:#fff; font:bold; }
  639. .atwho-view ul { list-style:none; padding:0; margin:auto; max-height: 200px;
  640. overflow-y:auto; }
  641. .atwho-view ul li { display:block; padding:5px 10px;
  642. border-bottom: 1px solid #ddd; cursor:pointer; text-align:right; }
  643. .atwho-view small { font-size:smaller; color:#777; font-weight:normal; }
  644. .atwho-view .ghsa-key { font-style:normal; float:left; margin-right:10px; }`
  645. );
  646.  
  647. init();
  648.  
  649. })(jQuery.noConflict(true));

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址