Some courses won't work outside of an LMS. That's annoying when you just want to review a course, so drop this in to provide a fake SCORM API implementation - getAPI should then pick up this fake API.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function extend(a, b) { | |
| var c = {}, attr; | |
| for (attr in a) { | |
| if (Object.prototype.hasOwnProperty.call(a, attr)) { | |
| c[attr] = a[attr]; | |
| } | |
| } | |
| for (attr in b) { | |
| if (Object.prototype.hasOwnProperty.call(b, attr)) { | |
| c[attr] = b[attr]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getQueryParam(param) { | |
| if (!this.params) { | |
| this.params = (function (query) { | |
| var obj = {}; | |
| if (query) { | |
| var i = query.length, keyValuePair; | |
| while (i--) { | |
| keyValuePair = query[i].split('='); | |
| if (keyValuePair[0] && keyValuePair[1]) { | |
| obj[keyValuePair[0]] = keyValuePair[1]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class document { | |
| public static function getElementsByClassName($name) { | |
| global $xpath; | |
| $nodes = array(); | |
| $elements = $xpath->query(sprintf("//div[contains(@class, '%s')]", $name)); | |
| foreach ($elements as $e) { | |
| array_push($nodes, $e); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function list_dir($resource) { | |
| $files = array(); | |
| $scan = glob(rtrim($resource, '/') . '/*'); | |
| if (is_file($resource)) { | |
| array_push($files, $resource); | |
| } | |
| if (is_dir($resource)) { | |
| foreach ($scan as $path) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function str2seq(str:String):String { | |
| var seq:String = "", byte:String, len:Number = str.length, i:Number = 0; | |
| for (; i<len; i++) { | |
| byte = parseInt(ord(str.charAt(i)), 10).toString(2); | |
| seq += "00000000".substr(0, 8-byte.length) + byte; | |
| } | |
| return seq; | |
| } | |
| function seq2str(seq:String):String { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| http = require "http" | |
| url = require "url" | |
| path = require "path" | |
| fs = require "fs" | |
| http.createServer (request, response) -> | |
| file = path.join process.cwd(), url.parse(request.url).pathname | |
| fs.exists file, (exists) -> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app.get "*", (request, response, next) -> | |
| response.header "Access-Control-Allow-Origin", "*" | |
| response.header "Access-Control-Allow-Methods", "GET, SETTINGS" | |
| response.header "Access-Control-Allow-Credentials", "true" | |
| response.header "Access-Control-Max-Age", "0" | |
| response.header "Cache-Control", "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0" | |
| return next() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sanitize = (str, html) -> | |
| replacements = | |
| "\xa9": if html then "©" else "(c)", | |
| "\xae": if html then "®" else "(r)", | |
| "\u2018": "'", | |
| "\u2019": "'", | |
| "\u201c": if html then """ else "\"", | |
| "\u201d": if html then """ else "\"", | |
| "\u2026": "...", | |
| "\u2013": if html then "–" else "-", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function(window){ | |
| var EventDispatcher = window.EventDispatcher = function(scope){ | |
| this.scope = scope; | |
| this.listeners = {}; | |
| }; | |
| EventDispatcher.prototype.addEventListener = function(type, listener){ | |
| if (listener instanceof Function) { | |
| if(!this.listeners[type]) { |