discourse-custom-header-links/common/header.html

44 lines
837 B
HTML
Raw Normal View History

2018-06-24 02:54:36 -04:00
<script type="text/discourse-plugin" version="0.8.20">
api.decorateWidget("home-logo:after", helper => {
const titleVisible = helper.attrs.minimized;
if (titleVisible) {
2018-06-24 04:20:52 -04:00
$(".headerLink:not(.keep)").hide();
2018-06-24 02:54:36 -04:00
} else {
2018-06-24 04:20:52 -04:00
$(".headerLink").show();
2018-06-24 02:54:36 -04:00
}
});
var chl = settings.Custom_header_links;
chl.split("|").map(i => {
var seg = $.map(i.split(","), $.trim),
trgt = seg[4],
keep = seg[5];
if (trgt == "self") {
seg[4] = "";
} else {
seg[4] = "_blank";
}
if (keep != "keep") {
seg[5] = "";
}
api.decorateWidget("header-buttons:before", helper => {
return helper.h(
"li.headerLink." + seg[3] + "." + seg[5],
helper.h(
"a",
{
href: seg[2],
title: seg[1],
target: seg[4]
},
seg[0]
)
);
});
});
</script>