mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2024-12-25 07:19:31 -05:00
refactor button refresh
This commit is contained in:
parent
521f134638
commit
2d9666c5ef
@ -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();
|
||||
|
||||
|
@ -72,7 +72,7 @@ endif;
|
||||
?>
|
||||
<script type="text/javascript" data-cfasync="false" src="js/purify-2.0.8.js" integrity="sha512-QwcEKGuEmKtMguCO9pqNtUtZqq9b/tJ8gNr5qhY8hykq3zKTlDOvpZAmf6Rs8yH35Bz1ZdctUjj2qEWxT5aXCg==" crossorigin="anonymous"></script>
|
||||
<script type="text/javascript" data-cfasync="false" src="js/legacy.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-LYos+qXHIRqFf5ZPNphvtTB0cgzHUizu2wwcOwcwz/VIpRv9lpcBgPYz4uq6jx0INwCAj6Fbnl5HoKiLufS2jg==" crossorigin="anonymous"></script>
|
||||
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-S+8e9MIqQbr3mdXYEZcZSwMxclYc1Dgr9uf35SpiFBCas5siCn451wjWyqJXof8MrJ+KNsNwocn8VsogXEr+YA==" crossorigin="anonymous"></script>
|
||||
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-CYFmIQfVQMeo0eSf4j+PNmc+RuTN0efNsEzHI8u1Os53/fYhcTcPya30ayE6O1DjsnhmyY9WQS10RN7RcC0SLQ==" crossorigin="anonymous"></script>
|
||||
<!-- icon -->
|
||||
<link rel="apple-touch-icon" href="img/apple-touch-icon.png?<?php echo rawurlencode($VERSION); ?>" sizes="180x180" />
|
||||
<link rel="icon" type="image/png" href="img/favicon-32x32.png?<?php echo rawurlencode($VERSION); ?>" sizes="32x32" />
|
||||
|
@ -50,7 +50,7 @@ endif;
|
||||
?>
|
||||
<script type="text/javascript" data-cfasync="false" src="js/purify-2.0.8.js" integrity="sha512-QwcEKGuEmKtMguCO9pqNtUtZqq9b/tJ8gNr5qhY8hykq3zKTlDOvpZAmf6Rs8yH35Bz1ZdctUjj2qEWxT5aXCg==" crossorigin="anonymous"></script>
|
||||
<script type="text/javascript" data-cfasync="false" src="js/legacy.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-LYos+qXHIRqFf5ZPNphvtTB0cgzHUizu2wwcOwcwz/VIpRv9lpcBgPYz4uq6jx0INwCAj6Fbnl5HoKiLufS2jg==" crossorigin="anonymous"></script>
|
||||
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-S+8e9MIqQbr3mdXYEZcZSwMxclYc1Dgr9uf35SpiFBCas5siCn451wjWyqJXof8MrJ+KNsNwocn8VsogXEr+YA==" crossorigin="anonymous"></script>
|
||||
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-CYFmIQfVQMeo0eSf4j+PNmc+RuTN0efNsEzHI8u1Os53/fYhcTcPya30ayE6O1DjsnhmyY9WQS10RN7RcC0SLQ==" crossorigin="anonymous"></script>
|
||||
<!-- icon -->
|
||||
<link rel="apple-touch-icon" href="img/apple-touch-icon.png?<?php echo rawurlencode($VERSION); ?>" sizes="180x180" />
|
||||
<link rel="icon" type="image/png" href="img/favicon-32x32.png?<?php echo rawurlencode($VERSION); ?>" sizes="32x32" />
|
||||
|
Loading…
Reference in New Issue
Block a user