summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2024-07-02 09:11:44 -0500
committerluxagraf <sng@luxagraf.net>2024-07-02 09:11:44 -0500
commit1a6b0224bcd2cd5b13a8b09c38a998ffde0ca4a1 (patch)
tree5cd5e362d36c05a22454ac95df4a2afd3b4a1732
parent9964a8ac4c9c3036f4f0aa4a3b02fd1093a7730a (diff)
gtd: reverted deal generating code to handle any site
-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)";