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 flatObj(obj) { | |
| if (!obj || typeof obj !== 'object' || obj instanceof Array) { | |
| throw new TypeError('flatObj() arguments need be object'); | |
| } | |
| var result = {}; | |
| for (var x in obj) { | |
| if (obj[x] && typeof obj[x] === 'object') { | |
| for (var y in obj[x]) { | |
| result[x + '_' + y] = obj[x][y]; | |
| } |
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 getUrlVars() { | |
| var url = decodeURIComponent(window.location.href); | |
| var vars = {}; | |
| var hashes = url.split("?")[1]; | |
| var hash = hashes.split('&'); | |
| for (var i = 0; i < hash.length; i++) { | |
| params = hash[i].split("="); | |
| vars[params[0]] = params[1]; |