forked from BlogEngine/BlogEngine.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsound.min.js
More file actions
36 lines (36 loc) · 872 Bytes
/
sound.min.js
File metadata and controls
36 lines (36 loc) · 872 Bytes
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
var arr, audio, f, hash, i, url;
audio = document.getElementById("audio"),
url = location.href.toString(),
hash = {},
arr = [],
i = 0,
function() {
var a, b, c, d, e, f;
for (a = url.replace(/.*#/, "").split(";"),
f = [],
d = 0,
e = a.length; e > d; d++)
c = a[d],
b = c.split("="),
f.push(hash[b[0]] = b[1]);
return f
}
(),
function() {
return arr = decodeURI(hash.query).toUpperCase().replace(/&/g, "和").replace(/[,。!?]/g, " ").replace(/\s+/g, " ").split(" "),
console.log(arr)
}
(),
f = function() {
var a;
return i <= arr.length ? (a = arr[i],
a && setTimeout(function() {
return audio.src = "http://translate.google.cn/translate_tts?tl=zh-CN&q=" + a
}
, 500),
i++) : void 0
}
,
audio.addEventListener("ended", f),
audio.addEventListener("error", f),
hash.query && f();