2018-06-24 02:54:36 -04:00
|
|
|
<script type="text/discourse-plugin" version="0.8.20">
|
2018-12-08 00:13:54 -05:00
|
|
|
let customHeaderLinks = settings.Custom_header_links;
|
2018-06-24 02:54:36 -04:00
|
|
|
|
2018-12-08 00:13:54 -05:00
|
|
|
customHeaderLinks.split("|").map(i => {
|
|
|
|
let seg = $.map(i.split(","), $.trim),
|
|
|
|
linkText = seg[0],
|
|
|
|
linkTitle = seg[1],
|
|
|
|
linkHref = seg[2],
|
2018-12-08 00:21:28 -05:00
|
|
|
deviceClass = "." + seg[3],
|
2018-12-08 00:13:54 -05:00
|
|
|
linkTarget = seg[4] === "self" ? "" : "_blank",
|
2018-12-08 00:21:28 -05:00
|
|
|
keepOnScrollClass = seg[5] === "keep" ? ".keep" : "";
|
2018-06-24 02:54:36 -04:00
|
|
|
|
|
|
|
api.decorateWidget("header-buttons:before", helper => {
|
|
|
|
return helper.h(
|
2018-12-08 00:21:28 -05:00
|
|
|
"li.headerLink" + deviceClass + keepOnScrollClass,
|
2018-06-24 02:54:36 -04:00
|
|
|
helper.h(
|
|
|
|
"a",
|
|
|
|
{
|
2018-12-08 00:13:54 -05:00
|
|
|
href: linkHref,
|
|
|
|
title: linkTitle,
|
2019-03-28 06:35:46 -04:00
|
|
|
target: linkTarget,
|
|
|
|
attributes: { "data-auto-route": "true" }
|
2018-06-24 02:54:36 -04:00
|
|
|
},
|
2018-12-08 00:13:54 -05:00
|
|
|
linkText
|
2018-06-24 02:54:36 -04:00
|
|
|
)
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
2018-12-08 00:13:54 -05:00
|
|
|
|
|
|
|
api.decorateWidget("home-logo:after", helper => {
|
|
|
|
let titleVisible = helper.attrs.minimized;
|
|
|
|
if (titleVisible) {
|
|
|
|
$(".d-header").addClass("hide-menus");
|
|
|
|
} else {
|
|
|
|
$(".d-header").removeClass("hide-menus");
|
|
|
|
}
|
|
|
|
});
|
2018-06-24 02:54:36 -04:00
|
|
|
</script>
|