Auto Refresh

Tự động refresh.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name  Auto Refresh
// @namespace  Nguyen Kim Long
// @description  Tự động refresh.
// @version  1.0.2
// @author  NKL
// @match  https://colkidsclub.vn/backpack-season-3*
// @require  https://code.jquery.com/jquery-2.2.4.min.js
// @require  https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.8/js/select2.full.min.js
// @run-at  document-idle
// ==/UserScript==

(function () {
    'use strict';
    $(document).ready(function () {
        if (document.getElementsByClassName('sold-out').length == 1) {
            setTimeout(function () {
                location.reload();
            }, 3000);
        } else {
            if (document.title == 'Just a moment...') {
                //alert('antiddos');
                setTimeout(function () {
                    location.reload();
                }, 5000);
            } else {
                async function playaudio() {
                    var audio = await new Audio('https://www.w3schools.com/html/horse.mp3');
                    audio.loop = true;
                    audio.play();
                }
                playaudio();
                async function addTocart() {
                    var button = await document.getElementsByClassName('add_to_cart ');
                    await button[0].click();
                    var url = await 'https://colkidsclub.vn/checkout/'
                    await window.open(url,'_blank');
                }
                addTocart();
            }

        }
    });
})();