diff options
-rw-r--r-- | app/gtd/templates/gtd/deal_code.html | 8 |
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)"; |