2011-06-22 23:36:30 +00:00
|
|
|
|
2012-02-01 21:02:43 +00:00
|
|
|
var dir;
|
|
|
|
|
2011-12-05 21:44:30 +00:00
|
|
|
function disableall()
|
|
|
|
{
|
|
|
|
$('button,a,input').disable();
|
|
|
|
}
|
|
|
|
|
2012-08-09 23:06:30 +00:00
|
|
|
function pastedialogue()
|
|
|
|
{
|
|
|
|
$('#pwdialogue').dialog({
|
|
|
|
title: "Pasting from clipboard",
|
|
|
|
modal: true, autoOpen: true,
|
|
|
|
height: 'auto', width: 'auto',
|
|
|
|
show: 'scale', hide: 'fade',
|
|
|
|
draggable: false, resizable: false,
|
|
|
|
closeOnEscape: false,
|
|
|
|
open: function() {
|
|
|
|
$('.ui-dialog-titlebar-close').hide();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2011-12-28 21:36:35 +00:00
|
|
|
function reloadclipboard()
|
|
|
|
{
|
|
|
|
$('#clipboard')
|
|
|
|
.empty()
|
|
|
|
.html('<img src=/img/loading.gif> <i>Loading...</i>')
|
2013-02-25 22:31:54 +00:00
|
|
|
.load('/browse/clipboard.jim', function() {
|
2011-12-28 21:36:35 +00:00
|
|
|
|
|
|
|
// Start Clipboard post-load actions
|
|
|
|
|
2011-12-29 00:57:18 +00:00
|
|
|
if ($('#clipclear').length)
|
2012-08-09 23:06:30 +00:00
|
|
|
{
|
2011-12-29 00:57:18 +00:00
|
|
|
$('#paste').enable();
|
2013-02-27 23:15:37 +00:00
|
|
|
$('#doptmenu,#dooptmenu').enableContextMenuItems('#paste');
|
2012-08-09 23:06:30 +00:00
|
|
|
}
|
2011-12-29 00:57:18 +00:00
|
|
|
else
|
2012-08-09 23:06:30 +00:00
|
|
|
{
|
2011-12-29 00:57:18 +00:00
|
|
|
$('#paste').disable();
|
2013-02-27 23:15:37 +00:00
|
|
|
$('#doptmenu,#dooptmenu').disableContextMenuItems('#paste');
|
2012-08-09 23:06:30 +00:00
|
|
|
}
|
2011-12-29 00:57:18 +00:00
|
|
|
|
2011-12-28 21:36:35 +00:00
|
|
|
$('#clipclear').button().click(function() {
|
2013-02-25 22:31:54 +00:00
|
|
|
$.get('/browse/clipboard.jim?act=clear', function() {
|
2011-12-28 21:36:35 +00:00
|
|
|
reloadclipboard();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
$('a.clipdel').click(function() {
|
2013-02-25 22:31:54 +00:00
|
|
|
$.get('/browse/clipboard.jim?act=remove&path=' +
|
2011-12-28 21:36:35 +00:00
|
|
|
$(this).attr('path'), function() {
|
|
|
|
reloadclipboard();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2012-02-01 21:02:43 +00:00
|
|
|
$('#paste').button()
|
|
|
|
.click(function() {
|
|
|
|
disableall();
|
2012-08-09 23:06:30 +00:00
|
|
|
pastedialogue();
|
2012-02-01 21:02:43 +00:00
|
|
|
$('#pwfeedback').load(
|
2013-02-25 22:31:54 +00:00
|
|
|
'/browse/clipboard.jim?act=paste&dir='
|
2012-02-01 21:02:43 +00:00
|
|
|
+ encodeURIComponent(dir), function() {
|
|
|
|
$('#pwdialogue').dialog('close');
|
|
|
|
window.location.reload(true);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2011-12-28 21:36:35 +00:00
|
|
|
// End Clipboard post-load actions
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2011-06-25 20:59:50 +00:00
|
|
|
function epginfo_callback(data, status, xhr)
|
|
|
|
{
|
2012-11-18 12:07:53 +00:00
|
|
|
//console.log(status);
|
|
|
|
//console.dir(data);
|
2011-06-25 20:59:50 +00:00
|
|
|
|
|
|
|
if (status != 'success')
|
|
|
|
return;
|
|
|
|
|
2012-11-18 12:07:53 +00:00
|
|
|
$('#rename_title').val(data.title);
|
|
|
|
$('#rename_synopsis').val(data.synopsis);
|
|
|
|
$('#rename_guidance').val(data.guidance);
|
2013-01-06 23:50:39 +00:00
|
|
|
$('#rename_genre').val(data.genre);
|
2011-06-25 20:59:50 +00:00
|
|
|
|
|
|
|
$('tr.tstype').show('slow');
|
|
|
|
}
|
|
|
|
|
|
|
|
function insert_folder_size(folder, size)
|
|
|
|
{
|
|
|
|
folder = folder.replace(/ /g, '');
|
2011-06-27 21:59:07 +00:00
|
|
|
folder = folder.replace(/([ #;&,.+*~\':"!^$[\]()=>|\/@])/g, '\\$1');
|
2011-06-25 20:59:50 +00:00
|
|
|
//console.log("Folder: (%s) = (%s)", folder, size);
|
2012-10-15 21:32:25 +00:00
|
|
|
if (size.search(/\d$/) == -1)
|
|
|
|
size += 'iB';
|
|
|
|
else
|
|
|
|
size += ' bytes';
|
2011-06-27 21:59:07 +00:00
|
|
|
if (folder == "")
|
2012-10-15 21:32:25 +00:00
|
|
|
$('#dirsize').text(' (' + size + ')');
|
2011-06-27 21:59:07 +00:00
|
|
|
else
|
2012-10-15 21:32:25 +00:00
|
|
|
$('#' + folder).text(' (' + size + ')');
|
2011-06-25 20:59:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function folder_size_callback(data, status, xhr)
|
|
|
|
{
|
|
|
|
//console.log("Status: %s", status);
|
2011-06-27 21:59:07 +00:00
|
|
|
//console.dir(data);
|
2011-06-25 20:59:50 +00:00
|
|
|
$.each(data, insert_folder_size);
|
|
|
|
}
|
|
|
|
|
2011-06-29 23:53:16 +00:00
|
|
|
function set_folder_new(folder, cnt)
|
|
|
|
{
|
|
|
|
folder = folder.replace(/ /g, '');
|
|
|
|
folder = folder.replace(/([ #;&,.+*~\':"!^$[\]()=>|\/@])/g, '\\$1');
|
2011-07-01 22:56:53 +00:00
|
|
|
//console.log("Folder: (%s) = (%s)", folder, cnt);
|
2013-09-07 22:13:03 +00:00
|
|
|
left = cnt > 99 ? 11 : (cnt > 9 ? 14 : 17);
|
|
|
|
$('#img' + folder)
|
|
|
|
.attr('src', '/img/Folder_New.png')
|
|
|
|
.next('span.foldernum')
|
|
|
|
.css('left', left + 'px')
|
|
|
|
.text(cnt)
|
|
|
|
.show();
|
2011-06-29 23:53:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function new_folder_callback(data, status, xhr)
|
|
|
|
{
|
|
|
|
//console.log("Status: %s", status);
|
|
|
|
//console.dir(data);
|
|
|
|
$.each(data, set_folder_new);
|
|
|
|
}
|
|
|
|
|
2013-03-05 00:10:38 +00:00
|
|
|
//function insert_shrunk(file, perc)
|
|
|
|
//{
|
|
|
|
// if (perc == 0)
|
|
|
|
// {
|
|
|
|
// file = file.replace(/[ ]/g, '');
|
|
|
|
// file = file.replace(/([ #;&,.+*~\':"!^$[\]()=>|\/@])/g, '\\$1');
|
|
|
|
// //console.log("File: (%s) = (%s)", file, perc);
|
|
|
|
// $('#sp_' + file).show();
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
|
|
|
|
//function shrunk_callback(data, status, xhr)
|
|
|
|
//{
|
|
|
|
// //console.log("Status: %s", status);
|
|
|
|
// //console.dir(data);
|
|
|
|
// $.each(data, insert_shrunk);
|
|
|
|
//}
|
2012-06-15 21:34:07 +00:00
|
|
|
|
2012-01-16 22:28:20 +00:00
|
|
|
function delete_callback(file, dir, id)
|
2011-06-22 23:36:30 +00:00
|
|
|
{
|
|
|
|
var el = 'div.bf#' + id;
|
|
|
|
var results = el + ' .results';
|
2011-12-05 21:44:30 +00:00
|
|
|
$(results)
|
|
|
|
.html('<img src=/img/loading.gif>Deleting, please wait...')
|
|
|
|
.slideDown('slow')
|
2013-02-25 22:31:54 +00:00
|
|
|
.load('/browse/delete.jim', {
|
2012-01-16 22:28:20 +00:00
|
|
|
'dir': dir,
|
|
|
|
'files': [decodeURIComponent(file)]
|
|
|
|
}, function() {
|
2011-06-22 23:36:30 +00:00
|
|
|
$(el).delay(3000).slideUp(300, function() {
|
|
|
|
$(el).remove();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function lock_callback(file, type, id)
|
|
|
|
{
|
2013-02-25 22:31:54 +00:00
|
|
|
var url = '/browse/lock.jim?file=' + file;
|
2011-06-26 23:05:38 +00:00
|
|
|
$.get(url, function() { window.location.reload(true); });
|
2011-06-22 23:36:30 +00:00
|
|
|
}
|
|
|
|
|
2011-07-08 20:39:57 +00:00
|
|
|
function enc_callback(file, type, id)
|
|
|
|
{
|
2013-02-25 22:31:54 +00:00
|
|
|
var url = '/browse/enc.jim?file=' + file;
|
2011-07-08 20:39:57 +00:00
|
|
|
$.get(url, function() { window.location.reload(true); });
|
|
|
|
}
|
|
|
|
|
|
|
|
function new_callback(file, type, id)
|
|
|
|
{
|
2013-02-25 22:31:54 +00:00
|
|
|
var url = '/browse/new.jim?file=' + file;
|
2011-07-08 20:39:57 +00:00
|
|
|
$.get(url, function() { window.location.reload(true); });
|
|
|
|
}
|
|
|
|
|
2013-03-07 23:37:56 +00:00
|
|
|
function thumbnail_callback(file, type, id)
|
|
|
|
{
|
|
|
|
var el = 'div.bf#' + id;
|
|
|
|
var results = el + ' .results';
|
|
|
|
$(results)
|
|
|
|
.html('<img src=/img/loading.gif>Generating thumbnail, ' +
|
|
|
|
'please wait...')
|
|
|
|
.slideDown('slow')
|
|
|
|
.load('/browse/thumbnail.jim?file=' + file)
|
|
|
|
.delay(3000)
|
|
|
|
.slideUp('slow');
|
|
|
|
$('div.bf#' + id + ' img.opt').attr('thmok', 1);
|
|
|
|
}
|
|
|
|
|
2011-06-25 20:59:50 +00:00
|
|
|
function rename_submit()
|
|
|
|
{
|
|
|
|
var s = $('#renameform_form').serialize();
|
2013-02-25 22:31:54 +00:00
|
|
|
$.post('/browse/rename.jim', s,
|
2011-06-26 23:05:38 +00:00
|
|
|
function() { window.location.reload(true); });
|
2011-06-25 20:59:50 +00:00
|
|
|
}
|
|
|
|
|
2011-12-09 10:11:41 +00:00
|
|
|
function drename_submit()
|
|
|
|
{
|
|
|
|
var s = $('#drenameform_form').serialize();
|
2013-02-25 22:31:54 +00:00
|
|
|
$.get('/browse/rename.jim?' + s,
|
|
|
|
function() { window.location.reload(true); });
|
|
|
|
}
|
|
|
|
|
|
|
|
function aexpiry_submit()
|
|
|
|
{
|
|
|
|
$('#aexpiry_working').slideDown('slow');
|
|
|
|
var s = $('#aexpiry_form').serialize();
|
|
|
|
$.get('/browse/aexpiry.jim?' + s,
|
2011-12-09 10:11:41 +00:00
|
|
|
function() { window.location.reload(true); });
|
|
|
|
}
|
|
|
|
|
2011-12-29 00:57:18 +00:00
|
|
|
function newdir_submit()
|
|
|
|
{
|
|
|
|
var s = $('#newdirform_form').serialize();
|
2013-02-25 22:31:54 +00:00
|
|
|
$.get('/browse/mknewdir.jim?' + s,
|
2011-12-29 00:57:18 +00:00
|
|
|
function() { window.location.reload(true); });
|
|
|
|
}
|
|
|
|
|
2011-10-03 22:47:44 +00:00
|
|
|
function savestream_submit()
|
|
|
|
{
|
|
|
|
var s = $('#savestream_form').serialize();
|
|
|
|
var sf = $('#save_stream').attr('file');
|
|
|
|
$('#savestream_spin').show();
|
2013-02-25 22:31:54 +00:00
|
|
|
$.get('/browse/savestream.jim?sfile=' +
|
2011-10-03 22:47:44 +00:00
|
|
|
encodeURIComponent(sf) + '&' + s,
|
|
|
|
function() {
|
|
|
|
window.location.reload(true);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2011-06-22 23:36:30 +00:00
|
|
|
var $confirm; // Populated after DOM is loaded.
|
|
|
|
|
|
|
|
function confirm_action(action, callback, file, type, id)
|
|
|
|
{
|
|
|
|
var bfile = file.replace(/.*\/|\.[^.]*$/g, '');
|
|
|
|
$confirm.dialog('option', 'buttons', {
|
|
|
|
'Yes': function() { $(this).dialog('close');
|
|
|
|
callback(file, type, id); },
|
|
|
|
'No': function() {$(this).dialog('close');}
|
|
|
|
|
|
|
|
});
|
|
|
|
$('#confirm').empty().html(
|
|
|
|
'Are you sure you wish to ' + action + '<br>' +
|
2011-12-14 13:55:58 +00:00
|
|
|
'<i>' + decodeURIComponent(bfile) + '</i> ?'
|
2011-06-22 23:36:30 +00:00
|
|
|
);
|
|
|
|
$confirm.dialog('open');
|
|
|
|
}
|
|
|
|
|
|
|
|
function preparemenu(el, menu)
|
|
|
|
{
|
|
|
|
if (el.attr('type') == 'ts')
|
|
|
|
{
|
2012-05-02 17:41:23 +00:00
|
|
|
// if (el.attr('def') == 'HD')
|
|
|
|
// {
|
|
|
|
// $(menu).enableContextMenuItems('#enc');
|
|
|
|
// if (el.attr('encd') == 1)
|
|
|
|
// $(menu).changeContextMenuItem('#enc',
|
|
|
|
// 'Remove Enc');
|
|
|
|
// else
|
|
|
|
// $(menu).changeContextMenuItem('#enc',
|
|
|
|
// 'Set Enc');
|
|
|
|
// }
|
2011-11-16 22:55:06 +00:00
|
|
|
|
|
|
|
if (el.attr('bx') > 0)
|
2012-01-07 22:30:19 +00:00
|
|
|
$(menu).enableContextMenuItems('#crop');
|
2011-07-08 20:39:57 +00:00
|
|
|
else
|
2012-01-07 22:30:19 +00:00
|
|
|
$(menu).disableContextMenuItems('#crop');
|
2011-07-08 20:39:57 +00:00
|
|
|
|
2013-03-11 23:00:41 +00:00
|
|
|
if (el.attr('odencd') == 0)
|
2013-03-07 23:37:56 +00:00
|
|
|
$(menu).enableContextMenuItems('#thm');
|
|
|
|
else
|
|
|
|
$(menu).disableContextMenuItems('#thm');
|
|
|
|
|
|
|
|
if (el.attr('thmok') == 1)
|
|
|
|
$(menu).enableContextMenuItems('#vthm');
|
|
|
|
else
|
|
|
|
$(menu).disableContextMenuItems('#vthm');
|
|
|
|
|
2013-02-25 22:31:54 +00:00
|
|
|
$(menu).enableContextMenuItems('#strip');
|
2012-06-10 21:16:22 +00:00
|
|
|
|
2012-02-06 23:28:53 +00:00
|
|
|
if (el.attr('rsize') > 4294967296)
|
|
|
|
$(menu).enableContextMenuItems('#chunk');
|
|
|
|
else
|
|
|
|
$(menu).disableContextMenuItems('#chunk');
|
|
|
|
|
2012-01-07 22:30:19 +00:00
|
|
|
$(menu).enableContextMenuItems('#new');
|
2011-07-08 20:39:57 +00:00
|
|
|
if (el.attr('new') == 1)
|
|
|
|
$(menu).changeContextMenuItem('#new', 'Mark watched');
|
|
|
|
else
|
|
|
|
$(menu).changeContextMenuItem('#new', 'Mark new');
|
|
|
|
|
|
|
|
|
2012-01-07 22:30:19 +00:00
|
|
|
$(menu).enableContextMenuItems('#lock');
|
2011-06-22 23:36:30 +00:00
|
|
|
if (el.attr('locked') == 1)
|
|
|
|
{
|
|
|
|
$(menu).changeContextMenuItem('#lock', 'Unlock');
|
2012-01-07 22:30:19 +00:00
|
|
|
$(menu).disableContextMenuItems('#delete');
|
2011-06-22 23:36:30 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$(menu).changeContextMenuItem('#lock', 'Lock');
|
2012-01-07 22:30:19 +00:00
|
|
|
$(menu).enableContextMenuItems('#delete');
|
2011-06-22 23:36:30 +00:00
|
|
|
}
|
2011-11-04 00:55:13 +00:00
|
|
|
|
2012-06-24 20:45:07 +00:00
|
|
|
if (el.attr('odencd') == 1 && el.attr('dlna') == 1 &&
|
|
|
|
el.attr('encd') == 0)
|
2012-01-07 22:30:19 +00:00
|
|
|
$(menu).enableContextMenuItems('#decrypt');
|
2011-11-04 00:55:13 +00:00
|
|
|
else
|
2012-01-07 22:30:19 +00:00
|
|
|
$(menu).disableContextMenuItems('#decrypt');
|
2012-01-22 19:47:47 +00:00
|
|
|
|
|
|
|
if (el.attr('odencd') == 1)
|
2012-02-12 23:11:23 +00:00
|
|
|
{
|
2012-01-22 19:47:47 +00:00
|
|
|
$(menu).disableContextMenuItems('#audio');
|
2012-02-12 23:11:23 +00:00
|
|
|
$(menu).disableContextMenuItems('#mpg');
|
|
|
|
}
|
2012-01-22 19:47:47 +00:00
|
|
|
else
|
2012-02-12 23:11:23 +00:00
|
|
|
{
|
2012-01-07 22:30:19 +00:00
|
|
|
$(menu).enableContextMenuItems('#audio');
|
2013-01-08 22:43:43 +00:00
|
|
|
if (el.attr('def') == 'HD')
|
|
|
|
$(menu).disableContextMenuItems('#mpg');
|
|
|
|
else
|
|
|
|
$(menu).enableContextMenuItems('#mpg');
|
2012-02-12 23:11:23 +00:00
|
|
|
}
|
2011-06-22 23:36:30 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-01-07 22:30:19 +00:00
|
|
|
$(menu).enableContextMenuItems('#delete');
|
|
|
|
$(menu).disableContextMenuItems('#lock');
|
2012-05-02 17:41:23 +00:00
|
|
|
//$(menu).disableContextMenuItems('#enc');
|
2012-01-07 22:30:19 +00:00
|
|
|
$(menu).disableContextMenuItems('#new');
|
2011-06-22 23:36:30 +00:00
|
|
|
}
|
2011-07-08 20:39:57 +00:00
|
|
|
|
2011-06-22 23:36:30 +00:00
|
|
|
}
|
|
|
|
|
2013-01-18 18:47:14 +00:00
|
|
|
function fixdmenu(el, menu, flag, tag, descr, recurse)
|
|
|
|
{
|
|
|
|
var a = el.attr(flag);
|
|
|
|
var b = el.attr(flag + 'r');
|
|
|
|
|
|
|
|
if (a == undefined) a = 0;
|
|
|
|
if (b == undefined) b = 0;
|
|
|
|
|
|
|
|
if (a > 0)
|
|
|
|
$(menu).changeContextMenuItem(tag, 'Disable ' + descr);
|
|
|
|
else
|
|
|
|
$(menu).changeContextMenuItem(tag, 'Enable ' + descr);
|
|
|
|
|
|
|
|
if (recurse)
|
|
|
|
{
|
|
|
|
if (b > 0)
|
|
|
|
{
|
|
|
|
$(menu).changeContextMenuItem(tag + 'r',
|
|
|
|
'Disable Recursive ' + descr);
|
|
|
|
$(menu).disableContextMenuItems(tag);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$(menu).changeContextMenuItem(tag + 'r',
|
|
|
|
'Enable Recursive ' + descr);
|
|
|
|
$(menu).enableContextMenuItems(tag);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-12 23:45:58 +00:00
|
|
|
function preparedmenu(el, menu)
|
|
|
|
{
|
|
|
|
if (el.attr('noflat') != undefined)
|
|
|
|
{
|
|
|
|
if (el.attr('noflat') > 0)
|
|
|
|
$(menu).changeContextMenuItem('#flat', 'Allow Flatten');
|
|
|
|
else
|
|
|
|
$(menu).changeContextMenuItem('#flat',
|
|
|
|
'Prevent Flatten');
|
|
|
|
}
|
2013-01-18 18:47:14 +00:00
|
|
|
|
|
|
|
fixdmenu(el, menu, 'autoshrink', '#shrink', 'Auto-shrink', 1);
|
|
|
|
fixdmenu(el, menu, 'autodedup', '#dedup', 'Auto-dedup', 0);
|
|
|
|
fixdmenu(el, menu, 'autodecrypt', '#decrypt', 'Auto-decrypt', 1);
|
|
|
|
fixdmenu(el, menu, 'autompg', '#mpg', 'Auto-mpg', 0);
|
2013-03-06 22:49:28 +00:00
|
|
|
fixdmenu(el, menu, 'automp3', '#mp3', 'Auto-audio', 0);
|
2013-02-25 22:31:54 +00:00
|
|
|
fixdmenu(el, menu, 'autoexpire', '#expire', 'Auto-expire', 0);
|
2011-12-12 23:45:58 +00:00
|
|
|
}
|
2011-06-25 20:59:50 +00:00
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
|
2012-02-01 21:02:43 +00:00
|
|
|
dir = $('#dir').text();
|
2012-01-16 22:28:20 +00:00
|
|
|
|
2011-06-25 20:59:50 +00:00
|
|
|
var menuclick = function(action, el, pos)
|
2011-06-22 23:36:30 +00:00
|
|
|
{
|
|
|
|
var file = $(el).parent().prevAll('a.bf').last().attr('file');
|
2011-06-25 20:59:50 +00:00
|
|
|
var bfile = file.replace(/.*\/|\.[^.]*$/g, '');
|
|
|
|
bfile = bfile.replace(/[\x00-\x1f]+/g, '');
|
2011-06-22 23:36:30 +00:00
|
|
|
var type = $(el).attr('type');
|
|
|
|
var id = $(el).attr('did');
|
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case 'delete':
|
2011-06-25 20:59:50 +00:00
|
|
|
confirm_action('delete', delete_callback, file,
|
2012-01-16 22:28:20 +00:00
|
|
|
dir, id);
|
2011-06-22 23:36:30 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-28 21:36:35 +00:00
|
|
|
case 'copy':
|
2011-12-29 00:57:18 +00:00
|
|
|
if (!confirm('Are you sure? Copying recordings takes a long time!'))
|
|
|
|
break;
|
|
|
|
// Fallthrough
|
|
|
|
case 'cut':
|
2013-02-25 22:31:54 +00:00
|
|
|
$.get('/browse/clipboard.jim?act=add&mode=' + action +
|
2011-12-28 21:36:35 +00:00
|
|
|
'&path=' + file, function() {
|
|
|
|
reloadclipboard();
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
|
2011-06-22 23:36:30 +00:00
|
|
|
case 'lock':
|
|
|
|
confirm_action('change the lock on', lock_callback,
|
|
|
|
file, type, id);
|
|
|
|
break;
|
|
|
|
|
2012-05-02 17:41:23 +00:00
|
|
|
// case 'enc':
|
|
|
|
// confirm_action('change the ENC flag on', enc_callback,
|
|
|
|
// file, type, id);
|
|
|
|
// break;
|
2011-07-08 20:39:57 +00:00
|
|
|
|
|
|
|
case 'new':
|
|
|
|
confirm_action('change the New flag on', new_callback,
|
|
|
|
file, type, id);
|
|
|
|
break;
|
|
|
|
|
2011-06-25 20:59:50 +00:00
|
|
|
case 'rename':
|
2011-12-14 13:55:58 +00:00
|
|
|
$('#rename').val(decodeURIComponent(bfile));
|
2012-11-18 12:07:53 +00:00
|
|
|
$('#renamefile').val(decodeURIComponent(file));
|
2011-06-25 20:59:50 +00:00
|
|
|
|
2012-11-18 12:07:53 +00:00
|
|
|
$('#rename_title').val('');
|
|
|
|
$('#rename_synopsis').val('');
|
|
|
|
$('#rename_guidance').val('');
|
2011-06-25 20:59:50 +00:00
|
|
|
$('tr.tstype').css('display', 'none');
|
|
|
|
|
|
|
|
if (type == 'ts')
|
|
|
|
{
|
2013-02-25 22:31:54 +00:00
|
|
|
$.getJSON('/browse/epgtitle.jim?file=' +
|
2011-12-14 13:55:58 +00:00
|
|
|
file, epginfo_callback);
|
2011-06-25 20:59:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$('#renameform').dialog('open');
|
|
|
|
break;
|
|
|
|
|
2013-03-07 23:37:56 +00:00
|
|
|
case 'thm':
|
2013-03-11 23:00:41 +00:00
|
|
|
window.location.href = '/browse/thumbnail/index.jim?file=' +
|
|
|
|
file;
|
2013-03-07 23:37:56 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'vthm':
|
2013-03-11 23:00:41 +00:00
|
|
|
// window.open('/browse/bmpw.jim?file=' + file, 'hxwebifbmp',
|
|
|
|
// 'height=156,width=280,toolbar=no,' +
|
|
|
|
// 'scrollbars=no,menubar=no,location=no,titlebar=no');
|
|
|
|
$('#thmbmp').attr('src', 'bmp.jim?file=' + file);
|
|
|
|
$('#bmpdialogue').dialog('open');
|
2013-03-07 23:37:56 +00:00
|
|
|
break;
|
|
|
|
|
2011-06-22 23:36:30 +00:00
|
|
|
case 'download':
|
2013-02-25 22:31:54 +00:00
|
|
|
window.location.href = '/browse/download.jim?file=' +
|
2012-11-05 21:57:29 +00:00
|
|
|
file + '&base=' +
|
|
|
|
encodeURIComponent(document.URL.match(/:\/\/(.[^/]+)/)[1]);
|
2011-06-22 23:36:30 +00:00
|
|
|
break;
|
|
|
|
|
2011-11-03 23:43:17 +00:00
|
|
|
case 'crop':
|
2013-02-25 22:31:54 +00:00
|
|
|
window.location.href = '/browse/crop/crop.jim?file=' +
|
2011-12-14 13:55:58 +00:00
|
|
|
file;
|
2011-11-03 23:43:17 +00:00
|
|
|
break;
|
|
|
|
|
2012-06-10 21:16:22 +00:00
|
|
|
case 'strip':
|
2013-02-25 22:31:54 +00:00
|
|
|
window.location.href = '/browse/strip/strip.jim?file=' +
|
2012-06-10 21:16:22 +00:00
|
|
|
file;
|
|
|
|
break;
|
|
|
|
|
2012-02-06 23:28:53 +00:00
|
|
|
case 'chunk':
|
2013-02-25 22:31:54 +00:00
|
|
|
window.location.href = '/browse/chunk/chunk.jim?file=' +
|
2012-02-06 23:28:53 +00:00
|
|
|
file;
|
|
|
|
break;
|
|
|
|
|
2011-11-04 00:55:13 +00:00
|
|
|
case 'decrypt':
|
2012-02-07 00:17:33 +00:00
|
|
|
window.location.href =
|
2013-02-25 22:31:54 +00:00
|
|
|
'/browse/decrypt/decrypt.jim?file=' + file;
|
2011-11-04 00:55:13 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-09 20:33:57 +00:00
|
|
|
case 'audio':
|
2013-02-25 22:31:54 +00:00
|
|
|
window.location.href = '/browse/audio/audio.jim?file=' +
|
2011-12-14 13:55:58 +00:00
|
|
|
file;
|
2011-12-09 20:33:57 +00:00
|
|
|
break;
|
|
|
|
|
2012-02-12 23:11:23 +00:00
|
|
|
case 'mpg':
|
2013-02-25 22:31:54 +00:00
|
|
|
window.location.href = '/browse/mpg/mpg.jim?file=' +
|
2012-02-12 23:11:23 +00:00
|
|
|
file;
|
|
|
|
break;
|
|
|
|
|
2011-06-22 23:36:30 +00:00
|
|
|
default:
|
|
|
|
alert('Unhandled action: ' + action);
|
|
|
|
break;
|
|
|
|
}
|
2011-06-25 20:59:50 +00:00
|
|
|
};
|
2011-06-22 23:36:30 +00:00
|
|
|
|
2013-01-18 18:47:14 +00:00
|
|
|
function flagdir(file, flag, iconset, output, options)
|
|
|
|
{
|
2013-02-25 22:31:54 +00:00
|
|
|
var url = '/browse/flagdir.jim?dir=' + file +
|
2013-01-18 18:47:14 +00:00
|
|
|
'&flag=' + flag;
|
|
|
|
|
|
|
|
$(output).load(url, function() {
|
|
|
|
$(iconset)
|
|
|
|
.empty()
|
|
|
|
.html('<img src=/img/loading.gif> Updating...')
|
2013-02-25 22:31:54 +00:00
|
|
|
.load('/browse/iconset.jim?file=' + file);
|
2013-01-18 18:47:14 +00:00
|
|
|
if ($(options).attr(flag) == '1')
|
|
|
|
$(options).attr(flag, 0);
|
|
|
|
else
|
|
|
|
$(options).attr(flag, 1);
|
|
|
|
}).delay(3000).slideUp();
|
|
|
|
}
|
|
|
|
|
2011-12-09 10:11:41 +00:00
|
|
|
var dmenuclick = function(action, el, pos)
|
|
|
|
{
|
|
|
|
var direl = $(el).parent().parent();
|
|
|
|
var file = $(el).parent().prevAll('a.dbf').last().attr('file');
|
2013-01-18 18:47:14 +00:00
|
|
|
var iconset = $(el).parent().prevAll('span.iconset').last();
|
2011-12-09 10:11:41 +00:00
|
|
|
var bfile = file.replace(/.*\//g, '');
|
|
|
|
bfile = bfile.replace(/[\x00-\x1f]+/g, '');
|
|
|
|
var results = $(el).parent().next('div.results');
|
|
|
|
|
|
|
|
switch (action)
|
|
|
|
{
|
2012-08-09 23:06:30 +00:00
|
|
|
case 'paste':
|
|
|
|
pastedialogue();
|
|
|
|
$('#pwfeedback').load(
|
2013-02-25 22:31:54 +00:00
|
|
|
'/browse/clipboard.jim?act=paste&dir=' +
|
2012-08-09 23:06:30 +00:00
|
|
|
file, function() {
|
|
|
|
$('#pwdialogue').dialog('close');
|
|
|
|
reloadclipboard();
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
|
2011-12-09 10:11:41 +00:00
|
|
|
case 'delete':
|
|
|
|
|
2011-12-14 13:55:58 +00:00
|
|
|
if (confirm('Are you sure you wish to delete "' +
|
|
|
|
decodeURIComponent(file) +
|
2011-12-09 10:11:41 +00:00
|
|
|
'" and all files within it?'))
|
|
|
|
{
|
|
|
|
$(results)
|
|
|
|
.html('<img src=/img/loading.gif>' +
|
|
|
|
'Deleting, please wait...')
|
|
|
|
.slideDown('slow')
|
2013-02-25 22:31:54 +00:00
|
|
|
.load('/browse/delete.jim', {
|
2012-01-16 22:28:20 +00:00
|
|
|
'dir': dir,
|
|
|
|
'files': [decodeURIComponent(file)]
|
|
|
|
}, function() {
|
2011-12-09 10:11:41 +00:00
|
|
|
$(direl).delay(3000).slideUp(300, function() {
|
|
|
|
$(direl).remove();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2011-12-28 21:36:35 +00:00
|
|
|
case 'copy':
|
2011-12-29 00:57:18 +00:00
|
|
|
if (!confirm('Are you sure? Copying directories can take a very long time!'))
|
|
|
|
break;
|
|
|
|
// Fallthrough
|
|
|
|
case 'cut':
|
2013-02-25 22:31:54 +00:00
|
|
|
$.get('/browse/clipboard.jim?act=add&mode=' + action +
|
2011-12-28 21:36:35 +00:00
|
|
|
'&path=' + file, function() {
|
|
|
|
reloadclipboard();
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
|
2011-12-09 10:11:41 +00:00
|
|
|
case 'rename':
|
2011-12-14 13:55:58 +00:00
|
|
|
$('#drename').val(decodeURIComponent(bfile));
|
|
|
|
$('#drenameorig').val(decodeURIComponent(file));
|
2011-12-09 10:11:41 +00:00
|
|
|
$('#drenameform').dialog('open');
|
|
|
|
break;
|
|
|
|
|
2013-02-25 22:31:54 +00:00
|
|
|
case 'expire':
|
|
|
|
if ($(el).attr('autoexpire') == 1)
|
|
|
|
flagdir(file, 'autoexpire', iconset, results, el);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$('#aexpiry_ldir').val(decodeURIComponent(file));
|
|
|
|
if ($(el).attr('autoexpiredays') > 0)
|
|
|
|
$('#aexpiry_days')
|
|
|
|
.val($(el).attr('autoexpiredays'));
|
|
|
|
else
|
|
|
|
$('#aexpiry_days').val(7);
|
|
|
|
$('#aexpiry_working').hide('fast');
|
|
|
|
$('#aexpiry').dialog('open');
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2011-12-12 23:45:58 +00:00
|
|
|
case 'flat':
|
2013-01-18 18:47:14 +00:00
|
|
|
flagdir(file, 'noflatten', iconset, results, el);
|
2012-06-13 23:21:34 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'dedup':
|
2013-01-18 18:47:14 +00:00
|
|
|
flagdir(file, 'autodedup', iconset, results, el);
|
2012-06-13 23:21:34 +00:00
|
|
|
break;
|
|
|
|
|
2013-01-08 22:43:43 +00:00
|
|
|
case 'mpg':
|
2013-01-18 18:47:14 +00:00
|
|
|
flagdir(file, 'autompg', iconset, results, el);
|
2013-01-08 22:43:43 +00:00
|
|
|
break;
|
|
|
|
|
2013-03-06 22:49:28 +00:00
|
|
|
case 'mp3':
|
|
|
|
flagdir(file, 'automp3', iconset, results, el);
|
|
|
|
break;
|
|
|
|
|
2012-06-15 21:34:07 +00:00
|
|
|
case 'shrink':
|
2013-01-18 18:47:14 +00:00
|
|
|
flagdir(file, 'autoshrink', iconset, results, el);
|
2012-06-13 23:21:34 +00:00
|
|
|
break;
|
|
|
|
|
2013-01-18 19:24:50 +00:00
|
|
|
case 'shrinkr':
|
|
|
|
flagdir(file, 'autoshrinkr', iconset, results, el);
|
|
|
|
break;
|
|
|
|
|
2012-06-13 23:21:34 +00:00
|
|
|
case 'decrypt':
|
2013-01-18 18:47:14 +00:00
|
|
|
flagdir(file, 'autodecrypt', iconset, results, el);
|
2012-04-22 20:54:29 +00:00
|
|
|
break;
|
|
|
|
|
2013-01-18 19:24:50 +00:00
|
|
|
case 'decryptr':
|
|
|
|
flagdir(file, 'autodecryptr', iconset, results, el);
|
|
|
|
break;
|
|
|
|
|
2012-04-22 20:54:29 +00:00
|
|
|
case 'resetnew':
|
2013-02-25 22:31:54 +00:00
|
|
|
var url = '/browse/resetnew.jim?dir=' + file;
|
2011-12-12 23:45:58 +00:00
|
|
|
$.get(url, function() { window.location.reload(true); });
|
|
|
|
break;
|
|
|
|
|
2011-12-09 10:11:41 +00:00
|
|
|
default:
|
|
|
|
alert('Unhandled action: ' + action);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2011-06-22 23:36:30 +00:00
|
|
|
// Bind context menu to opt+ image
|
|
|
|
$('img.opt').contextMenu(
|
|
|
|
{
|
|
|
|
menu: 'optmenu',
|
|
|
|
leftButton: true,
|
2012-06-10 21:16:22 +00:00
|
|
|
beforeShow: preparemenu
|
|
|
|
},
|
|
|
|
menuclick
|
|
|
|
);
|
|
|
|
|
|
|
|
// Bind context menu to opt+ image
|
|
|
|
$('img.oopt').contextMenu(
|
|
|
|
{
|
|
|
|
menu: 'ooptmenu',
|
|
|
|
leftButton: true,
|
2011-06-22 23:36:30 +00:00
|
|
|
beforeShow: preparemenu
|
|
|
|
},
|
|
|
|
menuclick
|
|
|
|
);
|
|
|
|
|
2011-12-09 10:11:41 +00:00
|
|
|
$('img.dopt').contextMenu(
|
|
|
|
{
|
|
|
|
menu: 'doptmenu',
|
2011-12-12 23:45:58 +00:00
|
|
|
leftButton: true,
|
|
|
|
beforeShow: preparedmenu
|
2011-12-09 10:11:41 +00:00
|
|
|
},
|
|
|
|
dmenuclick
|
|
|
|
);
|
|
|
|
|
2013-02-27 23:15:37 +00:00
|
|
|
$('img.doopt').contextMenu(
|
|
|
|
{
|
|
|
|
menu: 'dooptmenu',
|
|
|
|
leftButton: true,
|
|
|
|
beforeShow: preparedmenu
|
|
|
|
},
|
|
|
|
dmenuclick
|
|
|
|
);
|
|
|
|
|
2011-06-22 23:36:30 +00:00
|
|
|
// Disable items which are not yet implemented.
|
2011-06-25 20:59:50 +00:00
|
|
|
$('#optmenu').disableContextMenuItems('#title');
|
2011-06-22 23:36:30 +00:00
|
|
|
|
2012-01-25 23:19:57 +00:00
|
|
|
var $buttons = {
|
|
|
|
"Close" : function() {$(this).dialog('close');}
|
|
|
|
};
|
|
|
|
var $buttonsp = $.extend(
|
|
|
|
{"Play" : function() { doplay(); }},
|
|
|
|
$buttons);
|
|
|
|
|
2011-06-22 23:36:30 +00:00
|
|
|
// Create reusable dialogue.
|
|
|
|
var $dialog = $('#dialogue').dialog({
|
|
|
|
title: "Media Details",
|
|
|
|
modal: false, autoOpen: false,
|
|
|
|
height: 600, width: 700,
|
|
|
|
show: 'scale', hide: 'fade',
|
|
|
|
draggable: true, resizable: true,
|
2012-01-25 23:19:57 +00:00
|
|
|
buttons: $buttons,
|
2011-06-22 23:36:30 +00:00
|
|
|
close: function(e,u) { $('#dialogue').empty().html(
|
|
|
|
'<img src="/img/loading.gif" alt="loading">'); }
|
|
|
|
});
|
|
|
|
|
2012-01-25 23:19:57 +00:00
|
|
|
function doplay()
|
|
|
|
{
|
|
|
|
var file = $dialog.attr('file');
|
|
|
|
var type = $dialog.attr('type');
|
|
|
|
|
|
|
|
disableall();
|
|
|
|
|
2012-07-16 20:29:59 +00:00
|
|
|
window.location = '/play/play.jim?' +
|
2012-01-25 23:19:57 +00:00
|
|
|
'dir=' + encodeURIComponent(dir) +
|
|
|
|
'&file=' + file;
|
|
|
|
}
|
|
|
|
|
2011-06-22 23:36:30 +00:00
|
|
|
// Bind dialogue open to filenames.
|
|
|
|
$('a.bf').click(function(e) {
|
|
|
|
e.preventDefault();
|
2012-01-25 23:19:57 +00:00
|
|
|
|
2011-06-22 23:36:30 +00:00
|
|
|
var file = $(this).attr('file');
|
|
|
|
var type = $(this).attr('type');
|
2012-01-25 23:19:57 +00:00
|
|
|
var opt = $(this).nextAll('a').find('img.opt');
|
|
|
|
|
2013-02-25 22:31:54 +00:00
|
|
|
var url = '/browse/file.jim?file=' + file
|
2011-12-14 13:55:58 +00:00
|
|
|
+ '&type=' + type;
|
2012-01-25 23:19:57 +00:00
|
|
|
$dialog.load(url);
|
|
|
|
|
|
|
|
$dialog.attr('file', file);
|
|
|
|
$dialog.attr('type', type);
|
|
|
|
|
|
|
|
if (type == 'ts' &&
|
|
|
|
(opt.attr('odencd') == 0 || opt.attr('dlna') == 1))
|
|
|
|
$dialog.dialog("option", "buttons", $buttonsp);
|
|
|
|
else
|
|
|
|
$dialog.dialog("option", "buttons", $buttons);
|
2011-06-22 23:36:30 +00:00
|
|
|
$dialog.dialog('open');
|
|
|
|
});
|
|
|
|
|
2011-06-25 20:59:50 +00:00
|
|
|
$('#renameform').dialog({
|
|
|
|
autoOpen: false,
|
|
|
|
height: 'auto', width: 'auto',
|
|
|
|
modal: true,
|
|
|
|
buttons: {
|
|
|
|
"Update": rename_submit,
|
|
|
|
"Close": function() {
|
|
|
|
$(this).dialog('close');
|
|
|
|
}
|
|
|
|
},
|
|
|
|
close: function() { $('#rename').val(''); }
|
|
|
|
});
|
|
|
|
|
2011-12-09 10:11:41 +00:00
|
|
|
$('#drenameform').dialog({
|
|
|
|
autoOpen: false,
|
|
|
|
height: 'auto', width: 'auto',
|
|
|
|
modal: true,
|
|
|
|
buttons: {
|
|
|
|
"Update": drename_submit,
|
|
|
|
"Close": function() {
|
|
|
|
$(this).dialog('close');
|
|
|
|
}
|
|
|
|
},
|
|
|
|
close: function() { $('#drename').val(''); }
|
|
|
|
});
|
|
|
|
|
2013-02-25 22:31:54 +00:00
|
|
|
$('#aexpiry').dialog({
|
|
|
|
autoOpen: false,
|
|
|
|
height: 'auto', width: 'auto',
|
|
|
|
modal: true,
|
|
|
|
buttons: {
|
|
|
|
"Update": aexpiry_submit,
|
|
|
|
"Close": function() {
|
|
|
|
$(this).dialog('close');
|
|
|
|
}
|
|
|
|
},
|
|
|
|
close: function() { $('#aexpiry_days').val('0'); }
|
|
|
|
});
|
|
|
|
|
2011-10-03 22:47:44 +00:00
|
|
|
$('#savestreamform').dialog({
|
|
|
|
autoOpen: false,
|
|
|
|
height: 'auto', width: 'auto',
|
|
|
|
modal: true,
|
|
|
|
buttons: {
|
|
|
|
"Save": savestream_submit,
|
|
|
|
"Cancel": function() {
|
|
|
|
$(this).dialog('close');
|
|
|
|
}
|
|
|
|
},
|
|
|
|
close: function() { $('#savestream_name').val(''); }
|
|
|
|
});
|
|
|
|
|
2013-03-11 23:00:41 +00:00
|
|
|
$('#bmpdialogue').dialog({
|
|
|
|
autoOpen: false,
|
|
|
|
height: 'auto', width: 'auto',
|
|
|
|
modal: true,
|
|
|
|
buttons: {
|
|
|
|
"Close": function() {
|
|
|
|
$(this).dialog('close');
|
|
|
|
}
|
|
|
|
},
|
|
|
|
close: function() { $('#thmbmp').attr('src', 'about:blank'); }
|
|
|
|
});
|
|
|
|
|
2011-06-22 23:36:30 +00:00
|
|
|
// Create re-usable confirmation dialogue.
|
|
|
|
$confirm = $('#confirm').dialog({
|
|
|
|
modal: true, autoOpen: false,
|
|
|
|
height: 160, width: 500,
|
|
|
|
show: 'fade', hide: 'fade',
|
|
|
|
draggable: false, resizable: false
|
|
|
|
});
|
|
|
|
|
2011-06-25 20:59:50 +00:00
|
|
|
// Load folder sizes
|
2013-02-25 22:31:54 +00:00
|
|
|
$.getJSON('/browse/sizes.jim?dir=' + encodeURIComponent(dir),
|
2011-06-25 20:59:50 +00:00
|
|
|
folder_size_callback);
|
2011-06-29 23:53:16 +00:00
|
|
|
|
2012-06-15 21:34:07 +00:00
|
|
|
// Flag shrunk recordings
|
2013-03-05 00:10:38 +00:00
|
|
|
// $.getJSON('/browse/shrunk.jim?dir=' + encodeURIComponent(dir),
|
|
|
|
// shrunk_callback);
|
2012-06-15 21:34:07 +00:00
|
|
|
|
2011-06-29 23:53:16 +00:00
|
|
|
// Flag folders with unwatched items
|
2013-02-25 22:31:54 +00:00
|
|
|
$.getJSON('/browse/newdir.jim?dir=' + encodeURIComponent(dir),
|
2011-06-29 23:53:16 +00:00
|
|
|
new_folder_callback);
|
2011-10-03 22:47:44 +00:00
|
|
|
|
2011-12-28 14:11:10 +00:00
|
|
|
// Load clipboard
|
2011-12-28 21:36:35 +00:00
|
|
|
reloadclipboard();
|
2011-12-28 14:11:10 +00:00
|
|
|
|
2011-12-05 21:44:30 +00:00
|
|
|
// Uncheck everything
|
|
|
|
$('input.fs:checked').attr('checked', false);
|
|
|
|
|
|
|
|
// Buttons
|
|
|
|
|
2011-10-03 22:47:44 +00:00
|
|
|
$('#dedup').button().click(function() {
|
2012-04-11 20:54:59 +00:00
|
|
|
window.location = '/dedup/dedup.jim?dir='
|
2011-10-03 22:47:44 +00:00
|
|
|
+ encodeURIComponent(dir);
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#save_stream').button().click(function() {
|
|
|
|
$('#savestream_spin').hide();
|
|
|
|
$('#savestreamform').dialog('open');
|
|
|
|
$('#savestream_detail').load(
|
2013-02-25 22:31:54 +00:00
|
|
|
'/browse/ffmpeg.jim?file=' +
|
2011-10-03 22:47:44 +00:00
|
|
|
encodeURIComponent($('#save_stream').attr('file')));
|
|
|
|
});
|
2011-11-27 23:29:14 +00:00
|
|
|
|
2011-11-28 15:24:38 +00:00
|
|
|
$('#selectall').click(function(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
$('input.fs').attr('checked', true).trigger('change');
|
|
|
|
});
|
|
|
|
$('#deselectall').click(function(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
$('input.fs:checked').attr('checked', false).trigger('change');
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#join').button().disable()
|
2011-11-27 23:29:14 +00:00
|
|
|
.click(function() {
|
|
|
|
var files = new Array();
|
|
|
|
var els = $('input.fsts:checked + a').each(function() {
|
2012-01-08 20:54:07 +00:00
|
|
|
files.push($(this).attr('file'));
|
2011-11-27 23:29:14 +00:00
|
|
|
});
|
|
|
|
//console.log("%o", files);
|
2013-02-25 22:31:54 +00:00
|
|
|
window.location.href = '/browse/join/join.jim?files=' +
|
2011-11-27 23:29:14 +00:00
|
|
|
files.join();
|
|
|
|
});
|
|
|
|
|
2011-11-28 15:24:38 +00:00
|
|
|
$('#delete').button().disable()
|
|
|
|
.click(function() {
|
2011-12-05 21:44:30 +00:00
|
|
|
var files = new Array();
|
|
|
|
var els = $('input.fs:checked + a').each(function() {
|
2012-01-08 20:54:07 +00:00
|
|
|
files.push(decodeURIComponent($(this).attr('file')));
|
2011-12-05 21:44:30 +00:00
|
|
|
});
|
|
|
|
//console.log("%o", files);
|
|
|
|
var str = 'Are you sure you want to delete ' + files.length +
|
|
|
|
' file';
|
|
|
|
if (files.length != 1) str += 's';
|
|
|
|
str += '?';
|
|
|
|
if (confirm(str))
|
|
|
|
{
|
|
|
|
disableall();
|
|
|
|
$('#deletewait').slideDown('slow');
|
2011-12-29 00:57:18 +00:00
|
|
|
|
|
|
|
$('#pwdialogue').dialog({
|
|
|
|
title: "Deleting",
|
|
|
|
modal: true, autoOpen: true,
|
|
|
|
height: 'auto', width: 'auto',
|
|
|
|
show: 'scale', hide: 'fade',
|
|
|
|
draggable: false, resizable: false,
|
|
|
|
closeOnEscape: false,
|
|
|
|
open: function() {
|
|
|
|
$('.ui-dialog-titlebar-close').hide();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
$('#pwfeedback').load(
|
2013-02-25 22:31:54 +00:00
|
|
|
'/browse/delete.jim', {
|
2012-01-08 20:54:07 +00:00
|
|
|
'dir': dir,
|
|
|
|
'files': files
|
|
|
|
}, function() {
|
2011-12-29 00:57:18 +00:00
|
|
|
$('#pwdialogue').dialog('close');
|
|
|
|
window.location.reload(true);
|
|
|
|
});
|
2011-12-05 21:44:30 +00:00
|
|
|
}
|
2011-11-28 15:24:38 +00:00
|
|
|
});
|
|
|
|
|
2011-12-29 00:57:18 +00:00
|
|
|
$('#copy,#cut').button().disable()
|
|
|
|
.click(function() {
|
|
|
|
var files = new Array();
|
|
|
|
var els = $('input.fs:checked + a').each(function() {
|
2012-01-08 20:54:07 +00:00
|
|
|
files.push(decodeURIComponent($(this).attr('file')));
|
2011-12-29 00:57:18 +00:00
|
|
|
});
|
|
|
|
//console.log("%o", files);
|
|
|
|
var action = $(this).attr('id');
|
2012-01-08 20:54:07 +00:00
|
|
|
if (action == 'copy' && !confirm('Are you sure? ' +
|
|
|
|
'Copying recordings can take a very long time!'))
|
2011-12-29 00:57:18 +00:00
|
|
|
return;
|
2012-01-08 20:54:07 +00:00
|
|
|
|
2013-02-25 22:31:54 +00:00
|
|
|
$.post('/browse/clipboard.jim', {
|
2012-01-08 20:54:07 +00:00
|
|
|
'act': 'add',
|
2012-01-08 21:10:38 +00:00
|
|
|
'dir': dir,
|
2012-01-08 20:54:07 +00:00
|
|
|
'mode': action,
|
|
|
|
'path': files
|
|
|
|
}, function() {
|
2011-12-29 00:57:18 +00:00
|
|
|
reloadclipboard();
|
|
|
|
$('input.fs:checked').attr('checked', false);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#newdir').button().click(function() {
|
|
|
|
$('#newdirform').dialog({
|
|
|
|
autoOpen: true,
|
|
|
|
height: 'auto', width: 'auto',
|
|
|
|
modal: true,
|
|
|
|
buttons: {
|
|
|
|
"Create": newdir_submit,
|
|
|
|
"Cancel": function() {
|
|
|
|
$(this).dialog('close');
|
|
|
|
}
|
|
|
|
},
|
|
|
|
close: function() { $('#newdirname').val(''); }
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2011-11-27 23:29:14 +00:00
|
|
|
$('input.fs').change(function() {
|
2011-11-28 15:24:38 +00:00
|
|
|
var num = $('input.fs:checked').size();
|
|
|
|
if (num > 0)
|
2011-12-29 00:57:18 +00:00
|
|
|
$('#delete,#cut,#copy').enable();
|
2011-11-28 15:24:38 +00:00
|
|
|
else
|
2011-12-29 00:57:18 +00:00
|
|
|
$('#delete,#cut,#copy').disable();
|
2012-01-07 22:30:19 +00:00
|
|
|
|
2011-11-27 23:29:14 +00:00
|
|
|
var num = $('input.fsts:checked').size();
|
|
|
|
if (num > 1)
|
2011-11-28 15:24:38 +00:00
|
|
|
$('#join').enable();
|
2011-11-27 23:29:14 +00:00
|
|
|
else
|
2011-11-28 15:24:38 +00:00
|
|
|
$('#join').disable();
|
2011-11-27 23:29:14 +00:00
|
|
|
|
|
|
|
});
|
2011-11-28 15:24:38 +00:00
|
|
|
|
2012-11-05 22:36:04 +00:00
|
|
|
var streamsize = 0;
|
|
|
|
|
|
|
|
function checkstream()
|
|
|
|
{
|
2013-02-25 22:31:54 +00:00
|
|
|
$.get('/browse/streamsize.jim', function(size) {
|
2012-11-18 12:07:53 +00:00
|
|
|
//console.log('Stream size: %o', size);
|
2012-11-05 22:36:04 +00:00
|
|
|
var mb = size / (1024 * 1024);
|
|
|
|
mb = mb|0;
|
|
|
|
if (streamsize && size > streamsize)
|
2013-01-13 22:48:38 +00:00
|
|
|
{
|
|
|
|
rate = (size - streamsize) * 8.0 /
|
|
|
|
(3 * 1048576);
|
|
|
|
$('#streamstatus').text(mb +
|
|
|
|
' MiB (growing @' + rate.toFixed(2) +
|
|
|
|
' Mib/s)');
|
|
|
|
}
|
2012-11-05 22:36:04 +00:00
|
|
|
else
|
|
|
|
$('#streamstatus').text(mb + ' MiB');
|
|
|
|
streamsize = size;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($('#streamstatus').length)
|
|
|
|
setInterval(checkstream, 3000);
|
|
|
|
|
2011-06-25 20:59:50 +00:00
|
|
|
});
|
2011-06-22 23:36:30 +00:00
|
|
|
|