fix: javascript-enabled click&buy didnt recognize deposit or item+deposit buttons
This commit is contained in:
parent
f2ad3bb89b
commit
bc18ed6661
|
@ -9,10 +9,12 @@ jQuery(document).ready(function($) {
|
||||||
var lock = false;
|
var lock = false;
|
||||||
var items = [false];
|
var items = [false];
|
||||||
|
|
||||||
var buyItem = function(id, callback) {
|
var buyItem = function(id, callback, options) {
|
||||||
$.post("/api2/buyable/item/" + id, {
|
if(typeof options === "undefined") options = {};
|
||||||
|
|
||||||
|
$.post("/api2/buyable/item/" + id, $.extend({
|
||||||
"POSTDATA": "Y U NO CANT BE EMPTY"
|
"POSTDATA": "Y U NO CANT BE EMPTY"
|
||||||
}, callback);
|
}, options), callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
$.extend($.gritter.options, {
|
$.extend($.gritter.options, {
|
||||||
|
@ -35,6 +37,13 @@ jQuery(document).ready(function($) {
|
||||||
var id = dataContainer.attr("data-id");
|
var id = dataContainer.attr("data-id");
|
||||||
var name = dataContainer.attr("data-name");
|
var name = dataContainer.attr("data-name");
|
||||||
var image = dataContainer.attr("data-image");
|
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) {
|
buyItem(id, function(data, status) {
|
||||||
$.gritter.add({
|
$.gritter.add({
|
||||||
|
@ -44,7 +53,7 @@ jQuery(document).ready(function($) {
|
||||||
});
|
});
|
||||||
|
|
||||||
dataContainer.children().removeClass("locked");
|
dataContainer.children().removeClass("locked");
|
||||||
});
|
}, options);
|
||||||
});
|
});
|
||||||
|
|
||||||
$.getJSON("/api2/buyable/item", function(data) {
|
$.getJSON("/api2/buyable/item", function(data) {
|
||||||
|
|
Loading…
Reference in New Issue