remove api, images are now local
This commit is contained in:
+7
-18
@@ -40,35 +40,25 @@ jQuery(function($) {
|
||||
console.log("testing function")
|
||||
console.log(chckGender());
|
||||
|
||||
|
||||
loadapi();
|
||||
function getData(gender) {
|
||||
let malecnt = chckGender()[0];
|
||||
let femalecnt = chckGender()[1];
|
||||
let x = (Math.random() * 99).toFixed(0);
|
||||
if (gender == "male")
|
||||
{
|
||||
return $.ajax({
|
||||
url: 'https://randomuser.me/api/?inc=picture&results=' + malecnt + '&gender=male',
|
||||
dataType: 'json',
|
||||
});
|
||||
return "assets/img/pfp/m/" + x + ".jpg"
|
||||
}
|
||||
else if (gender == "female")
|
||||
{
|
||||
return $.ajax({
|
||||
url: 'https://randomuser.me/api/?inc=picture&results=' + femalecnt + '&gender=female',
|
||||
dataType: 'json',
|
||||
});
|
||||
return "assets/img/pfp/f/" + x + ".jpg"
|
||||
}
|
||||
};
|
||||
|
||||
async function loadapi() {
|
||||
if (equLoaded == 0){
|
||||
try {
|
||||
const resMen = await getData('male');
|
||||
const resWoman = await getData('female');
|
||||
console.log(resMen);
|
||||
console.log(resWoman);
|
||||
picurlWom = resWoman;
|
||||
picurlMen = resMen;
|
||||
equipeMain();
|
||||
} catch(err) {
|
||||
console.log(err);
|
||||
@@ -159,12 +149,11 @@ jQuery(function($) {
|
||||
nomdesc = equipeText(item);
|
||||
console.log(nomdesc[0]);
|
||||
console.log(nomdesc[1]);
|
||||
if (nomdesc[1]){picurl = picurlWom;countFemale++;count = countFemale;console.log(countFemale);}
|
||||
else{picurl = picurlMen;countMale++;count = countMale;console.log(countMale);};
|
||||
if (nomdesc[1]){picurl = getData('female');countFemale++;count = countFemale;console.log(countFemale);}
|
||||
else{picurl = getData('male');countMale++;count = countMale;console.log(countMale);};
|
||||
try {
|
||||
console.log(picurl);
|
||||
console.log(picurl.results[count].picture.large);
|
||||
body += "<tr><td><div id='playerwindow' class='window' style='margin: auto;'><div class='title-bar' style='padding-top: 15px; padding-bottom: 15px;'><div id='title-bar-xp'class='title-bar-text'> " + nomdesc[0] + "</div></div><div class='window-body'><img src='" + picurl.results[count].picture.large.toString() + "'></div></div></td><td style='padding-top: 3%;'><div id='playerwindow' class='window'><div class='title-bar'style='padding-top: 15px; padding-bottom: 15px;'><div id='title-bar-xp'class='title-bar-text'>Meaculpa.mpeg</div><div class='title-bar-controls'><button aria-label='Close'></button></div></div><div class='window-body'>" + nomdesc[2] + "</td></div></div></tr>";
|
||||
body += "<tr><td><div id='playerwindow' class='window' style='margin: auto;'><div class='title-bar' style='padding-top: 15px; padding-bottom: 15px;'><div id='title-bar-xp'class='title-bar-text'> " + nomdesc[0] + "</div></div><div class='window-body'><img src='" + picurl.toString() + "'></div></div></td><td style='padding-top: 3%;'><div id='playerwindow' class='window'><div class='title-bar'style='padding-top: 15px; padding-bottom: 15px;'><div id='title-bar-xp'class='title-bar-text'>Meaculpa.mpeg</div><div class='title-bar-controls'><button aria-label='Close'></button></div></div><div class='window-body'>" + nomdesc[2] + "</td></div></div></tr>";
|
||||
apiLoaded = 1;
|
||||
equLoaded = 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user