User:Uraxys/common.js: Difference between revisions
From Idle Clans wiki
mNo edit summary |
No edit summary |
||
(12 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
// Testing | |||
// mw.loader.load('//wiki.idleclans.com/index.php?title=User:Uraxys/scripts/test.js&action=raw&ctype=text/javascript'); | |||
// local IDE | |||
// mw.loader.load('http://mediawiki.localhost/src/mediawiki.js'); | |||
// | /*function testMath2(base, multiplier) { | ||
base = base || 33.0; | |||
multiplier = multiplier || 30 + 25; | |||
var wasm_base64; | |||
var wasm_buffer; | |||
var wasm; | |||
var wasm_instance; | |||
function hw() { | |||
wasm_base64 = "AGFzbQEAAAABIwZgAn9/AX9gBH9/f38AYAF/AX9gAXwBfGADfHx/AXxgAX8AAwsKAAEBAwQAAgACBQQFAXABCQkFAwEAEQYJAX8BQYCAwAALBxkCBm1lbW9yeQIADGNhbGN1bGF0ZV94cAAECQ4BAEEBCwgJAQUGCQIHCArWCwqnBAEHfyABKAIAIgMEQCAAQQJ0IQcDQCADKAIIIgJBAXEEfwNAIAMgAkF+cTYCCCADKAIEIgZBfHEiBQR/QQAgBSAFLQAAQQFxGwVBAAshBAJAIAMoAgAiAkECcQ0AIAJBfHEiCEUNACAIIAgoAgRBA3EgBXI2AgQgAygCBCIGQXxxIQUgAygCACECCyAFBEAgBSAFKAIAQQNxIAJBfHFyNgIAIAMoAgQhBiADKAIAIQILIAMgBkEDcTYCBCADIAJBA3E2AgAgAkECcQRAIAQgBCgCAEECcjYCAAsgASAENgIAIAQiAygCCCICQQFxDQALIARBCGoFIANBCGoLIQQCQCADKAIAQXxxIgUgBGsgB0kNAAJ/IAUgB2tBfHEiAiAEQZiAwAAgAEGogMAAKAIAEQAAQQJ0akEIakkEQCAEKAIAIQIgBEEDcQ0CIAEgAkF8cTYCACADIgIoAgAMAQtBACEAIAJBADYCACACQQhrIgJCADcCACACIAMoAgBBfHE2AgACQCADKAIAIgFBAnENACABQXxxIgFFDQAgASABKAIEQQNxIAJyNgIEIAIoAgRBA3EhAAsgAiAAIANyNgIEIAQgBCgCAEF+cTYCACADIAMoAgAiAEEDcSACciIBNgIAIABBAnFFBEAgAigCAAwBCyADIAFBfXE2AgAgAigCAEECcgshACACIABBAXI2AgAgAkEIag8LIAEgAjYCACACIgMNAAsLQQAL3AEBA38jAEEQayIDJAAgAyABKAIAIgYoAgA2AgwjAEEQayIBJAACQEGAECACQQJqIgIgAmwiAiACQYAQTRsiBSADQQxqIgIQACIEDQAgAUEIakGYgMAAIAVBBEGkgMAAKAIAEQEAQQAhBCABKAIIDQAgASgCDCIEIAIoAgA2AgggAiAENgIAIAUgAhAAIQQLIAFBEGokACAEIQEgBiADKAIMNgIAIAEEfyABQgA3AgQgASABIAVBAnRqQQJyNgIAQQAFQQELIQIgACABNgIEIAAgAjYCACADQRBqJAALagACfyACQQJ0IgEgA0EDdEGAgAFqIgIgASACSxtBh4AEaiIBQRB2QAAiAkF/RgRAQQAhAkEBDAELIAJBEHQiAkIANwIEIAIgAiABQYCAfHFqQQJyNgIAQQALIQMgACACNgIEIAAgAzYCAAshACAAvUKAgICAgICAgIB/g0L/////////7z+EvyAAoJ0LpgQCAn0BfyACQQBHIAC2IQMgAbYiBEMAAAAAXgRAIARDAADIQpVDAACAP5IgA5S7RAAAAAAAACRAoiIAIAAQAyIAoZlEAAAAAAAA4D9hBHwgAEQAAAAAAADgw2YhBSAAIABEAAAAAAAA8L+gQv///////////wACfiAAmUQAAAAAAADgQ2MEQCAAsAwBC0KAgICAgICAgIB/C0KAgICAgICAgIB/IAUbIABE////////30NkG0IAIAAgAGEbQgGDUBsFIAALRAAAAAAAACRAo7YhAwsEfSADQ2Zmpj+Uu0QAAAAAAAAkQKIiACAAEAMiAKGZRAAAAAAAAOA/YQR8IABEAAAAAAAA4MNmIQIgACAARAAAAAAAAPC/oEL///////////8AAn4gAJlEAAAAAAAA4ENjBEAgALAMAQtCgICAgICAgICAfwtCgICAgICAgICAfyACGyAARP///////99DZBtCACAAIABhG0IBg1AbBSAAC0QAAAAAAAAkQKO2BSADC7tEAAAAAAAAJECiIgAgABADIgChmUQAAAAAAADgP2EEfCAARAAAAAAAAODDZiECIAAgAEQAAAAAAADwv6BC////////////AAJ+IACZRAAAAAAAAOBDYwRAIACwDAELQoCAgICAgICAgH8LQoCAgICAgICAgH8gAhsgAET////////fQ2QbQgAgACAAYRtCAYNQGwUgAAtEAAAAAAAAJECjtrsLBAAgAQsEAEEACwUAQYAECwQAQQELAwABCws2AQBBgIDAAAstAQAAAAQAAAAEAAAAAgAAAAMAAAAEAAAABQAAAAAAAAABAAAABgAAAAcAAAAIAG8JcHJvZHVjZXJzAghsYW5ndWFnZQEEUnVzdAAMcHJvY2Vzc2VkLWJ5AwVydXN0Yx0xLjc4LjAgKDliMDA5NTZlNSAyMDI0LTA0LTI5KQZ3YWxydXMGMC4yMC4zDHdhc20tYmluZGdlbgYwLjIuOTIALA90YXJnZXRfZmVhdHVyZXMCKw9tdXRhYmxlLWdsb2JhbHMrCHNpZ24tZXh0"; | |||
wasm_buffer = Uint8Array.from(atob(wasm_base64), function (c) { return c.charCodeAt(0); }).buffer; | |||
WebAssembly.compile(wasm_buffer).then(function(x) { | |||
wasm = x; | |||
wasm_instance = new WebAssembly.Instance(wasm); | |||
var x = wasm_instance.exports.calculate_xp(base, multiplier, false); | |||
// to one decimal place | |||
console.log("Calculate xp:", x.toFixed(1)); | |||
}); | |||
} | |||
hw(); | |||
} | |||
testMath2();*/ |
Latest revision as of 10:14, 12 June 2024
// Testing // mw.loader.load('//wiki.idleclans.com/index.php?title=User:Uraxys/scripts/test.js&action=raw&ctype=text/javascript'); // local IDE // mw.loader.load('http://mediawiki.localhost/src/mediawiki.js'); /*function testMath2(base, multiplier) { base = base || 33.0; multiplier = multiplier || 30 + 25; var wasm_base64; var wasm_buffer; var wasm; var wasm_instance; function hw() { wasm_base64 = "AGFzbQEAAAABIwZgAn9/AX9gBH9/f38AYAF/AX9gAXwBfGADfHx/AXxgAX8AAwsKAAEBAwQAAgACBQQFA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gAjYCACADQRBqJAALagACfyACQQJ0IgEgA0EDdEGAgAFqIgIgASACSxtBh4AEaiIBQRB2QAAiAkF/RgRAQQAhAkEBDAELIAJBEHQiAkIANwIEIAIgAiABQYCAfHFqQQJyNgIAQQALIQMgACACNgIEIAAgAzYCAAshACAAvUKAgICAgICAgIB/g0L/////////7z+EvyAAoJ0LpgQCAn0BfyACQQBHIAC2IQMgAbYiBEMAAAAAXgRAIARDAADIQpVDAACAP5IgA5S7RAAAAAAAACRAoiIAIAAQAyIAoZlEAAAAAAAA4D9hBHwgAEQAAAAAAADgw2YhBSAAIABEAAAAAAAA8L+gQv///////////wACfiAAmUQAAAAAAADgQ2MEQCAAsAwBC0KAgICAgICAgIB/C0KAgICAgICAgIB/IAUbIABE////////30NkG0IAIAAgAGEbQgGDUBsFIAALRAAAAAAAACRAo7YhAwsEfSADQ2Zmpj+Uu0QAAAAAAAAkQKIiACAAEAMiAKGZRAAAAAAAAOA/YQR8IABEAAAAAAAA4MNmIQIgACAARAAAAAAAAPC/oEL///////////8AAn4gAJlEAAAAAAAA4ENjBEAgALAMAQtCgICAgICAgICAfwtCgICAgICAgICAfyACGyAARP///////99DZBtCACAAIABhG0IBg1AbBSAAC0QAAAAAAAAkQKO2BSADC7tEAAAAAAAAJECiIgAgABADIgChmUQAAAAAAADgP2EEfCAARAAAAAAAAODDZiECIAAgAEQAAAAAAADwv6BC////////////AAJ+IACZRAAAAAAAAOBDYwRAIACwDAELQoCAgICAgICAgH8LQoCAgICAgICAgH8gAhsgAET////////fQ2QbQgAgACAAYRtCAYNQGwUgAAtEAAAAAAAAJECjtrsLBAAgAQsEAEEACwUAQYAECwQAQQELAwABCws2AQBBgIDAAAstAQAAAAQAAAAEAAAAAgAAAAMAAAAEAAAABQAAAAAAAAABAAAABgAAAAcAAAAIAG8JcHJvZHVjZXJzAghsYW5ndWFnZQEEUnVzdAAMcHJvY2Vzc2VkLWJ5AwVydXN0Yx0xLjc4LjAgKDliMDA5NTZlNSAyMDI0LTA0LTI5KQZ3YWxydXMGMC4yMC4zDHdhc20tYmluZGdlbgYwLjIuOTIALA90YXJnZXRfZmVhdHVyZXMCKw9tdXRhYmxlLWdsb2JhbHMrCHNpZ24tZXh0"; wasm_buffer = Uint8Array.from(atob(wasm_base64), function (c) { return c.charCodeAt(0); }).buffer; WebAssembly.compile(wasm_buffer).then(function(x) { wasm = x; wasm_instance = new WebAssembly.Instance(wasm); var x = wasm_instance.exports.calculate_xp(base, multiplier, false); // to one decimal place console.log("Calculate xp:", x.toFixed(1)); }); } hw(); } testMath2();*/