Skip to content
kyleplo edited this page Apr 10, 2018 · 4 revisions

Welcome to UltraLangScript! UltraLangScript is a JavaScript library built for running everywhere. It is still in development, but here are the basics:

Hosting

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

Basic Syntax

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"})

Selectors

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

Classes use u(".class")

IDs

IDs use u("#id")

Tags

For tags, you just type the tag name: u("tag")

Element Nodes

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

Objects

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.

Arrays

You can also input an array of elements as a selector

Using CSS Selectors

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"))

Conflict

If you have multiple JS libraries that have a u() function, new UltraLang() does the same exact thing as u()

Clone this wiki locally