mirror of
https://github.com/arfct/itty-bitty.git
synced 2026-03-11 08:54:33 +00:00
Update Script sources
This commit is contained in:
parent
96fdfcfa43
commit
9083fa1f90
9 changed files with 16 additions and 14 deletions
|
|
@ -67,6 +67,7 @@ function loadSyle(href, callback) {
|
|||
function renderScriptContent(data, origin) {
|
||||
var base = el('base', {href: data.script});
|
||||
document.head.appendChild(base);
|
||||
window.script = data.script
|
||||
window.params = data;
|
||||
window.params.origin = origin;
|
||||
console.log("🖊 Rendering with", {script:data.script, params:data})
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
let script = document.currentScript?.src
|
||||
let script = window.script
|
||||
|
||||
var cssURL = "/render/axiom.css";
|
||||
Promise.all([loadSyle(cssURL)]).then(render);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,9 @@ let barName = ua.match(/Chrome/i) ? "Bookmarks" : "Favorites"
|
|||
let managerName = ua.match(/Edge/i) ? "Favorites" : "Bookmarks"
|
||||
let cmdKey = ua.match(/Mac/i) ? "⇧⌘B" : "Ctrl + Shift + B"
|
||||
|
||||
loadSyle(document.currentScript.src.replace("js", "css")).then(() => {
|
||||
let script = window.script;
|
||||
|
||||
loadSyle(script.replace("js", "css")).then(() => {
|
||||
document.body.appendChild(
|
||||
el("div", {id:"content"},
|
||||
el("div", {className:"description"}, params.info?.d ?? ""),
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
let script = document.currentScript?.src || import.meta?.url;
|
||||
let script = window.script;
|
||||
|
||||
function render() {
|
||||
let colors = params.body;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
let script = document.currentScript?.src || import.meta?.url;
|
||||
let script = window.script;
|
||||
|
||||
// import Color from "https://colorjs.io/dist/color.js";
|
||||
import Color from "/js/color.min.js";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
loadSyle(document.currentScript.src.replace("js", "css"))
|
||||
loadSyle(window.script.replace("js", "css"))
|
||||
|
||||
try {
|
||||
let filename = params.title
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
loadSyle(document.currentScript.src.replace("js", "css"))
|
||||
loadSyle(window.script.replace("js", "css"))
|
||||
|
||||
loadScript("https://unpkg.com/ipfs@0.63.2/dist/index.min.js", (scr) => {
|
||||
let cid = params.url.replace("ipfs:",'');
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
let script = document.currentScript;
|
||||
let reformat = true;
|
||||
|
||||
FRACTION_MAP = {
|
||||
let FRACTION_MAP = {
|
||||
'1/4': '\u00BC',
|
||||
'1/2': '\u00BD',
|
||||
'3/4': '\u00BE',
|
||||
|
|
@ -191,7 +190,7 @@ function render() {
|
|||
let image = json.image;
|
||||
if (Array.isArray(image)) image = image.shift();
|
||||
image = image?.url || image;
|
||||
instructions = json.recipeInstructions;
|
||||
let instructions = json.recipeInstructions;
|
||||
let title = clean(json.name);
|
||||
let description = clean(json.description);
|
||||
parent.postMessage({title:title, favicon:"🍴", image:image, description:description, wakeLock:true, updateURL:true}, "*");
|
||||
|
|
@ -274,8 +273,8 @@ function render() {
|
|||
|
||||
|
||||
|
||||
let yield = (getStringProperty(json.recipeYield));
|
||||
if (!isNaN(parseInt(yield?.charAt(yield?.length - 1)))) yield += " servings";
|
||||
let recipeYield = (getStringProperty(json.recipeYield));
|
||||
if (!isNaN(parseInt(recipeYield?.charAt(recipeYield?.length - 1)))) recipeYield += " servings";
|
||||
|
||||
function imgload(e) {
|
||||
console.log(e, "img");
|
||||
|
|
@ -307,7 +306,7 @@ function render() {
|
|||
),
|
||||
m("h1", title),
|
||||
m(".metadata",
|
||||
(yield) ? m("div", m("span.yield", m(".icon.material-icons-outlined", "restaurant"), yield)) : null,
|
||||
(recipeYield) ? m("div", m("span.yield", m(".icon.material-icons-outlined", "restaurant"), recipeYield)) : null,
|
||||
json.totalTime ? m(".time",
|
||||
m(".icon.material-icons-outlined", "timer"),
|
||||
|
||||
|
|
@ -351,7 +350,7 @@ function render() {
|
|||
)
|
||||
}
|
||||
|
||||
var path = script.src.substring(0, script.src.lastIndexOf("."));
|
||||
var path = window.script.substring(0, window.script.lastIndexOf("."));
|
||||
var cssURL = path + ".css";
|
||||
loadSyle("https://fonts.googleapis.com/icon?family=Material+Icons+Outlined")
|
||||
.then(() => loadSyle(cssURL)).then(render);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
let script = document.currentScript?.src || import.meta?.url;
|
||||
let script = window.script;
|
||||
|
||||
loadScript(params.url);
|
||||
Loading…
Reference in a new issue