Sleazy Fork is available in English.

CFake.com image and link fixer

Prevents links from opening a new window, enables right click on videos, hides ads, and automatically loads the high res image

  1. // ==UserScript==
  2. // @name CFake.com image and link fixer
  3. // @namespace cfake.com/*
  4. // @version 1.4
  5. // @description Prevents links from opening a new window, enables right click on videos, hides ads, and automatically loads the high res image
  6. // @author codingjoe
  7. // @match https://cfake.com/*
  8. // @grant none
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. // cut the bs
  13. document.body.onload = function () {};
  14. document.body.style.overflow = "auto";
  15.  
  16. // xpath
  17. function $x(xpath, root) {
  18. let doc = root ? root.evaluate ? root : root.ownerDocument : document, next;
  19. let got = doc.evaluate(xpath, root || doc, null, null, null), result = [];
  20. while (next = got.iterateNext()) result.push(next);
  21. return result;
  22. }
  23.  
  24. (function() {
  25. 'use strict';
  26. var strMatch = "javascript:showimage('";
  27.  
  28. // redirect main page to image gallery
  29. if (location.href.replace(/\/$/,"").toLowerCase().endsWith("cfake.com")) {
  30. location.href = "https://cfake.com/images/gallery/";
  31. }
  32.  
  33. // hide ads
  34. $x("//div[@id='over' and contains(text(), 'AdBlock ad')] | //div[@id='content_ban'] | //*[@id='content_square'] | //div[@id='slideblockContainer']").forEach(ad => {
  35. ad.style.display = "none";
  36. });
  37.  
  38. // enables middle click to open page in new tab
  39. $x(`//a[contains(@href, "${strMatch}")]`).forEach(link => {
  40. var pos = link.href.indexOf(".jpg")+4;
  41. link.href = `https://cfake.com/${link.href.substring(strMatch.length, pos)}`;
  42. })
  43.  
  44. // retrieve high res image
  45. $x("//img[contains(@src, 'medias/photos')]").forEach(img => {
  46. let btnSwitchSize = document.querySelector("img[title='Switch Size']");
  47. if (btnSwitchSize === null) {
  48. img.parentNode.href = img.src;
  49. } else {
  50. new Promise(resolve => {
  51. btnSwitchSize.click();
  52. setTimeout(resolve, 100);
  53. }).then(resolve => {
  54. setTimeout(() => {
  55. document.querySelectorAll("img#content_img").forEach(r => r.parentNode.href = r.src);
  56. resolve();
  57. }, 100);
  58. });
  59. }
  60. });
  61.  
  62. // enable right click on videos
  63. document.querySelectorAll("video").forEach(r => r.setAttribute("oncontextmenu",""));
  64. })();