|
|
@ -1216,25 +1216,29 @@ define([
|
|
|
|
return $div;
|
|
|
|
return $div;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
makeBlock('trim-history', function (cb) {
|
|
|
|
var redrawTrimHistory = function (cb, $div) {
|
|
|
|
if (!common.isLoggedIn()) { return; }
|
|
|
|
|
|
|
|
// XXX settings_trimHistoryTitle, settings_trimHistoryHint, trimHistory_button, trimHistory_error
|
|
|
|
|
|
|
|
// XXX trimHistory_success, trimHistory_confirm, trimHistory_noHistory
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//if (!privateData.isDriveOwned) { return; } // XXX
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var spinner = UI.makeSpinner();
|
|
|
|
var spinner = UI.makeSpinner();
|
|
|
|
var button = h('button.btn.btn-danger-alt', {
|
|
|
|
var button = h('button.btn.btn-danger-alt', {
|
|
|
|
disabled: 'disabled'
|
|
|
|
disabled: 'disabled'
|
|
|
|
}, Messages.trimHistory_button || 'delete history... xxx'); // XXX
|
|
|
|
}, Messages.trimHistory_button || 'delete history... xxx'); // XXX
|
|
|
|
var currentSize = h('p', $(spinner.spinner).clone()[0]);
|
|
|
|
var currentSize = h('p', $(spinner.spinner).clone()[0]);
|
|
|
|
var content = h('div', [
|
|
|
|
var content = h('div#cp-settings-trim-container', [
|
|
|
|
currentSize,
|
|
|
|
currentSize,
|
|
|
|
button,
|
|
|
|
button,
|
|
|
|
spinner.ok,
|
|
|
|
spinner.ok,
|
|
|
|
spinner.spinner
|
|
|
|
spinner.spinner
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!privateData.isDriveOwned) {
|
|
|
|
|
|
|
|
var href = privateData.origin + privateData.pathname + '#' + 'account';
|
|
|
|
|
|
|
|
$(currentSize).html(Messages.trimHistory_needMigration || 'Need migration <a>Click</a>'); // XXX
|
|
|
|
|
|
|
|
$(currentSize).find('a').prop('href', href).click(function (e) {
|
|
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
$('.cp-sidebarlayout-category[data-category="account"]').click();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
return void cb(content);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Messages.trimHistory_currentSize = 'Size XXX: <b>{0}</b>'; // XXX
|
|
|
|
Messages.trimHistory_currentSize = 'Size XXX: <b>{0}</b>'; // XXX
|
|
|
|
|
|
|
|
|
|
|
|
var $button = $(button);
|
|
|
|
var $button = $(button);
|
|
|
@ -1273,19 +1277,26 @@ define([
|
|
|
|
channels: channels
|
|
|
|
channels: channels
|
|
|
|
}, function (obj) {
|
|
|
|
}, function (obj) {
|
|
|
|
if (obj && obj.error) {
|
|
|
|
if (obj && obj.error) {
|
|
|
|
// XXX what are the possible errors?
|
|
|
|
var error = h('div.alert.alert-danger', Messages.trimHistory_error || 'error'); // XXX
|
|
|
|
|
|
|
|
$(content).empty().append(error);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
spinner.hide();
|
|
|
|
spinner.hide();
|
|
|
|
// XXX redraw this block instead of displaying a green message?
|
|
|
|
redrawTrimHistory(cb, $div);
|
|
|
|
$(currentSize).remove();
|
|
|
|
|
|
|
|
$(content).append(h('div.alert.alert-success', Messages.trimHistory_success || 'ok')); // XXX
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}).prop('disabled', '');
|
|
|
|
}).prop('disabled', '');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$div.find('#cp-settings-trim-container').remove();
|
|
|
|
cb(content);
|
|
|
|
cb(content);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
makeBlock('trim-history', function (cb, $div) {
|
|
|
|
|
|
|
|
if (!common.isLoggedIn()) { return; }
|
|
|
|
|
|
|
|
// XXX settings_trimHistoryTitle, settings_trimHistoryHint, trimHistory_button, trimHistory_error
|
|
|
|
|
|
|
|
// XXX trimHistory_success, trimHistory_confirm, trimHistory_noHistory
|
|
|
|
|
|
|
|
// XXX trimHistory_needMigration (clickable <a> tag (no attribute) to go to the "account" part of settings)
|
|
|
|
|
|
|
|
redrawTrimHistory(cb, $div);
|
|
|
|
}, true);
|
|
|
|
}, true);
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
@ -1713,7 +1724,10 @@ define([
|
|
|
|
APP.$usage = $('<div>', {'class': 'usage'}).appendTo(APP.$leftside);
|
|
|
|
APP.$usage = $('<div>', {'class': 'usage'}).appendTo(APP.$leftside);
|
|
|
|
var active = privateData.category || 'account';
|
|
|
|
var active = privateData.category || 'account';
|
|
|
|
Object.keys(categories).forEach(function (key) {
|
|
|
|
Object.keys(categories).forEach(function (key) {
|
|
|
|
var $category = $('<div>', {'class': 'cp-sidebarlayout-category'}).appendTo($categories);
|
|
|
|
var $category = $('<div>', {
|
|
|
|
|
|
|
|
'class': 'cp-sidebarlayout-category',
|
|
|
|
|
|
|
|
'data-category': key
|
|
|
|
|
|
|
|
}).appendTo($categories);
|
|
|
|
if (key === 'account') { $category.append($('<span>', {'class': 'fa fa-user-o'})); }
|
|
|
|
if (key === 'account') { $category.append($('<span>', {'class': 'fa fa-user-o'})); }
|
|
|
|
if (key === 'drive') { $category.append($('<span>', {'class': 'fa fa-hdd-o'})); }
|
|
|
|
if (key === 'drive') { $category.append($('<span>', {'class': 'fa fa-hdd-o'})); }
|
|
|
|
if (key === 'cursor') { $category.append($('<span>', {'class': 'fa fa-i-cursor' })); }
|
|
|
|
if (key === 'cursor') { $category.append($('<span>', {'class': 'fa fa-i-cursor' })); }
|
|
|
|