JS Bin Search

Add find and replace features in jsbin.com

当前为 2016-06-09 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name JS Bin Search
  3. // @version 0.2
  4. // @description Add find and replace features in jsbin.com
  5. // @author himalay
  6. // @namespace https://himalay.com.np
  7. // @include *://jsbin.com/*
  8. // @grant GM_addStyle
  9. // ==/UserScript==
  10. //
  11. // The keybindings
  12. // ===============
  13. // Ctrl-F / Cmd-F : Start searching
  14. // Ctrl-G / Cmd-G : Find next
  15. // Shift-Ctrl-G / Shift-Cmd-G : Find // previous
  16. // Shift-Ctrl-F / Cmd-Option-F : Replace
  17. // Shift-Ctrl-R / Shift-Cmd-Option-F : Replace all
  18.  
  19. (function () {
  20. ['//codemirror.net/addon/dialog/dialog.js', '//codemirror.net/addon/search/search.js'].forEach(function(scriptURL){
  21. document.body.appendChild(Object.assign(document.createElement('script'), {
  22. type: 'text/javascript',
  23. src: scriptURL
  24. }));
  25. });
  26. })();
  27.  
  28. GM_addStyle('.CodeMirror-dialog{position:absolute;left:0;right:0;background:inherit;z-index:15000;padding:.1em .8em;overflow:hidden;color:inherit}' +
  29. '.CodeMirror-dialog-top{border-bottom:1px solid #eee;top:0}' +
  30. '.CodeMirror-dialog-bottom{border-top:1px solid #eee;bottom:0}' +
  31. '.CodeMirror-dialog input{border:none;outline:0;background:0 0;width:20em;color:inherit;font-family:monospace}' +
  32. '.CodeMirror-dialog button{font-size:70%}');