Sleazy Fork is available in English.

Konadown

Alter Konachan download links so that they actually download the file instead of opening the file in chrome

Verzia zo dňa 20.06.2019. Pozri najnovšiu verziu.

  1. // ==UserScript==
  2. // @name Konadown
  3. // @namespace https://konachan.com/
  4. // @version 1.0
  5. // @description Alter Konachan download links so that they actually download the file instead of opening the file in chrome
  6. // @author kein
  7. // @match https://konachan.com/post/show/*
  8. // @grant none
  9. // @require http://code.jquery.com/jquery-latest.js
  10. // ==/UserScript==
  11.  
  12. $(function() {
  13. 'use strict';
  14. let name, fName, link, submit, pause, elementExists;
  15.  
  16. // First link, the PNG
  17. elementExists = document.getElementsByClassName("original-file-unchanged");
  18. if (elementExists.length != 0) {
  19. link = $(".original-file-unchanged").attr("href");
  20. for (let i = 0; i < link.length; i++) {
  21. name += link[i];
  22. if (link[i] == "/") {
  23. name = "";
  24. }
  25. }
  26. submit = "";
  27. fName = "";
  28. for (let i = 0; i < name.length; i++) {
  29. if (pause > 0) {
  30. pause--;
  31. continue;
  32. }
  33. submit = name[i];
  34. if (submit == "%") {
  35. pause = 2;
  36. if (name[i]+name[i+1]+name[i+2] == "%21") {
  37. submit = "!";
  38. } else {
  39. submit = " ";
  40. }
  41. }
  42. fName += submit;
  43. }
  44. $(".original-file-unchanged").attr("download", fName);
  45. } else {
  46. console.warn("Unchanged file does not exist");
  47. }
  48.  
  49.  
  50. // Second link, the JPG
  51. elementExists = document.getElementsByClassName("original-file-changed");
  52. if (elementExists.length != 0) {
  53. link = $(".original-file-changed").attr("href");
  54. for (let i = 0; i < link.length; i++) {
  55. name += link[i];
  56. if (link[i] == "/") {
  57. name = "";
  58. }
  59. }
  60. submit = "";
  61. fName = "";
  62. for (let i = 0; i < name.length; i++) {
  63. if (pause > 0) {
  64. pause--;
  65. continue;
  66. }
  67. submit = name[i];
  68. if (submit == "%") {
  69. pause = 2;
  70. if (name[i]+name[i+1]+name[i+2] == "%21") {
  71. submit = "!";
  72. } else {
  73. submit = " ";
  74. }
  75. }
  76. fName += submit;
  77. }
  78.  
  79. $(".original-file-changed").attr("download", fName);
  80. } else {
  81. console.warn("Changed file does not exist");
  82. }
  83. })();