Created
February 5, 2016 08:43
-
-
Save motss/056ed1ea95f162ed4062 to your computer and use it in GitHub Desktop.
Full year calendar for Firebase
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 () { | |
| try { | |
| var _ = require('lodash'); | |
| }catch (err) { | |
| if (err) { | |
| try { | |
| typeof _ === 'function'; | |
| }catch (err) { | |
| if (err) { | |
| console.log('script-src'); | |
| var script = document.createElement('script'); | |
| script.type = 'text/javascript'; | |
| script.src = 'https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.10.1/lodash.min.js'; | |
| document.head.appendChild(script); | |
| } | |
| } | |
| } | |
| } | |
| })(document); | |
| var _ref = new Firebase('https://polymer-semaphore.firebaseio.com/mockMessages'); | |
| var _siteData = { | |
| "alpha": { | |
| "01level": { | |
| "freedom tower": { | |
| "capacity": 0, | |
| "floor": "Level 1", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "000" | |
| }, | |
| "taipei 101": { | |
| "capacity": 6, | |
| "floor": "Level 1", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "C03" | |
| }, | |
| "the shard": { | |
| "capacity": 6, | |
| "floor": "Level 1", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "081" | |
| }, | |
| "twin towers": { | |
| "capacity": 4, | |
| "floor": "Level 1", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "803" | |
| }, | |
| "willis tower": { | |
| "capacity": 10, | |
| "floor": "Level 1", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "481" | |
| } | |
| }, | |
| "02level": { | |
| "acetyls": { | |
| "capacity": 10, | |
| "floor": "Level 2", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "C81" | |
| }, | |
| "aromatics": { | |
| "capacity": 6, | |
| "floor": "Level 2", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "081" | |
| }, | |
| "bitumen": { | |
| "capacity": 6, | |
| "floor": "Level 2", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "C03" | |
| }, | |
| "hydrocarbon": { | |
| "capacity": 4, | |
| "floor": "Level 2", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "003" | |
| }, | |
| "lubricant": { | |
| "capacity": 4, | |
| "floor": "Level 2", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "000" | |
| }, | |
| "olefin": { | |
| "capacity": 0, | |
| "floor": "Level 2", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "083" | |
| } | |
| }, | |
| "03level": { | |
| "dowjones": { | |
| "capacity": 4, | |
| "floor": "Level 3", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "003" | |
| }, | |
| "euronext": { | |
| "capacity": 0, | |
| "floor": "Level 3", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "083" | |
| }, | |
| "ftse": { | |
| "capacity": 6, | |
| "floor": "Level 3", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "081" | |
| }, | |
| "hangseng": { | |
| "capacity": 10, | |
| "floor": "Level 3", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "C81" | |
| }, | |
| "nikkei": { | |
| "capacity": 6, | |
| "floor": "Level 3", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "C43" | |
| } | |
| }, | |
| "04level": { | |
| "austen": { | |
| "capacity": 6, | |
| "floor": "Level 3A", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "803" | |
| }, | |
| "dickens": { | |
| "capacity": 4, | |
| "floor": "Level 3A", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "003" | |
| }, | |
| "eliot": { | |
| "capacity": 6, | |
| "floor": "Level 3A", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "081" | |
| }, | |
| "rowling": { | |
| "capacity": 0, | |
| "floor": "Level 3A", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "083" | |
| }, | |
| "twain": { | |
| "capacity": 10, | |
| "floor": "Level 3A", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "881" | |
| } | |
| }, | |
| "05level": { | |
| "daffodil": { | |
| "capacity": 6, | |
| "floor": "Level 5", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "081" | |
| }, | |
| "golden wattle": { | |
| "capacity": 4, | |
| "floor": "Level 5", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "003" | |
| }, | |
| "hibiscus": { | |
| "capacity": 4, | |
| "floor": "Level 5", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "003" | |
| }, | |
| "orchid": { | |
| "capacity": 0, | |
| "floor": "Level 5", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "083" | |
| }, | |
| "protea": { | |
| "capacity": 6, | |
| "floor": "Level 5", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "C03" | |
| }, | |
| "raflesia": { | |
| "capacity": 10, | |
| "floor": "Level 5", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "C81" | |
| }, | |
| "rose": { | |
| "capacity": 4, | |
| "floor": "Level 5", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "003" | |
| }, | |
| "tulip": { | |
| "capacity": 4, | |
| "floor": "Level 5", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "003" | |
| } | |
| }, | |
| "06level": { | |
| "courage": { | |
| "capacity": 4, | |
| "floor": "Level 6", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "003" | |
| }, | |
| "exellence": { | |
| "capacity": 10, | |
| "floor": "Level 6", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "881" | |
| }, | |
| "one team": { | |
| "capacity": 6, | |
| "floor": "Level 6", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "803" | |
| }, | |
| "respect": { | |
| "capacity": 6, | |
| "floor": "Level 6", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "081" | |
| }, | |
| "values": { | |
| "capacity": 0, | |
| "floor": "Level 6", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "083" | |
| } | |
| }, | |
| "07level": { | |
| "alpha": { | |
| "capacity": 6, | |
| "floor": "Level 7", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "003" | |
| }, | |
| "beta": { | |
| "capacity": 4, | |
| "floor": "Level 7", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "003" | |
| }, | |
| "delta": { | |
| "capacity": 4, | |
| "floor": "Level 7", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "881" | |
| }, | |
| "gamma": { | |
| "capacity": 6, | |
| "floor": "Level 7", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "881" | |
| }, | |
| "kappa": { | |
| "capacity": 10, | |
| "floor": "Level 7", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "881" | |
| }, | |
| "omega": { | |
| "capacity": 0, | |
| "floor": "Level 7", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "083" | |
| }, | |
| "sigma": { | |
| "capacity": 4, | |
| "floor": "Level 7", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "003" | |
| }, | |
| "zeta": { | |
| "capacity": 4, | |
| "floor": "Level 7", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "003" | |
| } | |
| }, | |
| "08level": { | |
| "angsana": { | |
| "capacity": 4, | |
| "floor": "Level 8", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "003" | |
| }, | |
| "cendana": { | |
| "capacity": 10, | |
| "floor": "Level 8", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "811" | |
| }, | |
| "chengal": { | |
| "capacity": 4, | |
| "floor": "Level 8", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "003" | |
| }, | |
| "jati": { | |
| "capacity": 6, | |
| "floor": "Level 8", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "881" | |
| }, | |
| "meranti": { | |
| "capacity": 4, | |
| "floor": "Level 8", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "003" | |
| }, | |
| "seraya": { | |
| "capacity": 4, | |
| "floor": "Level 8", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "003" | |
| }, | |
| "teak": { | |
| "capacity": 0, | |
| "floor": "Level 8", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "083" | |
| } | |
| }, | |
| "09level": { | |
| "batu caves": { | |
| "capacity": 14, | |
| "floor": "Level 9", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "881" | |
| }, | |
| "batu ferringi": { | |
| "capacity": 12, | |
| "floor": "Level 9", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "081" | |
| }, | |
| "cherating": { | |
| "capacity": 8, | |
| "floor": "Level 9", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "081" | |
| }, | |
| "gunung ledang": { | |
| "capacity": 8, | |
| "floor": "Level 9", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "081" | |
| }, | |
| "jonker street": { | |
| "capacity": 4, | |
| "floor": "Level 9", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "003" | |
| }, | |
| "kinabalu": { | |
| "capacity": 6, | |
| "floor": "Level 9", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "004" | |
| }, | |
| "klcc": { | |
| "capacity": 4, | |
| "floor": "Level 9", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "003" | |
| }, | |
| "lake melati": { | |
| "capacity": 8, | |
| "floor": "Level 9", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "881" | |
| }, | |
| "limestone": { | |
| "capacity": 14, | |
| "floor": "Level 9", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "881" | |
| }, | |
| "minangkabau": { | |
| "capacity": 18, | |
| "floor": "Level 9", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "881" | |
| }, | |
| "putrajaya": { | |
| "capacity": 4, | |
| "floor": "Level 9", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "002" | |
| }, | |
| "silat": { | |
| "capacity": 0, | |
| "floor": "Level 9", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "083" | |
| }, | |
| "songket": { | |
| "capacity": 8, | |
| "floor": "Level 9", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "081" | |
| }, | |
| "wellness room": { | |
| "capacity": 0, | |
| "floor": "Level 9", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "000" | |
| } | |
| }, | |
| "10level": { | |
| "degas": { | |
| "capacity": 4, | |
| "floor": "Level 10", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "003" | |
| }, | |
| "michaelangelo": { | |
| "capacity": 4, | |
| "floor": "Level 10", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "003" | |
| }, | |
| "monet": { | |
| "capacity": 6, | |
| "floor": "Level 10", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "003" | |
| }, | |
| "picasso": { | |
| "capacity": 6, | |
| "floor": "Level 10", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "881" | |
| }, | |
| "renoir": { | |
| "capacity": 0, | |
| "floor": "Level 10", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "083" | |
| }, | |
| "sisley": { | |
| "capacity": 4, | |
| "floor": "Level 10", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "003" | |
| }, | |
| "van gogh": { | |
| "capacity": 10, | |
| "floor": "Level 10", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "881" | |
| } | |
| }, | |
| "11level": { | |
| "anise": { | |
| "capacity": 6, | |
| "floor": "Level 11", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "003" | |
| }, | |
| "cardamom": { | |
| "capacity": 0, | |
| "floor": "Level 11", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "083" | |
| }, | |
| "cinnamon": { | |
| "capacity": 10, | |
| "floor": "Level 11", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "881" | |
| }, | |
| "clove": { | |
| "capacity": 6, | |
| "floor": "Level 11", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "881" | |
| }, | |
| "peppercorn": { | |
| "capacity": 4, | |
| "floor": "Level 11", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "003" | |
| }, | |
| "sesame": { | |
| "capacity": 4, | |
| "floor": "Level 11", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "003" | |
| }, | |
| "tamarind": { | |
| "capacity": 4, | |
| "floor": "Level 11", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "003" | |
| }, | |
| "tumeric": { | |
| "capacity": 4, | |
| "floor": "Level 11", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "003" | |
| } | |
| }, | |
| "12level": { | |
| "amethyst": { | |
| "capacity": 6, | |
| "floor": "Level 12", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "003" | |
| }, | |
| "diamond": { | |
| "capacity": 4, | |
| "floor": "Level 12", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "003" | |
| }, | |
| "emerald": { | |
| "capacity": 6, | |
| "floor": "Level 12", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "881" | |
| }, | |
| "garnet": { | |
| "capacity": 10, | |
| "floor": "Level 12", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "809" | |
| }, | |
| "pearl": { | |
| "capacity": 0, | |
| "floor": "Level 12", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "083" | |
| }, | |
| "sapphire": { | |
| "capacity": 4, | |
| "floor": "Level 12", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "003" | |
| }, | |
| "topaz": { | |
| "capacity": 4, | |
| "floor": "Level 12", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "003" | |
| }, | |
| "zircon": { | |
| "capacity": 0, | |
| "floor": "Level 12", | |
| "site": "KLB - Tower 5", | |
| "time": "0", | |
| "types": "003" | |
| } | |
| } | |
| }, | |
| "beta": { | |
| "03level": { | |
| "benz": { | |
| "capacity": 4, | |
| "floor": "Level 3", | |
| "site": "KLB - Tower 2A", | |
| "time": "0", | |
| "types": "080" | |
| }, | |
| "edison": { | |
| "capacity": 8, | |
| "floor": "Level 3", | |
| "site": "KLB - Tower 2A", | |
| "time": "0", | |
| "types": "880" | |
| }, | |
| "einstein": { | |
| "capacity": 0, | |
| "floor": "Level 3", | |
| "site": "KLB - Tower 2A", | |
| "time": "0", | |
| "types": "002" | |
| }, | |
| "fleming": { | |
| "capacity": 4, | |
| "floor": "Level 3", | |
| "site": "KLB - Tower 2A", | |
| "time": "0", | |
| "types": "802" | |
| }, | |
| "franklin": { | |
| "capacity": 6, | |
| "floor": "Level 3", | |
| "site": "KLB - Tower 2A", | |
| "time": "0", | |
| "types": "802" | |
| }, | |
| "graham": { | |
| "capacity": 6, | |
| "floor": "Level 3", | |
| "site": "KLB - Tower 2A", | |
| "time": "0", | |
| "types": "880" | |
| }, | |
| "newton": { | |
| "capacity": 0, | |
| "floor": "Level 3", | |
| "site": "KLB - Tower 2A", | |
| "time": "0", | |
| "types": "002" | |
| }, | |
| "whitney": { | |
| "capacity": 10, | |
| "floor": "Level 3", | |
| "site": "KLB - Tower 2A", | |
| "time": "0", | |
| "types": "880" | |
| } | |
| } | |
| }, | |
| "gamma": { | |
| "01level": { | |
| "collaborate": { | |
| "capacity": 8, | |
| "floor": "Level 1", | |
| "site": "SUITE", | |
| "time": "0", | |
| "types": "081" | |
| }, | |
| "create": { | |
| "capacity": 10, | |
| "floor": "Level 1", | |
| "site": "SUITE", | |
| "time": "0", | |
| "types": "881" | |
| }, | |
| "fun": { | |
| "capacity": 0, | |
| "floor": "Level 1", | |
| "site": "SUITE", | |
| "time": "0", | |
| "types": "083" | |
| }, | |
| "grow": { | |
| "capacity": 10, | |
| "floor": "Level 1", | |
| "site": "SUITE", | |
| "time": "0", | |
| "types": "903" | |
| }, | |
| "idea": { | |
| "capacity": 8, | |
| "floor": "Level 1", | |
| "site": "SUITE", | |
| "time": "0", | |
| "types": "081" | |
| }, | |
| "innovate": { | |
| "capacity": 10, | |
| "floor": "Level 1", | |
| "site": "SUITE", | |
| "time": "0", | |
| "types": "881" | |
| }, | |
| "inspire": { | |
| "capacity": 12, | |
| "floor": "Level 1", | |
| "site": "SUITE", | |
| "time": "0", | |
| "types": "103" | |
| }, | |
| "lead": { | |
| "capacity": 10, | |
| "floor": "Level 1", | |
| "site": "SUITE", | |
| "time": "0", | |
| "types": "983" | |
| }, | |
| "meet": { | |
| "capacity": 4, | |
| "floor": "Level 1", | |
| "site": "SUITE", | |
| "time": "0", | |
| "types": "003" | |
| }, | |
| "team": { | |
| "capacity": 6, | |
| "floor": "Level 1", | |
| "site": "SUITE", | |
| "time": "0", | |
| "types": "103" | |
| }, | |
| "think": { | |
| "capacity": 4, | |
| "floor": "Level 1", | |
| "site": "SUITE", | |
| "time": "0", | |
| "types": "003" | |
| } | |
| } | |
| } | |
| }; | |
| var _reservationsData = { | |
| "0800": { | |
| "person": false, | |
| "subject": false, | |
| "time": false | |
| }, | |
| "0830": { | |
| "person": false, | |
| "subject": false, | |
| "time": false | |
| }, | |
| "0900": { | |
| "person": false, | |
| "subject": false, | |
| "time": false | |
| }, | |
| "0930": { | |
| "person": false, | |
| "subject": false, | |
| "time": false | |
| }, | |
| "1000": { | |
| "person": false, | |
| "subject": false, | |
| "time": false | |
| }, | |
| "1030": { | |
| "person": false, | |
| "subject": false, | |
| "time": false | |
| }, | |
| "1100": { | |
| "person": false, | |
| "subject": false, | |
| "time": false | |
| }, | |
| "1130": { | |
| "person": false, | |
| "subject": false, | |
| "time": false | |
| }, | |
| "1200": { | |
| "person": false, | |
| "subject": false, | |
| "time": false | |
| }, | |
| "1230": { | |
| "person": false, | |
| "subject": false, | |
| "time": false | |
| }, | |
| "1300": { | |
| "person": false, | |
| "subject": false, | |
| "time": false | |
| }, | |
| "1330": { | |
| "person": false, | |
| "subject": false, | |
| "time": false | |
| }, | |
| "1400": { | |
| "person": false, | |
| "subject": false, | |
| "time": false | |
| }, | |
| "1430": { | |
| "person": false, | |
| "subject": false, | |
| "time": false | |
| }, | |
| "1500": { | |
| "person": false, | |
| "subject": false, | |
| "time": false | |
| }, | |
| "1530": { | |
| "person": false, | |
| "subject": false, | |
| "time": false | |
| }, | |
| "1600": { | |
| "person": false, | |
| "subject": false, | |
| "time": false | |
| }, | |
| "1630": { | |
| "person": false, | |
| "subject": false, | |
| "time": false | |
| }, | |
| "1700": { | |
| "person": false, | |
| "subject": false, | |
| "time": false | |
| }, | |
| "1730": { | |
| "person": false, | |
| "subject": false, | |
| "time": false | |
| }, | |
| "1800": { | |
| "person": false, | |
| "subject": false, | |
| "time": false | |
| }, | |
| "1830": { | |
| "person": false, | |
| "subject": false, | |
| "time": false | |
| }, | |
| "1900": { | |
| "person": false, | |
| "subject": false, | |
| "time": false | |
| }, | |
| "1930": { | |
| "person": false, | |
| "subject": false, | |
| "time": false | |
| }, | |
| "2000": { | |
| "person": false, | |
| "subject": false, | |
| "time": false | |
| }, | |
| "2030": { | |
| "person": false, | |
| "subject": false, | |
| "time": false | |
| }, | |
| "2100": { | |
| "person": false, | |
| "subject": false, | |
| "time": false | |
| }, | |
| "2130": { | |
| "person": false, | |
| "subject": false, | |
| "time": false | |
| }, | |
| "2200": { | |
| "person": false, | |
| "subject": false, | |
| "time": false | |
| }, | |
| "2230": { | |
| "person": false, | |
| "subject": false, | |
| "time": false | |
| }, | |
| "2300": { | |
| "person": false, | |
| "subject": false, | |
| "time": false | |
| }, | |
| "2330": { | |
| "person": false, | |
| "subject": false, | |
| "time": false | |
| } | |
| }; | |
| var _wholeMonth = []; | |
| var _year = 2017; | |
| // http://www.calendar-365.com/calendar/2016/January.html | |
| function getWeekNumber (_fulldate) { | |
| var _now = new Date(_fulldate); | |
| _now = new Date(_now.getFullYear(), _now.getMonth(), _now.getDate() - _now.getDay() + 4); | |
| var _onejan = new Date(_now.getFullYear(), 0, 1); | |
| return Math.ceil(((_now - _onejan) / 86400000 + 1) / 7); | |
| } | |
| function _perDay (_fulldate, _data) { | |
| var _newDate = new Date(_fulldate); | |
| if (_newDate.getDay() > 0 && _newDate.getDay() < 6) { | |
| return _data; | |
| }else { | |
| return ""; | |
| } | |
| } | |
| // 0, 2, 4, 6, 7, 9, 11 = 31 | |
| // 3, 5, 8, 10 = 30 | |
| // 1 = 28/29 | |
| function datesForAMonth (_fullyear, _month) { | |
| function _twoDigits (_number) { | |
| var _numString = ('00' + _number).slice(-2); | |
| return _numString; | |
| } | |
| var _monthArray = []; | |
| for (var i = 0; i < 12; i++) { | |
| var _day = 31; | |
| if (i === 1) { | |
| _day = new Date(_fullyear, _month, 29).getMonth() === 1 ? 29 : 28; | |
| }else if (i === 3 || i === 5 || i === 8 || i === 10) { | |
| _day = 30 | |
| } | |
| } | |
| for (var j = 1; j <= _day; j++) { | |
| _monthArray.push(_fullyear + '-' + _twoDigits(_month + 1) + '-' + _twoDigits(j)); | |
| } | |
| return _monthArray; | |
| } | |
| // main code | |
| var obj = {}; | |
| for (var i = 0; i < 12; i++) { | |
| var _monthName = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december']; | |
| var _weekdayName = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']; | |
| var monthIdx = ('00' + i).slice(-2); | |
| var month = monthIdx + _monthName[i]; | |
| obj[month] = {}; | |
| var alldatesInAMonth = datesForAMonth(_year, i); | |
| for (var j = 0, len = alldatesInAMonth.length; j < len; j++) { | |
| var _weekNumber = 'week' + ('00' + getWeekNumber(alldatesInAMonth[j])).slice(-2); | |
| var _dayNumber = ('00' + new Date(alldatesInAMonth[j]).getDate()).slice(-2); | |
| if (_.isUndefined(obj[month][_weekNumber])) { | |
| obj[month][_weekNumber] = {}; | |
| } | |
| if (_.isUndefined(obj[month][_weekNumber][_dayNumber])) { | |
| obj[month][_weekNumber][_dayNumber] = {}; | |
| } | |
| obj[month][_weekNumber][_dayNumber]['site'] = _perDay(alldatesInAMonth[j], _siteData); | |
| obj[month][_weekNumber][_dayNumber]['day'] = _weekdayName[new Date(alldatesInAMonth[j]).getDay()]; | |
| obj[month][_weekNumber][_dayNumber]['reservations'] = _perDay(alldatesInAMonth[j], _reservationsData); | |
| } | |
| } | |
| console.log(obj); | |
| _ref.child(_year).set(obj); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment