mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
47 lines
1.1 KiB
JavaScript
47 lines
1.1 KiB
JavaScript
|
|
(function() {
|
|
const Torrent = Backbone.Model.extend({
|
|
defaults: function() {
|
|
return {
|
|
title: "",
|
|
torr: {},
|
|
url:"/torrents"
|
|
};
|
|
},
|
|
remove: function() {
|
|
this.destroy();
|
|
},
|
|
fetch: function (){
|
|
const collection = this;
|
|
getTorrent(this.torr.hash, function (torr){
|
|
console.log(torr);
|
|
collection.reset(torr);
|
|
})
|
|
}
|
|
});
|
|
|
|
var TorrentList = Backbone.Collection.extend({
|
|
model: Torrent,
|
|
update: function(){
|
|
listTorrent(function(torrs){
|
|
// torrs.forEach(tr=>
|
|
//
|
|
// )
|
|
Torrents.create({title:""});
|
|
console.log(Torrents);
|
|
},function (error) {
|
|
console.log(error);
|
|
});
|
|
}
|
|
});
|
|
|
|
var AppView = Backbone.View.extend({
|
|
el: $("#torrents"),
|
|
initialize: function() {
|
|
Torrents.update();
|
|
},
|
|
});
|
|
|
|
var Torrents = new TorrentList;
|
|
var App = new AppView;
|
|
})(); |