hypothes.isFloatingButton

This is a shortcut for using hypothes.is service. It combines the hypothes.is bookmarklet to the page directly for a further convience.

目前為 2019-06-20 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name hypothes.isFloatingButton
  3. // @namespace https://greasyfork.org/users/296362
  4. // @version 1.0.2.4
  5. // @author Lancelotly.Sagirrarimeow
  6. // @description This is a shortcut for using hypothes.is service. It combines the hypothes.is bookmarklet to the page directly for a further convience.
  7. // @match *://*/*
  8. // @exclude https://hypothes.is/*
  9. // @noframes
  10. // @run-at document-idle
  11. // @grant GM_addStyle
  12. // @icon https://blogresources.lancelotly.ml/img/hypothesis-favicon.png
  13. // ==/UserScript==
  14.  
  15. /*--- Create a button in a container div. It will be styled and positioned with CSS.*/
  16. function buttonClickAction(t){!function(){window.hypothesisConfig=function(){return{showHighlights:!0}};var t=document,e=t.createElement("script");e.setAttribute("src","https://hypothes.is/embed.js"),t.body.appendChild(e)}()}function findHighestZIndex(t){for(var e=document.getElementsByTagName(t),n=0,d=0;d<e.length;d++){var i=document.defaultView.getComputedStyle(e[d],null).getPropertyValue("z-index");i>n&&"auto"!=i&&(n=i)}return n}var hNode=document.createElement("div"),z=findHighestZIndex("div");hNode.innerHTML='<div id="fButton" data-toggle="tooltip" data-placement="left" data-original-title="Create"></div>',hNode.style.zIndex=z+1,hNode.setAttribute("id","myFloatingButton"),document.body.appendChild(hNode),document.getElementById("fButton").addEventListener("click",buttonClickAction,!1);
  17.  
  18. //--- Style our newly added elements using CSS.
  19. GM_addStyle(`
  20. #myFloatingButton {
  21. width: 25px;
  22. height: 25px;
  23. border-radius: 50%;
  24. background-image: url(https://blogresources.lancelotly.ml/img/hypothesis-favicon.png);
  25. background-repeat: no-repeat;
  26. background-size: cover;
  27. position: fixed;
  28. bottom: 20px;
  29. left: 20px;
  30. box-shadow: -2px 2px 9px #202020;
  31. }
  32.  
  33. #fButton {
  34. cursor: pointer;
  35. width: 2em;
  36. height: 2em;
  37. }
  38.  
  39. #myFloatingButton p {
  40. color: white;
  41. display: block;
  42. text-align: center;
  43. margin: 0px;
  44. font-family: 'Roboto';
  45. font-size: 18px;
  46. }
  47. `);