Skip to content

Commit

Permalink
adding ability to get infinite lives and spins for free
Browse files Browse the repository at this point in the history
  • Loading branch information
jodoglevy committed Mar 1, 2015
1 parent 66e486f commit fe4a238
Show file tree
Hide file tree
Showing 31 changed files with 29,507 additions and 11 deletions.
55 changes: 55 additions & 0 deletions TriviaCrackNonGarglApi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
var TriviaCrackAPI = {};

TriviaCrackAPI.CreateUser = function (callback) {
var headers = {
"Accept": "application/json, text/javascript, */*; q=0.01",
"Content-Type": "application/json; charset=utf-8",
};

var data = {
email: "Trivia-Cracker-" + new Date().getTime() + "@gmail.com"
}

data = JSON.stringify(data);

$.ajax({
type: "POST",
headers: headers,
url: "https://api.preguntados.com/api/users",
data: data,
})
.always(function (response, error, request) {
callback(error, response, request)
});
}

TriviaCrackAPI.sendGift = function (fromTriviaCrackId, targetFacebookId, giftType, callback) {
// valid giftType values are "LIFE" and "EXTRA_SHOT"

var headers = {
"Accept": "application/json, text/javascript, */*; q=0.01",
"Content-Type": "application/json; charset=utf-8"//,
};

var data = {
"action": "SEND",
"items": [{
"type": giftType
}],
"receivers": [{
"facebook_id": targetFacebookId
}]
};

data = JSON.stringify(data);

$.ajax({
type: "POST",
headers: headers,
url: "https://api.preguntados.com/api/users/" + fromTriviaCrackId + "/gifts",
data: data
})
.always(function (response, error) {
callback(error, response)
});
}
11 changes: 11 additions & 0 deletions background.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,22 @@ function verifyLicense(callback) {
});
}

function sendGift(targetFacebookId, giftType, callback) {
TriviaCrackAPI.CreateUser(function(err, response) {
var fromTriviaCrackId = response.id;
TriviaCrackAPI.sendGift(fromTriviaCrackId, targetFacebookId, giftType, callback);
});
}

chrome.runtime.onMessage.addListener(
function(request, sender, sendResponse) {
if(request.verifyLicense) {
verifyLicense(sendResponse);
return true;
}
else if(request.sendGift) {
sendGift(request.targetFacebookId, request.giftType, sendResponse);
return true;
}
}
);
File renamed without changes
Binary file added images/app/triviaCrackerGiftButton.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions jqueryUI/jquery-1.11.1.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit fe4a238

Please sign in to comment.