First commit

This commit is contained in:
Stephen McNabb 2014-04-20 13:53:25 -07:00
parent adc527f12c
commit 775b3f12e2
9 changed files with 3507 additions and 0 deletions

9
css/bootstrap-responsive.min.css vendored Normal file

File diff suppressed because one or more lines are too long

9
css/bootstrap.min.css vendored Normal file

File diff suppressed because one or more lines are too long

12
css/main.css Normal file
View File

@ -0,0 +1,12 @@
table { width: 100%; }
th { text-align: left;}
.table-striped tbody tr:nth-child(odd) td, .table-striped tbody tr:nth-child(odd) th { background-color: #E9E9E9;}
@media print {
body { color: #000; }
.navbar, #intro, input[type="checkbox"] { display: none; }
a { color: #000; text-decoration: underline; }
.tab-content > .tab-pane, .pill-content > .pill-pane { display: block; }
.tab-pane { page-break-after: always; }
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

2162
index.html Normal file

File diff suppressed because it is too large Load Diff

6
js/bootstrap.min.js vendored Normal file

File diff suppressed because one or more lines are too long

1143
js/jstorage.js Normal file

File diff suppressed because it is too large Load Diff

166
js/main.js Normal file
View File

@ -0,0 +1,166 @@
(function($) {
var defaultProfiles = {
'current': 'Default Profile',
'ds2_profiles': {
'Default Profile': {
checklistData: {}
}
}
};
var profiles = $.jStorage.get('ds2_profiles', defaultProfiles);
jQuery(document).ready(function($) {
// TODO Find a better way to do this in one pass
$('ul li li').each(function(index) {
if ($(this).attr('data-id')) {
addCheckbox(this);
}
});
$('ul li').each(function(index) {
if ($(this).attr('data-id')) {
addCheckbox(this);
}
});
populateProfiles();
$('input[type="checkbox"]').click(function() {
var id = $(this).attr('id');
var isChecked = profiles.ds2_profiles[profiles.current].checklistData[id] = $(this).prop('checked');
_gaq.push(['_trackEvent', 'Checkbox', (isChecked ? 'Check' : 'Uncheck'), id]);
$(this).parent().parent().find('li > label > input[type="checkbox"]').each(function() {
var id = $(this).attr('id');
profiles.ds2_profiles[profiles.current].checklistData[id] = isChecked;
$(this).prop('checked', isChecked);
});
$.jStorage.set('ds2_profiles', profiles);
});
$('#profiles').change(function(event) {
profiles.current = $(this).val();
$.jStorage.set('ds2_profiles', profiles);
populateChecklists();
_gaq.push(['_trackEvent', 'Profile', 'Change', profiles.current]);
});
$('#profileAdd').click(function() {
$('#profileModalTitle').html('Add Profile');
$('#profileModalName').val('');
$('#profileModalAdd').show();
$('#profileModalUpdate').hide();
$('#profileModalDelete').hide();
$('#profileModal').modal('show');
_gaq.push(['_trackEvent', 'Profile', 'Add']);
});
$('#profileEdit').click(function() {
$('#profileModalTitle').html('Edit Profile');
$('#profileModalName').val(profiles.current);
$('#profileModalAdd').hide();
$('#profileModalUpdate').show();
if (canDelete()) {
$('#profileModalDelete').show();
} else {
$('#profileModalDelete').hide();
}
$('#profileModal').modal('show');
_gaq.push(['_trackEvent', 'Profile', 'Edit', profiles.current]);
});
$('#profileModalAdd').click(function(event) {
event.preventDefault();
var profile = $.trim($('#profileModalName').val());
if (profile.length > 0) {
if (typeof profiles.ds2_profiles[profile] == 'undefined') {
profiles.ds2_profiles[profile] = { checklistData: {} };
}
profiles.current = profile;
$.jStorage.set('ds2_profiles', profiles);
populateProfiles();
populateChecklists();
}
$('#profileModal').modal('hide');
_gaq.push(['_trackEvent', 'Profile', 'Create', profile]);
});
$('#profileModalUpdate').click(function(event) {
event.preventDefault();
var newName = $.trim($('#profileModalName').val());
if (newName.length > 0 && newName != profiles.current) {
profiles.ds2_profiles[newName] = profiles.ds2_profiles[profiles.current];
delete profiles.ds2_profiles[profiles.current];
profiles.current = newName;
$.jStorage.set('ds2_profiles', profiles);
populateProfiles();
}
$('#profileModal').modal('hide');
_gaq.push(['_trackEvent', 'Profile', 'Update', profile]);
});
$('#profileModalDelete').click(function(event) {
event.preventDefault();
if (!canDelete()) {
return;
}
if (!confirm('Are you sure?')) {
return;
}
delete profiles.ds2_profiles[profiles.current];
profiles.current = getFirstProfile();
$.jStorage.set('ds2_profiles', profiles);
populateProfiles();
populateChecklists();
$('#profileModal').modal('hide');
_gaq.push(['_trackEvent', 'Profile', 'Delete']);
});
$('#profileModalClose').click(function(event) {
event.preventDefault();
$('#profileModal').modal('hide');
_gaq.push(['_trackEvent', 'Profile', 'Close']);
});
});
function populateProfiles() {
$('#profiles').empty();
$.each(profiles.ds2_profiles, function(index, value) {
$('#profiles').append($("<option></option>").attr('value', index).text(index));
});
$('#profiles').val(profiles.current);
}
function populateChecklists() {
$('input[type="checkbox"]').prop('checked', false);
$.each(profiles.ds2_profiles[profiles.current].checklistData, function(index, value) {
$('#' + index).prop('checked', value);
});
}
function addCheckbox(el) {
//console.log($(el).attr('data-id'));
var lines = $(el).html().split('\n');
lines[0] = '<label class="checkbox"><input type="checkbox" id="' + $(el).attr('data-id') + '">' + lines[0] + '</label>';
$(el).html(lines.join('\n'));
if (profiles.ds2_profiles[profiles.current].checklistData[$(el).attr('data-id')] == true) {
$('#' + $(el).attr('data-id')).prop('checked', true);
}
}
function canDelete() {
var count = 0;
$.each(profiles.ds2_profiles, function(index, value) {
count++;
});
return (count > 1);
}
function getFirstProfile() {
for (var profile in profiles.ds2_profiles) {
return profile;
}
}
})( jQuery );