22 lines
1.1 KiB
HTML
22 lines
1.1 KiB
HTML
$( '.form' ).addEventListener( "change", async function() {
|
|
if ( this.files[ 0 ].size >= 120000 && this.files[ 0 ].size < 350000 ) {
|
|
console.log( "yay!" );
|
|
var conf = confirm( "You exceeded the 120 kb size limit. Click ok to override this warning or click cancel to try again." );
|
|
if ( conf ) {
|
|
var b64 = await encodeBase64( this );
|
|
} else {
|
|
this.value = null;
|
|
}
|
|
} else if ( this.files[ 0 ].size >= 350000 ) {
|
|
alert( "You exceeded this software's hard size limit of 350 kb files. Modify the code to override the limit." )
|
|
this.value = null;
|
|
} else {
|
|
var b64 = await encodeBase64( this );
|
|
}
|
|
var base64 = b64.substring( b64.indexOf( "base64," ) + 7 );
|
|
var hex = base64ToHex( base64 );
|
|
// console.log( "hex:", hex );
|
|
// console.log( "bytes:", hexToBytes( hex ) );
|
|
$( '.file' ).innerText = hex;
|
|
});
|