mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2025-08-05 21:14:12 -04:00
refactor button refresh
This commit is contained in:
parent
521f134638
commit
2d9666c5ef
3 changed files with 19 additions and 7 deletions
|
@ -4374,9 +4374,6 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||
cursor.continue();
|
||||
} else {
|
||||
me.refreshList();
|
||||
if (isInMemory(window.location.href)) {
|
||||
$('#rememberbutton').addClass('disabled');
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -4413,11 +4410,25 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||
const request = memory.add(newPaste);
|
||||
request.onsuccess = function(e) {
|
||||
me.refreshList();
|
||||
$('#rememberbutton').addClass('disabled');
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* refresh the state of the remember button
|
||||
*
|
||||
* @name Memory.refreshButton
|
||||
* @function
|
||||
*/
|
||||
me.refreshButton = function()
|
||||
{
|
||||
if (isInMemory(window.location.href)) {
|
||||
$('#rememberbutton').addClass('disabled');
|
||||
} else {
|
||||
$('#rememberbutton').removeClass('disabled');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* refresh the displayed list from memory
|
||||
*
|
||||
|
@ -4426,6 +4437,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||
*/
|
||||
me.refreshList = function()
|
||||
{
|
||||
me.refreshButton();
|
||||
const $tbody = $('#sidebar-wrapper table tbody')[0];
|
||||
if (!$tbody) {
|
||||
return;
|
||||
|
@ -4800,7 +4812,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||
|
||||
// show new URL in browser bar
|
||||
history.pushState({type: 'newpaste'}, document.title, url);
|
||||
$('#rememberbutton').removeClass('disabled');
|
||||
Memory.refreshButton();
|
||||
|
||||
TopNav.showViewButtons();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue