Skip to content

Instantly share code, notes, and snippets.

@prochor666
Last active July 26, 2016 19:10
Show Gist options
  • Select an option

  • Save prochor666/c79f6ffc0f0786a45b8e0db3eab2a2c9 to your computer and use it in GitHub Desktop.

Select an option

Save prochor666/c79f6ffc0f0786a45b8e0db3eab2a2c9 to your computer and use it in GitHub Desktop.
Nebula browser
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);
}
};
};
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