javascript: code large integers with scientific notation

99999999 and 1e8 are not the same number, but srollTop only needs to be
very large, not that particular number.

saves 18 Bytes of JavaScript code.
This commit is contained in:
Bernhard Kirchen 2022-04-03 12:34:43 +02:00
parent 09a4c62fee
commit 34fb6dfe2a
8 changed files with 52 additions and 52 deletions

View File

@ -2,7 +2,7 @@
// compressed by tools/unishox/compress-html-uncompressed.py
/////////////////////////////////////////////////////////////////////
const size_t HTTP_SCRIPT_CONSOL_SIZE = 997;
const size_t HTTP_SCRIPT_CONSOL_SIZE = 985;
const char HTTP_SCRIPT_CONSOL_COMPRESSED[] PROGMEM = "\x33\xBF\xAF\x71\xF0\xE3\x3A\x8B\x44\x3E\x1C\x67\x51\x18\xA3\xA8\x2A\x2B\x1A\x7C"
"\x3E\x84\x3C\x18\x17\xC1\xD6\xE7\x20\x8E\xE8\xC3\xBC\x7B\x4C\xEF\xE8\x33\xAB\x0F"
"\x87\xD9\xF6\x78\x0C\x27\x7F\x2A\x2B\xD1\xAF\x05\xD1\xDD\x0A\x8E\xF0\x24\xCD\x31"
@ -10,35 +10,35 @@ const char HTTP_SCRIPT_CONSOL_COMPRESSED[] PROGMEM = "\x33\xBF\xAF\x71\xF0\xE3\x
"\x0E\x43\xBC\x7B\x48\x33\xE3\x1C\x77\x4F\xB0\xCE\x43\xEC\xEF\x1E\x0B\x0F\x87\xD9"
"\xFA\x0C\xE4\x3E\x1F\x67\x6C\x9F\x07\x82\x32\x16\x5F\x2D\x20\xF0\x68\xCC\xE7\xD4"
"\x77\x43\x3A\x19\xD8\x42\xD9\xDE\x3C\x02\x14\x53\xE1\xF6\x7D\x9E\x28\xE9\xE0\xFF"
"\x81\x04\x55\x83\x0F\x87\x11\x1B\xD0\xCF\x1E\xE3\xE0\x23\x54\x3C\x1E\xED\x30\x77"
"\x41\x1A\x61\xF8\x7C\xF7\x1D\xE3\xDB\xA6\x0E\xE9\xB0\xFE\x1F\x38\x58\x41\x1D\xE3"
"\xDA\x6C\x3A\x58\xEC\xFD\x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\xE7\x34\x51\xDD"
"\x3B\xC7\xB4\x10\xF9\x89\x3A\x58\x82\x13\x33\x7D\x44\x16\xFA\x9F\x3F\x9D\xD3\xEC"
"\xD1\x99\x09\x83\xFC\x7D\x9D\x4C\xF8\x7E\x1E\xD3\x3B\xFA\x1C\x08\x9C\xDB\x9D\x41"
"\x9F\x19\xD0\xD1\x99\x10\x78\x23\x3C\x69\x83\xBA\x72\xFE\x7C\x3E\x10\x67\xF8\xFF"
"\x1C\xC6\x7C\x3E\x10\x67\x78\xF6\x8E\x3A\x58\xBA\xC0\xF0\x68\xC0\x9D\x33\xE1\xF7"
"\x86\x0C\x1F\x67\x80\x46\xE0\x20\x71\xF0\xFC\x3D\xA3\x8E\x86\x30\x31\x7E\x3B\xA7"
"\x78\xF0\x38\xE9\xE7\x45\xE6\x13\x0E\xB7\x38\xBF\x7C\x3C\xCE\xE9\xC8\x4C\xE2\x3A"
"\xA1\x33\x88\xEF\x1E\xE3\xA9\x9D\x44\x38\xEF\x1E\xE3\x97\xF3\xE1\xF0\x83\x3B\x47"
"\x74\xED\x9D\xB0\xF8\xFC\x14\x18\x21\x72\x2A\x01\x7E\x8F\xD1\xDD\x0F\x8F\x80\x89"
"\x2C\xEF\x1D\x43\x81\x0B\x93\x41\x41\x9E\xF0\x7C\x75\x9C\x87\xBE\x7F\x8F\xF1\xF6"
"\x7D\x9D\xE3\xCF\x19\xF0\xF8\x41\x9D\xA3\xBA\x71\x9F\x87\x59\xD6\x41\xF0\x20\xE2"
"\x07\x19\x02\x9E\x10\x72\x59\xF0\xF8\x41\x9F\xA3\xF4\x77\x41\x13\x31\x3F\x0E\x44"
"\x7E\x8F\xD1\x0A\x0C\xE8\x33\x06\x1D\xD3\xBC\x75\x0A\x0C\xE8\x2F\x81\x07\x98\xA0"
"\x42\xC7\x0E\xF1\xD4\x1F\x1F\x0E\x33\xBC\x7B\x8E\xF1\xE0\xF7\x10\xF8\x47\x74\x51"
"\xDE\x3C\x1B";
"\x81\x04\x55\x83\x0F\x87\x21\x33\x9F\x3C\x17\xB8\xF8\x08\xD3\xCF\x07\xBB\x4C\x1D"
"\xD0\x46\x98\x7E\x1F\x3D\xC7\x78\xF6\xE9\x83\xBA\x6C\x3F\x87\xCE\x16\x10\x47\x78"
"\xF6\x9B\x0E\x96\x3B\x3F\x47\x74\xEF\x1E\x0F\x71\xB0\xF9\xCC\x7D\x11\xB0\x86\x90"
"\x44\x2A\x2B\xA8\x61\x7D\x9A\x85\xBF\x51\xDD\x3B\xC7\x83\x61\xD3\x3B\xEE\xC4\x32"
"\xF5\x5D\x30\xC5\x5F\x0F\x33\xE1\xDD\x3B\xC7\xC3\xF0\xF6\xE9\x83\xBA\x6C\x3A\x7D"
"\xD8\x86\x45\xEA\xBA\x67\xC3\xE1\xCC\x3F\x47\xE8\x8D\x87\x4F\x55\xD0\xBF\x1F\x0F"
"\x87\x29\xB2\x04\x1E\x1D\xCD\xA7\x50\x87\x81\x0F\x86\xC3\xA7\xDF\x86\x67\x79\x95"
"\x33\x65\x1D\x3C\x30\x2D\xA3\xBA\x76\x1E\xE3\x90\xEC\x3B\xC7\x82\xD1\x0F\x82\x1D"
"\x3C\x2B\x4C\x51\xDD\x3B\xC7\x8D\x30\x77\x41\x12\x49\xF0\xF8\x71\x9D\xE3\xDA\x54"
"\x08\xBC\x24\x9E\xE3\x68\x24\xE0\xA6\xD3\xA0\x4F\x87\xA8\x51\xF8\x08\xB8\x19\xDB"
"\x3E\x1B\x4F\x07\xB8\x16\xB8\x71\x04\xCE\x3C\x02\xA3\xE7\x9D\x02\x27\x22\x67\x50"
"\x54\x34\xEF\x1E\x0F\x71\xEE\x3C\x1B\x0E\x98\x31\xF1\xDD\x3E\xC8\x78\x99\x51\xF6"
"\x75\x1F\x61\xF8\xED\x06\x72\x8F\x87\xD9\xDB\x2D\x10\xED\xE1\xD5\x5F\x16\xCE\xF1"
"\xE0\xD8\x74\xF3\xE1\x0E\xE9\xDE\x3C\x18\x04\xAC\x78\xE5\x13\x39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E8\x33\x06\x1D\xD3\xBC\x75\x0A\x0C\xE8\x2F\x81\x07\x98"
"\x30\x42\xC7\x0E\xF1\xD4\x1F\x1F\x0E\x33\xBC\x7B\x8E\xF1\xE0\xF7\x10\xF8\x47\x74"
"\x51\xDE\x3C\x1B";
#define HTTP_SCRIPT_CONSOL Decompress(HTTP_SCRIPT_CONSOL_COMPRESSED,HTTP_SCRIPT_CONSOL_SIZE).c_str()

