@@ -282,6 +282,33 @@ func (a *goBlog) renderOldContentWarning(hb *htmlbuilder.HtmlBuilder, p *post, b
282
282
hb .WriteElementClose ("strong" )
283
283
}
284
284
285
+ func (a * goBlog ) renderShareButton (hb * htmlbuilder.HtmlBuilder , p * post , b * configBlog ) {
286
+ if b == nil || b .hideShareButton {
287
+ return
288
+ }
289
+ hb .WriteElementOpen ("a" , "class" , "button" , "href" , fmt .Sprintf ("https://www.addtoany.com/share#url=%s%s" , a .shortPostURL (p ), lo .If (p .RenderedTitle != "" , "&title=" + p .RenderedTitle ).Else ("" )), "target" , "_blank" , "rel" , "nofollow noopener noreferrer" )
290
+ hb .WriteEscaped (a .ts .GetTemplateStringVariant (b .Lang , "share" ))
291
+ hb .WriteElementClose ("a" )
292
+ }
293
+
294
+ func (a * goBlog ) renderTranslateButton (hb * htmlbuilder.HtmlBuilder , p * post , b * configBlog ) {
295
+ if b == nil || b .hideTranslateButton {
296
+ return
297
+ }
298
+ hb .WriteElementOpen (
299
+ "a" , "id" , "translateBtn" ,
300
+ "class" , "button" ,
301
+ "href" , fmt .Sprintf ("https://translate.google.com/translate?u=%s" , a .getFullAddress (p .Path )),
302
+ "target" , "_blank" , "rel" , "nofollow noopener noreferrer" ,
303
+ "title" , a .ts .GetTemplateStringVariant (b .Lang , "translate" ),
304
+ "translate" , "no" ,
305
+ )
306
+ hb .WriteEscaped ("A ⇄ 文" )
307
+ hb .WriteElementClose ("a" )
308
+ hb .WriteElementOpen ("script" , "defer" , "" , "src" , a .assetFileName ("js/translate.js" ))
309
+ hb .WriteElementClose ("script" )
310
+ }
311
+
285
312
func (a * goBlog ) renderInteractions (hb * htmlbuilder.HtmlBuilder , rd * renderData ) {
286
313
// Start accordion
287
314
hb .WriteElementOpen ("details" , "class" , "p" , "id" , "interactions" )
@@ -609,29 +636,21 @@ func (a *goBlog) renderPostSectionSettings(hb *htmlbuilder.HtmlBuilder, rd *rend
609
636
hb .WriteElementClose ("form" )
610
637
}
611
638
612
- func (a * goBlog ) renderCollapsibleBooleanSetting (hb * htmlbuilder.HtmlBuilder , rd * renderData , path , title , description , name string , value bool ) {
613
- hb .WriteElementOpen ("details" )
614
-
615
- hb .WriteElementOpen ("summary" )
616
- hb .WriteElementOpen ("h3" )
617
- hb .WriteEscaped (title )
618
- hb .WriteElementClose ("h3" )
619
- hb .WriteElementClose ("summary" )
639
+ func (a * goBlog ) renderBooleanSetting (hb * htmlbuilder.HtmlBuilder , rd * renderData , path , description , name string , value bool ) {
640
+ hb .WriteElementOpen ("form" , "class" , "fw p" , "method" , "post" , "action" , path )
620
641
621
- hb .WriteElementOpen ("form" , "class" , "fw p" , "method" , "post" )
622
-
623
- hb .WriteElementOpen ("input" , "type" , "checkbox" , "name" , name , "id" , "cb-" + name , lo .If (value , "checked" ).Else ("" ), "" )
642
+ hb .WriteElementOpen ("input" , "type" , "checkbox" , "class" , "autosubmit" , "name" , name , "id" , "cb-" + name , lo .If (value , "checked" ).Else ("" ), "" )
624
643
hb .WriteElementOpen ("label" , "for" , "cb-" + name )
625
644
hb .WriteEscaped (description )
626
645
hb .WriteElementClose ("label" )
627
646
647
+ hb .WriteElementOpen ("noscript" )
628
648
hb .WriteElementOpen ("div" , "class" , "p" )
629
649
hb .WriteElementOpen (
630
- "input" , "type" , "submit" , "value" , a .ts .GetTemplateStringVariant (rd .Blog .Lang , "update" ), "formaction" , path ,
650
+ "input" , "type" , "submit" , "value" , a .ts .GetTemplateStringVariant (rd .Blog .Lang , "update" ),
631
651
)
632
652
hb .WriteElementClose ("div" )
653
+ hb .WriteElementClose ("noscript" )
633
654
634
655
hb .WriteElementClose ("form" )
635
-
636
- hb .WriteElementClose ("details" )
637
656
}
0 commit comments