Skip to content

Commit

Permalink
Update Fallen_London_Contacts_Favours.user.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Laurvin authored Nov 4, 2018
1 parent 83c2cf9 commit 1ee2384
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions Fallen_London_Contacts_Favours.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// @include https://fallenlondon.com/*
// @include https://www.fallenlondon.com/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js
// @grant GM_xmlhttpRequest
// @grant none
// @run-at document-idle
// ==/UserScript==

Expand Down Expand Up @@ -66,16 +66,16 @@ function GetFavors()
{
var access_token = localStorage.getItem("access_token");

GM_xmlhttpRequest({
method: 'GET',
url: 'https://api.fallenlondon.com/api/character/myself',
headers: {
$.ajax({
method: 'GET',
url: 'https://api.fallenlondon.com/api/character/myself',
headers: {
"authorization": "Bearer " + access_token,
"accept": "application/json, text/plain, */*"
},
timeout: 2000,
onload: function(response) {
var MySelfData = JSON.parse(response.responseText);
timeout: 3000,
success: function(result) {
var MySelfData = result;

for (var i = 0; i < MySelfData.possessions.length; i++) {
if (MySelfData.possessions[i].name == "Contacts") {
Expand Down Expand Up @@ -103,15 +103,12 @@ function GetFavors()
event.preventDefault();
$('#FLCF').text("Loading Contact Favours...");
GetFavors();
});
},
onerror: function(response) {
alert('Failed loading.');
},
ontimeout: function(response) {
alert('Timed out loading.');
}
});
});
},
error: function(xhr, status, errorThrown) {
console.log("Error! " + status + errorThrown);
}
});
}

$(document).ready(function() {
Expand Down

0 comments on commit 1ee2384

Please sign in to comment.