diff --git a/plugins/mysql/js/mysql.js b/plugins/mysql/js/mysql.js index c83ce1be0..41fa45cc0 100755 --- a/plugins/mysql/js/mysql.js +++ b/plugins/mysql/js/mysql.js @@ -459,11 +459,11 @@ function showHidePass(obj){ function copyPass(password){ var clipboard = new ClipboardJS('#bt_copys'); clipboard.on('success', function (e) { - layer.msg({msg:'复制成功',icon:1}); + layer.msg('复制成功',{icon:1,time:2000}); }); clipboard.on('error', function (e) { - layer.msg({msg:'复制失败,浏览器不兼容!',icon:2}); + layer.msg('复制失败,浏览器不兼容!',{icon:2,time:2000}); }); $("#bt_copys").attr('data-clipboard-text',password); $("#bt_copys").click(); @@ -912,9 +912,9 @@ function myLogs(){ var rdata = $.parseJSON(data.data); var limitCon = '
\ - '+ lan.soft.mysql_log_bin + ' ' + toSize(rdata.msg) + '\ + 二进制日志 ' + toSize(rdata.msg) + '\ \ -
'+ lan.soft.mysql_log_err + '
\ +错误日志
\ \ ' $(".soft-man-con").html(limitCon); diff --git a/plugins/qbittorrent/index.py b/plugins/qbittorrent/index.py index 44d57e69f..831e471c4 100755 --- a/plugins/qbittorrent/index.py +++ b/plugins/qbittorrent/index.py @@ -236,14 +236,39 @@ def pQbClient(): def qbList(): + args = getArgs() + # data = checkArgs(args, ['type']) + # if not data[0]: + # return data[1] + args_type = '' + if 'type' in args: + args_type = args['type'] + + f = ['downloading', 'completed'] + tfilter = '' + if args_type in f: + tfilter = args['type'] try: qb = pQbClient() - torrents = qb.torrents() - return public.returnJson(True, 'ok', torrents) + torrents = qb.torrents(filter=tfilter) + data = {} + data['type'] = tfilter + data['torrents'] = torrents + return public.returnJson(True, 'ok', data) except Exception as e: return public.returnJson(False, str(e)) +def qbDel(): + args = getArgs() + data = checkArgs(args, ['hash']) + if not data[0]: + return data[1] + qb = pQbClient() + data = qb.delete(args['hash']) + return public.returnJson(True, '操作成功!', data) + + def test(): qb = pQbClient() # magnet_link = "magnet:?xt=urn:btih:57a0ec92a61c60585f1b7a206a75798aa69285a5" @@ -278,6 +303,8 @@ if __name__ == "__main__": print getRunLog() elif func == 'qb_list': print qbList() + elif func == 'qb_del': + print qbDel() elif func == 'test': print test() else: diff --git a/plugins/qbittorrent/js/qbittorrent.js b/plugins/qbittorrent/js/qbittorrent.js index b9e9d9670..74ea6d5e0 100755 --- a/plugins/qbittorrent/js/qbittorrent.js +++ b/plugins/qbittorrent/js/qbittorrent.js @@ -30,55 +30,115 @@ function qbPost(method, args, callback){ }); } -function qbList(page,search){ - var _data = {}; - if (typeof(page) =='undefined'){ - var page = 1; - } +function showHideHash(obj){ + var a = "glyphicon-eye-open"; + var b = "glyphicon-eye-close"; - _data['page'] = page; - _data['page_size'] = 10; + if($(obj).hasClass(a)){ + $(obj).removeClass(a).addClass(b); + $(obj).prev().text($(obj).prev().attr('data-pw')) + } else{ + $(obj).removeClass(b).addClass(a); + $(obj).prev().text($(obj).attr('data-pw')); + } +} + + +function copyText(password){ + var clipboard = new ClipboardJS('#bt_copys'); + clipboard.on('success', function (e) { + layer.msg('复制成功',{icon:1,time:2000}); + }); + + clipboard.on('error', function (e) { + layer.msg('复制失败,浏览器不兼容!',{icon:2,time:2000}); + }); + $("#bt_copys").attr('data-clipboard-text',password); + $("#bt_copys").click(); +} + +function getLocalTime(nS) { + return new Date(parseInt(nS) * 1000).toLocaleString().replace(/:\d{1,2}$/,' '); +} + + +function qbAdd(type){ + +} + + +function qbDel(hash){ + qbPost('qb_del', {hash:hash}, function(data){ + var rdata = $.parseJSON(data.data); + if (rdata['status']){ + layer.msg(rdata.msg,{icon:1,time:2000,shade: [0.3, '#000']}); + } else { + layer.msg(rdata.msg,{icon:2,time:2000,shade: [0.3, '#000']}); + } + }); +} + +function qbListFind(){ + var qbs = $('#qb_selected').val(); + if ( qbs == '0' ){ + qbList(); + } else { + qbList(qbs); + } +} + +function qbList(search){ + var _data = {}; + _data['test'] ='yes'; if(typeof(search) != 'undefined'){ - _data['search'] = search; + _data['type'] = search; } qbPost('qb_list', _data, function(data){ - var rdata = $.parseJSON(data.data); if (!rdata['status']){ layer.msg(rdata.msg,{icon:0,time:2000,shade: [0.3, '#000']}); return; } - console.log(rdata); - content = ''; - // content += ''; + + content = ''; + content += ''; content += '种子(hash) | '; - content += '状态 | '; - content += '操作(添加 | 管理) | '; + content += '添加时间 | '; + content += '操作(添加 | 管理) | '; content += '
---|---|---|---|---|
'+ulist[i]['hash']+' | '+ - ''+'下载中'+' | '+ - '删除 | ||
'+ + ''+ulist[i]['hash'].substr(0,3)+'' + + ''+ + ''+ + ' | '+ + ''+getLocalTime(ulist[i]['added_on'])+' | '+ + '删除 |