Finished up project - with bonus: card filters!
This commit is contained in:
1
static/fastclick.min.js
vendored
Normal file
1
static/fastclick.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
57
static/general.js
Normal file
57
static/general.js
Normal file
@@ -0,0 +1,57 @@
|
||||
$(document).ready(function(){
|
||||
if ($('.memorizePanel').length != 0) {
|
||||
|
||||
$('.flipCard').click(function(){
|
||||
$('.cardFront').hide();
|
||||
$('.cardBack').show();
|
||||
});
|
||||
}
|
||||
|
||||
if ($('.cardForm').length != 0) {
|
||||
|
||||
$('.cardForm').submit(function(){
|
||||
|
||||
var frontTrim = $.trim($('#front').val());
|
||||
$('#front').val(frontTrim);
|
||||
var backTrim = $.trim($('#back').val());
|
||||
$('#back').val(backTrim);
|
||||
|
||||
if (! $('#front').val() || ! $('#back').val()) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if ($('.editPanel').length != 0) {
|
||||
|
||||
function checkit() {
|
||||
var checkedVal = $('input[name=type]:checked').val();
|
||||
if (checkedVal === undefined) {
|
||||
// hide the fields
|
||||
$('.fieldFront').hide();
|
||||
$('.fieldBack').hide();
|
||||
$('.saveButton').hide();
|
||||
} else {
|
||||
$('.toggleButton').removeClass('toggleSelected');
|
||||
$(this).addClass('toggleSelected');
|
||||
|
||||
if (checkedVal == '1') {
|
||||
$('textarea[name=back]').attr('rows', 5);
|
||||
} else {
|
||||
$('textarea[name=back]').attr('rows', 12);
|
||||
}
|
||||
|
||||
$('.fieldFront').show();
|
||||
$('.fieldBack').show();
|
||||
$('.saveButton').show();
|
||||
}
|
||||
}
|
||||
|
||||
$('.toggleButton').click(checkit);
|
||||
|
||||
checkit();
|
||||
}
|
||||
|
||||
// to remove the short delay on click on touch devices
|
||||
FastClick.attach(document.body);
|
||||
});
|
||||
@@ -5,4 +5,46 @@
|
||||
|
||||
textarea {
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
.cardContent h4 {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.alignContainer {
|
||||
display: table;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.alignMiddle {
|
||||
height: 20em;
|
||||
display: table-cell;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.cardBack {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.largerText {
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
|
||||
/* disables collapsing header menu */
|
||||
|
||||
.navbar-collapse.collapse {
|
||||
display: block!important;
|
||||
}
|
||||
|
||||
.navbar-nav>li, .navbar-nav {
|
||||
float: left !important;
|
||||
}
|
||||
|
||||
.navbar-nav.navbar-right:last-child {
|
||||
margin-right: 0 !important;
|
||||
}
|
||||
|
||||
.navbar-right {
|
||||
float: right!important;
|
||||
}
|
||||
Reference in New Issue
Block a user