//1============= function HideFrm(id) { var Item = document.getElementById(id); if (Item) Item.style.display = 'none'; } function CloseFrm(id) { HideFrm('IDFormBG'); var Item = document.getElementById(id); Item.remove(); } function getJSON(url, callback) { var request = new XMLHttpRequest(); request.open("GET", url); request.onload = function() { if(callback) callback(request); } request.responseType = 'json'; request.send(); } function postJSON(url, data, callback) { var request = new XMLHttpRequest(); request.open("POST", url); //request.onreadystatechange = function() { request.onload = function() { if(request.readyState === 4 && callback) callback(request); } request.responseType = 'json'; request.setRequestHeader("Content-Type", "application/json"); request.send(JSON.stringify(data)); } function CreateElement(etype, eclass = null, ehtml = null) { let e = document.createElement(etype); if (eclass) { e.classList.add(eclass); } if (ehtml) { e.innerHTML = ehtml; } return e; } //5============= /** * [js-sha3]{@link https://github.com/emn178/js-sha3} * * @version 0.9.3 * @author Chen, Yi-Cyuan [emn178@gmail.com] * @copyright Chen, Yi-Cyuan 2015-2023 * @license MIT */ !function(){"use strict";function t(t,e,r){this.blocks=[],this.s=[],this.padding=e,this.outputBits=r,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(t<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function e(e,r,n){t.call(this,e,r,n)}var r="input is invalid type",n="object"==typeof window,i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var o=!n&&"object"==typeof self;!i.JS_SHA3_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node?i=global:o&&(i=self);for(var a=!i.JS_SHA3_NO_COMMON_JS&&"object"==typeof module&&module.exports,s="function"==typeof define&&define.amd,u=!i.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,f="0123456789abcdef".split(""),c=[4,1024,262144,67108864],h=[0,8,16,24],p=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],d=[224,256,384,512],l=[128,256],y=["hex","buffer","arrayBuffer","array","digest"],b={128:168,256:136},v=i.JS_SHA3_NO_NODE_JS||!Array.isArray?function(t){return"[object Array]"===Object.prototype.toString.call(t)}:Array.isArray,A=!u||!i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView?ArrayBuffer.isView:function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer},g=function(t){var e=typeof t;if("string"===e)return[t,!0];if("object"!==e||null===t)throw new Error(r);if(u&&t.constructor===ArrayBuffer)return[new Uint8Array(t),!1];if(!v(t)&&!A(t))throw new Error(r);return[t,!1]},B=function(t){return 0===g(t)[0].length},_=function(t){for(var e=[],r=0;r>2]|=n<>2]|=(192|n>>6)<>2]|=(128|63&n)<=57344?(o[r>>2]|=(224|n>>12)<>2]|=(128|n>>6&63)<>2]|=(128|63&n)<>2]|=(240|n>>18)<>2]|=(128|n>>12&63)<>2]|=(128|n>>6&63)<>2]|=(128|63&n)<>2]|=t[f]<=a){for(this.start=r-a,this.block=o[u],r=0;r>=8);r>0;)i.unshift(r),r=255&(t>>=8),++n;return e?i.push(n):i.unshift(n),this.update(i),i.length},t.prototype.encodeString=function(t){var e=g(t);t=e[0];var r=e[1],n=0,i=t.length;if(r)for(var o=0;o=57344?n+=3:(a=65536+((1023&a)<<10|1023&t.charCodeAt(++o)),n+=4)}else n=i;return n+=this.encode(8*n),this.update(t),n},t.prototype.bytepad=function(t,e){for(var r=this.encode(e),n=0;n>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[r],e=1;e>4&15]+f[15&t]+f[t>>12&15]+f[t>>8&15]+f[t>>20&15]+f[t>>16&15]+f[t>>28&15]+f[t>>24&15];a%e==0&&(r=_(r),R(r),o=0)}return i&&(t=r[o],s+=f[t>>4&15]+f[15&t],i>1&&(s+=f[t>>12&15]+f[t>>8&15]),i>2&&(s+=f[t>>20&15]+f[t>>16&15])),s},t.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;t=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(s);for(var u=new Uint32Array(t);a>8&255,u[t+2]=e>>16&255,u[t+3]=e>>24&255;s%r==0&&(n=_(n),R(n))}return o&&(t=s<<2,e=n[a],u[t]=255&e,o>1&&(u[t+1]=e>>8&255),o>2&&(u[t+2]=e>>16&255)),u},(e.prototype=new t).finalize=function(){return this.encode(this.outputBits,!0),t.prototype.finalize.call(this)};var R=function(t){var e,r,n,i,o,a,s,u,f,c,h,d,l,y,b,v,A,g,B,_,k,w,S,C,x,m,O,z,N,J,M,j,E,H,I,R,F,U,D,V,W,Y,K,q,G,L,P,Q,T,X,Z,$,tt,et,rt,nt,it,ot,at,st,ut,ft,ct;for(n=0;n<48;n+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],a=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],u=t[4]^t[14]^t[24]^t[34]^t[44],f=t[5]^t[15]^t[25]^t[35]^t[45],c=t[6]^t[16]^t[26]^t[36]^t[46],h=t[7]^t[17]^t[27]^t[37]^t[47],e=(d=t[8]^t[18]^t[28]^t[38]^t[48])^(a<<1|s>>>31),r=(l=t[9]^t[19]^t[29]^t[39]^t[49])^(s<<1|a>>>31),t[0]^=e,t[1]^=r,t[10]^=e,t[11]^=r,t[20]^=e,t[21]^=r,t[30]^=e,t[31]^=r,t[40]^=e,t[41]^=r,e=i^(u<<1|f>>>31),r=o^(f<<1|u>>>31),t[2]^=e,t[3]^=r,t[12]^=e,t[13]^=r,t[22]^=e,t[23]^=r,t[32]^=e,t[33]^=r,t[42]^=e,t[43]^=r,e=a^(c<<1|h>>>31),r=s^(h<<1|c>>>31),t[4]^=e,t[5]^=r,t[14]^=e,t[15]^=r,t[24]^=e,t[25]^=r,t[34]^=e,t[35]^=r,t[44]^=e,t[45]^=r,e=u^(d<<1|l>>>31),r=f^(l<<1|d>>>31),t[6]^=e,t[7]^=r,t[16]^=e,t[17]^=r,t[26]^=e,t[27]^=r,t[36]^=e,t[37]^=r,t[46]^=e,t[47]^=r,e=c^(i<<1|o>>>31),r=h^(o<<1|i>>>31),t[8]^=e,t[9]^=r,t[18]^=e,t[19]^=r,t[28]^=e,t[29]^=r,t[38]^=e,t[39]^=r,t[48]^=e,t[49]^=r,y=t[0],b=t[1],L=t[11]<<4|t[10]>>>28,P=t[10]<<4|t[11]>>>28,z=t[20]<<3|t[21]>>>29,N=t[21]<<3|t[20]>>>29,st=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,Y=t[40]<<18|t[41]>>>14,K=t[41]<<18|t[40]>>>14,H=t[2]<<1|t[3]>>>31,I=t[3]<<1|t[2]>>>31,v=t[13]<<12|t[12]>>>20,A=t[12]<<12|t[13]>>>20,Q=t[22]<<10|t[23]>>>22,T=t[23]<<10|t[22]>>>22,J=t[33]<<13|t[32]>>>19,M=t[32]<<13|t[33]>>>19,ft=t[42]<<2|t[43]>>>30,ct=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,rt=t[4]<<30|t[5]>>>2,R=t[14]<<6|t[15]>>>26,F=t[15]<<6|t[14]>>>26,g=t[25]<<11|t[24]>>>21,B=t[24]<<11|t[25]>>>21,X=t[34]<<15|t[35]>>>17,Z=t[35]<<15|t[34]>>>17,j=t[45]<<29|t[44]>>>3,E=t[44]<<29|t[45]>>>3,C=t[6]<<28|t[7]>>>4,x=t[7]<<28|t[6]>>>4,nt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,U=t[26]<<25|t[27]>>>7,D=t[27]<<25|t[26]>>>7,_=t[36]<<21|t[37]>>>11,k=t[37]<<21|t[36]>>>11,$=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,q=t[8]<<27|t[9]>>>5,G=t[9]<<27|t[8]>>>5,m=t[18]<<20|t[19]>>>12,O=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,at=t[28]<<7|t[29]>>>25,V=t[38]<<8|t[39]>>>24,W=t[39]<<8|t[38]>>>24,w=t[48]<<14|t[49]>>>18,S=t[49]<<14|t[48]>>>18,t[0]=y^~v&g,t[1]=b^~A&B,t[10]=C^~m&z,t[11]=x^~O&N,t[20]=H^~R&U,t[21]=I^~F&D,t[30]=q^~L&Q,t[31]=G^~P&T,t[40]=et^~nt&ot,t[41]=rt^~it&at,t[2]=v^~g&_,t[3]=A^~B&k,t[12]=m^~z&J,t[13]=O^~N&M,t[22]=R^~U&V,t[23]=F^~D&W,t[32]=L^~Q&X,t[33]=P^~T&Z,t[42]=nt^~ot&st,t[43]=it^~at&ut,t[4]=g^~_&w,t[5]=B^~k&S,t[14]=z^~J&j,t[15]=N^~M&E,t[24]=U^~V&Y,t[25]=D^~W&K,t[34]=Q^~X&$,t[35]=T^~Z&tt,t[44]=ot^~st&ft,t[45]=at^~ut&ct,t[6]=_^~w&y,t[7]=k^~S&b,t[16]=J^~j&C,t[17]=M^~E&x,t[26]=V^~Y&H,t[27]=W^~K&I,t[36]=X^~$&q,t[37]=Z^~tt&G,t[46]=st^~ft&et,t[47]=ut^~ct&rt,t[8]=w^~y&v,t[9]=S^~b&A,t[18]=j^~C&m,t[19]=E^~x&O,t[28]=Y^~H&R,t[29]=K^~I&F,t[38]=$^~q&L,t[39]=tt^~G&P,t[48]=ft^~et&nt,t[49]=ct^~rt&it,t[0]^=p[n],t[1]^=p[n+1]};if(a)module.exports=z;else{for(J=0;J>> 2] |= message[index] << SHIFT[i++ & 3]; } } else { for (i = this.start; index < length && i < 64; ++index) { code = message.charCodeAt(index); if (code < 0x80) { blocks[i >>> 2] |= code << SHIFT[i++ & 3]; } else if (code < 0x800) { blocks[i >>> 2] |= (0xc0 | (code >>> 6)) << SHIFT[i++ & 3]; blocks[i >>> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; } else if (code < 0xd800 || code >= 0xe000) { blocks[i >>> 2] |= (0xe0 | (code >>> 12)) << SHIFT[i++ & 3]; blocks[i >>> 2] |= (0x80 | ((code >>> 6) & 0x3f)) << SHIFT[i++ & 3]; blocks[i >>> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; } else { code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff)); blocks[i >>> 2] |= (0xf0 | (code >>> 18)) << SHIFT[i++ & 3]; blocks[i >>> 2] |= (0x80 | ((code >>> 12) & 0x3f)) << SHIFT[i++ & 3]; blocks[i >>> 2] |= (0x80 | ((code >>> 6) & 0x3f)) << SHIFT[i++ & 3]; blocks[i >>> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; } } } this.lastByteIndex = i; this.bytes += i - this.start; if (i >= 64) { this.block = blocks[16]; this.start = i - 64; this.hash(); this.hashed = true; } else { this.start = i; } } if (this.bytes > 4294967295) { this.hBytes += this.bytes / 4294967296 << 0; this.bytes = this.bytes % 4294967296; } return this; }; Sha256.prototype.finalize = function () { if (this.finalized) { return; } this.finalized = true; var blocks = this.blocks, i = this.lastByteIndex; blocks[16] = this.block; blocks[i >>> 2] |= EXTRA[i & 3]; this.block = blocks[16]; if (i >= 56) { if (!this.hashed) { this.hash(); } blocks[0] = this.block; blocks[16] = blocks[1] = blocks[2] = blocks[3] = blocks[4] = blocks[5] = blocks[6] = blocks[7] = blocks[8] = blocks[9] = blocks[10] = blocks[11] = blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0; } blocks[14] = this.hBytes << 3 | this.bytes >>> 29; blocks[15] = this.bytes << 3; this.hash(); }; Sha256.prototype.hash = function () { var a = this.h0, b = this.h1, c = this.h2, d = this.h3, e = this.h4, f = this.h5, g = this.h6, h = this.h7, blocks = this.blocks, j, s0, s1, maj, t1, t2, ch, ab, da, cd, bc; for (j = 16; j < 64; ++j) { // rightrotate t1 = blocks[j - 15]; s0 = ((t1 >>> 7) | (t1 << 25)) ^ ((t1 >>> 18) | (t1 << 14)) ^ (t1 >>> 3); t1 = blocks[j - 2]; s1 = ((t1 >>> 17) | (t1 << 15)) ^ ((t1 >>> 19) | (t1 << 13)) ^ (t1 >>> 10); blocks[j] = blocks[j - 16] + s0 + blocks[j - 7] + s1 << 0; } bc = b & c; for (j = 0; j < 64; j += 4) { if (this.first) { if (this.is224) { ab = 300032; t1 = blocks[0] - 1413257819; h = t1 - 150054599 << 0; d = t1 + 24177077 << 0; } else { ab = 704751109; t1 = blocks[0] - 210244248; h = t1 - 1521486534 << 0; d = t1 + 143694565 << 0; } this.first = false; } else { s0 = ((a >>> 2) | (a << 30)) ^ ((a >>> 13) | (a << 19)) ^ ((a >>> 22) | (a << 10)); s1 = ((e >>> 6) | (e << 26)) ^ ((e >>> 11) | (e << 21)) ^ ((e >>> 25) | (e << 7)); ab = a & b; maj = ab ^ (a & c) ^ bc; ch = (e & f) ^ (~e & g); t1 = h + s1 + ch + K[j] + blocks[j]; t2 = s0 + maj; h = d + t1 << 0; d = t1 + t2 << 0; } s0 = ((d >>> 2) | (d << 30)) ^ ((d >>> 13) | (d << 19)) ^ ((d >>> 22) | (d << 10)); s1 = ((h >>> 6) | (h << 26)) ^ ((h >>> 11) | (h << 21)) ^ ((h >>> 25) | (h << 7)); da = d & a; maj = da ^ (d & b) ^ ab; ch = (h & e) ^ (~h & f); t1 = g + s1 + ch + K[j + 1] + blocks[j + 1]; t2 = s0 + maj; g = c + t1 << 0; c = t1 + t2 << 0; s0 = ((c >>> 2) | (c << 30)) ^ ((c >>> 13) | (c << 19)) ^ ((c >>> 22) | (c << 10)); s1 = ((g >>> 6) | (g << 26)) ^ ((g >>> 11) | (g << 21)) ^ ((g >>> 25) | (g << 7)); cd = c & d; maj = cd ^ (c & a) ^ da; ch = (g & h) ^ (~g & e); t1 = f + s1 + ch + K[j + 2] + blocks[j + 2]; t2 = s0 + maj; f = b + t1 << 0; b = t1 + t2 << 0; s0 = ((b >>> 2) | (b << 30)) ^ ((b >>> 13) | (b << 19)) ^ ((b >>> 22) | (b << 10)); s1 = ((f >>> 6) | (f << 26)) ^ ((f >>> 11) | (f << 21)) ^ ((f >>> 25) | (f << 7)); bc = b & c; maj = bc ^ (b & d) ^ cd; ch = (f & g) ^ (~f & h); t1 = e + s1 + ch + K[j + 3] + blocks[j + 3]; t2 = s0 + maj; e = a + t1 << 0; a = t1 + t2 << 0; this.chromeBugWorkAround = true; } this.h0 = this.h0 + a << 0; this.h1 = this.h1 + b << 0; this.h2 = this.h2 + c << 0; this.h3 = this.h3 + d << 0; this.h4 = this.h4 + e << 0; this.h5 = this.h5 + f << 0; this.h6 = this.h6 + g << 0; this.h7 = this.h7 + h << 0; }; Sha256.prototype.hex = function () { this.finalize(); var h0 = this.h0, h1 = this.h1, h2 = this.h2, h3 = this.h3, h4 = this.h4, h5 = this.h5, h6 = this.h6, h7 = this.h7; var hex = HEX_CHARS[(h0 >>> 28) & 0x0F] + HEX_CHARS[(h0 >>> 24) & 0x0F] + HEX_CHARS[(h0 >>> 20) & 0x0F] + HEX_CHARS[(h0 >>> 16) & 0x0F] + HEX_CHARS[(h0 >>> 12) & 0x0F] + HEX_CHARS[(h0 >>> 8) & 0x0F] + HEX_CHARS[(h0 >>> 4) & 0x0F] + HEX_CHARS[h0 & 0x0F] + HEX_CHARS[(h1 >>> 28) & 0x0F] + HEX_CHARS[(h1 >>> 24) & 0x0F] + HEX_CHARS[(h1 >>> 20) & 0x0F] + HEX_CHARS[(h1 >>> 16) & 0x0F] + HEX_CHARS[(h1 >>> 12) & 0x0F] + HEX_CHARS[(h1 >>> 8) & 0x0F] + HEX_CHARS[(h1 >>> 4) & 0x0F] + HEX_CHARS[h1 & 0x0F] + HEX_CHARS[(h2 >>> 28) & 0x0F] + HEX_CHARS[(h2 >>> 24) & 0x0F] + HEX_CHARS[(h2 >>> 20) & 0x0F] + HEX_CHARS[(h2 >>> 16) & 0x0F] + HEX_CHARS[(h2 >>> 12) & 0x0F] + HEX_CHARS[(h2 >>> 8) & 0x0F] + HEX_CHARS[(h2 >>> 4) & 0x0F] + HEX_CHARS[h2 & 0x0F] + HEX_CHARS[(h3 >>> 28) & 0x0F] + HEX_CHARS[(h3 >>> 24) & 0x0F] + HEX_CHARS[(h3 >>> 20) & 0x0F] + HEX_CHARS[(h3 >>> 16) & 0x0F] + HEX_CHARS[(h3 >>> 12) & 0x0F] + HEX_CHARS[(h3 >>> 8) & 0x0F] + HEX_CHARS[(h3 >>> 4) & 0x0F] + HEX_CHARS[h3 & 0x0F] + HEX_CHARS[(h4 >>> 28) & 0x0F] + HEX_CHARS[(h4 >>> 24) & 0x0F] + HEX_CHARS[(h4 >>> 20) & 0x0F] + HEX_CHARS[(h4 >>> 16) & 0x0F] + HEX_CHARS[(h4 >>> 12) & 0x0F] + HEX_CHARS[(h4 >>> 8) & 0x0F] + HEX_CHARS[(h4 >>> 4) & 0x0F] + HEX_CHARS[h4 & 0x0F] + HEX_CHARS[(h5 >>> 28) & 0x0F] + HEX_CHARS[(h5 >>> 24) & 0x0F] + HEX_CHARS[(h5 >>> 20) & 0x0F] + HEX_CHARS[(h5 >>> 16) & 0x0F] + HEX_CHARS[(h5 >>> 12) & 0x0F] + HEX_CHARS[(h5 >>> 8) & 0x0F] + HEX_CHARS[(h5 >>> 4) & 0x0F] + HEX_CHARS[h5 & 0x0F] + HEX_CHARS[(h6 >>> 28) & 0x0F] + HEX_CHARS[(h6 >>> 24) & 0x0F] + HEX_CHARS[(h6 >>> 20) & 0x0F] + HEX_CHARS[(h6 >>> 16) & 0x0F] + HEX_CHARS[(h6 >>> 12) & 0x0F] + HEX_CHARS[(h6 >>> 8) & 0x0F] + HEX_CHARS[(h6 >>> 4) & 0x0F] + HEX_CHARS[h6 & 0x0F]; if (!this.is224) { hex += HEX_CHARS[(h7 >>> 28) & 0x0F] + HEX_CHARS[(h7 >>> 24) & 0x0F] + HEX_CHARS[(h7 >>> 20) & 0x0F] + HEX_CHARS[(h7 >>> 16) & 0x0F] + HEX_CHARS[(h7 >>> 12) & 0x0F] + HEX_CHARS[(h7 >>> 8) & 0x0F] + HEX_CHARS[(h7 >>> 4) & 0x0F] + HEX_CHARS[h7 & 0x0F]; } return hex; }; Sha256.prototype.toString = Sha256.prototype.hex; Sha256.prototype.digest = function () { this.finalize(); var h0 = this.h0, h1 = this.h1, h2 = this.h2, h3 = this.h3, h4 = this.h4, h5 = this.h5, h6 = this.h6, h7 = this.h7; var arr = [ (h0 >>> 24) & 0xFF, (h0 >>> 16) & 0xFF, (h0 >>> 8) & 0xFF, h0 & 0xFF, (h1 >>> 24) & 0xFF, (h1 >>> 16) & 0xFF, (h1 >>> 8) & 0xFF, h1 & 0xFF, (h2 >>> 24) & 0xFF, (h2 >>> 16) & 0xFF, (h2 >>> 8) & 0xFF, h2 & 0xFF, (h3 >>> 24) & 0xFF, (h3 >>> 16) & 0xFF, (h3 >>> 8) & 0xFF, h3 & 0xFF, (h4 >>> 24) & 0xFF, (h4 >>> 16) & 0xFF, (h4 >>> 8) & 0xFF, h4 & 0xFF, (h5 >>> 24) & 0xFF, (h5 >>> 16) & 0xFF, (h5 >>> 8) & 0xFF, h5 & 0xFF, (h6 >>> 24) & 0xFF, (h6 >>> 16) & 0xFF, (h6 >>> 8) & 0xFF, h6 & 0xFF ]; if (!this.is224) { arr.push((h7 >>> 24) & 0xFF, (h7 >>> 16) & 0xFF, (h7 >>> 8) & 0xFF, h7 & 0xFF); } return arr; }; Sha256.prototype.array = Sha256.prototype.digest; Sha256.prototype.arrayBuffer = function () { this.finalize(); var buffer = new ArrayBuffer(this.is224 ? 28 : 32); var dataView = new DataView(buffer); dataView.setUint32(0, this.h0); dataView.setUint32(4, this.h1); dataView.setUint32(8, this.h2); dataView.setUint32(12, this.h3); dataView.setUint32(16, this.h4); dataView.setUint32(20, this.h5); dataView.setUint32(24, this.h6); if (!this.is224) { dataView.setUint32(28, this.h7); } return buffer; }; function HmacSha256(key, is224, sharedMemory) { var i, type = typeof key; if (type === 'string') { var bytes = [], length = key.length, index = 0, code; for (i = 0; i < length; ++i) { code = key.charCodeAt(i); if (code < 0x80) { bytes[index++] = code; } else if (code < 0x800) { bytes[index++] = (0xc0 | (code >>> 6)); bytes[index++] = (0x80 | (code & 0x3f)); } else if (code < 0xd800 || code >= 0xe000) { bytes[index++] = (0xe0 | (code >>> 12)); bytes[index++] = (0x80 | ((code >>> 6) & 0x3f)); bytes[index++] = (0x80 | (code & 0x3f)); } else { code = 0x10000 + (((code & 0x3ff) << 10) | (key.charCodeAt(++i) & 0x3ff)); bytes[index++] = (0xf0 | (code >>> 18)); bytes[index++] = (0x80 | ((code >>> 12) & 0x3f)); bytes[index++] = (0x80 | ((code >>> 6) & 0x3f)); bytes[index++] = (0x80 | (code & 0x3f)); } } key = bytes; } else { if (type === 'object') { if (key === null) { throw new Error(ERROR); } else if (ARRAY_BUFFER && key.constructor === ArrayBuffer) { key = new Uint8Array(key); } else if (!Array.isArray(key)) { if (!ARRAY_BUFFER || !ArrayBuffer.isView(key)) { throw new Error(ERROR); } } } else { throw new Error(ERROR); } } if (key.length > 64) { key = (new Sha256(is224, true)).update(key).array(); } var oKeyPad = [], iKeyPad = []; for (i = 0; i < 64; ++i) { var b = key[i] || 0; oKeyPad[i] = 0x5c ^ b; iKeyPad[i] = 0x36 ^ b; } Sha256.call(this, is224, sharedMemory); this.update(iKeyPad); this.oKeyPad = oKeyPad; this.inner = true; this.sharedMemory = sharedMemory; } HmacSha256.prototype = new Sha256(); HmacSha256.prototype.finalize = function () { Sha256.prototype.finalize.call(this); if (this.inner) { this.inner = false; var innerHash = this.array(); Sha256.call(this, this.is224, this.sharedMemory); this.update(this.oKeyPad); this.update(innerHash); Sha256.prototype.finalize.call(this); } }; var exports = createMethod(); exports.sha256 = exports; exports.sha224 = createMethod(true); exports.sha256.hmac = createHmacMethod(); exports.sha224.hmac = createHmacMethod(true); if (COMMON_JS) { module.exports = exports; } else { root.sha256 = exports.sha256; root.sha224 = exports.sha224; if (AMD) { define(function () { return exports; }); } } })(); //2============= function SendReq() { var FrmBlock = document.getElementById("IDFrmReqBlock"); var BtnSend = document.getElementById("IDBtnSend"); BtnSend.disabled = true; //var dWait = document.createElement('div'); //FrmBlock.appendChild(dWait); //dWait.className = 'WaitingBlock'; var lbSpec = document.getElementById('id_spec'); var lbEForm = document.getElementById('id_eform'); lbSpec.options[lbSpec.options.selectedIndex].value = lbSpec.options[lbSpec.options.selectedIndex].text; lbEForm.options[lbEForm.options.selectedIndex].value = lbEForm.options[lbEForm.options.selectedIndex].text; var Frm = document.getElementById("IDFrmReq"); var frmData = new FormData(Frm); var frmJSON = Object.fromEntries(frmData.entries()); //var rJSON = JSON.stringify(frmJSON, null, 2); //console.log(frmJSON); postJSON("send_req.php", frmJSON, function(req){ //var newID = req.response; //alert('Заявка отправлена. В ближайшее время мы с Вами свяжемся. Спасибо.'); //console.log(req.response['res']); //console.log(req);//alert(req.response['res']); HideFrm("IDFrmReqBlock"); var dMainBlock = document.getElementById('MainBlock'); var dInfo = document.createElement('div'); dMainBlock.appendChild(dInfo); dInfo.className = 'Message'; dInfo.innerHTML = 'Ваша заявка отправлена. В ближайшее время мы с Вами свяжемся. Благодарим за обращение.'; }); } function LoadPAForm() { var lbSpec = document.getElementById('id_spec'); var lbEForm = document.getElementById('id_eform'); var url = './get_data.php?type=spec'; var request = new XMLHttpRequest(); request.open('GET', url); request.responseType = 'text'; //request.responseType = 'json'; request.onload = function() { var rowsJSON = request.response; var req = JSON.parse(rowsJSON); //console.log(req); id_spec, sname, scode for(i = 0; i < req.rows.length; i++){ var optn = new Option(req.rows[i].scode+" "+req.rows[i].sname, req.rows[i].id_spec, false, false); //console.log(slink); //lbSpec.options.appendChild(optn); lbSpec.options[lbSpec.options.length] = optn; } }; request.send(); lbSpec.onchange = function() { LoadEForm(lbSpec.options[lbSpec.options.selectedIndex].value); } } function LoadEForm(idSpec) { var lbEForm = document.getElementById('id_eform'); lbEForm.options.length = 1; var url = './get_data.php?type=efs&val='+idSpec; var request = new XMLHttpRequest(); request.open('GET', url); request.responseType = 'text'; //request.responseType = 'json'; request.onload = function() { var rowsJSON = request.response; var req = JSON.parse(rowsJSON); //console.log(req); id_eform, id_spec, efname for(i = 0; i < req.rows.length; i++){ var optn = new Option(req.rows[i].efname, req.rows[i].id_eform, false, false); //console.log(slink); //lbSpec.options.appendChild(optn); lbEForm.options[lbEForm.options.length] = optn; } }; request.send(); } //4============= window.addEventListener('scroll', function() { let tp = document.getElementById('ID_top-pos'); let ml = document.getElementById('ID_EIOS_menu-list'); let md = document.getElementById('ID_EIOS_menu-dummy'); if (tp.getBoundingClientRect().top<0 && !ml.classList.contains('fixed-top-pos')) { ml.classList.add('fixed-top-pos'); md.style.display = 'block'; md.style.height = ml.offsetHeight; } else if (tp.getBoundingClientRect().top>0) { ml.classList.remove('fixed-top-pos'); md.style.display = 'none'; }; }); function PostForm(IDForm, RefreshFn = null) { var Frm = document.getElementById(IDForm); var frmData = new FormData(Frm); var frmJSON = Object.fromEntries(frmData.entries()); //console.log(frmJSON); postJSON("post_data.php", frmJSON, function(req){ //console.log(req.response); //var rowsJSON = preq.response; //var req = JSON.parse(rowsJSON); if (req.response['res']) { //if (req['res']) { if (req.response['res'] == 'OK') { //if (req['res'] == 'OK') { CloseFrm(IDForm); //location.reload(); // перезагружаем страницу if (RefreshFn) {RefreshFn();} } else { var dMsg = document.getElementById('message'); dMsg.innerHTML = req.response['res']; //dMsg.innerHTML = req['res']; } } }); } function SendLogin() { var Frm = document.getElementById("IDLoginForm"); var hPsw = document.getElementById("hpsw"); var Psw = document.getElementById("psw"); //sha256(hPsw.value).then(hash => {hPsw.value=hash;}); //hPsw.value = sha3_256(Psw.value); hPsw.value = sha256(Psw.value); var frmData = new FormData(Frm); var frmJSON = Object.fromEntries(frmData.entries()); //console.log(frmJSON); postJSON("post_data.php", frmJSON, function(req){ //console.log(req.response['res']); if (req.response['res']) { if (req.response['res'] == 'OK') { HideFrm("IDLoginForm"); document.forms.LoginForm.reset(); // сбрасываем форму location.reload(); // перезагружаем страницу } else { var dMsg = document.getElementById('message'); //var dInfo = document.createElement('div'); //dMainBlock.appendChild(dInfo); //dInfo.className = 'Message'; dMsg.innerHTML = req.response['res']; } } }); } function Logout() { var url = './get_data.php?type=logout'; var request = new XMLHttpRequest(); request.open('GET', url); request.responseType = 'text'; request.onload = function() { location.reload(); }; request.send(); } async function sha256(message) { // Encode the message as a UTF-8 Uint8Array const msgBuffer = new TextEncoder('utf-8').encode(message); // Hash the message using SHA-256 const hashBuffer = await crypto.subtle.digest('SHA-256', msgBuffer); // Convert the ArrayBuffer to a regular Array of bytes const hashArray = Array.from(new Uint8Array(hashBuffer)); // Convert the bytes to a hexadecimal string const hashHex = hashArray.map(b => ('00' + b.toString(16)).slice(-2)).join(''); return hashHex; } //6============= function LoadGroupsList() { var lbGrList = document.getElementById('id_group'); var dSchedule = document.getElementById('id_schedule'); var url = './get_data.php?type=grlist'; var request = new XMLHttpRequest(); request.open('GET', url); request.responseType = 'text'; //request.responseType = 'json'; request.onload = function() { var rowsJSON = request.response; var req = JSON.parse(rowsJSON); for(i = 0; i < req.rows.length; i++){ var optn = new Option(req.rows[i].gname, req.rows[i].id, false, false); //console.log(slink); //lbSpec.options.appendChild(optn); lbGrList.options[lbGrList.options.length] = optn; } }; request.send(); lbGrList.onchange = function() { LoadSchedule(lbGrList.options[lbGrList.options.selectedIndex].value); } } function LoadSchedule(idGroup) { var sb = document.getElementById('ID_schedule-block'); var url = './get_data.php?type=cursch&grp='+idGroup; var request = new XMLHttpRequest(); sb.innerHTML = ""; request.open('GET', url); request.responseType = 'text'; //request.responseType = 'json'; request.onload = function() { let rowsJSON = request.response; let req = JSON.parse(rowsJSON); //console.log(req); let cdate = ""; let gnum = ""; let prevTime, sidClass, sidcCItems, sidcCItem; let sidcCTime, sidcDName, sidcTName, sidcANum; if (req) { for(i = 0; i < req.rows.length; i++){ if (cdate != req.rows[i].cdate) { var item_day = CreateElement('div', 'schedule-item-day'); if (req.rows[i].curd == true) { item_day.classList.add('shedule-current-day'); } cdate = req.rows[i].cdate; gnum = req.rows[i].gnum; prevTime = ''; let sidDate = CreateElement('div', 'sid-date', req.rows[i].wday+', '+req.rows[i].cdate); let sidLine = CreateElement('div', 'sid-line'); item_day.append(sidDate); item_day.append(sidLine); } sidcCItem = CreateElement('div', 'sidci-item'); sidcDName = CreateElement('div', 'sidc-dname', req.rows[i].dname); sidcTName = CreateElement('div', 'sidc-tname', req.rows[i].tname); sidcANum = CreateElement('div', 'sidc-anum', req.rows[i].anum); sidcCItem.append(sidcDName, sidcTName, sidcANum); if (req.rows[i].ctime != prevTime) { sidClass = CreateElement('div', 'sid-class'); sidcCTime = CreateElement('div', 'sidc-ctime', req.rows[i].ctime); sidcCItems = CreateElement('div', 'sidc-items'); prevTime = req.rows[i].ctime; sidcCItems.append(sidcCItem); sidClass.append(sidcCTime, sidcCItems); if (item_day) { item_day.append(sidClass); sb.append(item_day); } } else { sidcCItems.append(sidcCItem); } } } else { var item_day = document.createElement("div"); item_day.classList.add('schedule-item-day'); let sidDate = CreateElement('div', 'sid-date', 'На указанный период расписание отсутствует.'); item_day.append(sidDate); sb.append(item_day); } }; request.send(); } window.onload=LoadGroupsList; //7============= function LoadGroupsList() { LoadSelectList('IDGrp', './get_data.php?type=grlist', 'id', 'gname'); } function LoadWTypes() { LoadSelectList('IDWType', './get_data.php?type=wtypes', 'id', 'wtname', null, '[нет]', -1); } function SchedFilter() {//загрузка представления с расписанием var SVTBody = document.getElementById('IDSchedView_tbody'); var ffGList = document.getElementById('IDGrp'); var ffSem = document.getElementById('IDSem'); var ffWTList = document.getElementById('IDWType'); var IDGroup = ffGList.options[ffGList.options.selectedIndex].value; var WType = ffWTList.options[ffWTList.options.selectedIndex].value; var Sem = ffSem.value; var url = './get_data.php?type=edsch'; if (IDGroup != 0) { url += '&grp='+IDGroup; }; if (WType != -1) { url += '&wtype='+WType; }; if (Sem != '') { url += '&sem='+Sem; }; //console.log(url); var request = new XMLHttpRequest(); SVTBody.innerHTML = ""; request.open('GET', url); request.responseType = 'text'; request.onload = function() { let rowsJSON = request.response; let req = JSON.parse(rowsJSON); //console.log(req); //let WDay = ""; if (req) { for(i = 0; i < req.rows.length; i++){ //if (WDay != req.rows[i].wday) { var item_tr = document.createElement('tr'); //var item_td = document.createElement('td'); //item_tr.setAttribute('rowID', req.rows[i].id); item_tr.setAttribute('onclick', 'Sched_RowClick('+req.rows[i].id+')'); item_tr.innerHTML = ''+req.rows[i].semester+''+ ''+req.rows[i].gname+''+ ''+req.rows[i].wtype+''+ ''+req.rows[i].wday+''+ ''+req.rows[i].pnum+'' + ''+req.rows[i].tname+'' + ''+req.rows[i].dname+'' + ''+req.rows[i].anum+'' + ''+req.rows[i].gnum+'' + ''+req.rows[i].bdate+'' + ''+req.rows[i].edate+''; //item_tr.append(item_td); SVTBody.append(item_tr); //} } } else { var item_tr = document.createElement("tr"); item_tr.innerHTML = '
Данные отсутствуют

