261 lines
7.5 KiB
HTML
261 lines
7.5 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
|
<title>Singularity Viewer</title>
|
|
<script type="text/javascript">
|
|
//<![CDATA[
|
|
/*
|
|
* Source: https://github.com/singularity-viewer/login-page
|
|
*
|
|
* Paramaters
|
|
* CURRENT VERSION GOES HERE
|
|
*/
|
|
|
|
var current_version = "1.8.5 (5617)";
|
|
|
|
// Minimum recommended alpha version
|
|
var min_alpha = "1.8.5 (6068)";
|
|
|
|
/*
|
|
* Main functionality (no need to edit anything below to udpate the version)
|
|
*/
|
|
|
|
var toolbarShown = false;
|
|
var urlParams;
|
|
|
|
function parseUrlParams() {
|
|
var match,
|
|
pl = /\+/g, // Regex for replacing addition symbol with a space
|
|
search = /([^&=]+)=?([^&]*)/g,
|
|
decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); },
|
|
query = window.location.search.substring(1);
|
|
|
|
urlParams = {};
|
|
while (match = search.exec(query))
|
|
urlParams[decode(match[1])] = decode(match[2]);
|
|
}
|
|
|
|
function pageY(elem)
|
|
{
|
|
return elem.offsetParent ? (elem.offsetTop + pageY(elem.offsetParent)) : elem.offsetTop;
|
|
}
|
|
|
|
function resizeIframe()
|
|
{
|
|
var height = document.documentElement.clientHeight;
|
|
height -= pageY(document.getElementById('origpage'));
|
|
height = (height < 0) ? 0 : height;
|
|
document.getElementById('origpage').style.height = height + 'px';
|
|
}
|
|
|
|
function setVisible(e, visible)
|
|
{
|
|
var elem = document.getElementById(e);
|
|
if (!elem) return;
|
|
|
|
if (visible)
|
|
{
|
|
elem.style.display = "block";
|
|
}
|
|
else
|
|
{
|
|
elem.style.display = "none";
|
|
}
|
|
}
|
|
|
|
function updateVisibility(visible)
|
|
{
|
|
setVisible("opentoolbar", !visible);
|
|
setVisible("singtoolbar", visible);
|
|
resizeIframe();
|
|
}
|
|
|
|
function toggleToolbar()
|
|
{
|
|
toolbarShown = !toolbarShown;
|
|
updateVisibility(toolbarShown);
|
|
}
|
|
|
|
function cleanVersion(v)
|
|
{
|
|
return v.toString()
|
|
.replace(/^.*?(\d)/g, "$1") // Get rid of everything before the first digit
|
|
.replace(/(.*\d).*/g, "$1") // Get rid of everything after the lst digit
|
|
.replace(/[^\d]+/g, ".") // Convert all non-digits to dots
|
|
}
|
|
|
|
function compareVersion(a, b)
|
|
{
|
|
if (a === b)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
var a_components = cleanVersion(a).split(".");
|
|
var b_components = cleanVersion(b).split(".");
|
|
|
|
var len = Math.min(a_components.length, b_components.length);
|
|
|
|
// loop while the components are equal
|
|
for (var i = 0; i < len; i++)
|
|
{
|
|
// A bigger than B
|
|
if (parseInt(a_components[i]) > parseInt(b_components[i]))
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
// B bigger than A
|
|
if (parseInt(a_components[i]) < parseInt(b_components[i]))
|
|
{
|
|
return -1;
|
|
}
|
|
}
|
|
|
|
// If one's a prefix of the other, the longer one is greater.
|
|
if (a_components.length > b_components.length)
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
if (a_components.length < b_components.length)
|
|
{
|
|
return -1;
|
|
}
|
|
|
|
// Otherwise they are the same.
|
|
return 0;
|
|
}
|
|
|
|
// Main
|
|
window.onload = function()
|
|
{
|
|
parseUrlParams();
|
|
if (!urlParams["original_page"] || !urlParams["version"]) return;
|
|
window.onresize = resizeIframe;
|
|
document.getElementById('origpage').onload = resizeIframe;
|
|
document.getElementById('origpage').setAttribute("src", urlParams["original_page"]);
|
|
document.getElementById('closetoolbar').onclick = toggleToolbar;
|
|
document.getElementById('opentoolbar').onclick = toggleToolbar;
|
|
|
|
// Current version is newer that user's
|
|
if (compareVersion(current_version, urlParams["version"]) > 0)
|
|
{
|
|
toolbarShown = true;
|
|
setVisible("updateavail", true);
|
|
}
|
|
// User is on Singularity Alpha older than minimum recommended
|
|
else if (urlParams["channel"] == "Singularity Alpha" && compareVersion(min_alpha, urlParams["version"]) > 0)
|
|
{
|
|
toolbarShown = true;
|
|
setVisible("alpha_updateavail", true);
|
|
}
|
|
else if (urlParams["channel"] == "Singularity Zero" && compareVersion("1.8.5 (6068)", urlParams["version"]) > 0)
|
|
{
|
|
toolbarShown = true;
|
|
if (urlParams["lang"] == "fr")
|
|
setVisible("zero_updatetoalpha_fr", true);
|
|
else
|
|
setVisible("zero_updatetoalpha", true);
|
|
}
|
|
else
|
|
{
|
|
toolbarShown = false;
|
|
setVisible("uptodate", true);
|
|
}
|
|
|
|
updateVisibility(toolbarShown);
|
|
}
|
|
//]]>
|
|
</script>
|
|
<style media="screen" type="text/css">
|
|
html, body
|
|
{
|
|
font-family: Arial, sans-serif;
|
|
font-size: 14px;
|
|
color: #bbb;
|
|
background-color: #212121;
|
|
height: 100%;
|
|
width: 100%;
|
|
margin: 0;
|
|
padding: 0;
|
|
overflow: hidden;
|
|
}
|
|
|
|
a
|
|
{
|
|
color: #fff;
|
|
text-decoration: none;
|
|
}
|
|
a:hover
|
|
{
|
|
text-decoration: underline;
|
|
}
|
|
|
|
#origpage
|
|
{
|
|
height: 100%;
|
|
width: 100%;
|
|
margin: 0;
|
|
padding: 0;
|
|
border: none;
|
|
}
|
|
|
|
#singtoolbar
|
|
{
|
|
display: none;
|
|
margin-top: 25px;
|
|
}
|
|
#opentoolbar
|
|
{
|
|
position: absolute;
|
|
top: 0px;
|
|
right: 0px;
|
|
display: none;
|
|
}
|
|
#closetoolbar
|
|
{
|
|
position: absolute;
|
|
top: 0px;
|
|
right: 0px;
|
|
margin-top: 19px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="opentoolbar" title="Version check"><img src="down_arrow.png" /></div>
|
|
<div id="singtoolbar">
|
|
<div id="closetoolbar"><img src="x.png"/></div>
|
|
<div id="toolbarcontent" style="margin: 0px 4px 10px 12px;">
|
|
<div id="uptodate" style="display: none;">Your Singularity is up to date.</div>
|
|
<div id="updateavail" style="display: none;">
|
|
<img src="alert.png" style="vertical-align: bottom;" />
|
|
An updated version of Singularity is available. Please visit the
|
|
<a href="http://www.singularityviewer.org/" target="_external">Singularity main site</a>
|
|
to download it.
|
|
</div>
|
|
<div id="alpha_updateavail" style="display: none;">
|
|
<img src="alert.png" style="vertical-align: bottom;" />
|
|
An updated version of Singularity Alpha is available. Please visit the
|
|
<a href="http://alpha.singularityviewer.org/alpha/" target="_external">Singularity Alpha builds page</a>
|
|
to download it.
|
|
</div>
|
|
<div id="zero_updatetoalpha" style="display: none;">
|
|
<img src="alert.png" style="vertical-align: bottom;" />
|
|
Thank you kindly, for testing Singularity Zero, please migrate to Singularity alpha from the
|
|
<a href="http://alpha.singularityviewer.org/alpha/" target="_external">alpha builds page</a>
|
|
~
|
|
</div>
|
|
<div id="zero_updatetoalpha_fr" style="display: none;">
|
|
<img src="alert.png" style="vertical-align: bottom;" />
|
|
Nous remercions, grandement les gens qui ont aidé en testant la zero, maintenant elle est basculée sur une alpha:
|
|
<a href="http://alpha.singularityviewer.org/alpha/" target="_external">alpha builds page</a>
|
|
~
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<iframe id="origpage"/>
|
|
</body>
|
|
</html>
|