Last active
July 26, 2016 19:10
-
-
Save prochor666/c79f6ffc0f0786a45b8e0db3eab2a2c9 to your computer and use it in GitHub Desktop.
Nebula browser
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 Browser = function(_hub) | |
| { | |
| var self = this; | |
| self.element = '.browser table tbody'; | |
| self.get = function(_options) | |
| { | |
| var _settings = { | |
| fulltext : "", | |
| result : [], | |
| }; | |
| $.extend(_settings, _options); | |
| _hub.r({ | |
| url: '/api/get', | |
| stack: false, | |
| data: JSON.stringify( _settings ), | |
| type: 'POST', | |
| preloader: true, | |
| notifyDone: false, | |
| notifyFail: true, | |
| notifyError: true, | |
| postError: _hub.utils.log, | |
| postFail: _hub.utils.log, | |
| postDone: load | |
| }); | |
| }; | |
| // This will throw some data to the DOM element | |
| var load = function(data) | |
| { | |
| assets = data["data"]; | |
| for (i in assets) | |
| { | |
| asset = assets[i]; | |
| var row = $('<tr></tr>'); | |
| for(col in asset) | |
| { | |
| row.append('<td>'+ asset[col] +'</td>'); | |
| } | |
| $(self.element).append(row); | |
| } | |
| }; | |
| }; |
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 browser = new Browser(App); | |
| browser.get({ | |
| fulltext : "search", | |
| result : ["title", "genre", "_duration@" ,"id"], | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment