Skip to content

Instantly share code, notes, and snippets.

@mathieuancelin
Created January 20, 2012 14:24
Show Gist options
  • Save mathieuancelin/1647577 to your computer and use it in GitHub Desktop.
Save mathieuancelin/1647577 to your computer and use it in GitHub Desktop.
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/1.4.0/bootstrap.min.css"></link>
</head>
<body>
<a href="#" class="btn success" onclick="openPopup(
new Array(
{
url:'pop.html?videoId=video1',
x:100,
y:600,
width:400,
height:120
}
))">Open Video 1 from file video2.swf)</a>
<a href="#" class="btn success" onclick="openPopup(
new Array(
{
url:'pop.html?videoId=video2',
x:100,
y:600,
width:400,
height:120
}
))">Open Video 2 (from file video2.swf)</a>
<script type="text/javascript">
function openPopup(pageNames) {
for (nbr in pageNames) {
var obj = pageNames[nbr];
var varp ='"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,width=' + obj['width'] + 'px,height=' + obj['height'] + 'px,';
open(obj['url'], 'fenetre' + obj['url'], varp + "left=" + obj['x'] + ", top=" + obj['y']);
}
}
</script>
</body>
</html>
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/1.4.0/bootstrap.min.css"></link>
</head>
<body>
<div id="video">
</div>
<script type="text/javascript">
function getURLParam(strParamName){
var strReturn = "";
var strHref = window.location.href;
if ( strHref.indexOf("?") > -1 ){
var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
var aQueryString = strQueryString.split("&");
for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
if (
aQueryString[iParam].indexOf(strParamName.toLowerCase() + "=") > -1 ){
var aParam = aQueryString[iParam].split("=");
strReturn = aParam[1];
break;
}
}
}
return unescape(strReturn);
}
var id = getURLParam("videoId");
$('#video').html('<object type="application/x-shockwave-flash" width="600px" height="600px" data="' + id + '.swf"><param name="movie" value="' + id + '.swf"/><param name="allowfullscreen" value="true"/></object>');
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment