/* Author: Noah Gonzales // http://theyoungamerica.com*/
$(function(){
/*
France, French Benelux (as defined below), Dutch Benelux (as defined below), Spain, Portugal, Andorra, Eastern Europe (as defined below) and Asia (as defined below).
Benelux shall mean Belgium, The Netherlands and Luxembourg.
Eastern Europe shall mean Albania, Bosnia & Herzegovina, Bulgaria, the Czech Republic, Greece, Hungary, Liechtenstein, Macedonia, Malta, Moldova, Romania, Poland, Slovakia, Slovenia and Turkey.
Asia shall mean Afghanistan, Bangladesh, Bhutan, Brunei, Cambodia/Kampuchea, China, East Timor, Hong Kong, Indonesia, Kazakhstan, Kyrgyzstan, Laos, Macau, Malaysia, Maldives, Mongolia, Myanmar/Burma, North Korea, Pakistan, Philippines, Singapore, South Korea, Sri Lanka, Taiwan, Tajikistan, Thailand, Tibet, Turkmenistan, Uzbekistan and Vietnam.
France: FR
French Benelux: BE, NL, LU
Dutch Benelux: ??
Spain: ES
Portugal: PT
Andorra: AD
Eastern Europe: AL, BA, BG, CZ, GR, HU, LI, MK, MT, MD, RO, PL, SK, SI, TR
Asia: AF, BD, BT, BN, KH, CN, TP, HK, ID, KZ, KG, LA, MO, MY, MV, MN, MM, BU, KP, PK, PH, SG, KR, LK, TW, TJ, TH, TB, TK, UZ,
*/
// DEV (for now)
if ($("#watch-now").hasClass("vhx")){
if ($.inArray(geoip_country_code(), ['FR', 'BE','NL','LU','ES','PT','AD','AL','BA', 'BG', 'CZ', 'GR', 'HU', 'LI', 'MK', 'MT', 'MD', 'RO', 'PL', 'SK', 'SI', 'TR', 'AF', 'BD', 'BT', 'BN', 'KH', 'CN', 'TP', 'HK', 'ID', 'KZ', 'KG', 'LA', 'MO', 'MY', 'MV', 'MN', 'MM', 'BU', 'KP', 'PK', 'PH', 'SG', 'KR', 'LK', 'TW', 'TJ', 'TH', 'TB', 'TK', 'UZ', 'VT']) === -1) {
$("#vhxbtn").show();
} else {
$("#vhxbtn").remove();
}
}
var
insta_container = $(".instagram")
, insta_next_url
$('a').click( function() {
$.scrollTo(this.hash,300)
})
insta_container
.instagram({
hash: 'iamnotahipster'
, clientId: '9fe4f15be0674c179490cd717748612d'
, show : 18
, onComplete : function (data) {
insta_next_url = data.pagination.next_url
}
})
$('#insta-more').live('click', function(e){
var
button = $(this)
, text = button.text()
button.text('Getting Photos')
insta_container.instagram({
next_url : insta_next_url
, show : 18
, onComplete : function(data) {
insta_next_url = data.pagination.next_url
button.text(text)
}
})
})
// Float Nav
var top = $('#nav-float').offset().top - parseFloat($('#nav-float').css('marginTop').replace(/auto/, 0));
$(window).scroll(function (event) {
// what the y position of the scroll is
var y = $(this).scrollTop();
// whether that's below the form
if (y >= top) {
// if so, ad the fixed class
$('#nav-float').addClass('fixed');
} else {
// otherwise remove it
$('#nav-float').removeClass('fixed');
}
});
//Twitter Feed
// set your twitter id
var user = 'clarkemakesart';
// using jquery built in get json method with twitter api, return only one result
$.getJSON('http://twitter.com/statuses/user_timeline.json?screen_name=' + user + '&count=1&callback=?', function(data) {
// result returned
var tweet = data[0].text;
// process links and reply
tweet = tweet.replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig, function(url) {
return ''+url+'';
}).replace(/B@([_a-z0-9]+)/ig, function(reply) {
return reply.charAt(0)+''+reply.substring(1)+'';
});
// output the result
$("#tweet").html(tweet);
});
});