forked from thexerteproject/xerteonlinetoolkits
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rloObject.js
118 lines (97 loc) · 5.16 KB
/
rloObject.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/**
* Licensed to The Apereo Foundation under one or more contributor license
* agreements. See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
* The Apereo Foundation licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
rloObject = function(w,h,rloFile,xmlPath,xmlFile,site,link_id){
var rloWidth = w;
var rloHeight = h;
var rloFile = rloFile
var rloID = rloFile.substr(0, rloFile.lastIndexOf('.')).replace(/[^a-zA-Z0-9]+/g,'');
var scorm = false;
var templateData =xmlFile;
var templatePath = rloFile.substr(0, rloFile.lastIndexOf('/') + 1);
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 &&
navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
document.write('<SCRIPT LANGUAGE=VBScript\> \n');
document.write('on error resume next \n');
document.write('Sub ' + rloID + '_FSCommand(ByVal command, ByVal args)\n');
document.write(' call ' + rloID + '_DoFSCommand(command, args)\n');
document.write('end sub\n');
document.write('</SCRIPT\> \n');
//flag the browser
browser = 'ie';
} else {
browser = 'mozilla'; //no voice or speech capabilities
}
function getLocation(){
var loc;
var searchStr;
searchStr = document.location.search.toString();
searchStr = searchStr.substr(1);
templateData = searchStr.split('&')[1].split('=')[1];
loc = templateData.substr(0, templateData.lastIndexOf('/') + 1);
return loc;
}
var FileLocation = xmlPath;
document.write('<script language = "JavaScript">');
document.write('function ' + rloID + '_DoFSCommand(command, args){');
document.write('if (command == "messageBox"){');
document.write('alert(args);');
document.write('return true;');
document.write('}');
document.write('if (command == "resize"){');
document.write(' document.getElementById("rlo'+ rloID + '").style.width = args.substr(0, args.indexOf(","))+"px"; ');
document.write(' document.getElementById("rlo'+ rloID + '").style.height = args.substr(args.indexOf(",") + 1, args.length)+"px"; ');
document.write('}');
document.write('if (command == "fullscreen"){');
document.write(' document.getElementById("rlo'+ rloID + '").style.width = "100%"; ');
document.write(' document.getElementById("rlo'+ rloID + '").style.height = "100%"; ');
document.write('}');
document.write('if (command == "speak"){');
document.write(' VoiceObj.Speak(args, 3);');
document.write('}');
document.write('if (command == "stopTTS"){');
document.write(' VoiceObj.Speak("", 2);');
document.write('}');
document.write('}');
document.write('</script> ');
document.writeln('<div id="rlo' + rloID + '"style="padding:0px; width:' + rloWidth + 'px; height:' + rloHeight + 'px;"');
document.writeln('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" Codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" WIDTH="'+rloWidth+'" HEIGHT="'+rloHeight+'" id="' + rloID + '" ALIGN="middle">');
document.writeln('<param name="movie" value="MainPreloader.swf" />');
document.writeln('<param name="quality" value="high" />');
document.writeln('<param name="scale" value="showAll" />');
document.writeln('<param name="salign" value="T" />');
document.writeln('<param name="bgcolor" value="#ffffff" />');
document.writeln('<param name="allowScriptAccess" value="always" />');
document.writeln('<param name="seamlessTabbing" value="0" />');
document.writeln('<param name="flashVars" value="File=' + rloFile + '&FileLocation=' + FileLocation + '&scorm=' + scorm + '&browser=' + browser + '&templateData=' + templateData + '&templatePath=' + templatePath + '&site_url=' + site + '&linkID=' + link_id + '"/>');
document.writeln('<embed src="MainPreloader.swf" allowScriptAccess="always" quality="high" scale="showAll" salign="T" bgcolor="#ffffff" WIDTH="100%" HEIGHT="100%" NAME="' + rloID + '" ALIGN="middle" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" flashVars="File=' + rloFile + '&FileLocation=' + FileLocation + '&scorm=' + scorm + '&browser=' + browser + '&templateData=' + templateData + '&templatePath=' + templatePath + '&site_url=' + site + '&linkID=' + link_id + '"/>');
document.writeln('</object>');
document.writeln('</div>');
}
function getUrlParam(pairName){
var searchString = location.search;
var pairVal = "";
searchString = searchString.substring(1);
var nvPairs = searchString.split("&");
for (i = 0; i < nvPairs.length; i++)
{
var nvPair = nvPairs[i].split("=");
if (nvPair[0] == pairName){
pairVal = nvPair[1];
}
}
return pairVal;
}