JS TS (TuxedoScript 16.8.7)
Inspiration: ECMA Script6, CoffeeScript, Java, and Python
Not for use in IE
A Pen by Mink CBOS - Ephellon Dantzler on CodePen.
/******** | |
---- Tuxedo Baseline ---- | |
-- Special (a.k.a "pa.t.ch" [patches]) -- | |
<$n> ... </$n> - no.t.ch, any code put between the html-like tags will be treated as native JS | |
<$s> ... </$s> - so.t.ch, any code put between the html-like tags will be parsed as some TS, then JS (shorcuts, and threads can be used) | |
<$t> ... </$t> - to.t.ch, no need, just a proposal | |
-- Comments -- | |
## - single line comment, or multi-line comment ending | |
#* - multi-line comment starter | |
#*# - multi-line comment starter ("author tags", or "embroider tags") | |
@aut - author | |
@lie - license | |
@dat - date | |
@tie - time | |
@url - url | |
@ver - version | |
##! - strict mode | |
## +thread - enable an html-attribute via inline script | |
can be: advance clean eval greek hide html-editor js-editor js-unit legacy math ugly wordy | |
## -thread - disable an html-attribute via inline script | |
can be: advance clean eval greek hide html-editor js-editor js-unit legacy math ugly wordy | |
## @x - emulates that JS version: 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.8.1, 1.8.5 | |
## *a: b; - replace all $a with b (soft baste) | |
## **a: b; - replace all $a with parsed b (hard baste) | |
## /abc/gmiyu = $1 - replace with regexp | |
-- Sequences and Strings -- | |
\c - escape character, for use in/out of strings (darns) | |
can be: / \ & ? : ; . @ # % $ < > + - * ( ) [ ] { } | ^ | |
`...` - multiline string /runs script/ | |
`...!white-sapce` - removes extra white space characters /!white-space can be put anywhere in the string/ | |
-- Variables -- | |
#a - var a | |
a--b - a_b | |
a#b - a[b] | |
a#0b - a[a.length - b] | |
@ - this or self, depending on the JS version | |
# - this or self, depending on the JS version | |
@a - this.a | |
$of - typeof | |
$del - delete | |
$args - arguments | |
$doc - document | |
$win - window | |
$nav - navigator | |
$loc - location | |
$cont - continue | |
$con - console | |
$# - Object | |
$Obj - Object | |
$obj - Object | |
.$id - getElementById | |
.$class - getElementsByClassName | |
.$tag - getElementsByTagName | |
.$html - innerHTML | |
.$text - innerText | |
.$val - value | |
.$qy - querySelector | |
.$Qy - querySelectorAll | |
...$args - depending on the JS version, either calls on the last constructor, or does nothing | |
a: b - if there isn't a comma after b, there will be one added, unless b is the last item | |
-- functions -- | |
<- - return | |
<+ - throw | |
$a b, c, d - function a(b, c, d) | |
:$a, b, c - function(a, b, c) | |
=$a, b, c - function(a, b, c) | |
,$a, b, c - function(a, b, c) | |
$a b, c, d: - one line functions | |
$ { - function() | |
-- Loops and Statements -- | |
a?? - test if a exists | |
a!?? - test if a doesn't exist | |
?a { - if a | |
}{ - else | |
}? a { - else if a | |
?#a, b - for a, to b by 1 | |
?#a, b, c - for a = b, to c by 1 | |
?#a, b, c, d - for a = b, to c, by d | |
-?#a, b - for a, to b by -1 | |
-?#a, b, c - for a = b, to c by -1 | |
-?#a, b, c, d - for a = b, to c, by d | |
?#a:b - for a in b | |
?#a:b ? c - for a, to b by 1, do c /!deprecated/ use ?#a,b {c} | |
@def - default | |
@a: - case a | |
---- "Advance thread" features ---- | |
.a - class x | |
.a b - class a extends b | |
*. - super | |
@(a, b, c) - constructor(a, b, c) | |
b => a - const a = b | |
a --> b - a = (arguments) => b | |
-> - => | |
$*a, b, c { - void function(a, b, c) | |
prom a - creates a promissory function (like Java's "interface", Tux "gusset"); see http://codepen.io/Ephellon/pen/MKWaja | |
Tux will automatically create a main function to call from, and switch through the number/type(s) of arguments to find a match | |
natively supported types: Array Boolean Function Number Object RegExp String Symbol * [any] | |
---- "Legacy thread" features ---- | |
a ~= b - a = -(a - b) | |
a &= b - a = a && b | |
a |= b - a = a || b | |
a ^= b - if a != null, a = b | |
a ?= b - if a == null, a = b | |
-- Special -- | |
@x..y: - "case x..y:" -- this will repeat "case ...:" for (x-y) times /i.e. "@4..6:" -> "case 4: case 5: case 6:" | |
-- Arrays (try limiting them to one per line) -- | |
a[b..c] - a.slice(b, c) | |
a[..c] - a.slice(0, c) | |
a[b..] - a.slice(b) | |
a[.] - a.slice(0) | |
a[*] - a.split | |
a[+] - a.concat | |
a[++] - a.push | |
a[<] - a.shift | |
a[>] - a.unshift | |
a[~] - a.every | |
a[&] - a.join | |
a[?] - a.indexOf | |
a[-?] - a.lastIndexOf | |
a[=] - a.reverse | |
a[^] - a.sort | |
a[-] - a.pop | |
d[] - if d is a number, it creates a d-dimension array (Tux Array "gores"), i.e. 3[] === [[[]]] /called on as [x][y][z]/ | |
r:a - if r is a reserved word, it will be double-quoted | |
.r - if r is a reserved word, it will be double-quoted and bracketed; ["r"] | |
-- Strings -- | |
"${a}" - interpolation, ..." + a + "... | |
'${a}' - interpolation, ...' + a + '... | |
`${a}` - interpolation, ...` + a + `... | |
"..." "..." - automatic concatination, "..." + "..." | |
'...' '...' - automatic concatination, '...' + '...' | |
`...` `...` - automatic concatination, `...` + `...` | |
d * "..." - (Tux String "gores") if d is a number, then the string will be repeated d many times | |
d * '...' - if d is a number, then the string will be repeated d many times | |
d * `...` - if d is a number, then the string will be repeated d many times | |
"..." - '...' - string.replace(string, "") | |
"..." - a - string.replace(a, "") | |
-- RegExp -- | |
\a - Alpha characters, [a-zA-Z] | |
\A - Non-alpha characters, [^a-zA-Z] | |
\j - JS variables, [a-zA-Z\$_][\w\d\$_]* | |
\J - non-JS variables, [^a-zA-Z\$_][\w\d\$_]* | |
\e - Greek letters | |
\E - Non-Greek letters | |
\k - lowercase, \k[A-fR-Z] = /[a-fr-z]/ | |
\K - uppercase, \K[A-fR-Z] = /[A-FR-Z]/ | |
---- "Math thread" features ---- | |
a(b) = c - function a(b){ return c; } | |
da - if d is a number, then d * a | |
a~b - ((a % b + b) % b) | |
|a| - Math.abs(a) | |
a^b - Math.pow(a, b) | |
a**b - Math.pow(a, b) | |
/?a/ - Math.sqrt(a) | |
a/?b/ - "a" root of b, i.e. 3\x\ is the cube root of x | |
a%%b - Math.floor(a/b) | |
log a (b) - log, base a, of b /log(b) / log(a)/ | |
@.property - Math.property, i.e. @.PI = Math.PI, @.log = Math.log /notice the ./ | |
---- "Wordy thread" features ---- | |
-- Loops and Statements -- | |
a exists - test if a exists | |
a exist - test if a exists | |
a !exists - test if a doesn't exist | |
a !exist - test if a doesn't exist | |
if a { - if a | |
else - automatic braces for else | |
else-if a { - else if a | |
else-when a { - else if a | |
else-where a { - else if a | |
if a then b else c - ternary operator, (a)?b:c | |
for a, b - for a, to b by 1 | |
for a, b, c - for a = b, to c by 1 | |
for a, b, c, d - for a = b, to c, by d | |
-for a, b - for a, to b by -1 | |
-for a, b, c - for a = b, to c by -1 | |
-for a, b, c, d - for a = b, to c, by d | |
for a: b - for a in b | |
for a in b - for a in b | |
for a: b? c - for a, to b by 1, do c | |
for a in b do c - for a, to b by 1, do c | |
while a - while a | |
until a - while !a | |
switch a - switch a | |
a(b) from c while d - for each item in c, if d is true, do b = c[...], a(b) | |
a(b) from c - for each item in c, do b = c[...], a(b) | |
a() from b while c - for each item in b, if c is true, do a | |
-- Baseline -- | |
#r - if r is a Tuxedo reserved word, then it will be a variable | |
\r - if r is a Tuxedo reserved word, then it will be a variable | |
AND - && | |
OR - || | |
XOR - ^ | |
NOT - ! | |
does not - ! | |
do not - ! | |
doesnt - ! | |
does - !! | |
on - true | |
yes - true | |
good - true | |
off - false | |
no - false | |
bad - false | |
maybe - true | false /uses tuxedo.random()/ | |
is not - !== | |
isnt - !== | |
equals - === | |
equal - === | |
is - === | |
the x is - x = | |
a = b in c - a = c[b] | |
a = b from c - a = c.indexOf(b) | |
<?> - ? armscye | |
<!> - ! armscye | |
<#> - # armscye | |
---- "Ugly thread" features ---- | |
single line comments become multi-line | |
undefined - void 0 | |
true - !0 | |
!false - !0 | |
!!true - !0 | |
false - !1 | |
!true - !1 | |
!!false - !1 | |
Number(a) - (+a) | |
a.toString() - a + "" | |
while(x) - for(;x;) | |
multiple zeros are "crunched" down to a 1eX form, i.e. 10000000 = 1e7 | |
boolean tests become lazy, i.e. && = &, || = | | |
---- "JS-Unit thread" features ---- | |
-- Baseline -- | |
@@ - JSUNIT | |
@@toconsole - redirect all output to the console | |
(@Test ... { ... }#) - test to run, and optional event arguments | |
(@Test ... { ... }) - "empty" test, doesn't run | |
@Before - code to run before every test | |
@After - code to run after every test | |
-- Assert Tests -- | |
@@assert(value, [comment]) - log that you wanted value | |
@@assertTrue(value, [comment]) - log that you wanted value to be true | |
@@assertFalse(value, [comment]) - log that you wanted value to be false | |
@@assertEquals(expected, recieved, [comment]) - log that you wanted recieved to equal expected | |
@@assertNotEquals(expected, recieved, [comment]) - log that you wanted recieved to not equal expected | |
@@assertNull(value, [comment]) - log that you wanted value to be null | |
@@assertNotNull(value, [comment]) - log that you wanted value to not be null | |
@@assertUndefined(value, [comment]) - log that you wanted typeof value to be undefined | |
@@assertNotUndefined(value, [comment]) - log that you wanted typeof value to not be undefined | |
@@assertNaN(value, [comment]) - log that you wanted value to be NaN | |
@@assertNotNaN(value, [comment]) - log that you wanted value to not be NaN | |
@@assertFail(comment) - log fail, "comment" | |
---- "Greek thread" features ---- | |
-- <Word> -- | |
<word> - each letter is turned into it's Greek counterpart (except q, v, and j) | |
word - if "word" is a Greek letter's name, it's turn into that letter (i.e. Pi and pi) | |
---- "Advance + Legacy cord [threads]" features ---- | |
-- Splats -- | |
$a b... - same as b = arguments | |
$a b, c... - c will be all arguments after b | |
$a b..., c - b will be all arguments before c | |
$a b, c..., d - c will be all arguments between b and d | |
a(b...) - same as a(b) uses .apply | |
a(b, c...) - a([b c]) uses .apply | |
a(b..., c) - a([b c]) uses .apply | |
a(b, c..., d) - a([b c d]) uses .apply | |
<@> - @ armscye | |
<&> - & armscye | |
---- Armscyes ---- | |
! - "index_counter" | |
@ - "arguments" | |
# - "undefined" | |
? - "ANON" | |
* - "use strict" | |
& - "Array" or "[].slice.call" | |
---- Godets [Legacy] ---- | |
a b - a(b) | |
a "b" - a("b") | |
a 'b' - a('b') | |
a `b` - a(`b`) | |
a /b/ - a(/b/) | |
---- Tuxedo Methods ---- | |
* $ means executable | |
* ~ means "same as above," but with different arguments | |
* # means a property, that isn't a method | |
* tuxedo === tux | |
tux | |
.get | |
.form | |
$ .data - get form data from the URI | |
.storage | |
$ .set[...] - set the local storage [name, data, name, data ...] | |
$ .check[name] - see if the local storage at the name exists | |
$ .get[name] - get the local storage at the name | |
$ .delete[name] - delete the local storage at the name | |
$ .attr[element, attribute, value] - set the attribute as the value | |
$ .id[element, attribute, value] - set the attribute as the value | |
~ .id[element, html] - set the innerHTML as the value | |
~ .id[element] - just return the element, by id | |
$ .class[element, attribute, value] - set the attribute as the value | |
~ .class[element, html] - set the innerHTML as the value | |
~ .class[element] - just return the element, by class name | |
$ .tag[element, attribute, value] - set the attribute as the value | |
~ .tag[element, html] - set the innerHTML as the value | |
~ .tag[element] - just return the element, by tag name | |
$ .ele[element, number, attribute, value] - set the attribute as the value | |
~ .ele[element, number, html] - set the innerHTML as the value | |
~ .ele[element, number] - just return the element, by element name (via querySelector) | |
$ .save[data, name] - tux.storage.set(name, data) | |
$ .load[name] - tux.storage.get(name) | |
$ .delete[name] - tux.storage.delete(name) | |
$ .typeof[object] - returns the typeof "object" to a string, i.e. true === "<true>", [1, 2, 3] === "[1, 2, 3]" | |
$ .typeOf[a, b, c] - returns a string of each arguments type | |
$ .precompiled - returns an object as if a snap-shot of the data being compiled | |
# .content - returns the actual "snap-shot" | |
# .channels - returns the channels {no} | |
# .comments - returns an object of the comments {plural, single} | |
# .regexps - returns the regexps | |
# .strings - returns an object of strings {double, grave, single} | |
# .threads - returns an object of threads {available, disabled, enabled} | |
$ .stamp - returns an object containing a start, stop, and difference of the TuxedoScript compile time {start, end, span} | |
# .version - the TuxedoScript version | |
$ .support - returns an array of all JS versions supported by the user's browser i.e. [1.1 ... 1.8.5] | |
$ .runtime - returns the JS version that has been detected | |
********/ |
<textarea type=text/ts cols=128 rows=8>/* TuxedoScript 16.7.3 | |
@aut: Ephellon Dantzler | |
@dat: Tue Sept 8, 2015 | |
@tie: 23:51 CST -06:00 | |
@lie: "Free for use, as long as my name, CoffeeScript, Python, and ECMA are mentioned" | |
*/ | |
##!, strict mode required for advanced features | |
## Coffee Script-Like Examples, see coffeescript.org | |
## Extendable features | |
## +advance | |
## +eval | |
## +js-editor | |
## +legacy | |
## +math | |
## +wordy | |
## -hide | |
## -html-editor | |
## -ugly | |
## Assignment | |
#number = 42 | |
#opposite = true | |
3.14 => PI | |
## Conditions | |
number = -42 if opposite; | |
/* or | |
number = -42 if opposite is true; | |
number = -42 unless opposite is false; | |
*/ | |
## Functions | |
$square x: | |
<- x^2 | |
/* or, with +math | |
square(x) = x^2 | |
*/ | |
$eat f { | |
$doc.writeln "I ate the ${f}<br>" | |
} | |
$discuss f { | |
// f[f.length-1] | |
#s = "s" if f#01 != 's'; | |
else s = ""; | |
$doc.writeln "The ${f} look${s} good<br>" | |
} | |
$doc.writeln = $x { | |
$doc.body.$html += "${x}<br>" | |
} | |
## Arrays | |
#list = [1, 2, 3, 4, 5] | |
## Objects | |
#math = { | |
root: @.sqrt | |
square: square | |
cube: $x { | |
<- x^3 | |
} | |
} | |
## Splats + Interpolation | |
$race winner, runners... { | |
$doc.writeln "${winner}, ${runners}" | |
} | |
## Existence | |
alert "I knew it" if Elvis exists; | |
## Array comprehension | |
#menu = ['tacos', 'burritos', 'sushi', 'spaghetti'] | |
if menu exists { | |
discuss food from menu | |
} | |
eat food from menu while the food isnt "sushi" | |
## Promissories | |
#prom say | |
$say <String string> { | |
$doc.writeln string | |
} | |
$say <Number number> { | |
$doc.writeln "number, ${number}" | |
} | |
$say <* first, * rest...> { | |
$doc.writeln first | |
$doc.writeln rest | |
} | |
say "taco time" | |
say(["abc", 123], "this is extra", "and this", 123, "that as well") | |
## Simple English | |
#sushi = "sushi" from menu | |
#third = 3 in menu | |
## Reserved words | |
#off = off | |
off = off OR NOT on</textarea><br><br> | |
<span> | |
<a href="https://gist.github.com/Ephellon/0835432477cff45fa29e">Java compiler for TuxedoScript</a><br><br> | |
<b> | |
See above in <a href="javascript:window.open('http://s.codepen.io/Ephellon/debug/NGbmKJ?coffee')">Tux Editor</a> | |
</b><br><br> | |
<b> | |
See "Lines by Kishin" in <a href="javascript:window.open('http://s.codepen.io/Ephellon/debug/NGbmKJ?zvRPWv=html+css')">Tux Editor</a> | |
</b><br><br> | |
<b> | |
See "Organ Systems [Class]" in <a href="javascript:window.open('http://s.codepen.io/Ephellon/debug/NGbmKJ?wKpxKX=css')">Tux Editor</a> | |
</b><br><br> | |
<b> | |
See "Piggy Bank [Class]" in <a href="javascript:window.open('http://s.codepen.io/Ephellon/debug/NGbmKJ?EVwgdJ=css')">Tux Editor</a> | |
</b><br><br> | |
<b> | |
See "Zoo [Class]" in <a href="javascript:window.open('http://s.codepen.io/Ephellon/debug/NGbmKJ?zvdqpK=css')">Tux Editor</a> | |
</b><br><br> | |
<b> | |
See "Racers [Splats] by CofeeScript" in <a href="javascript:window.open('http://s.codepen.io/Ephellon/debug/NGbmKJ?NGvdqW=css')">Tux Editor</a> | |
</b><br><br> | |
<b> | |
See "Ultimate Loader [Math] by Rauri" in <a href="javascript:window.open('http://s.codepen.io/Ephellon/debug/NGbmKJ?LpOXLj=html+css')">Tux Editor</a> | |
</b><br><br> | |
<b> | |
See "Biology Example [Class and Shorthand]" in <a href="javascript:window.open('http://s.codepen.io/Ephellon/debug/NGbmKJ?xwLEzx=css')">Tux Editor</a> | |
</b><br><br> | |
<b> | |
See "Secco by Tiffany Rayside" in <a href="javascript:window.open('http://s.codepen.io/Ephellon/debug/NGbmKJ?rOJExb=html+css')">Tux Editor</a> | |
</b><br><br> | |
<b> | |
See "JS-Unit Example" in <a href="javascript:window.open('http://s.codepen.io/Ephellon/debug/NGbmKJ?meQEbx=css')">Tux Editor</a> | |
</b><br><br> | |
<b> | |
See "Prommissory-Functions Example" in <a href="javascript:window.open('http://s.codepen.io/Ephellon/debug/NGbmKJ?MKWaja=css')">Tux Editor</a> | |
</b> | |
</span> | |
<hr> | |
<style> | |
body, body>* { | |
background: #1d1f20; | |
color: #efc371; | |
font-family: arial, monospace; | |
font-size: 14px; | |
overflow: hidden; | |
} | |
textarea { | |
background: #000; | |
border: 1px solid #fff; | |
max-width: 100vw; | |
overflow: auto; | |
width: 99vw; | |
} | |
b { | |
border-bottom: 3px solid #888; | |
cursor: pointer; | |
} | |
b:hover { | |
background: rgba(128, 128, 128, 0.5); | |
} | |
a { | |
border-bottom: 3px solid #00aced; | |
color: #00aced; | |
cursor: help; | |
text-decoration: none; | |
} | |
</style> |
// TuxedoScript 16.9.6 - Ephellon Dantzler: Tue Sept 8, 2015 23:51 CDT -06:00 | |
// Free for use, as long as my name ("Ephellon Dantzler" or "Mink CBOS"), CoffeeScript, Python, Java, and ECMA are mentioned | |
var TUX; | |
// the parsable string returned from Tuxedo() | |
function Tuxedo(__ts__, __os__) { | |
// main function, executes the code as [input-element, output-element*] | |
"use strict"; | |
// use strict mode for all of TuxedoScript | |
var time, runtime, __dq__, __sq__, __ga__, __rx__, __cms__, __cmm__, dq_, sq_, ga_, rx_, cms_, cmm_, __, _, _o, x, y, z, a, b, c, _eval, _htmleditor, _jseditor, _clean, _math, _advance, _ugly, _hide, _legacy, _wordy, _jsunit, _greek, nch_, sch_, tch_, __nch__, __sch__, __tch__, _notch, _sotch, _totch, N, S, T, M, L; | |
// declare all variables that Tuxedo will use | |
__dq__ = /("[^"]*?")/; | |
// used to hide, and keep double quotes from being executed | |
__sq__ = /('[^']*?')/; | |
// single quotes | |
__ga__ = /(`[^`]*?`)/; | |
// grave accents | |
__rx__ = /([\!\=\?\:\[\(,]\s*)(\/[^\/\$\*\?\+].+?\/[gmiyu]*)/; | |
// regular expressions ** problem when using quotes and $1 within them ** | |
__nch__ = /<\$n>([\w\W]*?)<\/\$n>/; | |
// no.t.ch | |
__sch__ = /<\$s>([\w\W]*?)<\/\$s>/; | |
// so.t.ch | |
__tch__ = /<([a-z\$_][\w\$]*\s+[a-z\$_][\w\$]*.*?)>/i; | |
// to.t.ch | |
__cms__ = /(^.*[^"'`\:]\s*\/\/.*(?!$))/; | |
// single-line comments, only replace them so parsing wont generate errors | |
__cmm__ = /(\/\*[\w\W]*?\*\/|#\*[\w\W]*?[\*#]#)/; | |
// multi-line comments | |
time = { | |
start: (new Date() + "").replace(/.+(\d{2}\:\d{2}\:\d{2}).+/, "$1") + "." + new Date().getMilliseconds(), | |
end: null, | |
span: null | |
}; | |
dq_ = []; | |
// holder for double-quotes | |
sq_ = []; | |
// holder for single-quotes | |
ga_ = []; | |
// holder of grave accents | |
rx_ = []; | |
// holder of regular expressions | |
nch_ = []; | |
// holder of no.t.ch | |
sch_ = []; | |
// holder of so.t.ch | |
tch_ = []; | |
// holder of to.t.ch | |
cms_ = []; | |
// holder for sinlge-line comments | |
cmm_ = []; | |
// holder for multi-line comments ** error with @tags not switching ** | |
runtime = { | |
/* | |
ECMAScript features | |
(All info. provided by the MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/New_in_JavaScript) | |
*/ | |
is: function(e) { | |
switch (e + "") { | |
case "*": | |
return runtime.is("1.8.5"); | |
break; | |
case "1.8.5": | |
if (undefined === Object.create || null === Object.create) return runtime.is("1.8.1"); | |
/* JavaScript 1.8.5 | |
Objects: | |
Proxy | |
Methods: | |
Object: | |
create, defineProperty, defineProperties, getOwnPropertyDescriptor, keys, getOwnPropertyNames, preventExtensions, isExpandable, seal, isSealed, freeze, isFrozen, isArray | |
Date.prototype: | |
toJSON | |
Function.prototype: | |
bind | |
Operators: | |
get | |
set | |
*/ | |
break; | |
case "1.8.1": | |
if (undefined === Object.getPrototypeOf || null === Object.getPrototypeOf) return runtime.is("1.8"); | |
/* JavaScript 1.8.1 | |
Methods: | |
Object: | |
getProtototypeOf | |
"native" JSON | |
String.prototype: | |
trim, trimLeft, trimRight, statrsWith | |
*/ | |
break; | |
// ^ ECMAScript 7 | |
case "1.8": | |
if (undefined === Array.prototype.reduce || null === Array.prototype.reduce) return runtime.is("1.7"); | |
/* JavaScript 1.8 | |
Methods: | |
Array.prototype: | |
reduce, reduceRight | |
Deprecated: | |
"destructing" to NUL | |
*/ | |
break; | |
// ^ ECMAScript 6 | |
case "1.7": | |
if (undefined !== Array.prototype.indexOf && null !== Array.prototype.indexOf && undefined === Array.prototype.reduce || null === Array.prototype.reduce) return runtime.is("1.6"); | |
/* JavaScript 1.7 | |
Et Cetra: | |
"destructing" @ { | |
[a, b, c, ...] = ["abc", 123, "xyz", ...] | |
{a, b, c, ...} = {a: "abc", b: 123, c: "xyz", ...} | |
} | |
*/ | |
break; | |
case "1.6": | |
if (undefined === Array.prototype.indexOf || null === Array.prototype.indexOf) return runtime.is("1.5"); | |
/* JavaScript 1.6 | |
Methods: | |
Array: | |
indexOf, lastIndexOf, every, filter, forEach, map, some | |
Statements: | |
for each...in | |
Et Cetra: | |
XML support | |
*/ | |
break; | |
// ^ ECMAScript 5 | |
case "1.5": | |
if (undefined === Number.prototype.toExponential || null === Number.prototype.toExponential) return runtime.is("1.4"); | |
/* JavaScript 1.5 | |
Methods: | |
Number.prototype: | |
toExponential, toFixed, toPrecision | |
Statements: | |
const | |
Improved: | |
/(catch)+/ in try...catch | |
*/ | |
break; | |
case "1.4": | |
if (undefined === Function.prototype.length || null === Function.prototype.length) return runtime.is("1.3"); | |
/* JavaScript 1.4 | |
Operators: | |
in | |
instanceof | |
Statements: | |
throw | |
try...catch | |
Deprecated: | |
Function.arity to Function.length | |
*/ | |
break; | |
case "1.3": | |
if (undefined === Function.prototype.apply || null === Function.prototype.apply) return runtime.is("1.2"); | |
/* JavaScript 1.3 | |
Globals: | |
NaN | |
Infinity | |
undefined | |
Methods: | |
isFinite | |
Function.prototype: | |
apply, call | |
Date: * | |
Et Cetra: | |
=== | |
!== | |
*/ | |
break; | |
case "1.2": | |
if (undefined === Array.prototype.concat || null === Array.prototype.concat) return runtime.is("1.1"); | |
/* JavaScript 1.2 | |
Objects: | |
arguments | |
Properties: | |
Function: | |
arity | |
Methods: | |
Array.prototype: | |
concat, slice | |
String.prototype: | |
charCodeAt, concat, fromCharCode, match, replace, search, slice, substr | |
Operators | |
delete | |
== | |
!= | |
Statements: | |
"label" @ { | |
label_name: | |
statement | |
} | |
switch | |
do...while | |
import | |
export | |
Et Cetra: | |
RegExp | |
*/ | |
break; | |
default: | |
return "1.1"; | |
} | |
return e + ""; | |
}, | |
has: function(e) { | |
if (Tuxedo.support) return Tuxedo.support.indexOf(e) > -1; | |
var r = [ "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.8.1", "1.8.5" ], t = 0; | |
return t = r.slice(0, r.indexOf(runtime.is("*")) + 1), Tuxedo.runtime = t.slice(t.length - 1, t.length)[0], | |
(Tuxedo.support = t).indexOf(e) > -1; | |
}, | |
emulate: function(e) { | |
var r = [ "*", "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.8.1", "1.8.5" ]; | |
return Tuxedo.support = r.slice(0, (r.indexOf(e) || r.indexOf(runtime.is("*"))) + 1), | |
Tuxedo.runtime = Tuxedo.support[Tuxedo.support.length - 1] + ".*", Tuxedo.support | |
} | |
}; | |
if (!runtime.has("1.3")) | |
return console.error("TuxedoScript [" + tuxedo.version + "]:", '"Requires at least JavaScript 1.3 (Currently Running @' + Tuxedo.runtime + ') [1.3 - 19 October 1998]"'); | |
x = y = z = a = b = c = N = S = T = M = L = 0; | |
// get all script tags, getting ready to test them | |
for (var K = document.querySelectorAll("script"), k = 0; k < K.length; k++) | |
if (/\*\*TS\*\*/.test(K[k].innerHTML)) { | |
// see if the innerHTML matches the pattern --TS-- | |
K[k].setAttribute("type", "text/ts"); | |
K[k].innerHTML = K[k].innerHTML | |
.replace(/\/\*\*TS\*\*/, "// TuxedoScript") | |
.replace(/\*\*TS\*\*\/\s*/g, "\n//"); | |
// close off | |
__ts__ = K[k] | |
}; | |
_ = [ "ts", "tux", "tuxs", "tuxedo", "tux-script", "tuxedoscript", "tuxedo-script", "tscript", "t-script" ]; | |
// accepted types for the type attribute to execute tuxedo-script | |
for (var k = 0; k < _.length; k++) // find which one matches | |
__ts__ = __ts__ || document.querySelector('[type="text/' + _[k] + '"]'); | |
// finds the first one | |
if (undefined === typeof __ts__ || null === __ts__) // stop execution here | |
return console.error("TuxedoScript [" + tux.version + "]:", '"No TuxedoScript element found"'); | |
_o = [ "tso", "tuxo", "tuxso", "tuxedoo", "tux-script-out", "tuxedoscriptout", "tuxedo-script-out", "tscriptout", "t-script-o" ]; | |
// accepted types for the type attribute to output tuxedo-script | |
for (var k = 0; k < _o.length; k++) // find which one matches | |
__os__ = __os__ || document.querySelector('[type="text/' + _o[k] + '"]'); | |
// finds the first one | |
__os__ = __os__ || __ts__; | |
// copy, or hold the input-element | |
__ = (__ts__.value || __ts__.innerHTML) + "\n"; | |
// ## parse runtime emulation | |
for (var rq = /##\s*@(\d\.\d\.?\d?)/; rq.test(__); ) { | |
__.replace(rq); | |
var k = RegExp.$1, K = runtime.emulate(k); | |
__ = __.replace(rq, "\b// emulate " + k) | |
} | |
// ## parse phantom thread | |
for (rq = /##\s*\*\*([\w\$]+)\:\s*(.+)/; rq.test(__); ) { | |
// shorthand variables, parseable | |
__.replace(rq); | |
var k = RegExp.$1, K = RegExp.$2.replace(/;/, ""), r = RegExp("\\$" + k + "([^\\w\\d\\$])", "g"); | |
__ = __ | |
.replace(r, eval(K) + "$1") | |
.replace(rq, "\b// " + eval(K) + " -> " + k) | |
} | |
// ## replace phantom thread | |
for (rq = /##\s*\*([\w\$]+)\:\s*(.+)/;rq.test(__); ) { | |
// shorthand variables, literal | |
__.replace(rq); | |
var k = RegExp.$1, K = RegExp.$2.replace(/;/, ""), r = RegExp("\\$" + k + "([^\\w\\d\\$])", "g"); | |
__ = __ | |
.replace(r, K + "$1") | |
.replace(rq, "\b// " + K + " -> " + k) | |
} | |
// patches [use "illegal" characters, so that they never match user code (un)intentionally] | |
for (;__.match(__nch__); N++) { | |
// remove no.t.ch | |
__.replace(__nch__); | |
nch_.push(RegExp.$1); | |
__ = __.replace(__nch__, "\bnch[" + N + "]\b") | |
} | |
__nch__ = /([\b]nch\[\d+\][\b])/; | |
for (;__.match(__sch__); S++) { | |
// remove so.t.ch | |
__.replace(__sch__); | |
sch_.push(RegExp.$1); | |
__ = __.replace(__sch__, "\bsch[" + S + "]\b") | |
} | |
__sch__ = /([\b]sch\[\d+\][\b])/; | |
for (;__.match(__cmm__); M++) { | |
// remove multi-line comments | |
__.replace(__cmm__); | |
cmm_.push(RegExp.$1 | |
.replace(/#\*#?/g, "/*") | |
.replace(/[\*#]#|\/$/, "*\b/")); | |
__ = __.replace(__cmm__, "\bcmm[" + M + "]\b") | |
} | |
for (;__.match(__cms__); L++) { | |
// remove single-line comments | |
__.replace(__cms__); | |
cms_.push(RegExp.$1); | |
__ = __.replace(__cms__, "\bcms[" + L + "]\b") | |
} | |
__cms__ = /([^\:]\/\/.*|##.*)/; | |
__ = __ | |
.replace(/\$[\b]?([1-9])/g, "$\b$1") | |
.replace(/(\d)(["'`])/g, "$1\b$2") | |
.replace(/\\\\/g, "\b.bs.") | |
.replace(/\\\//g, "\b.re.") | |
.replace(/\\"/g, "\b.dq.") | |
.replace(/\\'/g, "\b.sq.") | |
.replace(/\\`/g, "\b.ga.") | |
.replace(/\\$/g, "\b.dl.") | |
.replace(/\\(.)/g, "\b$1\b"); | |
for (;__.match(__dq__); x++) { | |
// remove double-quotes | |
__.replace(__dq__); | |
dq_.push(RegExp.$1 | |
.replace(/^"\n|\n"$/g, '"') | |
.replace(/\n/g, " ")); | |
__ = __.replace(__dq__, "\bdq[" + x + "]\b") | |
} | |
for (;__.match(__sq__); y++) { | |
// remove single-quotes | |
__.replace(__sq__); | |
sq_.push(RegExp.$1 | |
.replace(/^'\n|\n'$/g, "'") | |
.replace(/\n/g, " ")); | |
__ = __.replace(__sq__, "\bsq[" + y + "]\b") | |
} | |
for (;__.match(__ga__); z++) { | |
// remove grave-accent quotes | |
__.replace(__ga__); | |
ga_.push(RegExp.$1); | |
__ = __.replace(__ga__, "\bga[" + z + "]\b") | |
} | |
for (;__.match(__rx__); a++) { | |
// remove regular | |
__.replace(__rx__); | |
rx_.push(RegExp.$2); | |
__ = __.replace(__rx__, RegExp.$1 + "\bre[" + a + "]\b") | |
} | |
for (;__.match(__tch__); T++) { | |
// remove to.t.ch | |
__.replace(__tch__); | |
tch_.push(RegExp.$1); | |
__ = __.replace(__tch__, "\btch[" + T + "]\b"); | |
} | |
__tch__ = /([\b]tch\[\d+\][\b])/; | |
__ = __ | |
.replace(/>/g, ">") | |
.replace(/</g, "<") | |
.replace(/&/g, "&") | |
.replace(/([a-z\$_][\w\$]*)(?:[\-]{2})([a-z\$_][\w\$]*)/gi, "$1_$2") | |
.replace(/([\w\$\.]+)\s*([\&\|]{1,2})\s*([\w\$\.]+)\s*(\!\!)?\s*(\?\?)/gi, "(($1 $2 $4) !== undefined && ($1 $2 $4) !== null)") | |
.replace(/([\w\$\.]+)\s*([\&\|]{1,2})\s*([\w\$\.]+)\s*\!\s*(\?\?)/gi, "(($1 $2 $3) === undefined || ($1 $2 $3) === null)") | |
.replace(/([\w\$\.]+)\s*\!\s*(\?\?)/gi, "($1 === undefined || $1 === null)") | |
.replace(/([\w\$\.]+)\s*(\?\?)/gi, "($1 !== undefined && $1 !== null)") | |
// .replace(/(\W.+)\?([^\:]+?)\:(\s*.+?)/g, "$1,,,$2,,,,$3") | |
// .replace(/\((.+?)\)\?([^\:]+?)\:(\s*.+?)/g, "($1),,,$2,,,,$3") | |
// .replace(/([\:\}])\?(.+)(\s*\{)/g, "} else if($2) {") | |
// .replace(/\?([^#\]])(.+)(\s*\{)/g, "if($1$2) {") | |
.replace(/\}\s*\{/g, "} else {") // .replace(/(\:\:|\}\s*\{)/g, "} else {") | |
.replace(/(\x20*)\?#([a-z\$_][\w\$]*)\s*\:\s*([a-z\$_][\w\$]*)(\s*\{)/gi, runtime.has("1.4") ? "$1for(var $2 in $3) {" : "$1for(var $2_in = 0; $3 = Array($3), $2_in < $3.length; $2_in++) {\n$1 var $2 = $2_in;"); | |
for (k = /\-?\?#([^\n,;]+)([,;\s]+)([^\n,;]+)\2([^\n,;]+)\2([^\n,;]+)(\s*\{)/; k.test(__); ) __ = __.replace(k, function(e) { | |
var r = RegExp.$1, t = RegExp.$3, _ = RegExp.$4, a = RegExp.$5, n = "-" !== e[0] || +_ > +t ? "<" : ">", s = "<" === n ? "+" : "-"; | |
return "for(var " + r + " = " + t + "; " + r + n + _ + "; " + r + s + "=" + a + ") {"; | |
}); | |
for (k = /\-?\?#([^\n,;]+)([,;\s]+)([^\n,;]+)\2([^\n,;]+)(\s*\{)/; k.test(__); ) __ = __.replace(k, function(e) { | |
var r = RegExp.$1, t = RegExp.$3, _ = RegExp.$4, a = "-" !== e[0] || +t > 0 ? "<" : ">", n = "<" === a ? "+" : "-"; | |
return "for(var " + r + " = 0; " + r + a + t + "; " + r + n + "=" + _ + ") {"; | |
}); | |
for (k = /\-?\?#([^\n,;]+)([,;\s]+)([^\n,;]+)(\s*\{)/; k.test(__); ) __ = __.replace(k, function(e) { | |
var r = RegExp.$1, t = RegExp.$3, _ = "-" !== e[0] || +t > 0 ? "<" : ">", a = "<" === _ ? "++" : "--"; | |
return "for(var " + r + " = 0; " + r + _ + t + "; " + r + a + ") {"; | |
}); | |
__ = __ | |
// .replace(/\?\s*\:/g, "do {") | |
// .replace(/([^\*\/\+\-\%]\s*)\?(.+)(\s*[;\{])/g, "$1while($2)$3".replace(/;/, ",,")) | |
// .replace(/\?\((.+)\)/g, "switch($1) {\n") | |
// .replace(/(try|catch|finally)\s*\:/g, "$1 {") | |
.replace(/@def(a?u?l?t?\:?)/g, "default:") | |
.replace(/#\*#/g, "/**") | |
.replace(/#\*/g, "/*") | |
.replace(/##/g, "//") | |
.replace(/([a-z\$_][\w\$\.]*)#00/gi, "$1[$1.length]") | |
.replace(/([a-z\$_][\w\$\.]*)#0([\w\$]+)/gi, "$1[$1.length-$2]") | |
.replace(/([a-z\$_][\w\$\.]*)#(\d+|[a-z\$_][\w\$]*)/gi, "$1[$2]") | |
.replace(/#([a-z\$_][\w\$]*)/gi, "var $1") | |
.replace(/([^\w\$])\$of([^\w\$])/g, "$1typeof$2") | |
.replace(/([^\w\$])\$del([^\w\$])/g, "$1delete$2") | |
.replace(/([^\w\$])\$args([^\w\$])/g, "$1arguments$2") | |
.replace(/([^\w\$])\$doc([^\w\$])/g, "$1document$2") | |
.replace(/([^\w\$])\$win([^\w\$])/g, "$1window$2") | |
.replace(/([^\w\$])\$nav([^\w\$])/g, "$1navigator$2") | |
.replace(/([^\w\$])\$loc([^\w\$])/g, "$1location$2") | |
.replace(/([^\w\$])\$cont([^\w\$])/g, "$1continue$2") | |
.replace(/([^\w\$])\$con([^\w\$])/g, "$1console$2") | |
.replace(/([^\w\$])\$(#|[Oo]bj)([^\w\$])/g, "$1Object$3") | |
.replace(/\.\$id([^\w\$])/g, ".getElementById$1") | |
.replace(/\.\$class([^\w\$])/g, ".getElementsByClassName$1") | |
.replace(/\.\$tag([^\w\$])/g, ".getElementsByTagName$1") | |
.replace(/\.\$html([^\w\$])/g, ".innerHTML$1") | |
.replace(/\.\$text([^\w\$])/g, ".innerText$1") | |
.replace(/\.\$val([^\w\$])/g, ".value$1") | |
.replace(/\.\$qy([^\w\$])/g, ".querySelector$1") | |
.replace(/\.\$Qy([^\w\$])/g, ".querySelectorAll$1") | |
.replace(/<\-([^\w\$])/g, "return$1") | |
.replace(/<\+([^\w\$])/g, "throw$1") | |
.replace(/([\:\=,]\s*)\$([^\(\)\{\}\[\]\n]+)(\s*\{)/g, "$1function($2) {") | |
.replace(/([\:\=,]\s*)\$([^\(\)\{\}\[\]\n]+)\s*\:(\s*[^\n\r\f;]*)([\n\r\f;])/gm, "$1function($2) {$3}$4") | |
.replace(/(\W)\$([a-z\$_][\w\$]*)\s+(.+)(\s*\{)/gi, "$1function $2($3) {") | |
.replace(/(\W)\$([a-z\$_][\w\$]*)\s+(.+)\s*\:(\s*[^\n\r\f;]*)([\n\r\f;])/gmi, "$1function $2($3) {$4}$5") | |
.replace(/(\W)\$([a-z\$_][\w\$]*)(\s*\{)/gi, "$1function $2() {") | |
.replace(/(\W)\$([a-z\$_][\w\$]*)\s*\:(\s*[^\n\r\f;]*)([\n\r\f;])/gmi, "$1function $2() {$3}$4") | |
.replace(/(\W)\$(\s*\{)/g, "$1function() {") | |
.replace(/function\s\(/g, "$(") | |
.replace(/@(.+)\:/g, "case $1:") | |
.replace(/([^\w\$\@])@([a-z\$_][\w\$]*\s*[^\:])/gi, "$1this.$2") | |
// .replace(/;([\s,\}\)]+)/g, "}$1") | |
.replace(/,,,,/g, ":") | |
.replace(/,,,/g, "?") | |
// .replace(/,,/g, ";") | |
.replace(/\/\/\!/g, '"use strict"; // use strict embed') | |
.replace(/(?!\?)([\w\$]+)\s*\:\s*(.+)([^,\{\[\(])(\s$)/gi, "$1: $2$3,$4"); | |
// [experimental] enable/disable features via ## +feature / ## -feature | |
rq = /\/\/\s*\-\s*(advance|clean|eval|greek|hide|html-editor|js-editor|js-unit|legacy|math|ugly|wordy)/; | |
for (;rq.test(__); ) { | |
// disable attributes | |
__.replace(rq); | |
var k = RegExp.$1; | |
__ts__.setAttribute(k, ""); | |
__ = __.replace(rq, "\b// disable " + k + "\b"); | |
} | |
rq = /\/\/\s*\+\s*(advance|clean|eval|greek|hide|html-editor|js-editor|js-unit|legacy|math|ugly|wordy)/; | |
for (;rq.test(__); ) { | |
// enable attributes | |
__.replace(rq); | |
var k = RegExp.$1; | |
__ts__.setAttribute(k, "!"); | |
__ = __.replace(rq, "\b// enable " + k + "\b"); | |
} | |
// threads | |
_advance = __ts__.getAttribute("advance"); | |
_clean = __ts__.getAttribute("clean"); | |
_eval = __ts__.getAttribute("eval"); | |
_greek = __ts__.getAttribute("greek"); | |
_hide = __ts__.getAttribute("hide"); | |
_htmleditor = __ts__.getAttribute("html-editor"); | |
_jseditor = __ts__.getAttribute("js-editor"); | |
_jsunit = __ts__.getAttribute("js-unit"); | |
_legacy = __ts__.getAttribute("legacy"); | |
_math = __ts__.getAttribute("math"); | |
_ugly = __ts__.getAttribute("ugly"); | |
_wordy = __ts__.getAttribute("wordy"); | |
for (;__.match(__sch__); ) { | |
// put so.t.ch back | |
S = +__.match(__sch__)[0] | |
.replace(/\D/g, ""); | |
__ = __.replace(__sch__, sch_[S]); | |
} | |
// ## parse regexps | |
for (var rq = /\/\/\s*(\/.+\/[gmiyu]*)\s*\=(.*)/; rq.test(__); ) { | |
__.replace(rq); | |
var k = RegExp.$1, K = RegExp.$2, g, h; | |
var rep = function (e) { | |
e = e | |
.replace(/[\b]\.bs\./g, "\\\\") | |
.replace(/[\b]\.re\./g, "\\/") | |
.replace(/[\b]\.dq\./g, '\\"') | |
.replace(/[\b]\.sq\./g, "\\'") | |
.replace(/[\b]\.ga\./g, "\\`") | |
.replace(/[\b]\.dl\./g, "\\$") | |
.replace(/[\b](.)[\b]/g, "\\$1") | |
.replace(/(\\.|[^\\]\[.*?[^\\]\]|[^\\]\(.*?[^\\]\))\+\+/g, "$1$1+") | |
.replace(/\\a/g, "[a-zA-Z]") | |
.replace(/\\A/g, "[^a-zA-Z]") | |
.replace(/\\j/g, "[a-zA-Z\\$_][\\w\\$]*") | |
.replace(/\\J/g, "[^a-zA-Z\\$_][\\w\\$]*") | |
.replace(/\\e/g, "[A-Z\\u0391-\\u03a9a-z\\u03b1-\\u03c9_]") | |
.replace(/\\E/g, "[^A-Z\\u0391-\\u03a9a-z\\u03b1-\\u03c9_]"); | |
for (var l = /\\k(\[.*?\])/; l.test(e); ) e = e.replace(l, function() { | |
return RegExp.$1.toLowerCase() | |
.replace(/(\w\-\w)\1/g, "$1") | |
}); | |
for (var l = /\\K(\[.*?\])/; l.test(e); ) e = e.replace(l, function() { | |
return RegExp.$1.toUpperCase() | |
.replace(/(\w\-\w)\1/g, "$1") | |
}); | |
for (var l = /[\b](sq|dq|ga|re)\[(\d+)\][\b]/; l.test(e); ) e = e.replace(l, function() { | |
var L = "sq sq dq dq ga ga re rx".split(" "), | |
n = +RegExp.$2, | |
N = RegExp.$1; | |
var p = L.indexOf(N) + 1; | |
return eval(L[p] + "_[" + n + "]") | |
}); | |
return e.replace(/[\b]/g, "") | |
} | |
k = eval(rep(k)); | |
K = rep(K); | |
h = ((g = /\seval\s/).test(K))? | |
eval(K.replace(g, "").replace(/\$([1-9])/g, "RegExp.\$$1").replace(/[\b]/g, "")): | |
K; | |
__ = __ | |
.replace(k, h) | |
.replace(rq, "\b// " + k + " -> " + h.replace(/\$/g, "$\b")) | |
} | |
for (;__.match(__cmm__); M++) { | |
// remove multi-line comments | |
__.replace(__cmm__); | |
cmm_.push(RegExp.$1 | |
.replace(/#\*#?/g, "/*") | |
.replace(/##|\/$/, "*\b/")); | |
__ = __.replace(__cmm__, "\bcmm[" + M + "]\b"); | |
} | |
__cmm__ = /([\b]cmm\[\d+\][\b])/m; | |
for (;__.match(__cms__); L++) { | |
// remove single line comments | |
__.replace(__cms__); | |
cms_.push(RegExp.$1.replace(/##/g, "//")); | |
__ = __.replace(__cms__, "\bcms[" + L + "]\b"); | |
} | |
__cms__ = /([\b]cms\[\d+\][\b])/; | |
for (;__.match(__dq__); x++) { | |
// remove double-quotes | |
__.replace(__dq__); | |
dq_.push(RegExp.$1); | |
__ = __.replace(__dq__, "\bdq[" + x + "]\b"); | |
} | |
__dq__ = /([\b]dq\[\d+\][\b])/; | |
for (;__.match(__sq__); y++) { | |
// remove single-quotes | |
__.replace(__sq__); | |
sq_.push(RegExp.$1); | |
__ = __.replace(__sq__, "\bsq[" + y + "]\b"); | |
} | |
__sq__ = /([\b]sq\[\d+\][\b])/; | |
for (;__.match(__ga__); z++) { | |
// remove grave-accent quotes | |
__.replace(__ga__); | |
ga_.push(RegExp.$1); | |
__ = __.replace(__ga__, "\bga[" + z + "]\b"); | |
} | |
__ga__ = /([\b]ga\[\d+\][\b])/; | |
for (;__.match(__rx__); a++) { | |
// remove regular | |
__.replace(__rx__); | |
rx_.push(RegExp.$1); | |
__ = __.replace(__rx__, "\bre[" + a + "]\b"); | |
} | |
__rx__ = /([\b]re\[\d+\][\b])/; | |
// other features | |
if ("!" === _greek) { | |
// greek lettering | |
var a = "\u03b1 \u03b2 \u03b3 \u03b4 \u03b5 \u03b6 \u03b7 \u03b8 \u03b9 \u03ba \u03bb \u03bc \u03bd \u03be \u03bf \u03c0 \u03c1 \u03c2 \u03c3 \u03c4 \u03c5 \u03c6 \u03c7 \u03c8 \u03c9 _ $", | |
A = a.toUpperCase(), // 0391 - 03a9 | |
l = "abgdezhqiklmnxoprvstufcyo_$", | |
L = l.toUpperCase(), | |
k = "alpha beta gamma delta epsilon zeta eta theta iota kappa lambda mu nu xi omicron pi ro cigma sigma tau upsilon phi chi psi omega", | |
K = "Alpha Beta Gamma Delta Epsilon Zeta Eta Theta Iota Kappa Lambda Mu Nu Xi Omicron Pi Ro Cigma Sigma Tau Upsilon Phi Chi Psi Omega"; | |
a = a.split(" "); | |
A = A.split(" "); | |
l = l.split(""); | |
L = L.split(""); | |
k = k.split(" "); | |
K = K.split(" "); | |
a = a.concat(A); | |
k = k.concat(K); | |
l = l.concat(L); | |
for(var i = 0; i < k.length; i++) | |
__ = __ | |
.replace(RegExp("([^\\w\\$])" + k[i] + "([^\\w\\$])", "g"), "$1" + a[i] + "$2"); | |
var j = /<([a-z\$_][\w\$]*)>/i; | |
for(;j.test(__);) | |
__ = __.replace(j, function(e) { | |
var $1 = RegExp.$1; | |
e = ""; | |
for(var I = 0; I < $1.length; I++) | |
e += a[l.indexOf($1[I])]; | |
return e | |
}) | |
} | |
if ("!" === _legacy) { | |
// JS related | |
__ = __ | |
.replace(/([a-z\$_@][\w\.\$]*)\s*\~\=\s*([\w\d\$]+)/g, "$1 = -($1 - $2)") | |
.replace(/([a-z\$_@][\w\.\$]*)\s*([\&\|])\=/gi, "$1 = $1 $2$2") | |
.replace(/([a-z\$_][\w\.\$]*)\s*\^\=(.+)/gi, "$1 = ($1 !== null)? $2: $1") | |
.replace(/([a-z\$_][\w\.\$]*)\s*\?\=(.+)/gi, "$1 = ($1 === null)? $2: $1") | |
.replace(/\[(\-?[\w\$\.]+)\.\.(\-?[\w\$\.]+)\]/gi, ".slice($1, $2)") | |
.replace(/\[\.\.(\-?[\w\$]+)\]/gi, ".slice(0, $1)") | |
.replace(/\[(\-?[\w\$]+)\.\.\]/gi, ".slice($1)") | |
.replace(/\[\.\]/g, ".slice(0)") | |
.replace(/\[\*\]/g, ".split") | |
.replace(/\[\+\]/g, ".concat") | |
.replace(/\[\+\+\]/g, ".push") | |
.replace(/\[<\]/g, ".shift") | |
.replace(/\[>\]/g, ".unshift") | |
.replace(/\[~\]/g, ".every") | |
.replace(/\[&\]/g, ".join") | |
.replace(/\[\?\s*\]/g, ".indexOf") | |
.replace(/\[\-\?\s*\]/g, ".lastIndexOf") | |
.replace(/\[\=\]/g, ".reverse") | |
.replace(/\[\^\]/g, ".sort") | |
.replace(/\[\-\]/g, ".pop") | |
.replace(/\-\s*([\b](dq|sq|ga|re)\[\d+\][\b])/g, ".replace($1, \"\")") | |
.replace(/([\b](dq|sq|ga|re)\[\d+\][\b])\s*\-\s*([\b](dq|sq|ga|re)[\b]|[\w\$\.\x20\t]+)/g, "$1.replace($2, \"\")"); | |
// [-] | |
for (rq = /(\x20*)case[\b]?\s+(\d+)\.\.(\d+)\:/; rq.test(__); ) __ = __.replace(rq, function(e) { | |
e = []; | |
for (var r, t, _ = r = +RegExp.$2; _ <= (t = +RegExp.$3) && _ >= 0; _ += t - r > 1 ? 1 : -1) e.push(RegExp.$1 + "case " + _ + ":"); | |
return e.toString() | |
.replace(/,/g, "\n"); | |
}); | |
__ = __ | |
.replace(/\.([a-z\$_][\w\$]*)\s+([a-z\$_][\w\$]*)\s*\{/gi, ".$1 $2 {") | |
.replace(/([^\w\$])(abstract|arguments|boolean|break|byte|case|catch|char|class|const|continue|debugger|delete|do|double|else|enum|eval|export|extends|false|final|finally|float|for|function|goto|if|implements|import|in|instanceof|int|interface|let|long|native|new|null|package|private|protected|public|return|short|static|super|switch|synchronized|this|throw|throws|transient|true|try|typeof|undefined|var|void|volatile|while|with|yield|[A-Za-z\$_][\w\$]*\-[\w\$]*)\s*\:/g, '$1"$2":') | |
.replace(/\.(abstract|arguments|boolean|break|byte|case|catch|char|class|const|continue|debugger|default|delete|do|double|else|enum|eval|export|extends|false|final|finally|float|for|function|goto|if|implements|import|in|instanceof|int|interface|let|long|native|new|null|package|private|protected|public|return|short|static|super|switch|synchronized|this|throw|throws|transient|true|try|typeof|undefined|var|void|volatile|while|with|yield)([^\w\$])/g, '["$1"]$2') | |
.replace(/\(\s*(abstract|boolean|break|byte|case|catch|char|class|const|continue|debugger|default|delete|do|double|else|enum|export|extends|final|finally|float|for|goto|if|implements|import|in|instanceof|int|interface|let|long|native|new|package|private|protected|public|return|short|static|switch|synchronized|throw|throws|transient|try|typeof|var|volatile|while|with|yield)\s*\)/g, " $1 ") | |
.replace(/([a-z\$_][\w\$]*)\.\.([a-z\$_][\w\$]*)/gi, "$1().$2"); | |
// a..b | |
for (;__.match(/([1-9][\d]*)\[\]/); ) { | |
// dimension arrays | |
__.replace(/([1-9][\d]*)\[\]/); | |
k = +RegExp.$1 - 1; | |
__ = __.replace(/([0-9][\d]*)\[\]/, "[/?/]"); | |
for (var x = 0; k - 1 > x; x++) __ = __.replace(/\/\?\//, "[/?/]"); | |
__ = __.replace(/\/\?\//, "[]"); | |
} | |
} | |
if ("!" === _advance) { | |
__ = __ | |
.replace(/(\W)\.([\s\w\$]+)\s+([\s\w\$]+)\{/gi, runtime.has("1.6") ? "$1class $2 extends $3{" : "$1var $2_class --> new $3.apply(null, arguments);\n$1function $2() {\n$1 $2_class.apply(null, arguments)") | |
.replace(/(\W)\.([\s\w\$]+)\{/gi, runtime.has("1.6") ? "$1class $2{" : "$1function $2() {") | |
.replace(/([\x20\t]*)@\((.*?)\)/g, runtime.has("1.6") ? "$1constructor($2)" : "$1self = this;\n$1this.constructor = function($2)") | |
.replace(/\*\./g, "super.") | |
.replace(/(\s*)(.+)\s*\=>\s*([a-z\$_][\w\$]*)/gi, runtime.has("1.5") ? "$1const $3 = $2" : "$1var $3 = $2") | |
.replace(/([\s\w\$]+)\s*\-\->(.+)/gi, runtime.has("1.6") ? "$1 = () => $2" : "$1 = function() { return $2 }") | |
.replace(/([a-z\$_][\w\$]*|\(.+?\))\s*\->/g, runtime.has("1.6") ? "$1 =>" : "function($1)" | |
.replace(/(\(+|\)+)/g, "$1")) | |
.replace(/\$\*(.*?)\s*{/g, "void function($1) {") | |
.replace(/(?:var\s+)?prom\s+([a-z\$_][\.\w\$]*)/gi, "PROM <$1>"); | |
var splatable = function(){}; | |
if ("!" === _legacy && !runtime.has("1.7")) { | |
splatable = function(splat) { | |
// advance + legacy threads | |
// Splats | |
// empty beginning splats | |
for (var rq = /\(\s*\.\.\.,\s*([a-z\$_][\w\$,\s]*)\s?\)\s*\{/i; rq.test(__); ) { | |
// splats | |
__.replace(rq); | |
var k = RegExp.$1.split(","); | |
__ = __.replace(rq, "( ){\n/splat/"); | |
for (var e = 0; e < k.length; e++) __ = __ | |
.replace(/\/splat\//, " var " + k[e] | |
.replace(/\s/g, "") + " = <@>[<@>.length-" + (e + 1) + "];\n/splat/"); | |
__ = __.replace(/\/splat\//g, ""); | |
} | |
rq = /\(\s*([a-z\$_][\w\$]*)\.\.\.\s*\)\s*\{/i; | |
// only splats | |
__.replace(rq); | |
__ = __ | |
.replace(rq, "( ){\n/splat/") | |
.replace(/\/splat\//, " var " + RegExp.$1 + " = <@>;"); | |
rq = /\(\s*([a-z\$_][\w\$]*)\.\.\.,\s*([a-z\$_][\w\$,\s]*)\s?\)\s*\{/i; | |
// beginning splats | |
for (;rq.test(__);) { | |
// splats | |
__.replace(rq); | |
var k = RegExp.$1, K = RegExp.$2.split(","); | |
__ = __.replace(rq, "( ){\n/splat/"); | |
__ = __.replace(/\/splat\//, " var " + k.replace(/\s/g, "") + " = (" + K.length + " <= <@>.length)?<&>(<@>, 0, <@>.length-" + K.length + "):[];\n/splat/"); | |
for (var e = K.length; e > 0; e--) __ = __ | |
.replace(/\/splat\//, " var " + K[e - 1] | |
.replace(/\s/g, "") + " = <@>[<@>.length-" + (K.length - e + 1) + "];\n/splat/"); | |
__ = __.replace(/\/splat\//g, ""); | |
} | |
rq = /\(\s*(.+),\s*\.\.\.\s*\)\s*\{/i; | |
// empty ending splats | |
for (;rq.test(__); ) { | |
// splats | |
__.replace(rq); | |
var k = RegExp.$1.split(","); | |
__ = __.replace(rq, "( ){\n/splat/"); | |
for (var e = 0; e < k.length; e++) __ = __ | |
.replace(/\/splat\//, " var " + k[e] | |
.replace(/\s/g, "") + " = <@>[" + e + "];\n/splat/"); | |
__ = __.replace(/\/splat\//g, ""); | |
} | |
rq = /\(\s*(.+),\s*([a-z\$_][\w\$,\s]*)\.\.\.\s*\)\s*\{/i; | |
// ending splats | |
for (;rq.test(__); ) { | |
// splats | |
__.replace(rq); | |
var k = RegExp.$1.split(","), K = RegExp.$2; | |
__ = __.replace(rq, "( ){\n/splat/"); | |
for (var e = 0; e < k.length; e++) __ = __ | |
.replace(/\/splat\//, " var " + k[e] | |
.replace(/\s/g, "") + " = <@>[" + e + "];\n/splat/"); | |
__ = __.replace(/\/splat\//, " var " + K.replace(/\s/g, "") + " = (" + (k.length + 1) + " <= <@>.length)?<&>(<@>, " + k.length + "):[];"); | |
} | |
rq = /\(\s*(.+),\s*\.\.\.,\s*(.+)\s*\)\s*\{/i; | |
// empty middle splats | |
for (;rq.test(__); ) { | |
// splats | |
__.replace(rq); | |
var K = RegExp.$1.split(","), k = RegExp.$2.split(","); | |
__ = __.replace(rq, "( ){\n/splat/"); | |
for (var e = 0; e < K.length; e++) __ = __ | |
.replace(/\/splat\//, " var " + K[e] | |
.replace(/\s/g, "") + " = <@>[" + e + "];\n/splat/"); | |
for (var e = k.length; e > 0; e--) __ = __ | |
.replace(/\/splat\//, " var " + k[e - 1] | |
.replace(/\s/g, "") + " = <@>[<@>.length-" + e + "];\n/splat/"); | |
__ = __.replace(/\/splat\//g, ""); | |
} | |
rq = /\(\s*(.+),\s*([a-z\$_][\w\$,\s]*)\.\.\.,\s*(.+)\s*\)\s*\{/i; | |
// middle splats | |
for (;rq.test(__);) { | |
// splats | |
__.replace(rq); | |
var K = RegExp.$1.split(","), j = RegExp.$2, k = RegExp.$3.split(","); | |
__ = __.replace(rq, "( ){\n/splat/"); | |
for (var e = 0; e < K.length; e++) __ = __ | |
.replace(/\/splat\//, " var " + K[e] | |
.replace(/\s/g, "") + " = <@>[" + e + "];\n/splat/"); | |
__ = __.replace(/\/splat\//, " var " + j.replace(/\s/g, "") + " = (" + (K.length + k.length + 1) + " <= <@>.length)?<&>(<@>, " + K.length + ", <@>.length-" + k.length + "):[];\n/splat/"); | |
for (var e = K.length - 1; e < K.length + k.length - 1; e++) __ = __ | |
.replace(/\/splat\//, " var " + k[e] | |
.replace(/\s/g, "") + " = <@>[<@>.length-" + (k.length - e) + "];\n/splat/"); | |
__ = __.replace(/\/splat\//g, ""); | |
} | |
var t = [/([a-z\$_][\w\$\.]*)\s*\(?\s*([a-z\$_][\w\$]*)\.\.\.\s*\)?/gi, /([a-z\$_][\w\$\.]*)\s*\(?(.+),\s*([a-z\$_][\w\$]*)\.\.\.\s*\)?/gi, /([a-z\$_][\w\$\.]*)\s*\(?([a-z\$_][\w\$]*)\.\.\.,\s*(.+?)\s*\)?/gi, /([a-z\$_][\w\$\.]*)\s*\(?\s*(.+),\s*([a-z\$_][\w\$,\s]*)\.\.\.,\s*(.+?)\s*\)?/gi], | |
u = ["$1.apply(null, $2)\n", "$1.apply(null, <&>(<&>($3)))\n", "$1.apply(null, <&>($3).concat([$2]))\n", "$1.apply(null, <&>($2).concat(<&>($3)))\n"], | |
h, j; | |
for(var i = 0; i < t.length; i++) | |
if((h = __.match(t[i])) !== null) | |
__ = __.replace(t[i], /\Wfunction\W/.test(j = RegExp.$1 + RegExp.$2 + RegExp.$3)? u[i]: h.join("").replace(/([a-z\$_][\w\$]*)\.{3}/i, splat? "...$1": "$1")); | |
__ = __ | |
.replace(/<@>/g, "arguments") | |
.replace(/<\&>/g, "[].slice.call") | |
} | |
} else if ("!" === _legacy) { | |
splatable = function(splat) { | |
__ = __ | |
.replace(/([a-z\$_][\w\$]*)\.\.\./gi, splat? "...$1": "$1") | |
.replace(/([a-z\$_][\w\$\.]*)\s+\.\.\.([a-z\$_][\w\$]*)/gi, "$1.apply(null, $2)") | |
} | |
} // end legacy cord | |
splatable(true); | |
// Prom "Gussets" | |
for (;__.match(__tch__); ) { | |
// put to.t.ch back | |
T = +__.match(__tch__)[0] | |
.replace(/\D/g, ""); | |
__ = __.replace(__tch__, "<" + tch_[T] + ">"); | |
} | |
for (var n = /PROM\s<([a-z\$_][\w\$]*)>/i; __.match(n); ) { | |
__ = __.replace(n, "<\b$1>"); | |
var m = RegExp.$1, // name | |
F = [], // splat or not | |
R = RegExp("(\\x20*)function\\s+" + m.replace(/\$/g, "\\$") + "\\s*\\(\\s*<\\.\\.\\.>\\s*\\)\\s*\\{"), r = RegExp("(\\x20*)function\\s+" + m.replace(/\$/g, "\\$") + "\\s*\\(\\s*<(.*)>\\s*\\)\\s*\\{"); | |
if (-1 === Array(window).indexOf("@" + m)) { | |
window["@" + m] = { | |
args: [], | |
max: [], | |
name: m, | |
prototype: {}, | |
splat: R.test(__), | |
stamp: new Date(), | |
toString: function() { | |
return function() {}; | |
} | |
}; | |
__ = __.replace(R, "function __" + m + "()\b {"); | |
for (;r.test(__); ) { | |
__.replace(r); | |
var k = RegExp.$2.split(","), K = (/\.{3}|\+/.test(k + "")? Infinity: k.length), s = RegExp.$1, j = k, t = 0, T = [], E = [], u = 0, U = !1; | |
K = "" === k ? 0 : K; | |
__ = __.replace(r, s + "function " + m + "__" + K + "\bu\b(/?/)\b {\n" + k.every(function(e) { | |
var r = !1; | |
e = e | |
.replace(/\*/, "Any") | |
.replace(/\((.+)\)/, " $1") | |
.replace(/^\s(.+)/, "$1"); | |
if (r = e.split(" ").length > 1) | |
e = e.split(" "); | |
F.push(/\.{3}|\+/.test(e[1])); | |
return T.push((!r ? e : -1 === (E.push(e[0]), e[0]).indexOf("Any") ? e[1] : e[1]).replace(/\.{3}|\+/g, "...\b")), | |
!0; | |
}).toString() | |
.replace(/true/, "")) | |
.replace(/\/\?\//, T.join(", ").replace(/([a-z\$_][\w\$]*)(\.{3}|\+)/gi, runtime.has("1.7")? "...$1": "$1")); | |
window["@" + m].args.push(E); | |
window["@" + m].max.push(K); | |
} | |
r = RegExp("<[\\b](" + m.replace(/\$/g, "\\$") + ")>"); | |
__ = __ | |
.replace(r, "function $1(){\n" + (s += " ") + "switch(" + ((U = "" !== (E + "") | |
.replace(/,/g, "")) ? "tux.typeOf.apply(null, arguments)" : "arguments.length") + "){\n" + s + "/\b/\n }\n}\n"); | |
for (var K = 0; K < window["@" + m].max.length; K++) { | |
var g = window["@" + m].max[K], | |
G = (U ? (g = '"' + window["@" + m].args[u] + '"', window["@" + m].args[u]) : g) + "", | |
E = []; | |
__ = __ | |
.replace(RegExp(m.replace(/\$/g, "\\$") + "__" + window["@" + m].max[K] + "[\\b]u[\\b]"), U ? m + "__" + window["@" + m].args[u++].toString() | |
.replace(/,/g, "_") : m + "__" + window["@" + m].max[K]) | |
.replace(/\/[\b]\//, s + "case " + (g = (g + "").toUpperCase()) | |
.split(",") | |
.every(function() { | |
for (var e = g.split(","), r = 0; r < e.length; r++) { | |
if (/ANY/.test(e[r])) e[r] = 0 !== r ? | |
(/\.{3}|\+/.test(T[r])? // splats | |
'"+tux.typeOf.apply(null, [].slice.call(arguments).slice(' + r + ', arguments.length))+"': | |
'"+tux.typeOf(arguments[' + r + '])+"'): | |
(/\.{3}|\+/.test(T[r])? // splats | |
'tux.typeOf.apply(null, [].slice.call(arguments).slice(' + r + ', arguments.length))+"': | |
'tux.typeOf(arguments[0])+"'); | |
if (r === e.length - 1) e[r] = e[r] | |
.replace(/\+"$/, ""); | |
} | |
return E = e, !0 | |
}).toString() | |
.replace(/true/, E) + ":\n" + s + " return " + m + "__" + G.replace(/,/g, "_") + ".apply(null, arguments);\n" + s + " break;\n /\b/"); | |
} | |
__ = __ | |
.replace(/\n?(\s*)\/[\b]\//, R ? "\n$1 default:\n$1 if(typeof __" + m + " === '" + typeof Function() + "'){\n$1 return __" + m + ".apply(null, arguments)\n$1 } else {\n$1 throw Error('\b@\b" + m + " (" + tux['typeof'](window["@" + m].args.join("; \b")) | |
.replace(/,/g, ", ") + " > ['+tux.typeOf.apply(null, arguments)+'])\\n \b No\b case\b found\b')\n$1 }" : ""); | |
} | |
for(var i = 0, h = 0; i < window["@" + m].args.length; i++) | |
for(var j = 0; j < window["@" + m].args[i].length; j++) | |
window["@" + m].args[i][j] += F[h++]? "...": ""; | |
} | |
splatable(false); | |
} | |
if ("!" === _math) { | |
__ = __ | |
.replace(/\|\s*\|/g, "/or/") | |
.replace(/\|\=/g, "/ore/") | |
.replace(/([a-z\$_][\w\$]*)\((.+)\)\s*\=\s*(.+)/gi, "function $1($2){return $3}\n") | |
.replace(/([^a-z\$_]\d+)(\x20*)([a-z\$_@][\w\$]*)/gi, "$1$2*$2$3") | |
.replace(/([\w\$\-\.@]+)\s*~\s*([\w\$\-\.@]+)/gi, "(($1 % $2 + $2) % $2)") | |
.replace(/\|(.+?)\|/g, " @.abs($1)") | |
.replace(/([^\\][\w\$@]+)\/\?\n?(.+?)\//gi, " @.pow($2, 1/$1)") | |
.replace(/\/\?\n?(.+?)\//g, " @.sqrt($1)") | |
.replace(/([\w\.\$_\-@]+)\s*(?:\^|\*\*)\s*([\w\.\$_\-@]+)/gi, " @.pow($1, $2)") | |
.replace(/([\w\$\-@]+)\s*%%\s*([\w\$\-@]+)/gi, " @.floor($1 / $2)") | |
.replace(/(\W)log\s(.+)\s\((.+)\)/g, "$1(@.log($3) / @.log($2))") | |
.replace(/@\.([a-z\$_][\w\$]*)/gi, "Math.$1") | |
.replace(/\/or\//g, "||") | |
.replace(/\/ore\//g, "|=") | |
.replace(/([^\d])0\s*\*\s*([ex])(\-?\d+)/g, "$10$2$3") | |
.replace(/(\d)\s*\*\s*e(\-?\d+)/g, "$1e$2"); | |
// fix e numbers | |
Math.modulo = function(e, r) { | |
e = +e; | |
// Number(a) | |
r = +r; | |
// Number(b) | |
return (e % r + r) % r; | |
}; | |
} | |
if ("!" === _wordy) { | |
// words | |
__ = __ | |
.replace(/var\s(does|do|NOT|AND|XOR|OR|isnt|on|yes|good|off|no|bad|equals?|is|when|where|from|unless|until|the|maybe)/g, "#0$1") | |
.replace(/(does|do|NOT|AND|XOR|OR|isnt|on|yes|good|off|no|bad|equals?|is|when|where|from|unless|until|the|maybe)(\s*\=)/g, "#00$1$2") | |
.replace(/\.(does|do|NOT|AND|XOR|OR|isnt|on|yes|good|off|no|bad|equals?|is|when|where|from|unless|until|the|maybe)/g, "#000$1") | |
.replace(/([^a-z\$_])(does|do|NOT|AND|XOR|OR|isnt|on|yes|good|off|no|bad|equals?|is|when|where|from|unless|until|the|maybe)\((.+?)\)/g, "$1$2 $3") | |
.replace(/\s(does\snot|doesnt|NOT)\s/g, "!") | |
.replace(/\s?(does|do)\s?\!\s/g, "!") | |
.replace(/\sdoes\s/g, "!!") | |
.replace(/([^\w\$])(on|yes|good)([^\w\$])/g, "$1true$3") | |
.replace(/([^\w\$])(off|no|bad)([^\w\$])/g, "$1false$3") | |
.replace(/([^\w\$])(maybe)([^\w\$])/g, "$1tux.random()$3") | |
.replace(/\s(isnt|is\snot)\s/g, " !== ") | |
.replace(/\!\s*(equals|equal|is)\s/g, " !== ") | |
.replace(/\s(equals|equal|is)\s/g, " === ") | |
.replace(/\sthe\s([a-z\$_][\w\$]*)/gi, " $1") | |
.replace(/([^a-z\$_])AND([^a-z\$_])/gi, "$1 && $2") | |
.replace(/(\!?)\sAND(\W)/g, "&& $2$1") | |
.replace(/([\w\$]+)\s+XOR\s+([\w\$]+)/gi, "$1,,,,,$2") | |
.replace(/([^a-z\$_])OR([^a-z\$_])/gi, "$1||$2") | |
.replace(/(\!?)\sOR(\W)/g, " ||$2$1") | |
.replace(/(\s*)(var|const)\s+([@\w\$\.]+)\s*([\*\/\+\-\%\&\|]?)\=\s*(.+)\s+(if|when|where)(\W.+)([\.;][^\w\$])\)?/gi, "$1$2 $3;\n$1if $7 {\n$1 $3 $4= $5\n$1}\n") | |
.replace(/(\s*)([@\w\$\.]+)\s*([\*\/\+\-\%\&\|]?)\=\s*(.+)\s+(if|when|where)(.+)([\.;][^\w\$])\)?/gi, "$1if $6 {\n$1 $2 $3= $4\n$1}") | |
.replace(/(\s*)(.+)\s+(if|when|where)(.+)([\.;][^\w\$])\)?/g, "$1if $4 {\n$1 $2\n$1}\n") | |
.replace(/(\s*)(var|const)\s+([@\w\$\.]+)\s*([\*\/\+\-\%\&\|]?)\=\s*(.+)\s+(unless)(.+)([\.;][^\w\$])\)?/gi, "$1$2 $3;\n$1if !$7 {\n$1 $3 $4= $5\n$1}\n") | |
.replace(/(\s*)([@\w\$\.]+)\s*([\*\/\+\-\%\&\|]?)\=\s*(.+)\s+(unless)(.+)([\.;][^\w\$])\)?/gi, "$1if !$6 {\n$1 $2 $3= $4\n$1}\n") | |
.replace(/(\s*)(.+)\s+(unless)(.+)([\.;][^\w\$])\)?/g, "$1if !$4 {\n$1 $2\n$1}\n") | |
.replace(/if\s+(.+)\s+then\s+(.+)\s+else\s+(.+)/g, "($1),,, $2,,,, $3") | |
.replace(/(\})\s*else\s+(if|when|where)(.+)(\{)/g, "} else-if ($3) {") | |
.replace(/unless\s+(.+)(\{)(\s+)/g, "if !$1 {\n$3") | |
.replace(/if([^\w\$])(.+)([^\)]\s*)\{/g, "if($1$2$3) {") | |
.replace(/if([^\w\$])(.+)([^\)]\s*)\{/g, function(e) { | |
var r = e.replace(/\{$/, ""), t = 0, _ = "", a = "", n = 0; | |
e = r.replace(/\(|\)/g, function(e) { | |
if ("(" === e) t--; else t++; | |
}); | |
if (0 === t) return r + "{"; else n = t > 0 ? -1 : 1; | |
e = r; | |
for (0 > t ? _ = "\\(" : a = "\\)"; 0 != t; t += n) if (/\($/.test(e)) e = e.replace(/\($/, ""); else e = e.replace(RegExp(_ + "(.+?)" + a), "$1"); | |
return "if (" + e | |
.replace("if", "") | |
.replace(/\(\s*/g, "(") | |
.replace(/\s*\)/g, ")") + ") {"; | |
}) | |
.replace(/([\.;\}]\s+)else(\s+[^\{])/g, "} else {$2") | |
.replace(/([^\}]\s+)else(\s+[^\{])/g, "$1} else {$2") | |
.replace(/(\s*)\}\s*else\s*\{(.+)[\.;]/g, "\n$1} else {\n$1 $2\n$1}") | |
.replace(/([a-z\$_][\w\$\.]*)\s*\=\s*(.+)\s+in\s+([a-z\$_][\w\$\.]*)([\.;\n]\s?)/gi, "$1 = $3[$2]\n") | |
.replace(/([a-z\$_][\w\$\.]*)\s*\=\s*(.+)\s+from\s+([a-z\$_][\w\$\.]*)([\.;\n]\s?)/gi, "$1 = $3.indexOf($2)\n") | |
.replace(/(\s*)(.+)\s+from\s+([a-z\$_][\w\$\.]*)\s+while\s+([a-z\$_][\w\$\.]*)([^;\n]+)([\.;\n]\s?)/gi, "$1for(var $3_<!> = 0; $3_<!> < $3.length; $3_<!>++){\n$1 var $4 = $3[$3_<!>],,\n$1 if($4$5){\n$1 $2\n$1 }\n$1}\n") | |
.replace(/(\s*)(.+)\s+from\s+([a-z\$_][\w\$\.]*)\s+while\s+([a-z\$_][\w\$\.]*)([\.;\n]\s?)/gi, "$1for(var $3_<!> = 0; $3_<!> < $3.length; $3_<!>++){\n$1 var $4 = $3[$3_<!>],,\n$1 if($4){\n$1 $2\n$1 }\n$1}\n") | |
.replace(/(\s*)([a-z\$_][\w\$\.]*)\s+([a-z\$_][\w\$\.]*)([^\)]*)\s+from\s+([a-z\$_][\w\$\.]*)([\.;\n]\s?)/gi, "$1for(var $5_<!> = 0; $5_<!> < $5.length; $5_<!>++){\n$1 var $3 = $5[$5_<!>],,\n$1 $2($3)\n$1}\n") | |
.replace(/(\s*)(.+)\s+from\s+\[([\w\W]+)\]\s+while\s+([a-z\$_][\w\$\.]*)([^;\n]+)([\.;\n]\s?)/gi, "$1var <?> = [$3],,\n$1for(var <?>_<!> = 0; <?>_<!> < <?>.length; <?>_<!>++){\n$1 var $4 = <?>[<?>_<!>],,\n$1 if($4$5){\n$1 $2\n$1 }\n$1}\n") | |
.replace(/(\s*)(.+)\s+from\s+([a-z\$_][\w\$\.]*)\s+while\s+\[([\w\W]+)\]([\.;\n]\s?)/gi, "$1var <?> = [$3],,\n$1for(var <?>_<!> = 0; <?>_<!> < <?>.length; <?>_<!>++){\n$1 var $4 = <?>[<?>_<!>],,\n$1 if($4){\n$1 $2\n$1 }\n$1}\n") | |
.replace(/(\s*)([a-z\$_][\w\$\.]*)\s+([a-z\$_][\w\$\.]*)([^\)]*)\s+from\s+\[([\w\W]+)\]([\.;\n]\s?)/gi, "$1var <?> = [$5],,\n$1for(var <?>_<!> = 0; <?>_<!> < <?>.length; <?>_<!>++){\n$1 var $3 = <?>[<?>_<!>],,\n$1 $2($3)\n$1}\n") | |
.replace(/(\s*)(?:var\s)?([a-z\$_][\w\$\.]*)\s*\+?\=\s*(?!var\s?)([a-z\$_][\w\$\.]*)\s+in\s+([a-z\$_][\w\$\.]*)\s+while\s+(in|\.\.\.?)([\.;\n]\s?)/gi, "$1var $2 = [],,\n$1for(var $3 in $4){\n$1 $2.push($4[$3])\n$1}\n") | |
.replace(/(\s*)(?:var\s)?([a-z\$_][\w\$\.]*)\s*\+?\=\s*(?!var\s?)([a-z\$_][\w\$\.]*)\s+in\s+([a-z\$_][\w\$\.]*)\s+while\s+\2\s+in\s+\3([\.;\n]\s?)/gi, "$1var $2 = [],,\n$1for(var $3 in $4){\n$1 $2.push($4[$3])\n$1}\n") | |
.replace(/(\s*)(?:var\s)?([a-z\$_][\w\$\.]*)\s*\+?\=\s*(?!var\s?)([a-z\$_][\w\$\.]*)\s+in\s+([a-z\$_][\w\$\.]*)([\.;\n]\s?)/gi, "$1var $2 = [],,\n$1for(var $3 in $4){\n$1 $2.push($4[$3])\n$1}\n") | |
.replace(/(\s*)(.+)\s+(while)(.+)([\.;][^\w\$])\)?/gi, "$1while($3){\n$1 $2\n$1}\n") | |
.replace(/(\s*)(.+)\s+(until)(.+)([\.;][^\w\$])\)?/gi, "$1while(!$3){\n$1 $2\n$1}\n"); | |
for (k = /\-?for\s+([^\n"'`,;]+)([,;]+)([^\n"'`,;]+)\2([^\n"'`,;]+)\2([^\n"'`,;]+)\s*(\{)/; k.test(__); ) __ = __.replace(k, function(e) { | |
var r = RegExp.$1, t = RegExp.$3, _ = RegExp.$4, a = RegExp.$5, n = "-" !== e[0] || +_ > +t ? "<" : ">", s = "<" === n ? "+" : "-"; | |
return "for(var " + r + " = " + t + ";\b " + r + n + _ + ";\b " + r + s + "=" + a + ") {"; | |
}); | |
for (k = /\-?for\s*\s+([^\n"'`,;]+)([,;]+)([^\n"'`,;]+)\2([^\n"'`,;]+)\s*(\{)/; k.test(__); ) __ = __.replace(k, function(e) { | |
var r = RegExp.$1, t = RegExp.$3, _ = RegExp.$4, a = "-" !== e[0] || +t > 0 ? "<" : ">", n = "<" === a ? "+" : "-"; | |
return "for(var " + r + " = 0;\b " + r + a + t + ";\b " + r + n + "=" + _ + ") {"; | |
}); | |
for (k = /\-?for\s*\s+([^\n"'`,;]+)([,;]+)([^\n"'`,;]+)\s*(\{)/; k.test(__); ) __ = __.replace(k, function(e) { | |
var r = RegExp.$1, t = RegExp.$3, _ = "-" !== e[0] || +t > 0 ? "<" : ">", a = "<" === _ ? "++" : "--"; | |
return "for(var " + r + " = 0;\b " + r + _ + t + ";\b " + r + a + ") {"; | |
}); | |
__ = __ | |
.replace(/(\s*)for\s*\s+(var\s+)?([a-z\$_][\w\$]*)(?:\s+in\s+|\s*\:\s*)([a-z\$_][\w\$]*)\s+(\{)/gi, runtime.has("1.4") ? "$1for($2$3 in $4) {" : "$1for($2$3_in = 0; $4_in = Array($4), $3_in < $4_in.length; $3_in++) {\n$1 var $3 = $4_in[$3_in];") | |
.replace(/(\s*)for\s+([a-z\$_][\w\$]*)(?:\s+in\s+|\s*\:\s*)([a-z\$_][\w\$]*)\s+(?:do|\?)\s+(.+)/gi, "$1for(var $2 = 0; $2 < $3.length; $2++) {\n$1 $4\n$1}\n") | |
.replace(/\sdo\:?\s*\n/g, "do {") | |
.replace(/while\s+(.+?)([\{\n])/g, "while($1)$2") | |
.replace(/until\s+(.+?)([\{\n])/g, "while(!$1)$2") | |
.replace(/switch\s+(.+)(\{)/g, "switch($1) {") | |
.replace(/\(\s*([\w\$\.])\s*(\&\&|\|\|)\s*([\w\$\.])\s*([\=\!]\=+)\s*([^\)]+?)\s*\)/gi, "($1 $4 $5 $2 $3 $4 $5)") | |
.replace(/([\w\$\.]+)\s*(\&\&|\|\|)\s*([\w\$\.]+)\s?\!\!\s?(exists?)/gi, "(typeof ($1 $2 $3) !== '<#>' && ($1 $2 $3) !== null)") | |
.replace(/([\w\$\.]+)\s*(\&\&|\|\|)\s*([\w\$\.]+)\s?\!\s?(exists?)/gi, "(typeof ($1 $2 $3) === '<#>' || ($1 $2 $3) === null)") | |
.replace(/([\w\$\.]+)\s*(\&\&|\|\|)\s*([\w\$\.]+)\s+(exists?)/gi, "(typeof ($1 $2 $3) !== '<#>' && ($1 $2 $3) !== null)") | |
.replace(/([\w\$\.]+)\s+\!\s?(exists?)/gi, "(typeof $1 === '<#>' || $1 === null)") | |
.replace(/([\w\$\.]+)\s+(exists?)/gi, "(typeof $1 !== '<#>' && $1 !== null)") | |
.replace(/else[-\s](if|when|where)/g, "else if") | |
.replace(/,,,,,/g, "^") | |
.replace(/,,,,/g, ":") | |
.replace(/,,,/g, "?") | |
// .replace(/,,/g, ";") | |
.replace(/#000/g, ".") | |
.replace(/#00/g, "") | |
.replace(/#0/g, "var ") | |
.replace(/<\?>/g, "ANON") | |
.replace(/<\!>/g, "index_counter") | |
.replace(/<#>/g, "undefined") | |
.replace(/\(\s*([\&\|\=\!]+)\s*\)/g, "$1"); | |
} | |
if ("!" === _legacy) { | |
// expelled: "typeof, false, null, super, this, true, eval" | |
for (var L = "abstract|boolean|break|byte|case|char|class|const|continue|debugger|default|delete|do|double|else|enum|export|extends|final|finally|float|function|goto|implements|import|in|instanceof|int|interface|let|long|native|new|package|private|protected|public|return|short|static|synchronized|throw|throws|transient|try|undefined|var|void|volatile|with|yield", k = /(<?[a-z\$_][\w\$]*)\x20+([\w\$@#][\w\$\.]*[^;\n\)\{]*|[\b]([ds]q|ga|re)\[\d+][\b])/i; k.test(__); ) { | |
// experimental [apply without ()] // all godets | |
var $1 = RegExp.$1, $2 = RegExp.$2, R = RegExp("([^\\w\\$]|^)(" + L + ")([^\\w\\$]|$)"), _1 = L.split("|").indexOf($1), _2 = L.split("|").indexOf($2); | |
if (-1 === _1 && !R.test($2) && -1 === "typeof false null true var".split(" ").indexOf($1)) __ = __ | |
.replace(k, "$1($2)") | |
.replace(/\(\s+/g, "(") | |
.replace(/\s+\)/g, ")"); else __ = __.replace(k, "$1//$2"); | |
} | |
__ = __.replace(/\/\//g, " "); | |
} | |
if ("!" === _advance) { | |
__ = __ | |
.replace(/function\s+([a-z\$_][\w\$]*)/gi, "function $1\b"); | |
var j = /([a-z\$_][\w\$]*[^\u0008\s])\s*\((.*?)\)\s*\{/i; | |
for(var i = 0;j.test(__) && !runtime.has("1.6") && i < 60; i++) { | |
__ = __ | |
.replace(j, function (e) { | |
var E = "for function if switch while" | |
.split(" "), | |
$1 = RegExp.$1, | |
$2 = RegExp.$2; | |
if(E.indexOf($1) > -1) | |
return e.replace($1, $1 + "\b"); | |
if($2.indexOf("(") !== -1 || $2.indexOf(")") !== -1) | |
return e.replace($1, $1 + "\b"); | |
return "this." + $1 + " = function\b (" + $2 + ") {" | |
}); | |
} | |
__ = __ | |
.replace(/([a-z\$_][\w\$]*)\s*\(([^\(\)\n\r\u2028\u2029]+)\)\s*\{/gi, runtime.has("1.6") ? "$1 ($2) {" : "this.$1 = function($2) {") | |
.replace(/this\.function\s*\=\s*function/g, "function") | |
.replace(/this\.(abstract|boolean|break|byte|case|catch|char|class|const|continue|debugger|default|delete|do|double|else|enum|export|extends|final|finally|float|for|goto|if|implements|import|in|instanceof|int|interface|let|long|native|new|null|package|private|protected|public|return|short|static|switch|synchronized|throw|throws|transient|try|typeof|undefined|var|volatile|while|with|yield)\s*\=\s*function/g, "$1") | |
.replace(/function\s+this\.([a-z\$_][\w\$]*)\s*\=\s*function/g, "function $1"); | |
} | |
if ("!" === _ugly) { | |
__ = __ | |
.replace(/([^\:])\/\/(.+)/g, "$1/*$2*/") | |
.replace(/\*\/(\s*)\/\*/g, "$1") | |
.replace(/([^\w\$])undefined([^\w\$])/g, "$1void 0$2") | |
.replace(/([^\w\$])(true|\!false|\!\!true)([^\w\$])/g, "$1!0$2") | |
.replace(/([^\w\$])(false|\!true|\!\!false)([^\w\$])/g, "$1!1$2") | |
.replace(/([^\w\$])while\s*\((.+)\s?\)/g, "$1for(;$2;)") | |
.replace(/([^\w\$])Number\s*\(/g, "$1(+") | |
.replace(/\.toString\s*\(\s*\)/g, '+""') | |
.replace(/([\&\|])\1/g, "$1") | |
.replace(/([\+\-])\s*\=\s*1(\D)/g, "$1$1$2") | |
.replace(/([a-z\$_][\w\$]*)\s*\=\s*\1\s*([\&\|]+|[\*\/\+\-\%])/gi, "$1 $2= "); | |
for (var zero = 1; __.match(/00+/); ) { | |
__.replace(/00+/, "$1"); | |
k = RegExp.$1; | |
__ = __.replace(/0(?=0)/, "/e/"); | |
zero++; | |
} | |
__ = __ | |
.replace(/\/e\/0/, "e" + zero + " ") | |
.replace(/(\/e\/)+/g, ""); | |
for (k = /(\d*)\.e(\d+)\s(\d+)/; k.test(__); ) __ = __.replace(k, function(e) { | |
e = e.split(/[\.\s]/); | |
var r = 0 == +e[0] ? e[2] : e[0] + "+" + e[2]; | |
return zero = -zero, r + e[1] | |
.replace("e", "e-"); | |
}); | |
} | |
__ = __ | |
.replace(/\n{2,}|\n\x20+\n/g, "\n") | |
.replace(/\.(\s*)([\)\]\}])/g, "$2.$1") | |
.replace(/(\s*)\}\.\n/g, ".\n$1}") | |
.replace(/([\]\}])\s+(\)|\])/g, "$1$2") | |
.replace(/([^;\.,])\n/g, "$1;\n") | |
.replace(/,?\s*;(\s*[a-z\$_][\w\$]*)\s*\:/gi, ",$1:"); | |
if ("!" === _htmleditor || "!" === _jseditor) { | |
__ = __ | |
.replace(/\n+/gm, "\n") | |
.replace(/\n([a-z])/gi, "\n\n$1") | |
.replace(/(.+)([\{\:])\s*\n(.+)/g, "$1$2\n $3\bind\b"); | |
for (rq = /[\b]ind[\b]\n([^\}\n]+)/; rq.test(__); ) __ = __.replace(rq, function() { | |
for (k = /[\b]ind[\b]\n([^\}\n]+)/; k.test(__); ) __ = __.replace(k, "\n $1\bind\b"); | |
return __.replace(k, ""); | |
}); | |
__ = __ | |
.replace(/\}\n+else([^\w\$])/g, "} else$1") | |
.replace(/\{\s+\}/g, "{}") | |
.replace(/\n+/g, "\n") | |
.replace(/function\s+([^\(\)]+?)\{/g, "function($1) {"); | |
} | |
// rebuild | |
Tuxedo.precompiled = { | |
channels: { | |
no: nch_, | |
to: tch_ | |
}, | |
comments: { | |
plural: cmm_, | |
single: cms_ | |
}, | |
content: __ | |
.replace(/[\b]\.bs\./g, "\\\\") | |
.replace(/[\b]\.re\./g, "\\/") | |
.replace(/[\b]\.dq\./g, '\\"') | |
.replace(/[\b]\.sq\./g, "\\'") | |
.replace(/[\b]\.ga\./g, "\\`") | |
.replace(/[\b]\.dl\./g, "\\$") | |
.replace(/\\(.)/g, "\b$1\b") | |
.replace(/(\W)var\s*\=.+/g, "$1") | |
.replace(/@@/g, "this.@") | |
.replace(/([^\w\$])@([a-z\$_][\w\$]*)/gi, "$1this.$2") | |
.replace(/(?![\b])@(?![\b])/g, "this") | |
.replace(/([\(\[\{,;\:\?\!\*\/\+\-\=%<>]\s*);(\s*)/g, "$1$2") | |
.replace(/;(\s*[\*\/\+\-\=%,\.\}\]\?\:]|\s*else|\s*while)/g, "$1") | |
.replace(/\*(\s*[\/\+\-%,\.\}\]\?\:]|\s*else|\s*while|\s*\={2,3})/g, "$1") | |
.replace(/;(\s*[\)])/g, "$1") | |
.replace(/(\s+);(\s+)/g, "$1$2") | |
.replace(/(["'])use\sstrict\1/g, "$1use strict$1;") | |
.replace(/([^\w\$])switch\((.+)\)\s*;/g, "$1switch($2) {") | |
.replace(/([^\w\$])break([,\n])/g, "$1break;\n") | |
.replace(/,,/g, ";") | |
.replace(/;+/g, ";") | |
.replace(/([\(\[\{\:]\s*),/g, "$1") | |
.replace(/,\s*([\)\]\}])/g, "$1") | |
.replace(/([\w\$]+)@([\w\$]+)/gi, "$1.prototype.$2") | |
.replace(/([^\\])\.([\s;\}]+)/g, "$1;$2") | |
.replace(/function\s+([^\(\)]+?)\s?\{/g, "function($1) {") | |
.replace(/([\{\[\(])\n+/g, "$1\n") | |
.replace(/(\$)[\b]([1-9])/g, "$1$2") | |
.replace(/[\b](.)[\b]/g, "\\$1") | |
.replace(/;\s*[,;]/g, ";") | |
.replace(/,\s*[,;]/g, ",") | |
.replace(/\*(\s*[\&\|\!\^])/g, "$1") | |
.replace(/\$\\([1-9])/g, "\$$1") | |
.replace(/^\s|\s+$/g, "") | |
.replace(/([a-z\$_][\w\$]*\s*)\.\s*function\s*([a-z\$_][\w\$]*\s*)\((.+)\)\s*\{\s*return\s+(.+)\}/gi, "$1.$2($3) = $4") | |
.replace(/function\s+this\./g, "this."), | |
regexps: rx_, | |
strings: { | |
"double": dq_, | |
grave: ga_, | |
single: sq_ | |
}, | |
threads: { | |
available: "advance clean eval greek hide htmleditor jseditor jsunit legacy math ugly wordy".split(" "), | |
disabled: function() { | |
a = "advance clean eval greek hide htmleditor jseditor jsunit legacy math ugly wordy".split(" "); | |
b = []; | |
for (var x = 0; x < a.length; x++) if ("!" !== eval("_" + a[x])) b.push(a[x]); | |
return b; | |
}(), | |
enabled: function() { | |
a = "advance clean eval greek hide htmleditor jseditor jsunit legacy math ugly wordy".split(" "); | |
b = []; | |
for (var x = 0; x < a.length; x++) if ("!" === eval("_" + a[x])) b.push(a[x]); | |
return b; | |
}() | |
} | |
}; | |
rq = /(abstract|boolean|byte|case|catch|char|const|continue|debugger|default|delete|do|double|else|enum|export|extends|final|finally|float|for|function|goto|if|implements|import|in|instanceof|int|interface|let|long|native|new|null|package|private|protected|public|return|short|static|switch|synchronized|throw|throws|transient|try|typeof|undefined|var|volatile|while|with|yield|@|#|\$)/g; | |
for (;__.match(__cmm__); ) { | |
// put multi-line comments back | |
M = +__.match(__cmm__)[0] | |
.replace(/\D/g, ""); | |
__ = __ | |
.replace(__cmm__, cmm_[M] | |
.replace(rq, "\b$1\b")); | |
} | |
for (;__.match(__cms__); ) { | |
// put single line comments back | |
L = +__.match(__cms__)[0] | |
.replace(/\D/g, ""); | |
__ = __ | |
.replace(__cms__, cms_[L] | |
.replace(rq, "\b$1\b")); | |
} | |
// @embroideries and fix | |
__ = __.replace(/\[\*([^\[]+?)\]/g, function(e) { | |
return e | |
.replace(/\*/, "") | |
.replace(/\s*[\*,]\s*\]/g, "]") | |
.replace(/\s/g, ",") | |
.replace(/,+/g, ", "); | |
}) | |
.replace(/\s*\+\s*,/g, "") | |
.replace(/(.+)\/\/(.+)([;,]+)/g, "$1$3 //$2") | |
.replace(/\/\/(.+)\n+(;\s*)+/g, "//$1") | |
.replace(/([\b]@[\b]|this\.)aut\:(.+[^,])/g, "author: $2") | |
.replace(/([\b]@[\b]|this\.)lie\:(.+[^,])/g, "license: $2") | |
.replace(/([\b]@[\b]|this\.)dat\:(.+[^,])/g, "date: $2") | |
.replace(/([\b]@[\b]|this\.)tie\:(.+[^,])/g, "time: $2") | |
.replace(/([\b]@[\b]|this\.)url\:(.+[^,])/g, "URL: $2") | |
.replace(/([\b]@[\b]|this\.)ver\:(.+[^,])/g, "Version: $2") | |
.replace(/[\b](.)[\b]/g, "$1"); | |
if("!" === _legacy) | |
for(var reg = /[\b](sq|dq|ga)\[(\d+)\][\b]?\s+[\b]?\1\[(\d+)\][\b]/; __.match(reg);) { | |
__.replace(reg); | |
var k = RegExp.$1, K = RegExp.$2, j = RegExp.$3; | |
__ = __.replace(reg, j = "\b$1[$2]\b + \b$1[$3]\b"); | |
}; | |
for (;__.match(__sq__); ) { | |
// put single quotes back | |
y = +__.match(__sq__)[0] | |
.replace(/\D/g, ""); | |
__ = __ | |
.replace(__sq__, sq_[y] | |
.replace(RegExp(__dq__.source, "g"), function(e) { | |
return dq_[+e | |
.replace(/\D/g, "")] | |
})) | |
.replace(/''/g, "'\b'"); | |
if ("!" === _legacy) { | |
// TS related, and interpolation | |
for (;__.match(r = /([1-9][\d]*)\s*\*\s*'(.*?)'/); ) { | |
// dimension strings | |
__.replace(r); | |
k = +RegExp.$1; | |
K = RegExp.$2; | |
__ = __.replace(r, "/str/"); | |
for (var y = 0; k > y; y++) __ = __.replace(/\/str\//, "'" + K + "' + /str/"); | |
__ = __.replace(/\s\+\s\/str\//, ""); | |
} | |
__ = __ | |
.replace(/\$\{([^'\}]+?)\}/g, "' + ( $1 ) + '") | |
.replace(/''\s\+\s|\s\+\s''/g, ""); | |
} | |
} | |
for (;__.match(__dq__); ) { | |
// put double quotes back | |
x = +__.match(__dq__)[0] | |
.replace(/\D/g, ""); | |
__ = __ | |
.replace(__dq__, dq_[x]) | |
.replace(/""/g, "\"\b\""); | |
if ("!" === _legacy) { | |
// TS related, and interpolation | |
for (;__.match(r = /([1-9][\d]*)\s*\*\s*"(.*?)"/); ) { | |
// dimension strings | |
__.replace(r); | |
k = +RegExp.$1; | |
K = RegExp.$2; | |
__ = __.replace(r, "/str/"); | |
for (var x = 0; k > x; x++) __ = __.replace(/\/str\//, '"' + K + '" + /str/'); | |
__ = __.replace(/\s\+\s\/str\//, ""); | |
} | |
__ = __ | |
.replace(/\$\{([^"\}]+?)\}/g, '" + ( $1 ) + "') | |
.replace(/""\s\+\s|\s\+\s""/g, ""); | |
} | |
} | |
__ = __.replace(/([^\\])`/g, "$1\\'"); | |
// embeded grave accents | |
for (;__.match(__ga__); ) { | |
// put grave accents back | |
z = +__.match(__ga__)[0] | |
.replace(/\D/g, ""); | |
__ = __ | |
.replace(__ga__, ga_[z] | |
.replace(/'/g, "\b.sq.") | |
.replace(/;\n/g, " ") | |
.replace(/``/g, "`\b`")); | |
if ("!" === _legacy) { | |
// TS related, and interpolation | |
for (;__.match(r = /([1-9][\d]*)\s*\*\s*`(.*?)`/); ) { | |
// dimension strings | |
__.replace(r); | |
k = +RegExp.$1; | |
K = RegExp.$2; | |
__ = __.replace(r, "/str/"); | |
for (var z = 0; k > z; z++) __ = __.replace(/\/str\//, "`" + K + "` + /str/"); | |
__ = __.replace(/\s\+\s\/str\//, ""); | |
} | |
__ = __ | |
.replace(/\$\{([^`\}]+?)\}/g, runtime.has("1.6") ? "$\b{$1}" : "` + ( $1 ) + `") | |
.replace(/``\s\+\s|\s\+\s``/g, ""); | |
} | |
} | |
// Again | |
for (;__.match(__sq__); ) { | |
// put single quotes back, again | |
y = +__.match(__sq__)[0] | |
.replace(/\D/g, ""); | |
__ = __ | |
.replace(__sq__, sq_[y] | |
.replace(/'/g, "\b.sq.") | |
.replace(/''/g, "'\b'")); | |
if ("!" === _legacy) // TS related, and interpolation | |
__ = __.replace(/\$\{([^\}]+?)\}/g, "' + ( $1 ) + '"); | |
} | |
for (;__.match(__dq__); ) { | |
// put double quotes back, again | |
x = +__.match(__dq__)[0] | |
.replace(/\D/g, ""); | |
__ = __ | |
.replace(__dq__, dq_[x] | |
.replace(/""/g, "\"\b\"")); | |
if ("!" === _legacy) // TS related, and interpolation | |
__ = __.replace(/\$\{([^\}]+?)\}/g, "' + ( $1 ) + '"); | |
} | |
for (;__.match(__rx__); ) { | |
// put regular expressions back | |
a = +__.match(__rx__)[0] | |
.replace(/\D/g, ""); | |
__ = __.replace(__rx__, rx_[a]); | |
} | |
if ("!" === _legacy) { | |
/* Reserved RegExp Escape Sequences | |
. - [^\n\r\u2028\u2029] | |
\d - [0-9] | |
\D - [^0-9] | |
\w - [A-Za-z0-9_] | |
\W - [^A-Za-z0-9_] | |
\s - [ \f\n\r\t\v\u00a0\u1680\u180e\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff] | |
\S - [^ \f\n\r\t\v\u00a0\u1680\u180e\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff] | |
\t - "horizontal tab" | |
\r - "carriage return" | |
\n - "newline feed" | |
\v - "vertical tab" | |
\f - "form feed" | |
\b - "zero width word" | |
\B - "zero width non-word" | |
[\b] - "backspace" [\u0008] | |
\0 - "NUL" | |
\c# - (# = [A-Z]) "control-#" | |
\x## - (# = [0-9a-f]) character code ## | |
\u#### - (# = [0-9a-f]) character code #### | |
*/ | |
__ = __ | |
.replace(/[\b](.)[\b]/g, "\\$1") | |
.replace(/(\\.|[^\\]\[.*?[^\\]\]|[^\\]\(.*?[^\\]\))\+\+/g, "$1$1+") | |
.replace(/\\a/g, "[a-zA-Z]") | |
.replace(/\\A/g, "[^a-zA-Z]") | |
.replace(/\\j/g, "[a-zA-Z\\$_][\\w\\$]*") | |
.replace(/\\J/g, "[^a-zA-Z\\$_][\\w\\$]*") | |
.replace(/\\e/g, "[A-Z\\u0391-\\u03a9a-z\\u03b1-\\u03c9_]") | |
.replace(/\\E/g, "[^A-Z\\u0391-\\u03a9a-z\\u03b1-\\u03c9_]"); | |
// \k | |
for (k = /\\k(\[.*?\])/; k.test(__); ) __ = __.replace(k, function() { | |
return RegExp.$1.toLowerCase() | |
.replace(/(\w\-\w)\1/g, "$1"); | |
}); | |
// \K | |
for (k = /\\K(\[.*?\])/; k.test(__); ) __ = __.replace(k, function() { | |
return RegExp.$1.toUpperCase() | |
.replace(/(\w\-\w)\1/g, "$1"); | |
}); | |
} | |
__ = __ | |
.replace(/[\b]\.bs\./g, "\\\\") | |
.replace(/[\b]\.re\./g, "\\/") | |
.replace(/[\b]\.dq\./g, '\\"') | |
.replace(/[\b]\.sq\./g, "\\'") | |
.replace(/[\b]\.ga\./g, "\\`") | |
.replace(/[\b]\.dl\./g, "\\$"); | |
// string multi-lining | |
__ = __.replace(/`([^`]+?)`/gm, runtime.has("1.6") ? "`$1`" : function(e) { | |
if (/[\!\\]white-space/.test(e)) e = e | |
.replace(/[\!\\]white-space/, "") | |
.replace(/\s+/g, " "); | |
return e | |
.replace(/\n/g, " ") | |
.replace(/`/g, "'"); | |
}); | |
__ = __ | |
.replace(/\\(.)/g, "\b$1\b") | |
.replace(/(\W)var\s*\=.+/g, "$1") | |
.replace(/@@/g, "this.@") | |
.replace(/([^\w\$])@([a-z\$_][\w\$]*)/gi, "$1this.$2") | |
.replace(/(?![\b])@(?![\b])/g, "this") | |
.replace(/([\(\[\{,;\:\?\!\*\/\+\-\=%<>]\s*);(\s*)/g, "$1$2") | |
.replace(/;(\s*[\*\/\+\-\=%,\.\}\]\?\:]|\s*else|\s*while)/g, "$1") | |
.replace(/\*(\s*[,\}\]\?\:]|\s*else|\s*while|\s*\={2,3})/g, "$1") | |
.replace(/;(\s*[\)])/g, "$1") | |
.replace(/(\s+);(\s+)/g, "$1$2") | |
.replace(/(["'])use\sstrict\1/g, "$1use strict$1;") | |
.replace(/([^\w\$])switch\((.+)\)\s*;/g, "$1switch($2) {") | |
.replace(/([^\w\$])break([,\n])/g, "$1break;\n") | |
.replace(/,,/g, ";") | |
.replace(/;+/g, ";") | |
.replace(/([\(\[\{\:]\s*),/g, "$1") | |
.replace(/,\s*([\)\]\}])/g, "$1") | |
.replace(/([\w\$]+)@([\w\$]+)/gi, "$1.prototype.$2") | |
.replace(/([^\\])\.([\s;\}]+)/g, "$1;$2") | |
.replace(/function\s+([^\(\)]+?)\s?\{/g, "function($1) {") | |
.replace(/([\{\[\(])\n+/g, "$1\n") | |
.replace(/(\$)[\b]([1-9])/g, "$1$2") | |
.replace(/[\b](.)[\b]/g, "\\$1") | |
.replace(/;\s*[,;]/g, ";") | |
.replace(/,\s*[,;]/g, ",") | |
.replace(/\*(\s*[\&\|\!\^])/g, "$1") | |
.replace(/\$\\([1-9])/g, "\$$1") | |
.replace(/^\s|\s+$/g, "") | |
.replace(/([a-z\$_][\w\$]*\s*)\.\s*function\s*([a-z\$_][\w\$]*\s*)\((.+)\)\s*\{\s*return\s+(.+)\}/gi, "$1.$2($3) = $4") | |
.replace(/function\s+this\./g, "this."); | |
// handle other features | |
window.JSUNIT = {}; | |
if ("!" === _jsunit) { | |
window.JSUNIT = { | |
after: "", | |
before: "", | |
count: 1, | |
out: function(e) { | |
JSUNIT.count++; | |
if (!JSUNIT.toconsole) document.body.innerHTML += e | |
.replace(/\n\s\s/g, "\n ") | |
.replace(/\n/g, "<br>"); else console.log(e); | |
}, | |
test: {}, | |
toconsole: !1 | |
}; | |
for (k = /this\.(Before|After)/; k.test(__); ) __ = __.replace(k, function(e) { | |
e = e.replace(/this\./, ""); | |
if (/Before/.test(e)) JSUNIT.before = "\n" + e + "();"; else if (/After/.test(e)) JSUNIT.after = e + "();\n"; | |
return "function " + e + "()"; | |
}); | |
__ = __ | |
.replace(/\(this\.Test(.*)\{/g, "(function($1){" + JSUNIT.before) | |
.replace(/\}(#|self)\);?/g, JSUNIT.after + "})();") | |
.replace(/this\.this/g, "JSUNIT") | |
.replace(/JSUNIT\.toconsole/g, function(e) { | |
JSUNIT.toconsole = !0; | |
return e; | |
}); | |
JSUNIT.assert = function(e, r) { | |
r = "[Test #" + JSUNIT.count + "]\n < assert(" + tux['typeof'](e) + ", " + tux['typeof'](r) + ") >\n recieved: " + tux['typeof'](r); | |
JSUNIT.out(r + "\n"); | |
}; | |
JSUNIT.assertTrue = function(e, r) { | |
if (e === !0) return JSUNIT.count++; | |
r = r || "[Error: Test #" + JSUNIT.count + "]\n < assertTrue(" + tux['typeof'](e) + ", " + tux['typeof'](r) + ") >\n expected: true\n recieved: " + tux['typeof'](e); | |
JSUNIT.out(r + "\n"); | |
}; | |
JSUNIT.assertFalse = function(e, r) { | |
if (e === !1) return JSUNIT.count++; | |
r = r || "[Error: Test #" + JSUNIT.count + "]\n < assertFalse(" + tux['typeof'](e) + ", " + tux['typeof'](r) + ") >\n expected: false\n recieved: " + tux['typeof'](e); | |
JSUNIT.out(r + "\n"); | |
}; | |
JSUNIT.assertEquals = function(e, r, t) { | |
if (e === r) return JSUNIT.count++; | |
t = t || "[Error: Test #" + JSUNIT.count + "]\n < assertEquals(" + tux['typeof'](e) + ", " + tux['typeof'](r) + ", " + tux['typeof'](t) + ") >\n expected: " + tux['typeof'](e) + "\n recieved: " + tux['typeof'](r); | |
JSUNIT.out(t + "\n"); | |
}; | |
JSUNIT.assertNotEquals = function(e, r, t) { | |
if (e !== r) return JSUNIT.count++; | |
t = t || "[Error: Test #" + JSUNIT.count + "]\n < assertNotEquals(" + tux['typeof'](e) + ", " + tux['typeof'](r) + ", " + tux['typeof'](t) + ") >\n did not expect: " + tux['typeof'](e) + "\n recieved: " + tux['typeof'](r); | |
JSUNIT.out(t + "\n"); | |
}; | |
JSUNIT.assertNull = function(e, r) { | |
if (null === e) return JSUNIT.count++; | |
r = r || "[Error: Test #" + JSUNIT.count + "]\n < assertNull(" + tux['typeof'](e) + ", " + tux['typeof'](r) + ") >\n expected: null\n recieved: " + tux['typeof'](e); | |
JSUNIT.out(r + "\n"); | |
}; | |
JSUNIT.assertNotNull = function(e, r) { | |
if (null !== e) return JSUNIT.count++; | |
r = r || "[Error: Test #" + JSUNIT.count + "]\n < assertNotNull(" + tux['typeof'](e) + ", " + tux['typeof'](r) + ") >\n did not expect: null\n recieved: " + tux['typeof'](e); | |
JSUNIT.out(r + "\n"); | |
}; | |
JSUNIT.assertUndefined = function(e, r) { | |
if (undefined === e) return JSUNIT.count++; | |
r = r || "[Error: Test #" + JSUNIT.count + "]\n < assertUndefined(" + tux['typeof'](e) + ", " + tux['typeof'](r) + ") >\n expected: undefined\n recieved: " + tux['typeof'](e); | |
JSUNIT.out(r + "\n"); | |
}; | |
JSUNIT.assertNotUndefined = function(e, r) { | |
if (undefined !== e) return JSUNIT.count++; | |
r = r || "[Error: Test #" + JSUNIT.count + "]\n < assertNotUndefined(" + tux['typeof'](e) + ", " + tux['typeof'](r) + ") >\n did not expect: undefined\n recieved: " + tux['typeof'](e); | |
JSUNIT.out(r + "\n"); | |
}; | |
JSUNIT.assertNaN = function(e, r) { | |
if (0/0 === e || 0/0 === +e) return JSUNIT.count++; | |
r = r || "[Error: Test #" + JSUNIT.count + "]\n < assertNaN(" + tux['typeof'](e) + ", " + tux['typeof'](r) + ") >\n expected: NaN\n recieved: " + tux['typeof'](e); | |
JSUNIT.out(r + "\n"); | |
}; | |
JSUNIT.assertNotNaN = function(e, r) { | |
if (0/0 !== e && 0/0 !== +e) return JSUNIT.count++; | |
r = r || "[Error: Test #" + JSUNIT.count + "]\n < assertNotNaN(" + tux['typeof'](e) + ", " + tux['typeof'](r) + ") >\n did not expect: NaN\n recieved: " + tux['typeof'](e); | |
JSUNIT.out(r + "\n"); | |
}; | |
JSUNIT.assertFail = function(e) { | |
JSUNIT.out("[Error: Test #" + JSUNIT.count + "]\n < assertFail(" + tux['typeof'](e) + ") >\n"); | |
}; | |
} | |
if (!runtime.has("1.6")) { | |
__ = __ | |
.replace(/\.\.\["arguments\"]/g, "this.constructor.apply(null, arguments)") | |
.replace(/([^\w\$\.])this([^\w\$\.])/g, "$1self$2") | |
.replace(/self\.([a-z\$_][\w\$\.]*)\s*\=\s*function/g, "this.$1 = function") | |
.replace(/self\s*\=\s*self/g, "var self = this") | |
.replace(/self\.constructor/g, "this.constructor") | |
.replace(/\\(.)/g, "\b$1\b") | |
.replace(/([^\u0008])#([^\u0008])/g, "$1this$2") | |
.replace(/[\b](.)[\b]/g, "\\$1"); | |
} else { | |
__ = __ | |
.replace(/\s*\.\.\["arguments\"]/g, "") | |
.replace(/([^\w\$\.]this)\s*\=\s*(this[^\w\$\.])/g, "") | |
.replace(/\\(.)/g, "\b$1\b") | |
.replace(/([^\u0008])#([^\u0008])/g, "$1this$2") | |
.replace(/[\b](.)[\b]/g, "\\$1"); | |
} | |
for (;__.match(__nch__); ) { | |
// put no.t.ch back | |
N = +__.match(__nch__)[0] | |
.replace(/\D/g, ""); | |
__ = __.replace(__nch__, nch_[N]); | |
} | |
__ = __.replace(/[\b]/g, ""); | |
// remove trailing \b, fix \char | |
TUX = __ | |
.replace(/&/g, "&") | |
.replace(/</g, "<") | |
.replace(/>/g, ">"); | |
// eval or not | |
if ("!" === _htmleditor) { | |
__ = __ | |
.replace(/</g, "<") | |
.replace(/>/g, ">") | |
.replace(/\n/g, "<br/>") | |
.replace(/\t/g, " ") | |
.replace(/\s/g, " "); | |
__ += // clean-up, make more readable | |
"!" !== _clean ? "<br/>/* - TuxedoScript " + tux.version + " - Ephellon Dantzler: Tue Sept 8, 2015 23:51 CDT -06:00 - */<br/>" : ""; | |
} | |
if (!__os__.value) __os__.innerHTML = __; else __os__.value = __ | |
.replace(/&/g, "&") | |
.replace(/</g, "<") | |
.replace(/>/g, ">"); | |
if ("!" === _hide) __os__.setAttribute("style", "display:none"); | |
// hide or not | |
return time.end = (new Date() + "") | |
.replace(/.+(\d{2}\:\d{2}\:\d{2}).+/, "$1") + "." + new Date().getMilliseconds(), | |
time.span = (-(+time.start | |
.replace(/:/g, "") - +time.end | |
.replace(/:/g, "")) + "s") | |
.replace(/\.(\d{0,4})\d*s/g, ".$1s") | |
.replace(/0+s/, "s"), | |
("!" === _eval)? eval(TUX): "", // parse or not | |
Tuxedo.stamp = time, Tuxedo.toString = function() {}, TUX; | |
} | |
var tux, tuxedo, nm; | |
tux = tuxedo = {}; | |
tux = tuxedo = nm || { | |
// nm | |
runtime: function() { | |
return Tuxedo.runtime; | |
}, | |
support: function() { | |
return Tuxedo.support; | |
}, | |
stamp: function() { | |
return Tuxedo.stamp; | |
}, | |
version: "16.9.6", | |
get: { | |
form: { | |
data: function() { | |
var e = 0, r = window.location.search + ""; | |
if (/\?/.test(r) === !1) return !1; | |
r = r | |
.replace("?", "") | |
.replace(/\\("|')/g, "\\\\\\$1") | |
.replace(/[^\\]("|')/g, "\\$1"); | |
if (!r || "" === r) return !1; | |
for (var t = encodeURI(r) | |
.replace(/=/g, '":"').split("&"), _ = '{"'; e < t.length - 1; e++) _ += t[e] + '","'; | |
_ += t[e] + '"}'; | |
_ = (_ + "") | |
.replace(",\n", ","); | |
_ = /\:/.test(_) ? _ : _.replace("}", ':""}'); | |
return JSON.parse(decodeURI(_)); | |
} | |
} | |
}, | |
storage: { | |
set: function() { | |
for (var e = 0, r = !1; e < arguments.length; ) { | |
if (undefined !== Storage) { | |
localStorage.setItem(arguments[e], arguments[e + 1]); | |
e += 2; | |
r = !0; | |
} | |
e += 2; | |
} | |
return r; | |
}, | |
check: function(e) { | |
return !!tux.storage.get(e); | |
}, | |
get: function(e) { | |
return localStorage.getItem(e); | |
}, | |
"delete": function(e) { | |
localStorage.setItem(e, null); | |
return !tux.storage.check(e); | |
} | |
}, | |
attr: function(e, r, t) { | |
if (e) if (!t) return e.getAttribute(r); else return "!" != t ? e.setAttribute(r, t) : e.getAttribute(r); | |
}, | |
id: function(e, r, t) { | |
if ("!" != e && e) { | |
var _ = document.getElementById(e) || document.getElementById(e + " "); | |
if (t) return tux.attr(_, r, t); | |
if (r) if ("$html" != r) _.innerHTML = r; else return _.innerHTML; | |
return _; | |
} | |
}, | |
"class": function(e, r, t, _) { | |
if ("!" != e && e) { | |
var a = document.getElementsByClassName(e); | |
if (!_) { | |
if (t) if ("$html" != t) a[r].innerHTML = t; else return a[r].innerHTML; | |
return a; | |
} else tux.attr(a[r], t, _); | |
} | |
}, | |
tag: function(e, r, t, _) { | |
if ("!" != e && e) { | |
var a = document.getElementsByTagName(e); | |
if (!_) { | |
if (t) if ("$html" != t) a[r].innerHTML = t; else return a[r].innerHTML; | |
return a; | |
} else tux.attr(a[r], t, _); | |
} | |
}, | |
ele: function(e, r, t, _) { | |
if ("!" != e && e) { | |
var a = document.querySelectorAll(e); | |
if (a.length < 2) r = 0; | |
if (!_) { | |
if (t) if ("$html" != t) a[r].innerHTML = t; else return a[r].innerHTML; | |
return a; | |
} else tux.attr(a[r], t, _); | |
} | |
}, | |
save: function(e, r) { | |
var t = window.location.pathname + ""; | |
r = r || t.substring(t.lastIndexOf("/") + 1, t.length) + ".cache"; | |
tux.storage.set(r, e); | |
return tux.storage.check(r); | |
}, | |
load: function(e, r) { | |
e = r ? encodeURI(e) : e; | |
var t = window.location.pathname + ""; | |
e = e || t.substring(t.lastIndexOf("/") + 1, t.length) + ".cache"; | |
return tux.storage.get(e); | |
}, | |
"delete": function(e) { | |
var r = window.location.pathname + ""; | |
e = e || r.substring(r.lastIndexOf("/") + 1, r.length) + ".cache"; | |
return tux.storage.delete(name); | |
}, | |
"typeof": function(e) { | |
if (arguments.length > 1) | |
return tux.typeOf.apply(null, arguments); | |
var r = ""; | |
switch (typeof e) { | |
case typeof Boolean(): | |
r = ""; | |
break; | |
case typeof Function(): | |
r = ""; | |
break; | |
case typeof Number(): | |
r = ""; | |
break; | |
case typeof Object(): | |
switch (e.constructor) { | |
case RegExp: | |
r = ""; | |
break; | |
case Array: | |
r = "[]"; | |
break; | |
default: | |
r = "{}"; | |
} | |
break; | |
case typeof String(): | |
r = '""'; | |
break; | |
case typeof Symbol(): | |
r = [ "(@@", ")" ]; | |
e = e.toString(); | |
break; | |
case "object": | |
r = ""; | |
break; | |
case "undefined": | |
r = ""; | |
break; | |
default: | |
r = ""; | |
} | |
return (r[0] || "") + e + (r[1] || ""); | |
}, | |
typeOf: function() { | |
for (var e = [], r = 0; r < arguments.length && undefined !== arguments[r] && null !== arguments[r]; r++) e.push(arguments[r].__proto__.constructor.name || arguments[r].constructor.name); | |
return (e + "") | |
.replace(/\*/g, "ANY").toUpperCase(); | |
}, | |
random: function() { | |
return Boolean(Math.round(Math.random())); | |
}, | |
precompiled: function() { | |
return Tuxedo.precompiled; | |
} | |
}; | |
if (void 0 !== typeof document.onreadystatechange) | |
document.onreadystatechange = function() { | |
// Tuxedo() when the page is ready | |
if ("complete" === document.readyState) | |
TUX = Tuxedo(); | |
}; else document.onload = function() { | |
// Tuxedo() when the page is ready (mobile users) | |
TUX = Tuxedo(); | |
}; |
/******** | |
---- Tuxedo Baseline ---- | |
-- Special (a.k.a "pa.t.ch" [patches]) -- | |
<$n> ... </$n> - no.t.ch, any code put between the html-like tags will be treated as native JS | |
<$s> ... </$s> - so.t.ch, any code put between the html-like tags will be parsed as some TS, then JS (shorcuts, and threads can be used) | |
<$t> ... </$t> - to.t.ch, no need, just a proposal | |
-- Comments -- | |
## - single line comment, or multi-line comment ending | |
#* - multi-line comment starter | |
#*# - multi-line comment starter ("author tags", or "embroider tags") | |
@aut - author | |
@lie - license | |
@dat - date | |
@tie - time | |
@url - url | |
@ver - version | |
##! - strict mode | |
## +thread - enable an html-attribute via inline script | |
can be: advance clean eval greek hide html-editor js-editor js-unit legacy math ugly wordy | |
## -thread - disable an html-attribute via inline script | |
can be: advance clean eval greek hide html-editor js-editor js-unit legacy math ugly wordy | |
## @x - emulates that JS version: 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.8.1, 1.8.5 | |
## *a: b; - replace all $a with b (soft baste) | |
## **a: b; - replace all $a with parsed b (hard baste) | |
## /abc/gmiyu = $1 - replace with regexp | |
-- Sequences and Strings -- | |
\c - escape character, for use in/out of strings (darns) | |
can be: / \ & ? : ; . @ # % $ < > + - * ( ) [ ] { } | ^ | |
`...` - multiline string /runs script/ | |
`...!white-sapce` - removes extra white space characters /!white-space can be put anywhere in the string/ | |
-- Variables -- | |
#a - var a | |
a--b - a_b | |
a#b - a[b] | |
a#0b - a[a.length - b] | |
@ - this or self, depending on the JS version | |
# - this or self, depending on the JS version | |
@a - this.a | |
$of - typeof | |
$del - delete | |
$args - arguments | |
$doc - document | |
$win - window | |
$nav - navigator | |
$loc - location | |
$cont - continue | |
$con - console | |
$# - Object | |
$Obj - Object | |
$obj - Object | |
.$id - getElementById | |
.$class - getElementsByClassName | |
.$tag - getElementsByTagName | |
.$html - innerHTML | |
.$text - innerText | |
.$val - value | |
.$qy - querySelector | |
.$Qy - querySelectorAll | |
...$args - depending on the JS version, either calls on the last constructor, or does nothing | |
a: b - if there isn't a comma after b, there will be one added, unless b is the last item | |
-- functions -- | |
<- - return | |
<+ - throw | |
$a b, c, d - function a(b, c, d) | |
:$a, b, c - function(a, b, c) | |
=$a, b, c - function(a, b, c) | |
,$a, b, c - function(a, b, c) | |
$a b, c, d: - one line functions | |
$ { - function() | |
-- Loops and Statements -- | |
a?? - test if a exists | |
a!?? - test if a doesn't exist | |
?a { - if a | |
}{ - else | |
}? a { - else if a | |
?#a, b - for a, to b by 1 | |
?#a, b, c - for a = b, to c by 1 | |
?#a, b, c, d - for a = b, to c, by d | |
-?#a, b - for a, to b by -1 | |
-?#a, b, c - for a = b, to c by -1 | |
-?#a, b, c, d - for a = b, to c, by d | |
?#a:b - for a in b | |
?#a:b ? c - for a, to b by 1, do c /!deprecated/ use ?#a,b {c} | |
@def - default | |
@a: - case a | |
---- "Advance thread" features ---- | |
.a - class x | |
.a b - class a extends b | |
*. - super | |
@(a, b, c) - constructor(a, b, c) | |
b => a - const a = b | |
a --> b - a = (arguments) => b | |
-> - => | |
$*a, b, c { - void function(a, b, c) | |
prom a - creates a promissory function (like Java's "interface", Tux "gusset"); see http://codepen.io/Ephellon/pen/MKWaja | |
Tux will automatically create a main function to call from, and switch through the number/type(s) of arguments to find a match | |
natively supported types: Array Boolean Function Number Object RegExp String Symbol * [any] | |
---- "Legacy thread" features ---- | |
a ~= b - a = -(a - b) | |
a &= b - a = a && b | |
a |= b - a = a || b | |
a ^= b - if a != null, a = b | |
a ?= b - if a == null, a = b | |
-- Special -- | |
@x..y: - "case x..y:" -- this will repeat "case ...:" for (x-y) times /i.e. "@4..6:" -> "case 4: case 5: case 6:" | |
-- Arrays (try limiting them to one per line) -- | |
a[b..c] - a.slice(b, c) | |
a[..c] - a.slice(0, c) | |
a[b..] - a.slice(b) | |
a[.] - a.slice(0) | |
a[*] - a.split | |
a[+] - a.concat | |
a[++] - a.push | |
a[<] - a.shift | |
a[>] - a.unshift | |
a[~] - a.every | |
a[&] - a.join | |
a[?] - a.indexOf | |
a[-?] - a.lastIndexOf | |
a[=] - a.reverse | |
a[^] - a.sort | |
a[-] - a.pop | |
d[] - if d is a number, it creates a d-dimension array (Tux Array "gores"), i.e. 3[] === [[[]]] /called on as [x][y][z]/ | |
r:a - if r is a reserved word, it will be double-quoted | |
.r - if r is a reserved word, it will be double-quoted and bracketed; ["r"] | |
-- Strings -- | |
"${a}" - interpolation, ..." + a + "... | |
'${a}' - interpolation, ...' + a + '... | |
`${a}` - interpolation, ...` + a + `... | |
"..." "..." - automatic concatination, "..." + "..." | |
'...' '...' - automatic concatination, '...' + '...' | |
`...` `...` - automatic concatination, `...` + `...` | |
d * "..." - (Tux String "gores") if d is a number, then the string will be repeated d many times | |
d * '...' - if d is a number, then the string will be repeated d many times | |
d * `...` - if d is a number, then the string will be repeated d many times | |
"..." - '...' - string.replace(string, "") | |
"..." - a - string.replace(a, "") | |
-- RegExp -- | |
\a - Alpha characters, [a-zA-Z] | |
\A - Non-alpha characters, [^a-zA-Z] | |
\j - JS variables, [a-zA-Z\$_][\w\d\$_]* | |
\J - non-JS variables, [^a-zA-Z\$_][\w\d\$_]* | |
\e - Greek letters | |
\E - Non-Greek letters | |
\k - lowercase, \k[A-fR-Z] = /[a-fr-z]/ | |
\K - uppercase, \K[A-fR-Z] = /[A-FR-Z]/ | |
---- "Math thread" features ---- | |
a(b) = c - function a(b){ return c; } | |
da - if d is a number, then d * a | |
a~b - ((a % b + b) % b) | |
|a| - Math.abs(a) | |
a^b - Math.pow(a, b) | |
a**b - Math.pow(a, b) | |
/?a/ - Math.sqrt(a) | |
a/?b/ - "a" root of b, i.e. 3\x\ is the cube root of x | |
a%%b - Math.floor(a/b) | |
log a (b) - log, base a, of b /log(b) / log(a)/ | |
@.property - Math.property, i.e. @.PI = Math.PI, @.log = Math.log /notice the ./ | |
---- "Wordy thread" features ---- | |
-- Loops and Statements -- | |
a exists - test if a exists | |
a exist - test if a exists | |
a !exists - test if a doesn't exist | |
a !exist - test if a doesn't exist | |
if a { - if a | |
else - automatic braces for else | |
else-if a { - else if a | |
else-when a { - else if a | |
else-where a { - else if a | |
if a then b else c - ternary operator, (a)?b:c | |
for a, b - for a, to b by 1 | |
for a, b, c - for a = b, to c by 1 | |
for a, b, c, d - for a = b, to c, by d | |
-for a, b - for a, to b by -1 | |
-for a, b, c - for a = b, to c by -1 | |
-for a, b, c, d - for a = b, to c, by d | |
for a: b - for a in b | |
for a in b - for a in b | |
for a: b? c - for a, to b by 1, do c | |
for a in b do c - for a, to b by 1, do c | |
while a - while a | |
until a - while !a | |
switch a - switch a | |
a(b) from c while d - for each item in c, if d is true, do b = c[...], a(b) | |
a(b) from c - for each item in c, do b = c[...], a(b) | |
a() from b while c - for each item in b, if c is true, do a | |
-- Baseline -- | |
#r - if r is a Tuxedo reserved word, then it will be a variable | |
\r - if r is a Tuxedo reserved word, then it will be a variable | |
AND - && | |
OR - || | |
XOR - ^ | |
NOT - ! | |
does not - ! | |
do not - ! | |
doesnt - ! | |
does - !! | |
on - true | |
yes - true | |
good - true | |
off - false | |
no - false | |
bad - false | |
maybe - true | false /uses tuxedo.random()/ | |
is not - !== | |
isnt - !== | |
equals - === | |
equal - === | |
is - === | |
the x is - x = | |
a = b in c - a = c[b] | |
a = b from c - a = c.indexOf(b) | |
<?> - ? armscye | |
<!> - ! armscye | |
<#> - # armscye | |
---- "Ugly thread" features ---- | |
single line comments become multi-line | |
undefined - void 0 | |
true - !0 | |
!false - !0 | |
!!true - !0 | |
false - !1 | |
!true - !1 | |
!!false - !1 | |
Number(a) - (+a) | |
a.toString() - a + "" | |
while(x) - for(;x;) | |
multiple zeros are "crunched" down to a 1eX form, i.e. 10000000 = 1e7 | |
boolean tests become lazy, i.e. && = &, || = | | |
---- "JS-Unit thread" features ---- | |
-- Baseline -- | |
@@ - JSUNIT | |
@@toconsole - redirect all output to the console | |
(@Test ... { ... }#) - test to run, and optional event arguments | |
(@Test ... { ... }) - "empty" test, doesn't run | |
@Before - code to run before every test | |
@After - code to run after every test | |
-- Assert Tests -- | |
@@assert(value, [comment]) - log that you wanted value | |
@@assertTrue(value, [comment]) - log that you wanted value to be true | |
@@assertFalse(value, [comment]) - log that you wanted value to be false | |
@@assertEquals(expected, recieved, [comment]) - log that you wanted recieved to equal expected | |
@@assertNotEquals(expected, recieved, [comment]) - log that you wanted recieved to not equal expected | |
@@assertNull(value, [comment]) - log that you wanted value to be null | |
@@assertNotNull(value, [comment]) - log that you wanted value to not be null | |
@@assertUndefined(value, [comment]) - log that you wanted typeof value to be undefined | |
@@assertNotUndefined(value, [comment]) - log that you wanted typeof value to not be undefined | |
@@assertNaN(value, [comment]) - log that you wanted value to be NaN | |
@@assertNotNaN(value, [comment]) - log that you wanted value to not be NaN | |
@@assertFail(comment) - log fail, "comment" | |
---- "Greek thread" features ---- | |
-- <Word> -- | |
<word> - each letter is turned into it's Greek counterpart (except q, v, and j) | |
word - if "word" is a Greek letter's name, it's turn into that letter (i.e. Pi and pi) | |
---- "Advance + Legacy cord [threads]" features ---- | |
-- Splats -- | |
$a b... - same as b = arguments | |
$a b, c... - c will be all arguments after b | |
$a b..., c - b will be all arguments before c | |
$a b, c..., d - c will be all arguments between b and d | |
a(b...) - same as a(b) uses .apply | |
a(b, c...) - a([b c]) uses .apply | |
a(b..., c) - a([b c]) uses .apply | |
a(b, c..., d) - a([b c d]) uses .apply | |
<@> - @ armscye | |
<&> - & armscye | |
---- Armscyes ---- | |
! - "index_counter" | |
@ - "arguments" | |
# - "undefined" | |
? - "ANON" | |
* - "use strict" | |
& - "Array" or "[].slice.call" | |
---- Godets [Legacy] ---- | |
a b - a(b) | |
a "b" - a("b") | |
a 'b' - a('b') | |
a `b` - a(`b`) | |
a /b/ - a(/b/) | |
---- Tuxedo Methods ---- | |
* $ means executable | |
* ~ means "same as above," but with different arguments | |
* # means a property, that isn't a method | |
* tuxedo === tux | |
tux | |
.get | |
.form | |
$ .data - get form data from the URI | |
.storage | |
$ .set[...] - set the local storage [name, data, name, data ...] | |
$ .check[name] - see if the local storage at the name exists | |
$ .get[name] - get the local storage at the name | |
$ .delete[name] - delete the local storage at the name | |
$ .attr[element, attribute, value] - set the attribute as the value | |
$ .id[element, attribute, value] - set the attribute as the value | |
~ .id[element, html] - set the innerHTML as the value | |
~ .id[element] - just return the element, by id | |
$ .class[element, attribute, value] - set the attribute as the value | |
~ .class[element, html] - set the innerHTML as the value | |
~ .class[element] - just return the element, by class name | |
$ .tag[element, attribute, value] - set the attribute as the value | |
~ .tag[element, html] - set the innerHTML as the value | |
~ .tag[element] - just return the element, by tag name | |
$ .ele[element, number, attribute, value] - set the attribute as the value | |
~ .ele[element, number, html] - set the innerHTML as the value | |
~ .ele[element, number] - just return the element, by element name (via querySelector) | |
$ .save[data, name] - tux.storage.set(name, data) | |
$ .load[name] - tux.storage.get(name) | |
$ .delete[name] - tux.storage.delete(name) | |
$ .typeof[object] - returns the typeof "object" to a string, i.e. true === "<true>", [1, 2, 3] === "[1, 2, 3]" | |
$ .typeOf[a, b, c] - returns a string of each arguments type | |
$ .precompiled - returns an object as if a snap-shot of the data being compiled | |
# .content - returns the actual "snap-shot" | |
# .channels - returns the channels {no} | |
# .comments - returns an object of the comments {plural, single} | |
# .regexps - returns the regexps | |
# .strings - returns an object of strings {double, grave, single} | |
# .threads - returns an object of threads {available, disabled, enabled} | |
$ .stamp - returns an object containing a start, stop, and difference of the TuxedoScript compile time {start, end, span} | |
# .version - the TuxedoScript version | |
$ .support - returns an array of all JS versions supported by the user's browser i.e. [1.1 ... 1.8.5] | |
$ .runtime - returns the JS version that has been detected | |
********/ |
JS TS (TuxedoScript 16.8.7)
Inspiration: ECMA Script6, CoffeeScript, Java, and Python
Not for use in IE
A Pen by Mink CBOS - Ephellon Dantzler on CodePen.
JS TS (TuxedoScript 16.8.7)
Inspiration: ECMA Script6, CoffeeScript, Java, and Python
Not for use in IE
A Pen by Mink CBOS - Ephellon Dantzler on CodePen.