Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…912cdd6b-5c7d-d5a7-a2ba-d0f0cdb91641
  • Loading branch information
FayCross committed Feb 2, 2012
1 parent fad42e0 commit 5d55074
Show file tree
Hide file tree
Showing 2 changed files with 185 additions and 1 deletion.
94 changes: 93 additions & 1 deletion modules/xerte/player/rloObject.htm
Expand Up @@ -8,6 +8,98 @@
VoiceObj = new ActiveXObject("Sapi.SpVoice");
}
}

function openWindow(params){
window.open(params.url,'xerte_window',"status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=0,scrollbars=0,left=" + String((screen.width / 2) - (params.width / 2)) + ",top=" + String((screen.height / 2) - (params.height / 2)) + ",height=" + params.height + ",width=" + params.width);
}

function makePopUp(params)
{
//kill any existing popups
var popup = document.getElementById("popup");
var parent = document.getElementById("popup_parent");

if (popup != null)
{
parent.removeChild(popup);
}

//make the div and style it
var create_div = document.createElement("DIV");
create_div.id = params.id;
create_div.style.position = "absolute";
create_div.style.background = params.bgColour;
if (params.borderColour != "none") {
create_div.style.border = "1px solid " + params.borderColour;
}

var stageW = params.width;
var stageH = params.height;
var divNum = Number(params.id.substring(5, params.id.length));
if (params.screenSize == "full screen" || params.screenSize == "fill window" || (params.width == 1600 && params.height == 1200)) {
if (document.body && document.body.offsetWidth) {
stageW = document.body.offsetWidth;
stageH = document.body.offsetHeight;
}
if (document.compatMode=='CSS1Compat' && document.documentElement && document.documentElement.offsetWidth ) {
stageW = document.documentElement.offsetWidth;
stageH = document.documentElement.offsetHeight;
}
if (window.innerWidth && window.innerHeight) {
stageW = window.innerWidth;
stageH = window.innerHeight;
}

if (params.screenSize == "full screen" && stageH / stageW != 0.75) {
var ratio = stageH / stageW;
if (ratio > 0.75) {
stageH = stageW * 0.75;
} else {
stageW = stageH / 0.75;
}
}

}

var divW = stageW / 100 * params.calcW;
var divH = stageH / 100 * params.calcH;
var divX = stageW - ((divW + (stageW / 100 * params.calcX) ) * (divNum + 1));
var divY = stageH / 100 * params.calcY;

create_div.style.width = divW + "px";
create_div.style.height = divH + "px";
create_div.style.left = divX + "px";
create_div.style.top = divY + "px";

if (params.type == 'div'){
create_div.innerHTML = params.src;
} else {
var iframe_create_div = document.createElement("IFRAME");
iframe_create_div.src = params.src;
if (params.type == 'jmol') {
iframe_create_div.src += ';width=' + divW + ';height=' + divH;
}
iframe_create_div.style.height = divH + "px";
iframe_create_div.style.width = divW + "px";
iframe_create_div.frameBorder='no';
create_div.appendChild(iframe_create_div);
}

//finally append the div
parent.appendChild(create_div);
}

function killPopUp()
{
var parent = document.getElementById("popup_parent");
if ( parent.hasChildNodes() )
{
while ( parent.childNodes.length >= 1 )
{
parent.removeChild( parent.firstChild );
}
}
}
</script>
<script type="text/javascript" src = "rloObject.js"></script>
</head>
Expand All @@ -19,6 +111,6 @@
myRLO = new rloObject('change_width','change_height','learningobject.rlt');
</script>
</div>

<div id="popup_parent"/>
</body>
</html>
92 changes: 92 additions & 0 deletions modules/xerte/scorm/scormRLO.htm
Expand Up @@ -19,6 +19,98 @@
}
}

function openWindow(params){
window.open(params.url,'xerte_window',"status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=0,scrollbars=0,left=" + String((screen.width / 2) - (params.width / 2)) + ",top=" + String((screen.height / 2) - (params.height / 2)) + ",height=" + params.height + ",width=" + params.width);
}

function makePopUp(params)
{
//kill any existing popups
var popup = document.getElementById("popup");
var parent = document.getElementById("popup_parent");

if (popup != null)
{
parent.removeChild(popup);
}

//make the div and style it
var create_div = document.createElement("DIV");
create_div.id = params.id;
create_div.style.position = "absolute";
create_div.style.background = params.bgColour;
if (params.borderColour != "none") {
create_div.style.border = "1px solid " + params.borderColour;
}

var stageW = params.width;
var stageH = params.height;
var divNum = Number(params.id.substring(5, params.id.length));
if (params.screenSize == "full screen" || params.screenSize == "fill window" || (params.width == 1600 && params.height == 1200)) {
if (document.body && document.body.offsetWidth) {
stageW = document.body.offsetWidth;
stageH = document.body.offsetHeight;
}
if (document.compatMode=='CSS1Compat' && document.documentElement && document.documentElement.offsetWidth ) {
stageW = document.documentElement.offsetWidth;
stageH = document.documentElement.offsetHeight;
}
if (window.innerWidth && window.innerHeight) {
stageW = window.innerWidth;
stageH = window.innerHeight;
}

if (params.screenSize == "full screen" && stageH / stageW != 0.75) {
var ratio = stageH / stageW;
if (ratio > 0.75) {
stageH = stageW * 0.75;
} else {
stageW = stageH / 0.75;
}
}

}

var divW = stageW / 100 * params.calcW;
var divH = stageH / 100 * params.calcH;
var divX = stageW - ((divW + (stageW / 100 * params.calcX) ) * (divNum + 1));
var divY = stageH / 100 * params.calcY;

create_div.style.width = divW + "px";
create_div.style.height = divH + "px";
create_div.style.left = divX + "px";
create_div.style.top = divY + "px";

if (params.type == 'div'){
create_div.innerHTML = params.src;
} else {
var iframe_create_div = document.createElement("IFRAME");
iframe_create_div.src = params.src;
if (params.type == 'jmol') {
iframe_create_div.src += ';width=' + divW + ';height=' + divH;
}
iframe_create_div.style.height = divH + "px";
iframe_create_div.style.width = divW + "px";
iframe_create_div.frameBorder='no';
create_div.appendChild(iframe_create_div);
}

//finally append the div
parent.appendChild(create_div);
}

function killPopUp()
{
var parent = document.getElementById("popup_parent");
if ( parent.hasChildNodes() )
{
while ( parent.childNodes.length >= 1 )
{
parent.removeChild( parent.firstChild );
}
}
}

function MainPreloader_DoFSCommand(command, args){
if (command == "messageBox"){
alert(args);
Expand Down

0 comments on commit 5d55074

Please sign in to comment.