Greasy Fork 支持简体中文。

Convert HTML select to Select2

It's often hard to select data from combobox where it has huge data. This script will make easy to use comboxbox(select tag)

  1. // ==UserScript==
  2. // @name Convert HTML select to Select2
  3. // @namespace HTML Combobox to Select2
  4. // @description It's often hard to select data from combobox where it has huge data. This script will make easy to use comboxbox(select tag)
  5. // @include *
  6. // @version 1
  7. // @grant none
  8. // @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js
  9. // @require https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.full.js
  10. // ==/UserScript==
  11.  
  12. $(function()
  13. {
  14. $("body").append('<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.css" integrity="sha256-xqxV4FDj5tslOz6MV13pdnXgf63lJwViadn//ciKmIs=" crossorigin="anonymous" />');
  15. setTimeout(function()
  16. {
  17. $("select").each(function()
  18. {
  19. $(this).select2();
  20. });
  21. },1000);
  22. });