hover for link

try to take over the world!

  1. // ==UserScript==
  2. // @name hover for link
  3. // @namespace https://github.com/Khdoop
  4. // @version 0.5
  5. // @description try to take over the world!
  6. // @author Khdoop
  7. // @match *://*/*
  8. // @grant none
  9. // @require https://code.jquery.com/jquery-3.1.1.min.js
  10. // ==/UserScript==
  11.  
  12.  
  13. var body = $(document.body);
  14. console.log('1111111', body);
  15. var anchors = body.find('a');
  16. var box = $('<div class="link-tooltip"></div>').appendTo(body);
  17.  
  18. box.css({
  19. display: 'block',
  20. position: 'absolute',
  21. right: 0,
  22. padding: '5px',
  23. 'font-size': '18px',
  24. background: 'white',
  25. border: '1px solid black',
  26. opacity: 0.9,
  27. 'word-break': 'break-all',
  28. 'z-index': 99999
  29. });
  30.  
  31. anchors.on('mouseover', function() {
  32. box.css({display: 'block', bottom: body.scrollTop() * -1}).text($(this)[0].href);
  33. }).on('mouseleave', function() {
  34. box.css({display: 'none'});
  35. });