Heta kyssar och ljuv romantik imorgon! – TV4

Något gick fel, prova igen

’;
var timeOut;

if (!$element.hasClass(’tv-table-channel-program-episode-name’))
$element.addClass(’tv-table-channel-program-episode-name’);

programInfoLoader.prependToTarget($element);

$.ajax(
type: ’GET’,
url: informationUrl,
dataType: ’html’,
timeout: 3000,
beforeSend: function ()
programInfoLoader.start();

})
.done(function (data)
$(data).insertAfter($element);
timeOut = setTimeout(function ()
programInfoLoader.reset();
clearTimeout(timeOut);
, 500);
})
.fail(function ()
ammountOfReloads = ammountOfReloads + 1;

if (ammountOfReloads === 3)
$(errorText).insertAfter($element);
else
$element.removeClass(’tv-table-channel-program-episode-name’);
loadProgramInformation($element);

});
} else
$element.removeClass(’tv-table-channel-program-episode-name’);
$element.parent().find(’.episode-info-container’).remove();

}

function toggleWholeWeek(e)
var $this = $(this),
$arrowNavAnchorItem = $this.parent(),
$url = $this.attr(’data-location’);

e.preventDefault();

// Let’s prevent loading multiple navigations
if (tv4.common.respondsTo.aboveMobile() && $this.data(’link-activated’) === true)
return;
else if (tv4.common.respondsTo.aboveMobile())
$this.data(’link-activated’, true);

if (tv4.common.respondsTo.aboveMobile())
if ($url && $url.length > 1)
switchWeek($url);

}
else
if ($arrowNavAnchorItem.hasClass(’tv-table-header-right-arrow’))
toggleDayForward($this);

else if ($arrowNavAnchorItem.hasClass(’tv-table-header-left-arrow’))
toggleDayBackward($this);

}
}

function switchWeek($url, select_day)
var $outerWrapper = $(’.tv-table-navigation-wrapper’),
$innerWrapper = $(’.tv-table-navigation-inner-wrapper’);

if (select_day)
if ($url.indexOf(’?’) >= 0)
$url = $url + ’&select_day=’ + select_day;
else
$url = $url + ’?select_day=’ + select_day;

}

$.ajax(
url: $url
)
.done(function (data)
var $data = $(data);
$innerWrapper.remove();
$outerWrapper.append($data);
$(’.tv-table-header-weekly-list’).find(’li.tv-table-header-weekly-current a’).trigger(’click’, toggleDays);
);
}

function toggleDayForward($anchor)
var $currentItem = $(’.tv-table-header-weekly-list’).find(’.tv-table-header-weekly-current’),
$nextItem = $currentItem.next(),
$currentItemAnchor = $currentItem.find(’a’),
url = $anchor.attr(’data-location’);

if ($nextItem && $nextItem.length === 0)
if (url && url.length > 0)
switchWeek(url, ’monday’);

} else
$currentItem.removeClass(’tv-table-header-weekly-current’);
$nextItem.addClass(’tv-table-header-weekly-current’).find(’a’).trigger(’click’, toggleDays);

}

function toggleDayBackward($anchor)
var $currentItem = $(’.tv-table-header-weekly-list’).find(’.tv-table-header-weekly-current’),
$prevItem = $currentItem.prev(),
url = $anchor.attr(’data-location’);

if ($prevItem && $prevItem.length 0)
switchWeek(url, ’sunday’);

} else
$currentItem.removeClass(’tv-table-header-weekly-current’);
$prevItem.addClass(’tv-table-header-weekly-current’).find(’a’).trigger(’click’, toggleDays);

}

function toggleDays(e)
var $url = $(this).attr(’data-location’),
$button = $(this),
$loader = $(’.tv-tabla-is-loading-overlay’);

e.preventDefault();

switchDay($url, $button, $loader);

function switchDay(url, $button, $loader)
if (tv4.common.respondsTo.mobile())
disableWeekNavOnLastDay();