View File

@ -2,7 +2,7 @@
// compressed by tools/unishox/compress-html-uncompressed.py
/////////////////////////////////////////////////////////////////////
const size_t HTTP_SCRIPT_ROOT_SIZE = 501;
const size_t HTTP_SCRIPT_ROOT_SIZE = 499;
const char HTTP_SCRIPT_ROOT_COMPRESSED[] PROGMEM = "\x33\xBF\xA3\x14\x78\x30\x2F\x83\xAD\xCE\x41\x59\xDD\x18\x77\x8F\x6D\x9F\x06\x1F"
"\xE3\xFC\x7D\x9F\x67\x80\xC2\x77\xF2\xAD\x1A\xF0\x5D\x1D\xD3\x14\x77\x81\x26\x68"
"\x54\x77\x8F\x1A\x60\xEE\x9B\x0F\xE1\xF3\x85\x84\x11\xDE\x3D\xA6\xC3\xA5\x8E\xCF"
@ -19,7 +19,7 @@ const char HTTP_SCRIPT_ROOT_COMPRESSED[] PROGMEM = "\x33\xBF\xA3\x14\x78\x30\x2F
"\x43\xEC\xEF\x1D\x0B\x7B\x9F\xC8\x51\x51\x0D\x20\x8F\x9E\x05\xEE\x2E\x82\xA3\xE7"
"\x9D\x02\x24\xEB\x3A\x8F\xA1\x0E\xF1\xE0\xF7\x1E\xE3\xC1\xB0\xE9\x83\x1F\x1D\xD3"
"\xEC\x87\x89\x95\x1F\x67\x51\xF6\x74\x3B\x43\x4F\x87\x21\xF6\x76\xCA\xCE\xAA\xF8"
"\xB6\x77\x8F\x06\xC3\xA7\x9F\x08\x77\x4E\xF1\xE0\xC0\x25\xE3\x47\x29\xB6\xCE\xF1"
"\xE0\xF7\x1B";
"\xB6\x77\x8F\x06\xC3\xA7\x9F\x08\x77\x4E\xF1\xE0\xC0\x25\xE3\x47\x28\x99\xCC\x3B"
"\xC7\x83\xDC";
#define HTTP_SCRIPT_ROOT Decompress(HTTP_SCRIPT_ROOT_COMPRESSED,HTTP_SCRIPT_ROOT_SIZE).c_str()

