Skip to content

Commit

Permalink
This reverts commit 3df51c5.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomholland committed Jan 16, 2016
1 parent c901732 commit f1331c4
Showing 1 changed file with 3 additions and 23 deletions.
26 changes: 3 additions & 23 deletions www/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ var selectedFactionId = null;
var selectedWarbandId = null;
var selectedWarbandCharacterId = null;
var selectedScenarioId = null;
var scrollPositions = {};
scrollToPosition = false;

function htmlEncode(value){
return $('<div/>').text(value).html().replace(/\"/g, '&quot;');
Expand Down Expand Up @@ -41,19 +39,12 @@ function setContentScrollViewWrapperDimensions() {
}

function renderTemplate(templateId, templateData) {
if ($('.content-view .content-view-scroll-wrapper').length) {
scrollPositions[currentTemplateId] = $('.content-view .content-view-scroll-wrapper').scrollTop();
}
$('.content').empty().html(Mustache.render(staticData.templates[templateId], templateData));
setContentScrollViewWrapperDimensions();
currentTemplateId = templateId;
if (['warband_characters','warband_events','warband_terrain'].indexOf(currentTemplateId) >= 0) {
if (['warband_characters','warband_character_enhancements','warband_events','warband_terrain'].indexOf(templateId) >= 0) {
$('.warband-tabs-rice-wrapper .segmented-control').css('width', (contentViewWidth - 70)+'px'); // 5px left margin, 60px badge, 5px right margin
}
if (scrollToPosition && scrollPositions.hasOwnProperty(currentTemplateId)) {
$('.content-view .content-view-scroll-wrapper').scrollTop(scrollPositions[currentTemplateId]);
scrollToPosition = false;
}
currentTemplateId = templateId;
window.plugin.statusbarOverlay.hide();
addEventsToRenderedView();
}
Expand Down Expand Up @@ -143,7 +134,6 @@ function renderView(templateId, contentId) {
hideBackButton();
showAddButton();
renderTemplate(templateId, templateData);
return;
});
});
break;
Expand Down Expand Up @@ -183,7 +173,6 @@ function renderView(templateId, contentId) {
showBackButton();
showAddButton();
renderTemplate(templateId, templateData);
return;
});
});
break;
Expand All @@ -193,7 +182,6 @@ function renderView(templateId, contentId) {
showBackButton();
hideAddButton();
renderTemplate(templateId, templateData);
return;
});
break;
case 'warband_character_enhancements':
Expand All @@ -216,7 +204,6 @@ function renderView(templateId, contentId) {
showBackButton();
showAddButton();
renderTemplate(templateId, templateData);
return;
});
});
break;
Expand All @@ -226,7 +213,6 @@ function renderView(templateId, contentId) {
showBackButton();
hideAddButton();
renderTemplate(templateId, templateData);
return;
});
break;
case 'warband_events':
Expand All @@ -249,7 +235,6 @@ function renderView(templateId, contentId) {
showBackButton();
showAddButton();
renderTemplate(templateId, templateData);
return;
});
});
break;
Expand All @@ -259,7 +244,6 @@ function renderView(templateId, contentId) {
showBackButton();
hideAddButton();
renderTemplate(templateId, templateData);
return;
});
break;
case 'warband_terrain':
Expand All @@ -282,7 +266,6 @@ function renderView(templateId, contentId) {
showBackButton();
showAddButton();
renderTemplate(templateId, templateData);
return;
});
});
break;
Expand All @@ -292,7 +275,6 @@ function renderView(templateId, contentId) {
showBackButton();
hideAddButton();
renderTemplate(templateId, templateData);
return;
});
break;
case 'scenarios':
Expand Down Expand Up @@ -989,19 +971,17 @@ document.addEventListener('deviceready', function() {

$('#back').tap(function() {
blurFormElements();
scrollToPosition = true;
switch(currentTemplateId) {
case 'faction_characters':
renderView('factions', null);
return;
case 'character_cards':
if ($('nav').find('a.active').attr('data-template-id') === 'warbands') {
renderView('warband_characters', null);
return;
} else {
renderView('faction_characters', selectedFactionId);
return;
}
return;
case 'warband':
case 'warband_characters':
case 'warband_events':
Expand Down

0 comments on commit f1331c4

Please sign in to comment.