$button.parents(’.tv-table-header-weekly-list’).find(’li.tv-table-header-weekly-current’).removeClass(’tv-table-header-weekly-current’);
$button.parent(’li’).addClass(’tv-table-header-weekly-current’);

$.ajax(
url: url,
beforeSend: function ()
$loader.show();
tablaLoaderIcon.start();

})
.done(function (data)
var $data = $(data);

$(’.tv-table-channel-lists’).remove();
$(’.tv-table-main-inner’).append($data);
$loader.delay(100).fadeOut(300, function ()
tablaLoaderIcon.stop();
);
});
}

function disableWeekNavOnLastDay()
var mobileDisabledClass = ’tv-table-week-mobile-is-disabled’,
currentClass = ’tv-table-header-weekly-current’,
$navWrapper = $(’.tv-table-navigation-wrapper’),
$days = $navWrapper.find(’.tv-table-header-weekly-list-item’),
$monday = $days.first(),
$sunday = $days.last();

$(’.’ + mobileDisabledClass).removeClass(mobileDisabledClass);

if ($monday.is(’.’ + currentClass))
$navWrapper.find(’.tv-table-header-left-arrow.tv-table-week-is-disabled’).addClass(mobileDisabledClass);

if ($sunday.is(’.’ + currentClass))
$navWrapper.find(’.tv-table-header-right-arrow.tv-table-week-is-disabled’).addClass(mobileDisabledClass);

}

function toggleWholeDay(e)
var $loadButton = $(this),
$channelListWrapper = $loadButton.prev(),
$channelList = $channelListWrapper.find(’ul’).first(),
$channelListHeight = $channelList.outerHeight(true),
$url = $loadButton.attr(’data-more-from’);

var dayEls =
loadButton: $loadButton,
channelListWrapper: $channelListWrapper,
channelList: $channelList,
channelListHeight: $channelListHeight,
url: $url,
defaultButtonText: ’Visa hela dagen’,
newButtonText: ’Dölj’
;

e.preventDefault();

if ($loadButton.text() === dayEls.newButtonText)
unshowWholeDay(dayEls);
else
loadWholeDay(dayEls);

}

function loadWholeDay(els)
els.channelListWrapper.css(’height’, els.channelListHeight);
els.loadButton.addClass(”state-button-is-loading”);

showWholeDayLoaderIcon.appendToTarget(els.loadButton);

$.ajax(
url: els.url
)
.done(function (data)
var $data = $(data);

els.channelList.fadeOut(300, function ()

els.channelListWrapper.addClass(’tv-table-channel-program-list-wrapper-loading’);
els.channelList.addClass(’tv-table-channel-list-compact’);
els.channelListWrapper.append($data);

els.channelListWrapper.animate(
height: els.channelListWrapper.find(’ul:not(”.tv-table-channel-list-compact”)’).outerHeight(true),
queue: false,
timeout: 5000
, 200, function ()
showWholeDayLoaderIcon.reset();
els.loadButton.removeClass(’state-button-is-loading’).addClass(’state-button-close-icon’).text(els.newButtonText);
els.channelListWrapper.removeClass(’tv-table-channel-program-list-wrapper-loading’);
els.channelListWrapper.css(’height’, ’auto’);
);

els.channelListWrapper.find(’ul:not(”.tv-table-channel-list-compact”)’).fadeIn(400);

});
});
}

function unshowWholeDay(els)
var $channelListExtended = els.channelListWrapper.find(’ul:not(”.tv-table-channel-list-compact”)’);

els.channelListWrapper.css(’height’, $channelListExtended.outerHeight(true));

$channelListExtended.fadeOut(400, function ()

$channelListExtended.empty().remove();

els.channelListWrapper.animate(
height: els.channelListHeight
, 200, function ()
els.channelList.fadeIn(200).removeClass(’tv-table-channel-list-compact’);
els.channelListWrapper.css(’height’, ’auto’);
els.loadButton.text(els.defaultButtonText).removeClass(’state-button-close-icon’);
);
});
}

