This web site makes use of cookies
We use cookies to personalize content material and advertisements, to supply social media options and to investigate our site visitors. We additionally share details about your use of our web site with our social media, promoting and analytics companions who could mix it with different info that you simply’ve supplied to them or that they’ve collected out of your use of their providers. Learn More
shut
window.REBELMOUSE_LOWEST_TASKS_QUEUE.push(function(){
let next_url = window.location.href.split("next_url=")[1];
let createAppleButtons = document.querySelectorAll("#createApple");
let createGoogleButtons = document.querySelectorAll("#createGoogle");
let createFBButtons = document.querySelectorAll("#createFacebook");
for ( let button of createAppleButtons){
button.addEventListener("click", () => {
redirect("/core/users/login/apple/", next_url)
});
}
for (let button of createGoogleButtons){
button.addEventListener("click", () => {
redirect("/core/users/login/googleplus/", next_url)
});
}
for (let button of createFBButtons){
button.addEventListener("click", () => {
redirect("/core/users/login/facebook/", next_url)
});
}
function redirect (url, next){
window.location.href = `${url}?next_url=${next}`
}
function frenchUrl(url){
if(url){
return url.includes("https://www.narcity.com/fr/");
}
else return false;
}
var monitorChekFrenchCheckbox = makeMonitor(function () {
return document.querySelector("label.authentication--field-IsFrenchProfile");
},function (res) {
let fr = frenchUrl(next_url);
let input = res.querySelector("input");
if (fr && !input.checked){
input.checked = true;
}
});
monitorChekFrenchCheckbox.start();
});
window.REBELMOUSE_LOWEST_TASKS_QUEUE.push(function(){
!function(p,r,e,s,b,d){p.pbq||(s=p.pbq=function(){s.exe?s.exe.apply(s,arguments):s.queue.push(arguments);},s.version='1.0',s.queue=[],b=r.createElement(e),b.async=!0,b.src="https://sr.studiostack.com/v3/services",d=r.getElementsByTagName(e)[0],d.parentNode.insertBefore(b,d))}(window,document,'script');
pbq('init', '250789');
});
window.REBELMOUSE_LOWEST_TASKS_QUEUE.push(function(){
let editProfile = document.querySelector('.gdpr-cookie-content');
let wrapper = document.querySelector('.rm-gdpr');
editProfile.addEventListener("click", function () {
wrapper.classList.add('hidden')
})
});
window.REBELMOUSE_LOWEST_TASKS_QUEUE.push(function(){
const supportPageOffset = window.pageXOffset !== undefined;
let previousScrollPosition = 0;
const isScrollingDown = () => {
let scrolledPosition = supportPageOffset
? window.pageYOffset
: isCSS1Compat
? document.documentElement.scrollTop
: document.body.scrollTop;
let isScrollDown;
if (scrolledPosition > previousScrollPosition) {
isScrollDown = true;
} else {
isScrollDown = false;
}
previousScrollPosition = scrolledPosition;
return isScrollDown;
};
const handleNavScroll = () => {
if(document.querySelector(".rumble-sticky--show")){
if (isScrollingDown() ) {
document.querySelector(".rumble-sticky--show").classList.add("active");
} else {
document.querySelector(".rumble-sticky--show").classList.remove("active");
}
}
};
var throttleTimer;
const throttle = (callback, time) => {
if (throttleTimer) return;
throttleTimer = true;
setTimeout(() => {
callback();
throttleTimer = false;
}, time);
};
const mediaQuery = window.matchMedia("(prefers-reduced-motion: reduce)");
window.addEventListener("scroll", () => {
throttle(handleNavScroll, 10);
});
});
window.REBELMOUSE_LOWEST_TASKS_QUEUE.push(function(){
function setCookie(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
var expires = "expires="+ d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}
function getCookie(cname) {
var name = cname + "=";
var decodedCookie = decodeURIComponent(document.cookie);
var ca = decodedCookie.split(';');
for(var i = 0; i
');
});
window.REBELMOUSE_LOWEST_TASKS_QUEUE.push(function(){
var post = JSON.parse(document.querySelector("#post-context-"+c_art_id).innerHTML);
if (c_sections.includes(c_fr_vedette) || c_sections.includes(c_sponsored) || isSponsored == "True"){
window.c_data_type = "sponsored";
}
else if(c_sections.includes(c_nsfw)){
window.c_data_type = "nsfw";
}
else window.c_data_type = "none";
document.querySelector("#IO_wrapper").setAttribute("data-ad-type", window.c_data_type);
});
window.REBELMOUSE_LOWEST_TASKS_QUEUE.push(function(){
function prepareFloatingHeadline(video) {
var videoParent = video.closest('.widget');
var pusher = document.createElement("div");
pusher.style.height = "76px";
pusher.classList.add("js-hidden-panel");
var closeButton = document.createElement("div");
closeButton.classList.add("close-button");
closeButton.classList.add("close-button-hide");
var clonedHeadlines = videoParent.querySelector('.widget__body').cloneNode(true);
clonedHeadlines.classList.replace('widget__body', 'widget__floating-headlines');
var clonedDate = videoParent.querySelector('.widget__head + .widget__body').cloneNode(true);
clonedDate.classList.replace('widget__body', 'widget__floating-info');
if (clonedHeadlines.querySelector(".widget__subheadline")) {
clonedHeadlines.removeChild(clonedHeadlines.querySelector(".widget__subheadline"));
}
var widget_section = clonedHeadlines.querySelector(".widget__section");
if (widget_section) {
clonedHeadlines.removeChild(widget_section);
}
if (clonedDate.querySelector(".js-expandable")) {
clonedDate.removeChild(clonedDate.querySelector(".js-expandable"));
}
var contentContainer = document.createElement("div");
contentContainer.classList.add('info-wrapper-sticky');
//contentContainer.appendChild(closeButton);
contentContainer.appendChild(clonedHeadlines);
contentContainer.appendChild(clonedDate);
video.appendChild(contentContainer);
video.appendChild(closeButton);
}
function createElChangeListener(selector, callback) {
const initializedNodes = new Set([]);
document.querySelectorAll(selector).forEach(node => {
callback(node);
initializedNodes.add(node);
});
const mutationObserver = new MutationObserver(() => {
const nodes = document.querySelectorAll(selector);
nodes.forEach(node => {
if (!initializedNodes.has(node)) {
callback(node);
initializedNodes.add(node);
}
});
});
mutationObserver.observe(document.body, {
childList: true,
subtree: true
});
}
var stopVideo = function ( element ) {
var iframe = element.querySelector( 'iframe');
var video = element.querySelector( 'video' );
if ( iframe ) {
var iframeSrc = iframe.src.replace("&autoplay=1","");
iframe.src = iframeSrc;
}
if ( video ) {
video.pause();
}
};
createElChangeListener('.widget__head', (el) => {
if(el.querySelector('.widget__video')){
if(document.querySelector('.widget__head a.widget__play') && el.querySelector('.article-body')){
document.querySelector('.widget__head a.widget__play').click();
}
prepareFloatingHeadline(el.querySelector('.widget__video'));
floatingObserver.observe(el);
}
});
if(document.querySelector(".close-button")){
document.querySelector(".close-button").addEventListener("click", function(){
var entryVideo =document.querySelector('.article-body .widget__video');
if (entryVideo.querySelector('.article-body [type="video-content"]')) {
document.querySelector(".close-button").classList.add("close-button-hide");
entryVideo.querySelector('.article-body [type="video-content"]').classList.remove('rumble-sticky-video')
if(entryVideo.querySelector('.widget__floating-headlines')){
entryVideo.querySelector('.widget__floating-headlines').classList.remove('headline-sticky');
}
if(entryVideo.querySelector('.widget__floating-info')){
entryVideo.querySelector('.widget__floating-info').classList.remove('info-sticky');
}
entryVideo.classList.remove("js-hidden-panel")
if( entryVideo.querySelector('video')){
entryVideo.querySelector('video').pause();
entryVideo.querySelector('video').style.height = "100%";
entryVideo.querySelector('video').parentElement.style.maxHeight = "370px";
} else{
stopVideo(entryVideo);
}
entryVideo.classList.remove('rumble-sticky--show');
}
})
}
});
Source link