Xnxx Download Movie Button

Add a link button to the movie

  1. // ==UserScript==
  2. // @name Xnxx Download Movie Button
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Add a link button to the movie
  6. // @author Guile93
  7. // @match https://www.xnxx.com/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=xnxx.com
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12. (function() {
  13. 'use strict';
  14. function useRegex(input) {
  15. let regex = /"contentUrl": "[^"]*"/i;
  16. var stepa = input.match(regex);
  17. return stepa;
  18. }
  19.  
  20. function extractAllText(str){
  21. const re = /"(.*?)"/g;
  22. const result = [];
  23. let current;
  24. while (current = re.exec(str)) {
  25. result.push(current.pop());
  26. }
  27. return result[1];
  28. }
  29. var docum=document.getElementsByTagName('head')[0].innerHTML;
  30. var momo=extractAllText(useRegex(docum));
  31. var css = `
  32. .btnDOWN{
  33. background-color: #CC0000;
  34. border: 1px solid brown;
  35. height:30px;
  36. border-radius: 6px;
  37. margin-top:2px;
  38. box-sizing: border-box;
  39. color: #fff;
  40. cursor: pointer;
  41. display: inline-block;
  42. font-size: 12px;
  43. font-weight: 600;
  44. line-height: 20px;
  45. position: relative;
  46. float: right;
  47. text-align: center;
  48. touch-action: manipulation;
  49. vertical-align: middle;
  50. }
  51. .btnDOWN:hover {
  52. background-color: #FF0000;
  53. }
  54. `
  55. var head = document.getElementsByTagName('head')[0];
  56. var s = document.createElement('style');
  57. s.setAttribute('type', 'text/css');
  58. s.appendChild(document.createTextNode(css));
  59. head.appendChild(s);
  60. let btn = document.createElement("button");
  61. btn.innerHTML = "DOWNLOAD";
  62. btn.name="movieDownload";
  63. btn.className="btnDOWN";
  64. btn.addEventListener("click", function () {
  65. window.open(momo);
  66. });
  67. document.getElementsByClassName('header-icons')[0].appendChild(btn);
  68. })();