function getChannelVideoId(appId)
var key;
var videoIds =
’tv4’: ’2219145’,
’sjuan’: ’2219146’,
’tv11’: ’2219148’,
’tv4-sport’: ’2211912’,
’tv4-news’: ’2143280’,
’tv4-fakta’: ’2219150’,
’tv4-fakta-xl’: ’2219153’,
’tv4-film’: ’2219156’,
’tv4-komedi’: ’2219154’,
’tv4-guld’: ’2219155’
;

for (key in videoIds)
if (videoIds.hasOwnProperty(key))
if (key === appId)
return videoIds[key];

}
}

// if no appId found, return empty string
return ”;
}

function openLiveProgram(e)

if (tv4.common.iOSUserAgent())
e.preventDefault();
var buttonStyle = ’button’;
var buttonPrimary = ”Jag har appen”;
var pathname = e.target.pathname;
var videoId = pathname.slice(pathname.lastIndexOf(’/’) + 1);
var isInteger = /^-?d+$/;

if (!isInteger.test(videoId))
videoId = getChannelVideoId(videoId);

if (tv4.modal.getCookie(’app_cookie’))
buttonStyle = ’link’;
buttonPrimary = ’Öppna video i appen’;

var messageData =
header: ”ÖPPNA TV4 PLAY-APPEN”,
body: ”Av rättighetsskäl måste detta program visas i ” + tv4.iOSApp.appName() + ”-appen.”,
buttonPrimary: buttonPrimary,
urlPrimary: tv4.iOSApp.appVideoUrl(videoId),
buttonSecondary: ”Ladda ner TV4 Play-appen”,
urlSecondary: tv4.iOSApp.appUrl(),
buttonAsideText: ”(Gratis)”,
buttonStyle: buttonStyle
;
tv4.modal.open(’player/modal’, messageData);
tv4.modal.setCookieOnClick(”.app-modal-button-primary”, ”app_cookie”, ”app_link_chosen”);
}
}

tv4.tvTable =
bootstrap: function ($)
$(’.tv-table-main-inner’).start(this);
,

start: function (elements)
setupProgramInformationLinks(elements);
setupWholeDayButtons(elements);
setUpDateNavigation($(’.tv-table-navigation-wrapper’));
setUpLoader();
tv4.common.setUpToolTip(’tv-table-tooltip’);

elements.on(’mouseover mouseout’, ’.tv-table-program-list-item-play-link’, function (e)
var $this, offsetx, offsety, $html;

if (e.type === ’mouseover’)
$this = $(this);
offsetx = 80;
offsety = 75;
$html = $(’Se avsnittet i TV4 Play’);

tv4.common.showToolTip($this, e, offsetx, offsety, $html);

else if (e.type === ’mouseout’)
tv4.common.hideToolTip();

});
}
};
}(jQuery));
/*jshint onevar: true, white: true, indent: 2 */
/*global FB:false, twttr:false, gapi:false, pSUPERFLY */

(function ($)
var tv4 = window.tv4 = window.tv4 ;

function insertSocialButtons(textElement)
var el = $(textElement).closest(’.update’).find(’.update-social-buttons’);
tv4.socialButtons.insert($(el));

function cbRegisterClickStat(source, title)
if (source && source.length && !!pSUPERFLY)
pSUPERFLY.virtualPage(source, title);

}

function showMore(e)
var terseText = $(this).parent().parent(’.update-text-terse’),
linkSource = $(this).data(’update-link’),
updateHeading = $(this).data(’update-title’);

terseText.hide();
terseText.next().show();
insertSocialButtons(terseText);
cbRegisterClickStat(linkSource, updateHeading);
e.preventDefault();

function showLess(e)
var fullText = $(this).closest(’.update-text-full’);
fullText.hide();
fullText.prev().show();
e.preventDefault();

function insertLinks(elements)
var showMoreLink, showLessLink;

