]> _ Git - scorm-scroll.git/commitdiff
wip #4333 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 10 Mar 2021 15:53:01 +0000 (16:53 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 10 Mar 2021 15:53:01 +0000 (16:53 +0100)
imsmanifest.xml
index.html
scorm-scroll.min.js
scorm-scroll.zip [new file with mode: 0644]
scripts/project.js
scripts/scorm.js

index 8b478d8fc4499d1a85c5645717ae87294470652b..57360e273606048c725fb8a75674f5bfaec2747f 100644 (file)
@@ -15,7 +15,7 @@
         <organization identifier="SCORM_ORG" structure="hierarchical">
             <title>$scorm_title</title>
             <item identifier="SCORM_ID" identifierref="SCORM_REF" isvisible="true">
-                <title>$scorm_title</title>
+                <title>SCORM_TITLE</title>
             </item>
         </organization>
     </organizations>
index 9ff079a6cec6ff51722f2e62584aef2d13cf4c2b..10715899dbf1b8df8a42437ea19c244ef189983a 100644 (file)
 <!DOCTYPE html>
-<html>
+<html lang="en">
 <head>
-<html lang="en" >
-<meta name="viewport" content="width=device-width, initial-scale=1"><style>
-body,
-html {
-height: 100%;
-  margin: 0;
-  font-size: 25px;
-  font-family: Myriad Pro, Arial, sans-serif;
-  font-weight: 400;
-  line-height: 1.5em;
-  color: #000;
-  background-color:#322332
-}
-a:link, a:visited {
-  color: #ffffff;
-  font-size: 20px;
-  font-weight: normal;
-  margin-top: 50px;
-  text-decoration: underline;
-}
- h3 {
-        font-size: 40px;
-        font-weight: 900;
-    line-height: 1.2em;
-    color: #fff;
-    }
- h2 {
-        color: rgb(211, 30, 135);
-        font-size: 20px;
-        font-weight: normal;
-        text-transform: uppercase;
-        margin-top: 50px;
-        margin-bottom: 0;
-    }
- h4 {
-        font-size: 30px;
-        font-weight: normal;
-        margin-top: 50px;
-        margin-bottom: 0;
-    }
-  h1 {
-        font-size: 40px;
-        font-weight: 800;
-        line-height: 1.5em;
-    }
-h5 {
-        font-size: 250px;
-        font-weight: bold;
-        margin-top: 50px;
-        margin-bottom: 0;
-    }
-
-
-img.resize {
-  max-width:100%;
-  max-height:100%;
-}
-img.resizemedium {
-  max-width:80%;
-  max-height:80%;
-}
-
-img.resizesmaller {
-  max-width:70%;
-  max-height:70%;
-}
-
-img.resizesmall {
-  max-width:45%;
-  max-height:45%;
-}
-
-img.resizetiny {
-  max-width:20%;
-  max-height:20%;
-}
-img.resizemini {
-  max-width:5%;
-  max-height:5%;
-}
-
-
-.section {
-  text-align: center;
-  padding: 80px 80px;
-}
-
- .section-white {
-  background-color: #fff;
-  color: #322332;
-}
-
- .section-red {
-  background-color: #ff0a0a;
-  color: #fff;
-}
-
-
-.text {
-  position: absolute;
-  padding-left: 15%;
-  top: 60%;
-  width: 80%;
-  text-align: center;
-  color: #000;
-  font-size: 40px;
-  letter-spacing: 8px;
-  text-transform: uppercase;
-    line-height: 1.8em;
-
-}
-
-.text .border {
-  background-color: #322332;
-  color: #fff;
-  padding: 20px;
-}
-
-@media (max-width: 568px) {
-  .firstimg,
-  .secondimg,
-  .thirdimg,
-  .forthimg {
-    background-attachment: scroll;
-  }
-}
-a {
-  text-decoration: none;
-  color: black;
-}
-/*------------------------------------*\
-    Column 
-\*------------------------------------*/
-* {
-  box-sizing: border-box;
-}
-
-/* Create two equal columns that floats next to each other */
-.column {
-  float: left;
-  width: 50%;
-  padding: 0px;
-  height: 150px; /* Should be removed. Only for demonstration */
-}
-
-/* Clear floats after the columns */
-.row:after {
-  content: "";
-  display: table;
-  clear: both;
-}
-
-/* Responsive layout - makes the two columns stack on top of each other instead of next to each other */
-@media screen and (max-width: 600px) {
-  .column {
-    width: 80%;
-  }
-}
-/*------------------------------------*\
-    Column end
-\*------------------------------------*/
-
-
-.responsive {
-  max-width: 100%;
-  height: auto;
-}
-
-/*------------------------------------*\
-  /*. Progress bar. */
-
-.header {
-  position: fixed;
-  text-align: center;
-  top: 0;
-  z-index: 99;
-  width: 100%;
-  background-color: #322331;
-}
-
-.progress-container {
-  width: 100%;
-  height: 6px;
-  background: #fff;
-}
-
-.progress-bar {
-  height: 6px;
-  background: #322332;
-  width: 0%;
-}
-
-.content {
-  padding: 0px 0;
-  margin: 0px auto 0 auto;
-  width: 100%;
-}
- /*. Progress bar end */
- /*------------------------------------*\
-</style> <meta charset="utf-8"/></head>
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <style>
+        body,
+        html {
+            height: 100%;
+            margin: 0;
+            font-size: 25px;
+            font-family: Myriad Pro, Arial, sans-serif;
+            font-weight: 400;
+            line-height: 1.5em;
+            color: #000;
+            background-color: #322332
+        }
+
+        a:link, a:visited {
+            color: #ffffff;
+            font-size: 20px;
+            font-weight: normal;
+            margin-top: 50px;
+            text-decoration: underline;
+        }
+
+        h3 {
+            font-size: 40px;
+            font-weight: 900;
+            line-height: 1.2em;
+            color: #fff;
+        }
+
+        h2 {
+            color: rgb(211, 30, 135);
+            font-size: 20px;
+            font-weight: normal;
+            text-transform: uppercase;
+            margin-top: 50px;
+            margin-bottom: 0;
+        }
+
+        h4 {
+            font-size: 30px;
+            font-weight: normal;
+            margin-top: 50px;
+            margin-bottom: 0;
+        }
+
+        h1 {
+            font-size: 40px;
+            font-weight: 800;
+            line-height: 1.5em;
+        }
+
+        h5 {
+            font-size: 250px;
+            font-weight: bold;
+            margin-top: 50px;
+            margin-bottom: 0;
+        }
+
+
+        img.resize {
+            max-width: 100%;
+            max-height: 100%;
+        }
+
+        img.resizemedium {
+            max-width: 80%;
+            max-height: 80%;
+        }
+
+        img.resizesmaller {
+            max-width: 70%;
+            max-height: 70%;
+        }
+
+        img.resizesmall {
+            max-width: 45%;
+            max-height: 45%;
+        }
+
+        img.resizetiny {
+            max-width: 20%;
+            max-height: 20%;
+        }
+
+        img.resizemini {
+            max-width: 5%;
+            max-height: 5%;
+        }
+
+
+        .section {
+            text-align: center;
+            padding: 80px 80px;
+        }
+
+        .section-white {
+            background-color: #fff;
+            color: #322332;
+        }
+
+        .section-red {
+            background-color: #ff0a0a;
+            color: #fff;
+        }
+
+
+        .text {
+            position: absolute;
+            padding-left: 15%;
+            top: 60%;
+            width: 80%;
+            text-align: center;
+            color: #000;
+            font-size: 40px;
+            letter-spacing: 8px;
+            text-transform: uppercase;
+            line-height: 1.8em;
+
+        }
+
+        .text .border {
+            background-color: #322332;
+            color: #fff;
+            padding: 20px;
+        }
+
+        @media (max-width: 568px) {
+            .firstimg,
+            .secondimg,
+            .thirdimg,
+            .forthimg {
+                background-attachment: scroll;
+            }
+        }
+
+        a {
+            text-decoration: none;
+            color: black;
+        }
+
+        /*------------------------------------*\
+            Column
+        \*------------------------------------*/
+        * {
+            box-sizing: border-box;
+        }
+
+        /* Create two equal columns that floats next to each other */
+        .column {
+            float: left;
+            width: 50%;
+            padding: 0px;
+            height: 150px; /* Should be removed. Only for demonstration */
+        }
+
+        /* Clear floats after the columns */
+        .row:after {
+            content: "";
+            display: table;
+            clear: both;
+        }
+
+        /* Responsive layout - makes the two columns stack on top of each other instead of next to each other */
+        @media screen and (max-width: 600px) {
+            .column {
+                width: 80%;
+            }
+        }
+
+        /*------------------------------------*\
+            Column end
+        \*------------------------------------*/
+
+
+        .responsive {
+            max-width: 100%;
+            height: auto;
+        }
+
+
+        /*------------------------------------*\
+          /*. Progress bar. */
+
+        .header {
+            position: fixed;
+            text-align: center;
+            top: 0;
+            z-index: 99;
+            width: 100%;
+            background-color: #322331;
+        }
+
+        .progress-container {
+            width: 100%;
+            height: 6px;
+            background: #fff;
+        }
+
+        .progress-bar {
+            height: 6px;
+            background: #322332;
+            width: 0%;
+        }
+
+        .content {
+            padding: 0px 0;
+            margin: 0px auto 0 auto;
+            width: 100%;
+        }
+
+        /*. Progress bar end */
+        /*------------------------------------*\
+</style>
+    <meta charset="utf-8"/>
+</head>
 
 <body>
 
 <div class="header">
-  <img class="resize" src="images/html-header-safely.svg" style="min-height:40px;"><br>
-  <div class="progress-container">
-    <div class="progress-bar" id="myBar"></div>
-  </div>  
+    <img class="resize" src="images/html-header-safely.svg" style="min-height:40px;"><br>
+    <div class="progress-container">
+        <div class="progress-bar" id="myBar"></div>
+    </div>
 </div>
 
-    <section class="section section-white">
-        <br><br><br>
-<h1>Introduction</h1>
-              <p><img class="resizesmall" src="images/ VM-working-safely.svg" style="min-height:50px;"></p>
+<section class="section section-white">
+    <br><br><br>
+    <a style="color:#ff0000;" href="javascript:scormComplete();">Mark as complete</a><br>
+    <a style="color:#ff0000;" href="javascript:scormCompleteAndClose();">Mark as complete and close</a><br>
+    <h1>Introduction</h1>
+    <p><img class="resizesmall" src="images/ VM-working-safely.svg" style="min-height:50px;"></p>
 
-<p>At Virgin Media, the safety of our people, partners and customers is paramount and everyone deserves a place to work that is safe and comfortable and to get home safe, every day. 
-In our business, there are plenty of potential risks. Hence our commitment to creating a Zero Harm culture. You are responsible for living the five Zero Harm behaviours every day. </p><br>
+    <p>At Virgin Media, the safety of our people, partners and customers is paramount and everyone deserves a place to
+        work that is safe and comfortable and to get home safe, every day.
+        In our business, there are plenty of potential risks. Hence our commitment to creating a Zero Harm culture. You
+        are responsible for living the five Zero Harm behaviours every day. </p><br>
 
 </section>
 
-    <section class="section section-red">
+<section class="section section-red">
 
-<h1>Why is it important we Be Safe?</h1>
+    <h1>Why is it important we Be Safe?</h1>
 
-   <p><img class="resizetiny" src="images/number-1-roundal-white.svg" style="min-height:50px;"></p>
+    <p><img class="resizetiny" src="images/number-1-roundal-white.svg" style="min-height:50px;"></p>
 
-<p><strong>To avoid injuring ourselves, our work colleagues, our customers, or anyone who might be affected by our work</strong></p>
-                          <p><img class="resizesmall" src="images/VM-safety-everyone.svg" style="min-height:50px;"></p>           
+    <p><strong>To avoid injuring ourselves, our work colleagues, our customers, or anyone who might be affected by our
+        work</strong></p>
+    <p><img class="resizesmall" src="images/VM-safety-everyone.svg" style="min-height:50px;"></p>
 
-<p>The impact of an injury at work doesn't stop with the pain and discomfort of the physical injury. It can be emotionally and mentally damaging to the injured party, witnesses to the injury and those close to the injured party at home, and at work.</p>
-<p>This may result in stress for the injured party, their family and those close to them. Serious injuries could result in long term sickness, financial difficulties, and long-term health complications.</p> <br>
+    <p>The impact of an injury at work doesn't stop with the pain and discomfort of the physical injury. It can be
+        emotionally and mentally damaging to the injured party, witnesses to the injury and those close to the injured
+        party at home, and at work.</p>
+    <p>This may result in stress for the injured party, their family and those close to them. Serious injuries could
+        result in long term sickness, financial difficulties, and long-term health complications.</p> <br>
 
-                <p><img class="resizetiny" src="images/number-2-roundal-white.svg" style="min-height:50px;"></p>
+    <p><img class="resizetiny" src="images/number-2-roundal-white.svg" style="min-height:50px;"></p>
 
-                          <p><img class="resizesmall" src="images/ VM-poor-safety.svg" style="min-height:50px;"></p>
+    <p><img class="resizesmall" src="images/ VM-poor-safety.svg" style="min-height:50px;"></p>
 
-<p><strong>Poor safety can harm our business, as well as our people</strong></p>
+    <p><strong>Poor safety can harm our business, as well as our people</strong></p>
 
-<p>Poor safety practices also cost time and money and that is bad for any business. Possible costs to the business in the event of a serious accident:</p><br>
-                <p><img class="resizemini" src="images/teardrop-white.svg" style="min-height:20px;"></p>
+    <p>Poor safety practices also cost time and money and that is bad for any business. Possible costs to the business
+        in the event of a serious accident:</p><br>
+    <p><img class="resizemini" src="images/teardrop-white.svg" style="min-height:20px;"></p>
 
-<p>downtime at the time of the accident (injured party and witnesses)</p>
-                <p><img class="resizemini" src="images/teardrop-white.svg" style="min-height:20px;"></p>
+    <p>downtime at the time of the accident (injured party and witnesses)</p>
+    <p><img class="resizemini" src="images/teardrop-white.svg" style="min-height:20px;"></p>
 
-<p>downtime for those undertaking and participating in the accident investigation </p>
-                <p><img class="resizemini" src="images/teardrop-white.svg" style="min-height:20px;"></p>
+    <p>downtime for those undertaking and participating in the accident investigation </p>
+    <p><img class="resizemini" src="images/teardrop-white.svg" style="min-height:20px;"></p>
 
-<p>additional labour costs, if injured party is off sick and work needs to be completed on paid overtime, or by employing contractors</p>
-                <p><img class="resizemini" src="images/teardrop-white.svg" style="min-height:20px;"></p>
+    <p>additional labour costs, if injured party is off sick and work needs to be completed on paid overtime, or by
+        employing contractors</p>
+    <p><img class="resizemini" src="images/teardrop-white.svg" style="min-height:20px;"></p>
 
-<p>cost of possible enforcement activity (downtime and potentially fines)</p>
-                <p><img class="resizemini" src="images/teardrop-white.svg" style="min-height:20px;"></p>
+    <p>cost of possible enforcement activity (downtime and potentially fines)</p>
+    <p><img class="resizemini" src="images/teardrop-white.svg" style="min-height:20px;"></p>
 
-<p>cost of defending a personal injury claim </p>
-                <p><img class="resizemini" src="images/teardrop-white.svg" style="min-height:20px;"></p>
+    <p>cost of defending a personal injury claim </p>
+    <p><img class="resizemini" src="images/teardrop-white.svg" style="min-height:20px;"></p>
 
-<p>cost of paying out on a successful claim plus court costs</p>
-                <p><img class="resizemini" src="images/teardrop-white.svg" style="min-height:20px;"></p>
+    <p>cost of paying out on a successful claim plus court costs</p>
+    <p><img class="resizemini" src="images/teardrop-white.svg" style="min-height:20px;"></p>
 
-<p>increased insurance premiums</p>
-                <p><img class="resizemini" src="images/teardrop-white.svg" style="min-height:20px;"></p>
+    <p>increased insurance premiums</p>
+    <p><img class="resizemini" src="images/teardrop-white.svg" style="min-height:20px;"></p>
 
-<p>brand damage and consequent loss of business </p><br>
+    <p>brand damage and consequent loss of business </p><br>
 
 
-<p>Even a minor incident can impact the business.</p>
-<p>We have a brand we are immensely proud of and want to protect, as well as maintain your and our customers’ confidence in us. </p><br>
+    <p>Even a minor incident can impact the business.</p>
+    <p>We have a brand we are immensely proud of and want to protect, as well as maintain your and our customers’
+        confidence in us. </p><br>
 
-                <p><img class="resizetiny" src="images/number-3-roundal-white.svg" style="min-height:50px;"></p>
+    <p><img class="resizetiny" src="images/number-3-roundal-white.svg" style="min-height:50px;"></p>
 
-<h1>It's the law!</h1>
-              <p><img class="resizesmall" src="images/ VM-law.svg" style="min-height:50px;"></p>         
+    <h1>It's the law!</h1>
+    <p><img class="resizesmall" src="images/ VM-law.svg" style="min-height:50px;"></p>
 
 
-<p>The Health and Safety at Work etc Act 1974 is the primary legislation covering occupational health and safety in Great Britain. It sets out the general principles for managing health and safety at work. </p>
-<p><strong>This includes the Duty of Care Responsibilities...</strong></p>
-<p>employers have towards employees and members of the public</p>
-                <p><img class="resizemini" src="images/teardrop-white.svg" style="min-height:20px;"></p>
+    <p>The Health and Safety at Work etc Act 1974 is the primary legislation covering occupational health and safety in
+        Great Britain. It sets out the general principles for managing health and safety at work. </p>
+    <p><strong>This includes the Duty of Care Responsibilities...</strong></p>
+    <p>employers have towards employees and members of the public</p>
+    <p><img class="resizemini" src="images/teardrop-white.svg" style="min-height:20px;"></p>
 
-<p>employees have to themselves and to each other </p>
-                <p><img class="resizemini" src="images/teardrop-white.svg" style="min-height:20px;"></p>
+    <p>employees have to themselves and to each other </p>
+    <p><img class="resizemini" src="images/teardrop-white.svg" style="min-height:20px;"></p>
 
-<p>Our Partners and self-employed workers have towards themselves and others </p><br>
+    <p>Our Partners and self-employed workers have towards themselves and others </p><br>
 
-<p>Looking after your, and others’, health and safety isn’t just down to Virgin Media – legally, it’s down to you too! </p><br>
+    <p>Looking after your, and others’, health and safety isn’t just down to Virgin Media – legally, it’s down to you
+        too! </p><br>
 
 </section>
 
-    <section class="section section-white">
-        
-<h1>The five Zero Harm behaviours to help you</h1>
-              <p><img class="resizesmall" src="images/ VM-zero-harm.svg" style="min-height:50px;"></p>           
+<section class="section section-white">
 
-   <p><img class="resizetiny" src="images/number-1-roundal.svg" style="min-height:50px;"></p>
-<p><strong>Safety First - in everything you do</strong></p>
-  <p>Always think safety first in everything you do both in and out of work.</p><br>
+    <h1>The five Zero Harm behaviours to help you</h1>
+    <p><img class="resizesmall" src="images/ VM-zero-harm.svg" style="min-height:50px;"></p>
 
-                 <p><img class="resizetiny" src="images/number-2-roundal.svg" style="min-height:50px;"></p>
<p><strong>Take care - of yourself and everyone else</strong></p>
-  <p>Always take care of yourself and others</p><br>
+    <p><img class="resizetiny" src="images/number-1-roundal.svg" style="min-height:50px;"></p>
   <p><strong>Safety First - in everything you do</strong></p>
+    <p>Always think safety first in everything you do both in and out of work.</p><br>
 
-   <p><img class="resizetiny" src="images/number-3-roundal.svg" style="min-height:50px;"></p>
-<p><strong>Do the right thing</strong></p>
-  <p>Be vigilant about safety. Follow safe systems of work and always carry out simple risk assessments or Be Safe checks before every job, and if it doesn't feel safe then don’t do it!</p>
-  <p>If ever you are in any doubt speak to your manager or the safety team.</p><br>
+    <p><img class="resizetiny" src="images/number-2-roundal.svg" style="min-height:50px;"></p>
+    <p><strong>Take care - of yourself and everyone else</strong></p>
+    <p>Always take care of yourself and others</p><br>
 
-   <p><img class="resizetiny" src="images/number-4-roundal.svg" style="min-height:50px;"></p>
-<p><strong>Report that stuff</strong></p>
-  <p>Report all unsafe practices or procedures you identify. Knowing about issues helps us put things right, and continually improve health and safety performance.</p><br>
+    <p><img class="resizetiny" src="images/number-3-roundal.svg" style="min-height:50px;"></p>
+    <p><strong>Do the right thing</strong></p>
+    <p>Be vigilant about safety. Follow safe systems of work and always carry out simple risk assessments or Be Safe
+        checks before every job, and if it doesn't feel safe then don’t do it!</p>
+    <p>If ever you are in any doubt speak to your manager or the safety team.</p><br>
 
-   <p><img class="resizetiny" src="images/number-5-roundal.svg" style="min-height:50px;"></p>
-<p><strong>Speak up and own it</strong></p>
-  <p>If you see something or someone you know that is unsafe, you are expected to be confident and challenge the person and do something to make the situation safe. </p><br>
+    <p><img class="resizetiny" src="images/number-4-roundal.svg" style="min-height:50px;"></p>
+    <p><strong>Report that stuff</strong></p>
+    <p>Report all unsafe practices or procedures you identify. Knowing about issues helps us put things right, and
+        continually improve health and safety performance.</p><br>
+
+    <p><img class="resizetiny" src="images/number-5-roundal.svg" style="min-height:50px;"></p>
+    <p><strong>Speak up and own it</strong></p>
+    <p>If you see something or someone you know that is unsafe, you are expected to be confident and challenge the
+        person and do something to make the situation safe. </p><br>
 
-   
-</section>
 
+</section>
+</div>
 <script>
-// When the user scrolls the page, execute myFunction 
-window.onscroll = function() {myFunction()};
-
-function myFunction() {
-  var winScroll = document.body.scrollTop || document.documentElement.scrollTop;
-  var height = document.documentElement.scrollHeight - document.documentElement.clientHeight;
-  var scrolled = (winScroll / height) * 100;
-  document.getElementById("myBar").style.width = scrolled + "%";
-}
+    // When the user scrolls the page, execute myFunction
+    window.onscroll = function () {
+        myFunction()
+    };
+
+    function myFunction() {
+        var winScroll = document.body.scrollTop || document.documentElement.scrollTop;
+        var height = document.documentElement.scrollHeight - document.documentElement.clientHeight;
+        var scrolled = (winScroll / height) * 100;
+        document.getElementById("myBar").style.width = scrolled + "%";
+    }
 </script>
 <script>
-var COMPLETE_SCROLL_RATIO=0.98;
-var COMPLETE_ON_CLOSE=true;
+    var COMPLETE_SCROLL_RATIO = 0.98;
+    var COMPLETE_ON_CLOSE = false;
 </script>
 <script src="scorm-scroll.min.js"></script>
-</div>
-</body>
\ No newline at end of file
+</body>
+</html>
\ No newline at end of file
index 8ac1102fec4b2562103f5f44a5d0898fcc684d06..6f945cd39e9b9a49d8e5882cd397f50bc63f0153 100644 (file)
@@ -1 +1 @@
-var pipwerks={UTILS:{},debug:{isActive:!0},SCORM:{version:null,handleCompletionStatus:!0,handleExitMode:!0,API:{handle:null,isFound:!1},connection:{isActive:!1},data:{completionStatus:null,exitStatus:null},debug:{}}};pipwerks.SCORM.isAvailable=function(){return!0},pipwerks.SCORM.API.find=function(e){for(var t=null,i=0,n="SCORM.API.find",s=pipwerks.UTILS.trace,o=pipwerks.SCORM;!e.API&&!e.API_1484_11&&e.parent&&e.parent!=e&&i<=12;)i++,e=e.parent;if(o.version)switch(o.version){case"2004":e.API_1484_11?t=e.API_1484_11:s(n+": SCORM version 2004 was specified by user, but API_1484_11 cannot be found.");break;case"1.2":e.API?t=e.API:s(n+": SCORM version 1.2 was specified by user, but API cannot be found.")}else e.API_1484_11?(o.version="2004",t=e.API_1484_11):e.API&&(o.version="1.2",t=e.API);return t?(s(n+": API found. Version: "+o.version),s("API: "+t)):s(n+": Error finding API. \nFind attempts: "+i+". \nFind attempt limit: 12"),t},pipwerks.SCORM.API.get=function(){var e=null,t=window,i=pipwerks.SCORM,n=i.API.find,s=pipwerks.UTILS.trace;return(e=!(e=!(e=!(e=n(t))&&t.parent&&t.parent!=t?n(t.parent):e)&&t.top&&t.top.opener?n(t.top.opener):e)&&t.top&&t.top.opener&&t.top.opener.document?n(t.top.opener.document):e)?i.API.isFound=!0:s("API.get failed: Can't find the API!"),e},pipwerks.SCORM.API.getHandle=function(){var e=pipwerks.SCORM.API;return e.handle||e.isFound||(e.handle=e.get()),e.handle},pipwerks.SCORM.connection.initialize=function(){var e=!1,t=pipwerks.SCORM,i=t.data.completionStatus,n=pipwerks.UTILS.trace,s=pipwerks.UTILS.StringToBoolean,o=t.debug,r="SCORM.connection.initialize ";if(n("connection.initialize called."),t.connection.isActive)n(r+"aborted: Connection already active.");else{var a=t.API.getHandle(),c=0;if(a){switch(t.version){case"1.2":e=s(a.LMSInitialize(""));break;case"2004":e=s(a.Initialize(""))}if(e)if(null!==(c=o.getCode())&&0===c){if(t.connection.isActive=!0,t.handleCompletionStatus&&(i=t.status("get"))){switch(i){case"not attempted":case"unknown":t.status("set","incomplete"),t.set("cmi.success_status","unknown");break;default:t.status("set",i),t.set("cmi.success_status",t.get("cmi.success_status"))}t.save()}}else e=!1,n(r+"failed. \nError code: "+c+" \nError info: "+o.getInfo(c));else n(null!==(c=o.getCode())&&0!==c?r+"failed. \nError code: "+c+" \nError info: "+o.getInfo(c):r+"failed: No response from server.")}else n(r+"failed: API is null.")}return e},pipwerks.SCORM.connection.terminate=function(){var e=!1,t=pipwerks.SCORM,i=t.data.exitStatus,n=t.data.completionStatus,s=pipwerks.UTILS.trace,o=pipwerks.UTILS.StringToBoolean,r=t.debug,a="SCORM.connection.terminate ";if(t.connection.isActive){var c,l=t.API.getHandle();if(l){if(t.handleExitMode&&!i)if("completed"!==n&&"passed"!==n)switch(t.version){case"1.2":e=t.set("cmi.core.exit","suspend");break;case"2004":e=t.set("cmi.exit","suspend")}else switch(t.version){case"1.2":e=t.set("cmi.core.exit","suspend");break;case"2004":e=t.set("cmi.exit","suspend")}if(e=t.save()){switch(t.version){case"1.2":e=o(l.LMSFinish(""));break;case"2004":e=o(l.Terminate(""))}e?t.connection.isActive=!1:s(a+"failed. \nError code: "+(c=r.getCode())+" \nError info: "+r.getInfo(c))}}else s(a+"failed: API is null.")}else s(a+"aborted: Connection already terminated.");return e},pipwerks.SCORM.data.get=function(e){var t=null,i=pipwerks.SCORM,n=pipwerks.UTILS.trace,s=i.debug,o="SCORM.data.get('"+e+"') ";if(i.connection.isActive){var r,a=i.API.getHandle();if(a){switch(i.version){case"1.2":t=a.LMSGetValue(e);break;case"2004":t=a.GetValue(e)}if(r=s.getCode(),""!==t||0===r)switch(e){case"cmi.core.lesson_status":case"cmi.completion_status":i.data.completionStatus=t;break;case"cmi.core.exit":case"cmi.exit":i.data.exitStatus=t}else n(o+"failed. \nError code: "+r+"\nError info: "+s.getInfo(r))}else n(o+"failed: API is null.")}else n(o+"failed: API connection is inactive.");return n(o+" value: "+t),String(t)},pipwerks.SCORM.data.set=function(e,t){var i=!1,n=pipwerks.SCORM,s=pipwerks.UTILS.trace,o=pipwerks.UTILS.StringToBoolean,r=n.debug,a="SCORM.data.set('"+e+"') ";if(n.connection.isActive){var c,l=n.API.getHandle();if(l){switch(n.version){case"1.2":i=o(l.LMSSetValue(e,t));break;case"2004":i=o(l.SetValue(e,t))}i?"cmi.core.lesson_status"===e||"cmi.completion_status"===e?n.data.completionStatus=t:"cmi.core.exit"!=e&&"cmi.exit"!=e||(n.data.exitStatus=t):s(a+"failed. \nError code: "+(c=r.getCode())+". \nError info: "+r.getInfo(c))}else s(a+"failed: API is null.")}else s(a+"failed: API connection is inactive.");return s(a+" value: "+t),i},pipwerks.SCORM.data.save=function(){var e=!1,t=pipwerks.SCORM,i=pipwerks.UTILS.trace,n=pipwerks.UTILS.StringToBoolean,s="SCORM.data.save failed";if(t.connection.isActive){var o=t.API.getHandle();if(o)switch(t.version){case"1.2":e=n(o.LMSCommit(""));break;case"2004":e=n(o.Commit(""))}else i(s+": API is null.")}else i(s+": API connection is inactive.");return e},pipwerks.SCORM.status=function(e,t){var i=!1,n=pipwerks.SCORM,s=pipwerks.UTILS.trace,o="SCORM.getStatus failed",r="";if(null!==e){switch(n.version){case"1.2":r="cmi.core.lesson_status";break;case"2004":r="cmi.completion_status"}switch(e){case"get":i=n.data.get(r);break;case"set":null!==t?i=n.data.set(r,t):(i=!1,s(o+": status was not specified."));break;default:i=!1,s(o+": no valid action was specified.")}}else s(o+": action was not specified.");return i},pipwerks.SCORM.debug.getCode=function(){var e=pipwerks.SCORM,t=e.API.getHandle(),i=pipwerks.UTILS.trace,n=0;if(t)switch(e.version){case"1.2":n=parseInt(t.LMSGetLastError(),10);break;case"2004":n=parseInt(t.GetLastError(),10)}else i("SCORM.debug.getCode failed: API is null.");return n},pipwerks.SCORM.debug.getInfo=function(e){var t=pipwerks.SCORM,i=t.API.getHandle(),n=pipwerks.UTILS.trace,s="";if(i)switch(t.version){case"1.2":s=i.LMSGetErrorString(e.toString());break;case"2004":s=i.GetErrorString(e.toString())}else n("SCORM.debug.getInfo failed: API is null.");return String(s)},pipwerks.SCORM.debug.getDiagnosticInfo=function(e){var t=pipwerks.SCORM,i=t.API.getHandle(),n=pipwerks.UTILS.trace,s="";if(i)switch(t.version){case"1.2":s=i.LMSGetDiagnostic(e);break;case"2004":s=i.GetDiagnostic(e)}else n("SCORM.debug.getDiagnosticInfo failed: API is null.");return String(s)},pipwerks.SCORM.init=pipwerks.SCORM.connection.initialize,pipwerks.SCORM.get=pipwerks.SCORM.data.get,pipwerks.SCORM.set=pipwerks.SCORM.data.set,pipwerks.SCORM.save=pipwerks.SCORM.data.save,pipwerks.SCORM.quit=pipwerks.SCORM.connection.terminate,pipwerks.UTILS.StringToBoolean=function(e){switch(typeof e){case"object":case"string":return/(true|1)/i.test(e);case"number":return!!e;case"boolean":return e;case"undefined":return null;default:return!1}},pipwerks.UTILS.trace=function(e){pipwerks.debug.isActive&&window.console&&window.console.log&&window.console.log(e)},SCORM=!0,SCORM_INITED=!1,SCORM_START_TIME=null,SCORM_INTERACTION_TIMESTAMPS=[],SCORM_CORRECT_ANSWERS=[],SCORM_ID_TO_N={},SCORM_QUESTIONS=[],SCORM_SUCCESS_STATUS="unknown",SCORM_SUCCESS_SCORE=SCORM_WEIGHTING=0,SCORM_INTERACTIONS_INITED=SCORM_EVENTS_INITED=!1,SCORM_LOCATION_INITED=!1,SCORM_OK=!1;var _CMI12={location:"cmi.core.lesson_location",status:"cmi.core.lesson_status",session_time:"cmi.core.session_time",success_status:"",exit:"cmi.core.exit"},_CMI2004={location:"cmi.location",status:"cmi.completion_status",session_time:"cmi.session_time",success_status:"cmi.success_status",exit:"cmi.exit"};function initScorm(){if(!SCORM_INITED){console.log("init scorm"),SCORM_INITED=!0;try{pipwerks.SCORM.init()&&(SCORM_OK=!0)}catch(e){}try{FORCE_SCORM&&(SCORM_OK=!0)}catch(e){}return SCORM_OK?$(document).on("fluidbook.ready",function(){scormExit(),startScormTimer(),initScormEvents(),initScormInteractions()}):console.log("SCORM nok"),SCORM_OK}}function _cmi(e){var t=null;switch(pipwerks.SCORM.version){case"1.2":t=_CMI12[e];break;case"2004":t=_CMI2004[e]}return t=null==t||null==t?e:t}function initScormEvents(){SCORM_OK&&!SCORM_EVENTS_INITED&&(SCORM_EVENTS_INITED=!0,$(window).on("unload",function(){scormMarkAsComplete(),finishScorm()}),SCORM_LOCATION_INITED||(SCORM_LOCATION_INITED=!0,setInterval(function(){pipwerks.SCORM.save()},5e3)))}function finishScorm(){SCORM_OK&&(setSessionTime(),pipwerks.SCORM.save(),pipwerks.SCORM.quit())}function scormMarkAsComplete(){SCORM_OK&&(scormExit(),setScormValue("status","completed"),setScormValue("success_status","passed"))}function scormExit(){var e;SCORM_OK&&(e="suspend",setScormValue("exit",e=fluidbook.settings.scorm_force_attempts?"1.2"===pipwerks.SCORM.version?"logout":"normal":e))}function startScormTimer(){SCORM_START_TIME=new Date}function scormComplete(){SCORM_OK&&(scormMarkAsComplete(),finishScorm())}function scormCompleteAndClose(){scormComplete(),scormClose()}function scormClose(){parent.close(),top.close(),window.close()}function getScormValue(e){if(!SCORM_OK)return null;e=_cmi(e);return""==e?null:pipwerks.SCORM.get(e)}function setScormValue(e,t){if(SCORM_OK){e=_cmi(e);return""==e?!1:pipwerks.SCORM.set(e,t)}}function setSessionTime(){var e,t,i;SCORM_OK&&(e=(new Date).getTime()-SCORM_START_TIME,"1.2"==pipwerks.SCORM.version?(e-=1e3*(t=Math.floor(e/1e3/60/60))*60*60,t<1e3&&99<t?t="0"+t:t<100&&9<t?t="00"+t:t<10&&(t="000"+t),e-=1e3*(i=Math.floor(e/1e3/60))*60,setScormValue("session_time",t+":"+(i=i<10?"0"+i:i)+":"+(i=(i=Math.floor(e/1e3))<10?"0"+i:i))):setScormValue("session_time",scormSecondsToTimeInterval(e/1e3)))}function dateToScormTime(e){e=e.toISOString().split(".");return e.pop(),e.join(".")}function getScormTimeInterval(e,t){return scormSecondsToTimeInterval(Math.round((t.getTime()-e.getTime())/1e3))}function scormSecondsToTimeInterval(e){var e=Math.round(e),t=Math.floor(e/3600);return e%=3600,"PT"+t+"H"+Math.floor(e/60)+"M"+e%60+"S"}function getWindowScroll(){var e=document.documentElement,t=document.body,i="scrollTop",n="scrollHeight";return(e[i]||t[i])/((e[n]||t[n])-e.clientHeight)}window.addEventListener("scroll",function(){});
\ No newline at end of file
+var pipwerks={UTILS:{},debug:{isActive:!0},SCORM:{version:null,handleCompletionStatus:!0,handleExitMode:!0,API:{handle:null,isFound:!1},connection:{isActive:!1},data:{completionStatus:null,exitStatus:null},debug:{}}};pipwerks.SCORM.isAvailable=function(){return!0},pipwerks.SCORM.API.find=function(e){for(var t=null,i=0,n="SCORM.API.find",s=pipwerks.UTILS.trace,o=pipwerks.SCORM;!e.API&&!e.API_1484_11&&e.parent&&e.parent!=e&&i<=12;)i++,e=e.parent;if(o.version)switch(o.version){case"2004":e.API_1484_11?t=e.API_1484_11:s(n+": SCORM version 2004 was specified by user, but API_1484_11 cannot be found.");break;case"1.2":e.API?t=e.API:s(n+": SCORM version 1.2 was specified by user, but API cannot be found.")}else e.API_1484_11?(o.version="2004",t=e.API_1484_11):e.API&&(o.version="1.2",t=e.API);return t?(s(n+": API found. Version: "+o.version),s("API: "+t)):s(n+": Error finding API. \nFind attempts: "+i+". \nFind attempt limit: 12"),t},pipwerks.SCORM.API.get=function(){var e=null,t=window,i=pipwerks.SCORM,n=i.API.find,s=pipwerks.UTILS.trace;return(e=!(e=!(e=!(e=n(t))&&t.parent&&t.parent!=t?n(t.parent):e)&&t.top&&t.top.opener?n(t.top.opener):e)&&t.top&&t.top.opener&&t.top.opener.document?n(t.top.opener.document):e)?i.API.isFound=!0:s("API.get failed: Can't find the API!"),e},pipwerks.SCORM.API.getHandle=function(){var e=pipwerks.SCORM.API;return e.handle||e.isFound||(e.handle=e.get()),e.handle},pipwerks.SCORM.connection.initialize=function(){var e=!1,t=pipwerks.SCORM,i=t.data.completionStatus,n=pipwerks.UTILS.trace,s=pipwerks.UTILS.StringToBoolean,o=t.debug,r="SCORM.connection.initialize ";if(n("connection.initialize called."),t.connection.isActive)n(r+"aborted: Connection already active.");else{var a=t.API.getHandle(),c=0;if(a){switch(t.version){case"1.2":e=s(a.LMSInitialize(""));break;case"2004":e=s(a.Initialize(""))}if(e)if(null!==(c=o.getCode())&&0===c){if(t.connection.isActive=!0,t.handleCompletionStatus&&(i=t.status("get"))){switch(i){case"not attempted":case"unknown":t.status("set","incomplete"),t.set("cmi.success_status","unknown");break;default:t.status("set",i),t.set("cmi.success_status",t.get("cmi.success_status"))}t.save()}}else e=!1,n(r+"failed. \nError code: "+c+" \nError info: "+o.getInfo(c));else n(null!==(c=o.getCode())&&0!==c?r+"failed. \nError code: "+c+" \nError info: "+o.getInfo(c):r+"failed: No response from server.")}else n(r+"failed: API is null.")}return e},pipwerks.SCORM.connection.terminate=function(){var e=!1,t=pipwerks.SCORM,i=t.data.exitStatus,n=t.data.completionStatus,s=pipwerks.UTILS.trace,o=pipwerks.UTILS.StringToBoolean,r=t.debug,a="SCORM.connection.terminate ";if(t.connection.isActive){var c,l=t.API.getHandle();if(l){if(t.handleExitMode&&!i)if("completed"!==n&&"passed"!==n)switch(t.version){case"1.2":e=t.set("cmi.core.exit","suspend");break;case"2004":e=t.set("cmi.exit","suspend")}else switch(t.version){case"1.2":e=t.set("cmi.core.exit","suspend");break;case"2004":e=t.set("cmi.exit","suspend")}if(e=t.save()){switch(t.version){case"1.2":e=o(l.LMSFinish(""));break;case"2004":e=o(l.Terminate(""))}e?t.connection.isActive=!1:s(a+"failed. \nError code: "+(c=r.getCode())+" \nError info: "+r.getInfo(c))}}else s(a+"failed: API is null.")}else s(a+"aborted: Connection already terminated.");return e},pipwerks.SCORM.data.get=function(e){var t=null,i=pipwerks.SCORM,n=pipwerks.UTILS.trace,s=i.debug,o="SCORM.data.get('"+e+"') ";if(i.connection.isActive){var r,a=i.API.getHandle();if(a){switch(i.version){case"1.2":t=a.LMSGetValue(e);break;case"2004":t=a.GetValue(e)}if(r=s.getCode(),""!==t||0===r)switch(e){case"cmi.core.lesson_status":case"cmi.completion_status":i.data.completionStatus=t;break;case"cmi.core.exit":case"cmi.exit":i.data.exitStatus=t}else n(o+"failed. \nError code: "+r+"\nError info: "+s.getInfo(r))}else n(o+"failed: API is null.")}else n(o+"failed: API connection is inactive.");return n(o+" value: "+t),String(t)},pipwerks.SCORM.data.set=function(e,t){var i=!1,n=pipwerks.SCORM,s=pipwerks.UTILS.trace,o=pipwerks.UTILS.StringToBoolean,r=n.debug,a="SCORM.data.set('"+e+"') ";if(n.connection.isActive){var c,l=n.API.getHandle();if(l){switch(n.version){case"1.2":i=o(l.LMSSetValue(e,t));break;case"2004":i=o(l.SetValue(e,t))}i?"cmi.core.lesson_status"===e||"cmi.completion_status"===e?n.data.completionStatus=t:"cmi.core.exit"!=e&&"cmi.exit"!=e||(n.data.exitStatus=t):s(a+"failed. \nError code: "+(c=r.getCode())+". \nError info: "+r.getInfo(c))}else s(a+"failed: API is null.")}else s(a+"failed: API connection is inactive.");return s(a+" value: "+t),i},pipwerks.SCORM.data.save=function(){var e=!1,t=pipwerks.SCORM,i=pipwerks.UTILS.trace,n=pipwerks.UTILS.StringToBoolean,s="SCORM.data.save failed";if(t.connection.isActive){var o=t.API.getHandle();if(o)switch(t.version){case"1.2":e=n(o.LMSCommit(""));break;case"2004":e=n(o.Commit(""))}else i(s+": API is null.")}else i(s+": API connection is inactive.");return e},pipwerks.SCORM.status=function(e,t){var i=!1,n=pipwerks.SCORM,s=pipwerks.UTILS.trace,o="SCORM.getStatus failed",r="";if(null!==e){switch(n.version){case"1.2":r="cmi.core.lesson_status";break;case"2004":r="cmi.completion_status"}switch(e){case"get":i=n.data.get(r);break;case"set":null!==t?i=n.data.set(r,t):(i=!1,s(o+": status was not specified."));break;default:i=!1,s(o+": no valid action was specified.")}}else s(o+": action was not specified.");return i},pipwerks.SCORM.debug.getCode=function(){var e=pipwerks.SCORM,t=e.API.getHandle(),i=pipwerks.UTILS.trace,n=0;if(t)switch(e.version){case"1.2":n=parseInt(t.LMSGetLastError(),10);break;case"2004":n=parseInt(t.GetLastError(),10)}else i("SCORM.debug.getCode failed: API is null.");return n},pipwerks.SCORM.debug.getInfo=function(e){var t=pipwerks.SCORM,i=t.API.getHandle(),n=pipwerks.UTILS.trace,s="";if(i)switch(t.version){case"1.2":s=i.LMSGetErrorString(e.toString());break;case"2004":s=i.GetErrorString(e.toString())}else n("SCORM.debug.getInfo failed: API is null.");return String(s)},pipwerks.SCORM.debug.getDiagnosticInfo=function(e){var t=pipwerks.SCORM,i=t.API.getHandle(),n=pipwerks.UTILS.trace,s="";if(i)switch(t.version){case"1.2":s=i.LMSGetDiagnostic(e);break;case"2004":s=i.GetDiagnostic(e)}else n("SCORM.debug.getDiagnosticInfo failed: API is null.");return String(s)},pipwerks.SCORM.init=pipwerks.SCORM.connection.initialize,pipwerks.SCORM.get=pipwerks.SCORM.data.get,pipwerks.SCORM.set=pipwerks.SCORM.data.set,pipwerks.SCORM.save=pipwerks.SCORM.data.save,pipwerks.SCORM.quit=pipwerks.SCORM.connection.terminate,pipwerks.UTILS.StringToBoolean=function(e){switch(typeof e){case"object":case"string":return/(true|1)/i.test(e);case"number":return!!e;case"boolean":return e;case"undefined":return null;default:return!1}},pipwerks.UTILS.trace=function(e){pipwerks.debug.isActive&&window.console&&window.console.log&&window.console.log(e)},SCORM=!0,SCORM_INITED=!1,SCORM_START_TIME=null,SCORM_INTERACTION_TIMESTAMPS=[],SCORM_CORRECT_ANSWERS=[],SCORM_ID_TO_N={},SCORM_QUESTIONS=[],SCORM_SUCCESS_STATUS="unknown",SCORM_SUCCESS_SCORE=SCORM_WEIGHTING=0,SCORM_INTERACTIONS_INITED=SCORM_EVENTS_INITED=!1,SCORM_LOCATION_INITED=!1,SCORM_OK=!1;var COMPLETE_ON_CLOSE,_CMI12={location:"cmi.core.lesson_location",status:"cmi.core.lesson_status",session_time:"cmi.core.session_time",success_status:"",exit:"cmi.core.exit"},_CMI2004={location:"cmi.location",status:"cmi.completion_status",session_time:"cmi.session_time",success_status:"cmi.success_status",exit:"cmi.exit"};function initScorm(){if(!SCORM_INITED){console.log("init scorm"),SCORM_INITED=!0;try{pipwerks.SCORM.init()&&(SCORM_OK=!0)}catch(e){}try{FORCE_SCORM&&(SCORM_OK=!0)}catch(e){}return SCORM_OK?(scormExit(),startScormTimer(),initScormEvents()):console.log("SCORM nok"),SCORM_OK}}function _cmi(e){var t=null;switch(pipwerks.SCORM.version){case"1.2":t=_CMI12[e];break;case"2004":t=_CMI2004[e]}return t=null==t||null==t?e:t}function initScormEvents(){SCORM_OK&&!SCORM_EVENTS_INITED&&(SCORM_EVENTS_INITED=!0,SCORM_LOCATION_INITED||(SCORM_LOCATION_INITED=!0,setInterval(function(){pipwerks.SCORM.save()},5e3)))}function finishScorm(){SCORM_OK&&(setSessionTime(),pipwerks.SCORM.save(),pipwerks.SCORM.quit())}function scormMarkAsComplete(){SCORM_OK&&(scormExit(),setScormValue("status","completed"),setScormValue("success_status","passed"))}function scormExit(){SCORM_OK&&setScormValue("exit","suspend")}function startScormTimer(){SCORM_START_TIME=new Date}function scormComplete(){scormMarkAsComplete()}function scormCompleteAndClose(){scormComplete(),finishScorm(),scormClose()}function scormClose(){parent.close(),top.close(),window.close()}function getScormValue(e){if(!SCORM_OK)return null;e=_cmi(e);return""==e?null:pipwerks.SCORM.get(e)}function setScormValue(e,t){if(SCORM_OK){e=_cmi(e);return""==e?!1:pipwerks.SCORM.set(e,t)}}function setSessionTime(){var e,t,i;SCORM_OK&&(e=(new Date).getTime()-SCORM_START_TIME,"1.2"==pipwerks.SCORM.version?(e-=1e3*(t=Math.floor(e/1e3/60/60))*60*60,t<1e3&&99<t?t="0"+t:t<100&&9<t?t="00"+t:t<10&&(t="000"+t),e-=1e3*(i=Math.floor(e/1e3/60))*60,setScormValue("session_time",t+":"+(i=i<10?"0"+i:i)+":"+(i=(i=Math.floor(e/1e3))<10?"0"+i:i))):setScormValue("session_time",scormSecondsToTimeInterval(e/1e3)))}function dateToScormTime(e){e=e.toISOString().split(".");return e.pop(),e.join(".")}function getScormTimeInterval(e,t){return scormSecondsToTimeInterval(Math.round((t.getTime()-e.getTime())/1e3))}function scormSecondsToTimeInterval(e){var e=Math.round(e),t=Math.floor(e/3600);return e%=3600,"PT"+t+"H"+Math.floor(e/60)+"M"+e%60+"S"}function getWindowScroll(){var e=document.documentElement,t=document.body,i="scrollTop",n="scrollHeight";return(e[i]||t[i])/((e[n]||t[n])-e.clientHeight)}void 0===COMPLETE_ON_CLOSE&&(COMPLETE_SCROLL_RATIO=1),void 0===COMPLETE_ON_CLOSE&&(COMPLETE_ON_CLOSE=!0);var COMPLETED=!1;document.addEventListener("DOMContentLoaded",function(){initScorm()}),window.addEventListener("scroll",function(){var e=getWindowScroll();return!COMPLETED&&e>=COMPLETE_SCROLL_RATIO&&(COMPLETED=!0,scormComplete()),!0}),window.addEventListener("unload",function(){COMPLETE_ON_CLOSE&&scormMarkAsComplete(),finishScorm()});
\ No newline at end of file
diff --git a/scorm-scroll.zip b/scorm-scroll.zip
new file mode 100644 (file)
index 0000000..8feb596
Binary files /dev/null and b/scorm-scroll.zip differ
index 25595289a6ea3860c4b61ff4bbe6276a40721a3f..404a588199797bd2b29b47f3e0df24dab9ba73cb 100644 (file)
@@ -4,10 +4,24 @@ if (COMPLETE_ON_CLOSE === undefined) {
 if (COMPLETE_ON_CLOSE === undefined) {
     var COMPLETE_ON_CLOSE = true;
 }
+var COMPLETED = false;
+
+document.addEventListener("DOMContentLoaded", function () {
+    initScorm();
+});
 
 window.addEventListener('scroll', function () {
-    if (getWindowScroll() >= COMPLETE_SCROLL_RATIO) {
+    var scroll = getWindowScroll();
+    if (!COMPLETED && scroll >= COMPLETE_SCROLL_RATIO) {
+        COMPLETED = true;
         scormComplete();
     }
     return true;
+});
+
+window.addEventListener('unload', function () {
+    if (COMPLETE_ON_CLOSE) {
+        scormMarkAsComplete();
+    }
+    finishScorm();
 });
\ No newline at end of file
index bb53ae25e7f789e289ebe58fb8c02a6869e21d37..06a9acecdd5b73515c6d198b31239d30736c8bcb 100644 (file)
@@ -52,12 +52,9 @@ function initScorm() {
     }
 
     if (SCORM_OK) {
-        $(document).on('fluidbook.ready', function () {
-            scormExit();
-            startScormTimer();
-            initScormEvents();
-            initScormInteractions();
-        });
+        scormExit();
+        startScormTimer();
+        initScormEvents();
     } else {
         console.log('SCORM nok');
     }
@@ -86,13 +83,6 @@ function initScormEvents() {
     }
     SCORM_EVENTS_INITED = true;
 
-    $(window).on('unload', function () {
-        if (COMPLETE_ON_CLOSE) {
-            scormMarkAsComplete();
-        }
-        finishScorm();
-    });
-
     if (SCORM_LOCATION_INITED) {
         return;
     }
@@ -183,14 +173,6 @@ function scormExit() {
         return;
     }
     var v = 'suspend';
-    if (fluidbook.settings.scorm_force_attempts) {
-        if (pipwerks.SCORM.version === '1.2') {
-            v = 'logout';
-        } else {
-            v = 'normal';
-        }
-    }
-
     setScormValue('exit', v);
 }
 
@@ -199,15 +181,12 @@ function startScormTimer() {
 }
 
 function scormComplete() {
-    if (SCORM_OK) {
-        scormMarkAsComplete();
-        finishScorm();
-        return;
-    }
+    scormMarkAsComplete();
 }
 
 function scormCompleteAndClose() {
     scormComplete();
+    finishScorm();
     scormClose();
 }