'; SVTBody.append(item_tr); } }; request.send(); } function LoadListsData() { LoadGroupsList(); LoadWTypes(); } function Sched_Add() { LoadForm(4, function (fndata) { LoadSelectList('IDWeek_Type', './get_data.php?type=wtypes', 'id', 'wtname', null, '[нет]', -1); LoadSelectList('IDWeek_Day', './get_data.php?type=wdlist', 'id', 'wdname'); LoadSelectList('IDTeacher', './get_data.php?type=tchlist', 'id', 'tname'); LoadSelectList('IDDiscipline', './get_data.php?type=dislist', 'id', 'dname'); LoadSelectList('IDAuditory', './get_data.php?type=audlist', 'id', 'anum'); LoadSelectList('IDGroup', './get_data.php?type=grlist', 'id', 'gname'); LoadSelectList('IDPNum', './get_data.php?type=plist', 'pnum', 'pname'); let btnNew = document.getElementById('IDFrmBtnNew'); if (btnNew) {btnNew.disabled = true;} let btnDel = document.getElementById('IDFrmBtnDel'); if (btnDel) {btnDel.disabled = true;} }); } function Sched_Edit() { } function SchedDel() { let frmIDFType = document.getElementById('IDFType'); frmIDFType.value = 'SchedDel'; PostForm('IDSchedForm', function () { SchedFilter(); }); } function SchedSave() { PostForm('IDSchedForm', function () { SchedFilter(); }); } function SchedClone() { let frmIDID = document.getElementById('IDID'); frmIDID.value = ''; PostForm('IDSchedForm', function () { SchedFilter(); }); } function oldSched_RowClick(idrow) { LoadForm(4, function (fndata) { LoadSelectList('IDWeek_Type', './get_data.php?type=wtypes', 'id', 'wtname', null, '[нет]', -1); LoadSelectList('IDWeek_Day', './get_data.php?type=wdlist', 'id', 'wdname'); LoadSelectList('IDTeacher', './get_data.php?type=tchlist', 'id', 'tname'); LoadSelectList('IDDiscipline', './get_data.php?type=dislist', 'id', 'dname'); LoadSelectList('IDAuditory', './get_data.php?type=audlist', 'id', 'anum'); LoadSelectList('IDGroup', './get_data.php?type=grlist', 'id', 'gname'); LoadSelectList('IDPNum', './get_data.php?type=plist', 'pnum', 'pname'); if (fndata) { fndata(); } }, function () { LoadFormData('IDSchedForm', './get_data.php?type=frmdatasched&id='+idrow); }); } function Sched_RowClick(idrow) { LoadForm(4, function (fndata) { if (fndata) { fndata(); } LoadRecRow('./get_data.php?type=frmdatasched&id='+idrow, function (frmData) { LoadSelectList('IDWeek_Type', './get_data.php?type=wtypes', 'id', 'wtname', frmData, '[нет]', -1); LoadSelectList('IDWeek_Day', './get_data.php?type=wdlist', 'id', 'wdname', frmData); LoadSelectList('IDTeacher', './get_data.php?type=tchlist', 'id', 'tname', frmData); LoadSelectList('IDDiscipline', './get_data.php?type=dislist', 'id', 'dname', frmData); LoadSelectList('IDAuditory', './get_data.php?type=audlist', 'id', 'anum', frmData); LoadSelectList('IDGroup', './get_data.php?type=grlist', 'id', 'gname', frmData); LoadSelectList('IDPNum', './get_data.php?type=plist', 'pnum', 'pname', frmData); }); }, function () { LoadFormData('IDSchedForm', './get_data.php?type=frmdatasched&id='+idrow); }); } window.onload=LoadListsData; //8============= function LoadSelectList(inIDSelObj, inURL, inIDField, inValField, inInitData = null, inNullVal = '[нет]', inNullID = 0) { var lbObj = document.getElementById(inIDSelObj); //var url = inURL; var request = new XMLHttpRequest(); request.open('GET', inURL); request.responseType = 'text'; request.onload = function() { var rowsJSON = request.response; var req = JSON.parse(rowsJSON); lbObj.options[lbObj.options.length] = new Option(inNullVal, inNullID); for(i = 0; i < req.rows.length; i++){ var optn = new Option(req.rows[i][inValField], req.rows[i][inIDField], false, false); lbObj.options[lbObj.options.length] = optn; } if (inInitData) { lbObj.value = inInitData[lbObj.name]; } }; request.send(); } function LoadForm(idfrm, fnInit = null, fnData = null) { var frmBG = document.getElementById('IDFormBG'); var url = './get_data.php?type=frm&id=' + idfrm; var request = new XMLHttpRequest(); request.open('GET', url); request.responseType = 'text'; request.onload = function () { var frmBody = request.response; if (frmBody) { var frmBlock = document.createElement("div"); //контейнер формы frmBlock.classList.add('form-cnt'); frmBlock.innerHTML = frmBody; frmBG.append(frmBlock); frmBG.style.display = 'flex'; if (fnInit) { fnInit(fnData); }; //if (fnData) { // fnData(); //} } }; request.send(); } function LoadFormData(inIDForm, inURL, inFn = null) { var frmObj = document.getElementById(inIDForm); var request = new XMLHttpRequest(); //var Fn = inFn; request.open('GET', inURL); request.responseType = 'text'; request.onload = function() { var rowsJSON = request.response; var req = JSON.parse(rowsJSON); let e; for(key in req.rows[0]) { e = document.getElementsByName(key); if (e) { if (e[0]) { e[0].value = req.rows[0][key]; } }; }; if (inFn) { inFn(req.rows[0]); } }; request.send(); } function LoadRecRow(inURL, inDoAfterFn = null) { var request = new XMLHttpRequest(); request.open('GET', inURL); request.responseType = 'text'; request.onload = function() { var rowsJSON = request.response; var req = JSON.parse(rowsJSON); if (inDoAfterFn) { inDoAfterFn(req.rows[0]); } return req.rows[0]; }; request.send(); } //9============= function PhotoboxUpdate(idobj, filename) { document.getElementById(idobj).style.setProperty('background-image', 'url('+filename+')'); } //11======================= function AplOnLoad() { var AVTBody = document.getElementById('IDAplView_tbody'); AVTBody.innerHTML = ""; var url = './get_data.php?type=apllist'; var request = new XMLHttpRequest(); request.open('GET', url); request.responseType = 'text'; request.onload = function () { let rowsJSON = request.response; let req = JSON.parse(rowsJSON); //console.log(req); //let WDay = ""; if (req) { for (i = 0; i < req.rows.length; i++) { //if (WDay != req.rows[i].wday) { var item_tr = document.createElement('tr'); //var item_td = document.createElement('td'); //item_tr.setAttribute('rowID', req.rows[i].id); item_tr.setAttribute('onclick', 'AplRowClick(' + req.rows[i].id + ')'); item_tr.innerHTML = '' + req.rows[i].identifier + '' + '' + req.rows[i].adate + '' + '' + req.rows[i].full_name + '' + '' + req.rows[i].phones + '' + '' + req.rows[i].efname + '' + '' + req.rows[i].sname + '' + '' + req.rows[i].btpcomment + '' + '' + req.rows[i].asname + ''; //item_tr.append(item_td); AVTBody.append(item_tr); //} } } else { var item_tr = document.createElement("tr"); item_tr.innerHTML = '
Данные отсутствуют