showMoreLink = $(”)
.addClass(’update-show-more-link’)
.attr(’href’, ’#’)
.append(’ Visa hela’)
.click(showMore);

showLessLink = $(”)
.addClass(’update-show-less-link’)
.attr(’href’, ’#’)
.append(’ Visa mindre’)
.click(showLess);

elements.find(’.update-heading-and-text > .update-text-terse p:last-child’).append(showMoreLink);
elements.find(’.update-text-full’).append(showLessLink);
elements.data(’truncated’, ’true’);

elements.find(’.update-link’).each(function ()
$(this).parent().find(’.update-show-more-link’)
.data(’update-link’, $(this).attr(’href’))
.data(’update-title’, $(this).find(’.update-heading’).text());
);

}

function attachClickHandlers(elements)
elements.on(’click’, ’.update-video-mini’, function (e)
var headingAndText = $(this).siblings(’.update-heading-and-text-mini’);
$(this).css(’width’, ’100%’);
headingAndText.toggleClass(’update-heading-and-text-mini update-heading-and-text’);
headingAndText.find(’.update-heading-mini’)
.toggleClass(’update-heading-mini update-heading’);
insertSocialButtons(headingAndText);
);
}

tv4.updates =
bootstrap: function ($)
$(’.js-updates’).start(this);
,

start: function (elements)
var $loadedHTML;

insertLinks(elements);
attachClickHandlers(elements);

$(document).on(’more-loaded-data’, function (event)
if (tv4.showMore.loadedHTML)
$loadedHTML = tv4.showMore.loadedHTML;
insertLinks($loadedHTML);
attachClickHandlers($loadedHTML);

});

}
};
}(jQuery));
/*jshint onevar: true, white: true, indent: 2 */
/*global console:false */

(function ($)
var tv4 = window.tv4 = window.tv4 ;

function insertSocialButtons(elements)
elements.find(’.video-social-buttons’).each(function (index, container)
var $container = $(container);
$container.append(tv4.socialButtons.fbLikeButton.draw($container));
);
tv4.socialButtons.fbLikeButton.initialize(elements);
}

tv4.videoPoll =
bootstrap: function ($)
$(’.active-video-poll’).start(this);
,
start: function (elements)
setTimeout(function ()
insertSocialButtons(elements);
, 500);
}
};

}(jQuery));
/*global BDM */

(function ($)
var tv4 = window.tv4 = window.tv4 ;
var fadeAnimation = false;

tv4.videoPlayerEmbed =

bootstrap: function ()
this.eventListeners();
,

playHost: function()
if ( $(’body’).data(’tv4play-host’) )
return $(’body’).data(’tv4play-host’);
else
return ”www.tv4play.se”;

},

eventListeners: function ()
var _this = this;
var scrollToTimer = null;
var scrollToPosition;
var offsetRange = 0;
var bd_timer = null;

if ($(’body’).find(’.video-is-active’).length && $(’body’).find(’.video-gallery’).length)
_this.embedPlayer($(’.video-is-active’), $(’.video-is-active’).find(’.video-container’).data(’video-id’));

scrollToPosition = $(’.video-is-active’).offset().top – 20;

if ($(’body’).hasClass(’gilla-tv’) && $(”.video-is-active”).parent().index() === 0)
offsetRange = $(’.gilla-tv-masthead #fb-like-button’).length > 0 && $(’.gilla-tv-masthead #fb-like-button’).css(’position’) === ’absolute’ ? 100 : 60;

scrollToTimer = setTimeout(function ()
$(’html, body’).animate(
scrollTop: scrollToPosition – offsetRange
, 1000, function()
clearTimeout(scrollToTimer);
);
}, 2000);

clearTimeout(bd_timer);
bd_timer = setTimeout(function()
if (typeof BDM === ’object’)
BDM.trigger(’bdaction.watch’);

}, 25000);

}

$(’.video-grid-wrapper’).on(’click’, ’.video-grid-container’, function(e)
e.preventDefault();
var block = $(this);

if($(this).parents(’.video-grid-main-video’).length)
block = $(’.video-grid-wrapper .video-grid-listed-clips-item .selected’).parent(’.video-grid-container’);

if(_this.getActiveBlock())
_this.removePlayer(_this.getActiveBlock());

_this.createGridMainVideo(block);
});

