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 filters_width = $('Filters').getSize().x;
|
||||
var properties_height = $('propertiesPanel').getSize().y;
|
||||
// Save it in a cookie
|
||||
Cookie.write('filters_width', filters_width);
|
||||
Cookie.write('properties_height', properties_height);
|
||||
localStorage.setItem('filters_width', filters_width);
|
||||
localStorage.setItem('properties_height', properties_height);
|
||||
}
|
||||
|
||||
/*MochaUI.Desktop = new MochaUI.Desktop();
|
||||
@ -45,7 +44,7 @@ window.addEvent('load', function(){
|
||||
});*/
|
||||
MochaUI.Desktop.initialize();
|
||||
|
||||
var filt_w = Cookie.read('filters_width');
|
||||
var filt_w = localStorage.getItem('filters_width');
|
||||
if($defined(filt_w))
|
||||
filt_w = filt_w.toInt();
|
||||
else
|
||||
@ -112,7 +111,7 @@ window.addEvent('load', function(){
|
||||
.replace("%2", friendlyUnit(info.dl_info_data, false)));
|
||||
$("UpInfos").set('html', "_(U: %1 - T: %2)".replace("%1", friendlyUnit(info.up_info_speed, true))
|
||||
.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));
|
||||
else
|
||||
document.title = "_(qBittorrent web User Interface)";
|
||||
@ -226,7 +225,7 @@ window.addEvent('load', function(){
|
||||
onResize: saveColumnSizes,
|
||||
height: null
|
||||
});
|
||||
var prop_h = Cookie.read('properties_height');
|
||||
var prop_h = localStorage.getItem('properties_height');
|
||||
if($defined(prop_h))
|
||||
prop_h = prop_h.toInt();
|
||||
else
|
||||
@ -258,8 +257,7 @@ window.addEvent('load', function(){
|
||||
$(f+"_filter").addClass("selectedFilter");
|
||||
myTable.setFilter(f);
|
||||
ajaxfn();
|
||||
// Remember this via Cookie
|
||||
Cookie.write('selected_filter', f);
|
||||
localStorage.setItem('selected_filter', f);
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -42,7 +42,7 @@ var dynamicTable = new Class ({
|
||||
this.cur = new Array();
|
||||
this.priority_hidden = false;
|
||||
this.progressIndex = progressIndex;
|
||||
this.filter = Cookie.read('selected_filter');
|
||||
this.filter = localStorage.getItem('selected_filter');
|
||||
if(!$defined(this.filter)) {
|
||||
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(){
|
||||
|
||||
function addClickEvent(el, fn){
|
||||
@ -271,7 +283,7 @@ initializeWindows = 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';
|
||||
else
|
||||
$(speedInBrowserTitleBarLink).firstChild.style.opacity = '0';
|
||||
@ -281,10 +293,10 @@ initializeWindows = function(){
|
||||
|
||||
addClickEvent('speedInBrowserTitleBar', function(e){
|
||||
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';
|
||||
Cookie.write('speed_in_browser_title_bar', speed_in_browser_title_bar, {duration: 365 * 10});
|
||||
updateSpeedInBrowserTitleBarLinkCheckState(true);
|
||||
localStorage.setItem('speed_in_browser_title_bar', speed_in_browser_title_bar);
|
||||
updateSpeedInBrowserTitleBarLinkCheckState();
|
||||
});
|
||||
|
||||
// Deactivate menu header links
|
||||
|
Loading…
x
Reference in New Issue
Block a user