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
|
- 更新了easyui到1.5.1和jquery到1.12.4 By -- @balonik
|
||||||
- 修复问题#20,#21,#23,#39,#40,#43,#44, #53 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当前工作情况;
|
- 在线查看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
|
- 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
|
- Fixed issue #20, #21, #23, #39, #40, #43, #44 #53 By -- @balonik
|
||||||
- Replaced some Chinese comments to English
|
- 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
|
### Features
|
||||||
- Add torrent files or URLs
|
- Add torrent files or URLs
|
||||||
|
|
Binary file not shown.
|
@ -1,14 +1,13 @@
|
||||||
var cookies = {
|
var cookies = {
|
||||||
/* ***********************************************
|
/* ***********************************************
|
||||||
'** 函数名称: 取得Cookies的值
|
'** Function name: Get the value of Cookies
|
||||||
'** 函数功能: 显示分页信息
|
'** Parameters:
|
||||||
'** 参数说明:
|
'** strName Cookie name
|
||||||
'** strName 要取值的Cookies名称
|
'** strSubName subkey name (if any)
|
||||||
'** strSubName 子项名称(如果有的话)
|
'** returns:
|
||||||
'** 函数返回:
|
'** null if no values has been obtained
|
||||||
'** null 表示没有取得值
|
'** cookie values in cookie
|
||||||
'** cookies值 正确返回(有值)
|
'** Example:
|
||||||
'** 参考实例:
|
|
||||||
'** var strCookie = getCookie("myCookies","mySubCookies");
|
'** var strCookie = getCookie("myCookies","mySubCookies");
|
||||||
*************************************************/
|
*************************************************/
|
||||||
get:function(strName,strSubName)
|
get:function(strName,strSubName)
|
||||||
|
@ -20,17 +19,17 @@ var cookies = {
|
||||||
|
|
||||||
for (var i=0; i < intCookiesLength; i++)
|
for (var i=0; i < intCookiesLength; i++)
|
||||||
{
|
{
|
||||||
// 当有子项目时会有&符号
|
// There will be ampersand if there are subprojects
|
||||||
if (strCookies[i].indexOf("&") > 0)
|
if (strCookies[i].indexOf("&") > 0)
|
||||||
{
|
{
|
||||||
// 取得头
|
// Get head
|
||||||
strHead = strCookies[i].split("=");
|
strHead = strCookies[i].split("=");
|
||||||
// 判断是否和要查找的参数相同
|
// If we have cookie we seek
|
||||||
if (strName == strHead[0])
|
if (strName == strHead[0])
|
||||||
{
|
{
|
||||||
// 去掉头信息
|
// Manipulate head information
|
||||||
strCookies[i] = strCookies[i].substr(strName.length+1);
|
strCookies[i] = strCookies[i].substr(strName.length+1);
|
||||||
// 以&分割字符,以取得所有子项
|
// Use the & divisible character to get all the children
|
||||||
strCookie = strCookies[i].split("&");
|
strCookie = strCookies[i].split("&");
|
||||||
intLength = strCookie.length;
|
intLength = strCookie.length;
|
||||||
var result = {};
|
var result = {};
|
||||||
|
@ -38,7 +37,8 @@ var cookies = {
|
||||||
{
|
{
|
||||||
strItem = strCookie[j].split("=");
|
strItem = strCookie[j].split("=");
|
||||||
|
|
||||||
var value = unescape(strItem[1]);
|
//var value = unescape(strItem[1]);
|
||||||
|
var value = JSON.parse(strItem[1]);
|
||||||
switch (value)
|
switch (value)
|
||||||
{
|
{
|
||||||
case "true":
|
case "true":
|
||||||
|
@ -51,18 +51,16 @@ var cookies = {
|
||||||
result[strItem[0]] = value;
|
result[strItem[0]] = value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (strSubName == strItem[0])
|
if (strSubName == strItem[0])
|
||||||
{
|
{
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 如果没有指定子项名称时,则返回一个对象,包含所有子项;
|
// If no child name is specified, an object is returned that contains all the children;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 没有子项时直接判断取值
|
// There is no child to determine the value directly
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strItem = strCookies[i].split("=");
|
strItem = strCookies[i].split("=");
|
||||||
|
@ -74,8 +72,8 @@ var cookies = {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// 设置 cookie 内容
|
// Set the cookie content
|
||||||
// value 可为对象,格式如:key:value
|
// Value can be an object, such as: key: value
|
||||||
,set:function(name,value,expireDays)
|
,set:function(name,value,expireDays)
|
||||||
{
|
{
|
||||||
var exdate=new Date();
|
var exdate=new Date();
|
||||||
|
@ -87,19 +85,21 @@ var cookies = {
|
||||||
var cookieValue = value;
|
var cookieValue = value;
|
||||||
switch (typeof(value))
|
switch (typeof(value))
|
||||||
{
|
{
|
||||||
// 如果为对象时,按格式拆分后保存
|
// Save it per object type
|
||||||
case "object":
|
case "object":
|
||||||
case "function":
|
case "function":
|
||||||
var arr = new Array();
|
var arr = new Array();
|
||||||
for (var key in value)
|
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("&");
|
cookieValue = arr.join("&");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
cookieValue = escape(value);
|
//cookieValue = escape(value);
|
||||||
|
cookieValue = JSON.stringify(value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
document.cookie=name+"=" +cookieValue+((expireDays==0)? "" :"; expires="+exdate.toGMTString());
|
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
|
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++){n=i[f].split("=")
|
for(var u={},f=0;f<r;f++){i=s[f].split("=")
|
||||||
var l=unescape(n[1])
|
var l=JSON.parse(i[1])
|
||||||
switch(l){case"true":u[n[0]]=!0
|
switch(l){case"true":u[i[0]]=!0
|
||||||
break
|
break
|
||||||
case"false":u[n[0]]=!1
|
case"false":u[i[0]]=!1
|
||||||
break
|
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])
|
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 n=new Date
|
return null},set:function(e,t,r){var i=new Date
|
||||||
void 0==r&&(r=0),n.setDate(n.getDate()+r)
|
void 0==r&&(r=0),i.setDate(i.getDate()+r)
|
||||||
var a=t
|
var n=t
|
||||||
switch(typeof t){case"object":case"function":var i=new Array
|
switch(typeof t){case"object":case"function":var s=new Array
|
||||||
for(var s in t)i.push(s+"="+escape(t[s]))
|
for(var a in t)s.push(a+"="+JSON.stringify(t[a]))
|
||||||
a=i.join("&")
|
n=s.join("&")
|
||||||
break
|
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}}
|
||||||
|
|
4
src/tr-web-control/script/min/system.min.js
vendored
4
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,7 +2,7 @@
|
||||||
var system = {
|
var system = {
|
||||||
version:"1.1 Beta"
|
version:"1.1 Beta"
|
||||||
,rootPath: "tr-web-control/"
|
,rootPath: "tr-web-control/"
|
||||||
,codeupdate:"20170522"
|
,codeupdate:"20170523"
|
||||||
,configHead: "transmission-web-control"
|
,configHead: "transmission-web-control"
|
||||||
// default config, can be customized in config.js
|
// default config, can be customized in config.js
|
||||||
,config:{
|
,config:{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user