$(document).on(’click’, ’.js-video-player’, function(e)
e.preventDefault();
if(!fadeAnimation)
if(_this.getActiveBlock())
if($(this).parent().hasClass(’video-clip-video’))
if($(this).parents().hasClass(’video-is-active’))
_this.embedPlayer($(this).parents(’.video-clip’));
else
_this.fadeOutPlayer(_this.getActiveBlock());
_this.fadeInPlayer($(this));

} else
if($(this).parents().hasClass(’video-is-active’))
_this.embedPlayer($(this).parents(’.update-article-video, .update-video-mini, .update-video-full, .program-episode-video, .episode-video’));
else
_this.removePlayer(_this.getActiveBlock());
_this.embedPlayer($(this).parents(’.update-article-video, .update-video-mini, .update-video-full, .program-episode-video, .episode-video’));

}
} else
if($(this).parent().hasClass(’video-clip-video’))
_this.fadeInPlayer($(this));
else
_this.embedPlayer($(this).parent().parent());

}
}
});

if ($(’.article’).attr(’data-autoplay’) === ’true’)
$(’.js-video-player:eq(0)’).trigger(’click’);

$(document).on(’click’, ’.video-clip-meta .video-clip-title, .video-clip-meta .content-meta’, function(e)
e.preventDefault();
if($(this).parents(’.video-clip’).length && !$(this).parents(’.video-clip’).hasClass(’video-is-active’) && $(this).parents(’.video-clip’).find(’.js-video-player’).length)
$(this).parents(’.video-clip’).find(’.js-video-player’).trigger(’click’);

});

$(document).on(’click’, ’.close-active-video-button’, function(e)
e.preventDefault();

if(_this.getActiveBlock())
if($(’body’).hasClass(’gilla-tv’))
tv4.gillaTv.resetSocialMediaShareButtons();

_this.fadeOutPlayer(_this.getActiveBlock());
}
});
},

createGridMainVideo: function (block)
var _this = this;

var $element = block.parent().parent(),
$videoPlaceHolders = $(’.video-grid-wrapper’).find(’.video-place-holder’),
$videoPlaceHolder = block.find(’.video-place-holder’),
$videoItemImage = $element.find(’.video-image’).clone(),
$videoItemTitle = $.trim($element.find(’.video-grid-item-title > span’).text()),
$videoItemMeta = $.trim($element.find(’.content-meta’).html()),
$videoMainImage = $(’.video-grid-main-video’).find(’.video-image’),
$videoMainTitle = $(’.video-grid-main-video’).find(’.video-grid-main-video-title’),
$videoMainMeta = $(’.video-grid-main-video’).find(’.content-meta’);

$videoPlaceHolders.removeClass(’selected’);
$videoPlaceHolder.addClass(’selected’);

$videoMainImage.replaceWith($videoItemImage);
$videoMainTitle.text($videoItemTitle);
$videoMainMeta.html($videoItemMeta);

$(’.video-grid-main-video’).addClass(’hide-video-image’);

_this.embedPlayer(block.parents(’.video-grid-wrapper’).find(’.video-grid-main-video’), block.attr(’data-video-id’));

$(’html, body’).filter(’:not(:animated)’).animate(
scrollTop: $(’.video-grid-main-video’).offset().top – 55
,
queue: false,
duration: 650
);
},

fadeOutPlayer: function (blocks)
if ($(’body’).hasClass(’gilla-tv’))
tv4.gillaTv.resetSocialMediaShareButtons();

