Skip to content

Instantly share code, notes, and snippets.

@janka102
Last active October 18, 2016 16:07
Show Gist options
  • Save janka102/9029044 to your computer and use it in GitHub Desktop.
Save janka102/9029044 to your computer and use it in GitHub Desktop.
Full-Tab Flash Player
/* This loads jQuery if not already loaded
* Then if there is an iframe, sets the tab url to that iframe url
* ** If there was an iframe, you will need to run this again after the page loads the new page **
* Then it deletes all elements in the body except <object> and <embed> tags
* and sets them to take 100% of the tab size
*
* To make this a bookmarklet (the recommened way to run this),
* create a bookmark and edit the url to be "javascript:" without the quotes
* then open a tab to "http://closure-compiler.appspot.com/",
* then click the view raw button for this gist and copy the url of that
* then back on the Closure Compiler tab paste the url of the raw gist into the Add a url input
* then delete everything in the textarea below that and paste this:
// ==ClosureCompiler==
// @compilation_level SIMPLE_OPTIMIZATIONS
// @output_file_name default.js
// ==/ClosureCompiler==
* and finally click compile and wait for it show up on the right.
* Once it finishes, select it and paste it after the ":" in the bookmark
*/
function fullTab() {
var iframe = $('iframe'),
player = $('object').add('embed');
if (iframe.length && !player.length) {
window.location.href = iframe[0].src;
} else {
if (player.length) {
$('body').css({
'margin': 0,
'padding': 0
});
player.css({
'width': '100vw',
'height': '100vh'
});
$('body').html(player);
}
}
}
if (typeof jQuery === 'undefined') {
var headTag = document.getElementsByTagName('head')[0];
var jq = document.createElement('script');
jq.type = 'text/javascript';
jq.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js';
jq.onload = fullTab;
headTag.appendChild(jq);
} else {
fullTab();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment