FIX: marked links should hide when topic is visible
This also includes a number of changes to make the component compatible with the latest changes to the header in core
This commit is contained in:
parent
99d36e3142
commit
caa4b16439
|
@ -1,43 +1,37 @@
|
||||||
<script type="text/discourse-plugin" version="0.8.20">
|
<script type="text/discourse-plugin" version="0.8.20">
|
||||||
api.decorateWidget("home-logo:after", helper => {
|
let customHeaderLinks = settings.Custom_header_links;
|
||||||
const titleVisible = helper.attrs.minimized;
|
|
||||||
if (titleVisible) {
|
|
||||||
$(".headerLink:not(.keep)").hide();
|
|
||||||
} else {
|
|
||||||
$(".headerLink").show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var chl = settings.Custom_header_links;
|
customHeaderLinks.split("|").map(i => {
|
||||||
|
let seg = $.map(i.split(","), $.trim),
|
||||||
chl.split("|").map(i => {
|
linkText = seg[0],
|
||||||
var seg = $.map(i.split(","), $.trim),
|
linkTitle = seg[1],
|
||||||
trgt = seg[4],
|
linkHref = seg[2],
|
||||||
keep = seg[5];
|
deviceClass = " ." + seg[3],
|
||||||
|
linkTarget = seg[4] === "self" ? "" : "_blank",
|
||||||
if (trgt == "self") {
|
keepOnScrollClass = seg[5] === "keep" ? " .keep" : "";
|
||||||
seg[4] = "";
|
|
||||||
} else {
|
|
||||||
seg[4] = "_blank";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (keep != "keep") {
|
|
||||||
seg[5] = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
api.decorateWidget("header-buttons:before", helper => {
|
api.decorateWidget("header-buttons:before", helper => {
|
||||||
return helper.h(
|
return helper.h(
|
||||||
"li.headerLink." + seg[3] + "." + seg[5],
|
"li.headerLink." + deviceClass + keepOnScrollClass,
|
||||||
helper.h(
|
helper.h(
|
||||||
"a",
|
"a",
|
||||||
{
|
{
|
||||||
href: seg[2],
|
href: linkHref,
|
||||||
title: seg[1],
|
title: linkTitle,
|
||||||
target: seg[4]
|
target: linkTarget
|
||||||
},
|
},
|
||||||
seg[0]
|
linkText
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
api.decorateWidget("home-logo:after", helper => {
|
||||||
|
let titleVisible = helper.attrs.minimized;
|
||||||
|
if (titleVisible) {
|
||||||
|
$(".d-header").addClass("hide-menus");
|
||||||
|
} else {
|
||||||
|
$(".d-header").removeClass("hide-menus");
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue