fix: javascript-enabled click&buy didnt recognize deposit or item+deposit buttons

This commit is contained in:
Konrad Mohrfeldt 2011-10-21 00:03:55 +02:00
parent f2ad3bb89b
commit bc18ed6661
1 changed files with 13 additions and 4 deletions

View File

@ -9,10 +9,12 @@ jQuery(document).ready(function($) {
var lock = false;
var items = [false];
var buyItem = function(id, callback) {
$.post("/api2/buyable/item/" + id, {
var buyItem = function(id, callback, options) {
if(typeof options === "undefined") options = {};
$.post("/api2/buyable/item/" + id, $.extend({
"POSTDATA": "Y U NO CANT BE EMPTY"
}, callback);
}, options), callback);
};
$.extend($.gritter.options, {
@ -35,6 +37,13 @@ jQuery(document).ready(function($) {
var id = dataContainer.attr("data-id");
var name = dataContainer.attr("data-name");
var image = dataContainer.attr("data-image");
var options = {};
if(button.hasClass("inclDeposit")) {
options.deposit = 2;
} else if(button.hasClass("onlyDeposit")) {
options.deposit = 1;
}
buyItem(id, function(data, status) {
$.gritter.add({
@ -44,7 +53,7 @@ jQuery(document).ready(function($) {
});
dataContainer.children().removeClass("locked");
});
}, options);
});
$.getJSON("/api2/buyable/item", function(data) {