'; AVTBody.append(item_tr); } }; request.send(); } function AplRowClick(idrow) { LoadForm(9, function (fndata) { if (fndata) { fndata(); } LoadRecRow('./get_data.php?type=frmdataapl&id=' + idrow, function (frmData) { LoadSelectList('IDAplState', './get_data.php?type=aslist', 'id', 'asname', frmData); LoadSelectList('IDEForm', './get_data.php?type=eflist', 'id', 'efname', frmData); LoadSelectList('IDSpec', './get_data.php?type=speclist', 'id', 'sname', frmData); LoadSelectList('IDBasicTp', './get_data.php?type=btplist', 'id', 'btpcomment', frmData); }); }, function () { LoadFormData('IDAplForm', './get_data.php?type=frmdataapl&id=' + idrow); }); } function AplSave() { PostForm('IDAplForm', function () { AplOnLoad(); }); } function AplAdd() { LoadForm(9, function () { LoadSelectList('IDAplState', './get_data.php?type=aslist', 'id', 'asname'); LoadSelectList('IDEForm', './get_data.php?type=eflist', 'id', 'efname'); LoadSelectList('IDSpec', './get_data.php?type=speclist', 'id', 'sname'); LoadSelectList('IDBasicTp', './get_data.php?type=btplist', 'id', 'btpcomment'); }); }