mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-23 13:04:23 +00:00
Use localStorage instead of cookies
This commit is contained in:
parent
5e8c62e539
commit
740617e5ce
@ -33,9 +33,8 @@ window.addEvent('load', function(){
|
|||||||
var saveColumnSizes = function() {
|
var saveColumnSizes = function() {
|
||||||
var filters_width = $('Filters').getSize().x;
|
var filters_width = $('Filters').getSize().x;
|
||||||
var properties_height = $('propertiesPanel').getSize().y;
|
var properties_height = $('propertiesPanel').getSize().y;
|
||||||
// Save it in a cookie
|
localStorage.setItem('filters_width', filters_width);
|
||||||
Cookie.write('filters_width', filters_width);
|
localStorage.setItem('properties_height', properties_height);
|
||||||
Cookie.write('properties_height', properties_height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*MochaUI.Desktop = new MochaUI.Desktop();
|
/*MochaUI.Desktop = new MochaUI.Desktop();
|
||||||
@ -45,7 +44,7 @@ window.addEvent('load', function(){
|
|||||||
});*/
|
});*/
|
||||||
MochaUI.Desktop.initialize();
|
MochaUI.Desktop.initialize();
|
||||||
|
|
||||||
var filt_w = Cookie.read('filters_width');
|
var filt_w = localStorage.getItem('filters_width');
|
||||||
if($defined(filt_w))
|
if($defined(filt_w))
|
||||||
filt_w = filt_w.toInt();
|
filt_w = filt_w.toInt();
|
||||||
else
|
else
|
||||||
@ -112,7 +111,7 @@ window.addEvent('load', function(){
|
|||||||
.replace("%2", friendlyUnit(info.dl_info_data, false)));
|
.replace("%2", friendlyUnit(info.dl_info_data, false)));
|
||||||
$("UpInfos").set('html', "_(U: %1 - T: %2)".replace("%1", friendlyUnit(info.up_info_speed, true))
|
$("UpInfos").set('html', "_(U: %1 - T: %2)".replace("%1", friendlyUnit(info.up_info_speed, true))
|
||||||
.replace("%2", friendlyUnit(info.up_info_data, false)));
|
.replace("%2", friendlyUnit(info.up_info_data, false)));
|
||||||
if(Cookie.read('speed_in_browser_title_bar') == 'true')
|
if(localStorage.getItem('speed_in_browser_title_bar') == 'true')
|
||||||
document.title = "_(D:%1 U:%2)".replace("%1", friendlyUnit(info.dl_info_speed, true)).replace("%2", friendlyUnit(info.up_info_speed, true));
|
document.title = "_(D:%1 U:%2)".replace("%1", friendlyUnit(info.dl_info_speed, true)).replace("%2", friendlyUnit(info.up_info_speed, true));
|
||||||
else
|
else
|
||||||
document.title = "_(qBittorrent web User Interface)";
|
document.title = "_(qBittorrent web User Interface)";
|
||||||
@ -226,7 +225,7 @@ window.addEvent('load', function(){
|
|||||||
onResize: saveColumnSizes,
|
onResize: saveColumnSizes,
|
||||||
height: null
|
height: null
|
||||||
});
|
});
|
||||||
var prop_h = Cookie.read('properties_height');
|
var prop_h = localStorage.getItem('properties_height');
|
||||||
if($defined(prop_h))
|
if($defined(prop_h))
|
||||||
prop_h = prop_h.toInt();
|
prop_h = prop_h.toInt();
|
||||||
else
|
else
|
||||||
@ -258,8 +257,7 @@ window.addEvent('load', function(){
|
|||||||
$(f+"_filter").addClass("selectedFilter");
|
$(f+"_filter").addClass("selectedFilter");
|
||||||
myTable.setFilter(f);
|
myTable.setFilter(f);
|
||||||
ajaxfn();
|
ajaxfn();
|
||||||
// Remember this via Cookie
|
localStorage.setItem('selected_filter', f);
|
||||||
Cookie.write('selected_filter', f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -42,7 +42,7 @@ var dynamicTable = new Class ({
|
|||||||
this.cur = new Array();
|
this.cur = new Array();
|
||||||
this.priority_hidden = false;
|
this.priority_hidden = false;
|
||||||
this.progressIndex = progressIndex;
|
this.progressIndex = progressIndex;
|
||||||
this.filter = Cookie.read('selected_filter');
|
this.filter = localStorage.getItem('selected_filter');
|
||||||
if(!$defined(this.filter)) {
|
if(!$defined(this.filter)) {
|
||||||
this.filter = 'all';
|
this.filter = 'all';
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,18 @@
|
|||||||
|
|
||||||
----------------------------------------------------------------- */
|
----------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/* Define localStorage object for older browsers */
|
||||||
|
if (typeof localStorage == 'undefined') {
|
||||||
|
window['localStorage'] = {
|
||||||
|
getItem: function(name) {
|
||||||
|
return Cookie.read(name);
|
||||||
|
},
|
||||||
|
setItem: function(name, value) {
|
||||||
|
Cookie.write(name, value, {duration: 365 * 10});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
initializeWindows = function(){
|
initializeWindows = function(){
|
||||||
|
|
||||||
function addClickEvent(el, fn){
|
function addClickEvent(el, fn){
|
||||||
@ -269,23 +281,23 @@ initializeWindows = function(){
|
|||||||
}).send();
|
}).send();
|
||||||
});
|
});
|
||||||
|
|
||||||
updateSpeedInBrowserTitleBarLinkCheckState = function()
|
updateSpeedInBrowserTitleBarLinkCheckState = function()
|
||||||
{
|
{
|
||||||
if (Cookie.read('speed_in_browser_title_bar') == 'true')
|
if (localStorage.getItem('speed_in_browser_title_bar') == 'true')
|
||||||
$(speedInBrowserTitleBarLink).firstChild.style.opacity = '1';
|
$(speedInBrowserTitleBarLink).firstChild.style.opacity = '1';
|
||||||
else
|
else
|
||||||
$(speedInBrowserTitleBarLink).firstChild.style.opacity = '0';
|
$(speedInBrowserTitleBarLink).firstChild.style.opacity = '0';
|
||||||
}
|
}
|
||||||
|
|
||||||
updateSpeedInBrowserTitleBarLinkCheckState();
|
updateSpeedInBrowserTitleBarLinkCheckState();
|
||||||
|
|
||||||
addClickEvent('speedInBrowserTitleBar', function(e){
|
addClickEvent('speedInBrowserTitleBar', function(e){
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
var speed_in_browser_title_bar = Cookie.read('speed_in_browser_title_bar');
|
var speed_in_browser_title_bar = localStorage.getItem('speed_in_browser_title_bar');
|
||||||
speed_in_browser_title_bar = speed_in_browser_title_bar == 'true' ? 'false' : 'true';
|
speed_in_browser_title_bar = speed_in_browser_title_bar == 'true' ? 'false' : 'true';
|
||||||
Cookie.write('speed_in_browser_title_bar', speed_in_browser_title_bar, {duration: 365 * 10});
|
localStorage.setItem('speed_in_browser_title_bar', speed_in_browser_title_bar);
|
||||||
updateSpeedInBrowserTitleBarLinkCheckState(true);
|
updateSpeedInBrowserTitleBarLinkCheckState();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Deactivate menu header links
|
// Deactivate menu header links
|
||||||
$$('a.returnFalse').each(function(el){
|
$$('a.returnFalse').each(function(el){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user