Add overall code reformatting
This commit is contained in:
parent
93d5fec51a
commit
6654cf857e
12 changed files with 248 additions and 212 deletions
|
@ -1,5 +1,5 @@
|
||||||
make.colors = {
|
make.colors = {
|
||||||
colors: function() {
|
colors: function () {
|
||||||
return random.pick([
|
return random.pick([
|
||||||
make.colors.colorRGB,
|
make.colors.colorRGB,
|
||||||
make.colors.colorHSL,
|
make.colors.colorHSL,
|
||||||
|
@ -7,7 +7,7 @@ make.colors = {
|
||||||
]);
|
]);
|
||||||
},
|
},
|
||||||
|
|
||||||
colorRGB: function() {
|
colorRGB: function () {
|
||||||
let values;
|
let values;
|
||||||
|
|
||||||
switch (random.number(4)) {
|
switch (random.number(4)) {
|
||||||
|
@ -34,10 +34,10 @@ make.colors = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
colorHSL: function() {
|
colorHSL: function () {
|
||||||
let values, opt;
|
let values, opt;
|
||||||
|
|
||||||
switch(random.number(4)) {
|
switch (random.number(4)) {
|
||||||
case 0:
|
case 0:
|
||||||
values = [random.number(255), "%" + random.number(255), "%" + random.number(255)];
|
values = [random.number(255), "%" + random.number(255), "%" + random.number(255)];
|
||||||
return "hsl(" + values.join(',') + ")";
|
return "hsl(" + values.join(',') + ")";
|
||||||
|
@ -54,7 +54,7 @@ make.colors = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
colorKeywords: function() {
|
colorKeywords: function () {
|
||||||
return random.pick([
|
return random.pick([
|
||||||
"lime", "red", "blue", "invert", "currentColor", "ActiveBorder", "ActiveCaption",
|
"lime", "red", "blue", "invert", "currentColor", "ActiveBorder", "ActiveCaption",
|
||||||
"AppWorkspace", "Background", "ButtonFace", "ButtonHighlight", "ButtonShadow",
|
"AppWorkspace", "Background", "ButtonFace", "ButtonHighlight", "ButtonShadow",
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
make.fonts = {
|
make.fonts = {
|
||||||
fontStyles: function() {
|
fontStyles: function () {
|
||||||
return ["italic", "normal", "oblique", "inherit"];
|
return ["italic", "normal", "oblique", "inherit"];
|
||||||
},
|
},
|
||||||
fontVariants: function() {
|
fontVariants: function () {
|
||||||
return ["normal", "small-caps", "inherit"];
|
return ["normal", "small-caps", "inherit"];
|
||||||
},
|
},
|
||||||
fontWeights: function() {
|
fontWeights: function () {
|
||||||
return ["normal", "bold", "bolder", "lighter"];
|
return ["normal", "bold", "bolder", "lighter"];
|
||||||
},
|
},
|
||||||
fontSizeAbsolute: function() {
|
fontSizeAbsolute: function () {
|
||||||
return ["xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large"];
|
return ["xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large"];
|
||||||
},
|
},
|
||||||
fontFamiliesGeneric: function() {
|
fontFamiliesGeneric: function () {
|
||||||
return ["serif", "sans-serif", "cursive", "fantasy", "monospace"];
|
return ["serif", "sans-serif", "cursive", "fantasy", "monospace"];
|
||||||
},
|
},
|
||||||
fontFamilies: function() {
|
fontFamilies: function () {
|
||||||
return ["'Times New Roman'", "Arial", "Courier", "Helvetica"];
|
return ["'Times New Roman'", "Arial", "Courier", "Helvetica"];
|
||||||
},
|
},
|
||||||
fontFamily: function () {
|
fontFamily: function () {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
make.network = {
|
make.network = {
|
||||||
sdp: function() {
|
sdp: function () {
|
||||||
// session description protocol template
|
// session description protocol template
|
||||||
return [
|
return [
|
||||||
"v=0",
|
"v=0",
|
||||||
|
@ -34,23 +34,28 @@ make.network = {
|
||||||
"a=candidate:0 2 UDP 2113601790 192.168.129.33 62658 typ host",
|
"a=candidate:0 2 UDP 2113601790 192.168.129.33 62658 typ host",
|
||||||
].join("\n");
|
].join("\n");
|
||||||
},
|
},
|
||||||
PeerConnectionProtocols: function() {
|
PeerConnectionProtocols: function () {
|
||||||
return ["turn", "turns", "stun", "stuns"]
|
return ["turn", "turns", "stun", "stuns"]
|
||||||
},
|
},
|
||||||
randomIPv4: function() {
|
randomIPv4: function () {
|
||||||
return random.pick([random.number(255), make.numbers.number]) + "." +
|
return random.pick([random.number(255), make.numbers.number]) + "." +
|
||||||
random.pick([random.number(255), make.numbers.number]) + "." +
|
random.pick([random.number(255), make.numbers.number]) + "." +
|
||||||
random.pick([random.number(255), make.numbers.number]) + "." +
|
random.pick([random.number(255), make.numbers.number]) + "." +
|
||||||
random.pick([random.number(255), make.numbers.number]);
|
random.pick([random.number(255), make.numbers.number]);
|
||||||
},
|
},
|
||||||
randomIPv6: function() {
|
randomIPv6: function () {
|
||||||
return "[" + make.stringFromBlocks([":", function() { return make.strings.digitsHex(random.range(1, 4)) }]) + "]"
|
return "[" + make.stringFromBlocks([":", function () {
|
||||||
|
return make.strings.digitsHex(random.range(1, 4))
|
||||||
|
}]) + "]"
|
||||||
},
|
},
|
||||||
goodHostnames: function() { return [
|
goodHostnames: function () {
|
||||||
|
return [
|
||||||
"0.0.0.0",
|
"0.0.0.0",
|
||||||
"127.0.0.1:8080",
|
"127.0.0.1:8080",
|
||||||
]},
|
]
|
||||||
badHostnames: function() { return [
|
},
|
||||||
|
badHostnames: function () {
|
||||||
|
return [
|
||||||
"google.org:8080",
|
"google.org:8080",
|
||||||
"::1",
|
"::1",
|
||||||
"[::192.9.5.5]:42",
|
"[::192.9.5.5]:42",
|
||||||
|
@ -62,8 +67,9 @@ make.network = {
|
||||||
"::ffff:192.0.2.128",
|
"::ffff:192.0.2.128",
|
||||||
"2001:db8::1:2",
|
"2001:db8::1:2",
|
||||||
"2001:db8::1:1:1:1:1"
|
"2001:db8::1:1:1:1:1"
|
||||||
]},
|
]
|
||||||
randomBitmask: function(list) {
|
},
|
||||||
|
randomBitmask: function (list) {
|
||||||
if (list.length <= 1) {
|
if (list.length <= 1) {
|
||||||
return list.join("");
|
return list.join("");
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,16 +5,25 @@ make.numbers = {
|
||||||
float: function () {
|
float: function () {
|
||||||
let n;
|
let n;
|
||||||
if (random.chance(32)) {
|
if (random.chance(32)) {
|
||||||
switch(random.number(4)) {
|
switch (random.number(4)) {
|
||||||
case 0: n = random.range(Number.MAX_VALUE, Number.MIN_VALUE); break;
|
case 0:
|
||||||
case 1: n = Math.pow(10, 1) / Math.pow(10, random.number(307)); break;
|
n = random.range(Number.MAX_VALUE, Number.MIN_VALUE);
|
||||||
case 2: n = Math.pow(2, random.float() * random.float() * 64); break;
|
break;
|
||||||
case 3: n = Math.pow(10, random.range(1, 9)) / Math.pow(10, random.range(1, 9)); break;
|
case 1:
|
||||||
|
n = Math.pow(10, 1) / Math.pow(10, random.number(307));
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
n = Math.pow(2, random.float() * random.float() * 64);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
n = Math.pow(10, random.range(1, 9)) / Math.pow(10, random.range(1, 9));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
switch (random.number(6)) {
|
switch (random.number(6)) {
|
||||||
default: n = random.float();
|
default:
|
||||||
|
n = random.float();
|
||||||
}
|
}
|
||||||
return n;
|
return n;
|
||||||
},
|
},
|
||||||
|
@ -37,7 +46,7 @@ make.numbers = {
|
||||||
let value = random.choose([
|
let value = random.choose([
|
||||||
[10, make.numbers.float],
|
[10, make.numbers.float],
|
||||||
[10, [make.numbers.rangeNumber, make.numbers.tinyNumber]],
|
[10, [make.numbers.rangeNumber, make.numbers.tinyNumber]],
|
||||||
[ 1, Make.numbers.unsignedNumber]
|
[1, Make.numbers.unsignedNumber]
|
||||||
]);
|
]);
|
||||||
return random.chance(10) ? -value : value;
|
return random.chance(10) ? -value : value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
make.shaders = {
|
make.shaders = {
|
||||||
fragment1: function() {
|
fragment1: function () {
|
||||||
return [
|
return [
|
||||||
[
|
[
|
||||||
"#ifdef GL_ES",
|
"#ifdef GL_ES",
|
||||||
|
@ -54,7 +54,7 @@ make.shaders = {
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
fragment2: function() {
|
fragment2: function () {
|
||||||
return [
|
return [
|
||||||
[
|
[
|
||||||
"varying highp vec2 vTextureCoord;",
|
"varying highp vec2 vTextureCoord;",
|
||||||
|
@ -86,7 +86,7 @@ make.shaders = {
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
vertex2: function() {
|
vertex2: function () {
|
||||||
return [
|
return [
|
||||||
[
|
[
|
||||||
"attribute highp vec3 aVertexNormal;",
|
"attribute highp vec3 aVertexNormal;",
|
||||||
|
@ -132,7 +132,7 @@ make.shaders = {
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
shaderPair: function(v, f) {
|
shaderPair: function (v, f) {
|
||||||
let i = random.number(v.length);
|
let i = random.number(v.length);
|
||||||
return {
|
return {
|
||||||
vertex: utils.common.quote(v[i].join("\n")),
|
vertex: utils.common.quote(v[i].join("\n")),
|
||||||
|
|
56
make/text.js
56
make/text.js
|
@ -26,7 +26,7 @@ make.text = {
|
||||||
"en-US", "en", "de"
|
"en-US", "en", "de"
|
||||||
]);
|
]);
|
||||||
},
|
},
|
||||||
layoutCharCodes: function() {
|
layoutCharCodes: function () {
|
||||||
return random.pick([
|
return random.pick([
|
||||||
0, // null
|
0, // null
|
||||||
160, // non-breaking space
|
160, // non-breaking space
|
||||||
|
@ -96,7 +96,8 @@ make.text = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// http://www.unicode.org/Public/6.0.0/ucd/UnicodeData.txt
|
// http://www.unicode.org/Public/6.0.0/ucd/UnicodeData.txt
|
||||||
unicodeCombiningCharacters: function() { return random.item([
|
unicodeCombiningCharacters: function () {
|
||||||
|
return random.item([
|
||||||
[0x0300, 0x036F], // Combining Diacritical Marks
|
[0x0300, 0x036F], // Combining Diacritical Marks
|
||||||
[0x0483, 0x0489],
|
[0x0483, 0x0489],
|
||||||
[0x07EB, 0x07F3],
|
[0x07EB, 0x07F3],
|
||||||
|
@ -115,29 +116,39 @@ make.text = {
|
||||||
[0x1D17B, 0x1D18B],
|
[0x1D17B, 0x1D18B],
|
||||||
[0x1D1AA, 0x1D1AD],
|
[0x1D1AA, 0x1D1AD],
|
||||||
[0x1D242, 0x1D244]
|
[0x1D242, 0x1D244]
|
||||||
])},
|
])
|
||||||
unicodeBMP: function() { return random.item([
|
},
|
||||||
|
unicodeBMP: function () {
|
||||||
|
return random.item([
|
||||||
// BMP = Basic Multilingual Plane
|
// BMP = Basic Multilingual Plane
|
||||||
[0x0000, 0xFFFF]
|
[0x0000, 0xFFFF]
|
||||||
])},
|
])
|
||||||
unicodeSMP: function() { return random.item([
|
},
|
||||||
|
unicodeSMP: function () {
|
||||||
|
return random.item([
|
||||||
// SMP = Supplementary Multilingual Plane
|
// SMP = Supplementary Multilingual Plane
|
||||||
[0x10000, 0x13FFF],
|
[0x10000, 0x13FFF],
|
||||||
[0x16000, 0x16FFF],
|
[0x16000, 0x16FFF],
|
||||||
[0x1B000, 0x1BFFF],
|
[0x1B000, 0x1BFFF],
|
||||||
[0x1D000, 0x1DFFF],
|
[0x1D000, 0x1DFFF],
|
||||||
[0x1F000, 0x1FFFF]
|
[0x1F000, 0x1FFFF]
|
||||||
])},
|
])
|
||||||
unicodeSIP: function() { return random.item([
|
},
|
||||||
|
unicodeSIP: function () {
|
||||||
|
return random.item([
|
||||||
// SIP = Supplementary Ideographic Plane
|
// SIP = Supplementary Ideographic Plane
|
||||||
[0x20000, 0x2BFFF],
|
[0x20000, 0x2BFFF],
|
||||||
[0x2F000, 0x2FFFF]
|
[0x2F000, 0x2FFFF]
|
||||||
])},
|
])
|
||||||
unicodeSSP: function() { return random.item([
|
},
|
||||||
|
unicodeSSP: function () {
|
||||||
|
return random.item([
|
||||||
// SSP = Supplementary Special-purpose Plane
|
// SSP = Supplementary Special-purpose Plane
|
||||||
[0xE0000, 0xE0FFF]
|
[0xE0000, 0xE0FFF]
|
||||||
])},
|
])
|
||||||
registeredFontFeatures: function() { return random.pick([
|
},
|
||||||
|
registeredFontFeatures: function () {
|
||||||
|
return random.pick([
|
||||||
'aalt', 'abvf', 'abvm', 'abvs', 'afrc', 'akhn', 'blwf', 'blwm', 'blws',
|
'aalt', 'abvf', 'abvm', 'abvs', 'afrc', 'akhn', 'blwf', 'blwm', 'blws',
|
||||||
'calt', 'case', 'ccmp', 'cfar', 'cjct', 'clig', 'cpct', 'cpsp', 'cswh',
|
'calt', 'case', 'ccmp', 'cfar', 'cjct', 'clig', 'cpct', 'cpsp', 'cswh',
|
||||||
'curs', 'cv01-cv99', 'c2pc', 'c2sc', 'dist', 'dlig', 'dnom', 'expt',
|
'curs', 'cv01-cv99', 'c2pc', 'c2sc', 'dist', 'dlig', 'dnom', 'expt',
|
||||||
|
@ -153,16 +164,23 @@ make.text = {
|
||||||
'ss14', 'ss15', 'ss16', 'ss17', 'ss18', 'ss19', 'ss20', 'subs', 'sups',
|
'ss14', 'ss15', 'ss16', 'ss17', 'ss18', 'ss19', 'ss20', 'subs', 'sups',
|
||||||
'swsh', 'titl', 'tjmo', 'tnam', 'tnum', 'trad', 'twid', 'unic', 'valt',
|
'swsh', 'titl', 'tjmo', 'tnam', 'tnum', 'trad', 'twid', 'unic', 'valt',
|
||||||
'vatu', 'vert', 'vhal', 'vjmo', 'vkna', 'vkrn', 'vpal', 'vrt2', 'zero'
|
'vatu', 'vert', 'vhal', 'vjmo', 'vkna', 'vkrn', 'vpal', 'vrt2', 'zero'
|
||||||
])},
|
])
|
||||||
assignmentOperator: function() { return random.pick([
|
},
|
||||||
|
assignmentOperator: function () {
|
||||||
|
return random.pick([
|
||||||
"=", "-=", "+=", "*=", "/="
|
"=", "-=", "+=", "*=", "/="
|
||||||
])},
|
])
|
||||||
arithmeticOperator: function() { return random.pick([
|
},
|
||||||
|
arithmeticOperator: function () {
|
||||||
|
return random.pick([
|
||||||
"%", "-", "+", "*", "/"
|
"%", "-", "+", "*", "/"
|
||||||
])},
|
])
|
||||||
currency: function() { return random.pick([
|
},
|
||||||
|
currency: function () {
|
||||||
|
return random.pick([
|
||||||
// https://en.wikipedia.org/wiki/ISO_4217
|
// https://en.wikipedia.org/wiki/ISO_4217
|
||||||
"USD", "USS", "USN", "EUR", "CHF", "GBP", "XAG", "XBA", "XBB", "XBC",
|
"USD", "USS", "USN", "EUR", "CHF", "GBP", "XAG", "XBA", "XBB", "XBC",
|
||||||
"XBD", "XSU", "XTS", "XXX",
|
"XBD", "XSU", "XTS", "XXX",
|
||||||
])},
|
])
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
make.types = {
|
make.types = {
|
||||||
random: function() {
|
random: function () {
|
||||||
return random.item([
|
return random.item([
|
||||||
"true",
|
"true",
|
||||||
"null",
|
"null",
|
||||||
|
|
|
@ -9,15 +9,15 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function MersenneTwister()
|
function MersenneTwister() {
|
||||||
{
|
|
||||||
const N = 624;
|
const N = 624;
|
||||||
const M = 397;
|
const M = 397;
|
||||||
const UPPER_MASK = 0x80000000;
|
const UPPER_MASK = 0x80000000;
|
||||||
const LOWER_MASK = 0x7fffffff;
|
const LOWER_MASK = 0x7fffffff;
|
||||||
const MAG01 = new Int32Array([0, 0x9908b0df]);
|
const MAG01 = new Int32Array([0, 0x9908b0df]);
|
||||||
|
|
||||||
let mt = new Int32Array(N); /* the array for the state vector */
|
let mt = new Int32Array(N);
|
||||||
|
/* the array for the state vector */
|
||||||
let mti = 625;
|
let mti = 625;
|
||||||
|
|
||||||
this.seed = function (s) {
|
this.seed = function (s) {
|
||||||
|
@ -27,28 +27,28 @@ function MersenneTwister()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.export_state = function() {
|
this.export_state = function () {
|
||||||
return [mt, mti];
|
return [mt, mti];
|
||||||
};
|
};
|
||||||
|
|
||||||
this.import_state = function(s) {
|
this.import_state = function (s) {
|
||||||
mt = s[0];
|
mt = s[0];
|
||||||
mti = s[1];
|
mti = s[1];
|
||||||
};
|
};
|
||||||
|
|
||||||
this.export_mta = function() {
|
this.export_mta = function () {
|
||||||
return mt;
|
return mt;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.import_mta = function(_mta) {
|
this.import_mta = function (_mta) {
|
||||||
mt = _mta;
|
mt = _mta;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.export_mti = function() {
|
this.export_mti = function () {
|
||||||
return mti;
|
return mti;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.import_mti = function(_mti) {
|
this.import_mti = function (_mti) {
|
||||||
mti = _mti;
|
mti = _mti;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -56,16 +56,16 @@ function MersenneTwister()
|
||||||
let y, kk;
|
let y, kk;
|
||||||
|
|
||||||
if (mti >= N) { /* generate N words at one time */
|
if (mti >= N) { /* generate N words at one time */
|
||||||
for (kk = 0; kk < N-M; kk++) {
|
for (kk = 0; kk < N - M; kk++) {
|
||||||
y = ((mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK));
|
y = ((mt[kk] & UPPER_MASK) | (mt[kk + 1] & LOWER_MASK));
|
||||||
mt[kk] = (mt[kk+M] ^ (y >>> 1) ^ MAG01[y & 0x1]);
|
mt[kk] = (mt[kk + M] ^ (y >>> 1) ^ MAG01[y & 0x1]);
|
||||||
}
|
}
|
||||||
for (; kk < N-1; kk++) {
|
for (; kk < N - 1; kk++) {
|
||||||
y = ((mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK));
|
y = ((mt[kk] & UPPER_MASK) | (mt[kk + 1] & LOWER_MASK));
|
||||||
mt[kk] = (mt[kk+(M-N)] ^ (y >>> 1) ^ MAG01[y & 0x1]);
|
mt[kk] = (mt[kk + (M - N)] ^ (y >>> 1) ^ MAG01[y & 0x1]);
|
||||||
}
|
}
|
||||||
y = ((mt[N-1] & UPPER_MASK) | (mt[0] & LOWER_MASK));
|
y = ((mt[N - 1] & UPPER_MASK) | (mt[0] & LOWER_MASK));
|
||||||
mt[N-1] = (mt[M-1] ^ (y >>> 1) ^ MAG01[y & 0x1]);
|
mt[N - 1] = (mt[M - 1] ^ (y >>> 1) ^ MAG01[y & 0x1]);
|
||||||
mti = 0;
|
mti = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ var random = {
|
||||||
y = (x * limit) >>> 0, r;
|
y = (x * limit) >>> 0, r;
|
||||||
do {
|
do {
|
||||||
r = this.twister.int32();
|
r = this.twister.int32();
|
||||||
} while(y && r >= y);
|
} while (y && r >= y);
|
||||||
return (r / x) >>> 0;
|
return (r / x) >>> 0;
|
||||||
},
|
},
|
||||||
float: function () {
|
float: function () {
|
||||||
|
@ -39,7 +39,7 @@ var random = {
|
||||||
}
|
}
|
||||||
return this.number(limit - start + 1) + start;
|
return this.number(limit - start + 1) + start;
|
||||||
},
|
},
|
||||||
ludOneTo: function(limit) {
|
ludOneTo: function (limit) {
|
||||||
// Returns a float in [1, limit]. The logarithm has uniform distribution.
|
// Returns a float in [1, limit]. The logarithm has uniform distribution.
|
||||||
return Math.exp(this.float() * Math.log(limit));
|
return Math.exp(this.float() * Math.log(limit));
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
utils.block = {
|
utils.block = {
|
||||||
block: function(list, optional) {
|
block: function (list, optional) {
|
||||||
if (optional == true) {
|
if (optional == true) {
|
||||||
if (random.chance(6)) {
|
if (random.chance(6)) {
|
||||||
return '';
|
return '';
|
||||||
|
@ -16,7 +16,7 @@ utils.block = {
|
||||||
if (typeof(item) == "string") {
|
if (typeof(item) == "string") {
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
if (item instanceof(Array)) {
|
if (item instanceof (Array)) {
|
||||||
let s = "";
|
let s = "";
|
||||||
for (let i = 0; i < item.length; i++) {
|
for (let i = 0; i < item.length; i++) {
|
||||||
s += go_deeper(item[i]);
|
s += go_deeper(item[i]);
|
||||||
|
|
|
@ -11,7 +11,7 @@ utils.script = {
|
||||||
return "(" + params.join(", ") + ")";
|
return "(" + params.join(", ") + ")";
|
||||||
},
|
},
|
||||||
methodCall: function (objectName, methodHash) {
|
methodCall: function (objectName, methodHash) {
|
||||||
if(!utils.common.getKeysFromHash(methodHash).length || !objectName) {
|
if (!utils.common.getKeysFromHash(methodHash).length || !objectName) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
var methodName = random.key(methodHash);
|
var methodName = random.key(methodHash);
|
||||||
|
@ -22,7 +22,7 @@ utils.script = {
|
||||||
return objectName + "." + methodName + utils.script..methodHead(methodArgs);
|
return objectName + "." + methodName + utils.script..methodHead(methodArgs);
|
||||||
},
|
},
|
||||||
setAttribute: function (objectName, attributeHash) {
|
setAttribute: function (objectName, attributeHash) {
|
||||||
if(!utils.common.getKeysFromHash(attributeHash).length || !objectName) {
|
if (!utils.common.getKeysFromHash(attributeHash).length || !objectName) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
var attributeName = random.key(attributeHash);
|
var attributeName = random.key(attributeHash);
|
||||||
|
@ -85,15 +85,18 @@ utils.script = {
|
||||||
return "(document.body || document.documentElement).appendChild" + utils.script..methodHead([name]);
|
return "(document.body || document.documentElement).appendChild" + utils.script..methodHead([name]);
|
||||||
},
|
},
|
||||||
forceGC: function () {
|
forceGC: function () {
|
||||||
if (platform.isMozilla) {}
|
if (platform.isMozilla) {
|
||||||
|
}
|
||||||
if (platform.isChrome) {
|
if (platform.isChrome) {
|
||||||
if (window.GCController)
|
if (window.GCController)
|
||||||
return GCController.collect();
|
return GCController.collect();
|
||||||
}
|
}
|
||||||
if (platform.isSafari) {}
|
if (platform.isSafari) {
|
||||||
if (platform.isIE) {}
|
}
|
||||||
|
if (platform.isIE) {
|
||||||
|
}
|
||||||
},
|
},
|
||||||
getRandomElement: function() {
|
getRandomElement: function () {
|
||||||
return "document.getElementsByTagName('*')[" + random.number(document.getElementsByTagName("*").length) + "]";
|
return "document.getElementsByTagName('*')[" + random.number(document.getElementsByTagName("*").length) + "]";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue