From 656d955dbf2bd5a9c81dfbaa90f144d2e28df2ca Mon Sep 17 00:00:00 2001 From: zzossig Date: Sun, 2 Feb 2020 19:20:15 +0900 Subject: [PATCH] rtl ui bug fix(post title link position) --- layouts/partials/script/single-script.html | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/layouts/partials/script/single-script.html b/layouts/partials/script/single-script.html index 3a017b9..112c028 100644 --- a/layouts/partials/script/single-script.html +++ b/layouts/partials/script/single-script.html @@ -279,6 +279,9 @@ var text, clip = new ClipboardJS('.anchor'); var headers = singleContentsElem.querySelectorAll("h1, h2, h3, h4"); + {{ $languagedir := ($.Param "languagedir" | default "ltr") }} + var languagedir = JSON.parse({{ $languagedir | jsonify }}); + headers ? headers.forEach(function (elem) { var url = encodeURI(document.location.origin + document.location.pathname); @@ -292,11 +295,16 @@ var newElemInner = document.createElement('span'); newElemInner.style.fontSize = '1rem'; newElemInner.style.position = 'absolute'; - newElemInner.style.right = '-2rem'; newElemInner.style.top = '50%'; newElemInner.style.transform = 'translateY(-50%)'; newElemInner.innerText = "🔗"; + if (languagedir === "rtl") { + newElemInner.style.left = '-2rem'; + } else { + newElemInner.style.right = '-2rem'; + } + newElemOuter.append(newElemInner); elem.append(newElemOuter);