mirror of
https://github.com/ronggang/transmission-web-control.git
synced 2024-09-20 14:55:49 +00:00
Fixed cookie's pagelist
This commit is contained in:
parent
573c44364d
commit
743dea4685
|
@ -20,6 +20,8 @@
|
|||
- 更新了easyui到1.5.1和jquery到1.12.4 By -- @balonik
|
||||
- 修复问题#20,#21,#23,#39,#40,#43,#44, #53 By -- @balonik
|
||||
- 替换了一些中文注释为英文注释.
|
||||
- 修复问题#77,#81 (如果载入错误,请清空cookies。) By -- @balonik
|
||||
- 种子列表数修改为最多300,同时也可修改config.js中的"pagination:true" 为"pagination:false"来显示所有种子。 By -- @balonik
|
||||
|
||||
### 功能介绍
|
||||
- 在线查看Transmission当前工作情况;
|
||||
|
@ -95,6 +97,8 @@ I will do my best to fix the issues in this repo.
|
|||
- Updated easyui to 1.5.1 and jquery to 1.12.4 By -- @balonik
|
||||
- Fixed issue #20, #21, #23, #39, #40, #43, #44 #53 By -- @balonik
|
||||
- Replaced some Chinese comments to English
|
||||
- Fixed issue #77,#81 (Please clear your cookies if you encounter any error) By -- @balonik
|
||||
- Now the maximum number of torrents per page is 300,meanwhile, you can still modify the file config.js "pagination:true" to "pagination:false" in order to show ALL the torrents. By -- @balonik
|
||||
|
||||
### Features
|
||||
- Add torrent files or URLs
|
||||
|
|
Binary file not shown.
|
@ -1,14 +1,13 @@
|
|||
var cookies = {
|
||||
/* ***********************************************
|
||||
'** 函数名称: 取得Cookies的值
|
||||
'** 函数功能: 显示分页信息
|
||||
'** 参数说明:
|
||||
'** strName 要取值的Cookies名称
|
||||
'** strSubName 子项名称(如果有的话)
|
||||
'** 函数返回:
|
||||
'** null 表示没有取得值
|
||||
'** cookies值 正确返回(有值)
|
||||
'** 参考实例:
|
||||
'** Function name: Get the value of Cookies
|
||||
'** Parameters:
|
||||
'** strName Cookie name
|
||||
'** strSubName subkey name (if any)
|
||||
'** returns:
|
||||
'** null if no values has been obtained
|
||||
'** cookie values in cookie
|
||||
'** Example:
|
||||
'** var strCookie = getCookie("myCookies","mySubCookies");
|
||||
*************************************************/
|
||||
get:function(strName,strSubName)
|
||||
|
@ -20,17 +19,17 @@ var cookies = {
|
|||
|
||||
for (var i=0; i < intCookiesLength; i++)
|
||||
{
|
||||
// 当有子项目时会有&符号
|
||||
// There will be ampersand if there are subprojects
|
||||
if (strCookies[i].indexOf("&") > 0)
|
||||
{
|
||||
// 取得头
|
||||
// Get head
|
||||
strHead = strCookies[i].split("=");
|
||||
// 判断是否和要查找的参数相同
|
||||
// If we have cookie we seek
|
||||
if (strName == strHead[0])
|
||||
{
|
||||
// 去掉头信息
|
||||
// Manipulate head information
|
||||
strCookies[i] = strCookies[i].substr(strName.length+1);
|
||||
// 以&分割字符,以取得所有子项
|
||||
// Use the & divisible character to get all the children
|
||||
strCookie = strCookies[i].split("&");
|
||||
intLength = strCookie.length;
|
||||
var result = {};
|
||||
|
@ -38,7 +37,8 @@ var cookies = {
|
|||
{
|
||||
strItem = strCookie[j].split("=");
|
||||
|
||||
var value = unescape(strItem[1]);
|
||||
//var value = unescape(strItem[1]);
|
||||
var value = JSON.parse(strItem[1]);
|
||||
switch (value)
|
||||
{
|
||||
case "true":
|
||||
|
@ -50,19 +50,17 @@ var cookies = {
|
|||
default:
|
||||
result[strItem[0]] = value;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if (strSubName == strItem[0])
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
// 如果没有指定子项名称时,则返回一个对象,包含所有子项;
|
||||
// If no child name is specified, an object is returned that contains all the children;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
// 没有子项时直接判断取值
|
||||
// There is no child to determine the value directly
|
||||
else
|
||||
{
|
||||
strItem = strCookies[i].split("=");
|
||||
|
@ -74,8 +72,8 @@ var cookies = {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
// 设置 cookie 内容
|
||||
// value 可为对象,格式如:key:value
|
||||
// Set the cookie content
|
||||
// Value can be an object, such as: key: value
|
||||
,set:function(name,value,expireDays)
|
||||
{
|
||||
var exdate=new Date();
|
||||
|
@ -87,19 +85,21 @@ var cookies = {
|
|||
var cookieValue = value;
|
||||
switch (typeof(value))
|
||||
{
|
||||
// 如果为对象时,按格式拆分后保存
|
||||
// Save it per object type
|
||||
case "object":
|
||||
case "function":
|
||||
var arr = new Array();
|
||||
for (var key in value)
|
||||
{
|
||||
arr.push(key+"="+escape(value[key]));
|
||||
//arr.push(key+"="+escape(value[key]));
|
||||
arr.push(key+"="+JSON.stringify(value[key]));
|
||||
}
|
||||
cookieValue = arr.join("&");
|
||||
break;
|
||||
|
||||
default:
|
||||
cookieValue = escape(value);
|
||||
//cookieValue = escape(value);
|
||||
cookieValue = JSON.stringify(value);
|
||||
break;
|
||||
}
|
||||
document.cookie=name+"=" +cookieValue+((expireDays==0)? "" :"; expires="+exdate.toGMTString());
|
||||
|
|
26
src/tr-web-control/script/min/cookies.min.js
vendored
26
src/tr-web-control/script/min/cookies.min.js
vendored
|
@ -1,16 +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
|
||||
var cookies={get:function(e,t){for(var r,i,n,s,a=document.cookie.split("; "),o=a.length,c=0;c<o;c++)if(a[c].indexOf("&")>0){if(n=a[c].split("="),e==n[0]){a[c]=a[c].substr(e.length+1),s=a[c].split("&"),r=s.length
|
||||
for(var u={},f=0;f<r;f++){i=s[f].split("=")
|
||||
var l=JSON.parse(i[1])
|
||||
switch(l){case"true":u[i[0]]=!0
|
||||
break
|
||||
case"false":u[n[0]]=!1
|
||||
case"false":u[i[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("&")
|
||||
default:u[i[0]]=l}if(t==i[0])return l}return u}}else if(i=a[c].split("="),e==i[0])return unescape(i[1])
|
||||
return null},set:function(e,t,r){var i=new Date
|
||||
void 0==r&&(r=0),i.setDate(i.getDate()+r)
|
||||
var n=t
|
||||
switch(typeof t){case"object":case"function":var s=new Array
|
||||
for(var a in t)s.push(a+"="+JSON.stringify(t[a]))
|
||||
n=s.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}}
|
||||
default:n=JSON.stringify(t)}document.cookie=e+"="+n+(0==r?"":"; expires="+i.toGMTString())},remove:function(e){this.set(e,"",-1)},all:function(){return document.cookie}}
|
||||
|
|
6
src/tr-web-control/script/min/system.min.js
vendored
6
src/tr-web-control/script/min/system.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -2,16 +2,16 @@
|
|||
var system = {
|
||||
version:"1.1 Beta"
|
||||
,rootPath: "tr-web-control/"
|
||||
,codeupdate:"20170522"
|
||||
,codeupdate:"20170523"
|
||||
,configHead: "transmission-web-control"
|
||||
// default config, can be customized in config.js
|
||||
// default config, can be customized in config.js
|
||||
,config:{
|
||||
autoReload: true
|
||||
,reloadStep: 5000
|
||||
,pageSize: 30
|
||||
,pagination: true
|
||||
,pageList:[10,20,30,40,50,100,150,200,250,300]
|
||||
,defaultSelectNode: null
|
||||
,pagination: true
|
||||
,pageList: [10,20,30,40,50,100,150,200,250,300]
|
||||
,defaultSelectNode: null
|
||||
,autoExpandAttribute: false
|
||||
,defaultLang: ""
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user