Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
501 additions
and
489 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
$.ajax({ | ||
url: 'https://randomuser.me/api/?randomapi', | ||
dataType: 'json', | ||
success: function(data) { | ||
(function() { | ||
if (document.title.indexOf('home') !== -1) { | ||
var result = pegasus('https://randomuser.me/api/?randomapi'); | ||
result.then(function(data) { | ||
error(data); | ||
},function (data) { | ||
error(data); | ||
}); | ||
|
||
var error = function(data) { | ||
if (data['error']) { | ||
var _errorBanner = document.createElement('div'); | ||
_errorBanner.className = 'alert'; | ||
_errorBanner.innerHTML = 'API Status: OFFLINE. Please tweet us <a href="https://twitter.com/randomapi">@randomapi</a> if you are seeing this message.'; | ||
$('body').prepend(_errorBanner); | ||
_errorBanner.className = 'alert'; | ||
_errorBanner.innerHTML = 'API Status: OFFLINE. Please tweet us <a href="https://twitter.com/randomapi">@randomapi</a> if you are seeing this message.'; | ||
var body = document.getElementsByTagName('body')[0]; | ||
body.insertBefore(_errorBanner, body.firstChild); | ||
} | ||
}, | ||
error: function(data) { | ||
var _errorBanner = document.createElement('div'); | ||
_errorBanner.className = 'alert'; | ||
_errorBanner.innerHTML = 'API Status: OFFLINE. Please tweet us <a href="https://twitter.com/randomapi">@randomapi</a> if you are seeing this message.'; | ||
$('body').prepend(_errorBanner); | ||
} | ||
}); | ||
}; | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
(function() { | ||
domready(function() { | ||
if (window.location.href.indexOf('stats') !== -1) { | ||
new Highcharts.Chart({ | ||
chart: { | ||
renderTo: document.getElementById("charts") | ||
}, | ||
title: { | ||
text: '30 days', | ||
x: -20 //center | ||
}, | ||
xAxis: { | ||
title: { | ||
text: 'Date' | ||
}, | ||
categories: ["3.07", "3.08", "3.09", "3.10", "3.11", "3.12", "3.13", "3.14", "3.15", "3.16", "3.17", "3.18", "3.19", "3.20", "3.21", "3.22", "3.23", "3.24", "3.25", "3.26", "3.27", "3.28", "3.29", "3.30", "3.31", "4.01", "4.02", "4.03", "4.04"]}, | ||
yAxis: [{ | ||
min: 0, | ||
title: { | ||
text: 'Values' | ||
}, | ||
plotLines: [{ | ||
value: 0, | ||
width: 1, | ||
color: '#808080' | ||
}] | ||
}], | ||
legend: { | ||
layout: 'vertical', | ||
align: 'right', | ||
verticalAlign: 'middle', | ||
borderWidth: 0 | ||
}, | ||
series: [{ | ||
name: 'Total', | ||
data: [1279674, 1372594, 2946605, 2621451, 1972811, 1649625, 2038890, 1774476, 1735823, 1709348, 1406762, 1633831, 2662855, 1589869, 1599016, 1003070, 944028, 884739, 4232470, 6826524, 2572823, 5721567, 2655161, 788038, 633055, 566234, 254669, 290714, 371588], | ||
color: '#0F0' | ||
}], | ||
tooltip: { | ||
shared: true | ||
} | ||
}); | ||
} | ||
}); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,65 @@ | ||
$(document).ready(function(){ | ||
(function() { | ||
domready(function() { | ||
if (document.title.indexOf('Home') !== -1) { | ||
getNewUser(); | ||
|
||
api_url = 'https://randomuser.me/api/0.4/?randomapi'; | ||
var liList = Array.prototype.slice.call(document.getElementById("values_list").getElementsByTagName('li')); | ||
liList.forEach(function(el) { | ||
el.addEventListener('mouseover', function() { | ||
liList.forEach(function(el) { | ||
el.className = el.className.replace(/\bactive\b/,''); | ||
}); | ||
var item = this; | ||
item.className += ' active'; | ||
|
||
getNewUser(api_url); | ||
|
||
$('#values_list li').hover(function(){ | ||
$('#values_list li').removeClass('active'); | ||
var item = $(this); | ||
item.addClass('active'); | ||
$('#user_title').html(item.attr('data-title')); | ||
$('#user_value').html(item.attr('data-value')); | ||
document.getElementById('user_title').innerHTML = item.getAttribute('data-title'); | ||
document.getElementById('user_value').innerHTML = item.getAttribute('data-value'); | ||
|
||
if(item.attr('data-caps')){ | ||
$('#user_value').css({'text-transform': 'lowercase'}); | ||
if(item.getAttribute('data-caps')){ | ||
document.getElementById('user_value').style.textTransform = "lowercase"; | ||
} else { | ||
$('#user_value').css({'text-transform': 'capitalize'}); | ||
document.getElementById('user_value').style.textTransform = "capitalize"; | ||
} | ||
}); | ||
}); | ||
|
||
function getNewUser(location){ | ||
$.ajax({ | ||
url: location, | ||
dataType: 'json', | ||
success: function(data){ | ||
if(!data['error']){ | ||
var user = data.results[0].user; | ||
// Update to SSL picture | ||
user.picture = user.picture.replace('http://api.', 'https://'); | ||
user.picture = user.picture.replace('.me/', '.me/api/'); | ||
}); | ||
}); | ||
} | ||
}); | ||
})(); | ||
|
||
function getNewUser(){ | ||
var result = pegasus('https://randomuser.me/api/0.4/?randomapi'); | ||
|
||
result.then(function(data) { | ||
if(!data['error']){ | ||
var user = data.results[0].user; | ||
// Update to SSL picture | ||
user.picture = user.picture.replace('http://api.', 'https://'); | ||
user.picture = user.picture.replace('.me/', '.me/api/'); | ||
|
||
// Assign Data | ||
document.getElementById('user_photo').getElementsByTagName('img')[0].src = user.picture; | ||
|
||
// Assign Data | ||
$('#user_photo img').attr('src', user.picture.replace('portraits/', 'portraits/')); | ||
|
||
$('li[data-label="name"]').attr('data-value', user.name.first+' '+user.name.last); | ||
$('#user_value').html(user.name.first+' '+user.name.last); | ||
|
||
$('li[data-label="email"]').attr('data-value', user.email); | ||
|
||
var birthday = new Date(user.dob*1000); | ||
$('li[data-label="birthday"]').attr('data-value', birthday.getMonth()+1+'/'+(birthday.getDay()+1)+'/19'+birthday.getYear()); | ||
|
||
$('li[data-label="location"]').attr('data-value', user.location.street); | ||
$('li[data-label="phone"]').attr('data-value', user.cell); | ||
$('li[data-label="pass"]').attr('data-value', user.password); | ||
} else { | ||
// Error | ||
} | ||
setData('name', user.name.first+' '+user.name.last); | ||
|
||
document.getElementById('user_value').innerHTML = user.name.first+' '+user.name.last; | ||
|
||
setData('email', user.email); | ||
|
||
var birthday = new Date(user.dob*1000); | ||
setData('birthday', birthday.getMonth()+1+'/'+(birthday.getDay()+1)+'/19'+birthday.getYear()); | ||
setData('location', user.location.street); | ||
setData('phone', user.cell); | ||
setData('pass', user.password); | ||
} else { | ||
// Error | ||
} | ||
}); | ||
|
||
function setData(label, value) { | ||
var liList = Array.prototype.slice.call(document.getElementsByTagName('li')); | ||
|
||
liList.find(function(el) { | ||
return el.getAttribute('data-label') === label; | ||
}).setAttribute('data-value', value); | ||
} | ||
} |
Oops, something went wrong.