Browse Source

edge cases: re-enable remember button when creating a new paste, refresh list and disble button upon memorizing the current paste

El RIDO 6 years ago
parent
commit
521f134638
3 changed files with 7 additions and 2 deletions
  1. 5 0
      js/privatebin.js
  2. 1 1
      tpl/bootstrap.php
  3. 1 1
      tpl/page.php

+ 5 - 0
js/privatebin.js

@@ -4411,6 +4411,10 @@ jQuery.PrivateBin = (function($, RawDeflate) {
             }
             const memory = db.transaction('pastes', 'readwrite').objectStore('pastes');
             const request = memory.add(newPaste);
+            request.onsuccess = function(e) {
+                me.refreshList();
+                $('#rememberbutton').addClass('disabled');
+            }
             return true;
         };
 
@@ -4796,6 +4800,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
 
             // show new URL in browser bar
             history.pushState({type: 'newpaste'}, document.title, url);
+            $('#rememberbutton').removeClass('disabled');
 
             TopNav.showViewButtons();
 

+ 1 - 1
tpl/bootstrap.php

@@ -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-+gTE0A/WPe61SJOCwyY3Xbo7Hyfs8fhnYn4OLiqBJpW6qnWVa/o0ycwwZ2iH6fM8XgpF4fFExMswE45cyLS/AA==" 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>
 		<!-- 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" />

+ 1 - 1
tpl/page.php

@@ -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-+gTE0A/WPe61SJOCwyY3Xbo7Hyfs8fhnYn4OLiqBJpW6qnWVa/o0ycwwZ2iH6fM8XgpF4fFExMswE45cyLS/AA==" 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>
 		<!-- 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" />