Advertisement
TheMoonV22

Doubtnut Video Unlocker Script for Phone

Oct 11th, 2023
549
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 1.54 KB | Source Code | 0 0
  1. // ==UserScript==
  2. // @name         Doubtnut Video Unlocker
  3. // @namespace    http://CM-Of-Dholakpur.com/
  4. // @version      1.0
  5. // @description  Adds an "Unlock Video" button and opens the link in a new tab when it's clicked
  6. // @match        https://www.doubtnut.com/*
  7. // @grant        none
  8. // ==/UserScript==
  9.  
  10. (function() {
  11.     // Create a new button element
  12.     var unlockButton = document.createElement('button');
  13.  
  14.     // Set the button text and style
  15.     unlockButton.textContent = 'Unlock Video';
  16.     unlockButton.style.fontSize = '24px'; // Adjust the font size as needed
  17.     unlockButton.style.position = 'fixed';
  18.     unlockButton.style.top = '110px';
  19.     unlockButton.style.left = '20%';
  20.     unlockButton.style.transform = 'translateX(-50%)';
  21.     unlockButton.style.zIndex = '9999';
  22.     unlockButton.style.backgroundColor = 'black'; // Black background color
  23.     unlockButton.style.color = 'white'; // White text color
  24.     unlockButton.style.border = '2px solid red'; // Red border
  25.  
  26.     // Append the button to the document body
  27.     document.body.appendChild(unlockButton);
  28.  
  29.     // Add a click event listener to the button
  30.     unlockButton.addEventListener('click', function() {
  31.         // Find the video element
  32.         var videoElement = document.getElementById('content_video_html5_api');
  33.  
  34.         if (videoElement) {
  35.             // Get the video source URL
  36.             var videoUrl = videoElement.getAttribute('src');
  37.  
  38.             // Open the URL in a new tab
  39.             window.open(videoUrl, '_blank');
  40.         }
  41.     });
  42. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement