(function() {
	$.getJSON("https://api.github.com/repos/thelounge/lounge/tags", function(json) {
		var first = json.shift();
		if (first.name) {
			var version = document.getElementById("version");
			version.textContent = "version " + first.name.substr(1); // Strip `v` in `vX.Y.Z`
			version.className = "version_shown";
		}
	});
}());

(function() {
	$.getJSON("https://api.github.com/repos/thelounge/lounge/releases", function(json) {
		var first = json.filter(function (release) {
			return !release.prerelease;
		})[0];

		if (first.tag_name) {
			var version = document.getElementById("version");
			version.textContent = "version " + first.tag_name.substr(1); // Strip `v` in `vX.Y.Z`
			version.className = "version_shown";
		}
	});
}());

Use GitHub releases to retrieve latest non-prerelease version
Use GitHub releases to retrieve latest non-prerelease version