View File

@ -2,7 +2,7 @@
// compressed by tools/unishox/compress-html-uncompressed.py
/////////////////////////////////////////////////////////////////////
const size_t HTTP_SCRIPT_ROOT_SIZE = 436;
const size_t HTTP_SCRIPT_ROOT_SIZE = 434;
const char HTTP_SCRIPT_ROOT_COMPRESSED[] PROGMEM = "\x30\x2F\x83\xAD\xCE\x41\x59\xDD\x18\x77\x8F\x6E\x98\x3B\xB4\x64\x31\xE1\x83\xBA"
"\x4C\xCD\xF5\x17\xB0\x5F\xC3\x67\x78\xFE\x1F\x0F\x87\xB0\x5F\x08\xCC\x6F\x31\x0F"
"\x61\xDE\x3D\xA6\x77\xF4\xCF\x9C\xC7\xD0\x23\x60\x47\x74\xFB\x3B\x43\x4F\x87\x21"
@ -18,7 +18,7 @@ const char HTTP_SCRIPT_ROOT_COMPRESSED[] PROGMEM = "\x30\x2F\x83\xAD\xCE\x41\x59
"\x6C\x3A\x58\xEC\xFD\x1D\xD3\xBC\x7B\x8D\x87\xCE\x63\xE8\x8D\x84\x34\x82\x21\x55"
"\x43\x0B\xEC\xD4\x2D\xFA\x8E\xE9\xDE\x3C\x1B\x0E\x98\x31\xF1\xDD\x3E\xC8\x78\x99"
"\x51\xF6\x75\x1F\x67\x43\xB4\x34\xF8\x72\x1F\x67\x6C\xAC\xEA\xAF\x8B\x67\x78\xF0"
"\x6C\x3A\x79\xF0\x87\x74\xEF\x1E\x02\xA3\xE7\x9D\x02\x26\x83\x67\x51\xCA\x6D\xB3"
"\xBC\x78\x3D\xC6";
"\x6C\x3A\x79\xF0\x87\x74\xEF\x1E\x02\xA3\xE7\x9D\x02\x26\x83\x67\x51\xCA\x26\x73"
"\x0E\xF1\xE0\xF7\x1B";
#define HTTP_SCRIPT_ROOT Decompress(HTTP_SCRIPT_ROOT_COMPRESSED,HTTP_SCRIPT_ROOT_SIZE).c_str()

