🎉 Hello world
This commit is contained in:
commit
5b6426306f
43 files changed
+2878
No files matched your search
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
/*! jQuery v3.4.1 | (c) JS Foundation and other contributors | jquery.org/license */
|
||||
!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],E=C.document,r=Object.getPrototypeOf,s=t.slice,g=t.concat,u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},x=function(e){return null!=e&&e===e.window},c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.4.1",k=function(e,t){return new k.fn.init(e,t)},p=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;function d(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0<t&&t-1 in e)}k.fn=k.prototype={jquery:f,constructor:k,length:0,toArray:function(){return s.call(this)},get:function(e){return null==e?s.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=k.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return k.each(this,e)},map:function(n){return this.pushStack(k.map(this,function(e,t){return n.call(e,t,e)}))},slice:function(){return this.pushStack(s.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(0<=n&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:u,sort:t.sort,splice:t.splice},k.extend=k.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||m(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)r=e[t],"__proto__"!==t&&a!==r&&(l&&r&&(k.isPlainObject(r)||(i=Array.isArray(r)))?(n=a[t],o=i&&!Array.isArray(n)?[]:i||k.isPlainObject(n)?n:{},i=!1,a[t]=k.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},k.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==o.call(e))&&(!(t=r(e))||"function"==typeof(n=v.call(t,"constructor")&&t.constructor)&&a.call(n)===l)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e,t){b(e,{nonce:t&&t.nonce})},each:function(e,t){var n,r=0;if(d(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},trim:function(e){return null==e?"":(e+"").replace(p,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(d(Object(e))?k.merge(n,"string"==typeof e?[e]:e):u.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:i.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r=[],i=0,o=e.length,a=!n;i<o;i++)!t(e[i],i)!==a&&r.push(e[i]);return r},map:function(e,t,n){var r,i,o=0,a=[];if(d(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&a.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&a.push(i);return g.apply([],a)},guid:1,support:y}),"function"==typeof Symbol&&(k.fn[Symbol.iterator]=t[Symbol.iterator]),k.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){n["[object "+t+"]"]=t.toLowerCase()});var h=function(n){var e,d,b,o,i,h,f,g,w,u,l,T,C,a,E,v,s,c,y,k="sizzle"+1*new Date,m=n.document,S=0,r=0,p=ue(),x=ue(),N=ue(),A=ue(),D=function(e,t){return e===t&&(l=!0),0},j={}.hasOwnProperty,t=[],q=t.pop,L=t.push,H=t.push,O=t.slice,P=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},R="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",I="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",W="\\["+M+"*("+I+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+I+"))|)"+M+"*\\]",$=":("+I+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+W+")*)|.*)\\)|)",F=new RegExp(M+"+","g"),B=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),_=new RegExp("^"+M+"*,"+M+"*"),z=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp($),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+$),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+Line truncated
|
||||
@@ -0,0 +1,30 @@
|
||||
const save_button = document.getElementById("save");
|
||||
let pseudo = document.getElementById("pseudo");
|
||||
save_button.onclick = function(evt) {
|
||||
evt.preventDefault();
|
||||
pseudo_value = pseudo.value;
|
||||
|
||||
let pseudo_sha1 = sha1(pseudo_value);
|
||||
let hashed_pseudo = str_split(pseudo_sha1, 7);
|
||||
const elements = ['eyes', 'hair', 'mouth'];
|
||||
for (let j in elements) {
|
||||
let element = elements[j];
|
||||
$.ajax('choix.php', {
|
||||
'dataType' : 'text',
|
||||
'data' : { 'element' : element, 'hash': hashed_pseudo[j] },
|
||||
'success' : function(data) {
|
||||
document.getElementById(element).innerSVG = data;
|
||||
document.getElementById(element).innerHTML = data;
|
||||
}
|
||||
});
|
||||
}
|
||||
//
|
||||
// fetch('generate.php?pseudo='+encodeURIComponent(pseudo.value), {
|
||||
// method: 'get'
|
||||
// })
|
||||
// .then(response => response.json())
|
||||
// .then(jsonData => img.src = "data:image/png;base64,"+jsonData.image)
|
||||
// .catch(err => {
|
||||
// //error block
|
||||
// });
|
||||
};
|
||||
@@ -0,0 +1,154 @@
|
||||
function sha1 (str) {
|
||||
// discuss at: https://locutus.io/php/sha1/
|
||||
// original by: Webtoolkit.info (https://www.webtoolkit.info/)
|
||||
// improved by: Michael White (https://getsprink.com)
|
||||
// improved by: Kevin van Zonneveld (https://kvz.io)
|
||||
// input by: Brett Zamir (https://brett-zamir.me)
|
||||
// note 1: Keep in mind that in accordance with PHP, the whole string is buffered and then
|
||||
// note 1: hashed. If available, we'd recommend using Node's native crypto modules directly
|
||||
// note 1: in a steaming fashion for faster and more efficient hashing
|
||||
// example 1: sha1('Kevin van Zonneveld')
|
||||
// returns 1: '54916d2e62f65b3afa6e192e6a601cdbe5cb5897'
|
||||
|
||||
var hash
|
||||
try {
|
||||
var crypto = require('crypto')
|
||||
var sha1sum = crypto.createHash('sha1')
|
||||
sha1sum.update(str)
|
||||
hash = sha1sum.digest('hex')
|
||||
} catch (e) {
|
||||
hash = undefined
|
||||
}
|
||||
|
||||
if (hash !== undefined) {
|
||||
return hash
|
||||
}
|
||||
|
||||
var _rotLeft = function (n, s) {
|
||||
var t4 = (n << s) | (n >>> (32 - s))
|
||||
return t4
|
||||
}
|
||||
|
||||
var _cvtHex = function (val) {
|
||||
var str = ''
|
||||
var i
|
||||
var v
|
||||
|
||||
for (i = 7; i >= 0; i--) {
|
||||
v = (val >>> (i * 4)) & 0x0f
|
||||
str += v.toString(16)
|
||||
}
|
||||
return str
|
||||
}
|
||||
|
||||
var blockstart
|
||||
var i, j
|
||||
var W = new Array(80)
|
||||
var H0 = 0x67452301
|
||||
var H1 = 0xEFCDAB89
|
||||
var H2 = 0x98BADCFE
|
||||
var H3 = 0x10325476
|
||||
var H4 = 0xC3D2E1F0
|
||||
var A, B, C, D, E
|
||||
var temp
|
||||
|
||||
// utf8_encode
|
||||
str = unescape(encodeURIComponent(str))
|
||||
var strLen = str.length
|
||||
|
||||
var wordArray = []
|
||||
for (i = 0; i < strLen - 3; i += 4) {
|
||||
j = str.charCodeAt(i) << 24 |
|
||||
str.charCodeAt(i + 1) << 16 |
|
||||
str.charCodeAt(i + 2) << 8 |
|
||||
str.charCodeAt(i + 3)
|
||||
wordArray.push(j)
|
||||
}
|
||||
|
||||
switch (strLen % 4) {
|
||||
case 0:
|
||||
i = 0x080000000
|
||||
break
|
||||
case 1:
|
||||
i = str.charCodeAt(strLen - 1) << 24 | 0x0800000
|
||||
break
|
||||
case 2:
|
||||
i = str.charCodeAt(strLen - 2) << 24 | str.charCodeAt(strLen - 1) << 16 | 0x08000
|
||||
break
|
||||
case 3:
|
||||
i = str.charCodeAt(strLen - 3) << 24 |
|
||||
str.charCodeAt(strLen - 2) << 16 |
|
||||
str.charCodeAt(strLen - 1) <<
|
||||
8 | 0x80
|
||||
break
|
||||
}
|
||||
|
||||
wordArray.push(i)
|
||||
|
||||
while ((wordArray.length % 16) !== 14) {
|
||||
wordArray.push(0)
|
||||
}
|
||||
|
||||
wordArray.push(strLen >>> 29)
|
||||
wordArray.push((strLen << 3) & 0x0ffffffff)
|
||||
|
||||
for (blockstart = 0; blockstart < wordArray.length; blockstart += 16) {
|
||||
for (i = 0; i < 16; i++) {
|
||||
W[i] = wordArray[blockstart + i]
|
||||
}
|
||||
for (i = 16; i <= 79; i++) {
|
||||
W[i] = _rotLeft(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1)
|
||||
}
|
||||
|
||||
A = H0
|
||||
B = H1
|
||||
C = H2
|
||||
D = H3
|
||||
E = H4
|
||||
|
||||
for (i = 0; i <= 19; i++) {
|
||||
temp = (_rotLeft(A, 5) + ((B & C) | (~B & D)) + E + W[i] + 0x5A827999) & 0x0ffffffff
|
||||
E = D
|
||||
D = C
|
||||
C = _rotLeft(B, 30)
|
||||
B = A
|
||||
A = temp
|
||||
}
|
||||
|
||||
for (i = 20; i <= 39; i++) {
|
||||
temp = (_rotLeft(A, 5) + (B ^ C ^ D) + E + W[i] + 0x6ED9EBA1) & 0x0ffffffff
|
||||
E = D
|
||||
D = C
|
||||
C = _rotLeft(B, 30)
|
||||
B = A
|
||||
A = temp
|
||||
}
|
||||
|
||||
for (i = 40; i <= 59; i++) {
|
||||
temp = (_rotLeft(A, 5) + ((B & C) | (B & D) | (C & D)) + E + W[i] + 0x8F1BBCDC) & 0x0ffffffff
|
||||
E = D
|
||||
D = C
|
||||
C = _rotLeft(B, 30)
|
||||
B = A
|
||||
A = temp
|
||||
}
|
||||
|
||||
for (i = 60; i <= 79; i++) {
|
||||
temp = (_rotLeft(A, 5) + (B ^ C ^ D) + E + W[i] + 0xCA62C1D6) & 0x0ffffffff
|
||||
E = D
|
||||
D = C
|
||||
C = _rotLeft(B, 30)
|
||||
B = A
|
||||
A = temp
|
||||
}
|
||||
|
||||
H0 = (H0 + A) & 0x0ffffffff
|
||||
H1 = (H1 + B) & 0x0ffffffff
|
||||
H2 = (H2 + C) & 0x0ffffffff
|
||||
H3 = (H3 + D) & 0x0ffffffff
|
||||
H4 = (H4 + E) & 0x0ffffffff
|
||||
}
|
||||
|
||||
temp = _cvtHex(H0) + _cvtHex(H1) + _cvtHex(H2) + _cvtHex(H3) + _cvtHex(H4)
|
||||
return temp.toLowerCase()
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
function str_split (string, splitLength) {
|
||||
// eslint-disable-line camelcase
|
||||
// discuss at: https://locutus.io/php/str_split/
|
||||
// original by: Martijn Wieringa
|
||||
// improved by: Brett Zamir (https://brett-zamir.me)
|
||||
// bugfixed by: Onno Marsman (https://twitter.com/onnomarsman)
|
||||
// revised by: Theriault (https://github.com/Theriault)
|
||||
// revised by: Rafał Kukawski (https://blog.kukawski.pl)
|
||||
// input by: Bjorn Roesbeke (https://www.bjornroesbeke.be/)
|
||||
// example 1: str_split('Hello Friend', 3)
|
||||
// returns 1: ['Hel', 'lo ', 'Fri', 'end']
|
||||
|
||||
if (splitLength === null) {
|
||||
splitLength = 1
|
||||
}
|
||||
if (string === null || splitLength < 1) {
|
||||
return false
|
||||
}
|
||||
|
||||
string += ''
|
||||
var chunks = []
|
||||
var pos = 0
|
||||
var len = string.length
|
||||
|
||||
while (pos < len) {
|
||||
chunks.push(string.slice(pos, pos += splitLength))
|
||||
}
|
||||
|
||||
return chunks
|
||||
}
|
||||
Reference in new issue
Block a user