Skip to content

Instantly share code, notes, and snippets.

@luckycdev
Created August 31, 2022 16:24
Show Gist options
  • Save luckycdev/99a884d9082d2e556734a854393450cb to your computer and use it in GitHub Desktop.
Save luckycdev/99a884d9082d2e556734a854393450cb to your computer and use it in GitHub Desktop.
Bookmarklet to play eclipse emulator in your current tab in a corner

Puts an iframe with Eclipse Emulator on your current page in a small corner with a close button

press escape or the close button to close it

Code:

javascript:
((function()%7Bvar a,b,c;
c="https://eclipseemu.me/play",
b=document.createElement("iframe"),
b.setAttribute("src",c),
b.setAttribute("id","eclipse"),
b.setAttribute("style","width: 30%; height: 30%; right:0px; bottom:0px; border:none; position:fixed;z-index:20; overflow:hidden;"),
b.setAttribute("mozallowfullscreen","true"),
b.setAttribute("allow","autoplay,autoplay; fullscreen *; geolocation; microphone; camera; midi; monetization; xr-spatial-tracking; gamepad; gyroscope; accelerometer; xr"),
b.setAttribute("frameborder","0"),
b.setAttribute("msallowfullscreen","true"),
b.setAttribute("scrolling","yes"),
b.setAttribute("allowfullscreen","true"),
b.setAttribute("webkitallowfullscreen","true"),
b.setAttribute("allowtransparency","true"),
a=document.getElementsByTagName("body")%5B0%5D,
a.appendChild(b)%7D)).call(this);
var btn=document.createElement("button");
document.body.appendChild(btn);
btn.innerHTML="Close";
btn.setAttribute("style","position:absolute;right:0px;bottom:200px;");
btn.onclick=function()
{
document.getElementById("eclipse").parentNode.removeChild(document.getElementById("eclipse"));
btn.setAttribute("id","btn1");
document.getElementById("btn1").parentNode.removeChild(document.getElementById("btn1"));
};
document.onkeydown=function(evt)
{
evt=evt||window.event;
var closekey=false;
if("key" in evt)
{
closekey=(evt.key === "Escape"||evt.key==="Esc");
}
else
{
closekey=(evt.keycode === 27);
}
if(closekey)
{
document.getElementById("eclipse").parentNode.removeChild(document.getElementById("eclipse"));
btn.setAttribute("id","btn1");
document.getElementById("btn1").parentNode.removeChild(document.getElementById("btn1"));
}
};

Bookmarklet:

javascript:((function()%7Bvar a,b,c;c="https://eclipseemu.me/play",b=document.createElement("iframe"),b.setAttribute("src",c),b.setAttribute("id","eclipse"),b.setAttribute("style","width: 30%; height: 30%; right:0px; bottom:0px; border:none; position:fixed;z-index:20; overflow:hidden;"),b.setAttribute("mozallowfullscreen","true"),b.setAttribute("allow","autoplay,autoplay; fullscreen *; geolocation; microphone; camera; midi; monetization; xr-spatial-tracking; gamepad; gyroscope; accelerometer; xr"),b.setAttribute("frameborder","0"),b.setAttribute("msallowfullscreen","true"),b.setAttribute("scrolling","yes"),b.setAttribute("allowfullscreen","true"),b.setAttribute("webkitallowfullscreen","true"),b.setAttribute("allowtransparency","true"),a=document.getElementsByTagName("body")%5B0%5D,a.appendChild(b)%7D)).call(this);var btn=document.createElement("button");document.body.appendChild(btn);btn.innerHTML="Close";btn.setAttribute("style","position:absolute;right:0px;bottom:200px;");btn.onclick=function(){document.getElementById("eclipse").parentNode.removeChild(document.getElementById("eclipse"));btn.setAttribute("id","btn1");document.getElementById("btn1").parentNode.removeChild(document.getElementById("btn1"));};document.onkeydown=function(evt){evt=evt||window.event;var closekey=false;if("key" in evt){closekey=(evt.key === "Escape"||evt.key==="Esc");} else { closekey=(evt.keycode === 27);} if(closekey) {document.getElementById("eclipse").parentNode.removeChild(document.getElementById("eclipse"));btn.setAttribute("id","btn1");document.getElementById("btn1").parentNode.removeChild(document.getElementById("btn1"));}};
javascript:((function()%7Bvar a,b,c;c="https://eclipseemu.me/play",b=document.createElement("iframe"),b.setAttribute("src",c),b.setAttribute("id","eclipse"),b.setAttribute("style","width: 30%; height: 30%; right:0px; bottom:0px; border:none; position:fixed;z-index:20; overflow:hidden;"),b.setAttribute("mozallowfullscreen","true"),b.setAttribute("allow","autoplay,autoplay; fullscreen *; geolocation; microphone; camera; midi; monetization; xr-spatial-tracking; gamepad; gyroscope; accelerometer; xr"),b.setAttribute("frameborder","0"),b.setAttribute("msallowfullscreen","true"),b.setAttribute("scrolling","yes"),b.setAttribute("allowfullscreen","true"),b.setAttribute("webkitallowfullscreen","true"),b.setAttribute("allowtransparency","true"),a=document.getElementsByTagName("body")%5B0%5D,a.appendChild(b)%7D)).call(this);var btn=document.createElement("button");document.body.appendChild(btn);btn.innerHTML="Close";btn.setAttribute("style","position:absolute;right:0px;bottom:200px;");btn.onclick=function(){document.getElementById("eclipse").parentNode.removeChild(document.getElementById("eclipse"));btn.setAttribute("id","btn1");document.getElementById("btn1").parentNode.removeChild(document.getElementById("btn1"));};document.onkeydown=function(evt){evt=evt||window.event;var closekey=false;if("key" in evt){closekey=(evt.key === "Escape"||evt.key==="Esc");} else { closekey=(evt.keycode === 27);} if(closekey) {document.getElementById("eclipse").parentNode.removeChild(document.getElementById("eclipse"));btn.setAttribute("id","btn1");document.getElementById("btn1").parentNode.removeChild(document.getElementById("btn1"));}};
@luckycdev
Copy link
Author

doesnt work for some reason on google docs or slides or gmail or classroom and stuff idk why

@luckycdev
Copy link
Author

to press escape to close you have to click out of it first idk why

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment