๐ Interpreter Language Documentation (v5.0)
๐ง What is Interpreter Language?
Interpreter Language is a lightweight plugin language for creating widgets such as counters, buttons, inputs, and draggable items or even changing styles and outlook of the target page without writing JavaScript directly. Manifest V3 safe processing of user modification.
Everything is written using easy-to-read commands (all described in this documentation)
This Documentation will guide you step-by-step, if you're new to this!
Basic Structure
//=============addon===============
//name : "NewPlugin"
//version : "1.0"
//Author : "You"
//uuid : "random-uuid-here"
//min-environment : "required.engine.version.in.numbers"
//=================================
// then the code starts
๐งฎ Variables, Constants, and Strings
You can define memory variables and constants that act just like JavaScript variables. You can combine strings and variables using the + sign.
variable myvar = "Hello! you can change me"; constant myconst = "wow , I won't change"; variable emptyvar; emptyvar = 100;
variable greeting = myVar + " World! " + emptyVar; variable customMessage = pastvariable + "th time " + aconstant;
The loadtextfrom() wrapper works like javascript's ${}. You can embed it inside quotes, inside math blocks, and even in CSS.
myVar = "Today is loadtextfrom(date.format="dayname")"; myConst = loadtextfrom(localstorage.score);
create div with id(#app)^^ <p>loadtextfrom(myVar)</p> ^^;
๐ข Math Engine (maybe unstable)
Language supports math calculation logics. You can calculate dynamically using standard math syntax inside a math(...) command block.
variable day = 25; variable total = math((day*100) + (day/5)); variable squared = math(day^2);
Functions like rounding, generating random numbers, and formatting string decimals:
variable rounded = math(round(12.6)); // Returns 13 variable floored = math(floor(12.6)); // Returns 12 variable ceiled = math(ceil(12.1)); // Returns 13 variable randNum = math(random * 100); // Random number between 0 and 100 variable fixed = math((12.3456).tofixed(2)); // Returns "12.35"
Because loadtextfrom() works everywhere, you can seamlessly bring in storage inside math blocks.
variable dynTotal = math(loadtextfrom(localstorage.count) * 2 + 5);
create div with id(#app)^^ <p>Calculated value: loadtextfrom(math(total + 10))</p> ^^;
๐ฃ Grab from DOM directly
You can retrieve live data from elements on the page. Directly capture innerText, innerHTML, values, and styles from any element using the element(#id).property syntax wrapped in loadtextfrom().
variable liveText = loadtextfrom(element(#titleText).innerText); variable rawHTML = loadtextfrom(element(.my-container).innerHTML); variable typedInput = loadtextfrom(element(#usernameInput).value); variable boxStyle = loadtextfrom(element(#app).style);
๐ Logic (If / ElseIf / Else)
Conditional logic if, elseif, and else statements nearly similar to javascript.
variable myvar = "11";
if(myvar == "11").exec{
update.element("#status").innerHTML("It is 11!");
}
else.exec{update.element("#status").innerHTML("It is NOT 11!");}
variable power = 9001;
if(power < 5000).exec{
update.element("#scouter").innerHTML("Weak");
}
elseif(power > 9000).exec{
update.element("#scouter").innerHTML("Strong");
}
else.exec{
update.element("#scouter").innerHTML("Meh");
}
==, !=, >, <, >=, <=, and === are supported.Run any interpreter code inside the
exec{....} block.
๐ฆ Creating Elements (Line sensitive)
Step 1 :
create div with id(#hello)^^
Don't write content in the same line with this command.(line gap must)
^^; on its own line.
create div with id(#hello)^^ <p>Welcome!</p> ^^;
๐๏ธ DOM Update (Dynamic)
Use update.element(...) to modify text, style, HTML and other properties dynamically.
update.element("#hello").innerHTML("New title!");
update.element(".classname").innerText(loadtextfrom(myVar)); //updates all element with this class
update.element("#msg").innerHTML("Status: loadtextfrom(localstorage.status)");
update.element("#hitext").setattribute("placeholder", "Type here...");
update.element(".box").style("color", "red"); //updates all element with this class
update.element("#box").style("color: loadtextfrom(myColor);");
โฑ๏ธ Timer Function
Use the timer function to execute commands after a delay or at regular intervals.It allows execution of code blocks after a delay or repeatedly.
Specify the time in ms (milliseconds), s (seconds) or just numbers (milliseconds by default).
timer.once(1000).exec{ update.element("#box").style("color", "red"); };
timer.once(1s).exec{ update.element("#box").style("color", "blue"); };
timer.loop(2s).exec{
inc localstorage.counter;
update.element("#display").innerHTML(loadtextfrom(localstorage.counter));
};
๐พ Using Storage
Language supports persistent storage through localstorage.
set localstorage.score = "100";
inc localstorage.count; dec localstorage.count; reset localstorage.count;
๐ฉ State Management (Enable/Disable)
Set hidden "flags" or states using the enable and disable commands.
This command doesn't look usefull , but added for Cool New Tab's support.
enable featureX;
๐ฏ Event Listeners (Click Actions)
React to clicks, using create eventlistener-on(#id)-doing^^ ... ^^; code block.
Only click listener for now , will add more listener compatibility in future.
create eventlistener-on(#plus)-doing^^
inc localstorage.count;
update.element("#thenumber").innerHTML(loadtextfrom(localstorage.count));
^^;
๐ง Getting Input Values
Get the text typed inside an input field and save it to storage using the element(#id).value syntax.
#myinput when a button is clicked:create eventlistener-on(#savebtn)-doing^^ set localstorage.text = loadtextfrom(element(#myinput).value); ^^;
๐ Date Format
To show formatted dates, use:
loadtextfrom(date.format="dd/mm/yyyy dayname")
To get the current timestamp in milliseconds (like JavaScript's Date.now()), use:
loadtextfrom(date.now)
List:
dd= day number (01โ31)mm= month number (01โ12)mtext= full month name (June)mtxt= short month name (Jun)yyyy= full year (2025)yy= short year (25)dayname= full weekday name (Friday)day= short weekday name (Fri)date.now= number of milliseconds since January 1, 1970
โฐ Time Format
Show the current time using time.format. Supports 12-hour and 24-hour formats.
loadtextfrom(time.format.12h="hh:mm:ss Period")Result: 04:12:43 PM
If .12h or .24h not specified , it uses 24-hour time by default. Also ignores the Period keyword if added.
loadtextfrom(time.format.24h="hh:mm:ss Period") loadtextfrom(time.format.24h="hh:mm:ss") loadtextfrom(time.format="hh:mm:ss")All Results same : 16:12:43
hh= 2-digit hour 04, 16h= 1-digit hour preferred 4, 16mm= 2-digit minute 05 , 45m= 1-digit minute preferred 5 , 45ss= 2-digit second 09 , 43s= 1-digit second preferred 9 , 43Period= AM / PM (uppercase)period= am / pm (lowercase)
๐ Search Widget
Attach a search input box to a link search with a button:
create searcher for-(https://google.com/search?q=!!gettextfrominputid!!)-inputid(#input)-buttonid(#btn)
๐จ Applying CSS (Line sensitive)
To add CSS styles, start with set override css = ^^
and go to next line and write css styles
and final line close with ^^;
variable themeColor = "#121212";
set override css = ^^
body {
background: loadtextfrom(themeColor);
color: white;
}
^^;
๐ฆ Making Elements Draggable
To make an element draggable, add dragmovable attribute to the element's div:
<div dragmovable>Drag me!</div>
You can also add offsets or save position:
<div dragmovable="-5,-5">Offset drag</div> <div dragmovable="-5,-5,stored">Saved position</div>
๐งช Full Example
set override css = ^^
#app { background: black; color: white; padding: 20px; }
^^;
default localstorage.count = 0;
create div with id(#app)^^
<h1>Counter</h1>
<p>Count: <span id="countDisplay">loadtextfrom(localstorage.count)</span></p>
<button id="plus">+</button>
<button id="minus">-</button>
^^;
create eventlistener-on(#plus)-doing^^
inc localstorage.count;
update.element("#countDisplay").innerHTML(loadtextfrom(localstorage.count));
^^;
create eventlistener-on(#minus)-doing^^
dec localstorage.count;
update.element("#countDisplay").innerHTML(loadtextfrom(localstorage.count));
^^;
๐ Rules You Must Follow
- In the editor
//uuidcan't be deleted , you can click it to generate a new one - Never write content inline like
create div ^^ <p>Hi</p> ^^;on line sensitive commands. Must use new lines.
๐ก Tips
-
Just make the New tab Cooler โจ