View File

@ -2,7 +2,7 @@
// compressed by tools/unishox/compress-html-uncompressed.py
/////////////////////////////////////////////////////////////////////
const size_t HTTP_SCRIPT_ROOT_SIZE = 874;
const size_t HTTP_SCRIPT_ROOT_SIZE = 872;
const char HTTP_SCRIPT_ROOT_COMPRESSED[] PROGMEM = "\x33\xBF\xAF\x98\xF0\xA3\xE1\xC8\x75\x11\x8A\x3C\x18\x17\xC1\xD6\xE7\x20\xAC\xEE"
"\x8C\x3B\xC7\xB6\xCF\x83\x0F\xF1\xFE\x3E\xCF\xB3\xC0\x61\x3B\xF9\x56\x8D\x78\x2E"
"\x8E\xE9\x8A\x3B\xC0\x93\x34\x2A\x2B\x3B\xC7\x8D\x30\x77\x4D\x87\xF0\xF9\xC2\xC2"
@ -20,13 +20,13 @@ const char HTTP_SCRIPT_ROOT_COMPRESSED[] PROGMEM = "\x33\xBF\xAF\x98\xF0\xA3\xE1
"\x23\xE7\x81\x80\xF1\x77\xF3\x1E\x14\x77\x8F\x68\x54\x7C\xF3\xA0\x44\xAF\x67\x51"
"\xF4\x21\xDE\x3C\x1E\xE3\xDC\x7B\x81\x16\xF1\xB0\xE9\x83\x1F\x1D\xD3\xEC\x87\x89"
"\x95\x1F\x67\x51\xF6\x74\x3B\x43\x4F\x87\x21\xF6\x76\xCA\xCE\xAA\xF8\xB6\x77\x8F"
"\x06\xC3\xA7\x9F\x08\x77\x4E\xF1\xE0\xC0\x25\xE4\x87\x29\xB6\xCE\xF1\xE0\xF7\x1E"
"\xE2\x04\x4E\x57\xFC\xCC\xEC\xEE\x8C\xBF\x9D\x5A\x67\x7F\x3B\xC7\xB4\x2B\x3B\xA7"
"\xD9\xFA\xF1\x99\xF0\xFB\x3B\x7A\x67\x7F\x3B\x67\xD9\xFB\x3E\xCE\xD8\xCB\xF9\xDE"
"\x3C\x02\x36\x1B\xA0\x91\x86\x82\x0F\x36\x47\x80\x53\xC5\x3E\x63\xC2\x8F\x87\x19"
"\x02\x56\x37\x40\x9B\x8E\x0C\xBF\xA3\xE2\x19\x7F\x3A\x78\x2D\x0D\x9D\xD3\x8C\xEA"
"\x3B\x94\x77\x8E\xE1\xDB\x20\x46\x9C\x72\xCE\xF1\x03\x05\xD0\x46\x7C\xEE\x98\x3B"
"\xC7\xB7\x4C\x1D\xD3\x07\x78\xF6\x82\x67\x18\x40\x99\xC7\x20\x28\x71\x94\x08\x5B"
"\xA1\xEE\x61\x79\x82\xF6\x40\x08\x7A\xF9\xEE";
"\x06\xC3\xA7\x9F\x08\x77\x4E\xF1\xE0\xC0\x25\xE4\x87\x28\x99\xCC\x3B\xC7\x83\xDC"
"\x7B\x88\x11\x39\x5D\xF3\x33\xB3\xBA\x32\xFE\x75\x69\x9D\xFC\xEF\x1E\xD0\xAC\xEE"
"\x9F\x67\xEB\xC6\x67\xC3\xEC\xED\xE9\x9D\xFC\xED\x9F\x67\xEC\xFB\x3B\x63\x2F\xE7"
"\x78\xF0\x08\xD8\x6E\x82\x46\x1A\x08\x3C\xD8\x1E\x01\x4F\x14\xF9\x8F\x0A\x3E\x1C"
"\x64\x09\x58\xDD\x02\x6E\x38\x32\xFE\x8F\x88\x65\xFC\xE9\xE0\xB4\x36\x77\x4E\x33"
"\xA8\xEE\x51\xDE\x3B\x87\x6C\x81\x1A\x71\xCB\x3B\xC4\x0C\x17\x41\x19\xF3\xBA\x60"
"\xEF\x1E\xDD\x30\x77\x4C\x1D\xE3\xDA\x09\x9C\x60\x02\x67\x1C\x40\xA1\xC6\x40\x21"
"\x6E\x87\xB9\x85\xE6\x0B\xD9\x2A\x01\x21\xEB\xE7\xB8";
#define HTTP_SCRIPT_ROOT Decompress(HTTP_SCRIPT_ROOT_COMPRESSED,HTTP_SCRIPT_ROOT_SIZE).c_str()

