MDL-15950 MDL-15640 MDL-15943 - SCORM player.php not inserting footer, Showing SCORM...
[moodle-linuxchix.git] / mod / scorm / rd.js
blobe4c3f3d1dcc331e13d7d11d02d30751e571a0133
1 <!--
2 function scorm_get_element_style(obj, prop, cssProp) {
3 var ret = '';
5 if (obj.currentStyle) {
6 ret = obj.currentStyle[prop];
7 } else if (document.defaultView && document.defaultView.getComputedStyle) {
8 var compStyle = document.defaultView.getComputedStyle(obj, null);
9 ret = compStyle.getPropertyValue(cssProp);
12 if (ret == 'auto') ret = '0';
13 return ret;
16 function scorm_resize () {
17 var winwidth = 0, winheight = 0;
18 if( typeof( window.innerWidth ) == 'number' ) {
19 //Non-IE
20 winwidth = window.innerWidth;
21 winheight = window.innerHeight;
22 } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
23 //IE 6+ in 'standards compliant mode'
24 winwidth = document.documentElement.clientWidth;
25 winheight = document.documentElement.clientHeight;
26 } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
27 //IE 4 compatible
28 winwidth = document.body.clientWidth;
29 winheight = document.body.clientHeight;
32 var header = document.getElementById('header');
33 var content = document.getElementById('content');
34 var headerheight = 0;
35 if (content) {
36 headerheight = content.offsetTop;
39 var footer = document.getElementById('footer');
40 var imsnavbar = document.getElementById('tochead');
41 var scormtop = document.getElementById('scormtop');
42 var footerheight = 0;
43 var imsnavheight = 0;
44 var scormtopheight = 0;
45 if (footer) {
46 footerheight = footer.offsetHeight + parseInt(scorm_get_element_style(footer, 'marginTop', 'margin-top')) + parseInt(scorm_get_element_style(footer, 'marginBottom', 'margin-bottom'));
48 if (imsnavbar) {
49 imsnavheight = imsnavbar.offsetHeight;
51 if (scormtop) {
52 scormtopheight = scormtop.offsetHeight;
55 var topmargin = parseInt(scorm_get_element_style(document.getElementsByTagName('body')[0], 'marginTop', 'margin-top'));
56 var bottommargin = parseInt(scorm_get_element_style(document.getElementsByTagName('body')[0], 'marginBottom', 'margin-bottom'));
58 var totalheight = headerheight +
59 footerheight +
60 scormtopheight+
61 topmargin +
62 bottommargin+10; // +10 to save a minor vertical scroll always present!
64 var totalheighttoc = totalheight+imsnavheight;
65 var toctree = document.getElementById('toctree');
66 if (toctree != null){
67 var toctreeHeight = toctree.offsetHeight;
68 document.getElementById('toctree').style.height = (winheight - totalheighttoc) + 'px';
69 var scoframe2 = document.getElementById('scoframe1');
70 document.getElementById('scormobject').style.height = (winheight - totalheight) + 'px';
71 }else{
72 var scoframe2 = document.getElementById('scoframe1');
73 document.getElementById('scormobject').style.height = (winheight - totalheight) + 'px';
76 // resize the content container too to move the footer below the SCORM content
77 var contenti3 = document.getElementById('content-i3');
78 if (contenti3) {
79 contenti3.style.height = (winheight - totalheight + 30) + 'px';
80 } else {
81 document.getElementById('content').style.height = (winheight - totalheight + 30) + 'px';
83 // resize the content container too to move the footer below the SCORM content
84 var contenti3 = document.getElementById('content-i3');
85 if (contenti3) {
86 contenti3.style.height = (winheight - totalheight + 30) + 'px';
87 } else {
88 document.getElementById('content').style.height = (winheight - totalheight + 30) + 'px';
91 -->