Create header.html

This commit is contained in:
Joe 2018-06-24 14:54:36 +08:00 committed by GitHub
parent d8ff59fc33
commit 4284b0be89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 43 additions and 0 deletions

43
common/header.html Normal file
View File

@ -0,0 +1,43 @@
<script type="text/discourse-plugin" version="0.8.20">
api.decorateWidget("home-logo:after", helper => {
const titleVisible = helper.attrs.minimized;
if (titleVisible) {
$(".headerLink:not(.keep)").fadeOut("fast");
} else {
$(".headerLink").fadeIn("fast");
}
});
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>