[Premium] Coinpayu.com

Open and close Framed and Frameless Ads with Overlay for settings

Fra og med 08.09.2024. Se den nyeste version.

  1. // ==UserScript==
  2. // @name [Premium] Coinpayu.com
  3. // @namespace https://greasyfork.org/users/1162863
  4. // @version 3.3.1
  5. // @description Open and close Framed and Frameless Ads with Overlay for settings
  6. // @author Andrewblood
  7. // @match *://*.coinpayu.com/*
  8. // @exclude *://*.coinpayu.com/login
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=coinpayu.com
  10. // @grant GM_setValue
  11. // @grant GM_getValue
  12. // @grant GM_addStyle
  13. // @grant window.close
  14. // @antifeature referral-link Referral-Link is in this Script integrated.
  15. // @license Copyright Andrewblood
  16. // ==/UserScript==
  17.  
  18. (function() {
  19. 'use strict';
  20.  
  21. // CSS-Stile mit GM_addStyle hinzufügen
  22. GM_addStyle(`
  23. #customOverlay {
  24. position: fixed;
  25. bottom: 20px;
  26. right: 20px;
  27. width: 300px;
  28. background-color: rgba(0, 0, 0, 0.8);
  29. color: white;
  30. z-index: 10000;
  31. padding: 20px;
  32. box-sizing: border-box;
  33. display: flex;
  34. flex-direction: column;
  35. align-items: center; /* Zentriert den Inhalt horizontal */
  36. justify-content: center; /* Zentriert den Inhalt vertikal */
  37. }
  38. #overlayTitle {
  39. font-size: 18px;
  40. font-weight: bold;
  41. margin-bottom: 15px;
  42. text-align: center;
  43. width: 100%;
  44. }
  45. #status {
  46. font-size: 16px; /* Gleiche Größe wie die Schalter */
  47. color: #00aaff; /* Hellblau wie der Button */
  48. margin-top: -10px; /* 5px näher zur Überschrift */
  49. margin-bottom: 10px; /* 5px Abstand nach unten */
  50. }
  51. .toggleSwitchWrapper {
  52. display: flex;
  53. align-items: center;
  54. cursor: pointer;
  55. margin-bottom: 10px;
  56. width: 100%;
  57. }
  58. .toggleSwitch {
  59. display: none;
  60. }
  61. .switchSpan {
  62. width: 60px;
  63. height: 30px;
  64. background-color: #ccc;
  65. position: relative;
  66. border-radius: 30px;
  67. transition: background-color 0.3s;
  68. margin-right: 10px;
  69. }
  70. .switchHandle {
  71. width: 26px;
  72. height: 26px;
  73. background-color: #fff;
  74. position: absolute;
  75. border-radius: 50%;
  76. top: 2px;
  77. left: 2px;
  78. transition: transform 0.3s;
  79. }
  80. .toggleText {
  81. flex-grow: 1;
  82. font-size: 16px;
  83. color: white;
  84. }
  85.  
  86. #customOverlay button {
  87. margin-top: 20px;
  88. background-color: #00aaff;
  89. color: white;
  90. border: none;
  91. padding: 10px 20px;
  92. font-size: 14px;
  93. cursor: pointer;
  94. border-radius: 5px;
  95. transition: background-color 0.3s;
  96. text-align: center;
  97. }
  98.  
  99. #customOverlay button:hover {
  100. background-color: #0099dd;
  101. }
  102.  
  103. #info-overlay {
  104. position: fixed;
  105. top: 50%;
  106. left: 50%;
  107. transform: translate(-50%, -50%);
  108. width: 80%;
  109. height: 80%;
  110. background-color: rgba(0, 0, 0, 0.8);
  111. color: white;
  112. z-index: 99999;
  113. padding: 20px;
  114. display: none;
  115. overflow-y: auto;
  116. }
  117.  
  118. #info-overlay h2 {
  119. text-align: center;
  120. color: white;
  121. }
  122.  
  123. #info-overlay a {
  124. color: #00aaff;
  125. }
  126. `);
  127.  
  128. // Overlay-Div erstellen
  129. var overlay = document.createElement('div');
  130. overlay.id = 'customOverlay';
  131.  
  132. // Überschrift erstellen
  133. var title = document.createElement('div');
  134. title.id = 'overlayTitle';
  135. title.textContent = 'Coinpayu Script from Andrewblood';
  136. overlay.appendChild(title);
  137.  
  138. function setStatus(html) {
  139. Status.textContent = html;
  140. }
  141.  
  142. var Status = document.createElement('div');
  143. Status.id = 'status';
  144. overlay.appendChild(Status);
  145.  
  146. // Funktion zum Erstellen eines Toggle-Schalters
  147. function createToggleSwitch(id, labelText) {
  148. var toggle = document.createElement('label');
  149. toggle.className = 'toggleSwitchWrapper';
  150.  
  151. var switchInput = document.createElement('input');
  152. switchInput.type = 'checkbox';
  153. switchInput.id = id;
  154. switchInput.className = 'toggleSwitch';
  155.  
  156. var switchSpan = document.createElement('span');
  157. switchSpan.className = 'switchSpan';
  158.  
  159. var switchHandle = document.createElement('span');
  160. switchHandle.className = 'switchHandle';
  161.  
  162. var toggleText = document.createElement('span');
  163. toggleText.className = 'toggleText';
  164. toggleText.textContent = labelText;
  165.  
  166. toggle.appendChild(switchInput);
  167. toggle.appendChild(switchSpan);
  168. switchSpan.appendChild(switchHandle);
  169. toggle.appendChild(toggleText);
  170. overlay.appendChild(toggle);
  171.  
  172. // Initialen Status des Schalters setzen
  173. updateToggle(switchInput, switchSpan, switchHandle);
  174.  
  175. // Schalter-Event-Handler
  176. switchInput.addEventListener('change', function() {
  177. const isChecked = this.checked;
  178. GM_setValue(id + '_toggleStatus', isChecked);
  179. switchSpan.style.backgroundColor = isChecked ? '#00aaff' : '#ccc';
  180. switchHandle.style.transform = isChecked ? 'translateX(30px)' : 'translateX(0)';
  181. });
  182. }
  183.  
  184. // Funktion zum Aktualisieren des Toggle-Schalters
  185. function updateToggle(switchInput, switchSpan, switchHandle) {
  186. const isChecked = GM_getValue(switchInput.id + '_toggleStatus', false);
  187. switchInput.checked = isChecked;
  188. switchSpan.style.backgroundColor = isChecked ? '#00aaff' : '#ccc';
  189. switchHandle.style.transform = isChecked ? 'translateX(30px)' : 'translateX(0)';
  190. }
  191.  
  192. // Drei Toggle-Schalter mit Texten erstellen
  193. createToggleSwitch('toggleSwitch1', 'Framed Ads');
  194. createToggleSwitch('toggleSwitch2', 'Frameless Ads');
  195. createToggleSwitch('toggleSwitch3', 'Close after work');
  196.  
  197.  
  198. var moreInfoButton = document.createElement('button');
  199. moreInfoButton.textContent = 'More Info';
  200. moreInfoButton.addEventListener('click', openInfoOverlay);
  201.  
  202. overlay.appendChild(moreInfoButton);
  203.  
  204. // Overlay zur Seite hinzufügen
  205. document.body.appendChild(overlay);
  206.  
  207. function openInfoOverlay() {
  208. var infoOverlay = document.getElementById('info-overlay');
  209. if (!infoOverlay) {
  210. infoOverlay = document.createElement('div');
  211. infoOverlay.id = 'info-overlay';
  212. infoOverlay.innerHTML = `
  213. <h2>Additional Information</h2>
  214. <p>
  215. Go to the Dashboard and it start after reloading the page.<br>
  216. Framed Ads: It opens the first aviable site in the list and stay on it, when one site is completed it starts with the Next.<br>
  217. When all sites completed it goes to Framless Ads.<br>
  218. Frameless Ads: It opens and close site by site.<br>
  219. When all sites completed it close coinpayu or go after 3 hour to Framless Ads and begin from new.<br>
  220. You can activate and deactivate the functions in the Overlay as desired.<br>
  221. </p>
  222. <br>
  223.  
  224. <h2>Download Captcha Solver</h2>
  225. <p>
  226. <b>HCaptcha + ReCaptcha:</b> NoCoding Data Scraper and CAPTCHA Solver - <a href="https://chromewebstore.google.com/search/minirpa" target="_blank">Install Here</a><br>
  227. <b>Antibot Words:</b> AB Links Solver - <a href="https://greasyfork.org/de/scripts/459453-ab-links-solver" target="_blank">Install Here</a><br>
  228. <b>Cf-Turnstile:</b> Autopass Cloudflare CAPTCHA - <a href="https://greasyfork.org/de/scripts/464785-autopass-cloudflare-captcha" target="_blank">Install Here</a><br>
  229. </p>
  230. <br>
  231.  
  232. <h2>Support</h2>
  233. <p>
  234. If you have any questions or need assistance, don't hesitate to reach out the creator and supporter, <a href="https://greasyfork.org/users/1162863" target="_blank">Andrewblood</a>.<br>
  235. </p>
  236. <br>
  237.  
  238. <h2>Privacy Policy</h2>
  239. <p>
  240. This script stores user data locally within TamperMonkey and is exclusively used for script functionality.<br>
  241. It is not shared with the script creator or third parties.<br>
  242. </p>
  243. `;
  244. document.body.appendChild(infoOverlay);
  245. }
  246. infoOverlay.style.display = 'block';
  247.  
  248. document.addEventListener('click', function(event) {
  249. if (!infoOverlay.contains(event.target) && event.target !== moreInfoButton) {
  250. closeInfoOverlay();
  251. }
  252. });
  253. }
  254.  
  255. function closeInfoOverlay() {
  256. var infoOverlay = document.getElementById('info-overlay');
  257. if (infoOverlay) {
  258. infoOverlay.style.display = 'none';
  259. }
  260. }
  261.  
  262. setStatus("Script gestartet");
  263.  
  264. // Funktion für das Schließen der Tabs
  265. var oldfunction = unsafeWindow.open;
  266. var windowName = "";
  267. function newFunction(params1, params2) {
  268. if (!params2 || params2 == "_blank") {
  269. windowName = "popUpWindow";
  270. } else {
  271. windowName = params2;
  272. }
  273. return oldfunction(params1, windowName);
  274. }
  275.  
  276. unsafeWindow.open = newFunction;
  277. unsafeWindow.onbeforeunload = function() {
  278. unsafeWindow.open('', windowName).close();
  279. };
  280.  
  281. // Referal Code einfügen
  282. if (window.location.href.includes("register")) {
  283. if (!window.location.href.includes("Andrewblood")) {
  284. window.location.replace("https://www.coinpayu.com/register?r=Andrewblood");
  285. }
  286. }
  287.  
  288. // Fenster von Framed Ad schließen
  289. if (window.location.href.includes("coinpayu.com/dashboard/view_active?id=")) {
  290. var intervalId = setInterval(function() {
  291. var waittime = document.querySelector("#app > div > div > div > div > div");
  292. if (waittime && waittime.style.width === "100%") {
  293. clearInterval(intervalId);
  294. setTimeout(function() {
  295. setStatus('Schließe Fenster von Framed Ad.');
  296. window.close();
  297. }, 500);
  298. }
  299. }, 100);
  300. }
  301.  
  302. setTimeout(function() {
  303. console.log('Klicke auf #toViewAds');
  304. document.querySelector("#toViewAds").click();
  305. setTimeout(function() {
  306. console.log('Klicke auf das zweite Element in #viewads');
  307. document.querySelector("#viewads > div:nth-child(2) > p", "#viewads > div.nav-head.dashboard-actived > p").click();
  308. }, 500);
  309. }, 1000 * 2);
  310.  
  311. // 1. Funktion für Framed Ads
  312. async function processFramedAds() {
  313. setStatus('Starte Verarbeitung von Framed Ads');
  314. var headlineElement = document.querySelector("#app > div > div.coinpayu-dashboard-content > div.main-panel > div > div > h6");
  315. if (GM_getValue('toggleSwitch1_toggleStatus', false) && headlineElement.innerText.includes("Framed")) {
  316. return new Promise(resolve => {
  317.  
  318. function processNextFramedElement() {
  319. setStatus('Verarbeite nächsten Framed Ad Element');
  320. var element = document.querySelector('.clearfix.ags-list-box:not(.gray-all)');
  321. if (element) {
  322. var firstElement = element.querySelector('.text-overflow.ags-description > span');
  323. var timeElement = element.querySelector('.ags-detail-time span');
  324. var urlElement = element.querySelector('.text-overflow.ags-description');
  325. var url = urlElement.getAttribute('title');
  326. var time = parseInt(timeElement.textContent);
  327.  
  328. setStatus('Open ' + url + ' for ' + time + ' seconds.');
  329. urlElement.removeAttribute('title');
  330.  
  331. if (firstElement) {
  332. firstElement.click();
  333. setTimeout(function() {
  334. var interval = setInterval(function() {
  335. var alertElementGreen = document.querySelector(".alert-div.alert-green");
  336. var alertElementRed = document.querySelector(".alert-div.alert-red");
  337.  
  338. if (alertElementGreen) {
  339. clearInterval(interval);
  340. setTimeout(function() {
  341. processNextFramedElement();
  342. }, 3000);
  343. } else if (alertElementRed) {
  344. clearInterval(interval);
  345. element.remove();
  346. setTimeout(function() {
  347. processNextFramedElement();
  348. }, 7000);
  349. }
  350. }, 1000);
  351. }, 3000);
  352. }
  353. } else {
  354. setStatus('Framed Ads abgeschlossen.');
  355. document.querySelector("#viewads > div:nth-child(1) > p").click();
  356.  
  357. setTimeout(function() {
  358. resolve();
  359. }, 2000);
  360. }
  361. }
  362. processNextFramedElement();
  363.  
  364. });
  365. }
  366.  
  367. }
  368.  
  369. // 2. Funktion für Frameless Ads
  370. async function processFramelessAds() {
  371. setStatus('Starte Verarbeitung von Frameless Ads');
  372. var headlineElement = document.querySelector("#app > div > div.coinpayu-dashboard-content > div.main-panel > div > div > h6");
  373. if (GM_getValue('toggleSwitch2_toggleStatus', false) && headlineElement?.innerText.includes("Frameless")) {
  374. setStatus('Frameless Ads Toggle ist aktiviert und die Überschrift ist vorhanden.');
  375. return new Promise(resolve => {
  376. function processNextFramelessElement() {
  377. setStatus('Verarbeite nächsten Frameless Ad Element');
  378. var element = document.querySelector('.clearfix.ags-list-box:not(.gray-all)');
  379. if (element) {
  380. var firstElement = element.querySelector('.text-overflow.ags-description > span');
  381. var timeElement = element.querySelector('.ags-detail-time span');
  382. var urlElement = element.querySelector('.text-overflow.ags-description');
  383. var url = urlElement.getAttribute('title');
  384. var time = parseInt(timeElement.textContent);
  385.  
  386. setStatus('Open ' + url + ' for ' + time + ' seconds.');
  387. urlElement.removeAttribute('title');
  388.  
  389. if (firstElement) {
  390. firstElement.click();
  391. unsafeWindow.open('', windowName).close();
  392.  
  393. setTimeout(function() {
  394. var interval = setInterval(function() {
  395. var alertElementGreen = document.querySelector(".alert-div.alert-green");
  396. var alertElementRed = document.querySelector(".alert-div.alert-red");
  397.  
  398. if (alertElementGreen) {
  399. clearInterval(interval);
  400. setTimeout(function() {
  401. processNextFramelessElement();
  402. }, 3000);
  403. } else if (alertElementRed) {
  404. clearInterval(interval);
  405. element.remove();
  406. setTimeout(function() {
  407. processNextFramelessElement();
  408. }, 7000);
  409. }
  410. }, 1000);
  411. }, 3000);
  412. }
  413. } else {
  414. setStatus('Keine weiteren Frameless Ads gefunden.');
  415. resolve();
  416. }
  417. }
  418. processNextFramelessElement();
  419. });
  420. } else {
  421. setStatus('Frameless Ads Toggle ist nicht aktiviert oder Überschrift nicht vorhanden.');
  422. }
  423. }
  424.  
  425.  
  426. // 3. Funktion für das Schließen nach der Arbeit oder Seiten-Neuladen nach 3 Stunden
  427. async function closeAfterWork() {
  428. setStatus('Überprüfe, ob Schließen nach Arbeit aktiviert ist.');
  429. if (GM_getValue('toggleSwitch3_toggleStatus', false)) {
  430. // Wenn der Toggle aktiviert ist, schließe das Fenster
  431. return new Promise(resolve => {
  432. setTimeout(function() {
  433. setStatus('Schließe Fenster nach der Arbeit.');
  434. window.close();
  435. resolve();
  436. }, 3000); // 3 Sekunden warten vor dem Schließen
  437. });
  438. } else {
  439. // Wenn der Toggle nicht aktiviert ist, lade die Seite nach 3 Stunden neu
  440. return new Promise(resolve => {
  441. setStatus('Lade die Seite nach 3 Stunden neu.');
  442. setTimeout(function() {
  443. window.location.href = "https://www.coinpayu.com/dashboard";
  444. resolve();
  445. }, 3 * 60 * 60 * 1000); // 3 Stunden in Millisekunden
  446. });
  447. }
  448. }
  449.  
  450. // Funktionen in Reihenfolge ausführen
  451. setTimeout(async function run() {
  452. setStatus('Starte alle Funktionen nach 5 Sekunden');
  453. await processFramedAds();
  454. await processFramelessAds();
  455. await closeAfterWork();
  456. }, 5000); // 5 Sekunden warten, bevor die Funktionen ausgeführt werden
  457.  
  458. })();