brooklyndesignstudio

Disable Download Button/Right-Click in Video/Image Modules

Nov 14th, 2020 (edited)
1,232
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!-- Disable Download Button in Video Module -->
  2. <script>
  3.     window.onload = function() {
  4.         videos = document.querySelectorAll('video');
  5.         [].forEach.call(videos, function(video) {
  6.   video.setAttribute("controlsList", "nodownload");
  7. });
  8.     };
  9. </script>
  10. <!-- Disable Right-click on All Media -->
  11. <script>
  12.  document.addEventListener("contextmenu", function(e){
  13.     e.preventDefault();
  14. }, false);
  15. </script>
  16. <!-- Remove Download Button in Video Module -->
  17. <script>
  18. jQuery(document).ready(function() {
  19.     if (jQuery('.lwp-no-download .et_pb_video_box').length !== 0) {
  20.         jQuery(".lwp-no-download .et_pb_video_box").find('video').attr('controlsList', 'nodownload');
  21.     }
  22. });
  23. </script>
RAW Paste Data