WBW Downloader

Download button for WhatBoysWant

  1. // ==UserScript==
  2. // @name WBW Downloader
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Download button for WhatBoysWant
  6. // @author ReaperUnreal
  7. // @match https://*.whatboyswant.com/babes/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=whatboyswant.com
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. // get the image link
  17. var images = document.getElementsByClassName('img-fluid');
  18. if (images.length !== 1) {
  19. return;
  20. }
  21. var src = images[0].src;
  22.  
  23. // get the button row
  24. var cards = document.getElementsByClassName('card-tools');
  25. if (cards.length !== 1) {
  26. return;
  27. }
  28. var buttonRow = cards[0];
  29. if (buttonRow.children.length < 2) {
  30. return;
  31. }
  32.  
  33. // positively identify download button
  34. var downloadA = buttonRow.children[1];
  35. if (downloadA.tagName.toLowerCase() !== 'a') {
  36. return;
  37. }
  38. if (downloadA.children.length !== 1) {
  39. return;
  40. }
  41. if (!downloadA.children[0].classList.contains('fa-download')) {
  42. return;
  43. }
  44. downloadA.href = src;
  45. downloadA.setAttribute('download', '');
  46. })();