Hormold

VK Change (#1386696609)

Dec 10th, 2013
600
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 226.45 KB | None | 0 0
  1. Файл - photoview.js (Старый размер - 115247 | Новый - 0):
  2. 0.  - var Photoview = {
  3. 1.  -   blank: '/images/blank.gif',
  4. 2.  -   blankf: function() {},
  5. 3.  -   cacheSize: 3,
  6. 4.  -   allSizes: ['x', 'y', 'z'/*, 'w'*/],
  7. 5.  -   genUrl: function(base, add) {
  8. 6.  -     if (!add.match(/\.[a-z]{3}$/i)) add += '.jpg';
  9. 7.  -     if (add.match(/https?:\/\//i)) return add;
  10. 8.  -     return (base || '').replace(/\/[a-z0-9_:\.]*$/i, '') + '/' + add;
  11. 9.  -   },
  12. 10.  -   genData: function(ph, size) {
  13. 11.  -     var f = (size == 'x') ? 3 : ((size == 'y') ? 2 : ((size == 'z') ? 1 : 0)), c = ['w', 'z', 'y', 'x'].slice(f), d, s, i, l;
  14. 12.  -     for (i = 0; i < 4 - f; ++i) {
  15. 13.  -       l = c[i];
  16. 14.  -       if (d = ph[l + '_']) break;
  17. 15.  -       if (s = ph[l + '_src']) break;
  18. 16.  -     }
  19. 17.  -     if (!d) d = [s];
  20. 18.  -     return {src: Photoview.genUrl(ph.base, d[0]), width: d[2] && d[1], height: d[1] && d[2]};
  21. 19.  -   },
  22. 20.  -
  23. 21.  -   updateArrows: function() {
  24. 22.  -     var sbw = sbWidth() + 2;
  25. 23.  -     if (cur.pvLeft) {
  26. 24.  -       cur.pvLeft.style.left = '20px';//(Math.floor((lastWindowWidth - sbw - cur.pvActualWidth - 52) / 2) - 39) + 'px';
  27. 25.  -     }
  28. 26.  -     cur.pvLeftNav.style.width = Math.floor((lastWindowWidth - sbw - cur.pvActualWidth - 52) / 2) + 'px';
  29. 27.  -     cur.pvRightNav.style.left = Math.floor((lastWindowWidth - sbw + cur.pvActualWidth + 52) / 2) + 'px';
  30. 28.  -     cur.pvRightNav.style.width = Math.floor((lastWindowWidth - sbw - cur.pvActualWidth - 52) / 2) + 'px';
  31. 29.  -     if (cur.pvClose) {
  32. 30.  -       cur.pvClose.style.left = (lastWindowWidth - sbw - 2 - 37) + 'px';//(Math.floor((lastWindowWidth - sbw + cur.pvActualWidth + 52) / 2) + 22) + 'px';
  33. 31.  -     }
  34. 32.  -   },
  35. 33.  -   updateHeight: function() {
  36. 34.  -     var h = cur.pvBox.offsetHeight + 110, sbw = Math.floor(sbWidth() / 2);
  37. 35.  -     cur.pvLeftNav.style.height = cur.pvRightNav.style.height = (h - 110) + 'px';
  38. 36.  -     window.updateWndVScroll && updateWndVScroll();
  39. 37.  -     if (!browser.mobile) return;
  40. 38.  -     var skipTop = 10 + cur.pvYOffset;
  41. 39.  -     cur.pvLeft.style.top = cur.pvClose.style.top = (cur.pvYOffset + 25) + 'px';
  42. 40.  -     if (lastWindowHeight < cur.pvYOffset + h) {
  43. 41.  -       setTimeout(function() {
  44. 42.  -         var f = ge('footer');
  45. 43.  -         f.style.height = (intval(getStyle(f, 'height')) + (cur.pvYOffset + h - lastWindowHeight)) + 'px';
  46. 44.  -         onBodyResize();
  47. 45.  -         Photoview.onResize();
  48. 46.  -       }, 1);
  49. 47.  -     }
  50. 48.  -   },
  51. 49.  -   actionInfo: function() {
  52. 50.  -     return ge('pv_action_info') || cur.pvWide.insertBefore(ce('div', {id: 'pv_action_info'}), cur.pvTags);
  53. 51.  -   },
  54. 52.  -
  55. 53.  -   locNav: function(ch, old, nw, opts) {
  56. 54.  -     if ((cur.pvListId == 'newtag' + vk.id + (nw.rev ? '/rev' : '')) && (nw[0] == 'albums' + vk.id) && (nw.act == 'added')) {
  57. 55.  -       Photoview.hide(opts.hist);
  58. 56.  -       return false;
  59. 57.  -     }
  60. 58.  -     nw = nav.toStr(nw);
  61. 59.  -     if (nw.replace('?rev=1', '/rev') == cur.pvListId && cur.pvShown) {
  62. 60.  -       Photoview.hide(opts.hist);
  63. 61.  -       return false;
  64. 62.  -     }
  65. 63.  -     var m = nw.match(/^photo(-?\d+_\d+)\??((all=1|newtag=\d+)(&rev=1)?|(rev=1&)?tag=\d+|rev=1)?$/);
  66. 64.  -     if (!m) return;
  67. 65.  -
  68. 66.  -     var listId = cur.pvListId;
  69. 67.  -     if (!listId || !cur.pvShown) {
  70. 68.  -       if (nav.objLoc.act == 'added') {
  71. 69.  -         listId = 'newtag' + vk.id + (nav.objLoc.rev ? '/rev' : '');
  72. 70.  -       } else {
  73. 71.  -         listId = nav.strLoc.replace('?rev=1', '/rev');
  74. 72.  -       }
  75. 73.  -     }
  76. 74.  -     var data = cur.pvData[listId];
  77. 75.  -     if (!data) return;
  78. 76.  -
  79. 77.  -     for (var i = 0, l = data.length; i < l; ++i) {
  80. 78.  -       if (data[i] && data[i].id == m[1]) {
  81. 79.  -         Photoview.show(listId, i, false, cur.pvRoot);
  82. 80.  -         return false;
  83. 81.  -       }
  84. 82.  -     }
  85. 83.  -   },
  86. 84.  -   updateLocNav: function() {
  87. 85.  -     if (cur.pvRoot) {
  88. 86.  -       for (var i = 0, l = cur.nav.length; i < l; ++i) {
  89. 87.  -         if (cur.nav[i] == Photoview.locNav) return;
  90. 88.  -       }
  91. 89.  -       cur.nav.push(Photoview.locNav);
  92. 90.  -     } else {
  93. 91.  -       for (var i = 0, l = cur.nav.length; i < l; ++i) {
  94. 92.  -         if (cur.nav[i] == Photoview.locNav) {
  95. 93.  -           cur.nav.splice(i, 1);
  96. 94.  -           --i; --l;
  97. 95.  -         }
  98. 96.  -       }
  99. 97.  -     }
  100. 98.  -   },
  101. 99.  -
  102. 100.  -   checkLayerVisibility: function() {
  103. 101.  -     if (cur.pvShown) return true;
  104. 102.  -
  105. 103.  -     debugLog('layerqueue.hide from photoview');
  106. 104.  -     layerQueue.hide();
  107. 105.  -
  108. 106.  -     addEvent(window, 'resize', Photoview.onResize);
  109. 107.  -     addEvent(document, 'keydown', Photoview.onKeyDown);
  110. 108.  -     addEvent(layerWrap, 'click', Photoview.onClick);
  111. 109.  -     boxQueue.hideAll();
  112. 110.  -     setStyle(layerBG, {opacity: ''});
  113. 111.  -     layers.show();
  114. 112.  -     layers.fullhide = Photoview.hide;
  115. 113.  -   },
  116. 114.  -   createLayer: function() {
  117. 115.  -     var colorClass = vk.pvdark ? 'pv_dark' : 'pv_light';
  118. 116.  -
  119. 117.  -     cur.pvFixed = bodyNode.appendChild(ce('div', {className: 'pv_fixed fixed ' + colorClass, innerHTML: '\
  120. 118.  - <div class="pv_left no_select" onmousedown="Photoview.show(false, cur.pvIndex - 1, event);" onmouseover="Photoview.activate(this)" onmouseout="Photoview.deactivate(this)"><div></div></div>\
  121. 119.  - <div class="pv_close no_select" onmouseover="Photoview.activate(this)" onmouseout="Photoview.deactivate(this)" onmousedown="cur.pvClicked = true; Photoview.onClick(event, true);"><div></div></div>\
  122. 120.  -     '}));
  123. 121.  -
  124. 122.  -     cur.pvLeft = cur.pvFixed.firstChild;
  125. 123.  -     cur.pvClose = cur.pvLeft.nextSibling;
  126. 124.  -
  127. 125.  -     addClass(layerWrap, colorClass);
  128. 126.  -     addClass(layerBG, colorClass);
  129. 127.  -     vkImage().src = '/images/upload.gif';
  130. 128.  -
  131. 129.  -     var hhHide = Photoview.hhCheck() ? '' : ' style="display: none;"',
  132. 130.  -         albumsHtml = cur.pvAlbumsShown ? cur.pvAlbumsData[cur.pvAlbumsShown].html : '',
  133. 131.  -         albumHtml = cur.pvAlbumShown ? cur.pvAlbumData[cur.pvAlbumShown].html : '',
  134. 132.  -         pvVTagsHtml = cur.pvVideoTagsShown ? cur.pvVideoTagsData.html : '',
  135. 133.  -         pwStyle = cur.pvVideoTagsShown || cur.pvAlbumsShown || cur.pvAlbumShown || cur.pvPhotoTagShown ? 'display: none' : '',
  136. 134.  -         awStyle = cur.pvAlbumsShown ? '' : 'display: none',
  137. 135.  -         sawStyle = cur.pvAlbumShown ? '' : 'display: none',
  138. 136.  -         vtStyle = cur.pvVideoTagsShown ? '' : 'display: none';
  139. 137.  -     if (cur.pvPhotoTagShown) {
  140. 138.  -       albumHtml = cur.pvPhotoTagData[cur.pvPhotoTagShown].html;
  141. 139.  -       sawStyle = '';
  142. 140.  -     }
  143. 141.  -
  144. 142.  -     layer.innerHTML = '\
  145. 143.  - <div class="pv_cont">\
  146. 144.  - \
  147. 145.  - <table cellspacing="0" cellpadding="0">\
  148. 146.  - <tr><td class="sidesh s1"><div></div></td><td>\
  149. 147.  - <table cellspacing="0" cellpadding="0">\
  150. 148.  - <tr><td class="sidesh s2"><div></div></td><td>\
  151. 149.  - <table cellspacing="0" cellpadding="0">\
  152. 150.  - <tr><td colspan="3" class="bottomsh s3"><div></div></td></tr>\
  153. 151.  - <tr><td class="sidesh s3"><div></div></td><td>\
  154. 152.  - \
  155. 153.  - <div id="pv_box" onclick="cur.pvClicked = true;">\
  156. 154.  -   <a class="fl_r pv_close_link" onclick="Photoview.hide(0)">' + getLang('global_close') + '</a>\
  157. 155.  -   <div id="pv_summary"><span class="summary"></span></div>\
  158. 156.  -   <div id="pv_photo_wrap" style="' + pwStyle + '">\
  159. 157.  -     <div id="pv_tag_info" class="clear_fix"></div>\
  160. 158.  -     <div class="no_select pv_data">\
  161. 159.  -       <div id="pv_tag_frame"></div>\
  162. 160.  -       <div id="pv_tag_faded"></div>\
  163. 161.  -       <div id="pv_tag_person" onmouseout="Photoview.hideTag()"></div>\
  164. 162.  -       <div id="pv_loader"></div>\
  165. 163.  -       <div class="pvs_hh"' + hhHide + ' id="pv_hh"><div class="pvs_hh_cover"><div class="pvs_hh_bg"></div><div class="pvs_hh_fg" id="pv_hh_fg" onmouseover="Photoview.hhOver(this)" onmouseout="Photoview.hhOut(this)" onmousedown="return Photoview.hhClick(this, event, 1)"></div></div></div>\
  166. 164.  -       <a onmouseout="Photoview.hideTag()" onmousedown="if (!cur.pvTagger && checkEvent(event) === false) return Photoview.show(false, cur.pvIndex + 1, event);" onselectstart="return cancelEvent(event);" onclick="return checkEvent(event)" href="" id="pv_photo"></a>\
  167. 165.  -     </div>\
  168. 166.  -     <div class="clear_fix select_fix" id="pv_comments_data">\
  169. 167.  -       <div class="fl_l wide_column">\
  170. 168.  -         <div id="pv_wide"></div>\
  171. 169.  -         <div id="pv_your_comment" class="clear clear_fix" onclick="return cancelEvent(event);">\
  172. 170.  -           <div id="pv_comment_header">' + getLang('photos_yourcomment') + '</div>\
  173. 171.  -           <textarea id="pv_comment" onkeyup="Photoview.commentChanged()" onkeypress="onCtrlEnter(event, Photoview.sendComment);"></textarea>\
  174. 172.  -           <div id="pv_comment_warn"></div>\
  175. 173.  -           <div id="pv_media_preview" class="clear_fix"></div>\
  176. 174.  -           <div id="pv_comment_submit">\
  177. 175.  -             <div class="button_blue fl_l"><button id="pv_comment_send">' + getLang('box_send') + '</button></div>\
  178. 176.  -             <div id="pv_reply_as_group" class="checkbox fl_l" onclick="checkbox(this)">\
  179. 177.  -               <div></div>' + getLang('wall_reply_as_group') + '\
  180. 178.  -             </div>\
  181. 179.  -             <div id="pv_reply_to_title" class="fl_l"></div>\
  182. 180.  -             <div id="pv_del_reply_to" class="fl_l" onclick="Photoview.commentTo()"></div>\
  183. 181.  -             <div id="pv_add_media" class="fl_r">\
  184. 182.  -               <span class="add_media_lnk">' + getLang('global_add_media') + '</span>\
  185. 183.  -             </div>\
  186. 184.  -           </div>\
  187. 185.  -         </div>\
  188. 186.  -       </div>\
  189. 187.  -       <div class="fl_r narrow_column" id="pv_narrow"></div>\
  190. 188.  -     </div>\
  191. 189.  -   </div>\
  192. 190.  -   <div id="pv_albums_wrap" style="' + awStyle + '">' + albumsHtml + '</div>\
  193. 191.  -   <div id="pv_album_wrap" '+ (cur.pvsaMini ? 'class="pv_album_wrap_mini"' : '') +' style="' + sawStyle + '">' + albumHtml + '</div>\
  194. 192.  -   <div id="pv_vtagged_wrap" style="' + vtStyle + '">' + pvVTagsHtml + '</div>\
  195. 193.  - </div>\
  196. 194.  - \
  197. 195.  - </td><td class="sidesh s3"><div></div></td></tr>\
  198. 196.  - <tr><td colspan="3" class="bottomsh s3"><div></div></td></tr></table>\
  199. 197.  - </td><td class="sidesh s2"><div></div></td></tr>\
  200. 198.  - <tr><td colspan="3" class="bottomsh s2"><div></div></td></tr></table>\
  201. 199.  - </td><td class="sidesh s1"><div></div></td></tr>\
  202. 200.  - <tr><td colspan="3" class="bottomsh s1"><div></div></td></tr></table>\
  203. 201.  - </div>\
  204. 202.  - <div class="no_select" id="pv_left_nav" '+'onmouseover="Photoview.activate(cur.pvLeft)" onmouseout="Photoview.deactivate(cur.pvLeft)" onmousedown="cur.pvClicked = true; Photoview.show(false, cur.pvIndex - 1, event);" onselectstart="return cancelEvent(event);"></div>\
  205. 203.  - <div class="no_select" id="pv_right_nav" '+'onmouseover="Photoview.activate(cur.pvClose)" onmouseout="Photoview.deactivate(cur.pvClose)" onmousedown="cur.pvClicked = true; Photoview.onClick(event, true);"></div>\
  206. 204.  - <div class="pv_switch no_select" id="pv_switch" onmouseover="if (!browser.msie6) Photoview.activate(this)" onmouseout="if (!browser.msie6) Photoview.deactivate(this)" onmousedown="Photoview.switchColor(this); cur.pvClicked = true;"><div class="pv_switch_wrap"><img class="pv_switch_img" width="10" height="22" src="/images/photoswitch'+(window.devicePixelRatio >= 2 ? '_2x' : '')+'.png" /></div></div>\
  207. 205.  -     ';
  208. 206.  -
  209. 207.  -     if (cur.pvYourComment) {
  210. 208.  -       domPN(ge('pv_your_comment')).replaceChild(cur.pvYourComment, ge('pv_your_comment'));
  211. 209.  -     }
  212. 210.  -     extend(cur, {
  213. 211.  -       pvCont: domFC(layer),
  214. 212.  -       pvBox: ge('pv_box'),
  215. 213.  -
  216. 214.  -       pvLeftNav: ge('pv_left_nav'),
  217. 215.  -       pvRightNav: ge('pv_right_nav'),
  218. 216.  -
  219. 217.  -       pvPhotoWrap: ge('pv_photo_wrap'),
  220. 218.  -       pvAlbumWrap: ge('pv_album_wrap'),
  221. 219.  -       pvAlbumsWrap: ge('pv_albums_wrap'),
  222. 220.  -       pvVTagsWrap: ge('pv_vtagged_wrap'),
  223. 221.  -
  224. 222.  -       pvSummary: domFC(ge('pv_summary')),
  225. 223.  -       pvTagInfo: ge('pv_tag_info'),
  226. 224.  -       pvLoader: ge('pv_loader'),
  227. 225.  -       pvTagFrame: ge('pv_tag_frame'),
  228. 226.  -       pvTagFaded: ge('pv_tag_faded'),
  229. 227.  -       pvTagPerson: ge('pv_tag_person'),
  230. 228.  -       pvPhoto: ge('pv_photo'),
  231. 229.  -       pvCommentsData: ge('pv_comments_data'),
  232. 230.  -
  233. 231.  -       pvNarrow: ge('pv_narrow'),
  234. 232.  -       pvWide: ge('pv_wide'),
  235. 233.  -
  236. 234.  -       pvHH: ge('pv_hh'),
  237. 235.  -       pvHHFg: ge('pv_hh_fg'),
  238. 236.  -
  239. 237.  -       pvYourComment: ge('pv_your_comment'),
  240. 238.  -       pvAddMedia: domFC(ge('pv_add_media')),
  241. 239.  -       pvMediaPreview: ge('pv_media_preview'),
  242. 240.  -       pvCommentSend: ge('pv_comment_send'),
  243. 241.  -       pvComment: ge('pv_comment'),
  244. 242.  -       pvAsGroup: ge('pv_reply_as_group'),
  245. 243.  -
  246. 244.  -       pvSwitch: ge('pv_switch')
  247. 245.  -     });
  248. 246.  -     addEvent(cur.pvPhoto, 'mousemove', Photoview.onMouseMove);
  249. 247.  -     if (browser.mobile) {
  250. 248.  -       cur.pvYOffset = intval(window.pageYOffset);
  251. 249.  -
  252. 250.  -       cur.pvCont.style.paddingTop = cur.pvLeftNav.style.top =
  253. 251.  -       cur.pvRightNav.style.top = (cur.pvYOffset + 10) + 'px';
  254. 252.  -
  255. 253.  -       cur.pvSwitch.style.top = cur.pvYOffset + 'px';
  256. 254.  -     }
  257. 255.  -     addEvent(layerWrap, 'scroll', Photoview.scrollResize);
  258. 256.  -
  259. 257.  -     Photoview.updateSize();
  260. 258.  -   },
  261. 259.  -   doShowAlbums: function(ownerId, ev) {
  262. 260.  -     ownerId = intval(ownerId);
  263. 261.  -     if (ev && (ev.button == 2 || ev.which == 3)) return;
  264. 262.  -
  265. 263.  -     clearTimeout(window.__pvhideTimer);
  266. 264.  -     if (__afterFocus) {
  267. 265.  -       return ev ? cancelEvent(ev) : false;
  268. 266.  -     }
  269. 267.  -     if (cur.pvTagger) {
  270. 268.  -       Phototag.stopTag();
  271. 269.  -       if (ev !== false) {
  272. 270.  -         return ev ? cancelEvent(ev) : false;
  273. 271.  -       }
  274. 272.  -     }
  275. 273.  -
  276. 274.  -     var data = (cur.pvAlbumsData || {})[ownerId];
  277. 275.  -     if (!data) return;
  278. 276.  -
  279. 277.  - //    if (window.wkLayerWrap && isVisible(window.wkLayerWrap)) {
  280. 278.  - //      wkcur.scrollTop = window.wkLayerWrap.scrollTop;
  281. 279.  - //      hide(wkLayerWrap);
  282. 280.  - //    }
  283. 281.  -
  284. 282.  -     Photoview.checkLayerVisibility();
  285. 283.  -     cur.pvRoot = false;
  286. 284.  -     Photoview.updateLocNav();
  287. 285.  -
  288. 286.  -     if (ev && ev.pageX && ev.pageY) {
  289. 287.  -       extend(cur, {pvOldX: ev.pageX, pvOldY: ev.pageY, pvOldT: vkNow()});
  290. 288.  -     }
  291. 289.  -
  292. 290.  -     cur.pvShown = true;
  293. 291.  -     cur.pvAlbumsShown = ownerId;
  294. 292.  -     if (!cur.pvFixed || val('pva_owner') != ownerId) {
  295. 293.  -       extend(cur, {
  296. 294.  -         pvaOffset: data.opts.offset,
  297. 295.  -         pvaCount: data.opts.count,
  298. 296.  -         pvaPhotosOffset: data.opts.photos_offset,
  299. 297.  -         pvaPhotosCount: data.opts.photos_count,
  300. 298.  -         pvShowAllAlbums: false
  301. 299.  -       });
  302. 300.  -     }
  303. 301.  -     if (!cur.pvFixed) {
  304. 302.  -       Photoview.createLayer();
  305. 303.  -     } else {
  306. 304.  -       if (val('pva_owner') != ownerId) {
  307. 305.  -         val(cur.pvAlbumsWrap, data.html);
  308. 306.  -       }
  309. 307.  -       if (!isVisible(cur.pvAlbumsWrap)) {
  310. 308.  -         hide(cur.pvPhotoWrap, cur.pvAlbumWrap, cur.pvVTagsWrap);
  311. 309.  -         show(cur.pvAlbumsWrap);
  312. 310.  -         Photoview.updateSize();
  313. 311.  -         layerWrap.scrollTop = val('pva_scroll');
  314. 312.  -       }
  315. 313.  -     }
  316. 314.  -
  317. 315.  -     cur.pvSummary.innerHTML = data.opts.summary;
  318. 316.  -
  319. 317.  -     if (cur.pvListId && cur.pvListId != 'temp') {
  320. 318.  -       extend(cur, {
  321. 319.  -         pvOldListId: cur.pvListId,
  322. 320.  -         pvOldIndex: cur.pvIndex
  323. 321.  -       });
  324. 322.  -       var old = (cur.pvListId || '').split('/');
  325. 323.  -       if (old[0]) {
  326. 324.  -         Photoview.showRepeat(ge(old[0]));
  327. 325.  -       }
  328. 326.  -
  329. 327.  -       show(cur.pvLeft, cur.pvLeftNav, cur.pvRightNav, cur.pvClose);
  330. 328.  -     } else {
  331. 329.  -       hide(cur.pvLeft, cur.pvLeftNav, cur.pvRightNav, cur.pvClose);
  332. 330.  -       if (!browser.msie || browser.version > 8) cur.pvClicked = false;
  333. 331.  -     }
  334. 332.  -     cur.pvListId = false;
  335. 333.  -
  336. 334.  -     var nl = extend(nav.objLoc, {z: 'albums' + cur.pvAlbumsShown});
  337. 335.  -     if (nav.strLoc != nav.toStr(nl)) {
  338. 336.  -       if (!cur.pvNoHistory) {
  339. 337.  -         ++cur.pvHistoryLength;
  340. 338.  -       }
  341. 339.  -       nav.setLoc(nl);
  342. 340.  -     }
  343. 341.  -
  344. 342.  -     return ev ? cancelEvent(ev) : false;
  345. 343.  -   },
  346. 344.  -   jumpToAlbums: function(returning) {
  347. 345.  -     if (cur.pvListId == 'temp') {
  348. 346.  -       cur.pvCancelLoad();
  349. 347.  -       if (cur.pvJumpTo.z == 'albums' + val('pva_owner') && cur.pvJumpTo.z == nav.objLoc.z) {
  350. 348.  -         showAlbums(val('pva_owner'), {noHistory: true});
  351. 349.  -         return;
  352. 350.  -       }
  353. 351.  -     }
  354. 352.  -     if (returning) {
  355. 353.  -       cur.pvListId = false;
  356. 354.  -     }
  357. 355.  -     extend(cur, {
  358. 356.  -       pvJumpFrom: false,
  359. 357.  -       pvJumpSteps: 0
  360. 358.  -     });
  361. 359.  -     nav.change(cur.pvJumpTo);
  362. 360.  -   },
  363. 361.  -   jumpToAlbum: function(returning) {
  364. 362.  -     if (cur.pvListId == 'temp') {
  365. 363.  -       cur.pvCancelLoad();
  366. 364.  -       if (cur.pvJumpTo.z == 'album' + val('pvsa_album') && cur.pvJumpTo.z == nav.objLoc.z) {
  367. 365.  -         showAlbum(val('pvsa_album'), {noHistory: true});
  368. 366.  -         return;
  369. 367.  -       }
  370. 368.  -     }
  371. 369.  -     if (returning) {
  372. 370.  -       cur.pvListId = false;
  373. 371.  -     }
  374. 372.  -     extend(cur, {
  375. 373.  -       pvJumpFrom: false,
  376. 374.  -       pvJumpSteps: 0
  377. 375.  -     });
  378. 376.  -     nav.change(cur.pvJumpTo);
  379. 377.  -   },
  380. 378.  -   jumpToTagged: function(returning) {
  381. 379.  -     if (cur.pvListId == 'temp') {
  382. 380.  -       cur.pvCancelLoad();
  383. 381.  -       if (cur.pvJumpTo.z == 'tag' + val('pvsa_tag') && cur.pvJumpTo.z == nav.objLoc.z) {
  384. 382.  -         showTagged(val('pvsa_tag'), {noHistory: true});
  385. 383.  -         return;
  386. 384.  -       }
  387. 385.  -     }
  388. 386.  -     if (cur.pvJumpTo.z == 'tag' + val('pvsa_tag')) {
  389. 387.  -       cur.pvJumpTo.z = 'photo_' + cur.pvJumpTo.z;
  390. 388.  -     }
  391. 389.  -     if (returning) {
  392. 390.  -       cur.pvListId = false;
  393. 391.  -     }
  394. 392.  -     extend(cur, {
  395. 393.  -       pvJumpFrom: false,
  396. 394.  -       pvJumpSteps: 0
  397. 395.  -     });
  398. 396.  -     nav.change(cur.pvJumpTo);
  399. 397.  -   },
  400. 398.  -   doShowAlbum: function(albumRaw, ev) {
  401. 399.  -     if (ev && (ev.button == 2 || ev.which == 3)) return;
  402. 400.  -
  403. 401.  -     clearTimeout(window.__pvhideTimer);
  404. 402.  -     if (__afterFocus) {
  405. 403.  -       return ev ? cancelEvent(ev) : false;
  406. 404.  -     }
  407. 405.  -     if (cur.pvTagger) {
  408. 406.  -       Phototag.stopTag();
  409. 407.  -       if (ev !== false) {
  410. 408.  -         return ev ? cancelEvent(ev) : false;
  411. 409.  -       }
  412. 410.  -     }
  413. 411.  -
  414. 412.  -     var data = (cur.pvAlbumData || {})[albumRaw];
  415. 413.  -     if (!data) return;
  416. 414.  -
  417. 415.  - //    if (window.wkLayerWrap && isVisible(window.wkLayerWrap)) {
  418. 416.  - //      wkcur.scrollTop = window.wkLayerWrap.scrollTop;
  419. 417.  - //      hide(wkLayerWrap);
  420. 418.  - //    }
  421. 419.  -
  422. 420.  -     Photoview.checkLayerVisibility();
  423. 421.  -     cur.pvRoot = false;
  424. 422.  -     Photoview.updateLocNav();
  425. 423.  -
  426. 424.  -     if (ev && ev.pageX && ev.pageY) {
  427. 425.  -       extend(cur, {pvOldX: ev.pageX, pvOldY: ev.pageY, pvOldT: vkNow()});
  428. 426.  -     }
  429. 427.  -
  430. 428.  -     cur.pvShown = true;
  431. 429.  -     cur.pvAlbumShown = albumRaw;
  432. 430.  -     if (!cur.pvFixed || val('pvsa_album') != albumRaw) {
  433. 431.  -       extend(cur, {
  434. 432.  -         pvsaOffset: data.opts.offset,
  435. 433.  -         pvsaCount: data.opts.count,
  436. 434.  -         pvsaMini: data.opts.count <= 40
  437. 435.  -       });
  438. 436.  -     }
  439. 437.  -     if (!cur.pvFixed) {
  440. 438.  -       Photoview.createLayer();
  441. 439.  -     } else {
  442. 440.  -       toggleClass(cur.pvAlbumWrap, 'pv_album_wrap_mini', cur.pvsaMini);
  443. 441.  -       if (val('pvsa_album') != albumRaw) {
  444. 442.  -         val(cur.pvAlbumWrap, data.html);
  445. 443.  -       }
  446. 444.  -       if (!isVisible(cur.pvAlbumWrap)) {
  447. 445.  -         hide(cur.pvPhotoWrap, cur.pvAlbumsWrap, cur.pvVTagsWrap);
  448. 446.  -         show(cur.pvAlbumWrap);
  449. 447.  -         Photoview.updateSize();
  450. 448.  -         layerWrap.scrollTop = val('pvsa_scroll');
  451. 449.  -       }
  452. 450.  -     }
  453. 451.  -
  454. 452.  -     val(cur.pvSummary, data.opts.summary);
  455. 453.  -
  456. 454.  -     if (cur.pvListId && cur.pvListId != 'temp') {
  457. 455.  -       extend(cur, {
  458. 456.  -         pvOldListId: cur.pvListId,
  459. 457.  -         pvOldIndex: cur.pvIndex
  460. 458.  -       });
  461. 459.  -       var old = (cur.pvListId || '').split('/');
  462. 460.  -       if (old[0]) {
  463. 461.  -         Photoview.showRepeat(ge(old[0]));
  464. 462.  -       }
  465. 463.  -
  466. 464.  -       show(cur.pvLeft, cur.pvLeftNav, cur.pvRightNav, cur.pvClose);
  467. 465.  -     } else {
  468. 466.  -       hide(cur.pvLeft, cur.pvLeftNav, cur.pvRightNav, cur.pvClose);
  469. 467.  -       if (!browser.msie || browser.version > 8) cur.pvClicked = false;
  470. 468.  -     }
  471. 469.  -     cur.pvListId = false;
  472. 470.  -
  473. 471.  -     var nl = extend(nav.objLoc, {z: 'album' + cur.pvAlbumShown});
  474. 472.  -     if (nav.strLoc != nav.toStr(nl)) {
  475. 473.  -       if (!cur.pvNoHistory) {
  476. 474.  -         ++cur.pvHistoryLength;
  477. 475.  -       }
  478. 476.  -       nav.setLoc(nl);
  479. 477.  -     }
  480. 478.  -
  481. 479.  -     return ev ? cancelEvent(ev) : false;
  482. 480.  -   },
  483. 481.  -   doShowTagged: function(ownerId, ev) {
  484. 482.  -     ownerId = intval(ownerId);
  485. 483.  -     if (ev && (ev.button == 2 || ev.which == 3)) return;
  486. 484.  -
  487. 485.  -     clearTimeout(window.__pvhideTimer);
  488. 486.  -     if (__afterFocus) {
  489. 487.  -       return ev ? cancelEvent(ev) : false;
  490. 488.  -     }
  491. 489.  -     if (cur.pvTagger) {
  492. 490.  -       Phototag.stopTag();
  493. 491.  -       if (ev !== false) {
  494. 492.  -         return ev ? cancelEvent(ev) : false;
  495. 493.  -       }
  496. 494.  -     }
  497. 495.  -
  498. 496.  -     var data = (cur.pvPhotoTagData || {})[ownerId];
  499. 497.  -     if (!data) return;
  500. 498.  -
  501. 499.  - //    if (window.wkLayerWrap && isVisible(window.wkLayerWrap)) {
  502. 500.  - //      wkcur.scrollTop = window.wkLayerWrap.scrollTop;
  503. 501.  - //      hide(wkLayerWrap);
  504. 502.  - //    }
  505. 503.  -
  506. 504.  -     Photoview.checkLayerVisibility();
  507. 505.  -     cur.pvRoot = false;
  508. 506.  -     Photoview.updateLocNav();
  509. 507.  -
  510. 508.  -     if (ev && ev.pageX && ev.pageY) {
  511. 509.  -       extend(cur, {pvOldX: ev.pageX, pvOldY: ev.pageY, pvOldT: vkNow()});
  512. 510.  -     }
  513. 511.  -
  514. 512.  -     cur.pvShown = true;
  515. 513.  -     cur.pvPhotoTagShown = ownerId;
  516. 514.  -     if (!cur.pvFixed || val('pvsa_tag') != ownerId) {
  517. 515.  -       extend(cur, {
  518. 516.  -         pvsaOffset: data.opts.offset,
  519. 517.  -         pvsaCount: data.opts.count,
  520. 518.  -         pvsaMini: data.opts.count <= 40
  521. 519.  -       });
  522. 520.  -     }
  523. 521.  -     if (!cur.pvFixed) {
  524. 522.  -       Photoview.createLayer();
  525. 523.  -     } else {
  526. 524.  -       toggleClass(cur.pvAlbumWrap, 'pv_album_wrap_mini', cur.pvsaMini);
  527. 525.  -       if (val('pvsa_tag') != ownerId) {
  528. 526.  -         val(cur.pvAlbumWrap, data.html);
  529. 527.  -       }
  530. 528.  -       if (!isVisible(cur.pvAlbumWrap)) {
  531. 529.  -         hide(cur.pvPhotoWrap, cur.pvAlbumsWrap, cur.pvVTagsWrap);
  532. 530.  -         show(cur.pvAlbumWrap);
  533. 531.  -         Photoview.updateSize();
  534. 532.  -         layerWrap.scrollTop = val('pvsa_scroll');
  535. 533.  -       }
  536. 534.  -     }
  537. 535.  -
  538. 536.  -     val(cur.pvSummary, data.opts.summary);
  539. 537.  -
  540. 538.  -     if (cur.pvListId && cur.pvListId != 'temp') {
  541. 539.  -       extend(cur, {
  542. 540.  -         pvOldListId: cur.pvListId,
  543. 541.  -         pvOldIndex: cur.pvIndex
  544. 542.  -       });
  545. 543.  -       var old = (cur.pvListId || '').split('/');
  546. 544.  -       if (old[0]) {
  547. 545.  -         Photoview.showRepeat(ge(old[0]));
  548. 546.  -       }
  549. 547.  -
  550. 548.  -       show(cur.pvLeft, cur.pvLeftNav, cur.pvRightNav, cur.pvClose);
  551. 549.  -     } else {
  552. 550.  -       hide(cur.pvLeft, cur.pvLeftNav, cur.pvRightNav, cur.pvClose);
  553. 551.  -       if (!browser.msie || browser.version > 8) cur.pvClicked = false;
  554. 552.  -     }
  555. 553.  -     cur.pvListId = false;
  556. 554.  -
  557. 555.  -     var nl = extend(nav.objLoc, {z: 'photo_tag' + cur.pvPhotoTagShown});
  558. 556.  -     if (nav.strLoc != nav.toStr(nl)) {
  559. 557.  -       if (!cur.pvNoHistory) {
  560. 558.  -         ++cur.pvHistoryLength;
  561. 559.  -       }
  562. 560.  -       nav.setLoc(nl);
  563. 561.  -     }
  564. 562.  -
  565. 563.  -     return ev ? cancelEvent(ev) : false;
  566. 564.  -   },
  567. 565.  -   doShowVideoTags: function(ownerId, ev) {
  568. 566.  -     if (ev && (ev.button == 2 || ev.which == 3)) return;
  569. 567.  -
  570. 568.  -     clearTimeout(window.__pvhideTimer);
  571. 569.  -     if (__afterFocus) {
  572. 570.  -       return ev ? cancelEvent(ev) : false;
  573. 571.  -     }
  574. 572.  -     if (cur.pvTagger) {
  575. 573.  -       Phototag.stopTag();
  576. 574.  -       if (ev !== false) {
  577. 575.  -         return ev ? cancelEvent(ev) : false;
  578. 576.  -       }
  579. 577.  -     }
  580. 578.  -
  581. 579.  -     var data = cur.pvVideoTagsData;
  582. 580.  -     if (!data) return;
  583. 581.  -
  584. 582.  - //    if (window.wkLayerWrap && isVisible(window.wkLayerWrap)) {
  585. 583.  - //      wkcur.scrollTop = window.wkLayerWrap.scrollTop;
  586. 584.  - //      hide(wkLayerWrap);
  587. 585.  - //    }
  588. 586.  -
  589. 587.  -     Photoview.checkLayerVisibility();
  590. 588.  -     cur.pvRoot = false;
  591. 589.  -     Photoview.updateLocNav();
  592. 590.  -
  593. 591.  -     if (ev && ev.pageX && ev.pageY) {
  594. 592.  -       extend(cur, {pvOldX: ev.pageX, pvOldY: ev.pageY, pvOldT: vkNow()});
  595. 593.  -     }
  596. 594.  -
  597. 595.  -     cur.pvShown = true;
  598. 596.  -     cur.pvVideoTagsShown = ownerId;
  599. 597.  -     if (!cur.pvFixed || val('pvsa_vtag') != ownerId) {
  600. 598.  -       extend(cur, {
  601. 599.  -         pvsaOffset: data.opts.offset,
  602. 600.  -         pvsaCount: data.opts.count
  603. 601.  -       });
  604. 602.  -     }
  605. 603.  -     if (data.opts.lang) {
  606. 604.  -       cur.lang = extend(cur.lang || {}, data.opts.lang);
  607. 605.  -     }
  608. 606.  -     if (!cur.pvFixed) {
  609. 607.  -       Photoview.createLayer();
  610. 608.  -     } else {
  611. 609.  -       if (val('pvsa_vtag') != ownerId) {
  612. 610.  -         val(cur.pvVTagsWrap, data.html);
  613. 611.  -       }
  614. 612.  -       if (!isVisible(cur.pvVTagsWrap)) {
  615. 613.  -         hide(cur.pvPhotoWrap, cur.pvAlbumsWrap, cur.pvAlbumWrap);
  616. 614.  -         show(cur.pvVTagsWrap);
  617. 615.  -         Photoview.updateSize();
  618. 616.  -         layerWrap.scrollTop = val('pvsa_scroll');
  619. 617.  -       }
  620. 618.  -     }
  621. 619.  -
  622. 620.  -     val(cur.pvSummary, data.opts.summary);
  623. 621.  -
  624. 622.  -     hide(cur.pvLeft, cur.pvLeftNav, cur.pvRightNav, cur.pvClose);
  625. 623.  -     cur.pvListId = false;
  626. 624.  -     domPN(cur.pvSummary).style.width = '606px';
  627. 625.  -
  628. 626.  -     var nl = extend(nav.objLoc, {z: 'video_tag' + cur.pvVideoTagsShown});
  629. 627.  -     if (nav.strLoc != nav.toStr(nl)) {
  630. 628.  -       if (!cur.pvNoHistory) {
  631. 629.  -         ++cur.pvHistoryLength;
  632. 630.  -       }
  633. 631.  -       nav.setLoc(nl);
  634. 632.  -     }
  635. 633.  -
  636. 634.  -     return ev ? cancelEvent(ev) : false;
  637. 635.  -   },
  638. 636.  -   show: function(listId, index, ev, root) {
  639. 637.  -     if (ev && (ev.button == 2 || ev.which == 3)) return;
  640. 638.  -
  641. 639.  -     clearTimeout(window.__pvhideTimer);
  642. 640.  -
  643. 641.  -     if (listId == 'temp' && cur.pvShown) {
  644. 642.  -       if (cur.pvListId && cur.pvListId != 'temp') return;
  645. 643.  -       cur.pvWasShown = true;
  646. 644.  -     } else {
  647. 645.  -       cur.pvWasShown = false;
  648. 646.  -     }
  649. 647.  -     if (__afterFocus) {
  650. 648.  -       return ev ? cancelEvent(ev) : false;
  651. 649.  -     }
  652. 650.  -     if (cur.pvTagger) {
  653. 651.  -       Phototag.stopTag();
  654. 652.  -       if (ev !== false) {
  655. 653.  -         return ev ? cancelEvent(ev) : false;
  656. 654.  -       }
  657. 655.  -     }
  658. 656.  -     if (listId === false) {
  659. 657.  -       if (cur.pvAlbumsShown || cur.pvAlbumShown || cur.pvPhotoTagShown) {
  660. 658.  -         if (cur.pvOldListId) {
  661. 659.  -           extend(cur, {
  662. 660.  -             pvJumpTo: cur.pvOldJumpTo,
  663. 661.  -             pvJumpFrom: cur.pvOldJumpFrom,
  664. 662.  -             pvJumpSteps: cur.pvOldJumpSteps
  665. 663.  -           });
  666. 664.  -           if (index == cur.pvOldIndex + 1) ++cur.pvOldIndex;
  667. 665.  -           return Photoview.show(cur.pvOldListId, cur.pvOldIndex, ev, root);
  668. 666.  -         } else {
  669. 667.  -           hide(cur.pvLeft, cur.pvLeftNav, cur.pvRightNav, cur.pvClose);
  670. 668.  -         }
  671. 669.  -       }
  672. 670.  -       listId = cur.pvListId;
  673. 671.  -     }
  674. 672.  -     var count = ((cur.pvData || {})[listId] || {}).length, otherList = (listId != cur.pvListId);
  675. 673.  -     if (!count) return;
  676. 674.  -
  677. 675.  -     if (ev && ev.pageX && ev.pageY) {
  678. 676.  -       extend(cur, {pvOldX: ev.pageX, pvOldY: ev.pageY, pvOldT: vkNow()});
  679. 677.  -     }
  680. 678.  -
  681. 679.  -     if ((cur.pvOptions || {}).queue) {
  682. 680.  -       debugLog('pushing in photoview.show');
  683. 681.  -       layerQueue.push();
  684. 682.  -       cur.pvOptions.queue = false;
  685. 683.  -       cur.pvHistoryLength = 0;
  686. 684.  -     }
  687. 685.  -
  688. 686.  - //    if (window.wkLayerWrap && isVisible(window.wkLayerWrap)) {
  689. 687.  - //      wkcur.scrollTop = window.wkLayerWrap.scrollTop;
  690. 688.  - //      hide(wkLayerWrap);
  691. 689.  - //    }
  692. 690.  -
  693. 691.  -     if (!Photoview.checkLayerVisibility()) {
  694. 692.  -       otherList = true;
  695. 693.  -     }
  696. 694.  -
  697. 695.  -     var newIndex = index + (index < 0 ? count : (index >= count ? (-count) : 0));
  698. 696.  -     var direction = otherList ? 1 : (cur.pvIndex > index ? -1 : 1);
  699. 697.  -
  700. 698.  -     if (!otherList && !cur.pvCanvas) {
  701. 699.  -       if (cur.pvJumpTo) {
  702. 700.  -         cur.pvJumpSteps += (index - cur.pvIndex);
  703. 701.  -         var needJump = (newIndex === cur.pvJumpFrom && cur.pvJumpSteps >= count);
  704. 702.  -         if (needJump) {
  705. 703.  -           extend(cur, {
  706. 704.  -             pvOldJumpFrom: cur.pvJumpFrom,
  707. 705.  -             pvOldJumpSteps: cur.pvJumpSteps - (index - cur.pvIndex),
  708. 706.  -             pvOldJumpTo: cur.pvJumpTo
  709. 707.  -           });
  710. 708.  -           return Photoview.jumpToAlbums(cur.pvJumpSteps < 0);
  711. 709.  -         }
  712. 710.  -         if (direction > 0) {
  713. 711.  -           if (newIndex < cur.pvJumpFrom && newIndex + 4 > cur.pvJumpFrom || newIndex < cur.pvJumpFrom + count && newIndex + 4 > cur.pvJumpFrom + count) {
  714. 712.  -             vkImage().src = stManager._srcPrefix('.css')+'/images/icons/post_hh'+(window.devicePixelRatio >= 2 ? '_2x' : '')+'.png?2';
  715. 713.  -             var m = cur.pvJumpTo.z.match(/^albums(-?\d+)$/);
  716. 714.  -             if (m) {
  717. 715.  -               if (!cur.pvAlbumsData) cur.pvAlbumsData = {};
  718. 716.  -               if (!cur.pvAlbumsData[m[1]]) {
  719. 717.  -                 cur.pvAlbumsData[m[1]] = 'loading';
  720. 718.  -                 ajax.post('al_photos.php', {act: 'show_albums', owner: m[1], other: 1}, {onDone: Photoview.loadedAlbums});
  721. 719.  -               }
  722. 720.  -             }
  723. 721.  -           }
  724. 722.  -         }
  725. 723.  -         if (cur.pvJumpSteps <= -count) {
  726. 724.  -           cur.pvJumpSteps += count;
  727. 725.  -         }
  728. 726.  -       }
  729. 727.  -       if (count == 1 && index != cur.pvIndex && listId != 'temp') {
  730. 728.  -         Photoview.hide();
  731. 729.  -         return ev ? cancelEvent(ev) : false;
  732. 730.  -       }
  733. 731.  -     }
  734. 732.  -
  735. 733.  -     if (otherList && listId != 'temp') {
  736. 734.  -       if (cur.pvJumpFrom === false) {
  737. 735.  -         cur.pvJumpFrom = newIndex;
  738. 736.  -       }
  739. 737.  -       cur.pvRoot = root;
  740. 738.  -       Photoview.updateLocNav();
  741. 739.  -     }
  742. 740.  -
  743. 741.  -     index = newIndex;
  744. 742.  -
  745. 743.  -     var ph = cur.pvData[listId][index];
  746. 744.  -
  747. 745.  -     if (!ph || !ph.x_ && !ph.x_src) return;
  748. 746.  -
  749. 747.  -     cur.pvIndex = index;
  750. 748.  -     cur.pvShown = true;
  751. 749.  -     cur.pvAlbumsShowing = cur.pvAlbumsShown = false;
  752. 750.  -     cur.pvAlbumShowing = cur.pvAlbumShown = false;
  753. 751.  -     cur.pvPhotoTagShowing = cur.pvPhotoTagShown = false;
  754. 752.  -     cur.pvVideoTagShowing = cur.pvVideoTagsShown = false;
  755. 753.  -     cur.pvListId = listId;
  756. 754.  -     if (!cur.pvFixed) {
  757. 755.  -       Photoview.createLayer();
  758. 756.  -     }
  759. 757.  -     cur.pvCurData = Photoview.genData(ph, vk.pvbig ? (cur.pvVeryBig ? (cur.pvVeryBig > 1 ? 'z' : 'z') : 'y') : 'x');
  760. 758.  -     if (cur.pvCurrent) {
  761. 759.  -       cur.pvCurrent.onload = Photoview.blankf;
  762. 760.  -       cur.pvCurrent.src = Photoview.blank;
  763. 761.  -     }
  764. 762.  -     delete cur.pvCurrent;
  765. 763.  -     cur.pvCurrent = vkImage();
  766. 764.  -     cur.pvCurrent.onload = Photoview.preload.pbind(index, direction);
  767. 765.  -     cur.pvCurrent.src = cur.pvCurData.src;
  768. 766.  -
  769. 767.  -     if (otherList) {
  770. 768.  -       var needControls = (count > 1) || ((cur.pvJumpTo || {}).z == 'albums' + val('pva_owner')) || ((cur.pvJumpTo || {}).z == 'album' + val('pvsa_album'));
  771. 769.  -       (needControls ? show : hide)(cur.pvLeft, cur.pvLeftNav, cur.pvRightNav, cur.pvClose);
  772. 770.  -     }
  773. 771.  -     cur.pvSummary.innerHTML = (listId == 'temp') ? '<img src="/images/upload.gif" />' : ((count > 1) ? getLang('photos_photo_num_of_N').replace('%s', cur.pvIndex + 1).replace('%s', count) : getLang('photos_view_one_photo'));
  774. 772.  -
  775. 773.  -     cur.pvCurPhoto = ph;
  776. 774.  -     if (!cur.pvCurData.width || !cur.pvCurData.height) {
  777. 775.  -       cur.pvCurData = cur.pvCurrent;
  778. 776.  -       cur.pvTimerPassed = 0;
  779. 777.  -       clearTimeout(cur.pvTimer);
  780. 778.  -       cur.pvTimer = setTimeout(Photoview.doShow, 0);
  781. 779.  -     } else {
  782. 780.  -       Photoview.doShow();
  783. 781.  -     }
  784. 782.  -
  785. 783.  -     return ev ? cancelEvent(ev) : false;
  786. 784.  -   },
  787. 785.  -   doShow: function() {
  788. 786.  -     var img = cur.pvCurData;
  789. 787.  -     if ((!img.width || !img.height) && cur.pvTimerPassed < 5000) {
  790. 788.  -       clearTimeout(cur.pvTimer);
  791. 789.  -       cur.pvTimerPassed += 100;
  792. 790.  -       cur.pvTimer = setTimeout(Photoview.doShow, 100);
  793. 791.  -       return;
  794. 792.  -     }
  795. 793.  -     if (!cur.pvShown) return;
  796. 794.  -
  797. 795.  -     if (cur.pvCanvas) {
  798. 796.  -       cur.pvScrWidth = cur.pvCanvas.offsetWidth;
  799. 797.  -       cur.pvScrHeight = cur.pvCanvas.offsetHeight;
  800. 798.  -
  801. 799.  -       var c = 1, t = 0, l = 0, w = img.width || 604, h = img.height || 453, i = vkImage();
  802. 800.  - //      if (w > cur.pvScrWidth) {
  803. 801.  -         c = cur.pvScrWidth / w;
  804. 802.  - //      }
  805. 803.  -       if (h * c > cur.pvScrHeight) {
  806. 804.  -         c = cur.pvScrHeight / h;
  807. 805.  -       }
  808. 806.  -       if (c > 1.25) c = 1.25;
  809. 807.  -       cur.pvFSWidth = w = Math.floor(w * c);
  810. 808.  -       cur.pvFSHeight = h = Math.floor(h * c);
  811. 809.  -       cur.pvFSTop = t = Math.floor((cur.pvScrHeight - h) / 2);
  812. 810.  -
  813. 811.  -       val(domFC(cur.pvCanvas), '<img style="margin-top: ' + t + 'px; width: ' + w + 'px; height: ' + h + 'px;" src="' + img.src + '" />');
  814. 812.  -       i.onload = Photoview.fullscreenOnLoad;
  815. 813.  -       i.src = img.src;
  816. 814.  -
  817. 815.  -       if (window.FullscreenPV) FullscreenPV.updateInfo();
  818. 816.  -       return;
  819. 817.  -     }
  820. 818.  -
  821. 819.  -     if (isVisible(cur.pvAlbumsWrap)) {
  822. 820.  -       val('pva_scroll', layerWrap.scrollTop);
  823. 821.  -       hide(cur.pvAlbumsWrap);
  824. 822.  -       show(cur.pvPhotoWrap);
  825. 823.  -       Photoview.updateSize();
  826. 824.  -     }
  827. 825.  -     if (isVisible(cur.pvAlbumWrap)) {
  828. 826.  -       val('pvsa_scroll', layerWrap.scrollTop);
  829. 827.  -       hide(cur.pvAlbumWrap);
  830. 828.  -       show(cur.pvPhotoWrap);
  831. 829.  -       Photoview.updateSize();
  832. 830.  -     }
  833. 831.  -
  834. 832.  -     var lnk = cur.pvPhoto, c = 1, marginTop = 0, w = img.width || 604, h = img.height || 453;
  835. 833.  -     if (vk.pvbig) {
  836. 834.  -       if (w > cur.pvWidth) {
  837. 835.  -         c = cur.pvWidth / w;
  838. 836.  -       }
  839. 837.  -       if (h * c > cur.pvHeight) {
  840. 838.  -         c = cur.pvHeight / h;
  841. 839.  -       }
  842. 840.  -     }
  843. 841.  -     marginTop = positive(Math.floor((403 - h * c) / 2));
  844. 842.  -     cur.pvPhWidth = Math.floor(w * c);
  845. 843.  -     cur.pvPhHeight = Math.floor(h * c);
  846. 844.  -     cur.pvActualWidth = Math.max(cur.pvPhWidth, 604);
  847. 845.  -     if (h * c >= 453) {
  848. 846.  -       lnk.style.height = Math.floor(h * c) + 'px';
  849. 847.  -     } else {
  850. 848.  -       lnk.style.height = Math.max(400, cur.pvPhHeight)+'px';
  851. 849.  -     }
  852. 850.  -
  853. 851.  -     if (vk.pvbig) {
  854. 852.  -       cur.pvCont.style.width = (cur.pvActualWidth + 154) + 'px';
  855. 853.  -       domPN(cur.pvSummary).style.width = (cur.pvActualWidth - 4) + 'px';
  856. 854.  -     }
  857. 855.  -
  858. 856.  -     if (cur.pvTagger) Phototag.stopTag();
  859. 857.  -     Photoview.hideTag(true);
  860. 858.  -
  861. 859.  -     if (cur.pvLoader) {
  862. 860.  -       hide(cur.pvLoader);
  863. 861.  -       delete(cur.pvLoader);
  864. 862.  -     }
  865. 863.  -
  866. 864.  -     imgOpts = '';
  867. 865.  -
  868. 866.  -     var ph = cur.pvCurPhoto, notAvail = (ph.commshown >= 0) ? false : (-ph.commshown);
  869. 867.  -
  870. 868.  -     if (!cur.pvHHMove && Photoview.hhCheck() && !notAvail) {
  871. 869.  -       addEvent(layer, 'mousemove', Photoview.photoAct);
  872. 870.  -       cur.pvHHMove = true;
  873. 871.  -     }
  874. 872.  -
  875. 873.  -     cur.pvHH.style[vk.rtl ? 'marginRight' : 'marginLeft'] = Math.ceil((cur.pvActualWidth + 50 - 72) / 2) + 'px';
  876. 874.  -
  877. 875.  -     lnk.innerHTML = '<img '+imgOpts+' style="width: ' + cur.pvPhWidth + 'px; height: ' + cur.pvPhHeight + 'px; margin-top: ' + marginTop + 'px;" src="' + img.src + '" />';
  878. 876.  -
  879. 877.  -     layerWrap.scrollTop = 0;
  880. 878.  -     if (cur.pvListId == 'temp') {
  881. 879.  -       hide(cur.pvCommentsData);
  882. 880.  -       Photoview.updateArrows();
  883. 881.  -       return;
  884. 882.  -     }
  885. 883.  -
  886. 884.  -     (ph.liked ? addClass : removeClass)(cur.pvHH, 'pvs_hh_liked');
  887. 885.  -     Photoview.hhOut(cur.pvHHFg);
  888. 886.  -
  889. 887.  -     if (window.tooltips) {
  890. 888.  -       tooltips.destroyAll(cur.pvBox);
  891. 889.  -     }
  892. 890.  -
  893. 891.  -     var taglnkst = (!ph.taginfo && ph.actions.tag && ph.tags[0] < cur.pvMaxTags) ? '' : ' style="display: none"';
  894. 892.  -     var shareacts = [], fs = false;
  895. 893.  -     if (vk.id) shareacts.push(['pvs_send', getLang('photos_send_to_fr'), 'onclick="Photoview.sendPhoto()"']);
  896. 894.  -     if (ph.actions.save) shareacts.push(['pvs_save', getLang('photos_save_to_alb'), 'onclick="Photoview.savePhoto()"']);
  897. 895.  -     shareacts.push(['pvs_down', getLang('photos_download_hq'), 'target="_blank" href="' + Photoview.genData(ph, 'w').src + /* '?dl=1' + */'"']);
  898. 896.  -
  899. 897.  -     var share = '', l = shareacts.length, sprg = '<div id="pv_share_prg" class="progress fl_r"></div>';
  900. 898.  -     if (l < 1) {
  901. 899.  -       share = '';
  902. 900.  -     } else if (l == 1) {
  903. 901.  -       share = '<a ' + shareacts[0][2] + '>' + sprg + shareacts[0][1] + '</a>';
  904. 902.  -     } else {
  905. 903.  -       var shareRows = '';
  906. 904.  -       for (var i = 0; i < l; ++i) {
  907. 905.  -         shareRows += '<a class="pvs_act" ' + shareacts[i][2] + '><span class="fl_l ' + shareacts[i][0] + '"></span><span class="pvs_act_text">' + shareacts[i][1] + '</span></a>';
  908. 906.  -       }
  909. 907.  -       var share = '<a id="pv_share" onclick="Photoview.showDD(this, this.nextSibling)">' + sprg + '<span class="pv_act_text">' + getLang('photos_share_from_view') + '</span></a>'+Photoview.createDD(shareRows, getLang('photos_share_from_view'));
  910. 908.  -     }
  911. 909.  -
  912. 910.  -     if (ph.actions.edit/* & 2*/) {
  913. 911.  -       photoEditAct = '<a id="pv_edit_link" onclick="return showBox(\'al_photos.php\', {act: \'edit_photo\', photo: cur.pvData[cur.pvListId][cur.pvIndex].id}, {stat: [\'ui_controls.css\', \'ui_controls.js\']})">' + getLang('photos_edit') + '</a>';
  914. 912.  -     } else {
  915. 913.  -       photoEditAct = '';
  916. 914.  -     }
  917. 915.  -     var actsHtml = share;
  918. 916.  -     if (ph.actions.spam) {
  919. 917.  -       //actsHtml += '<a id="pv_spam_link" onclick="Photoview.spamPhoto(this.firstChild)"><div class="progress fl_r"></div>' + getLang('its_spam') + '</a>';
  920. 918.  -       var reportRows = '';
  921. 919.  -       var items = cur.pvReasons;
  922. 920.  -       for(var i in items) {
  923. 921.  -         reportRows += '<a class="pvs_act" onclick="Photoview.report(\''+ph.hash+'\', ' + items[i][0] + ');"><span class="fl_l "></span><span class="pvs_act_text">' + items[i][1] + '</span></a>'
  924. 922.  -
  925. 923.  -       }
  926. 924.  -       actsHtml += '<a id="pv_report" onclick="Photoview.showDD(this, this.nextSibling)"><div class="progress fl_r"></div><span class="pv_act_text">' + getLang('photos_report') + '</span><div class="progress_inline pv_report_upload"></div> </a>'+Photoview.createDD(reportRows, getLang('photos_report'));
  927. 925.  -     }
  928. 926.  -     if (ph.actions.del) {
  929. 927.  -       actsHtml += '<a id="pv_delete_link" onclick="Photoview.deletePhoto()"><div class="progress fl_r" id="pv_delete_progress"></div>' + getLang('global_delete') + '</a>';
  930. 928.  -     }
  931. 929.  -     if (ph.actions.rot) {
  932. 930.  -       actsHtml += '<div id="pv_rotate"><div id="pv_rotate_progress" class="progress fl_r"></div>' + getLang('photos_rotate') + '\
  933. 931.  -     <span onclick="Photoview.rotatePhoto(1)" class="right"></span>\
  934. 932.  -     <span onclick="Photoview.rotatePhoto(-1)" class="left"></span>\
  935. 933.  -     <form method="POST" target="pv_rotate_frame" name="pv_rotate_form" id="pv_rotate_form"></form>\
  936. 934.  -   </div>';
  937. 935.  -     }
  938. 936.  -
  939. 937.  -     if (img.width < 200 || img.height < 200) {
  940. 938.  -       ph.actions.prof = false;
  941. 939.  -       ph.actions.dialog = false;
  942. 940.  -     }
  943. 941.  -     cur.pvNarrow.innerHTML = '\
  944. 942.  - ' + ((ph.album != 'NA' && notAvail != 2 || ph.graffiti) ? '<div class="pv_info">' + getLang('photos_album_name') + '</div><div class="pv_info" id="pv_album">' + ph.album + '</div>' : '') + '\
  945. 943.  - ' + (ph.author != 'NA' ? '<div class="pv_info">' + getLang('photos_author') + '</div><div id="pv_author">' + ph.author + '</div>' : '') + '\
  946. 944.  - <div id="pv_actions">\
  947. 945.  - ' + (fs ? '<a onclick="Photoview.fullscreen()">' + getLang('photos_fullscreen') + '</a>' : '') + '\
  948. 946.  -   <a id="pv_tag_link" onclick="stManager.add([\'phototag.js\', \'phototag.css\', \'tagger.css\', \'tagger.js\'], function() { Phototag.startTag(); })"' + taglnkst + '>' + getLang('photos_tagperson') + '</a>\
  949. 947.  - ' + (ph.actions.prof ? ('<a id="pv_to_profile" onmouseover="Photoview.toProfileTag()" onmouseout="Photoview.hideTag()" onclick="showBox(\'al_page.php\', {act: \'owner_photo_edit\', photo: \'' + ph.id + '\'}, {stat: [\'owner_photo.css\', \'owner_photo.js\', \'tagger.css\', \'tagger.js\']});">' + getLang('photos_load_to_profile') + '</a>') : '') + '\
  950. 948.  - ' + (ph.actions.dialog ? ('<a id="pv_to_dialog" onclick="showBox(\'al_page.php\', {act: \'owner_photo_edit\', photo: \'' + ph.id + '\', oid: ' + ph.actions.dialog + ', list: \'' + cur.pvListId + '\'}, {stat: [\'owner_photo.css\', \'owner_photo.js\', \'tagger.css\', \'tagger.js\']});">' + getLang('photos_load_to_dialog') + '</a>') : '') + '\
  951. 949.  - ' + photoEditAct + '\
  952. 950.  - ' + ((ph.y_src || ph.y_) ? ('<a id="pv_large_link" onclick="Photoview.switchSize()">' + getLang(vk.pvbig ? 'photos_smaller' : 'photos_larger') + '</a>') : '') + '\
  953. 951.  - ' + actsHtml + '\
  954. 952.  - </div>';
  955. 953.  -
  956. 954.  -     var likeop = (ph.liked ? 1 : 0.4), likest = browser.msie ? ('filter: alpha(opacity=' + Math.floor(likeop * 100) + ')') : ('opacity: ' + likeop);
  957. 955.  -
  958. 956.  -     var commstyle = '', commshown = '', commlink = '', commclass = '',
  959. 957.  -         commslikes = cur.pvCommsLikes[ph.id], comms = commslikes[0], likes = commslikes[1];;
  960. 958.  -     if (ph.commcount > ph.commshown) {
  961. 959.  -       commshown = getLang('photos_show_prev_comments', ph.commcount - ph.commshown);
  962. 960.  -     } else {
  963. 961.  -       commstyle = ' style="display: none"';
  964. 962.  -     }
  965. 963.  -
  966. 964.  -     Wall.cancelEdit(true);
  967. 965.  -
  968. 966.  -     var additional = notAvail ? '<div class="clear">' + getLang('photos_in_closed_album') + '</div>' : '\
  969. 967.  - <div id="pv_comments_header" class="clear ' + commclass + '"' + commstyle + ' onclick="Photoview.comments()">\
  970. 968.  -   <div>' + commshown + '</div><div id="pv_comments_progress" class="progress"></div>\
  971. 969.  - </div>\
  972. 970.  - <div id="pv_comments" class="clear wall_module">' + (comms.tagName ? '' : comms) + '</div>', commsNode;
  973. 971.  -
  974. 972.  -     var tagsst = ph.tagshtml ? '' : ' style="display: none"',
  975. 973.  -         descText = '<div' + (ph.actions.edit & 1 ? (' class="pv_can_edit" onclick="Photoview.editInline(event)"' + (ph.desc ? (' onmouseover="Photoview.descTT(this)"') : '')) : ' class="pv_cant_edit"') + '>' + (ph.desc || ('<span class="pv_desc_edit">' + getLang('photos_edit_desc') + '</span>')) + '</div>',
  976. 974.  -         placeText = ph.place ? ('<span class="pv_place_label">' + getLang('photos_place_label') + '</span> <a class="pv_place_a" id="pv_place_a" onclick="Photoview.showPlace()">' + ph.place + '</a>') : '',
  977. 975.  -         addPlace = ph.actions.place ? ('<span' + (placeText ? ' style="display: none;"' : '') + ' id="pv_add_place"><span class="divider fl_l">|</span><a class="fl_l" id="pv_app_place_link" onclick="Photoview.editPlace();">' + getLang('photos_edit_add_place') + '</a></span>') : '';
  978. 976.  -     cur.pvWide.innerHTML = '\
  979. 977.  - <div id="pv_desc" style="' + ((ph.actions.edit & 1 || ph.desc) ? '' : 'display: none') + '">' + descText + '</div>\
  980. 978.  - <div id="pv_place">' + placeText + '</div>\
  981. 979.  - <div id="pv_tags"' + tagsst + '>' + getLang('photos_onthisphoto') + ': ' + ph.tagshtml + '</div>\
  982. 980.  - <div id="pv_inlineedit_prg" class="fl_r progress"></div>\
  983. 981.  - <div id="pv_date_wrap" class="fl_l">' + getLang('photos_added') + ' <span id="pv_date">' + ph.date + '</span></div>\
  984. 982.  - ' + addPlace + (cur.pvNoLikes ? '' : '<span class="divider fl_l">|</span>\
  985. 983.  - <div id="pv_like_wrap" class="fl_l" onmouseover="Photoview.likeOver()" onmouseout="Photoview.likeOut()" onclick="Photoview.like()">\
  986. 984.  -   <span class="fl_l" id="pv_like_link">' + getLang('photos_i_like') + '</span>\
  987. 985.  -   <i class="fl_l' + (likes ? '' : ' nolikes') + '" id="pv_like_icon" style="' + likest + '"></i>\
  988. 986.  -   <span id="pv_like_count" class="fl_l">' + (likes || '') + '</span>\
  989. 987.  - </div>') + (notAvail == 2 ? '' : additional);
  990. 988.  -     if (comms.tagName) {
  991. 989.  -       each(geByClass('page_gif_loading', comms), function() { Page.hideGif(this, false); });
  992. 990.  -       commsNode = ge('pv_comments');
  993. 991.  -       domPN(commsNode).replaceChild(comms, commsNode);
  994. 992.  -     }
  995. 993.  -
  996. 994.  -     extend(cur, {
  997. 995.  -       pvTagLink: ge('pv_tag_link'),
  998. 996.  -       pvLikeIcon: ge('pv_like_icon'),
  999. 997.  -       pvLikeLink: ge('pv_like_link'),
  1000. 998.  -       pvDesc: ge('pv_desc'),
  1001. 999.  -       pvTags: ge('pv_tags'),
  1002. 1000.  -       pvEditing: false
  1003. 1001.  -     });
  1004. 1002.  -
  1005. 1003.  -     if (ph.deleted || !ph.author) {
  1006. 1004.  -       cleanElems('pv_confirm_tag', 'pv_delete_tag', 'pv_prof_cancel', 'pv_prof_done');
  1007. 1005.  -       if (ph.deleted) {
  1008. 1006.  -         cur.pvTagInfo.innerHTML = ph.deleted;
  1009. 1007.  -         show(cur.pvTagInfo);
  1010. 1008.  -       }
  1011. 1009.  -       hide(cur.pvCommentsData, cur.pvHH);
  1012. 1010.  -     } else if (ph.taginfo) {
  1013. 1011.  -       cleanElems('pv_confirm_tag', 'pv_delete_tag', 'pv_prof_cancel', 'pv_prof_done');
  1014. 1012.  -       cur.pvTagInfo.innerHTML = '\
  1015. 1013.  - <table cellspacing="0" cellpadding="0"><tr>\
  1016. 1014.  - <td class="info">' + ph.taginfo + '</td>\
  1017. 1015.  - <td><nobr><div class="button_blue"><button id="pv_confirm_tag">' + getLang('photos_confirm_tag') + '</button></div></td>\
  1018. 1016.  - <td><nobr><div class="button_gray"><button id="pv_delete_tag">' + getLang('photos_delete_tag') + '</button></div></td>\
  1019. 1017.  - <td><div id="pv_tag_handling" class="progress"></div></td>\
  1020. 1018.  - </tr></table>';
  1021. 1019.  -       show(cur.pvTagInfo, cur.pvCommentsData);
  1022. 1020.  -       if (Photoview.hhCheck()) show(cur.pvHH);
  1023. 1021.  -       ge('pv_confirm_tag').onclick = Photoview.confirmTag.pbind(ph.tagid);
  1024. 1022.  -       ge('pv_delete_tag').onclick = Photoview.deleteTag.pbind(ph.tagid);
  1025. 1023.  -     } else {
  1026. 1024.  -       hide(cur.pvTagInfo);
  1027. 1025.  -       show(cur.pvCommentsData);
  1028. 1026.  -       if (Photoview.hhCheck()) show(cur.pvHH);
  1029. 1027.  -     }
  1030. 1028.  -
  1031. 1029.  -     if (notAvail || !ph.actions.comm) {
  1032. 1030.  -       hide(cur.pvYourComment);
  1033. 1031.  -     } else {
  1034. 1032.  -       show(cur.pvYourComment);
  1035. 1033.  -       Wall.initComposer(cur.pvComment, {
  1036. 1034.  -         lang: {
  1037. 1035.  -           introText: getLang('profile_mention_start_typing'),
  1038. 1036.  -           noResult: getLang('profile_mention_not_found')
  1039. 1037.  -         },
  1040. 1038.  -         wddClass: 'pv_composer_dd',
  1041. 1039.  -         width: getSize(domPN(cur.pvYourComment))[0],
  1042. 1040.  -         media: {
  1043. 1041.  -           lnk: cur.pvAddMedia,
  1044. 1042.  -           preview: cur.pvMediaPreview,
  1045. 1043.  -           types: cur.pvMediaTypes,
  1046. 1044.  -           options: {limit: 2, disabledTypes: ['album'], toggleLnk: true, onChange: function() {
  1047. 1045.  -             setTimeout(Photoview.updateHeight, 2);
  1048. 1046.  -           }}
  1049. 1047.  -         }
  1050. 1048.  -       });
  1051. 1049.  -       cur.pvCommentSend.onclick = Photoview.sendComment;
  1052. 1050.  -       if (!cur.pvComment.phevents) {
  1053. 1051.  -         cur.pvComment.placeholder = getLang('reply_to_post');
  1054. 1052.  -         placeholderSetup(cur.pvComment);
  1055. 1053.  -       }
  1056. 1054.  -       if (!cur.pvComment.autosize) {
  1057. 1055.  -         autosizeSetup(cur.pvComment, {minHeight: 65, onResize: Photoview.updateHeight});
  1058. 1056.  -       }
  1059. 1057.  -       if (cur.pvCommenting && cur.pvCommenting != ph.id) {
  1060. 1058.  -         var replyToName = (cur.pvReplyNames[(cur.pvReplyTo || {})[0]] || [])[1];
  1061. 1059.  -         if (replyToName && !replyToName.indexOf(trim(val(cur.pvComment)))) {
  1062. 1060.  -           val(cur.pvComment, '');
  1063. 1061.  -         }
  1064. 1062.  -         cur.pvReplyTo = false;
  1065. 1063.  -         hide('pv_reply_to_title', 'pv_del_reply_to');
  1066. 1064.  -
  1067. 1065.  -         cur.pvCommenting = false;
  1068. 1066.  -       }
  1069. 1067.  -       toggle(cur.pvAsGroup, !!ph.actions.asgr);
  1070. 1068.  -     }
  1071. 1069.  -
  1072. 1070.  -     Photoview.updateArrows();
  1073. 1071.  -     if ((cur.pvOptions || {}).scroll) {
  1074. 1072.  -       layerWrap.scrollTop = cur.pvOptions.scroll;
  1075. 1073.  -     }
  1076. 1074.  -
  1077. 1075.  -     setTimeout(Photoview.afterShow, 2);
  1078. 1076.  -   },
  1079. 1077.  -   afterShow: function() {
  1080. 1078.  -     Photoview.updateHeight();
  1081. 1079.  -     setStyle(layer, {marginTop: 0});
  1082. 1080.  -
  1083. 1081.  -     cur.pvPhoto.href = '/photo' + cur.pvCurPhoto.id;
  1084. 1082.  -     cur.pvPhoto.focus();
  1085. 1083.  -
  1086. 1084.  -     if ((cur.pvCurPhoto.actions.edit & 4) && !cur.pvCurPhoto.desc) {
  1087. 1085.  -       Photoview.editInline();
  1088. 1086.  -     }
  1089. 1087.  -
  1090. 1088.  -     var x = cur.pvPhoto.firstChild.offsetLeft, y = cur.pvPhoto.firstChild.offsetTop;
  1091. 1089.  -     cur.pvTagFrame.innerHTML = '<img style="width: ' + cur.pvPhWidth + 'px; height: ' + cur.pvPhHeight + 'px;" src="' + cur.pvCurData.src + '" />';
  1092. 1090.  -     setStyle(cur.pvTagFaded, {
  1093. 1091.  -       width: cur.pvPhWidth + 'px',
  1094. 1092.  -       height: cur.pvPhHeight + 'px',
  1095. 1093.  -       left: x + 'px',
  1096. 1094.  -       top: y + 'px'
  1097. 1095.  -     });
  1098. 1096.  -     var deltaX = browser.mozilla && ((lastWindowWidth - cur.pvActualWidth) % 2) && ((cur.pvActualWidth - cur.pvPhWidth) % 2) ? 4 : 3;
  1099. 1097.  -     setStyle(cur.pvTagFrame, {
  1100. 1098.  -       left: (x - deltaX) + 'px', // 3 - tag frame border, mozilla buggy
  1101. 1099.  -       top: (y - 3) + 'px'
  1102. 1100.  -     });
  1103. 1101.  -     setStyle(cur.pvTagPerson, {
  1104. 1102.  -       left: x + 'px',
  1105. 1103.  -       top: y + 'px'
  1106. 1104.  -     });
  1107. 1105.  -
  1108. 1106.  -     if ((cur.pvOptions || {}).scroll) {
  1109. 1107.  -       layerWrap.scrollTop = cur.pvOptions.scroll;
  1110. 1108.  -       cur.pvOptions.scroll = 0;
  1111. 1109.  -     }
  1112. 1110.  -
  1113. 1111.  -     Photoview.updateLoc();
  1114. 1112.  -   },
  1115. 1113.  -   updateLoc: function() {
  1116. 1114.  -     var nl, listId = cur.pvListId;
  1117. 1115.  -     if (cur.pvRoot) {
  1118. 1116.  -       nl = {0: 'photo' + cur.pvCurPhoto.id};
  1119. 1117.  -       if (listId.substr(0, 6) == 'photos') {
  1120. 1118.  -         nl.all = 1;
  1121. 1119.  -       } else if (listId.substr(0, 3) == 'tag') {
  1122. 1120.  -         nl.tag = intval(listId.substr(3));
  1123. 1121.  -       } else if (listId.substr(0, 6) == 'newtag') {
  1124. 1122.  -         nl.newtag = intval(listId.substr(6));
  1125. 1123.  -       }
  1126. 1124.  -       if (listId.indexOf('/rev') != -1) {
  1127. 1125.  -         nl.rev = 1;
  1128. 1126.  -       }
  1129. 1127.  -     } else {
  1130. 1128.  -       nl = extend(nav.objLoc, {z: 'photo' + cur.pvCurPhoto.id + '/' + (cur.pvCurPhoto.list_override || listId)});
  1131. 1129.  -     }
  1132. 1130.  -
  1133. 1131.  -     if (nav.strLoc != nav.toStr(nl)) {
  1134. 1132.  -       if (!cur.pvNoHistory) {
  1135. 1133.  -         ++cur.pvHistoryLength;
  1136. 1134.  -       }
  1137. 1135.  -       nav.setLoc(nl);
  1138. 1136.  -       if ((cur.pvOptions || {}).fromQueue) {
  1139. 1137.  -         cur.pvNoHistory = true;
  1140. 1138.  -         cur.pvHistoryLength = 0;
  1141. 1139.  -       }
  1142. 1140.  -     }
  1143. 1141.  -     if (cur.pvOptions) cur.pvOptions.fromQueue = false;
  1144. 1142.  -   },
  1145. 1143.  -
  1146. 1144.  -   canFullscreen: function() {
  1147. 1145.  -     var b = browser, v = floatval(browser.version);
  1148. 1146.  -     return (b.chrome && v > 15) ||
  1149. 1147.  -       (b.mozilla && v > 9) ||
  1150. 1148.  -       (b.safari && v > 5 && !b.mobile);
  1151. 1149.  -   },
  1152. 1150.  -   fullscreenOnLoad: function() {
  1153. 1151.  -     if (window.FullscreenPV) {
  1154. 1152.  -       FullscreenPV.slide();
  1155. 1153.  -     }
  1156. 1154.  -   },
  1157. 1155.  -   fullscreenEnd: function(finishing) {
  1158. 1156.  -     var el = cur.pvCanvas;
  1159. 1157.  -     if (!el) return;
  1160. 1158.  -     cleanElems(el);
  1161. 1159.  -     re(el);
  1162. 1160.  -     clearTimeout(cur.pvFSTimer);
  1163. 1161.  -     clearTimeout(cur.pvFSControlsTimer);
  1164. 1162.  -     cur.pvCanvas = cur.pvFSControls = cur.pvFSTimer = cur.pvFSControlsTimer = false;
  1165. 1163.  -     removeEvent(document, 'webkitfullscreenchange mozfullscreenchange fullscreenchange webkitfullscreenerror mozfullscreenerror fullscreenerror');
  1166. 1164.  -     show(pageNode);
  1167. 1165.  -     if (cur.pvScrWasY !== undefined) {
  1168. 1166.  -       scrollToY(cur.pvScrWasY, 0);
  1169. 1167.  -       delete cur.pvScrWasY;
  1170. 1168.  -     }
  1171. 1169.  -     if (finishing !== true) {
  1172. 1170.  -       Photoview.updateSize();
  1173. 1171.  -       Photoview.show(cur.pvListId, cur.pvIndex);
  1174. 1172.  -     }
  1175. 1173.  -   },
  1176. 1174.  -   fullscreen: function() {
  1177. 1175.  -     if (cur.pvCanvas) return;
  1178. 1176.  -     var el = cur.pvCanvas = bodyNode.appendChild(ce('div', {className: 'fixed', id: 'pv_fullscreen', innerHTML: '<div></div>'})), method = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen || el.msRequestFullScreen;
  1179. 1177.  -
  1180. 1178.  -     cur.pvFinishing = false;
  1181. 1179.  -     stManager.add(['fullscreen_pv.css', 'fullscreen_pv.js'], function() {
  1182. 1180.  -       FullscreenPV.init();
  1183. 1181.  -     });
  1184. 1182.  -
  1185. 1183.  -     addEvent(document, 'webkitfullscreenchange mozfullscreenchange fullscreenchange', Photoview.onFullscreen);
  1186. 1184.  -     addEvent(document, 'webkitfullscreenerror mozfullscreenerror fullscreenerror', Photoview.fullscreenEnd.pbind(true));
  1187. 1185.  -
  1188. 1186.  -     try {
  1189. 1187.  -       method.call(el);
  1190. 1188.  -     } catch(e) {
  1191. 1189.  -       cur.pvPartScreen = true;
  1192. 1190.  -       Photoview.onFullscreen();
  1193. 1191.  -     }
  1194. 1192.  -   },
  1195. 1193.  -   fullscreenStop: function(finishing) {
  1196. 1194.  -     cur.pvFinishing = (finishing === true);
  1197. 1195.  -     cur.pvPartScreen = false;
  1198. 1196.  -     var method = document.exitFullscreen || document.mozCancelFullScreen || document.webkitCancelFullScreen;
  1199. 1197.  -     try {
  1200. 1198.  -       method();
  1201. 1199.  -     } catch(e) {
  1202. 1200.  -       Photoview.onFullscreen();
  1203. 1201.  -     }
  1204. 1202.  -     Photoview.fullscreenEnd();
  1205. 1203.  -   },
  1206. 1204.  -   onFullscreen: function() {
  1207. 1205.  -     if (document.fullScreenElement || document.mozFullScreen || document.webkitIsFullScreen || cur.pvPartScreen) {
  1208. 1206.  -       if (cur.pvTagger) {
  1209. 1207.  -         Phototag.stopTag();
  1210. 1208.  -       }
  1211. 1209.  -       vk.oldpvbig = vk.pvbig;
  1212. 1210.  -       vk.pvbig = true;
  1213. 1211.  -       cur.pvScrWidth = cur.pvCanvas.offsetWidth;
  1214. 1212.  -       cur.pvScrHeight = cur.pvCanvas.offsetHeight;
  1215. 1213.  -       cur.pvScrWasY = scrollGetY();
  1216. 1214.  -       hide(pageNode);
  1217. 1215.  -       if (!cur.pvFinishing) {
  1218. 1216.  -         Photoview.updateSize();
  1219. 1217.  -         Photoview.show(cur.pvListId, cur.pvIndex);
  1220. 1218.  -       }
  1221. 1219.  -     } else {
  1222. 1220.  -       vk.pvbig = vk.oldpvbig;
  1223. 1221.  -       Photoview.fullscreenEnd(cur.pvFinishing);
  1224. 1222.  -     }
  1225. 1223.  -   },
  1226. 1224.  -
  1227. 1225.  -   showDD: function(obj, dd) {
  1228. 1226.  -     if (hasClass(obj, 'pv_report_blocked')) {
  1229. 1227.  -       return;
  1230. 1228.  -     }
  1231. 1229.  -     clearTimeout(cur.hideShareTimer);
  1232. 1230.  -     obj.blur();
  1233. 1231.  -     if (hasClass(dd, 'pv_dd_hiding')) {
  1234. 1232.  -       return;
  1235. 1233.  -     }
  1236. 1234.  -     if (isVisible(dd)) {
  1237. 1235.  -       return fadeIn(dd, 0);
  1238. 1236.  -     }
  1239. 1237.  -     if (cur.ddShown) {
  1240. 1238.  -       Photoview.hideDD(0);
  1241. 1239.  -     }
  1242. 1240.  -     cur.ddShown = dd;
  1243. 1241.  -     setTimeout(addEvent.pbind(document, 'click', Photoview.hideDD), 1);
  1244. 1242.  -     show(dd);
  1245. 1243.  -   },
  1246. 1244.  -
  1247. 1245.  -   hideDD: function(timeout) {
  1248. 1246.  -     if (timeout > 0) {
  1249. 1247.  -       cur.hideShareTimer = setTimeout(Photoview.hideDD.pbind(0), timeout);
  1250. 1248.  -       return;
  1251. 1249.  -     }
  1252. 1250.  -     var dd = cur.ddShown;
  1253. 1251.  -     if (!dd) return;
  1254. 1252.  -     if (timeout == -1) {
  1255. 1253.  -       hide(dd);
  1256. 1254.  -     } else {
  1257. 1255.  -       addClass(dd, 'mv_dd_hiding')
  1258. 1256.  -       fadeOut(dd, 200, function() {
  1259. 1257.  -         removeClass(dd, 'mv_dd_hiding')
  1260. 1258.  -       });
  1261. 1259.  -     }
  1262. 1260.  -     removeEvent(document, 'click', Photoview.hideDD);
  1263. 1261.  -     cur.ddShown = false;
  1264. 1262.  -   },
  1265. 1263.  -
  1266. 1264.  -   createDD: function(rows, name) {
  1267. 1265.  -      return '<div onmouseover="Photoview.showDD(this.previousSibling, this);" onmouseout="Photoview.hideDD(500)" onclick="Photoview.hideDD(-1)" class="pvs_dd fixed"><table cellspacing="0" cellpadding="0"><tr>\
  1268. 1266.  -     <td class="pvs_side_sh"><div class="pvs_side_sh_el"></div></td>\
  1269. 1267.  -     <td>\
  1270. 1268.  -       <div class="pvs_header_wrap"><div class="pvs_header"><span class="pvs_header_text">' + name + '</span></div></div>\
  1271. 1269.  -       <div class="pvs_acts">' + rows + '</div>\
  1272. 1270.  -       <div class="pvs_sh1"></div><div class="pvs_sh2"></div>\
  1273. 1271.  -     </td>\
  1274. 1272.  -     <td class="pvs_side_sh"><div class="pvs_side_sh_el"></div></td>\
  1275. 1273.  -   </tr></table></div>'
  1276. 1274.  -   },
  1277. 1275.  -
  1278. 1276.  -   report: function(hash, reason) {
  1279. 1277.  -     var ids = cur.pvCurPhoto.id.split('_');
  1280. 1278.  -     ajax.post('reports.php', {act: 'new_report', type: 'photo', reason: reason, hash: hash, oid: ids[0], item_id: ids[1]}, {
  1281. 1279.  -       onDone: function(text) {
  1282. 1280.  -         var cont = ge('pv_report');
  1283. 1281.  -         cont.parentNode.replaceChild(ce('div', {className: 'pv_report_blocked', innerHTML: text}), cont);
  1284. 1282.  -       },
  1285. 1283.  -       showProgress: function() {
  1286. 1284.  -         var cont = ge('pv_report');
  1287. 1285.  -         addClass(cont, 'pv_report_blocked');
  1288. 1286.  -       },
  1289. 1287.  -       hideProgress: function() {
  1290. 1288.  -         var cont = ge('mv_report');
  1291. 1289.  -         removeClass(cont, 'pv_report_blocked');
  1292. 1290.  -       }
  1293. 1291.  -     });
  1294. 1292.  -   },
  1295. 1293.  -
  1296. 1294.  -   showShare: function() {
  1297. 1295.  -     clearTimeout(cur.hideShareTimer);
  1298. 1296.  -     var dd = ge('pvs_dd');
  1299. 1297.  -     ge('pv_share').blur();
  1300. 1298.  -     if (isVisible(dd)) {
  1301. 1299.  -       return fadeIn(dd, 0);
  1302. 1300.  -     }
  1303. 1301.  -     setTimeout(addEvent.pbind(document, 'click', Photoview.hideShare), 1);
  1304. 1302.  -     show(dd);
  1305. 1303.  -   },
  1306. 1304.  -   hideShare: function(timeout) {
  1307. 1305.  -     if (timeout > 0) {
  1308. 1306.  -       cur.hideShareTimer = setTimeout(Photoview.hideShare.pbind(0), timeout);
  1309. 1307.  -       return;
  1310. 1308.  -     }
  1311. 1309.  -     var dd = ge('pvs_dd');
  1312. 1310.  -     if (!dd) return;
  1313. 1311.  -     if (timeout == -1) {
  1314. 1312.  -       hide(dd);
  1315. 1313.  -     } else {
  1316. 1314.  -       fadeOut(dd, 200);
  1317. 1315.  -     }
  1318. 1316.  -     removeEvent(document, 'click', Photoview.hideShare);
  1319. 1317.  -   },
  1320. 1318.  -   savePhoto: function() {
  1321. 1319.  -     var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index];
  1322. 1320.  -     ajax.post('al_photos.php', {act: 'save_me', photo: ph.id, list: listId, hash: ph.hash}, {progress: 'pv_share_prg', onDone: showDoneBox});
  1323. 1321.  -   },
  1324. 1322.  -   sendPhoto: function() {
  1325. 1323.  -     var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index];
  1326. 1324.  -     showBox('like.php', {act: 'publish_box', object: 'photo' + ph.id, list: listId, to: 'mail'}, {stat: ['page.js', 'page.css', 'wide_dd.js', 'wide_dd.css', 'sharebox.js']});
  1327. 1325.  -   },
  1328. 1326.  -
  1329. 1327.  -   setTags: function(tags) {
  1330. 1328.  -     Photoview.hideTag();
  1331. 1329.  -     if (!tags) {
  1332. 1330.  -       hide(cur.pvTags);
  1333. 1331.  -       return;
  1334. 1332.  -     }
  1335. 1333.  -     show(cur.pvTags);
  1336. 1334.  -     if (window.tooltips) {
  1337. 1335.  -       each(geByClass('delete', cur.pvTags), function() {
  1338. 1336.  -         tooltips.destroy(this);
  1339. 1337.  -       });
  1340. 1338.  -     }
  1341. 1339.  -     cur.pvTags.innerHTML = getLang('photos_onthisphoto') + ': ' + tags;
  1342. 1340.  -   },
  1343. 1341.  -   preload: function(from, direction) {
  1344. 1342.  -     window.updateWndVScroll && updateWndVScroll(); // Because called on photo load
  1345. 1343.  -     var listId = cur.pvListId, count = ((cur.pvData || {})[listId] || {}).length;
  1346. 1344.  -     if (!count) return;
  1347. 1345.  -
  1348. 1346.  -     var s1 = vk.pvbig ? (cur.pvVeryBig > 1 ? 'z' : (cur.pvVeryBig ? 'z' : 'y')) : 'x';
  1349. 1347.  -     var s2 = vk.pvbig ? (cur.pvVeryBig > 1 ? 'z' : (cur.pvVeryBig ? 'y' : 'x')) : 0;
  1350. 1348.  -     var s3 = vk.pvbig ? (cur.pvVeryBig > 1 ? 'y' : (cur.pvVeryBig ? 'x' : 0)) : 0;
  1351. 1349.  -
  1352. 1350.  -     cur.pvLastFrom = from;
  1353. 1351.  -     cur.pvLastDirection = direction;
  1354. 1352.  -
  1355. 1353.  -     // remove preloaded ones without touching preloading ones
  1356. 1354.  -     for (var i = 0; i < Math.min(Photoview.cacheSize, count - Photoview.cacheSize); ++i) {
  1357. 1355.  -       var ind = from + (i + 1) * (-direction);
  1358. 1356.  -       while (ind >= count) ind -= count;
  1359. 1357.  -       while (ind < 0) ind += count;
  1360. 1358.  -
  1361. 1359.  -       var p = cur.pvData[listId][ind];
  1362. 1360.  -       if (!p) continue;
  1363. 1361.  -       for (var j = 0, l = Photoview.allSizes.length; j < l; ++j) {
  1364. 1362.  -         var s = Photoview.allSizes[j];
  1365. 1363.  -         if (p[s] && p[s].src) {
  1366. 1364.  -           p[s].src = Photoview.blank;
  1367. 1365.  -           delete(p[s]);
  1368. 1366.  -         }
  1369. 1367.  -       }
  1370. 1368.  -     }
  1371. 1369.  -     for (var i = 0; i < Photoview.cacheSize; ++i) {
  1372. 1370.  -       var ind = from + (i + 1) * direction;
  1373. 1371.  -       while (ind >= count) ind -= count;
  1374. 1372.  -       while (ind < 0) ind += count;
  1375. 1373.  -
  1376. 1374.  -       var p = cur.pvData[listId][ind];
  1377. 1375.  -       if (!p || !p.id) {
  1378. 1376.  -         if (!p || (vkNow() - p > 3000)) {
  1379. 1377.  -           cur.pvData[listId][ind] = vkNow();
  1380. 1378.  -           setTimeout(function() {
  1381. 1379.  -             ajax.post('al_photos.php', {act: 'show', list: listId, offset: Photoview.realOffset(listId, ind, -1), direction: direction}, {onDone: Photoview.loaded});
  1382. 1380.  -           }, 10);
  1383. 1381.  -         }
  1384. 1382.  -         break;
  1385. 1383.  -       }
  1386. 1384.  -
  1387. 1385.  -       if (p[s1]) continue;
  1388. 1386.  -       if (p[s1 + '_src']) {
  1389. 1387.  -         p[s1] = vkImage();
  1390. 1388.  -         p[s1].src = p[s1 + '_src'];
  1391. 1389.  -         continue;
  1392. 1390.  -       } else {
  1393. 1391.  -         p[s1] = 1;
  1394. 1392.  -       }
  1395. 1393.  -
  1396. 1394.  -       if (p[s2]) continue;
  1397. 1395.  -       if (p[s2 + '_src']) {
  1398. 1396.  -         p[s2] = vkImage();
  1399. 1397.  -         p[s2].src = p[s2 + '_src'];
  1400. 1398.  -         continue;
  1401. 1399.  -       } else {
  1402. 1400.  -         p[s2] = 1;
  1403. 1401.  -       }
  1404. 1402.  -
  1405. 1403.  -       if (p[s3]) continue;
  1406. 1404.  -       if (p[s3 + '_src']) {
  1407. 1405.  -         p[s3] = vkImage();
  1408. 1406.  -         p[s3].src = p[s3 + '_src'];
  1409. 1407.  -         continue;
  1410. 1408.  -       } else {
  1411. 1409.  -         p[s3] = 1;
  1412. 1410.  -       }
  1413. 1411.  -
  1414. 1412.  -       if (p.x) continue;
  1415. 1413.  -       p.x = vkImage();
  1416. 1414.  -       p.x.src = p.x_src;
  1417. 1415.  -     }
  1418. 1416.  -   },
  1419. 1417.  -   hide: function(noLoc, fromQueue) {
  1420. 1418.  -     if (!cur.pvShown || __afterFocus && fromQueue !== true) return;
  1421. 1419.  -     if (cur.pvCanvas) Photoview.fullscreenStop(true);
  1422. 1420.  -
  1423. 1421.  -     if ((cur.pvJumpTo || {}).z == 'albums' + val('pva_owner') && !cur.pvAlbumsShown && noLoc === 0) {
  1424. 1422.  -       return Photoview.jumpToAlbums(true);
  1425. 1423.  -     }
  1426. 1424.  -     if ((cur.pvJumpTo || {}).z == 'album' + val('pvsa_album') && !cur.pvAlbumShown && noLoc === 0) {
  1427. 1425.  -       return Photoview.jumpToAlbum(true);
  1428. 1426.  -     }
  1429. 1427.  -     if ((cur.pvJumpTo || {}).z == 'tag' + val('pvsa_tag') && !cur.pvPhotoTagShown && noLoc === 0) {
  1430. 1428.  -       return Photoview.jumpToTagged(true);
  1431. 1429.  -     }
  1432. 1430.  -     if (cur.pvListId == 'temp') {
  1433. 1431.  -       cur.pvCancelLoad();
  1434. 1432.  -     } else if (!cur.pvNoHistory && !noLoc && cur.pvHistoryLength > 0 && cur.pvHistoryLength < 10) {
  1435. 1433.  -       cur.pvNoHistory = true;
  1436. 1434.  -       __adsUpdate('very_lazy');
  1437. 1435.  -       return history.go(-cur.pvHistoryLength);
  1438. 1436.  -     }
  1439. 1437.  -
  1440. 1438.  -     if (noLoc !== true && !layerQueue.count()) {
  1441. 1439.  -       var newLoc;
  1442. 1440.  -       if (cur.pvRoot) {
  1443. 1441.  -         if (cur.pvListId.substr(0, 6) == 'newtag') {
  1444. 1442.  -           newLoc = 'albums' + vk.id + '?act=added';
  1445. 1443.  -           if (cur.pvListId.indexOf('/rev') != -1) {
  1446. 1444.  -             newLoc += '&rev=1';
  1447. 1445.  -           }
  1448. 1446.  -         } else {
  1449. 1447.  -           newLoc = cur.pvListId.replace('/rev', '?rev=1');
  1450. 1448.  -         }
  1451. 1449.  -         nav.setLoc(newLoc);
  1452. 1450.  -       } else {
  1453. 1451.  -         newLoc = clone(nav.objLoc);
  1454. 1452.  -         delete(newLoc.z);
  1455. 1453.  -       }
  1456. 1454.  -       if (nav.strLoc != nav.toStr(newLoc)) {
  1457. 1455.  -         nav.setLoc(newLoc);
  1458. 1456.  -       }
  1459. 1457.  -       __adsUpdate('very_lazy');
  1460. 1458.  -     }
  1461. 1459.  -
  1462. 1460.  -     window.__pvhideTimer = setTimeout(Photoview.doHide.pbind(cur), 0);
  1463. 1461.  -     __adsUpdate();
  1464. 1462.  -
  1465. 1463.  - //    if (window.wkcur && wkcur.scrollTop) {
  1466. 1464.  - //      setTimeout(function() {
  1467. 1465.  - //        window.wkLayerWrap.scrollTop = wkcur.scrollTop;
  1468. 1466.  - //        wkcur.scrollTop = false;
  1469. 1467.  - //      }, 0);
  1470. 1468.  - //    }
  1471. 1469.  -     if (cur.pvHHMove) {
  1472. 1470.  -       removeEvent(layer, 'mousemove', Photoview.photoAct);
  1473. 1471.  -       cur.pvHHMove = false;
  1474. 1472.  -     }
  1475. 1473.  -     cur.pvAlbumsShowing = cur.pvAlbumsShown = false;
  1476. 1474.  -     cur.pvAlbumShowing = cur.pvAlbumShown = false;
  1477. 1475.  -     cur.pvPhotoTagShowing = cur.pvPhotoTagShown = false;
  1478. 1476.  -     cur.pvVideoTagShowing = cur.pvVideoTagsShown = false;
  1479. 1477.  -   },
  1480. 1478.  -   doHide: function(c) {
  1481. 1479.  -     c.pvHistoryLength = 0;
  1482. 1480.  -     if (cur.pvTagger) Phototag.stopTag();
  1483. 1481.  -     cleanElems('pv_confirm_tag', 'pv_delete_tag', 'pv_prof_cancel', 'pv_prof_done');
  1484. 1482.  -     if (c.pvFriends) {
  1485. 1483.  -       cleanElems('pv_add_tag', 'pv_cancel_tag', c.pvFriends.firstChild.firstChild, c.pvFriends);
  1486. 1484.  -       re(c.pvFriends);
  1487. 1485.  -       c.pvFriends = c.pvFriendName = false;
  1488. 1486.  -     }
  1489. 1487.  -
  1490. 1488.  -     Wall.cancelEdit(true);
  1491. 1489.  -
  1492. 1490.  -     removeEvent(c.pvPhoto, 'mousemove', Photoview.onMouseMove);
  1493. 1491.  -
  1494. 1492.  -     // remove preloaded
  1495. 1493.  -     var listId = c.pvListId, count = ((c.pvData || {})[listId] || {}).length;
  1496. 1494.  -     if (c.pvLastDirection && count) {
  1497. 1495.  -       for (var i = 0; i < Photoview.cacheSize; ++i) {
  1498. 1496.  -         var ind = c.pvLastFrom + (i + 1) * c.pvLastDirection;
  1499. 1497.  -         while (ind >= count) ind -= count;
  1500. 1498.  -         while (ind < 0) ind += count;
  1501. 1499.  -
  1502. 1500.  -         var p = c.pvData[listId][ind];
  1503. 1501.  -         if (!p) continue;
  1504. 1502.  -         for (var j = 0, l = Photoview.allSizes.length; j < l; ++j) {
  1505. 1503.  -           var s = Photoview.allSizes[j];
  1506. 1504.  -           if (p[s] && p[s].src) {
  1507. 1505.  -             p[s].src = Photoview.blank;
  1508. 1506.  -             delete(p[s]);
  1509. 1507.  -           }
  1510. 1508.  -         }
  1511. 1509.  -       }
  1512. 1510.  -       c.pvLastDirection = c.pvLastFrom = false;
  1513. 1511.  -     }
  1514. 1512.  -
  1515. 1513.  -     cur.pvYourComment = re(cur.pvYourComment);
  1516. 1514.  -
  1517. 1515.  -     layers.hide();
  1518. 1516.  -     layers.fullhide = false;
  1519. 1517.  -
  1520. 1518.  -     Photoview.hideTag(true);
  1521. 1519.  -     each(['pvLeft', 'pvClose', 'pvSwitch', 'pvFixed'], function() {
  1522. 1520.  -       var n = this + '';
  1523. 1521.  -       re(c[n]);
  1524. 1522.  -       c[n] = false;
  1525. 1523.  -     });
  1526. 1524.  -     if (window.tooltips) {
  1527. 1525.  -       tooltips.destroyAll(cur.pvBox);
  1528. 1526.  -     }
  1529. 1527.  -
  1530. 1528.  -     if (browser.mobile) {
  1531. 1529.  -       ge('footer').style.height = '';
  1532. 1530.  -     }
  1533. 1531.  -
  1534. 1532.  -     var colorClass = vk.pvdark ? 'pv_dark' : 'pv_light';
  1535. 1533.  -     removeClass(layerWrap, colorClass);
  1536. 1534.  -     removeClass(layerBG, colorClass);
  1537. 1535.  -     layerBG.style.opacity = '';
  1538. 1536.  -
  1539. 1537.  -     c.pvShown = c.pvListId = c.pvClicked = false;
  1540. 1538.  -     removeEvent(window, 'resize', Photoview.onResize);
  1541. 1539.  -     removeEvent(document, 'keydown', Photoview.onKeyDown);
  1542. 1540.  -     removeEvent(layerWrap, 'click', Photoview.onClick);
  1543. 1541.  -     removeEvent(layerWrap, 'scroll', Photoview.scrollResize);
  1544. 1542.  -
  1545. 1543.  - //    if (window.wkcur && wkcur.shown) {
  1546. 1544.  - //      WkView.showLayer();
  1547. 1545.  - //    }
  1548. 1546.  -     var onh = cur.pvOptions && cur.pvOptions.onHide;
  1549. 1547.  -     if (cur.pvOptions) {
  1550. 1548.  -       var onh = cur.pvOptions.onHide;
  1551. 1549.  -       cur.pvOptions.onHide = false;
  1552. 1550.  -       if (onh) onh();
  1553. 1551.  -     }
  1554. 1552.  -     layerQueue.pop();
  1555. 1553.  -
  1556. 1554.  -     if (c.pvPreloaded && c === cur) {
  1557. 1555.  -       var cont = ge('photos_container'), d = ce('div', {innerHTML: c.pvPreloaded});
  1558. 1556.  -       while (d.firstChild) {
  1559. 1557.  -         cont.appendChild(d.firstChild);
  1560. 1558.  -       }
  1561. 1559.  -       if (cont.qsorter) {
  1562. 1560.  -         setTimeout(qsorter.added.pbind(cont), 0);
  1563. 1561.  -       }
  1564. 1562.  -       c.pvPreloaded = false;
  1565. 1563.  -     }
  1566. 1564.  -   },
  1567. 1565.  -   editPhoto: function() {
  1568. 1566.  -   },
  1569. 1567.  -   descTT: function(el) {
  1570. 1568.  -     return showTooltip(el, {
  1571. 1569.  -       text: getLang('photos_edit_desc'),
  1572. 1570.  -       black: 1,
  1573. 1571.  -       shift: [2, 4, 0],
  1574. 1572.  -       showdt: 0
  1575. 1573.  -     });
  1576. 1574.  -   },
  1577. 1575.  -   editInline: function(ev, noreq) {
  1578. 1576.  -     if (((ev || window.event || {}).target || {}).tagName == 'A' || cur.pvEditing) return;
  1579. 1577.  -
  1580. 1578.  -     var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index], noreq = !ph.desc;
  1581. 1579.  -     var onDone = function(text) {
  1582. 1580.  -       if (!cur.pvShown || cur.pvListId != listId || cur.pvIndex != index || cur.pvEditing) return;
  1583. 1581.  -
  1584. 1582.  -       cur.pvEditing = [listId, index];
  1585. 1583.  -       var mrg = '0px 0px 0px', taStyle = '';
  1586. 1584.  -       if (browser.chrome) {
  1587. 1585.  -         mrg = '0px 0px -5px';
  1588. 1586.  -         taStyle = ' style="padding-bottom: 0px"';
  1589. 1587.  -       } else if (browser.mozilla) {
  1590. 1588.  -         mrg = '0px -1px 0px';
  1591. 1589.  -       } else if (browser.msie) {
  1592. 1590.  -         mrg = '0px 0px -6px';
  1593. 1591.  -       }
  1594. 1592.  -       var el = cur.pvDesc.appendChild(ce('div', {innerHTML: '\
  1595. 1593.  - <div style="margin: ' + mrg + '">\
  1596. 1594.  -   <textarea id="pv_edit_text"' + taStyle + ' onkeydown="onCtrlEnter(event, Photoview.saveInline)" placeholder="' + getLang('photos_edit_desc_intro') + '">' + text + '</textarea>\
  1597. 1595.  - </div>'}, {display: 'none'})), txt = ge('pv_edit_text');
  1598. 1596.  -       placeholderSetup(txt, {back: 1});
  1599. 1597.  -       autosizeSetup(txt, {minHeight: 13});
  1600. 1598.  -       setTimeout(function() {
  1601. 1599.  -         show(el);
  1602. 1600.  -         elfocus(txt);
  1603. 1601.  -         addEvent(txt, 'blur', Photoview.saveInline);
  1604. 1602.  -         hide(cur.pvDesc.firstChild);
  1605. 1603.  -       }, 1);
  1606. 1604.  -     };
  1607. 1605.  -     if (!noreq) {
  1608. 1606.  -       ajax.post('al_photos.php', {act: 'edit_desc', photo: ph.id}, {onDone: onDone, progress: 'pv_inlineedit_prg'});
  1609. 1607.  -     } else {
  1610. 1608.  -       onDone('');
  1611. 1609.  -     }
  1612. 1610.  -   },
  1613. 1611.  -   cancelInline: function() {
  1614. 1612.  -     cur.pvEditing = false;
  1615. 1613.  -     removeEvent(ge('pv_edit_text'), 'blur');
  1616. 1614.  -     show(cur.pvDesc.firstChild);
  1617. 1615.  -     re(cur.pvDesc.firstChild.nextSibling);
  1618. 1616.  -   },
  1619. 1617.  -   saveInline: function() {
  1620. 1618.  -     if (!cur.pvEditing) return;
  1621. 1619.  -     removeEvent(ge('pv_edit_text'), 'blur');
  1622. 1620.  -
  1623. 1621.  -     var listId = cur.pvEditing[0], index = cur.pvEditing[1], ph = cur.pvData[listId][index];
  1624. 1622.  -     ajax.post('al_photos.php', {act: 'save_desc', photo: ph.id, hash: ph.hash, text: val('pv_edit_text')}, {onDone: function(text) {
  1625. 1623.  -       ph.desc = text;
  1626. 1624.  -
  1627. 1625.  -       var shown = cur.pvShown && listId == cur.pvListId && index == cur.pvIndex;
  1628. 1626.  -       if (!shown) return;
  1629. 1627.  -
  1630. 1628.  -       cur.pvEditing = false;
  1631. 1629.  -       var d = domFC(cur.pvDesc);
  1632. 1630.  -       val(d, text || ('<span class="pv_desc_edit">' + getLang('photos_edit_desc') + '</span>'));
  1633. 1631.  -       d.onmouseover = text ? Photoview.descTT.pbind(d) : function() {};
  1634. 1632.  -       show(d);
  1635. 1633.  -       re(domNS(d));
  1636. 1634.  -     }, progress: 'pv_inlineedit_prg'});
  1637. 1635.  -   },
  1638. 1636.  -
  1639. 1637.  -   cmp: function(id1, id2) {
  1640. 1638.  -     var l1 = id1.length, l2 = id2.length;
  1641. 1639.  -     if (l1 < l2) {
  1642. 1640.  -       return -1;
  1643. 1641.  -     } else if (l1 > l2) {
  1644. 1642.  -       return 1;
  1645. 1643.  -     } else if (id1 < id2) {
  1646. 1644.  -       return -1;
  1647. 1645.  -     } else if (id1 > id2) {
  1648. 1646.  -       return 1;
  1649. 1647.  -     }
  1650. 1648.  -     return 0;
  1651. 1649.  -   },
  1652. 1650.  -   receiveComms: function(listId, index, text, names, noOld, toUp) {
  1653. 1651.  -     if (listId != cur.pvListId || index != cur.pvIndex) return;
  1654. 1652.  -
  1655. 1653.  -     var n = ce('div', {innerHTML: text}), comms = ge('pv_comments'), last = current = domLC(comms), frm = getXY(current, true)[1], ph = cur.pvData[listId][index];
  1656. 1654.  -     for (var el = domLC(n); el; el = domLC(n)) {
  1657. 1655.  -       if (ph.actions.comm) addClass(el, 'reply_replieable');
  1658. 1656.  -       while (current && Photoview.cmp(current.id, el.id) > 0) {
  1659. 1657.  -         current = domPS(current);
  1660. 1658.  -       }
  1661. 1659.  -       if (current && !Photoview.cmp(current.id, el.id)) {
  1662. 1660.  -         comms.replaceChild(el, current);
  1663. 1661.  -         current = el;
  1664. 1662.  -       } else {
  1665. 1663.  -         if (current && domNS(current)) {
  1666. 1664.  -           comms.insertBefore(el, domNS(current));
  1667. 1665.  -         } else if (!current && domFC(comms)) {
  1668. 1666.  -           if (noOld === true) {
  1669. 1667.  -             --ph.commshown;
  1670. 1668.  -             n.removeChild(el);
  1671. 1669.  -           } else {
  1672. 1670.  -             comms.insertBefore(el, domFC(comms));
  1673. 1671.  -           }
  1674. 1672.  -         } else {
  1675. 1673.  -           comms.appendChild(el);
  1676. 1674.  -         }
  1677. 1675.  -         ++ph.commshown;
  1678. 1676.  -       }
  1679. 1677.  -     }
  1680. 1678.  -     if (toUp && last) {
  1681. 1679.  -       layerWrap.scrollTop += getXY(last, true)[1] - frm;
  1682. 1680.  -     }
  1683. 1681.  -     cur.pvCommsLikes[ph.id][0] = comms;
  1684. 1682.  -     extend(cur.pvReplyNames, names);
  1685. 1683.  -     Photoview.updateComms();
  1686. 1684.  -   },
  1687. 1685.  -   commSaved: function(post) {
  1688. 1686.  -     if (!cur.pvShown) return;
  1689. 1687.  -     var comms = ge('pv_comments'), ph = comms ? cur.pvData[cur.pvListId][cur.pvIndex] : false, comm = post.match(/^(-?\d+)photo(_\d+)/);
  1690. 1688.  -     if (!ph || !comm || !ge('pv_comment' + comm[1] + comm[2])) return;
  1691. 1689.  -     cur.pvCommsLikes[ph.id][0] = comms;
  1692. 1690.  -   },
  1693. 1691.  -   comments: function(showcomm) {
  1694. 1692.  -     if (showcomm) {
  1695. 1693.  -       var frst = domFC(ge('pv_comments')).id || '';
  1696. 1694.  -       if (
  1697. 1695.  -         !isVisible('pv_comments_header') ||
  1698. 1696.  -         isVisible('pv_comments_progress') ||
  1699. 1697.  -         Photoview.cmp(frst, 'pv_comment' + showcomm) < 0
  1700. 1698.  -       ) {
  1701. 1699.  -         return;
  1702. 1700.  -       }
  1703. 1701.  -     }
  1704. 1702.  -     var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index];
  1705. 1703.  -     var prg = ge('pv_comments_progress');
  1706. 1704.  -     ajax.post('al_photos.php', {act: 'photo_comments', offset: ph.commshown, photo: ph.id}, {
  1707. 1705.  -       onDone: function(text, names) {
  1708. 1706.  -         Photoview.receiveComms(listId, index, text, names, false, showcomm);
  1709. 1707.  -         if (showcomm && ge('pv_comment' + showcomm)) {
  1710. 1708.  -           Photoview.showComment(showcomm);
  1711. 1709.  -         }
  1712. 1710.  -       },
  1713. 1711.  -       showProgress: function() {
  1714. 1712.  -         hide(prg.previousSibling);
  1715. 1713.  -         show(prg);
  1716. 1714.  -       }, hideProgress: function() {
  1717. 1715.  -         hide(prg);
  1718. 1716.  -         show(prg.previousSibling);
  1719. 1717.  -       }
  1720. 1718.  -     });
  1721. 1719.  -   },
  1722. 1720.  -   updateComms: function() {
  1723. 1721.  -     setTimeout(Photoview.updateHeight, 2);
  1724. 1722.  -
  1725. 1723.  -     var ph = cur.pvData[cur.pvListId][cur.pvIndex];
  1726. 1724.  -     var commshown = '', commprg = ge('pv_comments_progress'), commheader = ge('pv_comments_header');
  1727. 1725.  -     if (ph.commcount > ph.commshown) {
  1728. 1726.  -       commshown = getLang('photos_show_prev_comments', ph.commcount - ph.commshown);
  1729. 1727.  -     }
  1730. 1728.  -     (commshown ? show : hide)(commheader);
  1731. 1729.  -     domPS(commprg).innerHTML = commshown;
  1732. 1730.  -   },
  1733. 1731.  -   commentClick: function(el, event, from) {
  1734. 1732.  -     var comm = el.id.replace('pv_comment', ''), cmnt = comm.split('_');
  1735. 1733.  -     if (Wall.checkReplyClick(el, event)) return;
  1736. 1734.  -
  1737. 1735.  -     var moreLink = geByClass1('wall_reply_more', el, 'a');
  1738. 1736.  -     if (moreLink && isVisible(moreLink)) {
  1739. 1737.  -       removeClass(el, 'reply_moreable');
  1740. 1738.  -       moreLink.onclick();
  1741. 1739.  -       return;
  1742. 1740.  -     }
  1743. 1741.  -     if (from && cmnt[1] && isVisible(cur.pvYourComment)) {
  1744. 1742.  -       Photoview.commentTo(comm, from, event);
  1745. 1743.  -     }
  1746. 1744.  -   },
  1747. 1745.  -   commentChanged: function() {
  1748. 1746.  -     checkTextLength(cur.pvCommLimit, cur.pvComment, ge('pv_comment_warn'));
  1749. 1747.  -     cur.pvCommenting = cur.pvData[cur.pvListId][cur.pvIndex].id;
  1750. 1748.  -   },
  1751. 1749.  -   commentTo: function(comm, toId, event) {
  1752. 1750.  -     var cmnt = (comm || '').split('_'), commId = cmnt[1], ph = cur.pvData[cur.pvListId][cur.pvIndex], replyNameOld = cur.pvReplyTo && cur.pvReplyNames[cur.pvReplyTo[0]] || '', replyName = cur.pvReplyNames[toId] || '', rf = cur.pvComment, tl = ge('pv_reply_to_title');
  1753. 1751.  -
  1754. 1752.  -     cur.pvCommenting = ph.id;
  1755. 1753.  -
  1756. 1754.  -     if (comm) {
  1757. 1755.  -       cur.pvReplyTo = [toId, commId];
  1758. 1756.  -       val(tl, replyName[0]);
  1759. 1757.  -       show(tl, 'pv_del_reply_to');
  1760. 1758.  -       setStyle(tl, {maxWidth: ge('pv_comment_submit').offsetWidth - domPN(ge('pv_comment_send')).offsetWidth - (isVisible(cur.pvAsGroup) ? cur.pvAsGroup.offsetWidth : 0) - domPN(cur.pvAddMedia).offsetWidth - 31});
  1761. 1759.  -     } else {
  1762. 1760.  -       cur.pvReplyTo = false;
  1763. 1761.  -       hide(tl, 'pv_del_reply_to');
  1764. 1762.  -     }
  1765. 1763.  -
  1766. 1764.  -     var v = trim(val(rf)), cEl = comm && geByClass1('pv_reply_to', ge('pv_comment' + comm));
  1767. 1765.  -     if (!v || replyNameOld && !winToUtf(replyNameOld[1]).indexOf(v)) {
  1768. 1766.  -       val(rf, (comm && !checkEvent(event)) ? replaceEntities(replyName[1]) : '');
  1769. 1767.  -     }
  1770. 1768.  -     toggleClass(cur.pvAsGroup, 'on', !!(ph.actions.asgr && cEl && cEl.getAttribute('rid') === cmnt[0]));
  1771. 1769.  -     elfocus(rf);
  1772. 1770.  -   },
  1773. 1771.  -   sendComment: function() {
  1774. 1772.  -     var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index],
  1775. 1773.  -         fld = cur.pvComment, comp = fld && data(fld, 'composer'),
  1776. 1774.  -         params = comp ? Composer.getSendParams(comp, Photoview.sendComment) : {message: trim(val(fld))},
  1777. 1775.  -         replyToName = (cur.pvReplyNames[(cur.pvReplyTo || {})[0]] || [])[1], btn = 'pv_comment_send';
  1778. 1776.  -
  1779. 1777.  -     if (params.delayed) return;
  1780. 1778.  -
  1781. 1779.  -     if (!params.attach1_type && (!params.message || replyToName && !replyToName.indexOf(params.message))) {
  1782. 1780.  -       elfocus(fld);
  1783. 1781.  -       return;
  1784. 1782.  -     }
  1785. 1783.  -
  1786. 1784.  -     hide('pv_comment_warn');
  1787. 1785.  -     ajax.post('al_photos.php',  Wall.fixPostParams(extend(params, {
  1788. 1786.  -       act: 'post_comment',
  1789. 1787.  -       photo: ph.id,
  1790. 1788.  -       hash: ph.hash,
  1791. 1789.  -       fromview: 1,
  1792. 1790.  -       from_group: isVisible(cur.pvAsGroup) ? isChecked(cur.pvAsGroup) : '',
  1793. 1791.  -       reply_to: (cur.pvReplyTo || {})[1]
  1794. 1792.  -     })), {onDone: function(text, names) {
  1795. 1793.  -       ++ph.commcount;
  1796. 1794.  -       Photoview.receiveComms(listId, index, text, names, true);
  1797. 1795.  -       if (data(cur.pvComment, 'composer')) {
  1798. 1796.  -         Composer.reset(data(cur.pvComment, 'composer'));
  1799. 1797.  -       } else {
  1800. 1798.  -         val(cur.pvComment, '');
  1801. 1799.  -       }
  1802. 1800.  -       cur.pvComment.blur();
  1803. 1801.  -       cur.pvReplyTo = false;
  1804. 1802.  -       hide('pv_reply_to_title', 'pv_del_reply_to');
  1805. 1803.  -     }, showProgress: lockButton.pbind(btn), hideProgress: unlockButton.pbind(btn)});
  1806. 1804.  -   },
  1807. 1805.  -   highlightComment: function(el) {
  1808. 1806.  -     el = ge(el);
  1809. 1807.  -     if (!el) return;
  1810. 1808.  -
  1811. 1809.  -     var hlfunc = animate.pbind(el, {backgroundColor: '#ECEFF3'}, 200, function() {
  1812. 1810.  -       setTimeout(function() {
  1813. 1811.  -         animate(el, {backgroundColor: '#FFF'}, 200, function() {
  1814. 1812.  -           setStyle(el, {backgroundColor: ''});
  1815. 1813.  -         });
  1816. 1814.  -       }, 1000);
  1817. 1815.  -     }), top = getXY(el, true)[1];
  1818. 1816.  -
  1819. 1817.  -     if (top < 0 || top > lastWindowHeight - 200) {
  1820. 1818.  -       animate(layerWrap, {scrollTop: layerWrap.scrollTop + top - 50}, 300, hlfunc);
  1821. 1819.  -     } else {
  1822. 1820.  -       hlfunc();
  1823. 1821.  -     }
  1824. 1822.  -   },
  1825. 1823.  -   showComment: function(comm) {
  1826. 1824.  -     var p = ge('pv_comment' + comm);
  1827. 1825.  -     if (p) {
  1828. 1826.  -       Photoview.highlightComment(p);
  1829. 1827.  -     } else {
  1830. 1828.  -       Photoview.comments(comm);
  1831. 1829.  -     }
  1832. 1830.  -     return false;
  1833. 1831.  -   },
  1834. 1832.  -   commDone: function(comm, context, text, del, script) {
  1835. 1833.  -     var node = ge('pv_comment' + comm + context);
  1836. 1834.  -     if (!node) return;
  1837. 1835.  -
  1838. 1836.  -     var msg = node.firstChild.nextSibling, ph = context ? false : cur.pvData[cur.pvListId][cur.pvIndex];
  1839. 1837.  -     if (!text) {
  1840. 1838.  -       show(node.firstChild);
  1841. 1839.  -       hide(msg);
  1842. 1840.  -       if (ph) {
  1843. 1841.  -         ++ph.commcount;
  1844. 1842.  -         ++ph.commshown;
  1845. 1843.  -         Photoview.updateComms();
  1846. 1844.  -       } else if (window.photos && cur.offset) {
  1847. 1845.  -         photos.recache(cur.offset, 1);
  1848. 1846.  -       }
  1849. 1847.  -       return;
  1850. 1848.  -     }
  1851. 1849.  -     if (msg) {
  1852. 1850.  -       msg.innerHTML = text;
  1853. 1851.  -       show(msg);
  1854. 1852.  -     } else {
  1855. 1853.  -       node.appendChild(ce('div', {innerHTML: text}));
  1856. 1854.  -     }
  1857. 1855.  -     hide(node.firstChild);
  1858. 1856.  -     if (del) {
  1859. 1857.  -       if (ph) {
  1860. 1858.  -         --ph.commshown;
  1861. 1859.  -         --ph.commcount;
  1862. 1860.  -         Photoview.updateComms();
  1863. 1861.  -       } else if (window.photos && cur.offset) {
  1864. 1862.  -         photos.recache(cur.offset, -1);
  1865. 1863.  -       }
  1866. 1864.  -     } else {
  1867. 1865.  -       Photoview.updateHeight();
  1868. 1866.  -     }
  1869. 1867.  -     if (ph) {
  1870. 1868.  -       cur.pvCommsLikes[ph.id][0] = ge('pv_comments');
  1871. 1869.  -     }
  1872. 1870.  -     if (script) {
  1873. 1871.  -       eval(script);
  1874. 1872.  -     }
  1875. 1873.  -   },
  1876. 1874.  -   commProgress: function(comm, sh) {
  1877. 1875.  -     var acts = ge('pv_actions' + comm);
  1878. 1876.  -     if (!acts) return;
  1879. 1877.  -
  1880. 1878.  -     var prg = acts.firstChild.nextSibling;
  1881. 1879.  -     if (sh !== true) {
  1882. 1880.  -       hide(prg);
  1883. 1881.  -       show(acts.firstChild);
  1884. 1882.  -       return;
  1885. 1883.  -     }
  1886. 1884.  -     hide(acts.firstChild);
  1887. 1885.  -     if (!prg) {
  1888. 1886.  -       prg = acts.appendChild(ce('div', {className: 'progress'}));
  1889. 1887.  -     }
  1890. 1888.  -     show(prg);
  1891. 1889.  -   },
  1892. 1890.  -   commParams: function(comm, context) {
  1893. 1891.  -     return {
  1894. 1892.  -       onDone: Photoview.commDone.pbind(comm, context),
  1895. 1893.  -       progress: 'pv_progress' + comm + context,
  1896. 1894.  -       stat: ['privacy.js', 'privacy.css']
  1897. 1895.  -     }
  1898. 1896.  -   },
  1899. 1897.  -   commAction: function(act, comm, context, hash) {
  1900. 1898.  -     if (isVisible('pv_progress' + comm + context)) return;
  1901. 1899.  -     ajax.post('al_photos.php', {act: act + '_comment', comment: comm, context: context, hash: hash}, Photoview.commParams(comm, context));
  1902. 1900.  -   },
  1903. 1901.  -
  1904. 1902.  -   onClick: function(e, skipClicked) {
  1905. 1903.  -     if (cur.pvClicked && !skipClicked || __afterFocus) {
  1906. 1904.  -       cur.pvClicked = false;
  1907. 1905.  -       return;
  1908. 1906.  -     }
  1909. 1907.  -     if (e && (e.button == 2 || e.which == 3 || e.pvHandle)) return;
  1910. 1908.  -     if (e) e.pvHandle = true;
  1911. 1909.  -     var px = e.pageX, py = e.pageY;
  1912. 1910.  -     if (px == null && e.clientX != null) {
  1913. 1911.  -       var doc = document.documentElement, body = bodyNode;
  1914. 1912.  -       px = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0);
  1915. 1913.  -       py = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0);
  1916. 1914.  -     }
  1917. 1915.  -     var dx = Math.abs(px - intval(cur.pvOldX));
  1918. 1916.  -     var dy = Math.abs(py - intval(cur.pvOldY));
  1919. 1917.  -     if (dx > 3 || dy > 3) {
  1920. 1918.  -       if (vkNow() - intval(cur.pvOldT) > 300) {
  1921. 1919.  -         if (cur.pvTagger) {
  1922. 1920.  -           Phototag.stopTag();
  1923. 1921.  -         } else {
  1924. 1922.  -           Photoview.hide(0);
  1925. 1923.  -         }
  1926. 1924.  -       }
  1927. 1925.  -     }
  1928. 1926.  -   },
  1929. 1927.  -   onMouseMove: function(ev) {
  1930. 1928.  -     var el = cur.pvPhoto.firstChild;
  1931. 1929.  -     if (cur.pvTagger || !el) return;
  1932. 1930.  -
  1933. 1931.  -     var elemXY = getXY(el), ph = cur.pvData[cur.pvListId][cur.pvIndex];
  1934. 1932.  -     var x = (ev.pageX - elemXY[0]) * 100 / cur.pvPhWidth, y = (ev.pageY - elemXY[1]) * 100 / cur.pvPhHeight;
  1935. 1933.  -     for (var i in ph.tags) {
  1936. 1934.  -       var coords = ph.tags[i];
  1937. 1935.  -       if (x > coords[0] && x < coords[2] && y > coords[1] && y < coords[3]) {
  1938. 1936.  -         Photoview.showDynTag(i);
  1939. 1937.  -         return;
  1940. 1938.  -       }
  1941. 1939.  -     }
  1942. 1940.  -     Photoview.hideTag();
  1943. 1941.  -   },
  1944. 1942.  -   onKeyDown: function(e) {
  1945. 1943.  -     if (e.returnValue === false) return false;
  1946. 1944.  -     if (e.keyCode == KEY.ESC && cur.pvEditing) {
  1947. 1945.  -       Photoview.cancelInline();
  1948. 1946.  -       return cancelEvent(e);
  1949. 1947.  -     }
  1950. 1948.  -     if (e.altKey && e.keyCode == KEY.RETURN && Photoview.canFullscreen()) {
  1951. 1949.  -       (cur.pvCanvas ? Photoview.fullscreenStop() : Photoview.fullscreen());
  1952. 1950.  -     }
  1953. 1951.  -     if (e.target && (e.target.tagName == 'INPUT' || e.target.tagName == 'TEXTAREA' || e.target.tagName == 'DIV' && e.target.contentEditable)) {
  1954. 1952.  -       return true;
  1955. 1953.  -     }
  1956. 1954.  -     if (e.keyCode == KEY.ESC) {
  1957. 1955.  -       if (cur.pvCanvas) {
  1958. 1956.  -         Photoview.fullscreenStop();
  1959. 1957.  -       } else if (cur.pvTagger) {
  1960. 1958.  -         Phototag.stopTag();
  1961. 1959.  -       } else if (!e.vkCanceled && !curBox()) {
  1962. 1960.  -         Photoview.hide(0);
  1963. 1961.  -       }
  1964. 1962.  -       return cancelEvent(e);
  1965. 1963.  -     } else if (!cur.pvTagger && !boxQueue.count() && (!cur.pvComment || !cur.pvComment.focused)) {
  1966. 1964.  -       if (e.keyCode == KEY.RIGHT) {
  1967. 1965.  -         Photoview.show(cur.pvListId, cur.pvIndex + 1);
  1968. 1966.  -       } else if (e.keyCode == KEY.LEFT) {
  1969. 1967.  -         Photoview.show(cur.pvListId, cur.pvIndex - 1);
  1970. 1968.  -       }
  1971. 1969.  -     }
  1972. 1970.  -   },
  1973. 1971.  -   onResize: function() {
  1974. 1972.  -     var dwidth = lastWindowWidth, dheight = lastWindowHeight, sbw = sbWidth();
  1975. 1973.  -     if (cur.pvCanvas) {
  1976. 1974.  -       var sizeChanged = false, oldverybig = cur.pvVeryBig, w = cur.pvCanvas.offsetWidth, h = cur.pvCanvas.offsetHeight;
  1977. 1975.  -       cur.pvVeryBig = (w > 1280 || h > 1280) ? 2 : ((w > 807 || h > 807) ? 1 : false);
  1978. 1976.  -       if (sizeChanged = (oldverybig != cur.pvVeryBig)) {
  1979. 1977.  -         setTimeout(Photoview.preload.pbind(cur.pvIndex, cur.pvLastDirection || 1), 10);
  1980. 1978.  -       }
  1981. 1979.  -       return;
  1982. 1980.  -     }
  1983. 1981.  -     if (cur.pvAlbumsShown || cur.pvAlbumShown || cur.pvPhotoTagShown) {
  1984. 1982.  -       cur.pvActualWidth = (cur.pvsaMini && !cur.pvAlbumsShown) ? 536 : 804;
  1985. 1983.  -       cur.pvCont.style.width = (cur.pvActualWidth + 154) + 'px';
  1986. 1984.  -       domPN(cur.pvSummary).style.width = (cur.pvActualWidth - 4) + 'px';
  1987. 1985.  -     } else if (vk.pvbig) {
  1988. 1986.  -       var w = dwidth - sbw - 2 - 120 - 34 - 50, h = dheight - 31 - 28 - 72;
  1989. 1987.  -       if (w > 1280) { // less than full hd - not size > 2
  1990. 1988.  -         w = 1280;
  1991. 1989.  -       } else if (w > 807 && w < 907) { // 1024x768 - not size > 1
  1992. 1990.  -         w = 807;
  1993. 1991.  -       } else if (w < 604) {
  1994. 1992.  -         w = 604;
  1995. 1993.  -       }
  1996. 1994.  -       if (h < 453) {
  1997. 1995.  -         h = 453;
  1998. 1996.  -       }
  1999. 1997.  -       cur.pvWidth = w;
  2000. 1998.  -       cur.pvHeight = h;
  2001. 1999.  -
  2002. 2000.  -       var sizeChanged = false, oldverybig = cur.pvVeryBig;
  2003. 2001.  -       cur.pvVeryBig = (w > 1280) ? 2 : (w > 807 ? 1 : false);
  2004. 2002.  -       sizeChanged = (oldverybig != cur.pvVeryBig);
  2005. 2003.  -
  2006. 2004.  -       var lnk = cur.pvPhoto;
  2007. 2005.  -       if (lnk && lnk.firstChild && cur.pvCurData.src == lnk.firstChild.src && cur.pvCurData.width) {
  2008. 2006.  -         var c = (cur.pvCurData.width > cur.pvWidth) ? (cur.pvWidth / cur.pvCurData.width) : 1;
  2009. 2007.  -         if (cur.pvCurData.height * c > cur.pvHeight) {
  2010. 2008.  -           c = cur.pvHeight / cur.pvCurData.height;
  2011. 2009.  -         }
  2012. 2010.  -         var w = cur.pvPhWidth = Math.floor(cur.pvCurData.width * c);
  2013. 2011.  -         var h = cur.pvPhHeight = Math.floor(cur.pvCurData.height * c);
  2014. 2012.  -         cur.pvActualWidth = Math.max(604, w);
  2015. 2013.  -
  2016. 2014.  -         if (vk.pvbig) {
  2017. 2015.  -           cur.pvCont.style.width = (cur.pvActualWidth + 154) + 'px';
  2018. 2016.  -           domPN(cur.pvSummary).style.width = (cur.pvActualWidth - 4) + 'px';
  2019. 2017.  -         }
  2020. 2018.  -
  2021. 2019.  -         lnk.style.height = Math.max(453, h) + 'px';
  2022. 2020.  -         lnk.firstChild.style.width = w + 'px';
  2023. 2021.  -         lnk.firstChild.style.height = h + 'px';
  2024. 2022.  -         if (cur.pvTagger && cur.pvTagger != 'loading') {
  2025. 2023.  -           cur.pvTagger.resize(w, h);
  2026. 2024.  -         }
  2027. 2025.  -
  2028. 2026.  -         var x = lnk.firstChild.offsetLeft, y = lnk.firstChild.offsetTop;
  2029. 2027.  -         if (browser.msie7 || browser.msie6) {
  2030. 2028.  -           x += lnk.offsetLeft;
  2031. 2029.  -           y += lnk.offsetTop;
  2032. 2030.  -         }
  2033. 2031.  -         setStyle(cur.pvTagFrame.firstChild, {
  2034. 2032.  -           width: w + 'px',
  2035. 2033.  -           height: h + 'px'
  2036. 2034.  -         });
  2037. 2035.  -         setStyle(cur.pvTagFaded, {
  2038. 2036.  -           width: w + 'px',
  2039. 2037.  -           height: h + 'px',
  2040. 2038.  -           left: x + 'px',
  2041. 2039.  -           top: y + 'px'
  2042. 2040.  -         });
  2043. 2041.  -         setStyle(cur.pvTagFrame, {
  2044. 2042.  -           left: (x - 3) + 'px', // 3 - tag frame border
  2045. 2043.  -           top: (y - 3) + 'px'
  2046. 2044.  -         });
  2047. 2045.  -         setStyle(cur.pvTagPerson, {
  2048. 2046.  -           left: x + 'px',
  2049. 2047.  -           top: y + 'px'
  2050. 2048.  -         });
  2051. 2049.  -
  2052. 2050.  -         if (sizeChanged) {
  2053. 2051.  -           setTimeout(Photoview.preload.pbind(cur.pvIndex, cur.pvLastDirection || 1), 10);
  2054. 2052.  -         }
  2055. 2053.  -       } else {
  2056. 2054.  -         cur.pvActualWidth = intval(getStyle(cur.pvBox, 'width'));
  2057. 2055.  -       }
  2058. 2056.  -     }
  2059. 2057.  -     if (!cur.pvPhoto) return;
  2060. 2058.  -     if (browser.mozilla && cur.pvPhoto.firstChild) {
  2061. 2059.  -       var x = cur.pvPhoto.firstChild.offsetLeft, deltaX = ((lastWindowWidth - cur.pvActualWidth) % 2) && ((cur.pvActualWidth - cur.pvPhWidth) % 2) ? 4 : 3;
  2062. 2060.  -       setStyle(cur.pvTagFrame, {
  2063. 2061.  -         left: (x - deltaX) + 'px' // 3 - tag w border, mozilla buggy
  2064. 2062.  -       });
  2065. 2063.  -     }
  2066. 2064.  -     Photoview.updateArrows();
  2067. 2065.  -     Photoview.updateHeight();
  2068. 2066.  -     cur.pvHH.style.marginLeft = Math.ceil((cur.pvActualWidth + 50 - 72) / 2) + 'px';
  2069. 2067.  -
  2070. 2068.  -     Photoview.scrollResize();
  2071. 2069.  - //    if (ge('pv_date')) { // debug
  2072. 2070.  - //      ge('pv_date').innerHTML = lastWindowWidth + ' ' + cur.pvActualWidth + ' ' + cur.pvPhWidth;
  2073. 2071.  - //    }
  2074. 2072.  -   },
  2075. 2073.  -   updateSize: function() {
  2076. 2074.  -     if (!vk.pvbig) {
  2077. 2075.  -       cur.pvActualWidth = 604;
  2078. 2076.  -       domPN(cur.pvSummary).style.width = '600px';
  2079. 2077.  -       cur.pvCont.style.width = '758px';
  2080. 2078.  -       cur.pvPhoto.innerHTML = '';
  2081. 2079.  -     }
  2082. 2080.  -     onBodyResize();
  2083. 2081.  -     Photoview.onResize();
  2084. 2082.  -   },
  2085. 2083.  -
  2086. 2084.  -   switchSize: function() {
  2087. 2085.  -     vk.pvbig = !vk.pvbig;
  2088. 2086.  -
  2089. 2087.  -     ge('pv_large_link').innerHTML = getLang(vk.pvbig ? 'photos_smaller' : 'photos_larger');
  2090. 2088.  -     if (cur.pvTagger) Phototag.stopTag();
  2091. 2089.  -     Photoview.updateSize();
  2092. 2090.  -     Photoview.show(cur.pvListId, cur.pvIndex);
  2093. 2091.  -     if (vk.id) {
  2094. 2092.  -       clearTimeout(cur.pvSaveBig);
  2095. 2093.  -       cur.pvSaveBig = setTimeout(ajax.post.pbind('al_photos.php', {act: 'viewer_big', big: (vk.pvbig ? 1 : ''), hash: cur.pvHash}), 1000);
  2096. 2094.  -     }
  2097. 2095.  -   },
  2098. 2096.  -   switchColor: function(el) {
  2099. 2097.  -     var old = vk.pvdark ? 'pv_dark' : 'pv_light';
  2100. 2098.  -     vk.pvdark = !vk.pvdark;
  2101. 2099.  -     var cl = vk.pvdark ? 'pv_dark' : 'pv_light';
  2102. 2100.  -
  2103. 2101.  -     setStyle(el, 'opacity', vk.pvdark ? 1 : 0.7);
  2104. 2102.  -
  2105. 2103.  -     layerBG.className = layerBG.className.replace(old, cl);
  2106. 2104.  -     layerWrap.className = layerWrap.className.replace(old, cl);
  2107. 2105.  -     cur.pvFixed.className = cur.pvFixed.className.replace(old, cl);
  2108. 2106.  -     if (vk.id) {
  2109. 2107.  -       clearTimeout(cur.pvSaveColor);
  2110. 2108.  -       cur.pvSaveColor = setTimeout(ajax.post.pbind('al_photos.php', {act: 'viewer_color', dark: (vk.pvdark ? 1 : ''), hash: cur.pvHash}), 1000);
  2111. 2109.  -     }
  2112. 2110.  -   },
  2113. 2111.  -
  2114. 2112.  -   activate: function(arrow) {
  2115. 2113.  -     if (arrow && arrow.timeout) {
  2116. 2114.  -       clearTimeout(arrow.timeout);
  2117. 2115.  -       removeAttr(arrow, 'timeout');
  2118. 2116.  -     } else if (isVisible(arrow)) {
  2119. 2117.  -       fadeTo(arrow, 200, vk.pvdark ? 1 : 0.7);
  2120. 2118.  -     }
  2121. 2119.  -   },
  2122. 2120.  -   deactivate: function(arrow) {
  2123. 2121.  -     if (!arrow || !isVisible(arrow) || arrow.timeout) {
  2124. 2122.  -       return;
  2125. 2123.  -     }
  2126. 2124.  -     arrow.timeout = setTimeout(function() {
  2127. 2125.  -       removeAttr(arrow, 'timeout');
  2128. 2126.  -       fadeTo(arrow, 200, 0.4);
  2129. 2127.  -     }, 1);
  2130. 2128.  -   },
  2131. 2129.  -
  2132. 2130.  -   deletePhoto: function(sure) {
  2133. 2131.  -     var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index], box = curBox();
  2134. 2132.  -     var prg = box ? box.progress : 'pv_delete_progress';
  2135. 2133.  -     if (isVisible(prg)) return;
  2136. 2134.  -
  2137. 2135.  -     if (cur.pvTagger && ev !== false) {
  2138. 2136.  -       Phototag.stopTag();
  2139. 2137.  -       return;
  2140. 2138.  -     }
  2141. 2139.  -
  2142. 2140.  -     ajax.post('al_photos.php', {act: 'delete_photo', photo: ph.id, hash: ph.hash, set_prev: isChecked('pvb_prev_check'), sure: intval(sure)}, {onDone: function(text, html) {
  2143. 2141.  -       if (box) {
  2144. 2142.  -         box.hide();
  2145. 2143.  -         return nav.go('/id0', false, {nocur: true});
  2146. 2144.  -       }
  2147. 2145.  -       if (html) {
  2148. 2146.  -         return showFastBox(text, html, getLang('global_delete'), Photoview.deletePhoto.pbind(1), getLang('global_cancel'));
  2149. 2147.  -       }
  2150. 2148.  -       ph.deleted = text;
  2151. 2149.  -       if (listId == cur.pvListId && index == cur.pvIndex) {
  2152. 2150.  -         cleanElems('pv_confirm_tag', 'pv_delete_tag', 'pv_prof_cancel', 'pv_prof_done');
  2153. 2151.  -         cur.pvTagInfo.innerHTML = ph.deleted;
  2154. 2152.  -         show(cur.pvTagInfo);
  2155. 2153.  -         hide(cur.pvCommentsData);
  2156. 2154.  -         Photoview.updateHeight();
  2157. 2155.  -       }
  2158. 2156.  -     }, progress: prg});
  2159. 2157.  -   },
  2160. 2158.  -   restorePhoto: function() {
  2161. 2159.  -     var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index];
  2162. 2160.  -     if (isVisible('pv_restore_progress')) return;
  2163. 2161.  -
  2164. 2162.  -     ajax.post('al_photos.php', {act: 'restore_photo', photo: ph.id, hash: ph.hash}, {onDone: function(text) {
  2165. 2163.  -       ph.deleted = false;
  2166. 2164.  -       if (listId == cur.pvListId && index == cur.pvIndex) {
  2167. 2165.  -         cleanElems('pv_confirm_tag', 'pv_delete_tag', 'pv_prof_cancel', 'pv_prof_done');
  2168. 2166.  -         if (ph.taginfo) {
  2169. 2167.  -           cur.pvTagInfo.innerHTML = '\
  2170. 2168.  - <table cellspacing="0" cellpadding="0"><tr>\
  2171. 2169.  -   <td class="info">' + ph.taginfo + '</td>\
  2172. 2170.  -   <td><nobr><div class="button_blue"><button id="pv_confirm_tag">' + getLang('photos_confirm_tag') + '</button></div></td>\
  2173. 2171.  -   <td><nobr><div class="button_gray"><button id="pv_delete_tag">' + getLang('photos_delete_tag') + '</button></div></td>\
  2174. 2172.  -   <td><div id="pv_tag_handling" class="progress"></div></td>\
  2175. 2173.  - </tr></table>';
  2176. 2174.  -           show(cur.pvTagInfo);
  2177. 2175.  -           ge('pv_confirm_tag').onclick = Photoview.confirmTag.pbind(ph.tagid);
  2178. 2176.  -           ge('pv_delete_tag').onclick = Photoview.deleteTag.pbind(ph.tagid);
  2179. 2177.  -         } else {
  2180. 2178.  -           cur.pvTagInfo.innerHTML = '';
  2181. 2179.  -           hide(cur.pvTagInfo);
  2182. 2180.  -         }
  2183. 2181.  -         show(cur.pvCommentsData);
  2184. 2182.  -         Photoview.updateHeight();
  2185. 2183.  -       }
  2186. 2184.  -     }, progress: 'pv_restore_progress'});
  2187. 2185.  -   },
  2188. 2186.  -   spamPhoto: function(prg, spamHash) {
  2189. 2187.  -     var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index];
  2190. 2188.  -     if (isVisible(prg)) return;
  2191. 2189.  -
  2192. 2190.  -     if (cur.pvTagger && ev !== false) {
  2193. 2191.  -       Phototag.stopTag();
  2194. 2192.  -       return;
  2195. 2193.  -     }
  2196. 2194.  -
  2197. 2195.  -     ajax.post('al_photos.php', {act: 'spam_photo', photo: ph.id, hash: ph.hash, spam_hash: spamHash}, {onDone: function(text, del) {
  2198. 2196.  -       if (del) ph.deleted = text;
  2199. 2197.  -       if (listId == cur.pvListId && index == cur.pvIndex) {
  2200. 2198.  -         cleanElems('pv_confirm_tag', 'pv_delete_tag', 'pv_prof_cancel', 'pv_prof_done');
  2201. 2199.  -         cur.pvTagInfo.innerHTML = text;
  2202. 2200.  -         show(cur.pvTagInfo);
  2203. 2201.  -         if (del) hide(cur.pvCommentsData);
  2204. 2202.  -         Photoview.updateHeight();
  2205. 2203.  -       }
  2206. 2204.  -     }, progress: prg});
  2207. 2205.  -   },
  2208. 2206.  -   rotatePhoto: function(to) {
  2209. 2207.  -     var prg = ge('pv_rotate_progress');
  2210. 2208.  -     if (isVisible(prg)) return;
  2211. 2209.  -
  2212. 2210.  -     show(prg);
  2213. 2211.  -     ge('pv_rotate').appendChild(ce('div', {id: 'pv_rotate_frame', className: 'upload_frame', innerHTML: '<iframe name="pv_rotate_frame"></iframe>'}));
  2214. 2212.  -     var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index], form = ge('pv_rotate_form');
  2215. 2213.  -     form.innerHTML = '';
  2216. 2214.  -     form.action = ph.rotate[0];
  2217. 2215.  -     var data = extend({act: 'do_rotate', to: to, list_id: listId, index: index, fid: ph.id}, ph.rotate);
  2218. 2216.  -     to = (to + 4) % 4;
  2219. 2217.  -     if (data.act == 'rotate_photo') {
  2220. 2218.  -       data.angle = (data.angle + to) % 4;
  2221. 2219.  -     }
  2222. 2220.  -     if (data['rot'+to]) {
  2223. 2221.  -       data.act = 'done_rotate';
  2224. 2222.  -       data.complete = 1;
  2225. 2223.  -       ajax.post('/al_photos.php', data, {
  2226. 2224.  -         onDone: Photoview.rotateDone,
  2227. 2225.  -         onFail: function() {
  2228. 2226.  -           Photoview.rotateDone();
  2229. 2227.  -         }
  2230. 2228.  -       });
  2231. 2229.  -       return;
  2232. 2230.  -     }
  2233. 2231.  -     for (var i in data) {
  2234. 2232.  -       if (i != 0) {
  2235. 2233.  -         form.appendChild(ce('input', {type: 'hidden', name: i, value: data[i]}));
  2236. 2234.  -       }
  2237. 2235.  -     }
  2238. 2236.  -     form.submit();
  2239. 2237.  -   },
  2240. 2238.  -   rotateDone: function(data) {
  2241. 2239.  -     hide('pv_rotate_progress');
  2242. 2240.  -     var el = ge('pv_rotate_frame');
  2243. 2241.  -
  2244. 2242.  -     if (!el) return;
  2245. 2243.  -     re(el);
  2246. 2244.  -
  2247. 2245.  -     if (!data) return;
  2248. 2246.  -     var listId = data.list_id, index = data.index, ph = cur.pvData[listId][index];
  2249. 2247.  -     extend(ph, {x_src: data.x_src, y_src: data.y_src, z_src: data.z_src, w_src: data.w_src, base: data.base, x_: data.x_, y_: data.y_, z_: data.z_, w_: data.w_, x: 0, y: 0, z: 0, w: 0, tags: data.tags, tagged: data.tagged, tagshtml: data.html})
  2250. 2248.  -     extend(ph.rotate, {photo: data.photo, hash: data.hash, rhash: data.rhash, angle: data.angle, rot1: data.rot1, rot3: data.rot3});
  2251. 2249.  -     if (listId == cur.pvListId && index == cur.pvIndex) {
  2252. 2250.  -       Photoview.show(listId, index);
  2253. 2251.  -     }
  2254. 2252.  -   },
  2255. 2253.  -
  2256. 2254.  -   likeUpdate: function(my, count, title) {
  2257. 2255.  -     count = intval(count);
  2258. 2256.  -
  2259. 2257.  -     var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index];
  2260. 2258.  -     var countInput = ge('like_real_count_photo' + ph.id) || {}, rows = ge('like_table_photo' + ph.id);
  2261. 2259.  -     var titleNode = ge('like_title_photo' + ph.id), countNode = ge('pv_like_count');
  2262. 2260.  -     var icon = cur.pvLikeIcon;
  2263. 2261.  -     var tt = icon.parentNode.tt || {}, opts = clone(tt.opts || {}), newleft = (my ? 0 : -36);
  2264. 2262.  -
  2265. 2263.  -     if (title && titleNode) {
  2266. 2264.  -       val(titleNode, title);
  2267. 2265.  -     }
  2268. 2266.  -     cur.pvCommsLikes[ph.id][1] = countInput.value = count;
  2269. 2267.  -     animateCount(countNode, count);
  2270. 2268.  -
  2271. 2269.  -     ph.liked = my;
  2272. 2270.  -     (my ? addClass : removeClass)(cur.pvHH, 'pvs_hh_liked');
  2273. 2271.  -     if (!my) {
  2274. 2272.  -       var cb = ge('like_share_photo' + ph.id);
  2275. 2273.  -       if (cb) checkbox(cb, false);
  2276. 2274.  -     } else {
  2277. 2275.  -       setStyle(icon, {opacity: 1});
  2278. 2276.  -     }
  2279. 2277.  -     if (count) {
  2280. 2278.  -       var styleName = vk.rtl ? 'right' : 'left';
  2281. 2279.  -       if (tt.el && !isVisible(tt.container) && !title) {
  2282. 2280.  -         rows.style[styleName] = newleft + 'px';
  2283. 2281.  -         tooltips.show(tt.el, extend(opts, {showdt: 0}));
  2284. 2282.  -       } else if (rows) {
  2285. 2283.  -         var params = {};
  2286. 2284.  -         params[styleName] = newleft;
  2287. 2285.  -         animate(rows, params, 200);
  2288. 2286.  -       }
  2289. 2287.  -       removeClass(icon, 'no_likes');
  2290. 2288.  -     } else {
  2291. 2289.  -       if (tt.el) tt.hide();
  2292. 2290.  -       addClass(icon, 'no_likes');
  2293. 2291.  -     }
  2294. 2292.  -   },
  2295. 2293.  -   like: function() {
  2296. 2294.  -     if (!vk.id) return;
  2297. 2295.  -     var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index], my = !ph.liked;
  2298. 2296.  -     ajax.post('like.php', {act: 'a_do_' + (my ? '' : 'un') + 'like', object: 'photo' + ph.id, hash: ph.hash, from: 'photo_viewer'}, {
  2299. 2297.  -       onDone: function(count, title) {
  2300. 2298.  -         if (cur.pvListId == listId && cur.pvIndex == index) {
  2301. 2299.  -           return Photoview.likeUpdate(my, count, title);
  2302. 2300.  -         }
  2303. 2301.  -         cur.pvCommsLikes[ph.id][1] = count;
  2304. 2302.  -         ph.liked = my;
  2305. 2303.  -       }
  2306. 2304.  -     });
  2307. 2305.  -     Photoview.likeUpdate(my, cur.pvCommsLikes[ph.id][1] + (my ? 1 : -1));
  2308. 2306.  -   },
  2309. 2307.  -   likeShare: function(hash) {
  2310. 2308.  -     if (!vk.id) return;
  2311. 2309.  -     var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index];
  2312. 2310.  -     var el = ge('like_share_photo' + ph.id), was = isChecked(el);
  2313. 2311.  -     checkbox(el);
  2314. 2312.  -     ajax.post('like.php', {act: 'a_do_' + (was ? 'un' : '') + 'publish', object: 'photo' + ph.id, list: listId, hash: hash, from: 'photo_viewer'}, {
  2315. 2313.  -       onDone: function(count, title) {
  2316. 2314.  -         if (cur.pvListId == listId && cur.pvIndex == index) {
  2317. 2315.  -           return Photoview.likeUpdate(true, count, title);
  2318. 2316.  -         }
  2319. 2317.  -         cur.pvCommsLikes[ph.id][1] = count;
  2320. 2318.  -         ph.liked = true;
  2321. 2319.  -       }
  2322. 2320.  -     });
  2323. 2321.  -     Photoview.likeUpdate(true, cur.pvCommsLikes[ph.id][1] + (ph.liked ? 0 : 1));
  2324. 2322.  -   },
  2325. 2323.  -   likeOver: function() {
  2326. 2324.  -     var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index];
  2327. 2325.  -     var icon = cur.pvLikeIcon;
  2328. 2326.  -     if (!ph.liked) {
  2329. 2327.  -       setTimeout(animate.pbind(icon, {opacity: 1}, 200, false), 1);
  2330. 2328.  -     } else {
  2331. 2329.  -       setStyle(icon, {opacity: 1});
  2332. 2330.  -     }
  2333. 2331.  -     var linkW = cur.pvLikeLink.offsetWidth;
  2334. 2332.  -
  2335. 2333.  -     showTooltip(icon.parentNode, {
  2336. 2334.  -       url: 'like.php',
  2337. 2335.  -       params: {act: 'a_get_stats', object: 'photo' + ph.id, list: listId},
  2338. 2336.  -       slide: 15,
  2339. 2337.  -       shift: [0, 5, 9],
  2340. 2338.  -       ajaxdt: 100,
  2341. 2339.  -       showdt: 400,
  2342. 2340.  -       hidedt: 200,
  2343. 2341.  -       className: 'rich like_tt',
  2344. 2342.  -       init: function (tt) {
  2345. 2343.  -         if (!tt.container) return;
  2346. 2344.  -         var bp = geByClass1('bottom_pointer', tt.container, 'div');
  2347. 2345.  -         var tp = geByClass1('top_pointer', tt.container, 'div');
  2348. 2346.  -         setStyle(bp, {marginLeft: linkW + 2});
  2349. 2347.  -         setStyle(tp, {marginLeft: linkW + 2});
  2350. 2348.  -       }
  2351. 2349.  -     });
  2352. 2350.  -   },
  2353. 2351.  -   likeOut: function() {
  2354. 2352.  -     var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index];
  2355. 2353.  -     if (!ph.liked) {
  2356. 2354.  -       setTimeout(animate.pbind(cur.pvLikeIcon, {opacity: 0.4}, 200, false), 1);
  2357. 2355.  -     }
  2358. 2356.  -   },
  2359. 2357.  -
  2360. 2358.  -   tagOver: function(el) {
  2361. 2359.  -     animate(el, {backgroundColor: '#6B8DB1'}, 200);
  2362. 2360.  -     showTooltip(el, {text: getLang('photos_delete_tag'), shift: [0, -2, 0]});
  2363. 2361.  -   },
  2364. 2362.  -   tagOut: function(el) {
  2365. 2363.  -     if (!el.parentNode || !el.parentNode.parentNode) return;
  2366. 2364.  -     animate(el, {backgroundColor: '#C4D2E1'}, 200);
  2367. 2365.  -   },
  2368. 2366.  -   deleteTag: function(tagId) {
  2369. 2367.  -     var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index];
  2370. 2368.  -     if (ph.tagid) {
  2371. 2369.  -       if (isVisible('pv_tag_handling')) return;
  2372. 2370.  -     } else {
  2373. 2371.  -       if (ge('pv_action_progress')) return;
  2374. 2372.  -     }
  2375. 2373.  -
  2376. 2374.  -     ajax.post('al_photos.php', {act: 'delete_tag', photo: ph.id, tag: tagId, hash: ph.hash}, {onDone: function(text, tags, tagged, html, padres) {
  2377. 2375.  -       if (_pads.shown == 'ph') {
  2378. 2376.  -         Pads.phDone(ph.id, false, padres);
  2379. 2377.  -       }
  2380. 2378.  -       Pads.invalidate('ph');
  2381. 2379.  -       if (ph.tagid) {
  2382. 2380.  -         ph.taginfo = ph.tagid = false;
  2383. 2381.  -         cleanElems('pv_confirm_tag', 'pv_delete_tag', 'pv_prof_cancel', 'pv_prof_done');
  2384. 2382.  -         cur.pvTagInfo.innerHTML = '<div class="progress fl_r" id="pv_spam_progress"></div><div class="pv_info">' + text + '</div>';
  2385. 2383.  -       } else {
  2386. 2384.  -         Photoview.actionInfo().innerHTML = text;
  2387. 2385.  -       }
  2388. 2386.  -       Photoview.updateHeight();
  2389. 2387.  -       if (tags !== undefined) {
  2390. 2388.  -         ph.tags = tags;
  2391. 2389.  -         ph.tagged = tagged;
  2392. 2390.  -         ph.tagshtml = html;
  2393. 2391.  -         if (cur.pvListId == listId && cur.pvIndex == index) {
  2394. 2392.  -           Photoview.setTags(html);
  2395. 2393.  -
  2396. 2394.  -           ((!ph.taginfo && ph.actions.tag && tags[0] < cur.pvMaxTags) ? show : hide)(cur.pvTagLink);
  2397. 2395.  -         }
  2398. 2396.  -       }
  2399. 2397.  -     }, onFail: function(text) {
  2400. 2398.  -       if (!text) return;
  2401. 2399.  -       Photoview.actionInfo().innerHTML = text;
  2402. 2400.  -       return true;
  2403. 2401.  -     }, showProgress: function() {
  2404. 2402.  -       if (ph.tagid) {
  2405. 2403.  -         hide(ge('pv_confirm_tag').parentNode, ge('pv_delete_tag').parentNode);
  2406. 2404.  -         show('pv_tag_handling');
  2407. 2405.  -       } else {
  2408. 2406.  -         Photoview.actionInfo().innerHTML = '<div id="pv_action_progress" class="progress" style="display: block"></div>';
  2409. 2407.  -       }
  2410. 2408.  -     }, hideProgress: function() {
  2411. 2409.  -       if (ph.tagid) {
  2412. 2410.  -         hide('pv_tag_handling');
  2413. 2411.  -         show(ge('pv_confirm_tag').parentNode, ge('pv_delete_tag').parentNode);
  2414. 2412.  -       } else {
  2415. 2413.  -         re(Photoview.actionInfo());
  2416. 2414.  -       }
  2417. 2415.  -     }});
  2418. 2416.  -   },
  2419. 2417.  -   restoreTag: function(tagId) {
  2420. 2418.  -     if (ge('pv_action_progress')) return;
  2421. 2419.  -
  2422. 2420.  -     var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index];
  2423. 2421.  -     ajax.post('al_photos.php', {act: 'restore_tag', photo: ph.id, tag: tagId, hash: ph.hash}, {onDone: function(text, tags, tagged, html) {
  2424. 2422.  -       if (tags !== undefined) {
  2425. 2423.  -         ph.tags = tags;
  2426. 2424.  -         ph.tagged = tagged;
  2427. 2425.  -         ph.tagshtml = html;
  2428. 2426.  -         if (cur.pvListId == listId && cur.pvIndex == index) {
  2429. 2427.  -           Photoview.setTags(html);
  2430. 2428.  -           ((!ph.taginfo && ph.actions.tag && tags[0] < cur.pvMaxTags) ? show : hide)(cur.pvTagLink);
  2431. 2429.  -         }
  2432. 2430.  -       }
  2433. 2431.  -       Photoview.actionInfo().innerHTML = text;
  2434. 2432.  -     }, onFail: function(text) {
  2435. 2433.  -       if (!text) return;
  2436. 2434.  -       Photoview.actionInfo().innerHTML = text;
  2437. 2435.  -       return true;
  2438. 2436.  -     }, showProgress: function() {
  2439. 2437.  -       Photoview.actionInfo().innerHTML = '<div id="pv_action_progress" class="progress" style="display: block"></div>';
  2440. 2438.  -     }, hideProgress: function() {
  2441. 2439.  -       re(Photoview.actionInfo());
  2442. 2440.  -     }});
  2443. 2441.  -   },
  2444. 2442.  -
  2445. 2443.  -   confirmTag: function(tagId) {
  2446. 2444.  -     var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index];
  2447. 2445.  -     if (isVisible('pv_tag_handling')) return;
  2448. 2446.  -
  2449. 2447.  -     ajax.post('al_photos.php', {act: 'confirm_tag', tag: tagId, photo: ph.id, hash: ph.hash}, {onDone: function(tags, tagged, html, padres) {
  2450. 2448.  -       if (_pads.shown == 'ph') {
  2451. 2449.  -         Pads.phDone(ph.id, false, padres);
  2452. 2450.  -       }
  2453. 2451.  -       Pads.invalidate('ph');
  2454. 2452.  -       ph.tags = tags;
  2455. 2453.  -       ph.tagged = tagged;
  2456. 2454.  -       ph.tagshtml = html;
  2457. 2455.  -       ph.taginfo = ph.tagid = false;
  2458. 2456.  -       if (listId == cur.pvListId && index == cur.pvIndex) {
  2459. 2457.  -         Photoview.setTags(html);
  2460. 2458.  -         ((!ph.taginfo && ph.actions.tag && tags[0] < cur.pvMaxTags) ? show : hide)(cur.pvTagLink);
  2461. 2459.  -         cleanElems('pv_confirm_tag', 'pv_delete_tag', 'pv_prof_cancel', 'pv_prof_done');
  2462. 2460.  -         cur.pvTagInfo.innerHTML = '';
  2463. 2461.  -         hide(cur.pvTagInfo);
  2464. 2462.  -       }
  2465. 2463.  -       Photoview.updateHeight();
  2466. 2464.  -     }, showProgress: function() {
  2467. 2465.  -       hide(ge('pv_confirm_tag').parentNode, ge('pv_delete_tag').parentNode);
  2468. 2466.  -       show('pv_tag_handling');
  2469. 2467.  -     }, hideProgress: function() {
  2470. 2468.  -       hide('pv_tag_handling');
  2471. 2469.  -       show(ge('pv_confirm_tag').parentNode, ge('pv_delete_tag').parentNode);
  2472. 2470.  -     }});
  2473. 2471.  -   },
  2474. 2472.  -
  2475. 2473.  -   toProfileTag: function() {
  2476. 2474.  -     var tag = cur.pvData[cur.pvListId][cur.pvIndex].tagged[vk.id];
  2477. 2475.  -     if (tag && !cur.pvTagger) {
  2478. 2476.  -       Photoview.showTag(tag);
  2479. 2477.  -     }
  2480. 2478.  -   },
  2481. 2479.  -   showTag: function(tagId) {
  2482. 2480.  -     clearTimeout(cur.pvHidingTag);
  2483. 2481.  -     if (cur.pvShowingTag == tagId) return;
  2484. 2482.  -
  2485. 2483.  -     var coords = clone(cur.pvData[cur.pvListId][cur.pvIndex].tags[tagId]);
  2486. 2484.  -     each(coords, function(i, v) {
  2487. 2485.  -       var wh = cur[(i % 2) ? 'pvPhHeight' : 'pvPhWidth'];
  2488. 2486.  -       coords[i] = Math.max(3, Math.min(wh - 3, positive(v * wh / 100)));
  2489. 2487.  -     });
  2490. 2488.  -     setStyle(cur.pvTagFrame, {
  2491. 2489.  -       marginLeft: coords[0] + 'px',
  2492. 2490.  -       marginTop: coords[1] + 'px',
  2493. 2491.  -       width: (coords[2] - coords[0]) + 'px',
  2494. 2492.  -       height: (coords[3] - coords[1]) + 'px'
  2495. 2493.  -     });
  2496. 2494.  -     setStyle(cur.pvTagFrame.firstChild, {
  2497. 2495.  -       marginLeft: -coords[0] + 'px',
  2498. 2496.  -       marginTop: -coords[1] + 'px'
  2499. 2497.  -     });
  2500. 2498.  -     cur.pvShowingTag = tagId;
  2501. 2499.  -     if (browser.msie) {
  2502. 2500.  -       show(cur.pvTagFrame, cur.pvTagFaded);
  2503. 2501.  -     } else {
  2504. 2502.  -       fadeIn(cur.pvTagFrame, 200);
  2505. 2503.  -       fadeIn(cur.pvTagFaded, 200);
  2506. 2504.  -     }
  2507. 2505.  -   },
  2508. 2506.  -   showDynTag: function(tagId) {
  2509. 2507.  -     clearTimeout(cur.pvHidingTag);
  2510. 2508.  -     if (cur.pvShowingTag == tagId) return;
  2511. 2509.  -
  2512. 2510.  -     var coords = clone(cur.pvData[cur.pvListId][cur.pvIndex].tags[tagId]), el = ge('pv_tag' + tagId);
  2513. 2511.  -     if (!el) return;
  2514. 2512.  -
  2515. 2513.  -     each(coords, function(i, v) {
  2516. 2514.  -       coords[i] = positive(v * cur[(i % 2) ? 'pvPhHeight' : 'pvPhWidth'] / 100);
  2517. 2515.  -     });
  2518. 2516.  -     setStyle(cur.pvTagPerson, {
  2519. 2517.  -       marginLeft: coords[0] + 'px',
  2520. 2518.  -       marginTop: coords[3] + 'px',
  2521. 2519.  -       minWidth: (coords[2] - coords[0]) + 'px'
  2522. 2520.  -     });
  2523. 2521.  -     cur.pvTagPerson.innerHTML = el.firstChild.innerHTML;
  2524. 2522.  -     var s = getSize(cur.pvTagPerson);
  2525. 2523.  -     if (coords[3] + s[1] > cur.pvPhHeight) {
  2526. 2524.  -       setStyle(cur.pvTagPerson, {marginTop: (cur.pvPhHeight - s[1]) + 'px'});
  2527. 2525.  -     }
  2528. 2526.  -     cur.pvTagPerson.onmouseover = Photoview.showDynTag.pbind(tagId);
  2529. 2527.  -     cur.pvShowingTag = tagId;
  2530. 2528.  -     if (browser.msie){
  2531. 2529.  -       show(cur.pvTagPerson);
  2532. 2530.  -     } else {
  2533. 2531.  -       fadeIn(cur.pvTagPerson, 200);
  2534. 2532.  -     }
  2535. 2533.  -   },
  2536. 2534.  -   hideTag: function(quick) {
  2537. 2535.  -     if (quick === true) {
  2538. 2536.  -       clearTimeout(cur.pvHidingTag);
  2539. 2537.  -       hide(cur.pvTagFaded, cur.pvTagFrame, cur.pvTagPerson);
  2540. 2538.  -       cur.pvShowingTag = false;
  2541. 2539.  -     }
  2542. 2540.  -     if (!cur.pvShowingTag) return;
  2543. 2541.  -
  2544. 2542.  -     clearTimeout(cur.pvHidingTag);
  2545. 2543.  -     cur.pvHidingTag = setTimeout(function() {
  2546. 2544.  -       if (browser.msie) {
  2547. 2545.  -         hide(cur.pvTagFaded, cur.pvTagFrame, cur.pvTagPerson);
  2548. 2546.  -       } else if (cur.pvShowingTag) {
  2549. 2547.  -         fadeOut(cur.pvTagFaded, 200);
  2550. 2548.  -         fadeOut(cur.pvTagFrame, 200);
  2551. 2549.  -         fadeOut(cur.pvTagPerson, 200);
  2552. 2550.  -       }
  2553. 2551.  -       cur.pvShowingTag = false;
  2554. 2552.  -     }, 0);
  2555. 2553.  -   },
  2556. 2554.  -   realOffset: function(listId, offset, inc) {
  2557. 2555.  -     var res = offset;
  2558. 2556.  -     if (!cur.pvData || !cur.pvData[listId]) {
  2559. 2557.  -       return res;
  2560. 2558.  -     }
  2561. 2559.  -     for (var i = 0; i < offset; i++) {
  2562. 2560.  -       if (cur.pvData[listId][i] && (cur.pvData[listId][i].deleted || cur.pvData[listId][i].moved)) {
  2563. 2561.  -         res += inc;
  2564. 2562.  -       }
  2565. 2563.  -     }
  2566. 2564.  -     return res;
  2567. 2565.  -   },
  2568. 2566.  -   realCount: function(listId, count) {
  2569. 2567.  -     var res = count;
  2570. 2568.  -     if (!cur.pvData || !cur.pvData[listId]) {
  2571. 2569.  -       return res;
  2572. 2570.  -     }
  2573. 2571.  -     for (var i = 0; i < cur.pvData[listId].length; i++) {
  2574. 2572.  -       if (cur.pvData[listId][i] && (cur.pvData[listId][i].deleted || cur.pvData[listId][i].moved)) {
  2575. 2573.  -         res++;
  2576. 2574.  -       }
  2577. 2575.  -     }
  2578. 2576.  -     return res;
  2579. 2577.  -   },
  2580. 2578.  -
  2581. 2579.  -   list: function(photoId, listId, realList) {
  2582. 2580.  -     if (realList == 'deleted') return;
  2583. 2581.  -     if (!cur.pvList) cur.pvList = {};
  2584. 2582.  -     cur.pvList[photoId + '_' + listId] = realList;
  2585. 2583.  -   },
  2586. 2584.  -   loaded: function(listId, count, offset, data, opts) {
  2587. 2585.  -     if (listId == 'deleted') return;
  2588. 2586.  -     if (opts) {
  2589. 2587.  -       extend(cur, {
  2590. 2588.  -         lang: extend(cur.lang || {}, opts.lang),
  2591. 2589.  -         pvHash: opts.hash,
  2592. 2590.  -         pvCommLimit: opts.commlimit,
  2593. 2591.  -         pvMaxTags: opts.maxtags,
  2594. 2592.  -         pvReasons: opts.reasons,
  2595. 2593.  -         pvReplyNames: extend(cur.pvReplyNames || {}, opts.names || {}),
  2596. 2594.  -         pvMediaTypes: opts.media
  2597. 2595.  -       });
  2598. 2596.  -       if (!cur.options) cur.options = {};
  2599. 2597.  -       if (!cur.options.share) cur.options.share = opts.share;
  2600. 2598.  -       val(cur.pvAsGroup, '<div></div>' + getLang('wall_reply_as_group'));
  2601. 2599.  -       val('pv_comment_header', getLang('photos_yourcomment'));
  2602. 2600.  -       val(domFC(ge('pv_add_media')), getLang('global_add_media'));
  2603. 2601.  -     }
  2604. 2602.  -     count = Photoview.realCount(listId, count);
  2605. 2603.  -     offset = Photoview.realOffset(listId, offset, 1);
  2606. 2604.  -     if (!cur.pvData) cur.pvData = {};
  2607. 2605.  -     if (!cur.pvCommsLikes) cur.pvCommsLikes = {};
  2608. 2606.  -     if (!cur.pvData[listId]) {
  2609. 2607.  -       cur.pvData[listId] = new Array(count);
  2610. 2608.  -     } else if (cur.pvData[listId].length < count) {
  2611. 2609.  -       for (var i = cur.pvData[listId].length; i < count; ++i) {
  2612. 2610.  -         cur.pvData[listId].push(undefined);
  2613. 2611.  -       }
  2614. 2612.  -     } else if (cur.pvData[listId].length > count) {
  2615. 2613.  -       cur.pvData[listId] = cur.pvData[listId].slice(0, count);
  2616. 2614.  -     }
  2617. 2615.  -     var nw = vkNow();
  2618. 2616.  -     for (var i = 0, len = data.length; i < len; ++i) {
  2619. 2617.  -       var index = (offset + i), ph = clone(data[i]);
  2620. 2618.  -       while (index >= count) index -= count;
  2621. 2619.  -       cur.pvCommsLikes[ph.id] = [ph.comments, ph.likes, vkNow(), false];
  2622. 2620.  -       delete(ph.comments);
  2623. 2621.  -       delete(ph.likes);
  2624. 2622.  -       cur.pvData[listId][index] = ph;
  2625. 2623.  -     }
  2626. 2624.  -   },
  2627. 2625.  -   showDeleted: function(lst, msg, spm) {
  2628. 2626.  -     if (cur.pvShown && cur.pvListId == 'temp') {
  2629. 2627.  -       msg += '<br><br>' + spm;
  2630. 2628.  -     }
  2631. 2629.  -
  2632. 2630.  -     showFastBox({title: getLang('global_error'), onHide: function() {
  2633. 2631.  -       if (cur.pvShown && cur.pvListId == 'temp') {
  2634. 2632.  -         Photoview.hide(true);
  2635. 2633.  -       }
  2636. 2634.  -     }}, msg);
  2637. 2635.  -   },
  2638. 2636.  -   spamDeleted: function(el, ph, hash) {
  2639. 2637.  -     if (isVisible(curBox().progress)) return;
  2640. 2638.  -     ajax.post('al_photos.php', {act: 'spam_photo', photo: ph, hash: hash, from: 'deleted'}, {onDone: function(text) {
  2641. 2639.  -       domPN(el).replaceChild(ce('span', {innerHTML: text}), el);
  2642. 2640.  -     }, showProgress: curBox().showProgress, hideProgress: curBox().hideProgress});
  2643. 2641.  -   },
  2644. 2642.  -   showPhoto: function(photoId, listId, options, just) {
  2645. 2643.  -     if (!cur.pvShown || cur.pvListId == 'temp' && !cur.pvWasShown || options.noHistory !== undefined) {
  2646. 2644.  -       debugLog('in showPhoto noHistory: ' + options.noHistory);
  2647. 2645.  -       cur.pvNoHistory = options.noHistory;
  2648. 2646.  -       cur.pvHistoryLength = options.noHistory ? 0 : (options.histLen || 0);
  2649. 2647.  -     }
  2650. 2648.  -     extend(cur, {
  2651. 2649.  -       pvJumpTo: options.jumpTo || false,
  2652. 2650.  -       pvJumpFrom: false,
  2653. 2651.  -       pvJumpSteps: 0
  2654. 2652.  -     });
  2655. 2653.  -     listId = cur.pvList && cur.pvList[photoId + '_' + listId] || listId;
  2656. 2654.  -     if (!cur.pvData || !cur.pvData[listId]) {
  2657. 2655.  -       return;
  2658. 2656.  -     }
  2659. 2657.  -     var data = cur.pvData[listId], whole = true, onh = cur.pvOptions && cur.pvOptions.onHide;
  2660. 2658.  -     cur.pvOptions = options;
  2661. 2659.  -     if (!cur.pvOptions.onHide) cur.pvOptions.onHide = onh;
  2662. 2660.  -     for (var i = 0, len = data.length; i < len; ++i) {
  2663. 2661.  -       if (data[i]) {
  2664. 2662.  -         if (data[i].id === photoId) {
  2665. 2663.  -           Photoview.show(listId, i, false, options.root);
  2666. 2664.  -           if (options.onShow) {
  2667. 2665.  -             options.onShow();
  2668. 2666.  -           }
  2669. 2667.  -           return false;
  2670. 2668.  -         }
  2671. 2669.  -       } else {
  2672. 2670.  -         whole = false;
  2673. 2671.  -       }
  2674. 2672.  -     }
  2675. 2673.  -     if (whole && just) {
  2676. 2674.  -       if (options.onEmpty) {
  2677. 2675.  -         options.onEmpty();
  2678. 2676.  -       }
  2679. 2677.  -       return false;
  2680. 2678.  -     }
  2681. 2679.  -   },
  2682. 2680.  -
  2683. 2681.  -   loadedAlbums: function(ownerId, html, preload, preloadPhotos, opts) {
  2684. 2682.  -     if (!cur.pvAlbumsData) return;
  2685. 2683.  -
  2686. 2684.  -     ajax.preload('al_photos.php', extend({offset: opts.offset, part: 1, owner: ownerId}, {act: 'show_albums'}), preload);
  2687. 2685.  -     ajax.preload('al_photos.php', extend({offset: opts.photos_offset, part: 1, owner: ownerId}, {act: 'show_albums', only_photos: 1}), preloadPhotos);
  2688. 2686.  -
  2689. 2687.  -     cur.pvAlbumsData[ownerId] = {
  2690. 2688.  -       html: html,
  2691. 2689.  -       opts: opts
  2692. 2690.  -     };
  2693. 2691.  -     if (cur.pvAlbumsShowing == ownerId) {
  2694. 2692.  -       Photoview.doShowAlbums(ownerId, false);
  2695. 2693.  -       boxRefreshCoords(layer);
  2696. 2694.  -     }
  2697. 2695.  -   },
  2698. 2696.  -   showAlbums: function(ownerId, options) {
  2699. 2697.  -     ownerId = intval(ownerId);
  2700. 2698.  -     if (!cur.pvAlbumsData) cur.pvAlbumsData = {};
  2701. 2699.  -     if (cur.pvListId == 'temp') {
  2702. 2700.  -       cur.pvCancelLoad();
  2703. 2701.  -     }
  2704. 2702.  -
  2705. 2703.  -     cur.pvNoHistory = options.noHistory;
  2706. 2704.  -     cur.pvHistoryLength = 0;
  2707. 2705.  -     cur.pvAlbumsShowing = ownerId;
  2708. 2706.  -     var of = options.onFail;
  2709. 2707.  -     if (!cur.pvAlbumsData[ownerId]) {
  2710. 2708.  -       cur.pvAlbumsData[ownerId] = 'loading';
  2711. 2709.  -       ajax.post('al_photos.php', {act: 'show_albums', owner: ownerId}, extend(options, {onDone: Photoview.loadedAlbums, onFail: function(t) {
  2712. 2710.  -           if (of) of(t);
  2713. 2711.  -           delete(cur.pvAlbumsData[ownerId]);
  2714. 2712.  -           cur.pvAlbumsData[ownerId];
  2715. 2713.  -           layers.fullhide(true);
  2716. 2714.  -           return true;
  2717. 2715.  -         }
  2718. 2716.  -       }));
  2719. 2717.  -     } else if (cur.pvAlbumsData[ownerId] != 'loading') {
  2720. 2718.  -       Photoview.doShowAlbums(ownerId, false);
  2721. 2719.  -       boxRefreshCoords(layer);
  2722. 2720.  -     }
  2723. 2721.  -   },
  2724. 2722.  -   loadedAlbum: function(albumRaw, html, preload, opts) {
  2725. 2723.  -     if (!cur.pvAlbumData) return;
  2726. 2724.  -
  2727. 2725.  -     if (preload) {
  2728. 2726.  -       ajax.preload('al_photos.php', extend({offset: opts.offset, part: 1, album: albumRaw}, {act: 'show_album'}), preload);
  2729. 2727.  -     }
  2730. 2728.  -
  2731. 2729.  -     cur.pvAlbumData[albumRaw] = {
  2732. 2730.  -       html: html,
  2733. 2731.  -       opts: opts
  2734. 2732.  -     };
  2735. 2733.  -     if (cur.pvAlbumShowing == albumRaw) {
  2736. 2734.  -       Photoview.doShowAlbum(albumRaw, false);
  2737. 2735.  -       boxRefreshCoords(layer);
  2738. 2736.  -     }
  2739. 2737.  -   },
  2740. 2738.  -   showAlbum: function(albumRaw, options) {
  2741. 2739.  -     if (!cur.pvAlbumData) cur.pvAlbumData = {};
  2742. 2740.  -     if (cur.pvListId == 'temp') {
  2743. 2741.  -       cur.pvCancelLoad();
  2744. 2742.  -     }
  2745. 2743.  -
  2746. 2744.  -     cur.pvNoHistory = options.noHistory;
  2747. 2745.  -     cur.pvHistoryLength = 0;
  2748. 2746.  -     cur.pvAlbumShowing = albumRaw;
  2749. 2747.  -     var of = options.onFail;
  2750. 2748.  -     if (!cur.pvAlbumData[albumRaw]) {
  2751. 2749.  -       cur.pvAlbumData[albumRaw] = 'loading';
  2752. 2750.  -       ajax.post('al_photos.php', {act: 'show_album', album: albumRaw}, extend(options, {onDone: Photoview.loadedAlbum, onFail: function(t) {
  2753. 2751.  -           if (of) of(t);
  2754. 2752.  -           delete(cur.pvAlbumData[albumRaw]);
  2755. 2753.  -           cur.pvAlbumData[albumRaw];
  2756. 2754.  -           layers.fullhide(true);
  2757. 2755.  -           return true;
  2758. 2756.  -         }
  2759. 2757.  -       }));
  2760. 2758.  -     } else if (cur.pvAlbumData[albumRaw] != 'loading') {
  2761. 2759.  -       Photoview.doShowAlbum(albumRaw, false);
  2762. 2760.  -       boxRefreshCoords(layer);
  2763. 2761.  -     }
  2764. 2762.  -   },
  2765. 2763.  -   loadedTagged: function(ownerId, html, preload, preloadPhotos, opts) {
  2766. 2764.  -     if (!cur.pvPhotoTagData) return;
  2767. 2765.  -
  2768. 2766.  -     ajax.preload('al_photos.php', extend({offset: opts.offset, part: 1, owner: ownerId}, {act: 'show_tag'}), preload);
  2769. 2767.  -     ajax.preload('al_photos.php', extend({offset: opts.photos_offset, part: 1, owner: ownerId}, {act: 'show_tag', only_photos: 1}), preloadPhotos);
  2770. 2768.  -
  2771. 2769.  -     cur.pvPhotoTagData[ownerId] = {
  2772. 2770.  -       html: html,
  2773. 2771.  -       opts: opts
  2774. 2772.  -     };
  2775. 2773.  -     if (cur.pvPhotoTagShowing == ownerId) {
  2776. 2774.  -       Photoview.doShowTagged(ownerId, false);
  2777. 2775.  -       boxRefreshCoords(layer);
  2778. 2776.  -     }
  2779. 2777.  -   },
  2780. 2778.  -   showTagged: function(ownerId, options) {
  2781. 2779.  -     ownerId = intval(ownerId);
  2782. 2780.  -     if (!cur.pvPhotoTagData) cur.pvPhotoTagData = {};
  2783. 2781.  -     if (cur.pvListId == 'temp') {
  2784. 2782.  -       cur.pvCancelLoad();
  2785. 2783.  -     }
  2786. 2784.  -
  2787. 2785.  -     cur.pvNoHistory = options.noHistory;
  2788. 2786.  -     cur.pvHistoryLength = 0;
  2789. 2787.  -     cur.pvPhotoTagShowing = ownerId;
  2790. 2788.  -     var of = options.onFail;
  2791. 2789.  -     if (!cur.pvPhotoTagData[ownerId]) {
  2792. 2790.  -       cur.pvPhotoTagData[ownerId] = 'loading';
  2793. 2791.  -       ajax.post('al_photos.php', {act: 'show_tag', mid: ownerId}, extend(options, {onDone: Photoview.loadedTagged, onFail: function(t) {
  2794. 2792.  -           if (of) of(t);
  2795. 2793.  -           delete(cur.pvPhotoTagData[ownerId]);
  2796. 2794.  -           cur.pvPhotoTagData[ownerId];
  2797. 2795.  -           layers.fullhide(true);
  2798. 2796.  -           return true;
  2799. 2797.  -         }
  2800. 2798.  -       }));
  2801. 2799.  -     } else if (cur.pvPhotoTagData[ownerId] != 'loading') {
  2802. 2800.  -       Photoview.doShowTagged(ownerId, false);
  2803. 2801.  -       boxRefreshCoords(layer);
  2804. 2802.  -     }
  2805. 2803.  -   },
  2806. 2804.  -   loadedVideoTags: function(ownerId, html, preload, opts) {
  2807. 2805.  -     ajax.preload('/al_video.php', {act: 'show_video_tags', offset: opts.offset, part: 1, mid: ownerId}, preload);
  2808. 2806.  -
  2809. 2807.  -     cur.pvVideoTagsData = {
  2810. 2808.  -       html: html,
  2811. 2809.  -       opts: opts
  2812. 2810.  -     };
  2813. 2811.  -     if (cur.pvVideoTagShowing == ownerId) {
  2814. 2812.  -       Photoview.doShowVideoTags(ownerId, false);
  2815. 2813.  -       boxRefreshCoords(layer);
  2816. 2814.  -     }
  2817. 2815.  -   },
  2818. 2816.  -   showVideoTags: function(ownerId, options) {
  2819. 2817.  -     cur.pvNoHistory = options.noHistory;
  2820. 2818.  -     cur.pvHistoryLength = 0;
  2821. 2819.  -     cur.pvVideoTagShowing = ownerId;
  2822. 2820.  -     var of = options.onFail;
  2823. 2821.  -     if (!cur.pvVideoTagsData) {
  2824. 2822.  -       cur.pvVideoTagsData = 'loading';
  2825. 2823.  -       ajax.post('/al_video.php', {act: 'show_video_tags', mid: ownerId}, extend(options, {onDone: Photoview.loadedVideoTags, onFail: function(t) {
  2826. 2824.  -           if (of) of(t);
  2827. 2825.  -           delete(cur.pvVideoTagsData);
  2828. 2826.  -           layers.fullhide && layers.fullhide(true);
  2829. 2827.  -           return true;
  2830. 2828.  -         }
  2831. 2829.  -       }));
  2832. 2830.  -     } else if (cur.pvVideoTagsData != 'loading') {
  2833. 2831.  -       Photoview.doShowVideoTags(ownerId, false);
  2834. 2832.  -       boxRefreshCoords(layer);
  2835. 2833.  -     }
  2836. 2834.  -   },
  2837. 2835.  -   scrollResize: function() {
  2838. 2836.  -     if (browser.mobile || !cur.pvShown || (!cur.pvAlbumsShown && !cur.pvAlbumShown && !cur.pvPhotoTagShown && !cur.pvVideoTagsShown)) return;
  2839. 2837.  -
  2840. 2838.  -     var bt = lastWindowHeight,
  2841. 2839.  -         lnk = cur.pvVideoTagsShown ? ge('pva_more_videos') : (cur.pvAlbumsShown ? ge('pva_more_photos') : ge('pvsa_more_photos')),
  2842. 2840.  -         albumsLnk = ge('pva_more');
  2843. 2841.  -
  2844. 2842.  -     if (isVisible(lnk) && bt > getXY(lnk)[1] - (browser.msie6 ? 0 : scrollGetY())) {
  2845. 2843.  -       if (cur.pvVideoTagsShown) {
  2846. 2844.  -         Photoview.loadVideoTags();
  2847. 2845.  -       } else if (cur.pvPhotoTagShown) {
  2848. 2846.  -         Photoview.loadTaggedPhotos();
  2849. 2847.  -       } else if (cur.pvAlbumsShown) {
  2850. 2848.  -         Photoview.loadAlbumsPhotos();
  2851. 2849.  -       } else {
  2852. 2850.  -         Photoview.loadAlbumPhotos();
  2853. 2851.  -       }
  2854. 2852.  -     }
  2855. 2853.  -     if (cur.pvAlbumsShown && cur.pvShowAllAlbums && isVisible(albumsLnk) && bt > getXY(albumsLnk)[1] - (browser.msie6 ? 0 : scrollGetY())) {
  2856. 2854.  -       Photoview.loadAlbums();
  2857. 2855.  -     }
  2858. 2856.  -   },
  2859. 2857.  -   loadAlbums: function() {
  2860. 2858.  -     cur.pvShowAllAlbums = true;
  2861. 2859.  -     Photoview.loadAlbumsPhotos(true);
  2862. 2860.  -   },
  2863. 2861.  -   loadedAlbumsPhotos: function(off, rows, albums) {
  2864. 2862.  -     cur.pvaLoading = 0;
  2865. 2863.  -
  2866. 2864.  -     if (!cur.pvAlbumsShown) return;
  2867. 2865.  -
  2868. 2866.  -     if (albums) {
  2869. 2867.  -       cur.pvaOffset = off;
  2870. 2868.  -     } else {
  2871. 2869.  -       cur.pvaPhotosOffset = off;
  2872. 2870.  -     }
  2873. 2871.  -
  2874. 2872.  -     var cont = albums ? ge('pva_content') : ge('pva_content_photos'),
  2875. 2873.  -         more = albums ? ge('pva_more') : ge('pva_more_photos'),
  2876. 2874.  -         opts = albums ? {act: 'show_albums'} : {act: 'show_albums', only_photos: 1},
  2877. 2875.  -         offset = albums ? cur.pvaOffset : cur.pvaPhotosOffset,
  2878. 2876.  -         count = albums ? cur.pvaCount : cur.pvaPhotosCount,
  2879. 2877.  -         d = ce('div', {innerHTML: rows});
  2880. 2878.  -     if (!cont) return;
  2881. 2879.  -
  2882. 2880.  -     while (d.firstChild) {
  2883. 2881.  -       cont.appendChild(d.firstChild);
  2884. 2882.  -     }
  2885. 2883.  -
  2886. 2884.  -     Photoview.onResize();
  2887. 2885.  -
  2888. 2886.  -     if (off >= count || !rows) {
  2889. 2887.  -       hide(more);
  2890. 2888.  -       return;
  2891. 2889.  -     }
  2892. 2890.  -     cur.pvaLoading = 1;
  2893. 2891.  -
  2894. 2892.  -     ajax.post('al_photos.php', extend({offset: offset, part: 1, owner: cur.pvAlbumsShown}, opts || {}), {cache: 1, onDone: function() {
  2895. 2893.  -       debugLog('preload done: ' + cur.pvaLoading);
  2896. 2894.  -       if (cur.pvaLoading == 2) {
  2897. 2895.  -         Photoview.loadedAlbumsPhotos.apply(window, arguments);
  2898. 2896.  -       } else {
  2899. 2897.  -         cur.pvaLoading = false;
  2900. 2898.  -       }
  2901. 2899.  -     }, onFail: function() {
  2902. 2900.  -       cur.pvaLoading = 0;
  2903. 2901.  -       return true;
  2904. 2902.  -     }});
  2905. 2903.  -   },
  2906. 2904.  -   loadAlbumsPhotos: function(albums) {
  2907. 2905.  -     var more = albums ? ge('pva_more') : ge('pva_more_photos'),
  2908. 2906.  -         progress = albums ? ge('pva_more_prg') : ge('pva_more_photos_prg'),
  2909. 2907.  -         opts = albums ? {act: 'show_albums'} : {act: 'show_albums', only_photos: 1},
  2910. 2908.  -         offset = albums ? cur.pvaOffset : cur.pvaPhotosOffset;
  2911. 2909.  -     if (!cur.pvAlbumsShown || !more || !isVisible(more) || isVisible(progress)) return;
  2912. 2910.  -
  2913. 2911.  -     if (cur.pvaLoading) {
  2914. 2912.  -       cur.pvaLoading = 2;
  2915. 2913.  -       return;
  2916. 2914.  -     }
  2917. 2915.  -
  2918. 2916.  -     ajax.post('al_photos.php', extend({offset: offset, part: 1, owner: cur.pvAlbumsShown}, opts || {}), {onDone: Photoview.loadedAlbumsPhotos, onFail: function() {
  2919. 2917.  -       cur.pvaLoading = 0;
  2920. 2918.  -       return true;
  2921. 2919.  -     }, showProgress: function() {
  2922. 2920.  -       show(progress);
  2923. 2921.  -       hide(more.firstChild);
  2924. 2922.  -     }, hideProgress: function() {
  2925. 2923.  -       show(more.firstChild);
  2926. 2924.  -       hide(progress);
  2927. 2925.  -     }, cache: 1});
  2928. 2926.  -   },
  2929. 2927.  -   loadedAlbumPhotos: function(off, rows) {
  2930. 2928.  -     cur.pvaLoading = 0;
  2931. 2929.  -
  2932. 2930.  -     if (!cur.pvAlbumShown) return;
  2933. 2931.  -
  2934. 2932.  -     cur.pvsaOffset = off;
  2935. 2933.  -
  2936. 2934.  -     var cont = ge('pvsa_content_photos'),
  2937. 2935.  -         more = ge('pvsa_more_photos');
  2938. 2936.  -     if (!cont) return;
  2939. 2937.  -
  2940. 2938.  -     cont.appendChild(cf(rows));
  2941. 2939.  -
  2942. 2940.  -     if (off >= cur.pvsaCount) {
  2943. 2941.  -       hide(more);
  2944. 2942.  -       Photoview.onResize();
  2945. 2943.  -       return;
  2946. 2944.  -     }
  2947. 2945.  -
  2948. 2946.  -     Photoview.onResize();
  2949. 2947.  -     cur.pvsaLoading = 1;
  2950. 2948.  -
  2951. 2949.  -     ajax.post('al_photos.php', extend({offset: cur.pvsaOffset, part: 1, album: cur.pvAlbumShown}, {act: 'show_album'}), {cache: 1, onDone: function() {
  2952. 2950.  -       debugLog('preload done: ', cur.pvsaLoading);
  2953. 2951.  -       if (cur.pvsaLoading == 2) {
  2954. 2952.  -         Photoview.loadedAlbumPhotos.apply(window, arguments);
  2955. 2953.  -       } else {
  2956. 2954.  -         cur.pvsaLoading = false;
  2957. 2955.  -       }
  2958. 2956.  -     }, onFail: function() {
  2959. 2957.  -       cur.pvsaLoading = 0;
  2960. 2958.  -       return true;
  2961. 2959.  -     }});
  2962. 2960.  -   },
  2963. 2961.  -   loadAlbumPhotos: function() {
  2964. 2962.  -     var more = ge('pvsa_more_photos'),
  2965. 2963.  -         progress = ge('pvsa_more_photos_prg'),
  2966. 2964.  -         offset = cur.pvsaOffset;
  2967. 2965.  -     if (!cur.pvAlbumShown || !more || !isVisible(more) || isVisible(progress)) return;
  2968. 2966.  -
  2969. 2967.  -     if (cur.pvsaLoading) {
  2970. 2968.  -       cur.pvsaLoading = 2;
  2971. 2969.  -       return;
  2972. 2970.  -     }
  2973. 2971.  -
  2974. 2972.  -     ajax.post('al_photos.php', {act: 'show_album', album: cur.pvAlbumShown, offset: offset, part: 1}, {onDone: Photoview.loadedAlbumPhotos, onFail: function() {
  2975. 2973.  -       cur.pvsaLoading = 0;
  2976. 2974.  -       return true;
  2977. 2975.  -     }, showProgress: function() {
  2978. 2976.  -       show(progress);
  2979. 2977.  -       hide(more.firstChild);
  2980. 2978.  -     }, hideProgress: function() {
  2981. 2979.  -       show(more.firstChild);
  2982. 2980.  -       hide(progress);
  2983. 2981.  -     }, cache: 1});
  2984. 2982.  -   },
  2985. 2983.  -   loadedTaggedPhotos: function(off, rows) {
  2986. 2984.  -     cur.pvaLoading = 0;
  2987. 2985.  -
  2988. 2986.  -     if (!cur.pvPhotoTagShown) return;
  2989. 2987.  -
  2990. 2988.  -     cur.pvsaOffset = off;
  2991. 2989.  -
  2992. 2990.  -     var cont = ge('pvsa_content_photos'),
  2993. 2991.  -         more = ge('pvsa_more_photos');
  2994. 2992.  -     if (!cont) return;
  2995. 2993.  -
  2996. 2994.  -     cont.appendChild(cf(rows));
  2997. 2995.  -
  2998. 2996.  -     Photoview.onResize();
  2999. 2997.  -
  3000. 2998.  -     if (off >= cur.pvsaCount || !rows) {
  3001. 2999.  -       hide(more);
  3002. 3000.  -       return;
  3003. 3001.  -     }
  3004. 3002.  -     cur.pvsaLoading = 1;
  3005. 3003.  -
  3006. 3004.  -     ajax.post('al_photos.php', extend({offset: cur.pvsaOffset, part: 1, mid: cur.pvPhotoTagShown}, {act: 'show_tag'}), {cache: 1, onDone: function() {
  3007. 3005.  -       debugLog('preload done: ', cur.pvsaLoading);
  3008. 3006.  -       if (cur.pvsaLoading == 2) {
  3009. 3007.  -         Photoview.loadedTaggedPhotos.apply(window, arguments);
  3010. 3008.  -       } else {
  3011. 3009.  -         cur.pvsaLoading = false;
  3012. 3010.  -       }
  3013. 3011.  -     }, onFail: function() {
  3014. 3012.  -       cur.pvsaLoading = 0;
  3015. 3013.  -       return true;
  3016. 3014.  -     }});
  3017. 3015.  -   },
  3018. 3016.  -   loadTaggedPhotos: function(albums) {
  3019. 3017.  -     var more = ge('pvsa_more_photos'),
  3020. 3018.  -         progress = ge('pvsa_more_photos_prg'),
  3021. 3019.  -         offset = cur.pvsaOffset;
  3022. 3020.  -     if (!cur.pvPhotoTagShown || !more || !isVisible(more) || isVisible(progress)) return;
  3023. 3021.  -
  3024. 3022.  -     if (cur.pvsaLoading) {
  3025. 3023.  -       cur.pvsaLoading = 2;
  3026. 3024.  -       return;
  3027. 3025.  -     }
  3028. 3026.  -
  3029. 3027.  -     ajax.post('al_photos.php', {act: 'show_tag', mid: cur.pvPhotoTagShown, offset: offset, part: 1}, {onDone: Photoview.loadedTaggedPhotos, onFail: function() {
  3030. 3028.  -       cur.pvsaLoading = 0;
  3031. 3029.  -       return true;
  3032. 3030.  -     }, showProgress: function() {
  3033. 3031.  -       show(progress);
  3034. 3032.  -       hide(more.firstChild);
  3035. 3033.  -     }, hideProgress: function() {
  3036. 3034.  -       show(more.firstChild);
  3037. 3035.  -       hide(progress);
  3038. 3036.  -     }, cache: 1});
  3039. 3037.  -   },
  3040. 3038.  -   loadedMoreVideoTags: function(off, rows) {
  3041. 3039.  -     cur.pvaLoading = 0;
  3042. 3040.  -
  3043. 3041.  -     if (!cur.pvVideoTagsShown) return;
  3044. 3042.  -
  3045. 3043.  -     cur.pvsaOffset = off;
  3046. 3044.  -
  3047. 3045.  -     var cont = ge('pva_video_tags'),
  3048. 3046.  -         more = ge('pva_more_videos');
  3049. 3047.  -     if (!cont) return;
  3050. 3048.  -
  3051. 3049.  -     cont.appendChild(cf(rows));
  3052. 3050.  -
  3053. 3051.  -     Photoview.onResize();
  3054. 3052.  -
  3055. 3053.  -     if (off >= cur.pvsaCount || !rows) {
  3056. 3054.  -       hide(more);
  3057. 3055.  -       return;
  3058. 3056.  -     }
  3059. 3057.  -     cur.pvsaLoading = 1;
  3060. 3058.  -
  3061. 3059.  -     ajax.post('/al_video.php', extend({act: 'show_video_tags', offset: cur.pvsaOffset, part: 1, mid: cur.pvVideoTagsShown}), {cache: 1, onDone: function() {
  3062. 3060.  -       debugLog('preload done: ', cur.pvsaLoading);
  3063. 3061.  -       if (cur.pvsaLoading == 2) {
  3064. 3062.  -         Photoview.loadedMoreVideoTags.apply(window, arguments);
  3065. 3063.  -       } else {
  3066. 3064.  -         cur.pvsaLoading = false;
  3067. 3065.  -       }
  3068. 3066.  -     }, onFail: function() {
  3069. 3067.  -       cur.pvsaLoading = 0;
  3070. 3068.  -       return true;
  3071. 3069.  -     }});
  3072. 3070.  -   },
  3073. 3071.  -   loadVideoTags: function(albums) {
  3074. 3072.  -     var more = ge('pva_more_videos'),
  3075. 3073.  -         progress = ge('pva_more_videos_prg'),
  3076. 3074.  -         offset = cur.pvsaOffset;
  3077. 3075.  -     if (!cur.pvVideoTagsShown || !more || !isVisible(more) || isVisible(progress)) return;
  3078. 3076.  -
  3079. 3077.  -     if (cur.pvsaLoading) {
  3080. 3078.  -       cur.pvsaLoading = 2;
  3081. 3079.  -       return;
  3082. 3080.  -     }
  3083. 3081.  -
  3084. 3082.  -     ajax.post('/al_video.php', {act: 'show_video_tags', mid: cur.pvVideoTagsShown, offset: offset, part: 1}, {onDone: Photoview.loadedMoreVideoTags, onFail: function() {
  3085. 3083.  -       cur.pvsaLoading = 0;
  3086. 3084.  -       return true;
  3087. 3085.  -     }, showProgress: function() {
  3088. 3086.  -       show(progress);
  3089. 3087.  -       hide(more.firstChild);
  3090. 3088.  -     }, hideProgress: function() {
  3091. 3089.  -       show(more.firstChild);
  3092. 3090.  -       hide(progress);
  3093. 3091.  -     }, cache: 1});
  3094. 3092.  -   },
  3095. 3093.  -   thumbOver: function(obj, id) {
  3096. 3094.  -     clearTimeout((cur.pvHideTO || {})[id]);
  3097. 3095.  -     var title = geByClass1('pva_title', obj), r = title.previousSibling, descY = getSize(geByClass1('pva_desc', obj))[1];
  3098. 3096.  -     if (descY < 5) return;
  3099. 3097.  -
  3100. 3098.  -     animate(title, {marginTop: 238 - (descY + 7)}, {duration: 200, transition: Fx.Transitions.easeOutCirc});
  3101. 3099.  -     if (r.className == 'pva_repeat') {
  3102. 3100.  -       animate(r, {marginTop: 86 - Math.floor((descY + 7) / 2)}, {duration: 200, transition: Fx.Transitions.easeOutCirc});
  3103. 3101.  -     }
  3104. 3102.  -   },
  3105. 3103.  -   thumbOut: function(obj, id) {
  3106. 3104.  -     if (!cur.pvHideTO) cur.pvHideTO = {};
  3107. 3105.  -     cur.pvHideTO[id] = setTimeout(function() {
  3108. 3106.  -       var title = geByClass1('pva_title', obj), r = title.previousSibling;
  3109. 3107.  -       animate(title, {marginTop: 238}, 200);
  3110. 3108.  -       if (r.className == 'pva_repeat') {
  3111. 3109.  -         animate(r, {marginTop: 86}, 200);
  3112. 3110.  -       }
  3113. 3111.  -     }, 150);
  3114. 3112.  -   },
  3115. 3113.  -
  3116. 3114.  -   photoAct: function(ev) {
  3117. 3115.  -     if (cur.pvAlbumsShown || cur.pvAlbumShown || cur.pvPhotoTagShown || !cur.pvCurPhoto.author) return;
  3118. 3116.  -
  3119. 3117.  -     var pos = getXY(cur.pvHH, true);
  3120. 3118.  -     if (pos[0]) {
  3121. 3119.  -       cur.hhPos = pos;
  3122. 3120.  -     } else {
  3123. 3121.  -       pos = cur.hhPos;
  3124. 3122.  -     }
  3125. 3123.  -
  3126. 3124.  -     var next = cur.pvHH;
  3127. 3125.  -
  3128. 3126.  -     var dx = Math.abs(ev.clientX - pos[0] - 36);
  3129. 3127.  -     var dy = ev.clientY - pos[1];
  3130. 3128.  -
  3131. 3129.  -     if (dx < 120 && dy < 130 && dy > -30) {
  3132. 3130.  -       if (cur.pvHHShowing) return;
  3133. 3131.  -       cur.pvHHShowing = true;
  3134. 3132.  -       show(next);
  3135. 3133.  -       animate(next.firstChild, {opacity: 1}, 400);
  3136. 3134.  -
  3137. 3135.  -       if (!cur.rvPreloadBig) {
  3138. 3136.  -         vkImage().src = '/images/icons/post_big_hh.png';
  3139. 3137.  -         cur.rvPreloadBig = true;
  3140. 3138.  -       }
  3141. 3139.  -     } else {
  3142. 3140.  -       if (!cur.pvHHShowing) return;
  3143. 3141.  -       cur.pvHHShowing = false;
  3144. 3142.  -       animate(next.firstChild, {opacity: 0}, 400);
  3145. 3143.  -     }
  3146. 3144.  -
  3147. 3145.  -   },
  3148. 3146.  -
  3149. 3147.  -   hhLiked: function(obj, act) {
  3150. 3148.  -     return (act || hasClass)(obj.parentNode.parentNode, 'pvs_hh_liked');
  3151. 3149.  -   },
  3152. 3150.  -   hhOver: function(obj) {
  3153. 3151.  -     clearTimeout(obj.parentNode.parentNode.getAttribute('timer'));
  3154. 3152.  -     var params = Photoview.hhLiked(obj) ? [0.25, 1] : [0.28, 0.65];
  3155. 3153.  -     animate(obj.previousSibling, {opacity: params[0]}, 200);
  3156. 3154.  -     animate(obj, {opacity: params[1]}, 200);
  3157. 3155.  -   },
  3158. 3156.  -   hhOut: function(obj) {
  3159. 3157.  -     var params = Photoview.hhLiked(obj) ? [0.25, 1] : [0.2, 0.5];
  3160. 3158.  -     animate(obj.previousSibling, {opacity: params[0]}, 200);
  3161. 3159.  -     animate(obj, {opacity: params[1]}, 200);
  3162. 3160.  -   },
  3163. 3161.  -   hhClick: function(obj, ev, pv) {
  3164. 3162.  -     if (ev.button == 2) return;
  3165. 3163.  -     var liked = Photoview.hhLiked(obj);
  3166. 3164.  -
  3167. 3165.  -     Photoview.like();
  3168. 3166.  -     liked && Photoview.likeOut();
  3169. 3167.  -
  3170. 3168.  -     Photoview.hhOver(obj);
  3171. 3169.  -
  3172. 3170.  -     if (!liked && !(browser.msie && intval(browser.version) < 9 || browser.mozilla && intval(browser.version) < 9)) {
  3173. 3171.  -       obj.innerHTML = '<img class="pvs_hh_ah" width="38" height="34" src="/images/icons/post_big_hh.png" />';
  3174. 3172.  -       var img = obj.firstChild;
  3175. 3173.  -       animate(img, {marginLeft: -3, marginTop: 3, width: 78, height: 71, opacity: 0}, {duration: 600, transition: Fx.Transitions.easeOutCubic});
  3176. 3174.  -     }
  3177. 3175.  -
  3178. 3176.  -     return cancelEvent(ev);
  3179. 3177.  -   },
  3180. 3178.  -   hhCheck: function() {
  3181. 3179.  -     return (!browser.msie || intval(browser.version) > 8) && !cur.pvNoLikes;
  3182. 3180.  -   },
  3183. 3181.  -
  3184. 3182.  -   showRepeat: function(row) {
  3185. 3183.  -     if (!row || geByClass1('pva_repeat', row)) return;
  3186. 3184.  -
  3187. 3185.  -     geByClass1('pva_link', row).insertBefore(ce('div', {className: 'pva_repeat', innerHTML: '\
  3188. 3186.  - <div class="pva_repeat_blob">\
  3189. 3187.  -   <div class="pva_repeat_cont"><img class="pva_repeat_img png" src="'+stManager._srcPrefix('.css')+'/images/icons/post_hh'+(window.devicePixelRatio >= 2 ? '_2x' : '')+'.png?2" /><span class="pva_repeat_text">' + getLang('photos_repeat_album') + '</span></div>\
  3190. 3188.  - </div>'}), geByClass1('pva_title', row));
  3191. 3189.  -   },
  3192. 3190.  -
  3193. 3191.  -   showPlace: function() {
  3194. 3192.  -     var geohash = cur.pvCurPhoto.geohash;
  3195. 3193.  -     showBox('al_places.php', {act: 'show_photo_place', geohash: geohash, photo: cur.pvCurPhoto.id}, {width: 708, hideButtons: true, title: false, cache: 1});
  3196. 3194.  -   },
  3197. 3195.  -
  3198. 3196.  -   editPlace: function() {
  3199. 3197.  -     var geohash = cur.pvCurPhoto.geohash;
  3200. 3198.  -     showBox('al_places.php', {act: 'show_photo_place', edit: 1, geohash: geohash || '', photo: cur.pvCurPhoto.id});
  3201. 3199.  -   },
  3202. 3200.  -
  3203. 3201.  -   updatePlace: function(photo, place) {
  3204. 3202.  -     var placeCont = ge('pv_edit_place');
  3205. 3203.  -     if (place) {
  3206. 3204.  -       placeCont && (placeCont.innerHTML = place ? place + '.' : '');
  3207. 3205.  -       ge('pv_place').innerHTML = place ? '<span class="pv_place_label">' + getLang('photos_place_label') + '</span> <a class="pv_place_a" id="pv_place_a" onclick="Photoview.showPlace()">' + place + '</a>' : '';
  3208. 3206.  -       hide('pv_add_place');
  3209. 3207.  -     } else {
  3210. 3208.  -       setTimeout(function() {
  3211. 3209.  -         ajax.post('al_photos.php', {act: 'get_photo_place', photo: photo}, {
  3212. 3210.  -           onDone: function(place, placeGeoHash) {
  3213. 3211.  -             Photoview.updatePlace(photo, place);
  3214. 3212.  -           }
  3215. 3213.  -         })
  3216. 3214.  -       }, 1000);
  3217. 3215.  -     }
  3218. 3216.  -   },
  3219. 3217.  -
  3220. 3218.  -   nearProgress: function(obj) {
  3221. 3219.  -     obj.insertBefore(ce('div', {className: 'pv_load_near'}), obj.firstChild);
  3222. 3220.  -   },
  3223. 3221.  -
  3224. 3222.  -   reportComment: function(obj, ev, commentRaw) {
  3225. 3223.  -     stManager.add(['privacy.js', 'privacy.css'], function() {
  3226. 3224.  -       return Privacy.show(obj, ev, 'report_'+commentRaw);
  3227. 3225.  -     });
  3228. 3226.  -   }
  3229. 3227.  -
  3230. 3228.  - }, photoview = Photoview;
  3231. 3229.  -
  3232. 3230.  - try{stManager.done('photoview.js');}catch(e){}
  3233. ------
  3234. Файл - videoview.js (Старый размер - 68870 | Новый - 0):
  3235. 0.  - var Videoview = {
  3236. 1.  -
  3237. 2.  - isFS: false,
  3238. 3.  -
  3239. 4.  - playerCallback: {
  3240. 5.  -   resize: function (w, h) {
  3241. 6.  -   },
  3242. 7.  -   debugLog: function() {
  3243. 8.  -     var args = Array.prototype.slice.call(arguments);
  3244. 9.  -     args.unshift('flashPlayer: ');
  3245. 10.  -     debugLog(args);
  3246. 11.  -   },
  3247. 12.  -   fullscreen: function(value) {
  3248. 13.  -     Videoview.isFS = value;
  3249. 14.  -   },
  3250. 15.  -   incViewCounter: function(oid, vid, hash) {
  3251. 16.  -     ajax.post('al_video.php', {act: 'inc_view_counter', oid: oid, vid: vid, hash: hash}, {
  3252. 17.  -       cache: 1,
  3253. 18.  -       onDone: function(t) {
  3254. 19.  -     }});
  3255. 20.  -   },
  3256. 21.  -   rotateVideo: function(oid, vid, angle, hash) {
  3257. 22.  -     ajax.post('al_video.php', {act: 'rotate_video', oid: oid, vid: vid, angle: angle, hash: hash});
  3258. 23.  -   },
  3259. 24.  -   scoreCardCounter: function () {
  3260. 25.  -     // vkImage().src = locProtocol + '//b.scorecardresearch.com/p?c1=1&c2=13765216&c5=06&rn=' + Math.round(Math.random() * 1000000000);
  3261. 26.  -   },
  3262. 27.  -   onVideoResolutionChanged: function(oid, vid, hash, resolution) {
  3263. 28.  -     if (mvcur.mvData) {
  3264. 29.  -       mvcur.mvData.resolution = resolution;
  3265. 30.  -     }
  3266. 31.  -   },
  3267. 32.  -   onVideoPlayProgress: function(oid, vid, hash, time_progress, time_total) {
  3268. 33.  -     var rawId = oid+'_'+vid;
  3269. 34.  -     if (time_progress < 5000 && cur.tnsStart != rawId) {
  3270. 35.  -       this.playerCallback.scoreCardCounter();
  3271. 36.  -       cur.tnsStart = rawId;
  3272. 37.  -     } else if (time_progress > (time_total / 2) && cur.tnsEnd != rawId) {
  3273. 38.  -       cur.tnsEnd = rawId;
  3274. 39.  -     }
  3275. 40.  -     if (mvcur.adData) {
  3276. 41.  -       if (mvcur.adData.stat_link_start && !mvcur.adData.view_complete_start && time_progress >= 5000) {
  3277. 42.  -         ajax.post(mvcur.adData.stat_link_start, {}, {onDone: function() {}, onFail: function() { return true; }});
  3278. 43.  -         mvcur.adData.view_complete_start = true;
  3279. 44.  -       }
  3280. 45.  -       if (mvcur.adData.stat_link_half && !mvcur.adData.view_complete_half && time_progress >= (time_total / 2)) {
  3281. 46.  -         ajax.post(mvcur.adData.stat_link_half, {}, {onDone: function() {}, onFail: function() { return true; }});
  3282. 47.  -         mvcur.adData.view_complete_half = true;
  3283. 48.  -       }
  3284. 49.  -       if (mvcur.adData.stat_link_full && !mvcur.adData.view_complete_full && time_progress >= (time_total * 0.9)) {
  3285. 50.  -         ajax.post(mvcur.adData.stat_link_full, {}, {onDone: function() {}, onFail: function() { return true; }});
  3286. 51.  -         mvcur.adData.view_complete_full = true;
  3287. 52.  -       }
  3288. 53.  -     }
  3289. 54.  -   },
  3290. 55.  -   onVideoStreamPlaying: function() {
  3291. 56.  -     var _n = window.Notifier, _a = window.audioPlayer;
  3292. 57.  -     if (_n) setTimeout(function() { _n.lcSend('video_start'); }, 0);
  3293. 58.  -     if (_a && _a.player && !_a.player.paused()) {
  3294. 59.  -       _a.pauseTrack();
  3295. 60.  -       _a.pausedByVideo = 1;
  3296. 61.  -     }
  3297. 62.  -   },
  3298. 63.  -   onVideoPlayStarted: function(oid, vid, hash) {
  3299. 64.  -     ajax.post('al_video.php', {act: 'video_view_started', oid: oid, vid: vid, hash: hash, quality: mvcur.mvData.resolution || 0}, {
  3300. 65.  -       cache: 1,
  3301. 66.  -       onDone: function(t) {
  3302. 67.  -     }});
  3303. 68.  -   },
  3304. 69.  -   onVideoPlayFinished: function() {
  3305. 70.  -     mvcur.finished = true;
  3306. 71.  -     mvcur.mousemoved = true;
  3307. 72.  -     Videoview.moveCheck();
  3308. 73.  -
  3309. 74.  -     if (mvcur.adData) {
  3310. 75.  -       if (mvcur.adData.stat_link_start && !mvcur.adData.view_complete_start) {
  3311. 76.  -         ajax.post(mvcur.adData.stat_link_start, {}, {onDone: function() {}, onFail: function() { return true; }});
  3312. 77.  -         mvcur.adData.view_complete_start = true;
  3313. 78.  -       }
  3314. 79.  -       if (mvcur.adData.stat_link_half && !mvcur.adData.view_complete_half) {
  3315. 80.  -         ajax.post(mvcur.adData.stat_link_half, {}, {onDone: function() {}, onFail: function() { return true; }});
  3316. 81.  -         mvcur.adData.view_complete_half = true;
  3317. 82.  -       }
  3318. 83.  -       if (mvcur.adData.stat_link_full && !mvcur.adData.view_complete_full) {
  3319. 84.  -         ajax.post(mvcur.adData.stat_link_full, {}, {onDone: function() {}, onFail: function() { return true; }});
  3320. 85.  -         mvcur.adData.view_complete_full = true;
  3321. 86.  -       }
  3322. 87.  -     }
  3323. 88.  -   }
  3324. 89.  - },
  3325. 90.  -
  3326. 91.  - updateArrowsX: function() {
  3327. 92.  -   /*var w = mvcur.mvActualWidth + 30, sbw = sbWidth();
  3328. 93.  -   var lw = Math.max(lastWindowWidth, w + 124 + sbw + 2);
  3329. 94.  -   mvcur.mvLeft.style.left  = Math.floor((lw - sbw - 10 - (w + 66)) / 2) + 'px';
  3330. 95.  -   mvcur.mvRight.style.left = Math.floor((lw - sbw - 10 + (w + 66)) / 2) + 'px';
  3331. 96.  -   if (vk.rtl) {
  3332. 97.  -     mvcur.mvSwitch.style.left = (lw - sbw - 36) + 'px';
  3333. 98.  -   }*/
  3334. 99.  - },
  3335. 100.  -
  3336. 101.  - updateArrowsY: function() {
  3337. 102.  -   /*var h = mvcur.mvBox.offsetHeight;
  3338. 103.  -   if (browser.mobile) {
  3339. 104.  -     var skipTop = 10 + mvcur.mvYOffset;
  3340. 105.  -     mvcur.mvRight.style.top = mvcur.mvLeft.style.top = (skipTop + Math.floor(h / 2) - 7) + 'px';
  3341. 106.  -     if (lastWindowHeight < mvcur.mvYOffset + h + 50) {
  3342. 107.  -       setTimeout(function() {
  3343. 108.  -         var f = ge('footer');
  3344. 109.  -         f.style.height = (intval(getStyle(f, 'height')) + (mvcur.mvYOffset + h + 50 - lastWindowHeight)) + 'px';
  3345. 110.  -         onBodyResize();
  3346. 111.  -         Videoview.onResize();
  3347. 112.  -       }, 1);
  3348. 113.  -     }
  3349. 114.  -   }
  3350. 115.  -   mvcur.mvLeftNav.style.height = mvcur.mvRightNav.style.height = h + 'px';*/
  3351. 116.  - },
  3352. 117.  -
  3353. 118.  - actionInfo: function() {
  3354. 119.  -   return ge('mv_action_info') || mvcur.mvWide.appendChild(ce('div', {id: 'mv_action_info'}));
  3355. 120.  - },
  3356. 121.  -
  3357. 122.  - locNav: function(ch, old, nw) {
  3358. 123.  -   nw = nav.toStr(nw);
  3359. 124.  -   var m = nw.match(/^video(-?\d+_\d+)$/);
  3360. 125.  -   if (!m) {
  3361. 126.  -     Videoview.hide();
  3362. 127.  -     return;
  3363. 128.  -   }
  3364. 129.  - },
  3365. 130.  -
  3366. 131.  - showPlayer: function(force) {
  3367. 132.  -   var el = ge('video_player');
  3368. 133.  -   if (!el) return;
  3369. 134.  -   if (!force && el.getAttribute('preventhide') && !browser.safari_mobile) return;
  3370. 135.  -   if (browser.msie) {
  3371. 136.  -     setStyle(el, {position: 'static', top: 0});
  3372. 137.  -   } if (browser.safari_mobile) {
  3373. 138.  -     show(el);
  3374. 139.  -   } else {
  3375. 140.  -     el.style.visibility = 'visible';
  3376. 141.  -   }
  3377. 142.  - },
  3378. 143.  -
  3379. 144.  - hidePlayer: function(force) {
  3380. 145.  -   var el = ge('video_player');
  3381. 146.  -   if (!el) return;
  3382. 147.  -   if (!force && el.getAttribute('preventhide') && !browser.safari_mobile) return;
  3383. 148.  -   if (browser.msie) {
  3384. 149.  -     setStyle(el, {position: 'absolute', top: '-5000px'});
  3385. 150.  -   } if (browser.safari_mobile) {
  3386. 151.  -     hide(el);
  3387. 152.  -   } else {
  3388. 153.  -     el.style.visibility = 'hidden';
  3389. 154.  -   }
  3390. 155.  - },
  3391. 156.  -
  3392. 157.  - showTagSelector: function() {
  3393. 158.  -   Videoview.hidePlayer();
  3394. 159.  -   showTabbedBox('al_friends.php', {act: 'select_friends_box', Checked: '', allow_self: 1}, {stat: ['privacy.js', 'ui_controls.js', 'ui_controls.css'], cache: 1, onHide: function() {
  3395. 160.  -     removeClass(mvcur.mvCont, 'toggle_flash');
  3396. 161.  -   }});
  3397. 162.  -   cur.onFlistSave = function (ids, list) {
  3398. 163.  -     Videoview.showPlayer();
  3399. 164.  -     Videoview.addTags(ids);
  3400. 165.  -   }
  3401. 166.  - },
  3402. 167.  -
  3403. 168.  - init: function() {
  3404. 169.  -   window.mvcur = {};
  3405. 170.  -   if (window.mvLayer) {
  3406. 171.  -     return;
  3407. 172.  -   }
  3408. 173.  -   window.mvLayer = ce('div', {
  3409. 174.  -     id: 'mv_layer'
  3410. 175.  -   });
  3411. 176.  -
  3412. 177.  -   addEvent(mvLayer, 'mousemove', function() {
  3413. 178.  -     mvcur.mousemoved = true;
  3414. 179.  -     if (mvcur.blackout) {
  3415. 180.  -       Videoview.moveCheck();
  3416. 181.  -     }
  3417. 182.  -   });
  3418. 183.  -
  3419. 184.  -   window.mvLayerWrap = ce('div', {
  3420. 185.  -     id: 'mv_layer_wrap',
  3421. 186.  -     className: 'scroll_fix_wrap fixed'
  3422. 187.  -   });
  3423. 188.  -
  3424. 189.  -   mvLayerWrap.appendChild(window.mvLayer);
  3425. 190.  -
  3426. 191.  -   bodyNode.appendChild(mvLayerWrap);
  3427. 192.  -
  3428. 193.  -   window.mvLayer.style.width = (lastWindowWidth - sbWidth() - 2) + 'px';
  3429. 194.  - },
  3430. 195.  -
  3431. 196.  - moveCheck: function() {
  3432. 197.  -   if (!mvcur.mousemoved) {
  3433. 198.  -     if (!mvcur.blackout && !mvcur.finished && isVisible(layerBG)) {
  3434. 199.  -       mvcur.blackout = true;
  3435. 200.  -       animate(layerBG, {opacity: 0.9}, 5000);
  3436. 201.  -     }
  3437. 202.  -   } else if (mvcur.blackout) {
  3438. 203.  -     mvcur.blackout = false;
  3439. 204.  -     if (isVisible(layerBG)) {
  3440. 205.  -       animate(layerBG, {opacity: 0.7}, 200);
  3441. 206.  -     } else {
  3442. 207.  -       setStyle(layerBG, {opacity: 0.7});
  3443. 208.  -     }
  3444. 209.  -   }
  3445. 210.  -   mvcur.mousemoved = false;
  3446. 211.  - },
  3447. 212.  -
  3448. 213.  - show: function(ev, videoRaw, listId, options) {
  3449. 214.  -   var _a = window.audioPlayer;
  3450. 215.  -   if (_a && _a.player && !_a.player.paused()) {
  3451. 216.  -     _a.pauseTrack();
  3452. 217.  -     _a.pausedByVideo = 1;
  3453. 218.  -   }
  3454. 219.  -   Videoview.playerCallback.onVideoStreamPlaying();
  3455. 220.  -   debugLog('show video ' + videoRaw);
  3456. 221.  -   if (window.mvcur && mvcur.minimized) {
  3457. 222.  -     if (options.nomin) {
  3458. 223.  -       if (options.prevLoc) {
  3459. 224.  -         mvcur.mvPrevLoc = options.prevLoc;
  3460. 225.  -       }
  3461. 226.  -       debugLog('unminimizing in show');
  3462. 227.  -       Videoview.unminimize(true, false, true);
  3463. 228.  -     }
  3464. 229.  -     return true;
  3465. 230.  -   }
  3466. 231.  -
  3467. 232.  -   if (options.queue) {
  3468. 233.  -     debugLog('pushing in videoview.show');
  3469. 234.  -     layerQueue.push();
  3470. 235.  -     options.queue = false;
  3471. 236.  -   }
  3472. 237.  -
  3473. 238.  -   layerQueue.hide();
  3474. 239.  - //  if (window.wkLayerWrap && isVisible(window.wkLayerWrap)) {
  3475. 240.  - //    hide(wkLayerWrap);
  3476. 241.  - //  }
  3477. 242.  -
  3478. 243.  -   this.init();
  3479. 244.  -
  3480. 245.  -   if (mvcur.mvShown) return;
  3481. 246.  -
  3482. 247.  -   mvcur.showTime = new Date().getTime();
  3483. 248.  -
  3484. 249.  -   if (!isVisible(mvLayerWrap)) {
  3485. 250.  -     otherList = true;
  3486. 251.  -     addEvent(window, 'resize', Videoview.onResize);
  3487. 252.  -     addEvent(document, 'keydown', Videoview.onKeyDown);
  3488. 253.  -     addEvent(mvLayerWrap, 'click', Videoview.onClick);
  3489. 254.  -     boxQueue.hideAll();
  3490. 255.  -     layers.wrapshow(mvLayerWrap, 0.7);
  3491. 256.  -     layers.fullhide = Videoview.hide;
  3492. 257.  -   } else {
  3493. 258.  -     return false;
  3494. 259.  -   }
  3495. 260.  -   setTimeout(function() {
  3496. 261.  -     layers.wrapshow(mvLayerWrap, 0.7);
  3497. 262.  -     layers.fullhide = Videoview.hide;
  3498. 263.  -   }, 0);
  3499. 264.  -
  3500. 265.  -   mvcur.noLocChange = 0; // do return location
  3501. 266.  -   if (options.ad_video) { // videoAds
  3502. 267.  -     options.hideInfo = 1;
  3503. 268.  -     options.noLocChange = 1;
  3504. 269.  -     mvcur.noLocChange = 1;
  3505. 270.  -     mvcur.videoAds = 1;
  3506. 271.  -   }
  3507. 272.  -   mvcur.noHistory = options.noLocChange || options.noHistory;
  3508. 273.  -
  3509. 274.  -   mvcur.blackInterval = setInterval(Videoview.moveCheck, 180000);
  3510. 275.  -
  3511. 276.  -   mvcur.mvShown = true;
  3512. 277.  -
  3513. 278.  -   mvcur.videoRaw = videoRaw;
  3514. 279.  -   mvcur.options = options;
  3515. 280.  -   mvcur.listId = listId;
  3516. 281.  -   mvcur.mvData = false;
  3517. 282.  -
  3518. 283.  -   if (options.prevLoc) {
  3519. 284.  -     mvcur.mvPrevLoc = options.prevLoc;
  3520. 285.  -   } else {
  3521. 286.  -     setTimeout(Videoview.setLocation.pbind(options.noLocChange), 0);
  3522. 287.  -   }
  3523. 288.  -
  3524. 289.  -   if (ev && ev.pageX && ev.pageY) {
  3525. 290.  -     extend(mvcur, {mvOldX: ev.pageX, mvOldY: ev.pageY, mvOldT: vkNow()});
  3526. 291.  -   }
  3527. 292.  -
  3528. 293.  -   if (!mvcur.mvFixed) {
  3529. 294.  -     var colorClass = 'mv_dark';
  3530. 295.  -
  3531. 296.  -     /*mvcur.mvFixed = bodyNode.appendChild(ce('div', {className: 'mv_fixed fixed ' + colorClass, innerHTML: '\
  3532. 297.  - <div class="mv_left no_select" onmousedown="Videoview.show(false, mvcur.mvIndex - 1 + vk.rtl * 2, event);" onmouseover="Videoview.activate(ge(\'mv_left_nav\'), this)" onmouseout="Videoview.deactivate(ge(\'mv_left_nav\'), this)"><div></div></div>\
  3533. 298.  - <div class="mv_right no_select" onmousedown="Videoview.show(false, mvcur.mvIndex + 1 - vk.rtl * 2, event);" onmouseover="Videoview.activate(ge(\'mv_right_nav\'), this)" onmouseout="Videoview.deactivate(ge(\'mv_right_nav\'), this)"><div></div></div>\
  3534. 299.  -     '}));
  3535. 300.  -
  3536. 301.  -     mvcur.mvLeft = mvcur.mvFixed.firstChild;
  3537. 302.  -     mvcur.mvRight = mvcur.mvLeft.nextSibling;
  3538. 303.  -     mvcur.mvSwitch = mvcur.mvRight.nextSibling;
  3539. 304.  -     */
  3540. 305.  -     addClass(mvLayerWrap, colorClass);
  3541. 306.  -     addClass(layerBG, colorClass);
  3542. 307.  -     vkImage().src = '/images/upload.gif';
  3543. 308.  -
  3544. 309.  -
  3545. 310.  -     if (options.hideInfo) {
  3546. 311.  -       var showControls = 'display: none';
  3547. 312.  -       var controlsClass = '';
  3548. 313.  -     } else {
  3549. 314.  -       var showControls = '';
  3550. 315.  -       var controlsClass = 'mv_controls_shown';
  3551. 316.  -     }
  3552. 317.  -
  3553. 318.  -   if (vk.rtl) {
  3554. 319.  -     var minimizeBtn = '';
  3555. 320.  -   } else {
  3556. 321.  -     var minimizeBtn = '<div class="divider fl_r">|</div><div onmouseover="Videoview.activate(this, 2);" onmouseout="Videoview.deactivate(this, 2);" onclick="return Videoview.minimize(event);" class="mv_top_button fl_r">'+getLang('global_min')+'</div>';
  3557. 322.  -   }
  3558. 323.  - // '+' - fix for buggy firefox
  3559. 324.  -     mvLayer.innerHTML = '\
  3560. 325.  - <div class="mv_cont">\
  3561. 326.  - \
  3562. 327.  - <div class="no_select" id="mv_left_nav" '+'onmouseover="Videoview.activate(this, mvcur.mvLeft)" onmouseout="Videoview.deactivate(this, mvcur.mvLeft)" onmousedown="Videoview.show(false, mvcur.mvIndex - 1 + vk.rtl * 2, event); mvcur.mvClicked = true;" onselectstart="return cancelEvent(event);"></div>\
  3563. 328.  - <div class="no_select" id="mv_right_nav" onmouseover="Videoview.activate(this, mvcur.mvRight)" onmouseout="Videoview.deactivate(this, mvcur.mvRight)" onmousedown="Videoview.show(false, mvcur.mvIndex + 1 - vk.rtl * 2, event); mvcur.mvClicked = true;" onselectstart="return cancelEvent(event);"></div>\
  3564. 329.  - <div class="no_select" id="mv_right_controls" style="display: none;" onselectstart="return cancelEvent(event);">\
  3565. 330.  - <div onmouseover="Videoview.activate(this, true);" onmouseout="Videoview.deactivate(this, true);" class="mv_controls_ctrl mv_controls_close"><div></div></div>\
  3566. 331.  - <div onmouseover="Videoview.activate(this, true);" onmouseout="Videoview.deactivate(this, true);" onclick="return Videoview.minimize(event);" class="mv_controls_ctrl mv_controls_min"><div></div></div>\
  3567. 332.  - <div class="mv_controls_bg"></div>\
  3568. 333.  - </div>\
  3569. 334.  - \
  3570. 335.  - <table cellspacing="0" cellpadding="0">\
  3571. 336.  - <tr><td class="sidesh s1"><div></div></td><td>\
  3572. 337.  - <table cellspacing="0" cellpadding="0">\
  3573. 338.  - <tr><td>\
  3574. 339.  - <table cellspacing="0" cellpadding="0">\
  3575. 340.  - <tr><td colspan="3" class="bottomsh s3"><div></div></td></tr>\
  3576. 341.  - <tr><td class="sidesh s3"><div></div></td><td>\
  3577. 342.  - \
  3578. 343.  - <div id="mv_box" onclick="mvcur.mvClicked = true;">\
  3579. 344.  - <div id="mv_approve" style="display: none;"></div>\
  3580. 345.  - <div id="mv_min_layer"><div class="mv_min_header"><div class="mv_mini_control fl_r" onmousedown="return Videoview.hide(false, true);"><div class="mv_close_control"></div></div><div class="mv_mini_control fl_r" onclick="return Videoview.unminimize();"><div class="mv_max_control"></div></div><div class="mv_min_title" id="mv_min_title" onmouseover="if (mvcur.minimized) Videoview.activate(this, 2);" onmouseout="Videoview.deactivate(this, 2);"></div></div></div>\
  3581. 346.  - <div class="no_select mv_data">\
  3582. 347.  -   <div id="mv_top_controls"><div onmouseover="Videoview.activate(this, 2);" onmouseout="Videoview.deactivate(this, 2);" onclick="return Videoview.hide(false, true, event);" class="mv_top_button mv_top_close fl_r">'+getLang('global_close')+'</div>'+minimizeBtn+'</div>\
  3583. 348.  -   <div id="mv_loader"></div>\
  3584. 349.  -   <div id="mv_content"></div>\
  3585. 350.  - </div>\
  3586. 351.  - <div id="mv_controls_line" class="ta_l '+controlsClass+'">\
  3587. 352.  - </div>\
  3588. 353.  - <div class="mv_controls" id="mv_controls" style="'+showControls+'">\
  3589. 354.  -   <div class="clear_fix select_fix" id="mv_comments_data">\
  3590. 355.  -     <div class="fl_l wide_column">\
  3591. 356.  -       <div id="mv_wide"></div>\
  3592. 357.  -     </div>\
  3593. 358.  -     <div class="fl_r narrow_column" id="mv_narrow"></div>\
  3594. 359.  -     <br class="clear" />\
  3595. 360.  -   </div>\
  3596. 361.  -   <div id="mv_warning" style="display: none;"></div>\
  3597. 362.  - </div>\
  3598. 363.  - </div>\
  3599. 364.  - \
  3600. 365.  - </td><td class="sidesh s3"><div></div></td></tr>\
  3601. 366.  - <tr><td colspan="3" class="bottomsh s3"><div></div></td></tr></table>\
  3602. 367.  - </td></tr>\
  3603. 368.  - <tr><td colspan="3" class="bottomsh s2"><div></div></td></tr></table>\
  3604. 369.  - </td><td class="sidesh s1"><div></div></td></tr>\
  3605. 370.  - <tr><td colspan="3" class="bottomsh s1"><div></div></td></tr></table>\
  3606. 371.  - </div>\
  3607. 372.  -     ';
  3608. 373.  -
  3609. 374.  -     extend(mvcur, {
  3610. 375.  -       mvCont: mvLayer.firstChild,
  3611. 376.  -       mvBox: ge('mv_box'),
  3612. 377.  -
  3613. 378.  -       mvLeftNav: ge('mv_left_nav'),
  3614. 379.  -       mvRightNav: ge('mv_right_nav'),
  3615. 380.  -       mvRightControls: ge('mv_right_controls'),
  3616. 381.  -       mvControlsLine: ge('mv_controls_line'),
  3617. 382.  -
  3618. 383.  -       mvLoader: ge('mv_loader'),
  3619. 384.  -       mvContent: ge('mv_content'),
  3620. 385.  -
  3621. 386.  -       mvCommentsData: ge('mv_comments_data'),
  3622. 387.  -
  3623. 388.  -       mvNarrow: ge('mv_narrow'),
  3624. 389.  -       mvWide: ge('mv_wide')
  3625. 390.  -     });
  3626. 391.  -     if (browser.mobile) {
  3627. 392.  -       mvcur.mvYOffset = intval(window.pageYOffset);
  3628. 393.  -
  3629. 394.  -       mvcur.mvCont.style.paddingTop = (mvcur.mvYOffset + 10) + 'px';
  3630. 395.  -       //mvcur.mvRightControls.style.top = (mvcur.mvYOffset + 10) + 'px';
  3631. 396.  -     }
  3632. 397.  -
  3633. 398.  -     Videoview.updateSize();
  3634. 399.  -     if (cur.timeouts && cur.timeouts.changeUrl) {
  3635. 400.  -       clearTimeout(cur.timeouts.changeUrl);
  3636. 401.  -     }
  3637. 402.  -   }
  3638. 403.  -
  3639. 404.  -   hide(mvcur.mvLeft, mvcur.mvLeftNav, mvcur.mvRight, mvcur.mvRightNav);
  3640. 405.  -
  3641. 406.  -   if (!cur.mvNavInited) {
  3642. 407.  -     cur.mvNavInited = true;
  3643. 408.  -     if (cur._back) {
  3644. 409.  -       cur._back.hide.push(function() {
  3645. 410.  -         /*if (mvcur.mvShown || mvcur.minimized) {
  3646. 411.  -           Videoview.hide(false, true);
  3647. 412.  -         }*/
  3648. 413.  -       });
  3649. 414.  -     }
  3650. 415.  -   }
  3651. 416.  -
  3652. 417.  -   if (cur.vSearch) {
  3653. 418.  -     cur.vSearch.blur();
  3654. 419.  -   }
  3655. 420.  -   if (options.minimized) {
  3656. 421.  - //    if (browser.msie) {
  3657. 422.  -       setTimeout(Videoview.minimize.bind(Videoview), 0);
  3658. 423.  - //    } else {
  3659. 424.  - //      Videoview.minimize();
  3660. 425.  - //    }
  3661. 426.  -   }
  3662. 427.  -
  3663. 428.  -   return false;
  3664. 429.  - },
  3665. 430.  -
  3666. 431.  - hide: function(noLoc, force, ev) {
  3667. 432.  -   if (!window.mvcur || !force && !mvcur.mvShown) return;
  3668. 433.  -   if (!force && mvcur.minimized) {
  3669. 434.  -     if (!mvcur.noLocChange && noLoc !== true) {
  3670. 435.  -       if (noLoc === 2) {
  3671. 436.  -         nav.setLoc(hab.getLoc());
  3672. 437.  -       } else if (!layerQueue.count()) {
  3673. 438.  -         Videoview.backLocation();
  3674. 439.  -       }
  3675. 440.  -     }
  3676. 441.  -     return;
  3677. 442.  -   }
  3678. 443.  -   if (!mvcur.noHistory && !noLoc) {
  3679. 444.  -     mvcur.noHistory = 1;
  3680. 445.  -     mvcur.forceHistoryHide = force;
  3681. 446.  -     __adsUpdate('very_lazy');
  3682. 447.  -     return history.go(-1);
  3683. 448.  -   }
  3684. 449.  -   if (mvcur.forceHistoryHide) {
  3685. 450.  -     force = mvcur.forceHistoryHide;
  3686. 451.  -     mvcur.forceHistoryHide = false;
  3687. 452.  -   }
  3688. 453.  -
  3689. 454.  -   if (mvcur.statusVideo) {
  3690. 455.  -     var icon = ge('mv_like_icon');
  3691. 456.  -     if (icon) {
  3692. 457.  -       var tt = icon.parentNode.tt;
  3693. 458.  -       if (tt && tt.container) {
  3694. 459.  -         re(tt.container);
  3695. 460.  -       }
  3696. 461.  -       if (icon.parentNode.tt) {
  3697. 462.  -         delete icon.parentNode.tt;
  3698. 463.  -       }
  3699. 464.  -     }
  3700. 465.  -   }
  3701. 466.  -
  3702. 467.  -   var wasmin = mvcur.minimized;
  3703. 468.  -   if (wasmin) {
  3704. 469.  -     Videoview.unminimize(true, true, true);
  3705. 470.  -     mvcur.minimized = false;
  3706. 471.  -     noLoc = true;
  3707. 472.  -   }
  3708. 473.  -
  3709. 474.  -   Wall.cancelEdit(true);
  3710. 475.  -
  3711. 476.  -   if (mvcur.mvData.duration > 60 && !force && !mvcur.finished) {
  3712. 477.  -     var openTime = new Date().getTime() - mvcur.showTime, closeText = getLang('video_are_you_sure_close');
  3713. 478.  -     if (openTime > 30000 && closeText != 'are you sure close' && !browser.safari_mobile) {
  3714. 479.  -       var box;
  3715. 480.  -       box = showFastBox(getLang('video_are_you_sure_close_title'), closeText, getLang('box_yes'), function() {
  3716. 481.  -         box.hide();
  3717. 482.  -         Videoview.hide(noLoc, true)
  3718. 483.  -       }, getLang('box_no'));
  3719. 484.  -       var checkKey = function(event) {
  3720. 485.  -         if (event.keyCode == 13) {
  3721. 486.  -           box.hide();
  3722. 487.  -           Videoview.hide(noLoc, true)
  3723. 488.  -         }
  3724. 489.  -       }
  3725. 490.  -       addEvent(document, 'keydown', checkKey);
  3726. 491.  -       box.onHide = function() {
  3727. 492.  -         removeEvent(document, 'keydown', checkKey);
  3728. 493.  -       };
  3729. 494.  -       return true;
  3730. 495.  -     }
  3731. 496.  -   }
  3732. 497.  -   var _a = window.audioPlayer, _n = window.Notifier;
  3733. 498.  -   if (_a && _a.player && _a.player.paused() && _a.pausedByVideo) {
  3734. 499.  -     _a.playTrack();
  3735. 500.  -     _a.pausedByVideo = null;
  3736. 501.  -   }
  3737. 502.  -   if (_n) _n.lcSend('video_hide');
  3738. 503.  -
  3739. 504.  -   if (wasmin) {
  3740. 505.  -     hide(mvLayerWrap);
  3741. 506.  -   } else {
  3742. 507.  -     layers.wraphide(mvLayerWrap);
  3743. 508.  -     layers.fullhide = false;
  3744. 509.  -   }
  3745. 510.  -
  3746. 511.  -   if (window.tooltips) {
  3747. 512.  -     each(geByClass('delete', mvcur.mvTags), function() {
  3748. 513.  -       tooltips.destroy(this);
  3749. 514.  -     });
  3750. 515.  -   }
  3751. 516.  -
  3752. 517.  -   if (window.tooltips) {
  3753. 518.  -     tooltips.destroyAll(cur.mvBox);
  3754. 519.  -   }
  3755. 520.  -
  3756. 521.  -   var colorClass = 'mv_dark';
  3757. 522.  -   removeClass(mvLayerWrap, colorClass);
  3758. 523.  -   removeClass(layerBG, colorClass);
  3759. 524.  -
  3760. 525.  -   mvcur.mvShown = mvcur.mvClicked = false;
  3761. 526.  -   removeEvent(window, 'resize', Videoview.onResize);
  3762. 527.  -   removeEvent(document, 'keydown', Videoview.onKeyDown);
  3763. 528.  -   removeEvent(mvLayerWrap, 'click', Videoview.onClick);
  3764. 529.  -
  3765. 530.  -   mvcur.mvContent.innerHTML = '';
  3766. 531.  -   mvcur.changeCanvasSize = false;
  3767. 532.  -
  3768. 533.  - //  if (window.wkcur && wkcur.shown) {
  3769. 534.  - //    WkView.showLayer();
  3770. 535.  - //  } else if (window.Photoview && cur.pvShown) {
  3771. 536.  - //    Photoview.showPvLayer();
  3772. 537.  - //  }
  3773. 538.  -   if (!wasmin || !isVisible(layerWrap)) {
  3774. 539.  -     debugLog('pop from videoview.hide');
  3775. 540.  -     setTimeout(layerQueue.pop, 0);
  3776. 541.  -   }
  3777. 542.  -
  3778. 543.  -   if (mvcur.blackInterval) {
  3779. 544.  -     clearInterval(mvcur.blackInterval);
  3780. 545.  -   }
  3781. 546.  -   if (!mvcur.noLocChange && noLoc !== true) {
  3782. 547.  -     if (noLoc === 2) {
  3783. 548.  -       nav.setLoc(hab.getLoc());
  3784. 549.  -     } else {
  3785. 550.  -       Videoview.backLocation();
  3786. 551.  -     }
  3787. 552.  -     __adsUpdate('very_lazy');
  3788. 553.  -   }
  3789. 554.  -   __adsUpdate();
  3790. 555.  -   return false;
  3791. 556.  - },
  3792. 557.  -
  3793. 558.  - cmp: function(id1, id2) {
  3794. 559.  -   var l1 = id1.length, l2 = id2.length;
  3795. 560.  -   if (l1 < l2) {
  3796. 561.  -     return -1;
  3797. 562.  -   } else if (l1 > l2) {
  3798. 563.  -     return 1;
  3799. 564.  -   } else if (id1 < id2) {
  3800. 565.  -     return -1;
  3801. 566.  -   } else if (id1 > id2) {
  3802. 567.  -     return 1;
  3803. 568.  -   }
  3804. 569.  -   return 0;
  3805. 570.  - },
  3806. 571.  -
  3807. 572.  -
  3808. 573.  - onClick: function(e) {
  3809. 574.  -   if (mvcur.mvClicked) {
  3810. 575.  -     mvcur.mvClicked = false;
  3811. 576.  -     return;
  3812. 577.  -   }
  3813. 578.  -   var dx = Math.abs(e.pageX - intval(mvcur.mvOldX));
  3814. 579.  -   var dy = Math.abs(e.pageY - intval(mvcur.mvOldY));
  3815. 580.  -   if (dx > 3 || dy > 3) {
  3816. 581.  -     if (vkNow() - intval(mvcur.mvOldT) > 300) {
  3817. 582.  -       if (mvcur.mvTagger) {
  3818. 583.  -         Videoview.stopTag();
  3819. 584.  -       } else {
  3820. 585.  -         Videoview.hide();
  3821. 586.  -       }
  3822. 587.  -     }
  3823. 588.  -   }
  3824. 589.  - },
  3825. 590.  -
  3826. 591.  - onKeyDown: function(e) {
  3827. 592.  -   if (e.returnValue === false) return false;
  3828. 593.  -
  3829. 594.  -   if (e.keyCode == KEY.ESC) {
  3830. 595.  -     if (Videoview.isFS) {
  3831. 596.  -       ge('video_player').toggleFullscreen();
  3832. 597.  -       return false;
  3833. 598.  -     }
  3834. 599.  -     if (mvcur.mvTagger) {
  3835. 600.  -       Videoview.stopTag();
  3836. 601.  -     } else {
  3837. 602.  -       Videoview.hide();
  3838. 603.  -     }
  3839. 604.  -     return cancelEvent(e);
  3840. 605.  -   }
  3841. 606.  - },
  3842. 607.  -
  3843. 608.  - onResize: function() {
  3844. 609.  -   var dwidth = lastWindowWidth, dheight = lastWindowHeight, sbw = sbWidth();
  3845. 610.  -
  3846. 611.  -   var w = dwidth - sbw - 2 - 120 - 34 - 50, h = dheight - 31 - 28 - 72;
  3847. 612.  -   if (w > 1280) { // less than full hd - not size > 2
  3848. 613.  -     w = 1280;
  3849. 614.  -   } else if (w > 807 && w < 907) { // 1024x768 - not size > 1
  3850. 615.  -     w = 807;
  3851. 616.  -   } else if (w < 604) {
  3852. 617.  -     w = 604;
  3853. 618.  -   }
  3854. 619.  -   if (h < 453) {
  3855. 620.  -     h = 453;
  3856. 621.  -   }
  3857. 622.  -   mvcur.mvWidth = w;
  3858. 623.  -   mvcur.mvHeight = h;
  3859. 624.  -
  3860. 625.  -   var sizeChanged = false, oldverybig = mvcur.mvVeryBig;
  3861. 626.  -   mvcur.mvVeryBig = (w > 1280) ? 2 : (w > 807 ? 1 : false);
  3862. 627.  -   sizeChanged = (oldverybig != mvcur.mvVeryBig);
  3863. 628.  -
  3864. 629.  -   Videoview.updateArrowsX();
  3865. 630.  -   Videoview.updateArrowsY();
  3866. 631.  - },
  3867. 632.  -
  3868. 633.  - updateSize: function() {
  3869. 634.  -   if (mvcur.minimized) {
  3870. 635.  -     return false;
  3871. 636.  -   }
  3872. 637.  -   var size = getSize(mvcur.mvBox);
  3873. 638.  -   mvcur.mvActualWidth = size[0]+3;
  3874. 639.  -   //mvcur.mvCont.style.width = mvcur.mvActualWidth + 'px';
  3875. 640.  -
  3876. 641.  -   var docEl = document.documentElement;
  3877. 642.  -   var ch = window.innerHeight || docEl.clientHeight || bodyNode.clientHeight;
  3878. 643.  -
  3879. 644.  -
  3880. 645.  -   mvcur.mvCont.style.top = String(Math.max((ch - 800) / 2,50)) +'px';
  3881. 646.  -
  3882. 647.  -   //mvcur.mvRightControls.style.left = (mvcur.mvActualWidth) + 'px';
  3883. 648.  -
  3884. 649.  -   onBodyResize();
  3885. 650.  -   Videoview.onResize();
  3886. 651.  - },
  3887. 652.  -
  3888. 653.  - list: function(photoId, listId, realList) {
  3889. 654.  -   if (!mvcur.mvList) mvcur.mvList = {};
  3890. 655.  -   mvcur.mvList[photoId + '_' + listId] = realList;
  3891. 656.  - },
  3892. 657.  -
  3893. 658.  - showInfo: function() {
  3894. 659.  -   addClass(mvcur.mvControlsLine, 'mv_controls_shown');
  3895. 660.  -   show(ge('mv_controls'));
  3896. 661.  -   Videoview.activate(ge('mv_hide_info'), 2, true);
  3897. 662.  -   window.updateWndVScroll && updateWndVScroll();
  3898. 663.  -   return false;
  3899. 664.  - },
  3900. 665.  -
  3901. 666.  - hideInfo: function() {
  3902. 667.  -   removeClass(mvcur.mvControlsLine, 'mv_controls_shown');
  3903. 668.  -   hide(ge('mv_controls'));
  3904. 669.  -   Videoview.activate(ge('mv_show_info'), 2, true);
  3905. 670.  -   window.updateWndVScroll && updateWndVScroll();
  3906. 671.  -   return false;
  3907. 672.  - },
  3908. 673.  -
  3909. 674.  - getPrevLoc: function() {
  3910. 675.  -   mvcur.mvPrevLoc = {};
  3911. 676.  -   for (var i in nav.objLoc) {
  3912. 677.  -     if (i != 'z' || !nav.objLoc[i].match(new RegExp('^video' + mvcur.videoRaw, ''))) {
  3913. 678.  -       mvcur.mvPrevLoc[i] = nav.objLoc[i];
  3914. 679.  -     }
  3915. 680.  -   }
  3916. 681.  - },
  3917. 682.  -
  3918. 683.  - setLocation: function(noLocChange) {
  3919. 684.  -   if (mvcur.options.fromPreload) {
  3920. 685.  -     var listData = mvcur.listId.match(new RegExp('([a-z]*)([0-9\-]*)'));
  3921. 686.  -     var claimData = mvcur.listId.match(new RegExp('claim=([0-9]+)'));
  3922. 687.  -     var oid = parseInt(listData[2]);
  3923. 688.  -     if (oid > 0) {
  3924. 689.  -       mvcur.mvPrevLoc = {'0': 'videos' + oid};
  3925. 690.  -     } else {
  3926. 691.  -       mvcur.mvPrevLoc = {'0': 'video', gid: (-oid)};
  3927. 692.  -     }
  3928. 693.  -     if (listData[1] != 'videos') {
  3929. 694.  -       mvcur.mvPrevLoc['section']  = listData[1];
  3930. 695.  -     }
  3931. 696.  -     if (claimData && claimData[1]) {
  3932. 697.  -       mvcur.mvPrevLoc['claim'] = claimData[1];
  3933. 698.  -     }
  3934. 699.  -   } else {
  3935. 700.  -     if (noLocChange) {
  3936. 701.  -       mvcur.mvPrevLoc = 'z';
  3937. 702.  -     } else {
  3938. 703.  -       Videoview.getPrevLoc();
  3939. 704.  -     }
  3940. 705.  -   }
  3941. 706.  -   if (noLocChange) {
  3942. 707.  -     return;
  3943. 708.  -   }
  3944. 709.  -   var m = mvcur.videoRaw.match(/^(-?\d+)(photo|video)?_/), owner = intval(m[1]), nl;
  3945. 710.  -   if (!m[2] && nav.objLoc[0] == 'video' && (owner == vk.id && !nav.objLoc.gid || owner < 0 && nav.objLoc.gid == (-owner)) || owner > 0 && nav.objLoc[0] == 'videos' + owner) {
  3946. 711.  -     nl = {'0': 'video' + mvcur.videoRaw + (nav.objLoc.claim ? "?claim=" + nav.objLoc.claim : "")};
  3947. 712.  -     if ((mvcur.options || {}).fromQueue) {
  3948. 713.  -       mvcur.noHistory = 1;
  3949. 714.  -     }
  3950. 715.  -   } else {
  3951. 716.  -     var videoLocation = 'video' + mvcur.videoRaw, nl;
  3952. 717.  -     if (mvcur.listId) {
  3953. 718.  -       videoLocation += '/' + mvcur.listId;
  3954. 719.  -     }
  3955. 720.  -     nl = extend(nav.objLoc, {'z': videoLocation});
  3956. 721.  -   }
  3957. 722.  -   if (nav.strLoc != nav.toStr(nl)) {
  3958. 723.  -     nav.setLoc(nl);
  3959. 724.  -     if ((mvcur.options || {}).fromQueue) {
  3960. 725.  -       mvcur.noHistory = 1;
  3961. 726.  -     }
  3962. 727.  -   }
  3963. 728.  -   if (mvcur.options) mvcur.options.fromQueue = false;
  3964. 729.  - },
  3965. 730.  -
  3966. 731.  - backLocation: function() {
  3967. 732.  -   if (mvcur.mvPrevLoc == 'z' || !mvcur.mvPrevLoc && nav.objLoc.z) {
  3968. 733.  -     var loc = clone(nav.objLoc);
  3969. 734.  -     delete loc.z;
  3970. 735.  -     nav.setLoc(loc);
  3971. 736.  -   } else if (mvcur.mvPrevLoc) {
  3972. 737.  -     nav.setLoc(mvcur.mvPrevLoc);
  3973. 738.  -   } else if (nav.objLoc[0] == 'video' || nav.objLoc[0].match(/^video-?\d+_\d+/)) {
  3974. 739.  -     nav.setLoc({'0': 'video'});
  3975. 740.  -   }
  3976. 741.  -   if (mvcur.options.prevTitle) {
  3977. 742.  -     window.document.title = replaceEntities(stripHTML(mvcur.options.prevTitle));
  3978. 743.  -     delete mvcur.options.prevTitle;
  3979. 744.  -   }
  3980. 745.  -   mvcur.noHistory = 1;
  3981. 746.  - },
  3982. 747.  -
  3983. 748.  - highlightComment: function(el) {
  3984. 749.  -   el = ge(el);
  3985. 750.  -   if (!el) return;
  3986. 751.  -
  3987. 752.  -   var hlfunc = animate.pbind(el, {backgroundColor: '#ECEFF3'}, 200, function() {
  3988. 753.  -     setTimeout(function() {
  3989. 754.  -       animate(el, {backgroundColor: '#FFF'}, 200);
  3990. 755.  -     }, 1000);
  3991. 756.  -   }), top = getXY(el, true)[1];
  3992. 757.  -
  3993. 758.  -   if (top < 0 || top > lastWindowHeight - 200) {
  3994. 759.  -     animate(mvLayerWrap, {scrollTop: mvLayerWrap.scrollTop + top - 50}, 300, hlfunc);
  3995. 760.  -   } else {
  3996. 761.  -     hlfunc();
  3997. 762.  -   }
  3998. 763.  - },
  3999. 764.  - showComment: function(comm) {
  4000. 765.  -   var p = ge('mv_comment' + comm);
  4001. 766.  -   if (p) {
  4002. 767.  -     Videoview.highlightComment(p);
  4003. 768.  -   } else {
  4004. 769.  -     Videoview.comments(comm);
  4005. 770.  -   }
  4006. 771.  -   return false;
  4007. 772.  - },
  4008. 773.  - commDone: function(comm, from, text, del, script) {
  4009. 774.  -   var node = ge(from + '_comment' + comm);
  4010. 775.  -   if (!node) return;
  4011. 776.  -   var fChild = node.firstChild;
  4012. 777.  -
  4013. 778.  -   var msg = fChild.nextSibling;
  4014. 779.  -   if (!text) {
  4015. 780.  -     show(node.firstChild);
  4016. 781.  -     hide(msg);
  4017. 782.  -     if (from == 'mv') {
  4018. 783.  -       ++mvcur.mvData.commcount;
  4019. 784.  -       ++mvcur.mvData.commshown;
  4020. 785.  -     } else {
  4021. 786.  -       ++cur.commentsCount;
  4022. 787.  -       ++cur.commentsShown;
  4023. 788.  -     }
  4024. 789.  -
  4025. 790.  -     Videoview.updateComms(from);
  4026. 791.  -     return;
  4027. 792.  -   }
  4028. 793.  -   if (msg) {
  4029. 794.  -     msg.innerHTML = text;
  4030. 795.  -     show(msg);
  4031. 796.  -   } else {
  4032. 797.  -     if (hasClass(fChild, 'video_comment_first')) {
  4033. 798.  -       var dldClass = 'review_comment_first';
  4034. 799.  -     } else {
  4035. 800.  -       var dldClass = 'review_comment_dld';
  4036. 801.  -     }
  4037. 802.  -     node.appendChild(ce('div', {className: dldClass, innerHTML: text}));
  4038. 803.  -   }
  4039. 804.  -   hide(node.firstChild);
  4040. 805.  -   if (del) {
  4041. 806.  -     if (from == 'mv') {
  4042. 807.  -       --mvcur.mvData.commcount;
  4043. 808.  -       --mvcur.mvData.commshown;
  4044. 809.  -     } else {
  4045. 810.  -       --cur.commentsCount;
  4046. 811.  -       --cur.commentsShown;
  4047. 812.  -     }
  4048. 813.  -     Videoview.updateComms(from);
  4049. 814.  -   } else {
  4050. 815.  -     if (from == 'mv') {
  4051. 816.  -       Videoview.updateArrowsY();
  4052. 817.  -       Videoview.recache();
  4053. 818.  -       if (!cur.mvComments) cur.mvComments = {};
  4054. 819.  -       cur.mvComments[mvcur.videoRaw] = ge('mv_comments_wrap');
  4055. 820.  -     }
  4056. 821.  -   }
  4057. 822.  -   if (script) {
  4058. 823.  -     eval(script);
  4059. 824.  -   }
  4060. 825.  - },
  4061. 826.  -
  4062. 827.  - commParams: function(comm, from) {
  4063. 828.  -   return {
  4064. 829.  -     onDone: Videoview.commDone.pbind(comm, from),
  4065. 830.  -     progress: from + '_progress' + comm,
  4066. 831.  -     stat: ['privacy.js', 'privacy.css']
  4067. 832.  -   }
  4068. 833.  - },
  4069. 834.  -
  4070. 835.  - commAction: function(act, comm, hash, from) {
  4071. 836.  -   if (isVisible(from + '_progress' + comm)) return;
  4072. 837.  -   ajax.post('al_video.php', {act: act + '_comment', comment: comm, hash: hash, videoview: 1, from: from}, Videoview.commParams(comm, from));
  4073. 838.  - },
  4074. 839.  -
  4075. 840.  - comments: function(showcomm) {
  4076. 841.  -   if (showcomm) {
  4077. 842.  -     var frst = domFC(ge('mv_comments')).id || '';
  4078. 843.  -     if (
  4079. 844.  -       !isVisible('mv_comments_header') ||
  4080. 845.  -       (domFC(ge('mv_comments_header')) || {}).tagName == 'IMG' ||
  4081. 846.  -       Videoview.cmp(frst, 'mv_comment' + showcomm) < 0
  4082. 847.  -     ) {
  4083. 848.  -       return;
  4084. 849.  -     }
  4085. 850.  -   }
  4086. 851.  -   var mv = mvcur.mvData;
  4087. 852.  -   var commlink = ge('mv_comments_link');
  4088. 853.  -   ajax.post('al_video.php', {act: 'video_comments', offset: mv.commshown, video: mv.videoRaw}, {
  4089. 854.  -     onDone: function(text, names) {
  4090. 855.  -       Videoview.receiveComms(text, names, false, showcomm);
  4091. 856.  -       if (showcomm && ge('mv_comment' + showcomm)) {
  4092. 857.  -         Videoview.showComment(showcomm);
  4093. 858.  -       }
  4094. 859.  -     },
  4095. 860.  -     showProgress: function() {
  4096. 861.  -       var commHeader = ge('mv_comments_header');
  4097. 862.  -       mvcur.mvCommInfo = commHeader.innerHTML;
  4098. 863.  -       commHeader.innerHTML = '<img src="/images/upload.gif" />';
  4099. 864.  -     }, hideProgress: function() {
  4100. 865.  -       ge('mv_comments_header').innerHTML = mvcur.mvCommInfo;
  4101. 866.  -     }
  4102. 867.  -   });
  4103. 868.  - },
  4104. 869.  -
  4105. 870.  - updateComms: function(from) {
  4106. 871.  -   if (from == 'review') {
  4107. 872.  -     Video.changeSummary();
  4108. 873.  -     return;
  4109. 874.  -   }
  4110. 875.  -   setTimeout(Videoview.updateArrowsY, 2);
  4111. 876.  -   var mv = mvcur.mvData;
  4112. 877.  -   var commshown = '';
  4113. 878.  -   if (mv.commcount > mv.commshown) {
  4114. 879.  -     commshown = getLang('video_show_previous_comments', mv.commcount - mv.commshown);
  4115. 880.  -   }
  4116. 881.  -   (commshown ? show : hide)(ge('mv_comments_header'));
  4117. 882.  -   ge('mv_comments_header').innerHTML = commshown;
  4118. 883.  -   Videoview.recache();
  4119. 884.  -   if (!cur.mvComments) cur.mvComments = {};
  4120. 885.  -   cur.mvComments[mvcur.videoRaw] = ge('mv_comments_wrap');
  4121. 886.  - },
  4122. 887.  - commentClick: function(el, event, from) {
  4123. 888.  -   var comm = el.id.replace('mv_comment', ''), cmnt = comm.split('_');
  4124. 889.  -   if (Wall.checkReplyClick(el, event)) return;
  4125. 890.  -
  4126. 891.  -   var moreLink = geByClass1('wall_reply_more', el, 'a');
  4127. 892.  -   if (moreLink && isVisible(moreLink)) {
  4128. 893.  -     removeClass(el, 'reply_moreable');
  4129. 894.  -     moreLink.onclick();
  4130. 895.  -     return;
  4131. 896.  -   }
  4132. 897.  -   if (from && cmnt[1] && ge('mv_comment')) {
  4133. 898.  -     Videoview.commentTo(comm, from, event);
  4134. 899.  -   }
  4135. 900.  - },
  4136. 901.  - commentChanged: function() {
  4137. 902.  -   checkTextLength(mvcur.mvCommLimit, ge('mv_comment'), ge('mv_comment_warn'));
  4138. 903.  - },
  4139. 904.  - commentTo: function(comm, toId, event) {
  4140. 905.  -   var cmnt = (comm || '').split('_'), commId = cmnt[1], replyNameOld = mvcur.mvReplyTo && mvcur.mvReplyNames[mvcur.mvReplyTo[0]] || '', replyName = mvcur.mvReplyNames[toId] || '', rf = ge('mv_comment'), tl = ge('mv_reply_to_title'), asGroup = ge('mv_reply_as_group');
  4141. 906.  -
  4142. 907.  -   if (comm) {
  4143. 908.  -     mvcur.mvReplyTo = [toId, commId];
  4144. 909.  -     val(tl, replyName[0] || '');
  4145. 910.  -     show(tl, 'mv_del_reply_to');
  4146. 911.  -     setStyle(tl, {maxWidth: ge('mv_comment_submit').offsetWidth - domPN(ge('mv_comment_send')).offsetWidth - (asGroup ? (asGroup.offsetWidth + 10) : 0) - ge('mv_add_media').offsetWidth - 21});
  4147. 912.  -   } else {
  4148. 913.  -     mvcur.mvReplyTo = false;
  4149. 914.  -     hide(tl, 'mv_del_reply_to');
  4150. 915.  -   }
  4151. 916.  -   cur.mvReplyIn = mvcur.videoRaw;
  4152. 917.  -   cur.mvReplyTo = mvcur.mvReplyTo;
  4153. 918.  -
  4154. 919.  -   var v = trim(val(rf)), cEl = comm && geByClass1('mv_reply_to', ge('mv_comment' + comm));
  4155. 920.  -   if (!v || replyNameOld && !winToUtf(replyNameOld[1]).indexOf(v) || comm === false) {
  4156. 921.  -     val(rf, (comm && !checkEvent(event)) ? replaceEntities(replyName[1]) : '');
  4157. 922.  -   }
  4158. 923.  -   toggleClass(asGroup, 'on', !!(cEl && cEl.getAttribute('rid') === cmnt[0]));
  4159. 924.  -   if (comm) {
  4160. 925.  -     elfocus(rf);
  4161. 926.  -   }
  4162. 927.  - },
  4163. 928.  - receiveComms: function(text, names, noOld, toUp) {
  4164. 929.  -   var n = ce('div', {innerHTML: text}), comms = ge('mv_comments'), last = current = domLC(comms), frm = getXY(current, true)[1], mv = mvcur.mvData, commField = ge('mv_comment');
  4165. 930.  -   for (var el = domLC(n); el; el = domLC(n)) {
  4166. 931.  -     if (commField) addClass(el, 'reply_replieable');
  4167. 932.  -     while (current && Videoview.cmp(current.id, el.id) > 0) {
  4168. 933.  -       current = domPS(current);
  4169. 934.  -     }
  4170. 935.  -     if (current && !Videoview.cmp(current.id, el.id)) {
  4171. 936.  -       comms.replaceChild(el, current);
  4172. 937.  -       current = el;
  4173. 938.  -     } else {
  4174. 939.  -       if (current && domNS(current)) {
  4175. 940.  -         comms.insertBefore(el, domNS(current));
  4176. 941.  -       } else if (!current && domFC(comms)) {
  4177. 942.  -         if (noOld === true) {
  4178. 943.  -           --mv.commshown;
  4179. 944.  -           n.removeChild(el);
  4180. 945.  -         } else {
  4181. 946.  -           comms.insertBefore(el, domFC(comms));
  4182. 947.  -         }
  4183. 948.  -       } else {
  4184. 949.  -         comms.appendChild(el);
  4185. 950.  -       }
  4186. 951.  -       ++mv.commshown;
  4187. 952.  -     }
  4188. 953.  -   }
  4189. 954.  -   if (toUp && last) {
  4190. 955.  -     mvLayerWrap.scrollTop += getXY(last, true)[1] - frm;
  4191. 956.  -   }
  4192. 957.  -   mv.comments = comms.innerHTML;
  4193. 958.  -   extend(mvcur.mvReplyNames, names);
  4194. 959.  -   window.updateWndVScroll && updateWndVScroll();
  4195. 960.  -   Videoview.updateComms();
  4196. 961.  - },
  4197. 962.  - commSaved: function(post) {
  4198. 963.  -   if (!mvcur.mvShown || mvcur.minimized) return;
  4199. 964.  -   var comms = ge('mv_comments_wrap'), vd = comms ? mvcur.videoRaw : false, comm = post.match(/^(-?\d+)video(_\d+)/);
  4200. 965.  -   if (!vd || !comm || !ge('mv_comment' + comm[1] + comm[2])) return;
  4201. 966.  -   if (!cur.mvComments) cur.mvComments = {};
  4202. 967.  -   cur.mvComments[mvcur.videoRaw] = comms;
  4203. 968.  - },
  4204. 969.  -
  4205. 970.  - sendComment: function() {
  4206. 971.  -   var fld = ge('mv_comment'), comp = fld && data(fld, 'composer'),
  4207. 972.  -       params = comp ? Composer.getSendParams(comp, Videoview.sendComment) : {message: trim(val(fld))},
  4208. 973.  -       replyToName = (mvcur.mvReplyNames[(mvcur.mvReplyTo || {})[0]] || [])[1], btn = 'mv_comment_send';
  4209. 974.  -
  4210. 975.  -   if (params.delayed) return;
  4211. 976.  -
  4212. 977.  -   if (!params.attach1_type && (!params.message || replyToName && !replyToName.indexOf(params.message))) {
  4213. 978.  -     elfocus(fld);
  4214. 979.  -     return;
  4215. 980.  -   }
  4216. 981.  -
  4217. 982.  -   hide('mv_comment_warn');
  4218. 983.  -   ajax.post('al_video.php', Wall.fixPostParams(extend(params, {
  4219. 984.  -     act: 'post_comment',
  4220. 985.  -     video: mvcur.mvData.videoRaw,
  4221. 986.  -     hash: mvcur.mvData.hash,
  4222. 987.  -     fromview: 1,
  4223. 988.  -     videoviewer: 1,
  4224. 989.  -     from_group: isChecked(ge('mv_reply_as_group')),
  4225. 990.  -     reply_to: (mvcur.mvReplyTo || {})[1]
  4226. 991.  -   })), {
  4227. 992.  -     onDone: function(text, names) {
  4228. 993.  -       ++mvcur.mvData.commcount;
  4229. 994.  -       Videoview.receiveComms(text, names, true);
  4230. 995.  -       var fld = ge('mv_comment');
  4231. 996.  -       if (fld && data(fld, 'composer')) {
  4232. 997.  -         Composer.reset(data(fld, 'composer'));
  4233. 998.  -       } else {
  4234. 999.  -         val(fld, '');
  4235. 1000.  -       }
  4236. 1001.  -       fld.blur();
  4237. 1002.  -       mvcur.mvReplyTo = false;
  4238. 1003.  -       hide('mv_reply_to_title', 'mv_del_reply_to');
  4239. 1004.  -     },
  4240. 1005.  -     onFail: function(text) {
  4241. 1006.  -       if (fld) {
  4242. 1007.  -         showTooltip(fld, {text: text, showdt: 200, forcetodown: 0, slide: 15});
  4243. 1008.  -         elfocus(fld);
  4244. 1009.  -         return true;
  4245. 1010.  -       }
  4246. 1011.  -     }, showProgress: lockButton.pbind(btn), hideProgress: unlockButton.pbind(btn)
  4247. 1012.  -   });
  4248. 1013.  - },
  4249. 1014.  -
  4250. 1015.  - activate: function(el, control, fast) {
  4251. 1016.  -   if (control == 2) {
  4252. 1017.  -     animate(el, {color: '#FFFFFF'}, (typeof(fast) != 'undefined') ? 0 : 200);
  4253. 1018.  -   } else {
  4254. 1019.  -     animate(el, {opacity: 1}, 200);
  4255. 1020.  -   }
  4256. 1021.  - },
  4257. 1022.  -
  4258. 1023.  - deactivate: function(el, control) {
  4259. 1024.  -   if (control == 2) {
  4260. 1025.  -     animate(el, {color: '#777777'}, (typeof(fast) != 'undefined') ? 0 : 200);
  4261. 1026.  -   } else {
  4262. 1027.  -     animate(el, {opacity: 0.5}, 200);
  4263. 1028.  -   }
  4264. 1029.  - },
  4265. 1030.  -
  4266. 1031.  - addVideo: function(videoRaw, hash, obj, gid, accessHash, from) {
  4267. 1032.  -   if (window.mvcur && mvcur.statusVideo) {
  4268. 1033.  -     var params = {
  4269. 1034.  -       act: 'external_add',
  4270. 1035.  -       status: videoRaw,
  4271. 1036.  -       hash: hash,
  4272. 1037.  -       from: from || 'videoviewer'
  4273. 1038.  -     };
  4274. 1039.  -     var url = 'al_video_external.php';
  4275. 1040.  -   } else {
  4276. 1041.  -     var params = {
  4277. 1042.  -       act: 'a_add',
  4278. 1043.  -       video: videoRaw,
  4279. 1044.  -       hash: hash,
  4280. 1045.  -       from: from || 'videoviewer',
  4281. 1046.  -       module: cur.module || ''
  4282. 1047.  -     };
  4283. 1048.  -     if (gid) {
  4284. 1049.  -       params.gid = gid;
  4285. 1050.  -     }
  4286. 1051.  -     var url = 'al_video.php';
  4287. 1052.  -   }
  4288. 1053.  -   if (accessHash) {
  4289. 1054.  -     params['access_hash'] = accessHash;
  4290. 1055.  -   }
  4291. 1056.  -   ajax.post(url, params, {
  4292. 1057.  -     onDone: function(text, row, hash, shareHash) {
  4293. 1058.  -       if (obj) {
  4294. 1059.  -         obj.parentNode.innerHTML = text;
  4295. 1060.  -       }
  4296. 1061.  -       try {
  4297. 1062.  -         row = eval('('+row+')');
  4298. 1063.  -       } catch(e) {
  4299. 1064.  -       }
  4300. 1065.  -       if (window.Video && cur.oid && (vk.id == cur.oid || gid)) {
  4301. 1066.  -         Video.addToList('all', row);
  4302. 1067.  -       }
  4303. 1068.  -       if (window.mvcur) {
  4304. 1069.  -         if (mvcur.mvData && mvcur.mvData.afterAdd) {
  4305. 1070.  -           mvcur.mvData.afterAdd(row[0]+'_'+row[1], shareHash);
  4306. 1071.  -         } else {
  4307. 1072.  -           mvcur.mvData.addedVideo = row[0]+'_'+row[1];
  4308. 1073.  -           mvcur.mvData.addedVideoHash = hash;
  4309. 1074.  -           mvcur.mvData.addedVideoShareHash = shareHash;
  4310. 1075.  -         }
  4311. 1076.  -       }
  4312. 1077.  -       var videoEl = ge('video_cont'+videoRaw);
  4313. 1078.  -       if (videoEl) {
  4314. 1079.  -         addClass(videoEl, 'video_row_added');
  4315. 1080.  -       }
  4316. 1081.  -       if (from == 'list') {
  4317. 1082.  -         showDoneBox(text);
  4318. 1083.  -       }
  4319. 1084.  -     }
  4320. 1085.  -   });
  4321. 1086.  -   //}
  4322. 1087.  -   return false;
  4323. 1088.  - },
  4324. 1089.  -
  4325. 1090.  - likeUpdate: function(my, count, title, nott) {
  4326. 1091.  -   count = intval(count);
  4327. 1092.  -
  4328. 1093.  -   var mv = mvcur.mvData;
  4329. 1094.  -   var likeType = (mvcur.statusVideo) ? 'wall' : 'video';
  4330. 1095.  -
  4331. 1096.  -   var rows = ge('like_table_' + likeType + mv.videoRaw);
  4332. 1097.  -   var titleNode = ge('like_title_' + likeType + mv.videoRaw)
  4333. 1098.  -   var countInput = ge('like_real_count_' + likeType + mv.videoRaw) || {};
  4334. 1099.  -
  4335. 1100.  -   var countNode = ge('mv_like_count');
  4336. 1101.  -   var icon = ge('mv_like_icon');
  4337. 1102.  -   var tt = icon.parentNode.tt || {}, opts = clone(tt.opts || {}), newleft = (my ? 0 : -36);
  4338. 1103.  -
  4339. 1104.  -   if (title && titleNode) {
  4340. 1105.  -     val(titleNode, title);
  4341. 1106.  -   }
  4342. 1107.  -   mv.likes = countInput.value = count;
  4343. 1108.  -   animateCount(countNode, count);
  4344. 1109.  -
  4345. 1110.  -   if (mvcur.statusVideo) {
  4346. 1111.  -     var wallCount = ge('like_count' + mv.videoRaw);
  4347. 1112.  -     if (wallCount) {
  4348. 1113.  -       wallCount.innerHTML = count ? count : '';
  4349. 1114.  -       (ge('like_real_count_wall' + mv.videoRaw) || {}).value = count;
  4350. 1115.  -       var statusIcon = ge('like_icon' + mv.videoRaw);
  4351. 1116.  -       if (statusIcon) {
  4352. 1117.  -         if (my) {
  4353. 1118.  -           addClass(statusIcon, 'my_like');
  4354. 1119.  -         } else {
  4355. 1120.  -           removeClass(statusIcon, 'my_like');
  4356. 1121.  -         }
  4357. 1122.  -         if (count) {
  4358. 1123.  -           removeClass(statusIcon, 'no_likes');
  4359. 1124.  -           setStyle(statusIcon, {opacity: 1, visibility: 'visible'});
  4360. 1125.  -         } else {
  4361. 1126.  -           addClass(statusIcon, 'no_likes');
  4362. 1127.  -           setStyle(statusIcon, {opacity: 0, visibility: 'hidden'});
  4363. 1128.  -         }
  4364. 1129.  -       }
  4365. 1130.  -     }
  4366. 1131.  -   }
  4367. 1132.  -
  4368. 1133.  -   mv.liked = my;
  4369. 1134.  -   if (!my) {
  4370. 1135.  -     var cb = ge('like_share_video' + mv.videoRaw);
  4371. 1136.  -     if (cb) checkbox(cb, false);
  4372. 1137.  -   } else {
  4373. 1138.  -     setStyle(icon, {opacity: 1});
  4374. 1139.  -   }
  4375. 1140.  -   if (count) {
  4376. 1141.  -     var styleName = vk.rtl ? 'right' : 'left';
  4377. 1142.  -     if (tt.el && !isVisible(tt.container) && !title) {
  4378. 1143.  -       rows.style[styleName] = newleft + 'px';
  4379. 1144.  -       if (nott !== true) {
  4380. 1145.  -         tooltips.show(tt.el, extend(opts, {showdt: 0}));
  4381. 1146.  -       }
  4382. 1147.  -     } else if (rows) {
  4383. 1148.  -       var params = {};
  4384. 1149.  -       params[styleName] = newleft;
  4385. 1150.  -       animate(rows, params, 200);
  4386. 1151.  -     }
  4387. 1152.  -     removeClass(icon, 'no_likes');
  4388. 1153.  -   } else {
  4389. 1154.  -     if (tt.el) tt.hide();
  4390. 1155.  -     addClass(icon, 'no_likes');
  4391. 1156.  -   }
  4392. 1157.  - },
  4393. 1158.  -
  4394. 1159.  - likeSmall: function() {
  4395. 1160.  -   Videoview.like();
  4396. 1161.  -   addClass(ge('mv_like_line'), 'video_liked');
  4397. 1162.  -   return false;
  4398. 1163.  - },
  4399. 1164.  -
  4400. 1165.  - addSmall: function(videoRaw, hash, gid, accessHash) {
  4401. 1166.  -   Videoview.addVideo(videoRaw, hash, false, gid, accessHash);
  4402. 1167.  -   hide('video_add_action_link');
  4403. 1168.  -   addClass(ge('mv_like_line'), 'video_added');
  4404. 1169.  - },
  4405. 1170.  -
  4406. 1171.  - share: function(videoRaw, obj) {
  4407. 1172.  -   if (!vk.id) return;
  4408. 1173.  -   showBox('like.php', {act: 'publish_box', object: 'video'+(mvcur.mvData.addedVideo || videoRaw)});
  4409. 1174.  -   return false;
  4410. 1175.  - },
  4411. 1176.  -
  4412. 1177.  - like: function() {
  4413. 1178.  -   if (!vk.id) return;
  4414. 1179.  -   var mv = mvcur.mvData;
  4415. 1180.  -   if (mvcur.statusVideo) {
  4416. 1181.  -     var object = 'wall' + mv.videoRaw;
  4417. 1182.  -   } else {
  4418. 1183.  -     var object = 'video' + mv.videoRaw;
  4419. 1184.  -   }
  4420. 1185.  -   ajax.post('like.php', {act: 'a_do_' + (mv.liked ? 'un' : '') + 'like', object: object, hash: mv.likeHash, short_view: 1, from: 'videoview'}, {
  4421. 1186.  -     onDone: Videoview.likeUpdate.pbind(!mv.liked)
  4422. 1187.  -   });
  4423. 1188.  -   Videoview.likeUpdate(!mv.liked, mv.likes + (mv.liked ? -1 : 1));
  4424. 1189.  - },
  4425. 1190.  -
  4426. 1191.  - likeShare: function(hash) {
  4427. 1192.  -   if (!vk.id) return;
  4428. 1193.  -   var mv = mvcur.mvData;
  4429. 1194.  -   if (mvcur.statusVideo) {
  4430. 1195.  -     var object = 'wall' + mv.videoRaw;
  4431. 1196.  -   } else {
  4432. 1197.  -     var object = 'video' + mv.videoRaw;
  4433. 1198.  -   }
  4434. 1199.  -   var el = ge('like_share_video' + mv.videoRaw), was = isChecked(el);
  4435. 1200.  -   checkbox(el);
  4436. 1201.  -   ajax.post('like.php', {act: 'a_do_' + (was ? 'un' : '') + 'publish', object: object, hash: hash, short_view: 1, list: mvcur.listId}, {
  4437. 1202.  -     onDone: Videoview.likeUpdate.pbind(true)
  4438. 1203.  -   });
  4439. 1204.  -   Videoview.likeUpdate(true, mv.likes + (mv.liked ? 0 : 1));
  4440. 1205.  - },
  4441. 1206.  -
  4442. 1207.  - likeOver: function() {
  4443. 1208.  -   var mv = mvcur.mvData;
  4444. 1209.  -   var icon = ge('mv_like_icon'),
  4445. 1210.  -       link = ge('mv_like_link');
  4446. 1211.  -
  4447. 1212.  -   if (!mv.liked) {
  4448. 1213.  -     setTimeout(animate.pbind(icon, {opacity: 1}, 200, false), 1);
  4449. 1214.  -   } else {
  4450. 1215.  -     setStyle(icon, {opacity: 1});
  4451. 1216.  -   }
  4452. 1217.  -   var leftShift = vk.id ? 36 : 56;
  4453. 1218.  -   if (mvcur.statusVideo) {
  4454. 1219.  -     var object = 'wall' + mv.videoRaw;
  4455. 1220.  -   } else {
  4456. 1221.  -     var object = 'video' + mv.videoRaw;
  4457. 1222.  -   }
  4458. 1223.  -   var linkW = link.offsetWidth;
  4459. 1224.  -
  4460. 1225.  -   showTooltip(icon.parentNode, {
  4461. 1226.  -     url: 'like.php',
  4462. 1227.  -     params: {act: 'a_get_stats', object: object, list: mvcur.listId},
  4463. 1228.  -     slide: 15,
  4464. 1229.  -     shift: [0, 5, 9],
  4465. 1230.  -     ajaxdt: 100,
  4466. 1231.  -     showdt: 400,
  4467. 1232.  -     hidedt: 200,
  4468. 1233.  -     className: 'rich like_tt',
  4469. 1234.  -     no_shadow: (mvcur.videoAds || mvcur.statusVideo) ? 1 : 0,
  4470. 1235.  -     init: function (tt) {
  4471. 1236.  -       if (!tt.container) return;
  4472. 1237.  -       var bp = geByClass1('bottom_pointer', tt.container, 'div');
  4473. 1238.  -       var tp = geByClass1('top_pointer', tt.container, 'div');
  4474. 1239.  -       setStyle(bp, {marginLeft: linkW + 2});
  4475. 1240.  -       setStyle(tp, {marginLeft: linkW + 2});
  4476. 1241.  -     }
  4477. 1242.  -   });
  4478. 1243.  - },
  4479. 1244.  -
  4480. 1245.  - likeOut: function() {
  4481. 1246.  -   var mv = mvcur.mvData;
  4482. 1247.  -   if (!mv.liked) {
  4483. 1248.  -     setTimeout(animate.pbind(ge('mv_like_icon'), {opacity: 0.4}, 200, false), 1);
  4484. 1249.  -   } else if (mvcur.videoAds || mvcur.statusVideo) {
  4485. 1250.  -     setTimeout(animate.pbind(ge('mv_like_icon'), {opacity: 0.7}, 200, false), 1);
  4486. 1251.  -   }
  4487. 1252.  - },
  4488. 1253.  -
  4489. 1254.  - showEditBox: function(vid, oid, ev) {
  4490. 1255.  -   Videoview.hidePlayer();
  4491. 1256.  -   var box = showBox('al_video.php', {act: 'edit_box', vid: vid, oid: oid}, {stat: ['privacy.js', 'privacy.css', 'video.css'], dark: 1});
  4492. 1257.  -   box.setOptions({onHide: function() {
  4493. 1258.  -     Videoview.showPlayer();
  4494. 1259.  -   }});
  4495. 1260.  -   return cancelEvent(ev);
  4496. 1261.  - },
  4497. 1262.  -
  4498. 1263.  - restoreVideo: function(vid, oid, hash, from, ev) {
  4499. 1264.  -   var warning = ge('mv_warning');
  4500. 1265.  -   if (warning) {
  4501. 1266.  -     warning.innerHTML = '<img style="margin-left: 100px;" src="/images/upload.gif" />';
  4502. 1267.  -   }
  4503. 1268.  -   ajax.post('al_video.php', {
  4504. 1269.  -     act: 'restore_video',
  4505. 1270.  -     vid: vid,
  4506. 1271.  -     oid: oid,
  4507. 1272.  -     hash: hash,
  4508. 1273.  -     from: from || 'videoviewer'
  4509. 1274.  -   }, {
  4510. 1275.  -     onDone: function(row) {
  4511. 1276.  -       if (from == 'list' && cur.restoreRaw && cur.restoreRaw[oid+'_'+vid]) {
  4512. 1277.  -         var rowCont = ge('video_row'+oid+'_'+vid);
  4513. 1278.  -         rowCont.innerHTML = cur.restoreRaw[oid+'_'+vid];
  4514. 1279.  -
  4515. 1280.  -         removeClass(rowCont, 'video_row_loading');
  4516. 1281.  -         removeClass(rowCont, 'video_row_deleted');
  4517. 1282.  -         setStyle(geByClass1('video_row_icon_delete', rowCont), {opacity: 0.8});
  4518. 1283.  -         var skipClear = true;
  4519. 1284.  -       } else {
  4520. 1285.  -         var skipClear = false;
  4521. 1286.  -       }
  4522. 1287.  -       hide('mv_warning');
  4523. 1288.  -       show('mv_controls');
  4524. 1289.  -       show('mv_controls_line');
  4525. 1290.  -       if (cur.claimedVideoText) {
  4526. 1291.  -         ge('video_player').innerHTML = cur.claimedVideoText;
  4527. 1292.  -         cur.claimedVideoText = "";
  4528. 1293.  -       }
  4529. 1294.  -       if (window.mvcur && mvcur.mvCommentsData) {
  4530. 1295.  -         show(mvcur.mvCommentsData);
  4531. 1296.  -       }
  4532. 1297.  -       var row = eval('('+row+')');
  4533. 1298.  -       if (window.Video) {
  4534. 1299.  -         Video.addToList('all', row, skipClear);
  4535. 1300.  -       }
  4536. 1301.  -     },
  4537. 1302.  -     onFail: function(text) {
  4538. 1303.  -       setTimeout(showFastBox(getLang('global_error'), text).hide, 5000);
  4539. 1304.  -       return true;
  4540. 1305.  -     }
  4541. 1306.  -   });
  4542. 1307.  -   return cancelEvent(ev);
  4543. 1308.  - },
  4544. 1309.  -
  4545. 1310.  - deleteVideo: function(vid, oid, hash, sure, from, obj, callback) {
  4546. 1311.  -   if (obj && hasClass(obj, 'loading')) return;
  4547. 1312.  -   ajax.post('al_video.php', {
  4548. 1313.  -     act: 'delete_video',
  4549. 1314.  -     vid: vid,
  4550. 1315.  -     oid: oid,
  4551. 1316.  -     hash: hash,
  4552. 1317.  -     sure: (sure) ? 1 : 0,
  4553. 1318.  -     from: from
  4554. 1319.  -   }, {onDone: function(type, removeInfo, text, do_button, cancel_button) {
  4555. 1320.  -     Videoview.recache(oid+'_'+vid);
  4556. 1321.  -     if (type == 'sure') {
  4557. 1322.  -       Videoview.hidePlayer();
  4558. 1323.  -       var box = showFastBox({title: removeInfo}, text);
  4559. 1324.  -       box.setOptions({onHide: function() {
  4560. 1325.  -         Videoview.showPlayer();
  4561. 1326.  -       }});
  4562. 1327.  -       box.removeButtons();
  4563. 1328.  -       box.addButton(cancel_button, box.hide, 'no');
  4564. 1329.  -       box.addButton(do_button, function() {
  4565. 1330.  -         box.showProgress();
  4566. 1331.  -         Videoview.deleteVideo(vid, oid, hash, true, from, obj, box.hide);
  4567. 1332.  -       }, 'yes');
  4568. 1333.  -     } else if (type == 'result') {
  4569. 1334.  -       if (callback) {
  4570. 1335.  -         callback(text);
  4571. 1336.  -       }
  4572. 1337.  -       if (from == 'videoviewer') {
  4573. 1338.  -         if (mvcur.mvCommentsData) {
  4574. 1339.  -           hide(mvcur.mvCommentsData);
  4575. 1340.  -           var warning = ge('mv_warning');
  4576. 1341.  -           warning.innerHTML = text;
  4577. 1342.  -           show(warning);
  4578. 1343.  -         }
  4579. 1344.  -         text = removeInfo;
  4580. 1345.  -       }
  4581. 1346.  -       if (cur.module == 'video') {
  4582. 1347.  -         var row = ge('video_row'+oid+'_'+vid);
  4583. 1348.  -         addClass(row, 'video_row_deleted');
  4584. 1349.  -         re(geByClass1('video_row_controls', row));
  4585. 1350.  -         var textEl = se(text);
  4586. 1351.  -         row.insertBefore(textEl, row.firstChild);
  4587. 1352.  -         setStyle(textEl, {marginTop: getSize(row)[1] / 2 - getSize(textEl)[1] / 2})
  4588. 1353.  -         Video.removeFromLists(oid+'_'+vid, true);
  4589. 1354.  -         return true;
  4590. 1355.  -       }
  4591. 1356.  -     }
  4592. 1357.  -   }, showProgress: obj ? addClass.pbind(obj, 'loading') : false, hideProgress: obj ? removeClass.pbind(obj, 'loading') : false});
  4593. 1358.  - },
  4594. 1359.  - deleteVideoOnClaim: function(vid, oid, hash, sure, from, obj) {
  4595. 1360.  -   Videoview.deleteVideo(vid, oid, hash, sure, from, obj, function(text) {
  4596. 1361.  -     if (from == 'videoviewer') {
  4597. 1362.  -       hide('mv_controls');
  4598. 1363.  -       hide('mv_controls_line');
  4599. 1364.  -       cur.claimedVideoText = ge('video_player').innerHTML;
  4600. 1365.  -       ge('video_player').innerHTML = text;
  4601. 1366.  -     }
  4602. 1367.  -   });
  4603. 1368.  - },
  4604. 1369.  -
  4605. 1370.  - tagOver: function(el) {
  4606. 1371.  -   animate(el, {backgroundColor: '#6B8DB1'}, 200);
  4607. 1372.  -   showTooltip(el, {text: getLang('video_delete_tag'), shift: [0, -2, 0]});
  4608. 1373.  - },
  4609. 1374.  -
  4610. 1375.  - tagOut: function(el) {
  4611. 1376.  -   if (!el.parentNode || !el.parentNode.parentNode) return;
  4612. 1377.  -   animate(el, {backgroundColor: '#C4D2E1'}, 200);
  4613. 1378.  - },
  4614. 1379.  -
  4615. 1380.  - recache: function(videoRaw) {
  4616. 1381.  -   if (!videoRaw && window.mvcur && mvcur.mvData.videoRaw) {
  4617. 1382.  -     videoRaw = mvcur.mvData.videoRaw;
  4618. 1383.  -   }
  4619. 1384.  -   for (var i in ajaxCache) {
  4620. 1385.  -     if (i.match(/^\/al_video\.php\#act=show/) && i.match(new RegExp('\&video='+videoRaw+'([^0-9]|$)', ''))) {
  4621. 1386.  -       delete(ajaxCache[i]);
  4622. 1387.  -     }
  4623. 1388.  -   }
  4624. 1389.  - },
  4625. 1390.  -
  4626. 1391.  - deleteTag: function(tagId, usersTag) {
  4627. 1392.  -   var actionCont = ge('mv_action_info');
  4628. 1393.  -   actionCont.innerHTML = '<img src="/images/upload.gif" />';
  4629. 1394.  -   show(actionCont);
  4630. 1395.  -   mv = mvcur.mvData;
  4631. 1396.  -   ajax.post('al_video.php', {act: 'delete_tag', video: mv.videoRaw, tag_id: tagId, hash: mv.hash}, {onDone: function(info, tagsList) {
  4632. 1397.  -     ge('mv_action_info').innerHTML = info;
  4633. 1398.  -     ge('mv_tags_list').innerHTML = tagsList;
  4634. 1399.  -     (tagsList ? show : hide)('mv_tags');
  4635. 1400.  -     (info ? show : hide)('mv_action_info');
  4636. 1401.  -     Videoview.recache(mv.videoRaw);
  4637. 1402.  -     if (window.Video && Video.removeFromLists && usersTag) {
  4638. 1403.  -       Video.removeFromLists(mvcur.mvData.videoRaw);
  4639. 1404.  -     }
  4640. 1405.  -   }});
  4641. 1406.  - },
  4642. 1407.  -
  4643. 1408.  - restoreTag: function(tagId) {
  4644. 1409.  -   var actionCont = ge('mv_action_info');
  4645. 1410.  -   actionCont.innerHTML = '<img src="/images/upload.gif" />';
  4646. 1411.  -   show(actionCont);
  4647. 1412.  -   mv = mvcur.mvData;
  4648. 1413.  -   ajax.post('al_video.php', {act: 'restore_tag', video: mv.videoRaw, tag_id: tagId, hash: mv.hash}, {onDone: function(info, tagsList) {
  4649. 1414.  -     ge('mv_action_info').innerHTML = info;
  4650. 1415.  -     ge('mv_tags_list').innerHTML = tagsList;
  4651. 1416.  -     (tagsList ? show : hide)('mv_tags');
  4652. 1417.  -     (info ? show : hide)('mv_action_info');
  4653. 1418.  -     Videoview.recache(mv.videoRaw);
  4654. 1419.  -   }});
  4655. 1420.  - },
  4656. 1421.  -
  4657. 1422.  - addTags: function(ids) {
  4658. 1423.  -   var actionCont = ge('mv_action_info');
  4659. 1424.  -   actionCont.innerHTML = '<img src="/images/upload.gif" />';
  4660. 1425.  -   show(actionCont);
  4661. 1426.  -   mv = mvcur.mvData;
  4662. 1427.  -   ajax.post('al_video.php', {act: 'add_tags', video: mv.videoRaw, ids: ids.join(','), hash: mv.hash}, {onDone: function(info, tagsList) {
  4663. 1428.  -     ge('mv_action_info').innerHTML = info;
  4664. 1429.  -     ge('mv_tags_list').innerHTML = tagsList;
  4665. 1430.  -     (tagsList ? show : hide)('mv_tags');
  4666. 1431.  -     (info ? show : hide)('mv_action_info');
  4667. 1432.  -     Videoview.recache(mv.videoRaw);
  4668. 1433.  -   }});
  4669. 1434.  - },
  4670. 1435.  -
  4671. 1436.  - getVideoCode: function(oid, vid) {
  4672. 1437.  -   Videoview.hidePlayer();
  4673. 1438.  -   var box = showBox('al_video.php', {act: 'video_embed_box', oid: oid, vid: vid}, {
  4674. 1439.  -     stat: ['ui_controls.js', 'ui_controls.css', 'video.css'],
  4675. 1440.  -     dark: 1,
  4676. 1441.  -     params: {
  4677. 1442.  -       width: 390,
  4678. 1443.  -       bodyStyle: 'padding: 5px 20px 20px;'
  4679. 1444.  -     }
  4680. 1445.  -   });
  4681. 1446.  -   box.setOptions({onHide: function() {
  4682. 1447.  -     Videoview.showPlayer();
  4683. 1448.  -   }});
  4684. 1449.  - },
  4685. 1450.  -
  4686. 1451.  - reportBox: function(oid, vid) {
  4687. 1452.  -   Videoview.hidePlayer();
  4688. 1453.  -   showBox('reports.php', {act: 'a_report_video_box', oid: oid, vid: vid}, {onHideAttempt: function() {
  4689. 1454.  -     Videoview.showPlayer();
  4690. 1455.  -   }, stat: ['ui_controls.js', 'ui_controls.css'], dark: 1});
  4691. 1456.  - },
  4692. 1457.  -
  4693. 1458.  - setAdult: function(oid, vid, hash) {
  4694. 1459.  -   ajax.post('al_video.php', {
  4695. 1460.  -     act: 'set_adult_video',
  4696. 1461.  -     vid: vid,
  4697. 1462.  -     oid: oid,
  4698. 1463.  -     hash: hash
  4699. 1464.  -   }, {onDone: function(text) {
  4700. 1465.  -     ge('mv_setadult_line').innerHTML = text;
  4701. 1466.  -   }});
  4702. 1467.  - },
  4703. 1468.  -
  4704. 1469.  - spamVideo: function(oid, vid, hash, obj, from, sure, callback) {
  4705. 1470.  -   if (obj) {
  4706. 1471.  -     addClass(obj, 'loading');
  4707. 1472.  -   }
  4708. 1473.  -   ajax.post('al_video.php', {
  4709. 1474.  -     act: 'spam_video',
  4710. 1475.  -     vid: vid,
  4711. 1476.  -     oid: oid,
  4712. 1477.  -     hash: hash,
  4713. 1478.  -     sure: (sure) ? 1 : 0,
  4714. 1479.  -     from: from
  4715. 1480.  -   }, {onDone: function(type, title, text, do_button, cancel_button) {
  4716. 1481.  -     if (obj) {
  4717. 1482.  -       removeClass(obj, 'loading');
  4718. 1483.  -     }
  4719. 1484.  -     Videoview.recache(oid+'_'+vid);
  4720. 1485.  -     if (type == 'sure') {
  4721. 1486.  -       Videoview.hidePlayer();
  4722. 1487.  -       var box = showFastBox({title: title}, text);
  4723. 1488.  -       box.setOptions({onHide: function() {
  4724. 1489.  -         Videoview.showPlayer();
  4725. 1490.  -       }});
  4726. 1491.  -       box.removeButtons();
  4727. 1492.  -       box.addButton(cancel_button, box.hide, 'no');
  4728. 1493.  -       box.addButton(do_button, function() {
  4729. 1494.  -         box.showProgress();
  4730. 1495.  -         Videoview.spamVideo(oid, vid, hash, obj, from, true, box.hide);
  4731. 1496.  -       }, 'yes');
  4732. 1497.  -     } else if (type == 'result') {
  4733. 1498.  -       if (callback) {
  4734. 1499.  -         callback();
  4735. 1500.  -       }
  4736. 1501.  -       if (from == 'videoviewer') {
  4737. 1502.  -         if (mvcur.mvCommentsData) {
  4738. 1503.  -           hide(mvcur.mvCommentsData);
  4739. 1504.  -           var warning = ge('mv_warning');
  4740. 1505.  -           warning.innerHTML = text;
  4741. 1506.  -           show(warning);
  4742. 1507.  -         }
  4743. 1508.  -         if (window.Video) {
  4744. 1509.  -           Video.removeFromLists(oid+'_'+vid);
  4745. 1510.  -         }
  4746. 1511.  -       } if (from == 'list') {
  4747. 1512.  -         ge('video_row'+oid+'_'+vid).innerHTML = '<div class="video_row">'+text+'</div>';
  4748. 1513.  -         Video.removeFromLists(oid+'_'+vid, true);
  4749. 1514.  -         return true;
  4750. 1515.  -       }
  4751. 1516.  -     } else {
  4752. 1517.  -       obj.parentNode.innerHTML = type;
  4753. 1518.  -     }
  4754. 1519.  -   }});
  4755. 1520.  - },
  4756. 1521.  -
  4757. 1522.  - licensed: function(obj, hash) {
  4758. 1523.  -   var actionCont = ge('mv_licensed_info');
  4759. 1524.  -   actionCont.innerHTML = '<img src="/images/upload.gif" />';
  4760. 1525.  -   show(actionCont);
  4761. 1526.  -
  4762. 1527.  -   ajax.post('al_video.php', {act: 'change_licensed', video: mvcur.mvData.videoRaw, hash: hash}, {onDone: function(text, info) {
  4763. 1528.  -     actionCont.innerHTML = info;
  4764. 1529.  -     (info ? show : hide)(actionCont);
  4765. 1530.  -     obj.innerHTML = text;
  4766. 1531.  -   }});
  4767. 1532.  - },
  4768. 1533.  - claimed: function(claim_id, action) {
  4769. 1534.  -   ge('claim_link').innerHTML = '<img src="/images/upload.gif" />';
  4770. 1535.  -
  4771. 1536.  -   ajax.post('al_claims.php', {act: 'a_' + action, type: 'video', id: mvcur.mvData.vid, owner_id: mvcur.mvData.oid, claim_id: claim_id}, {onDone: function() {
  4772. 1537.  -     if (action == 'claim') {
  4773. 1538.  -       ge('claim_link').innerHTML = '<a onclick="return Videoview.claimed(' + claim_id + ', \'unclaim\');\">�������</a>';
  4774. 1539.  -     } else {
  4775. 1540.  -       ge('claim_link').innerHTML = '<a onclick="return Videoview.claimed(' + claim_id + ', \'claim\');\">������</a>';
  4776. 1541.  -     }
  4777. 1542.  -   }});
  4778. 1543.  - },
  4779. 1544.  -
  4780. 1545.  - confirmTag: function(tagId) {
  4781. 1546.  -   var actionCont = ge('mv_action_info');
  4782. 1547.  -   ge('mv_approve').innerHTML = '<div style="text-align: center; padding-top: 4px;"><img src="/images/upload.gif"></div>';
  4783. 1548.  -   ajax.post('al_video.php', {act: 'confirm_tag', video: mvcur.mvData.videoRaw, tag_id: tagId, hash: mvcur.mvData.hash}, {onDone: function(info, tagsList, padres) {
  4784. 1549.  -     if (_pads.shown == 'vid') {
  4785. 1550.  -       Pads.vidDone(mvcur.mvData.videoRaw, false, padres);
  4786. 1551.  -     }
  4787. 1552.  -     Pads.invalidate('vid');
  4788. 1553.  -     hide('mv_approve');
  4789. 1554.  -     ge('mv_tags_list').innerHTML = tagsList;
  4790. 1555.  -     (tagsList ? show : hide)('mv_tags');
  4791. 1556.  -     if (window.Video && Video.onTagConfirm) {
  4792. 1557.  -       Video.onTagConfirm(mvcur.mvData.videoRaw);
  4793. 1558.  -     }
  4794. 1559.  -     Videoview.recache(mvcur.mvData.videoRaw);
  4795. 1560.  -   }});
  4796. 1561.  - },
  4797. 1562.  -
  4798. 1563.  - declineTag: function(tagId) {
  4799. 1564.  -   var appr = ge('mv_approve');
  4800. 1565.  -   var back = appr.innerHTML;
  4801. 1566.  -   appr.innerHTML = '<div style="text-align: center; padding-top: 4px;"><img src="/images/upload.gif"></div>';
  4802. 1567.  -   ajax.post('al_video.php', {act: 'delete_tag', video: mvcur.mvData.videoRaw, tag_id: tagId, hash: mvcur.mvData.hash}, {
  4803. 1568.  -     onDone: function(info, tagsList, padres) {
  4804. 1569.  -       if (_pads.shown == 'vid') {
  4805. 1570.  -         Pads.vidDone(mvcur.mvData.videoRaw, false, padres);
  4806. 1571.  -       }
  4807. 1572.  -       Pads.invalidate('vid');
  4808. 1573.  -       ge('mv_approve').innerHTML = info;
  4809. 1574.  -       //hide('mv_approve');
  4810. 1575.  -       ge('mv_tags_list').innerHTML = tagsList;
  4811. 1576.  -       (tagsList ? show : hide)('mv_tags');
  4812. 1577.  -       if (window.Video && Video.removeFromLists) {
  4813. 1578.  -         Video.removeFromLists(mvcur.mvData.videoRaw);
  4814. 1579.  -       }
  4815. 1580.  -       Videoview.recache(mvcur.mvData.videoRaw);
  4816. 1581.  -     },
  4817. 1582.  -     onFail: function() {
  4818. 1583.  -       appr.innerHTML = back;
  4819. 1584.  -     }
  4820. 1585.  -   });
  4821. 1586.  - },
  4822. 1587.  -
  4823. 1588.  - setStyle: function(label, obj, style) {
  4824. 1589.  -   if (!mvcur.restoreStyles) {
  4825. 1590.  -     mvcur.restoreStyles = {};
  4826. 1591.  -   }
  4827. 1592.  -   for (var i in style) {
  4828. 1593.  -     if (!mvcur.restoreStyles[label]) {
  4829. 1594.  -       mvcur.restoreStyles[label] = {};
  4830. 1595.  -     }
  4831. 1596.  -     mvcur.restoreStyles[label][i] = obj.style[i];
  4832. 1597.  -     obj.style[i] = style[i];
  4833. 1598.  -   }
  4834. 1599.  - },
  4835. 1600.  -
  4836. 1601.  - restoreStyle: function(label, obj) {
  4837. 1602.  -   setStyle(obj, mvcur.restoreStyles[label]);
  4838. 1603.  - },
  4839. 1604.  -
  4840. 1605.  - showVideo: function(title, html, js, desc, info, controlsLine, opt) {
  4841. 1606.  -   if (!vk.id && !html) {
  4842. 1607.  -     setTimeout(function() {
  4843. 1608.  -       Videoview.hide(false, true);
  4844. 1609.  -       showDoneBox(title);
  4845. 1610.  -     }, 500);
  4846. 1611.  -     return;
  4847. 1612.  -   }
  4848. 1613.  -
  4849. 1614.  -   opt = opt || {};
  4850. 1615.  -   window.lang = extend(window.lang || {}, opt.lang);
  4851. 1616.  -   mvcur.mvCommLimit = opt.commlimit;
  4852. 1617.  -   mvcur.mvData = opt.mvData;
  4853. 1618.  -   mvcur.videoRaw = opt.mvData.videoRaw;
  4854. 1619.  -   mvcur.mvMediaTypes = opt.media;
  4855. 1620.  -   mvcur.mvMediaShare = opt.share;
  4856. 1621.  -   mvcur.mvReplyNames = opt.names || {};
  4857. 1622.  -
  4858. 1623.  -   if (!mvcur.mvContent) {
  4859. 1624.  -     mvcur.mvContent = ge('mv_content');
  4860. 1625.  -   }
  4861. 1626.  -
  4862. 1627.  -   Wall.cancelEdit(true);
  4863. 1628.  -
  4864. 1629.  -   mvcur.mvContent.innerHTML = html;
  4865. 1630.  -   if (mvcur.mvWide) {
  4866. 1631.  -     mvcur.mvWide.innerHTML = desc;
  4867. 1632.  -   }
  4868. 1633.  -   if (mvcur.mvNarrow) {
  4869. 1634.  -     mvcur.mvNarrow.innerHTML = info;
  4870. 1635.  -   }
  4871. 1636.  -
  4872. 1637.  -   Videoview.updateComposer();
  4873. 1638.  -   if (mvcur.mvData.videoRaw == cur.mvReplyIn) {
  4874. 1639.  -     mvcur.mvReplyTo = cur.mvReplyTo;
  4875. 1640.  -     cur.mvReplyIn = mvcur.videoRaw;
  4876. 1641.  -     cur.mvReplyTo = mvcur.mvReplyTo;
  4877. 1642.  -   } else {
  4878. 1643.  -     Videoview.commentTo(false);
  4879. 1644.  -   }
  4880. 1645.  -
  4881. 1646.  -   if (!cur.mvComments) cur.mvComments = {};
  4882. 1647.  -   var cms = ge('mv_comments_wrap');
  4883. 1648.  -   if (cur.mvComments[mvcur.videoRaw]) {
  4884. 1649.  -     domPN(cms).replaceChild(cur.mvComments[mvcur.videoRaw], cms);
  4885. 1650.  -   }
  4886. 1651.  -
  4887. 1652.  -   mvcur.mvControlsLine.innerHTML = controlsLine;
  4888. 1653.  -
  4889. 1654.  -   mvcur.finished = false;
  4890. 1655.  -
  4891. 1656.  -   hide(mvcur.mvLoader);
  4892. 1657.  -   if (js) {
  4893. 1658.  -     eval('(function(){' + js + '})()');
  4894. 1659.  -   }
  4895. 1660.  -   if (opt['taggedInfo']) {
  4896. 1661.  -     var tagInfo = ge('mv_approve');
  4897. 1662.  -     tagInfo.innerHTML = opt['taggedInfo'];
  4898. 1663.  -     show(tagInfo);
  4899. 1664.  -   }
  4900. 1665.  -
  4901. 1666.  -   Videoview.updateSize();
  4902. 1667.  -   mvcur.changeCanvasSize = function() {
  4903. 1668.  -     Videoview.updateSize();
  4904. 1669.  -     window.checkRBoxes && checkRBoxes();
  4905. 1670.  -   };
  4906. 1671.  -
  4907. 1672.  -   if (mvcur.minimized) {
  4908. 1673.  -     Videoview.minimizePlayer();
  4909. 1674.  -   }
  4910. 1675.  -
  4911. 1676.  -   var titleWidth = (mvcur.minimized) ? mvcur.minSize.wrap.w : false;
  4912. 1677.  -   Videoview.setTitle(titleWidth);
  4913. 1678.  -
  4914. 1679.  -   if (mvcur.statusVideo) {
  4915. 1680.  -     var statusCont = ge('like_count' + mvcur.mvData.videoRaw);
  4916. 1681.  -     if (statusCont) {
  4917. 1682.  -       var tt = statusCont.parentNode.tt;
  4918. 1683.  -       if (tt && tt.container) {
  4919. 1684.  -         re(tt.container)
  4920. 1685.  -         //re(tt.el);
  4921. 1686.  -       }
  4922. 1687.  -       if (statusCont.parentNode.tt) {
  4923. 1688.  -         delete statusCont.parentNode.tt;
  4924. 1689.  -       }
  4925. 1690.  -     }
  4926. 1691.  -   }
  4927. 1692.  -   if (opt.showInfo && !mvcur.minimized && !mvcur.options.hideInfo) {
  4928. 1693.  -     addClass(mvcur.mvControlsLine, 'mv_controls_shown');
  4929. 1694.  -     show(ge('mv_controls'));
  4930. 1695.  -   }
  4931. 1696.  -
  4932. 1697.  -   show('mv_content');
  4933. 1698.  -   window.updateWndVScroll && updateWndVScroll();
  4934. 1699.  -
  4935. 1700.  -   if ((mvcur.options || {}).scroll) {
  4936. 1701.  -     mvLayerWrap.scrollTop = mvcur.options.scroll;
  4937. 1702.  -     mvcur.options.scroll = 0;
  4938. 1703.  -   }
  4939. 1704.  - },
  4940. 1705.  -
  4941. 1706.  - setTitle: function(len) {
  4942. 1707.  -   len = len || 590;
  4943. 1708.  -   ge('mv_min_title').innerHTML = mvcur.mvData.title || '';
  4944. 1709.  -   setStyle(ge('mv_min_title'), {maxWidth: Math.max(0, len - 60)});
  4945. 1710.  - },
  4946. 1711.  -
  4947. 1712.  - getContSize: function() {
  4948. 1713.  -   if (!mvcur.contSize) {
  4949. 1714.  -     mvcur.contSize = getSize(mvcur.mvBox);
  4950. 1715.  -   }
  4951. 1716.  -   return mvcur.contSize;
  4952. 1717.  - },
  4953. 1718.  -
  4954. 1719.  - getContPlace: function(event, click) {
  4955. 1720.  -   var mask = 0;
  4956. 1721.  -   var size = Videoview.getContSize();
  4957. 1722.  -   var x = event.clientX - mvcur.minSize.wrap.l;
  4958. 1723.  -   var y = event.clientY - mvcur.minSize.wrap.t;
  4959. 1724.  -   if (y < 6) mask += 1;
  4960. 1725.  -   if (x > size[0] - 20) mask += 2;
  4961. 1726.  -   if (y > size[1] - 10) mask += 4;
  4962. 1727.  -   if (x < 10) mask += 8;
  4963. 1728.  -   if (mask == 1 && x > size[0] - 55) {
  4964. 1729.  -     mask = 0;
  4965. 1730.  -   }
  4966. 1731.  -   if (!mask && y < 25 && x < size[0] - 55) {
  4967. 1732.  -     mask += 16;
  4968. 1733.  -   }
  4969. 1734.  -   return mask;
  4970. 1735.  - },
  4971. 1736.  -
  4972. 1737.  - changeCursor: function(event) {
  4973. 1738.  -   var mask = Videoview.getContPlace(event);
  4974. 1739.  -   var cursor = 'default';
  4975. 1740.  -   if (mask && mvcur.minimized) {
  4976. 1741.  -     var direction = '';
  4977. 1742.  -     if (mask & 1) direction += 'n';
  4978. 1743.  -     if (mask & 4) direction += 's';
  4979. 1744.  -     if (mask & 2) direction += 'e';
  4980. 1745.  -     if (mask & 8) direction += 'w';
  4981. 1746.  -     cursor = direction+'-resize';
  4982. 1747.  -     if (mask & 16) {
  4983. 1748.  -       cursor = 'move';
  4984. 1749.  -     }
  4985. 1750.  -   }
  4986. 1751.  -   setStyle(mvcur.mvBox, {cursor: cursor});
  4987. 1752.  - },
  4988. 1753.  -
  4989. 1754.  - getMinSize: function() {
  4990. 1755.  -   extend(mvcur.minSize, {
  4991. 1756.  -     wrap: {
  4992. 1757.  -       t: intval(mvLayerWrap.style.top),
  4993. 1758.  -       l: intval(mvLayerWrap.style.left),
  4994. 1759.  -       w: intval(mvLayerWrap.style.width),
  4995. 1760.  -       h: intval(mvLayerWrap.style.height)
  4996. 1761.  -     },
  4997. 1762.  -     player: {
  4998. 1763.  -       w: intval(mvcur.mvPlayer.style.width),
  4999. 1764.  -       h: intval(mvcur.mvPlayer.style.height)
  5000. 1765.  -     }
  5001. 1766.  -   });
  5002. 1767.  - },
  5003. 1768.  -
  5004. 1769.  - startDrag: function(event) {
  5005. 1770.  -   if (event.button && event.button !== 1) {
  5006. 1771.  -     return;
  5007. 1772.  -   }
  5008. 1773.  -   var mask = Videoview.getContPlace(event, true);
  5009. 1774.  -   if (!mask) {
  5010. 1775.  -     return;
  5011. 1776.  -   }
  5012. 1777.  -   var dragTime = new Date().getTime();
  5013. 1778.  -
  5014. 1779.  -   Videoview.getMinSize();
  5015. 1780.  -   extend(mvcur.minSize, {x: event.clientX, y: event.clientY});
  5016. 1781.  -
  5017. 1782.  -   mvcur.resizeDiff = 0;
  5018. 1783.  -   mvcur.mvPlayerCont = mvcur.mvPlayer.parentNode;
  5019. 1784.  -
  5020. 1785.  -   if (!mask || mask & 16) {
  5021. 1786.  -     var act = Videoview.onMinMove;
  5022. 1787.  -   } else {
  5023. 1788.  -     var act = Videoview.onMinResize;
  5024. 1789.  -   }
  5025. 1790.  -   mvcur.resizeMask = mask;
  5026. 1791.  -   var cb = function (event) {
  5027. 1792.  -     removeEvent(document, 'mouseup', cb);
  5028. 1793.  -     removeEvent(document, 'mousemove', act);
  5029. 1794.  -     removeEvent(document, 'drag', act);
  5030. 1795.  -     var time = new Date().getTime();
  5031. 1796.  -     Videoview.getMinSize();
  5032. 1797.  -     if (mvcur.resizeDiff < 8 && (time - dragTime) < 400 && (mask & 16 || mask == 1)) {
  5033. 1798.  -       Videoview.unminimize();
  5034. 1799.  -     }
  5035. 1800.  -     removeClass(mvLayerWrap, 'mv_resizing');
  5036. 1801.  -     hide(mvcur.mvLoader);
  5037. 1802.  -     addEvent(mvcur.mvBox, 'mousemove', Videoview.changeCursor);
  5038. 1803.  -     ls.set('mv_minSize', mvcur.minSize);
  5039. 1804.  -     return false;
  5040. 1805.  -   }
  5041. 1806.  -   addClass(mvLayerWrap, 'mv_resizing');
  5042. 1807.  -   show(mvcur.mvLoader);
  5043. 1808.  -   addEvent(document, 'mouseup', cb);
  5044. 1809.  -   addEvent(document, 'mousemove', act);
  5045. 1810.  -   addEvent(document, 'drag', act);
  5046. 1811.  -   removeEvent(mvcur.mvBox, 'mousemove', Videoview.changeCursor);
  5047. 1812.  -   return cancelEvent(event);
  5048. 1813.  - },
  5049. 1814.  -
  5050. 1815.  - onMinMove: function(event) {
  5051. 1816.  -   if (event) {
  5052. 1817.  -     var diffY = event.clientY - mvcur.minSize.y;
  5053. 1818.  -     var diffX = event.clientX - mvcur.minSize.x;
  5054. 1819.  -   } else {
  5055. 1820.  -     var diffY = 0;
  5056. 1821.  -     var diffX = 0;
  5057. 1822.  -   }
  5058. 1823.  -   if (mvcur.minSize.wrap.t + diffY > mvcur.minSize.ch - mvcur.minSize.wrap.h - 15) {
  5059. 1824.  -     diffY = mvcur.minSize.ch - mvcur.minSize.wrap.h - mvcur.minSize.wrap.t;
  5060. 1825.  -   }
  5061. 1826.  -   if (mvcur.minSize.wrap.l + diffX > mvcur.minSize.cw - mvcur.minSize.wrap.w - 25) {
  5062. 1827.  -     diffX = mvcur.minSize.cw - mvcur.minSize.wrap.w - mvcur.minSize.wrap.l - 14;
  5063. 1828.  -   }
  5064. 1829.  -   if (mvcur.minSize.wrap.t + diffY < 15) {
  5065. 1830.  -     diffY = -mvcur.minSize.wrap.t;
  5066. 1831.  -   }
  5067. 1832.  -   if (mvcur.minSize.wrap.l + diffX < 15) {
  5068. 1833.  -     diffX = -mvcur.minSize.wrap.l;
  5069. 1834.  -   }
  5070. 1835.  -   setStyle(mvLayerWrap, {
  5071. 1836.  -     top: mvcur.minSize.wrap.t + diffY + 'px',
  5072. 1837.  -     left: mvcur.minSize.wrap.l + diffX + 'px'
  5073. 1838.  -   });
  5074. 1839.  -   mvcur.resizeDiff = Math.max(Math.abs(diffX), Math.max(Math.abs(diffY), mvcur.resizeDiff));
  5075. 1840.  -   return (event) ? cancelEvent(event) : false;
  5076. 1841.  - },
  5077. 1842.  -
  5078. 1843.  - onMinResize: function(event) {
  5079. 1844.  -   var diffL = 0;
  5080. 1845.  -   var diffT = 0;
  5081. 1846.  -   var mask = mvcur.resizeMask;
  5082. 1847.  -   var diffY = (mask & 1 || mask & 4) ? event.clientY - mvcur.minSize.y : 0;
  5083. 1848.  -   var diffX = (mask & 2 || mask & 8) ? event.clientX - mvcur.minSize.x : 0;
  5084. 1849.  -   if ((mask & 4) && mvcur.minSize.wrap.t + diffY > mvcur.minSize.ch - mvcur.minSize.wrap.h) {
  5085. 1850.  -     diffY = mvcur.minSize.ch - mvcur.minSize.wrap.h - mvcur.minSize.wrap.t;
  5086. 1851.  -   }
  5087. 1852.  -   if ((mask & 1) && mvcur.minSize.wrap.t + diffY < 0) {
  5088. 1853.  -     diffY = -mvcur.minSize.wrap.t;
  5089. 1854.  -   }
  5090. 1855.  -   if ((mask & 2) && mvcur.minSize.wrap.l + diffX > mvcur.minSize.cw - mvcur.minSize.wrap.w - 14) {
  5091. 1856.  -     diffX = mvcur.minSize.cw - mvcur.minSize.wrap.w - mvcur.minSize.wrap.l - 14;
  5092. 1857.  -   }
  5093. 1858.  -   if ((mask & 8) && mvcur.minSize.wrap.l + diffX < 0) {
  5094. 1859.  -     diffX = -mvcur.minSize.wrap.l;
  5095. 1860.  -   }
  5096. 1861.  -   if (mask & 8) {
  5097. 1862.  -     diffL = diffX;
  5098. 1863.  -     diffX = -diffX;
  5099. 1864.  -   }
  5100. 1865.  -   if (mask & 1) {
  5101. 1866.  -     diffT = diffY;
  5102. 1867.  -     diffY = -diffY;
  5103. 1868.  -   }
  5104. 1869.  -   if (mvcur.minSize.wrap.w + diffX < 250) {
  5105. 1870.  -     diffX = 250 - mvcur.minSize.wrap.w;
  5106. 1871.  -     if (mask & 8) diffL = -diffX;
  5107. 1872.  -   }
  5108. 1873.  -   if (mvcur.minSize.wrap.h + diffY < 200) {
  5109. 1874.  -     diffY = 200 - mvcur.minSize.wrap.h;
  5110. 1875.  -     if (mask & 1) diffT = -diffY;
  5111. 1876.  -   }
  5112. 1877.  -   var change = Math.abs(diffX) + Math.abs(diffY);
  5113. 1878.  -   var wrapW = mvcur.minSize.wrap.w + diffX;
  5114. 1879.  -   setStyle(mvLayerWrap, {
  5115. 1880.  -     top: (mvcur.minSize.wrap.t + diffT) + 'px',
  5116. 1881.  -     left: positive(mvcur.minSize.wrap.l + diffL) + 'px',
  5117. 1882.  -     width: wrapW + 'px',
  5118. 1883.  -     height: (mvcur.minSize.wrap.h + diffY) + 'px'
  5119. 1884.  -   });
  5120. 1885.  -   var style = {
  5121. 1886.  -     height: (mvcur.minSize.player.h + diffY) + 'px',
  5122. 1887.  -     width: (mvcur.minSize.player.w + diffX) + 'px'
  5123. 1888.  -   };
  5124. 1889.  -   if (!mvcur.flashResizeStyle) {
  5125. 1890.  -     if (change > 4) {
  5126. 1891.  -       clearTimeout(mvcur.resizeTimeout);
  5127. 1892.  -     }
  5128. 1893.  -     mvcur.resizeTimeout = setTimeout(function() {
  5129. 1894.  -       setStyle(mvcur.mvPlayer, mvcur.flashResizeStyle);
  5130. 1895.  -       mvcur.flashResizeStyle = false;
  5131. 1896.  -     }, 200);
  5132. 1897.  -   }
  5133. 1898.  -   mvcur.flashResizeStyle = style;
  5134. 1899.  -   setStyle(mvcur.mvPlayerCont, style);
  5135. 1900.  -
  5136. 1901.  -   mvcur.resizeDiff = Math.max(change, mvcur.resizeDiff);
  5137. 1902.  -   mvcur.contSize = false;
  5138. 1903.  -   Videoview.setTitle(wrapW);
  5139. 1904.  -   if (ge('html5_player') && window.html5video) {
  5140. 1905.  -     html5video.onResize()
  5141. 1906.  -   }
  5142. 1907.  -   return false;
  5143. 1908.  - },
  5144. 1909.  -
  5145. 1910.  - minimize: function(ev) {
  5146. 1911.  -   ev && cancelEvent(ev);
  5147. 1912.  -
  5148. 1913.  -   if (mvcur.minimized) {
  5149. 1914.  -     return false;
  5150. 1915.  -   }
  5151. 1916.  -
  5152. 1917.  -   mvcur.controlsVisibility = isVisible('mv_controls');
  5153. 1918.  -   hide('mv_controls');
  5154. 1919.  -   hide('mv_top_controls');
  5155. 1920.  -   if (isVisible('mv_approve')) {
  5156. 1921.  -     mvcur.needShowApprove = true;
  5157. 1922.  -     hide('mv_approve');
  5158. 1923.  -   } else {
  5159. 1924.  -     mvcur.needShowApprove = false;
  5160. 1925.  -   }
  5161. 1926.  -
  5162. 1927.  -   Wall.cancelEdit(true);
  5163. 1928.  -
  5164. 1929.  -   addClass(mvLayerWrap, 'mv_minimized');
  5165. 1930.  -   if (!mvcur.minSize) {
  5166. 1931.  -     mvcur.minSize = ls.get('mv_minSize');
  5167. 1932.  -   }
  5168. 1933.  -
  5169. 1934.  -   var colorClass = 'mv_dark';
  5170. 1935.  -   removeClass(mvLayerWrap, colorClass);
  5171. 1936.  -   removeClass(layerBG, colorClass);
  5172. 1937.  -   layers.fullhide = false;
  5173. 1938.  -
  5174. 1939.  -   if (!mvcur.minSize || !Videoview.enabledResize() || !mvcur.minSize.wrap.w) {
  5175. 1940.  -     mvcur.minSize = {
  5176. 1941.  -       wrap: {
  5177. 1942.  -         w: 300,
  5178. 1943.  -         h: 210
  5179. 1944.  -       }
  5180. 1945.  -     }
  5181. 1946.  -   }
  5182. 1947.  -
  5183. 1948.  -   var wrap = mvcur.minSize.wrap;
  5184. 1949.  -   mvcur.minSize.player = {w: wrap.w - 20, h: wrap.h - 37};
  5185. 1950.  -
  5186. 1951.  -   Videoview.setStyle('mvCont', mvcur.mvCont, {
  5187. 1952.  -     left: '0px',
  5188. 1953.  -     top: '0px'
  5189. 1954.  -   });
  5190. 1955.  -
  5191. 1956.  -   mvLayer.style.width = 'auto';
  5192. 1957.  -
  5193. 1958.  -   if (mvcur.mvData) {
  5194. 1959.  -     Videoview.minimizePlayer();
  5195. 1960.  -   }
  5196. 1961.  -
  5197. 1962.  -   if (window.tooltips) {
  5198. 1963.  -     tooltips.destroyAll(cur.mvBox);
  5199. 1964.  -   }
  5200. 1965.  -
  5201. 1966.  -   removeEvent(window, 'resize', Videoview.onResize);
  5202. 1967.  -   removeEvent(document, 'keydown', Videoview.onKeyDown);
  5203. 1968.  -
  5204. 1969.  -   addEvent(window, 'resize', Videoview.minResize);
  5205. 1970.  -   if (Videoview.enabledResize()) {
  5206. 1971.  -     addEvent(mvcur.mvBox, 'mousedown', Videoview.startDrag);
  5207. 1972.  -     addEvent(mvcur.mvBox, 'mousemove', Videoview.changeCursor);
  5208. 1973.  -     mvcur.minDestroy = function() {
  5209. 1974.  -       removeEvent(mvcur.mvBox, 'mousedown', Videoview.startDrag);
  5210. 1975.  -       removeEvent(mvcur.mvBox, 'mousemove', Videoview.changeCursor);
  5211. 1976.  -       setStyle(mvcur.mvBox, {cursor: 'default'});
  5212. 1977.  -     }
  5213. 1978.  -   } else {
  5214. 1979.  -     addEvent(ge('mv_min_title'), 'click', Videoview.unminimize);
  5215. 1980.  -     mvcur.minDestroy = function() {
  5216. 1981.  -       removeEvent(ge('mv_min_title'), 'click', Videoview.unminimize);
  5217. 1982.  -     }
  5218. 1983.  -   }
  5219. 1984.  -
  5220. 1985.  -   Videoview.setTitle(wrap.w);
  5221. 1986.  -
  5222. 1987.  -   Videoview.minResize();
  5223. 1988.  -
  5224. 1989.  -   Videoview.setStyle('mvLayerWrap', mvLayerWrap, {
  5225. 1990.  -     width: mvcur.minSize.wrap.w + 'px',
  5226. 1991.  -     height: mvcur.minSize.wrap.h + 'px'
  5227. 1992.  -   });
  5228. 1993.  -
  5229. 1994.  -   mvcur.minimized = true;
  5230. 1995.  -
  5231. 1996.  - //  if (window.wkcur && wkcur.shown) {
  5232. 1997.  - //    WkView.showLayer();
  5233. 1998.  - //  } else {
  5234. 1999.  -     layers.wraphide();
  5235. 2000.  - //  }
  5236. 2001.  -
  5237. 2002.  -   var popLayer = layerQueue.count();
  5238. 2003.  -   if (!mvcur.noLocChange) {
  5239. 2004.  -     if (!mvcur.noHistory) {
  5240. 2005.  -       popLayer = false;
  5241. 2006.  -       history.go(-1); // return location through history
  5242. 2007.  -     } else {
  5243. 2008.  -       Videoview.backLocation();
  5244. 2009.  -     }
  5245. 2010.  -     mvcur.noHistory = 1;
  5246. 2011.  -   }
  5247. 2012.  -
  5248. 2013.  -   layerQueue.skipVideo = true;
  5249. 2014.  -   if (popLayer) {
  5250. 2015.  -     debugLog('pop from minimize');
  5251. 2016.  -     layerQueue.pop();
  5252. 2017.  -   }
  5253. 2018.  -
  5254. 2019.  -   return false;
  5255. 2020.  - },
  5256. 2021.  -
  5257. 2022.  - enabledResize: function() {
  5258. 2023.  -   return (browser.safari || browser.chrome || browser.mozilla | browser.opera) && !browser['safari_mobile'];
  5259. 2024.  - },
  5260. 2025.  -
  5261. 2026.  - minimizePlayer: function() {
  5262. 2027.  -   mvcur.mvPlayer = ge('video_player') || ge('extra_player') || ge('html5_player');
  5263. 2028.  -   if (mvcur.mvPlayer) {
  5264. 2029.  -     var style = {
  5265. 2030.  -       width: mvcur.minSize.player.w + 'px',
  5266. 2031.  -       height: mvcur.minSize.player.h + 'px'
  5267. 2032.  -     };
  5268. 2033.  -     Videoview.setStyle('mvPlayer', mvcur.mvPlayer, style);
  5269. 2034.  -     Videoview.setStyle('mvPlayerParent', mvcur.mvPlayer.parentNode, style);
  5270. 2035.  -     if (ge('html5_player') && window.html5video) {
  5271. 2036.  -       html5video.onResize()
  5272. 2037.  -     }
  5273. 2038.  -   }
  5274. 2039.  - },
  5275. 2040.  -
  5276. 2041.  - minResize: function() {
  5277. 2042.  -   var docEl = document.documentElement;
  5278. 2043.  -
  5279. 2044.  -   mvcur.minSize.ch = window.innerHeight || docEl.clientHeight || bodyNode.clientHeight;
  5280. 2045.  -   mvcur.minSize.cw = window.innerWidth || docEl.clientWidth || bodyNode.clientWidth;
  5281. 2046.  -
  5282. 2047.  -   var pos = getXY(ge('page_layout'));
  5283. 2048.  -
  5284. 2049.  -   if (mvcur.minSize.wrap.t === undefined) {
  5285. 2050.  -     mvcur.minSize.wrap.t = mvcur.minSize.ch - mvcur.minSize.wrap.h;
  5286. 2051.  -   }
  5287. 2052.  -   if (mvcur.minSize.wrap.l === undefined) {
  5288. 2053.  -     mvcur.minSize.wrap.l = Math.max(String(pos[0] - mvcur.minSize.player.w / 2), 30);
  5289. 2054.  -   }
  5290. 2055.  -
  5291. 2056.  -   setStyle(mvLayerWrap, {
  5292. 2057.  -     left: mvcur.minSize.wrap.l + 'px',
  5293. 2058.  -     top: mvcur.minSize.wrap.t + 'px'
  5294. 2059.  -   });
  5295. 2060.  -
  5296. 2061.  -   Videoview.onMinMove();
  5297. 2062.  -
  5298. 2063.  -   if (mvcur.minimized) {
  5299. 2064.  -     Videoview.getMinSize();
  5300. 2065.  -   }
  5301. 2066.  - },
  5302. 2067.  -
  5303. 2068.  - updateComposer: function() {
  5304. 2069.  -   var yc = ge('mv_your_comment');
  5305. 2070.  -   if (!yc || cur.mvYourComment == yc) return;
  5306. 2071.  -
  5307. 2072.  -   if (cur.mvYourComment) {
  5308. 2073.  -     domPN(yc).replaceChild(cur.mvYourComment, yc);
  5309. 2074.  -     return;
  5310. 2075.  -   }
  5311. 2076.  -   var comp = data(ge('mv_comment'), 'composer');
  5312. 2077.  -   if (comp) {
  5313. 2078.  -     Composer.reset(comp);
  5314. 2079.  -     Composer.destroy(comp);
  5315. 2080.  -   }
  5316. 2081.  -   cur.mvYourComment = yc;
  5317. 2082.  -   cur.destroy.push(function(c) {
  5318. 2083.  -     var field = c.pvYourComment && geByTag1('textarea', c.pvYourComment), comp = field && data(field, 'composer');
  5319. 2084.  -     if (comp) {
  5320. 2085.  -       Composer.reset(comp);
  5321. 2086.  -       Composer.destroy(comp);
  5322. 2087.  -     }
  5323. 2088.  -   });
  5324. 2089.  -   Wall.initComposer(ge('mv_comment'), {
  5325. 2090.  -     lang: {
  5326. 2091.  -       introText: getLang('profile_mention_start_typing'),
  5327. 2092.  -       noResult: getLang('profile_mention_not_found')
  5328. 2093.  -     },
  5329. 2094.  -     wddClass: 'mv_composer_dd',
  5330. 2095.  -     width: getSize(domPN(cur.pvYourComment))[0],
  5331. 2096.  -     media: {
  5332. 2097.  -       lnk: domFC(ge('mv_add_media')),
  5333. 2098.  -       preview: ge('mv_media_preview'),
  5334. 2099.  -       types: mvcur.mvMediaTypes,
  5335. 2100.  -       options: {limit: 2, disabledTypes: ['album'], toggleLnk: true, onChange: function() {
  5336. 2101.  -         setTimeout(Videoview.updateArrowsY, 2);
  5337. 2102.  -       }}
  5338. 2103.  -     }
  5339. 2104.  -   });
  5340. 2105.  -   if (!cur.options) cur.options = {};
  5341. 2106.  -   if (!cur.options.share) cur.options.share = mvcur.mvMediaShare;
  5342. 2107.  - },
  5343. 2108.  -
  5344. 2109.  - unminimize: function(noLoc, beforeHide, noQueue) {
  5345. 2110.  -   if (!mvcur.minimized) {
  5346. 2111.  -     return;
  5347. 2112.  -   }
  5348. 2113.  -   if (!noQueue) {
  5349. 2114.  -     layerQueue.push();
  5350. 2115.  -   }
  5351. 2116.  -   if (!beforeHide) {
  5352. 2117.  -     layerQueue.hide();
  5353. 2118.  -     setTimeout(function() {
  5354. 2119.  -       mvcur.noHistory = 1;
  5355. 2120.  -       layerQueue.noHistory();
  5356. 2121.  -       layers.wrapshow(mvLayerWrap, 0.7);
  5357. 2122.  -       layers.fullhide = Videoview.hide;
  5358. 2123.  -       Videoview.updateComposer();
  5359. 2124.  -       cur.mvReplyIn = mvcur.videoRaw;
  5360. 2125.  -       cur.mvReplyTo = mvcur.mvReplyTo;
  5361. 2126.  -     }, 0);
  5362. 2127.  -   }
  5363. 2128.  -   Videoview.hidePlayer(true);
  5364. 2129.  -
  5365. 2130.  - //  if (window.wkLayerWrap && isVisible(window.wkLayerWrap)) {
  5366. 2131.  - //    hide(wkLayerWrap);
  5367. 2132.  - //  }
  5368. 2133.  -
  5369. 2134.  -   if (mvcur.controlsVisibility) {
  5370. 2135.  -     show('mv_controls');
  5371. 2136.  -   }
  5372. 2137.  -   //show('mv_right_controls');
  5373. 2138.  -   show('mv_top_controls');
  5374. 2139.  -
  5375. 2140.  -   mvcur.minimized = false;
  5376. 2141.  -   removeClass(mvLayerWrap, 'mv_minimized');
  5377. 2142.  -   Videoview.restoreStyle('mvLayerWrap', mvLayerWrap);
  5378. 2143.  -
  5379. 2144.  -   var colorClass = 'mv_dark';
  5380. 2145.  -   addClass(mvLayerWrap, colorClass);
  5381. 2146.  -   addClass(layerBG, colorClass);
  5382. 2147.  -
  5383. 2148.  -   if (mvcur.needShowApprove) {
  5384. 2149.  -     mvcur.needShowApprove = false;
  5385. 2150.  -     show('mv_approve');
  5386. 2151.  -   }
  5387. 2152.  -
  5388. 2153.  -   Videoview.restoreStyle('mvCont', mvcur.mvCont);
  5389. 2154.  -   if (mvcur.mvPlayer) {
  5390. 2155.  -     Videoview.restoreStyle('mvPlayer', mvcur.mvPlayer);
  5391. 2156.  -     Videoview.restoreStyle('mvPlayerParent', mvcur.mvPlayer.parentNode);
  5392. 2157.  -     if (ge('html5_player') && window.html5video) {
  5393. 2158.  -       html5video.onResize()
  5394. 2159.  -     }
  5395. 2160.  -   }
  5396. 2161.  -
  5397. 2162.  - //  if (cur.pvFixed) {
  5398. 2163.  - //    hide(cur.pvFixed);
  5399. 2164.  - //    cur.pvFixedHide = true;
  5400. 2165.  - //  }
  5401. 2166.  - //  layers.wrapshow(false, 0.7);
  5402. 2167.  -
  5403. 2168.  -   Videoview.updateSize();
  5404. 2169.  -
  5405. 2170.  -   addEvent(window, 'resize', Videoview.onResize);
  5406. 2171.  -   addEvent(document, 'keydown', Videoview.onKeyDown);
  5407. 2172.  -   removeEvent(window, 'resize', Videoview.minResize);
  5408. 2173.  -
  5409. 2174.  -   if (mvcur.minDestroy) {
  5410. 2175.  -     mvcur.minDestroy();
  5411. 2176.  -   }
  5412. 2177.  -   if (!mvcur.noLocChange && noLoc !== true) {
  5413. 2178.  -     Videoview.setLocation();
  5414. 2179.  -   }
  5415. 2180.  -
  5416. 2181.  -   onBodyResize(true);
  5417. 2182.  -
  5418. 2183.  -   setStyle(mvLayerWrap, {
  5419. 2184.  -     left: '0px',
  5420. 2185.  -     top: '0px'
  5421. 2186.  -   });
  5422. 2187.  -
  5423. 2188.  -   Videoview.showPlayer(true);
  5424. 2189.  -
  5425. 2190.  -   Videoview.setTitle();
  5426. 2191.  -
  5427. 2192.  -   return false;
  5428. 2193.  - },
  5429. 2194.  -
  5430. 2195.  - sendVideo: function() {
  5431. 2196.  -   Videoview.hidePlayer();
  5432. 2197.  -   var box = showBox('like.php', {act: 'publish_box', object: 'video' + mvcur.videoRaw, list: mvcur.listId, to: 'mail'}, {stat: ['page.js', 'page.css', 'wide_dd.js', 'wide_dd.css', 'sharebox.js']});
  5433. 2198.  -   box.setOptions({onHideAttempt: function() {
  5434. 2199.  -     Videoview.showPlayer();
  5435. 2200.  -     return true;
  5436. 2201.  -   }});
  5437. 2202.  - },
  5438. 2203.  -
  5439. 2204.  - showDD: function(obj, dd) {
  5440. 2205.  -   clearTimeout(cur.hideShareTimer);
  5441. 2206.  -   obj.blur();
  5442. 2207.  -   if (hasClass(dd, 'mv_dd_hiding')) {
  5443. 2208.  -     return;
  5444. 2209.  -   }
  5445. 2210.  -   if (isVisible(dd)) {
  5446. 2211.  -     return fadeIn(dd, 0);
  5447. 2212.  -   }
  5448. 2213.  -   if (cur.ddShown) {
  5449. 2214.  -     videoview.hideDD(0);
  5450. 2215.  -   }
  5451. 2216.  -   cur.ddShown = dd;
  5452. 2217.  -   setTimeout(addEvent.pbind(document, 'click', Videoview.hideDD), 1);
  5453. 2218.  -   show(dd);
  5454. 2219.  - },
  5455. 2220.  -
  5456. 2221.  - hideDD: function(timeout) {
  5457. 2222.  -   if (timeout > 0) {
  5458. 2223.  -     cur.hideShareTimer = setTimeout(Videoview.hideDD.pbind(0), timeout);
  5459. 2224.  -     return;
  5460. 2225.  -   }
  5461. 2226.  -   var dd = cur.ddShown;
  5462. 2227.  -   if (!dd) return;
  5463. 2228.  -   if (timeout == -1) {
  5464. 2229.  -     hide(dd);
  5465. 2230.  -   } else {
  5466. 2231.  -     addClass(dd, 'mv_dd_hiding')
  5467. 2232.  -     fadeOut(dd, 200, function() {
  5468. 2233.  -       removeClass(dd, 'mv_dd_hiding')
  5469. 2234.  -     });
  5470. 2235.  -   }
  5471. 2236.  -   removeEvent(document, 'click', Videoview.hideDD);
  5472. 2237.  -   cur.ddShown = false;
  5473. 2238.  - },
  5474. 2239.  -
  5475. 2240.  - createDD: function(obj, items, callback) {
  5476. 2241.  -   var dd = obj.nextSibling;
  5477. 2242.  -   if (hasClass(obj, 'mv_report_blocked')) {
  5478. 2243.  -     return;
  5479. 2244.  -   }
  5480. 2245.  -   if (!dd || !hasClass(dd, 'mv_controls_dd')) {
  5481. 2246.  -     var text = geByClass1('mv_share_text', obj).innerHTML;
  5482. 2247.  -     var dd = se('<div onmouseover="videoview.showDD(ge(\''+obj.id+'\'), this);" onmouseout="videoview.hideDD(500);" onclick="videoview.hideDD(-1);" class="mv_controls_dd fixed">'+
  5483. 2248.  -   '<table cellspacing="0" cellpadding="0"><tbody><tr>'+
  5484. 2249.  -   '<td class="mvs_side_sh">'+
  5485. 2250.  -     '<div class="mvs_side_sh_el"></div>'+
  5486. 2251.  -   '</td><td>'+
  5487. 2252.  -     '<div class="mvs_header_wrap">'+
  5488. 2253.  -       '<div class="mvs_header">'+
  5489. 2254.  -         '<span class="mvs_header_text">'+text+'</span>'+
  5490. 2255.  -       '</div>'+
  5491. 2256.  -     '</div>'+
  5492. 2257.  -     '<div class="mvs_acts">'+
  5493. 2258.  -     '</div>'+
  5494. 2259.  -     '<div class="mvs_sh1"></div>'+
  5495. 2260.  -     '<div class="mvs_sh2"></div>'+
  5496. 2261.  -   '</td><td class="mvs_side_sh">'+
  5497. 2262.  -     '<div class="mvs_side_sh_el"></div>'+
  5498. 2263.  -   '</td>'+
  5499. 2264.  -   '</tr></tbody></table></div>');
  5500. 2265.  -     var acts = geByClass1('mvs_acts', dd);
  5501. 2266.  -     for(var i in items) {
  5502. 2267.  -       var el = ce('a', {className: 'mvs_act', onclick: callback.pbind(items[i][0]), innerHTML: '<span class="mvs_act_text">'+items[i][1]+'</span>'});
  5503. 2268.  -       acts.appendChild(el)
  5504. 2269.  -     }
  5505. 2270.  -     obj.parentNode.insertBefore(dd, obj.nextSibling)
  5506. 2271.  -     debugLog(dd);
  5507. 2272.  -   }
  5508. 2273.  -   videoview.showDD(obj, dd);
  5509. 2274.  - },
  5510. 2275.  -
  5511. 2276.  - showStats: function(oid, vid) {
  5512. 2277.  -   showBox('al_stats.php', {act: 'video_stat', oid: oid, vid: vid}, {params: {width: 654}, dark: 1});
  5513. 2278.  - },
  5514. 2279.  -
  5515. 2280.  - reportFromDD: function(hash, reason) {
  5516. 2281.  -   ajax.post('reports.php', {act: 'new_report', type: 'video', reason: reason, hash: hash, oid: mvcur.mvData.oid, item_id: mvcur.mvData.vid}, {
  5517. 2282.  -     onDone: function(text) {
  5518. 2283.  -       var cont = ge('mv_report');
  5519. 2284.  -       cont.parentNode.replaceChild(ce('div', {className: 'mv_report_blocked', innerHTML: text}), cont);
  5520. 2285.  -     },
  5521. 2286.  -     showProgress: function() {
  5522. 2287.  -       var cont = ge('mv_report');
  5523. 2288.  -       addClass(cont, 'mv_report_blocked');
  5524. 2289.  -     },
  5525. 2290.  -     hideProgress: function() {
  5526. 2291.  -       var cont = ge('mv_report');
  5527. 2292.  -       removeClass(cont, 'mv_report_blocked');
  5528. 2293.  -     }
  5529. 2294.  -   });
  5530. 2295.  - },
  5531. 2296.  -
  5532. 2297.  - reportComment: function(obj, ev, commentRaw) {
  5533. 2298.  -   stManager.add(['privacy.js', 'privacy.css'], function() {
  5534. 2299.  -     return Privacy.show(obj, ev, 'report_'+commentRaw);
  5535. 2300.  -   });
  5536. 2301.  - },
  5537. 2302.  -
  5538. 2303.  - _eof: 1}, videoview = Videoview;try{stManager.done('videoview.js');}catch(e){}
  5539. ------
Advertisement
Add Comment
Please, Sign In to add comment