Instagram Image Viewer

View the full image with the click of a button (or D key press).

当前为 2019-02-19 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Instagram Image Viewer
  3. // @namespace https://github.com/kittenparry/
  4. // @version 0.1
  5. // @description View the full image with the click of a button (or D key press).
  6. // @author kittenparry
  7. // @match https://www.instagram.com/p/*
  8. // @grant none
  9. // @license MIT License
  10. // ==/UserScript==
  11.  
  12. window.addEventListener('keydown', (e) => {
  13. var type = e.target.getAttribute('type');
  14. var tag = e.target.tagName.toLowerCase();
  15. if(type != 'text' && tag != 'textarea'){
  16. switch(e.keyCode){
  17. case 68:
  18. window.location = document.querySelector('meta[property="og:image"]').getAttribute('content');
  19. break;
  20. default:
  21. }
  22. }
  23. }, false);
  24.  
  25. document.body.innerHTML += '<a href="' + document.querySelector("meta[property='og:image']").getAttribute('content') + '" style="color: #7f8a94;"><div style="position: fixed; bottom: 50%; right: 0px; border-radius: 15px 0px 0px 15px; background: #faf0e6; padding: 13px; border: 2px solid #7f8a94; border-right-style: none;"><i style="border: solid black; border-width: 0 3px 3px 0; display: inline-block; padding: 3px; transform: rotate(45deg); -webkit-transform: rotate(45deg);"></i></div></a>';