Spaces:
Running
Running
Deploy billsprig to the hub
Browse filesFiles changed (4)
473 unmodified lines474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504473 unmodified lines window.addEventListener("load", function () { navigator.serviceWorker.register("sw.js").catch(function () { /* offline cache is optional */ }); }); }
/* ---------- trade template from a link: #preset=<URL-encoded JSON> (cybermaxtools.com/invoice-templates/<trade>/) ---------- * {"title": "Plumbing invoice", "items": [["Call-out fee", "1"], ...], "terms": "Net 14", "notes": "..."}. Rates stay empty: * the person types their own prices. Nothing leaves the browser. */ function applyPreset() { var m = /[#&]preset=([^&]+)/.exec(location.hash || ""); if (!m) return; history.replaceState(null, "", location.pathname + location.search); var p; try { p = JSON.parse(decodeURIComponent(m[1])); } catch (e) { return; } if (!p || !Array.isArray(p.items) || !p.items.length) return; var cur = S.doc, mine = cur && cur.to && String(cur.to.name || "").trim() && cur.number !== "INV-0042"; if (mine && !window.confirm("Replace your current draft with the " + String(p.title || "trade") + " template? Save it to history first if you need it.")) return; var d = newDoc("invoice"); d.items = p.items.slice(0, 30).map(function (r) { var q = String((r && r[1]) || "1").slice(0, 12); return { desc: String((r && r[0]) || "").slice(0, 200), qty: /^\d+(\.\d+)?$/.test(q) ? q : "1", rate: "", tax: "", disc: "" }; }); if (typeof p.terms === "string" && p.terms.length < 40) { d.terms = p.terms; var td = C.termDays(d.terms); if (td != null) d.due = C.addDays(d.date, td); } if (typeof p.notes === "string") d.notes = p.notes.slice(0, 600); S.doc = doc = d; save(); setTimeout(function () { toast((p.title ? String(p.title).slice(0, 60) + " loaded" : "Template loaded") + ". Type your own rates, then add your business and client."); }, 400); } applyPreset();
/* ---------- start ---------- */ fillSelects(); toForm();246 unmodified lines24724824925025125225025125225325425510 unmodified lines266267268269269270246 unmodified lines <a href="https://cybermax-tools-cybermax.static.hf.space/menumoor/index.html" target="_blank" rel="noopener">Menumoor · menus & price lists</a> <a href="https://cybermax-tools-cybermax.static.hf.space/sigsprig/index.html" target="_blank" rel="noopener">Sigsprig · email signatures</a> <a href="https://cybermax-tools-cybermax.static.hf.space/profit-margin-calculator/index.html" target="_blank" rel="noopener">Profit margin calculator</a> <a href="https://noticewright.cybermax-tools.workers.dev/" target="_blank" rel="noopener">Noticewright · privacy policy generator</a> <a href="https://scanmoor.cybermax-tools.workers.dev/" target="_blank" rel="noopener">Scanmoor · QR codes</a> <a href="https://cybermax.cybermax-tools.workers.dev/store/?utm_source=billsprig&utm_medium=more-from" target="_blank" rel="noopener">CyberMax Store</a> <a href="https://noticewright.cybermaxtools.com/" target="_blank" rel="noopener">Noticewright · privacy policy generator</a> <a href="https://scanmoor.cybermaxtools.com/" target="_blank" rel="noopener">Scanmoor · QR codes</a> <a href="https://cybermaxtools.com/store/?utm_source=billsprig&utm_medium=more-from" target="_blank" rel="noopener">CyberMax Store</a> </div> <div class="copy">© 2026 CyberMax. All rights reserved. · Support: <a href="mailto:cybermax.tools@gmail.com">cybermax.tools@gmail.com</a></div> </footer>10 unmodified lines<script src="lib/calc.js"></script><script src="lib/pdf.js"></script><script src="app.js"></script><!-- cybermax-count:start --><script>(function(){try{var u="https://data.cybermax-tools.workers.dev/v?p="+encodeURIComponent(location.host+location.pathname)+"&r="+encodeURIComponent((document.referrer||"").split("/")[2]||"")+(function(){var q=new URLSearchParams(location.search),s=q.get("utm_source");return s?"&us="+encodeURIComponent(s)+"&uc="+encodeURIComponent(q.get("utm_campaign")||""):""})();navigator.sendBeacon?navigator.sendBeacon(u):(new Image).src=u}catch(e){}})()</script><!-- cybermax-count:end --></body></body></html>1 unmodified line23456567893 unmodified lines131415161617181819202138 unmodified lines606162636364656632 unmodified lines991001011021031021031041051061071081091101101111121131 unmodified line * self-contained). Extends pro.js with several plans (monthly, yearly, one-time) and a re-check for subscriptions. * Config before this script: * window.CMX_PRO = { id, name, perks: [..], plans: [{ offer, label, price, per, note, best }], free: "one line" } * Buy: counted link https://data.cybermax-tools.workers.dev/buy/<offer>?s=app-<id> -> Stripe Payment Link. * After checkout Stripe sends the buyer to data.cybermax-tools.workers.dev/unlock/<id>?session_id=..., which checks the * Buy: counted link https://data.cybermaxtools.com/buy/<offer>?s=app-<id> -> Stripe Payment Link. * After checkout Stripe sends the buyer to data.cybermaxtools.com/unlock/<id>?session_id=..., which checks the * Checkout Session (and, for a subscription, that it is still active) and returns here with #cmx-pro=<session id>. * The app checks that code once (/unlock/<id>?json=1&session_id=..) and remembers Pro in this browser; it re-checks every * 3 days, so a cancelled subscription turns off by itself (one tiny request per buyer every 3 days, none for free users).3 unmodified lines "use strict"; var C = window.CMX_PRO || {}; if (!C.id) return; var DATA = "https://data.cybermax-tools.workers.dev"; var DATA = "https://data.cybermaxtools.com"; var KEY = "cmx-pro:" + C.id; var SID = /^cs_(live|test)_[A-Za-z0-9]{10,200}$/; var SID = /^(cs_(live|test)_[A-Za-z0-9]{10,200}|[A-Z0-9]{8}-[A-Z0-9]{8}-[A-Z0-9]{8}-[A-Z0-9]{8})$/i; // Stripe order code or Gumroad licence key var RECHECK = 3 * 864e5; var listeners = [];
38 unmodified lines
// Convert kit (funnel beacons, real proof, email capture, phone buy bar), loaded from the CyberMax Store; optional: // if it can't load (offline), the app and the Pro box work exactly the same. var KIT = "https://cybermax.cybermax-tools.workers.dev/store/convert.js", kitQ = []; var KIT = "https://cybermaxtools.com/store/convert.js", kitQ = []; function conv(fn) { if (window.CMXConvert) return fn(window.CMXConvert); kitQ.push(fn);32 unmodified lines el.innerHTML = '<h2>' + esc(C.name) + ' Pro</h2>' + (C.free ? '<p class="cmx-pro-small">Free: ' + esc(C.free) + "</p>" : "") + "<ul>" + C.perks.map(function (p) { return "<li>" + esc(p) + "</li>"; }).join("") + '</ul><div class="cmx-plans">' + plans + '</div><p class="cmx-pro-small">Secure Stripe checkout. Pro turns on the moment you pay; no account needed.' + (subs ? " Subscriptions cancel any time from your receipt email." : " One payment, no subscription.") + ' 14-day promise: if it doesn\'t work as described, we fix it or refund you in full (<a href="https://cybermax.cybermax-tools.workers.dev/terms#payments" target="_blank" rel="noopener">terms</a>). Questions: <a href="mailto:cybermax.tools@gmail.com">cybermax.tools@gmail.com</a></p><div class="cmx-pro-proof"></div><div class="cmx-pro-cap"></div>' + '<details><summary>Already bought Pro?</summary><form id="cmx-pro-form"><label>Unlock code <input id="cmx-pro-code" autocomplete="off" placeholder="cs_live_…"></label> <button class="btn ghost" type="submit">Unlock</button></form></details><p id="cmx-pro-msg" class="cmx-pro-small" aria-live="polite"></p>'; ' 14-day promise: if it doesn\'t work as described, we fix it or refund you in full (<a href="https://cybermaxtools.com/terms#payments" target="_blank" rel="noopener">terms</a>). Questions: <a href="mailto:cybermax.tools@gmail.com">cybermax.tools@gmail.com</a></p><div class="cmx-pro-proof"></div><div class="cmx-pro-cap"></div>' + '<details><summary>Already bought Pro?</summary><form id="cmx-pro-form"><label>Unlock code <input id="cmx-pro-code" autocomplete="off" placeholder="cs_live_… or Gumroad licence key"></label> <button class="btn ghost" type="submit">Unlock</button></form></details><p id="cmx-pro-msg" class="cmx-pro-small" aria-live="polite"></p>'; Array.prototype.forEach.call(el.querySelectorAll("a.cmx-plan"), function (a) { a.addEventListener("click", function () { conv(function (K) { K.event("upgrade-click", C.id); }); }); }); conv(function (K) { K.proof(el.querySelector(".cmx-pro-proof"), C.id); K.capture(el.querySelector(".cmx-pro-cap"), { list: "weekly-" + C.id, src: "app-" + C.id, label: "Not ready for Pro? Email me " + C.name + " tips and new features (about once a week)" }); }); var f = document.getElementById("cmx-pro-form"); if (f) f.onsubmit = function (e) { e.preventDefault(); var c = (document.getElementById("cmx-pro-code").value || "").trim(); if (SID.test(c)) unlock(c); else toast("Paste the code from your receipt page (it starts with cs_live_)."); }; if (f) f.onsubmit = function (e) { e.preventDefault(); var c = (document.getElementById("cmx-pro-code").value || "").trim(); if (SID.test(c)) unlock(c); else toast("Paste the code from your receipt page (it starts with cs_live_) or your Gumroad licence key."); }; }
function apply() {122345/* Billsprig offline cache. © 2026 CyberMax. All rights reserved. */var CACHE = "billsprig-v1";var CACHE = "billsprig-v2";var FILES = ["./", "index.html", "style.css", "pro.js", "lib/calc.js", "lib/pdf.js", "app.js", "manifest.webmanifest", "icon.svg", "icon-192.png", "icon-512.png"];self.addEventListener("install", function (e) { e.waitUntil(caches.open(CACHE).then(function (c) { return c.addAll(FILES); }).then(function () { return self.skipWaiting(); }));billsprig/app.js+25
billsprig/index.html+4-4
billsprig/pro.js+8-8
billsprig/sw.js+1-1