-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Welcome to UltraLangScript! UltraLangScript is a JavaScript library built for running everywhere. It is still in development, but here are the basics:
There currently isn't a hosted version of UltraLangScript, so you will need to host your own. Download main.js to your server and link it with a script
tag.
You can also use this link from @kyleplo 's free service:
http://test.kyleplo.com/api/github/rawfile.php?user=UltraLang&repo=UltraLangScript&branch=master&path=main.js
The basic syntax is easy to learn. Every UltraLangScript command starts with u(selector)
and then has more after it. For example:
u("body").style({backgroundColor: "red"})
You can use selectors to select different things. They are different from CSS selectors. To use CSS selectors, see Using CSS Selectors at the bottom of this page.
Classes use u(".class")
IDs use u("#id")
For tags, you just type the tag name: u("tag")
To create headless element nodes, like document.createElement()
, enter the raw HTML: u("<p>hello</p>")
Note: Use u(element).add(elementNode)
to add headless nodes as children
You can trick UltraLangScript into thinking an object as an element by putting the object in as a selector. For example, u(window).on("load")
tricks it into thinking that the window is an element and can have events. In this case, window can actually have events.
You can also input an array of elements as a selector
By default, UltraLangScript uses it's own selectors. To use CSS complex selectors, input document.querySelector(selector)
as your selector. For example: u(document.querySelector("p + div > nav"))
Note: This only selects the first instance. For example, if you have this HTML:
<p>hello</p>
<p>world</p>
This code returns both elements:
u("p")
But this only returns the first paragraph:
u(document.querySelector("p"))
If you have multiple JS libraries that have a u()
function, new UltraLang()
does the same exact thing as u()
Support Us, By Making issues, and PR's!