mirror of
https://github.com/wassname/cardsforscience.git
synced 2026-06-27 17:29:55 +08:00
Add update notification
This commit is contained in:
+5
-1
@@ -72,7 +72,11 @@ h1 br {
|
||||
|
||||
#achievements-container .alert-text,
|
||||
#messages-container .alert-text {
|
||||
font-size: 14px; font-weight: bold;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
#achievements-container .alert-text {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#messages-container .btn {
|
||||
|
||||
+1
-1
@@ -210,7 +210,7 @@
|
||||
<script src="js/event.js"></script>
|
||||
<script src="js/detector.js"></script>
|
||||
<script src="js/achievements.js"></script>
|
||||
<script src="js/game.js"></script>
|
||||
<script src="js/ui.js"></script>
|
||||
<script src="js/game.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
var workers = GameObjects.workers;
|
||||
var upgrades = GameObjects.upgrades;
|
||||
|
||||
UI.validateVersion(lab.version);
|
||||
|
||||
achievements.addResearch(research);
|
||||
achievements.addWorkers(workers);
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ var GameObjects = (function() {
|
||||
/** Lab
|
||||
*/
|
||||
var labPrototype = {
|
||||
version: '0.2',
|
||||
name: 'My Awesome Lab',
|
||||
detector: {
|
||||
rate: 1
|
||||
|
||||
+2
-1
@@ -37,6 +37,7 @@ var Helpers = (function() {
|
||||
|
||||
return {
|
||||
loadFile: loadFile,
|
||||
formatNumberPostfix: formatNumberPostfix
|
||||
formatNumberPostfix: formatNumberPostfix,
|
||||
version: '0.2'
|
||||
};
|
||||
})();
|
||||
|
||||
@@ -51,6 +51,25 @@ var UI = (function () {
|
||||
}});
|
||||
}
|
||||
|
||||
var validateVersion = function(version) {
|
||||
if (version != Helpers.version) {
|
||||
var alert = '<div id="outofdate" class="alert alert-info alert-dismissible" role="alert">';
|
||||
alert += '<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>';
|
||||
alert += '<span class="glyphicon glyphicon-info-sign alert-glyph"></span> <span class="alert-text">Your saved state out of date. <a href="#"><strong>Restart</strong></a> to use latest version of the game.</span>';
|
||||
alert += '</div>';
|
||||
alert = $(alert);
|
||||
alert.find('a').click(function ()
|
||||
{
|
||||
if (window.confirm('Do you really want to restart the game? All progress will be lost.')) {
|
||||
ObjectStorage.clear();
|
||||
window.location.reload(true);
|
||||
}
|
||||
})
|
||||
|
||||
$('#messages-container').append(alert);
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof $.cookie('cookielaw') === 'undefined') {
|
||||
var alert = '<div id="cookielaw" class="alert alert-info" role="alert">';
|
||||
alert += '<button type="button" class="btn btn-primary">OK</button>';
|
||||
@@ -68,7 +87,8 @@ var UI = (function () {
|
||||
|
||||
return {
|
||||
showModal: showModal,
|
||||
showUpdateValue: showUpdateValue
|
||||
showUpdateValue: showUpdateValue,
|
||||
validateVersion: validateVersion
|
||||
}
|
||||
})();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user