NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name Allocine video
// @namespace https://openuserjs.org/users/clemente
// @match https://www.allocine.fr/*
// @version 1.2
// @author clemente
// @license MIT
// @inject-into content
// @noframes
// ==/UserScript==
function getMetaContent(name) {
const detectedMeta = document.querySelector(`meta[name="${name}"]`);
if (detectedMeta) return detectedMeta.content;
return null;
}
function replacePlayer() {
const currentPlayer = document.querySelector(".video-card-player figure");
const videoId = JSON.parse(currentPlayer.dataset.model).videos[0].id;
const newPlayerUrl = `https://player.allocine.fr/${videoId}.html`;
if (!currentPlayer || !newPlayerUrl) return;
const { width, height } = currentPlayer.getBoundingClientRect();
const newPlayer = document.createElement('iframe');
newPlayer.src = newPlayerUrl;
newPlayer.width = width;
newPlayer.height = height;
newPlayer.allow = "fullscreen";
currentPlayer.replaceWith(newPlayer);
}
replacePlayer();