show link border demo🔧

for surface

当前为 2023-06-11 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name show link border demo🔧
  3. // @description for surface
  4. // @namespace show_link_border
  5. // @author Covenant
  6. // @version 1.0.1
  7. // @license MIT
  8. // @homepage
  9. // @match *://*/*
  10. // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAMAAADypuvZAAAAPFBMVEUAAACvDwOyDwKyDwOvEACyDgOyDwKvDwKwDgCyDgKxDgOyDgKvDgKyDwKyDgOxDgKzDgKxDgKxEASyDwMgW5ZmAAAAE3RSTlMAQN+/EJDvMB9wYJ9Qz7CAf6CAtGoj/AAAAcFJREFUSMeVltu2gyAMRLlfBDxt+f9/PTq2VXSwmod2GdhkEoIiiPmYinK1VqXt4MUFk9bVxlTyvxBdienhNoJwoYMY+57hdMzBTA4v4/gRaykT1FuLNI0/j/1g3i2IJ8s9F+owNCx+2UlWQXbexQFjjTjN1/lGALS9xIm9QIXNOoowlFKrFssYTtmvuOXpp2HtT6lUE3f11bH1IQu9qbYUBEr7yq8zCxkWuva8+rtF4RrkP6ESxFPoj7rtW30+jI4UQlZuiejEwZ4cMg65RKjjUDz6NdwWvxw6nnLESEAl230O5cldUAdy8P44hJZTYh40DOIKzFw3QOI6hPk9aDiFHJc3nMirKERgEPd7FKKgiy5DEn3+5JsrAfHNtfjVRLucTPTaCA1rxFVz6AX8yYsIUlXoMqbPWFUeXF1Cyqz7Ej1PAXNBs1B1tsKWKpsX0yFhslTetL4mL8s4j2fyslTbjbT7Va2V7GCG5ukhftijXdsoQhGmzSI4QhHGhVufz4QJ/v6Hug6dK0EK3YuM8/3Lx5h3Z0STywe55oxRejM5Qo4aAtZ8eTBuWp6dl3IXgfnnLpyzBCFctHomnSopejLhH/3AMfEMndTJAAAAAElFTkSuQmCC
  11. // @grant GM_setValue
  12. // @grant GM_getValue
  13. // @grant GM_registerMenuCommand
  14. // @connect
  15. // @run-at document-end
  16. // @noframes
  17. // ==/UserScript==
  18. var anchor_border_style=GM_getValue("anchor_border_style", 'dashed');
  19. var remove_anchor_width=GM_getValue("remove_anchor_width", false);
  20. function create_style(textContent,id,class_name){
  21. let style=create_node("style",class_name,true,document.body);
  22. style.type='text/css';
  23. style.id=id;
  24. style.textContent=textContent;
  25. return style;
  26. }
  27. function create_node(tagname,class_name,is_appendChild,node,refNode){
  28. let element=document.createElement(tagname);
  29. if(Array.isArray(class_name)){
  30. for(let i=0; i<class_name.length; i++){element.classList.add(class_name[i]);}
  31. }
  32. else if(typeof class_name==='string'){element.classList.add(class_name);}
  33. if(is_appendChild){node.appendChild(element);}else{node.insertBefore(element, refNode);}
  34. return element;
  35. }
  36. var style_user_css=create_style("a{border-style: "+anchor_border_style+" !important;border-color: #707070 !important; border-width: 1px !important;border-radius: 4px;padding: 2px;}\n","gm_user_css_show_link_border",["user_gm_css","css_show_link_border"]);
  37. if(remove_anchor_width)style_user_css.textContent+="a{width: auto !important;min-width: 0.1rem;}\n";
  38. (function() {
  39. 'use strict';
  40. GM_registerMenuCommand('dashed', () => {
  41. GM_setValue("anchor_border_style", 'dashed');
  42. });
  43. GM_registerMenuCommand('dotted', () => {
  44. GM_setValue("anchor_border_style", 'dotted');
  45. });
  46. GM_registerMenuCommand('double', () => {
  47. GM_setValue("anchor_border_style", 'double');
  48. });
  49. GM_registerMenuCommand('remove link width'+(remove_anchor_width?"✔️":"❌"), () => {
  50. GM_setValue("remove_anchor_width", !remove_anchor_width);
  51. });
  52. })();