48 |
49 |

50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/src/main/resources/static/images/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/1.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/2.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/3.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/4.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/Asleep.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/Asleep.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/Awake.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/Awake.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/arrow.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/bk1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/bk1.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/bk2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/bk2.jpg
--------------------------------------------------------------------------------
/src/main/resources/static/images/bk3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/bk3.jpg
--------------------------------------------------------------------------------
/src/main/resources/static/images/bk4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/bk4.jpg
--------------------------------------------------------------------------------
/src/main/resources/static/images/bk5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/bk5.jpg
--------------------------------------------------------------------------------
/src/main/resources/static/images/chakanjieguo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/chakanjieguo.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/demo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/demo.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/desc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/desc.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/desc1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/desc1.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/desc2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/desc2.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/desc3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/desc3.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/desc_old.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/desc_old.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/free.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/free.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/free_old.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/free_old.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/man.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/man.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/photo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/photo.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/photo_old.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/photo_old.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/plus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/plus.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/qrcode.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/qrcode.jpg
--------------------------------------------------------------------------------
/src/main/resources/static/images/reco.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/reco.jpg
--------------------------------------------------------------------------------
/src/main/resources/static/images/result14.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/result14.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/result15.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/result15.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/save.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/save.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/startAnalysis.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/startAnalysis.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/startAnalysis_old.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/startAnalysis_old.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/takePhoto.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/takePhoto.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/takePhoto_old.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/takePhoto_old.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/title.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/title.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/title2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/title2.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/title3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/title3.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/title4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/title4.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/title5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bz51/AIFace/bd09c79594144ac25984ebf4dcafd92472a651db/src/main/resources/static/images/title5.png
--------------------------------------------------------------------------------
/src/main/resources/static/js/canvas.js:
--------------------------------------------------------------------------------
1 | var canvas = document.getElementById("cas");
2 | var ctx = canvas.getContext("2d");
3 | resize();
4 | window.onresize = resize;
5 | function resize() {
6 | canvas.width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
7 | canvas.height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
8 | }
9 | var RAF = (function() {
10 | return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(callback) {
11 | window.setTimeout(callback, 1000 / 120);
12 | };
13 | })();
14 | // 鼠标活动时,获取鼠标坐标
15 | var warea = {x: null, y: null, max: 20000};
16 | window.onmousemove = function(e) {
17 | e = e || window.event;
18 | warea.x = e.clientX;
19 | warea.y = e.clientY;
20 | };
21 | window.onmouseout = function(e) {
22 | warea.x = null;
23 | warea.y = null;
24 | };
25 | // 添加粒子
26 | // x,y为粒子坐标,xa, ya为粒子xy轴加速度,max为连线的最大距离
27 | var dots = [];
28 | for (var i = 0; i < 40; i++) {
29 | var x = Math.random() * canvas.width;
30 | var y = Math.random() * canvas.height;
31 | var xa = Math.random() * 2 - 1;
32 | var ya = Math.random() * 2 - 1;
33 | dots.push({
34 | x: x,
35 | y: y,
36 | xa: xa,
37 | ya: ya,
38 | max: 6000
39 | })
40 | }
41 | // 延迟100秒开始执行动画,如果立即执行有时位置计算会出错
42 | setTimeout(function() {
43 | animate();
44 | }, 100);
45 | // 每一帧循环的逻辑
46 | function animate() {
47 | ctx.clearRect(0, 0, canvas.width, canvas.height);
48 | // 将鼠标坐标添加进去,产生一个用于比对距离的点数组
49 | var ndots = [warea].concat(dots);
50 | dots.forEach(function(dot) {
51 | // 粒子位移
52 | dot.x += dot.xa;
53 | dot.y += dot.ya;
54 | // 遇到边界将加速度反向
55 | dot.xa *= (dot.x > canvas.width || dot.x < 0) ? -1 : 1;
56 | dot.ya *= (dot.y > canvas.height || dot.y < 0) ? -1 : 1;
57 | // 绘制点
58 | ctx.fillRect(dot.x - 0.5, dot.y - 0.5, 1, 1);
59 | // 循环比对粒子间的距离
60 | for (var i = 0; i < ndots.length; i++) {
61 | var d2 = ndots[i];
62 | if (dot === d2 || d2.x === null || d2.y === null) continue;
63 | var xc = dot.x - d2.x;
64 | var yc = dot.y - d2.y;
65 | // 两个粒子之间的距离
66 | var dis = xc * xc + yc * yc;
67 | // 距离比
68 | var ratio;
69 | // 如果两个粒子之间的距离小于粒子对象的max值,则在两个粒子间画线
70 | if (dis < d2.max) {
71 | // 如果是鼠标,则让粒子向鼠标的位置移动
72 | // if (d2 === warea && dis > (d2.max / 2)) {
73 | // dot.x -= xc * 0.03;
74 | // dot.y -= yc * 0.03;
75 | // }
76 | // 计算距离比
77 | ratio = (d2.max - dis) / d2.max;
78 | // 画线
79 | ctx.beginPath();
80 | ctx.lineWidth = ratio / 2;
81 | ctx.strokeStyle = 'rgba(201,203,206,' + (ratio + 0.2) + ')';
82 | ctx.moveTo(dot.x, dot.y);
83 | ctx.lineTo(d2.x, d2.y);
84 | ctx.stroke();
85 | }
86 | }
87 | // 将已经计算过的粒子从数组中删除
88 | ndots.splice(ndots.indexOf(dot), 1);
89 | });
90 | RAF(animate);
91 | }
92 |
--------------------------------------------------------------------------------
/src/main/resources/static/js/classie.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * classie - class helper functions
3 | * from bonzo https://github.com/ded/bonzo
4 | *
5 | * classie.has( elem, 'my-class' ) -> true/false
6 | * classie.add( elem, 'my-new-class' )
7 | * classie.remove( elem, 'my-unwanted-class' )
8 | * classie.toggle( elem, 'my-class' )
9 | */
10 |
11 | /*jshint browser: true, strict: true, undef: true */
12 | /*global define: false */
13 |
14 | ( function( window ) {
15 |
16 | 'use strict';
17 |
18 | // class helper functions from bonzo https://github.com/ded/bonzo
19 |
20 | function classReg( className ) {
21 | return new RegExp("(^|\\s+)" + className + "(\\s+|$)");
22 | }
23 |
24 | // classList support for class management
25 | // altho to be fair, the api sucks because it won't accept multiple classes at once
26 | var hasClass, addClass, removeClass;
27 |
28 | if ( 'classList' in document.documentElement ) {
29 | hasClass = function( elem, c ) {
30 | return elem.classList.contains( c );
31 | };
32 | addClass = function( elem, c ) {
33 | elem.classList.add( c );
34 | };
35 | removeClass = function( elem, c ) {
36 | elem.classList.remove( c );
37 | };
38 | }
39 | else {
40 | hasClass = function( elem, c ) {
41 | return classReg( c ).test( elem.className );
42 | };
43 | addClass = function( elem, c ) {
44 | if ( !hasClass( elem, c ) ) {
45 | elem.className = elem.className + ' ' + c;
46 | }
47 | };
48 | removeClass = function( elem, c ) {
49 | elem.className = elem.className.replace( classReg( c ), ' ' );
50 | };
51 | }
52 |
53 | function toggleClass( elem, c ) {
54 | var fn = hasClass( elem, c ) ? removeClass : addClass;
55 | fn( elem, c );
56 | }
57 |
58 | var classie = {
59 | // full names
60 | hasClass: hasClass,
61 | addClass: addClass,
62 | removeClass: removeClass,
63 | toggleClass: toggleClass,
64 | // short names
65 | has: hasClass,
66 | add: addClass,
67 | remove: removeClass,
68 | toggle: toggleClass
69 | };
70 |
71 | // transport
72 | if ( typeof define === 'function' && define.amd ) {
73 | // AMD
74 | define( classie );
75 | } else {
76 | // browser global
77 | window.classie = classie;
78 | }
79 |
80 | })( window );
81 |
--------------------------------------------------------------------------------
/src/main/resources/static/js/common.js:
--------------------------------------------------------------------------------
1 | var finishURL = "http://www.chaimm.com/html/finish.html";
2 | var appID = "wx82de919618ed3240";
3 |
4 | /*
5 | * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
6 | * in FIPS PUB 180-1
7 | * Version 2.1a Copyright Paul Johnston 2000 - 2002.
8 | * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
9 | * Distributed under the BSD License
10 | * See http://pajhome.org.uk/crypt/md5 for details.
11 | */
12 |
13 | /*
14 | * Configurable variables. You may need to tweak these to be compatible with
15 | * the server-side, but the defaults work in most cases.
16 | */
17 | var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */
18 | var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */
19 | var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */
20 |
21 | /*
22 | * These are the functions you'll usually want to call
23 | * They take string arguments and return either hex or base-64 encoded strings
24 | */
25 | function hex_sha1(s){return binb2hex(core_sha1(str2binb(s),s.length * chrsz));}
26 | function b64_sha1(s){return binb2b64(core_sha1(str2binb(s),s.length * chrsz));}
27 | function str_sha1(s){return binb2str(core_sha1(str2binb(s),s.length * chrsz));}
28 | function hex_hmac_sha1(key, data){ return binb2hex(core_hmac_sha1(key, data));}
29 | function b64_hmac_sha1(key, data){ return binb2b64(core_hmac_sha1(key, data));}
30 | function str_hmac_sha1(key, data){ return binb2str(core_hmac_sha1(key, data));}
31 |
32 | /*
33 | * Perform a simple self-test to see if the VM is working
34 | */
35 | function sha1_vm_test()
36 | {
37 | return hex_sha1("abc") == "a9993e364706816aba3e25717850c26c9cd0d89d";
38 | }
39 |
40 | /*
41 | * Calculate the SHA-1 of an array of big-endian words, and a bit length
42 | */
43 | function core_sha1(x, len)
44 | {
45 | /* append padding */
46 | x[len >> 5] |= 0x80 << (24 - len % 32);
47 | x[((len + 64 >> 9) << 4) + 15] = len;
48 |
49 | var w = Array(80);
50 | var a = 1732584193;
51 | var b = -271733879;
52 | var c = -1732584194;
53 | var d = 271733878;
54 | var e = -1009589776;
55 |
56 | for(var i = 0; i < x.length; i += 16)
57 | {
58 | var olda = a;
59 | var oldb = b;
60 | var oldc = c;
61 | var oldd = d;
62 | var olde = e;
63 |
64 | for(var j = 0; j < 80; j++)
65 | {
66 | if(j < 16) w[j] = x[i + j];
67 | else w[j] = rol(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1);
68 | var t = safe_add(safe_add(rol(a, 5), sha1_ft(j, b, c, d)),
69 | safe_add(safe_add(e, w[j]), sha1_kt(j)));
70 | e = d;
71 | d = c;
72 | c = rol(b, 30);
73 | b = a;
74 | a = t;
75 | }
76 |
77 | a = safe_add(a, olda);
78 | b = safe_add(b, oldb);
79 | c = safe_add(c, oldc);
80 | d = safe_add(d, oldd);
81 | e = safe_add(e, olde);
82 | }
83 | return Array(a, b, c, d, e);
84 |
85 | }
86 |
87 | /*
88 | * Perform the appropriate triplet combination function for the current
89 | * iteration
90 | */
91 | function sha1_ft(t, b, c, d)
92 | {
93 | if(t < 20) return (b & c) | ((~b) & d);
94 | if(t < 40) return b ^ c ^ d;
95 | if(t < 60) return (b & c) | (b & d) | (c & d);
96 | return b ^ c ^ d;
97 | }
98 |
99 | /*
100 | * Determine the appropriate additive constant for the current iteration
101 | */
102 | function sha1_kt(t)
103 | {
104 | return (t < 20) ? 1518500249 : (t < 40) ? 1859775393 :
105 | (t < 60) ? -1894007588 : -899497514;
106 | }
107 |
108 | /*
109 | * Calculate the HMAC-SHA1 of a key and some data
110 | */
111 | function core_hmac_sha1(key, data)
112 | {
113 | var bkey = str2binb(key);
114 | if(bkey.length > 16) bkey = core_sha1(bkey, key.length * chrsz);
115 |
116 | var ipad = Array(16), opad = Array(16);
117 | for(var i = 0; i < 16; i++)
118 | {
119 | ipad[i] = bkey[i] ^ 0x36363636;
120 | opad[i] = bkey[i] ^ 0x5C5C5C5C;
121 | }
122 |
123 | var hash = core_sha1(ipad.concat(str2binb(data)), 512 + data.length * chrsz);
124 | return core_sha1(opad.concat(hash), 512 + 160);
125 | }
126 |
127 | /*
128 | * Add integers, wrapping at 2^32. This uses 16-bit operations internally
129 | * to work around bugs in some JS interpreters.
130 | */
131 | function safe_add(x, y)
132 | {
133 | var lsw = (x & 0xFFFF) + (y & 0xFFFF);
134 | var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
135 | return (msw << 16) | (lsw & 0xFFFF);
136 | }
137 |
138 | /*
139 | * Bitwise rotate a 32-bit number to the left.
140 | */
141 | function rol(num, cnt)
142 | {
143 | return (num << cnt) | (num >>> (32 - cnt));
144 | }
145 |
146 | /*
147 | * Convert an 8-bit or 16-bit string to an array of big-endian words
148 | * In 8-bit function, characters >255 have their hi-byte silently ignored.
149 | */
150 | function str2binb(str)
151 | {
152 | var bin = Array();
153 | var mask = (1 << chrsz) - 1;
154 | for(var i = 0; i < str.length * chrsz; i += chrsz)
155 | bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (32 - chrsz - i%32);
156 | return bin;
157 | }
158 |
159 | /*
160 | * Convert an array of big-endian words to a string
161 | */
162 | function binb2str(bin)
163 | {
164 | var str = "";
165 | var mask = (1 << chrsz) - 1;
166 | for(var i = 0; i < bin.length * 32; i += chrsz)
167 | str += String.fromCharCode((bin[i>>5] >>> (32 - chrsz - i%32)) & mask);
168 | return str;
169 | }
170 |
171 | /*
172 | * Convert an array of big-endian words to a hex string.
173 | */
174 | function binb2hex(binarray)
175 | {
176 | var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
177 | var str = "";
178 | for(var i = 0; i < binarray.length * 4; i++)
179 | {
180 | str += hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8+4)) & 0xF) +
181 | hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8 )) & 0xF);
182 | }
183 | return str;
184 | }
185 |
186 | /*
187 | * Convert an array of big-endian words to a base-64 string
188 | */
189 | function binb2b64(binarray)
190 | {
191 | var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
192 | var str = "";
193 | for(var i = 0; i < binarray.length * 4; i += 3)
194 | {
195 | var triplet = (((binarray[i >> 2] >> 8 * (3 - i %4)) & 0xFF) << 16)
196 | | (((binarray[i+1 >> 2] >> 8 * (3 - (i+1)%4)) & 0xFF) << 8 )
197 | | ((binarray[i+2 >> 2] >> 8 * (3 - (i+2)%4)) & 0xFF);
198 | for(var j = 0; j < 4; j++)
199 | {
200 | if(i * 8 + j * 6 > binarray.length * 32) str += b64pad;
201 | else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F);
202 | }
203 | }
204 | return str;
205 | }
206 |
207 | /**
208 | * 生成指定长度随机字符串
209 | */
210 | function randomString(len) {
211 | len = len || 32;
212 | var $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678'; /****默认去掉了容易混淆的字符oOLl,9gq,Vv,Uu,I1****/
213 | var maxPos = $chars.length;
214 | var pwd = '';
215 | for (i = 0; i < len; i++) {
216 | pwd += $chars.charAt(Math.floor(Math.random() * maxPos));
217 | }
218 | return pwd;
219 | }
220 |
221 | function chooseImage(){
222 | wx.chooseImage({
223 | count: 1, // 默认9
224 | sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
225 | sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
226 | success: function (res) {
227 | var localIds = res.localIds; // 返回选定照片的本地ID列表,localId可以作为img标签的src属性显示图片
228 | debugger;
229 | }
230 | });
231 | }
232 |
233 |
234 | function upload() {
235 | // var xmlhttp;
236 | // if (window.XMLHttpRequest)
237 | // {// code for IE7+, Firefox, Chrome, Opera, Safari
238 | // xmlhttp=new XMLHttpRequest();
239 | // }
240 | // else
241 | // {// code for IE6, IE5
242 | // xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
243 | // }
244 | // xmlhttp.onreadystatechange=function()
245 | // {
246 | // if (xmlhttp.readyState==4 && xmlhttp.status==200)
247 | // {
248 | // var data = xmlhttp.responseText;
249 | //
250 | // var nonceStr = randomString(16);
251 | // var timestamp = Math.round(new Date().getTime() / 1000);
252 | // var url = finishURL;
253 | // var string1 = "jsapi_ticket=" + data + "&noncestr=" + nonceStr + "×tamp=" + timestamp + "&url=" + url;
254 | // var signature = hex_sha1(string1);
255 | //
256 | // wx.config({
257 | // debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
258 | // appId: appID, // 必填,公众号的唯一标识
259 | // timestamp: timestamp, // 必填,生成签名的时间戳
260 | // nonceStr: nonceStr, // 必填,生成签名的随机串
261 | // signature: signature,// 必填,签名,见附录1
262 | // jsApiList: ['chooseImage', 'uploadImage', 'downloadImage', 'previewImage'] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
263 | // });
264 | //
265 | // wx.ready(function(){
266 | //
267 | // });
268 | // }
269 | // }
270 | // xmlhttp.open("GET","/getJSTicket",true);
271 | // xmlhttp.send();
272 |
273 | // var userToken = localStorage.getItem("userToken");
274 | // if ( userToken != null && userToken != "" && userToken != undefined) {
275 | // alert("每人仅限体验一次哦~");
276 | // window.location.href = "result.html";
277 | // }
278 |
279 |
280 | wx.chooseImage({
281 | count: 1, // 默认9
282 | sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有'original',
283 | sourceType: ['album','camera'], // 可以指定来源是相册还是相机,默认二者都有
284 | success: function (res) {
285 | var localIds = res.localIds.toString(); // 返回选定照片的本地ID列表,localId可以作为img标签的src属性显示图片
286 |
287 | wx.uploadImage({
288 | localId: localIds, // 需要上传的图片的本地ID,由chooseImage接口获得
289 | isShowProgressTips: 1, // 默认为1,显示进度提示
290 | success: function (res) {
291 | var userToken = localStorage.getItem("userToken");
292 | if ( userToken == null || userToken == "" || userToken == undefined) {
293 | userToken = randomString(10);
294 | localStorage.setItem("userToken",userToken);
295 | }
296 | var serverId = res.serverId; // 返回图片的服务器端ID
297 | var url = "/recognizeFace?picId="+serverId+"&userToken="+userToken;
298 |
299 | var xmlhttp;
300 | if (window.XMLHttpRequest)
301 | {// code for IE7+, Firefox, Chrome, Opera, Safari
302 | xmlhttp=new XMLHttpRequest();
303 | }
304 | else
305 | {// code for IE6, IE5
306 | xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
307 | }
308 | xmlhttp.onreadystatechange=function()
309 | {
310 | if (xmlhttp.readyState==4 && xmlhttp.status==200)
311 | {
312 | var data = JSON.parse(xmlhttp.responseText);
313 | //若返回no
314 | if(data.success==false){
315 | alert(data.message);
316 | }
317 |
318 | //若返回yes
319 | else{
320 | var facePic = document.getElementById("facePic");
321 | var uploadPic = document.getElementById("uploadPic");
322 | var uploadPicTxt = document.getElementById("uploadPicTxt");
323 | facePic.style.display = "block";
324 | facePic.style.backgroundImage = "url("+data.faceUrl+")";
325 | facePic.style.backgroundRepeat = "no-repeat";
326 | facePic.style.backgroundSize = "cover";
327 | facePic.style.backgroundPosition = "center center";
328 | facePic.style.width = "100%";
329 | facePic.style.height = "100%";
330 |
331 | uploadPic.style.display = "none";
332 | uploadPicTxt.style.display = "none";
333 |
334 | // facePic.src = data.faceUrl;
335 |
336 | var analysisResult = document.getElementById("analysisResult");
337 | analysisResult.style.display = "block";
338 | var gender = document.getElementById("gender");
339 | // var age = document.getElementById("age");
340 | var expression = document.getElementById("expression");
341 | var glass = document.getElementById("glass");
342 |
343 | gender.innerHTML = data.gender;
344 | // age.innerHTML = data.age-5;
345 | expression.innerHTML = data.expression;
346 | glass.innerHTML = data.glass;
347 |
348 | localStorage.setItem("gender",data.gender);
349 | localStorage.setItem("expression",data.expression);
350 | localStorage.setItem("glass",data.glass);
351 | localStorage.setItem("faceUrl",data.faceUrl);
352 |
353 | var startBtn = document.getElementById("startBtn");
354 | startBtn.style.display = "block";
355 |
356 | var phoneBtn = document.getElementById("phoneBtn");
357 | phoneBtn.style.display = "none";
358 |
359 | localStorage.setItem("resultUrl",data.resultUrl);
360 |
361 | var faceBox = document.getElementById("faceBox");
362 | faceBox.removeAttribute("onclick");
363 | }
364 | }
365 | }
366 | xmlhttp.open("GET",url,true);
367 | xmlhttp.send();
368 |
369 | },
370 | fail: function (res) {
371 | alert(JSON.stringify(res));
372 | }
373 | });
374 | }
375 | });
376 |
377 |
378 | }
379 |
380 | function upload2(){
381 | var facePic = document.getElementById("facePic");
382 | var uploadPic = document.getElementById("uploadPic");
383 | var uploadPicTxt = document.getElementById("uploadPicTxt");
384 | facePic.style.display = "block";
385 | facePic.style.backgroundImage = "url(http://www.chaimm.com/upload/ai/1515649931)";
386 | facePic.style.backgroundRepeat = "no-repeat";
387 | facePic.style.backgroundSize = "cover";
388 | facePic.style.backgroundPosition = "center center";
389 | facePic.style.width = "100%";
390 | facePic.style.height = "100%";
391 |
392 | uploadPic.style.display = "none";
393 | uploadPicTxt.style.display = "none";
394 |
395 | // facePic.src = data.faceUrl;
396 |
397 | var analysisResult = document.getElementById("analysisResult");
398 | analysisResult.style.display = "block";
399 | var gender = document.getElementById("gender");
400 | // var age = document.getElementById("age");
401 | var expression = document.getElementById("expression");
402 | var glass = document.getElementById("glass");
403 |
404 | gender.innerHTML = "男";
405 | // age.innerHTML = "21";
406 | expression.innerHTML = "微笑";
407 | glass.innerHTML = "戴眼镜";
408 |
409 | var startBtn = document.getElementById("startBtn");
410 | startBtn.style.display = "block";
411 |
412 | var phoneBtn = document.getElementById("phoneBtn");
413 | phoneBtn.style.display = "none";
414 |
415 | // localStorage.setItem("resultUrl",data.resultUrl);
416 |
417 | var faceBox = document.getElementById("faceBox");
418 | faceBox.removeAttribute("onclick");
419 | }
420 |
421 |
422 | function init() {
423 | var faceUrl = localStorage.getItem("faceUrl");
424 | if ( faceUrl == null || faceUrl == "" || faceUrl == undefined) {
425 | config();
426 | return;
427 | }
428 |
429 | var facePic = document.getElementById("facePic");
430 | var uploadPic = document.getElementById("uploadPic");
431 | var uploadPicTxt = document.getElementById("uploadPicTxt");
432 | facePic.style.display = "block";
433 | facePic.style.backgroundImage = "url("+localStorage.getItem('faceUrl')+")";
434 | facePic.style.backgroundRepeat = "no-repeat";
435 | facePic.style.backgroundSize = "cover";
436 | facePic.style.backgroundPosition = "center center";
437 | facePic.style.width = "100%";
438 | facePic.style.height = "100%";
439 |
440 | uploadPic.style.display = "none";
441 | uploadPicTxt.style.display = "none";
442 |
443 | var analysisResult = document.getElementById("analysisResult");
444 | analysisResult.style.display = "block";
445 | var gender = document.getElementById("gender");
446 | // var age = document.getElementById("age");
447 | var expression = document.getElementById("expression");
448 | var glass = document.getElementById("glass");
449 |
450 | gender.innerHTML = localStorage.getItem("gender");
451 | // age.innerHTML = data.age-5;
452 | expression.innerHTML = localStorage.getItem("expression");
453 | glass.innerHTML = localStorage.getItem("glass");
454 |
455 |
456 |
457 | var resultBtn = document.getElementById("resultBtn");
458 | resultBtn.style.display = "block";
459 |
460 | var phoneBtn = document.getElementById("phoneBtn");
461 | phoneBtn.style.display = "none";
462 |
463 | var startBtn = document.getElementById("startBtn");
464 | phoneBtn.style.display = "none";
465 |
466 | var faceBox = document.getElementById("faceBox");
467 | faceBox.removeAttribute("onclick");
468 | }
469 |
470 | init();
471 |
472 |
473 | function config() {
474 | // $.get("/getJSTicket",
475 | // function (data, status) {
476 | //
477 | // var nonceStr = randomString(16);
478 | // var timestamp = Math.round(new Date().getTime() / 1000);
479 | // var url = finishURL;
480 | // var string1 = "jsapi_ticket=" + data + "&noncestr=" + nonceStr + "×tamp=" + timestamp + "&url=" + url;
481 | // var signature = hex_sha1(string1);
482 | //
483 | // wx.config({
484 | // debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
485 | // appId: appID, // 必填,公众号的唯一标识
486 | // timestamp: timestamp, // 必填,生成签名的时间戳
487 | // nonceStr: nonceStr, // 必填,生成签名的随机串
488 | // signature: signature,// 必填,签名,见附录1
489 | // jsApiList: ['chooseImage', 'uploadImage', 'downloadImage', 'previewImage'] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
490 | // });
491 | // });
492 |
493 | var xmlhttp;
494 | if (window.XMLHttpRequest)
495 | {// code for IE7+, Firefox, Chrome, Opera, Safari
496 | xmlhttp=new XMLHttpRequest();
497 | }
498 | else
499 | {// code for IE6, IE5
500 | xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
501 | }
502 | xmlhttp.onreadystatechange=function()
503 | {
504 | if (xmlhttp.readyState==4 && xmlhttp.status==200)
505 | {
506 | var data = xmlhttp.responseText;
507 |
508 | var nonceStr = randomString(16);
509 | var timestamp = Math.round(new Date().getTime() / 1000);
510 | var url = finishURL;
511 | var string1 = "jsapi_ticket=" + data + "&noncestr=" + nonceStr + "×tamp=" + timestamp + "&url=" + url;
512 | var signature = hex_sha1(string1);
513 |
514 | wx.config({
515 | debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
516 | appId: appID, // 必填,公众号的唯一标识
517 | timestamp: timestamp, // 必填,生成签名的时间戳
518 | nonceStr: nonceStr, // 必填,生成签名的随机串
519 | signature: signature,// 必填,签名,见附录1
520 | jsApiList: ['chooseImage', 'uploadImage', 'downloadImage', 'previewImage'] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
521 | });
522 | }
523 | }
524 | xmlhttp.open("GET","/getJSTicket",true);
525 | xmlhttp.send();
526 | }
527 |
528 | // config();
529 |
530 |
531 |
--------------------------------------------------------------------------------
/src/main/resources/static/js/dialogFx.js:
--------------------------------------------------------------------------------
1 | /**
2 | * dialogFx.js v1.0.0
3 | * http://www.codrops.com
4 | *
5 | * Licensed under the MIT license.
6 | * http://www.opensource.org/licenses/mit-license.php
7 | *
8 | * Copyright 2014, Codrops
9 | * http://www.codrops.com
10 | */
11 | ;( function( window ) {
12 |
13 | 'use strict';
14 |
15 | var support = { animations : Modernizr.cssanimations },
16 | animEndEventNames = { 'WebkitAnimation' : 'webkitAnimationEnd', 'OAnimation' : 'oAnimationEnd', 'msAnimation' : 'MSAnimationEnd', 'animation' : 'animationend' },
17 | animEndEventName = animEndEventNames[ Modernizr.prefixed( 'animation' ) ],
18 | onEndAnimation = function( el, callback ) {
19 | var onEndCallbackFn = function( ev ) {
20 | if( support.animations ) {
21 | if( ev.target != this ) return;
22 | this.removeEventListener( animEndEventName, onEndCallbackFn );
23 | }
24 | if( callback && typeof callback === 'function' ) { callback.call(); }
25 | };
26 | if( support.animations ) {
27 | el.addEventListener( animEndEventName, onEndCallbackFn );
28 | }
29 | else {
30 | onEndCallbackFn();
31 | }
32 | };
33 |
34 | function extend( a, b ) {
35 | for( var key in b ) {
36 | if( b.hasOwnProperty( key ) ) {
37 | a[key] = b[key];
38 | }
39 | }
40 | return a;
41 | }
42 |
43 | function DialogFx( el, options ) {
44 | this.el = el;
45 | this.options = extend( {}, this.options );
46 | extend( this.options, options );
47 | this.ctrlClose = this.el.querySelector( '[data-dialog-close]' );
48 | this.isOpen = false;
49 | this._initEvents();
50 | }
51 |
52 | DialogFx.prototype.options = {
53 | // callbacks
54 | onOpenDialog : function() { return false; },
55 | onCloseDialog : function() { return false; }
56 | }
57 |
58 | DialogFx.prototype._initEvents = function() {
59 | var self = this;
60 |
61 | // close action
62 | this.ctrlClose.addEventListener( 'click', this.toggle.bind(this) );
63 |
64 | // esc key closes dialog
65 | document.addEventListener( 'keydown', function( ev ) {
66 | var keyCode = ev.keyCode || ev.which;
67 | if( keyCode === 27 && self.isOpen ) {
68 | self.toggle();
69 | }
70 | } );
71 |
72 | this.el.querySelector( '.dialog__overlay' ).addEventListener( 'click', this.toggle.bind(this) );
73 | }
74 |
75 | DialogFx.prototype.toggle = function() {
76 | var self = this;
77 | if( this.isOpen ) {
78 | classie.remove( this.el, 'dialog--open' );
79 | classie.add( self.el, 'dialog--close' );
80 |
81 | onEndAnimation( this.el.querySelector( '.dialog__content' ), function() {
82 | classie.remove( self.el, 'dialog--close' );
83 | } );
84 |
85 | // callback on close
86 | this.options.onCloseDialog( this );
87 | }
88 | else {
89 | classie.add( this.el, 'dialog--open' );
90 |
91 | // callback on open
92 | this.options.onOpenDialog( this );
93 | }
94 | this.isOpen = !this.isOpen;
95 | };
96 |
97 | // add to global namespace
98 | window.DialogFx = DialogFx;
99 |
100 | })( window );
--------------------------------------------------------------------------------
/src/main/resources/static/js/modernizr.custom.js:
--------------------------------------------------------------------------------
1 | /* Modernizr 2.8.3 (Custom Build) | MIT & BSD
2 | * Build: http://modernizr.com/download/#-cssanimations-shiv-cssclasses-prefixed-testprop-testallprops-domprefixes-load
3 | */
4 | ;window.Modernizr=function(a,b,c){function x(a){j.cssText=a}function y(a,b){return x(prefixes.join(a+";")+(b||""))}function z(a,b){return typeof a===b}function A(a,b){return!!~(""+a).indexOf(b)}function B(a,b){for(var d in a){var e=a[d];if(!A(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function C(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:z(f,"function")?f.bind(d||b):f}return!1}function D(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+n.join(d+" ")+d).split(" ");return z(b,"string")||z(b,"undefined")?B(e,b):(e=(a+" "+o.join(d+" ")+d).split(" "),C(e,b,c))}var d="2.8.3",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m="Webkit Moz O ms",n=m.split(" "),o=m.toLowerCase().split(" "),p={},q={},r={},s=[],t=s.slice,u,v={}.hasOwnProperty,w;!z(v,"undefined")&&!z(v.call,"undefined")?w=function(a,b){return v.call(a,b)}:w=function(a,b){return b in a&&z(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=t.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(t.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(t.call(arguments)))};return e}),p.cssanimations=function(){return D("animationName")};for(var E in p)w(p,E)&&(u=E.toLowerCase(),e[u]=p[E](),s.push((e[u]?"":"no-")+u));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)w(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},x(""),i=k=null,function(a,b){function l(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function m(){var a=s.elements;return typeof a=="string"?a.split(" "):a}function n(a){var b=j[a[h]];return b||(b={},i++,a[h]=i,j[i]=b),b}function o(a,c,d){c||(c=b);if(k)return c.createElement(a);d||(d=n(c));var g;return d.cache[a]?g=d.cache[a].cloneNode():f.test(a)?g=(d.cache[a]=d.createElem(a)).cloneNode():g=d.createElem(a),g.canHaveChildren&&!e.test(a)&&!g.tagUrn?d.frag.appendChild(g):g}function p(a,c){a||(a=b);if(k)return a.createDocumentFragment();c=c||n(a);var d=c.frag.cloneNode(),e=0,f=m(),g=f.length;for(;e