View File

@ -9,7 +9,7 @@ const char HTTP_SCRIPT_CONSOL[] PROGMEM =
"c=eb('c1');" // Console command id
"o='&c1='+encodeURIComponent(c.value);"
"c.value='';"
"t.scrollTop=99999999;"
"t.scrollTop=1e8;"
"sn=t.scrollTop;"
"}"
"if(t.scrollTop>=sn){" // User scrolled back so no updates
@ -23,7 +23,7 @@ const char HTTP_SCRIPT_CONSOL[] PROGMEM =
"if(d.shift()==0){t.value='';}"
"z=d.shift();"
"if(z.length>0){t.value+=z;}"
"t.scrollTop=99999999;"
"t.scrollTop=1e8;"
"sn=t.scrollTop;"
"clearTimeout(ft);"
"lt=setTimeout(l,ltm);" // webrefresh timer....
@ -31,7 +31,7 @@ const char HTTP_SCRIPT_CONSOL[] PROGMEM =
"};"
"x.open('GET','cs?c2='+id+o,true);" // Related to Webserver->hasArg("c2") and WebGetArg("c2", stmp, sizeof(stmp))
"x.send();"
"ft=setTimeout(l,20000);" // fail timeout, triggered 20s after asking for XHR
"ft=setTimeout(l,2e4);" // fail timeout, triggered 20s after asking for XHR
"}else{"
"lt=setTimeout(l,ltm);" // webrefresh timer....
"}"

View File

@ -19,5 +19,5 @@ const char HTTP_SCRIPT_ROOT[] PROGMEM =
"};"
"x.open('GET','.?m=1'+a,true);" // ?m related to Webserver->hasArg("m")
"x.send();"
"ft=setTimeout(la,20000);" // 20s failure timeout
"ft=setTimeout(la,2e4);" // 20s failure timeout
"}";

View File

@ -16,5 +16,5 @@ const char HTTP_SCRIPT_ROOT[] PROGMEM =
"x=new XMLHttpRequest();"
"x.open('GET','.?m=1'+a,true);" // ?m related to Webserver->hasArg("m")
"x.send();"
"lt=setTimeout(la,20000);" // 20s failure timeout
"lt=setTimeout(la,2e4);" // 20s failure timeout
"}";

View File

@ -22,7 +22,7 @@ const char HTTP_SCRIPT_ROOT[] PROGMEM =
"if(rfsh){"
"x.open('GET','.?m=1'+a,true);" // ?m related to Webserver->hasArg("m")
"x.send();"
"ft=setTimeout(la,20000);" // 20s failure timeout
"ft=setTimeout(la,2e4);" // 20s failure timeout
"}"
"}"
"function seva(par,ivar){"