Skip to content

Instantly share code, notes, and snippets.

@alexander-arce
Forked from remram44/userscript.js
Created July 16, 2026 18:10
Show Gist options
  • Select an option

  • Save alexander-arce/dff99d3c80f913e0e7fc9ca3d69cc6bd to your computer and use it in GitHub Desktop.

Select an option

Save alexander-arce/dff99d3c80f913e0e7fc9ca3d69cc6bd to your computer and use it in GitHub Desktop.
Embed HTML in Google Slides
// ==UserScript==
// @name Google Slides embedder
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Shows an iframe in Google Slides presentation to fake embedding
// @author Remi Rampin
// @match https://docs.google.com/presentation/d/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==
(function() {
'use strict';
var injectFrame;
window.setInterval(function() {
if(injectFrame && !injectFrame.parentNode) {
console.log("Frame is gone");
injectFrame = undefined;
}
var presoFrame = document.getElementsByClassName('punch-present-iframe')
if(!presoFrame || !presoFrame.length) {
return;
}
presoFrame = presoFrame[0];
console.log("found punch-present-iframe", presoFrame);
if(!injectFrame) {
injectFrame = presoFrame.contentDocument.createElement('iframe');
injectFrame.setAttribute('src', 'https://spire.remram.fr/');
injectFrame.setAttribute('width', '400');
injectFrame.setAttribute('height', '400');
injectFrame.setAttribute('style', 'position: absolute; z-index: 300;');
injectFrame.className = "rr4_inject_frame";
presoFrame.contentDocument.body.appendChild(injectFrame);
console.log("created iframe", injectFrame);
}
var texts = presoFrame.contentDocument.getElementsByTagName('text');
console.log("", texts.length, "text elements");
var targetText;
for(var i = 0; i < texts.length; ++i) {
console.log("text:", texts[i].textContent);
if(texts[i].textContent === 'Embedding...') {
targetText = texts[i];
}
}
if(targetText) {
console.log("Found target text", targetText);
var rect = targetText.getClientRects()[0];
injectFrame.setAttribute('style', 'position: absolute; z-index: 300; left: ' + Math.round(rect.left) + 'px; top: ' + Math.round(rect.top) + 'px;');
} else {
console.log("deleting iframe");
injectFrame.parentNode.removeChild(injectFrame);
injectFrame = undefined;
}
}, 800);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment