Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
autorun(reaction => {
this.activeTitle = toJS(store.activeTitle);
this.shareUrl = document.location.href;
this.shareMsg = this.activeTitle + " " + this.shareUrl;
if (varGet(store.activeItem, "metadata.fields.subtitle", false)) {
this.subtitle = store.activeItem.metadata.fields.subtitle;
} else {
this.subtitle = false;
}
// look for image on the post and make it the pin share
if (varGet(store.activeItem, "metadata.fields.images.0.src", false)) {
this.activeImage = store.activeItem.metadata.fields.images[0].src;
}
this.__disposer.push(reaction);
});
}
autorun(reaction => {
this.activeTitle = toJS(store.activeTitle);
this.shareUrl = document.location.href;
this.shareMsg = this.activeTitle + " " + this.shareUrl;
if (varGet(store.activeItem, "metadata.fields.subtitle", false)) {
this.subtitle = store.activeItem.metadata.fields.subtitle;
} else {
this.subtitle = false;
}
// look for image on the post and make it the pin share
if (varGet(store.activeItem, "metadata.fields.images.0.src", false)) {
this.activeImage = store.activeItem.metadata.fields.images[0].src;
}
this.__disposer.push(reaction);
});
}
autorun(reaction => {
this.activeTitle = toJS(store.activeTitle);
this.shareUrl = document.location.href;
this.shareMsg = this.activeTitle + " " + this.shareUrl;
if (varGet(store.activeItem, "metadata.fields.subtitle", false)) {
this.subtitle = store.activeItem.metadata.fields.subtitle;
} else {
this.subtitle = false;
}
// look for image on the post and make it the pin share
if (varGet(store.activeItem, "metadata.fields.images.0.src", false)) {
this.activeImage = store.activeItem.metadata.fields.images[0].src;
}
this.__disposer.push(reaction);
});
}
async print(e) {
// now dynamic import the footer so we don't bloat all other page loads
import("@lrnwebcomponents/haxcms-elements/lib/ui-components/layout/site-footer.js");
const type = this.type;
let content = "";
if (type === "page") {
// oh there you are
content = `
<h1>${store.activeItem.title}</h1>
<div>${store.activeItemContent}</div>`;
} else if (type === "parent") {
// everything from the parent of this page, down
const result = store.computeItems(
1,
100,
store.activeId,
"parent",
store.routerManifest,
true
);
for (var i in result) {
content += await fetch("pages/" + result[i].location + "/index.html")
.then(function(response) {
return response.text();
})
autorun(reaction => {
this.activeTitle = toJS(store.activeTitle);
this.shareUrl = document.location.href;
this.shareMsg = this.activeTitle + " " + this.shareUrl;
if (varGet(store.activeItem, "metadata.fields.subtitle", false)) {
this.subtitle = store.activeItem.metadata.fields.subtitle;
} else {
this.subtitle = false;
}
// look for image on the post and make it the pin share
if (varGet(store.activeItem, "metadata.fields.images.0.src", false)) {
this.activeImage = store.activeItem.metadata.fields.images[0].src;
}
this.__disposer.push(reaction);
});
}
autorun(reaction => {
this.activeTitle = toJS(store.activeTitle);
this.shareUrl = document.location.href;
this.shareMsg = this.activeTitle + " " + this.shareUrl;
if (varGet(store.activeItem, "metadata.fields.subtitle", false)) {
this.subtitle = store.activeItem.metadata.fields.subtitle;
} else {
this.subtitle = false;
}
// look for image on the post and make it the pin share
if (varGet(store.activeItem, "metadata.fields.images.0.src", false)) {
this.activeImage = store.activeItem.metadata.fields.images[0].src;
}
this.__disposer.push(reaction);
});
}
autorun(reaction => {
if (store.activeItem) {
this.activeItem = toJS(store.activeItem);
}
this.__disposer.push(reaction);
});
}
autorun(reaction => {
if (store.activeItem) {
this.activeGitFileLink =
varGet(store.manifest, "metadata.site.git.publicRepoUrl", "") +
store.activeItem.location;
}
this.__disposer.push(reaction);
});
}
autorun(reaction => {
this.activeItem = toJS(store.activeItem);
this.__disposer.push(reaction);
});
window.SimpleToast.requestAvailability();
autorun(reaction => {
if (store.activeItem) {
this.activeItem = toJS(store.activeItem);
}
this.__disposer.push(reaction);
});
}