-
Notifications
You must be signed in to change notification settings - Fork 0
/
faces.clj
57 lines (57 loc) · 2.58 KB
/
faces.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
(fn[rq rs](let[c(.getAttribute rq"c")v(.getAttribute rq"vars")t"WikiFaces"
s(.split(slurp"picSize.txt")"\n")
n(.split(slurp"qpic")"\n")]
(hiccup.core/html"<!DOCTYPE html>"[:html[:head[:title t" « α"];(:can c)(:css c)(:vp c)
[:link{:rel"stylesheet":type"text/css":href"https://dresdenlabs.appspot.com/css"}]
[:meta{:name"viewport":content"width=device-width,initial-scale=1.0"}]]
[:body[:h1[:span#as[:a#aa{:href"/"}"α"]]"» "t]
[:script{:src"https://rawgit.com/wasserfuhr/hn4j/master/WiDa.js"}]
[:script"function cl(e,q){
var t=document.getElementById(q)
var x=e.pageX-t.offsetLeft
xhr=new XMLHttpRequest()
try{
xhr.open('get',
'/pred/RaWa/HiPo/'+
Math.round(256*x/t.width).toString(16)+'/'+
q.substr(1))
xhr.onreadystatechange=function(){
if(xhr.readyState===4)
if(xhr.status===200)
h=xhr.responseText.split('.')
else
console.log('Error: '+xhr.status)}
xhr.send(null)}
catch(e){console.log('Error: '+xhr.status)}}"]
(map(fn[q](if(not(.startsWith q";"))(let[
d(read-string(str"0x"q))
p(filter(fn[i](.startsWith i(str q" ")))s)
s(filter(fn[i](.startsWith i(str q" ")))n)]
(if(and (not-empty p)(not-empty s)(not(.contains(first p)" ")))
(let[a(.split(first p)" ")
bi(.indexOf(first s)" ")
b(subs(first s)bi)
h(read-string(str"0x"(get a 2)))
w(read-string(str"0x"(get a 3)))
e(java.net.URLEncoder/encode(.replaceAll b" ""_"))]
[:div{:style"float:left;text-align:center"}
[:div{:style"width:200px;height:240px;overflow:hidden;float:left"}
[:img{:id(str"i"q):width w :height h :onclick(str"cl(event,'i"q"')") ;:style"
:src(str"https://upload.wikimedia.org/wikipedia/commons/thumb/"
(subs (second a)0 1)"/"(second a)"/"(subs e 1)"/"w"px-"(subs e 1))}]]
[:small"first name or given name starts with...:"]
[:div{:style"font-size:300%"}
[:input{:type"button":value"A":onclick(str"alert('"(subs e 1)"')")}]
[:input{:type"button":value"G":onclick(str"alert('"(subs e 1)"')")}]
[:input{:type"button":value"O":onclick(str"alert('"(subs e 1)"')")}]
[:input{:type"button":value"W":onclick(str"alert('"(subs e 1)"')")}]]
[:br][:input{:type"button":value"?":onclick(str"alert('"(subs e 1)"')")}]])))))
(.split"17 4c"" "))
; (.split(slurp"qref")" "))
[:br{:style"clear:both"}]
[:script"for(var q in wd){
d=document.getElementById('r'+q)
if(d){
d.title=wd[q]//+'n'+q
d.alt=wd[q]}}"]
[:footer"An "[:a{:href"https://dresdenlabs.appspot.com/"}"AlphaLabs"]" production. Images from "[:a{:href"https://dresdenlabs.appspot.com/iw/WikiPedia/Wikidata"}"WikiData"]"."]]])))