Browse Source

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

master
Konrad Mohrfeldt 11 years ago
parent
commit
bc18ed6661
  1. 17
      k4ever/media/js/k4ever.js

17
k4ever/media/js/k4ever.js

@ -9,10 +9,12 @@ jQuery(document).ready(function($) { @@ -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($) { @@ -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($) { @@ -44,7 +53,7 @@ jQuery(document).ready(function($) {
});
dataContainer.children().removeClass("locked");
});
}, options);
});
$.getJSON("/api2/buyable/item", function(data) {

Loading…
Cancel
Save