Untitled diff

Created Diff never expires
45 removals
150 lines
218 additions
327 lines
(function()
(function()
{
{
var touch = window.ontouchstart
var touch = window.ontouchstart
|| navigator.MaxTouchPoints > 0
|| navigator.MaxTouchPoints > 0
|| navigator.msMaxTouchPoints > 0;
|| navigator.msMaxTouchPoints > 0;
is_touch_device();
is_touch_device();
if (touch == true) { // remove all :hover stylesheets
if (touch == true) { // remove all :hover stylesheets
try { // prevent crash on browsers not supporting DOM styleSheets properly
try { // prevent crash on browsers not supporting DOM styleSheets properly
for (var si in document.styleSheets) {
for (var si in document.styleSheets) {
var styleSheet = document.styleSheets[si];
var styleSheet = document.styleSheets[si];
if (!styleSheet.rules) continue;
if (!styleSheet.rules) continue;
for (var ri = styleSheet.rules.length - 1; ri >= 0; ri--) {
for (var ri = styleSheet.rules.length - 1; ri >= 0; ri--) {
if (!styleSheet.rules[ri].selectorText) continue;
if (!styleSheet.rules[ri].selectorText) continue;
if (styleSheet.rules[ri].selectorText.match(':hover')) {
if (styleSheet.rules[ri].selectorText.match(':hover')) {
stylesheet.deleteRule(ri);
stylesheet.deleteRule(ri);
}
}
}
}
}
}
} catch (ex) {}
} catch (ex) {}
}
}
$(window).on('scroll', checkAnchors);
$('.main-nav, .mobile-nav').on('click','div',navClick);
$('body').on('click', '.rsvp', function ()
{
//
});
$('.schedule-info').on('click', function ()
{
if ($('div', this).hasClass('active'))
{
$('div', this).removeClass('active');
}
else
{
$('div', this).addClass('active');
}
});
$('.answer-open').on('click', function ()
{
if ($(this).hasClass('active'))
{
$(this).removeClass('active');
var answerParent = $(this).parent();
$('.faq-answer', answerParent).removeClass('active');
}
else
{
$(this).addClass('active');
var answerParent = $(this).parent();
$('.faq-answer', answerParent).addClass('active');
}
});
$('.mobile-menu-link').on('click', function (e)
{
e.preventDefault();
if ($('.mobile-nav').hasClass('active')) {
$('.mobile-nav').removeClass('active');
$('.mobile-nav-cover').removeClass('active');
}
else
{
$('.mobile-nav').addClass('active');
$('.mobile-nav-cover').addClass('active');
}
});
$('.rewards-link').on('click', function (e)
$('.rewards-link').on('click', function (e)
{
{
e.preventDefault();
e.preventDefault();
$('.rewards-pop-up').addClass('active');
$('.rewards-pop-up').addClass('active');
$('.cover').addClass('active');
$('.cover').addClass('active');
});
});
$('.rewards-pop-up-close-btn').on('click', function ()
$('.rewards-pop-up-close-btn').on('click', function ()
{
{
$('.rewards-pop-up').removeClass('active');
$('.rewards-pop-up').removeClass('active');
$('.cover').removeClass('active');
$('.cover').removeClass('active');
});
});
$('.videoStill').magnificPopup({
$('.trailer-house').magnificPopup({
delegate: 'img', // child items selector, by clicking on it popup will open
delegate: 'i', // child items selector, by clicking on it popup will open
type: 'iframe',
type: 'iframe',
gallery:
gallery:
{
{
enabled:true
enabled:true
}
}
// other options
// other options
});
});
$('.travel-info-image').magnificPopup({
delegate: 'img', // child items selector, by clicking on it popup will open
type: 'image',
gallery:
{
enabled:false
}
// other options
});
//if (touch == false) {
//if (touch == false) {
// $('.digital-link').on('mouseenter', function (e)
// $('.digital-link').on('mouseenter', function (e)
// {
// {
// var currentSource = $('img', this).attr('src');
// var currentSource = $('img', this).attr('src');
// var newSource = currentSource.replace('.png', '_hover.png');
// var newSource = currentSource.replace('.png', '_hover.png');
// $('img', this).attr('src', newSource);
// $('img', this).attr('src', newSource);
// });
// });
// $('.digital-link').on('mouseleave', function (e)
// $('.digital-link').on('mouseleave', function (e)
// {
// {
// var currentSource = $('img', this).attr('src');
// var currentSource = $('img', this).attr('src');
// var newSource = currentSource.replace('_hover.png', '.png');
// var newSource = currentSource.replace('_hover.png', '.png');
// $('img', this).attr('src', newSource);
// $('img', this).attr('src', newSource);
// });
// });
//}
//}
$('.digital-link').on('click', function (e)
$('.digital-link').on('click', function (e)
{
{
e.preventDefault();
e.preventDefault();
if ($(this).attr('href').search('playstation.com') != -1) {
if ($(this).attr('href').search('playstation.com') != -1) {
var storeLink = 'PlayStation Store';
var storeLink = 'PlayStation Store';
}
}
else if ($(this).attr('href').search('xbox.com') != -1) {
else if ($(this).attr('href').search('xbox.com') != -1) {
var storeLink = 'Xbox Store';
var storeLink = 'Xbox Store';
}
}
else if ($(this).attr('href').search('steampowered.com') != -1) {
else if ($(this).attr('href').search('steampowered.com') != -1) {
var storeLink = 'Steam Store';
var storeLink = 'Steam Store';
}
}
else if ($(this).attr('href').search('square') != -1) {
else if ($(this).attr('href').search('square') != -1) {
var storeLink = 'Square Enix Store';
var storeLink = 'Square Enix Store';
}
}
if ($(this).hasClass('windows-10')) {
if ($(this).hasClass('windows-10')) {
var storeLink = 'Windows 10';
//
if ($(this).attr('href') == '#') {
//
}
else
{
var url = window.location;
var urlExtension = parseUrl(url).search;
if (typeof urlExtension[1] != 'undefined') {
var splitUrlExtension = urlExtension.split('?');
var paramsArray = splitUrlExtension[1].split('&');
var paramsSplit = {};
$(paramsArray).each(function (idx)
{
var splitString = this.split('=');
paramsSplit[splitString[0]] = splitString[1];
});
var fullWindowsEtension = '';
if ('utm_campaign' in paramsSplit) {
fullWindowsEtension += '_'+paramsSplit['utm_campaign'];
}
if ('utm_source' in paramsSplit) {
fullWindowsEtension += '_'+paramsSplit['utm_source'];
}
if ('utm_content' in paramsSplit) {
fullWindowsEtension += '_'+paramsSplit['utm_content'];
}
}
ga('send', 'event', 'Store Link Click', storeLink);
window.open('https://www.microsoft.com/en-us/store/games/rise-of-the-tomb-raider/9nblggh6crsz?cid=SEA_ROTTR_W10'+fullWindowsEtension, '_blank');
}
}
}
else
else
{
{
ga('send', 'event', 'Store Link Click', storeLink);
ga('send', 'event', 'Store Link Click', storeLink);
var url = window.location;
var url = window.location;
var urlExtension = parseUrl(url).search;
var urlExtension = parseUrl(url).search;
window.open($(this).attr('href')+urlExtension);
window.open($(this).attr('href')+urlExtension);
}
}
});
});
var language = $('body').attr('lang');
var language = $('body').attr('data-attr-lang');
var currentFlag = $('#'+language+'-flag').detach();
$("#timer").countdown({
date: "february 5, 2016 16:00",
yearsAndMonths: false,
template: '<span class="time-text">%td</span> %d <span class="time-text">%th</span> <span class="time-text-2">%h</span> <span class="time-text">%ti</span> <span class="time-text-2">%i</span> <span class="time-text">%ts</span> <span class="time-text-2">%s</span>',
});
$("#timer").countdown("changeLocale", language);
var currentFlag;
$('.flag-inner a').each(function ()
{
if ($(this).attr('data-country-code') == language)
{
currentFlag = $(this).detach();
}
});
$('.flag-container .flag-inner').prepend(currentFlag);
$('.flag-container .flag-inner').prepend(currentFlag);
$('.flag-container .flag-inner').on('click', 'div.flag', function ()
$('.flag-container .flag-inner').on('click', 'div.flag', function ()
{
{
var newLocale = ($(this).attr('id')).replace('-flag', '');
var newLocale = ($(this).attr('id')).replace('-flag', '');
var newUrl = (window.location.href).split('/');
var newUrl = (window.location.href).split('/');
newUrl = newUrl[0] + '//' + newUrl[2] + '/';
newUrl = newUrl[0] + '//' + newUrl[2] + '/';
window.location.href = newUrl+newLocale;
window.location.href = newUrl+newLocale;
});
});
if (typeof xboxRetailersArray !== 'undefined') {
var parsedXbox = $.parseJSON(xboxRetailersArray);
$.each(parsedXbox, function ()
{
$('.linksHouse.retailers.xbox').append('<a href="'+this.link[0]+'" class="retailer-link" />');
$('.linksHouse.retailers.xbox a:last').append('<img src="'+this.logo+'" class="retailer-logo" />');
});
}
if (typeof ps4RetailersArray !== 'undefined')
{
var parsedPS4 = $.parseJSON(ps4RetailersArray);
$.each(parsedPS4, function ()
{
$('.linksHouse.retailers.ps4').append('<a href="'+this.link[0]+'" class="retailer-link" />');
$('.linksHouse.retailers.ps4 a:last').append('<img src="'+this.logo+'" class="retailer-logo" />');
});
}
if (typeof pcRetailersArray !== 'undefined')
if (typeof pcRetailersArray !== 'undefined')
{
{
var parsedPC = $.parseJSON(pcRetailersArray);
var parsedPC = $.parseJSON(pcRetailersArray);
$.each(parsedPC, function ()
$.each(parsedPC, function ()
{
{
$('.linksHouse.retailers.pc').append('<a href="'+this.link+'" class="retailer-link" />');
$('.linksHouse.retailers.pc').append('<a href="'+this.link[0]+'" class="retailer-link" />');
$('.linksHouse.retailers.pc a:last').append('<img src="'+this.logo+'" class="retailer-logo" />');
$('.linksHouse.retailers.pc a:last').append('<img src="'+this.logo+'" class="retailer-logo" />');
});
});
}
}
}) ();
}) ();
function is_touch_device() {
function is_touch_device() {
return 'ontouchstart' in window // works on most browsers
return 'ontouchstart' in window // works on most browsers
|| 'onmsgesturechange' in window; // works on ie10
|| 'onmsgesturechange' in window; // works on ie10
}
}


