Hormold

VK Change (#1383899403)

Nov 8th, 2013
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 23.34 KB | None | 0 0
  1. Файл - wall.js (Старый размер - 19289 | Новый - 0):
  2. 0.  - var FullWall = {
  3. 1.  -   getsect: function() {
  4. 2.  -     var current = ge('full_wall_filters').firstChild;
  5. 3.  -     for (; !hasClass(current, 'active_link') && current;) {
  6. 4.  -       current = current.nextSibling;
  7. 5.  -     }
  8. 6.  -     return current;
  9. 7.  -   },
  10. 8.  -   failed: function(old, text) {
  11. 9.  -     FullWall.getsect().className = '';
  12. 10.  -     if (old) old.className = 'active_link';
  13. 11.  -     if (!text) return;
  14. 12.  -
  15. 13.  -     setTimeout(showFastBox(getLang('global_error'), text).hide, 2000);
  16. 14.  -     return true;
  17. 15.  -   },
  18. 16.  -   go: function(el, ev) {
  19. 17.  -     var current = FullWall.getsect();
  20. 18.  -     var result = nav.go(el, ev, {onFail: FullWall.failed.pbind(current)});
  21. 19.  -     if (result === false) {
  22. 20.  -       if (current) current.className = '';
  23. 21.  -       el.parentNode.className = 'active_link';
  24. 22.  -     }
  25. 23.  -   },
  26. 24.  -   scrollCheck: function(e, st) {
  27. 25.  -     var ch = lastWindowHeight, top, ntop = 0, el, nel, bits, posts = [];
  28. 26.  -     if (domPN(cur.topRow) != cur.pgCont) {
  29. 27.  -       cur.topRow = domFC(cur.pgCont);
  30. 28.  -     }
  31. 29.  -     if (
  32. 30.  -       !vk.id ||
  33. 31.  -       !cur.topRow ||
  34. 32.  -       ((window.curNotifier || {}).idle_manager || {}).is_idle
  35. 33.  -     ) {
  36. 34.  -       return;
  37. 35.  -     }
  38. 36.  -     for (el = domPS(cur.topRow); el && cur.topRow.offsetTop > st; el = domPS(el)) cur.topRow = el;
  39. 37.  -     for (el = cur.topRow; el; el = nel) {
  40. 38.  -       top = ntop ? ntop : el.offsetTop;
  41. 39.  -       if (top >= st + ch) break;
  42. 40.  -
  43. 41.  -       nel = domNS(el);
  44. 42.  -
  45. 43.  -       ntop = nel ? nel.offsetTop : top + el.offsetHeight;
  46. 44.  -       if (ntop < st && nel) cur.topRow = nel;
  47. 45.  -
  48. 46.  -       bits = el.bits || 0;
  49. 47.  -       if (bits >= 3) continue;
  50. 48.  -
  51. 49.  -       if (bits |= ((top >= st && top < st + ch) ? 1 : 0) | ((ntop >= st && ntop < st + ch) ? 2 : 0)) {
  52. 50.  -         el.bits = bits;
  53. 51.  -         if (bits == 3) {
  54. 52.  -           posts.push(FullWall.postsGetRaws(el));
  55. 53.  -         }
  56. 54.  -       }
  57. 55.  -     }
  58. 56.  -     Page.postsSeen(posts);
  59. 57.  -   },
  60. 58.  -   postsGetRaws: function(el) {
  61. 59.  -     var m, res = {};
  62. 60.  -     if (m = el.id.match(new RegExp('^post(' + cur.oid + '_\\d+)$', ''))) {
  63. 61.  -       res[m[1]] = 1;
  64. 62.  -       if (m = (el.getAttribute('data-copy') || '').match(/^(-?\d+_\d+)$/)) {
  65. 63.  -         res[m[1]] = -1;
  66. 64.  -       }
  67. 65.  -     }
  68. 66.  -     return res;
  69. 67.  -   },
  70. 68.  -   init: function(opts, preload) {
  71. 69.  -     extend(cur, {
  72. 70.  -       options: opts,
  73. 71.  -       module: 'wall',
  74. 72.  -
  75. 73.  -       pgStart: opts.start,
  76. 74.  -       pgOffset: opts.offset,
  77. 75.  -       pgCount: opts.count,
  78. 76.  -       pgPerPage: opts.per_page,
  79. 77.  -       pgCont: ge('page_wall_posts'),
  80. 78.  -       pgMore: ge('fw_load_more'),
  81. 79.  -       pgPages: ge('fw_pages'),
  82. 80.  -       pgMorePrg: ge('fw_more_progress'),
  83. 81.  -       pgPreload: preload,
  84. 82.  -       pgUrl: opts.url,
  85. 83.  -       pgOnScroll: FullWall.scrollCheck,
  86. 84.  -
  87. 85.  -       pgParams: opts.params,
  88. 86.  -       pgHref: opts.href,
  89. 87.  -
  90. 88.  -       pgPostProcess: FullWall.loadedPosts,
  91. 89.  -       pgNoArrowNav: FullWall.noArrowNav,
  92. 90.  -
  93. 91.  -       oid: opts.owner_id,
  94. 92.  -       postTo: opts.owner_id,
  95. 93.  -       fullPostView: true
  96. 94.  -     });
  97. 95.  -     wall.init(opts);
  98. 96.  -     if (!opts.wall_type || opts.wall_type != 'cards' && opts.wall_type != 'supp' && opts.wall_type != 'phone_info') {
  99. 97.  -       Pagination.init();
  100. 98.  -     }
  101. 99.  -     cur.destroy.push(Pagination.deinit);
  102. 100.  -     if (opts.with_id) return;
  103. 101.  -
  104. 102.  -     if (opts.search) {
  105. 103.  -       var searchEl = ge('wall_search');
  106. 104.  -       placeholderSetup(searchEl, {back: 1});
  107. 105.  -       addEvent(searchEl, 'keydown', function (e) {
  108. 106.  -         if (e.keyCode == KEY.RETURN) {
  109. 107.  -           FullWall.doSearch();
  110. 108.  -           searchEl.blur();
  111. 109.  -           return cancelEvent(e);
  112. 110.  -         }
  113. 111.  -       });
  114. 112.  -       elfocus(searchEl);
  115. 113.  -       setTimeout(elfocus.pbind(searchEl), 100);
  116. 114.  -       if (val(searchEl)) show('wall_reset_search');
  117. 115.  -     }
  118. 116.  -
  119. 117.  -     wall.initUpdates(opts.add_queue_key);
  120. 118.  -     if (opts.wall_type && (opts.wall_type == 'cards' || opts.wall_type == 'supp' || opts.wall_type == 'phone_info')) return;
  121. 119.  -     cur.nav.push(function(changed, current, next) {
  122. 120.  -       var own = changed.own;
  123. 121.  -       delete(changed.own);
  124. 122.  -       delete(changed.offset);
  125. 123.  -       if (!isEmpty(changed) || own === undefined) return;
  126. 124.  -       ajax.post('al_wall.php', {
  127. 125.  -         act: 's',
  128. 126.  -         owner_id: cur.oid,
  129. 127.  -         own: next.own || undefined,
  130. 128.  -         lnav: 1,
  131. 129.  -         offset: next.offset || undefined
  132. 130.  -       }, {onDone: function(summary, rows, names, href, start, offset, perpage, count, preload, queue) {
  133. 131.  -         ge('fw_summary_wrap').innerHTML = summary;
  134. 132.  -         Pagination.deinit();
  135. 133.  -         extend(cur, {
  136. 134.  -           pgStart: start,
  137. 135.  -           pgOffset: offset,
  138. 136.  -           pgCount: count,
  139. 137.  -           pgParams: next.own ? {own: 1} : false,
  140. 138.  -           pgHref: href,
  141. 139.  -           pgPages: ge('fw_pages'),
  142. 140.  -           pgPreload: preload
  143. 141.  -         });
  144. 142.  -         toggle(cur.pgMore, (count > offset + cur.pgPerPage));
  145. 143.  -         wall.cancelEdit();
  146. 144.  -         var posts = ge('page_wall_posts');
  147. 145.  -         posts.innerHTML = rows;
  148. 146.  -         each(geByTag('textarea', posts), function() { placeholderSetup(this, {fast: 1}); });
  149. 147.  -         Pagination.init();
  150. 148.  -         wall.initUpdates(queue);
  151. 149.  -
  152. 150.  -         for (var mid in names) {
  153. 151.  -           cur.options.reply_names[mid] = names[mid];
  154. 152.  -         }
  155. 153.  -
  156. 154.  -         cur.wallType = 'full_' + (next.own ? 'own' : 'all');
  157. 155.  -         nav.setLoc(next);
  158. 156.  -
  159. 157.  -         scrollToTop();
  160. 158.  -
  161. 159.  -         ge('wall_' + (next.own ? 'all' : 'own') + '_filter').className = '';
  162. 160.  -         var selFilter = ge('wall_' + (next.own ? 'own' : 'all') + '_filter');
  163. 161.  -         selFilter.className = 'active_link';
  164. 162.  -       }, showProgress: function() {
  165. 163.  -         hide('full_wall_return', 'fw_search_toggler');
  166. 164.  -         show('full_wall_progress');
  167. 165.  -       }, hideProgress: function() {
  168. 166.  -         hide('full_wall_progress');
  169. 167.  -         show('full_wall_return', 'fw_search_toggler');
  170. 168.  -       }, onFail: FullWall.failed.pbind(FullWall.getsect())});
  171. 169.  -       return false;
  172. 170.  -     });
  173. 171.  -   },
  174. 172.  -   loadedPosts: function(count, from, rows, offset, pages, preload, names) {
  175. 173.  -     if (preload) {
  176. 174.  -       each(geByTag('textarea', cur.pgCont), function() { placeholderSetup(this, {fast: 1}); });
  177. 175.  -       wall.cancelEdit();
  178. 176.  -     } else {
  179. 177.  -       var l = cur.pgCont.childNodes.length, i = 0;
  180. 178.  -       for (var el = cur.pgCont.lastChild; el && ++i <= cur.pgPerPage; el = el.previousSibling) {
  181. 179.  -         placeholderSetup(geByTag1('textarea', el), {fast: 1});
  182. 180.  -       }
  183. 181.  -       names = offset;
  184. 182.  -     }
  185. 183.  -     for (var mid in names) {
  186. 184.  -       cur.options.reply_names[mid] = names[mid];
  187. 185.  -     }
  188. 186.  -     FullWall.updateSummary(count);
  189. 187.  -   },
  190. 188.  -   updateSummary: function(count) {
  191. 189.  -     var ds = re('wall_datesearch_wrap');
  192. 190.  -     if (count > 1) {
  193. 191.  -       ge('fw_summary').innerHTML = getLang('wall_x_posts_at_all', count, true);
  194. 192.  -     } else if (count > 0) {
  195. 193.  -       ge('fw_summary').innerHTML = getLang('wall_one_post');
  196. 194.  -     } else {
  197. 195.  -       ge('fw_summary').innerHTML = getLang('wall_no_posts');
  198. 196.  -     }
  199. 197.  -     if (ds) ge('fw_summary').appendChild(ds);
  200. 198.  -   },
  201. 199.  -   noArrowNav: function() {
  202. 200.  -     return cur.__focused || (ge('own_reply_field') || {}).focused || cur.editingPost;
  203. 201.  -   },
  204. 202.  -
  205. 203.  -   initOnePost: function(opts, preload) {
  206. 204.  -     Page.postsSeen(opts.seen);
  207. 205.  -     extend(cur, {
  208. 206.  -       onepost: true,
  209. 207.  -       options: opts,
  210. 208.  -       module: 'wall',
  211. 209.  -
  212. 210.  -       docked: false,
  213. 211.  -
  214. 212.  -       addField: ge('fwr_text'),
  215. 213.  -       addBlock: ge('fwr_form'),
  216. 214.  -       addBlockWrap: ge('fwr_wrap'),
  217. 215.  -
  218. 216.  -       pgStart: opts.start,
  219. 217.  -       pgOffset: opts.offset,
  220. 218.  -       pgCount: opts.count,
  221. 219.  -       pgPerPage: opts.per_page,
  222. 220.  -       pgCont: ge('fw_replies_rows'),
  223. 221.  -       pgMore: ge('fwp_load_more'),
  224. 222.  -       pgPages: ge('fw_pages'),
  225. 223.  -       pgMorePrg: ge('fw_more_progress'),
  226. 224.  -       pgPreload: preload,
  227. 225.  -       pgUrl: opts.url,
  228. 226.  -       pgParams: opts.params,
  229. 227.  -       pgHref: opts.href,
  230. 228.  -
  231. 229.  -       pgPostProcess: FullWall.loadedReplies,
  232. 230.  -       pgOnScroll: FullWall.onePostOnScroll,
  233. 231.  -       pgNoArrowNav: FullWall.noArrowNav,
  234. 232.  -
  235. 233.  -       oid: opts.owner_id,
  236. 234.  -       pid: opts.post_id,
  237. 235.  -       nid: opts.note_id,
  238. 236.  -       fullPostView: true,
  239. 237.  -       named: {replies: ge('fw_one_replies_wrap')}
  240. 238.  -     });
  241. 239.  -     wall.init(opts);
  242. 240.  -
  243. 241.  -     if (cur.addField) {
  244. 242.  -       placeholderSetup(cur.addField);
  245. 243.  -       autosizeSetup(cur.addField, {minHeight: opts.note ? 62 : 42, maxHeight: 300});
  246. 244.  -       addEvent(cur.addField, 'change keydown keyup paste', FullWall.replyFieldUpdated);
  247. 245.  -
  248. 246.  -       var mediaTypes = [];
  249. 247.  -       each (cur.options.rmedia_types, function () {
  250. 248.  -         if (inArray(this[0], ['photo', 'video', 'audio', 'doc', 'link', 'page'])) {
  251. 249.  -           mediaTypes.push(this);
  252. 250.  -         }
  253. 251.  -       });
  254. 252.  -       var media;
  255. 253.  -       if (mediaTypes.length) {
  256. 254.  -         media = {
  257. 255.  -           lnk: ge('fwr_reply_media_lnk').firstChild,
  258. 256.  -           preview: ge('fwr_reply_media_preview'),
  259. 257.  -           types: mediaTypes,
  260. 258.  -           options: {limit: 2, disabledTypes: ['album'], toggleLnk: true}
  261. 259.  -         };
  262. 260.  -       }
  263. 261.  -       Wall.initComposer(cur.addField, {
  264. 262.  -         lang: {
  265. 263.  -           introText: getLang('profile_mention_start_typing'),
  266. 264.  -           noResult: getLang('profile_mention_not_found')
  267. 265.  -         },
  268. 266.  -         media: media
  269. 267.  -       });
  270. 268.  -       FullWall.replyFieldUpdated();
  271. 269.  -     }
  272. 270.  -     Pagination.init(opts.scroll);
  273. 271.  -     cur.destroy.push(Pagination.deinit);
  274. 272.  -
  275. 273.  -     wall.initUpdates(opts.add_queue_key);
  276. 274.  -   },
  277. 275.  -   scrollToEnd: function() {
  278. 276.  -     var st = cur.addBlockTop + cur.addBlockHeight + 20 - lastWindowHeight;
  279. 277.  -     if (scrollGetY() < st) {
  280. 278.  -       Pagination.setScroll(st);
  281. 279.  -     }
  282. 280.  -   },
  283. 281.  -   replyFieldUpdated: function() {
  284. 282.  -     if (!cur.addField) return;
  285. 283.  -
  286. 284.  -     var newt = val(cur.addField), newh = getSize(cur.addBlock)[1];
  287. 285.  -     var ch = (cur.addBlockHeight != newh), ct = (cur.addText != newt);
  288. 286.  -     if (ch) {
  289. 287.  -       cur.addBlockHeight = newh;
  290. 288.  -       cur.addBlockWrap.style.height = newh + 'px';
  291. 289.  -     }
  292. 290.  -     if (ct) {
  293. 291.  -       cur.addText = newt;
  294. 292.  -     }
  295. 293.  -     if (ch || ct) {
  296. 294.  -       FullWall.onePostOnScroll(false, false, true);
  297. 295.  -     }
  298. 296.  -   },
  299. 297.  -   onePostResetStyle: function() {
  300. 298.  -     cur.addBlock.style.left = '';
  301. 299.  -   },
  302. 300.  -   onePostOnScroll: function(e, st, pp) {
  303. 301.  -     if (!cur.addField) return;
  304. 302.  -
  305. 303.  -     if (st === false || st === undefined) {
  306. 304.  -       st = scrollGetY();
  307. 305.  -     }
  308. 306.  -     if (pp === true) {
  309. 307.  -       cur.addBlockTop = getXY(cur.addBlockWrap)[1];
  310. 308.  -       if (browser.msie6) cur.addBlockTop += st;
  311. 309.  -     }
  312. 310.  -     var needDock = (cur.addText || cur.addForce) && (st + lastWindowHeight < cur.addBlockTop + cur.addBlockHeight);
  313. 311.  -     if (needDock && !cur.docked) {
  314. 312.  -       cur.addBlock.className = 'fixed';
  315. 313.  -       if (browser.msie6) {
  316. 314.  -         bodyNode.appendChild(cur.addBlock);
  317. 315.  -         e = {type: 'resize'};
  318. 316.  -       }
  319. 317.  -       cur.docked = true;
  320. 318.  -       show('fwr_cancel');
  321. 319.  -       cur.addForce = true;
  322. 320.  -     } else if (!needDock && cur.docked) {
  323. 321.  -       FullWall.cancelAddReply();
  324. 322.  -     }
  325. 323.  -     if (cur.docked && e && e.type == 'resize') {
  326. 324.  -       if (browser.msie6) {
  327. 325.  -         cur.addBlock.style.left = getXY(ge('content'))[0] + 'px';
  328. 326.  -       } else {
  329. 327.  -         cur.addBlock.style.left = (ge('page_layout').offsetLeft + ge('content').offsetLeft) + 'px';
  330. 328.  -         setTimeout(FullWall.onePostResetStyle, 0);
  331. 329.  -       }
  332. 330.  -     }
  333. 331.  -   },
  334. 332.  -   loadedReplies: function(count, from, rows, offset, pages, preload, names) {
  335. 333.  -     if (!preload) {
  336. 334.  -       names = offset;
  337. 335.  -     }
  338. 336.  -     for (var mid in names) {
  339. 337.  -       cur.options.reply_names[mid] = names[mid];
  340. 338.  -     }
  341. 339.  -     FullWall.onePostOnScroll(false, false, true);
  342. 340.  -     FullWall.repliesSummary(count);
  343. 341.  -   },
  344. 342.  -   repliesSummary: function(count) {
  345. 343.  -     var summary = ge('fw_summary');
  346. 344.  -     summary.innerHTML = count ? getLang('wall_n_replies', count) : getLang('wall_no_replies');
  347. 345.  -     show(summary.parentNode);
  348. 346.  -   },
  349. 347.  -   sendReply: function() {
  350. 348.  -     var rf = ge('fwr_text'),
  351. 349.  -         composer = rf && data(rf, 'composer'),
  352. 350.  -         params = composer ? Composer.getSendParams(composer, FullWall.sendReply) : {message: trim(val(rf))},
  353. 351.  -         replyName = cur.reply_to && cur.options.reply_names[cur.reply_to[0]],
  354. 352.  -         state;
  355. 353.  -
  356. 354.  -     if (params.delayed) {
  357. 355.  -       return;
  358. 356.  -     }
  359. 357.  -
  360. 358.  -     if (!params.attach1_type) {
  361. 359.  -       if (!params.message ||
  362. 360.  -           isArray(replyName) && !replyName[1].indexOf(params.message)) {
  363. 361.  -         elfocus(rf);
  364. 362.  -         return;
  365. 363.  -       }
  366. 364.  -     }
  367. 365.  -
  368. 366.  -     rf.blur();
  369. 367.  -     cur.wallMyReplied[cur.oid + '_' + cur.pid] = 1;
  370. 368.  -     cur.wallMyOpened[cur.oid + '_' + cur.pid] = 1;
  371. 369.  -     if (cur.pid) {
  372. 370.  -       var replyTo = cur.oid + '_' + cur.pid;
  373. 371.  -     } else {
  374. 372.  -       var replyTo = cur.oid + '_note' + cur.nid;
  375. 373.  -     }
  376. 374.  -
  377. 375.  -     if (composer) {
  378. 376.  -       state = Composer.reset(composer);
  379. 377.  -     } else {
  380. 378.  -       val(rf, '');
  381. 379.  -     }
  382. 380.  -
  383. 381.  -     extend(params, {
  384. 382.  -       act: 'post',
  385. 383.  -       type: cur.wallType,
  386. 384.  -       reply_to: replyTo,
  387. 385.  -       reply_to_msg: val('fwr_to'),
  388. 386.  -       reply_to_user: cur.reply_to && cur.reply_to[0] || 0,
  389. 387.  -       last: ((cur.pgCont.lastChild || {}).id || '').split('_')[1],
  390. 388.  -       from_group: isChecked('fwr_as_group'),
  391. 389.  -       hash: cur.options.post_hash
  392. 390.  -     });
  393. 391.  -     ajax.post('al_wall.php', params, {
  394. 392.  -       onDone: function(count, from, rows, offset, pages, preload, names) {
  395. 393.  -         cur.wallMyReplied[cur.oid + '_' + cur.pid] = 0;
  396. 394.  -         Pagination.loaded.apply(window, arguments);
  397. 395.  -         FullWall.cancelAddReply(true);
  398. 396.  -         setTimeout(FullWall.scrollToEnd, 0);
  399. 397.  -         if (pages && offset) {
  400. 398.  -           nav.setLoc(extend(nav.objLoc, {offset: offset}));
  401. 399.  -         }
  402. 400.  -       },
  403. 401.  -       onFail: function () {
  404. 402.  -         if (composer) {
  405. 403.  -           Composer.restore(composer, state);
  406. 404.  -         }
  407. 405.  -       },
  408. 406.  -       showProgress: lockButton.pbind(ge('fwr_send')),
  409. 407.  -       hideProgress: unlockButton.pbind(ge('fwr_send'))
  410. 408.  -     });
  411. 409.  -   },
  412. 410.  -   cancelAddReply: function(clear) {
  413. 411.  -     cur.addForce = false;
  414. 412.  -     hide('fwr_cancel');
  415. 413.  -     cur.addBlock.className = '';
  416. 414.  -     if (browser.msie6) {
  417. 415.  -       cur.addBlockWrap.appendChild(cur.addBlock);
  418. 416.  -     }
  419. 417.  -     cur.docked = false;
  420. 418.  -     if (clear === true) {
  421. 419.  -       val(cur.addField, '');
  422. 420.  -       hide('fwr_warn');
  423. 421.  -       cur.addField.autosize.update();
  424. 422.  -       FullWall.cancelReplyTo();
  425. 423.  -       FullWall.replyFieldUpdated();
  426. 424.  -     }
  427. 425.  -   },
  428. 426.  -
  429. 427.  -   replyTo: function(post, toMsgId, toId, event) {
  430. 428.  -     event = normEvent(event);
  431. 429.  -     val('fwr_to', toMsgId);
  432. 430.  -     var replyName = cur.options.reply_names[toId], cancel = '<span class="fwr_no_to" onclick="FullWall.cancelReplyTo(); elfocus(\'fwr_text\');"></span>';
  433. 431.  -     if (isArray(replyName)) {
  434. 432.  -       val('fwr_to_title', replyName[0] + cancel);
  435. 433.  -       var rf = ge('fwr_text'), replyNameOld = cur.reply_to && cur.options.reply_names[cur.reply_to[0]], v = trim(val(rf));
  436. 434.  -       if (!v || replyNameOld && isArray(replyNameOld) && !replyNameOld[1].indexOf(v)) {
  437. 435.  -         val(rf, !checkEvent(event) ? replaceEntities(replyName[1]) : '');
  438. 436.  -         FullWall.replyFieldUpdated();
  439. 437.  -       }
  440. 438.  -     } else {
  441. 439.  -       val('fwr_to_title', replyName + cancel);
  442. 440.  -     }
  443. 441.  -     cur.reply_to = [toId, toMsgId];
  444. 442.  -     cur.addForce = true;
  445. 443.  -     FullWall.onePostOnScroll();
  446. 444.  -     setTimeout(elfocus.pbind(cur.addField), 0);
  447. 445.  -     return false;
  448. 446.  -   },
  449. 447.  -   cancelReplyTo: function() {
  450. 448.  -     var rf = ge('fwr_text'), replyNameOld = cur.reply_to && cur.options.reply_names[cur.reply_to[0]], v = trim(val(rf));
  451. 449.  -     val('fwr_to_title', '');
  452. 450.  -     val('fwr_to', '');
  453. 451.  -     cur.reply_to = false;
  454. 452.  -     if (!v || replyNameOld && isArray(replyNameOld) && !replyNameOld[1].indexOf(v)) {
  455. 453.  -       val(rf, '');
  456. 454.  -       FullWall.replyFieldUpdated();
  457. 455.  -     }
  458. 456.  -   },
  459. 457.  -   deletePost: function(post, hash) {
  460. 458.  -     return FullWall.replyAction('delete', post, hash);
  461. 459.  -   },
  462. 460.  -   markAsSpam: function(post, hash) {
  463. 461.  -     return FullWall.replyAction('spam', post, hash);
  464. 462.  -   },
  465. 463.  -   restorePost: function(post, hash, root) {
  466. 464.  -     if (!root) {
  467. 465.  -       if (cur.pid) {
  468. 466.  -         root = (post == cur.oid + '_' + cur.pid);
  469. 467.  -       } else {
  470. 468.  -         root = (post == cur.oid + 'note_' + cur.nid);
  471. 469.  -       }
  472. 470.  -     }
  473. 471.  -     ajax.post('al_wall.php', {act: 'restore', post: post, hash: hash, root: root ? 1 : 0}, {onDone: function() {
  474. 472.  -       var p = root ? ge('fw_post') : ge('post' + post);
  475. 473.  -       if (!p || isVisible(p.firstChild)) return;
  476. 474.  -       if (root) {
  477. 475.  -         cur.pgPaused = false;
  478. 476.  -         show('fwr_wrap', 'fw_one_replies_wrap', 'post_publish' + post);
  479. 477.  -       } else {
  480. 478.  -         Pagination.recache(1);
  481. 479.  -         FullWall.repliesSummary(cur.pgCount);
  482. 480.  -       }
  483. 481.  -       show(p.firstChild);
  484. 482.  -       re(p.firstChild.nextSibling);
  485. 483.  -     }});
  486. 484.  -   },
  487. 485.  -   replyAction: function(act, post, hash, force) {
  488. 486.  -     if (cur.pid) {
  489. 487.  -       var root = (post == cur.oid + '_' + cur.pid);
  490. 488.  -     } else {
  491. 489.  -       var root = (post == cur.oid + 'note_' + cur.nid);
  492. 490.  -     }
  493. 491.  -     cur.wallMyDeleted[post] = act == 'restore' ? 0 : 1;
  494. 492.  -     ajax.post('al_wall.php', {act: act, post: post, hash: hash, from: 'full', root: root ? 1 : 0, confirm: force ? 1 : 0}, {onDone: function(msg, deleted, need_confirm) {
  495. 493.  -       if (need_confirm && act == 'delete') {
  496. 494.  -         var box = showFastBox(msg, need_confirm, getLang('global_delete'), function() { box.hide(); FullWall.replyAction(act, post, hash, 1); }, getLang('box_cancel'));
  497. 495.  -         return;
  498. 496.  -       }
  499. 497.  -       var p = root ? ge('fw_post') : ge('post' + post);
  500. 498.  -       if (!p) return;
  501. 499.  -       if (root) {
  502. 500.  -         cur.pgPaused = true;
  503. 501.  -         hide('fwr_wrap', 'fw_one_replies_wrap', 'post_publish' + post);
  504. 502.  -       }
  505. 503.  -       if (p.firstChild.nextSibling) {
  506. 504.  -         p.firstChild.nextSibling.innerHTML = msg;
  507. 505.  -       } else {
  508. 506.  -         p.appendChild(ce('div', {id: 'post_del' + post, innerHTML: msg, className: 'fw_deleted'}));
  509. 507.  -         hide(p.firstChild);
  510. 508.  -         if (deleted && !root) {
  511. 509.  -           Pagination.recache(-1);
  512. 510.  -           FullWall.repliesSummary(cur.pgCount);
  513. 511.  -         }
  514. 512.  -       }
  515. 513.  -     }, progress: ge('wpe_prg' + post) || geByClass1('fw_reply_prg', ge('post' + post))});
  516. 514.  -   },
  517. 515.  -
  518. 516.  -   addTetaTet: function(repls, ev) {
  519. 517.  -     var upd = {
  520. 518.  -       own_reply_link: '',
  521. 519.  -       tet_a_tet: ''
  522. 520.  -     };
  523. 521.  -     if (ev[9] && ev[9] != ev[2].split('_')[0] && cur.wallTpl.tet_a_tet) {
  524. 522.  -       upd.tet_a_tet = cur.wallTpl.tet_a_tet.replace('%from_uid%', ev[9]);
  525. 523.  -     } else {
  526. 524.  -       upd.own_reply_link = cur.wallTpl.own_reply_link.replace('%post_id%', ev[2]);
  527. 525.  -     }
  528. 526.  -     // debugLog(ev[9], ev[2], cur.wallTpl.tet_a_tet, upd);
  529. 527.  -     return upd;
  530. 528.  -   },
  531. 529.  -
  532. 530.  -   notePart: function(obj, obj_id) {
  533. 531.  -     hide(obj);
  534. 532.  -     show(obj_id);
  535. 533.  -   },
  536. 534.  -
  537. 535.  -   doSearch: function () {
  538. 536.  -     var q = trim(val('wall_search'));
  539. 537.  -     if (nav.objLoc[0].split('/').length > 1) {
  540. 538.  -       nav.change({0: 'wall'+cur.oid, q: q || false, search: !q && 1, offset: false});
  541. 539.  -     } else {
  542. 540.  -       nav.change({q: q || false, search: !q && 1, offset: false});
  543. 541.  -     }
  544. 542.  -     lockButton('wall_search_btn');
  545. 543.  -   },
  546. 544.  -   fixPost: function (link, post, hash, value) {
  547. 545.  -     ajax.post('al_wall.php', {act: 'a_fix_post', post: post, hash: hash, value: value}, {
  548. 546.  -       progress: ge('wpe_prg' + post),
  549. 547.  -       onDone: function () {
  550. 548.  -         val(link, getLang(value ? 'wall_unfix_post' : 'wall_fix_post'));
  551. 549.  -         link.onclick = function () {
  552. 550.  -           return FullWall.fixPost(link, post, hash, value ? 0 : 1);
  553. 551.  -         }
  554. 552.  -       }
  555. 553.  -     });
  556. 554.  -     return false;
  557. 555.  -   },
  558. 556.  -   calendar: function() {
  559. 557.  -     stManager.add(['ui_controls.js', 'datepicker.js', 'datepicker.css'], function() {
  560. 558.  -       if (!cur.wallDP) {
  561. 559.  -         cur.wallSD = val('wall_datesearch');
  562. 560.  -         cur.wallDP = new Datepicker(ge('wall_datesearch'), {
  563. 561.  -           width: 140,
  564. 562.  -           resfmt: 'plain',
  565. 563.  -           addRows: nav.objLoc.day ? '<tr><td class="wall_cal_clear" colspan="7"><a onclick="nav.change({day: false, offset: false, search: nav.objLoc.q ? false : 1})" id="wall_cal_clear_lnk">' + getLang('wall_clear_date_filter') + '</a></td></tr>' : '',
  566. 564.  -           onUpdate: function() {
  567. 565.  -             if (cur.wallSD != val('wall_datesearch')) {
  568. 566.  -               var nd = val('wall_datesearch').split('.');
  569. 567.  -               nav.change({'day': (nd[0] < 10 ? '0' : '') + nd[0] + (nd[1] < 10 ? '0' : '') + nd[1] + nd[2], search: false, offset: false});
  570. 568.  -             }
  571. 569.  -           }
  572. 570.  -         });
  573. 571.  -       }
  574. 572.  -       triggerEvent(geByClass1('datepicker_control', ge('wall_datesearch_cont')), 'mousedown', false, true);
  575. 573.  -       ge('wall_datesearch_cal_box').style[vk.rtl ? 'right' : 'left'] = Math.floor((ge('wall_datesearch_lnk').offsetWidth - ge('wall_datesearch_cal_div').offsetWidth) / 2 + ge('wall_datesearch_lnk')[vk.rtl ? 'offsetRight' : 'offsetLeft']) + 'px';
  576. 574.  -       ge('wall_datesearch_cal_box').style.marginTop = '-2px';
  577. 575.  -     });
  578. 576.  -   }
  579. 577.  - }
  580. 578.  -
  581. 579.  - try{stManager.done('wall.js');}catch(e){}
  582. ------
Advertisement
Add Comment
Please, Sign In to add comment