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