embed-formatted-v1.2.js 105 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139
  1. !
  2. function(e, t, s) {
  3. function a() {
  4. return c.short_name ? g + "//" + c.short_name + "." + S.DOMAIN: S.REMOTE
  5. }
  6. function i() {
  7. function t() {
  8. for (var t; t = y.shift();) {
  9. var a = t.url,
  10. i = new s(t.title, {
  11. dir: "auto",
  12. icon: t.iconUrl,
  13. body: t.body
  14. });
  15. try {
  16. i.onclick = function() {
  17. e.focus(),
  18. h.href = a,
  19. i.close()
  20. }
  21. } catch(r) {}
  22. setTimeout(function() {
  23. i.close && i.close()
  24. },
  25. 8e3)
  26. }
  27. }
  28. var s = e.Notification;
  29. "Notification" in e && "denied" !== s.permission && ("granted" === s.permission && t(), s.requestPermission(function(e) {
  30. "granted" === e && t()
  31. }))
  32. }
  33. function r() {
  34. return 0 == nt.data.user_id
  35. }
  36. function n(e) {
  37. S.theme = e,
  38. "none" != e && o.injectStylesheet(S.STATIC_URL + "/styles/embed" + (e ? "." + e + ".css?" + U[e] : "." + short_name) + ".css")
  39. }
  40. var o = {},
  41. d = t.getElementsByTagName("head")[0] || t.getElementsByTagName("body")[0];
  42. if (o.extend = function(e, t) {
  43. for (var s in t) e[s] = t[s];
  44. return e
  45. },
  46. o.injectScript = function(a, i) {
  47. var r = t.createElement("script"),
  48. n = t.head || t.getElementsByTagName("head")[0] || t.documentElement;
  49. r.type = "text/javascript",
  50. r.src = a,
  51. r.async = "async",
  52. r.charset = "utf-8",
  53. i && (r.onload = r.onreadystatechange = function(t, a) {
  54. var o = a || !r.readyState || /loaded|complete/.test(r.readyState);
  55. o && (r.onload = r.onreadystatechange = null, n && r.parentNode && n.removeChild(r), r = s, a || i.call(e))
  56. }),
  57. n.insertBefore(r, n.firstChild)
  58. },
  59. o.injectStylesheet = function(e) {
  60. var s = t.createElement("link");
  61. s.type = "text/css",
  62. s.rel = "stylesheet",
  63. s.href = e,
  64. d.appendChild(s)
  65. },
  66. o.injectStyle = function(e) {
  67. var s = t.createElement("style");
  68. return s.type = "text/css",
  69. d.appendChild(s),
  70. e = e.replace(/\}/g, "}\n"),
  71. s.styleSheet ? s.styleSheet.cssText = e: s.appendChild(t.createTextNode(e)),
  72. s
  73. },
  74. o.getCookie = function(e) {
  75. for (var a, i, r, n = " " + e + "=",
  76. o = t.cookie.split(";"), d = 0; d < o.length; d++) if (a = " " + o[d], i = a.indexOf(n), i >= 0 && i + n.length == (r = a.indexOf("=") + 1)) return decodeURIComponent(a.substring(r, a.length).replace(/\+/g, ""));
  77. return s
  78. },
  79. o.param = function(e) {
  80. var t = [];
  81. for (var a in e) e[a] != s && t.push(a + "=" + encodeURIComponent(e[a]));
  82. return t.join("&")
  83. },
  84. o.cssProperty = function(e, s) {
  85. var a = (t.body || t.documentElement).style;
  86. if ("undefined" == typeof a) return ! 1;
  87. if ("string" == typeof a[e]) return s ? e: !0;
  88. for (var i = ["Moz", "Webkit", "ms"], e = e.charAt(0).toUpperCase() + e.substr(1), r = 0; r < i.length; r++) if ("string" == typeof a[i[r] + e]) return s ? i[r] + e: !0
  89. },
  90. !e.DUOSHUO) {
  91. for (var l in Object.prototype) return alert("Object.prototype 不为空,请不要给 Object.prototype 设置方法");
  92. var c, u, p = e.JSON,
  93. h = e.location,
  94. f = e.XMLHttpRequest,
  95. m = p && p.stringify && e.localStorage,
  96. v = e.navigator.userAgent,
  97. g = "https:" == t.location.protocol ? "https:": "http:",
  98. b = 0,
  99. y = [],
  100. _ = u = function() {
  101. function e(e) {
  102. return t[e] || "&amp;"
  103. }
  104. var t = {
  105. "<": "&lt;",
  106. ">": "&gt;",
  107. '"': "&quot;",
  108. "'": "&#x27;",
  109. "`": "&#x60;"
  110. },
  111. s = /&(?!\w+;)|[<>"'`]/g,
  112. a = /[&<>"'`]/;
  113. return function(t) {
  114. return null == t || t === !1 ? "": a.test(t) ? t.replace(s, e) : t
  115. }
  116. } (),
  117. k = function(e) {
  118. if (e.match(/^(http|https):/)) return e;
  119. var s = t.createElement("a");
  120. return s.href = e,
  121. P.hrefNormalized ? s.href: s.getAttribute("href", 4)
  122. },
  123. w = function(e) {
  124. return function() {
  125. return e
  126. }
  127. },
  128. x = function() {
  129. for (var e = {},
  130. t = 0; t < arguments.length; t++) arguments[t] && o.extend(e, arguments[t]);
  131. var s = o.param(e);
  132. return s ? "?" + s: ""
  133. },
  134. T = function() {
  135. var e = o.getCookie("duoshuo_token");
  136. return e ? {
  137. jwt: e
  138. }: c.remote_auth ? {
  139. short_name: c.short_name,
  140. remote_auth: c.remote_auth
  141. }: s
  142. },
  143. q = function() {
  144. if (!c && (c = e.duoshuoQuery)) {
  145. if (!c.short_name || "your_duoshuo_short_name" === c.short_name) return c = s,
  146. void alert("你还没有设置多说域名(duoshuoQuery.short_name),填入已有域名或创建新站点:http://duoshuo.com/create-site/");
  147. it.trigger("queryDefined")
  148. }
  149. return c
  150. },
  151. C = function(e) {
  152. return e && e.error && e.warn ? e: {
  153. error: function() {},
  154. log: function() {},
  155. warn: function() {}
  156. }
  157. } (e.console),
  158. S = e.DUOSHUO = {
  159. sourceName: {
  160. weibo: "新浪微博",
  161. qq: "QQ",
  162. qzone: "QQ空间",
  163. qqt: "腾讯微博",
  164. renren: "人人网",
  165. douban: "豆瓣网",
  166. kaixin: "开心网",
  167. sohu: "搜狐微博",
  168. baidu: "百度",
  169. google: "谷歌",
  170. wechat: "微信",
  171. weixin: "微信",
  172. facebook: "Facebook",
  173. twitter: "Twitter",
  174. linkedin: "Linkedin"
  175. },
  176. serviceNames: {
  177. weibo: "微博",
  178. qq: "QQ",
  179. douban: "豆瓣",
  180. renren: "人人",
  181. kaixin: "开心",
  182. baidu: "百度",
  183. google: "谷歌",
  184. wechat: "微信",
  185. weixin: "微信",
  186. facebook: "Facebook",
  187. twitter: "Twitter",
  188. linkedin: "Linkedin"
  189. },
  190. parseDate: function(e) {
  191. return e.parse("2011-10-28T00:00:00+08:00") &&
  192. function(t) {
  193. return new e(t)
  194. } || e.parse("2011/10/28T00:00:00+0800") &&
  195. function(t) {
  196. return new e(t.replace(/-/g, "/").replace(/:(\d\d)$/, "$1"))
  197. } || e.parse("2011/10/28 00:00:00+0800") &&
  198. function(t) {
  199. return new e(t.replace(/-/g, "/").replace(/:(\d\d)$/, "$1").replace("T", " "))
  200. } ||
  201. function(t) {
  202. return new e(t)
  203. }
  204. } (Date),
  205. fullTime: function(e) {
  206. var t = S.parseDate(e);
  207. return t.getFullYear() + "年" + (t.getMonth() + 1) + "月" + t.getDate() + "日 " + t.toLocaleTimeString()
  208. },
  209. elapsedTime: function(e) {
  210. var t = S.parseDate(e),
  211. s = new Date,
  212. a = (s - b - t) / 1e3;
  213. return 10 > a ? "刚刚": 60 > a ? Math.round(a) + "秒前": 3600 > a ? Math.round(a / 60) + "分钟前": 86400 > a ? Math.round(a / 3600) + "小时前": (s.getFullYear() == t.getFullYear() ? "": t.getFullYear() + "年") + (t.getMonth() + 1) + "月" + t.getDate() + "日"
  214. },
  215. compileStyle: function(e) {
  216. var t = "",
  217. s = {};
  218. if (s.textbox = "#ds-thread #ds-reset .ds-replybox .ds-textarea-wrapper", !e) return t;
  219. for (var a in e) t += s[a] + "{" + e[a] + "}\n";
  220. return t
  221. },
  222. init: function(e, t) {
  223. e && !O[e] && (O[e] = t || {
  224. type: "EmbedThread"
  225. }),
  226. S.initView && S.initView()
  227. }
  228. },
  229. j = t.all,
  230. P = S.support = function() {
  231. var s = t.createElement("div");
  232. s.innerHTML = '<a href="/a" style="opacity:.55;">a</a><input type="checkbox"/>';
  233. var a = s.getElementsByTagName("a")[0],
  234. i = s.getElementsByTagName("input")[0],
  235. r = {
  236. placeholder: "placeholder" in i,
  237. touch: "ontouchstart" in e || "onmsgesturechange" in e,
  238. opacity: /^0.55$/.test(a.style.opacity),
  239. hrefNormalized: "/a" === a.getAttribute("href"),
  240. iOS: v.match(/ \((iPad|iPhone|iPod);( U;)? CPU( iPhone)? OS /),
  241. android: v.match(/ \(Linux; U; Android /)
  242. };
  243. return r.ie6 = !f && "undefined" == typeof s.style.maxHeight,
  244. r.authInWin = e.postMessage && e.screen.width > 800 && !r.iOS && !r.android && h.origin,
  245. r
  246. } (),
  247. O = S.selectors = {
  248. ".ds-thread": {
  249. type: "EmbedThread"
  250. },
  251. ".ds-recent-comments": {
  252. type: "RecentComments"
  253. },
  254. ".ds-recent-visitors": {
  255. type: "RecentVisitors"
  256. },
  257. ".ds-top-users": {
  258. type: "TopUsers"
  259. },
  260. ".ds-top-threads": {
  261. type: "TopThreads"
  262. },
  263. ".ds-login": {
  264. type: "LoginWidget"
  265. },
  266. ".ds-thread-count": {
  267. type: "ThreadCount"
  268. },
  269. ".ds-share": {
  270. type: "ShareWidget"
  271. }
  272. },
  273. E = S.openDialog = function(e) {
  274. return S.dialog !== s && S.dialog.el.remove(),
  275. S.dialog = new st.Dialog(et.dialog(e)).open()
  276. },
  277. L = S.smilies = {};
  278. S.require = function() {
  279. function t(e) {
  280. var t = R[e] ? "?" + R[e] + ".js": "";
  281. return S.STATIC_URL + "/libs/" + e + ".js" + t
  282. }
  283. var s = {
  284. mzadxN: "undefined" != typeof mzadxN
  285. };
  286. return "undefined" != typeof jQuery && jQuery.fn.jquery >= "1.5" && (s["embed.compat"] = !0, S.jQuery = e.jQuery),
  287. function(e, a) {
  288. if ("string" == typeof e) s[e] ? a() : o.injectScript(t(e),
  289. function() {
  290. s[e] = !0,
  291. a()
  292. });
  293. else if ("object" == typeof e) {
  294. var i, r = !0;
  295. for (i = 0; i < e.length; i++)(function(n) {
  296. s[e[i]] || (r = !1, o.injectScript(t(n),
  297. function() {
  298. s[n] = !0;
  299. for (var t = 0; t < e.length; t++) if (!s[e[t]]) return;
  300. a()
  301. }))
  302. })(e[i]);
  303. r && a()
  304. }
  305. }
  306. } ();
  307. for (var N = 0,
  308. I = ["EmbedThread", "RecentComments", "RecentVisitors", "TopUsers", "TopThreads", "LoginWidget", "ThreadCount"]; N < I.length; N++) S[I[N]] = function(e) {
  309. return function(t, s) {
  310. s = s || {},
  311. s.type = e,
  312. t && !O[t] && (O[t] = s),
  313. S.initSelector && S.initSelector(t, s)
  314. }
  315. } (I[N]),
  316. S["create" + I[N]] = function(e) {
  317. return function(s, a) {
  318. var i = t.createElement(s);
  319. for (var r in a) i.setAttribute("data-" + r, a[r]);
  320. return S[e](i),
  321. i
  322. }
  323. } (I[N]);
  324. S.RecentCommentsWidget = S.RecentComments;
  325. var A = S.API = {
  326. ajax: function(e, t, i, r, n) {
  327. function d(e) {
  328. var t = e.getResponseHeader("Date");
  329. t && (b = new Date - new Date(t))
  330. }
  331. function l(e, t, s) {
  332. var a, i, o, l = t;
  333. if (e >= 200 && 300 > e || 304 === e) if (304 === e) l = "notmodified",
  334. o = !0;
  335. else try {
  336. a = p.parse(s),
  337. l = "success",
  338. o = !0
  339. } catch(c) {
  340. l = "parsererror",
  341. i = c
  342. } else {
  343. i = l,
  344. (!l || e) && (l = "error", 0 > e && (e = 0));
  345. try {
  346. a = p.parse(s)
  347. } catch(c) {
  348. l = "parsererror",
  349. i = c
  350. }
  351. }
  352. o ? r && r(a) : "parseerror" === l ? C.error("解析错误: " + s) : (C.error("出错啦(" + a.code + "): " + a.errorMessage), n && n(a), a.errorTrace && C.error(a.errorTrace)),
  353. d(m)
  354. }
  355. var u = o.getCookie("duoshuo_token");
  356. i = i || {},
  357. i.v = S.version,
  358. u ? i.jwt = u: c.remote_auth && (i.remote_auth = c.remote_auth);
  359. var h = f && p && p.parse;
  360. if (h) {
  361. var m = new f,
  362. v = !!m && "withCredentials" in m;
  363. if (v) {
  364. var g;
  365. return m.open(e, a() + "/api/" + t + ".json" + ("GET" == e ? "?" + o.param(i) : ""), !0),
  366. m.withCredentials = !0,
  367. m.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"),
  368. m.send("GET" == e ? null: o.param(i)),
  369. g = function(e, t) {
  370. var a, i, r, n;
  371. try {
  372. if (g && (t || 4 === m.readyState)) if (g = s, t) 4 !== m.readyState && m.abort();
  373. else {
  374. a = m.status,
  375. r = m.getAllResponseHeaders();
  376. try {
  377. n = m.responseText
  378. } catch(e) {}
  379. try {
  380. i = m.statusText
  381. } catch(o) {
  382. i = ""
  383. }
  384. }
  385. } catch(d) {
  386. t || l( - 1, d)
  387. }
  388. n && l(a, i, n, r)
  389. },
  390. void(4 === m.readyState ? g() : m.onreadystatechange = g)
  391. }
  392. }
  393. "GET" != e && (i._method = "POST");
  394. var y = "cb_" + Math.round(1e6 * Math.random());
  395. A[y] = function(e) {
  396. switch (e.code) {
  397. case 0:
  398. r && r(e);
  399. break;
  400. default:
  401. n && n(e),
  402. C.error("出错啦(" + e.code + "): " + e.errorMessage),
  403. e.errorTrace && C.error(e.errorTrace)
  404. }
  405. },
  406. i.callback = "DUOSHUO.API['" + y + "']",
  407. o.injectScript(a() + "/api/" + t + ".jsonp?" + o.param(i))
  408. },
  409. get: function(e, t, s, a) {
  410. return this.ajax("GET", e, t, s, a)
  411. },
  412. post: function(e, t, s, a) {
  413. return this.ajax("POST", e, t, s, a)
  414. }
  415. },
  416. M = S.ws = {
  417. messages: [],
  418. send: function(s) {
  419. if (! ("WebSocket" in e && p)) return ! 1;
  420. var a = this;
  421. if (a.messages.push(p.stringify(s)), !a.webSocket) {
  422. var r = "https:" === t.location.protocol ? "wss://ws.duoshuo.com:8202/": "ws://ws.duoshuo.com:8201/",
  423. n = a.webSocket = new WebSocket(r);
  424. n.onopen = function() {
  425. var e, t = 1 === n.readyState;
  426. if (t) for (; e = a.messages.shift();) n.send(e)
  427. },
  428. n.onmessage = function(e) {
  429. try {
  430. var t = p.parse(e.data)
  431. } catch(s) {
  432. return
  433. }
  434. switch (t.type) {
  435. case "post":
  436. for (var a, r = 0; r < S.pagelets.length; r++) a = S.pagelets[r],
  437. a.threadId == t.thread_id && a.onMessage(t);
  438. break;
  439. case "notification":
  440. y.push(t),
  441. i()
  442. }
  443. },
  444. e.addEventListener("beforeunload",
  445. function() {
  446. n.close()
  447. })
  448. }
  449. a.webSocket.onopen()
  450. }
  451. };
  452. S.DOMAIN = "duoshuo.com",
  453. S.STATIC_URL = g + "//static.duoshuo.com",
  454. S.REMOTE = g + "//duoshuo.com",
  455. S.version = "15.11.15";
  456. var U = {
  457. "default": "79dc948b",
  458. dark: "ddc346d8",
  459. bluebox: "0f0f035c",
  460. newhua: "dc453ca2"
  461. },
  462. R = {
  463. "embed.compat": "24f8ca3f",
  464. smilies: "921e8eda"
  465. },
  466. z = {
  467. post: "发布",
  468. posting: "正在发布",
  469. settings: "设置",
  470. reply: "回复",
  471. like: "顶",
  472. repost: "转发",
  473. report: "举报",
  474. "delete": "删除",
  475. reply_to: "回复 ",
  476. reposts: "转发",
  477. comments: "评论",
  478. floor: "楼",
  479. latest: "最新",
  480. earliest: "最早",
  481. hottest: "最热",
  482. share_to: "分享到:",
  483. leave_a_message: "说点什么吧…",
  484. no_comments_yet: "还没有评论,沙发等你来抢",
  485. repost_reason: "请输入转发理由",
  486. hot_posts_title: "被顶起来的评论",
  487. comments_zero: "暂无评论",
  488. comments_one: "1条评论",
  489. comments_multiple: "{num}条评论",
  490. reposts_zero: "暂无转发",
  491. reposts_one: "1条转发",
  492. reposts_multiple: "{num}条转发",
  493. weibo_reposts_zero: "暂无新浪微博",
  494. weibo_reposts_one: "1条新浪微博",
  495. weibo_reposts_multiple: "{num}条新浪微博",
  496. qqt_reposts_zero: "暂无腾讯微博",
  497. qqt_reposts_one: "1条腾讯微博",
  498. qqt_reposts_multiple: "{num}条腾讯微博"
  499. },
  500. D = {
  501. get: function(e) {
  502. return m ? m[e] : void 0
  503. },
  504. save: function(e, t) {
  505. if (m) try {
  506. m.removeItem(e),
  507. m[e] = p.stringify(t),
  508. m.removeItem(e + ":timestamp"),
  509. m[e + ":timestamp"] = Math.floor((new Date - b) / 1e3)
  510. } catch(s) {}
  511. }
  512. },
  513. W = S.loadRequire = function(t) {
  514. if (t.visitor && (!nt.data && t.visitor.user_id && e.Notification && M.send({
  515. logged_user_id: t.visitor.user_id
  516. }), nt.reset(t.visitor)), t.site && (rt.reset(t.site), D.save("ds_site_" + c.short_name, t.site)), !S.theme && rt.data.theme && n(rt.data.theme), t.lang && (o.extend(z, t.lang), D.save("ds_lang_" + c.short_name, t.lang)), t.stylesheets) for (var s = 0; s < t.stylesheets.length; s++) o.injectStylesheet(t.stylesheets[s]);
  517. if (t.nonce && (S.nonce = t.nonce), t.style && o.injectStyle((t.style || "") + S.compileStyle(c.component_style)), t.unread && ot.reset(t.unread), t.warnings) for (var s = 0; s < t.warnings.length; s++) C.warn(t.warnings[s])
  518. },
  519. H = 0,
  520. B = S.Class = function() {};
  521. B.extend = function(e) {
  522. function t() { ! H && this.init && this.init.apply(this, arguments)
  523. }
  524. H = 1;
  525. var s = new this;
  526. H = 0;
  527. for (var a in e) s[a] = e[a];
  528. return t.prototype = s,
  529. t.prototype.constructor = t,
  530. t.extend = arguments.callee,
  531. t
  532. };
  533. var J = S.Event = B.extend({
  534. on: function(e, t) {
  535. var a = this.handlers || (this.handlers = {});
  536. return a[e] === s && (a[e] = []),
  537. a[e].push(t),
  538. this
  539. },
  540. trigger: function(e, t) {
  541. var s = (this.handlers || (this.handlers = {}))[e];
  542. if (s) for (var a = 0; a < s.length && s[a].call(this, t) !== !1; a++);
  543. return this
  544. }
  545. }),
  546. Q = S.Widget = J.extend({
  547. init: function(e, t) {
  548. this.el = e,
  549. this.options = t || {},
  550. this.render()
  551. },
  552. render: function() {},
  553. reset: function() {},
  554. load: function(e) {
  555. switch (e.code) {
  556. case 0:
  557. W(e);
  558. var t = this.prepare(e);
  559. t.options = o.extend(this.options, e.options),
  560. this.onload(t);
  561. break;
  562. default:
  563. this.onError(e)
  564. }
  565. },
  566. onload: function(e) {
  567. this.el.html(et[this.tmpl](e))
  568. },
  569. prepare: function(e) {
  570. return e
  571. },
  572. onMessage: function() {},
  573. onError: function(e) {
  574. C.error("出错啦(" + e.code + "): " + e.errorMessage),
  575. e.errorTrace && C.error(e.errorTrace)
  576. }
  577. }),
  578. V = S.Model = J.extend({
  579. init: function(e) {
  580. this.data = e
  581. },
  582. reset: function(e) {
  583. this.data = e,
  584. this.trigger("reset")
  585. },
  586. remove: function(e) {
  587. this.data.splice(e, 1),
  588. this.trigger("reset")
  589. },
  590. set: function(e, t) {
  591. if (t === s) for (var a in e) this.data[a] = e[a];
  592. else this.data[e] = t;
  593. return this.trigger("reset"),
  594. this
  595. },
  596. toJSON: function() {
  597. return o.extend({},
  598. this.data)
  599. }
  600. }),
  601. $ = V.extend({
  602. toJSON: function() {
  603. return o.extend({},
  604. this.data)
  605. }
  606. }),
  607. F = V.extend({
  608. toJSON: function() {
  609. var e = o.extend({},
  610. this.data);
  611. return e.theAuthor = ct[this.data.author_id] && ct[this.data.author_id].data || this.data.author,
  612. e.parents = this.data.parents || [],
  613. e
  614. }
  615. }),
  616. G = V.extend({
  617. toJSON: function() {
  618. return o.extend({},
  619. this.data)
  620. }
  621. }),
  622. Y = function(e) {
  623. this.model = e
  624. };
  625. Y.prototype.set = function(e) {
  626. for (var t in e) e[t] && (this[t] ? this[t].set(e[t]) : this[t] = new this.model(e[t]))
  627. },
  628. Y.prototype.get = function(e) {
  629. for (var t = 0,
  630. s = []; t < e.length; t++) s[t] = this[e[t]];
  631. return s
  632. },
  633. Y.prototype.getJSON = function(e) {
  634. for (var t = 0,
  635. s = []; t < e.length; t++) this[e[t]] && s.push(this[e[t]].toJSON());
  636. return s
  637. };
  638. var Z = {
  639. userUrl: function(e) {
  640. return e.url
  641. },
  642. avatarUrl: function(e) {
  643. return 'https://www.solomp.com/custom/catimg.php?src=' + e.avatar_url || 'https://www.solomp.com/custom/catimg.php?src=' + rt.data.default_avatar_url
  644. },
  645. loginUrl: function(e, t) {
  646. return t || (t = {}),
  647. c.sso && c.sso.login && (t.sso = 1, t.redirect_uri = c.sso.login),
  648. a() + "/login/" + e + "/" + x(t)
  649. },
  650. bindUrl: function(e) {
  651. return a() + "/bind/" + e + "/" + x(c.sso && c.sso.login ? {
  652. sso: 1,
  653. redirect_uri: c.sso.login
  654. }: null, T())
  655. },
  656. logoutUrl: function() {
  657. return a() + "/logout/" + x(c.sso && c.sso.logout ? {
  658. sso: 1,
  659. redirect_uri: c.sso.logout
  660. }: null)
  661. }
  662. },
  663. X = ["weixin", "weibo", "qq", "renren"],
  664. K = ["douban", "kaixin", "baidu", "google"],
  665. et = S.templates = {
  666. userAnchor: function(e) {
  667. return e.url ? '<a rel="nofollow author" target="_blank" href="' + _(e.url) + '">' + _(e.name) + "</a>": _(e.name)
  668. },
  669. avatarImg: function(e, t) {
  670. return '<img src="' + _(Z.avatarUrl(e, t)) + '" alt="' + _(e.name) + '"' + (t ? ' style="width:' + t + "px;height:" + t + 'px"': "") + "/>"
  671. },
  672. avatar: function(e, t) {
  673. var s = et.avatarImg(e, t),
  674. i = Z.userUrl(e);
  675. return i ? '<a rel="nofollow author" target="_blank" href="' + _(i) + '" ' + (e.user_id ? " onclick=\"this.href='" + a() + "/user-url/?user_id=" + e.user_id + "';\"": "") + ' title="' + _(e.name) + '">' + s + "</a>": s
  676. },
  677. timeText: function(e) {
  678. return e ? '<span class="ds-time" datetime="' + e + '" title="' + S.fullTime(e) + '">' + S.elapsedTime(e) + "</span>": ""
  679. },
  680. timeAnchor: function(e, t) {
  681. return e ? '<a href="' + t + '" target="_blank" rel="nofollow" class="ds-time" datetime="' + e + '" title="' + S.fullTime(e) + '">' + S.elapsedTime(e) + "</a>": ""
  682. },
  683. serviceIcon: function(e, t) {
  684. return '<a href="javascript:void(0)" class="ds-service-icon' + (t ? "-grey": "") + " ds-" + e + '" data-service="' + e + '" title="' + S.sourceName[e] + '"></a>'
  685. },
  686. poweredBy: function(e) {
  687. return '<p class="ds-powered-by"><a href="http://duoshuo.com" target="_blank" rel="nofollow">' + _(e) + "</a></p>"
  688. },
  689. indicator: w('<div id="ds-indicator"></div>'),
  690. waitingImg: w('<div id="ds-waiting"></div>'),
  691. loginItem: function(e, t) {
  692. var s = Z[t ? "bindUrl": "loginUrl"](e);
  693. return '<li> <a href="' + s + '" rel="nofollow" class="ds-service-link ds-' + e + '">' + S.serviceNames[e] + (nt.data.social_uid[e] ? ' <span class="ds-icon ds-icon-ok"></span>': "") + "</a></li>"
  694. }
  695. },
  696. tt = function(e) {
  697. var t = [];
  698. for (var s in e) t.push('<input type="hidden" name="' + s + '" value="' + _(e[s]) + '" />');
  699. return t.join("\n")
  700. };
  701. et.commentList = function(e) {
  702. var t = "",
  703. s = e.list;
  704. if (s) for (var a, i = -1,
  705. r = s.length - 1; r > i;) a = s[i += 1],
  706. t += '<li class="ds-comment',
  707. e.options.show_avatars && (t += " ds-show-avatars"),
  708. t += '" data-post-id="' + a.post_id + '">',
  709. e.options.show_avatars && (t += '<div class="ds-avatar">' + et.avatar(a.theAuthor, e.options.avatar_size) + "</div>"),
  710. t += '<div class="ds-meta">' + et.userAnchor(a.theAuthor),
  711. e.options.show_time && (t += et.timeText(a.created_at)),
  712. t += "</div>",
  713. t += e.options.show_title ? '<div class="ds-thread-title">在 <a href="' + u(a.thread.url) + '#comments">' + u(a.thread.title) + '</a> 中评论</div><div class="ds-excerpt">' + a.message + "</div>": '<a class="ds-excerpt" title="' + a.thread.title + ' 中的评论" href="' + u(a.thread.url) + '#comments">' + a.message + "</a>",
  714. t += "</li>";
  715. return t
  716. },
  717. et.ctxPost = function(e) {
  718. var t = "";
  719. return e.post && (t += '<li class="ds-ctx-entry"', e.hidden && (t += ' style="display:none"'), t += ' data-post-id="' + e.post.post_id + '"><div class="ds-avatar">' + et.avatar(e.post.theAuthor || e.post.author) + '</div><div class="ds-ctx-body"><div class="ds-ctx-head">' + et.userAnchor(e.post.theAuthor || e.post.author) + et.timeAnchor(e.post.created_at, e.post.url), e.index >= 0 && (t += '<div class="ds-ctx-nth" title="' + S.fullTime(e.post.created_at) + '">' + (e.index + 1) + z.floor + "</div>"), t += '</div><div class="ds-ctx-content">' + e.post.message, e.index >= 0 && (t += '       <div class="ds-comment-actions', e.post.vote > 0 && (t += " ds-post-liked"), t += '">' + et.likePost(e.post) + '<a class="ds-post-repost" href="javascript:void(0);"><span class="ds-icon ds-icon-share"></span>' + z.repost + '</a><a class="ds-post-reply" href="javascript:void(0);"><span class="ds-icon ds-icon-reply"></span>' + z.reply + "</a></div>"), t += "</div></div></li>"),
  720. t
  721. },
  722. et["dialog-anonymous"] = function(e) {
  723. var t = '<h2>社交帐号登录</h2><div class="ds-icons-32">',
  724. s = e.services;
  725. if (s) for (var a, i = -1,
  726. r = s.length - 1; r > i;) a = s[i += 1],
  727. t += '<a class="ds-' + a + '" href="' + Z.loginUrl(a) + '">' + S.sourceName[a] + "</a>";
  728. return t += "</div>",
  729. e.options.deny_anonymous || (t += '<h2>作为游客留言</h2><form><div class="ds-control-group"><input type="text" name="author_name" id="ds-dialog-name" value="' + u(nt.data.name) + '" required /><label for="ds-dialog-name">名字(必填)</label></div>', e.options.require_guest_email && (t += '<div class="ds-control-group"><input type="email" name="author_email" id="ds-dialog-email" value="' + u(nt.data.email) + '" required /><label for="ds-dialog-email">邮箱(必填)</label></div>'), e.options.require_guest_url && (t += '<div class="ds-control-group"><input type="url" name="author_url" id="ds-dialog-url" placeholder="http://" value="' + u(nt.data.url) + '" /><label for="ds-dialog-url">网址(可选)</label></div>'), t += '<button type="submit">发布</button></form>'),
  730. t
  731. },
  732. et["dialog-ask-for-auth"] = function() {
  733. var e = '<h2>社交帐号登录</h2><ul class="ds-service-list">' + et.serviceList(X) + '</ul><ul class="ds-service-list ds-additional-services">' + et.serviceList(K) + "</ul>";
  734. return e
  735. },
  736. et["dialog-bind-more"] = function() {
  737. var e = '<h2>绑定更多帐号</h2><ul class="ds-service-list">' + et.serviceBindList(X) + '</ul><ul class="ds-service-list ds-additional-services">' + et.serviceBindList(K) + '</ul><div style="clear:both"></div>';
  738. return e
  739. },
  740. et["dialog-qrcode"] = function(e) {
  741. var t = '<h2>微信扫一扫,分享到朋友圈</h2><div class="ds-share-qrcode" style="text-align:center;"><img src="' + e.qrcode_url + '" alt="' + e.url + '"></div>';
  742. return t
  743. },
  744. et["dialog-reposts"] = function(e) {
  745. var t = '<h2>转发到微博</h2><div class="ds-quote"><strong>@' + u(e.post.theAuthor.name) + "</strong>: " + e.post.message + "</div><form>" + tt({
  746. post_id: e.post.post_id
  747. }) + '<div class="ds-textarea-wrapper"><textarea name="message" title="Ctrl+Enter快捷提交" placeholder="' + u(z.repost_reason) + '">' + u(e.repostMessage) + '</textarea><pre class="ds-hidden-text"></pre>';
  748. return t += '</div><div class="ds-actions">',
  749. e.service ? t += tt({
  750. "service[]": e.service
  751. }) : (t += '<label><input type="checkbox" name="service[]" value="weibo"', nt.data.social_uid.weibo && (t += ' checked="checked"'), t += ' /><span class="ds-service-icon ds-weibo"></span>新浪微博</label><label><input type="checkbox" name="service[]" value="qqt"', nt.data.social_uid.qq && (t += ' checked="checked"'), t += ' /><span class="ds-service-icon ds-qqt"></span>腾讯微博</label>'),
  752. t += '<button type="submit">' + z.repost + "</button></div></form>"
  753. },
  754. et.dialog = function(e) {
  755. var t = '<div class="ds-dialog"><div class="ds-dialog-inner ds-rounded"><div class="ds-dialog-body">' + e + '</div><div class="ds-dialog-footer"><a href="http://duoshuo.com/" target="_blank" class="ds-logo"></a><span>社会化评论框</span></div><a class="ds-dialog-close" href="javascript:void(0)" title="关闭"></a></div></div>';
  756. return t
  757. },
  758. et.hotPosts = function(e) {
  759. var t = '<div class="ds-header ds-gradient-bg">' + u(z.hot_posts_title) + "</div><ul>",
  760. s = e.list;
  761. if (s) for (var a, i = -1,
  762. r = s.length - 1; r > i;) a = s[i += 1],
  763. t += et.post({
  764. post: a,
  765. options: e.options
  766. });
  767. return t += "</ul>"
  768. },
  769. et.likePost = function(e) {
  770. var t = '<a class="ds-post-likes" href="javascript:void(0);"><span class="ds-icon ds-icon-like"></span>' + z.like;
  771. return e.likes > 0 && (t += "(" + e.likes + ")"),
  772. t += "</a>"
  773. },
  774. et.likeTooltip = function(e) {
  775. var t = '<div class="ds-like-tooltip ds-rounded"><p>很高兴你能喜欢,分享一下吧:</p><ul>';
  776. for (var s in e.services) t += '<li><a class="ds-share-to-' + s + " ds-service-link ds-" + s + '" href="' + a() + "/share-proxy/?" + o.param({
  777. service: s,
  778. thread_id: e.thread_id
  779. }) + '">' + e.services[s] + "</a></li>";
  780. return t += '</ul><p class="ds-like-tooltip-footer"><a class="ds-like-tooltip-close">算了</a></p></div>'
  781. },
  782. et.loginButtons = function() {
  783. var e = '<div class="ds-login-buttons"><p>社交帐号登录:</p><div class="ds-social-links"><ul class="ds-service-list">' + et.serviceList(X) + '<li><a class="ds-more-services" href="javascript:void(0)">更多»</a></li></ul><ul class="ds-service-list ds-additional-services">' + et.serviceList(K) + "</ul></div></div>";
  784. return e
  785. },
  786. et.loginWidget = function(e) {
  787. var t = '<div class="ds-icons-32">',
  788. s = e;
  789. if (s) for (var a, i = -1,
  790. r = s.length - 1; r > i;) a = s[i += 1],
  791. t += '<a class="ds-' + a + '" href="' + Z.loginUrl(a) + '">' + S.sourceName[a] + "</a>";
  792. return t += "</div>"
  793. },
  794. et.meta = function(e) {
  795. var t = '<div class="ds-meta"><a href="javascript:void(0)" class="ds-like-thread-button ds-rounded';
  796. return e.user_vote > 0 && (t += " ds-thread-liked"),
  797. t += '"><span class="ds-icon ds-icon-heart"></span> <span class="ds-thread-like-text">',
  798. t += e.user_vote > 0 ? "已喜欢": "喜欢",
  799. t += '</span><span class="ds-thread-cancel-like">取消喜欢</span></a><span class="ds-like-panel"></span></div>'
  800. },
  801. et.notify = function(e) {
  802. var t = '<div id="ds-reset"><a class="ds-logo" href="http://duoshuo.com/" target="_blank" title="多说"></a><ul class="ds-notify-unread"><li';
  803. return e.comments || (t += ' style="display:none;"'),
  804. t += '><a data-type="unread-comments" href="javascript:void(0);">你有' + e.comments + "条新回复</a></li><li",
  805. e.notifications || (t += ' style="display:none;"'),
  806. t += '><a data-type="unread-notifications" href="javascript:void(0);">你有' + e.notifications + "条系统消息</a></li></ul></div>"
  807. },
  808. et.post = function(e) {
  809. var t = "",
  810. s = e.post,
  811. i = e.options,
  812. r = s.author;
  813. if (t += '<li class="ds-post" data-post-id="' + s.post_id + '"><div class="ds-post-self" data-post-id="' + s.post_id + '" data-thread-id="' + s.thread_id + '" data-root-id="' + s.root_id + '" data-source="' + s.source + '"><div class="ds-avatar"', r.user_id && (t += ' data-user-id="' + r.user_id + '"'), t += ">" + et.avatar(r), S.sourceName[s.source] && (t += et.serviceIcon(s.source)), t += '</div><div class="ds-comment-body"><div class="ds-comment-header">', r.url ? (t += '<a class="ds-user-name ds-highlight" data-qqt-account="' + (r.qqt_account || "") + '" href="' + u(r.url) + '" ', r.user_id && (t += " onclick=\"this.href='" + a() + "/user-url/?user_id=" + r.user_id + "';\""), t += ' rel="nofollow" target="_blank"', r.user_id && (t += ' data-user-id="' + r.user_id + '"'), t += ">" + u(r.name) + "</a>") : (t += '<span class="ds-user-name"', r.user_id && (t += ' data-user-id="' + r.user_id + '"'), t += ' data-qqt-account="' + (r.qqt_account || "") + '">' + u(r.name) + "</span>"), t += "</div>", 1 == i.max_depth && i.show_context && s.parents.length) {
  814. t += '<ol id="ds-ctx">';
  815. var n = lt.getJSON(s.parents);
  816. if (n) for (var o, d = -1,
  817. l = n.length - 1; l > d;) o = n[d += 1],
  818. 1 == d && s.parents.length > 2 && (t += '<li class="ds-ctx-entry"><a href="javascript:void(0);" class="ds-expand">还有' + (s.parents.length - 2) + "条评论</a></li>"),
  819. t += et.ctxPost({
  820. post: o,
  821. index: d,
  822. hidden: d && d < s.parents.length - 1
  823. });
  824. t += "</ol>"
  825. }
  826. if (t += "<p>", s.parents.length >= i.max_depth && (!i.show_context || i.max_depth > 1) && s.parent_id && lt[s.parent_id] && (t += '<a class="ds-comment-context" data-post-id="' + s.post_id + '" data-parent-id="' + s.parent_id + '">' + z.reply_to + u(lt[s.parent_id].toJSON().author.name) + ": </a>"), s.message = s.message.replace(/(http\:\/\/img.t.sinajs.cn\/t35\/style\/images\/common\/face\/ext\/normal\/)/g,"https://www.solomp.com/custom/catimg.php?src=$1"), t += s.message.replace(/(http\:\/\/static.duoshuo.com\/images\/)/g,"https://www.solomp.com/custom/catimg.php?src=$1") + '</p><div class="ds-comment-footer ds-comment-actions', s.vote > 0 && (t += " ds-post-liked"), t += '">', t += s.url ? et.timeAnchor(s.created_at, s.url) : et.timeText(s.created_at), "duoshuo" == s.source ? (t += '<a class="ds-post-reply" href="javascript:void(0);"><span class="ds-icon ds-icon-reply"></span>' + z.reply + "</a>" + et.likePost(s) + '<a class="ds-post-repost" href="javascript:void(0);"><span class="ds-icon ds-icon-share"></span>' + z.repost + '</a><a class="ds-post-report" href="javascript:void(0);"><span class="ds-icon ds-icon-report"></span>' + z.report + "</a>", s.privileges["delete"] && (t += '<a class="ds-post-delete" href="javascript:void(0);"><span class="ds-icon ds-icon-delete"></span>' + z["delete"] + "</a>")) : ("qqt" == s.source || "weibo" == s.source) && (t += '<a class="ds-weibo-comments" href="javascript:void(0);">' + z.comments, s.type.match(/\-comment$/) || (t += '(<span class="ds-count">' + s.comments + "</span>)"), t += '</a><a class="ds-weibo-reposts" href="javascript:void(0);">' + z.reposts, s.type.match(/\-comment$/) || (t += '(<span class="ds-count">' + s.reposts + "</span>)"), t += "</a>"), t += "</div></div></div>", i.max_depth > 1 && (s.childrenArray || s.children) && "weibo" != s.source && "qqt" != s.source) {
  827. t += '<ul class="ds-children">';
  828. var c = lt.getJSON(s.childrenArray || s.children);
  829. if (c) for (var s, d = -1,
  830. p = c.length - 1; p > d;) s = c[d += 1],
  831. t += et.post({
  832. post: s,
  833. options: i
  834. });
  835. t += "</ul>"
  836. }
  837. return t += "</li>"
  838. },
  839. et.postListHead = function(e) {
  840. var t = '<div class="ds-comments-info"><div class="ds-sort"><a class="ds-order-desc">' + z.latest + '</a><a class="ds-order-asc">' + z.earliest + '</a><a class="ds-order-hot">' + z.hottest + '</a></div><ul class="ds-comments-tabs"><li class="ds-tab"><a class="ds-comments-tab-duoshuo ds-current" href="javascript:void(0);"></a></li>';
  841. return e.options.show_reposts && e.thread.reposts && (t += '<li class="ds-tab"><a class="ds-comments-tab-repost" href="javascript:void(0);"></a></li>'),
  842. t += " ",
  843. e.options.show_weibo && e.thread.weibo_reposts && (t += '<li class="ds-tab"><a class="ds-comments-tab-weibo" href="javascript:void(0);"></a></li>'),
  844. t += " ",
  845. e.options.show_qqt && e.thread.qqt_reposts && (t += '<li class="ds-tab"><a class="ds-comments-tab-qqt" href="javascript:void(0);"></a></li>'),
  846. t += "</ul></div>"
  847. },
  848. et.recentVisitors = function(e) {
  849. var t = "",
  850. s = e.response;
  851. if (s) for (var a, i = -1,
  852. r = s.length - 1; r > i;) a = s[i += 1],
  853. t += '<div class="ds-avatar">' + et.avatar(a, e.options.avatar_size) + "</div>";
  854. return t
  855. },
  856. et.replybox = function(e) {
  857. var t = '<div class="ds-replybox"><a class="ds-avatar"';
  858. if (t += r() ? ' href="javascript:void(0);" onclick="return false"': ' href="' + S.REMOTE + "/settings/avatar/" + x(T()) + '" target="_blank" title="设置头像"', t += ">" + et.avatarImg(nt.data) + '</a><form method="post">' + tt(e.params) + '<div class="ds-textarea-wrapper ds-rounded-top"><textarea name="message" title="Ctrl+Enter快捷提交" placeholder="' + u(z.leave_a_message) + '"></textarea><pre class="ds-hidden-text"></pre>', t += "</div>", t += '<div class="ds-post-toolbar"><div class="ds-post-options ds-gradient-bg"><span class="ds-sync">', !r() && nt.data.repostOptions) {
  859. t += '<input id="ds-sync-checkbox',
  860. e.inline && (t += "-inline"),
  861. t += '" type="checkbox" name="repost" ',
  862. e.checked && (t += 'checked="checked" '),
  863. t += 'value="' + e.repostArray.join(",") + '"> <label for="ds-sync-checkbox',
  864. e.inline && (t += "-inline"),
  865. t += '">' + z.share_to + "</label>";
  866. for (var s in nt.data.repostOptions) t += et.serviceIcon(s, !nt.data.repostOptions[s])
  867. }
  868. return t += "</span>",
  869. t += "</div>",
  870. t += '<button class="ds-post-button" type="submit">' + u(z.post) + '</button><div class="ds-toolbar-buttons">',
  871. e.options.use_smilies && (t += '<a class="ds-toolbar-button ds-add-emote" title="插入表情"></a>'),
  872. e.options.use_images && e.options.parse_html_enabled && (t += '<a class="ds-toolbar-button ds-add-image" title="插入图片"></a>'),
  873. t += "</div></div>",
  874. t += "</form></div>"
  875. },
  876. et.serviceBindList = function(e) {
  877. var t = "",
  878. s = e;
  879. if (s) for (var a, i = -1,
  880. r = s.length - 1; r > i;) a = s[i += 1],
  881. t += '<li><a href="' + Z.bindUrl(a) + '" rel="nofollow" class="ds-service-link ds-' + a + '">' + S.serviceNames[a],
  882. nt.data.social_uid[a] && (t += ' <span class="ds-icon ds-icon-ok"></span>'),
  883. t += "</a></li>";
  884. return t
  885. },
  886. et.serviceList = function(e) {
  887. var t = "",
  888. s = e;
  889. if (s) for (var a, i = -1,
  890. r = s.length - 1; r > i;) a = s[i += 1],
  891. t += '<li><a href="' + Z.loginUrl(a) + '" rel="nofollow" class="ds-service-link ds-' + a + '">' + S.serviceNames[a] + "</a></li>";
  892. return t
  893. },
  894. et.shareWidget = function(e) {
  895. var t = '<div class="ds-share-icons"> <div class="ds-share-icons-inner"> <ul class="ds-share-icons-16"> ',
  896. s = e.services;
  897. if (s) for (var a, i = -1,
  898. r = s.length - 1; r > i;) a = s[i += 1],
  899. t += ' <li> <a class="ds-' + a + '" href="javascript:void(0);" data-service="' + a + '">' + S.sourceName[a] + "</a> </li> ";
  900. return t += ' </ul> </div> <div class="ds-share-icons-footer">' + e.copyright + "</div></div>"
  901. },
  902. et.smiliesTooltip = function(e) {
  903. var t = '<div id="ds-smilies-tooltip"><ul class="ds-smilies-tabs">';
  904. for (var s in e) t += "<li><a>" + s + "</a></li>";
  905. return t += '</ul><div class="ds-smilies-container"></div></div>'
  906. },
  907. et.toolbar = function() {
  908. var e = '<div class="ds-toolbar"><div class="ds-account-control"><span class="ds-icon ds-icon-settings"></span> <span>帐号管理</span><ul><li><a class="ds-bind-more" href="javascript:void(0);" style="border-top: none">绑定更多</a></li><li><a target="_blank" href="' + S.REMOTE + "/settings/" + x(T()) + '">' + u(z.settings) + '</a></li><li><a rel="nofollow" href="' + Z.logoutUrl() + '" style="border-bottom: none">登出</a></li></ul></div><div class="ds-visitor">';
  909. return e += nt.data.url ? '<a class="ds-visitor-name" href="' + u(nt.data.url) + '" target="_blank">' + u(nt.data.name) + "</a>": '<span class="ds-visitor-name">' + u(nt.data.name) + "</span>",
  910. e += '<a class="ds-unread-comments-count" href="javascript:void(0);" title="新回复"></a></div></div>'
  911. },
  912. et.topThreads = function(e) {
  913. var t = "",
  914. s = e.response;
  915. if (s) for (var a, i = -1,
  916. r = s.length - 1; r > i;) a = s[i += 1],
  917. t += '<li><a target="_blank" href="' + u(a.url) + '" title="' + u(a.title) + '">' + u(a.title) + "</a></li>";
  918. return t
  919. },
  920. et.topUsers = function(e) {
  921. var t = "",
  922. s = e.response;
  923. if (s) for (var a, i = -1,
  924. r = s.length - 1; r > i;) a = s[i += 1],
  925. t += '<div class="ds-avatar">' + et.avatar(a, e.options.avatar_size) + "<h4>" + u(a.name) + "</h4></div>";
  926. return t
  927. },
  928. et.userInfo = function(e) {
  929. var t = '<a href="' + u(e.url) + '" onclick="this.href=\'' + a() + "/user-url/?user_id=" + e.user_id + '\';" class="ds-avatar" target="_blank">' + et.avatarImg(e) + '</a><a href="' + u(e.url) + '" onclick="this.href=\'' + a() + "/user-url/?user_id=" + e.user_id + '\';" class="ds-user-name ds-highlight" target="_blank">' + u(e.name) + "</a>";
  930. for (var s in e.social_uid) t += '<a href="' + S.REMOTE + "/user-proxy/" + s + "/" + e.social_uid[s] + '/" target="_blank" class="ds-service-icon ds-' + s + '" title="' + S.sourceName[s] + '"></a>';
  931. return t += '<p class="ds-user-card-meta"><a href="' + S.REMOTE + "/profile/" + e.user_id + '/" target="_blank"><span class="ds-highlight">' + e.comments + "</span>条评论</a></p>",
  932. e.description && (t += '<p class="ds-user-description">' + u(e.description) + "</p>"),
  933. t
  934. };
  935. var st = S.Views = {},
  936. at = (S.Callbacks = {},
  937. S.pagelets = []),
  938. it = S.events = new J,
  939. rt = S.site = new V,
  940. nt = S.visitor = new $,
  941. ot = S.unread = new V,
  942. dt = S.threadPool = new Y(G),
  943. lt = S.postPool = new Y(F),
  944. ct = S.userPool = new Y($);
  945. it.on("queryDefined",
  946. function() {
  947. var e = c.short_name;
  948. if (c.theme && n(c.theme), m) {
  949. var t = m["ds_site_" + e],
  950. s = m["ds_lang_" + e];
  951. t && rt.reset(p.parse(t)),
  952. s && o.extend(z, p.parse(s))
  953. }
  954. }),
  955. q(),
  956. S.require("embed.compat",
  957. function() {
  958. function i(e) {
  959. e.stopPropagation()
  960. }
  961. function n(e) { (e.ctrlKey && 13 == e.which || 10 == e.which) && B(this.form).trigger("submit")
  962. }
  963. function d() {
  964. var e = B(this);
  965. e.height(Math.max(54, e.next(".ds-hidden-text").text(this.value).height() + 27))
  966. }
  967. function l() {
  968. if (P.authInWin) {
  969. var e = this.href.match(/\/(login|bind)\/(\w+)\//i);
  970. if (e && S.serviceNames[e[2]]) return ! b(e[2], this.href)
  971. }
  972. }
  973. function u() {
  974. var e, s, a, i, r, n = this,
  975. o = 0,
  976. d = 0;
  977. t.selection && (s = t.selection.createRange(), s && s.parentElement() == n && (i = n.value.length, e = n.value.replace(/\r\n/g, "\n"), a = n.createTextRange(), a.moveToBookmark(s.getBookmark()), r = n.createTextRange(), r.collapse(!1), a.compareEndPoints("StartToEnd", r) > -1 ? o = d = i: (o = -a.moveStart("character", -i), o += e.slice(0, o).split("\n").length - 1, a.compareEndPoints("EndToEnd", r) > -1 ? d = i: (d = -a.moveEnd("character", -i), d += e.slice(0, d).split("\n").length - 1)))),
  978. B(n).data("ds-range-start", o).data("ds-range-end", d)
  979. }
  980. function p(e) {
  981. return P.touch && e.addClass("ds-touch"),
  982. o.cssProperty("transition") || e.addClass("ds-no-transition"),
  983. P.ie6 && e.addClass("ds-ie6"),
  984. P.opacity || e.addClass("ds-no-opacity"),
  985. e
  986. }
  987. function f(e) {
  988. if (!P.placeholder) {
  989. var t = e.attr("placeholder");
  990. e.val(t).focus(function() {
  991. this.value === t && (this.value = "")
  992. }).blur(function() {
  993. "" === this.value && (this.value = t)
  994. })
  995. }
  996. return e
  997. }
  998. function g(e) {
  999. if ("http://duoshuo.com" === e.origin) switch (e.data.type) {
  1000. case "login":
  1001. h.href = e.data.redirectUrl
  1002. }
  1003. }
  1004. function b(t, s) {
  1005. var a = {
  1006. weibo: [760, 600],
  1007. renren: [420, 322],
  1008. qq: [504, 445],
  1009. weixin: [450, 550],
  1010. google: [600, 440]
  1011. } [t] || [550, 400];
  1012. return e.open(s + ( - 1 == s.indexOf("?") ? "?": "&") + o.param({
  1013. origin: h.origin || "http://" + h.host
  1014. }), "_blank", "width=" + a[0] + ",height=" + a[1] + ",toolbar=no,menubar=no,location=yes")
  1015. }
  1016. function y(e) {
  1017. var t = Z[r() ? "loginUrl": "bindUrl"](e);
  1018. P.authInWin && b(e, t) || (h.href = t)
  1019. }
  1020. function w() {
  1021. var e = E(et["dialog-ask-for-auth"]({})).el.find(".ds-dialog").css("width", "300px");
  1022. e.find("a.ds-service-link").click(l)
  1023. }
  1024. function x(e, t, s, a) {
  1025. function i() {
  1026. function e(e) {
  1027. if (s && a) {
  1028. var t = s.options,
  1029. i = U(s.postList.el, e.response[a], t);
  1030. "asc" == t.order == ("top" == t.formPosition) && S.scrollTo(i);
  1031. var r = s.el.find(".ds-comments-tab-" + a + " span.ds-highlight");
  1032. r.html(parseInt(r.html()) + 1)
  1033. }
  1034. }
  1035. return a || l.find("[type=checkbox]:checked")[0] ? (A.post("posts/repost", S.toJSON(l), e), o.close(), !1) : (alert("还没有选发布到哪儿呢"), !1)
  1036. }
  1037. function r() {
  1038. var e = this.value;
  1039. return this.checked && !nt.data.social_uid["qqt" == e ? "qq": e] ? void y(e) : void 0
  1040. }
  1041. var o = E(et["dialog-reposts"]({
  1042. post: e.toJSON(),
  1043. repostMessage: t,
  1044. service: a
  1045. })),
  1046. l = o.el.find("form");
  1047. return l.submit(i),
  1048. l.find(".ds-actions [type=checkbox]").change(r),
  1049. f(l.find("textarea")).keyup(n).keyup(d).focus(),
  1050. !1
  1051. }
  1052. function T(e) {
  1053. var t = {
  1054. "unread-comments": {
  1055. title: "新留言及回复",
  1056. apiUrl: "users/unreadComments",
  1057. tmpl: function(e) {
  1058. return e.thread ? '<li data-thread-id="' + e.thread.thread_id + '">' + B.map(e.authors, et.userAnchor).join("、") + ' 在 <a class="ds-read" href="' + e.thread.url + '#comments" target="_blank">' + _(e.thread.title || "无标题") + '</a> 中回复了你 <a class="ds-delete ds-read" title="知道了" href="javascript:void(0)">知道了</a></li>': ""
  1059. },
  1060. read: function(e) {
  1061. var t = e.attr("data-thread-id");
  1062. A.post("threads/read", {
  1063. thread_id: t
  1064. }),
  1065. ot.data.comments--
  1066. }
  1067. },
  1068. "unread-notifications": {
  1069. title: "系统消息",
  1070. apiUrl: "users/unreadNotifications",
  1071. tmpl: function(e) {
  1072. return '<li data-notification-id="' + e.notification_id + '" data-notification-type="' + e.type + '">' + e.content + ' <a class="ds-delete ds-read" title="知道了" href="javascript:void(0)">知道了</a></li>'
  1073. },
  1074. read: function(e) {
  1075. var t = e.attr("data-notification-id");
  1076. A.post("notifications/read", {
  1077. notification_id: t
  1078. }),
  1079. ot.data.notifications--
  1080. }
  1081. }
  1082. } [e],
  1083. s = E("<h2>" + t.title + '</h2><ul class="ds-unread-list"></ul>');
  1084. s.on("close", S.resetNotify);
  1085. var a = s.el.find(".ds-unread-list").delegate(".ds-delete", "click",
  1086. function() {
  1087. return B(this).parent().remove(),
  1088. 0 === a.children().length && s.close(),
  1089. !1
  1090. }).delegate(".ds-read", "click",
  1091. function() {
  1092. t.read(B(this).parent())
  1093. });
  1094. B("#ds-notify").hide(),
  1095. A.get(t.apiUrl, {},
  1096. function(e) {
  1097. s.el.find(".ds-unread-list").html(B.map(e.response, t.tmpl).join("\n"))
  1098. })
  1099. }
  1100. function N() {
  1101. bubbleOutTimer && (clearTimeout(bubbleOutTimer), bubbleOutTimer = 0)
  1102. }
  1103. function I() {
  1104. bubbleOutTimer = setTimeout(function() {
  1105. bubbleOutTimer = 0,
  1106. X.detach()
  1107. },
  1108. 400)
  1109. }
  1110. function U(e, t, s) {
  1111. return e.find(".ds-post[data-post-id=" + t.data.post_id + "]")[0] ? void 0 : (e.find(".ds-post-placeholder").remove(), B(et.post({
  1112. post: t.toJSON(),
  1113. options: s
  1114. })).hide()["asc" == s.order ? "appendTo": "prependTo"](e).slideDown(function() {}))
  1115. }
  1116. function R(e, t) {
  1117. function s() {
  1118. if (r()) return w(),
  1119. !1;
  1120. var e = B(this).parent(),
  1121. t = e.hasClass("ds-post-liked"),
  1122. s = B(this).html().match(/\((\d+)\)/),
  1123. a = (s ? parseInt(s[1]) : 0) + (t ? -1 : 1);
  1124. return A.post("posts/vote", {
  1125. post_id: e.closest(".ds-ctx-entry, .ds-post-self").attr("data-post-id"),
  1126. vote: t ? 0 : 1
  1127. }),
  1128. B(this).html(B(this).html().replace(/\(\d+\)/, "") + (a ? "(" + a + ")": "")),
  1129. e[t ? "removeClass": "addClass"]("ds-post-liked"),
  1130. !1
  1131. }
  1132. function a() {
  1133. var e = B(this).closest(".ds-post-self"),
  1134. t = lt[e.attr("data-post-id")];
  1135. return x(t, ""),
  1136. !1
  1137. }
  1138. function i() {
  1139. if (!confirm("确定要删除这条评论吗?")) return ! 1;
  1140. var t = B(this).closest(".ds-post-self");
  1141. return A.post("posts/remove", {
  1142. post_id: t.attr("data-post-id")
  1143. }),
  1144. t.parent().fadeOut(200,
  1145. function() {
  1146. e.data.comments--,
  1147. e.updateCounter("duoshuo"),
  1148. B(this).remove()
  1149. }),
  1150. !1
  1151. }
  1152. function n() {
  1153. if (!confirm("确定要举报这条评论吗?")) return ! 1;
  1154. var e = B(this).closest(".ds-post-self");
  1155. return A.post("posts/report", {
  1156. post_id: e.attr("data-post-id")
  1157. }),
  1158. alert("感谢您的反馈!"),
  1159. !1
  1160. }
  1161. function o() {
  1162. var s = B(this),
  1163. a = s.closest(".ds-comment-actions");
  1164. if (a.hasClass("ds-reply-active")) h.el.fadeOut(200,
  1165. function() {
  1166. B(this).detach()
  1167. }),
  1168. a.removeClass("ds-reply-active");
  1169. else {
  1170. var i = s.closest(".ds-ctx-entry, .ds-post-self");
  1171. h ? h.actionsBar.removeClass("ds-reply-active") : (h = new st.Replybox(e), h.render(!0).el.addClass("ds-inline-replybox").detach()),
  1172. h.el.find("[name=parent_id]").val(i.attr("data-post-id")),
  1173. h.el.show().appendTo(s.closest(".ds-ctx-body, .ds-comment-body")).find("textarea").focus(),
  1174. h.actionsBar = a.addClass("ds-reply-active"),
  1175. t.max_depth <= 1 ? h.postList = e.postList.el: (h.postList = i.siblings(".ds-children"), h.postList[0] || (h.postList = B('<ul class="ds-children"></ul>').insertAfter(i)))
  1176. }
  1177. return ! 1
  1178. }
  1179. function d() {
  1180. function e(e) {
  1181. W(e),
  1182. i.append(B.map(e.response,
  1183. function(e) {
  1184. return et.post({
  1185. post: e,
  1186. options: t
  1187. })
  1188. }).join(""))
  1189. } {
  1190. var s = B(this).closest(".ds-post-self"),
  1191. a = s.attr("data-post-id");
  1192. s.data("source")
  1193. }
  1194. if (0 != s.attr("data-root-id")) return ! 1;
  1195. var i = s.siblings(".ds-children");
  1196. return i[0] ? (i.remove(), !1) : (i = B('<ul class="ds-children"></ul>').insertAfter(s), A.get("posts/listComments", H({
  1197. post_id: a
  1198. }), e), !1)
  1199. }
  1200. function l() {
  1201. var t = B(this).closest(".ds-post-self"),
  1202. s = lt[t.attr("data-post-id")],
  1203. a = s.data.source;
  1204. if (!nt.data.social_uid["qqt" == a ? "qq": a]) return void y(a);
  1205. var i = s.data.root_id,
  1206. r = "0" != i ? lt[i] : s,
  1207. n = "";
  1208. if ("0" != i) {
  1209. var o = prepatePost(s.data).theAuthor;
  1210. n = ("weibo" == a ? "//@" + o.name: "|| @" + o.qqt_account) + ":" + s.data.message
  1211. }
  1212. return x(r, n, e, a),
  1213. !1
  1214. }
  1215. function c() {
  1216. var e = B(this).parent();
  1217. return e.siblings().show(),
  1218. e.remove(),
  1219. !1
  1220. }
  1221. function u() {
  1222. function t() {
  1223. function t(e) {
  1224. var t = e.response;
  1225. ct[c] ? ct[c].set(t) : ct[c] = new $(t),
  1226. X.owner == s && K.html(et.userInfo(t))
  1227. }
  1228. tt = 0,
  1229. X.owner = s,
  1230. N();
  1231. var i = a.offset(),
  1232. r = e.el.offset(),
  1233. n = a.innerWidth() / 2,
  1234. o = e.el.innerHeight() - (i.top - r.top) + 6,
  1235. d = i.left - r.left - 35 + (n > 35 ? 35 : n);
  1236. try {
  1237. if (a.hasClass("ds-comment-context")) K.attr("id", "ds-ctx-bubble").attr("data-post-id", a.attr("data-post-id")).html('<ul id="ds-ctx">' + et.ctxPost({
  1238. post: lt[a.attr("data-parent-id")].toJSON()
  1239. }) + '</ul><div class="ds-bubble-footer"><a class="ds-ctx-open" href="javascript:void(0);">查看对话</a></div>');
  1240. else if (a.hasClass("ds-avatar") || a.hasClass("ds-user-name")) {
  1241. var l = {},
  1242. c = l.user_id = a.attr("data-user-id");
  1243. if (!c) throw "no info";
  1244. K.attr("id", "ds-user-card").attr("data-user-id", c).empty(),
  1245. ct[c] ? K.html(et.userInfo(ct[c].data)) : A.get("users/profile", H(l), t)
  1246. }
  1247. X.css({
  1248. bottom: o,
  1249. left: d
  1250. }).appendTo(e.innerEl)
  1251. } catch(u) {
  1252. X.detach()
  1253. }
  1254. }
  1255. var s = this;
  1256. if (bubbleOutTimer && X.owner == s) return clearTimeout(bubbleOutTimer),
  1257. void(bubbleOutTimer = 0);
  1258. var a = B(s);
  1259. tt = setTimeout(t, 200)
  1260. }
  1261. function p() {
  1262. tt ? (clearTimeout(tt), tt = 0) : bubbleOutTimer || I()
  1263. }
  1264. var h;
  1265. this.delegate("a.ds-post-likes", "click", s).delegate("a.ds-post-repost", "click", a).delegate("a.ds-post-delete", "click", i).delegate("a.ds-post-report", "click", n).delegate("a.ds-post-reply", "click", o).delegate("a.ds-weibo-comments", "click", d).delegate("a.ds-weibo-reposts", "click", l).delegate("a.ds-expand", "click", c),
  1266. P.touch || this.delegate("a.ds-comment-context, .ds-avatar, .ds-user-name", "mouseenter", u).delegate("a.ds-comment-context, .ds-avatar, .ds-user-name", "mouseleave", p)
  1267. }
  1268. function H(e) {
  1269. var s = {
  1270. require: "site,visitor,nonce,lang" + (it++?"": ",unread,log,extraCss"),
  1271. site_ims: D.get("ds_site_" + c.short_name + ":timestamp"),
  1272. lang_ims: D.get("ds_lang_" + c.short_name + ":timestamp"),
  1273. referer: t.referrer
  1274. };
  1275. c.stylePatch && (s.style_patch = c.stylePatch);
  1276. for (var a in s) s[a] && (!P.ie6 || encodeURIComponent(s[a]).length < 200) && (e[a] = s[a]);
  1277. return e
  1278. }
  1279. var B = S.jQuery,
  1280. V = B(e),
  1281. Y = B(t);
  1282. e.postMessage && (e.addEventListener ? e.addEventListener("message", g, !1) : e.attachEvent && e.attachEvent("onmessage", g)),
  1283. S.scrollTo = function(e) {
  1284. var t = e.offset().top; (t < V.scrollTop() || t > V.scrollTop() + V.height()) && B("html, body").animate({
  1285. scrollTop: t - 40
  1286. },
  1287. 200, "swing")
  1288. },
  1289. S.toJSON = function(e) {
  1290. var t = /\r?\n/g,
  1291. s = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
  1292. a = /^(?:select|textarea)/i,
  1293. i = e.map(function() {
  1294. return this.elements ? B.makeArray(this.elements) : this
  1295. }).filter(function() {
  1296. return this.name && !this.disabled && (this.checked || a.test(this.nodeName) || s.test(this.type))
  1297. }).map(function(e, s) {
  1298. var a = B(this).val();
  1299. return null == a ? null: B.isArray(a) ? B.map(a,
  1300. function(e) {
  1301. return {
  1302. name: s.name,
  1303. value: e.replace(t, "\r\n")
  1304. }
  1305. }) : {
  1306. name: s.name,
  1307. value: a.replace(t, "\r\n")
  1308. }
  1309. }).toArray(),
  1310. r = {};
  1311. return B.each(i,
  1312. function() {
  1313. r[this.name] = this.value
  1314. }),
  1315. r
  1316. },
  1317. S.resetNotify = function() {
  1318. var e = B("#ds-notify"),
  1319. s = ot.data;
  1320. e[0] || (e = B('<div id="ds-notify"></div>').css({
  1321. hidden: {
  1322. display: "none"
  1323. },
  1324. "top-right": {
  1325. top: "24px",
  1326. right: "24px"
  1327. },
  1328. "bottom-right": {
  1329. bottom: "24px",
  1330. right: "24px"
  1331. }
  1332. } [rt.data.notify_position]).delegate(".ds-notify-unread a", "click",
  1333. function() {
  1334. return T(B(this).data("type")),
  1335. !1
  1336. }).appendTo(t.body)),
  1337. e.html(et.notify(s))[!s.comments && !s.notifications || "hidden" === rt.data.notify_position || B(".ds-dialog")[0] ? "hide": "show"]()
  1338. },
  1339. ot.on("reset", S.resetNotify),
  1340. st.Replybox = function(e) {
  1341. this.embedThread = e
  1342. },
  1343. st.Replybox.prototype = {
  1344. render: function(e) {
  1345. function s(e) {
  1346. e.data("submitting", !0),
  1347. e.find(".ds-post-button").addClass("ds-waiting").html(z.posting)[0].disabled = !0
  1348. }
  1349. function a(e) {
  1350. e.data("submitting", !1),
  1351. e.find(".ds-post-button").removeClass("ds-waiting").html(z.post)[0].disabled = !1
  1352. }
  1353. var i = this,
  1354. o = i.embedThread,
  1355. c = o.options,
  1356. p = function() {
  1357. S.require("smilies",
  1358. function() {})
  1359. },
  1360. h = {
  1361. thread: o,
  1362. options: c,
  1363. inline: e,
  1364. params: {
  1365. thread_id: o.threadId,
  1366. parent_id: "",
  1367. nonce: S.nonce
  1368. },
  1369. repostArray: [],
  1370. checked: 0
  1371. };
  1372. for (var v in nt.data.repostOptions) nt.data.repostOptions[v] && (h.repostArray.push(v), h.checked = 1);
  1373. var g = i.el = B(et.replybox(h)).click(p),
  1374. b = g.find("form"),
  1375. y = b.find("input[type=checkbox]")[0],
  1376. _ = b.find("a.ds-service-icon, a.ds-service-icon-grey"),
  1377. k = f(b.find("textarea")).focus(p).keyup(n).keyup(d).bind("focus mousedown mouseup keyup", u),
  1378. w = g.find(".ds-add-emote").click(function(e) {
  1379. var s = S.smiliesTooltip;
  1380. return w.toggleClass("ds-expanded").hasClass("ds-expanded") ? (s || (s = S.smiliesTooltip = new st.SmiliesTooltip, s.render(), S.require("smilies",
  1381. function() {
  1382. s.reset("微博-默认")
  1383. })), s.replybox = i, s.el.appendTo(t.body).css({
  1384. top: i.el.offset().top + i.el.outerHeight() + 4 + "px",
  1385. left: i.el.find(".ds-textarea-wrapper").offset().left + "px"
  1386. }), B(t.body).click(x)) : x(e),
  1387. !1
  1388. }),
  1389. x = (g.find(".ds-add-image").click(function(e) {
  1390. var s = k[0],
  1391. a = s.value,
  1392. i = "请输入图片地址",
  1393. r = '<img src="' + i + '" />';
  1394. if (t.selection) {
  1395. s.value = a.substring(0, k.data("ds-range-start")) + r + a.substring(k.data("ds-range-end"), a.length),
  1396. s.value = s.value.replace("说点什么吧 ...", ""),
  1397. s.focus();
  1398. var n = t.selection.createRange();
  1399. n.collapse(),
  1400. n.findText(i),
  1401. n.select()
  1402. } else {
  1403. s.value = a.substring(0, s.selectionStart) + r + a.substring(s.selectionEnd);
  1404. var o = s.value.search(i);
  1405. s.setSelectionRange(o, o + i.length),
  1406. s.focus()
  1407. }
  1408. e.preventDefault()
  1409. }), i.hideSmilies = function() {
  1410. w.removeClass("ds-expanded"),
  1411. S.smiliesTooltip.el.detach(),
  1412. B(t.body).unbind("click", x)
  1413. }),
  1414. T = function(e, t) {
  1415. var s = E(et["dialog-anonymous"]({
  1416. services: ["weixin", "weibo", "qq", "renren", "kaixin", "douban"],
  1417. options: c
  1418. })),
  1419. a = s.el.find(".ds-dialog").css("width", "320px");
  1420. if (a.find(".ds-icons-32 a").click(l), !c.deny_anonymous) {
  1421. var i = s.el.find("form");
  1422. i.submit(function() {
  1423. var e = i.find("input[name=author_email]").val();
  1424. return ! e && !c.require_guest_email || e.match(/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/) ? (t(S.toJSON(i)), s.close(), !1) : (alert("请输入一个有效的email地址."), !1)
  1425. }),
  1426. i.find("input[name=author_name]")[0].focus()
  1427. }
  1428. };
  1429. c.deny_anonymous && k.focus(function() {
  1430. if (r()) {
  1431. T(b, q);
  1432. var e = function(t) {
  1433. t.stopPropagation(),
  1434. k.unbind("click", e)
  1435. };
  1436. k.click(e)
  1437. }
  1438. return ! 1
  1439. });
  1440. var q = function(e) {
  1441. s(b),
  1442. A.post("posts/create", B.extend(S.toJSON(b), e),
  1443. function(e) {
  1444. var t = lt[e.response.post_id] = new F(e.response),
  1445. s = U(i.postList, t, c);
  1446. if ("asc" == c.order == ("top" == c.formPosition) && S.scrollTo(s), o.data.comments++, o.updateCounter("duoshuo"), k.val("").trigger("keyup"), a(b), g.hasClass("ds-inline-replybox") && (g.detach(), i.actionsBar.removeClass("ds-reply-active")), m) try {
  1447. m.removeItem("ds_draft_" + o.threadId)
  1448. } catch(r) {}
  1449. },
  1450. function(e) {
  1451. a(b),
  1452. alert(e.errorMessage)
  1453. })
  1454. };
  1455. b.submit(function() {
  1456. if (b.data("submitting")) return ! 1;
  1457. var e = B.trim(b[0].message.value);
  1458. return "" == e || !P.placeholder && e == k.attr("placeholder") ? (alert("您还没写内容呢"), !1) : (r() ? T(b, q) : q(), !1)
  1459. });
  1460. var C = function(e) {
  1461. return B(e).hasClass("ds-service-icon-grey") ? null: B(e).attr("data-service")
  1462. };
  1463. if (_.click(function() {
  1464. return B(this).toggleClass("ds-service-icon-grey").toggleClass("ds-service-icon"),
  1465. y.value = B.map(_, C).join(","),
  1466. y.checked = "" != y.value,
  1467. !1
  1468. }), B(y).change(function() {
  1469. var e = this.checked;
  1470. _[e ? "removeClass": "addClass"]("ds-service-icon-grey")[e ? "addClass": "removeClass"]("ds-service-icon"),
  1471. this.value = B.map(_, C).join(",")
  1472. }), !e && m) {
  1473. var j = "ds_draft_" + o.threadId;
  1474. k.bind("focus blur keyup",
  1475. function(e) {
  1476. var t = B(e.currentTarget).val();
  1477. try {
  1478. m[j] = t
  1479. } catch(e) {}
  1480. }),
  1481. m[j] && k.val(m[j])
  1482. }
  1483. return this
  1484. }
  1485. },
  1486. st.Dialog = J.extend({
  1487. init: function(e, t) { (this.el = B("#ds-wrapper"))[0] || (this.el = p(B('<div id="ds-wrapper"></div>'))),
  1488. this.options = B.extend({
  1489. width: 600
  1490. },
  1491. t),
  1492. e !== s && B(e).attr("id", "ds-reset").appendTo(this.el)
  1493. },
  1494. open: function() {
  1495. function e(e) {
  1496. return 27 == e.which ? (a.close(), !1) : void 0
  1497. }
  1498. function s() {
  1499. return a.close(),
  1500. !1
  1501. }
  1502. var a = this;
  1503. return a.el.hide().appendTo(t.body).fadeIn(200),
  1504. P.ie6 && a.el.css("top", V.scrollTop() + 100),
  1505. a.el.show().find(".ds-dialog").delegate("a.ds-dialog-close", "click",
  1506. function() {
  1507. return a.close(),
  1508. !1
  1509. }).click(i),
  1510. Y.keydown(e),
  1511. B(t.body).click(s),
  1512. a.close = function() {
  1513. Y.unbind("keydown", e),
  1514. B(t.body).unbind("click", s),
  1515. a.el.fadeOut(200,
  1516. function() {
  1517. B(this).remove()
  1518. }),
  1519. a.trigger("close")
  1520. },
  1521. a
  1522. }
  1523. }),
  1524. et.likePanel = function(e) {
  1525. return e.likes ? '<span class="ds-highlight">' + e.likes + "</span> 人喜欢": ""
  1526. },
  1527. st.Meta = function(e) {
  1528. this.embedThread = e
  1529. },
  1530. st.Meta.prototype = {
  1531. render: function() {
  1532. function a(a) {
  1533. function r(e) {
  1534. o.set(e),
  1535. n.resetLikePanel()
  1536. }
  1537. function c() {
  1538. n.tooltip.detach(),
  1539. B(t.body).unbind("click", c)
  1540. }
  1541. function u(t) {
  1542. switch (this.className) {
  1543. case "ds-like-tooltip-close":
  1544. c(t);
  1545. break;
  1546. default:
  1547. if (!e.open(this.href, "_blank", "height=500,width=600,top=0,left=0,toolbar=no,menubar=no,resizable=yes,location=yes,status=no")) return
  1548. }
  1549. return ! 1
  1550. }
  1551. var p = l.hasClass("ds-thread-liked");
  1552. if (A.post("threads/vote", {
  1553. thread_id: n.embedThread.threadId,
  1554. vote: p ? 0 : 1
  1555. },
  1556. r), l.toggleClass("ds-thread-liked"), l.find(".ds-thread-like-text").text(p ? "喜欢": "已喜欢"), p) return n.tooltip && c(a),
  1557. !1;
  1558. if (n.tooltip === s) {
  1559. var h = et.likeTooltip({
  1560. services: {
  1561. qzone: "QQ空间",
  1562. weibo: "新浪微博",
  1563. qqt: "腾讯微博",
  1564. renren: "人人网",
  1565. kaixin: "开心网",
  1566. douban: "豆瓣网",
  1567. baidu: "百度搜藏"
  1568. },
  1569. thread_id: o.data.thread_id
  1570. });
  1571. n.tooltip = B(h).click(i).delegate("a", "click", u)
  1572. }
  1573. var f = {};
  1574. return f.left = 0,
  1575. f.top = d.position().top + d.outerHeight() - 4 + "px",
  1576. n.tooltip.appendTo(n.embedThread.innerEl).css(f),
  1577. B(t.body).click(c),
  1578. !1
  1579. }
  1580. var n = this,
  1581. o = n.embedThread.model,
  1582. d = n.el = B(et.meta(o.toJSON())),
  1583. l = d.find(".ds-like-thread-button");
  1584. return l.click(a),
  1585. n.resetLikePanel(),
  1586. r() && d.hide(),
  1587. n
  1588. },
  1589. resetLikePanel: function() {
  1590. this.el.find(".ds-like-panel").html(et.likePanel(this.embedThread.model.toJSON()))
  1591. }
  1592. },
  1593. st.PostListHead = function(e) {
  1594. this.embedThread = e
  1595. },
  1596. st.PostListHead.prototype = {
  1597. render: function() {
  1598. function e(e) {
  1599. r.find("a.ds-current").removeClass("ds-current"),
  1600. a.params.page = 1;
  1601. var t = e.currentTarget;
  1602. switch (t.className) {
  1603. case "ds-comments-tab-duoshuo":
  1604. a.params.source = "duoshuo",
  1605. s.replybox.el.show();
  1606. break;
  1607. case "ds-comments-tab-repost":
  1608. a.params.source = "repost",
  1609. s.replybox.el.hide();
  1610. break;
  1611. case "ds-comments-tab-weibo":
  1612. a.params.source = "weibo",
  1613. s.replybox.el.hide();
  1614. break;
  1615. case "ds-comments-tab-qqt":
  1616. a.params.source = "qqt",
  1617. s.replybox.el.hide()
  1618. }
  1619. return B(t).addClass("ds-current"),
  1620. a.refetch(),
  1621. !1
  1622. }
  1623. function t() {
  1624. return n.find("a.ds-current").removeClass("ds-current"),
  1625. a.params.order = s.options.order = this.className.replace("ds-order-", ""),
  1626. a.params.page = 1,
  1627. a.refetch(),
  1628. B(this).addClass("ds-current"),
  1629. !1
  1630. }
  1631. var s = this.embedThread,
  1632. a = s.postList,
  1633. i = this.el = B(et.postListHead({
  1634. thread: s.model.toJSON(),
  1635. options: s.options
  1636. })),
  1637. r = i.find("ul.ds-comments-tabs");
  1638. r.delegate(".ds-tab a", "click", e);
  1639. var n = i.find(".ds-sort");
  1640. return n.delegate("a", "click", t),
  1641. n.find(".ds-order-" + a.params.order).addClass("ds-current"),
  1642. this
  1643. }
  1644. },
  1645. st.Paginator = function(e) {
  1646. function t() {
  1647. return i.params.page = parseInt(this.innerHTML),
  1648. i.refetch(),
  1649. a.find(".ds-current").removeClass("ds-current"),
  1650. B(this).addClass("ds-current"),
  1651. !1
  1652. }
  1653. e = e || {};
  1654. var s = this,
  1655. a = s.el = e.el || B('<div class="ds-paginator"></div>'),
  1656. i = s.collection = e.collection;
  1657. a.delegate("a", "click", t)
  1658. },
  1659. st.Paginator.prototype = {
  1660. reset: function(e) {
  1661. function t(e) {
  1662. i.push('<a data-page="' + e + '" href="javascript:void(0);">' + e + "</a>")
  1663. }
  1664. var s, a = this.collection.params.page || 1,
  1665. i = [];
  1666. if (a > 1) for (t(1), s = a > 4 ? a - 2 : 2, s > 2 && i.push('<span class="page-break">...</span>'); a > s; s++) t(s);
  1667. if (i.push('<a data-page="' + a + '" href="javascript:void(0);" class="ds-current">' + a + "</a>"), a < e.pages) {
  1668. for (s = a + 1; a + 4 >= s && s < e.pages; s++) t(s);
  1669. s < e.pages && i.push('<span class="page-break">...</span>'),
  1670. t(e.pages)
  1671. }
  1672. this.el.html('<div class="ds-border"></div>' + i.join(" "))[e.pages > 1 ? "show": "hide"]()
  1673. }
  1674. },
  1675. S.addSmilies = function(e, t) {
  1676. var s = S.smiliesTooltip;
  1677. s && s.el.find("ul.ds-smilies-tabs").append("<li><a>" + e + "</a></li>"),
  1678. S.smilies[e] = t
  1679. },
  1680. st.SmiliesTooltip = function() {},
  1681. st.SmiliesTooltip.prototype = {
  1682. render: function() {
  1683. function e() {
  1684. var e = s.replybox,
  1685. a = e.el.find("textarea"),
  1686. i = a[0],
  1687. r = i.value;
  1688. if (t.selection) {
  1689. i.value = r.substring(0, a.data("ds-range-start")) + this.title + r.substring(a.data("ds-range-end"), r.length),
  1690. i.value = i.value.replace(z.leave_a_message, ""),
  1691. i.focus();
  1692. var n = t.selection.createRange();
  1693. n.moveStart("character", a.data("ds-range-start") + this.title.length),
  1694. n.collapse(),
  1695. n.select()
  1696. } else {
  1697. var o = i.selectionStart + this.title.length;
  1698. i.value = r.substring(0, i.selectionStart) + this.title + r.substring(i.selectionEnd),
  1699. i.setSelectionRange(o, o)
  1700. }
  1701. e.hideSmilies(),
  1702. i.focus()
  1703. }
  1704. var s = this,
  1705. a = s.el = B(et.smiliesTooltip(L));
  1706. return a.click(i).find("ul.ds-smilies-tabs").delegate("a", "click",
  1707. function() {
  1708. s.reset(this.innerHTML)
  1709. }),
  1710. a.find(".ds-smilies-container").delegate("img", "click", e),
  1711. this
  1712. },
  1713. reset: function(e) {
  1714. function t(t, s) {
  1715. var i = 0 === e.indexOf("微博") ? "http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/" + s.replace("_org", "_thumb") : S.STATIC_URL + "/images/smilies/" + s;
  1716. "WordPress" === e && (t = " " + t + " "),
  1717. a += '<li><img src="https://www.solomp.com/custom/catimg.php?src=' + i + '" title="' + _(t) + '" /></li>'
  1718. }
  1719. var s = this.el.find("ul.ds-smilies-tabs");
  1720. s.find("a.ds-current").removeClass("ds-current"),
  1721. s.find("a").filter(function() {
  1722. return this.innerHTML == e
  1723. }).addClass("ds-current");
  1724. var a = "<ul>";
  1725. return B.each(L[e], t),
  1726. a += "</ul>",
  1727. this.el.find(".ds-smilies-container").html(a),
  1728. this
  1729. }
  1730. },
  1731. et.postPlaceholder = function() {
  1732. return ['<li class="ds-post ds-post-placeholder">', z.no_comments_yet, "</li>"].join("")
  1733. };
  1734. var X = B('<div id="ds-bubble"><div class="ds-bubble-content"></div><div class="ds-arrow ds-arrow-down ds-arrow-border"></div><div class="ds-arrow ds-arrow-down"></div></div>'),
  1735. K = X.find(".ds-bubble-content").delegate("a.ds-ctx-open", "click",
  1736. function() {
  1737. function e(e) {
  1738. function t(e, t) {
  1739. return et.ctxPost({
  1740. post: e,
  1741. index: t
  1742. })
  1743. }
  1744. C.log(B.map(e.response, t).join("\n"));
  1745. s.el.find("ol");
  1746. s.el.find("ol").html(B.map(e.response, t).join("\n"))
  1747. }
  1748. var t = {};
  1749. t.post_id = K.attr("data-post-id"),
  1750. A.get("posts/conversation", t, e);
  1751. var s = E('<h2>查看对话</h2><ol id="ds-ctx"></ol>');
  1752. return s.el.find(".ds-dialog").css("width", "600px"),
  1753. s.el.find(".ds-dialog-body").css({
  1754. "max-height": "350px",
  1755. _height: "350px",
  1756. "overflow-y": "auto",
  1757. "padding-top": "10px"
  1758. }),
  1759. !1
  1760. }),
  1761. tt = bubbleOutTimer = 0;
  1762. X.mouseenter(N).mouseleave(I),
  1763. st.PostList = function(e) {
  1764. e && (e.params && (this.params = e.params), e.embedThread && (this.embedThread = e.embedThread)),
  1765. this.el = B('<ul class="ds-comments"></ul>')
  1766. },
  1767. st.PostList.prototype = {
  1768. url: "threads/listPosts",
  1769. render: function() {
  1770. return R.call(this.el, this.embedThread, this.embedThread.options),
  1771. this
  1772. },
  1773. reset: function(e) {
  1774. var t = this.embedThread.options;
  1775. this.el.html(e[0] ? B.map(lt.getJSON(e),
  1776. function(e) {
  1777. return et.post({
  1778. post: e,
  1779. options: t
  1780. })
  1781. }).join("") : et.postPlaceholder())
  1782. },
  1783. refetch: function() {
  1784. function e(e) {
  1785. lt.set(e.parentPosts || e.relatedPosts),
  1786. ct.set(e.users),
  1787. s.reset(e.response),
  1788. s.embedThread.paginator.reset(e.cursor),
  1789. s.el.fadeTo(200, 1),
  1790. S.scrollTo(s.el),
  1791. a.remove()
  1792. }
  1793. var s = this,
  1794. a = B(et.indicator()).appendTo(t.body).fadeIn(200);
  1795. s.el.fadeTo(200, .5),
  1796. A.get(s.url, s.params, e)
  1797. }
  1798. },
  1799. st.EmbedThread = Q.extend({
  1800. uri: "threads/listPosts",
  1801. params: "thread-id local-thread-id source-thread-id thread-key category channel-key author-key author-id url limit order max-depth form-position container-url" + (v.match(/MSIE 6\.0/) ? "": " title image thumbnail"),
  1802. render: function() {
  1803. var e = this.el;
  1804. if ("请将此处替换成文章在你的站点中的ID" === e.data("thread-key")) return alert("请设置正确的 data-thread-key 属性"),
  1805. !1;
  1806. e.attr("id", "ds-thread").append(et.waitingImg());
  1807. var t = e.width(),
  1808. s = e.data("url") || !e.attr("data-thread-id") && B("link[rel=canonical]").attr("href");
  1809. s ? e.data("url", k(s)) : e.data("container-url", h.href),
  1810. t && 400 >= t && e.addClass("ds-narrow").data("max-depth", 1)
  1811. },
  1812. updateCounter: function(e) {
  1813. function t(e) {
  1814. return e.substr(e.indexOf("}") + 1)
  1815. }
  1816. var s = {
  1817. duoshuo: ["comments", t(z.comments_multiple) || "评论"],
  1818. repost: ["reposts", t(z.reposts_multiple) || "转载"],
  1819. weibo: ["weibo_reposts", t(z.weibo_reposts_multiple) || "新浪微博"],
  1820. qqt: ["qqt_reposts", t(z.qqt_reposts_multiple) || "腾讯微博"]
  1821. };
  1822. for (var a in s) if (!e || e == a) {
  1823. var i = this.data[s[a][0]];
  1824. this.el.find(".ds-comments-tab-" + a).html(this.el.hasClass("ds-narrow") ? '<span class="ds-service-icon ds-' + a + '"></span>' + i: (i ? '<span class="ds-highlight">' + i + "</span>": "0") + s[a][1])
  1825. }
  1826. },
  1827. onError: function(e) {
  1828. this.el.html("评论框出错啦(" + e.code + "): " + e.errorMessage)
  1829. },
  1830. onload: function(t) {
  1831. var a = this,
  1832. i = a.threadId = t.thread.thread_id,
  1833. n = t.cursor,
  1834. o = a.options = t.options,
  1835. d = a.innerEl = p(B('<div id="ds-reset"></div>').appendTo(a.el));
  1836. a.model = new G(a.data = t.thread),
  1837. lt.set(t.parentPosts || t.relatedPosts),
  1838. ct.set(t.users),
  1839. a.el.find("#ds-waiting").remove(),
  1840. o.like_thread_enabled && (a.meta = new st.Meta(a), d.append(a.meta.render().el)),
  1841. o.hot_posts && t.hotPosts && t.hotPosts.length && (a.hotPosts = new st.HotPosts(B('<div class="ds-rounded"></div>'), {
  1842. max_depth: 1,
  1843. show_context: o.show_context
  1844. }), a.hotPosts.thread = a, d.append(a.hotPosts.el), a.hotPosts.onload({
  1845. list: lt.getJSON(t.hotPosts)
  1846. })),
  1847. a.postListHead = new st.PostListHead(a),
  1848. a.postList = new st.PostList({
  1849. embedThread: a,
  1850. params: {
  1851. source: "duoshuo",
  1852. thread_id: i,
  1853. max_depth: o.max_depth,
  1854. order: o.order,
  1855. limit: o.limit
  1856. }
  1857. }),
  1858. a.postList.render().reset(t.response),
  1859. a.paginator = new st.Paginator({
  1860. collection: a.postList
  1861. }),
  1862. a.paginator.reset(n);
  1863. var c = a.replybox = new st.Replybox(a);
  1864. c.postList = a.postList.el,
  1865. r() ? a.loginButtons = B(et.loginButtons()).delegate("a.ds-more-services", "click",
  1866. function() {
  1867. return a.loginButtons.find(".ds-additional-services").toggle(),
  1868. !1
  1869. }).delegate("a.ds-service-link", "click", l) : a.toolbar = B(et.toolbar()).delegate(".ds-account-control", "mouseenter",
  1870. function() {
  1871. B(this).addClass("ds-active")
  1872. }).delegate(".ds-account-control", "mouseleave",
  1873. function() {
  1874. B(this).removeClass("ds-active")
  1875. }).delegate("a.ds-bind-more", "click",
  1876. function() {
  1877. var e = E(et["dialog-bind-more"]()).el.find(".ds-dialog").addClass("ds-dialog-bind-more").css("width", "300px");
  1878. return e.find("a.ds-service-link").click(l),
  1879. !1
  1880. }).delegate("a.ds-unread-comments-count", "click",
  1881. function() {
  1882. return T("unread-comments"),
  1883. !1
  1884. });
  1885. var u = ['<a name="respond"></a>', a.toolbar || a.loginButtons, c.render().el];
  1886. "top" == o.formPosition && B.fn.append.apply(d, u),
  1887. d.append(a.postListHead.render().el, a.postList.el, a.paginator.el),
  1888. "bottom" == o.formPosition && B.fn.append.apply(d, u),
  1889. d.append(et.poweredBy(o.poweredby_text)),
  1890. a.updateCounter(),
  1891. t.alerts && B.each(t.alerts,
  1892. function(e, t) {
  1893. B('<div class="ds-alert">' + t + "</div>").insertBefore(a.toolbar || loginButtons)
  1894. }),
  1895. o.message && c.el.find("textarea").val(o.message).focus(),
  1896. ot.on("reset",
  1897. function() {
  1898. var e = ot.data.comments || 0;
  1899. d.find("a.ds-unread-comments-count").html(e).attr("title", e ? "你有" + e + "条新回复": "你没有新回复").css("display", e ? "inline": "none")
  1900. }),
  1901. o.mzadx_id && (S.require("mzadxN",
  1902. function() {}), B('<div id="MZADX_' + o.mzadx_id + '" style="margin:0 auto;"></div>').appendTo(d), __mz_rpq = e.__mz_rpq || [], __mz_rpq.push({
  1903. l: [o.mzadx_id],
  1904. r: "1",
  1905. _srv: "MZADX",
  1906. _callback: function() {}
  1907. })),
  1908. S.thread = a,
  1909. ot.data !== s && ot.trigger("reset"),
  1910. r() || M.send({
  1911. visit_thread_id: a.threadId
  1912. })
  1913. },
  1914. onMessage: function(e) {
  1915. U(this.postList.el, new F(e), this.options)
  1916. }
  1917. }),
  1918. st.HotPosts = Q.extend({
  1919. tmpl: "hotPosts",
  1920. params: "show-quote",
  1921. render: function() {
  1922. return this.el.attr("id", "ds-hot-posts"),
  1923. this
  1924. },
  1925. onload: function(e) {
  1926. e.options = B.extend(this.options, e.options),
  1927. Q.prototype.onload.call(this, e),
  1928. R.call(this.el.find("ul"), this.thread, this.options)
  1929. }
  1930. }),
  1931. st.RecentComments = Q.extend({
  1932. tmpl: "commentList",
  1933. uri: "sites/listRecentPosts",
  1934. params: "show-avatars show-time show-title avatar-size show-admin excerpt-length num-items channel-key",
  1935. render: function() {
  1936. this.el.attr("id", "ds-recent-comments")
  1937. },
  1938. prepare: function(e) {
  1939. return {
  1940. list: B.map(e.response,
  1941. function(e) {
  1942. return new F(e).toJSON()
  1943. })
  1944. }
  1945. }
  1946. }),
  1947. st.RecentVisitors = Q.extend({
  1948. tmpl: "recentVisitors",
  1949. uri: "sites/listVisitors",
  1950. params: "show-time avatar-size num-items channel-key",
  1951. render: function() {
  1952. this.el.children().detach(),
  1953. this.el.attr("id", "ds-recent-visitors").append(this.waitingEl = B(et.waitingImg()))
  1954. }
  1955. }),
  1956. st.TopThreads = Q.extend({
  1957. tmpl: "topThreads",
  1958. uri: "sites/listTopThreads",
  1959. params: "range num-items channel-key",
  1960. render: function() {
  1961. this.el.children().detach(),
  1962. this.el.attr("id", "ds-top-threads").append(this.waitingEl = B(et.waitingImg()))
  1963. }
  1964. }),
  1965. st.LoginWidget = Q.extend({
  1966. tmpl: "loginWidget",
  1967. render: function() {
  1968. var e = this.el;
  1969. e.attr("id", "ds-login").html(et.loginWidget(["weixin", "weibo", "qq", "renren", "kaixin", "douban"])),
  1970. e.find("a").click(l),
  1971. e.find("a.ds-logout").attr("href", Z.logoutUrl())
  1972. }
  1973. }),
  1974. st.ThreadCount = Q.extend({
  1975. onload: function(e) {
  1976. var t = this.el,
  1977. s = t.data("count-type") || "comments",
  1978. a = e.data[s];
  1979. t[t.data("replace") ? "replaceWith": "html"](z[s + "_" + (a ? a > 1 ? "multiple": "one": "zero")].replace("{num}", a))
  1980. }
  1981. }),
  1982. st.ShareWidget = Q.extend({
  1983. tmpl: "shareWidget",
  1984. render: function() {
  1985. var e = {
  1986. copyright: "多说分享插件",
  1987. services: ["weibo", "qzone", "sohu", "renren", "netease", "qqt", "kaixin", "douban", "qq", "meilishuo", "mogujie", "baidu", "taobao", "google", "wechat", "diandian", "huaban", "duitang", "youdao", "pengyou", "facebook", "twitter", "linkedin", "msn"]
  1988. };
  1989. this.el.attr("id", "ds-share"),
  1990. this.el.children().attr("id", "ds-reset"),
  1991. this.el.find(".ds-share-aside-inner").html(et.shareWidget(e)),
  1992. this.el.find(".ds-share-icons-more").html(et.shareWidget(e)),
  1993. this.el.find(".ds-share-icons-more").hide(),
  1994. this.el.hasClass("flat") && this.el.find("a").each(function() {
  1995. B(this).addClass("flat")
  1996. }),
  1997. p(this.el),
  1998. this.delegateEvents()
  1999. },
  2000. delegateEvents: function() {
  2001. var s = this,
  2002. i = s.el;
  2003. if (i.children().hasClass("ds-share-inline")) {
  2004. var r = ".ds-share-icons-more",
  2005. n = i.find(r),
  2006. d = "[data-toggle=ds-share-icons-more]";
  2007. i.delegate(d, "mouseover",
  2008. function() {
  2009. n.show()
  2010. }),
  2011. i.delegate(d, "mouseout",
  2012. function() {
  2013. n.hide()
  2014. }),
  2015. i.delegate(r, "mouseover",
  2016. function() {
  2017. n.show()
  2018. }),
  2019. i.delegate(r, "mouseout",
  2020. function() {
  2021. n.hide()
  2022. })
  2023. } else {
  2024. var l = i.children().hasClass("ds-share-aside-left") ? "slide-to-right": "slide-to-left",
  2025. c = i.children();
  2026. if (!o.cssProperty("transition")) {
  2027. var u = i.children().hasClass("ds-share-aside-left") ? "left": "right";
  2028. i.delegate(".ds-share-aside-toggle", "mouseover",
  2029. function() {
  2030. var e = {},
  2031. s = P.ie6 && "right" === u;
  2032. s ? e.left = (t.documentElement.scrollLeft + t.documentElement.clientWidth - this.offsetWidth - (parseInt(this.currentStyle.marginLeft, 10) || 0) - parseInt(this.currentStyle.marginRight, 10) || 0) - 195 : e[u] = 0,
  2033. c.animate(e, 200)
  2034. }),
  2035. i.delegate(".ds-share-aside-inner", "mouseleave",
  2036. function() {
  2037. var e = {},
  2038. s = P.ie6 && "right" === u;
  2039. s ? e.left = (t.documentElement.scrollLeft + t.documentElement.clientWidth - this.offsetWidth - (parseInt(this.currentStyle.marginLeft, 10) || 0) - parseInt(this.currentStyle.marginRight, 10) || 0) + 230 : e[u] = -229,
  2040. c.animate(e, 200)
  2041. })
  2042. }
  2043. i.delegate(".ds-share-aside-toggle,.ds-share-aside-inner", "mouseover",
  2044. function() {
  2045. c.addClass(l)
  2046. }),
  2047. i.delegate(".ds-share-aside-toggle,.ds-share-aside-inner", "mouseleave",
  2048. function() {
  2049. c.removeClass(l)
  2050. })
  2051. }
  2052. i.delegate("a", "click",
  2053. function(t) {
  2054. var s = B(this).data("service");
  2055. if (!i.data("url")) return void alert("请设置data-url");
  2056. if ("wechat" === s) {
  2057. var r = a() + "/api/qrcode/getImage.png",
  2058. n = "?size=240&text=" + i.data("url"),
  2059. d = E(et["dialog-qrcode"]({
  2060. qrcode_url: r + n,
  2061. url: i.data("url")
  2062. }));
  2063. d.el.find(".ds-dialog").css("width", "320px")
  2064. } else {
  2065. var l = a() + "/share-proxy/?" + o.param({
  2066. service: B(this).data("service"),
  2067. thread_key: i.data("threadKey"),
  2068. title: i.data("title"),
  2069. images: i.data("images"),
  2070. content: i.data("content"),
  2071. url: i.data("url")
  2072. });
  2073. e.open(l, "_blank")
  2074. }
  2075. t.preventDefault(),
  2076. t.stopPropagation()
  2077. })
  2078. }
  2079. });
  2080. var it = 0;
  2081. S.initSelector = function(e, t) {
  2082. function s(e) {
  2083. W(e),
  2084. o.extend(z, e.options),
  2085. dt.set(e.response)
  2086. }
  2087. var a = []; ! q() || !B.isReady && j || B(e).each(function(e, s) {
  2088. var i = B(s);
  2089. if (!i.data("initialized")) {
  2090. i.data("initialized", !0);
  2091. var r = new st[t.type](i, t);
  2092. if (at.push(r), "ThreadCount" === t.type) {
  2093. var n = i.attr("data-thread-key");
  2094. i.attr("data-channel-key") && (n = i.attr("data-channel-key") + ":" + n),
  2095. a.push(n),
  2096. dt[n] || (dt[n] = new G({})),
  2097. dt[n].on("reset",
  2098. function() {
  2099. r.onload(this)
  2100. })
  2101. } else if (r.uri) {
  2102. var o = {};
  2103. B.each(r.params.split(" "),
  2104. function(e, t) {
  2105. o[t.replace(/-/g, "_")] = i.attr("data-" + t) || i.data(t)
  2106. }),
  2107. A.get(r.uri, H(o),
  2108. function(e) {
  2109. r.load(e)
  2110. })
  2111. }
  2112. }
  2113. }),
  2114. a.length && A.get("threads/counts", H({
  2115. threads: a.join(",")
  2116. }), s)
  2117. },
  2118. (S.initView = function() {
  2119. B.each(O, S.initSelector)
  2120. })(),
  2121. B(function() {
  2122. if (!c) {
  2123. if (!q()) return C.error("缺少 duoshuoQuery 的定义");
  2124. C.warn("请在加载多说 embed.js 之前定义 duoshuoQuery")
  2125. }
  2126. setInterval(function() {
  2127. B(".ds-time").each(function() {
  2128. var e = B(this).attr("datetime");
  2129. e && (this.innerHTML = S.elapsedTime(e))
  2130. })
  2131. },
  2132. 2e4),
  2133. c.ondomready && c.ondomready(),
  2134. S.initView(),
  2135. !it && c.short_name && A.get("analytics/ping", H({}), W)
  2136. })
  2137. })
  2138. }
  2139. } (window, document);