Google Keep Colour Bar

Add custom pens and markers to Google Keep's drawing toolbar

  1. // ==UserScript==
  2. // @name Google Keep Colour Bar
  3. // @version 0.1
  4. // @description Add custom pens and markers to Google Keep's drawing toolbar
  5. // @author yallinthehall
  6. // @match https://keep.google.com/
  7. // @grant none
  8. // @namespace https://gf.qytechs.cn/users/312448
  9. // ==/UserScript==
  10.  
  11. window.addEventListener('load', function() {
  12. 'use strict';
  13.  
  14. const markerPlace = document.querySelector("#canvas-parent > div.above-ink-canvas > div > div > div.ink-toolbar-begin > div:nth-child(5)");
  15. const resetBlackPen = document.querySelector("#canvas-parent > div.below-ink-canvas > div:nth-child(1) > div.ink-color-rows-container > div:nth-child(1) > button:nth-child(1)");
  16. const resetBrownPen = document.querySelector("#canvas-parent > div.below-ink-canvas > div:nth-child(1) > div.ink-color-rows-container > div:nth-child(1) > button:nth-child(7)");
  17.  
  18. const highlighterPlace = document.querySelector("#canvas-parent > div.above-ink-canvas > div > div > div.ink-toolbar-begin > div:nth-child(6)")
  19. const resetBlackMarker = document.querySelector("#canvas-parent > div.below-ink-canvas > div:nth-child(2) > div.ink-color-rows-container > div:nth-child(1) > button:nth-child(1)");
  20. const resetBrownMarker = document.querySelector("#canvas-parent > div.below-ink-canvas > div:nth-child(2) > div.ink-color-rows-container > div:nth-child(1) > button:nth-child(7)");
  21.  
  22. Element.prototype.appendBefore = function(element) {
  23. element.parentNode.insertBefore(this, element);
  24. }, false;
  25.  
  26. var allPens = [];
  27. var allMarkers = [];
  28. allPens.push("#000000"); //BLACK
  29. allPens.push("#000F55"); //BLUE INK
  30. allPens.push("#d500f9"); //PURPLE
  31. allPens.push("#00c853"); //GREEN
  32. allPens.push("#ff0000"); //RED
  33.  
  34. allMarkers.push("#000000"); //BLACK
  35. allMarkers.push("#ffbc00"); //PURPLE
  36. allMarkers.push("#00c853"); //GREEN
  37. allMarkers.push("#ff0000"); //RED
  38.  
  39. var newPen;
  40. for (const colour of allPens){
  41. newPen = document.createElement("button");
  42. newPen.setAttribute("class", "ink-color");
  43. newPen.setAttribute("tabindex", "0");
  44. newPen.setAttribute("style", "background:" + colour +";");
  45. newPen.addEventListener("click", function() {
  46. resetBlackPen.click();
  47. resetBrownPen.setAttribute("color-data", colour);
  48. resetBrownPen.click();
  49. });
  50. newPen.appendBefore(markerPlace);
  51. }
  52.  
  53. for (const colour of allMarkers){
  54. newPen = document.createElement("button");
  55. newPen.setAttribute("class", "ink-color");
  56. newPen.setAttribute("tabindex", "0");
  57. newPen.setAttribute("style", "background:" + colour +";");
  58. newPen.addEventListener("click", function() {
  59. resetBlackMarker.click();
  60. resetBrownMarker.setAttribute("color-data", colour);
  61. resetBrownMarker.click();
  62. });
  63. newPen.appendBefore(highlighterPlace);
  64. }
  65. },false);

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址