Created
October 2, 2014 15:35
-
-
Save Saeven/e88f55208620176c9830 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("#sort").on('change', function( e ){ | |
var sort = $(this).val(); | |
$("div#collage").empty(); | |
$("div#collage").spin('show'); | |
$.get( '/redeem/sweeps/sort', { 'sort': sort }, function( data ){ | |
$("div#collage").html( data ); | |
Ladda.bind( 'button.ladda-button' ); | |
}); | |
}); | |
$(document).on( 'click', "button.buy-confirm", function( e ){ | |
var btn = Core.btn( e ); | |
var item_id = btn.attr('data-item-id'); | |
$.getJSON('/redeem/sweeps/buy/' + item_id, function( j ){ | |
if(j.success) | |
{ | |
$("#total_store_points").html(j.total_store_points); | |
$("div.itemtpl[data-id='" + item_id + "']").find('h5.total_purchased').html(j.total_entries); | |
btn.trigger('ladda-stop'); | |
var pdiv = btn.parents( 'div.buy_section'); | |
pdiv.find( 'div.second').fadeOut( function(){ | |
pdiv.find( 'div.first').fadeIn(); | |
}); | |
} | |
}); | |
}); | |
$(document).on( 'click', "button.buy-now", function( e ){ | |
var btn = Core.btn( e ); | |
var pdiv = btn.parents( 'div.buy_section'); | |
pdiv.find( 'div.first').fadeOut( function(){ | |
pdiv.find( 'div.second').fadeIn(); | |
}); | |
}); | |
$(document).on( 'click', "button.buy-cancel", function( e ){ | |
var btn = $(this); | |
var pdiv = btn.parents( 'div.buy_section'); | |
pdiv.find( 'div.second').fadeOut( function(){ | |
pdiv.find( 'div.first').fadeIn(); | |
}); | |
}); | |
$(document).on('click', "button.load-more", function( e ){ | |
var btn = Core.btn(e); | |
var page = btn.attr('data-page-id'); | |
$.get( '/redeem/sweeps/sort', { 'sort': $("#sort").val(), 'page': page }, function( data ){ | |
btn.trigger('ladda-stop'); | |
btn.parents( 'div.show_more').hide( function(){ | |
$("div#collage").append( data ) | |
}); | |
}); | |
}); | |
$(document).ready(function(){ | |
Ladda.bind( 'button.ladda-button' ); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment