Sha256: 8f4bbc2843f482844c39620a1b789dd781667fd7ac76bd38a7bd6ae2549a71ff

Contents?: true

Size: 1.79 KB

Versions: 16

Compression:

Stored size: 1.79 KB

Contents

var versionRequest;

function isOutOfDate(newVersionNumber) {
    return JSUNIT_VERSION < newVersionNumber;
}

function sendRequestForLatestVersion(url) {
    versionRequest = createXmlHttpRequest();
    if (versionRequest) {
        versionRequest.onreadystatechange = requestStateChanged;
        versionRequest.open("GET", url, true);
        versionRequest.send(null);
    }
}

function createXmlHttpRequest() {
    if (window.XMLHttpRequest)
        return new XMLHttpRequest();
    else if (window.ActiveXObject)
        return new ActiveXObject("Microsoft.XMLHTTP");
}

function requestStateChanged() {
    if (versionRequest && versionRequest.readyState == 4) {
        if (versionRequest.status == 200) {
            var latestVersion = versionRequest.responseText;
            if (isOutOfDate(latestVersion))
                versionNotLatest(latestVersion);
            else
                versionLatest();
        } else
            versionCheckError();
    }
}

function checkForLatestVersion(url) {
    setLatestVersionDivHTML("Checking for newer version...");
    try {
        sendRequestForLatestVersion(url);
    } catch (e) {
        setLatestVersionDivHTML("An error occurred while checking for a newer version: " + e.message);
    }
}

function versionNotLatest(latestVersion) {
    setLatestVersionDivHTML('<font color="red">A newer version of JsUnit, version ' + latestVersion + ', is available.</font>');
}

function versionLatest() {
    setLatestVersionDivHTML("You are running the latest version of JsUnit.");
}

function setLatestVersionDivHTML(string) {
    document.getElementById("versionCheckDiv").innerHTML = string;
}

function versionCheckError() {
    setLatestVersionDivHTML("An error occurred while checking for a newer version.");
}

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
selenium-webdriver-0.0.24 common/src/js/jsunit/app/jsUnitVersionCheck.js
selenium-webdriver-0.0.23 common/src/js/jsunit/app/jsUnitVersionCheck.js
selenium-webdriver-0.0.22 common/src/js/jsunit/app/jsUnitVersionCheck.js
selenium-webdriver-0.0.21 common/src/js/jsunit/app/jsUnitVersionCheck.js
selenium-webdriver-0.0.20 common/src/js/jsunit/app/jsUnitVersionCheck.js
selenium-webdriver-0.0.19 common/src/js/jsunit/app/jsUnitVersionCheck.js
selenium-webdriver-0.0.18 common/src/js/jsunit/app/jsUnitVersionCheck.js
rainux-selenium-webdriver-0.0.17 common/src/js/jsunit/app/jsUnitVersionCheck.js
selenium-webdriver-0.0.17 common/src/js/jsunit/app/jsUnitVersionCheck.js
selenium-webdriver-0.0.16 common/src/js/jsunit/app/jsUnitVersionCheck.js
selenium-webdriver-0.0.15 common/src/js/jsunit/app/jsUnitVersionCheck.js
selenium-webdriver-0.0.14 common/src/js/jsunit/app/jsUnitVersionCheck.js
selenium-webdriver-0.0.13 common/src/js/jsunit/app/jsUnitVersionCheck.js
selenium-webdriver-0.0.12 common/src/js/jsunit/app/jsUnitVersionCheck.js
selenium-webdriver-0.0.11 common/src/js/jsunit/app/jsUnitVersionCheck.js
selenium-webdriver-0.0.10 common/src/js/jsunit/app/jsUnitVersionCheck.js