🏠 Home 

Greasy Fork is available in English.

Gplinks Bypass

Bypassing gplinks.co


ติดตั้งสคริปต์นี้?
  1. // ==UserScript==
  2. // @name Gplinks Bypass
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.3
  5. // @description Bypassing gplinks.co
  6. // @match *://*/*
  7. // @author Jayasurya Mailsamy
  8. // @grant none
  9. // ==/UserScript==
  10. (function() {
  11. 'use strict';
  12. // Function to remove scripts from the head
  13. function removeHeadScripts() {
  14. const head = document.head || document.getElementsByTagName('head')[0];
  15. const scripts = head.querySelectorAll('script');
  16. scripts.forEach(script => {
  17. script.parentNode.removeChild(script);
  18. });
  19. }
  20. // Function to set up a MutationObserver to detect script tags being added to the head
  21. function observeHeadForScripts() {
  22. const head = document.head || document.getElementsByTagName('head')[0];
  23. // Create a MutationObserver to watch for changes in the head element
  24. const observer = new MutationObserver(mutations => {
  25. mutations.forEach(mutation => {
  26. mutation.addedNodes.forEach(node => {
  27. if (node.tagName === 'SCRIPT') {
  28. node.parentNode.removeChild(node);
  29. }
  30. });
  31. });
  32. });
  33. // Observe the head element for child list changes
  34. observer.observe(head, {
  35. childList: true
  36. });
  37. // Also remove existing script elements immediately
  38. removeHeadScripts();
  39. }
  40. // Function to check for the specific script tag
  41. function checkForScript() {
  42. const scriptSrc = 'https://api.gplinks.com/track/js/main.js?2.7';
  43. const scripts = document.getElementsByTagName('script');
  44. for (let i = 0; i < scripts.length; i++) {
  45. if (scripts[i].src === scriptSrc) {
  46. // Proceed to make POST requests and redirect
  47. makePostRequestsAndRedirect();
  48. break;
  49. }
  50. }
  51. }
  52. // Function to get the value of a specific cookie
  53. function getCookie(name) {
  54. const value = `; ${document.cookie}`;
  55. const parts = value.split(`; ${name}=`);
  56. if (parts.length === 2) return parts.pop().split(';').shift();
  57. return null;
  58. }
  59. // Function to alert selected cookies
  60. function alertSelectedCookies() {
  61. const lid = getCookie("lid");
  62. const pid = getCookie("pid");
  63. const plid = getCookie("plid");
  64. const vid = getCookie("vid");
  65. let message = 'Cookies:\n';
  66. if (lid) message += `lid: ${lid}\n`;
  67. if (pid) message += `pid: ${pid}\n`;
  68. if (plid) message += `plid: ${plid}\n`;
  69. if (vid) message += `vid: ${vid}\n`;
  70. if (message === 'Cookies:\n') {
  71. message = 'No relevant cookies found.';
  72. }
  73. alert(message);
  74. }
  75. // Function to make POST requests
  76. function setVisitor(status, impressions, visitorId) {
  77. return $.ajax({
  78. type: "POST",
  79. url: "https://gplinks.com/track/data.php",
  80. data: {
  81. request: "setVisitor",
  82. status: status,
  83. imps: impressions,
  84. vid: visitorId,
  85. },
  86. dataType: "json",
  87. });
  88. }
  89. // Function to handle POST requests and redirect
  90. function makePostRequestsAndRedirect() {
  91. const vid = getCookie("vid"); // Assuming you want to use the cookie value for visitorId
  92. const cookie_pub_id = getCookie("pid");
  93. const cookie_link_id = getCookie("lid");
  94. if (!vid || !cookie_pub_id || !cookie_link_id) {
  95. alert('Missing required cookies for POST requests and redirect.');
  96. return;
  97. }
  98. // Perform three POST requests with different parameters
  99. $.when(
  100. setVisitor(1, 2, vid),
  101. setVisitor(2, 4, vid),
  102. setVisitor(3, 6, vid)
  103. ).done(function() {
  104. // Construct the target URL after POST requests are done
  105. const target_final = `https://gplinks.co/${cookie_link_id}/?pid=${cookie_pub_id}&vid=${vid}`;
  106. // Redirect to the target URL
  107. window.location.href = target_final;
  108. }).fail(function() {
  109. alert('One or more POST requests failed.');
  110. });
  111. }
  112. // Load jQuery if not already present
  113. function loadJQuery(callback) {
  114. const script = document.createElement('script');
  115. script.src = 'https://code.jquery.com/jquery-3.6.0.min.js';
  116. script.onload = callback;
  117. document.head.appendChild(script);
  118. }
  119. // Function to remove <script> tags from <head>
  120. function removeScriptTagsFromHead() {
  121. // Select all <script> tags within <head>
  122. const scriptTags = document.querySelectorAll('head script');
  123. // Remove each script tag
  124. scriptTags.forEach(script => {
  125. script.remove();
  126. console.log('Removed script tag:', script.src || 'inline script');
  127. });
  128. }
  129. // Function to modify the counter_value in app_vars
  130. function modifyCounterValue() {
  131. // Ensure the app_vars object is available
  132. if (window.app_vars) {
  133. // Check if counter_value exists in app_vars
  134. if ('counter_value' in window.app_vars) {
  135. // Modify counter_value to 0
  136. window.app_vars.counter_value = null;
  137. } else {
  138. console.error('counter_value not found in app_vars');
  139. }
  140. } else {
  141. console.error('app_vars not found on the page');
  142. }
  143. }
  144. // Function to check if an element exists
  145. function elementExists(selector) {
  146. return $(selector).length > 0;
  147. }
  148. // Redirect function
  149. function redirect(url) {
  150. window.location.href = url;
  151. }
  152. // Function to copy text to clipboard and redirect
  153. function handleRedirect(data) {
  154. // Copy URL to clipboard
  155. navigator.clipboard.writeText(data.url).then(() => {
  156. console.log('URL copied to clipboard');
  157. // Redirect after copying
  158. window.location.href = data.url;
  159. }).catch(err => {
  160. console.error('Failed to copy URL: ', err);
  161. });
  162. }
  163. $(document).ready(function() {
  164. if (window.jQuery) {
  165. checkForScript();
  166. } else {
  167. loadJQuery(checkForScript);
  168. }
  169. observeHeadForScripts();
  170. removeScriptTagsFromHead();
  171. modifyCounterValue();
  172. if (elementExists('form[id=go-link]')) {
  173. var form = $('form[id=go-link]');
  174. // Unbind any existing submit handlers
  175. form.unbind().submit(function(e) {
  176. e.preventDefault(); // Prevent the default form submission
  177. // AJAX request
  178. $.ajax({
  179. type: 'POST',
  180. async: true,
  181. url: form.attr('action'),
  182. data: form.serialize(),
  183. dataType: 'json',
  184. success: function(data) {
  185. if (data.url) {
  186. handleRedirect(data);
  187. redirect(data.url); // Redirect based on server response
  188. } else {
  189. console.error('No URL returned in response');
  190. }
  191. },
  192. error: function(xhr, status, error) {
  193. console.error('AJAX request failed:', status, error);
  194. }
  195. });
  196. });
  197. }
  198. });
  199. // Check if jQuery is already loaded
  200. })();