mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
something with web
This commit is contained in:
47
src/server/web/pages/template/html/main.js
Normal file
47
src/server/web/pages/template/html/main.js
Normal file
@@ -0,0 +1,47 @@
|
||||
|
||||
(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;
|
||||
})();
|
||||
Reference in New Issue
Block a user