Skip to content

Commit

Permalink
don't override share links with auto paste
Browse files Browse the repository at this point in the history
fixes #47
  • Loading branch information
maddyblue committed May 13, 2019
1 parent c900015 commit df3a807
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,11 @@ function b64DecodeUnicode(str) {
);
}
let search;
if (location.search) {
search = new URLSearchParams(location.search);
}
function reloadVals() {
// Load initial defaults from storage.
let sql = localStorage.getItem('sql');
Expand All @@ -719,8 +724,7 @@ function reloadVals() {
if (spVal === null) { spVal = 0; }
// Override any value from the URL.
if (location.search) {
const search = new URLSearchParams(location.search);
if (search) {
if (search.has('sql')) { sql = b64DecodeUnicode(search.get('sql')); }
if (search.has('n')) { nVal = search.get('n'); }
if (search.has('indent')) { iwVal = search.get('indent'); }
Expand Down Expand Up @@ -753,7 +757,10 @@ function autoPaste() {
});
}
}
autoPaste();
if (!search || !search.has('sql')) {
autoPaste();
}
(() => {
if (location.search) {
Expand Down

0 comments on commit df3a807

Please sign in to comment.