UploadCC Image Viewer

Hover the broken image and click it.

  1. // ==UserScript==
  2. // @name UploadCC Image Viewer
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Hover the broken image and click it.
  6. // @author CY Fung
  7. // @match https://*/*
  8. // @icon https://upload.cc/favicon.ico
  9. // @grant GM_addStyle
  10. // @grant GM_getResourceText
  11. // @license MIT
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16.  
  17. function imgClick(){
  18. window.open(this.src,'_blank');
  19. }
  20.  
  21. function setupFix(s){
  22.  
  23. if(s.classList.contains('zmtsr-uploaddcc-img-fix')) return;
  24. s.classList.add('zmtsr-uploaddcc-img-fix');
  25. s.addEventListener('click', imgClick, false);
  26.  
  27. }
  28.  
  29. document.addEventListener('animationstart',function(evt){
  30.  
  31. if(evt.animationName==='zmtsrUploadccimgfix'){
  32. setupFix(evt.target);
  33. }/*else if(evt.animationName === 'uploadccimgfix2'){
  34. }*/
  35.  
  36. },true);
  37.  
  38. GM_addStyle(`
  39.  
  40. @keyframes zmtsrUploadccimgfix {
  41. 0%{
  42. background-position-x: 1px;
  43. }
  44. 100%{
  45. background-position-x:2px;
  46. }
  47. }
  48. @keyframes zmtsrUploadccimgfix2 {
  49. 0%{
  50. background-position-x: 3px;
  51. }
  52. 100%{
  53. background-position-x:4px;
  54. }
  55. }
  56. img[src^="https://upload.cc/"]{
  57. cursor:pointer;
  58. animation: zmtsrUploadccimgfix 1ms;
  59. }
  60. a[href] img[src^="https://upload.cc/"]{
  61. animation: initial;
  62. }
  63. img[src^="https://upload.cc/"]:hover{
  64. animation: zmtsrUploadccimgfix2 1ms;
  65. }
  66. a[href] img[src^="https://upload.cc/"]:hover{
  67. animation: initial;
  68. }
  69.  
  70.  
  71. `);
  72. const my_css = GM_getResourceText("IMPORTED_CSS");
  73. GM_addStyle(my_css);
  74.  
  75. })();