blocks.each(function()
var block = $(this);
block.css(’opacity’, 0);
block.find(’.video-embed-container.playing’).remove();
block.removeClass(’video-is-active video-is-loading video-is-playing’);
block.find(’.close-active-video-button’).remove();
block.find(’.main-clip-play-button’).show();
block.find(’.video-clip-inner’).appendTo(block.find(’.video-clip-link’));

tv4.videoPlayerEmbed.unsetLocation(block);

block.animate(
opacity: 1
,
queue: false,
duration: 800,
complete: function()
$(document).trigger(’video-closed’);

if(block.find(”.video-clip-meta”).length)
var el = block.find(”.video-clip-meta”);
el.appendTo(el.parents(”.video-clip”));
el.find(’.video-clip-title’).addClass(’looks-clickable’);

}
});
});
},

fadeInPlayer: function (block)
var _this = this;

fadeAnimation = true;

block = block.parents(’.video-clip’);

block.animate(
opacity: 0
,
queue: false,
duration: 800,
complete: function()
block.addClass(’video-is-loading video-is-active video-is-playing’);

$(”,
’class’: ’close-active-video-button’,
’text’: ’stäng’
).appendTo(block);

_this.scrollToBlock(block);
$(document).trigger(’video-loaded’);
fadeAnimation = false;

if(block.find(”.video-clip-meta”).length)
var el = block.find(”.video-clip-meta”);
el.appendTo(el.prevAll(”.video-clip-inner”));
el.find(’.video-clip-title’).removeClass(’looks-clickable’);

}
});

block.find(’.video-clip-inner’).insertBefore(block.find(’.video-clip-link’));
},

scrollToBlock: function (block)
var _this = this;

var targetOffset = block.offset().top,
$page = $(’html, body’),
animate = false,
offsetRange = $(’.gilla-tv-masthead #fb-like-button’).length > 0 && $(’.gilla-tv-masthead #fb-like-button’).css(’position’) === ’absolute’ ? 120 : 80;

$page.animate(
scrollTop: targetOffset – offsetRange
,
queue: false,
duration: 650,
complete: function()
if(animate === false)
_this.setLocation(block);
_this.embedPlayer(block);
animate = true;

block.find(’.main-clip-play-button’).hide();
block.removeClass(’video-is-loading’);
block.animate(
opacity: 1
,
queue: false,
duration: 800
);
}
});
},

embedPlayer: function (block, videoId)
var _this = this;
var bd_timer = null;

block.addClass(’video-is-playing’);

if(!videoId)
videoId = block.find(’.video-container, .video-grid-container’).attr(’data-video-id’);

var program = block.find(’.video-container, .video-grid-container’).attr(’data-program’);

var video_url = ’//’ + tv4.videoPlayerEmbed.playHost() + ’/iframe/video/’+videoId+’?autoload=true&from-site=tv4se&from-program=’ + program;

var $container = $(”,
’class’: ’video-embed-container’
);

$container.appendTo(block.find(’.video-container, .video-grid-container’));

if(!block.hasClass(’video-is-active’))
block.addClass(’video-is-active’);

if(block.hasClass(’episode-video’)
if(block.hasClass(’video-grid-main-video’))
block.css(’width’, ’auto’);

if(block.hasClass(’update-video-mini’))
var headingAndText = block.siblings(’.update-heading-and-text-mini’);
headingAndText.toggleClass(’update-heading-and-text-mini update-heading-and-text’);
headingAndText.find(’.update-heading-mini’).toggleClass(’update-heading-mini update-heading’);
//tv4.socialButtons.insert(headingAndText.closest(’.update’).find(’.update-social-buttons’));

}

if (block.data(’social-buttons’) === true)
if (block.find(’.video-clip-social-buttons’))
tv4.socialButtons.insert(block.find(’.video-clip-social-buttons’));

}

if (typeof BDM === ’object’)
clearTimeout(bd_timer);
bd_timer = setTimeout(function()
BDM.trigger(’bdaction.watch’);
, 20000);
}

var $iframe = $(’

Läs mer:



Källa: Heta kyssar och ljuv romantik imorgon! – TV4


Publicerat

i

,

av

Etiketter:

Kommentarer

Lämna ett svar

Din e-postadress kommer inte publiceras. Obligatoriska fält är märkta *