Created
March 28, 2023 19:33
-
-
Save vinsworldcom/3ca062d917e677a34538f2b8d6b4d1a8 to your computer and use it in GitHub Desktop.
Tumblr JavaScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getQueryVariable(variable) { | |
var query = window.location.search.substring(1); | |
var vars = query.split("&"); | |
for (var i=0;i<vars.length;i++) { | |
var pair = vars[i].split("="); | |
if (pair[0] == variable) { | |
return pair[1]; | |
} | |
} | |
} | |
function autoResize(id){ | |
var scaling = 100; | |
var scalingFactor = 5; | |
var width = window.innerWidth | |
|| document.documentElement.clientWidth | |
|| document.body.clientWidth; | |
var height = window.innerHeight | |
|| document.documentElement.clientHeight | |
|| document.body.clientHeight; | |
if (width > scaling*scalingFactor) { | |
width -= scaling; | |
} | |
if (height > scaling*scalingFactor) { | |
height -= scaling; | |
} | |
var orig =document.getElementById(id); | |
orig.height = height; | |
orig.width = width; | |
var world = getQueryVariable("world"); | |
if (world != null) { | |
var unescapedurl = unescape(world); | |
var fullurl = 'https://sites.google.com/site/vinsworldcomsite/home/' + unescapedurl; | |
var clone=orig.cloneNode(true); | |
clone.setAttribute('src',fullurl); | |
orig.parentNode.replaceChild(clone,orig); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment