Updated easyui to 1.5.1 and jquery to 1.12.4 and bug fixed

This commit is contained in:
Alex Wang 2017-03-31 03:24:13 -04:00
parent 94a633e7b6
commit 37efe7d5ac
93 changed files with 11391 additions and 8055 deletions

View File

@ -9,26 +9,26 @@
<link rel='shortcut icon' href='favicon.ico' type='image/x-icon'/ >
<title>Transmission Web Control</title>
<!-- 样式表 -->
<link rel="stylesheet" type="text/css" href="tr-web-control/style/base.css?v=20131031" />
<link rel="stylesheet" type="text/css" href="tr-web-control/script/easyui/themes/default/easyui.css?v=20131031"/>
<link rel="stylesheet" type="text/css" href="tr-web-control/script/easyui/themes/icon.css?v=20131031"/>
<link rel="stylesheet" type="text/css" href="tr-web-control/style/base.css?v=20170109" />
<link rel="stylesheet" type="text/css" href="tr-web-control/script/easyui/themes/default/easyui.css?v=20170109"/>
<link rel="stylesheet" type="text/css" href="tr-web-control/script/easyui/themes/icon.css?v=20170109"/>
<!-- 基础类库 -->
<script type="text/javascript" src="tr-web-control/script/jquery/jquery-1.11.2.min.js"></script>
<script type="text/javascript" src="tr-web-control/script/jquery/jquery-1.12.4.min.js"></script>
<script type="text/javascript" src="tr-web-control/script/jquery/jquery.form.js"></script>
<script type="text/javascript" src="tr-web-control/script/jquery/json2.min.js"></script>
<script type="text/javascript" src="tr-web-control/script/jquery/Base64.js"></script>
<script type="text/javascript" src="tr-web-control/script/easyui/jquery.easyui.min.js?v=20131031"></script>
<script type="text/javascript" src="tr-web-control/script/easyui/jquery.easyui.min.js?v=20170109"></script>
<script type="text/javascript" src="tr-web-control/script/easyui/plugins/jquery.datagrid.drophead.js"></script>
<!-- -->
<!-- 系统类库 -->
<script type="text/javascript" src="tr-web-control/script/min/public.js?v=20131031"></script>
<script type="text/javascript" src="tr-web-control/script/min/cookies.js?v=20131031"></script>
<script type="text/javascript" src="tr-web-control/script/min/clientDevice.js?v=20131031"></script>
<script type="text/javascript" src="tr-web-control/script/min/transmission.js?v=20131031"></script>
<script type="text/javascript" src="tr-web-control/script/min/transmission.torrents.js?v=20131031"></script>
<script type="text/javascript" src="tr-web-control/script/min/system.js?v=20131031"></script>
<script type="text/javascript" src="tr-web-control/config.js?v=20131031"></script>
<script type="text/javascript" src="tr-web-control/plugin.js?v=20131031"></script>
<script type="text/javascript" src="tr-web-control/script/public.min.js?v=20170109"></script>
<script type="text/javascript" src="tr-web-control/script/cookies.min.js?v=20170109"></script>
<script type="text/javascript" src="tr-web-control/script/clientDevice.min.js?v=20170109"></script>
<script type="text/javascript" src="tr-web-control/script/transmission.min.js?v=20170109"></script>
<script type="text/javascript" src="tr-web-control/script/transmission.torrents.min.js?v=20170109"></script>
<script type="text/javascript" src="tr-web-control/script/system.min.js?v=20141032"></script>
<script type="text/javascript" src="tr-web-control/config.js?v=20170109"></script>
<script type="text/javascript" src="tr-web-control/plugin.js?v=20170109"></script>
</head>
<style type="text/css">
.tree-title {
@ -145,4 +145,4 @@
<div id="menu-plugin-auto-match-data-folder" data-options="iconCls:'icon-target'" system-tip-lang="menus.plugin['auto-match-data-folder']" onclick="system.plugin.exec('auto-match-data-folder');"><span system-lang="menus.plugin['auto-match-data-folder']"></span></div>
</div>
</body>
</html>
</html>

View File

@ -12,7 +12,7 @@
<link rel="stylesheet" type="text/css" href="tr-web-control/style/base.mobile.css?v=20130913" />
<link rel="stylesheet" type="text/css" href="tr-web-control/script/jquery/mobile/jquery.mobile-1.3.2.min.css?v=20130913"/>
<!-- 基础类库 -->
<script type="text/javascript" src="tr-web-control/script/jquery/jquery-1.11.2.min.js"></script>
<script type="text/javascript" src="tr-web-control/script/jquery/jquery-1.12.4.min.js"></script>
<script type="text/javascript" src="tr-web-control/script/jquery/jquery.form.js"></script>
<script type="text/javascript" src="tr-web-control/script/jquery/json2.min.js"></script>
<script type="text/javascript" src="tr-web-control/script/jquery/Base64.js"></script>

View File

@ -111,8 +111,8 @@ system.defaultLang = {
,"current":"Current"
,"uploadedBytes":"UploadedBytes: "
,"downloadedBytes":"DownloadedBytes: "
,"filesAdded":"FilesAdded: "
,"sessionCount":"SessionCount: "
,"filesAdded":"FilesAdded: "
,"sessionCount":"SessionCount: "
,"secondsActive":"SecondsActive: "
}
,"servers":"Trackers"
@ -125,7 +125,7 @@ system.defaultLang = {
}
,"statusbar":{
"downloadspeed":"Download speed:"
,"uploadspeed":"Send speed:"
,"uploadspeed":"Seed speed:"
,"version":"Version:"
}
,"dialog":{
@ -197,9 +197,9 @@ system.defaultLang = {
,"seedRatioLimited":"The default seed ratio for torrents to use:"
,"queue-stalled-enabled":"Whether or not to consider idle torrents as stalled:"
,"idle-seeding-limit-enabled":"Torrents we're seeding will be stopped if they're idle for this long:"
,"minuets":"Minuets"
,"minutes":"Minutes"
,"nochange":"No change"
,"saveing":"Saveing..."
,"saving":"Saving..."
}
,"public":{
"button-ok":"OK"

View File

@ -91,7 +91,7 @@ system.lang = {
,"active":"Active"
,"paused":"Paused"
,"downloading":"Downloading"
,"sending":"Sending"
,"sending":"Seeding"
,"error":"Error"
,"warning":"Warning"
,"actively":"Actively"
@ -108,8 +108,8 @@ system.lang = {
,"current":"Current"
,"uploadedBytes":"UploadedBytes: "
,"downloadedBytes":"DownloadedBytes: "
,"filesAdded":"FilesAdded: "
,"sessionCount":"SessionCount: "
,"filesAdded":"FilesAdded: "
,"sessionCount":"SessionCount: "
,"secondsActive":"SecondsActive: "
}
,"servers":"Trackers"
@ -122,7 +122,7 @@ system.lang = {
}
,"statusbar":{
"downloadspeed":"Download speed:"
,"uploadspeed":"Send speed:"
,"uploadspeed":"Seed speed:"
,"version":"Version:"
}
,"dialog":{

View File

@ -0,0 +1,16 @@
var clientDevice=function(){var e={ie:0,gecko:0,webkit:0,khtml:0,opera:0,ver:null},i={ie:0,firefox:0,konq:0,opera:0,chrome:0,safari:0,ver:null},r={win:!1,mac:!1,xll:!1,iPhone:!1,iPod:!1,iPad:!1,android:!1,nokiaN:!1,winMobile:!1,macMobile:!1,wii:!1,ps:!1},o=navigator.userAgent
if(window.opera)e.ver=i.ver=window.opera.version(),e.opera=i.opera=parseFloat(e.ver)
else if(/AppleWebKit\/(\S+)/.test(o))if(e.ver=RegExp.$1,e.webkit=parseFloat(e.ver),/Chrome\/(\S+)/.test(o))i.ver=RegExp.$1,i.chrome=parseFloat(i.ver)
else if(/Version\/(\S+)/.test(o))i.ver=RegExp.$1,i.safari=parseFloat(i.ver)
else{var a=1
a=e.webkit<100?1:e.webkit<312?1.2:e.webkit<412?1.3:2,i.safari=i.ver=a}else/KHTML\/(\S+)/.test(o)||/Konquersor\/([^;]+)/.test(o)?(e.ver=i.ver=RegExp.$1,e.khtml=i.kong=paresFloat(e.ver)):/rv:([^\)]+)\) Gecko\/\d{8}/.test(o)?(e.ver=RegExp.$1,e.gecko=parseFloat(e.ver),/Firefox\/(\S+)/.test(o)&&(i.ver=RegExp.$1,i.firefox=parseFloat(i.ver))):/MSIE([^;]+)/.test(o)&&(i.ver=RegExp.$1,i.firefox=parseFloat(i.ver))
i.ie=e.ie,i.opera=e.opera
var t=navigator.platform
if(r.win=0==t.indexOf("Win"),r.mac=0==t.indexOf("Mac"),r.x11="X11"==t||0==t.indexOf("Linux"),r.win&&/Win(?:doms)?([^do]{2})\s?(\d+\.\d+)?/.test(o))if("NT"==RegExp.$1)switch(RegExp.$2){case"5.0":r.win="2000"
break
case"5.1":r.win="XP"
break
case"6.0":r.win="Vista"
break
default:r.win="NT"}else RegExp.$1?r.win="ME":r.win=RegExp.$1
return r.iPhone=o.indexOf("iPhone")>-1,r.iPod=o.indexOf("iPod")>-1,r.iPad=o.indexOf("iPad")>-1,r.android=o.indexOf("Android")>-1,r.nokiaN=o.indexOf("NokiaN")>-1,r.winMobile="CE"==r.win,r.macMobile=r.iPhone||r.iPod||r.iPad,r.wii=o.indexOf("Wii")>-1,r.ps=/playstation/i.test(o),{engine:e,browser:i,system:r}}();(clientDevice.system.iphone||clientDevice.system.ipod||clientDevice.system.nokiaN||clientDevice.system.winMobile||clientDevice.system.macMobile||clientDevice.system.android)&&"computer"!=location.search.getQueryString("devicetype")&&(location.href="index.mobile.html")

View File

@ -0,0 +1,16 @@
var cookies={get:function(e,t){for(var r,n,a,i,s=document.cookie.split("; "),o=s.length,c=0;c<o;c++)if(s[c].indexOf("&")>0){if(a=s[c].split("="),e==a[0]){s[c]=s[c].substr(e.length+1),i=s[c].split("&"),r=i.length
for(var u={},f=0;f<r;f++){n=i[f].split("=")
var l=unescape(n[1])
switch(l){case"true":u[n[0]]=!0
break
case"false":u[n[0]]=!1
break
default:u[n[0]]=l}if(t==n[0])return l}return u}}else if(n=s[c].split("="),e==n[0])return unescape(n[1])
return null},set:function(e,t,r){var n=new Date
void 0==r&&(r=0),n.setDate(n.getDate()+r)
var a=t
switch(typeof t){case"object":case"function":var i=new Array
for(var s in t)i.push(s+"="+escape(t[s]))
a=i.join("&")
break
default:a=escape(t)}document.cookie=e+"="+a+(0==r?"":"; expires="+n.toGMTString())},remove:function(e){this.set(e,"",-1)},all:function(){return document.cookie}}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,20 @@
(function($) {
$.extend({
includePath: '',
include: function(file) {
var files = typeof file == "string" ? [file] : file;
for (var i = 0; i < files.length; i++) {
var name = files[i].replace(/^\s|\s$/g, "");
var att = name.split('.');
var ext = att[att.length - 1].toLowerCase();
var isCSS = ext == "css";
var tag = isCSS ? "link" : "script";
var attr = isCSS ? " type='text/css' rel='stylesheet' " : " language='javascript' type='text/javascript' ";
var link = (isCSS ? "href" : "src") + "='" + $.includePath + name + "'";
if ($(tag + "[" + link + "]").length == 0) document.write("<" + tag + attr + link + "></" + tag + ">");
}
}
});
$.includePath = "class/client/easyui/plugins/jquery.";
$.include(['datagrid.drophead.js','portal.css','portal.js']);
})(jQuery);

View File

@ -13,7 +13,7 @@ if ($.messager){
$.messager.defaults.ok = 'Ok';
$.messager.defaults.cancel = 'Die styl';
}
$.map(['validatebox','textbox','filebox','searchbox',
$.map(['validatebox','textbox','passwordbox','filebox','searchbox',
'combo','combobox','combogrid','combotree',
'datebox','datetimebox','numberbox',
'spinner','numberspinner','timespinner','datetimespinner'], function(plugin){

View File

@ -13,7 +13,7 @@ if ($.messager){
$.messager.defaults.ok = 'Այո';
$.messager.defaults.cancel = 'Փակել';
}
$.map(['validatebox','textbox','filebox','searchbox',
$.map(['validatebox','textbox','passwordbox','filebox','searchbox',
'combo','combobox','combogrid','combotree',
'datebox','datetimebox','numberbox',
'spinner','numberspinner','timespinner','datetimespinner'], function(plugin){

View File

@ -13,7 +13,7 @@ if ($.messager){
$.messager.defaults.ok = 'موافق';
$.messager.defaults.cancel = 'إلغاء';
}
$.map(['validatebox','textbox','filebox','searchbox',
$.map(['validatebox','textbox','passwordbox','filebox','searchbox',
'combo','combobox','combogrid','combotree',
'datebox','datetimebox','numberbox',
'spinner','numberspinner','timespinner','datetimespinner'], function(plugin){

View File

@ -13,7 +13,7 @@ if ($.messager){
$.messager.defaults.ok = 'Добре';
$.messager.defaults.cancel = 'Задрасквам';
}
$.map(['validatebox','textbox','filebox','searchbox',
$.map(['validatebox','textbox','passwordbox','filebox','searchbox',
'combo','combobox','combogrid','combotree',
'datebox','datetimebox','numberbox',
'spinner','numberspinner','timespinner','datetimespinner'], function(plugin){

View File

@ -13,7 +13,7 @@ if ($.messager){
$.messager.defaults.ok = 'Ok';
$.messager.defaults.cancel = 'Cancel';
}
$.map(['validatebox','textbox','filebox','searchbox',
$.map(['validatebox','textbox','passwordbox','filebox','searchbox',
'combo','combobox','combogrid','combotree',
'datebox','datetimebox','numberbox',
'spinner','numberspinner','timespinner','datetimespinner'], function(plugin){

View File

@ -13,7 +13,7 @@ if ($.messager){
$.messager.defaults.ok = 'Ok';
$.messager.defaults.cancel = 'Zrušit';
}
$.map(['validatebox','textbox','filebox','searchbox',
$.map(['validatebox','textbox','passwordbox','filebox','searchbox',
'combo','combobox','combogrid','combotree',
'datebox','datetimebox','numberbox',
'spinner','numberspinner','timespinner','datetimespinner'], function(plugin){

View File

@ -13,7 +13,7 @@ if ($.messager){
$.messager.defaults.ok = 'Ok';
$.messager.defaults.cancel = 'Zrušit';
}
$.map(['validatebox','textbox','filebox','searchbox',
$.map(['validatebox','textbox','passwordbox','filebox','searchbox',
'combo','combobox','combogrid','combotree',
'datebox','datetimebox','numberbox',
'spinner','numberspinner','timespinner','datetimespinner'], function(plugin){

View File

@ -13,7 +13,7 @@ if ($.messager){
$.messager.defaults.ok = 'Ok';
$.messager.defaults.cancel = 'Annuller';
}
$.map(['validatebox','textbox','filebox','searchbox',
$.map(['validatebox','textbox','passwordbox','filebox','searchbox',
'combo','combobox','combogrid','combotree',
'datebox','datetimebox','numberbox',
'spinner','numberspinner','timespinner','datetimespinner'], function(plugin){

View File

@ -13,7 +13,7 @@ if ($.messager){
$.messager.defaults.ok = 'OK';
$.messager.defaults.cancel = 'Abbruch';
}
$.map(['validatebox','textbox','filebox','searchbox',
$.map(['validatebox','textbox','passwordbox','filebox','searchbox',
'combo','combobox','combogrid','combotree',
'datebox','datetimebox','numberbox',
'spinner','numberspinner','timespinner','datetimespinner'], function(plugin){

View File

@ -13,7 +13,7 @@ if ($.messager){
$.messager.defaults.ok = 'Εντάξει';
$.messager.defaults.cancel = 'Άκυρο';
}
$.map(['validatebox','textbox','filebox','searchbox',
$.map(['validatebox','textbox','passwordbox','filebox','searchbox',
'combo','combobox','combogrid','combotree',
'datebox','datetimebox','numberbox',
'spinner','numberspinner','timespinner','datetimespinner'], function(plugin){

View File

@ -13,7 +13,7 @@ if ($.messager){
$.messager.defaults.ok = 'Ok';
$.messager.defaults.cancel = 'Cancel';
}
$.map(['validatebox','textbox','filebox','searchbox',
$.map(['validatebox','textbox','passwordbox','filebox','searchbox',
'combo','combobox','combogrid','combotree',
'datebox','datetimebox','numberbox',
'spinner','numberspinner','timespinner','datetimespinner'], function(plugin){

View File

@ -13,7 +13,7 @@ if ($.messager){
$.messager.defaults.ok = 'Aceptar';
$.messager.defaults.cancel = 'Cancelar';
}
$.map(['validatebox','textbox','filebox','searchbox',
$.map(['validatebox','textbox','passwordbox','filebox','searchbox',
'combo','combobox','combogrid','combotree',
'datebox','datetimebox','numberbox',
'spinner','numberspinner','timespinner','datetimespinner'], function(plugin){

View File

@ -13,7 +13,7 @@ if ($.messager){
$.messager.defaults.ok = 'Ok';
$.messager.defaults.cancel = 'Annuler';
}
$.map(['validatebox','textbox','filebox','searchbox',
$.map(['validatebox','textbox','passwordbox','filebox','searchbox',
'combo','combobox','combogrid','combotree',
'datebox','datetimebox','numberbox',
'spinner','numberspinner','timespinner','datetimespinner'], function(plugin){

View File

@ -13,7 +13,7 @@ if ($.messager){
$.messager.defaults.ok = 'Ok';
$.messager.defaults.cancel = 'Annulla';
}
$.map(['validatebox','textbox','filebox','searchbox',
$.map(['validatebox','textbox','passwordbox','filebox','searchbox',
'combo','combobox','combogrid','combotree',
'datebox','datetimebox','numberbox',
'spinner','numberspinner','timespinner','datetimespinner'], function(plugin){
@ -25,16 +25,35 @@ if ($.fn.validatebox){
$.fn.validatebox.defaults.rules.email.message = 'Inserisci un indirizzo email valido.';
$.fn.validatebox.defaults.rules.url.message = 'Inserisci un URL valido.';
$.fn.validatebox.defaults.rules.length.message = 'Inserisci un valore tra {0} e {1}.';
$.fn.validatebox.defaults.rules.remote.message = 'Aggiusta questo campo.';
$.fn.validatebox.defaults.rules.remote.message = 'Correggere questo campo.';
}
if ($.fn.calendar){
$.fn.calendar.defaults.weeks = ['S','M','T','W','T','F','S'];
$.fn.calendar.defaults.firstDay = 1;
$.fn.calendar.defaults.weeks = ['D','L','M','M','G','V','S'];
$.fn.calendar.defaults.months = ['Gen', 'Feb', 'Mar', 'Apr', 'Mag', 'Giu', 'Lug', 'Ago', 'Set', 'Ott', 'Nov', 'Dic'];
}
if ($.fn.datebox){
$.fn.datebox.defaults.currentText = 'Oggi';
$.fn.datebox.defaults.closeText = 'Chiudi';
$.fn.datebox.defaults.okText = 'Ok';
$.fn.datebox.defaults.formatter = function(date){
var y = date.getFullYear();
var m = date.getMonth()+1;
var d = date.getDate();
return (d<10?('0'+d):d)+'/'+(m<10?('0'+m):m)+'/'+y;
};
$.fn.datebox.defaults.parser = function(s){
if (!s) return new Date();
var ss = s.split('/');
var d = parseInt(ss[0],10);
var m = parseInt(ss[1],10);
var y = parseInt(ss[2],10);
if (!isNaN(y) && !isNaN(m) && !isNaN(d)){
return new Date(y,m-1,d);
} else {
return new Date();
}
};
}
if ($.fn.datetimebox && $.fn.datebox){
$.extend($.fn.datetimebox.defaults,{

View File

@ -13,7 +13,7 @@ if ($.messager){
$.messager.defaults.ok = 'OK';
$.messager.defaults.cancel = 'キャンセル';
}
$.map(['validatebox','textbox','filebox','searchbox',
$.map(['validatebox','textbox','passwordbox','filebox','searchbox',
'combo','combobox','combogrid','combotree',
'datebox','datetimebox','numberbox',
'spinner','numberspinner','timespinner','datetimespinner'], function(plugin){

View File

@ -0,0 +1,45 @@
if ($.fn.pagination){
$.fn.pagination.defaults.beforePageText = '페이지';
$.fn.pagination.defaults.afterPageText = '{pages} 중';
$.fn.pagination.defaults.displayMsg = '전체 {total} 항목 중 {from}부터 {to}번째';
}
if ($.fn.datagrid){
$.fn.datagrid.defaults.loadMsg = '처리 중입니다. 잠시만 기다려 주세요...';
}
if ($.fn.treegrid && $.fn.datagrid){
$.fn.treegrid.defaults.loadMsg = $.fn.datagrid.defaults.loadMsg;
}
if ($.messager){
$.messager.defaults.ok = '확인';
$.messager.defaults.cancel = '취소';
}
$.map(['validatebox','textbox','passwordbox','filebox','searchbox',
'combo','combobox','combogrid','combotree',
'datebox','datetimebox','numberbox',
'spinner','numberspinner','timespinner','datetimespinner'], function(plugin){
if ($.fn[plugin]){
$.fn[plugin].defaults.missingMessage = '필수 항목입니다.';
}
});
if ($.fn.validatebox){
$.fn.validatebox.defaults.rules.email.message = '올바른 메일 주소를 입력해 주세요.';
$.fn.validatebox.defaults.rules.url.message = '올바른 URL를 입력해 주세요.';
$.fn.validatebox.defaults.rules.length.message = '{0}에서 {1} 사이의 값을 입력해 주세요.';
$.fn.validatebox.defaults.rules.remote.message = '이 필드를 수정해 주세요.';
}
if ($.fn.calendar){
$.fn.calendar.defaults.weeks = ['일','월','화','수','목','금','토'];
$.fn.calendar.defaults.months = ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'];
}
if ($.fn.datebox){
$.fn.datebox.defaults.currentText = '오늘';
$.fn.datebox.defaults.closeText = '닫기';
$.fn.datebox.defaults.okText = '확인';
}
if ($.fn.datetimebox && $.fn.datebox){
$.extend($.fn.datetimebox.defaults,{
currentText: $.fn.datebox.defaults.currentText,
closeText: $.fn.datebox.defaults.closeText,
okText: $.fn.datebox.defaults.okText
});
}

View File

@ -13,7 +13,7 @@ if ($.messager){
$.messager.defaults.ok = 'Ok';
$.messager.defaults.cancel = 'Annuleren';
}
$.map(['validatebox','textbox','filebox','searchbox',
$.map(['validatebox','textbox','passwordbox','filebox','searchbox',
'combo','combobox','combogrid','combotree',
'datebox','datetimebox','numberbox',
'spinner','numberspinner','timespinner','datetimespinner'], function(plugin){

View File

@ -13,7 +13,7 @@ if ($.messager){
$.messager.defaults.ok = 'Ok';
$.messager.defaults.cancel = 'Cancel';
}
$.map(['validatebox','textbox','filebox','searchbox',
$.map(['validatebox','textbox','passwordbox','filebox','searchbox',
'combo','combobox','combogrid','combotree',
'datebox','datetimebox','numberbox',
'spinner','numberspinner','timespinner','datetimespinner'], function(plugin){

View File

@ -13,7 +13,7 @@ if ($.messager){
$.messager.defaults.ok = 'Ok';
$.messager.defaults.cancel = 'Cancelar';
}
$.map(['validatebox','textbox','filebox','searchbox',
$.map(['validatebox','textbox','passwordbox','filebox','searchbox',
'combo','combobox','combogrid','combotree',
'datebox','datetimebox','numberbox',
'spinner','numberspinner','timespinner','datetimespinner'], function(plugin){

View File

@ -13,7 +13,7 @@ if ($.messager){
$.messager.defaults.ok = 'Ок';
$.messager.defaults.cancel = 'Закрыть';
}
$.map(['validatebox','textbox','filebox','searchbox',
$.map(['validatebox','textbox','passwordbox','filebox','searchbox',
'combo','combobox','combogrid','combotree',
'datebox','datetimebox','numberbox',
'spinner','numberspinner','timespinner','datetimespinner'], function(plugin){

View File

@ -13,7 +13,7 @@ if ($.messager) {
$.messager.defaults.ok = 'Ok';
$.messager.defaults.cancel = 'Avbryt';
}
$.map(['validatebox','textbox','filebox','searchbox',
$.map(['validatebox','textbox','passwordbox','filebox','searchbox',
'combo','combobox','combogrid','combotree',
'datebox','datetimebox','numberbox',
'spinner','numberspinner','timespinner','datetimespinner'], function(plugin){

View File

@ -18,7 +18,7 @@ if ($.messager){
$.messager.defaults.ok = 'Tamam';
$.messager.defaults.cancel = 'İptal';
}
$.map(['validatebox','textbox','filebox','searchbox',
$.map(['validatebox','textbox','passwordbox','filebox','searchbox',
'combo','combobox','combogrid','combotree',
'datebox','datetimebox','numberbox',
'spinner','numberspinner','timespinner','datetimespinner'], function(plugin){

View File

@ -13,7 +13,7 @@ if ($.messager){
$.messager.defaults.ok = '确定';
$.messager.defaults.cancel = '取消';
}
$.map(['validatebox','textbox','filebox','searchbox',
$.map(['validatebox','textbox','passwordbox','filebox','searchbox',
'combo','combobox','combogrid','combotree',
'datebox','datetimebox','numberbox',
'spinner','numberspinner','timespinner','datetimespinner'], function(plugin){

View File

@ -13,7 +13,7 @@ if ($.messager){
$.messager.defaults.ok = '確定';
$.messager.defaults.cancel = '取消';
}
$.map(['validatebox','textbox','filebox','searchbox',
$.map(['validatebox','textbox','passwordbox','filebox','searchbox',
'combo','combobox','combogrid','combotree',
'datebox','datetimebox','numberbox',
'spinner','numberspinner','timespinner','datetimespinner'], function(plugin){

View File

@ -1,102 +1,102 @@
// 为 easyui.datagrid 增加表头拖放事件
// 仅对单行表头的表格有效
(function($) {
$.extend($.fn.datagrid.defaults.view, {
onBeforeRender: function(target, rows) {
var datagrid = $.data(target, 'datagrid');
var parent = datagrid.dc.view2;
if (datagrid.options["drophead"]) {
parent.find('.datagrid-header-inner .datagrid-header-row td .datagrid-cell').draggable({
revert: true,
proxy: function(source) {
return ($(source).clone().addClass("drag-begin").appendTo($(source).parent()));
},
cursor: "",
handle: ":first-child",
axis: "h"
}).droppable({
accept: '.datagrid-header-inner .datagrid-header-row td .datagrid-cell',
onDragEnter: function(e, source) {
// 目标
var _target = $(e.currentTarget).parent();
// 源
var _source = $(source).parent();
if (_target[0].cellIndex < _source[0].cellIndex) {
$(this).addClass('drop-over-before');
} else
$(this).addClass('drop-over-after');
},
onDragLeave: function(e, source) {
$(this).removeClass('drop-over-after drop-over-before');
},
onDrop: function(e, source) {
$(this).removeClass('drop-over-after drop-over-before');
// 目标
var _target = $(e.currentTarget).parent();
// 源
var _source = $(source).parent();
var _targetField = _target.attr("field");
var _sourceField = _source.attr("field");
var _targetCells = parent.find("table.datagrid-btable td[field='" + _targetField + "']");
var _sourceCells = parent.find("table.datagrid-btable td[field='" + _sourceField + "']");
var _targetIndex = _target[0].cellIndex;
var _sourceIndex = _source[0].cellIndex;
if (_targetIndex < _sourceIndex) {
_target.before(_source);
$.each(_targetCells, function(index, item) {
$(item).before(_sourceCells[index]);
});
} else {
_target.after(_source);
$.each(_targetCells, function(index, item) {
$(item).after(_sourceCells[index]);
});
}
// 调整字段位置
moveArrayIndex(datagrid.options.columns[0], _sourceIndex, _targetIndex);
// 执行拖放事件
if (datagrid.options.onHeadDrop)
{
datagrid.options.onHeadDrop(_sourceField,_targetField);
}
}
});
}
}
});
function moveArrayIndex(source, n, m) {
n = n < 0 ? 0 : (n > source.length - 1 ? source.length - 1 : n);
m = m < 0 ? 0 : (m > source.length - 1 ? source.length - 1 : m);
if (n === m) {
return source;
} else {
if (n > m) //向前移动>对两个索引位置及其中间的元素重新赋值[顺推]
{
var temp = [source[m], source[m] = source[n]][0]; //交换n和m的值并将m上的值赋给temp
for (var i = m + 1; i <= n; i++) {
temp = [source[i], source[i] = temp][0];
}
} else { //向后移动>对两个索引位置及其中间的元素重新赋值[倒推]
var temp = [source[m], source[m] = source[n]][0]; //交换n和m的值并将m上的值赋给temp
for (var i = m - 1; i >= n; i--) {
temp = [source[i], source[i] = temp][0];
}
}
return source;
}
};
// 为 easyui.datagrid 增加表头拖放事件
// 仅对单行表头的表格有效
(function($) {
$.extend($.fn.datagrid.defaults.view, {
onBeforeRender: function(target, rows) {
var datagrid = $.data(target, 'datagrid');
var parent = datagrid.dc.view2;
if (datagrid.options["drophead"]) {
parent.find('.datagrid-header-inner .datagrid-header-row td .datagrid-cell').draggable({
revert: true,
proxy: function(source) {
return ($(source).clone().addClass("drag-begin").appendTo($(source).parent()));
},
cursor: "",
handle: ":first-child",
axis: "h"
}).droppable({
accept: '.datagrid-header-inner .datagrid-header-row td .datagrid-cell',
onDragEnter: function(e, source) {
// 目标
var _target = $(e.currentTarget).parent();
// 源
var _source = $(source).parent();
if (_target[0].cellIndex < _source[0].cellIndex) {
$(this).addClass('drop-over-before');
} else
$(this).addClass('drop-over-after');
},
onDragLeave: function(e, source) {
$(this).removeClass('drop-over-after drop-over-before');
},
onDrop: function(e, source) {
$(this).removeClass('drop-over-after drop-over-before');
// 目标
var _target = $(e.currentTarget).parent();
// 源
var _source = $(source).parent();
var _targetField = _target.attr("field");
var _sourceField = _source.attr("field");
var _targetCells = parent.find("table.datagrid-btable td[field='" + _targetField + "']");
var _sourceCells = parent.find("table.datagrid-btable td[field='" + _sourceField + "']");
var _targetIndex = _target[0].cellIndex;
var _sourceIndex = _source[0].cellIndex;
if (_targetIndex < _sourceIndex) {
_target.before(_source);
$.each(_targetCells, function(index, item) {
$(item).before(_sourceCells[index]);
});
} else {
_target.after(_source);
$.each(_targetCells, function(index, item) {
$(item).after(_sourceCells[index]);
});
}
// 调整字段位置
moveArrayIndex(datagrid.options.columns[0], _sourceIndex, _targetIndex);
// 执行拖放事件
if (datagrid.options.onHeadDrop)
{
datagrid.options.onHeadDrop(_sourceField,_targetField);
}
}
});
}
}
});
function moveArrayIndex(source, n, m) {
n = n < 0 ? 0 : (n > source.length - 1 ? source.length - 1 : n);
m = m < 0 ? 0 : (m > source.length - 1 ? source.length - 1 : m);
if (n === m) {
return source;
} else {
if (n > m) //向前移动>对两个索引位置及其中间的元素重新赋值[顺推]
{
var temp = [source[m], source[m] = source[n]][0]; //交换n和m的值并将m上的值赋给temp
for (var i = m + 1; i <= n; i++) {
temp = [source[i], source[i] = temp][0];
}
} else { //向后移动>对两个索引位置及其中间的元素重新赋值[倒推]
var temp = [source[m], source[m] = source[n]][0]; //交换n和m的值并将m上的值赋给temp
for (var i = m - 1; i >= n; i--) {
temp = [source[i], source[i] = temp][0];
}
}
return source;
}
};
})(jQuery);

View File

@ -1,4 +1,4 @@
.c1,.c1:hover{
.c1,.c1:hover,.c1>.panel-header{
color: #fff;
border-color: #3c8b3c;
background: #4cae4c;
@ -12,7 +12,17 @@ a.c1:hover{
background: #449d44;
filter: none;
}
.c2,.c2:hover{
.c1>.panel-body{
border-color: #3c8b3c;
}
.c1>.dialog-toolbar,.c1>.dialog-button{
border-left-color: #3c8b3c;
border-right-color: #3c8b3c;
}
.c1>.dialog-button{
border-bottom-color: #3c8b3c;
}
.c2,.c2:hover,.c2>.panel-header{
color: #fff;
border-color: #5f5f5f;
background: #747474;
@ -26,7 +36,17 @@ a.c2:hover{
background: #676767;
filter: none;
}
.c3,.c3:hover{
.c2>.panel-body{
border-color: #5f5f5f;
}
.c2>.dialog-toolbar,.c2>.dialog-button{
border-left-color: #5f5f5f;
border-right-color: #5f5f5f;
}
.c2>.dialog-button{
border-bottom-color: #5f5f5f;
}
.c3,.c3:hover,.c3>.panel-header{
color: #333;
border-color: #ff8080;
background: #ffb3b3;
@ -40,7 +60,17 @@ a.c3:hover{
background: #ff9999;
filter: none;
}
.c4,.c4:hover{
.c3>.panel-body{
border-color: #ff8080;
}
.c3>.dialog-toolbar,.c3>.dialog-button{
border-left-color: #ff8080;
border-right-color: #ff8080;
}
.c3>.dialog-button{
border-bottom-color: #ff8080;
}
.c4,.c4:hover,.c4>.panel-header{
color: #333;
border-color: #52d689;
background: #b8eecf;
@ -54,7 +84,17 @@ a.c4:hover{
background: #a4e9c1;
filter: none;
}
.c5,.c5:hover{
.c4>.panel-body{
border-color: #52d689;
}
.c4>.dialog-toolbar,.c4>.dialog-button{
border-left-color: #52d689;
border-right-color: #52d689;
}
.c4>.dialog-button{
border-bottom-color: #52d689;
}
.c5,.c5:hover,.c5>.panel-header{
color: #fff;
border-color: #b52b27;
background: #d84f4b;
@ -68,7 +108,17 @@ a.c5:hover{
background: #c9302c;
filter: none;
}
.c6,.c6:hover{
.c5>.panel-body{
border-color: #b52b27;
}
.c5>.dialog-toolbar,.c5>.dialog-button{
border-left-color: #b52b27;
border-right-color: #b52b27;
}
.c5>.dialog-button{
border-bottom-color: #b52b27;
}
.c6,.c6:hover,.c6>.panel-header{
color: #fff;
border-color: #1f637b;
background: #2984a4;
@ -82,7 +132,17 @@ a.c6:hover{
background: #24748f;
filter: none;
}
.c7,.c7:hover{
.c6>.panel-body{
border-color: #1f637b;
}
.c6>.dialog-toolbar,.c6>.dialog-button{
border-left-color: #1f637b;
border-right-color: #1f637b;
}
.c6>.dialog-button{
border-bottom-color: #1f637b;
}
.c7,.c7:hover,.c7>.panel-header{
color: #333;
border-color: #e68900;
background: #ffab2e;
@ -96,7 +156,17 @@ a.c7:hover{
background: #ff9900;
filter: none;
}
.c8,.c8:hover{
.c7>.panel-body{
border-color: #e68900;
}
.c7>.dialog-toolbar,.c7>.dialog-button{
border-left-color: #e68900;
border-right-color: #e68900;
}
.c7>.dialog-button{
border-bottom-color: #e68900;
}
.c8,.c8:hover,.c8>.panel-header{
color: #fff;
border-color: #4b72a4;
background: #698cba;
@ -110,3 +180,31 @@ a.c8:hover{
background: #577eb2;
filter: none;
}
.c8>.panel-body{
border-color: #4b72a4;
}
.c8>.dialog-toolbar,.c8>.dialog-button{
border-left-color: #4b72a4;
border-right-color: #4b72a4;
}
.c8>.dialog-button{
border-bottom-color: #4b72a4;
}
.c1>.panel-header>.panel-title,.c2>.panel-header>.panel-title,
.c5>.panel-header>.panel-title,.c6>.panel-header>.panel-title,.c8>.panel-header>.panel-title{
color: #fff;
}
.c-plain{
border-color: #fff;
background: #fff;
}
.c-plain>.panel-header,
.c-plain>.panel-body,
.c-plain>.dialog-button,
.c-plain>.dialog-toolbar{
border-color: transparent;
background: transparent;
}
.c-raised{
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
}

View File

@ -110,14 +110,19 @@
padding-bottom: 5px;
}
.calendar-menu-year {
width: 40px;
width: 50px;
text-align: center;
border-width: 1px;
border-style: solid;
outline-style: none;
resize: none;
margin: 0;
padding: 2px;
font-weight: bold;
font-size: 12px;
-moz-border-radius: 5px 5px 5px 5px;
-webkit-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
}
.calendar-menu-prev,
.calendar-menu-next {

View File

@ -1,20 +1,3 @@
.combo {
display: inline-block;
white-space: nowrap;
margin: 0;
padding: 0;
border-width: 1px;
border-style: solid;
overflow: hidden;
vertical-align: middle;
}
.combo .combo-text {
font-size: 12px;
border: 0px;
margin: 0;
padding: 0px 2px;
vertical-align: baseline;
}
.combo-arrow {
width: 18px;
height: 20px;
@ -38,10 +21,6 @@
.combo-panel {
background-color: #ffffff;
}
.combo {
border-color: #95B8E7;
background-color: #fff;
}
.combo-arrow {
background-color: #E0ECFF;
}
@ -54,7 +33,3 @@
.combo .textbox-icon-disabled:hover {
cursor: default;
}
.textbox-invalid {
border-color: #ffa8a8;
background-color: #fff3f3;
}

View File

@ -1,8 +1,8 @@
.combobox-item,
.combobox-group {
.combobox-group,
.combobox-stick {
font-size: 12px;
padding: 3px;
padding-right: 0px;
}
.combobox-item-disabled {
opacity: 0.5;
@ -11,9 +11,17 @@
.combobox-gitem {
padding-left: 10px;
}
.combobox-group {
.combobox-group,
.combobox-stick {
font-weight: bold;
}
.combobox-stick {
position: absolute;
top: 1px;
left: 1px;
right: 1px;
background: inherit;
}
.combobox-item-hover {
background-color: #eaf2ff;
color: #000000;
@ -22,3 +30,10 @@
background-color: #ffe48d;
color: #000000;
}
.combobox-icon {
display: inline-block;
width: 16px;
height: 16px;
vertical-align: middle;
margin-right: 2px;
}

View File

@ -39,8 +39,18 @@
border-style: solid;
display: none;
}
.datagrid-empty {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 25px;
line-height: 25px;
text-align: center;
}
.datagrid-sort-icon {
padding: 0;
display: none;
}
.datagrid-toolbar {
height: auto;
@ -107,10 +117,11 @@
}
.datagrid-cell-group {
text-align: center;
text-overflow: ellipsis;
}
.datagrid-header-rownumber,
.datagrid-cell-rownumber {
width: 25px;
width: 30px;
text-align: center;
margin: 0;
padding: 0;
@ -186,11 +197,21 @@
-webkit-border-radius: 0 0 0 0;
border-radius: 0 0 0 0;
}
.datagrid-view .validatebox-invalid {
border-color: #ffa8a8;
}
.datagrid-sort .datagrid-sort-icon {
display: inline;
padding: 0 13px 0 0;
background: url('images/datagrid_icons.png') no-repeat -64px center;
}
.datagrid-sort-desc .datagrid-sort-icon {
display: inline;
padding: 0 13px 0 0;
background: url('images/datagrid_icons.png') no-repeat -16px center;
}
.datagrid-sort-asc .datagrid-sort-icon {
display: inline;
padding: 0 13px 0 0;
background: url('images/datagrid_icons.png') no-repeat 0px center;
}

View File

@ -2,11 +2,11 @@
height: 180px;
}
.datebox-button {
height: 18px;
padding: 2px 5px;
padding: 0 5px;
text-align: center;
}
.datebox-button a {
line-height: 22px;
font-size: 12px;
font-weight: bold;
text-decoration: none;

View File

@ -2,6 +2,7 @@
overflow: auto;
}
.dialog-toolbar {
position: relative;
padding: 2px 5px;
}
.dialog-tool-separator {
@ -12,6 +13,8 @@
margin: 2px 1px;
}
.dialog-button {
position: relative;
top: -1px;
padding: 5px;
text-align: right;
}
@ -30,3 +33,15 @@
.dialog-button {
border-color: #dddddd #95B8E7 #95B8E7 #95B8E7;
}
.window-thinborder .dialog-toolbar {
border-left: transparent;
border-right: transparent;
border-top-color: #F4F4F4;
}
.window-thinborder .dialog-button {
top: 0px;
padding: 5px 8px 8px 8px;
border-left: transparent;
border-right: transparent;
border-bottom: transparent;
}

View File

@ -275,10 +275,29 @@
position: relative;
top: -1px;
}
.window-thinborder {
padding: 0;
}
.window-thinborder .window-header {
padding: 5px 5px 6px 5px;
}
.window-thinborder .window-body {
border-width: 0px;
}
.window-thinborder .window-header .panel-icon,
.window-thinborder .window-header .panel-tool {
margin-top: -9px;
margin-left: 5px;
margin-right: 5px;
}
.window-noborder {
border: 0;
}
.dialog-content {
overflow: auto;
}
.dialog-toolbar {
position: relative;
padding: 2px 5px;
}
.dialog-tool-separator {
@ -289,6 +308,8 @@
margin: 2px 1px;
}
.dialog-button {
position: relative;
top: -1px;
padding: 5px;
text-align: right;
}
@ -307,6 +328,18 @@
.dialog-button {
border-color: #dddddd #95B8E7 #95B8E7 #95B8E7;
}
.window-thinborder .dialog-toolbar {
border-left: transparent;
border-right: transparent;
border-top-color: #F4F4F4;
}
.window-thinborder .dialog-button {
top: 0px;
padding: 5px 8px 8px 8px;
border-left: transparent;
border-right: transparent;
border-bottom: transparent;
}
.l-btn {
text-decoration: none;
display: inline-block;
@ -537,10 +570,21 @@
-webkit-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
}
.textbox .textbox-text::-ms-clear,
.textbox .textbox-text::-ms-reveal {
display: none;
}
.textbox textarea.textbox-text {
white-space: pre-wrap;
}
.textbox .textbox-prompt {
font-size: 12px;
color: #aaa;
}
.textbox .textbox-bgicon {
background-position: 3px center;
padding-left: 21px;
}
.textbox .textbox-button,
.textbox .textbox-button:hover {
position: absolute;
@ -551,18 +595,58 @@
-webkit-border-radius: 0 0 0 0;
border-radius: 0 0 0 0;
}
.textbox-button-right,
.textbox-button-right:hover {
.textbox .textbox-button-right,
.textbox .textbox-button-right:hover {
right: 0;
border-width: 0 0 0 1px;
}
.textbox-button-left,
.textbox-button-left:hover {
.textbox .textbox-button-left,
.textbox .textbox-button-left:hover {
left: 0;
border-width: 0 1px 0 0;
}
.textbox .textbox-button-top,
.textbox .textbox-button-top:hover {
left: 0;
border-width: 0 0 1px 0;
}
.textbox .textbox-button-bottom,
.textbox .textbox-button-bottom:hover {
top: auto;
bottom: 0;
left: 0;
border-width: 1px 0 0 0;
}
.textbox-addon {
position: absolute;
top: 0;
}
.textbox-label {
display: inline-block;
width: 80px;
height: 22px;
line-height: 22px;
vertical-align: middle;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
margin: 0;
padding-right: 5px;
}
.textbox-label-after {
padding-left: 5px;
padding-right: 0;
}
.textbox-label-top {
display: block;
width: auto;
padding: 0;
}
.textbox-disabled,
.textbox-label-disabled {
opacity: 0.6;
filter: alpha(opacity=60);
}
.textbox-icon {
display: inline-block;
width: 18px;
@ -589,6 +673,7 @@
filter: alpha(opacity=60);
}
.textbox-focused {
border-color: #6b9cde;
-moz-box-shadow: 0 0 3px 0 #95B8E7;
-webkit-box-shadow: 0 0 3px 0 #95B8E7;
box-shadow: 0 0 3px 0 #95B8E7;
@ -597,6 +682,12 @@
border-color: #ffa8a8;
background-color: #fff3f3;
}
.passwordbox-open {
background: url('images/passwordbox_open.png') no-repeat center center;
}
.passwordbox-close {
background: url('images/passwordbox_close.png') no-repeat center center;
}
.filebox .textbox-value {
vertical-align: top;
position: absolute;
@ -612,27 +703,11 @@
left: 0;
top: 0;
z-index: 10;
background: url('images/blank.gif') no-repeat;
}
.l-btn-disabled .filebox-label {
cursor: default;
}
.combo {
display: inline-block;
white-space: nowrap;
margin: 0;
padding: 0;
border-width: 1px;
border-style: solid;
overflow: hidden;
vertical-align: middle;
}
.combo .combo-text {
font-size: 12px;
border: 0px;
margin: 0;
padding: 0px 2px;
vertical-align: baseline;
}
.combo-arrow {
width: 18px;
height: 20px;
@ -656,10 +731,6 @@
.combo-panel {
background-color: #ffffff;
}
.combo {
border-color: #95B8E7;
background-color: #fff;
}
.combo-arrow {
background-color: #E0ECFF;
}
@ -672,15 +743,11 @@
.combo .textbox-icon-disabled:hover {
cursor: default;
}
.textbox-invalid {
border-color: #ffa8a8;
background-color: #fff3f3;
}
.combobox-item,
.combobox-group {
.combobox-group,
.combobox-stick {
font-size: 12px;
padding: 3px;
padding-right: 0px;
}
.combobox-item-disabled {
opacity: 0.5;
@ -689,9 +756,17 @@
.combobox-gitem {
padding-left: 10px;
}
.combobox-group {
.combobox-group,
.combobox-stick {
font-weight: bold;
}
.combobox-stick {
position: absolute;
top: 1px;
left: 1px;
right: 1px;
background: inherit;
}
.combobox-item-hover {
background-color: #eaf2ff;
color: #000000;
@ -700,6 +775,57 @@
background-color: #ffe48d;
color: #000000;
}
.combobox-icon {
display: inline-block;
width: 16px;
height: 16px;
vertical-align: middle;
margin-right: 2px;
}
.tagbox {
cursor: text;
}
.tagbox .textbox-text {
float: left;
}
.tagbox-label {
position: relative;
display: block;
margin: 4px 0 0 4px;
padding: 0 20px 0 4px;
float: left;
vertical-align: top;
text-decoration: none;
-moz-border-radius: 5px 5px 5px 5px;
-webkit-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
background: #eaf2ff;
color: #000000;
}
.tagbox-remove {
background: url('images/tagbox_icons.png') no-repeat -16px center;
position: absolute;
display: block;
width: 16px;
height: 16px;
right: 2px;
top: 50%;
margin-top: -8px;
opacity: 0.6;
filter: alpha(opacity=60);
}
.tagbox-remove:hover {
opacity: 1;
filter: alpha(opacity=100);
}
.textbox-disabled .tagbox-label {
cursor: default;
}
.textbox-disabled .tagbox-remove:hover {
cursor: default;
opacity: 0.6;
filter: alpha(opacity=60);
}
.layout {
position: relative;
overflow: hidden;
@ -711,6 +837,10 @@
position: absolute;
overflow: hidden;
}
.layout-body {
min-width: 1px;
min-height: 1px;
}
.layout-panel-east,
.layout-panel-west {
z-index: 2;
@ -735,6 +865,44 @@
.layout-expand .panel-header {
border-bottom-width: 0px;
}
.layout-expand .panel-body {
position: relative;
}
.layout-expand .panel-body .panel-icon {
margin-top: 0;
top: 0;
left: 50%;
margin-left: -8px;
}
.layout-expand-west .panel-header .panel-icon,
.layout-expand-east .panel-header .panel-icon {
display: none;
}
.layout-expand-title {
position: absolute;
top: 0;
left: 21px;
white-space: nowrap;
word-wrap: normal;
-webkit-transform: rotate(90deg);
-webkit-transform-origin: 0 0;
-moz-transform: rotate(90deg);
-moz-transform-origin: 0 0;
-o-transform: rotate(90deg);
-o-transform-origin: 0 0;
transform: rotate(90deg);
transform-origin: 0 0;
}
.layout-expand-with-icon {
top: 18px;
}
.layout-expand .panel-body-noheader .layout-expand-title,
.layout-expand .panel-body-noheader .panel-icon {
top: 5px;
}
.layout-expand .panel-body-noheader .layout-expand-with-icon {
top: 23px;
}
.layout-split-proxy-h,
.layout-split-proxy-v {
position: absolute;
@ -1245,8 +1413,18 @@
border-style: solid;
display: none;
}
.datagrid-empty {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 25px;
line-height: 25px;
text-align: center;
}
.datagrid-sort-icon {
padding: 0;
display: none;
}
.datagrid-toolbar {
height: auto;
@ -1313,10 +1491,11 @@
}
.datagrid-cell-group {
text-align: center;
text-overflow: ellipsis;
}
.datagrid-header-rownumber,
.datagrid-cell-rownumber {
width: 25px;
width: 30px;
text-align: center;
margin: 0;
padding: 0;
@ -1392,11 +1571,21 @@
-webkit-border-radius: 0 0 0 0;
border-radius: 0 0 0 0;
}
.datagrid-view .validatebox-invalid {
border-color: #ffa8a8;
}
.datagrid-sort .datagrid-sort-icon {
display: inline;
padding: 0 13px 0 0;
background: url('images/datagrid_icons.png') no-repeat -64px center;
}
.datagrid-sort-desc .datagrid-sort-icon {
display: inline;
padding: 0 13px 0 0;
background: url('images/datagrid_icons.png') no-repeat -16px center;
}
.datagrid-sort-asc .datagrid-sort-icon {
display: inline;
padding: 0 13px 0 0;
background: url('images/datagrid_icons.png') no-repeat 0px center;
}
@ -1777,14 +1966,19 @@
padding-bottom: 5px;
}
.calendar-menu-year {
width: 40px;
width: 50px;
text-align: center;
border-width: 1px;
border-style: solid;
outline-style: none;
resize: none;
margin: 0;
padding: 2px;
font-weight: bold;
font-size: 12px;
-moz-border-radius: 5px 5px 5px 5px;
-webkit-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
}
.calendar-menu-prev,
.calendar-menu-next {
@ -1866,11 +2060,11 @@
height: 180px;
}
.datebox-button {
height: 18px;
padding: 2px 5px;
padding: 0 5px;
text-align: center;
}
.datebox-button a {
line-height: 22px;
font-size: 12px;
font-weight: bold;
text-decoration: none;
@ -1898,32 +2092,6 @@
.datebox-button a {
color: #444;
}
.numberbox {
border: 1px solid #95B8E7;
margin: 0;
padding: 0 2px;
vertical-align: middle;
}
.textbox {
padding: 0;
}
.spinner {
display: inline-block;
white-space: nowrap;
margin: 0;
padding: 0;
border-width: 1px;
border-style: solid;
overflow: hidden;
vertical-align: middle;
}
.spinner .spinner-text {
font-size: 12px;
border: 0px;
margin: 0;
padding: 0 2px;
vertical-align: baseline;
}
.spinner-arrow {
background-color: #E0ECFF;
display: inline-block;
@ -1976,8 +2144,11 @@
.spinner-arrow-down {
background: url('images/spinner_arrows.png') no-repeat -15px center;
}
.spinner {
border-color: #95B8E7;
.spinner-button-up {
background: url('images/spinner_arrows.png') no-repeat -32px center;
}
.spinner-button-down {
background: url('images/spinner_arrows.png') no-repeat -48px center;
}
.progressbar {
border-width: 1px;
@ -2011,27 +2182,6 @@
background-color: #ffe48d;
color: #000000;
}
.searchbox {
display: inline-block;
white-space: nowrap;
margin: 0;
padding: 0;
border-width: 1px;
border-style: solid;
overflow: hidden;
vertical-align: middle;
}
.searchbox .searchbox-text {
font-size: 12px;
border: 0;
margin: 0;
padding: 0 2px;
vertical-align: top;
}
.searchbox .searchbox-prompt {
font-size: 12px;
color: #ccc;
}
.searchbox-button {
width: 18px;
height: 20px;
@ -2085,10 +2235,6 @@
.searchbox-button {
background: url('images/searchbox_button.png') no-repeat center center;
}
.searchbox {
border-color: #95B8E7;
background-color: #fff;
}
.searchbox .l-btn-plain {
background: #E0ECFF;
}
@ -2097,10 +2243,6 @@
opacity: 0.5;
filter: alpha(opacity=50);
}
.textbox-invalid {
border-color: #ffa8a8;
background-color: #fff3f3;
}
.slider-disabled {
opacity: 0.5;
filter: alpha(opacity=50);
@ -2428,12 +2570,12 @@
border-width: 0 0 0 1px;
}
.messager-body {
padding: 10px;
overflow: hidden;
padding: 10px 10px 30px 10px;
overflow: auto;
}
.messager-button {
text-align: center;
padding-top: 10px;
padding: 5px;
}
.messager-button .l-btn {
width: 70px;
@ -2464,9 +2606,13 @@
}
.messager-body .messager-input {
width: 100%;
padding: 1px 0;
padding: 4px 0;
outline-style: none;
border: 1px solid #95B8E7;
}
.window-thinborder .messager-button {
padding-bottom: 8px;
}
.tree {
margin: 0;
padding: 0;
@ -2601,13 +2747,14 @@
border: 1px dotted red;
}
.tree-editor {
border: 1px solid #ccc;
border: 1px solid #95B8E7;
font-size: 12px;
height: 14px !important;
height: 18px;
line-height: 14px;
padding: 1px 2px;
line-height: 16px;
padding: 0 4px;
margin: 0;
width: 80px;
outline-style: none;
vertical-align: top;
position: absolute;
top: 0;
}
@ -2663,6 +2810,9 @@
_border-color: tomato;
_filter: chroma(color=tomato);
}
.tooltip-arrow {
display: none \9;
}
.tooltip-right .tooltip-arrow-outer {
left: 0;
top: 50%;
@ -2732,3 +2882,80 @@
.tooltip-bottom .tooltip-arrow {
border-bottom-color: #ffffff;
}
.switchbutton {
text-decoration: none;
display: inline-block;
overflow: hidden;
vertical-align: middle;
margin: 0;
padding: 0;
cursor: pointer;
background: #bbb;
border: 1px solid #bbb;
-moz-border-radius: 5px 5px 5px 5px;
-webkit-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
}
.switchbutton-inner {
display: inline-block;
overflow: hidden;
position: relative;
top: -1px;
left: -1px;
}
.switchbutton-on,
.switchbutton-off,
.switchbutton-handle {
display: inline-block;
text-align: center;
height: 100%;
float: left;
font-size: 12px;
-moz-border-radius: 5px 5px 5px 5px;
-webkit-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
}
.switchbutton-on {
background: #ffe48d;
color: #000000;
}
.switchbutton-off {
background-color: #ffffff;
color: #000000;
}
.switchbutton-on,
.switchbutton-reversed .switchbutton-off {
-moz-border-radius: 5px 0 0 5px;
-webkit-border-radius: 5px 0 0 5px;
border-radius: 5px 0 0 5px;
}
.switchbutton-off,
.switchbutton-reversed .switchbutton-on {
-moz-border-radius: 0 5px 5px 0;
-webkit-border-radius: 0 5px 5px 0;
border-radius: 0 5px 5px 0;
}
.switchbutton-handle {
position: absolute;
top: 0;
left: 50%;
background-color: #ffffff;
color: #000000;
border: 1px solid #bbb;
-moz-box-shadow: 0 0 3px 0 #bbb;
-webkit-box-shadow: 0 0 3px 0 #bbb;
box-shadow: 0 0 3px 0 #bbb;
}
.switchbutton-value {
position: absolute;
top: 0;
left: -5000px;
}
.switchbutton-disabled {
opacity: 0.5;
filter: alpha(opacity=50);
}
.switchbutton-disabled,
.switchbutton-readonly {
cursor: default;
}

View File

@ -13,6 +13,7 @@
left: 0;
top: 0;
z-index: 10;
background: url('images/blank.gif') no-repeat;
}
.l-btn-disabled .filebox-label {
cursor: default;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 220 B

After

Width:  |  Height:  |  Size: 307 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 115 B

After

Width:  |  Height:  |  Size: 149 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 B

View File

@ -9,6 +9,10 @@
position: absolute;
overflow: hidden;
}
.layout-body {
min-width: 1px;
min-height: 1px;
}
.layout-panel-east,
.layout-panel-west {
z-index: 2;
@ -33,6 +37,44 @@
.layout-expand .panel-header {
border-bottom-width: 0px;
}
.layout-expand .panel-body {
position: relative;
}
.layout-expand .panel-body .panel-icon {
margin-top: 0;
top: 0;
left: 50%;
margin-left: -8px;
}
.layout-expand-west .panel-header .panel-icon,
.layout-expand-east .panel-header .panel-icon {
display: none;
}
.layout-expand-title {
position: absolute;
top: 0;
left: 21px;
white-space: nowrap;
word-wrap: normal;
-webkit-transform: rotate(90deg);
-webkit-transform-origin: 0 0;
-moz-transform: rotate(90deg);
-moz-transform-origin: 0 0;
-o-transform: rotate(90deg);
-o-transform-origin: 0 0;
transform: rotate(90deg);
transform-origin: 0 0;
}
.layout-expand-with-icon {
top: 18px;
}
.layout-expand .panel-body-noheader .layout-expand-title,
.layout-expand .panel-body-noheader .panel-icon {
top: 5px;
}
.layout-expand .panel-body-noheader .layout-expand-with-icon {
top: 23px;
}
.layout-split-proxy-h,
.layout-split-proxy-v {
position: absolute;

View File

@ -1,10 +1,10 @@
.messager-body {
padding: 10px;
overflow: hidden;
padding: 10px 10px 30px 10px;
overflow: auto;
}
.messager-button {
text-align: center;
padding-top: 10px;
padding: 5px;
}
.messager-button .l-btn {
width: 70px;
@ -35,6 +35,10 @@
}
.messager-body .messager-input {
width: 100%;
padding: 1px 0;
padding: 4px 0;
outline-style: none;
border: 1px solid #95B8E7;
}
.window-thinborder .messager-button {
padding-bottom: 8px;
}

View File

@ -1,9 +0,0 @@
.numberbox {
border: 1px solid #95B8E7;
margin: 0;
padding: 0 2px;
vertical-align: middle;
}
.textbox {
padding: 0;
}

View File

@ -0,0 +1,6 @@
.passwordbox-open {
background: url('images/passwordbox_open.png') no-repeat center center;
}
.passwordbox-close {
background: url('images/passwordbox_close.png') no-repeat center center;
}

View File

@ -1,24 +1,3 @@
.searchbox {
display: inline-block;
white-space: nowrap;
margin: 0;
padding: 0;
border-width: 1px;
border-style: solid;
overflow: hidden;
vertical-align: middle;
}
.searchbox .searchbox-text {
font-size: 12px;
border: 0;
margin: 0;
padding: 0 2px;
vertical-align: top;
}
.searchbox .searchbox-prompt {
font-size: 12px;
color: #ccc;
}
.searchbox-button {
width: 18px;
height: 20px;
@ -72,10 +51,6 @@
.searchbox-button {
background: url('images/searchbox_button.png') no-repeat center center;
}
.searchbox {
border-color: #95B8E7;
background-color: #fff;
}
.searchbox .l-btn-plain {
background: #E0ECFF;
}
@ -84,7 +59,3 @@
opacity: 0.5;
filter: alpha(opacity=50);
}
.textbox-invalid {
border-color: #ffa8a8;
background-color: #fff3f3;
}

View File

@ -1,20 +1,3 @@
.spinner {
display: inline-block;
white-space: nowrap;
margin: 0;
padding: 0;
border-width: 1px;
border-style: solid;
overflow: hidden;
vertical-align: middle;
}
.spinner .spinner-text {
font-size: 12px;
border: 0px;
margin: 0;
padding: 0 2px;
vertical-align: baseline;
}
.spinner-arrow {
background-color: #E0ECFF;
display: inline-block;
@ -67,6 +50,9 @@
.spinner-arrow-down {
background: url('images/spinner_arrows.png') no-repeat -15px center;
}
.spinner {
border-color: #95B8E7;
.spinner-button-up {
background: url('images/spinner_arrows.png') no-repeat -32px center;
}
.spinner-button-down {
background: url('images/spinner_arrows.png') no-repeat -48px center;
}

View File

@ -0,0 +1,77 @@
.switchbutton {
text-decoration: none;
display: inline-block;
overflow: hidden;
vertical-align: middle;
margin: 0;
padding: 0;
cursor: pointer;
background: #bbb;
border: 1px solid #bbb;
-moz-border-radius: 5px 5px 5px 5px;
-webkit-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
}
.switchbutton-inner {
display: inline-block;
overflow: hidden;
position: relative;
top: -1px;
left: -1px;
}
.switchbutton-on,
.switchbutton-off,
.switchbutton-handle {
display: inline-block;
text-align: center;
height: 100%;
float: left;
font-size: 12px;
-moz-border-radius: 5px 5px 5px 5px;
-webkit-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
}
.switchbutton-on {
background: #ffe48d;
color: #000000;
}
.switchbutton-off {
background-color: #ffffff;
color: #000000;
}
.switchbutton-on,
.switchbutton-reversed .switchbutton-off {
-moz-border-radius: 5px 0 0 5px;
-webkit-border-radius: 5px 0 0 5px;
border-radius: 5px 0 0 5px;
}
.switchbutton-off,
.switchbutton-reversed .switchbutton-on {
-moz-border-radius: 0 5px 5px 0;
-webkit-border-radius: 0 5px 5px 0;
border-radius: 0 5px 5px 0;
}
.switchbutton-handle {
position: absolute;
top: 0;
left: 50%;
background-color: #ffffff;
color: #000000;
border: 1px solid #bbb;
-moz-box-shadow: 0 0 3px 0 #bbb;
-webkit-box-shadow: 0 0 3px 0 #bbb;
box-shadow: 0 0 3px 0 #bbb;
}
.switchbutton-value {
position: absolute;
top: 0;
left: -5000px;
}
.switchbutton-disabled {
opacity: 0.5;
filter: alpha(opacity=50);
}
.switchbutton-disabled,
.switchbutton-readonly {
cursor: default;
}

View File

@ -0,0 +1,44 @@
.tagbox {
cursor: text;
}
.tagbox .textbox-text {
float: left;
}
.tagbox-label {
position: relative;
display: block;
margin: 4px 0 0 4px;
padding: 0 20px 0 4px;
float: left;
vertical-align: top;
text-decoration: none;
-moz-border-radius: 5px 5px 5px 5px;
-webkit-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
background: #eaf2ff;
color: #000000;
}
.tagbox-remove {
background: url('images/tagbox_icons.png') no-repeat -16px center;
position: absolute;
display: block;
width: 16px;
height: 16px;
right: 2px;
top: 50%;
margin-top: -8px;
opacity: 0.6;
filter: alpha(opacity=60);
}
.tagbox-remove:hover {
opacity: 1;
filter: alpha(opacity=100);
}
.textbox-disabled .tagbox-label {
cursor: default;
}
.textbox-disabled .tagbox-remove:hover {
cursor: default;
opacity: 0.6;
filter: alpha(opacity=60);
}

View File

@ -25,10 +25,21 @@
-webkit-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
}
.textbox .textbox-text::-ms-clear,
.textbox .textbox-text::-ms-reveal {
display: none;
}
.textbox textarea.textbox-text {
white-space: pre-wrap;
}
.textbox .textbox-prompt {
font-size: 12px;
color: #aaa;
}
.textbox .textbox-bgicon {
background-position: 3px center;
padding-left: 21px;
}
.textbox .textbox-button,
.textbox .textbox-button:hover {
position: absolute;
@ -39,18 +50,58 @@
-webkit-border-radius: 0 0 0 0;
border-radius: 0 0 0 0;
}
.textbox-button-right,
.textbox-button-right:hover {
.textbox .textbox-button-right,
.textbox .textbox-button-right:hover {
right: 0;
border-width: 0 0 0 1px;
}
.textbox-button-left,
.textbox-button-left:hover {
.textbox .textbox-button-left,
.textbox .textbox-button-left:hover {
left: 0;
border-width: 0 1px 0 0;
}
.textbox .textbox-button-top,
.textbox .textbox-button-top:hover {
left: 0;
border-width: 0 0 1px 0;
}
.textbox .textbox-button-bottom,
.textbox .textbox-button-bottom:hover {
top: auto;
bottom: 0;
left: 0;
border-width: 1px 0 0 0;
}
.textbox-addon {
position: absolute;
top: 0;
}
.textbox-label {
display: inline-block;
width: 80px;
height: 22px;
line-height: 22px;
vertical-align: middle;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
margin: 0;
padding-right: 5px;
}
.textbox-label-after {
padding-left: 5px;
padding-right: 0;
}
.textbox-label-top {
display: block;
width: auto;
padding: 0;
}
.textbox-disabled,
.textbox-label-disabled {
opacity: 0.6;
filter: alpha(opacity=60);
}
.textbox-icon {
display: inline-block;
width: 18px;
@ -77,6 +128,7 @@
filter: alpha(opacity=60);
}
.textbox-focused {
border-color: #6b9cde;
-moz-box-shadow: 0 0 3px 0 #95B8E7;
-webkit-box-shadow: 0 0 3px 0 #95B8E7;
box-shadow: 0 0 3px 0 #95B8E7;

View File

@ -29,6 +29,9 @@
_border-color: tomato;
_filter: chroma(color=tomato);
}
.tooltip-arrow {
display: none \9;
}
.tooltip-right .tooltip-arrow-outer {
left: 0;
top: 50%;

View File

@ -132,13 +132,14 @@
border: 1px dotted red;
}
.tree-editor {
border: 1px solid #ccc;
border: 1px solid #95B8E7;
font-size: 12px;
height: 14px !important;
height: 18px;
line-height: 14px;
padding: 1px 2px;
line-height: 16px;
padding: 0 4px;
margin: 0;
width: 80px;
outline-style: none;
vertical-align: top;
position: absolute;
top: 0;
}

View File

@ -92,3 +92,21 @@
position: relative;
top: -1px;
}
.window-thinborder {
padding: 0;
}
.window-thinborder .window-header {
padding: 5px 5px 6px 5px;
}
.window-thinborder .window-body {
border-width: 0px;
}
.window-thinborder .window-header .panel-icon,
.window-thinborder .window-header .panel-tool {
margin-top: -9px;
margin-left: 5px;
margin-right: 5px;
}
.window-noborder {
border: 0;
}

View File

@ -67,8 +67,6 @@
.icon-more{
background:url('icons/more.png') no-repeat center center;
}
.icon-mini-add{
background:url('icons/mini_add.png') no-repeat center center;
}
@ -94,3 +92,41 @@
.icon-large-chart{
background:url('icons/large_chart.png') no-repeat center center;
}
.icon-servers{
background:url('icons/servers.png') no-repeat;
}
.icon-server{
background:url('icons/server.png') no-repeat;
}
.icon-server-error{
background:url('icons/server_error.png') no-repeat;
}
.icon-home{
background:url('icons/home.png') no-repeat;
}
.icon-download{
background:url('icons/download1.png') no-repeat;
}
.icon-seed{
background:url('icons/seed.png') no-repeat;
}
.icon-warning{
background:url('icons/warning.png') no-repeat;
}
.icon-error{
background:url('icons/stop.png') no-repeat;
}
.icon-pause{
background:url('icons/pause.png') no-repeat;
}
.icon-check{
background:url('icons/yin-yang.png') no-repeat;
}
.icon-actively{
background:url('icons/actively.png') no-repeat;
}
.icon-wait{
background:url('icons/wait.png') no-repeat;
}
.icon-chart{
background:url('icons/chart.png') no-repeat;

Binary file not shown.

After

Width:  |  Height:  |  Size: 621 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 821 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 732 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 727 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 707 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 785 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 910 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 650 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 796 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 817 B

View File

@ -25,7 +25,8 @@
right:0;
z-index: 1;
}
.m-left>.l-btn,.m-right>.l-btn{
.m-left>.l-btn,.m-right>.l-btn,
.m-left>.switchbutton,.m-right>.switchbutton{
position: relative;
vertical-align: top;
top: 50%;
@ -251,6 +252,9 @@
position: absolute;
}
.textbox .textbox-text{
padding: 8px 4px;
}
.calendar-header,.calendar-title{
height: 30px;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,16 +1,28 @@
/*!
* jQuery Form Plugin
* version: 3.20 (20-NOV-2012)
* @requires jQuery v1.5 or later
*
* version: 3.51.0-2014.06.20
* Requires jQuery v1.5 or later
* Copyright (c) 2014 M. Alsup
* Examples and documentation at: http://malsup.com/jquery/form/
* Project repository: https://github.com/malsup/form
* Dual licensed under the MIT and GPL licenses:
* http://malsup.github.com/mit-license.txt
* http://malsup.github.com/gpl-license-v2.txt
* Dual licensed under the MIT and GPL licenses.
* https://github.com/malsup/form#copyright-and-license
*/
/*global ActiveXObject alert */
;(function($) {
/*global ActiveXObject */
// AMD support
(function (factory) {
"use strict";
if (typeof define === 'function' && define.amd) {
// using AMD; register as anon module
define(['jquery'], factory);
} else {
// no AMD; invoke directly
factory( (typeof(jQuery) != 'undefined') ? jQuery : window.Zepto );
}
}
(function($) {
"use strict";
/*
@ -37,7 +49,7 @@
target: '#output'
});
});
You can also use ajaxForm with delegation (requires jQuery v1.7+), so the
form does not have to exist when you invoke ajaxForm:
@ -45,7 +57,7 @@
delegation: true,
target: '#output'
});
When using ajaxForm, the ajaxSubmit function will be invoked for you
at the appropriate time.
*/
@ -57,6 +69,23 @@ var feature = {};
feature.fileapi = $("<input type='file'/>").get(0).files !== undefined;
feature.formdata = window.FormData !== undefined;
var hasProp = !!$.fn.prop;
// attr2 uses prop when it can but checks the return type for
// an expected string. this accounts for the case where a form
// contains inputs with names like "action" or "method"; in those
// cases "prop" returns the element
$.fn.attr2 = function() {
if ( ! hasProp ) {
return this.attr.apply(this, arguments);
}
var val = this.prop.apply(this, arguments);
if ( ( val && val.jquery ) || typeof val === 'string' ) {
return val;
}
return this.attr.apply(this, arguments);
};
/**
* ajaxSubmit() provides a mechanism for immediately submitting
* an HTML form using AJAX.
@ -69,15 +98,19 @@ $.fn.ajaxSubmit = function(options) {
log('ajaxSubmit: skipping submit process - no element selected');
return this;
}
var method, action, url, $form = this;
if (typeof options == 'function') {
options = { success: options };
}
else if ( options === undefined ) {
options = {};
}
method = options.type || this.attr2('method');
action = options.url || this.attr2('action');
method = this.attr('method');
action = this.attr('action');
url = (typeof action === 'string') ? $.trim(action) : '';
url = url || window.location.href || '';
if (url) {
@ -88,7 +121,7 @@ $.fn.ajaxSubmit = function(options) {
options = $.extend(true, {
url: url,
success: $.ajaxSettings.success,
type: method || 'GET',
type: method || $.ajaxSettings.type,
iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'
}, options);
@ -111,7 +144,7 @@ $.fn.ajaxSubmit = function(options) {
if ( traditional === undefined ) {
traditional = $.ajaxSettings.traditional;
}
var elements = [];
var qx, a = this.formToArray(options.semantic, elements);
if (options.data) {
@ -135,7 +168,7 @@ $.fn.ajaxSubmit = function(options) {
var q = $.param(a, traditional);
if (qx) {
q = ( q ? (q + '&' + qx) : qx );
}
}
if (options.type.toUpperCase() == 'GET') {
options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
options.data = null; // data is null for 'get'
@ -165,17 +198,33 @@ $.fn.ajaxSubmit = function(options) {
}
options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg
var context = options.context || this ; // jQuery 1.4+ supports scope context
var context = options.context || this ; // jQuery 1.4+ supports scope context
for (var i=0, max=callbacks.length; i < max; i++) {
callbacks[i].apply(context, [data, status, xhr || $form, $form]);
}
};
if (options.error) {
var oldError = options.error;
options.error = function(xhr, status, error) {
var context = options.context || this;
oldError.apply(context, [xhr, status, error, $form]);
};
}
if (options.complete) {
var oldComplete = options.complete;
options.complete = function(xhr, status) {
var context = options.context || this;
oldComplete.apply(context, [xhr, status, $form]);
};
}
// are there files to upload?
// [value] (issue #113), also see comment:
// https://github.com/malsup/form/commit/588306aedba1de01388032d5f42a60159eea9228#commitcomment-2180219
var fileInputs = $('input[type=file]:enabled[value!=""]', this);
var fileInputs = $('input[type=file]:enabled', this).filter(function() { return $(this).val() !== ''; });
var hasFileInputs = fileInputs.length > 0;
var mp = 'multipart/form-data';
@ -211,8 +260,9 @@ $.fn.ajaxSubmit = function(options) {
$form.removeData('jqxhr').data('jqxhr', jqxhr);
// clear element array
for (var k=0; k < elements.length; k++)
for (var k=0; k < elements.length; k++) {
elements[k] = null;
}
// fire 'notify' event
this.trigger('form-submit-notify', [this, options]);
@ -220,13 +270,16 @@ $.fn.ajaxSubmit = function(options) {
// utility fn for deep serialization
function deepSerialize(extraData){
var serialized = $.param(extraData).split('&');
var serialized = $.param(extraData, options.traditional).split('&');
var len = serialized.length;
var result = {};
var result = [];
var i, part;
for (i=0; i < len; i++) {
// #252; undo param space replacement
serialized[i] = serialized[i].replace(/\+/g,' ');
part = serialized[i].split('=');
result[decodeURIComponent(part[0])] = decodeURIComponent(part[1]);
// #278; use array instead of object storage, favoring array serializations
result.push([decodeURIComponent(part[0]), decodeURIComponent(part[1])]);
}
return result;
}
@ -241,9 +294,11 @@ $.fn.ajaxSubmit = function(options) {
if (options.extraData) {
var serializedData = deepSerialize(options.extraData);
for (var p in serializedData)
if (serializedData.hasOwnProperty(p))
formdata.append(p, serializedData[p]);
for (i=0; i < serializedData.length; i++) {
if (serializedData[i]) {
formdata.append(serializedData[i][0], serializedData[i][1]);
}
}
}
options.data = null;
@ -254,13 +309,13 @@ $.fn.ajaxSubmit = function(options) {
cache: false,
type: method || 'POST'
});
if (options.uploadProgress) {
// workaround because jqXHR does not expose upload property
s.xhr = function() {
var xhr = jQuery.ajaxSettings.xhr();
var xhr = $.ajaxSettings.xhr();
if (xhr.upload) {
xhr.upload.onprogress = function(event) {
xhr.upload.addEventListener('progress', function(event) {
var percent = 0;
var position = event.loaded || event.position; /*event.position is deprecated*/
var total = event.total;
@ -268,18 +323,25 @@ $.fn.ajaxSubmit = function(options) {
percent = Math.ceil(position / total * 100);
}
options.uploadProgress(event, position, total, percent);
};
}, false);
}
return xhr;
};
}
s.data = null;
var beforeSend = s.beforeSend;
s.beforeSend = function(xhr, o) {
var beforeSend = s.beforeSend;
s.beforeSend = function(xhr, o) {
//Send FormData() provided by user
if (options.formData) {
o.data = options.formData;
}
else {
o.data = formdata;
if(beforeSend)
beforeSend.call(this, xhr, o);
}
if(beforeSend) {
beforeSend.call(this, xhr, o);
}
};
return $.ajax(s);
}
@ -287,25 +349,23 @@ $.fn.ajaxSubmit = function(options) {
// private function for handling file uploads (hat tip to YAHOO!)
function fileUploadIframe(a) {
var form = $form[0], el, i, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle;
var useProp = !!$.fn.prop;
var deferred = $.Deferred();
if ($('[name=submit],[id=submit]', form).length) {
// if there is an input with a name or id of 'submit' then we won't be
// able to invoke the submit fn on the form (at least not x-browser)
alert('Error: Form elements must not have name or id of "submit".');
deferred.reject();
return deferred;
}
// #341
deferred.abort = function(status) {
xhr.abort(status);
};
if (a) {
// ensure that every serialized input is still enabled
for (i=0; i < elements.length; i++) {
el = $(elements[i]);
if ( useProp )
if ( hasProp ) {
el.prop('disabled', false);
else
}
else {
el.removeAttr('disabled');
}
}
}
@ -314,11 +374,13 @@ $.fn.ajaxSubmit = function(options) {
id = 'jqFormIO' + (new Date().getTime());
if (s.iframeTarget) {
$io = $(s.iframeTarget);
n = $io.attr('name');
if (!n)
$io.attr('name', id);
else
n = $io.attr2('name');
if (!n) {
$io.attr2('name', id);
}
else {
id = n;
}
}
else {
$io = $('<iframe name="' + id + '" src="'+ s.iframeSrc +'" />');
@ -340,20 +402,25 @@ $.fn.ajaxSubmit = function(options) {
var e = (status === 'timeout' ? 'timeout' : 'aborted');
log('aborting upload... ' + e);
this.aborted = 1;
// #214
if (io.contentWindow.document.execCommand) {
try { // #214
try { // #214, #257
if (io.contentWindow.document.execCommand) {
io.contentWindow.document.execCommand('Stop');
} catch(ignore) {}
}
}
catch(ignore) {}
$io.attr('src', s.iframeSrc); // abort op in progress
xhr.error = e;
if (s.error)
if (s.error) {
s.error.call(s.context, xhr, e, status);
if (g)
}
if (g) {
$.event.trigger("ajaxError", [xhr, s, e]);
if (s.complete)
}
if (s.complete) {
s.complete.call(s.context, xhr, e);
}
}
};
@ -391,15 +458,44 @@ $.fn.ajaxSubmit = function(options) {
}
}
}
var CLIENT_TIMEOUT_ABORT = 1;
var SERVER_ABORT = 2;
function getDoc(frame) {
var doc = frame.contentWindow ? frame.contentWindow.document : frame.contentDocument ? frame.contentDocument : frame.document;
/* it looks like contentWindow or contentDocument do not
* carry the protocol property in ie8, when running under ssl
* frame.document is the only valid response document, since
* the protocol is know but not on the other two objects. strange?
* "Same origin policy" http://en.wikipedia.org/wiki/Same_origin_policy
*/
var doc = null;
// IE8 cascading access check
try {
if (frame.contentWindow) {
doc = frame.contentWindow.document;
}
} catch(err) {
// IE8 access denied under ssl & missing protocol
log('cannot get iframe.contentWindow document: ' + err);
}
if (doc) { // successful getting content
return doc;
}
try { // simply checking may throw in ie8 under ssl or mismatched protocol
doc = frame.contentDocument ? frame.contentDocument : frame.document;
} catch(err) {
// last attempt
log('cannot get iframe.contentDocument: ' + err);
doc = frame.document;
}
return doc;
}
// Rails CSRF hack (thanks to Yvan Barthelemy)
var csrf_token = $('meta[name=csrf-token]').attr('content');
var csrf_param = $('meta[name=csrf-param]').attr('content');
@ -411,11 +507,14 @@ $.fn.ajaxSubmit = function(options) {
// take a breath so that pending repaints get some cpu time before the upload starts
function doSubmit() {
// make sure form attrs are set
var t = $form.attr('target'), a = $form.attr('action');
var t = $form.attr2('target'),
a = $form.attr2('action'),
mp = 'multipart/form-data',
et = $form.attr('enctype') || $form.attr('encoding') || mp;
// update form attrs in IE friendly way
form.setAttribute('target',id);
if (!method) {
if (!method || /post/i.test(method) ) {
form.setAttribute('method', 'POST');
}
if (a != s.url) {
@ -434,20 +533,22 @@ $.fn.ajaxSubmit = function(options) {
if (s.timeout) {
timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);
}
// look for server aborts
function checkState() {
try {
var state = getDoc(io).readyState;
log('state = ' + state);
if (state && state.toLowerCase() == 'uninitialized')
if (state && state.toLowerCase() == 'uninitialized') {
setTimeout(checkState,50);
}
}
catch(e) {
log('Server abort: ' , e, ' (', e.name, ')');
cb(SERVER_ABORT);
if (timeoutHandle)
if (timeoutHandle) {
clearTimeout(timeoutHandle);
}
timeoutHandle = undefined;
}
}
@ -461,11 +562,11 @@ $.fn.ajaxSubmit = function(options) {
// if using the $.param format that allows for multiple values with the same name
if($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {
extraInputs.push(
$('<input type="hidden" name="'+s.extraData[n].name+'">').attr('value',s.extraData[n].value)
$('<input type="hidden" name="'+s.extraData[n].name+'">').val(s.extraData[n].value)
.appendTo(form)[0]);
} else {
extraInputs.push(
$('<input type="hidden" name="'+n+'">').attr('value',s.extraData[n])
$('<input type="hidden" name="'+n+'">').val(s.extraData[n])
.appendTo(form)[0]);
}
}
@ -475,17 +576,27 @@ $.fn.ajaxSubmit = function(options) {
if (!s.iframeTarget) {
// add iframe to doc and submit the form
$io.appendTo('body');
if (io.attachEvent)
io.attachEvent('onload', cb);
else
io.addEventListener('load', cb, false);
}
if (io.attachEvent) {
io.attachEvent('onload', cb);
}
else {
io.addEventListener('load', cb, false);
}
setTimeout(checkState,15);
form.submit();
try {
form.submit();
} catch(err) {
// just in case form has element with name/id of 'submit'
var submitFn = document.createElement('form').submit;
submitFn.apply(form);
}
}
finally {
// reset attrs and remove "extra" input elements
form.setAttribute('action',a);
form.setAttribute('enctype', et); // #380
if(t) {
form.setAttribute('target', t);
} else {
@ -508,11 +619,10 @@ $.fn.ajaxSubmit = function(options) {
if (xhr.aborted || callbackProcessed) {
return;
}
try {
doc = getDoc(io);
}
catch(ex) {
log('cannot access response document: ', ex);
doc = getDoc(io);
if(!doc) {
log('cannot access response document');
e = SERVER_ABORT;
}
if (e === CLIENT_TIMEOUT_ABORT && xhr) {
@ -528,13 +638,16 @@ $.fn.ajaxSubmit = function(options) {
if (!doc || doc.location.href == s.iframeSrc) {
// response not received yet
if (!timedOut)
if (!timedOut) {
return;
}
}
if (io.detachEvent)
if (io.detachEvent) {
io.detachEvent('onload', cb);
else
}
else {
io.removeEventListener('load', cb, false);
}
var status = 'success', errMsg;
try {
@ -561,11 +674,12 @@ $.fn.ajaxSubmit = function(options) {
var docRoot = doc.body ? doc.body : doc.documentElement;
xhr.responseText = docRoot ? docRoot.innerHTML : null;
xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
if (isXml)
if (isXml) {
s.dataType = 'xml';
}
xhr.getResponseHeader = function(header){
var headers = {'content-type': s.dataType};
return headers[header];
return headers[header.toLowerCase()];
};
// support for XHR 'status' & 'statusText' emulation :
if (docRoot) {
@ -603,15 +717,15 @@ $.fn.ajaxSubmit = function(options) {
try {
data = httpData(xhr, dt, s);
}
catch (e) {
catch (err) {
status = 'parsererror';
xhr.error = errMsg = (e || status);
xhr.error = errMsg = (err || status);
}
}
catch (e) {
log('error caught: ',e);
catch (err) {
log('error caught: ',err);
status = 'error';
xhr.error = errMsg = (e || status);
xhr.error = errMsg = (err || status);
}
if (xhr.aborted) {
@ -625,40 +739,52 @@ $.fn.ajaxSubmit = function(options) {
// ordering of these callbacks/triggers is odd, but that's how $.ajax does it
if (status === 'success') {
if (s.success)
if (s.success) {
s.success.call(s.context, data, 'success', xhr);
}
deferred.resolve(xhr.responseText, 'success', xhr);
if (g)
if (g) {
$.event.trigger("ajaxSuccess", [xhr, s]);
}
}
else if (status) {
if (errMsg === undefined)
if (errMsg === undefined) {
errMsg = xhr.statusText;
if (s.error)
}
if (s.error) {
s.error.call(s.context, xhr, status, errMsg);
}
deferred.reject(xhr, 'error', errMsg);
if (g)
if (g) {
$.event.trigger("ajaxError", [xhr, s, errMsg]);
}
}
if (g)
if (g) {
$.event.trigger("ajaxComplete", [xhr, s]);
}
if (g && ! --$.active) {
$.event.trigger("ajaxStop");
}
if (s.complete)
if (s.complete) {
s.complete.call(s.context, xhr, status);
}
callbackProcessed = true;
if (s.timeout)
if (s.timeout) {
clearTimeout(timeoutHandle);
}
// clean up
setTimeout(function() {
if (!s.iframeTarget)
if (!s.iframeTarget) {
$io.remove();
}
else { //adding else to clean up existing iframe response.
$io.attr('src', s.iframeSrc);
}
xhr.responseXML = null;
}, 100);
}
@ -686,8 +812,9 @@ $.fn.ajaxSubmit = function(options) {
data = xml ? xhr.responseXML : xhr.responseText;
if (xml && data.documentElement.nodeName === 'parsererror') {
if ($.error)
if ($.error) {
$.error('parsererror');
}
}
if (s && s.dataFilter) {
data = s.dataFilter(data, type);
@ -724,7 +851,7 @@ $.fn.ajaxSubmit = function(options) {
$.fn.ajaxForm = function(options) {
options = options || {};
options.delegation = options.delegation && $.isFunction($.fn.on);
// in jQuery 1.3+ we can fix mistakes with the ready state
if (!options.delegation && this.length === 0) {
var o = { s: this.selector, c: this.context };
@ -754,16 +881,16 @@ $.fn.ajaxForm = function(options) {
.bind('click.form-plugin', options, captureSubmittingElement);
};
// private event handlers
// private event handlers
function doAjaxSubmit(e) {
/*jshint validthis:true */
var options = e.data;
if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed
e.preventDefault();
$(this).ajaxSubmit(options);
$(e.target).ajaxSubmit(options); // #365
}
}
function captureSubmittingElement(e) {
/*jshint validthis:true */
var target = e.target;
@ -819,8 +946,23 @@ $.fn.formToArray = function(semantic, elements) {
}
var form = this[0];
var formId = this.attr('id');
var els = semantic ? form.getElementsByTagName('*') : form.elements;
if (!els) {
var els2;
if (els && !/MSIE [678]/.test(navigator.userAgent)) { // #390
els = $(els).get(); // convert to standard array
}
// #386; account for inputs outside the form which use the 'form' attribute
if ( formId ) {
els2 = $(':input[form="' + formId + '"]').get(); // hat tip @thet
if ( els2.length ) {
els = (els || []).concat(els2);
}
}
if (!els || !els.length) {
return a;
}
@ -828,13 +970,13 @@ $.fn.formToArray = function(semantic, elements) {
for(i=0, max=els.length; i < max; i++) {
el = els[i];
n = el.name;
if (!n) {
if (!n || el.disabled) {
continue;
}
if (semantic && form.clk && el.type == "image") {
// handle image inputs on the fly when semantic == true
if(!el.disabled && form.clk == el) {
if(form.clk == el) {
a.push({name: n, value: $(el).val(), type: el.type });
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
}
@ -843,15 +985,17 @@ $.fn.formToArray = function(semantic, elements) {
v = $.fieldValue(el, true);
if (v && v.constructor == Array) {
if (elements)
if (elements) {
elements.push(el);
}
for(j=0, jmax=v.length; j < jmax; j++) {
a.push({name: n, value: v[j]});
}
}
else if (feature.fileapi && el.type == 'file' && !el.disabled) {
if (elements)
else if (feature.fileapi && el.type == 'file') {
if (elements) {
elements.push(el);
}
var files = el.files;
if (files.length) {
for (j=0; j < files.length; j++) {
@ -864,8 +1008,9 @@ $.fn.formToArray = function(semantic, elements) {
}
}
else if (v !== null && typeof v != 'undefined') {
if (elements)
if (elements) {
elements.push(el);
}
a.push({name: n, value: v, type: el.type, required: el.required});
}
}
@ -961,10 +1106,12 @@ $.fn.fieldValue = function(successful) {
if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) {
continue;
}
if (v.constructor == Array)
if (v.constructor == Array) {
$.merge(val, v);
else
}
else {
val.push(v);
}
}
return val;
};
@ -998,7 +1145,7 @@ $.fieldValue = function(el, successful) {
if (op.selected) {
var v = op.value;
if (!v) { // extra pain for IE...
v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
v = (op.attributes && op.attributes.value && !(op.attributes.value.specified)) ? op.text : op.value;
}
if (one) {
return v;
@ -1041,14 +1188,22 @@ $.fn.clearFields = $.fn.clearInputs = function(includeHidden) {
else if (tag == 'select') {
this.selectedIndex = -1;
}
else if (t == "file") {
if (/MSIE/.test(navigator.userAgent)) {
$(this).replaceWith($(this).clone(true));
} else {
$(this).val('');
}
}
else if (includeHidden) {
// includeHidden can be the value true, or it can be a selector string
// indicating a special test; for example:
// $('#myForm').clearForm('.special:hidden')
// the above would clean hidden inputs that have the class of 'special'
if ( (includeHidden === true && /hidden/.test(t)) ||
(typeof includeHidden == 'string' && $(this).is(includeHidden)) )
(typeof includeHidden == 'string' && $(this).is(includeHidden)) ) {
this.value = '';
}
}
});
};
@ -1107,8 +1262,9 @@ $.fn.ajaxSubmit.debug = false;
// helper fn for console logging
function log() {
if (!$.fn.ajaxSubmit.debug)
if (!$.fn.ajaxSubmit.debug) {
return;
}
var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
if (window.console && window.console.log) {
window.console.log(msg);
@ -1118,4 +1274,4 @@ function log() {
}
}
})(jQuery);
}));

View File

@ -1,4 +1,4 @@
var system={version:"1.0 Beta",rootPath:"tr-web-control/",codeupdate:"20141010",configHead:"transmission-web-control",config:{autoReload:true,reloadStep:5E3,pageSize:30,defaultSelectNode:null,autoExpandAttribute:false,defaultLang:""},storageKeys:{dictionary:{folders:"dictionary.folders"}},dictionary:{folders:null},checkUpdateScript:"https://transmission-control.googlecode.com/svn/resouces/checkupdate.js",contextMenus:{},panel:null,lang:null,reloading:false,autoReloadTimer:null,downloadDir:"",islocal:false,
var system={version:"1.1 Beta",rootPath:"tr-web-control/",codeupdate:"20170317",configHead:"transmission-web-control",config:{autoReload:true,reloadStep:5E3,pageSize:30,defaultSelectNode:null,autoExpandAttribute:false,defaultLang:""},storageKeys:{dictionary:{folders:"dictionary.folders"}},dictionary:{folders:null},checkUpdateScript:"https://transmission-control.googlecode.com/svn/resouces/checkupdate.js",contextMenus:{},panel:null,lang:null,reloading:false,autoReloadTimer:null,downloadDir:"",islocal:false,
B64:new Base64,currentTorrentId:0,control:{tree:null,torrentlist:null},userConfig:{torrentList:{fields:[],sortName:null,sortOrder:"asc"}},serverConfig:null,serverSessionStats:null,templates:{},setlang:function(a,b){a||(a=this.config.defaultLang?this.config.defaultLang:navigator.language||navigator.browserLanguage);a||(a="zh-CN");if(a.indexOf("-")!=-1)a=a.split("-")[0].toLocaleLowerCase()+"-"+a.split("-")[1].toLocaleUpperCase();this.languages[a]||(a="en");$.getScript(system.rootPath+"lang/"+a+".js",
function(){system.lang=$.extend(true,system.defaultLang,system.lang);system.resetLangText();$.getScript(system.rootPath+"script/easyui/locale/easyui-lang-"+a.replace("-","_")+".js").done(function(){b&&b()}).fail(function(){$.getScript(system.rootPath+"script/easyui/locale/easyui-lang-en.js",function(){b&&b()})})})},init:function(a,b){this.readConfig();this.islocal=b==1?true:false;this.panel={main:$("#main"),top:$("#m_top"),toolbar:$("#m_toolbar"),left_layout:$("#m_left_layout"),left:$("#m_left"),
body:$("#m_body"),layout_body:$("#layout_body"),list:$("#m_list"),attribute:$("#m_attribute"),bottom:$("#m_bottom"),title:$("#m_title"),status:$("#m_status"),statusbar:$("#m_statusbar"),status_text:$("#status_text"),droparea:$("#dropArea")};this.lang==null?this.setlang(a,function(){system.initdata()}):this.initdata()},resetLangText:function(a){a||(a=$);var b=a.find("*[system-lang]");$.each(b,function(c,d){var e=$(d).attr("system-lang");e.substr(0,1)=="["?$(d).html(eval("system.lang"+e)):$(d).html(eval("system.lang."+

View File

@ -1,4 +1,4 @@
var system={version:"1.0 Beta",rootPath:"tr-web-control/",codeupdate:"20141010",config:{autoReload:true,reloadStep:5E3,pageSize:30,defaultSelectNode:null},lang:null,reloading:false,autoReloadTimer:null,downloadDir:"",islocal:false,B64:new Base64,currentTorrentId:0,currentContentPage:"home",currentContentConfig:null,control:{tree:null,torrentlist:null},serverConfig:null,serverSessionStats:null,torrentListChecked:false,debug:function(a,b){window.console&&window.console.log&&window.console.log(a,b)},
var system={version:"1.1 Beta",rootPath:"tr-web-control/",codeupdate:"20160823",config:{autoReload:true,reloadStep:5E3,pageSize:30,defaultSelectNode:null},lang:null,reloading:false,autoReloadTimer:null,downloadDir:"",islocal:false,B64:new Base64,currentTorrentId:0,currentContentPage:"home",currentContentConfig:null,control:{tree:null,torrentlist:null},serverConfig:null,serverSessionStats:null,torrentListChecked:false,debug:function(a,b){window.console&&window.console.log&&window.console.log(a,b)},
setlang:function(a,b){a||(a=this.config.defaultLang?this.config.defaultLang:navigator.language||navigator.browserLanguage);a||(a="zh-CN");if(a.indexOf("-")!=-1)a=a.split("-")[0].toLocaleLowerCase()+"-"+a.split("-")[1].toLocaleUpperCase();this.languages[a]||(a="en");$.getScript(system.rootPath+"lang/"+a+".js",function(){system.lang=$.extend(true,system.defaultLang,system.lang);system.resetLangText();b&&b()})},resetLangText:function(){var a=$("*[system-lang]");$.each(a,function(b,c){var d=$(c).attr("system-lang");
$(c).html(eval("system.lang."+d))})},init:function(a){this.readConfig();transmission.options.getFolders=false;this.lang==null?this.setlang(a,function(){system.initdata()}):this.initdata()},initdata:function(){$(document).attr("title",this.lang.system.title+" "+this.version);this.control.torrentlist=$("#torrent-list");this.connect()},readConfig:function(){var a=cookies.get("transmission-web-control");if($.isPlainObject(a))this.config=$.extend(this.config,a)},saveConfig:function(){cookies.set("transmission-web-control",
this.config,100)},connect:function(){transmission.on.torrentCountChange=function(){system.reloadTorrentBaseInfos()};transmission.on.postError=function(){};transmission.init({islocal:true},function(){system.reloadSession(true);system.getServerStatus()})},reloadSession:function(){transmission.getSession(function(a){system.serverConfig=a;a["alt-speed-enabled"]==true?$("#status_alt_speed").show():$("#status_alt_speed").hide();system.downloadDir=a["download-dir"];parseInt(system.serverConfig["rpc-version"])>=

View File

@ -205,29 +205,30 @@ function getMinutesFromHours(hours)
return (parseInt(hours.split(":")[0],10)*60+parseInt(hours.split(":")[1],10));
}
// 获取累计时间
// Get the cumulative time
function getTotalTime(time,format)
{
//time [ms]
if (!format)
{
format = "%dd %hh %mm %ss";
format = "%dd %hh %mm %ss ";
}
//计算出相差天数
//Calculate the difference between the number of days
var days=Math.floor(time/(24*3600*1000));
//计算出小时数
//Calculate the number of hours
var leave1=time%(24*3600*1000);
//计算天数后剩余的毫秒数
//The number of milliseconds remaining after calculating the number of days
var hours=Math.floor(leave1/(3600*1000));
//计算相差分钟数
//Calculate the number of minutes
var leave2=leave1%(3600*1000);
//计算小时数后剩余的毫秒数
//The number of milliseconds remaining after the number of hours is counted
var minutes=Math.floor(leave2/(60*1000));
//计算相差秒数
//Calculate the number of seconds
var leave3=leave2%(60*1000);
//计算分钟数后剩余的毫秒数
//The number of milliseconds remaining after calculating the number of minutes
var seconds=Math.round(leave3/1000);
var result = format;
@ -261,7 +262,7 @@ function getTotalTime(time,format)
return result;
}
// 数组对象排序扩展
// Array object sort extension
function arrayObjectSort(field,sortOrder)
{
return function(object1, object2)
@ -294,7 +295,7 @@ function arrayObjectSort(field,sortOrder)
}
}
// 通用分时处理函数
// Generic time - sharing processing functions
function timedChunk(items, process, context, delay,callback)
{
var todo = items.concat();
@ -316,9 +317,9 @@ function timedChunk(items, process, context, delay,callback)
}, delay);
}
// jQuery 扩展
// jQuery Extended
(function($){
// 淡入谈出
// Fade in and out
$.fn.fadeInAndOut = function(speed,easing,fn){
var options = {
speed:speed
@ -329,7 +330,7 @@ function timedChunk(items, process, context, delay,callback)
this.fadeIn(options.speed).delay(options.speed).fadeOut(options.speed,options.easing,options.fn);
};
// 插件的defaults
// Plugin defaults
$.fn.fadeInAndOut.defaults = {
speed:1000
,easing:"swing"

37
src/tr-web-control/script/public.min.js vendored Normal file
View File

@ -0,0 +1,37 @@
// 获取“查询字符串”
//公用函数定义
//格式化数字
// 根据分钟获取小时
// 根据小时获取分钟
// Get the cumulative time
// Array object sort extension
// Generic time - sharing processing functions
// jQuery Extended
function getLocalTime(e){return new Date(1e3*parseInt(e)).toLocaleString().replace(/年|月/g,"-").replace(/日/g," ")}function formatLongTime(e,r){var t=new Date(1e3*parseInt(e))
return formatDate(t)}function formatDate(e,r){if(r||(r="yyyy-mm-dd hh:nn:ss"),e instanceof Date){var t=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"),n=e.getFullYear(),a=n.toString().substring(2),s=e.getMonth()+1,i=s<10?"0"+s:s,u=t[s],o=e.getDate(),c=o<10?"0"+o:o,l=e.getHours(),p=l<10?"0"+l:l,f=e.getMinutes(),h=f<10?"0"+f:f,d=e.getSeconds(),g=d<10?"0"+d:d
return r=r.replace(/yyyy/i,n),r=r.replace(/yy/i,a),r=r.replace(/mmm/i,u),r=r.replace(/mm/i,i),r=r.replace(/m/i,s),r=r.replace(/dd/i,c),r=r.replace(/d/i,o),r=r.replace(/hh/i,p),r=r.replace(/h/i,l),r=r.replace(/nn/i,h),r=r.replace(/n/i,f),r=r.replace(/ss/i,g),r=r.replace(/s/i,d)}return""}function formatSize(e,r,t){if(0==e)return 1==r?"":"speed"==t?"0.00 KB/s":"0.00"
var n="",a="KB"
return e<1024e3?(n=e/1024,a="KB"):e<1048576e3?(n=e/1048576,a="MB"):e<0xfa00000000?(n=e/1073741824,a="GB"):e<0x3e80000000000?(n=e/1099511627776,a="TB"):(n=e/0x4000000000000,a="PB"),"speed"==t&&(a+="/s"),n.formatNumber("###,###,###,###.00 ")+a}function getHoursFromMinutes(e){return("00"+parseInt(e/60,10)).right(2)+":"+("00"+e%60).right(2)}function getMinutesFromHours(e){return 60*parseInt(e.split(":")[0],10)+parseInt(e.split(":")[1],10)}function getTotalTime(e,r){r||(r="%dd %hh %mm %ss ")
var t=Math.floor(e/864e5),n=e%864e5,a=Math.floor(n/36e5),s=n%36e5,i=Math.floor(s/6e4),u=s%6e4,o=Math.round(u/1e3),c=r
return c=0==t?c.replace(/(%d+\s)/,""):c.replace("%d",t),c=0==a?c.replace(/(%h+\s)/,""):c.replace("%h",a),c=0==i?c.replace(/(%m+\s)/,""):c.replace("%m",i),c=0==o?c.replace(/(%s+\s)/,""):c.replace("%s",o)}function arrayObjectSort(e,r){return function(t,n){var a=t[e],s=n[e]
return a<s?"desc"==r?1:-1:a>s?"desc"==r?-1:1:0}}function timedChunk(e,r,t,n,a){var s=e.concat()
void 0==n&&(n=25),setTimeout(function(){var i=+new Date
do r.call(t,s.shift())
while(s.length>0&&+new Date-i<100)
s.length>0?setTimeout(arguments.callee,n):a&&a(e)},n)}String.prototype.getQueryString=function(e,r){void 0==r&&(r="&")
var t,n=new RegExp("(^|"+r+"|\\?)"+e+"=([^"+r+"]*)("+r+"|$)")
return(t=this.match(n))?unescape(t[2]):null},String.prototype.right=function(e){return this.substr(-e)},Number.prototype.formatNumber=function(e){this.fStr=function(e,t,n){if(""==e||void 0==e)return""==t||void 0==t?"":t
var a,i=s=r=""
n||(e=e.split("").reverse().join(""),t=t.split("").reverse().join(""))
for(var u=j=0;u<t.length;u++,j++)if(s=e.charAt(j),void 0!=s)switch(i=t.charAt(u)){case"#":r+=s,a=u
break
case"0":r=s||s==i?r+s:r+0,a=u
break
case".":r+=s==i?s:(j--,i)
break
case",":r+=s==i?s:(j--,i)
break
default:r+=i,j--}return j!=e.length&&"0"!=t.charAt(t.length-1)&&a!=t.length&&"0"!=t.charAt(a)&&(r=r.substr(0,a+1)+e.substr(j)+r.substr(a+1)),r=(n?r:r.split("").reverse().join("")).replace(/(^,)|(,$)|(,,+)/g,""),","==r.substr(0,1)&&(r=r.substr(1)),"-,"==r.substr(0,2)&&(r="-"+r.substr(2)),r}
var t=this.toString()
return 0==t.length?"":void 0==e?this:(e=e.split("."),t=t.split("."),e.length>1?this.fStr(t[0],e[0])+"."+this.fStr(t[1],e[1],1):this.fStr(t[0],e[0]))},function(e){e.fn.fadeInAndOut=function(r,t,n){var a={speed:r,easing:t,fn:n}
e.extend(a,e.fn.fadeInAndOut.defaults),this.fadeIn(a.speed).delay(a.speed).fadeOut(a.speed,a.easing,a.fn)},e.fn.fadeInAndOut.defaults={speed:1e3,easing:"swing",fn:null}}(jQuery)

File diff suppressed because it is too large Load Diff

240
src/tr-web-control/script/system.min.js vendored Normal file
View File

@ -0,0 +1,240 @@
// Current system global object
function pagerFilter(t){"number"==typeof t.length&&"function"==typeof t.splice&&(t={total:t.length,rows:t})
var e=$(this),s=e.datagrid("options"),n=e.datagrid("getPager"),a=e.data("buttons")
n.pagination({onSelectPage:function(a,r){s.pageNumber=a,s.pageSize=r,n.pagination("refresh",{pageNumber:a,pageSize:r}),e.datagrid("loadData",t)},buttons:a}),t.originalRows||(t.originalRows=t.rows)
var r=(s.pageNumber-1)*parseInt(s.pageSize),o=r+parseInt(s.pageSize)
return t.rows=t.originalRows.slice(r,o),t}var system={version:"1.1 Beta",rootPath:"tr-web-control/",codeupdate:"20170317",configHead:"transmission-web-control",config:{autoReload:!0,reloadStep:5e3,pageSize:30,defaultSelectNode:null,autoExpandAttribute:!1,defaultLang:""},storageKeys:{dictionary:{folders:"dictionary.folders"}},dictionary:{folders:null},checkUpdateScript:"https://transmission-control.googlecode.com/svn/resouces/checkupdate.js",contextMenus:{},panel:null,lang:null,reloading:!1,autoReloadTimer:null,downloadDir:"",islocal:!1,B64:new Base64,currentTorrentId:0,control:{tree:null,torrentlist:null},userConfig:{torrentList:{fields:[],sortName:null,sortOrder:"asc"}},serverConfig:null,serverSessionStats:null,templates:{},setlang:function(t,e){t||(t=this.config.defaultLang?this.config.defaultLang:navigator.language||navigator.browserLanguage),t||(t="zh-CN"),t.indexOf("-")!=-1&&(t=t.split("-")[0].toLocaleLowerCase()+"-"+t.split("-")[1].toLocaleUpperCase()),this.languages[t]||(t="en"),$.getScript(system.rootPath+"lang/"+t+".js",function(){system.lang=$.extend(!0,system.defaultLang,system.lang),system.resetLangText(),$.getScript(system.rootPath+"script/easyui/locale/easyui-lang-"+t.replace("-","_")+".js").done(function(t,s){e&&e()}).fail(function(t,s,n){$.getScript(system.rootPath+"script/easyui/locale/easyui-lang-en.js",function(){e&&e()})})})},init:function(t,e,s){this.readConfig(),this.islocal=1==e,this.panel={main:$("#main"),top:$("#m_top"),toolbar:$("#m_toolbar"),left_layout:$("#m_left_layout"),left:$("#m_left"),body:$("#m_body"),layout_body:$("#layout_body"),list:$("#m_list"),attribute:$("#m_attribute"),bottom:$("#m_bottom"),title:$("#m_title"),status:$("#m_status"),statusbar:$("#m_statusbar"),status_text:$("#status_text"),droparea:$("#dropArea")},null==this.lang?this.setlang(t,function(){system.initdata()}):this.initdata()},resetLangText:function(parent){parent||(parent=$)
var items=parent.find("*[system-lang]")
$.each(items,function(key,item){var name=$(item).attr("system-lang")
"["==name.substr(0,1)?$(item).html(eval("system.lang"+name)):$(item).html(eval("system.lang."+name))}),items=parent.find("*[system-tip-lang]"),$.each(items,function(key,item){var name=$(item).attr("system-tip-lang")
"["==name.substr(0,1)?$(item).attr("title",eval("system.lang"+name)):$(item).attr("title",eval("system.lang."+name))})},initdata:function(){$(document).attr("title",this.lang.system.title+" "+this.version)
var t=new Array,e="<span>"+this.lang.title.left+"</span>"
t.push("<span class='tree-title-toolbar'>")
for(var s in this.lang.tree.toolbar.nav){var n=this.lang.tree.toolbar.nav[s]
t.push('<a href="javascript:void(0);" id="tree-toolbar-nav-'+s+'" class="easyui-linkbutton" data-options="plain:true,iconCls:\'icon-disabled\'" onclick="javascript:system.navToolbarClick(this);">'+n+"</a>")}if(t.push("</span>"),t.length>1){e+=t.join(""),this.panel.left_layout.panel("setTitle",e)
for(var s in this.lang.tree.toolbar.nav)$("#tree-toolbar-nav-"+s).linkbutton()}else this.panel.left_layout.panel("setTitle",e)
e="<span>"+this.lang.title.list+"</span>",t.length=0,t.push("<span class='tree-title-toolbar'>")
for(var s in this.lang["torrent-head"].buttons){var n=this.lang["torrent-head"].buttons[s]
t.push('<a href="javascript:void(0);" id="torrent-head-buttons-'+s+'" class="easyui-linkbutton" data-options="plain:true,iconCls:\'icon-disabled\'" onclick="javascript:system.navToolbarClick(this);">'+n+"</a>")}if(t.push("</span>"),t.length>1){e+=t.join(""),this.panel.body.panel("setTitle",e)
for(var s in this.lang["torrent-head"].buttons)switch($("#torrent-head-buttons-"+s).linkbutton(),s){case"autoExpandAttribute":system.config.autoExpandAttribute?$("#torrent-head-buttons-"+s).linkbutton({iconCls:"icon-enabled"}).data("status",1):$("#torrent-head-buttons-"+s).linkbutton({iconCls:"icon-disabled"}).data("status",0)}}else this.panel.body.panel("setTitle",e)
this.panel.status.panel("setTitle",this.lang.title.status),this.panel.attribute.panel({title:this.lang.title.attribute,onExpand:function(){0!=system.currentTorrentId&&$(this).data("isload")?system.getTorrentInfos(system.currentTorrentId):system.clearTorrentAttribute()},onLoad:function(){$(this).data("isload")||($(this).data("isload",!0),0!=system.currentTorrentId&&setTimeout(function(){system.getTorrentInfos(system.currentTorrentId)},500))}}),$.each(this.languages,function(t,e){$("<option/>").text(e).val(t).attr("selected",t==system.lang.name).appendTo(system.panel.top.find("#lang"))}),this.panel.top.find("#lang").change(function(){location.href="?lang="+this.value}),this.panel.toolbar.attr("class","panel-header"),this.initTree(),this.initToolbar(),this.initStatusBar(),this.initTorrentTable(),this.connect(),this.initEvent()},initEvent:function(){$(window).resize(function(){$("#main").layout("resize")}),this.panel.droparea[0].addEventListener("dragover",function(t){t.stopPropagation(),t.preventDefault(),system.debug("#dropArea.dragover")},!1),this.panel.list[0].addEventListener("dragover",function(t){t.stopPropagation(),t.preventDefault(),system.panel.droparea.show(),system.debug("dragover")},!1),this.panel.droparea[0].addEventListener("drop",function(t){t.stopPropagation(),t.preventDefault(),system.panel.droparea.hide(),system.debug("drop.e.dataTransfer:",t.dataTransfer),system.checkDropFiles(t.dataTransfer.files)},!1),this.panel.droparea[0].addEventListener("dragleave",function(t){t.stopPropagation(),t.preventDefault(),system.panel.droparea.hide(),system.debug("dragleave")},!1),$("#text-drop-title").html(this.lang.public["text-drop-title"])},navToolbarClick:function(t){var e=t.id,s=$(t).data("status"),n=null
switch(e){case"tree-toolbar-nav-folders":n=this.panel.left.tree("find","folders")
break
case"tree-toolbar-nav-statistics":n=this.panel.left.tree("find","statistics")
break
case"torrent-head-buttons-autoExpandAttribute":n={},n.target=null,1==s?this.config.autoExpandAttribute=!1:this.config.autoExpandAttribute=!0}n&&(1==s?($(t).linkbutton({iconCls:"icon-disabled"}),$(n.target).parent().hide(),s=0):($(t).linkbutton({iconCls:"icon-enabled"}),$(n.target).parent().show(),s=1),$(t).data("status",s),this.saveConfig())},checkDropFiles:function(t){if(t&&t.length){for(var e=new Array,s=0;s<t.length;s++){var n=t[s]
"torrent"==n.name.split(".").pop().toLowerCase()&&e.push(n)}e.length>0&&system.openDialogFromTemplate({id:"dialog-torrent-addfile",options:{title:system.lang.toolbar["add-torrent"],width:620,height:300,resizable:!0},datas:{files:e}})}},initTree:function(){this.panel.left.tree({data:[{id:"torrent-all",iconCls:"icon-home",text:this.lang.tree.all+" ("+this.lang.tree.status.loading+")",children:[{id:"downloading",text:this.lang.tree.downloading,iconCls:"icon-download"},{id:"paused",text:this.lang.tree.paused,iconCls:"icon-pause"},{id:"sending",text:this.lang.tree.sending,iconCls:"icon-seed"},{id:"check",text:this.lang.tree.check,iconCls:"icon-check"},{id:"actively",text:this.lang.tree.actively,iconCls:"icon-actively"},{id:"error",text:this.lang.tree.error,iconCls:"icon-error"},{id:"warning",text:this.lang.tree.warning,iconCls:"icon-warning"}]},{id:"servers",text:this.lang.tree.servers,state:"closed",iconCls:"icon-servers",children:[{id:"servers-loading",text:this.lang.tree.status.loading,iconCls:"tree-loading"}]},{id:"folders",text:this.lang.tree.folders,children:[{id:"folders-loading",text:this.lang.tree.status.loading,iconCls:"tree-loading"}]},{id:"statistics",text:this.lang.tree.statistics.title,state:"closed",iconCls:"icon-chart",children:[{id:"cumulative-stats",text:this.lang.tree.statistics.cumulative,children:[{id:"uploadedBytes",text:this.lang.tree.statistics.uploadedBytes},{id:"downloadedBytes",text:this.lang.tree.statistics.downloadedBytes},{id:"filesAdded",text:this.lang.tree.statistics.filesAdded},{id:"sessionCount",text:this.lang.tree.statistics.sessionCount},{id:"secondsActive",text:this.lang.tree.statistics.secondsActive}]},{id:"current-stats",text:this.lang.tree.statistics.current,children:[{id:"current-uploadedBytes",text:this.lang.tree.statistics.uploadedBytes},{id:"current-downloadedBytes",text:this.lang.tree.statistics.downloadedBytes},{id:"current-filesAdded",text:this.lang.tree.statistics.filesAdded},{id:"current-sessionCount",text:this.lang.tree.statistics.sessionCount},{id:"current-secondsActive",text:this.lang.tree.statistics.secondsActive}]}]}],onSelect:function(t){system.loadTorrentToList({node:t})},lines:!0})
for(var t in this.lang.tree.toolbar.nav){var e=this.panel.left.tree("find",t)
$(e.target).parent().hide()}if(this.config.defaultSelectNode){var s=this.panel.left.tree("find",this.config.defaultSelectNode)
s&&this.panel.left.tree("select",s.target)}},initTorrentTable:function(){function t(){e&&$(e).remove(),e=$("<div/>").appendTo("body"),e.menu({onClick:function(t){"icon-ok"==t.iconCls?(system.control.torrentlist.datagrid("hideColumn",t.name),e.menu("setIcon",{target:t.target,iconCls:"icon-empty"})):(system.control.torrentlist.datagrid("showColumn",t.name),e.menu("setIcon",{target:t.target,iconCls:"icon-ok"})),system.resetTorrentListFieldsUserConfig(system.control.torrentlist.datagrid("options").columns[0]),system.saveUserConfig()}})
for(var t=system.control.torrentlist.datagrid("getColumnFields"),s=0;s<t.length;s++){var n=t[s],a=system.control.torrentlist.datagrid("getColumnOption",n)
0!=a.allowCustom&&"false"!=a.allowCustom&&e.menu("appendItem",{text:a.title,name:n,iconCls:a.hidden?"icon-empty":"icon-ok"})}}this.control.torrentlist=$("<table/>").attr("class","torrent-list").appendTo(this.panel.list)
var e=null,s=-1
$.get(system.rootPath+"template/torrent-fields.json?time="+new Date,function(n){var a=n.fields
0!=system.userConfig.torrentList.fields.length&&(a=system.userConfig.torrentList.fields)
var r=JSON.stringify(a)
system.userConfig.torrentList.fields=JSON.parse(r)
for(var o in a)a[o].title=system.lang.torrent.fields[a[o].field]||a[o].field,system.setFieldFormat(a[o])
system.control.torrentlist.datagrid({autoRowHeight:!1,pagination:!0,rownumbers:!0,remoteSort:!1,checkOnSelect:!1,pageSize:system.config.pageSize,idField:"id",fit:!0,striped:!0,sortName:system.userConfig.torrentList.sortName,sortOrder:system.userConfig.torrentList.sortOrder,drophead:!0,columns:[a],onCheck:function(t,e){system.checkTorrentRow(t,e)},onUncheck:function(t,e){system.checkTorrentRow(t,e)},onCheckAll:function(t){system.checkTorrentRow("all",!1)},onUncheckAll:function(t){system.checkTorrentRow("all",!0)},onSelect:function(t,e){s!=-1&&system.control.torrentlist.datagrid("unselectRow",s),system.config.autoExpandAttribute&&system.panel.attribute.panel("options").collapsed&&system.panel.layout_body.layout("expand","south"),system.getTorrentInfos(e.id),s=t},onUnselect:function(t,e){system.config.autoExpandAttribute&&(system.panel.attribute.panel("options").collapsed||system.panel.layout_body.layout("collapse","south")),system.currentTorrentId=0,s=-1},onBeforeLoad:function(t){system.currentTorrentId=0},onSortColumn:function(t,e){var s=t
"remainingTime"==t&&(s="remainingTimeRaw")
var n=system.control.torrentlist.datagrid("getData").originalRows.sort(arrayObjectSort(s,e))
system.control.torrentlist.datagrid("loadData",n),system.resetTorrentListFieldsUserConfig(system.control.torrentlist.datagrid("options").columns[0]),system.userConfig.torrentList.sortName=t,system.userConfig.torrentList.sortOrder=e,system.saveUserConfig()},onRowContextMenu:function(t,e,s){system.control.torrentlist.datagrid("uncheckAll"),system.control.torrentlist.datagrid("checkRow",e),t.preventDefault(),system.showContextMenu("torrent-list",t)},onHeadDrop:function(t,e){system.resetTorrentListFieldsUserConfig(system.control.torrentlist.datagrid("options").columns[0]),system.saveUserConfig()},onResizeColumn:function(t,e){system.resetTorrentListFieldsUserConfig(system.control.torrentlist.datagrid("options").columns[0]),system.saveUserConfig()},onHeaderContextMenu:function(s,n){s.preventDefault(),e||t(),e.menu("show",{left:s.pageX,top:s.pageY})}})},"json")},resetTorrentListFieldsUserConfig:function(t){var e={}
$.each(this.userConfig.torrentList.fields,function(t,s){e[s.field]=s}),this.userConfig.torrentList.fields=[],$.each(t,function(t,s){var n=$.extend({},e[s.field])
n.width=s.width,n.hidden=s.hidden,system.userConfig.torrentList.fields.push(n)})},showContextMenu:function(t,e){var s=this.contextMenus[t]
s?s.empty():(s=$("<div/>").attr("class","easyui-menu").css({width:"180px"}).appendTo(this.panel.main),this.contextMenus[t]=s,s.menu())
var n=null
switch(t){case"torrent-list":n=new Array("start","pause","-","rename","remove","recheck","-","morepeers","changeDownloadDir","-","menu-queue-move-top","menu-queue-move-up","menu-queue-move-down","menu-queue-move-bottom")
var a=this.panel.toolbar
for(var r in n){var o=n[r]
if("-"==o)$("<div class='menu-sep'></div>").appendTo(s)
else{var i=a.find("#toolbar_"+o)
i.length>0?s.menu("appendItem",{text:i.attr("title"),id:o,iconCls:i.linkbutton("options").iconCls,disabled:i.linkbutton("options").disabled,onclick:function(){system.panel.toolbar.find("#toolbar_"+$(this).attr("id")).click()}}):(i=$("#"+o),i.length>0&&s.menu("appendItem",{text:i.attr("title"),id:o,iconCls:i.attr("id").replace("menu","icon"),disabled:a.find("#toolbar_changeDownloadDir").linkbutton("options").disabled,onclick:function(){$("#"+$(this).attr("id")).click()}})),i=null}}}s.menu("show",{left:e.pageX,top:e.pageY}),s=null,n=null},checkTorrentRow:function(t,e){this.panel.toolbar.find("#toolbar_start").linkbutton({disabled:!1}),this.panel.toolbar.find("#toolbar_pause").linkbutton({disabled:!1}),this.panel.toolbar.find("#toolbar_rename").linkbutton({disabled:!1}),this.panel.toolbar.find("#toolbar_remove").linkbutton({disabled:!1}),this.panel.toolbar.find("#toolbar_recheck").linkbutton({disabled:!1}),this.panel.toolbar.find("#toolbar_changeDownloadDir").linkbutton({disabled:!1}),this.panel.toolbar.find("#toolbar_morepeers").linkbutton({disabled:!1}),this.panel.toolbar.find("#toolbar_queue").menubutton("enable")},initToolbar:function(){this.panel.toolbar.find("#toolbar_label_reload_time").html(this.lang.toolbar["reload-time"]),this.panel.toolbar.find("#toolbar_label_reload_time_unit").html(this.lang.toolbar["reload-time-unit"]),this.panel.toolbar.find("#toolbar_reload_time").numberspinner({value:this.config.reloadStep/1e3,min:3,disabled:!this.config.autoReload,onChange:function(){var t=this.value
$.isNumeric(t)&&(system.config.reloadStep=1e3*t,system.saveConfig())}}),this.panel.toolbar.find("#toolbar_autoreload").linkbutton({text:this.config.autoReload?this.lang.toolbar["autoreload-enabled"]:this.lang.toolbar["autoreload-disabled"],iconCls:this.config.autoReload?"icon-enabled":"icon-disabled"}).attr("title",this.config.autoReload?this.lang.toolbar.tip["autoreload-disabled"]:this.lang.toolbar.tip["autoreload-enabled"]).click(function(){system.config.autoReload?(system.config.autoReload=!1,clearTimeout(system.autoReloadTimer),system.panel.toolbar.find("#toolbar_reload_time").numberspinner("disable")):(system.config.autoReload=!0,system.reloadData(),system.panel.toolbar.find("#toolbar_reload_time").numberspinner("enable")),system.saveConfig(),$(this).linkbutton({text:system.config.autoReload?system.lang.toolbar["autoreload-enabled"]:system.lang.toolbar["autoreload-disabled"],iconCls:system.config.autoReload?"icon-enabled":"icon-disabled"}).attr("title",system.config.autoReload?system.lang.toolbar.tip["autoreload-disabled"]:system.lang.toolbar.tip["autoreload-enabled"])}),this.panel.toolbar.find("#toolbar_add_torrents").linkbutton({text:this.lang.toolbar["add-torrent"],disabled:!1}).attr("title",this.lang.toolbar.tip["add-torrent"]).click(function(){system.openDialogFromTemplate({id:"dialog-torrent-add",options:{title:system.lang.toolbar["add-torrent"],width:620,height:400,resizable:!0}})}),this.panel.toolbar.find("#toolbar_start_all").linkbutton({disabled:!1}).attr("title",this.lang.toolbar.tip["start-all"]).click(function(){var t=$(this),e=t.linkbutton("options").iconCls
t.linkbutton({disabled:!0,iconCls:"icon-loading"}),transmission.exec({method:"torrent-start"},function(s){t.linkbutton({iconCls:e,disabled:!1}),t=null})}),this.panel.toolbar.find("#toolbar_pause_all").linkbutton({disabled:!1}).attr("title",this.lang.toolbar.tip["pause-all"]).click(function(){var t=$(this),e=t.linkbutton("options").iconCls
t.linkbutton({disabled:!0,iconCls:"icon-loading"}),transmission.exec({method:"torrent-stop"},function(s){t.linkbutton({iconCls:e,disabled:!1}),t=null})}),this.panel.toolbar.find("#toolbar_start").linkbutton({disabled:!0}).attr("title",this.lang.toolbar.tip.start).click(function(){system.changeSelectedTorrentStatus("start",$(this))}),this.panel.toolbar.find("#toolbar_pause").linkbutton({disabled:!0}).attr("title",this.lang.toolbar.tip.pause).click(function(){system.changeSelectedTorrentStatus("stop",$(this))}),this.panel.toolbar.find("#toolbar_recheck").linkbutton({disabled:!0}).attr("title",this.lang.toolbar.tip.recheck).click(function(){var t=system.control.torrentlist.datagrid("getChecked")
if(t.length>0)if(1==t.length){var e=transmission.torrents.all[t[0].id]
e.percentDone>0?confirm(system.lang.toolbar.tip["recheck-confirm"])&&system.changeSelectedTorrentStatus("verify",$(this)):system.changeSelectedTorrentStatus("verify",$(this))}else confirm(system.lang.toolbar.tip["recheck-confirm"])&&system.changeSelectedTorrentStatus("verify",$(this))}),this.panel.toolbar.find("#toolbar_morepeers").linkbutton({disabled:!0}).click(function(){system.changeSelectedTorrentStatus("reannounce",$(this))}),this.panel.toolbar.find("#toolbar_remove").linkbutton({disabled:!0}).attr("title",this.lang.toolbar.tip.remove).click(function(){var t=system.control.torrentlist.datagrid("getChecked"),e=new Array
for(var s in t)e.push(t[s].id)
0!=e.length&&system.openDialogFromTemplate({id:"dialog-torrent-remove-confirm",options:{title:system.lang.dialog["torrent-remove"].title,width:350,height:150},datas:{ids:e}})}),this.panel.toolbar.find("#toolbar_rename").linkbutton({disabled:!0}).click(function(){var t=system.control.torrentlist.datagrid("getChecked")
0!=t.length&&system.openDialogFromTemplate({id:"dialog-torrent-rename",options:{title:system.lang.dialog["torrent-rename"].title,width:450,height:150,resizable:!0},datas:{id:t[0].id}})}),this.panel.toolbar.find("#toolbar_changeDownloadDir").linkbutton({disabled:!0}).attr("title",this.lang.toolbar.tip["change-download-dir"]).click(function(){var t=system.control.torrentlist.datagrid("getChecked"),e=new Array
for(var s in t)e.push(t[s].id)
0!=e.length&&system.openDialogFromTemplate({id:"dialog-torrent-changeDownloadDir",options:{title:system.lang.dialog["torrent-changeDownloadDir"].title,width:520,height:200},datas:{ids:e}})}),this.panel.toolbar.find("#toolbar_alt_speed").linkbutton().attr("title",this.lang.toolbar.tip["alt-speed"]).click(function(){var t=$(this),e=t.linkbutton("options"),s=!1
"icon-alt-speed-false"==e.iconCls&&(s=!0),transmission.exec({method:"session-set",arguments:{"alt-speed-enabled":s}},function(e){"success"==e.result&&(system.serverConfig["alt-speed-enabled"]=s,t.linkbutton({iconCls:"icon-alt-speed-"+s.toString()}),s?$("#status_alt_speed").show():$("#status_alt_speed").hide())}),t.linkbutton({iconCls:"icon-loading"})}),this.panel.toolbar.find("#toolbar_config").linkbutton().attr("title",this.lang.toolbar.tip["system-config"]).click(function(){system.openDialogFromTemplate({id:"dialog-system-config",options:{title:system.lang.toolbar["system-config"],width:620,height:440,resizable:!0}})}),this.panel.toolbar.find("#toolbar_reload").linkbutton().attr("title",this.lang.toolbar.tip["system-reload"]).click(function(){system.reloadData()}),this.panel.toolbar.find("#toolbar_search").searchbox({searcher:function(t){system.searchTorrents(t)},prompt:this.lang.toolbar["search-prompt"]})},initStatusBar:function(){this.panel.statusbar.find("#status_title_downloadspeed").html(this.lang.statusbar.downloadspeed),this.panel.statusbar.find("#status_title_uploadspeed").html(this.lang.statusbar.uploadspeed)},connect:function(){this.showStatus(this.lang.system.status.connect,0),transmission.on.torrentCountChange=function(){system.reloadTorrentBaseInfos()},transmission.on.postError=function(){},transmission.init({islocal:!0},function(){system.reloadSession(!0),system.getServerStatus()})},reloadSession:function(t){transmission.getSession(function(e){system.serverConfig=e,$("#status_version").html("Transmission "+system.lang.statusbar.version+e.version+", RPC: "+e["rpc-version"]+", WEB Control: "+system.version+"("+system.codeupdate+")"),1==e["alt-speed-enabled"]?(system.panel.toolbar.find("#toolbar_alt_speed").linkbutton({iconCls:"icon-alt-speed-true"}),$("#status_alt_speed").show()):(system.panel.toolbar.find("#toolbar_alt_speed").linkbutton({iconCls:"icon-alt-speed-false"}),$("#status_alt_speed").hide()),system.downloadDir=e["download-dir"],transmission.downloadDirs.push(system.downloadDir),parseInt(system.serverConfig["rpc-version"])>=15?transmission.getFreeSpace(system.downloadDir,function(t){system.serverConfig["download-dir-free-space"]=t.arguments["size-bytes"],system.showFreeSpace(t.arguments["size-bytes"])}):system.showFreeSpace(system.serverConfig["download-dir-free-space"]),t&&system.showStatus(system.lang.system.status.connected)})},showFreeSpace:function(t){var e=t
e=e==-1?system.lang.public["text-unknown"]:formatSize(e),$("#status_freespace").text(system.lang.dialog["system-config"]["download-dir-free-space"]+" "+e)},reloadTorrentBaseInfos:function(t,e){if(!this.reloading){clearTimeout(this.autoReloadTimer),this.reloading=!0
var s={trackers:transmission.trackers,folders:transmission.torrents.folders}
transmission.torrents.getallids(function(t){var e=new Array
for(var n in t){var a=t[n]
e.push(a.id)}var r=transmission.torrents.getErrorIds(e,!0)
r.length>0?transmission.torrents.getallids(function(){system.resetTorrentInfos(s)},r):system.resetTorrentInfos(s)},t,e)}},resetTorrentInfos:function(t){var e=this.currentTorrentId,s=this.panel.left.tree("find","servers")
if(s){var n=s.state
this.removeTreeNode("servers-loading")}else this.appendTreeNode(null,[{id:"servers",text:this.lang.tree.servers,state:"closed",iconCls:"icon-servers"}]),s=this.panel.left.tree("find","servers")
new Array
for(var a in transmission.trackers){var r=transmission.trackers[a],o=system.panel.left.tree("find",r.nodeid),i=r.name+this.showNodeMoreInfos(r.count,r.size)
o?system.updateTreeNodeText(r.nodeid,i,r.connected?"icon-server":"icon-server-error"):system.appendTreeNode(s,[{id:r.nodeid,text:i,iconCls:r.connected?"icon-server":"icon-server-error"}]),t.trackers[r.nodeid]=null}"closed"==n&&this.panel.left.tree("collapse",s.target)
for(var a in t.trackers){var r=t.trackers[a]
r&&system.removeTreeNode(r.nodeid)}if(transmission.torrents.status[transmission._status.stopped]?system.updateTreeNodeText("paused",system.lang.tree.paused+this.showNodeMoreInfos(transmission.torrents.status[transmission._status.stopped].length)):system.updateTreeNodeText("paused",system.lang.tree.paused),transmission.torrents.status[transmission._status.seed]?system.updateTreeNodeText("sending",system.lang.tree.sending+this.showNodeMoreInfos(transmission.torrents.status[transmission._status.seed].length)):system.updateTreeNodeText("sending",system.lang.tree.sending),transmission.torrents.status[transmission._status.seedwait]){var o=system.panel.left.tree("find","sending"),l=system.panel.left.tree("getChildren",o.target),i=system.lang.tree.wait+this.showNodeMoreInfos(transmission.torrents.status[transmission._status.seedwait].length)
l.length>0?system.updateTreeNodeText(l[0].id,i):system.appendTreeNode(o,[{id:"seedwait",text:i,iconCls:"icon-wait"}])}else system.removeTreeNode("seedwait")
if(transmission.torrents.status[transmission._status.check]?system.updateTreeNodeText("check",system.lang.tree.check+this.showNodeMoreInfos(transmission.torrents.status[transmission._status.check].length)):system.updateTreeNodeText("check",system.lang.tree.check),transmission.torrents.status[transmission._status.checkwait]){var o=system.panel.left.tree("find","check"),l=system.panel.left.tree("getChildren",o.target),i=system.lang.tree.wait+this.showNodeMoreInfos(transmission.torrents.status[transmission._status.checkwait].length)
l.length>0?system.updateTreeNodeText(l[0].id,i):system.appendTreeNode(o,[{id:"checkwait",text:i,iconCls:"icon-wait"}])}else system.removeTreeNode("checkwait")
if(transmission.torrents.status[transmission._status.download]?system.updateTreeNodeText("downloading",system.lang.tree.downloading+this.showNodeMoreInfos(transmission.torrents.status[transmission._status.download].length)):system.updateTreeNodeText("downloading",system.lang.tree.downloading),transmission.torrents.status[transmission._status.downloadwait]){var o=system.panel.left.tree("find","downloading"),l=system.panel.left.tree("getChildren",o.target),i=system.lang.tree.wait+this.showNodeMoreInfos(transmission.torrents.status[transmission._status.downloadwait].length)
l.length>0?system.updateTreeNodeText(l[0].id,i):system.appendTreeNode(o,[{id:"downloadwait",text:i,iconCls:"icon-wait"}])}else system.removeTreeNode("downloadwait")
system.updateTreeNodeText("actively",system.lang.tree.actively+this.showNodeMoreInfos(transmission.torrents.actively.length)),system.updateTreeNodeText("error",system.lang.tree.error+this.showNodeMoreInfos(transmission.torrents.error.length)),system.updateTreeNodeText("warning",system.lang.tree.warning+this.showNodeMoreInfos(transmission.torrents.warning.length))
var o=system.panel.left.tree("getSelected")
if(null!=o){var d=system.control.torrentlist.datagrid("options").pageNumber
system.loadTorrentToList({node:o,page:d})}0!=e&&system.control.torrentlist.datagrid("selectRecord",e),system.reloading=!1,system.config.autoReload&&(system.autoReloadTimer=setTimeout(function(){system.reloadData()},system.config.reloadStep)),system.updateTreeNodeText("torrent-all",system.lang.tree.all+this.showNodeMoreInfos(transmission.torrents.count,transmission.torrents.totalSize))
var c="uploadedBytes,downloadedBytes,filesAdded,sessionCount,secondsActive".split(",")
$.each(c,function(t,e){switch(e){case"uploadedBytes":case"downloadedBytes":system.updateTreeNodeText(e,system.lang.tree.statistics[e]+formatSize(system.serverSessionStats["cumulative-stats"][e])),system.updateTreeNodeText("current-"+e,system.lang.tree.statistics[e]+formatSize(system.serverSessionStats["current-stats"][e]))
break
case"secondsActive":system.updateTreeNodeText(e,system.lang.tree.statistics[e]+getTotalTime(1e3*system.serverSessionStats["cumulative-stats"][e])),system.updateTreeNodeText("current-"+e,system.lang.tree.statistics[e]+getTotalTime(1e3*system.serverSessionStats["current-stats"][e]))
break
default:system.updateTreeNodeText(e,system.lang.tree.statistics[e]+system.serverSessionStats["cumulative-stats"][e]),system.updateTreeNodeText("current-"+e,system.lang.tree.statistics[e]+system.serverSessionStats["current-stats"][e])}})
for(var a in transmission.torrents.folders){var u=transmission.torrents.folders[a]
t.folders[u.nodeid]=null}this.loadFolderList(t.folders),navigator.userAgent.indexOf("Firefox")>0&&system.panel.left.find("span.nav-total-size").css({"margin-top":"-19px"})},showNodeMoreInfos:function(t,e){var s=""
return t>0&&(s=" <span class='nav-torrents-number'>("+t+")</span>"),e>0&&(s+="<span class='nav-total-size'>["+formatSize(e)+"]</span>"),s},getServerStatus:function(){this.reloading||(clearTimeout(this.autoReloadTimer),this.reloading=!0,transmission.getStatus(function(t){if(system.reloading=!1,$("#status_downloadspeed").html(formatSize(t.downloadSpeed,!1,"speed")),$("#status_uploadspeed").html(formatSize(t.uploadSpeed,!1,"speed")),system.serverSessionStats=t,0==t.torrentCount){var e=system.panel.left.tree("find","servers")
e&&system.panel.left.tree("remove",e.target),system.updateTreeNodeText("torrent-all",system.lang.tree.all)}}))},showStatus:function(t,e){$("#m_status").panel("options").collapsed&&$("#layout_left").layout("expand","south"),this.panel.status_text.show(),this.panel.status_text.html(t),0!=e&&(void 0==e&&(e=3e3),this.panel.status_text.fadeOut(e,function(){$("#layout_left").layout("collapse","south")}))},updateTreeNodeText:function(t,e,s){var n=this.panel.left.tree("find",t)
if(n){var a={target:n.target,text:e}
void 0!=s&&(a.iconCls=s),this.panel.left.tree("update",a)}n=null},appendTreeNode:function(t,e){var s=null
s="string"==typeof t?this.panel.left.tree("find",t):t,s?this.panel.left.tree("append",{parent:s.target,data:e}):this.panel.left.tree("append",{data:e}),s=null},removeTreeNode:function(t){var e=this.panel.left.tree("find",t)
e&&this.panel.left.tree("remove",e.target),e=null},loadTorrentToList:function(t){if(transmission.torrents.all){var e={node:null,page:1}
if(jQuery.extend(e,t),t.node){var s=null,n=this.panel.left.tree("getParent",t.node.target)||{id:""},a=this.panel.left.data("currentNodeId")
switch(a!=t.node.id&&(this.control.torrentlist.datagrid({pageNumber:1}),a=t.node.id),this.panel.left.data("currentNodeId",a),n.id){case"servers":s=transmission.trackers[t.node.id].torrents
break
default:switch(t.node.id){case"torrent-all":case"servers":s=transmission.torrents.all
break
case"paused":s=transmission.torrents.status[transmission._status.stopped]
break
case"sending":s=transmission.torrents.status[transmission._status.seed]
break
case"seedwait":s=transmission.torrents.status[transmission._status.seedwait]
break
case"check":s=transmission.torrents.status[transmission._status.check]
break
case"checkwait":s=transmission.torrents.status[transmission._status.checkwait]
break
case"downloading":s=transmission.torrents.status[transmission._status.download]
break
case"downloadwait":s=transmission.torrents.status[transmission._status.downloadwait]
break
case"actively":s=transmission.torrents.actively
break
case"error":s=transmission.torrents.error
break
case"warning":s=transmission.torrents.warning
break
case"search-result":s=transmission.torrents.searchResult
break
default:if(t.node.id.indexOf("folders-")!=-1){var r=transmission.torrents.folders[t.node.id]
r&&(s=r.torrents)}}}this.config.defaultSelectNode!=t.node.id&&(this.control.torrentlist.datagrid("loadData",[]),this.config.defaultSelectNode=t.node.id,this.saveConfig())
var o=new Array
for(var i in s){if(!s[i])return
var l=this.lang.torrent["status-text"][s[i].status],d=parseFloat(100*s[i].percentDone).toFixed(2)
l==transmission._status.check&&(d=parseFloat(100*s[i].recheckProgress).toFixed(2)),0!=s[i].error?l="<span class='text-status-error'>"+l+"</span>":s[i].warning&&(l="<span class='text-status-warning' title='"+s[i].warning+"'>"+l+"</span>")
var c={}
c=$.extend(c,s[i]),c.status=l,c.statusCode=s[i].status,c.completeSize=Math.max(0,s[i].totalSize-s[i].leftUntilDone),c.leecherCount=s[i].leecher,c.seederCount=s[i].seeder,o.push(c)}this.updateTorrentCurrentPageDatas(o)}}},updateTorrentCurrentPageDatas:function(t){var e=this.control.torrentlist.datagrid("getRows")
if(0==t.length&&e.length>0)return void this.control.torrentlist.datagrid("loadData",[])
var s=this.control.torrentlist.datagrid("options"),n=null
if(s.sortName){n=s.sortName
var a=n
"remainingTime"==n&&(a="remainingTimeRaw"),t=t.sort(arrayObjectSort(a,s.sortOrder))}if(0==e.length||t.length!=this.control.torrentlist.datagrid("getData").total&&t.length>s.pageSize)return void this.control.torrentlist.datagrid({loadFilter:pagerFilter,pageNumber:s.pageNumber,sortName:n,sortOrder:s.sortOrder}).datagrid("loadData",t)
this.control.torrentlist.datagrid("getData").originalRows=t
var r=(s.pageNumber-1)*parseInt(s.pageSize),o=r+parseInt(s.pageSize)
t=t.slice(r,o)
var i={},l={}
for(var d in transmission.torrents.recently){var c=transmission.torrents.recently[d]
i[c.id]=!0,c=null}for(var d in t){var c=t[d]
l[c.id]=c,c=null}for(var u={},d=e.length-1;d>=0;d--){var c=e[d],m=l[c.id]
m?i[c.id]?(this.control.torrentlist.datagrid("updateRow",{index:d,row:m}),u[c.id]=c):transmission.torrents.removed&&transmission.torrents.removed.length>0&&$.inArray(c.id,transmission.torrents.removed)!=-1?this.control.torrentlist.datagrid("deleteRow",d):u[c.id]=c:this.control.torrentlist.datagrid("deleteRow",d),c=null,m=null}for(var d in t){var c=t[d]
u[c.id]||this.control.torrentlist.datagrid("appendRow",c)}e=null,i=null,l=null},getTorrentNameBar:function(t){var e="",s=t.name
switch(t.status){case transmission._status.stopped:e="iconlabel icon-pause-small"
break
case transmission._status.check:e="iconlabel icon-checking"
break
case transmission._status.download:e="iconlabel icon-down"
break
case transmission._status.seed:e="iconlabel icon-up"
break
case transmission._status.seedwait:case transmission._status.downloadwait:case transmission._status.checkwait:e="iconlabel icon-wait"}return s+="\n"+t.downloadDir,t.warning&&(e="iconlabel icon-warning-type1",s+="\n\n"+this.lang.public["text-info"]+": "+t.warning),0!=t.error&&(e="iconlabel icon-exclamation",s+="\n\n"+this.lang.public["text-info"]+": "+t.errorString),'<span class="'+e+'" title="'+s+'">'+t.name+"</span>"},getTorrentProgressBar:function(t,e){t+="%"
var s="",n=0
switch(n="object"==typeof e?e.status:e){case transmission._status.stopped:s="torrent-progress-stop"
break
case transmission._status.checkwait:case transmission._status.check:s="torrent-progress-check"
break
case transmission._status.downloadwait:case transmission._status.download:s="torrent-progress-download"
break
case transmission._status.seedwait:case transmission._status.seed:s="torrent-progress-seed"}return"object"==typeof e&&(e.warning&&(s="torrent-progress-warning"),0!=e.error&&(s="torrent-progress-error")),'<div class="torrent-progress" title="'+t+'"><div class="torrent-progress-text">'+t+'</div><div class="torrent-progress-bar '+s+'" style="width:'+t+';"></div></div>'},addTorrentsToServer:function(t,e,s,n){var a=e-t.length,r=t.shift()
return r?(this.showStatus(this.lang.system.status.queue+(a+1)+"/"+e+"<br/>"+r,0),void transmission.addTorrentFromUrl(r,n,s,function(a){system.addTorrentsToServer(t,e,s,n)})):(this.showStatus(this.lang.system.status.queuefinish),void this.getServerStatus())},changeSelectedTorrentStatus:function(t,e,s){var n=this.control.torrentlist.datagrid("getChecked"),a=new Array
t||(t="start")
for(var r in n)a.push(n[r].id)
if(s||(s="torrent-"+t),a.length>0){if(e){var o=e.linkbutton("options").iconCls
e.linkbutton({disabled:!0,iconCls:"icon-loading"})}transmission.exec({method:s,arguments:{ids:a}},function(t){e&&e.linkbutton({iconCls:o}),system.control.torrentlist.datagrid("uncheckAll"),system.reloadTorrentBaseInfos()})}},searchTorrents:function(t){if(""!=t){var e=transmission.torrents.search(t)
if(null==e||0==e.length)return void this.removeTreeNode("search-result")
var s=this.panel.left.tree("find","search-result"),n=this.lang.tree["search-result"]+" : "+t+" ("+e.length+")"
null==s?(this.appendTreeNode("torrent-all",[{id:"search-result",text:n,iconCls:"icon-search"}]),s=this.panel.left.tree("find","search-result")):this.panel.left.tree("update",{target:s.target,text:n}),this.panel.left.tree("select",s.target)}},getTorrentInfos:function(t){if(transmission.torrents.all[t]&&!transmission.torrents.all[t].infoIsLoading&&!(this.currentTorrentId>0&&transmission.torrents.all[this.currentTorrentId]&&transmission.torrents.all[this.currentTorrentId].infoIsLoading||(this.currentTorrentId=t,this.panel.attribute.panel("options").collapsed))){var e=transmission.torrents.all[t]
e.infoIsLoading=!0
var s="fileStats,trackerStats,peers,leftUntilDone,status,rateDownload,rateUpload,uploadedEver,uploadRatio,error,errorString"
e.moreInfosTag||(s+=",files,trackers,comment,dateCreated,creator,downloadDir"),transmission.torrents.getMoreInfos(s,t,function(s){if(e.infoIsLoading=!1,null!=s){if(jQuery.extend(e,s[0]),0==system.currentTorrentId||system.currentTorrentId!=t)return void system.clearTorrentAttribute()
e.completeSize=e.totalSize-e.leftUntilDone,e.moreInfosTag=!0,system.fillTorrentBaseInfos(e),system.fillTorrentFileList(e),system.fillTorrentServerList(e),system.fillTorrentPeersList(e),system.fillTorrentConfig(e),transmission.torrents.all[t]=e,transmission.torrents.datas[t]=e}})}},clearTorrentAttribute:function(){system.panel.attribute.find("#torrent-files-table").datagrid("loadData",[]),system.panel.attribute.find("#torrent-servers-table").datagrid("loadData",[]),system.panel.attribute.find("#torrent-peers-table").datagrid("loadData",[]),system.panel.attribute.find("span[id*='torrent-attribute-value']").html("")},updateCurrentPageDatas:function(t,e,s){var n=s.datagrid("getRows"),a=s.datagrid("options"),r=null
if(a.sortName&&(r=a.sortName,e=e.sort(arrayObjectSort(r,a.sortOrder))),0==n.length||e.length!=s.datagrid("getData").total&&e.length>a.pageSize)return void s.datagrid({loadFilter:pagerFilter,pageNumber:1,sortName:r,sortOrder:a.sortOrder}).datagrid("loadData",e)
s.datagrid("getData").originalRows=e
var o=(a.pageNumber-1)*parseInt(a.pageSize),i=o+parseInt(a.pageSize)
e=e.slice(o,i)
var l={}
for(var d in e){var c=e[d]
l[c[t]]=c,c=null}for(var d=n.length-1;d>=0;d--){var c=n[d],u=l[c[t]]
u?s.datagrid("updateRow",{index:d,row:u}):s.datagrid("deleteRow",d),u=null,c=null}},fillTorrentBaseInfos:function(t){$.each(t,function(t,e){switch(t){case"rateDownload":case"rateUpload":e=formatSize(e,!0,"speed")
break
case"totalSize":case"uploadedEver":case"leftUntilDone":case"completeSize":e=formatSize(e)
break
case"addedDate":case"dateCreated":case"doneDate":e=formatLongTime(e)
break
case"status":e=system.lang.torrent["status-text"][e]
break
case"error":0==e?system.panel.attribute.find("#torrent-attribute-tr-error").hide():system.panel.attribute.find("#torrent-attribute-tr-error").show()
break
case"comment":e=system.replaceURI(e)}system.panel.attribute.find("#torrent-attribute-value-"+t).html(e)})},fillTorrentFileList:function(t){var e=t.files,s=t.fileStats,n=new Array,a=t.name.length+1
for(var r in e){var o=e[r],i=s[r],l=parseFloat(i.bytesCompleted/o.length*100).toFixed(2)
n.push({name:o.name==t.name?o.name:o.name.substr(a),index:r,bytesCompleted:i.bytesCompleted,percentDone:system.getTorrentProgressBar(l,transmission._status.download),length:o.length,wanted:system.lang.torrent.attribute.status[i.wanted],priority:'<span class="iconlabel icon-flag-'+i.priority+'">'+system.lang.torrent.attribute.priority[i.priority]+"</span>"})}this.updateCurrentPageDatas("index",n,system.panel.attribute.find("#torrent-files-table"))},fillTorrentServerList:function(t){var e=t.trackers,s=t.trackerStats,n=new Array
for(var a in e){var r=(e[a],s[a]),o={}
for(var i in r)switch(i){case"lastAnnounceTime":case"nextAnnounceTime":o[i]=formatLongTime(r[i])
break
case"lastAnnounceSucceeded":case"lastAnnounceTimedOut":o[i]=system.lang.torrent.attribute.status[r[i]]
break
default:o[i]=r[i]}n.push(o)}transmission.torrents.addTracker(t),this.updateCurrentPageDatas("id",n,system.panel.attribute.find("#torrent-servers-table"))},fillTorrentPeersList:function(t){var e=t.peers,s=new Array
for(var n in e){var a=e[n],r={}
for(var o in a)r[o]=a[o]
var i=parseFloat(100*a.progress).toFixed(2)
r.progress=system.getTorrentProgressBar(i,transmission._status.download),s.push(r)}this.updateCurrentPageDatas("address",s,system.panel.attribute.find("#torrent-peers-table"))},fillTorrentConfig:function(t){4==system.panel.attribute.find("#torrent-attribute-tabs").data("selectedIndex")&&transmission.torrents.getConfig(t.id,function(t){if(null!=t){var e=transmission.torrents.all[system.currentTorrentId]
jQuery.extend(e,t[0]),0!=system.currentTorrentId&&$.each(t[0],function(t,e){var s=!1,n=!1,a=!1
switch(t){case"seedIdleMode":case"seedRatioMode":0==e&&(n=!1,s=!0),a=!0
case"downloadLimited":case"uploadLimited":1!=e&&1!=e||(n=!0),system.panel.attribute.find("input[enabledof='"+t+"']").prop("disabled",!n),a&&system.panel.attribute.find("#"+t).prop("indeterminate",s).data("_tag",e),system.panel.attribute.find("#"+t).prop("checked",n)
break
default:system.panel.attribute.find("#"+t).val(e),system.panel.attribute.find("#"+t).numberspinner("setValue",e)}})}})},setFieldFormat:function(t){if(t.formatter)switch(t.formatter){case"size":t.formatter=function(t,e,s){return formatSize(t)}
break
case"speed":t.formatter=function(t,e,s){return formatSize(t,!0,"speed")}
break
case"longtime":t.formatter=function(t,e,s){return formatLongTime(t)}
break
case"progress":t.formatter=function(t,e,s){var n=parseFloat(100*t).toFixed(2)
return system.getTorrentProgressBar(n,transmission.torrents.all[e.id])}
break
case"_usename_":switch(t.field){case"name":t.formatter=function(t,e,s){return system.getTorrentNameBar(transmission.torrents.all[e.id])}}}},reloadData:function(){this.reloadSession(),this.reloading=!1,this.getServerStatus(),this.reloading=!1,this.reloadTorrentBaseInfos(),this.checkTorrentRow("all",!1)},loadFolderList:function(t){this.removeTreeNode("folders-loading")
for(var e in t){var s=t[e]
s&&system.removeTreeNode(s.nodeid)}0!=transmission.downloadDirs.length&&timedChunk(transmission.downloadDirs,this.appendFolder,this,10,function(){navigator.userAgent.indexOf("Firefox")>0&&system.panel.left.find("span.nav-total-size").css({"margin-top":"-19px"})})},appendFolder:function(t){if(t){var e="folders",s=e,n=t.split("/"),a=e+"-"
for(var r in n){var o=n[r]
if(""!=o){a+=this.B64.encode(o)
var i=this.panel.left.tree("find",a),l=transmission.torrents.folders[a],d=o+this.showNodeMoreInfos(l.count,l.size)
i?this.updateTreeNodeText(a,d):(this.appendTreeNode(s,[{id:a,text:d}]),s!=e&&(i=this.panel.left.tree("find",s),this.panel.left.tree("collapse",i.target))),s=a}}}},replaceURI:function(t){var e=/(http|https|ftp):\/\/([^\/:]+)(:\d*)?([^# ]*)/gi
return t.replace(e,function(t){return'<a href="'+t+'" target="_blank">'+t+"</a>"})},readConfig:function(){this.readUserConfig()
var t=cookies.get(this.configHead)
$.isPlainObject(t)&&(this.config=$.extend(this.config,t))
for(var e in this.storageKeys.dictionary)this.dictionary[e]=this.getStorageData(this.storageKeys.dictionary[e])},saveConfig:function(){cookies.set(this.configHead,this.config,100)
for(var t in this.storageKeys.dictionary)this.setStorageData(this.storageKeys.dictionary[t],this.dictionary[t])
this.saveUserConfig()},readUserConfig:function(){var t=window.localStorage[this.configHead]
if(t){var e=JSON.parse(t)
this.userConfig=$.extend(!0,this.userConfig,e)}},saveUserConfig:function(){window.localStorage[this.configHead]=JSON.stringify(this.userConfig)},uploadTorrentFile:function(t,e,s,n){if(window.FileReader){var a=$("input[id='"+t+"']")[0].files
$.each(a,function(t,r){transmission.addTorrentFromFile(r,e,s,n,a.length)})}else alert(system.lang.publit["text-browsers-not-support-features"])},checkUpdate:function(){$.getScript(this.checkUpdateScript,function(){system.codeupdate<system.lastUpdateInfos.update?($("#area-update-infos").show(),$("#msg-updateInfos").html(system.lastUpdateInfos.update+" -> "+system.lastUpdateInfos.infos)):$("#area-update-infos").hide()})},changeLanguages:function(t){t!=this.lang.name&&t&&(this.config.defaultLang=t,this.saveConfig(),location.href="?lang="+t)},getStorageData:function(t,e){return null==window.localStorage[t]?e:window.localStorage[t]},setStorageData:function(t,e){window.localStorage[t]=e},openDialogFromTemplate:function(t){var e={id:null,options:null,datas:null}
if(t=$.extend(!0,e,t),null!=t.id){var s=t.id,n=t.options,a=t.datas,r=$("#"+s)
if(r.length)return r.dialog("open"),a&&$.each(a,function(t,e){r.data(t,e)}),void r.dialog({content:system.templates[s]})
var o={title:"",width:100,height:100,resizable:!1,cache:!0,content:"loading...",modal:!0}
n=$.extend(!0,o,n),$("<div/>").attr("id",s).appendTo(document.body).dialog(n),$.get(system.rootPath+"template/"+s+".html?time="+new Date,function(t){system.templates[s]=t,a&&$.each(a,function(t,e){$("#"+s).data(t,e)}),$("#"+s).dialog({content:t})})}},debug:function(t,e){window.console&&window.console.log&&window.console.log(t,e)}}
$(document).ready(function(){$.getScript(system.rootPath+"lang/default.js"),$.getScript(system.rootPath+"lang/_languages.js",function(){system.init(location.search.getQueryString("lang"),location.search.getQueryString("local"))})})

View File

@ -2,9 +2,9 @@
移动版
*/
var system = {
version:"1.0 Beta"
version:"1.1 Beta"
,rootPath: "tr-web-control/"
,codeupdate:"20141010"
,codeupdate:"20170317"
,config:{
autoReload: true
,reloadStep: 5000
@ -36,7 +36,7 @@ var system = {
{
window.console.log(label,text);
}
}
}
}
,setlang:function(lang,callback)
{
@ -50,14 +50,14 @@ var system = {
//this.debug("lang",lang);
}
if (!lang) lang="zh-CN";
// 如果语言代码中包含-,则需要将后半部份转为大写
if (lang.indexOf("-")!=-1)
{
// 因linux对文件有大小写限制故重新赋值
lang=lang.split("-")[0].toLocaleLowerCase()+"-"+lang.split("-")[1].toLocaleUpperCase();
}
// 如果该语言包没有定义,则使用英文
if (!this.languages[lang])
{
@ -154,7 +154,7 @@ var system = {
{
$("#status_alt_speed").hide();
}
system.downloadDir = result["download-dir"];
// rpc-version 版本为 15 起,不再提供 download-dir-free-space 参数,需从新的方法获取
@ -238,7 +238,7 @@ var system = {
,resetTorrentInfos:function(oldInfos)
{
var currentTorrentId = this.currentTorrentId;
// 已暂停
if (transmission.torrents.status[transmission._status.stopped])
{
@ -259,7 +259,7 @@ var system = {
this.updateCount("sending",0);
}
// 校验
if (transmission.torrents.status[transmission._status.check])
{
@ -289,14 +289,14 @@ var system = {
// 警告
this.updateCount("warning",transmission.torrents.warning.length);
system.reloading = false;
if (system.config.autoReload)
{
system.autoReloadTimer = setTimeout(function(){system.reloadData();},system.config.reloadStep);
}
// 总大小
this.updateCount("all",transmission.torrents.count);
@ -351,7 +351,7 @@ var system = {
{
return;
}
$("#content-"+config.page).show();
if (config.page!=this.currentContentPage)
{
@ -362,7 +362,7 @@ var system = {
$("#torrent-page-bar").hide();
if (!this.torrentListChecked)
$("#torrent-toolbar").hide();
this.currentContentPage = config.page;
switch (config.type)
{
@ -411,7 +411,7 @@ var system = {
case "downloadwait":
torrents = transmission.torrents.status[transmission._status.downloadwait];
break;
case "actively":
torrents = transmission.torrents.actively;
break;
@ -419,7 +419,7 @@ var system = {
case "error":
torrents = transmission.torrents.error;
break;
case "warning":
torrents = transmission.torrents.warning;
break;
@ -447,10 +447,10 @@ var system = {
,page:1
,target:"all"
};
jQuery.extend(def, config);
if (!config.target) return;
var torrents = this.getTorrentFromType(config.target);
this.config.defaultSelectNode = config.target;
@ -522,7 +522,7 @@ var system = {
}).checkboxradio();
}
}
this.torrentPager.setDatas(datas,config.target);
}
// 添加种子信息到列表
@ -535,7 +535,7 @@ var system = {
rateUpload: formatSize(data.rateUpload,false,"speed"),
completeSize: formatSize(data.completeSize),
totalSize: formatSize(data.totalSize),
percentDone: data.percentDone
percentDone: data.percentDone
};
// 由于不能以对象的方式来创建 listview 子项,所以只能用拼接字符串的方式
@ -608,7 +608,7 @@ var system = {
className = "iconlabel icon-exclamation";
tip+="\n\n"+this.lang["public"]["text-info"]+": "+torrent.errorString;
}
return '<span class="'+className+'" title="'+tip+'">'+torrent.name+'</span>';
}
@ -822,7 +822,7 @@ var system = {
return;
}
break;
}
button = $(button);
button.attr("disabled",true);
@ -882,4 +882,4 @@ $(document).ready(function(){
$.getScript(system.rootPath+"lang/_languages.js",function(){
system.init(location.search.getQueryString("lang"));
});
});
});

View File

@ -0,0 +1,86 @@
/*
移动版
*/
var system={version:"1.0 Beta",rootPath:"tr-web-control/",codeupdate:"20141010",config:{autoReload:!0,reloadStep:5e3,pageSize:30,defaultSelectNode:null},lang:null,reloading:!1,autoReloadTimer:null,downloadDir:"",islocal:!1,B64:new Base64,currentTorrentId:0,currentContentPage:"home",currentContentConfig:null,control:{tree:null,torrentlist:null},serverConfig:null,serverSessionStats:null,torrentListChecked:!1,debug:function(t,e){window.console&&window.console.log&&window.console.log(t,e)},setlang:function(t,e){t||(t=this.config.defaultLang?this.config.defaultLang:navigator.language||navigator.browserLanguage),t||(t="zh-CN"),t.indexOf("-")!=-1&&(t=t.split("-")[0].toLocaleLowerCase()+"-"+t.split("-")[1].toLocaleUpperCase()),this.languages[t]||(t="en"),$.getScript(system.rootPath+"lang/"+t+".js",function(){system.lang=$.extend(!0,system.defaultLang,system.lang),system.resetLangText(),e&&e()})},resetLangText:function(){var items=$("*[system-lang]")
$.each(items,function(key,item){var name=$(item).attr("system-lang")
$(item).html(eval("system.lang."+name))})},init:function(t,e){this.readConfig(),transmission.options.getFolders=!1,null==this.lang?this.setlang(t,function(){system.initdata()}):this.initdata()},initdata:function(){$(document).attr("title",this.lang.system.title+" "+this.version),this.control.torrentlist=$("#torrent-list"),this.connect()},readConfig:function(){var t=cookies.get("transmission-web-control")
$.isPlainObject(t)&&(this.config=$.extend(this.config,t))},saveConfig:function(){cookies.set("transmission-web-control",this.config,100)},connect:function(){transmission.on.torrentCountChange=function(){system.reloadTorrentBaseInfos()},transmission.on.postError=function(){},transmission.init({islocal:!0},function(){system.reloadSession(!0),system.getServerStatus()})},reloadSession:function(t){transmission.getSession(function(t){system.serverConfig=t,1==t["alt-speed-enabled"]?$("#status_alt_speed").show():$("#status_alt_speed").hide(),system.downloadDir=t["download-dir"],parseInt(system.serverConfig["rpc-version"])>=15?transmission.getFreeSpace(system.downloadDir,function(t){system.serverConfig["download-dir-free-space"]=t.arguments["size-bytes"],system.showFreeSpace(t.arguments["size-bytes"])}):system.showFreeSpace(system.serverConfig["download-dir-free-space"])})},showFreeSpace:function(t){var e=t
e=e==-1?system.lang.public["text-unknown"]:formatSize(e),$("#status_freespace").text(e)},getServerStatus:function(){this.reloading||(clearTimeout(this.autoReloadTimer),this.reloading=!0,transmission.getStatus(function(t){system.reloading=!1,$("#status_downloadspeed").html(formatSize(t.downloadSpeed,!1,"speed")),$("#status_uploadspeed").html(formatSize(t.uploadSpeed,!1,"speed")),system.serverSessionStats=t}))},reloadTorrentBaseInfos:function(t){if(!this.reloading){clearTimeout(this.autoReloadTimer),this.reloading=!0
var e={trackers:transmission.trackers,folders:transmission.torrents.folders}
transmission.torrents.getallids(function(t){var s=new Array
for(var n in t){var r=t[n]
s.push(r.id)}var a=transmission.torrents.getErrorIds(s,!0)
a.length>0?transmission.torrents.getallids(function(){system.resetTorrentInfos(e)},a):system.resetTorrentInfos(e)},t)}},resetTorrentInfos:function(t){this.currentTorrentId
if(transmission.torrents.status[transmission._status.stopped]?this.updateCount("paused",transmission.torrents.status[transmission._status.stopped].length):this.updateCount("paused",0),transmission.torrents.status[transmission._status.seed]?this.updateCount("sending",transmission.torrents.status[transmission._status.seed].length):this.updateCount("sending",0),transmission.torrents.status[transmission._status.check]?this.updateCount("check",transmission.torrents.status[transmission._status.check].length):this.updateCount("check",0),transmission.torrents.status[transmission._status.download]?this.updateCount("downloading",transmission.torrents.status[transmission._status.download].length):this.updateCount("downloading",0),this.updateCount("actively",transmission.torrents.actively.length),this.updateCount("error",transmission.torrents.error.length),this.updateCount("warning",transmission.torrents.warning.length),system.reloading=!1,system.config.autoReload&&(system.autoReloadTimer=setTimeout(function(){system.reloadData()},system.config.reloadStep)),this.updateCount("all",transmission.torrents.count),"torrent-list"==this.currentContentPage){var e=this.currentContentConfig
e.reload=!0,this.showContent(e)}},updateCount:function(t,e){var s=$("#count-"+t)
s.text(e),0==e?s.hide():s.show()},reloadData:function(){this.reloadSession(),this.reloading=!1,this.getServerStatus(),this.reloading=!1,this.reloadTorrentBaseInfos()},showContent:function(t){var e={page:"",type:"",data:"",title:this.lang.system.title,reload:!1,callback:null},s=null
if("string"==typeof t?(e.page=t,s=e):s=jQuery.extend(e,t),s.page!=this.currentContentPage||s.reload){switch($("#content-"+s.page).show(),s.page!=this.currentContentPage&&($("#content-"+this.currentContentPage).hide(),this.control.torrentlist.find("input:checked").prop("checked",!1).checkboxradio("refresh"),this.torrentListChecked=!1),$("#torrent-page-bar").hide(),this.torrentListChecked||$("#torrent-toolbar").hide(),this.currentContentPage=s.page,s.type){case"torrent-list":s.title=this.lang.tree[s.data],this.loadTorrentToList({target:s.data})}$("#page-title").text(s.title),s.reload=!1,this.currentContentConfig=s,s.callback&&s.callback()}},getTorrentFromType:function(t){var e=null
switch(t){case"torrent-all":case"all":case"servers":e=transmission.torrents.all
break
case"paused":e=transmission.torrents.status[transmission._status.stopped]
break
case"sending":e=transmission.torrents.status[transmission._status.seed]
break
case"seedwait":e=transmission.torrents.status[transmission._status.seedwait]
break
case"check":e=transmission.torrents.status[transmission._status.check]
break
case"checkwait":e=transmission.torrents.status[transmission._status.checkwait]
break
case"downloading":e=transmission.torrents.status[transmission._status.download]
break
case"downloadwait":e=transmission.torrents.status[transmission._status.downloadwait]
break
case"actively":e=transmission.torrents.actively
break
case"error":e=transmission.torrents.error
break
case"warning":e=transmission.torrents.warning
break
case"search-result":e=transmission.torrents.searchResult}return e},loadTorrentToList:function(t){if(!this.torrentListChecked&&transmission.torrents.all){var e={node:null,page:1,target:"all"}
if(jQuery.extend(e,t),t.target){var s=this.getTorrentFromType(t.target)
this.config.defaultSelectNode=t.target,this.saveConfig()
var n=new Array
this.control.torrentlist.empty()
for(var r in s)if(s[r]){var a=parseFloat(100*s[r].percentDone).toFixed(2),o=this.lang.torrent["status-text"][s[r].status]
0!=s[r].error?o="<span class='text-status-error'>"+o+"</span>":s[r].warning&&(o="<span class='text-status-warning' title='"+s[r].warning+"'>"+o+"</span>")
var i={id:s[r].id,name:this.getTorrentNameBar(s[r]),totalSize:s[r].totalSize,percentDone:this.getTorrentProgressBar(a,s[r]),percentDoneNumber:a,status:o,addedDate:formatLongTime(s[r].addedDate),completeSize:s[r].totalSize-s[r].leftUntilDone,rateDownload:s[r].rateDownload,rateUpload:s[r].rateUpload,leecherCount:s[r].leecher,seederCount:s[r].seeder,uploadRatio:s[r].uploadRatio,uploadedEver:s[r].uploadedEver}
n.push(i)}if(0==n.length)return void setTimeout(function(){system.showContent("home")},100)
null==this.torrentPager.onGotoPage&&(this.torrentPager.onGotoPage=function(t){system.control.torrentlist.empty(),$("#torrent-toolbar").hide()
for(var e in t)system.appendTorrentToList(t[e])
$(system.control.torrentlist).listview("refresh").find("input[type='checkbox']").click(function(){system.changeTorrentToolbar(this,i),system.torrentListChecked?system.control.torrentlist.find("a[name='torrent']").css("marginLeft","0px"):system.control.torrentlist.find("a[name='torrent']").css("marginLeft","-35px")}).checkboxradio()}),this.torrentPager.setDatas(n,t.target)}}},appendTorrentToList:function(t){var e={id:t.id,name:t.name,rateDownload:formatSize(t.rateDownload,!1,"speed"),rateUpload:formatSize(t.rateUpload,!1,"speed"),completeSize:formatSize(t.completeSize),totalSize:formatSize(t.totalSize),percentDone:t.percentDone},s="<li id='li-torrent-$id$' torrentid='$id$' style='padding:0px;'><a name='torrent' style='padding:0px;margin-left:-35px;'><label data-corners='false' style='margin:0px;border:0px;padding:0px;'><input type='checkbox' id='torrent-$id$'/><label for='torrent-$id$'><h3 style='margin:0px;'>$name$</h3><div style='padding:0px 10px 5px 0px;'>$percentDone$</div><p class='torrent-list-infos'>↓$rateDownload$ ↑$rateUpload$|$completeSize$/$totalSize$</p></label></label></a><a class='more'></a>"
s=s.replace(/\$([^\$]*)\$/g,function(t,s){return e[s]})
var n=$(s)
n.on("swiperight",function(t){system.control.torrentlist.find("a[name='torrent']").css("marginLeft","0px")}),n.on("swipeleft",function(t){system.control.torrentlist.find("a[name='torrent']").css("marginLeft","-35px")}),n.appendTo(this.control.torrentlist)},getTorrentNameBar:function(t){var e="",s=t.name
switch(t.status){case transmission._status.stopped:e="iconlabel icon-pause-small"
break
case transmission._status.check:e="iconlabel icon-checking"
break
case transmission._status.download:e="iconlabel icon-down"
break
case transmission._status.seed:e="iconlabel icon-up"
break
case transmission._status.seedwait:case transmission._status.downloadwait:case transmission._status.checkwait:e="iconlabel icon-wait"}return t.warning&&(e="iconlabel icon-warning-type1",s+="\n\n"+this.lang.public["text-info"]+": "+t.warning),0!=t.error&&(e="iconlabel icon-exclamation",s+="\n\n"+this.lang.public["text-info"]+": "+t.errorString),'<span class="'+e+'" title="'+s+'">'+t.name+"</span>"},getTorrentProgressBar:function(t,e){t+="%"
var s=""
switch(e.status){case transmission._status.stopped:s="torrent-progress-stop"
break
case transmission._status.checkwait:case transmission._status.check:s="torrent-progress-check"
break
case transmission._status.downloadwait:case transmission._status.download:s="torrent-progress-download"
break
case transmission._status.seedwait:case transmission._status.seed:s="torrent-progress-seed"}return e.warning&&(s="torrent-progress-warning"),0!=e.error&&(s="torrent-progress-error"),'<div class="torrent-progress" title="'+t+'"><div class="torrent-progress-text">'+t+'</div><div class="torrent-progress-bar '+s+'" style="width:'+t+';"></div></div>'},changeTorrentToolbar:function(t,e){var s=this.control.torrentlist.find("input:checked")
$("#torrent-checked-count").html(s.length),s.length>0?(this.torrentListChecked=!0,$("#torrent-toolbar").show()):(this.torrentListChecked=!1,$("#torrent-toolbar").hide()),e&&(this.currentTorrentId=e.id)},torrentPager:{datas:null,pageSize:30,pageNumber:0,pageCount:0,count:0,onGotoPage:null,currentDatas:null,pageBar:null,controls:{prev:null,next:null,number:null},head:"",init:function(t){this.pageBar=$("#torrent-page-bar"),this.controls.next=this.pageBar.find("#page-next"),this.controls.next.click(function(){system.torrentPager.gotoPage("next")}),this.controls.prev=this.pageBar.find("#page-prev"),this.controls.prev.click(function(){system.torrentPager.gotoPage("prev")}),this.controls.number=this.pageBar.find("#page-number"),t&&this.setDatas(t)},setDatas:function(t,e){this.datas||this.init(),this.datas=t,this.pageBar.show(),this.count=this.datas.length,this.pageCount=parseInt(this.count/this.pageSize),this.count%this.pageSize>0&&this.pageCount++,1==this.pageCount&&this.pageBar.hide(),this.head==e?this.gotoPage():this.gotoPage(1),this.head=e},gotoPage:function(t){if("number"==typeof t)this.pageNumber=t
else switch(t){case"next":this.pageNumber++
break
case"prev":this.pageNumber--}this.pageNumber>this.pageCount&&(this.pageNumber=this.pageCount),this.pageNumber<1&&(this.pageNumber=1)
var e=(this.pageNumber-1)*parseInt(this.pageSize),s=e+parseInt(this.pageSize)
this.currentDatas=this.datas.slice(e,s),this.controls.number.text(this.pageNumber+"/"+this.pageCount),this.pageNumber>1?this.controls.prev.show():this.controls.prev.hide(),this.pageNumber<this.pageCount?this.controls.next.show():this.controls.next.hide(),this.onGotoPage&&this.onGotoPage(this.currentDatas)}},changeSelectedTorrentStatus:function(t,e,s){var n=this.control.torrentlist.find("input:checked"),r=new Array
t||(t="start")
for(var a=0;a<n.length;a++)r.push(parseInt(n[a].id.replace("torrent-","")))
if(r.length>0){var arguments={ids:r}
switch(t){case"remove":arguments["delete-local-data"]=s.removeData
break
case"verify":if(1==r.length){var o=transmission.torrents.all[r[0]]
if(o.percentDone>0&&0==confirm(system.lang.toolbar.tip["recheck-confirm"]))return}else if(0==confirm(system.lang.toolbar.tip["recheck-confirm"]))return}e=$(e),e.attr("disabled",!0),transmission.exec({method:"torrent-"+t,arguments:arguments},function(t){e.attr("disabled",!1),system.reloadTorrentBaseInfos()}),this.torrentListChecked=!1}},addTorrentsToServer:function(t,e,s,n,r){var a=e-t.length,o=t.shift()
return o?(this.showStatus(this.lang.system.status.queue,e-a+1),void transmission.addTorrentFromUrl(o,n,s,function(a){system.addTorrentsToServer(t,e,s,n,r)})):(this.showStatus(this.lang.system.status.queuefinish),this.getServerStatus(),void(r&&r()))},showStatus:function(t,e){return t?($("#status").show(),$("#status-msg").html(t),void($.isNumeric(e)?$("#status-count").html(e).show():$("#status-count").hide())):void $("#status").hide()}}
$(document).ready(function(){$.getScript(system.rootPath+"lang/default.js"),$.getScript(system.rootPath+"lang/_languages.js",function(){system.init(location.search.getQueryString("lang"))})})

View File

@ -33,7 +33,7 @@ var transmission = {
,headers:{}
,trackers:{}
,islocal:false
// 当前已存在的目录列表
// The list of directories that currently exist
,downloadDirs:new Array()
,getSessionId:function(me,callback)
{

View File

@ -0,0 +1,20 @@
// transmission RPC 操作类
// 栽培者
var transmission={SessionId:"",isInitialized:!1,host:"",port:"9091",path:"/transmission/rpc",rpcpath:"../rpc",fullpath:"",on:{torrentCountChange:null,postError:null},username:"",password:"",_status:{stopped:0,checkwait:1,check:2,downloadwait:3,download:4,seedwait:5,seed:6,actively:101},options:{getFolders:!0,getTarckers:!0},headers:{},trackers:{},islocal:!1,downloadDirs:new Array,getSessionId:function(t,e){var s={type:"POST",url:this.fullpath,error:function(s,n,r){var o=""
409===s.status&&(o=s.getResponseHeader("X-Transmission-Session-Id"))&&(t.isInitialized=!0,t.SessionId=o,t.headers["X-Transmission-Session-Id"]=o,e&&e())},headers:this.headers}
jQuery.ajax(s)},init:function(t,e){jQuery.extend(this,t),this.username&&this.password&&(this.headers.Authorization="Basic "+(new Base64).encode(this.username+":"+this.password)),this.fullpath=this.rpcpath,this.getSessionId(this,e)},exec:function(t,e,s){if(!this.isInitialized)return!1
var n={method:"",arguments:{},tag:""}
jQuery.extend(n,t)
var r={type:"POST",url:this.fullpath,dataType:"json",data:JSON.stringify(n),success:function(t,n){e&&e(t,s)},error:function(t,e,s){var n=""
409===t.status&&(n=t.getResponseHeader("X-Transmission-Session-Id"))?(transmission.SessionId=n,transmission.headers["X-Transmission-Session-Id"]=n,jQuery.ajax(r)):transmission.on.postError&&transmission.on.postError(t)},headers:this.headers}
jQuery.ajax(r)},getStatus:function(t){this.exec({method:"session-stats"},function(e){"success"==e.result&&(t&&t(e.arguments),transmission.torrents.count==e.arguments.torrentCount&&transmission.torrents.activeTorrentCount==e.arguments.activeTorrentCount&&transmission.torrents.pausedTorrentCount==e.arguments.pausedTorrentCount||(transmission.torrents.count=e.arguments.torrentCount,transmission.torrents.activeTorrentCount=e.arguments.activeTorrentCount,transmission.torrents.pausedTorrentCount=e.arguments.pausedTorrentCount,transmission._onTorrentCountChange()))})},getSession:function(t){this.exec({method:"session-get"},function(e){"success"==e.result&&t&&t(e.arguments)})},addTorrentFromUrl:function(t,e,s,n){t.match(/^[0-9a-f]{40}$/i)&&(t="magnet:?xt=urn:btih:"+t)
var r={method:"torrent-add",arguments:{filename:t,paused:!s}}
e&&(r.arguments["download-dir"]=e),this.exec(r,function(t){switch(t.result){case"success":n&&(t.arguments["torrent-added"]?n(t.arguments["torrent-added"]):t.arguments["torrent-duplicate"]&&n({status:"duplicate",torrent:t.arguments["torrent-duplicate"]}))
break
case"duplicate torrent":default:n&&n(t.result)}})},addTorrentFromFile:function(t,e,s,n,r){var o=new FileReader
o.onload=function(t){var o=t.target.result,a="base64,",i=o.indexOf(a)
if(i!=-1){var u=o.substring(i+a.length)
transmission.exec({method:"torrent-add",arguments:{metainfo:u,"download-dir":e,paused:s}},function(t){switch(t.result){case"success":n&&n(t.arguments["torrent-added"],r)
break
case"duplicate torrent":n&&n("duplicate")}})}},o.readAsDataURL(t)},_onTorrentCountChange:function(){this.torrents.loadSimpleInfo=!1,this.on.torrentCountChange&&this.on.torrentCountChange()},removeTorrent:function(t,e,s){this.exec({method:"torrent-remove",arguments:{ids:t,"delete-local-data":e}},function(t){s&&s(t.result)})},getFreeSpace:function(t,e){this.exec({method:"free-space",arguments:{path:t}},function(t){e&&e(t)})},updateBlocklist:function(t){this.exec({method:"blocklist-update"},function(e){t&&t(e.result)})},renameTorrent:function(t,e,s,n){var r=this.torrents.all[t]
return!!r&&void this.exec({method:"torrent-rename-path",arguments:{ids:[t],path:e||r.name,name:s}},function(t){n&&n(t)})},closeSession:function(t){this.exec({method:"session-close"},function(e){t&&t(e)})}}

View File

@ -1,4 +1,4 @@
// 种子相关信息
// Torrent related information
transmission.torrents = {
all:null
,puased:null
@ -21,15 +21,15 @@ transmission.torrents = {
+",rateDownload,rateUpload,peersGettingFromUs,peersSendingToUs,uploadRatio,uploadedEver,downloadedEver,error,errorString,doneDate,queuePosition"
,config:"downloadLimit,downloadLimited,peer-limit,seedIdleLimit,seedIdleMode,seedRatioLimit,seedRatioMode,uploadLimit,uploadLimited"
}
// 所有已获取的种子列表
// List of all the torrents that have been acquired
,datas:{}
// 当前获取的种子列表
// The list of recently acquired torrents
,recently:null
// 当前移除的种子
// The recently removed seed
,removed:null
// 是否正在获取有变化的种子
// Whether the torrents are being changed
,isRecentlyActive:false
// 新增的种子
// New torrents
,newIds:new Array()
,getallids:function(callback,ids, moreFields)
{
@ -48,7 +48,7 @@ transmission.torrents = {
this.isRecentlyActive = false;
// 如果已经获取过
// If it has been acquired
if (this.all&&ids==undefined)
{
arguments["ids"] = "recently-active";
@ -94,20 +94,20 @@ transmission.torrents = {
}
);
}
// 根据种子状态将ID进行分类
// The IDs are sorted according to the torrent status
,splitid:function()
{
// 正在下载的种子
// Downloading
this.downloading = new Array();
// 已暂停的种子
// Paused
this.puased = new Array();
// 当前活动的种子
// Active lately
this.actively = new Array();
// 有错误提示的种子
// With Errors
this.error = new Array();
// 有警告提示的种子
// With Warnings
this.warning = new Array();
// 所有下载目录列表
// All download directories
transmission.downloadDirs = new Array();
var _Status = transmission._status;
@ -119,7 +119,7 @@ transmission.torrents = {
var B64 = new Base64();
// 合并两个数
// Merge two numbers
for (var index in this.recently)
{
var item = this.recently[index];
@ -128,14 +128,14 @@ transmission.torrents = {
var removed = new Array();
// 去除已经被删除的种子
// Remove the torrents that have been removed
for (var index in this.removed)
{
var item = this.removed[index];
removed.push(item);
}
// 将种子进行分类
// Torrents are classified
for (var index in this.datas)
{
var item = this.datas[index];
@ -155,7 +155,7 @@ transmission.torrents = {
continue;
}
// 如果当前是获取正有变化的种子,并且没有在之前种子列表内,即新增的种子,需要重新加载基本的信息
// If the current torrent is being acquired and there is no torrent in the previous torrent list, that is, the new torrent needs to be reloaded with the basic information
if (this.isRecentlyActive&&!this.all[item.id])
{
this.newIds.push(item.id);
@ -173,28 +173,36 @@ transmission.torrents = {
this.status[item.status] = new Array();
type = this.status[item.status];
}
// Total size
this.totalSize=item.totalSize;
// 剩余时间
// Time left
if (item.rateDownload>0&&item.leftUntilDone>0)
{
item["remainingTime"] = getTotalTime(item.leftUntilDone/item.rateDownload*1000);
item["remainingTimeRaw"] = Math.floor(item.leftUntilDone/item.rateDownload*1000);
}
else if (item.rateDownload==0&&item.leftUntilDone==0)
else if (item.rateDownload==0&&item.leftUntilDone==0&&item.totalSize!=0)
{
item["remainingTime"] = 0;
item["remainingTimeRaw"] = 0;
}
else
else {
item["remainingTime"] = "∞";
// ~100 years
item["remainingTimeRaw"] = 3153600000000;
}
type.push(item);
// 发生错误的种子
// The seed for which the error occurred
if (item.error!=0)
{
this.error.push(item);
}
// 当前有流量的种子
// There is currently a number of seeds
if (item.rateUpload>0||item.rateDownload>0)
{
this.actively.push(item);
@ -213,9 +221,9 @@ transmission.torrents = {
this.all[item.id]=item;
this.totalSize+=item.totalSize;
//this.totalSize+=item.totalSize;
// 设置目录
// Set the directory
if ($.inArray(item.downloadDir, transmission.downloadDirs)==-1)
{
transmission.downloadDirs.push(item.downloadDir);
@ -253,7 +261,7 @@ transmission.torrents = {
}
transmission.downloadDirs = transmission.downloadDirs.sort();
// 是否有需要获取的新种子
// If there a need to acquire new seeds
if (this.newIds.length>0)
{
this.getallids(null,this.newIds);

View File

@ -0,0 +1,42 @@
// Torrent related information
transmission.torrents={all:null,puased:null,downloading:null,actively:null,searchResult:null,error:null,warning:null,folders:{},status:{},count:0,totalSize:0,loadSimpleInfo:!1,activeTorrentCount:0,pausedTorrentCount:0,fields:{base:"id,name,status,hashString,totalSize,percentDone,addedDate,trackerStats,leftUntilDone,rateDownload,rateUpload,recheckProgress,rateDownload,rateUpload,peersGettingFromUs,peersSendingToUs,uploadRatio,uploadedEver,downloadedEver,downloadDir,error,errorString,doneDate,queuePosition",status:"id,status,percentDone,trackerStats,leftUntilDone,rateDownload,rateUpload,rateDownload,rateUpload,peersGettingFromUs,peersSendingToUs,uploadRatio,uploadedEver,downloadedEver,error,errorString,doneDate,queuePosition",config:"downloadLimit,downloadLimited,peer-limit,seedIdleLimit,seedIdleMode,seedRatioLimit,seedRatioMode,uploadLimit,uploadLimited"},datas:{},recently:null,removed:null,isRecentlyActive:!1,newIds:new Array,getallids:function(e,t,n){var s=this.fields.base
this.loadSimpleInfo&&this.all&&(s=this.fields.status)
var r=s.split(",")
$.isArray(n)&&$.unique($.merge(r,n))
var arguments={fields:r}
this.isRecentlyActive=!1,this.all&&void 0==t?(arguments.ids="recently-active",this.isRecentlyActive=!0):t&&(arguments.ids=t),this.all||(this.all={}),transmission.exec({method:"torrent-get",arguments:arguments},function(t){"success"==t.result?(transmission.torrents.newIds.length=0,transmission.torrents.loadSimpleInfo=!0,transmission.torrents.recently=t.arguments.torrents,transmission.torrents.removed=t.arguments.removed,transmission.torrents.splitid(),e&&e(t.arguments.torrents)):(transmission.torrents.datas=null,e&&e(null))})},splitid:function(){this.downloading=new Array,this.puased=new Array,this.actively=new Array,this.error=new Array,this.warning=new Array,transmission.downloadDirs=new Array
var e=transmission._status
this.status={},transmission.trackers={},this.totalSize=0,this.folders={},this.count=0
var t=new Base64
for(var n in this.recently){var s=this.recently[n]
this.datas[s.id]=s}var r=new Array
for(var n in this.removed){var s=this.removed[n]
r.push(s)}for(var n in this.datas){var s=this.datas[n]
if(!s)return
if($.inArray(s.id,r)!=-1&&r.length>0)this.all[s.id]&&(this.all[s.id]=null,delete this.all[s.id]),this.datas[n]=null,delete this.datas[n]
else{this.isRecentlyActive&&!this.all[s.id]&&this.newIds.push(s.id),s=$.extend(this.all[s.id],s),0==s.uploadedEver&&0==s.downloadedEver&&(s.uploadRatio="∞"),s.infoIsLoading=!1
var i=this.status[s.status]
switch(this.addTracker(s),i||(this.status[s.status]=new Array,i=this.status[s.status]),this.totalSize=s.totalSize,s.rateDownload>0&&s.leftUntilDone>0?(s.remainingTime=getTotalTime(s.leftUntilDone/s.rateDownload*1e3),s.remainingTimeRaw=Math.floor(s.leftUntilDone/s.rateDownload*1e3)):0==s.rateDownload&&0==s.leftUntilDone&&0!=s.totalSize?(s.remainingTime=0,s.remainingTimeRaw=0):(s.remainingTime="∞",s.remainingTimeRaw=31536e8),i.push(s),0!=s.error&&this.error.push(s),(s.rateUpload>0||s.rateDownload>0)&&this.actively.push(s),s.status){case e.stopped:this.puased.push(s)
break
case e.download:this.downloading.push(s)}if(this.all[s.id]=s,$.inArray(s.downloadDir,transmission.downloadDirs)==-1&&transmission.downloadDirs.push(s.downloadDir),transmission.options.getFolders&&s.downloadDir){var a=s.downloadDir.split("/"),o="folders-"
for(var l in a){var d=a[l]
if(""!=d){o+=t.encode(d)
var u=this.folders[o]
u||(u={count:0,torrents:new Array,size:0,nodeid:o}),u.torrents.push(s),u.count++,u.size+=s.totalSize,this.folders[o]=u}}}this.count++}}transmission.downloadDirs=transmission.downloadDirs.sort(),this.newIds.length>0&&this.getallids(null,this.newIds)},addTracker:function(e){var t=e.trackerStats,n=!1
if(e.leecherCount=0,e.seederCount=0,t.length>0){for(var s in t){var r=t[s],i=r.lastAnnounceResult.toLowerCase(),a=r.host.replace("http://","").replace("https://","").split(":")[0].split(".")
$.inArray(a[0],"www,tracker".split(","))!=-1&&a.shift()
var o=a.join("."),l="tracker-"+o.replace(/\./g,"-"),d=transmission.trackers[l]
d||(transmission.trackers[l]={count:0,torrents:new Array,size:0,connected:!0},d=transmission.trackers[l]),d.name=o,d.nodeid=l,d.host=r.host,"success"!=i&&0!=r.announceState&&(n=!0,e.warning=r.lastAnnounceResult,"could not connect to tracker"==i&&(d.connected=!1)),d.torrents.push(e),d.count++,d.size+=e.totalSize,e.leecherCount+=r.leecherCount,e.seederCount+=r.seederCount}n&&(e.nextAnnounceTime?e.nextAnnounceTime>r.nextAnnounceTime&&(e.nextAnnounceTime=r.nextAnnounceTime):e.nextAnnounceTime=r.nextAnnounceTime,this.warning.push(e)),e.leecherCount<0&&(e.leecherCount=0),e.seederCount<0&&(e.seederCount=0),e.leecher=e.leecherCount+" ("+e.peersGettingFromUs+")",e.seeder=e.seederCount+" ("+e.peersSendingToUs+")"}},getPeers:function(e){transmission.exec({method:"torrent-get",arguments:{fields:"peers,peersFrom".split(","),ids:e}},function(e){console.log("data:",e)})},getMoreInfos:function(e,t,n){transmission.exec({method:"torrent-get",arguments:{fields:e.split(","),ids:t}},function(e){"success"==e.result?n&&n(e.arguments.torrents):n&&n(null)})},search:function(e,t){if(!e)return null
t||(t=this.all)
var n=new Array
return $.each(t,function(s,r){t[s].name.toLowerCase().indexOf(e.toLowerCase())!=-1&&n.push(t[s])}),this.searchResult=n,n},getFiles:function(e,t){transmission.exec({method:"torrent-get",arguments:{fields:"files,fileStats".split(","),ids:e}},function(e){"success"==e.result?t&&t(e.arguments.torrents):t&&t(null)})},getConfig:function(e,t){this.getMoreInfos(this.fields.config,e,t)},getErrorIds:function(e,t){var n=new Array,s=new Date
1==t&&(s=s.getTime()/1e3)
for(var r in this.error){var i=this.error[r]
$.inArray(i.id,e)!=-1&&e.length>0||1==t&&s<i.nextAnnounceTime||i.status!=transmission._status.stopped&&n.push(i.id)}for(var r in this.warning){var i=this.warning[r]
$.inArray(i.id,e)!=-1&&e.length>0||1==t&&s<i.nextAnnounceTime||n.push(i.id)}return n},searchAndReplaceTrackers:function(e,t,n){if(e&&t){var s={},r=0
for(var i in this.all){var a=this.all[i]
if(!a)return
var o=a.trackerStats
for(var l in o){var d=o[l]
d.announce==e&&(s[l]||(s[l]={ids:new Array,tracker:t}),s[l].ids.push(a.id),r++)}}0==r&&n&&n(null,0)
for(var i in s)transmission.exec({method:"torrent-set",arguments:{ids:s[i].ids,trackerReplace:[parseInt(i),s[i].tracker]}},function(e,t){"success"==e.result?n&&n(t,r):n&&n(null)},s[i].ids)}}}

View File

@ -397,8 +397,7 @@
thisDialog.find("#download-dir-free-space").text(tmp);
// 本地设置信息
thisDialog.find("#local-storage-dictionary-folders").val(system.dictionary.folders);
thisDialog.find("#local-storage-dictionary-folders").val(transmission.downloadDirs);
// 取消
thisDialog.find("#system-config-button-cancel").click(function()