Soap+

player for soap2day

  1. // ==UserScript==
  2. // @name Soap+
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description player for soap2day
  6. // @author You
  7. // @match https://soap2day.to/*
  8. // @match https://soap2day.ac/*
  9. // @match https://soap2day.sh/*
  10. // @match https://s2dfree.to/*
  11. // @match https://s2dfree.is/*
  12. // @match https://s2dfree.in/*
  13. // @match https://s2dfree.nl/*
  14. // @match https://s2dfree.cc/*
  15. // @match https://s2dfree.de/*
  16. // @icon https://www.google.com/s2/favicons?domain=s2dfree.cc
  17. // @grant none
  18. // @require https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js
  19. // ==/UserScript==
  20.  
  21. (function () {
  22. 'use strict';
  23.  
  24.  
  25. const SWITCH_TO_PLAYER_AUTOMATICALLY = false; //WARNING: setting this value to true could lead to soap+ entering into player with unwanted videos.
  26.  
  27. function switchPlayer(videoSource, thumbnail) {
  28. $('body').html(`
  29. <style>
  30. video {
  31. width: 100%;
  32. position: absolute;
  33. left: 50%;
  34. top: 50%;
  35. transform: translate(-50%, -50%);
  36. background: url(${thumbnail}) no-repeat;
  37. background-position: center center;
  38. background-repeat: no-repeat;
  39. -webkit-background-size: cover;
  40. -moz-background-size: cover;
  41. -o-background-size: cover;
  42. background-size: cover;
  43. }
  44. .control-wrapper {
  45. position: relative;
  46. z-index; -100;
  47. }
  48. .controls {
  49. position:absolute;
  50. height: 5%;
  51. width: 100%;
  52. background-color: white;
  53. bottom: 10%;
  54. }
  55. </style>
  56. <video controls src="${videoSource}"></video>
  57. `);
  58.  
  59. $('body').attr('style', 'background: black !important;');
  60. }
  61.  
  62. var checkExist = setInterval(function () {
  63. if ($('video').length) {
  64. var videoSource = $('video').attr('src');
  65. var thumbnail = $('.thumbnail').find('img').attr('src');
  66.  
  67.  
  68. if(SWITCH_TO_PLAYER_AUTOMATICALLY) { switchPlayer(videoSource, thumbnail); } else {
  69. $('#divPlayerSelect').append('<div id="btnSoapPlus" class="btn btn-dark">Use Soap+ Player</div>');
  70. $( "#btnSoapPlus" ).click(function() {
  71. switchPlayer(videoSource);
  72. });
  73. }
  74.  
  75. clearInterval(checkExist);
  76. }
  77. }, 100); // check every 100ms
  78.  
  79. })();