aboutsummaryrefslogtreecommitdiffhomepage
path: root/public/javascripts
diff options
context:
space:
mode:
Diffstat (limited to 'public/javascripts')
-rw-r--r--public/javascripts/index.js40
1 files changed, 30 insertions, 10 deletions
diff --git a/public/javascripts/index.js b/public/javascripts/index.js
index c0388c55a..5d42f02e0 100644
--- a/public/javascripts/index.js
+++ b/public/javascripts/index.js
@@ -31,6 +31,10 @@
31 makeFriends() 31 makeFriends()
32 }) 32 })
33 33
34 $('#panel_quit_friends').on('click', function () {
35 quitFriends()
36 })
37
34 $('#search-video').on('keyup', function (e) { 38 $('#search-video').on('keyup', function (e) {
35 var search = $(this).val() 39 var search = $(this).val()
36 40
@@ -60,6 +64,17 @@
60 }) 64 })
61 } 65 }
62 66
67 function quitFriends () {
68 $.ajax({
69 url: '/api/v1/pods/quitfriends',
70 type: 'GET',
71 dataType: 'json',
72 success: function () {
73 alert('Quit friends!')
74 }
75 })
76 }
77
63 function printVideos (videos) { 78 function printVideos (videos) {
64 $content.empty() 79 $content.empty()
65 80
@@ -72,8 +87,21 @@
72 87
73 var $video_name = $('<span></span>').addClass('video_name').text(video.name) 88 var $video_name = $('<span></span>').addClass('video_name').text(video.name)
74 var $video_pod = $('<span></span>').addClass('video_pod_url').text(video.podUrl) 89 var $video_pod = $('<span></span>').addClass('video_pod_url').text(video.podUrl)
75 var $remove = $('<span></span>').addClass('span_action glyphicon glyphicon-remove') 90 var $header = $('<div></div>').append([ $video_name, $video_pod ])
76 var $header = $('<div></div>').append([ $video_name, $video_pod, $remove ]) 91
92 if (video.namePath !== null) {
93 var $remove = $('<span></span>').addClass('span_action glyphicon glyphicon-remove')
94
95 // Remove the video
96 $remove.on('click', function () {
97 // TODO
98 if (!confirm('Are you sure ?')) return
99
100 removeVideo(video)
101 })
102
103 $header.append($remove)
104 }
77 105
78 var $video_description = $('<div></div>').addClass('video_description').text(video.description) 106 var $video_description = $('<div></div>').addClass('video_description').text(video.description)
79 107
@@ -82,14 +110,6 @@
82 getVideo(video) 110 getVideo(video)
83 }) 111 })
84 112
85 // Remove the video
86 $remove.on('click', function () {
87 // TODO
88 if (!confirm('Are you sure ?')) return
89
90 removeVideo(video)
91 })
92
93 if (!video.magnetUri) { 113 if (!video.magnetUri) {
94 $remove.css('display', 'none') 114 $remove.css('display', 'none')
95 } 115 }