Bilibili Opensearch

找回被移除的 哔哩哔哩 Opensearch

当前为 2021-01-08 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Bilibili Opensearch
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1.1
  5. // @description 找回被移除的 哔哩哔哩 Opensearch
  6. // @author Lcandy
  7. // @run-at document-start
  8. // @match *://bilibili.com/*
  9. // @match *://www.bilibili.com/*
  10. // @match *://search.bilibili.com/*
  11. // @homepageURL https://greasyfork.org/en/scripts/419875-bilibili-opensearch
  12. // @homepageURL https://github.com/Lcandy2
  13. // @grant none
  14. // ==/UserScript==
  15.  
  16. (function() {
  17. var head=document.getElementsByTagName('head')[0];
  18. var link=document.createElement('link');
  19. link.rel="search";
  20. link.type="application/opensearchdescription+xml";
  21. if (window.location.hostname.indexOf("bilibili.com") >= 0){
  22. //<link rel="search" type="application/opensearchdescription+xml" href="//static.hdslb.com/opensearch.xml" title="哔哩哔哩" />
  23. /* //static.hdslb.com/opensearch.xml backup
  24. <?xml version="1.0" encoding="UTF-8"?>
  25. <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/">
  26. <ShortName>哔哩哔哩</ShortName>
  27. <Description>哔哩哔哩 站内搜索-可以使用av号直接跳转</Description>
  28. <Image height="16" width="16" type="image/x-icon">https://www.bilibili.com/favicon.ico</Image>
  29. <Url type="text/html" method="get" template="https://www.bilibili.com/search?keyword={searchTerms}" />
  30. <Url type="application/x-suggestions+json" method="get" template="https://www.bilibili.com/suggest?mode=opensearch&amp;term={searchTerms}" />
  31. <moz:SearchForm>https://www.bilibili.com/search</moz:SearchForm>
  32. <OutputEncoding>UTF-8</OutputEncoding>
  33. <InputEncoding>UTF-8</InputEncoding>
  34. </OpenSearchDescription>
  35. */
  36. window.onload = function(){
  37. link.href="//static.hdslb.com/opensearch.xml";
  38. link.title="哔哩哔哩";
  39. head.appendChild(link);}}
  40. }())