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
| var ValueMapper = { | |
| normalise: function(value, low, high) { | |
| var range = high - low; | |
| return (value - low) / range; | |
| }, | |
| transform: function(value, inputLow, inputHigh, outputLow, outputHigh) { | |
| var normal = this.normalise(value, inputLow, inputHigh); | |
| return normal * (outputHigh - outputLow) + outputLow; | |
| } |
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 cloneObject(objectToClone) { | |
| var key, i, clonedArray = []; | |
| var clone = {}; | |
| if(typeof objectToClone == "object") { | |
| if(objectToClone.length == undefined) { | |
| for(key in objectToClone){ | |
| clone[key] = cloneObject(objectToClone[key]); | |
| } | |
| } else { // we're an array or string | |
| clone = objectToClone.slice(0) |
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
| var url = document.URL, | |
| currentLocation = url.split("//"), | |
| newURL = "", | |
| path = ""; | |
| if(currentLocation[0] == "file:"){ | |
| path = url.substring(11, url.length); | |
| newURL = "http://localhost/" + path; | |
| } | |
| document.location = newURL; |