summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/gtd/templates/gtd/deal_code.html15
1 files changed, 13 insertions, 2 deletions
diff --git a/app/gtd/templates/gtd/deal_code.html b/app/gtd/templates/gtd/deal_code.html
index 57f8239..1766145 100644
--- a/app/gtd/templates/gtd/deal_code.html
+++ b/app/gtd/templates/gtd/deal_code.html
@@ -42,8 +42,19 @@ body {
</textarea>
<script>
-let params = new URL(document.location).searchParams;
-var str = "####"+" ["+params.get("title")+" for"+params.get("sale")+" ("+params.get("price").substring(1)+" off)]("+params.get("url")+")\n\n+++button-group\n\n[REI]("+params.get("url")+" \"REI\"){: target=\"_blank\"}\n\n+++";
+const url = new URL(document.location);
+const params = new URLSearchParams(url.search);
+if params.has("sale"){
+ var sale = params.get("sale");
+} else {
+ var sale = "tk";
+}
+if params.has("price"){
+ var price = params.get("price").substring(1);
+} else {
+ var price = "tk";
+}
+var str = "####"+" ["+params.get("title")+" for"+sale+" ("+price+" off)]("+params.get("url")+")\n\n+++button-group\n\n[REI]("+params.get("url")+" \"REI\"){: target=\"_blank\"}\n\n+++";
function setText() {
var el = document.getElementById('link');
el.innerHTML = params.get("title") + " for $tk ($tk off)";