summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2024-07-02 09:40:44 -0500
committerluxagraf <sng@luxagraf.net>2024-07-02 09:40:44 -0500
commit32406626b91809fa5a7e7ad4a7633667fba2a84a (patch)
tree6a33719d08ac75ff5148fd3cffddf5134e314593
parent9c9ac1128b3a2256402263549ed922bada7d743c (diff)
gtd: added generic sitename for btn
-rw-r--r--app/gtd/templates/gtd/deal_code.html8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/gtd/templates/gtd/deal_code.html b/app/gtd/templates/gtd/deal_code.html
index a54a1ed..1c4a250 100644
--- a/app/gtd/templates/gtd/deal_code.html
+++ b/app/gtd/templates/gtd/deal_code.html
@@ -42,6 +42,9 @@ body {
</textarea>
<script>
+function capitalize(s) {
+ return s && s[0].toUpperCase() + s.slice(1);
+}
var url = new URL(document.location);
var params = new URLSearchParams(url.search);
if(params.has("sale")){
@@ -54,8 +57,9 @@ if(params.has("price")){
} else {
var price = "tk";
}
-let prms = new URL(document.location).searchParams;
-var str = "####"+" ["+prms.get("title")+" for"+sale+" ("+price+" off)]("+prms.get("url")+")\n\n+++button-group\n\n[REI]("+prms.get("url")+" \"REI\"){: target=\"_blank\"}\n\n+++";
+const d = new URL(params.get("url"));
+var site = capitalize(d.hostname.split(".com")[0].substring(4));
+var str = "####"+" ["+params.get("title")+" for "+sale+" ("+price+" off)]("+params.get("url")+")\n\n+++button-group\n\n["+site+"]("+params.get("url")+" \""+site+"\"){: target=\"_blank\"}\n\n+++";
function setText() {
var el = document.getElementById('link');
el.innerHTML = params.get("title") + " for $tk ($tk off)";