Fixing whitespace conformity in Engine.js

This commit is contained in:
Travis Weston
2014-07-12 23:40:15 -04:00
parent b7a2c29aa0
commit 8cf3ab3dc9
+36 -30
View File
@@ -190,14 +190,11 @@
}, },
browserValid: function() { browserValid: function() {
return location.search.indexOf('ignorebrowser=true') >= 0 || ( return ( location.search.indexOf( 'ignorebrowser=true' ) >= 0 || ( typeof Storage != 'undefined' && !oldIE ) );
typeof Storage != 'undefined' &&
!oldIE);
}, },
isMobile: function() { isMobile: function() {
return location.search.indexOf('ignorebrowser=true') < 0 && return ( location.search.indexOf( 'ignorebrowser=true' ) < 0 && /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test( navigator.userAgent ) );
/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent);
}, },
saveGame: function() { saveGame: function() {
@@ -242,7 +239,9 @@
}, },
'import': { 'import': {
text: _('import'), text: _('import'),
nextScene: {1: 'confirm'}, nextScene: {
1: 'confirm'
},
}, },
'cancel': { 'cancel': {
text: _('cancel'), text: _('cancel'),
@@ -251,9 +250,11 @@
} }
}, },
'confirm': { 'confirm': {
text: [_('are you sure?'), text: [
_('are you sure?'),
_('if the code is invalid, all data will be lost.'), _('if the code is invalid, all data will be lost.'),
_('this is irreversible.')], _('this is irreversible.')
],
buttons: { buttons: {
'yes': { 'yes': {
text: _('yes'), text: _('yes'),
@@ -267,7 +268,9 @@
} }
}, },
'inputImport': { 'inputImport': {
text: [_('put the save code here.')], text: [
_('put the save code here.')
],
textarea: '', textarea: '',
buttons: { buttons: {
'okay': { 'okay': {
@@ -383,17 +386,17 @@
}, },
'twitter': { 'twitter': {
text: _('twitter'), text: _('twitter'),
nextScene: 'end',
onChoose: function() { onChoose: function() {
window.open('https://twitter.com/intent/tweet?text=A%20Dark%20Room&url=' + Engine.SITE_URL, 'sharer', 'width=660,height=260,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no'); window.open('https://twitter.com/intent/tweet?text=A%20Dark%20Room&url=' + Engine.SITE_URL, 'sharer', 'width=660,height=260,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no');
}, }
nextScene: 'end'
}, },
'reddit': { 'reddit': {
text: _('reddit'), text: _('reddit'),
nextScene: 'end',
onChoose: function() { onChoose: function() {
window.open('http://www.reddit.com/submit?url=' + Engine.SITE_URL, 'sharer', 'width=960,height=700,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no'); window.open('http://www.reddit.com/submit?url=' + Engine.SITE_URL, 'sharer', 'width=960,height=700,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no');
}, }
nextScene: 'end'
}, },
'close': { 'close': {
text: _('close'), text: _('close'),
@@ -402,7 +405,10 @@
} }
} }
} }
}, {width: '400px'}); },
{
width: '400px'
});
}, },
findStylesheet: function(title) { findStylesheet: function(title) {
@@ -417,9 +423,7 @@
isLightsOff: function() { isLightsOff: function() {
var darkCss = Engine.findStylesheet('darkenLights'); var darkCss = Engine.findStylesheet('darkenLights');
if (darkCss != null) { if ( darkCss != null && !darkCss.disabled ) {
if (darkCss.disabled)
return false;
return true; return true;
} }
return false; return false;
@@ -431,12 +435,10 @@
$('head').append('<link rel="stylesheet" href="css/dark.css" type="text/css" title="darkenLights" />'); $('head').append('<link rel="stylesheet" href="css/dark.css" type="text/css" title="darkenLights" />');
Engine.turnLightsOff; Engine.turnLightsOff;
$('.lightsOff').text(_('lights on.')); $('.lightsOff').text(_('lights on.'));
} } else if (darkCss.disabled) {
else if (darkCss.disabled) {
darkCss.disabled = false; darkCss.disabled = false;
$('.lightsOff').text(_('lights on.')); $('.lightsOff').text(_('lights on.'));
} } else {
else {
$("#darkenLights").attr("disabled", "disabled"); $("#darkenLights").attr("disabled", "disabled");
darkCss.disabled = true; darkCss.disabled = true;
$('.lightsOff').text(_('lights off.')); $('.lightsOff').text(_('lights off.'));
@@ -486,15 +488,15 @@
$('div#weapons').animate({opacity: 1}, 300); $('div#weapons').animate({opacity: 1}, 300);
} }
Notifications.printQueue(module); Notifications.printQueue(module);
} }
}, },
// Move the stores panel beneath top_container (or to top: 0px if top_container /* Move the stores panel beneath top_container (or to top: 0px if top_container
// either hasn't been filled in or is null) using transition_diff to sync with * either hasn't been filled in or is null) using transition_diff to sync with
// the animation in Engine.travelTo(). * the animation in Engine.travelTo().
*/
moveStoresView: function(top_container, transition_diff) { moveStoresView: function(top_container, transition_diff) {
var stores = $('#storesContainer'); var stores = $('#storesContainer');
@@ -510,8 +512,13 @@
stores.animate({top: '0px'}, {queue: false, duration: 300 * transition_diff}); stores.animate({top: '0px'}, {queue: false, duration: 300 * transition_diff});
} }
else { else {
stores.animate({top: top_container.height() + 26 + 'px'}, stores.animate({
{queue: false, duration: 300 * transition_diff}); top: top_container.height() + 26 + 'px'
},
{
queue: false,
duration: 300 * transition_diff
});
} }
}, },
@@ -655,8 +662,7 @@
//create jQuery Callbacks() to handle object events //create jQuery Callbacks() to handle object events
$.Dispatch = function( id ) { $.Dispatch = function( id ) {
var callbacks, var callbacks, topic = id && Engine.topics[ id ];
topic = id && Engine.topics[ id ];
if ( !topic ) { if ( !topic ) {
callbacks = jQuery.Callbacks(); callbacks = jQuery.Callbacks();
topic = { topic = {