/*document.addEventListener("DOMContentLoaded", function(event) {
if (isSmartphoneLayout === false) {
updategrnation('start');
}
$("img.lazycontainer").show().lazyload({ effect: "fadeIn", threshold: 200, container: $('.content.grtv') });
$(".lazy").show().lazyload();
});*/
// Start of release list hover effect
/* Deprecated */
/*function showHoverEffect(product, show) {
var objgameinfo = document.getElementById(product);
if (show) {
objgameinfo.style.visibility = 'visible';
} else {
objgameinfo.style.visibility = 'hidden';
}
}*/
/*function popularPreview(wrapper, show, section) {
if (isSmartphoneLayout) {
return;
}
if (!show) {
var $first = $('#first' + section); // optimization
var title = $first.attr('data-fgametitle');
var img = $first.attr('data-fgameimg');
var systemsAndSuch = $first.attr('data-fvalues');
//var systemString = $first.attr('data-fgamesystemString');
//var genreString = $first.attr('data-fgameGenreString');
//var releaseDate = $first.attr('data-fgamereleaseDate');
var gamepos = $first.attr('data-fgamepos');
var gamescore = $first.attr('data-fscore');
} else {
var $wrapper = $(wrapper);
var title = $wrapper.attr('data-gametitle');
var img = $wrapper.attr('data-gameimg');
var systemsAndSuch = $wrapper.attr('data-values');
//var systemString = $wrapper.attr('data-gamesystemString');
//var genreString = $wrapper.attr('data-gameGenreString');
//var releaseDate = $wrapper.attr('data-gamereleaseDate');
var gamepos = $wrapper.attr('data-gamepos');
var gamescore = 'undefined'; // $wrapper.attr('data-score'); outcommented because it's already visible to the right
}
systemsAndSuch = systemsAndSuch.split(';').join('
');
if (systemsAndSuch)
systemsAndSuch = '' + systemsAndSuch + '';
$('#first' + section + ' .cover').attr('src', img);
$('#first' + section + ' .gameswrapper .popularTitle').text(title);
$('#first' + section + ' .gameswrapper ul').html(systemsAndSuch);
$('#first' + section + ' .gameswrapper span').text(gamepos + '. ');
if (gamescore != 'undefined') {
if (gamescore < 10)
gamescore = '0' + gamescore;
gamescoreStr = gamescore;
$('#first' + section + ' .popularScore').attr('src', '/lay/redesign/score_c30_' + gamescore + '.png');
$('#first' + section + ' .popularScore').css('display', 'block');
} else {
$('#first' + section + ' .popularScore').css('display', 'none');
}
}*/
// End of release list hover effect
/**
* Deprecated
* Return width, height and outer width, out height of an element.
*/
/*function getElementSize(element) {
var style = element.currentStyle || window.getComputedStyle(element); // Get computed styles for the element
var width = element.offsetWidth;
var height = element.offsetHeight;
var outerWidth = width + parseInt(style.marginLeft.split('p')[0]) + parseInt(style.marginRight.split('p')[0]);
var outerHeight = height + parseInt(style.marginTop.split('p')[0]) + parseInt(style.marginBottom.split('p')[0]);
return {
width: width,
height: height,
outerWidth: outerWidth,
outerHeight: outerHeight
};
}*/
/**
* Deprecated
* Expands/Collapse Facebook like button (before comments lists)
*/
/*function facebookBtn(element) {
$(".fbLikeBox2").toggle("slow", function() {
// ANIMATION COMPLETE
});
}*/
function ajaxLoadVideo(channel, counter = false, subsection = false, section, callfrom = false) {
var counter;
if (counter != -1) {
counter = document.getElementById('grtvbelt' + (channel != 0 ? '_' + channel.replace(/\s/g,'') : '')).getElementsByClassName('grtv-belt-item').length;
}
channelMain = channel;
if (channel == 'Fun & Serious') {
channelMain = channel.replace(/\s/g, '');
channelMain = channelMain.replace(/\s/g, '\u0026');
channelMain = $.escapeSelector(channelMain);
channel = channelMain;
}
$('.view' + channelMain).attr("onclick", "ajaxLoadVideo('" + channel + "',0" + (subsection ? ",'" + subsection + "'" : ',\'date\'') + (channel != 0 ? ',false' : ',2') + ", '" + callfrom + "')");
$('.tabGrtv' + (!section ? '' : section)).removeClass('selected');
$('.tabGrtv' + (!section ? '' : section) + '.tab' + (subsection ? subsection : 'date')).addClass('selected');
$.ajax({
type: "POST",
url: '/ajaxstuff/loadStartVideos.php',
data: { channel: channel, counter: counter, section: section, subsection: subsection, callfrom: callfrom },
success: function(html) {
if (counter == -1) {
if (channel == 'userTv') {
$('.grtvuser').html(html);
} else if (channel == 'misc') {
$('.grtvschool').html(html);
} else {
$('#grtvbelt' + (channel != 0 ? '_' + channel.replace(/\s/g,'') : '')).html(html);
}
} else if (channel == 'Fun & Serious') {
$('#grtvbelt_' + channelMain).append(html);
} else {
$('#grtvbelt' + (channel != 0 ? '_' + channel.replace(/\s/g,'') : '')).append(html);
}
}
});
}
function ajaxLoadAudio(channel, counter = false, subsection = false, section, callfrom = false) {
var counter;
if (counter != -1) {
counter = document.getElementById('grtvbelt' + (channel != 0 ? '_' + channel.replace(/\s/g,'') : '')).getElementsByClassName('grtv-belt-item').length;
}
channelMain = channel;
$('.view' + channelMain).attr("onclick", "ajaxLoadAudio('" + channel + "',0" + (subsection ? ",'" + subsection + "'" : ',\'date\'') + (channel != 0 ? ',false' : ',2') + ", '" + callfrom + "')");
$('.tabGrtv' + (!section ? '' : section)).removeClass('selected');
$('.tabGrtv' + (!section ? '' : section) + '.tab' + (subsection ? subsection : 'date')).addClass('selected');
$.ajax({
type: "POST",
url: '/ajaxstuff/loadStartAudios.php',
data: { channel: channel, counter: counter, section: section, subsection: subsection, callfrom: callfrom },
success: function(html) {
if (counter == -1) {
$('#grtvbelt' + (channel != 0 ? '_' + channel.replace(/\s/g,'') : '')).html(html);
} else {
$('#grtvbelt' + (channel != 0 ? '_' + channel.replace(/\s/g,'') : '')).append(html);
}
}
});
}
function playAudioBelt(audioTag, audioTitle, audioid) {
allMediaTags = document.getElementsByTagName("audio");
for ( var i = 0; i < allMediaTags.length; i++) {
if (allMediaTags[i] != audioTag) {
allMediaTags[i].pause();
allMediaTags[i].removeAttribute("controls");
}
}
allMediaTags = document.getElementsByTagName("video");
for ( var i = 0; i < allMediaTags.length; i++) {
allMediaTags[i].muted = true;
}
document.getElementById("audio-belt-playbutton-" + audioid).style.display = 'none';
document.getElementById("audio-belt-pausebutton-" + audioid).style.display = 'block';
audioTag.setAttribute("controls",true);
if (typeof(_gaq) !== 'undefined') {
_gaq.push(['_trackEvent', 'CTR - Podcast', audioTitle]);
}
}
function pauseAudioBelt(audioTag, audioTitle, audioid) {
document.getElementById("audio-belt-playbutton-" + audioid).style.display = 'block';
document.getElementById("audio-belt-pausebutton-" + audioid).style.display = 'none';
}
function ajaxLoadText(subsection) {
var showSubsection;
if (subsection == 'date') {
showSubsection = subsection;
// console.log("defecto");
$('#hrd_d').addClass("selected");
$('#hrd_c').removeClass('selected');
$('#hrd_p').removeClass('selected');
} else if (subsection == "comments") {
showSubsection = subsection;
// console.log("Destacado");
$('#hrd_d').removeClass('selected');
$('#hrd_p').removeClass('selected');
$('#hrd_c').addClass("selected");
} else if ("popular") {
showSubsection = subsection;
// console.log("Popular");
$('#hrd_c').removeClass('selected');
$('#hrd_d').removeClass('selected');
$('#hrd_p').addClass("selected");
}
console.log(showSubsection);
$.ajax({
type: "POST",
url: '/ajaxstuff/loadStartTexts.php',
data: { showSubsection: showSubsection },
success: function(html) {
// $('.content .nosortbar .hardw').html(html);
$('#hrdwr').html(html);
}
});
}
/* Function for close ad stickcy in homepage mobile */
function closeAd() {
var stickCookie = getCookie('stickyBanner');
var __cfRLUnblockHandlers = 1;
$('#ad_sticky').fadeOut(0);
if (!stickCookie) {
// $(".closeSticky").click(function() {
var now = new Date();
var time = now.getTime();
time += 3600 * 1000;
// time += 60*1000;
now.setTime(time);
var closeAd = closeAdSticky => { document.getElementById("ad_sticky").style.display = "none"; }
setCookie("stickyBanner", "active", now.toUTCString(), "/", "", "");
// });
}
}