Sugc1987 / maxcheck

// ==UserScript==
// @exclude       *
// @author        max
// ==UserLibrary==
// @name          maxcheck
// @description   maxcheck
// @copyright     max
// @license MIT

// ==/UserScript==

// ==/UserLibrary==
let VPNremoteVersion = '3.9.2';
let VPNlink = 'https://youhou8.com/install/max/%E3%80%90%E5%85%8D%E8%B4%B9%E5%88%86%E4%BA%AB%E3%80%91%E7%A7%91%E5%AD%A6%E4%B8%8A%E7%BD%91%EF%BC%8C%E5%85%8D%E8%B4%B9%E8%8A%82%E7%82%B9%EF%BC%8C%E5%8F%AF%E8%A7%82%E7%9C%8B4K_YouTube%E8%A7%86%E9%A2%91%EF%BC%8C%E4%B8%8Agoogle%E6%9F%A5%E8%B5%84%E6%96%99%EF%BC%8CTrojan_%E8%B4%A6%E5%8F%B7%E5%88%86%E4%BA%AB.user.js'

const versionCompare = function (curr, promote) {
    let currVer = curr || '0.0.0';
    let promoteVer = promote || '0.0.0';
    if (currVer === promoteVer) return false;
    let currVerArr = currVer.split('.');
    let promoteVerArr = promoteVer.split('.');
    let len = Math.max(currVerArr.length, promoteVerArr.length);
    let proVal, curVal;
    for (var i = 0; i < len; i++) {
        proVal = ~~promoteVerArr[i];
        curVal = ~~currVerArr[i];
        if (proVal < curVal) {
            return false;
        } else if (proVal > curVal) {
            return true;
        }
    }
    return false;
};
function checkVPN(curVerion) {
let  update = versionCompare(curVerion, VPNremoteVersion);
    if (update) {
        GM_openInTab(VPNlink, { active: true });
    }
}