Last active
February 14, 2026 01:24
-
-
Save andyfutcher/fe1a4baf9ca7214de0ac818478f3293a to your computer and use it in GitHub Desktop.
Better Prompt Rocket Main JS HTMLless Snippet; this helps speed up page-speed and lighthouse scores by deferring resources until the DOM has loaded fully.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <!-- Page Customisation: START --> | |
| <!-- Page Encoding --> | |
| <meta charset="UTF-8"> | |
| <!-- Page Meta --> | |
| <title>Blank Main.JS Snippet</title> | |
| <meta name="author" content="Your Name"> | |
| <meta name="website" content="Your Website"> | |
| <meta name="description" content="Blank test page for Main.JS Project including the snippet for maximum performance!"> | |
| <meta name="robots" content="all"> | |
| <link rel="canonical" href="https://www.mainjs.org/install-snippet.html"> | |
| <noscript><base href="https://www.mainjs.org/"></noscript> | |
| <!-- Custom Main.HTML & Main.JS --> | |
| <meta property="main.js.example" content="new value here"> | |
| <!-- Page Customisation: END --> | |
| <!-- Main.JS Snippet: START --> | |
| <script> /* GNU General Public License v3.0 | |
| # Betterprompt Rocket Main.JS is a modern, lightweight and portable website JavaScript framework, Copyright (C) 2026 Better Prompt Pty Ltd. See <https://www.betterprompt.com/> for more | |
| # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. | |
| # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. | |
| # Main.JS not modified from original. Date: 2026-02-14 ### */ | |
| var main={version:{sem:{main:0,minor:8,patch:30},branch:'dev',htmlless:false},meta:{},js:{proto:{fs:'/',fs2:'//',https:'https:',http:'http:',file:'file:'},create:{base:document.createElement('base'),theme:document.createElement('link'),script:document.createElement('script'),style:document.createElement("style")},css:{loaded:false},regex:{base:/.*(\:\/\/|public\B|-html\b|-js\b|-dev\b|-rc\b|-main\b|-com\b|-com-[a-z]|-co-[a-z])[a-zA-Z0-9\-\_\.]*/i}}}; // Declare Main Object | |
| main.meta.canonical=document.querySelector('link[rel="canonical"]')||{href:null};main.meta.canonical.href=main.meta.canonical.href||main.meta.canonical.content||window.location.href.split('?')[0]; // Webpages Canonical URL | |
| main.meta.theme=document.querySelector('meta[name="theme"]')||document.querySelector('meta[property$=".theme"]')||{content:null};main.meta.theme.content=main.meta.theme.content||main.meta.theme.href||'default.css'; // Webpages Canonical URL | |
| switch(window.location.protocol){case main.js.proto.https:main.js.create.base.href=(window.location.origin+window.location.pathname).match(main.js.regex.base)[0]+main.js.proto.fs; // Origin Execution | |
| break;case main.js.proto.file:main.js.create.base.href=(window.location.protocol+main.js.proto.fs2+window.location.pathname).match(main.js.regex.base)[0]+main.js.proto.fs; // Local Execution | |
| break;case main.js.proto.http:window.location.href=main.js.proto.https+window.location.host+window.location.pathname; // Redirect to HTTPS Version | |
| break;default:if(!!main.meta.canonical.tagName){window.location.href=main.meta.canonical.href;}; // Unknown Protocol, Redirect to Canonical | |
| };main.base=main.js.create.base.href;document.head.appendChild(main.js.create.base); // Inject Base Tag | |
| Object.assign(main.js.create.theme,main.version.htmlless||{id:"main-theme",rel:"preload",as:"style",href:"main/theme/"+main.meta.theme.content+"?version="+Object.values(main.version.sem).join('.')});document.head.appendChild(main.js.create.theme).setAttribute('onload',"this.onload=null;this.rel='stylesheet'"); // Inject Lazy Loaded CSS | |
| Object.assign(main.js.create.style,{id:"main-css"});document.head.appendChild(main.js.create.style);main.js.css=Object.assign(main.js.css,{sheet:main.js.create.style.sheet.insertRule('main, footer { visibility: hidden; }',0),index:{loading:0}}); // Inject Main CSS Head | |
| Object.assign(main.js.create.script,{id:"main-js",src:"main/main.js?version="+Object.values(main.version.sem).join('.'),defer:'true'});document.head.appendChild(main.js.create.script); // Inject Deferred JS Script | |
| </script><noscript><link rel="stylesheet" href="main/theme/default.css"></noscript> | |
| <!-- Main.JS Snippet: END --> | |
| <!-- ### Main.JS insert add-on Main.JS scripts after this line. ### --> | |
| <!-- Viewport --> | |
| <meta name="generator" content="Betterprompt Rocket"> | |
| <meta name="viewport" content="width=device-width,initial-scale=1"> | |
| <link rel="icon" href="favicon.svg"><link rel="apple-touch-icon" href="favicon.svg"> | |
| </head> | |
| <body> | |
| <!-- Example Page --> | |
| <dialog role="alertdialog" open> | |
| <div id="blank-page" aria-label="Main.JS Example Install"> | |
| <div> | |
| <h1>Betterprompt Main.JS Example Install: <small><code><strong>install-snippet</strong>.html</code></small></h1> | |
| <p>This is a test page for Main.JS, use this project to install Betterprompt Main.JS on a pre-exisiting website.<br>Next steps: open the console and type <code>main</code> to ensure everything is loaded correctly...</p> | |
| <p>See this page HTML and inspect the <head> to find the Snippet: <mark>This is the preferred Installation Method!!</mark>.</p> | |
| <p class="float right"> | |
| <a href="https://example.com/" class="button">Main</a> | |
| </p> | |
| </div> | |
| </div> | |
| </dialog> | |
| </body> | |
| </html> |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@betterprompt-com Rocket is an AI-optimised, accessibility-first web template designed for the generative era. While traditional frameworks are built for human eyes, Rocket is built for Machine Understanding. By leveraging hyper-semantic HTML and a zero-dependency architecture, Rocket allows LLMs to generate, modify, and scale digital properties with perfect accuracy and minimal token overhead.
AI-Optimized Advantages
Check out Better Prompt Rocket project for more...