This file contains 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 isRegionOverlap(region1, region2) { | |
var min = Math.min; | |
var max = Math.max; | |
var left = max(region1.left,region2.left); | |
var top = min(-region1.top,-region2.top); | |
var right = min(region1.right,region2.right); | |
var bottom = max(-region1.bottom,-region2.bottom); | |
return right > left && top > bottom; | |
} |
This file contains 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
/** | |
* Fetches and inserts a script into the page before the first | |
* pre-existing script element, and optionally calls a callback | |
* on completion. | |
* | |
* [TODO] Make this a module of its own so it can be used elsewhere. | |
* | |
* @param {String} src source of the script | |
* @param {Function} callback (optional) onload callback | |
*/ |