|
63 | 63 |
|
64 | 64 | <h2>It's your money. It's your data.<br />Back it up!</h2> |
65 | 65 |
|
| 66 | + <a |
| 67 | + class="bookmarklet" |
| 68 | + href="javascript: (function () { |
| 69 | + const confirmSpendingQubes = window.confirm( |
| 70 | + 'Click on every Spending Qube once before continuing. Ready?' |
| 71 | + ); |
| 72 | +
|
| 73 | + if (!confirmSpendingQubes) { |
| 74 | + alert( |
| 75 | + 'Please go back and click on every spending qube before downloading your data.' |
| 76 | + ); |
| 77 | + return; |
| 78 | + } |
| 79 | +
|
| 80 | + function downloadJson(jsonString, label) { |
| 81 | + var anchor = document.createElement('a'); |
| 82 | + anchor.setAttribute( |
| 83 | + 'href', |
| 84 | + 'data:application/json;charset=utf-8,' + encodeURIComponent(jsonString) |
| 85 | + ); |
| 86 | + var timestamp = new Date().toISOString().slice(0, 10); |
| 87 | + anchor.setAttribute('download', `baqup-${label} ${timestamp}.json`); |
| 88 | + anchor.setAttribute('target', '_blank'); |
| 89 | + anchor.style.display = 'none'; |
| 90 | + document.body.appendChild(anchor); |
| 91 | +
|
| 92 | + anchor.click(); |
| 93 | + } |
| 94 | +
|
| 95 | + const cache = JSON.parse(localStorage.getItem('vuex')); |
| 96 | +
|
| 97 | + const currentURL = new URL(window.location.href); |
| 98 | + if ( |
| 99 | + !cache || |
| 100 | + currentURL.protocol !== 'https:' || |
| 101 | + currentURL.hostname !== 'dashboard.qubemoney.com' |
| 102 | + ) { |
| 103 | + alert('You must be viewing Qube and logged in to download your data.'); |
| 104 | + return; |
| 105 | + } |
| 106 | +
|
| 107 | + downloadJson(localStorage.getItem('vuex'), 'account'); |
| 108 | +})(); |
| 109 | +
|
| 110 | +" |
| 111 | + >💾 BaQup Qubes</a |
| 112 | + > |
| 113 | + |
66 | 114 | <a |
67 | 115 | class="bookmarklet" |
68 | 116 | href="javascript: (function () { |
69 | 117 | if (sessionStorage.getItem('baqupRunning')) { |
70 | 118 | alert('baQup Tools is already running. Please wait for it to finish.'); |
71 | 119 | return; |
72 | 120 | } |
| 121 | +
|
| 122 | + const confirmSpendingQubes = window.confirm( |
| 123 | + 'This will download all your transactions as multiple files. Stay on the page until you see the completion message. Ready?' |
| 124 | + ); |
| 125 | +
|
| 126 | + if (!confirmSpendingQubes) { |
| 127 | + return; |
| 128 | + } |
| 129 | +
|
73 | 130 | sessionStorage.setItem('baqupRunning', true); |
74 | 131 |
|
75 | 132 | function downloadJson(jsonString, label) { |
@@ -99,8 +156,6 @@ <h2>It's your money. It's your data.<br />Back it up!</h2> |
99 | 156 | return; |
100 | 157 | } |
101 | 158 |
|
102 | | - downloadJson(localStorage.getItem('vuex'), 'account'); |
103 | | -
|
104 | 159 | function downloadTransactions(url, fileNum = 0) { |
105 | 160 | let xhr = new XMLHttpRequest(); |
106 | 161 | xhr.open('GET', url, true); |
@@ -139,7 +194,7 @@ <h2>It's your money. It's your data.<br />Back it up!</h2> |
139 | 194 | ); |
140 | 195 | })(); |
141 | 196 | " |
142 | | - >💾 BaQup My Qubes</a |
| 197 | + >💾 BaQup Transactions</a |
143 | 198 | > |
144 | 199 |
|
145 | 200 | <ol> |
|
0 commit comments