Login page chacks version, provides passthrough for grid splash page
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
*~
|
||||||
|
*.bak
|
||||||
13
README.md
13
README.md
@@ -1,4 +1,11 @@
|
|||||||
login-page
|
Singularity login page
|
||||||
==========
|
======================
|
||||||
|
|
||||||
Source of the Singularity's login panel splash page
|
Source of the Singularity's login panel splash page.
|
||||||
|
In order to change the version update notifications to the users
|
||||||
|
change line
|
||||||
|
|
||||||
|
var current_version = "1.8.0 (4114)";
|
||||||
|
|
||||||
|
to whichever latest version is available on the main site
|
||||||
|
<http://www.singularityviewer.org/>
|
||||||
BIN
down_arrow.png
Normal file
BIN
down_arrow.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.0 KiB |
228
index.html
Normal file
228
index.html
Normal file
@@ -0,0 +1,228 @@
|
|||||||
|
<!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.0 (4114)";
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Main functionality (no need to edit anything below to udpate the version)
|
||||||
|
*/
|
||||||
|
|
||||||
|
var toolbarShown = false;
|
||||||
|
var user_version = getParameterByName("version");
|
||||||
|
var user_grid = getParameterByName("grid");
|
||||||
|
|
||||||
|
function getParameterByName(name)
|
||||||
|
{
|
||||||
|
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
|
||||||
|
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
|
||||||
|
results = regex.exec(location.search);
|
||||||
|
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
|
||||||
|
}
|
||||||
|
|
||||||
|
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 compareVersioen(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()
|
||||||
|
{
|
||||||
|
document.getElementById('origpage').onload = function() {
|
||||||
|
resizeIframe();
|
||||||
|
};
|
||||||
|
|
||||||
|
document.getElementById('origpage').setAttribute("src", getParameterByName("original_page"));
|
||||||
|
|
||||||
|
document.getElementById('closetoolbar').onclick = function() {
|
||||||
|
toggleToolbar();
|
||||||
|
};
|
||||||
|
document.getElementById('opentoolbar').onclick = toggleToolbar;
|
||||||
|
|
||||||
|
// Current version is newer that what user's
|
||||||
|
if (compareVersioen(current_version, user_version) == 1)
|
||||||
|
{
|
||||||
|
toolbarShown = true;
|
||||||
|
setVisible("updateavail", true);
|
||||||
|
setVisible("uptodate", false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
toolbarShown = false;
|
||||||
|
setVisible("updateavail", false);
|
||||||
|
setVisible("uptodate", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateVisibility(toolbarShown);
|
||||||
|
window.onresize = resizeIframe;
|
||||||
|
}
|
||||||
|
//]]>
|
||||||
|
</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: block;">
|
||||||
|
<img src="alert.png" style="vertical-align: bottom;" />
|
||||||
|
An updated version of Singularity is availabe. Please visit the
|
||||||
|
<a href="http://www.singularityviewer.org/">Singularity main site</a>
|
||||||
|
to download it.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<iframe id="origpage"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user