exh which is gif?

Highlights .gif files in gallery view by adding a glow around the thumbnail. Customizable settings are shown in the right sidebar, under the petition rename/expunge links.

  1. // ==UserScript==
  2. // @name exh which is gif?
  3. // @namespace https://sleazyfork.org/en/scripts/436971
  4. // @version 0.31
  5. // @description Highlights .gif files in gallery view by adding a glow around the thumbnail. Customizable settings are shown in the right sidebar, under the petition rename/expunge links.
  6. // @author coombrain
  7. // @match https://exhentai.org/g/*
  8. // @match https://e-hentai.org/g/*
  9. // @icon none
  10. // @grant GM.setValue
  11. // @grant GM.getValue
  12. // @require http://code.jquery.com/jquery-latest.min.js
  13. // @license MIT
  14. // ==/UserScript==
  15. var $ = window.jQuery;
  16.  
  17. var defc = GM.getValue("wigColor", "#00ffff").then(function(wigColor) { defc = wigColor; });
  18. var defs = GM.getValue("wigSize", 8).then(function(wigSize) { defs = wigSize; });
  19. var defw = GM.getValue("webpChk", true).then(function(webpChk) {defw = webpChk});
  20.  
  21. (function() {
  22. 'use strict';
  23.  
  24. $(document).ready(function () {
  25. $("#gd5").append(`<div class="wigcn"><a class="g2 wigst" href="#" style="font-weight:bold;">Which is GIF? ⚙️</a></div>`);
  26. $(".wigcn").append(`<div class="wigcns"><div class="tha nosel wigsto"><input type="color" name="which is gif? glow color" id="cpick" value="${defc}" style="border:none;padding:0;margin:0;height:24px;"></div>`);
  27. $(".wigcn").append(`<div class="tha nosel wigsto"><input type="number" name="which is gif? glow size" id="wigsz" min="0" value="${defs}" style="border:none;padding:0 0 0 5px;margin:none;max-width:50px;height:24px;"></div>`);
  28. $(".wigcn").append(`<div class="thtgl nosel wigsto"><label><input type="checkbox" name="which is gif? webp toggle" id="wbpc">Highlight .webp</label></div></div>`);
  29. $("#wbpc").prop('checked', defw);
  30.  
  31. $("#cpick, #wigsz, #wbpc").on("change", wigupd);
  32.  
  33. //-----------------
  34. // Uncomment the line below to hide the setting sidebar once you've set your desired glow color/size. Comment it out again to have it appear again.
  35. // $(".wigcn").css({"display":"none"});
  36. //-----------------
  37.  
  38. $(".wigsto").css({"display":"none","margin":"0 auto 0 10px"});
  39. $(".wigst").css({"margin":"0 auto 0 10px","max-width":"150px","padding":"0"}).click(function() {
  40. $(".wigsto").css("display",$(".wigsto").css("display") == "none" ? "inline-block" : "none");
  41. });
  42.  
  43. wigupd();
  44.  
  45. function wigupd() {
  46. let WG_GLOW_COLOR = $("#cpick")[0].value;
  47. let WG_GLOW_SIZE = $("#wigsz")[0].value;
  48. let WG_WEBP_CHK = $("#wbpc")[0].checked;
  49. GM.setValue("wigColor", WG_GLOW_COLOR);
  50. GM.setValue("wigSize", WG_GLOW_SIZE);
  51. GM.setValue("webpChk", WG_WEBP_CHK);
  52. wigApply(WG_GLOW_COLOR, WG_GLOW_SIZE, WG_WEBP_CHK);
  53. }
  54.  
  55. function wigApply(wigc, wigs, wbpc) {
  56. $("#gdt a div").each(function() {
  57. let tmtl = $(this).attr("title");
  58. let tmei = tmtl.lastIndexOf(".") + 1;
  59. let tmex = tmtl.substr(tmei);
  60.  
  61. console.log(wbpc)
  62.  
  63. if (tmex == "gif" || tmex == "apng" || tmex == "webm" || (tmex == "webp" && wbpc == true)) {
  64. //as of writing only gif is supported on exh galleries so lol
  65. $(this).css("box-shadow", `0 0 ${wigs}px ${wigc}`);
  66. } else if (tmex == "webp" && wbpc == false) {
  67. $(this).css("box-shadow", `0 0 0px ${wigc}`);
  68. }
  69. });
  70. }
  71. });
  72.  
  73. })();