FILE: /Users/rbutare/websites/system/.env
CACHE=ON
FILE: /Users/rbutare/websites/apps/myapp/.env
CACHE=OFF
FILE: /Users/rbutare/websites/system/php/paths.php
{
cacheSet(url, html);
return html;
});
}
// expose for console / global access
window.spaCache = spaCache;
// AdminLTE compatibility shim
window.useCache = {
get: function(url) {
if (!window.APP_CACHE_ENABLED) return undefined;
return cacheGet(url);
},
set: function(url, html) {
if (!window.APP_CACHE_ENABLED) return;
cacheSet(url, html);
},
load: function(url) {
// AdminLTE calls load(url) with no loader argument
return cacheLoad(url, function(u) {
return fetch(u).then(r => r.text());
});
}
};
FILE: /Users/rbutare/websites/system/js/md.renderer.js
window.__SPA_DEBUG.log("md.renderer.js loaded");
// Simple Markdown Renderer
export function renderMarkdown(md) {
let html = md;
// Headers
html = html.replace(/^# (.*$)/gim, "
$1
");
html = html.replace(/^## (.*$)/gim, "$1
");
html = html.replace(/^### (.*$)/gim, "$1
");
// Bold
html = html.replace(/\*\*(.*)\*\*/gim, "$1");
// Italic
html = html.replace(/\*(.*)\*/gim, "$1");
// Links: [text](url)
html = html.replace(/
\[(.*?)\]
\((.*?)\)/gim, "$1");
// Line breaks
html = html.replace(/\n/gim, "
");
return html.trim();
}
FILE: /Users/rbutare/websites/system/js/listener.js
window.__SPA_DEBUG.log("listener.js loaded");
import { loadPage, debugLog } from "./util.js";
// SPA Link Listener
document.addEventListener("DOMContentLoaded", () => {
window.__SPA_DEBUG.log("listener.js: DOMContentLoaded");
document.querySelectorAll("[data-url]").forEach(el => {
el.addEventListener("click", e => {
e.preventDefault();
const url = el.dataset.url;
debugLog("Clicked: " + url);
loadPage(url);
});
});
document.querySelectorAll("[data-load]").forEach(el => {
el.addEventListener("click", e => {
e.preventDefault();
const url = el.dataset.load;
debugLog("Clicked: " + url);
loadPage(url);
});
});
});
FILE: /Users/rbutare/websites/apps/myapp/myapp.index.php
= APP_NAME ?>