function parseUrl( url ) {
function parseUrl( url ) {
var a = document.createElement('a');
var a = document.createElement('a');
a.href = url;
a.href = url;
return a;
return a;
}
function navClick (e) {
e.preventDefault();
$(window).off('scroll', checkAnchors);
$('.mobile-nav').removeClass('active');
$('.mobile-nav-cover').removeClass('active');
if ($(this).hasClass('active'))
{
//
}
else
{
$('.nav-item, .mobile-nav-item').each(function ()
{
$(this).removeClass('active');
});
$(this).addClass('active');
if ($(this).attr('id') == 'forums') {
window.location = 'http://forum.finalfantasyxv.com';
}
else
{
//calculate destination place
var dest = 0;
if ($(window).width() <= 1024) {
console.log('little screen');
if ($('a[href=#'+$(this).attr('id')+']').offset().top - $(window).height() * -.15 > $(document).height() - $(window).height()) {
dest = $(document).height() - $(window).height();
} else {
dest = $('a[href=#'+$(this).attr('id')+']').offset().top - $(window).height() * -.15;
}
}
}
else
{
if ($('a[href=#'+$(this).attr('id')+']').offset().top - $(window).height() * .25 > $(document).height() - $(window).height()) {
dest = $(document).height() - $(window).height();
} else {
dest = $('a[href=#'+$(this).attr('id')+']').offset().top - $(window).height() * .25;
}
}
//go to destination
$('html,body').animate({
scrollTop: dest
}, 500, 'swing', function ()
{
$(window).on('scroll', checkAnchors);
});
}
}
}
function checkAnchors ()
{
//var homeLoc = ($('a[href=#home]').offset().top) - ($(window).height() * .3);
//var whatLoc = $('a[href=#what]').offset().top - ($(window).height() * .3);
//var trailerLoc = $('a[href=#trailer]').offset().top - ($(window).height() * .3);
//var livestreamLoc = $('a[href=#livestream]').offset().top - ($(window).height() * .3);
//var scheduleLoc = $('a[href=#schedule]').offset().top - ($(window).height() * .3);
//var travelLoc = $('a[href=#travel]').offset().top - ($(window).height() * .3);
//var faqLoc = $('a[href=#faq]').offset().top - ($(window).height() * .3);
//
//if ( $(window).scrollTop() > homeLoc && $(window).scrollTop() < whatLoc)
//{
// $('.nav-item, .mobile-nav-item').each(function ()
// {
// $(this).removeClass('active');
// });
// $('.main-nav div[id=home], .mobile-nav div[id=home]').addClass('active');
//}
//if ( $(window).scrollTop() > whatLoc && $(window).scrollTop() < trailerLoc)
//{
// $('.nav-item, .mobile-nav-item').each(function ()
// {
// $(this).removeClass('active');
// });
// $('.main-nav div[id=what], .mobile-nav div[id=what]').addClass('active');
//}
//if ( $(window).scrollTop() > trailerLoc && $(window).scrollTop() < livestreamLoc)
//{
// $('.nav-item, .mobile-nav-item').each(function ()
// {
// $(this).removeClass('active');
// });
// $('.main-nav div[id=trailer], .mobile-nav div[id=trailer]').addClass('active');
//}
//if ( $(window).scrollTop() > livestreamLoc && $(window).scrollTop() < scheduleLoc)
//{
// $('.nav-item, .mobile-nav-item').each(function ()
// {
// $(this).removeClass('active');
// });
// $('.main-nav div[id=livestream], .mobile-nav div[id=livestream]').addClass('active');
//}
//if ( $(window).scrollTop() > scheduleLoc && $(window).scrollTop() < travelLoc)
//{
// $('.nav-item, .mobile-nav-item').each(function ()
// {
// $(this).removeClass('active');
// });
// $('.main-nav div[id=schedule], .mobile-nav div[id=schedule]').addClass('active');
//}
//if ( $(window).scrollTop() > travelLoc && $(window).scrollTop() < faqLoc)
//{
// $('.nav-item, .mobile-nav-item').each(function ()
// {
// $(this).removeClass('active');
// });
// $('.main-nav div[id=travel], .mobile-nav div[id=travel]').addClass('active');
//}
//if ( $(window).scrollTop() > faqLoc)
//{
// $('.nav-item, .mobile-nav-item').each(function ()
// {
// $(this).removeClass('active');
// });
// $('.main-nav div[id=faq], .mobile-nav div[id=faq]').addClass('active');
//}
}