GitHub Search Autocomplete

A userscript that adds autocomplete search filters to GitHub

当前为 2017-06-16 提交的版本,查看 最新版本

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