Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Файл - photoview.js (Старый размер - 115204 | Новый - 0):
- 0. - var Photoview = {
- 1. - blank: '/images/blank.gif',
- 2. - blankf: function() {},
- 3. - cacheSize: 3,
- 4. - allSizes: ['x', 'y', 'z'/*, 'w'*/],
- 5. - genUrl: function(base, add) {
- 6. - if (!add.match(/\.[a-z]{3}$/i)) add += '.jpg';
- 7. - if (add.match(/https?:\/\//i)) return add;
- 8. - return (base || '').replace(/\/[a-z0-9_:\.]*$/i, '') + '/' + add;
- 9. - },
- 10. - genData: function(ph, size) {
- 11. - var f = (size == 'x') ? 3 : ((size == 'y') ? 2 : ((size == 'z') ? 1 : 0)), c = ['w', 'z', 'y', 'x'].slice(f), d, s, i, l;
- 12. - for (i = 0; i < 4 - f; ++i) {
- 13. - l = c[i];
- 14. - if (d = ph[l + '_']) break;
- 15. - if (s = ph[l + '_src']) break;
- 16. - }
- 17. - if (!d) d = [s];
- 18. - return {src: Photoview.genUrl(ph.base, d[0]), width: d[2] && d[1], height: d[1] && d[2]};
- 19. - },
- 20. -
- 21. - updateArrows: function() {
- 22. - var sbw = sbWidth() + 2;
- 23. - if (cur.pvLeft) {
- 24. - cur.pvLeft.style.left = '20px';//(Math.floor((lastWindowWidth - sbw - cur.pvActualWidth - 52) / 2) - 39) + 'px';
- 25. - }
- 26. - cur.pvLeftNav.style.width = Math.floor((lastWindowWidth - sbw - cur.pvActualWidth - 52) / 2) + 'px';
- 27. - cur.pvRightNav.style.left = Math.floor((lastWindowWidth - sbw + cur.pvActualWidth + 52) / 2) + 'px';
- 28. - cur.pvRightNav.style.width = Math.floor((lastWindowWidth - sbw - cur.pvActualWidth - 52) / 2) + 'px';
- 29. - if (cur.pvClose) {
- 30. - cur.pvClose.style.left = (lastWindowWidth - sbw - 2 - 37) + 'px';//(Math.floor((lastWindowWidth - sbw + cur.pvActualWidth + 52) / 2) + 22) + 'px';
- 31. - }
- 32. - },
- 33. - updateHeight: function() {
- 34. - var h = cur.pvBox.offsetHeight + 110, sbw = Math.floor(sbWidth() / 2);
- 35. - cur.pvLeftNav.style.height = cur.pvRightNav.style.height = (h - 110) + 'px';
- 36. - window.updateWndVScroll && updateWndVScroll();
- 37. - if (!browser.mobile) return;
- 38. - var skipTop = 10 + cur.pvYOffset;
- 39. - cur.pvLeft.style.top = cur.pvClose.style.top = (cur.pvYOffset + 25) + 'px';
- 40. - if (lastWindowHeight < cur.pvYOffset + h) {
- 41. - setTimeout(function() {
- 42. - var f = ge('footer');
- 43. - f.style.height = (intval(getStyle(f, 'height')) + (cur.pvYOffset + h - lastWindowHeight)) + 'px';
- 44. - onBodyResize();
- 45. - Photoview.onResize();
- 46. - }, 1);
- 47. - }
- 48. - },
- 49. - actionInfo: function() {
- 50. - return ge('pv_action_info') || cur.pvWide.insertBefore(ce('div', {id: 'pv_action_info'}), cur.pvTags);
- 51. - },
- 52. -
- 53. - locNav: function(ch, old, nw, opts) {
- 54. - if ((cur.pvListId == 'newtag' + vk.id + (nw.rev ? '/rev' : '')) && (nw[0] == 'albums' + vk.id) && (nw.act == 'added')) {
- 55. - Photoview.hide(opts.hist);
- 56. - return false;
- 57. - }
- 58. - nw = nav.toStr(nw);
- 59. - if (nw.replace('?rev=1', '/rev') == cur.pvListId && cur.pvShown) {
- 60. - Photoview.hide(opts.hist);
- 61. - return false;
- 62. - }
- 63. - var m = nw.match(/^photo(-?\d+_\d+)\??((all=1|newtag=\d+)(&rev=1)?|(rev=1&)?tag=\d+|rev=1)?$/);
- 64. - if (!m) return;
- 65. -
- 66. - var listId = cur.pvListId;
- 67. - if (!listId || !cur.pvShown) {
- 68. - if (nav.objLoc.act == 'added') {
- 69. - listId = 'newtag' + vk.id + (nav.objLoc.rev ? '/rev' : '');
- 70. - } else {
- 71. - listId = nav.strLoc.replace('?rev=1', '/rev');
- 72. - }
- 73. - }
- 74. - var data = cur.pvData[listId];
- 75. - if (!data) return;
- 76. -
- 77. - for (var i = 0, l = data.length; i < l; ++i) {
- 78. - if (data[i] && data[i].id == m[1]) {
- 79. - Photoview.show(listId, i, false, cur.pvRoot);
- 80. - return false;
- 81. - }
- 82. - }
- 83. - },
- 84. - updateLocNav: function() {
- 85. - if (cur.pvRoot) {
- 86. - for (var i = 0, l = cur.nav.length; i < l; ++i) {
- 87. - if (cur.nav[i] == Photoview.locNav) return;
- 88. - }
- 89. - cur.nav.push(Photoview.locNav);
- 90. - } else {
- 91. - for (var i = 0, l = cur.nav.length; i < l; ++i) {
- 92. - if (cur.nav[i] == Photoview.locNav) {
- 93. - cur.nav.splice(i, 1);
- 94. - --i; --l;
- 95. - }
- 96. - }
- 97. - }
- 98. - },
- 99. -
- 100. - checkLayerVisibility: function() {
- 101. - if (cur.pvShown) return true;
- 102. -
- 103. - debugLog('layerqueue.hide from photoview');
- 104. - layerQueue.hide();
- 105. -
- 106. - addEvent(window, 'resize', Photoview.onResize);
- 107. - addEvent(document, 'keydown', Photoview.onKeyDown);
- 108. - addEvent(layerWrap, 'click', Photoview.onClick);
- 109. - boxQueue.hideAll();
- 110. - setStyle(layerBG, {opacity: ''});
- 111. - layers.show();
- 112. - layers.fullhide = Photoview.hide;
- 113. - },
- 114. - createLayer: function() {
- 115. - var colorClass = vk.pvdark ? 'pv_dark' : 'pv_light';
- 116. -
- 117. - cur.pvFixed = bodyNode.appendChild(ce('div', {className: 'pv_fixed fixed ' + colorClass, innerHTML: '\
- 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>\
- 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>\
- 120. - '}));
- 121. -
- 122. - cur.pvLeft = cur.pvFixed.firstChild;
- 123. - cur.pvClose = cur.pvLeft.nextSibling;
- 124. -
- 125. - addClass(layerWrap, colorClass);
- 126. - addClass(layerBG, colorClass);
- 127. - vkImage().src = '/images/upload.gif';
- 128. -
- 129. - var hhHide = Photoview.hhCheck() ? '' : ' style="display: none;"',
- 130. - albumsHtml = cur.pvAlbumsShown ? cur.pvAlbumsData[cur.pvAlbumsShown].html : '',
- 131. - albumHtml = cur.pvAlbumShown ? cur.pvAlbumData[cur.pvAlbumShown].html : '',
- 132. - pvVTagsHtml = cur.pvVideoTagsShown ? cur.pvVideoTagsData.html : '',
- 133. - pwStyle = cur.pvVideoTagsShown || cur.pvAlbumsShown || cur.pvAlbumShown || cur.pvPhotoTagShown ? 'display: none' : '',
- 134. - awStyle = cur.pvAlbumsShown ? '' : 'display: none',
- 135. - sawStyle = cur.pvAlbumShown ? '' : 'display: none',
- 136. - vtStyle = cur.pvVideoTagsShown ? '' : 'display: none';
- 137. - if (cur.pvPhotoTagShown) {
- 138. - albumHtml = cur.pvPhotoTagData[cur.pvPhotoTagShown].html;
- 139. - sawStyle = '';
- 140. - }
- 141. -
- 142. - layer.innerHTML = '\
- 143. - <div class="pv_cont">\
- 144. - \
- 145. - <table cellspacing="0" cellpadding="0">\
- 146. - <tr><td class="sidesh s1"><div></div></td><td>\
- 147. - <table cellspacing="0" cellpadding="0">\
- 148. - <tr><td class="sidesh s2"><div></div></td><td>\
- 149. - <table cellspacing="0" cellpadding="0">\
- 150. - <tr><td colspan="3" class="bottomsh s3"><div></div></td></tr>\
- 151. - <tr><td class="sidesh s3"><div></div></td><td>\
- 152. - \
- 153. - <div id="pv_box" onclick="cur.pvClicked = true;">\
- 154. - <a class="fl_r pv_close_link" onclick="Photoview.hide(0)">' + getLang('global_close') + '</a>\
- 155. - <div id="pv_summary"><span class="summary"></span></div>\
- 156. - <div id="pv_photo_wrap" style="' + pwStyle + '">\
- 157. - <div id="pv_tag_info" class="clear_fix"></div>\
- 158. - <div class="no_select pv_data">\
- 159. - <div id="pv_tag_frame"></div>\
- 160. - <div id="pv_tag_faded"></div>\
- 161. - <div id="pv_tag_person" onmouseout="Photoview.hideTag()"></div>\
- 162. - <div id="pv_loader"></div>\
- 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>\
- 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>\
- 165. - </div>\
- 166. - <div class="clear_fix select_fix" id="pv_comments_data">\
- 167. - <div class="fl_l wide_column">\
- 168. - <div id="pv_wide"></div>\
- 169. - <div id="pv_your_comment" class="clear clear_fix" onclick="return cancelEvent(event);">\
- 170. - <div id="pv_comment_header">' + getLang('photos_yourcomment') + '</div>\
- 171. - <textarea id="pv_comment" onkeyup="Photoview.commentChanged()" onkeypress="onCtrlEnter(event, Photoview.sendComment);"></textarea>\
- 172. - <div id="pv_comment_warn"></div>\
- 173. - <div id="pv_media_preview" class="clear_fix"></div>\
- 174. - <div id="pv_comment_submit">\
- 175. - <div class="button_blue fl_l"><button id="pv_comment_send">' + getLang('box_send') + '</button></div>\
- 176. - <div id="pv_reply_as_group" class="checkbox fl_l" onclick="checkbox(this)">\
- 177. - <div></div>' + getLang('wall_reply_as_group') + '\
- 178. - </div>\
- 179. - <div id="pv_reply_to_title" class="fl_l"></div>\
- 180. - <div id="pv_del_reply_to" class="fl_l" onclick="Photoview.commentTo()"></div>\
- 181. - <div id="pv_add_media" class="fl_r">\
- 182. - <span class="add_media_lnk">' + getLang('global_add_media') + '</span>\
- 183. - </div>\
- 184. - </div>\
- 185. - </div>\
- 186. - </div>\
- 187. - <div class="fl_r narrow_column" id="pv_narrow"></div>\
- 188. - </div>\
- 189. - </div>\
- 190. - <div id="pv_albums_wrap" style="' + awStyle + '">' + albumsHtml + '</div>\
- 191. - <div id="pv_album_wrap" '+ (cur.pvsaMini ? 'class="pv_album_wrap_mini"' : '') +' style="' + sawStyle + '">' + albumHtml + '</div>\
- 192. - <div id="pv_vtagged_wrap" style="' + vtStyle + '">' + pvVTagsHtml + '</div>\
- 193. - </div>\
- 194. - \
- 195. - </td><td class="sidesh s3"><div></div></td></tr>\
- 196. - <tr><td colspan="3" class="bottomsh s3"><div></div></td></tr></table>\
- 197. - </td><td class="sidesh s2"><div></div></td></tr>\
- 198. - <tr><td colspan="3" class="bottomsh s2"><div></div></td></tr></table>\
- 199. - </td><td class="sidesh s1"><div></div></td></tr>\
- 200. - <tr><td colspan="3" class="bottomsh s1"><div></div></td></tr></table>\
- 201. - </div>\
- 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>\
- 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>\
- 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>\
- 205. - ';
- 206. -
- 207. - if (cur.pvYourComment) {
- 208. - domPN(ge('pv_your_comment')).replaceChild(cur.pvYourComment, ge('pv_your_comment'));
- 209. - }
- 210. - extend(cur, {
- 211. - pvCont: domFC(layer),
- 212. - pvBox: ge('pv_box'),
- 213. -
- 214. - pvLeftNav: ge('pv_left_nav'),
- 215. - pvRightNav: ge('pv_right_nav'),
- 216. -
- 217. - pvPhotoWrap: ge('pv_photo_wrap'),
- 218. - pvAlbumWrap: ge('pv_album_wrap'),
- 219. - pvAlbumsWrap: ge('pv_albums_wrap'),
- 220. - pvVTagsWrap: ge('pv_vtagged_wrap'),
- 221. -
- 222. - pvSummary: domFC(ge('pv_summary')),
- 223. - pvTagInfo: ge('pv_tag_info'),
- 224. - pvLoader: ge('pv_loader'),
- 225. - pvTagFrame: ge('pv_tag_frame'),
- 226. - pvTagFaded: ge('pv_tag_faded'),
- 227. - pvTagPerson: ge('pv_tag_person'),
- 228. - pvPhoto: ge('pv_photo'),
- 229. - pvCommentsData: ge('pv_comments_data'),
- 230. -
- 231. - pvNarrow: ge('pv_narrow'),
- 232. - pvWide: ge('pv_wide'),
- 233. -
- 234. - pvHH: ge('pv_hh'),
- 235. - pvHHFg: ge('pv_hh_fg'),
- 236. -
- 237. - pvYourComment: ge('pv_your_comment'),
- 238. - pvAddMedia: domFC(ge('pv_add_media')),
- 239. - pvMediaPreview: ge('pv_media_preview'),
- 240. - pvCommentSend: ge('pv_comment_send'),
- 241. - pvComment: ge('pv_comment'),
- 242. - pvAsGroup: ge('pv_reply_as_group'),
- 243. -
- 244. - pvSwitch: ge('pv_switch')
- 245. - });
- 246. - addEvent(cur.pvPhoto, 'mousemove', Photoview.onMouseMove);
- 247. - if (browser.mobile) {
- 248. - cur.pvYOffset = intval(window.pageYOffset);
- 249. -
- 250. - cur.pvCont.style.paddingTop = cur.pvLeftNav.style.top =
- 251. - cur.pvRightNav.style.top = (cur.pvYOffset + 10) + 'px';
- 252. -
- 253. - cur.pvSwitch.style.top = cur.pvYOffset + 'px';
- 254. - }
- 255. - addEvent(layerWrap, 'scroll', Photoview.scrollResize);
- 256. -
- 257. - Photoview.updateSize();
- 258. - },
- 259. - doShowAlbums: function(ownerId, ev) {
- 260. - ownerId = intval(ownerId);
- 261. - if (ev && (ev.button == 2 || ev.which == 3)) return;
- 262. -
- 263. - clearTimeout(window.__pvhideTimer);
- 264. - if (__afterFocus) {
- 265. - return ev ? cancelEvent(ev) : false;
- 266. - }
- 267. - if (cur.pvTagger) {
- 268. - Phototag.stopTag();
- 269. - if (ev !== false) {
- 270. - return ev ? cancelEvent(ev) : false;
- 271. - }
- 272. - }
- 273. -
- 274. - var data = (cur.pvAlbumsData || {})[ownerId];
- 275. - if (!data) return;
- 276. -
- 277. - // if (window.wkLayerWrap && isVisible(window.wkLayerWrap)) {
- 278. - // wkcur.scrollTop = window.wkLayerWrap.scrollTop;
- 279. - // hide(wkLayerWrap);
- 280. - // }
- 281. -
- 282. - Photoview.checkLayerVisibility();
- 283. - cur.pvRoot = false;
- 284. - Photoview.updateLocNav();
- 285. -
- 286. - if (ev && ev.pageX && ev.pageY) {
- 287. - extend(cur, {pvOldX: ev.pageX, pvOldY: ev.pageY, pvOldT: vkNow()});
- 288. - }
- 289. -
- 290. - cur.pvShown = true;
- 291. - cur.pvAlbumsShown = ownerId;
- 292. - if (!cur.pvFixed || val('pva_owner') != ownerId) {
- 293. - extend(cur, {
- 294. - pvaOffset: data.opts.offset,
- 295. - pvaCount: data.opts.count,
- 296. - pvaPhotosOffset: data.opts.photos_offset,
- 297. - pvaPhotosCount: data.opts.photos_count,
- 298. - pvShowAllAlbums: false
- 299. - });
- 300. - }
- 301. - if (!cur.pvFixed) {
- 302. - Photoview.createLayer();
- 303. - } else {
- 304. - if (val('pva_owner') != ownerId) {
- 305. - val(cur.pvAlbumsWrap, data.html);
- 306. - }
- 307. - if (!isVisible(cur.pvAlbumsWrap)) {
- 308. - hide(cur.pvPhotoWrap, cur.pvAlbumWrap, cur.pvVTagsWrap);
- 309. - show(cur.pvAlbumsWrap);
- 310. - Photoview.updateSize();
- 311. - layerWrap.scrollTop = val('pva_scroll');
- 312. - }
- 313. - }
- 314. -
- 315. - cur.pvSummary.innerHTML = data.opts.summary;
- 316. -
- 317. - if (cur.pvListId && cur.pvListId != 'temp') {
- 318. - extend(cur, {
- 319. - pvOldListId: cur.pvListId,
- 320. - pvOldIndex: cur.pvIndex
- 321. - });
- 322. - var old = (cur.pvListId || '').split('/');
- 323. - if (old[0]) {
- 324. - Photoview.showRepeat(ge(old[0]));
- 325. - }
- 326. -
- 327. - show(cur.pvLeft, cur.pvLeftNav, cur.pvRightNav, cur.pvClose);
- 328. - } else {
- 329. - hide(cur.pvLeft, cur.pvLeftNav, cur.pvRightNav, cur.pvClose);
- 330. - if (!browser.msie || browser.version > 8) cur.pvClicked = false;
- 331. - }
- 332. - cur.pvListId = false;
- 333. -
- 334. - var nl = extend(nav.objLoc, {z: 'albums' + cur.pvAlbumsShown});
- 335. - if (nav.strLoc != nav.toStr(nl)) {
- 336. - if (!cur.pvNoHistory) {
- 337. - ++cur.pvHistoryLength;
- 338. - }
- 339. - nav.setLoc(nl);
- 340. - }
- 341. -
- 342. - return ev ? cancelEvent(ev) : false;
- 343. - },
- 344. - jumpToAlbums: function(returning) {
- 345. - if (cur.pvListId == 'temp') {
- 346. - cur.pvCancelLoad();
- 347. - if (cur.pvJumpTo.z == 'albums' + val('pva_owner') && cur.pvJumpTo.z == nav.objLoc.z) {
- 348. - showAlbums(val('pva_owner'), {noHistory: true});
- 349. - return;
- 350. - }
- 351. - }
- 352. - if (returning) {
- 353. - cur.pvListId = false;
- 354. - }
- 355. - extend(cur, {
- 356. - pvJumpFrom: false,
- 357. - pvJumpSteps: 0
- 358. - });
- 359. - nav.change(cur.pvJumpTo);
- 360. - },
- 361. - jumpToAlbum: function(returning) {
- 362. - if (cur.pvListId == 'temp') {
- 363. - cur.pvCancelLoad();
- 364. - if (cur.pvJumpTo.z == 'album' + val('pvsa_album') && cur.pvJumpTo.z == nav.objLoc.z) {
- 365. - showAlbum(val('pvsa_album'), {noHistory: true});
- 366. - return;
- 367. - }
- 368. - }
- 369. - if (returning) {
- 370. - cur.pvListId = false;
- 371. - }
- 372. - extend(cur, {
- 373. - pvJumpFrom: false,
- 374. - pvJumpSteps: 0
- 375. - });
- 376. - nav.change(cur.pvJumpTo);
- 377. - },
- 378. - jumpToTagged: function(returning) {
- 379. - if (cur.pvListId == 'temp') {
- 380. - cur.pvCancelLoad();
- 381. - if (cur.pvJumpTo.z == 'tag' + val('pvsa_tag') && cur.pvJumpTo.z == nav.objLoc.z) {
- 382. - showTagged(val('pvsa_tag'), {noHistory: true});
- 383. - return;
- 384. - }
- 385. - }
- 386. - if (cur.pvJumpTo.z == 'tag' + val('pvsa_tag')) {
- 387. - cur.pvJumpTo.z = 'photo_' + cur.pvJumpTo.z;
- 388. - }
- 389. - if (returning) {
- 390. - cur.pvListId = false;
- 391. - }
- 392. - extend(cur, {
- 393. - pvJumpFrom: false,
- 394. - pvJumpSteps: 0
- 395. - });
- 396. - nav.change(cur.pvJumpTo);
- 397. - },
- 398. - doShowAlbum: function(albumRaw, ev) {
- 399. - if (ev && (ev.button == 2 || ev.which == 3)) return;
- 400. -
- 401. - clearTimeout(window.__pvhideTimer);
- 402. - if (__afterFocus) {
- 403. - return ev ? cancelEvent(ev) : false;
- 404. - }
- 405. - if (cur.pvTagger) {
- 406. - Phototag.stopTag();
- 407. - if (ev !== false) {
- 408. - return ev ? cancelEvent(ev) : false;
- 409. - }
- 410. - }
- 411. -
- 412. - var data = (cur.pvAlbumData || {})[albumRaw];
- 413. - if (!data) return;
- 414. -
- 415. - // if (window.wkLayerWrap && isVisible(window.wkLayerWrap)) {
- 416. - // wkcur.scrollTop = window.wkLayerWrap.scrollTop;
- 417. - // hide(wkLayerWrap);
- 418. - // }
- 419. -
- 420. - Photoview.checkLayerVisibility();
- 421. - cur.pvRoot = false;
- 422. - Photoview.updateLocNav();
- 423. -
- 424. - if (ev && ev.pageX && ev.pageY) {
- 425. - extend(cur, {pvOldX: ev.pageX, pvOldY: ev.pageY, pvOldT: vkNow()});
- 426. - }
- 427. -
- 428. - cur.pvShown = true;
- 429. - cur.pvAlbumShown = albumRaw;
- 430. - if (!cur.pvFixed || val('pvsa_album') != albumRaw) {
- 431. - extend(cur, {
- 432. - pvsaOffset: data.opts.offset,
- 433. - pvsaCount: data.opts.count,
- 434. - pvsaMini: data.opts.count <= 40
- 435. - });
- 436. - }
- 437. - if (!cur.pvFixed) {
- 438. - Photoview.createLayer();
- 439. - } else {
- 440. - toggleClass(cur.pvAlbumWrap, 'pv_album_wrap_mini', cur.pvsaMini);
- 441. - if (val('pvsa_album') != albumRaw) {
- 442. - val(cur.pvAlbumWrap, data.html);
- 443. - }
- 444. - if (!isVisible(cur.pvAlbumWrap)) {
- 445. - hide(cur.pvPhotoWrap, cur.pvAlbumsWrap, cur.pvVTagsWrap);
- 446. - show(cur.pvAlbumWrap);
- 447. - Photoview.updateSize();
- 448. - layerWrap.scrollTop = val('pvsa_scroll');
- 449. - }
- 450. - }
- 451. -
- 452. - val(cur.pvSummary, data.opts.summary);
- 453. -
- 454. - if (cur.pvListId && cur.pvListId != 'temp') {
- 455. - extend(cur, {
- 456. - pvOldListId: cur.pvListId,
- 457. - pvOldIndex: cur.pvIndex
- 458. - });
- 459. - var old = (cur.pvListId || '').split('/');
- 460. - if (old[0]) {
- 461. - Photoview.showRepeat(ge(old[0]));
- 462. - }
- 463. -
- 464. - show(cur.pvLeft, cur.pvLeftNav, cur.pvRightNav, cur.pvClose);
- 465. - } else {
- 466. - hide(cur.pvLeft, cur.pvLeftNav, cur.pvRightNav, cur.pvClose);
- 467. - if (!browser.msie || browser.version > 8) cur.pvClicked = false;
- 468. - }
- 469. - cur.pvListId = false;
- 470. -
- 471. - var nl = extend(nav.objLoc, {z: 'album' + cur.pvAlbumShown});
- 472. - if (nav.strLoc != nav.toStr(nl)) {
- 473. - if (!cur.pvNoHistory) {
- 474. - ++cur.pvHistoryLength;
- 475. - }
- 476. - nav.setLoc(nl);
- 477. - }
- 478. -
- 479. - return ev ? cancelEvent(ev) : false;
- 480. - },
- 481. - doShowTagged: function(ownerId, ev) {
- 482. - ownerId = intval(ownerId);
- 483. - if (ev && (ev.button == 2 || ev.which == 3)) return;
- 484. -
- 485. - clearTimeout(window.__pvhideTimer);
- 486. - if (__afterFocus) {
- 487. - return ev ? cancelEvent(ev) : false;
- 488. - }
- 489. - if (cur.pvTagger) {
- 490. - Phototag.stopTag();
- 491. - if (ev !== false) {
- 492. - return ev ? cancelEvent(ev) : false;
- 493. - }
- 494. - }
- 495. -
- 496. - var data = (cur.pvPhotoTagData || {})[ownerId];
- 497. - if (!data) return;
- 498. -
- 499. - // if (window.wkLayerWrap && isVisible(window.wkLayerWrap)) {
- 500. - // wkcur.scrollTop = window.wkLayerWrap.scrollTop;
- 501. - // hide(wkLayerWrap);
- 502. - // }
- 503. -
- 504. - Photoview.checkLayerVisibility();
- 505. - cur.pvRoot = false;
- 506. - Photoview.updateLocNav();
- 507. -
- 508. - if (ev && ev.pageX && ev.pageY) {
- 509. - extend(cur, {pvOldX: ev.pageX, pvOldY: ev.pageY, pvOldT: vkNow()});
- 510. - }
- 511. -
- 512. - cur.pvShown = true;
- 513. - cur.pvPhotoTagShown = ownerId;
- 514. - if (!cur.pvFixed || val('pvsa_tag') != ownerId) {
- 515. - extend(cur, {
- 516. - pvsaOffset: data.opts.offset,
- 517. - pvsaCount: data.opts.count,
- 518. - pvsaMini: data.opts.count <= 40
- 519. - });
- 520. - }
- 521. - if (!cur.pvFixed) {
- 522. - Photoview.createLayer();
- 523. - } else {
- 524. - toggleClass(cur.pvAlbumWrap, 'pv_album_wrap_mini', cur.pvsaMini);
- 525. - if (val('pvsa_tag') != ownerId) {
- 526. - val(cur.pvAlbumWrap, data.html);
- 527. - }
- 528. - if (!isVisible(cur.pvAlbumWrap)) {
- 529. - hide(cur.pvPhotoWrap, cur.pvAlbumsWrap, cur.pvVTagsWrap);
- 530. - show(cur.pvAlbumWrap);
- 531. - Photoview.updateSize();
- 532. - layerWrap.scrollTop = val('pvsa_scroll');
- 533. - }
- 534. - }
- 535. -
- 536. - val(cur.pvSummary, data.opts.summary);
- 537. -
- 538. - if (cur.pvListId && cur.pvListId != 'temp') {
- 539. - extend(cur, {
- 540. - pvOldListId: cur.pvListId,
- 541. - pvOldIndex: cur.pvIndex
- 542. - });
- 543. - var old = (cur.pvListId || '').split('/');
- 544. - if (old[0]) {
- 545. - Photoview.showRepeat(ge(old[0]));
- 546. - }
- 547. -
- 548. - show(cur.pvLeft, cur.pvLeftNav, cur.pvRightNav, cur.pvClose);
- 549. - } else {
- 550. - hide(cur.pvLeft, cur.pvLeftNav, cur.pvRightNav, cur.pvClose);
- 551. - if (!browser.msie || browser.version > 8) cur.pvClicked = false;
- 552. - }
- 553. - cur.pvListId = false;
- 554. -
- 555. - var nl = extend(nav.objLoc, {z: 'photo_tag' + cur.pvPhotoTagShown});
- 556. - if (nav.strLoc != nav.toStr(nl)) {
- 557. - if (!cur.pvNoHistory) {
- 558. - ++cur.pvHistoryLength;
- 559. - }
- 560. - nav.setLoc(nl);
- 561. - }
- 562. -
- 563. - return ev ? cancelEvent(ev) : false;
- 564. - },
- 565. - doShowVideoTags: function(ownerId, ev) {
- 566. - if (ev && (ev.button == 2 || ev.which == 3)) return;
- 567. -
- 568. - clearTimeout(window.__pvhideTimer);
- 569. - if (__afterFocus) {
- 570. - return ev ? cancelEvent(ev) : false;
- 571. - }
- 572. - if (cur.pvTagger) {
- 573. - Phototag.stopTag();
- 574. - if (ev !== false) {
- 575. - return ev ? cancelEvent(ev) : false;
- 576. - }
- 577. - }
- 578. -
- 579. - var data = cur.pvVideoTagsData;
- 580. - if (!data) return;
- 581. -
- 582. - // if (window.wkLayerWrap && isVisible(window.wkLayerWrap)) {
- 583. - // wkcur.scrollTop = window.wkLayerWrap.scrollTop;
- 584. - // hide(wkLayerWrap);
- 585. - // }
- 586. -
- 587. - Photoview.checkLayerVisibility();
- 588. - cur.pvRoot = false;
- 589. - Photoview.updateLocNav();
- 590. -
- 591. - if (ev && ev.pageX && ev.pageY) {
- 592. - extend(cur, {pvOldX: ev.pageX, pvOldY: ev.pageY, pvOldT: vkNow()});
- 593. - }
- 594. -
- 595. - cur.pvShown = true;
- 596. - cur.pvVideoTagsShown = ownerId;
- 597. - if (!cur.pvFixed || val('pvsa_vtag') != ownerId) {
- 598. - extend(cur, {
- 599. - pvsaOffset: data.opts.offset,
- 600. - pvsaCount: data.opts.count
- 601. - });
- 602. - }
- 603. - if (data.opts.lang) {
- 604. - cur.lang = extend(cur.lang || {}, data.opts.lang);
- 605. - }
- 606. - if (!cur.pvFixed) {
- 607. - Photoview.createLayer();
- 608. - } else {
- 609. - if (val('pvsa_vtag') != ownerId) {
- 610. - val(cur.pvVTagsWrap, data.html);
- 611. - }
- 612. - if (!isVisible(cur.pvVTagsWrap)) {
- 613. - hide(cur.pvPhotoWrap, cur.pvAlbumsWrap, cur.pvAlbumWrap);
- 614. - show(cur.pvVTagsWrap);
- 615. - Photoview.updateSize();
- 616. - layerWrap.scrollTop = val('pvsa_scroll');
- 617. - }
- 618. - }
- 619. -
- 620. - val(cur.pvSummary, data.opts.summary);
- 621. -
- 622. - hide(cur.pvLeft, cur.pvLeftNav, cur.pvRightNav, cur.pvClose);
- 623. - cur.pvListId = false;
- 624. - domPN(cur.pvSummary).style.width = '606px';
- 625. -
- 626. - var nl = extend(nav.objLoc, {z: 'video_tag' + cur.pvVideoTagsShown});
- 627. - if (nav.strLoc != nav.toStr(nl)) {
- 628. - if (!cur.pvNoHistory) {
- 629. - ++cur.pvHistoryLength;
- 630. - }
- 631. - nav.setLoc(nl);
- 632. - }
- 633. -
- 634. - return ev ? cancelEvent(ev) : false;
- 635. - },
- 636. - show: function(listId, index, ev, root) {
- 637. - if (ev && (ev.button == 2 || ev.which == 3)) return;
- 638. -
- 639. - clearTimeout(window.__pvhideTimer);
- 640. -
- 641. - if (listId == 'temp' && cur.pvShown) {
- 642. - if (cur.pvListId && cur.pvListId != 'temp') return;
- 643. - cur.pvWasShown = true;
- 644. - } else {
- 645. - cur.pvWasShown = false;
- 646. - }
- 647. - if (__afterFocus) {
- 648. - return ev ? cancelEvent(ev) : false;
- 649. - }
- 650. - if (cur.pvTagger) {
- 651. - Phototag.stopTag();
- 652. - if (ev !== false) {
- 653. - return ev ? cancelEvent(ev) : false;
- 654. - }
- 655. - }
- 656. - if (listId === false) {
- 657. - if (cur.pvAlbumsShown || cur.pvAlbumShown || cur.pvPhotoTagShown) {
- 658. - if (cur.pvOldListId) {
- 659. - extend(cur, {
- 660. - pvJumpTo: cur.pvOldJumpTo,
- 661. - pvJumpFrom: cur.pvOldJumpFrom,
- 662. - pvJumpSteps: cur.pvOldJumpSteps
- 663. - });
- 664. - if (index == cur.pvOldIndex + 1) ++cur.pvOldIndex;
- 665. - return Photoview.show(cur.pvOldListId, cur.pvOldIndex, ev, root);
- 666. - } else {
- 667. - hide(cur.pvLeft, cur.pvLeftNav, cur.pvRightNav, cur.pvClose);
- 668. - }
- 669. - }
- 670. - listId = cur.pvListId;
- 671. - }
- 672. - var count = ((cur.pvData || {})[listId] || {}).length, otherList = (listId != cur.pvListId);
- 673. - if (!count) return;
- 674. -
- 675. - if (ev && ev.pageX && ev.pageY) {
- 676. - extend(cur, {pvOldX: ev.pageX, pvOldY: ev.pageY, pvOldT: vkNow()});
- 677. - }
- 678. -
- 679. - if ((cur.pvOptions || {}).queue) {
- 680. - debugLog('pushing in photoview.show');
- 681. - layerQueue.push();
- 682. - cur.pvOptions.queue = false;
- 683. - cur.pvHistoryLength = 0;
- 684. - }
- 685. -
- 686. - // if (window.wkLayerWrap && isVisible(window.wkLayerWrap)) {
- 687. - // wkcur.scrollTop = window.wkLayerWrap.scrollTop;
- 688. - // hide(wkLayerWrap);
- 689. - // }
- 690. -
- 691. - if (!Photoview.checkLayerVisibility()) {
- 692. - otherList = true;
- 693. - }
- 694. -
- 695. - var newIndex = index + (index < 0 ? count : (index >= count ? (-count) : 0));
- 696. - var direction = otherList ? 1 : (cur.pvIndex > index ? -1 : 1);
- 697. -
- 698. - if (!otherList && !cur.pvCanvas) {
- 699. - if (cur.pvJumpTo) {
- 700. - cur.pvJumpSteps += (index - cur.pvIndex);
- 701. - var needJump = (newIndex === cur.pvJumpFrom && cur.pvJumpSteps >= count);
- 702. - if (needJump) {
- 703. - extend(cur, {
- 704. - pvOldJumpFrom: cur.pvJumpFrom,
- 705. - pvOldJumpSteps: cur.pvJumpSteps - (index - cur.pvIndex),
- 706. - pvOldJumpTo: cur.pvJumpTo
- 707. - });
- 708. - return Photoview.jumpToAlbums(cur.pvJumpSteps < 0);
- 709. - }
- 710. - if (direction > 0) {
- 711. - if (newIndex < cur.pvJumpFrom && newIndex + 4 > cur.pvJumpFrom || newIndex < cur.pvJumpFrom + count && newIndex + 4 > cur.pvJumpFrom + count) {
- 712. - vkImage().src = stManager._srcPrefix('.css')+'/images/icons/post_hh'+(window.devicePixelRatio >= 2 ? '_2x' : '')+'.png?2';
- 713. - var m = cur.pvJumpTo.z.match(/^albums(-?\d+)$/);
- 714. - if (m) {
- 715. - if (!cur.pvAlbumsData) cur.pvAlbumsData = {};
- 716. - if (!cur.pvAlbumsData[m[1]]) {
- 717. - cur.pvAlbumsData[m[1]] = 'loading';
- 718. - ajax.post('al_photos.php', {act: 'show_albums', owner: m[1], other: 1}, {onDone: Photoview.loadedAlbums});
- 719. - }
- 720. - }
- 721. - }
- 722. - }
- 723. - if (cur.pvJumpSteps <= -count) {
- 724. - cur.pvJumpSteps += count;
- 725. - }
- 726. - }
- 727. - if (count == 1 && index != cur.pvIndex && listId != 'temp') {
- 728. - Photoview.hide();
- 729. - return ev ? cancelEvent(ev) : false;
- 730. - }
- 731. - }
- 732. -
- 733. - if (otherList && listId != 'temp') {
- 734. - if (cur.pvJumpFrom === false) {
- 735. - cur.pvJumpFrom = newIndex;
- 736. - }
- 737. - cur.pvRoot = root;
- 738. - Photoview.updateLocNav();
- 739. - }
- 740. -
- 741. - index = newIndex;
- 742. -
- 743. - var ph = cur.pvData[listId][index];
- 744. -
- 745. - if (!ph || !ph.x_ && !ph.x_src) return;
- 746. -
- 747. - cur.pvIndex = index;
- 748. - cur.pvShown = true;
- 749. - cur.pvAlbumsShowing = cur.pvAlbumsShown = false;
- 750. - cur.pvAlbumShowing = cur.pvAlbumShown = false;
- 751. - cur.pvPhotoTagShowing = cur.pvPhotoTagShown = false;
- 752. - cur.pvVideoTagShowing = cur.pvVideoTagsShown = false;
- 753. - cur.pvListId = listId;
- 754. - if (!cur.pvFixed) {
- 755. - Photoview.createLayer();
- 756. - }
- 757. - cur.pvCurData = Photoview.genData(ph, vk.pvbig ? (cur.pvVeryBig ? (cur.pvVeryBig > 1 ? 'z' : 'z') : 'y') : 'x');
- 758. - if (cur.pvCurrent) {
- 759. - cur.pvCurrent.onload = Photoview.blankf;
- 760. - cur.pvCurrent.src = Photoview.blank;
- 761. - }
- 762. - delete cur.pvCurrent;
- 763. - cur.pvCurrent = vkImage();
- 764. - cur.pvCurrent.onload = Photoview.preload.pbind(index, direction);
- 765. - cur.pvCurrent.src = cur.pvCurData.src;
- 766. -
- 767. - if (otherList) {
- 768. - var needControls = (count > 1) || ((cur.pvJumpTo || {}).z == 'albums' + val('pva_owner')) || ((cur.pvJumpTo || {}).z == 'album' + val('pvsa_album'));
- 769. - (needControls ? show : hide)(cur.pvLeft, cur.pvLeftNav, cur.pvRightNav, cur.pvClose);
- 770. - }
- 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'));
- 772. -
- 773. - cur.pvCurPhoto = ph;
- 774. - if (!cur.pvCurData.width || !cur.pvCurData.height) {
- 775. - cur.pvCurData = cur.pvCurrent;
- 776. - cur.pvTimerPassed = 0;
- 777. - clearTimeout(cur.pvTimer);
- 778. - cur.pvTimer = setTimeout(Photoview.doShow, 0);
- 779. - } else {
- 780. - Photoview.doShow();
- 781. - }
- 782. -
- 783. - return ev ? cancelEvent(ev) : false;
- 784. - },
- 785. - doShow: function() {
- 786. - var img = cur.pvCurData;
- 787. - if ((!img.width || !img.height) && cur.pvTimerPassed < 5000) {
- 788. - clearTimeout(cur.pvTimer);
- 789. - cur.pvTimerPassed += 100;
- 790. - cur.pvTimer = setTimeout(Photoview.doShow, 100);
- 791. - return;
- 792. - }
- 793. - if (!cur.pvShown) return;
- 794. -
- 795. - if (cur.pvCanvas) {
- 796. - cur.pvScrWidth = cur.pvCanvas.offsetWidth;
- 797. - cur.pvScrHeight = cur.pvCanvas.offsetHeight;
- 798. -
- 799. - var c = 1, t = 0, l = 0, w = img.width || 604, h = img.height || 453, i = vkImage();
- 800. - // if (w > cur.pvScrWidth) {
- 801. - c = cur.pvScrWidth / w;
- 802. - // }
- 803. - if (h * c > cur.pvScrHeight) {
- 804. - c = cur.pvScrHeight / h;
- 805. - }
- 806. - if (c > 1.25) c = 1.25;
- 807. - cur.pvFSWidth = w = Math.floor(w * c);
- 808. - cur.pvFSHeight = h = Math.floor(h * c);
- 809. - cur.pvFSTop = t = Math.floor((cur.pvScrHeight - h) / 2);
- 810. -
- 811. - val(domFC(cur.pvCanvas), '<img style="margin-top: ' + t + 'px; width: ' + w + 'px; height: ' + h + 'px;" src="' + img.src + '" />');
- 812. - i.onload = Photoview.fullscreenOnLoad;
- 813. - i.src = img.src;
- 814. -
- 815. - if (window.FullscreenPV) FullscreenPV.updateInfo();
- 816. - return;
- 817. - }
- 818. -
- 819. - if (isVisible(cur.pvAlbumsWrap)) {
- 820. - val('pva_scroll', layerWrap.scrollTop);
- 821. - hide(cur.pvAlbumsWrap);
- 822. - show(cur.pvPhotoWrap);
- 823. - Photoview.updateSize();
- 824. - }
- 825. - if (isVisible(cur.pvAlbumWrap)) {
- 826. - val('pvsa_scroll', layerWrap.scrollTop);
- 827. - hide(cur.pvAlbumWrap);
- 828. - show(cur.pvPhotoWrap);
- 829. - Photoview.updateSize();
- 830. - }
- 831. -
- 832. - var lnk = cur.pvPhoto, c = 1, marginTop = 0, w = img.width || 604, h = img.height || 453;
- 833. - if (vk.pvbig) {
- 834. - if (w > cur.pvWidth) {
- 835. - c = cur.pvWidth / w;
- 836. - }
- 837. - if (h * c > cur.pvHeight) {
- 838. - c = cur.pvHeight / h;
- 839. - }
- 840. - }
- 841. - marginTop = positive(Math.floor((403 - h * c) / 2));
- 842. - cur.pvPhWidth = Math.floor(w * c);
- 843. - cur.pvPhHeight = Math.floor(h * c);
- 844. - cur.pvActualWidth = Math.max(cur.pvPhWidth, 604);
- 845. - if (h * c >= 453) {
- 846. - lnk.style.height = Math.floor(h * c) + 'px';
- 847. - } else {
- 848. - lnk.style.height = Math.max(400, cur.pvPhHeight)+'px';
- 849. - }
- 850. -
- 851. - if (vk.pvbig) {
- 852. - cur.pvCont.style.width = (cur.pvActualWidth + 154) + 'px';
- 853. - domPN(cur.pvSummary).style.width = (cur.pvActualWidth - 4) + 'px';
- 854. - }
- 855. -
- 856. - if (cur.pvTagger) Phototag.stopTag();
- 857. - Photoview.hideTag(true);
- 858. -
- 859. - if (cur.pvLoader) {
- 860. - hide(cur.pvLoader);
- 861. - delete(cur.pvLoader);
- 862. - }
- 863. -
- 864. - imgOpts = '';
- 865. -
- 866. - var ph = cur.pvCurPhoto, notAvail = (ph.commshown >= 0) ? false : (-ph.commshown);
- 867. -
- 868. - if (!cur.pvHHMove && Photoview.hhCheck() && !notAvail) {
- 869. - addEvent(layer, 'mousemove', Photoview.photoAct);
- 870. - cur.pvHHMove = true;
- 871. - }
- 872. -
- 873. - cur.pvHH.style[vk.rtl ? 'marginRight' : 'marginLeft'] = Math.ceil((cur.pvActualWidth + 50 - 72) / 2) + 'px';
- 874. -
- 875. - lnk.innerHTML = '<img '+imgOpts+' style="width: ' + cur.pvPhWidth + 'px; height: ' + cur.pvPhHeight + 'px; margin-top: ' + marginTop + 'px;" src="' + img.src + '" />';
- 876. -
- 877. - layerWrap.scrollTop = 0;
- 878. - if (cur.pvListId == 'temp') {
- 879. - hide(cur.pvCommentsData);
- 880. - Photoview.updateArrows();
- 881. - return;
- 882. - }
- 883. -
- 884. - (ph.liked ? addClass : removeClass)(cur.pvHH, 'pvs_hh_liked');
- 885. - Photoview.hhOut(cur.pvHHFg);
- 886. -
- 887. - if (window.tooltips) {
- 888. - tooltips.destroyAll(cur.pvBox);
- 889. - }
- 890. -
- 891. - var taglnkst = (!ph.taginfo && ph.actions.tag && ph.tags[0] < cur.pvMaxTags) ? '' : ' style="display: none"';
- 892. - var shareacts = [], fs = false;
- 893. - if (vk.id) shareacts.push(['pvs_send', getLang('photos_send_to_fr'), 'onclick="Photoview.sendPhoto()"']);
- 894. - if (ph.actions.save) shareacts.push(['pvs_save', getLang('photos_save_to_alb'), 'onclick="Photoview.savePhoto()"']);
- 895. - shareacts.push(['pvs_down', getLang('photos_download_hq'), 'target="_blank" href="' + Photoview.genData(ph, 'w').src + /* '?dl=1' + */'"']);
- 896. -
- 897. - var share = '', l = shareacts.length, sprg = '<div id="pv_share_prg" class="progress fl_r"></div>';
- 898. - if (l < 1) {
- 899. - share = '';
- 900. - } else if (l == 1) {
- 901. - share = '<a ' + shareacts[0][2] + '>' + sprg + shareacts[0][1] + '</a>';
- 902. - } else {
- 903. - var shareRows = '';
- 904. - for (var i = 0; i < l; ++i) {
- 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>';
- 906. - }
- 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'));
- 908. - }
- 909. -
- 910. - if (ph.actions.edit/* & 2*/) {
- 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>';
- 912. - } else {
- 913. - photoEditAct = '';
- 914. - }
- 915. - var actsHtml = share;
- 916. - if (ph.actions.spam) {
- 917. - //actsHtml += '<a id="pv_spam_link" onclick="Photoview.spamPhoto(this.firstChild)"><div class="progress fl_r"></div>' + getLang('its_spam') + '</a>';
- 918. - var reportRows = '';
- 919. - var items = cur.pvReasons;
- 920. - for(var i in items) {
- 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>'
- 922. -
- 923. - }
- 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'));
- 925. - }
- 926. - if (ph.actions.del) {
- 927. - actsHtml += '<a id="pv_delete_link" onclick="Photoview.deletePhoto()"><div class="progress fl_r" id="pv_delete_progress"></div>' + getLang('global_delete') + '</a>';
- 928. - }
- 929. - if (ph.actions.rot) {
- 930. - actsHtml += '<div id="pv_rotate"><div id="pv_rotate_progress" class="progress fl_r"></div>' + getLang('photos_rotate') + '\
- 931. - <span onclick="Photoview.rotatePhoto(1)" class="right"></span>\
- 932. - <span onclick="Photoview.rotatePhoto(-1)" class="left"></span>\
- 933. - <form method="POST" target="pv_rotate_frame" name="pv_rotate_form" id="pv_rotate_form"></form>\
- 934. - </div>';
- 935. - }
- 936. -
- 937. - if (img.width < 200 || img.height < 200) {
- 938. - ph.actions.prof = false;
- 939. - ph.actions.dialog = false;
- 940. - }
- 941. - cur.pvNarrow.innerHTML = '\
- 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>' : '') + '\
- 943. - ' + (ph.author != 'NA' ? '<div class="pv_info">' + getLang('photos_author') + '</div><div id="pv_author">' + ph.author + '</div>' : '') + '\
- 944. - <div id="pv_actions">\
- 945. - ' + (fs ? '<a onclick="Photoview.fullscreen()">' + getLang('photos_fullscreen') + '</a>' : '') + '\
- 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>\
- 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>') : '') + '\
- 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>') : '') + '\
- 949. - ' + photoEditAct + '\
- 950. - ' + ((ph.y_src || ph.y_) ? ('<a id="pv_large_link" onclick="Photoview.switchSize()">' + getLang(vk.pvbig ? 'photos_smaller' : 'photos_larger') + '</a>') : '') + '\
- 951. - ' + actsHtml + '\
- 952. - </div>';
- 953. -
- 954. - var likeop = (ph.liked ? 1 : 0.4), likest = browser.msie ? ('filter: alpha(opacity=' + Math.floor(likeop * 100) + ')') : ('opacity: ' + likeop);
- 955. -
- 956. - var commstyle = '', commshown = '', commlink = '', commclass = '',
- 957. - commslikes = cur.pvCommsLikes[ph.id], comms = commslikes[0], likes = commslikes[1];;
- 958. - if (ph.commcount > ph.commshown) {
- 959. - commshown = getLang('photos_show_prev_comments', ph.commcount - ph.commshown);
- 960. - } else {
- 961. - commstyle = ' style="display: none"';
- 962. - }
- 963. -
- 964. - Wall.cancelEdit(true);
- 965. -
- 966. - var additional = notAvail ? '<div class="clear">' + getLang('photos_in_closed_album') + '</div>' : '\
- 967. - <div id="pv_comments_header" class="clear ' + commclass + '"' + commstyle + ' onclick="Photoview.comments()">\
- 968. - <div>' + commshown + '</div><div id="pv_comments_progress" class="progress"></div>\
- 969. - </div>\
- 970. - <div id="pv_comments" class="clear wall_module">' + (comms.tagName ? '' : comms) + '</div>', commsNode;
- 971. -
- 972. - var tagsst = ph.tagshtml ? '' : ' style="display: none"',
- 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>',
- 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>') : '',
- 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>') : '';
- 976. - cur.pvWide.innerHTML = '\
- 977. - <div id="pv_desc" style="' + ((ph.actions.edit & 1 || ph.desc) ? '' : 'display: none') + '">' + descText + '</div>\
- 978. - <div id="pv_place">' + placeText + '</div>\
- 979. - <div id="pv_tags"' + tagsst + '>' + getLang('photos_onthisphoto') + ': ' + ph.tagshtml + '</div>\
- 980. - <div id="pv_inlineedit_prg" class="fl_r progress"></div>\
- 981. - <div id="pv_date_wrap" class="fl_l">' + getLang('photos_added') + ' <span id="pv_date">' + ph.date + '</span></div>\
- 982. - ' + addPlace + (cur.pvNoLikes ? '' : '<span class="divider fl_l">|</span>\
- 983. - <div id="pv_like_wrap" class="fl_l" onmouseover="Photoview.likeOver()" onmouseout="Photoview.likeOut()" onclick="Photoview.like()">\
- 984. - <span class="fl_l" id="pv_like_link">' + getLang('photos_i_like') + '</span>\
- 985. - <i class="fl_l' + (likes ? '' : ' nolikes') + '" id="pv_like_icon" style="' + likest + '"></i>\
- 986. - <span id="pv_like_count" class="fl_l">' + (likes || '') + '</span>\
- 987. - </div>') + (notAvail == 2 ? '' : additional);
- 988. - if (comms.tagName) {
- 989. - each(geByClass('page_gif_loading', comms), function() { Page.hideGif(this, false); });
- 990. - commsNode = ge('pv_comments');
- 991. - domPN(commsNode).replaceChild(comms, commsNode);
- 992. - }
- 993. -
- 994. - extend(cur, {
- 995. - pvTagLink: ge('pv_tag_link'),
- 996. - pvLikeIcon: ge('pv_like_icon'),
- 997. - pvLikeLink: ge('pv_like_link'),
- 998. - pvDesc: ge('pv_desc'),
- 999. - pvTags: ge('pv_tags'),
- 1000. - pvEditing: false
- 1001. - });
- 1002. -
- 1003. - if (ph.deleted || !ph.author) {
- 1004. - cleanElems('pv_confirm_tag', 'pv_delete_tag', 'pv_prof_cancel', 'pv_prof_done');
- 1005. - if (ph.deleted) {
- 1006. - cur.pvTagInfo.innerHTML = ph.deleted;
- 1007. - show(cur.pvTagInfo);
- 1008. - }
- 1009. - hide(cur.pvCommentsData, cur.pvHH);
- 1010. - } else if (ph.taginfo) {
- 1011. - cleanElems('pv_confirm_tag', 'pv_delete_tag', 'pv_prof_cancel', 'pv_prof_done');
- 1012. - cur.pvTagInfo.innerHTML = '\
- 1013. - <table cellspacing="0" cellpadding="0"><tr>\
- 1014. - <td class="info">' + ph.taginfo + '</td>\
- 1015. - <td><nobr><div class="button_blue"><button id="pv_confirm_tag">' + getLang('photos_confirm_tag') + '</button></div></td>\
- 1016. - <td><nobr><div class="button_gray"><button id="pv_delete_tag">' + getLang('photos_delete_tag') + '</button></div></td>\
- 1017. - <td><div id="pv_tag_handling" class="progress"></div></td>\
- 1018. - </tr></table>';
- 1019. - show(cur.pvTagInfo, cur.pvCommentsData);
- 1020. - if (Photoview.hhCheck()) show(cur.pvHH);
- 1021. - ge('pv_confirm_tag').onclick = Photoview.confirmTag.pbind(ph.tagid);
- 1022. - ge('pv_delete_tag').onclick = Photoview.deleteTag.pbind(ph.tagid);
- 1023. - } else {
- 1024. - hide(cur.pvTagInfo);
- 1025. - show(cur.pvCommentsData);
- 1026. - if (Photoview.hhCheck()) show(cur.pvHH);
- 1027. - }
- 1028. -
- 1029. - if (notAvail || !ph.actions.comm) {
- 1030. - hide(cur.pvYourComment);
- 1031. - } else {
- 1032. - show(cur.pvYourComment);
- 1033. - Wall.initComposer(cur.pvComment, {
- 1034. - lang: {
- 1035. - introText: getLang('profile_mention_start_typing'),
- 1036. - noResult: getLang('profile_mention_not_found')
- 1037. - },
- 1038. - wddClass: 'pv_composer_dd',
- 1039. - width: getSize(domPN(cur.pvYourComment))[0],
- 1040. - media: {
- 1041. - lnk: cur.pvAddMedia,
- 1042. - preview: cur.pvMediaPreview,
- 1043. - types: cur.pvMediaTypes,
- 1044. - options: {limit: 2, disabledTypes: ['album'], toggleLnk: true, onChange: function() {
- 1045. - setTimeout(Photoview.updateHeight, 2);
- 1046. - }}
- 1047. - }
- 1048. - });
- 1049. - cur.pvCommentSend.onclick = Photoview.sendComment;
- 1050. - if (!cur.pvComment.phevents) {
- 1051. - cur.pvComment.placeholder = getLang('reply_to_post');
- 1052. - placeholderSetup(cur.pvComment);
- 1053. - }
- 1054. - if (!cur.pvComment.autosize) {
- 1055. - autosizeSetup(cur.pvComment, {minHeight: 65, onResize: Photoview.updateHeight});
- 1056. - }
- 1057. - if (cur.pvCommenting && cur.pvCommenting != ph.id) {
- 1058. - var replyToName = (cur.pvReplyNames[(cur.pvReplyTo || {})[0]] || [])[1];
- 1059. - if (replyToName && !replyToName.indexOf(trim(val(cur.pvComment)))) {
- 1060. - val(cur.pvComment, '');
- 1061. - }
- 1062. - cur.pvReplyTo = false;
- 1063. - hide('pv_reply_to_title', 'pv_del_reply_to');
- 1064. -
- 1065. - cur.pvCommenting = false;
- 1066. - }
- 1067. - toggle(cur.pvAsGroup, !!ph.actions.asgr);
- 1068. - }
- 1069. -
- 1070. - Photoview.updateArrows();
- 1071. - if ((cur.pvOptions || {}).scroll) {
- 1072. - layerWrap.scrollTop = cur.pvOptions.scroll;
- 1073. - }
- 1074. -
- 1075. - setTimeout(Photoview.afterShow, 2);
- 1076. - },
- 1077. - afterShow: function() {
- 1078. - Photoview.updateHeight();
- 1079. - setStyle(layer, {marginTop: 0});
- 1080. -
- 1081. - cur.pvPhoto.href = '/photo' + cur.pvCurPhoto.id;
- 1082. - cur.pvPhoto.focus();
- 1083. -
- 1084. - if ((cur.pvCurPhoto.actions.edit & 4) && !cur.pvCurPhoto.desc) {
- 1085. - Photoview.editInline();
- 1086. - }
- 1087. -
- 1088. - var x = cur.pvPhoto.firstChild.offsetLeft, y = cur.pvPhoto.firstChild.offsetTop;
- 1089. - cur.pvTagFrame.innerHTML = '<img style="width: ' + cur.pvPhWidth + 'px; height: ' + cur.pvPhHeight + 'px;" src="' + cur.pvCurData.src + '" />';
- 1090. - setStyle(cur.pvTagFaded, {
- 1091. - width: cur.pvPhWidth + 'px',
- 1092. - height: cur.pvPhHeight + 'px',
- 1093. - left: x + 'px',
- 1094. - top: y + 'px'
- 1095. - });
- 1096. - var deltaX = browser.mozilla && ((lastWindowWidth - cur.pvActualWidth) % 2) && ((cur.pvActualWidth - cur.pvPhWidth) % 2) ? 4 : 3;
- 1097. - setStyle(cur.pvTagFrame, {
- 1098. - left: (x - deltaX) + 'px', // 3 - tag frame border, mozilla buggy
- 1099. - top: (y - 3) + 'px'
- 1100. - });
- 1101. - setStyle(cur.pvTagPerson, {
- 1102. - left: x + 'px',
- 1103. - top: y + 'px'
- 1104. - });
- 1105. -
- 1106. - if ((cur.pvOptions || {}).scroll) {
- 1107. - layerWrap.scrollTop = cur.pvOptions.scroll;
- 1108. - cur.pvOptions.scroll = 0;
- 1109. - }
- 1110. -
- 1111. - Photoview.updateLoc();
- 1112. - },
- 1113. - updateLoc: function() {
- 1114. - var nl, listId = cur.pvListId;
- 1115. - if (cur.pvRoot) {
- 1116. - nl = {0: 'photo' + cur.pvCurPhoto.id};
- 1117. - if (listId.substr(0, 6) == 'photos') {
- 1118. - nl.all = 1;
- 1119. - } else if (listId.substr(0, 3) == 'tag') {
- 1120. - nl.tag = intval(listId.substr(3));
- 1121. - } else if (listId.substr(0, 6) == 'newtag') {
- 1122. - nl.newtag = intval(listId.substr(6));
- 1123. - }
- 1124. - if (listId.indexOf('/rev') != -1) {
- 1125. - nl.rev = 1;
- 1126. - }
- 1127. - } else {
- 1128. - nl = extend(nav.objLoc, {z: 'photo' + cur.pvCurPhoto.id + '/' + (cur.pvCurPhoto.list_override || listId)});
- 1129. - }
- 1130. -
- 1131. - if (nav.strLoc != nav.toStr(nl)) {
- 1132. - if (!cur.pvNoHistory) {
- 1133. - ++cur.pvHistoryLength;
- 1134. - }
- 1135. - nav.setLoc(nl);
- 1136. - if ((cur.pvOptions || {}).fromQueue) {
- 1137. - cur.pvNoHistory = true;
- 1138. - cur.pvHistoryLength = 0;
- 1139. - }
- 1140. - }
- 1141. - if (cur.pvOptions) cur.pvOptions.fromQueue = false;
- 1142. - },
- 1143. -
- 1144. - canFullscreen: function() {
- 1145. - var b = browser, v = floatval(browser.version);
- 1146. - return (b.chrome && v > 15) ||
- 1147. - (b.mozilla && v > 9) ||
- 1148. - (b.safari && v > 5 && !b.mobile);
- 1149. - },
- 1150. - fullscreenOnLoad: function() {
- 1151. - if (window.FullscreenPV) {
- 1152. - FullscreenPV.slide();
- 1153. - }
- 1154. - },
- 1155. - fullscreenEnd: function(finishing) {
- 1156. - var el = cur.pvCanvas;
- 1157. - if (!el) return;
- 1158. - cleanElems(el);
- 1159. - re(el);
- 1160. - clearTimeout(cur.pvFSTimer);
- 1161. - clearTimeout(cur.pvFSControlsTimer);
- 1162. - cur.pvCanvas = cur.pvFSControls = cur.pvFSTimer = cur.pvFSControlsTimer = false;
- 1163. - removeEvent(document, 'webkitfullscreenchange mozfullscreenchange fullscreenchange webkitfullscreenerror mozfullscreenerror fullscreenerror');
- 1164. - show(pageNode);
- 1165. - if (cur.pvScrWasY !== undefined) {
- 1166. - scrollToY(cur.pvScrWasY, 0);
- 1167. - delete cur.pvScrWasY;
- 1168. - }
- 1169. - if (finishing !== true) {
- 1170. - Photoview.updateSize();
- 1171. - Photoview.show(cur.pvListId, cur.pvIndex);
- 1172. - }
- 1173. - },
- 1174. - fullscreen: function() {
- 1175. - if (cur.pvCanvas) return;
- 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;
- 1177. -
- 1178. - cur.pvFinishing = false;
- 1179. - stManager.add(['fullscreen_pv.css', 'fullscreen_pv.js'], function() {
- 1180. - FullscreenPV.init();
- 1181. - });
- 1182. -
- 1183. - addEvent(document, 'webkitfullscreenchange mozfullscreenchange fullscreenchange', Photoview.onFullscreen);
- 1184. - addEvent(document, 'webkitfullscreenerror mozfullscreenerror fullscreenerror', Photoview.fullscreenEnd.pbind(true));
- 1185. -
- 1186. - try {
- 1187. - method.call(el);
- 1188. - } catch(e) {
- 1189. - cur.pvPartScreen = true;
- 1190. - Photoview.onFullscreen();
- 1191. - }
- 1192. - },
- 1193. - fullscreenStop: function(finishing) {
- 1194. - cur.pvFinishing = (finishing === true);
- 1195. - cur.pvPartScreen = false;
- 1196. - var method = document.exitFullscreen || document.mozCancelFullScreen || document.webkitCancelFullScreen;
- 1197. - try {
- 1198. - method();
- 1199. - } catch(e) {
- 1200. - Photoview.onFullscreen();
- 1201. - }
- 1202. - Photoview.fullscreenEnd();
- 1203. - },
- 1204. - onFullscreen: function() {
- 1205. - if (document.fullScreenElement || document.mozFullScreen || document.webkitIsFullScreen || cur.pvPartScreen) {
- 1206. - if (cur.pvTagger) {
- 1207. - Phototag.stopTag();
- 1208. - }
- 1209. - vk.oldpvbig = vk.pvbig;
- 1210. - vk.pvbig = true;
- 1211. - cur.pvScrWidth = cur.pvCanvas.offsetWidth;
- 1212. - cur.pvScrHeight = cur.pvCanvas.offsetHeight;
- 1213. - cur.pvScrWasY = scrollGetY();
- 1214. - hide(pageNode);
- 1215. - if (!cur.pvFinishing) {
- 1216. - Photoview.updateSize();
- 1217. - Photoview.show(cur.pvListId, cur.pvIndex);
- 1218. - }
- 1219. - } else {
- 1220. - vk.pvbig = vk.oldpvbig;
- 1221. - Photoview.fullscreenEnd(cur.pvFinishing);
- 1222. - }
- 1223. - },
- 1224. -
- 1225. - showDD: function(obj, dd) {
- 1226. - if (hasClass(obj, 'pv_report_blocked')) {
- 1227. - return;
- 1228. - }
- 1229. - clearTimeout(cur.hideShareTimer);
- 1230. - obj.blur();
- 1231. - if (hasClass(dd, 'pv_dd_hiding')) {
- 1232. - return;
- 1233. - }
- 1234. - if (isVisible(dd)) {
- 1235. - return fadeIn(dd, 0);
- 1236. - }
- 1237. - if (cur.ddShown) {
- 1238. - Photoview.hideDD(0);
- 1239. - }
- 1240. - cur.ddShown = dd;
- 1241. - setTimeout(addEvent.pbind(document, 'click', Photoview.hideDD), 1);
- 1242. - show(dd);
- 1243. - },
- 1244. -
- 1245. - hideDD: function(timeout) {
- 1246. - if (timeout > 0) {
- 1247. - cur.hideShareTimer = setTimeout(Photoview.hideDD.pbind(0), timeout);
- 1248. - return;
- 1249. - }
- 1250. - var dd = cur.ddShown;
- 1251. - if (!dd) return;
- 1252. - if (timeout == -1) {
- 1253. - hide(dd);
- 1254. - } else {
- 1255. - addClass(dd, 'mv_dd_hiding')
- 1256. - fadeOut(dd, 200, function() {
- 1257. - removeClass(dd, 'mv_dd_hiding')
- 1258. - });
- 1259. - }
- 1260. - removeEvent(document, 'click', Photoview.hideDD);
- 1261. - cur.ddShown = false;
- 1262. - },
- 1263. -
- 1264. - createDD: function(rows, name) {
- 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>\
- 1266. - <td class="pvs_side_sh"><div class="pvs_side_sh_el"></div></td>\
- 1267. - <td>\
- 1268. - <div class="pvs_header_wrap"><div class="pvs_header"><span class="pvs_header_text">' + name + '</span></div></div>\
- 1269. - <div class="pvs_acts">' + rows + '</div>\
- 1270. - <div class="pvs_sh1"></div><div class="pvs_sh2"></div>\
- 1271. - </td>\
- 1272. - <td class="pvs_side_sh"><div class="pvs_side_sh_el"></div></td>\
- 1273. - </tr></table></div>'
- 1274. - },
- 1275. -
- 1276. - report: function(hash, reason) {
- 1277. - var ids = cur.pvCurPhoto.id.split('_');
- 1278. - ajax.post('reports.php', {act: 'new_report', type: 'photo', reason: reason, hash: hash, oid: ids[0], item_id: ids[1]}, {
- 1279. - onDone: function(text) {
- 1280. - var cont = ge('pv_report');
- 1281. - cont.parentNode.replaceChild(ce('div', {className: 'pv_report_blocked', innerHTML: text}), cont);
- 1282. - },
- 1283. - showProgress: function() {
- 1284. - var cont = ge('pv_report');
- 1285. - addClass(cont, 'pv_report_blocked');
- 1286. - },
- 1287. - hideProgress: function() {
- 1288. - var cont = ge('mv_report');
- 1289. - removeClass(cont, 'pv_report_blocked');
- 1290. - }
- 1291. - });
- 1292. - },
- 1293. -
- 1294. - showShare: function() {
- 1295. - clearTimeout(cur.hideShareTimer);
- 1296. - var dd = ge('pvs_dd');
- 1297. - ge('pv_share').blur();
- 1298. - if (isVisible(dd)) {
- 1299. - return fadeIn(dd, 0);
- 1300. - }
- 1301. - setTimeout(addEvent.pbind(document, 'click', Photoview.hideShare), 1);
- 1302. - show(dd);
- 1303. - },
- 1304. - hideShare: function(timeout) {
- 1305. - if (timeout > 0) {
- 1306. - cur.hideShareTimer = setTimeout(Photoview.hideShare.pbind(0), timeout);
- 1307. - return;
- 1308. - }
- 1309. - var dd = ge('pvs_dd');
- 1310. - if (!dd) return;
- 1311. - if (timeout == -1) {
- 1312. - hide(dd);
- 1313. - } else {
- 1314. - fadeOut(dd, 200);
- 1315. - }
- 1316. - removeEvent(document, 'click', Photoview.hideShare);
- 1317. - },
- 1318. - savePhoto: function() {
- 1319. - var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index];
- 1320. - ajax.post('al_photos.php', {act: 'save_me', photo: ph.id, list: listId, hash: ph.hash}, {progress: 'pv_share_prg', onDone: showDoneBox});
- 1321. - },
- 1322. - sendPhoto: function() {
- 1323. - var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index];
- 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']});
- 1325. - },
- 1326. -
- 1327. - setTags: function(tags) {
- 1328. - Photoview.hideTag();
- 1329. - if (!tags) {
- 1330. - hide(cur.pvTags);
- 1331. - return;
- 1332. - }
- 1333. - show(cur.pvTags);
- 1334. - if (window.tooltips) {
- 1335. - each(geByClass('delete', cur.pvTags), function() {
- 1336. - tooltips.destroy(this);
- 1337. - });
- 1338. - }
- 1339. - cur.pvTags.innerHTML = getLang('photos_onthisphoto') + ': ' + tags;
- 1340. - },
- 1341. - preload: function(from, direction) {
- 1342. - window.updateWndVScroll && updateWndVScroll(); // Because called on photo load
- 1343. - var listId = cur.pvListId, count = ((cur.pvData || {})[listId] || {}).length;
- 1344. - if (!count) return;
- 1345. -
- 1346. - var s1 = vk.pvbig ? (cur.pvVeryBig > 1 ? 'z' : (cur.pvVeryBig ? 'z' : 'y')) : 'x';
- 1347. - var s2 = vk.pvbig ? (cur.pvVeryBig > 1 ? 'z' : (cur.pvVeryBig ? 'y' : 'x')) : 0;
- 1348. - var s3 = vk.pvbig ? (cur.pvVeryBig > 1 ? 'y' : (cur.pvVeryBig ? 'x' : 0)) : 0;
- 1349. -
- 1350. - cur.pvLastFrom = from;
- 1351. - cur.pvLastDirection = direction;
- 1352. -
- 1353. - // remove preloaded ones without touching preloading ones
- 1354. - for (var i = 0; i < Math.min(Photoview.cacheSize, count - Photoview.cacheSize); ++i) {
- 1355. - var ind = from + (i + 1) * (-direction);
- 1356. - while (ind >= count) ind -= count;
- 1357. - while (ind < 0) ind += count;
- 1358. -
- 1359. - var p = cur.pvData[listId][ind];
- 1360. - if (!p) continue;
- 1361. - for (var j = 0, l = Photoview.allSizes.length; j < l; ++j) {
- 1362. - var s = Photoview.allSizes[j];
- 1363. - if (p[s] && p[s].src) {
- 1364. - p[s].src = Photoview.blank;
- 1365. - delete(p[s]);
- 1366. - }
- 1367. - }
- 1368. - }
- 1369. - for (var i = 0; i < Photoview.cacheSize; ++i) {
- 1370. - var ind = from + (i + 1) * direction;
- 1371. - while (ind >= count) ind -= count;
- 1372. - while (ind < 0) ind += count;
- 1373. -
- 1374. - var p = cur.pvData[listId][ind];
- 1375. - if (!p || !p.id) {
- 1376. - if (!p || (vkNow() - p > 3000)) {
- 1377. - cur.pvData[listId][ind] = vkNow();
- 1378. - setTimeout(function() {
- 1379. - ajax.post('al_photos.php', {act: 'show', list: listId, offset: Photoview.realOffset(listId, ind, -1), direction: direction}, {onDone: Photoview.loaded});
- 1380. - }, 10);
- 1381. - }
- 1382. - break;
- 1383. - }
- 1384. -
- 1385. - if (p[s1]) continue;
- 1386. - if (p[s1 + '_src']) {
- 1387. - p[s1] = vkImage();
- 1388. - p[s1].src = p[s1 + '_src'];
- 1389. - continue;
- 1390. - } else {
- 1391. - p[s1] = 1;
- 1392. - }
- 1393. -
- 1394. - if (p[s2]) continue;
- 1395. - if (p[s2 + '_src']) {
- 1396. - p[s2] = vkImage();
- 1397. - p[s2].src = p[s2 + '_src'];
- 1398. - continue;
- 1399. - } else {
- 1400. - p[s2] = 1;
- 1401. - }
- 1402. -
- 1403. - if (p[s3]) continue;
- 1404. - if (p[s3 + '_src']) {
- 1405. - p[s3] = vkImage();
- 1406. - p[s3].src = p[s3 + '_src'];
- 1407. - continue;
- 1408. - } else {
- 1409. - p[s3] = 1;
- 1410. - }
- 1411. -
- 1412. - if (p.x) continue;
- 1413. - p.x = vkImage();
- 1414. - p.x.src = p.x_src;
- 1415. - }
- 1416. - },
- 1417. - hide: function(noLoc, fromQueue) {
- 1418. - if (!cur.pvShown || __afterFocus && fromQueue !== true) return;
- 1419. - if (cur.pvCanvas) Photoview.fullscreenStop(true);
- 1420. -
- 1421. - if ((cur.pvJumpTo || {}).z == 'albums' + val('pva_owner') && !cur.pvAlbumsShown && noLoc === 0) {
- 1422. - return Photoview.jumpToAlbums(true);
- 1423. - }
- 1424. - if ((cur.pvJumpTo || {}).z == 'album' + val('pvsa_album') && !cur.pvAlbumShown && noLoc === 0) {
- 1425. - return Photoview.jumpToAlbum(true);
- 1426. - }
- 1427. - if ((cur.pvJumpTo || {}).z == 'tag' + val('pvsa_tag') && !cur.pvPhotoTagShown && noLoc === 0) {
- 1428. - return Photoview.jumpToTagged(true);
- 1429. - }
- 1430. - if (cur.pvListId == 'temp') {
- 1431. - cur.pvCancelLoad();
- 1432. - } else if (!cur.pvNoHistory && !noLoc && cur.pvHistoryLength > 0 && cur.pvHistoryLength < 10) {
- 1433. - cur.pvNoHistory = true;
- 1434. - __adsUpdate('very_lazy');
- 1435. - return history.go(-cur.pvHistoryLength);
- 1436. - }
- 1437. -
- 1438. - if (noLoc !== true && !layerQueue.count()) {
- 1439. - var newLoc;
- 1440. - if (cur.pvRoot) {
- 1441. - if (cur.pvListId.substr(0, 6) == 'newtag') {
- 1442. - newLoc = 'albums' + vk.id + '?act=added';
- 1443. - if (cur.pvListId.indexOf('/rev') != -1) {
- 1444. - newLoc += '&rev=1';
- 1445. - }
- 1446. - } else {
- 1447. - newLoc = cur.pvListId.replace('/rev', '?rev=1');
- 1448. - }
- 1449. - nav.setLoc(newLoc);
- 1450. - } else {
- 1451. - newLoc = clone(nav.objLoc);
- 1452. - delete(newLoc.z);
- 1453. - }
- 1454. - if (nav.strLoc != nav.toStr(newLoc)) {
- 1455. - nav.setLoc(newLoc);
- 1456. - }
- 1457. - __adsUpdate('very_lazy');
- 1458. - }
- 1459. -
- 1460. - window.__pvhideTimer = setTimeout(Photoview.doHide.pbind(cur), 0);
- 1461. - __adsUpdate();
- 1462. -
- 1463. - // if (window.wkcur && wkcur.scrollTop) {
- 1464. - // setTimeout(function() {
- 1465. - // window.wkLayerWrap.scrollTop = wkcur.scrollTop;
- 1466. - // wkcur.scrollTop = false;
- 1467. - // }, 0);
- 1468. - // }
- 1469. - if (cur.pvHHMove) {
- 1470. - removeEvent(layer, 'mousemove', Photoview.photoAct);
- 1471. - cur.pvHHMove = false;
- 1472. - }
- 1473. - cur.pvAlbumsShowing = cur.pvAlbumsShown = false;
- 1474. - cur.pvAlbumShowing = cur.pvAlbumShown = false;
- 1475. - cur.pvPhotoTagShowing = cur.pvPhotoTagShown = false;
- 1476. - cur.pvVideoTagShowing = cur.pvVideoTagsShown = false;
- 1477. - },
- 1478. - doHide: function(c) {
- 1479. - c.pvHistoryLength = 0;
- 1480. - if (cur.pvTagger) Phototag.stopTag();
- 1481. - cleanElems('pv_confirm_tag', 'pv_delete_tag', 'pv_prof_cancel', 'pv_prof_done');
- 1482. - if (c.pvFriends) {
- 1483. - cleanElems('pv_add_tag', 'pv_cancel_tag', c.pvFriends.firstChild.firstChild, c.pvFriends);
- 1484. - re(c.pvFriends);
- 1485. - c.pvFriends = c.pvFriendName = false;
- 1486. - }
- 1487. -
- 1488. - Wall.cancelEdit(true);
- 1489. -
- 1490. - removeEvent(c.pvPhoto, 'mousemove', Photoview.onMouseMove);
- 1491. -
- 1492. - // remove preloaded
- 1493. - var listId = c.pvListId, count = ((c.pvData || {})[listId] || {}).length;
- 1494. - if (c.pvLastDirection && count) {
- 1495. - for (var i = 0; i < Photoview.cacheSize; ++i) {
- 1496. - var ind = c.pvLastFrom + (i + 1) * c.pvLastDirection;
- 1497. - while (ind >= count) ind -= count;
- 1498. - while (ind < 0) ind += count;
- 1499. -
- 1500. - var p = c.pvData[listId][ind];
- 1501. - if (!p) continue;
- 1502. - for (var j = 0, l = Photoview.allSizes.length; j < l; ++j) {
- 1503. - var s = Photoview.allSizes[j];
- 1504. - if (p[s] && p[s].src) {
- 1505. - p[s].src = Photoview.blank;
- 1506. - delete(p[s]);
- 1507. - }
- 1508. - }
- 1509. - }
- 1510. - c.pvLastDirection = c.pvLastFrom = false;
- 1511. - }
- 1512. -
- 1513. - cur.pvYourComment = re(cur.pvYourComment);
- 1514. -
- 1515. - layers.hide();
- 1516. - layers.fullhide = false;
- 1517. -
- 1518. - Photoview.hideTag(true);
- 1519. - each(['pvLeft', 'pvClose', 'pvSwitch', 'pvFixed'], function() {
- 1520. - var n = this + '';
- 1521. - re(c[n]);
- 1522. - c[n] = false;
- 1523. - });
- 1524. - if (window.tooltips) {
- 1525. - tooltips.destroyAll(cur.pvBox);
- 1526. - }
- 1527. -
- 1528. - if (browser.mobile) {
- 1529. - ge('footer').style.height = '';
- 1530. - }
- 1531. -
- 1532. - var colorClass = vk.pvdark ? 'pv_dark' : 'pv_light';
- 1533. - removeClass(layerWrap, colorClass);
- 1534. - removeClass(layerBG, colorClass);
- 1535. - layerBG.style.opacity = '';
- 1536. -
- 1537. - c.pvShown = c.pvListId = c.pvClicked = false;
- 1538. - removeEvent(window, 'resize', Photoview.onResize);
- 1539. - removeEvent(document, 'keydown', Photoview.onKeyDown);
- 1540. - removeEvent(layerWrap, 'click', Photoview.onClick);
- 1541. - removeEvent(layerWrap, 'scroll', Photoview.scrollResize);
- 1542. -
- 1543. - // if (window.wkcur && wkcur.shown) {
- 1544. - // WkView.showLayer();
- 1545. - // }
- 1546. - var onh = cur.pvOptions && cur.pvOptions.onHide;
- 1547. - if (cur.pvOptions) {
- 1548. - var onh = cur.pvOptions.onHide;
- 1549. - cur.pvOptions.onHide = false;
- 1550. - if (onh) onh();
- 1551. - }
- 1552. - layerQueue.pop();
- 1553. -
- 1554. - if (c.pvPreloaded && c === cur) {
- 1555. - var cont = ge('photos_container'), d = ce('div', {innerHTML: c.pvPreloaded});
- 1556. - while (d.firstChild) {
- 1557. - cont.appendChild(d.firstChild);
- 1558. - }
- 1559. - if (cont.qsorter) {
- 1560. - setTimeout(qsorter.added.pbind(cont), 0);
- 1561. - }
- 1562. - c.pvPreloaded = false;
- 1563. - }
- 1564. - },
- 1565. - editPhoto: function() {
- 1566. - },
- 1567. - descTT: function(el) {
- 1568. - return showTooltip(el, {
- 1569. - text: getLang('photos_edit_desc'),
- 1570. - black: 1,
- 1571. - shift: [2, 4, 0],
- 1572. - showdt: 0
- 1573. - });
- 1574. - },
- 1575. - editInline: function(ev, noreq) {
- 1576. - if (((ev || window.event || {}).target || {}).tagName == 'A' || cur.pvEditing) return;
- 1577. -
- 1578. - var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index], noreq = !ph.desc;
- 1579. - var onDone = function(text) {
- 1580. - if (!cur.pvShown || cur.pvListId != listId || cur.pvIndex != index || cur.pvEditing) return;
- 1581. -
- 1582. - cur.pvEditing = [listId, index];
- 1583. - var mrg = '0px 0px 0px', taStyle = '';
- 1584. - if (browser.chrome) {
- 1585. - mrg = '0px 0px -5px';
- 1586. - taStyle = ' style="padding-bottom: 0px"';
- 1587. - } else if (browser.mozilla) {
- 1588. - mrg = '0px -1px 0px';
- 1589. - } else if (browser.msie) {
- 1590. - mrg = '0px 0px -6px';
- 1591. - }
- 1592. - var el = cur.pvDesc.appendChild(ce('div', {innerHTML: '\
- 1593. - <div style="margin: ' + mrg + '">\
- 1594. - <textarea id="pv_edit_text"' + taStyle + ' onkeydown="onCtrlEnter(event, Photoview.saveInline)" placeholder="' + getLang('photos_edit_desc_intro') + '">' + text + '</textarea>\
- 1595. - </div>'}, {display: 'none'})), txt = ge('pv_edit_text');
- 1596. - placeholderSetup(txt, {back: 1});
- 1597. - autosizeSetup(txt, {minHeight: 13});
- 1598. - setTimeout(function() {
- 1599. - show(el);
- 1600. - elfocus(txt);
- 1601. - addEvent(txt, 'blur', Photoview.saveInline);
- 1602. - hide(cur.pvDesc.firstChild);
- 1603. - }, 1);
- 1604. - };
- 1605. - if (!noreq) {
- 1606. - ajax.post('al_photos.php', {act: 'edit_desc', photo: ph.id}, {onDone: onDone, progress: 'pv_inlineedit_prg'});
- 1607. - } else {
- 1608. - onDone('');
- 1609. - }
- 1610. - },
- 1611. - cancelInline: function() {
- 1612. - cur.pvEditing = false;
- 1613. - removeEvent(ge('pv_edit_text'), 'blur');
- 1614. - show(cur.pvDesc.firstChild);
- 1615. - re(cur.pvDesc.firstChild.nextSibling);
- 1616. - },
- 1617. - saveInline: function() {
- 1618. - if (!cur.pvEditing) return;
- 1619. - removeEvent(ge('pv_edit_text'), 'blur');
- 1620. -
- 1621. - var listId = cur.pvEditing[0], index = cur.pvEditing[1], ph = cur.pvData[listId][index];
- 1622. - ajax.post('al_photos.php', {act: 'save_desc', photo: ph.id, hash: ph.hash, text: val('pv_edit_text')}, {onDone: function(text) {
- 1623. - ph.desc = text;
- 1624. -
- 1625. - var shown = cur.pvShown && listId == cur.pvListId && index == cur.pvIndex;
- 1626. - if (!shown) return;
- 1627. -
- 1628. - cur.pvEditing = false;
- 1629. - var d = domFC(cur.pvDesc);
- 1630. - val(d, text || ('<span class="pv_desc_edit">' + getLang('photos_edit_desc') + '</span>'));
- 1631. - d.onmouseover = text ? Photoview.descTT.pbind(d) : function() {};
- 1632. - show(d);
- 1633. - re(domNS(d));
- 1634. - }, progress: 'pv_inlineedit_prg'});
- 1635. - },
- 1636. -
- 1637. - cmp: function(id1, id2) {
- 1638. - var l1 = id1.length, l2 = id2.length;
- 1639. - if (l1 < l2) {
- 1640. - return -1;
- 1641. - } else if (l1 > l2) {
- 1642. - return 1;
- 1643. - } else if (id1 < id2) {
- 1644. - return -1;
- 1645. - } else if (id1 > id2) {
- 1646. - return 1;
- 1647. - }
- 1648. - return 0;
- 1649. - },
- 1650. - receiveComms: function(listId, index, text, names, noOld, toUp) {
- 1651. - if (listId != cur.pvListId || index != cur.pvIndex) return;
- 1652. -
- 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];
- 1654. - for (var el = domLC(n); el; el = domLC(n)) {
- 1655. - if (ph.actions.comm) addClass(el, 'reply_replieable');
- 1656. - while (current && Photoview.cmp(current.id, el.id) > 0) {
- 1657. - current = domPS(current);
- 1658. - }
- 1659. - if (current && !Photoview.cmp(current.id, el.id)) {
- 1660. - comms.replaceChild(el, current);
- 1661. - current = el;
- 1662. - } else {
- 1663. - if (current && domNS(current)) {
- 1664. - comms.insertBefore(el, domNS(current));
- 1665. - } else if (!current && domFC(comms)) {
- 1666. - if (noOld === true) {
- 1667. - --ph.commshown;
- 1668. - n.removeChild(el);
- 1669. - } else {
- 1670. - comms.insertBefore(el, domFC(comms));
- 1671. - }
- 1672. - } else {
- 1673. - comms.appendChild(el);
- 1674. - }
- 1675. - ++ph.commshown;
- 1676. - }
- 1677. - }
- 1678. - if (toUp && last) {
- 1679. - layerWrap.scrollTop += getXY(last, true)[1] - frm;
- 1680. - }
- 1681. - cur.pvCommsLikes[ph.id][0] = comms;
- 1682. - extend(cur.pvReplyNames, names);
- 1683. - Photoview.updateComms();
- 1684. - },
- 1685. - commSaved: function(post) {
- 1686. - if (!cur.pvShown) return;
- 1687. - var comms = ge('pv_comments'), ph = comms ? cur.pvData[cur.pvListId][cur.pvIndex] : false, comm = post.match(/^(-?\d+)photo(_\d+)/);
- 1688. - if (!ph || !comm || !ge('pv_comment' + comm[1] + comm[2])) return;
- 1689. - cur.pvCommsLikes[ph.id][0] = comms;
- 1690. - },
- 1691. - comments: function(showcomm) {
- 1692. - if (showcomm) {
- 1693. - var frst = domFC(ge('pv_comments')).id || '';
- 1694. - if (
- 1695. - !isVisible('pv_comments_header') ||
- 1696. - isVisible('pv_comments_progress') ||
- 1697. - Photoview.cmp(frst, 'pv_comment' + showcomm) < 0
- 1698. - ) {
- 1699. - return;
- 1700. - }
- 1701. - }
- 1702. - var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index];
- 1703. - var prg = ge('pv_comments_progress');
- 1704. - ajax.post('al_photos.php', {act: 'photo_comments', offset: ph.commshown, photo: ph.id}, {
- 1705. - onDone: function(text, names) {
- 1706. - Photoview.receiveComms(listId, index, text, names, false, showcomm);
- 1707. - if (showcomm && ge('pv_comment' + showcomm)) {
- 1708. - Photoview.showComment(showcomm);
- 1709. - }
- 1710. - },
- 1711. - showProgress: function() {
- 1712. - hide(prg.previousSibling);
- 1713. - show(prg);
- 1714. - }, hideProgress: function() {
- 1715. - hide(prg);
- 1716. - show(prg.previousSibling);
- 1717. - }
- 1718. - });
- 1719. - },
- 1720. - updateComms: function() {
- 1721. - setTimeout(Photoview.updateHeight, 2);
- 1722. -
- 1723. - var ph = cur.pvData[cur.pvListId][cur.pvIndex];
- 1724. - var commshown = '', commprg = ge('pv_comments_progress'), commheader = ge('pv_comments_header');
- 1725. - if (ph.commcount > ph.commshown) {
- 1726. - commshown = getLang('photos_show_prev_comments', ph.commcount - ph.commshown);
- 1727. - }
- 1728. - (commshown ? show : hide)(commheader);
- 1729. - domPS(commprg).innerHTML = commshown;
- 1730. - },
- 1731. - commentClick: function(el, event, from) {
- 1732. - var comm = el.id.replace('pv_comment', ''), cmnt = comm.split('_');
- 1733. - if (Wall.checkReplyClick(el, event)) return;
- 1734. -
- 1735. - var moreLink = geByClass1('wall_reply_more', el, 'a');
- 1736. - if (moreLink && isVisible(moreLink)) {
- 1737. - removeClass(el, 'reply_moreable');
- 1738. - moreLink.onclick();
- 1739. - return;
- 1740. - }
- 1741. - if (from && cmnt[1] && isVisible(cur.pvYourComment)) {
- 1742. - Photoview.commentTo(comm, from, event);
- 1743. - }
- 1744. - },
- 1745. - commentChanged: function() {
- 1746. - checkTextLength(cur.pvCommLimit, cur.pvComment, ge('pv_comment_warn'));
- 1747. - cur.pvCommenting = cur.pvData[cur.pvListId][cur.pvIndex].id;
- 1748. - },
- 1749. - commentTo: function(comm, toId, event) {
- 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');
- 1751. -
- 1752. - cur.pvCommenting = ph.id;
- 1753. -
- 1754. - if (comm) {
- 1755. - cur.pvReplyTo = [toId, commId];
- 1756. - val(tl, replyName[0]);
- 1757. - show(tl, 'pv_del_reply_to');
- 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});
- 1759. - } else {
- 1760. - cur.pvReplyTo = false;
- 1761. - hide(tl, 'pv_del_reply_to');
- 1762. - }
- 1763. -
- 1764. - var v = trim(val(rf)), cEl = comm && geByClass1('pv_reply_to', ge('pv_comment' + comm));
- 1765. - if (!v || replyNameOld && !winToUtf(replyNameOld[1]).indexOf(v)) {
- 1766. - val(rf, (comm && !checkEvent(event)) ? replaceEntities(replyName[1]) : '');
- 1767. - }
- 1768. - toggleClass(cur.pvAsGroup, 'on', !!(ph.actions.asgr && cEl && cEl.getAttribute('rid') === cmnt[0]));
- 1769. - elfocus(rf);
- 1770. - },
- 1771. - sendComment: function() {
- 1772. - var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index],
- 1773. - fld = cur.pvComment, comp = fld && data(fld, 'composer'),
- 1774. - params = comp ? Composer.getSendParams(comp, Photoview.sendComment) : {message: trim(val(fld))},
- 1775. - replyToName = (cur.pvReplyNames[(cur.pvReplyTo || {})[0]] || [])[1], btn = 'pv_comment_send';
- 1776. -
- 1777. - if (params.delayed) return;
- 1778. -
- 1779. - if (!params.attach1_type && (!params.message || replyToName && !replyToName.indexOf(params.message))) {
- 1780. - elfocus(fld);
- 1781. - return;
- 1782. - }
- 1783. -
- 1784. - hide('pv_comment_warn');
- 1785. - ajax.post('al_photos.php', Wall.fixPostParams(extend(params, {
- 1786. - act: 'post_comment',
- 1787. - photo: ph.id,
- 1788. - hash: ph.hash,
- 1789. - fromview: 1,
- 1790. - from_group: isVisible(cur.pvAsGroup) ? isChecked(cur.pvAsGroup) : '',
- 1791. - reply_to: (cur.pvReplyTo || {})[1]
- 1792. - })), {onDone: function(text, names) {
- 1793. - ++ph.commcount;
- 1794. - Photoview.receiveComms(listId, index, text, names, true);
- 1795. - if (data(cur.pvComment, 'composer')) {
- 1796. - Composer.reset(data(cur.pvComment, 'composer'));
- 1797. - } else {
- 1798. - val(cur.pvComment, '');
- 1799. - }
- 1800. - cur.pvComment.blur();
- 1801. - cur.pvReplyTo = false;
- 1802. - hide('pv_reply_to_title', 'pv_del_reply_to');
- 1803. - }, showProgress: lockButton.pbind(btn), hideProgress: unlockButton.pbind(btn)});
- 1804. - },
- 1805. - highlightComment: function(el) {
- 1806. - el = ge(el);
- 1807. - if (!el) return;
- 1808. -
- 1809. - var hlfunc = animate.pbind(el, {backgroundColor: '#ECEFF3'}, 200, function() {
- 1810. - setTimeout(function() {
- 1811. - animate(el, {backgroundColor: '#FFF'}, 200, function() {
- 1812. - setStyle(el, {backgroundColor: ''});
- 1813. - });
- 1814. - }, 1000);
- 1815. - }), top = getXY(el, true)[1];
- 1816. -
- 1817. - if (top < 0 || top > lastWindowHeight - 200) {
- 1818. - animate(layerWrap, {scrollTop: layerWrap.scrollTop + top - 50}, 300, hlfunc);
- 1819. - } else {
- 1820. - hlfunc();
- 1821. - }
- 1822. - },
- 1823. - showComment: function(comm) {
- 1824. - var p = ge('pv_comment' + comm);
- 1825. - if (p) {
- 1826. - Photoview.highlightComment(p);
- 1827. - } else {
- 1828. - Photoview.comments(comm);
- 1829. - }
- 1830. - return false;
- 1831. - },
- 1832. - commDone: function(comm, context, text, del, script) {
- 1833. - var node = ge('pv_comment' + comm + context);
- 1834. - if (!node) return;
- 1835. -
- 1836. - var msg = node.firstChild.nextSibling, ph = context ? false : cur.pvData[cur.pvListId][cur.pvIndex];
- 1837. - if (!text) {
- 1838. - show(node.firstChild);
- 1839. - hide(msg);
- 1840. - if (ph) {
- 1841. - ++ph.commcount;
- 1842. - ++ph.commshown;
- 1843. - Photoview.updateComms();
- 1844. - } else if (window.photos && cur.offset) {
- 1845. - photos.recache(cur.offset, 1);
- 1846. - }
- 1847. - return;
- 1848. - }
- 1849. - if (msg) {
- 1850. - msg.innerHTML = text;
- 1851. - show(msg);
- 1852. - } else {
- 1853. - node.appendChild(ce('div', {innerHTML: text}));
- 1854. - }
- 1855. - hide(node.firstChild);
- 1856. - if (del) {
- 1857. - if (ph) {
- 1858. - --ph.commshown;
- 1859. - --ph.commcount;
- 1860. - Photoview.updateComms();
- 1861. - } else if (window.photos && cur.offset) {
- 1862. - photos.recache(cur.offset, -1);
- 1863. - }
- 1864. - } else {
- 1865. - Photoview.updateHeight();
- 1866. - }
- 1867. - if (ph) {
- 1868. - cur.pvCommsLikes[ph.id][0] = ge('pv_comments');
- 1869. - }
- 1870. - if (script) {
- 1871. - eval(script);
- 1872. - }
- 1873. - },
- 1874. - commProgress: function(comm, sh) {
- 1875. - var acts = ge('pv_actions' + comm);
- 1876. - if (!acts) return;
- 1877. -
- 1878. - var prg = acts.firstChild.nextSibling;
- 1879. - if (sh !== true) {
- 1880. - hide(prg);
- 1881. - show(acts.firstChild);
- 1882. - return;
- 1883. - }
- 1884. - hide(acts.firstChild);
- 1885. - if (!prg) {
- 1886. - prg = acts.appendChild(ce('div', {className: 'progress'}));
- 1887. - }
- 1888. - show(prg);
- 1889. - },
- 1890. - commParams: function(comm, context) {
- 1891. - return {
- 1892. - onDone: Photoview.commDone.pbind(comm, context),
- 1893. - progress: 'pv_progress' + comm + context
- 1894. - }
- 1895. - },
- 1896. - commAction: function(act, comm, context, hash) {
- 1897. - if (isVisible('pv_progress' + comm + context)) return;
- 1898. - ajax.post('al_photos.php', {act: act + '_comment', comment: comm, context: context, hash: hash}, Photoview.commParams(comm, context));
- 1899. - },
- 1900. -
- 1901. - onClick: function(e, skipClicked) {
- 1902. - if (cur.pvClicked && !skipClicked || __afterFocus) {
- 1903. - cur.pvClicked = false;
- 1904. - return;
- 1905. - }
- 1906. - if (e && (e.button == 2 || e.which == 3 || e.pvHandle)) return;
- 1907. - if (e) e.pvHandle = true;
- 1908. - var px = e.pageX, py = e.pageY;
- 1909. - if (px == null && e.clientX != null) {
- 1910. - var doc = document.documentElement, body = bodyNode;
- 1911. - px = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0);
- 1912. - py = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0);
- 1913. - }
- 1914. - var dx = Math.abs(px - intval(cur.pvOldX));
- 1915. - var dy = Math.abs(py - intval(cur.pvOldY));
- 1916. - if (dx > 3 || dy > 3) {
- 1917. - if (vkNow() - intval(cur.pvOldT) > 300) {
- 1918. - if (cur.pvTagger) {
- 1919. - Phototag.stopTag();
- 1920. - } else {
- 1921. - Photoview.hide(0);
- 1922. - }
- 1923. - }
- 1924. - }
- 1925. - },
- 1926. - onMouseMove: function(ev) {
- 1927. - var el = cur.pvPhoto.firstChild;
- 1928. - if (cur.pvTagger || !el) return;
- 1929. -
- 1930. - var elemXY = getXY(el), ph = cur.pvData[cur.pvListId][cur.pvIndex];
- 1931. - var x = (ev.pageX - elemXY[0]) * 100 / cur.pvPhWidth, y = (ev.pageY - elemXY[1]) * 100 / cur.pvPhHeight;
- 1932. - for (var i in ph.tags) {
- 1933. - var coords = ph.tags[i];
- 1934. - if (x > coords[0] && x < coords[2] && y > coords[1] && y < coords[3]) {
- 1935. - Photoview.showDynTag(i);
- 1936. - return;
- 1937. - }
- 1938. - }
- 1939. - Photoview.hideTag();
- 1940. - },
- 1941. - onKeyDown: function(e) {
- 1942. - if (e.returnValue === false) return false;
- 1943. - if (e.keyCode == KEY.ESC && cur.pvEditing) {
- 1944. - Photoview.cancelInline();
- 1945. - return cancelEvent(e);
- 1946. - }
- 1947. - if (e.altKey && e.keyCode == KEY.RETURN && Photoview.canFullscreen()) {
- 1948. - (cur.pvCanvas ? Photoview.fullscreenStop() : Photoview.fullscreen());
- 1949. - }
- 1950. - if (e.target && (e.target.tagName == 'INPUT' || e.target.tagName == 'TEXTAREA' || e.target.tagName == 'DIV' && e.target.contentEditable)) {
- 1951. - return true;
- 1952. - }
- 1953. - if (e.keyCode == KEY.ESC) {
- 1954. - if (cur.pvCanvas) {
- 1955. - Photoview.fullscreenStop();
- 1956. - } else if (cur.pvTagger) {
- 1957. - Phototag.stopTag();
- 1958. - } else if (!e.vkCanceled && !curBox()) {
- 1959. - Photoview.hide(0);
- 1960. - }
- 1961. - return cancelEvent(e);
- 1962. - } else if (!cur.pvTagger && !boxQueue.count() && (!cur.pvComment || !cur.pvComment.focused)) {
- 1963. - if (e.keyCode == KEY.RIGHT) {
- 1964. - Photoview.show(cur.pvListId, cur.pvIndex + 1);
- 1965. - } else if (e.keyCode == KEY.LEFT) {
- 1966. - Photoview.show(cur.pvListId, cur.pvIndex - 1);
- 1967. - }
- 1968. - }
- 1969. - },
- 1970. - onResize: function() {
- 1971. - var dwidth = lastWindowWidth, dheight = lastWindowHeight, sbw = sbWidth();
- 1972. - if (cur.pvCanvas) {
- 1973. - var sizeChanged = false, oldverybig = cur.pvVeryBig, w = cur.pvCanvas.offsetWidth, h = cur.pvCanvas.offsetHeight;
- 1974. - cur.pvVeryBig = (w > 1280 || h > 1280) ? 2 : ((w > 807 || h > 807) ? 1 : false);
- 1975. - if (sizeChanged = (oldverybig != cur.pvVeryBig)) {
- 1976. - setTimeout(Photoview.preload.pbind(cur.pvIndex, cur.pvLastDirection || 1), 10);
- 1977. - }
- 1978. - return;
- 1979. - }
- 1980. - if (cur.pvAlbumsShown || cur.pvAlbumShown || cur.pvPhotoTagShown) {
- 1981. - cur.pvActualWidth = (cur.pvsaMini && !cur.pvAlbumsShown) ? 536 : 804;
- 1982. - cur.pvCont.style.width = (cur.pvActualWidth + 154) + 'px';
- 1983. - domPN(cur.pvSummary).style.width = (cur.pvActualWidth - 4) + 'px';
- 1984. - } else if (vk.pvbig) {
- 1985. - var w = dwidth - sbw - 2 - 120 - 34 - 50, h = dheight - 31 - 28 - 72;
- 1986. - if (w > 1280) { // less than full hd - not size > 2
- 1987. - w = 1280;
- 1988. - } else if (w > 807 && w < 907) { // 1024x768 - not size > 1
- 1989. - w = 807;
- 1990. - } else if (w < 604) {
- 1991. - w = 604;
- 1992. - }
- 1993. - if (h < 453) {
- 1994. - h = 453;
- 1995. - }
- 1996. - cur.pvWidth = w;
- 1997. - cur.pvHeight = h;
- 1998. -
- 1999. - var sizeChanged = false, oldverybig = cur.pvVeryBig;
- 2000. - cur.pvVeryBig = (w > 1280) ? 2 : (w > 807 ? 1 : false);
- 2001. - sizeChanged = (oldverybig != cur.pvVeryBig);
- 2002. -
- 2003. - var lnk = cur.pvPhoto;
- 2004. - if (lnk && lnk.firstChild && cur.pvCurData.src == lnk.firstChild.src && cur.pvCurData.width) {
- 2005. - var c = (cur.pvCurData.width > cur.pvWidth) ? (cur.pvWidth / cur.pvCurData.width) : 1;
- 2006. - if (cur.pvCurData.height * c > cur.pvHeight) {
- 2007. - c = cur.pvHeight / cur.pvCurData.height;
- 2008. - }
- 2009. - var w = cur.pvPhWidth = Math.floor(cur.pvCurData.width * c);
- 2010. - var h = cur.pvPhHeight = Math.floor(cur.pvCurData.height * c);
- 2011. - cur.pvActualWidth = Math.max(604, w);
- 2012. -
- 2013. - if (vk.pvbig) {
- 2014. - cur.pvCont.style.width = (cur.pvActualWidth + 154) + 'px';
- 2015. - domPN(cur.pvSummary).style.width = (cur.pvActualWidth - 4) + 'px';
- 2016. - }
- 2017. -
- 2018. - lnk.style.height = Math.max(453, h) + 'px';
- 2019. - lnk.firstChild.style.width = w + 'px';
- 2020. - lnk.firstChild.style.height = h + 'px';
- 2021. - if (cur.pvTagger && cur.pvTagger != 'loading') {
- 2022. - cur.pvTagger.resize(w, h);
- 2023. - }
- 2024. -
- 2025. - var x = lnk.firstChild.offsetLeft, y = lnk.firstChild.offsetTop;
- 2026. - if (browser.msie7 || browser.msie6) {
- 2027. - x += lnk.offsetLeft;
- 2028. - y += lnk.offsetTop;
- 2029. - }
- 2030. - setStyle(cur.pvTagFrame.firstChild, {
- 2031. - width: w + 'px',
- 2032. - height: h + 'px'
- 2033. - });
- 2034. - setStyle(cur.pvTagFaded, {
- 2035. - width: w + 'px',
- 2036. - height: h + 'px',
- 2037. - left: x + 'px',
- 2038. - top: y + 'px'
- 2039. - });
- 2040. - setStyle(cur.pvTagFrame, {
- 2041. - left: (x - 3) + 'px', // 3 - tag frame border
- 2042. - top: (y - 3) + 'px'
- 2043. - });
- 2044. - setStyle(cur.pvTagPerson, {
- 2045. - left: x + 'px',
- 2046. - top: y + 'px'
- 2047. - });
- 2048. -
- 2049. - if (sizeChanged) {
- 2050. - setTimeout(Photoview.preload.pbind(cur.pvIndex, cur.pvLastDirection || 1), 10);
- 2051. - }
- 2052. - } else {
- 2053. - cur.pvActualWidth = intval(getStyle(cur.pvBox, 'width'));
- 2054. - }
- 2055. - }
- 2056. - if (!cur.pvPhoto) return;
- 2057. - if (browser.mozilla && cur.pvPhoto.firstChild) {
- 2058. - var x = cur.pvPhoto.firstChild.offsetLeft, deltaX = ((lastWindowWidth - cur.pvActualWidth) % 2) && ((cur.pvActualWidth - cur.pvPhWidth) % 2) ? 4 : 3;
- 2059. - setStyle(cur.pvTagFrame, {
- 2060. - left: (x - deltaX) + 'px' // 3 - tag w border, mozilla buggy
- 2061. - });
- 2062. - }
- 2063. - Photoview.updateArrows();
- 2064. - Photoview.updateHeight();
- 2065. - cur.pvHH.style.marginLeft = Math.ceil((cur.pvActualWidth + 50 - 72) / 2) + 'px';
- 2066. -
- 2067. - Photoview.scrollResize();
- 2068. - // if (ge('pv_date')) { // debug
- 2069. - // ge('pv_date').innerHTML = lastWindowWidth + ' ' + cur.pvActualWidth + ' ' + cur.pvPhWidth;
- 2070. - // }
- 2071. - },
- 2072. - updateSize: function() {
- 2073. - if (!vk.pvbig) {
- 2074. - cur.pvActualWidth = 604;
- 2075. - domPN(cur.pvSummary).style.width = '600px';
- 2076. - cur.pvCont.style.width = '758px';
- 2077. - cur.pvPhoto.innerHTML = '';
- 2078. - }
- 2079. - onBodyResize();
- 2080. - Photoview.onResize();
- 2081. - },
- 2082. -
- 2083. - switchSize: function() {
- 2084. - vk.pvbig = !vk.pvbig;
- 2085. -
- 2086. - ge('pv_large_link').innerHTML = getLang(vk.pvbig ? 'photos_smaller' : 'photos_larger');
- 2087. - if (cur.pvTagger) Phototag.stopTag();
- 2088. - Photoview.updateSize();
- 2089. - Photoview.show(cur.pvListId, cur.pvIndex);
- 2090. - if (vk.id) {
- 2091. - clearTimeout(cur.pvSaveBig);
- 2092. - cur.pvSaveBig = setTimeout(ajax.post.pbind('al_photos.php', {act: 'viewer_big', big: (vk.pvbig ? 1 : ''), hash: cur.pvHash}), 1000);
- 2093. - }
- 2094. - },
- 2095. - switchColor: function(el) {
- 2096. - var old = vk.pvdark ? 'pv_dark' : 'pv_light';
- 2097. - vk.pvdark = !vk.pvdark;
- 2098. - var cl = vk.pvdark ? 'pv_dark' : 'pv_light';
- 2099. -
- 2100. - setStyle(el, 'opacity', vk.pvdark ? 1 : 0.7);
- 2101. -
- 2102. - layerBG.className = layerBG.className.replace(old, cl);
- 2103. - layerWrap.className = layerWrap.className.replace(old, cl);
- 2104. - cur.pvFixed.className = cur.pvFixed.className.replace(old, cl);
- 2105. - if (vk.id) {
- 2106. - clearTimeout(cur.pvSaveColor);
- 2107. - cur.pvSaveColor = setTimeout(ajax.post.pbind('al_photos.php', {act: 'viewer_color', dark: (vk.pvdark ? 1 : ''), hash: cur.pvHash}), 1000);
- 2108. - }
- 2109. - },
- 2110. -
- 2111. - activate: function(arrow) {
- 2112. - if (arrow && arrow.timeout) {
- 2113. - clearTimeout(arrow.timeout);
- 2114. - removeAttr(arrow, 'timeout');
- 2115. - } else if (isVisible(arrow)) {
- 2116. - fadeTo(arrow, 200, vk.pvdark ? 1 : 0.7);
- 2117. - }
- 2118. - },
- 2119. - deactivate: function(arrow) {
- 2120. - if (!arrow || !isVisible(arrow) || arrow.timeout) {
- 2121. - return;
- 2122. - }
- 2123. - arrow.timeout = setTimeout(function() {
- 2124. - removeAttr(arrow, 'timeout');
- 2125. - fadeTo(arrow, 200, 0.4);
- 2126. - }, 1);
- 2127. - },
- 2128. -
- 2129. - deletePhoto: function(sure) {
- 2130. - var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index], box = curBox();
- 2131. - var prg = box ? box.progress : 'pv_delete_progress';
- 2132. - if (isVisible(prg)) return;
- 2133. -
- 2134. - if (cur.pvTagger && ev !== false) {
- 2135. - Phototag.stopTag();
- 2136. - return;
- 2137. - }
- 2138. -
- 2139. - 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) {
- 2140. - if (box) {
- 2141. - box.hide();
- 2142. - return nav.go('/id0', false, {nocur: true});
- 2143. - }
- 2144. - if (html) {
- 2145. - return showFastBox(text, html, getLang('global_delete'), Photoview.deletePhoto.pbind(1), getLang('global_cancel'));
- 2146. - }
- 2147. - ph.deleted = text;
- 2148. - if (listId == cur.pvListId && index == cur.pvIndex) {
- 2149. - cleanElems('pv_confirm_tag', 'pv_delete_tag', 'pv_prof_cancel', 'pv_prof_done');
- 2150. - cur.pvTagInfo.innerHTML = ph.deleted;
- 2151. - show(cur.pvTagInfo);
- 2152. - hide(cur.pvCommentsData);
- 2153. - Photoview.updateHeight();
- 2154. - }
- 2155. - }, progress: prg});
- 2156. - },
- 2157. - restorePhoto: function() {
- 2158. - var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index];
- 2159. - if (isVisible('pv_restore_progress')) return;
- 2160. -
- 2161. - ajax.post('al_photos.php', {act: 'restore_photo', photo: ph.id, hash: ph.hash}, {onDone: function(text) {
- 2162. - ph.deleted = false;
- 2163. - if (listId == cur.pvListId && index == cur.pvIndex) {
- 2164. - cleanElems('pv_confirm_tag', 'pv_delete_tag', 'pv_prof_cancel', 'pv_prof_done');
- 2165. - if (ph.taginfo) {
- 2166. - cur.pvTagInfo.innerHTML = '\
- 2167. - <table cellspacing="0" cellpadding="0"><tr>\
- 2168. - <td class="info">' + ph.taginfo + '</td>\
- 2169. - <td><nobr><div class="button_blue"><button id="pv_confirm_tag">' + getLang('photos_confirm_tag') + '</button></div></td>\
- 2170. - <td><nobr><div class="button_gray"><button id="pv_delete_tag">' + getLang('photos_delete_tag') + '</button></div></td>\
- 2171. - <td><div id="pv_tag_handling" class="progress"></div></td>\
- 2172. - </tr></table>';
- 2173. - show(cur.pvTagInfo);
- 2174. - ge('pv_confirm_tag').onclick = Photoview.confirmTag.pbind(ph.tagid);
- 2175. - ge('pv_delete_tag').onclick = Photoview.deleteTag.pbind(ph.tagid);
- 2176. - } else {
- 2177. - cur.pvTagInfo.innerHTML = '';
- 2178. - hide(cur.pvTagInfo);
- 2179. - }
- 2180. - show(cur.pvCommentsData);
- 2181. - Photoview.updateHeight();
- 2182. - }
- 2183. - }, progress: 'pv_restore_progress'});
- 2184. - },
- 2185. - spamPhoto: function(prg, spamHash) {
- 2186. - var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index];
- 2187. - if (isVisible(prg)) return;
- 2188. -
- 2189. - if (cur.pvTagger && ev !== false) {
- 2190. - Phototag.stopTag();
- 2191. - return;
- 2192. - }
- 2193. -
- 2194. - ajax.post('al_photos.php', {act: 'spam_photo', photo: ph.id, hash: ph.hash, spam_hash: spamHash}, {onDone: function(text, del) {
- 2195. - if (del) ph.deleted = text;
- 2196. - if (listId == cur.pvListId && index == cur.pvIndex) {
- 2197. - cleanElems('pv_confirm_tag', 'pv_delete_tag', 'pv_prof_cancel', 'pv_prof_done');
- 2198. - cur.pvTagInfo.innerHTML = text;
- 2199. - show(cur.pvTagInfo);
- 2200. - if (del) hide(cur.pvCommentsData);
- 2201. - Photoview.updateHeight();
- 2202. - }
- 2203. - }, progress: prg});
- 2204. - },
- 2205. - rotatePhoto: function(to) {
- 2206. - var prg = ge('pv_rotate_progress');
- 2207. - if (isVisible(prg)) return;
- 2208. -
- 2209. - show(prg);
- 2210. - ge('pv_rotate').appendChild(ce('div', {id: 'pv_rotate_frame', className: 'upload_frame', innerHTML: '<iframe name="pv_rotate_frame"></iframe>'}));
- 2211. - var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index], form = ge('pv_rotate_form');
- 2212. - form.innerHTML = '';
- 2213. - form.action = ph.rotate[0];
- 2214. - var data = extend({act: 'do_rotate', to: to, list_id: listId, index: index, fid: ph.id}, ph.rotate);
- 2215. - to = (to + 4) % 4;
- 2216. - if (data.act == 'rotate_photo') {
- 2217. - data.angle = (data.angle + to) % 4;
- 2218. - }
- 2219. - if (data['rot'+to]) {
- 2220. - data.act = 'done_rotate';
- 2221. - data.complete = 1;
- 2222. - ajax.post('/al_photos.php', data, {
- 2223. - onDone: Photoview.rotateDone,
- 2224. - onFail: function() {
- 2225. - Photoview.rotateDone();
- 2226. - }
- 2227. - });
- 2228. - return;
- 2229. - }
- 2230. - for (var i in data) {
- 2231. - if (i != 0) {
- 2232. - form.appendChild(ce('input', {type: 'hidden', name: i, value: data[i]}));
- 2233. - }
- 2234. - }
- 2235. - form.submit();
- 2236. - },
- 2237. - rotateDone: function(data) {
- 2238. - hide('pv_rotate_progress');
- 2239. - var el = ge('pv_rotate_frame');
- 2240. -
- 2241. - if (!el) return;
- 2242. - re(el);
- 2243. -
- 2244. - if (!data) return;
- 2245. - var listId = data.list_id, index = data.index, ph = cur.pvData[listId][index];
- 2246. - 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})
- 2247. - extend(ph.rotate, {photo: data.photo, hash: data.hash, rhash: data.rhash, angle: data.angle, rot1: data.rot1, rot3: data.rot3});
- 2248. - if (listId == cur.pvListId && index == cur.pvIndex) {
- 2249. - Photoview.show(listId, index);
- 2250. - }
- 2251. - },
- 2252. -
- 2253. - likeUpdate: function(my, count, title) {
- 2254. - count = intval(count);
- 2255. -
- 2256. - var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index];
- 2257. - var countInput = ge('like_real_count_photo' + ph.id) || {}, rows = ge('like_table_photo' + ph.id);
- 2258. - var titleNode = ge('like_title_photo' + ph.id), countNode = ge('pv_like_count');
- 2259. - var icon = cur.pvLikeIcon;
- 2260. - var tt = icon.parentNode.tt || {}, opts = clone(tt.opts || {}), newleft = (my ? 0 : -36);
- 2261. -
- 2262. - if (title && titleNode) {
- 2263. - val(titleNode, title);
- 2264. - }
- 2265. - cur.pvCommsLikes[ph.id][1] = countInput.value = count;
- 2266. - animateCount(countNode, count);
- 2267. -
- 2268. - ph.liked = my;
- 2269. - (my ? addClass : removeClass)(cur.pvHH, 'pvs_hh_liked');
- 2270. - if (!my) {
- 2271. - var cb = ge('like_share_photo' + ph.id);
- 2272. - if (cb) checkbox(cb, false);
- 2273. - } else {
- 2274. - setStyle(icon, {opacity: 1});
- 2275. - }
- 2276. - if (count) {
- 2277. - var styleName = vk.rtl ? 'right' : 'left';
- 2278. - if (tt.el && !isVisible(tt.container) && !title) {
- 2279. - rows.style[styleName] = newleft + 'px';
- 2280. - tooltips.show(tt.el, extend(opts, {showdt: 0}));
- 2281. - } else if (rows) {
- 2282. - var params = {};
- 2283. - params[styleName] = newleft;
- 2284. - animate(rows, params, 200);
- 2285. - }
- 2286. - removeClass(icon, 'no_likes');
- 2287. - } else {
- 2288. - if (tt.el) tt.hide();
- 2289. - addClass(icon, 'no_likes');
- 2290. - }
- 2291. - },
- 2292. - like: function() {
- 2293. - if (!vk.id) return;
- 2294. - var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index], my = !ph.liked;
- 2295. - ajax.post('like.php', {act: 'a_do_' + (my ? '' : 'un') + 'like', object: 'photo' + ph.id, hash: ph.hash, from: 'photo_viewer'}, {
- 2296. - onDone: function(count, title) {
- 2297. - if (cur.pvListId == listId && cur.pvIndex == index) {
- 2298. - return Photoview.likeUpdate(my, count, title);
- 2299. - }
- 2300. - cur.pvCommsLikes[ph.id][1] = count;
- 2301. - ph.liked = my;
- 2302. - }
- 2303. - });
- 2304. - Photoview.likeUpdate(my, cur.pvCommsLikes[ph.id][1] + (my ? 1 : -1));
- 2305. - },
- 2306. - likeShare: function(hash) {
- 2307. - if (!vk.id) return;
- 2308. - var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index];
- 2309. - var el = ge('like_share_photo' + ph.id), was = isChecked(el);
- 2310. - checkbox(el);
- 2311. - ajax.post('like.php', {act: 'a_do_' + (was ? 'un' : '') + 'publish', object: 'photo' + ph.id, list: listId, hash: hash, from: 'photo_viewer'}, {
- 2312. - onDone: function(count, title) {
- 2313. - if (cur.pvListId == listId && cur.pvIndex == index) {
- 2314. - return Photoview.likeUpdate(true, count, title);
- 2315. - }
- 2316. - cur.pvCommsLikes[ph.id][1] = count;
- 2317. - ph.liked = true;
- 2318. - }
- 2319. - });
- 2320. - Photoview.likeUpdate(true, cur.pvCommsLikes[ph.id][1] + (ph.liked ? 0 : 1));
- 2321. - },
- 2322. - likeOver: function() {
- 2323. - var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index];
- 2324. - var icon = cur.pvLikeIcon;
- 2325. - if (!ph.liked) {
- 2326. - setTimeout(animate.pbind(icon, {opacity: 1}, 200, false), 1);
- 2327. - } else {
- 2328. - setStyle(icon, {opacity: 1});
- 2329. - }
- 2330. - var linkW = cur.pvLikeLink.offsetWidth;
- 2331. -
- 2332. - showTooltip(icon.parentNode, {
- 2333. - url: 'like.php',
- 2334. - params: {act: 'a_get_stats', object: 'photo' + ph.id, list: listId},
- 2335. - slide: 15,
- 2336. - shift: [0, 5, 9],
- 2337. - ajaxdt: 100,
- 2338. - showdt: 400,
- 2339. - hidedt: 200,
- 2340. - className: 'rich like_tt',
- 2341. - init: function (tt) {
- 2342. - if (!tt.container) return;
- 2343. - var bp = geByClass1('bottom_pointer', tt.container, 'div');
- 2344. - var tp = geByClass1('top_pointer', tt.container, 'div');
- 2345. - setStyle(bp, {marginLeft: linkW + 2});
- 2346. - setStyle(tp, {marginLeft: linkW + 2});
- 2347. - }
- 2348. - });
- 2349. - },
- 2350. - likeOut: function() {
- 2351. - var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index];
- 2352. - if (!ph.liked) {
- 2353. - setTimeout(animate.pbind(cur.pvLikeIcon, {opacity: 0.4}, 200, false), 1);
- 2354. - }
- 2355. - },
- 2356. -
- 2357. - tagOver: function(el) {
- 2358. - animate(el, {backgroundColor: '#6B8DB1'}, 200);
- 2359. - showTooltip(el, {text: getLang('photos_delete_tag'), shift: [0, -2, 0]});
- 2360. - },
- 2361. - tagOut: function(el) {
- 2362. - if (!el.parentNode || !el.parentNode.parentNode) return;
- 2363. - animate(el, {backgroundColor: '#C4D2E1'}, 200);
- 2364. - },
- 2365. - deleteTag: function(tagId) {
- 2366. - var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index];
- 2367. - if (ph.tagid) {
- 2368. - if (isVisible('pv_tag_handling')) return;
- 2369. - } else {
- 2370. - if (ge('pv_action_progress')) return;
- 2371. - }
- 2372. -
- 2373. - ajax.post('al_photos.php', {act: 'delete_tag', photo: ph.id, tag: tagId, hash: ph.hash}, {onDone: function(text, tags, tagged, html, padres) {
- 2374. - if (_pads.shown == 'ph') {
- 2375. - Pads.phDone(ph.id, false, padres);
- 2376. - }
- 2377. - Pads.invalidate('ph');
- 2378. - if (ph.tagid) {
- 2379. - ph.taginfo = ph.tagid = false;
- 2380. - cleanElems('pv_confirm_tag', 'pv_delete_tag', 'pv_prof_cancel', 'pv_prof_done');
- 2381. - cur.pvTagInfo.innerHTML = '<div class="progress fl_r" id="pv_spam_progress"></div><div class="pv_info">' + text + '</div>';
- 2382. - } else {
- 2383. - Photoview.actionInfo().innerHTML = text;
- 2384. - }
- 2385. - Photoview.updateHeight();
- 2386. - if (tags !== undefined) {
- 2387. - ph.tags = tags;
- 2388. - ph.tagged = tagged;
- 2389. - ph.tagshtml = html;
- 2390. - if (cur.pvListId == listId && cur.pvIndex == index) {
- 2391. - Photoview.setTags(html);
- 2392. -
- 2393. - ((!ph.taginfo && ph.actions.tag && tags[0] < cur.pvMaxTags) ? show : hide)(cur.pvTagLink);
- 2394. - }
- 2395. - }
- 2396. - }, onFail: function(text) {
- 2397. - if (!text) return;
- 2398. - Photoview.actionInfo().innerHTML = text;
- 2399. - return true;
- 2400. - }, showProgress: function() {
- 2401. - if (ph.tagid) {
- 2402. - hide(ge('pv_confirm_tag').parentNode, ge('pv_delete_tag').parentNode);
- 2403. - show('pv_tag_handling');
- 2404. - } else {
- 2405. - Photoview.actionInfo().innerHTML = '<div id="pv_action_progress" class="progress" style="display: block"></div>';
- 2406. - }
- 2407. - }, hideProgress: function() {
- 2408. - if (ph.tagid) {
- 2409. - hide('pv_tag_handling');
- 2410. - show(ge('pv_confirm_tag').parentNode, ge('pv_delete_tag').parentNode);
- 2411. - } else {
- 2412. - re(Photoview.actionInfo());
- 2413. - }
- 2414. - }});
- 2415. - },
- 2416. - restoreTag: function(tagId) {
- 2417. - if (ge('pv_action_progress')) return;
- 2418. -
- 2419. - var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index];
- 2420. - ajax.post('al_photos.php', {act: 'restore_tag', photo: ph.id, tag: tagId, hash: ph.hash}, {onDone: function(text, tags, tagged, html) {
- 2421. - if (tags !== undefined) {
- 2422. - ph.tags = tags;
- 2423. - ph.tagged = tagged;
- 2424. - ph.tagshtml = html;
- 2425. - if (cur.pvListId == listId && cur.pvIndex == index) {
- 2426. - Photoview.setTags(html);
- 2427. - ((!ph.taginfo && ph.actions.tag && tags[0] < cur.pvMaxTags) ? show : hide)(cur.pvTagLink);
- 2428. - }
- 2429. - }
- 2430. - Photoview.actionInfo().innerHTML = text;
- 2431. - }, onFail: function(text) {
- 2432. - if (!text) return;
- 2433. - Photoview.actionInfo().innerHTML = text;
- 2434. - return true;
- 2435. - }, showProgress: function() {
- 2436. - Photoview.actionInfo().innerHTML = '<div id="pv_action_progress" class="progress" style="display: block"></div>';
- 2437. - }, hideProgress: function() {
- 2438. - re(Photoview.actionInfo());
- 2439. - }});
- 2440. - },
- 2441. -
- 2442. - confirmTag: function(tagId) {
- 2443. - var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index];
- 2444. - if (isVisible('pv_tag_handling')) return;
- 2445. -
- 2446. - ajax.post('al_photos.php', {act: 'confirm_tag', tag: tagId, photo: ph.id, hash: ph.hash}, {onDone: function(tags, tagged, html, padres) {
- 2447. - if (_pads.shown == 'ph') {
- 2448. - Pads.phDone(ph.id, false, padres);
- 2449. - }
- 2450. - Pads.invalidate('ph');
- 2451. - ph.tags = tags;
- 2452. - ph.tagged = tagged;
- 2453. - ph.tagshtml = html;
- 2454. - ph.taginfo = ph.tagid = false;
- 2455. - if (listId == cur.pvListId && index == cur.pvIndex) {
- 2456. - Photoview.setTags(html);
- 2457. - ((!ph.taginfo && ph.actions.tag && tags[0] < cur.pvMaxTags) ? show : hide)(cur.pvTagLink);
- 2458. - cleanElems('pv_confirm_tag', 'pv_delete_tag', 'pv_prof_cancel', 'pv_prof_done');
- 2459. - cur.pvTagInfo.innerHTML = '';
- 2460. - hide(cur.pvTagInfo);
- 2461. - }
- 2462. - Photoview.updateHeight();
- 2463. - }, showProgress: function() {
- 2464. - hide(ge('pv_confirm_tag').parentNode, ge('pv_delete_tag').parentNode);
- 2465. - show('pv_tag_handling');
- 2466. - }, hideProgress: function() {
- 2467. - hide('pv_tag_handling');
- 2468. - show(ge('pv_confirm_tag').parentNode, ge('pv_delete_tag').parentNode);
- 2469. - }});
- 2470. - },
- 2471. -
- 2472. - toProfileTag: function() {
- 2473. - var tag = cur.pvData[cur.pvListId][cur.pvIndex].tagged[vk.id];
- 2474. - if (tag && !cur.pvTagger) {
- 2475. - Photoview.showTag(tag);
- 2476. - }
- 2477. - },
- 2478. - showTag: function(tagId) {
- 2479. - clearTimeout(cur.pvHidingTag);
- 2480. - if (cur.pvShowingTag == tagId) return;
- 2481. -
- 2482. - var coords = clone(cur.pvData[cur.pvListId][cur.pvIndex].tags[tagId]);
- 2483. - each(coords, function(i, v) {
- 2484. - var wh = cur[(i % 2) ? 'pvPhHeight' : 'pvPhWidth'];
- 2485. - coords[i] = Math.max(3, Math.min(wh - 3, positive(v * wh / 100)));
- 2486. - });
- 2487. - setStyle(cur.pvTagFrame, {
- 2488. - marginLeft: coords[0] + 'px',
- 2489. - marginTop: coords[1] + 'px',
- 2490. - width: (coords[2] - coords[0]) + 'px',
- 2491. - height: (coords[3] - coords[1]) + 'px'
- 2492. - });
- 2493. - setStyle(cur.pvTagFrame.firstChild, {
- 2494. - marginLeft: -coords[0] + 'px',
- 2495. - marginTop: -coords[1] + 'px'
- 2496. - });
- 2497. - cur.pvShowingTag = tagId;
- 2498. - if (browser.msie) {
- 2499. - show(cur.pvTagFrame, cur.pvTagFaded);
- 2500. - } else {
- 2501. - fadeIn(cur.pvTagFrame, 200);
- 2502. - fadeIn(cur.pvTagFaded, 200);
- 2503. - }
- 2504. - },
- 2505. - showDynTag: function(tagId) {
- 2506. - clearTimeout(cur.pvHidingTag);
- 2507. - if (cur.pvShowingTag == tagId) return;
- 2508. -
- 2509. - var coords = clone(cur.pvData[cur.pvListId][cur.pvIndex].tags[tagId]), el = ge('pv_tag' + tagId);
- 2510. - if (!el) return;
- 2511. -
- 2512. - each(coords, function(i, v) {
- 2513. - coords[i] = positive(v * cur[(i % 2) ? 'pvPhHeight' : 'pvPhWidth'] / 100);
- 2514. - });
- 2515. - setStyle(cur.pvTagPerson, {
- 2516. - marginLeft: coords[0] + 'px',
- 2517. - marginTop: coords[3] + 'px',
- 2518. - minWidth: (coords[2] - coords[0]) + 'px'
- 2519. - });
- 2520. - cur.pvTagPerson.innerHTML = el.firstChild.innerHTML;
- 2521. - var s = getSize(cur.pvTagPerson);
- 2522. - if (coords[3] + s[1] > cur.pvPhHeight) {
- 2523. - setStyle(cur.pvTagPerson, {marginTop: (cur.pvPhHeight - s[1]) + 'px'});
- 2524. - }
- 2525. - cur.pvTagPerson.onmouseover = Photoview.showDynTag.pbind(tagId);
- 2526. - cur.pvShowingTag = tagId;
- 2527. - if (browser.msie){
- 2528. - show(cur.pvTagPerson);
- 2529. - } else {
- 2530. - fadeIn(cur.pvTagPerson, 200);
- 2531. - }
- 2532. - },
- 2533. - hideTag: function(quick) {
- 2534. - if (quick === true) {
- 2535. - clearTimeout(cur.pvHidingTag);
- 2536. - hide(cur.pvTagFaded, cur.pvTagFrame, cur.pvTagPerson);
- 2537. - cur.pvShowingTag = false;
- 2538. - }
- 2539. - if (!cur.pvShowingTag) return;
- 2540. -
- 2541. - clearTimeout(cur.pvHidingTag);
- 2542. - cur.pvHidingTag = setTimeout(function() {
- 2543. - if (browser.msie) {
- 2544. - hide(cur.pvTagFaded, cur.pvTagFrame, cur.pvTagPerson);
- 2545. - } else if (cur.pvShowingTag) {
- 2546. - fadeOut(cur.pvTagFaded, 200);
- 2547. - fadeOut(cur.pvTagFrame, 200);
- 2548. - fadeOut(cur.pvTagPerson, 200);
- 2549. - }
- 2550. - cur.pvShowingTag = false;
- 2551. - }, 0);
- 2552. - },
- 2553. - realOffset: function(listId, offset, inc) {
- 2554. - var res = offset;
- 2555. - if (!cur.pvData || !cur.pvData[listId]) {
- 2556. - return res;
- 2557. - }
- 2558. - for (var i = 0; i < offset; i++) {
- 2559. - if (cur.pvData[listId][i] && (cur.pvData[listId][i].deleted || cur.pvData[listId][i].moved)) {
- 2560. - res += inc;
- 2561. - }
- 2562. - }
- 2563. - return res;
- 2564. - },
- 2565. - realCount: function(listId, count) {
- 2566. - var res = count;
- 2567. - if (!cur.pvData || !cur.pvData[listId]) {
- 2568. - return res;
- 2569. - }
- 2570. - for (var i = 0; i < cur.pvData[listId].length; i++) {
- 2571. - if (cur.pvData[listId][i] && (cur.pvData[listId][i].deleted || cur.pvData[listId][i].moved)) {
- 2572. - res++;
- 2573. - }
- 2574. - }
- 2575. - return res;
- 2576. - },
- 2577. -
- 2578. - list: function(photoId, listId, realList) {
- 2579. - if (realList == 'deleted') return;
- 2580. - if (!cur.pvList) cur.pvList = {};
- 2581. - cur.pvList[photoId + '_' + listId] = realList;
- 2582. - },
- 2583. - loaded: function(listId, count, offset, data, opts) {
- 2584. - if (listId == 'deleted') return;
- 2585. - if (opts) {
- 2586. - extend(cur, {
- 2587. - lang: extend(cur.lang || {}, opts.lang),
- 2588. - pvHash: opts.hash,
- 2589. - pvCommLimit: opts.commlimit,
- 2590. - pvMaxTags: opts.maxtags,
- 2591. - pvReasons: opts.reasons,
- 2592. - pvReplyNames: extend(cur.pvReplyNames || {}, opts.names || {}),
- 2593. - pvMediaTypes: opts.media
- 2594. - });
- 2595. - if (!cur.options) cur.options = {};
- 2596. - if (!cur.options.share) cur.options.share = opts.share;
- 2597. - val(cur.pvAsGroup, '<div></div>' + getLang('wall_reply_as_group'));
- 2598. - val('pv_comment_header', getLang('photos_yourcomment'));
- 2599. - val(domFC(ge('pv_add_media')), getLang('global_add_media'));
- 2600. - }
- 2601. - count = Photoview.realCount(listId, count);
- 2602. - offset = Photoview.realOffset(listId, offset, 1);
- 2603. - if (!cur.pvData) cur.pvData = {};
- 2604. - if (!cur.pvCommsLikes) cur.pvCommsLikes = {};
- 2605. - if (!cur.pvData[listId]) {
- 2606. - cur.pvData[listId] = new Array(count);
- 2607. - } else if (cur.pvData[listId].length < count) {
- 2608. - for (var i = cur.pvData[listId].length; i < count; ++i) {
- 2609. - cur.pvData[listId].push(undefined);
- 2610. - }
- 2611. - } else if (cur.pvData[listId].length > count) {
- 2612. - cur.pvData[listId] = cur.pvData[listId].slice(0, count);
- 2613. - }
- 2614. - var nw = vkNow();
- 2615. - for (var i = 0, len = data.length; i < len; ++i) {
- 2616. - var index = (offset + i), ph = clone(data[i]);
- 2617. - while (index >= count) index -= count;
- 2618. - cur.pvCommsLikes[ph.id] = [ph.comments, ph.likes, vkNow(), false];
- 2619. - delete(ph.comments);
- 2620. - delete(ph.likes);
- 2621. - cur.pvData[listId][index] = ph;
- 2622. - }
- 2623. - },
- 2624. - showDeleted: function(lst, msg, spm) {
- 2625. - if (cur.pvShown && cur.pvListId == 'temp') {
- 2626. - msg += '<br><br>' + spm;
- 2627. - }
- 2628. -
- 2629. - showFastBox({title: getLang('global_error'), onHide: function() {
- 2630. - if (cur.pvShown && cur.pvListId == 'temp') {
- 2631. - Photoview.hide(true);
- 2632. - }
- 2633. - }}, msg);
- 2634. - },
- 2635. - spamDeleted: function(el, ph, hash) {
- 2636. - if (isVisible(curBox().progress)) return;
- 2637. - ajax.post('al_photos.php', {act: 'spam_photo', photo: ph, hash: hash, from: 'deleted'}, {onDone: function(text) {
- 2638. - domPN(el).replaceChild(ce('span', {innerHTML: text}), el);
- 2639. - }, showProgress: curBox().showProgress, hideProgress: curBox().hideProgress});
- 2640. - },
- 2641. - showPhoto: function(photoId, listId, options, just) {
- 2642. - if (!cur.pvShown || cur.pvListId == 'temp' && !cur.pvWasShown || options.noHistory !== undefined) {
- 2643. - debugLog('in showPhoto noHistory: ' + options.noHistory);
- 2644. - cur.pvNoHistory = options.noHistory;
- 2645. - cur.pvHistoryLength = options.noHistory ? 0 : (options.histLen || 0);
- 2646. - }
- 2647. - extend(cur, {
- 2648. - pvJumpTo: options.jumpTo || false,
- 2649. - pvJumpFrom: false,
- 2650. - pvJumpSteps: 0
- 2651. - });
- 2652. - listId = cur.pvList && cur.pvList[photoId + '_' + listId] || listId;
- 2653. - if (!cur.pvData || !cur.pvData[listId]) {
- 2654. - return;
- 2655. - }
- 2656. - var data = cur.pvData[listId], whole = true, onh = cur.pvOptions && cur.pvOptions.onHide;
- 2657. - cur.pvOptions = options;
- 2658. - if (!cur.pvOptions.onHide) cur.pvOptions.onHide = onh;
- 2659. - for (var i = 0, len = data.length; i < len; ++i) {
- 2660. - if (data[i]) {
- 2661. - if (data[i].id === photoId) {
- 2662. - Photoview.show(listId, i, false, options.root);
- 2663. - if (options.onShow) {
- 2664. - options.onShow();
- 2665. - }
- 2666. - return false;
- 2667. - }
- 2668. - } else {
- 2669. - whole = false;
- 2670. - }
- 2671. - }
- 2672. - if (whole && just) {
- 2673. - if (options.onEmpty) {
- 2674. - options.onEmpty();
- 2675. - }
- 2676. - return false;
- 2677. - }
- 2678. - },
- 2679. -
- 2680. - loadedAlbums: function(ownerId, html, preload, preloadPhotos, opts) {
- 2681. - if (!cur.pvAlbumsData) return;
- 2682. -
- 2683. - ajax.preload('al_photos.php', extend({offset: opts.offset, part: 1, owner: ownerId}, {act: 'show_albums'}), preload);
- 2684. - ajax.preload('al_photos.php', extend({offset: opts.photos_offset, part: 1, owner: ownerId}, {act: 'show_albums', only_photos: 1}), preloadPhotos);
- 2685. -
- 2686. - cur.pvAlbumsData[ownerId] = {
- 2687. - html: html,
- 2688. - opts: opts
- 2689. - };
- 2690. - if (cur.pvAlbumsShowing == ownerId) {
- 2691. - Photoview.doShowAlbums(ownerId, false);
- 2692. - boxRefreshCoords(layer);
- 2693. - }
- 2694. - },
- 2695. - showAlbums: function(ownerId, options) {
- 2696. - ownerId = intval(ownerId);
- 2697. - if (!cur.pvAlbumsData) cur.pvAlbumsData = {};
- 2698. - if (cur.pvListId == 'temp') {
- 2699. - cur.pvCancelLoad();
- 2700. - }
- 2701. -
- 2702. - cur.pvNoHistory = options.noHistory;
- 2703. - cur.pvHistoryLength = 0;
- 2704. - cur.pvAlbumsShowing = ownerId;
- 2705. - var of = options.onFail;
- 2706. - if (!cur.pvAlbumsData[ownerId]) {
- 2707. - cur.pvAlbumsData[ownerId] = 'loading';
- 2708. - ajax.post('al_photos.php', {act: 'show_albums', owner: ownerId}, extend(options, {onDone: Photoview.loadedAlbums, onFail: function(t) {
- 2709. - if (of) of(t);
- 2710. - delete(cur.pvAlbumsData[ownerId]);
- 2711. - cur.pvAlbumsData[ownerId];
- 2712. - layers.fullhide(true);
- 2713. - return true;
- 2714. - }
- 2715. - }));
- 2716. - } else if (cur.pvAlbumsData[ownerId] != 'loading') {
- 2717. - Photoview.doShowAlbums(ownerId, false);
- 2718. - boxRefreshCoords(layer);
- 2719. - }
- 2720. - },
- 2721. - loadedAlbum: function(albumRaw, html, preload, opts) {
- 2722. - if (!cur.pvAlbumData) return;
- 2723. -
- 2724. - if (preload) {
- 2725. - ajax.preload('al_photos.php', extend({offset: opts.offset, part: 1, album: albumRaw}, {act: 'show_album'}), preload);
- 2726. - }
- 2727. -
- 2728. - cur.pvAlbumData[albumRaw] = {
- 2729. - html: html,
- 2730. - opts: opts
- 2731. - };
- 2732. - if (cur.pvAlbumShowing == albumRaw) {
- 2733. - Photoview.doShowAlbum(albumRaw, false);
- 2734. - boxRefreshCoords(layer);
- 2735. - }
- 2736. - },
- 2737. - showAlbum: function(albumRaw, options) {
- 2738. - if (!cur.pvAlbumData) cur.pvAlbumData = {};
- 2739. - if (cur.pvListId == 'temp') {
- 2740. - cur.pvCancelLoad();
- 2741. - }
- 2742. -
- 2743. - cur.pvNoHistory = options.noHistory;
- 2744. - cur.pvHistoryLength = 0;
- 2745. - cur.pvAlbumShowing = albumRaw;
- 2746. - var of = options.onFail;
- 2747. - if (!cur.pvAlbumData[albumRaw]) {
- 2748. - cur.pvAlbumData[albumRaw] = 'loading';
- 2749. - ajax.post('al_photos.php', {act: 'show_album', album: albumRaw}, extend(options, {onDone: Photoview.loadedAlbum, onFail: function(t) {
- 2750. - if (of) of(t);
- 2751. - delete(cur.pvAlbumData[albumRaw]);
- 2752. - cur.pvAlbumData[albumRaw];
- 2753. - layers.fullhide(true);
- 2754. - return true;
- 2755. - }
- 2756. - }));
- 2757. - } else if (cur.pvAlbumData[albumRaw] != 'loading') {
- 2758. - Photoview.doShowAlbum(albumRaw, false);
- 2759. - boxRefreshCoords(layer);
- 2760. - }
- 2761. - },
- 2762. - loadedTagged: function(ownerId, html, preload, preloadPhotos, opts) {
- 2763. - if (!cur.pvPhotoTagData) return;
- 2764. -
- 2765. - ajax.preload('al_photos.php', extend({offset: opts.offset, part: 1, owner: ownerId}, {act: 'show_tag'}), preload);
- 2766. - ajax.preload('al_photos.php', extend({offset: opts.photos_offset, part: 1, owner: ownerId}, {act: 'show_tag', only_photos: 1}), preloadPhotos);
- 2767. -
- 2768. - cur.pvPhotoTagData[ownerId] = {
- 2769. - html: html,
- 2770. - opts: opts
- 2771. - };
- 2772. - if (cur.pvPhotoTagShowing == ownerId) {
- 2773. - Photoview.doShowTagged(ownerId, false);
- 2774. - boxRefreshCoords(layer);
- 2775. - }
- 2776. - },
- 2777. - showTagged: function(ownerId, options) {
- 2778. - ownerId = intval(ownerId);
- 2779. - if (!cur.pvPhotoTagData) cur.pvPhotoTagData = {};
- 2780. - if (cur.pvListId == 'temp') {
- 2781. - cur.pvCancelLoad();
- 2782. - }
- 2783. -
- 2784. - cur.pvNoHistory = options.noHistory;
- 2785. - cur.pvHistoryLength = 0;
- 2786. - cur.pvPhotoTagShowing = ownerId;
- 2787. - var of = options.onFail;
- 2788. - if (!cur.pvPhotoTagData[ownerId]) {
- 2789. - cur.pvPhotoTagData[ownerId] = 'loading';
- 2790. - ajax.post('al_photos.php', {act: 'show_tag', mid: ownerId}, extend(options, {onDone: Photoview.loadedTagged, onFail: function(t) {
- 2791. - if (of) of(t);
- 2792. - delete(cur.pvPhotoTagData[ownerId]);
- 2793. - cur.pvPhotoTagData[ownerId];
- 2794. - layers.fullhide(true);
- 2795. - return true;
- 2796. - }
- 2797. - }));
- 2798. - } else if (cur.pvPhotoTagData[ownerId] != 'loading') {
- 2799. - Photoview.doShowTagged(ownerId, false);
- 2800. - boxRefreshCoords(layer);
- 2801. - }
- 2802. - },
- 2803. - loadedVideoTags: function(ownerId, html, preload, opts) {
- 2804. - ajax.preload('/al_video.php', {act: 'show_video_tags', offset: opts.offset, part: 1, mid: ownerId}, preload);
- 2805. -
- 2806. - cur.pvVideoTagsData = {
- 2807. - html: html,
- 2808. - opts: opts
- 2809. - };
- 2810. - if (cur.pvVideoTagShowing == ownerId) {
- 2811. - Photoview.doShowVideoTags(ownerId, false);
- 2812. - boxRefreshCoords(layer);
- 2813. - }
- 2814. - },
- 2815. - showVideoTags: function(ownerId, options) {
- 2816. - cur.pvNoHistory = options.noHistory;
- 2817. - cur.pvHistoryLength = 0;
- 2818. - cur.pvVideoTagShowing = ownerId;
- 2819. - var of = options.onFail;
- 2820. - if (!cur.pvVideoTagsData) {
- 2821. - cur.pvVideoTagsData = 'loading';
- 2822. - ajax.post('/al_video.php', {act: 'show_video_tags', mid: ownerId}, extend(options, {onDone: Photoview.loadedVideoTags, onFail: function(t) {
- 2823. - if (of) of(t);
- 2824. - delete(cur.pvVideoTagsData);
- 2825. - layers.fullhide && layers.fullhide(true);
- 2826. - return true;
- 2827. - }
- 2828. - }));
- 2829. - } else if (cur.pvVideoTagsData != 'loading') {
- 2830. - Photoview.doShowVideoTags(ownerId, false);
- 2831. - boxRefreshCoords(layer);
- 2832. - }
- 2833. - },
- 2834. - scrollResize: function() {
- 2835. - if (browser.mobile || !cur.pvShown || (!cur.pvAlbumsShown && !cur.pvAlbumShown && !cur.pvPhotoTagShown && !cur.pvVideoTagsShown)) return;
- 2836. -
- 2837. - var bt = lastWindowHeight,
- 2838. - lnk = cur.pvVideoTagsShown ? ge('pva_more_videos') : (cur.pvAlbumsShown ? ge('pva_more_photos') : ge('pvsa_more_photos')),
- 2839. - albumsLnk = ge('pva_more');
- 2840. -
- 2841. - if (isVisible(lnk) && bt > getXY(lnk)[1] - (browser.msie6 ? 0 : scrollGetY())) {
- 2842. - if (cur.pvVideoTagsShown) {
- 2843. - Photoview.loadVideoTags();
- 2844. - } else if (cur.pvPhotoTagShown) {
- 2845. - Photoview.loadTaggedPhotos();
- 2846. - } else if (cur.pvAlbumsShown) {
- 2847. - Photoview.loadAlbumsPhotos();
- 2848. - } else {
- 2849. - Photoview.loadAlbumPhotos();
- 2850. - }
- 2851. - }
- 2852. - if (cur.pvAlbumsShown && cur.pvShowAllAlbums && isVisible(albumsLnk) && bt > getXY(albumsLnk)[1] - (browser.msie6 ? 0 : scrollGetY())) {
- 2853. - Photoview.loadAlbums();
- 2854. - }
- 2855. - },
- 2856. - loadAlbums: function() {
- 2857. - cur.pvShowAllAlbums = true;
- 2858. - Photoview.loadAlbumsPhotos(true);
- 2859. - },
- 2860. - loadedAlbumsPhotos: function(off, rows, albums) {
- 2861. - cur.pvaLoading = 0;
- 2862. -
- 2863. - if (!cur.pvAlbumsShown) return;
- 2864. -
- 2865. - if (albums) {
- 2866. - cur.pvaOffset = off;
- 2867. - } else {
- 2868. - cur.pvaPhotosOffset = off;
- 2869. - }
- 2870. -
- 2871. - var cont = albums ? ge('pva_content') : ge('pva_content_photos'),
- 2872. - more = albums ? ge('pva_more') : ge('pva_more_photos'),
- 2873. - opts = albums ? {act: 'show_albums'} : {act: 'show_albums', only_photos: 1},
- 2874. - offset = albums ? cur.pvaOffset : cur.pvaPhotosOffset,
- 2875. - count = albums ? cur.pvaCount : cur.pvaPhotosCount,
- 2876. - d = ce('div', {innerHTML: rows});
- 2877. - if (!cont) return;
- 2878. -
- 2879. - while (d.firstChild) {
- 2880. - cont.appendChild(d.firstChild);
- 2881. - }
- 2882. -
- 2883. - Photoview.onResize();
- 2884. -
- 2885. - if (off >= count || !rows) {
- 2886. - hide(more);
- 2887. - return;
- 2888. - }
- 2889. - cur.pvaLoading = 1;
- 2890. -
- 2891. - ajax.post('al_photos.php', extend({offset: offset, part: 1, owner: cur.pvAlbumsShown}, opts || {}), {cache: 1, onDone: function() {
- 2892. - debugLog('preload done: ' + cur.pvaLoading);
- 2893. - if (cur.pvaLoading == 2) {
- 2894. - Photoview.loadedAlbumsPhotos.apply(window, arguments);
- 2895. - } else {
- 2896. - cur.pvaLoading = false;
- 2897. - }
- 2898. - }, onFail: function() {
- 2899. - cur.pvaLoading = 0;
- 2900. - return true;
- 2901. - }});
- 2902. - },
- 2903. - loadAlbumsPhotos: function(albums) {
- 2904. - var more = albums ? ge('pva_more') : ge('pva_more_photos'),
- 2905. - progress = albums ? ge('pva_more_prg') : ge('pva_more_photos_prg'),
- 2906. - opts = albums ? {act: 'show_albums'} : {act: 'show_albums', only_photos: 1},
- 2907. - offset = albums ? cur.pvaOffset : cur.pvaPhotosOffset;
- 2908. - if (!cur.pvAlbumsShown || !more || !isVisible(more) || isVisible(progress)) return;
- 2909. -
- 2910. - if (cur.pvaLoading) {
- 2911. - cur.pvaLoading = 2;
- 2912. - return;
- 2913. - }
- 2914. -
- 2915. - ajax.post('al_photos.php', extend({offset: offset, part: 1, owner: cur.pvAlbumsShown}, opts || {}), {onDone: Photoview.loadedAlbumsPhotos, onFail: function() {
- 2916. - cur.pvaLoading = 0;
- 2917. - return true;
- 2918. - }, showProgress: function() {
- 2919. - show(progress);
- 2920. - hide(more.firstChild);
- 2921. - }, hideProgress: function() {
- 2922. - show(more.firstChild);
- 2923. - hide(progress);
- 2924. - }, cache: 1});
- 2925. - },
- 2926. - loadedAlbumPhotos: function(off, rows) {
- 2927. - cur.pvaLoading = 0;
- 2928. -
- 2929. - if (!cur.pvAlbumShown) return;
- 2930. -
- 2931. - cur.pvsaOffset = off;
- 2932. -
- 2933. - var cont = ge('pvsa_content_photos'),
- 2934. - more = ge('pvsa_more_photos');
- 2935. - if (!cont) return;
- 2936. -
- 2937. - cont.appendChild(cf(rows));
- 2938. -
- 2939. - if (off >= cur.pvsaCount) {
- 2940. - hide(more);
- 2941. - Photoview.onResize();
- 2942. - return;
- 2943. - }
- 2944. -
- 2945. - Photoview.onResize();
- 2946. - cur.pvsaLoading = 1;
- 2947. -
- 2948. - ajax.post('al_photos.php', extend({offset: cur.pvsaOffset, part: 1, album: cur.pvAlbumShown}, {act: 'show_album'}), {cache: 1, onDone: function() {
- 2949. - debugLog('preload done: ', cur.pvsaLoading);
- 2950. - if (cur.pvsaLoading == 2) {
- 2951. - Photoview.loadedAlbumPhotos.apply(window, arguments);
- 2952. - } else {
- 2953. - cur.pvsaLoading = false;
- 2954. - }
- 2955. - }, onFail: function() {
- 2956. - cur.pvsaLoading = 0;
- 2957. - return true;
- 2958. - }});
- 2959. - },
- 2960. - loadAlbumPhotos: function() {
- 2961. - var more = ge('pvsa_more_photos'),
- 2962. - progress = ge('pvsa_more_photos_prg'),
- 2963. - offset = cur.pvsaOffset;
- 2964. - if (!cur.pvAlbumShown || !more || !isVisible(more) || isVisible(progress)) return;
- 2965. -
- 2966. - if (cur.pvsaLoading) {
- 2967. - cur.pvsaLoading = 2;
- 2968. - return;
- 2969. - }
- 2970. -
- 2971. - ajax.post('al_photos.php', {act: 'show_album', album: cur.pvAlbumShown, offset: offset, part: 1}, {onDone: Photoview.loadedAlbumPhotos, onFail: function() {
- 2972. - cur.pvsaLoading = 0;
- 2973. - return true;
- 2974. - }, showProgress: function() {
- 2975. - show(progress);
- 2976. - hide(more.firstChild);
- 2977. - }, hideProgress: function() {
- 2978. - show(more.firstChild);
- 2979. - hide(progress);
- 2980. - }, cache: 1});
- 2981. - },
- 2982. - loadedTaggedPhotos: function(off, rows) {
- 2983. - cur.pvaLoading = 0;
- 2984. -
- 2985. - if (!cur.pvPhotoTagShown) return;
- 2986. -
- 2987. - cur.pvsaOffset = off;
- 2988. -
- 2989. - var cont = ge('pvsa_content_photos'),
- 2990. - more = ge('pvsa_more_photos');
- 2991. - if (!cont) return;
- 2992. -
- 2993. - cont.appendChild(cf(rows));
- 2994. -
- 2995. - Photoview.onResize();
- 2996. -
- 2997. - if (off >= cur.pvsaCount || !rows) {
- 2998. - hide(more);
- 2999. - return;
- 3000. - }
- 3001. - cur.pvsaLoading = 1;
- 3002. -
- 3003. - ajax.post('al_photos.php', extend({offset: cur.pvsaOffset, part: 1, mid: cur.pvPhotoTagShown}, {act: 'show_tag'}), {cache: 1, onDone: function() {
- 3004. - debugLog('preload done: ', cur.pvsaLoading);
- 3005. - if (cur.pvsaLoading == 2) {
- 3006. - Photoview.loadedTaggedPhotos.apply(window, arguments);
- 3007. - } else {
- 3008. - cur.pvsaLoading = false;
- 3009. - }
- 3010. - }, onFail: function() {
- 3011. - cur.pvsaLoading = 0;
- 3012. - return true;
- 3013. - }});
- 3014. - },
- 3015. - loadTaggedPhotos: function(albums) {
- 3016. - var more = ge('pvsa_more_photos'),
- 3017. - progress = ge('pvsa_more_photos_prg'),
- 3018. - offset = cur.pvsaOffset;
- 3019. - if (!cur.pvPhotoTagShown || !more || !isVisible(more) || isVisible(progress)) return;
- 3020. -
- 3021. - if (cur.pvsaLoading) {
- 3022. - cur.pvsaLoading = 2;
- 3023. - return;
- 3024. - }
- 3025. -
- 3026. - ajax.post('al_photos.php', {act: 'show_tag', mid: cur.pvPhotoTagShown, offset: offset, part: 1}, {onDone: Photoview.loadedTaggedPhotos, onFail: function() {
- 3027. - cur.pvsaLoading = 0;
- 3028. - return true;
- 3029. - }, showProgress: function() {
- 3030. - show(progress);
- 3031. - hide(more.firstChild);
- 3032. - }, hideProgress: function() {
- 3033. - show(more.firstChild);
- 3034. - hide(progress);
- 3035. - }, cache: 1});
- 3036. - },
- 3037. - loadedMoreVideoTags: function(off, rows) {
- 3038. - cur.pvaLoading = 0;
- 3039. -
- 3040. - if (!cur.pvVideoTagsShown) return;
- 3041. -
- 3042. - cur.pvsaOffset = off;
- 3043. -
- 3044. - var cont = ge('pva_video_tags'),
- 3045. - more = ge('pva_more_videos');
- 3046. - if (!cont) return;
- 3047. -
- 3048. - cont.appendChild(cf(rows));
- 3049. -
- 3050. - Photoview.onResize();
- 3051. -
- 3052. - if (off >= cur.pvsaCount || !rows) {
- 3053. - hide(more);
- 3054. - return;
- 3055. - }
- 3056. - cur.pvsaLoading = 1;
- 3057. -
- 3058. - ajax.post('/al_video.php', extend({act: 'show_video_tags', offset: cur.pvsaOffset, part: 1, mid: cur.pvVideoTagsShown}), {cache: 1, onDone: function() {
- 3059. - debugLog('preload done: ', cur.pvsaLoading);
- 3060. - if (cur.pvsaLoading == 2) {
- 3061. - Photoview.loadedMoreVideoTags.apply(window, arguments);
- 3062. - } else {
- 3063. - cur.pvsaLoading = false;
- 3064. - }
- 3065. - }, onFail: function() {
- 3066. - cur.pvsaLoading = 0;
- 3067. - return true;
- 3068. - }});
- 3069. - },
- 3070. - loadVideoTags: function(albums) {
- 3071. - var more = ge('pva_more_videos'),
- 3072. - progress = ge('pva_more_videos_prg'),
- 3073. - offset = cur.pvsaOffset;
- 3074. - if (!cur.pvVideoTagsShown || !more || !isVisible(more) || isVisible(progress)) return;
- 3075. -
- 3076. - if (cur.pvsaLoading) {
- 3077. - cur.pvsaLoading = 2;
- 3078. - return;
- 3079. - }
- 3080. -
- 3081. - ajax.post('/al_video.php', {act: 'show_video_tags', mid: cur.pvVideoTagsShown, offset: offset, part: 1}, {onDone: Photoview.loadedMoreVideoTags, onFail: function() {
- 3082. - cur.pvsaLoading = 0;
- 3083. - return true;
- 3084. - }, showProgress: function() {
- 3085. - show(progress);
- 3086. - hide(more.firstChild);
- 3087. - }, hideProgress: function() {
- 3088. - show(more.firstChild);
- 3089. - hide(progress);
- 3090. - }, cache: 1});
- 3091. - },
- 3092. - thumbOver: function(obj, id) {
- 3093. - clearTimeout((cur.pvHideTO || {})[id]);
- 3094. - var title = geByClass1('pva_title', obj), r = title.previousSibling, descY = getSize(geByClass1('pva_desc', obj))[1];
- 3095. - if (descY < 5) return;
- 3096. -
- 3097. - animate(title, {marginTop: 238 - (descY + 7)}, {duration: 200, transition: Fx.Transitions.easeOutCirc});
- 3098. - if (r.className == 'pva_repeat') {
- 3099. - animate(r, {marginTop: 86 - Math.floor((descY + 7) / 2)}, {duration: 200, transition: Fx.Transitions.easeOutCirc});
- 3100. - }
- 3101. - },
- 3102. - thumbOut: function(obj, id) {
- 3103. - if (!cur.pvHideTO) cur.pvHideTO = {};
- 3104. - cur.pvHideTO[id] = setTimeout(function() {
- 3105. - var title = geByClass1('pva_title', obj), r = title.previousSibling;
- 3106. - animate(title, {marginTop: 238}, 200);
- 3107. - if (r.className == 'pva_repeat') {
- 3108. - animate(r, {marginTop: 86}, 200);
- 3109. - }
- 3110. - }, 150);
- 3111. - },
- 3112. -
- 3113. - photoAct: function(ev) {
- 3114. - if (cur.pvAlbumsShown || cur.pvAlbumShown || cur.pvPhotoTagShown || !cur.pvCurPhoto.author) return;
- 3115. -
- 3116. - var pos = getXY(cur.pvHH, true);
- 3117. - if (pos[0]) {
- 3118. - cur.hhPos = pos;
- 3119. - } else {
- 3120. - pos = cur.hhPos;
- 3121. - }
- 3122. -
- 3123. - var next = cur.pvHH;
- 3124. -
- 3125. - var dx = Math.abs(ev.clientX - pos[0] - 36);
- 3126. - var dy = ev.clientY - pos[1];
- 3127. -
- 3128. - if (dx < 120 && dy < 130 && dy > -30) {
- 3129. - if (cur.pvHHShowing) return;
- 3130. - cur.pvHHShowing = true;
- 3131. - show(next);
- 3132. - animate(next.firstChild, {opacity: 1}, 400);
- 3133. -
- 3134. - if (!cur.rvPreloadBig) {
- 3135. - vkImage().src = '/images/icons/post_big_hh.png';
- 3136. - cur.rvPreloadBig = true;
- 3137. - }
- 3138. - } else {
- 3139. - if (!cur.pvHHShowing) return;
- 3140. - cur.pvHHShowing = false;
- 3141. - animate(next.firstChild, {opacity: 0}, 400);
- 3142. - }
- 3143. -
- 3144. - },
- 3145. -
- 3146. - hhLiked: function(obj, act) {
- 3147. - return (act || hasClass)(obj.parentNode.parentNode, 'pvs_hh_liked');
- 3148. - },
- 3149. - hhOver: function(obj) {
- 3150. - clearTimeout(obj.parentNode.parentNode.getAttribute('timer'));
- 3151. - var params = Photoview.hhLiked(obj) ? [0.25, 1] : [0.28, 0.65];
- 3152. - animate(obj.previousSibling, {opacity: params[0]}, 200);
- 3153. - animate(obj, {opacity: params[1]}, 200);
- 3154. - },
- 3155. - hhOut: function(obj) {
- 3156. - var params = Photoview.hhLiked(obj) ? [0.25, 1] : [0.2, 0.5];
- 3157. - animate(obj.previousSibling, {opacity: params[0]}, 200);
- 3158. - animate(obj, {opacity: params[1]}, 200);
- 3159. - },
- 3160. - hhClick: function(obj, ev, pv) {
- 3161. - if (ev.button == 2) return;
- 3162. - var liked = Photoview.hhLiked(obj);
- 3163. -
- 3164. - Photoview.like();
- 3165. - liked && Photoview.likeOut();
- 3166. -
- 3167. - Photoview.hhOver(obj);
- 3168. -
- 3169. - if (!liked && !(browser.msie && intval(browser.version) < 9 || browser.mozilla && intval(browser.version) < 9)) {
- 3170. - obj.innerHTML = '<img class="pvs_hh_ah" width="38" height="34" src="/images/icons/post_big_hh.png" />';
- 3171. - var img = obj.firstChild;
- 3172. - animate(img, {marginLeft: -3, marginTop: 3, width: 78, height: 71, opacity: 0}, {duration: 600, transition: Fx.Transitions.easeOutCubic});
- 3173. - }
- 3174. -
- 3175. - return cancelEvent(ev);
- 3176. - },
- 3177. - hhCheck: function() {
- 3178. - return (!browser.msie || intval(browser.version) > 8) && !cur.pvNoLikes;
- 3179. - },
- 3180. -
- 3181. - showRepeat: function(row) {
- 3182. - if (!row || geByClass1('pva_repeat', row)) return;
- 3183. -
- 3184. - geByClass1('pva_link', row).insertBefore(ce('div', {className: 'pva_repeat', innerHTML: '\
- 3185. - <div class="pva_repeat_blob">\
- 3186. - <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>\
- 3187. - </div>'}), geByClass1('pva_title', row));
- 3188. - },
- 3189. -
- 3190. - showPlace: function() {
- 3191. - var geohash = cur.pvCurPhoto.geohash;
- 3192. - showBox('al_places.php', {act: 'show_photo_place', geohash: geohash, photo: cur.pvCurPhoto.id}, {width: 708, hideButtons: true, title: false, cache: 1});
- 3193. - },
- 3194. -
- 3195. - editPlace: function() {
- 3196. - var geohash = cur.pvCurPhoto.geohash;
- 3197. - showBox('al_places.php', {act: 'show_photo_place', edit: 1, geohash: geohash || '', photo: cur.pvCurPhoto.id});
- 3198. - },
- 3199. -
- 3200. - updatePlace: function(photo, place) {
- 3201. - var placeCont = ge('pv_edit_place');
- 3202. - if (place) {
- 3203. - placeCont && (placeCont.innerHTML = place ? place + '.' : '');
- 3204. - 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>' : '';
- 3205. - hide('pv_add_place');
- 3206. - } else {
- 3207. - setTimeout(function() {
- 3208. - ajax.post('al_photos.php', {act: 'get_photo_place', photo: photo}, {
- 3209. - onDone: function(place, placeGeoHash) {
- 3210. - Photoview.updatePlace(photo, place);
- 3211. - }
- 3212. - })
- 3213. - }, 1000);
- 3214. - }
- 3215. - },
- 3216. -
- 3217. - nearProgress: function(obj) {
- 3218. - obj.insertBefore(ce('div', {className: 'pv_load_near'}), obj.firstChild);
- 3219. - },
- 3220. -
- 3221. - reportComment: function(obj, ev, commentRaw) {
- 3222. - stManager.add(['privacy.js', 'privacy.css'], function() {
- 3223. - return Privacy.show(obj, ev, 'report_'+commentRaw);
- 3224. - });
- 3225. - }
- 3226. -
- 3227. - }, photoview = Photoview;
- 3228. -
- 3229. - try{stManager.done('photoview.js');}catch(e){}
- ------
- Файл - videoview.js (Старый размер - 68829 | Новый - 0):
- 0. - var Videoview = {
- 1. -
- 2. - isFS: false,
- 3. -
- 4. - playerCallback: {
- 5. - resize: function (w, h) {
- 6. - },
- 7. - debugLog: function() {
- 8. - var args = Array.prototype.slice.call(arguments);
- 9. - args.unshift('flashPlayer: ');
- 10. - debugLog(args);
- 11. - },
- 12. - fullscreen: function(value) {
- 13. - Videoview.isFS = value;
- 14. - },
- 15. - incViewCounter: function(oid, vid, hash) {
- 16. - ajax.post('al_video.php', {act: 'inc_view_counter', oid: oid, vid: vid, hash: hash}, {
- 17. - cache: 1,
- 18. - onDone: function(t) {
- 19. - }});
- 20. - },
- 21. - rotateVideo: function(oid, vid, angle, hash) {
- 22. - ajax.post('al_video.php', {act: 'rotate_video', oid: oid, vid: vid, angle: angle, hash: hash});
- 23. - },
- 24. - scoreCardCounter: function () {
- 25. - // vkImage().src = locProtocol + '//b.scorecardresearch.com/p?c1=1&c2=13765216&c5=06&rn=' + Math.round(Math.random() * 1000000000);
- 26. - },
- 27. - onVideoResolutionChanged: function(oid, vid, hash, resolution) {
- 28. - if (mvcur.mvData) {
- 29. - mvcur.mvData.resolution = resolution;
- 30. - }
- 31. - },
- 32. - onVideoPlayProgress: function(oid, vid, hash, time_progress, time_total) {
- 33. - var rawId = oid+'_'+vid;
- 34. - if (time_progress < 5000 && cur.tnsStart != rawId) {
- 35. - this.playerCallback.scoreCardCounter();
- 36. - cur.tnsStart = rawId;
- 37. - } else if (time_progress > (time_total / 2) && cur.tnsEnd != rawId) {
- 38. - cur.tnsEnd = rawId;
- 39. - }
- 40. - if (mvcur.adData) {
- 41. - if (mvcur.adData.stat_link_start && !mvcur.adData.view_complete_start && time_progress >= 5000) {
- 42. - ajax.post(mvcur.adData.stat_link_start, {}, {onDone: function() {}, onFail: function() { return true; }});
- 43. - mvcur.adData.view_complete_start = true;
- 44. - }
- 45. - if (mvcur.adData.stat_link_half && !mvcur.adData.view_complete_half && time_progress >= (time_total / 2)) {
- 46. - ajax.post(mvcur.adData.stat_link_half, {}, {onDone: function() {}, onFail: function() { return true; }});
- 47. - mvcur.adData.view_complete_half = true;
- 48. - }
- 49. - if (mvcur.adData.stat_link_full && !mvcur.adData.view_complete_full && time_progress >= (time_total * 0.9)) {
- 50. - ajax.post(mvcur.adData.stat_link_full, {}, {onDone: function() {}, onFail: function() { return true; }});
- 51. - mvcur.adData.view_complete_full = true;
- 52. - }
- 53. - }
- 54. - },
- 55. - onVideoStreamPlaying: function() {
- 56. - var _n = window.Notifier, _a = window.audioPlayer;
- 57. - if (_n) setTimeout(function() { _n.lcSend('video_start'); }, 0);
- 58. - if (_a && _a.player && !_a.player.paused()) {
- 59. - _a.pauseTrack();
- 60. - _a.pausedByVideo = 1;
- 61. - }
- 62. - },
- 63. - onVideoPlayStarted: function(oid, vid, hash) {
- 64. - ajax.post('al_video.php', {act: 'video_view_started', oid: oid, vid: vid, hash: hash, quality: mvcur.mvData.resolution || 0}, {
- 65. - cache: 1,
- 66. - onDone: function(t) {
- 67. - }});
- 68. - },
- 69. - onVideoPlayFinished: function() {
- 70. - mvcur.finished = true;
- 71. - mvcur.mousemoved = true;
- 72. - Videoview.moveCheck();
- 73. -
- 74. - if (mvcur.adData) {
- 75. - if (mvcur.adData.stat_link_start && !mvcur.adData.view_complete_start) {
- 76. - ajax.post(mvcur.adData.stat_link_start, {}, {onDone: function() {}, onFail: function() { return true; }});
- 77. - mvcur.adData.view_complete_start = true;
- 78. - }
- 79. - if (mvcur.adData.stat_link_half && !mvcur.adData.view_complete_half) {
- 80. - ajax.post(mvcur.adData.stat_link_half, {}, {onDone: function() {}, onFail: function() { return true; }});
- 81. - mvcur.adData.view_complete_half = true;
- 82. - }
- 83. - if (mvcur.adData.stat_link_full && !mvcur.adData.view_complete_full) {
- 84. - ajax.post(mvcur.adData.stat_link_full, {}, {onDone: function() {}, onFail: function() { return true; }});
- 85. - mvcur.adData.view_complete_full = true;
- 86. - }
- 87. - }
- 88. - }
- 89. - },
- 90. -
- 91. - updateArrowsX: function() {
- 92. - /*var w = mvcur.mvActualWidth + 30, sbw = sbWidth();
- 93. - var lw = Math.max(lastWindowWidth, w + 124 + sbw + 2);
- 94. - mvcur.mvLeft.style.left = Math.floor((lw - sbw - 10 - (w + 66)) / 2) + 'px';
- 95. - mvcur.mvRight.style.left = Math.floor((lw - sbw - 10 + (w + 66)) / 2) + 'px';
- 96. - if (vk.rtl) {
- 97. - mvcur.mvSwitch.style.left = (lw - sbw - 36) + 'px';
- 98. - }*/
- 99. - },
- 100. -
- 101. - updateArrowsY: function() {
- 102. - /*var h = mvcur.mvBox.offsetHeight;
- 103. - if (browser.mobile) {
- 104. - var skipTop = 10 + mvcur.mvYOffset;
- 105. - mvcur.mvRight.style.top = mvcur.mvLeft.style.top = (skipTop + Math.floor(h / 2) - 7) + 'px';
- 106. - if (lastWindowHeight < mvcur.mvYOffset + h + 50) {
- 107. - setTimeout(function() {
- 108. - var f = ge('footer');
- 109. - f.style.height = (intval(getStyle(f, 'height')) + (mvcur.mvYOffset + h + 50 - lastWindowHeight)) + 'px';
- 110. - onBodyResize();
- 111. - Videoview.onResize();
- 112. - }, 1);
- 113. - }
- 114. - }
- 115. - mvcur.mvLeftNav.style.height = mvcur.mvRightNav.style.height = h + 'px';*/
- 116. - },
- 117. -
- 118. - actionInfo: function() {
- 119. - return ge('mv_action_info') || mvcur.mvWide.appendChild(ce('div', {id: 'mv_action_info'}));
- 120. - },
- 121. -
- 122. - locNav: function(ch, old, nw) {
- 123. - nw = nav.toStr(nw);
- 124. - var m = nw.match(/^video(-?\d+_\d+)$/);
- 125. - if (!m) {
- 126. - Videoview.hide();
- 127. - return;
- 128. - }
- 129. - },
- 130. -
- 131. - showPlayer: function(force) {
- 132. - var el = ge('video_player');
- 133. - if (!el) return;
- 134. - if (!force && el.getAttribute('preventhide') && !browser.safari_mobile) return;
- 135. - if (browser.msie) {
- 136. - setStyle(el, {position: 'static', top: 0});
- 137. - } if (browser.safari_mobile) {
- 138. - show(el);
- 139. - } else {
- 140. - el.style.visibility = 'visible';
- 141. - }
- 142. - },
- 143. -
- 144. - hidePlayer: function(force) {
- 145. - var el = ge('video_player');
- 146. - if (!el) return;
- 147. - if (!force && el.getAttribute('preventhide') && !browser.safari_mobile) return;
- 148. - if (browser.msie) {
- 149. - setStyle(el, {position: 'absolute', top: '-5000px'});
- 150. - } if (browser.safari_mobile) {
- 151. - hide(el);
- 152. - } else {
- 153. - el.style.visibility = 'hidden';
- 154. - }
- 155. - },
- 156. -
- 157. - showTagSelector: function() {
- 158. - Videoview.hidePlayer();
- 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() {
- 160. - removeClass(mvcur.mvCont, 'toggle_flash');
- 161. - }});
- 162. - cur.onFlistSave = function (ids, list) {
- 163. - Videoview.showPlayer();
- 164. - Videoview.addTags(ids);
- 165. - }
- 166. - },
- 167. -
- 168. - init: function() {
- 169. - window.mvcur = {};
- 170. - if (window.mvLayer) {
- 171. - return;
- 172. - }
- 173. - window.mvLayer = ce('div', {
- 174. - id: 'mv_layer'
- 175. - });
- 176. -
- 177. - addEvent(mvLayer, 'mousemove', function() {
- 178. - mvcur.mousemoved = true;
- 179. - if (mvcur.blackout) {
- 180. - Videoview.moveCheck();
- 181. - }
- 182. - });
- 183. -
- 184. - window.mvLayerWrap = ce('div', {
- 185. - id: 'mv_layer_wrap',
- 186. - className: 'scroll_fix_wrap fixed'
- 187. - });
- 188. -
- 189. - mvLayerWrap.appendChild(window.mvLayer);
- 190. -
- 191. - bodyNode.appendChild(mvLayerWrap);
- 192. -
- 193. - window.mvLayer.style.width = (lastWindowWidth - sbWidth() - 2) + 'px';
- 194. - },
- 195. -
- 196. - moveCheck: function() {
- 197. - if (!mvcur.mousemoved) {
- 198. - if (!mvcur.blackout && !mvcur.finished && isVisible(layerBG)) {
- 199. - mvcur.blackout = true;
- 200. - animate(layerBG, {opacity: 0.9}, 5000);
- 201. - }
- 202. - } else if (mvcur.blackout) {
- 203. - mvcur.blackout = false;
- 204. - if (isVisible(layerBG)) {
- 205. - animate(layerBG, {opacity: 0.7}, 200);
- 206. - } else {
- 207. - setStyle(layerBG, {opacity: 0.7});
- 208. - }
- 209. - }
- 210. - mvcur.mousemoved = false;
- 211. - },
- 212. -
- 213. - show: function(ev, videoRaw, listId, options) {
- 214. - var _a = window.audioPlayer;
- 215. - if (_a && _a.player && !_a.player.paused()) {
- 216. - _a.pauseTrack();
- 217. - _a.pausedByVideo = 1;
- 218. - }
- 219. - Videoview.playerCallback.onVideoStreamPlaying();
- 220. - debugLog('show video ' + videoRaw);
- 221. - if (window.mvcur && mvcur.minimized) {
- 222. - if (options.nomin) {
- 223. - if (options.prevLoc) {
- 224. - mvcur.mvPrevLoc = options.prevLoc;
- 225. - }
- 226. - debugLog('unminimizing in show');
- 227. - Videoview.unminimize(true, false, true);
- 228. - }
- 229. - return true;
- 230. - }
- 231. -
- 232. - if (options.queue) {
- 233. - debugLog('pushing in videoview.show');
- 234. - layerQueue.push();
- 235. - options.queue = false;
- 236. - }
- 237. -
- 238. - layerQueue.hide();
- 239. - // if (window.wkLayerWrap && isVisible(window.wkLayerWrap)) {
- 240. - // hide(wkLayerWrap);
- 241. - // }
- 242. -
- 243. - this.init();
- 244. -
- 245. - if (mvcur.mvShown) return;
- 246. -
- 247. - mvcur.showTime = new Date().getTime();
- 248. -
- 249. - if (!isVisible(mvLayerWrap)) {
- 250. - otherList = true;
- 251. - addEvent(window, 'resize', Videoview.onResize);
- 252. - addEvent(document, 'keydown', Videoview.onKeyDown);
- 253. - addEvent(mvLayerWrap, 'click', Videoview.onClick);
- 254. - boxQueue.hideAll();
- 255. - layers.wrapshow(mvLayerWrap, 0.7);
- 256. - layers.fullhide = Videoview.hide;
- 257. - } else {
- 258. - return false;
- 259. - }
- 260. - setTimeout(function() {
- 261. - layers.wrapshow(mvLayerWrap, 0.7);
- 262. - layers.fullhide = Videoview.hide;
- 263. - }, 0);
- 264. -
- 265. - mvcur.noLocChange = 0; // do return location
- 266. - if (options.ad_video) { // videoAds
- 267. - options.hideInfo = 1;
- 268. - options.noLocChange = 1;
- 269. - mvcur.noLocChange = 1;
- 270. - mvcur.videoAds = 1;
- 271. - }
- 272. - mvcur.noHistory = options.noLocChange || options.noHistory;
- 273. -
- 274. - mvcur.blackInterval = setInterval(Videoview.moveCheck, 180000);
- 275. -
- 276. - mvcur.mvShown = true;
- 277. -
- 278. - mvcur.videoRaw = videoRaw;
- 279. - mvcur.options = options;
- 280. - mvcur.listId = listId;
- 281. - mvcur.mvData = false;
- 282. -
- 283. - if (options.prevLoc) {
- 284. - mvcur.mvPrevLoc = options.prevLoc;
- 285. - } else {
- 286. - setTimeout(Videoview.setLocation.pbind(options.noLocChange), 0);
- 287. - }
- 288. -
- 289. - if (ev && ev.pageX && ev.pageY) {
- 290. - extend(mvcur, {mvOldX: ev.pageX, mvOldY: ev.pageY, mvOldT: vkNow()});
- 291. - }
- 292. -
- 293. - if (!mvcur.mvFixed) {
- 294. - var colorClass = 'mv_dark';
- 295. -
- 296. - /*mvcur.mvFixed = bodyNode.appendChild(ce('div', {className: 'mv_fixed fixed ' + colorClass, innerHTML: '\
- 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>\
- 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>\
- 299. - '}));
- 300. -
- 301. - mvcur.mvLeft = mvcur.mvFixed.firstChild;
- 302. - mvcur.mvRight = mvcur.mvLeft.nextSibling;
- 303. - mvcur.mvSwitch = mvcur.mvRight.nextSibling;
- 304. - */
- 305. - addClass(mvLayerWrap, colorClass);
- 306. - addClass(layerBG, colorClass);
- 307. - vkImage().src = '/images/upload.gif';
- 308. -
- 309. -
- 310. - if (options.hideInfo) {
- 311. - var showControls = 'display: none';
- 312. - var controlsClass = '';
- 313. - } else {
- 314. - var showControls = '';
- 315. - var controlsClass = 'mv_controls_shown';
- 316. - }
- 317. -
- 318. - if (vk.rtl) {
- 319. - var minimizeBtn = '';
- 320. - } else {
- 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>';
- 322. - }
- 323. - // '+' - fix for buggy firefox
- 324. - mvLayer.innerHTML = '\
- 325. - <div class="mv_cont">\
- 326. - \
- 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>\
- 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>\
- 329. - <div class="no_select" id="mv_right_controls" style="display: none;" onselectstart="return cancelEvent(event);">\
- 330. - <div onmouseover="Videoview.activate(this, true);" onmouseout="Videoview.deactivate(this, true);" class="mv_controls_ctrl mv_controls_close"><div></div></div>\
- 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>\
- 332. - <div class="mv_controls_bg"></div>\
- 333. - </div>\
- 334. - \
- 335. - <table cellspacing="0" cellpadding="0">\
- 336. - <tr><td class="sidesh s1"><div></div></td><td>\
- 337. - <table cellspacing="0" cellpadding="0">\
- 338. - <tr><td>\
- 339. - <table cellspacing="0" cellpadding="0">\
- 340. - <tr><td colspan="3" class="bottomsh s3"><div></div></td></tr>\
- 341. - <tr><td class="sidesh s3"><div></div></td><td>\
- 342. - \
- 343. - <div id="mv_box" onclick="mvcur.mvClicked = true;">\
- 344. - <div id="mv_approve" style="display: none;"></div>\
- 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>\
- 346. - <div class="no_select mv_data">\
- 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>\
- 348. - <div id="mv_loader"></div>\
- 349. - <div id="mv_content"></div>\
- 350. - </div>\
- 351. - <div id="mv_controls_line" class="ta_l '+controlsClass+'">\
- 352. - </div>\
- 353. - <div class="mv_controls" id="mv_controls" style="'+showControls+'">\
- 354. - <div class="clear_fix select_fix" id="mv_comments_data">\
- 355. - <div class="fl_l wide_column">\
- 356. - <div id="mv_wide"></div>\
- 357. - </div>\
- 358. - <div class="fl_r narrow_column" id="mv_narrow"></div>\
- 359. - <br class="clear" />\
- 360. - </div>\
- 361. - <div id="mv_warning" style="display: none;"></div>\
- 362. - </div>\
- 363. - </div>\
- 364. - \
- 365. - </td><td class="sidesh s3"><div></div></td></tr>\
- 366. - <tr><td colspan="3" class="bottomsh s3"><div></div></td></tr></table>\
- 367. - </td></tr>\
- 368. - <tr><td colspan="3" class="bottomsh s2"><div></div></td></tr></table>\
- 369. - </td><td class="sidesh s1"><div></div></td></tr>\
- 370. - <tr><td colspan="3" class="bottomsh s1"><div></div></td></tr></table>\
- 371. - </div>\
- 372. - ';
- 373. -
- 374. - extend(mvcur, {
- 375. - mvCont: mvLayer.firstChild,
- 376. - mvBox: ge('mv_box'),
- 377. -
- 378. - mvLeftNav: ge('mv_left_nav'),
- 379. - mvRightNav: ge('mv_right_nav'),
- 380. - mvRightControls: ge('mv_right_controls'),
- 381. - mvControlsLine: ge('mv_controls_line'),
- 382. -
- 383. - mvLoader: ge('mv_loader'),
- 384. - mvContent: ge('mv_content'),
- 385. -
- 386. - mvCommentsData: ge('mv_comments_data'),
- 387. -
- 388. - mvNarrow: ge('mv_narrow'),
- 389. - mvWide: ge('mv_wide')
- 390. - });
- 391. - if (browser.mobile) {
- 392. - mvcur.mvYOffset = intval(window.pageYOffset);
- 393. -
- 394. - mvcur.mvCont.style.paddingTop = (mvcur.mvYOffset + 10) + 'px';
- 395. - //mvcur.mvRightControls.style.top = (mvcur.mvYOffset + 10) + 'px';
- 396. - }
- 397. -
- 398. - Videoview.updateSize();
- 399. - if (cur.timeouts && cur.timeouts.changeUrl) {
- 400. - clearTimeout(cur.timeouts.changeUrl);
- 401. - }
- 402. - }
- 403. -
- 404. - hide(mvcur.mvLeft, mvcur.mvLeftNav, mvcur.mvRight, mvcur.mvRightNav);
- 405. -
- 406. - if (!cur.mvNavInited) {
- 407. - cur.mvNavInited = true;
- 408. - if (cur._back) {
- 409. - cur._back.hide.push(function() {
- 410. - /*if (mvcur.mvShown || mvcur.minimized) {
- 411. - Videoview.hide(false, true);
- 412. - }*/
- 413. - });
- 414. - }
- 415. - }
- 416. -
- 417. - if (cur.vSearch) {
- 418. - cur.vSearch.blur();
- 419. - }
- 420. - if (options.minimized) {
- 421. - // if (browser.msie) {
- 422. - setTimeout(Videoview.minimize.bind(Videoview), 0);
- 423. - // } else {
- 424. - // Videoview.minimize();
- 425. - // }
- 426. - }
- 427. -
- 428. - return false;
- 429. - },
- 430. -
- 431. - hide: function(noLoc, force, ev) {
- 432. - if (!window.mvcur || !force && !mvcur.mvShown) return;
- 433. - if (!force && mvcur.minimized) {
- 434. - if (!mvcur.noLocChange && noLoc !== true) {
- 435. - if (noLoc === 2) {
- 436. - nav.setLoc(hab.getLoc());
- 437. - } else if (!layerQueue.count()) {
- 438. - Videoview.backLocation();
- 439. - }
- 440. - }
- 441. - return;
- 442. - }
- 443. - if (!mvcur.noHistory && !noLoc) {
- 444. - mvcur.noHistory = 1;
- 445. - mvcur.forceHistoryHide = force;
- 446. - __adsUpdate('very_lazy');
- 447. - return history.go(-1);
- 448. - }
- 449. - if (mvcur.forceHistoryHide) {
- 450. - force = mvcur.forceHistoryHide;
- 451. - mvcur.forceHistoryHide = false;
- 452. - }
- 453. -
- 454. - if (mvcur.statusVideo) {
- 455. - var icon = ge('mv_like_icon');
- 456. - if (icon) {
- 457. - var tt = icon.parentNode.tt;
- 458. - if (tt && tt.container) {
- 459. - re(tt.container);
- 460. - }
- 461. - if (icon.parentNode.tt) {
- 462. - delete icon.parentNode.tt;
- 463. - }
- 464. - }
- 465. - }
- 466. -
- 467. - var wasmin = mvcur.minimized;
- 468. - if (wasmin) {
- 469. - Videoview.unminimize(true, true, true);
- 470. - mvcur.minimized = false;
- 471. - noLoc = true;
- 472. - }
- 473. -
- 474. - Wall.cancelEdit(true);
- 475. -
- 476. - if (mvcur.mvData.duration > 60 && !force && !mvcur.finished) {
- 477. - var openTime = new Date().getTime() - mvcur.showTime, closeText = getLang('video_are_you_sure_close');
- 478. - if (openTime > 30000 && closeText != 'are you sure close' && !browser.safari_mobile) {
- 479. - var box;
- 480. - box = showFastBox(getLang('video_are_you_sure_close_title'), closeText, getLang('box_yes'), function() {
- 481. - box.hide();
- 482. - Videoview.hide(noLoc, true)
- 483. - }, getLang('box_no'));
- 484. - var checkKey = function(event) {
- 485. - if (event.keyCode == 13) {
- 486. - box.hide();
- 487. - Videoview.hide(noLoc, true)
- 488. - }
- 489. - }
- 490. - addEvent(document, 'keydown', checkKey);
- 491. - box.onHide = function() {
- 492. - removeEvent(document, 'keydown', checkKey);
- 493. - };
- 494. - return true;
- 495. - }
- 496. - }
- 497. - var _a = window.audioPlayer, _n = window.Notifier;
- 498. - if (_a && _a.player && _a.player.paused() && _a.pausedByVideo) {
- 499. - _a.playTrack();
- 500. - _a.pausedByVideo = null;
- 501. - }
- 502. - if (_n) _n.lcSend('video_hide');
- 503. -
- 504. - if (wasmin) {
- 505. - hide(mvLayerWrap);
- 506. - } else {
- 507. - layers.wraphide(mvLayerWrap);
- 508. - layers.fullhide = false;
- 509. - }
- 510. -
- 511. - if (window.tooltips) {
- 512. - each(geByClass('delete', mvcur.mvTags), function() {
- 513. - tooltips.destroy(this);
- 514. - });
- 515. - }
- 516. -
- 517. - if (window.tooltips) {
- 518. - tooltips.destroyAll(cur.mvBox);
- 519. - }
- 520. -
- 521. - var colorClass = 'mv_dark';
- 522. - removeClass(mvLayerWrap, colorClass);
- 523. - removeClass(layerBG, colorClass);
- 524. -
- 525. - mvcur.mvShown = mvcur.mvClicked = false;
- 526. - removeEvent(window, 'resize', Videoview.onResize);
- 527. - removeEvent(document, 'keydown', Videoview.onKeyDown);
- 528. - removeEvent(mvLayerWrap, 'click', Videoview.onClick);
- 529. -
- 530. - mvcur.mvContent.innerHTML = '';
- 531. - mvcur.changeCanvasSize = false;
- 532. -
- 533. - // if (window.wkcur && wkcur.shown) {
- 534. - // WkView.showLayer();
- 535. - // } else if (window.Photoview && cur.pvShown) {
- 536. - // Photoview.showPvLayer();
- 537. - // }
- 538. - if (!wasmin || !isVisible(layerWrap)) {
- 539. - debugLog('pop from videoview.hide');
- 540. - setTimeout(layerQueue.pop, 0);
- 541. - }
- 542. -
- 543. - if (mvcur.blackInterval) {
- 544. - clearInterval(mvcur.blackInterval);
- 545. - }
- 546. - if (!mvcur.noLocChange && noLoc !== true) {
- 547. - if (noLoc === 2) {
- 548. - nav.setLoc(hab.getLoc());
- 549. - } else {
- 550. - Videoview.backLocation();
- 551. - }
- 552. - __adsUpdate('very_lazy');
- 553. - }
- 554. - __adsUpdate();
- 555. - return false;
- 556. - },
- 557. -
- 558. - cmp: function(id1, id2) {
- 559. - var l1 = id1.length, l2 = id2.length;
- 560. - if (l1 < l2) {
- 561. - return -1;
- 562. - } else if (l1 > l2) {
- 563. - return 1;
- 564. - } else if (id1 < id2) {
- 565. - return -1;
- 566. - } else if (id1 > id2) {
- 567. - return 1;
- 568. - }
- 569. - return 0;
- 570. - },
- 571. -
- 572. -
- 573. - onClick: function(e) {
- 574. - if (mvcur.mvClicked) {
- 575. - mvcur.mvClicked = false;
- 576. - return;
- 577. - }
- 578. - var dx = Math.abs(e.pageX - intval(mvcur.mvOldX));
- 579. - var dy = Math.abs(e.pageY - intval(mvcur.mvOldY));
- 580. - if (dx > 3 || dy > 3) {
- 581. - if (vkNow() - intval(mvcur.mvOldT) > 300) {
- 582. - if (mvcur.mvTagger) {
- 583. - Videoview.stopTag();
- 584. - } else {
- 585. - Videoview.hide();
- 586. - }
- 587. - }
- 588. - }
- 589. - },
- 590. -
- 591. - onKeyDown: function(e) {
- 592. - if (e.returnValue === false) return false;
- 593. -
- 594. - if (e.keyCode == KEY.ESC) {
- 595. - if (Videoview.isFS) {
- 596. - ge('video_player').toggleFullscreen();
- 597. - return false;
- 598. - }
- 599. - if (mvcur.mvTagger) {
- 600. - Videoview.stopTag();
- 601. - } else {
- 602. - Videoview.hide();
- 603. - }
- 604. - return cancelEvent(e);
- 605. - }
- 606. - },
- 607. -
- 608. - onResize: function() {
- 609. - var dwidth = lastWindowWidth, dheight = lastWindowHeight, sbw = sbWidth();
- 610. -
- 611. - var w = dwidth - sbw - 2 - 120 - 34 - 50, h = dheight - 31 - 28 - 72;
- 612. - if (w > 1280) { // less than full hd - not size > 2
- 613. - w = 1280;
- 614. - } else if (w > 807 && w < 907) { // 1024x768 - not size > 1
- 615. - w = 807;
- 616. - } else if (w < 604) {
- 617. - w = 604;
- 618. - }
- 619. - if (h < 453) {
- 620. - h = 453;
- 621. - }
- 622. - mvcur.mvWidth = w;
- 623. - mvcur.mvHeight = h;
- 624. -
- 625. - var sizeChanged = false, oldverybig = mvcur.mvVeryBig;
- 626. - mvcur.mvVeryBig = (w > 1280) ? 2 : (w > 807 ? 1 : false);
- 627. - sizeChanged = (oldverybig != mvcur.mvVeryBig);
- 628. -
- 629. - Videoview.updateArrowsX();
- 630. - Videoview.updateArrowsY();
- 631. - },
- 632. -
- 633. - updateSize: function() {
- 634. - if (mvcur.minimized) {
- 635. - return false;
- 636. - }
- 637. - var size = getSize(mvcur.mvBox);
- 638. - mvcur.mvActualWidth = size[0]+3;
- 639. - //mvcur.mvCont.style.width = mvcur.mvActualWidth + 'px';
- 640. -
- 641. - var docEl = document.documentElement;
- 642. - var ch = window.innerHeight || docEl.clientHeight || bodyNode.clientHeight;
- 643. -
- 644. -
- 645. - mvcur.mvCont.style.top = String(Math.max((ch - 800) / 2,50)) +'px';
- 646. -
- 647. - //mvcur.mvRightControls.style.left = (mvcur.mvActualWidth) + 'px';
- 648. -
- 649. - onBodyResize();
- 650. - Videoview.onResize();
- 651. - },
- 652. -
- 653. - list: function(photoId, listId, realList) {
- 654. - if (!mvcur.mvList) mvcur.mvList = {};
- 655. - mvcur.mvList[photoId + '_' + listId] = realList;
- 656. - },
- 657. -
- 658. - showInfo: function() {
- 659. - addClass(mvcur.mvControlsLine, 'mv_controls_shown');
- 660. - show(ge('mv_controls'));
- 661. - Videoview.activate(ge('mv_hide_info'), 2, true);
- 662. - window.updateWndVScroll && updateWndVScroll();
- 663. - return false;
- 664. - },
- 665. -
- 666. - hideInfo: function() {
- 667. - removeClass(mvcur.mvControlsLine, 'mv_controls_shown');
- 668. - hide(ge('mv_controls'));
- 669. - Videoview.activate(ge('mv_show_info'), 2, true);
- 670. - window.updateWndVScroll && updateWndVScroll();
- 671. - return false;
- 672. - },
- 673. -
- 674. - getPrevLoc: function() {
- 675. - mvcur.mvPrevLoc = {};
- 676. - for (var i in nav.objLoc) {
- 677. - if (i != 'z' || !nav.objLoc[i].match(new RegExp('^video' + mvcur.videoRaw, ''))) {
- 678. - mvcur.mvPrevLoc[i] = nav.objLoc[i];
- 679. - }
- 680. - }
- 681. - },
- 682. -
- 683. - setLocation: function(noLocChange) {
- 684. - if (mvcur.options.fromPreload) {
- 685. - var listData = mvcur.listId.match(new RegExp('([a-z]*)([0-9\-]*)'));
- 686. - var claimData = mvcur.listId.match(new RegExp('claim=([0-9]+)'));
- 687. - var oid = parseInt(listData[2]);
- 688. - if (oid > 0) {
- 689. - mvcur.mvPrevLoc = {'0': 'videos' + oid};
- 690. - } else {
- 691. - mvcur.mvPrevLoc = {'0': 'video', gid: (-oid)};
- 692. - }
- 693. - if (listData[1] != 'videos') {
- 694. - mvcur.mvPrevLoc['section'] = listData[1];
- 695. - }
- 696. - if (claimData && claimData[1]) {
- 697. - mvcur.mvPrevLoc['claim'] = claimData[1];
- 698. - }
- 699. - } else {
- 700. - if (noLocChange) {
- 701. - mvcur.mvPrevLoc = 'z';
- 702. - } else {
- 703. - Videoview.getPrevLoc();
- 704. - }
- 705. - }
- 706. - if (noLocChange) {
- 707. - return;
- 708. - }
- 709. - var m = mvcur.videoRaw.match(/^(-?\d+)(photo|video)?_/), owner = intval(m[1]), nl;
- 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) {
- 711. - nl = {'0': 'video' + mvcur.videoRaw + (nav.objLoc.claim ? "?claim=" + nav.objLoc.claim : "")};
- 712. - if ((mvcur.options || {}).fromQueue) {
- 713. - mvcur.noHistory = 1;
- 714. - }
- 715. - } else {
- 716. - var videoLocation = 'video' + mvcur.videoRaw, nl;
- 717. - if (mvcur.listId) {
- 718. - videoLocation += '/' + mvcur.listId;
- 719. - }
- 720. - nl = extend(nav.objLoc, {'z': videoLocation});
- 721. - }
- 722. - if (nav.strLoc != nav.toStr(nl)) {
- 723. - nav.setLoc(nl);
- 724. - if ((mvcur.options || {}).fromQueue) {
- 725. - mvcur.noHistory = 1;
- 726. - }
- 727. - }
- 728. - if (mvcur.options) mvcur.options.fromQueue = false;
- 729. - },
- 730. -
- 731. - backLocation: function() {
- 732. - if (mvcur.mvPrevLoc == 'z' || !mvcur.mvPrevLoc && nav.objLoc.z) {
- 733. - var loc = clone(nav.objLoc);
- 734. - delete loc.z;
- 735. - nav.setLoc(loc);
- 736. - } else if (mvcur.mvPrevLoc) {
- 737. - nav.setLoc(mvcur.mvPrevLoc);
- 738. - } else if (nav.objLoc[0] == 'video' || nav.objLoc[0].match(/^video-?\d+_\d+/)) {
- 739. - nav.setLoc({'0': 'video'});
- 740. - }
- 741. - if (mvcur.options.prevTitle) {
- 742. - window.document.title = replaceEntities(stripHTML(mvcur.options.prevTitle));
- 743. - delete mvcur.options.prevTitle;
- 744. - }
- 745. - mvcur.noHistory = 1;
- 746. - },
- 747. -
- 748. - highlightComment: function(el) {
- 749. - el = ge(el);
- 750. - if (!el) return;
- 751. -
- 752. - var hlfunc = animate.pbind(el, {backgroundColor: '#ECEFF3'}, 200, function() {
- 753. - setTimeout(function() {
- 754. - animate(el, {backgroundColor: '#FFF'}, 200);
- 755. - }, 1000);
- 756. - }), top = getXY(el, true)[1];
- 757. -
- 758. - if (top < 0 || top > lastWindowHeight - 200) {
- 759. - animate(mvLayerWrap, {scrollTop: mvLayerWrap.scrollTop + top - 50}, 300, hlfunc);
- 760. - } else {
- 761. - hlfunc();
- 762. - }
- 763. - },
- 764. - showComment: function(comm) {
- 765. - var p = ge('mv_comment' + comm);
- 766. - if (p) {
- 767. - Videoview.highlightComment(p);
- 768. - } else {
- 769. - Videoview.comments(comm);
- 770. - }
- 771. - return false;
- 772. - },
- 773. - commDone: function(comm, from, text, del, script) {
- 774. - var node = ge(from + '_comment' + comm);
- 775. - if (!node) return;
- 776. - var fChild = node.firstChild;
- 777. -
- 778. - var msg = fChild.nextSibling;
- 779. - if (!text) {
- 780. - show(node.firstChild);
- 781. - hide(msg);
- 782. - if (from == 'mv') {
- 783. - ++mvcur.mvData.commcount;
- 784. - ++mvcur.mvData.commshown;
- 785. - } else {
- 786. - ++cur.commentsCount;
- 787. - ++cur.commentsShown;
- 788. - }
- 789. -
- 790. - Videoview.updateComms(from);
- 791. - return;
- 792. - }
- 793. - if (msg) {
- 794. - msg.innerHTML = text;
- 795. - show(msg);
- 796. - } else {
- 797. - if (hasClass(fChild, 'video_comment_first')) {
- 798. - var dldClass = 'review_comment_first';
- 799. - } else {
- 800. - var dldClass = 'review_comment_dld';
- 801. - }
- 802. - node.appendChild(ce('div', {className: dldClass, innerHTML: text}));
- 803. - }
- 804. - hide(node.firstChild);
- 805. - if (del) {
- 806. - if (from == 'mv') {
- 807. - --mvcur.mvData.commcount;
- 808. - --mvcur.mvData.commshown;
- 809. - } else {
- 810. - --cur.commentsCount;
- 811. - --cur.commentsShown;
- 812. - }
- 813. - Videoview.updateComms(from);
- 814. - } else {
- 815. - if (from == 'mv') {
- 816. - Videoview.updateArrowsY();
- 817. - Videoview.recache();
- 818. - if (!cur.mvComments) cur.mvComments = {};
- 819. - cur.mvComments[mvcur.videoRaw] = ge('mv_comments_wrap');
- 820. - }
- 821. - }
- 822. - if (script) {
- 823. - eval(script);
- 824. - }
- 825. - },
- 826. -
- 827. - commParams: function(comm, from) {
- 828. - return {
- 829. - onDone: Videoview.commDone.pbind(comm, from),
- 830. - progress: from + '_progress' + comm
- 831. - }
- 832. - },
- 833. -
- 834. - commAction: function(act, comm, hash, from) {
- 835. - if (isVisible(from + '_progress' + comm)) return;
- 836. - ajax.post('al_video.php', {act: act + '_comment', comment: comm, hash: hash, videoview: 1, from: from}, Videoview.commParams(comm, from));
- 837. - },
- 838. -
- 839. - comments: function(showcomm) {
- 840. - if (showcomm) {
- 841. - var frst = domFC(ge('mv_comments')).id || '';
- 842. - if (
- 843. - !isVisible('mv_comments_header') ||
- 844. - (domFC(ge('mv_comments_header')) || {}).tagName == 'IMG' ||
- 845. - Videoview.cmp(frst, 'mv_comment' + showcomm) < 0
- 846. - ) {
- 847. - return;
- 848. - }
- 849. - }
- 850. - var mv = mvcur.mvData;
- 851. - var commlink = ge('mv_comments_link');
- 852. - ajax.post('al_video.php', {act: 'video_comments', offset: mv.commshown, video: mv.videoRaw}, {
- 853. - onDone: function(text, names) {
- 854. - Videoview.receiveComms(text, names, false, showcomm);
- 855. - if (showcomm && ge('mv_comment' + showcomm)) {
- 856. - Videoview.showComment(showcomm);
- 857. - }
- 858. - },
- 859. - showProgress: function() {
- 860. - var commHeader = ge('mv_comments_header');
- 861. - mvcur.mvCommInfo = commHeader.innerHTML;
- 862. - commHeader.innerHTML = '<img src="/images/upload.gif" />';
- 863. - }, hideProgress: function() {
- 864. - ge('mv_comments_header').innerHTML = mvcur.mvCommInfo;
- 865. - }
- 866. - });
- 867. - },
- 868. -
- 869. - updateComms: function(from) {
- 870. - if (from == 'review') {
- 871. - Video.changeSummary();
- 872. - return;
- 873. - }
- 874. - setTimeout(Videoview.updateArrowsY, 2);
- 875. - var mv = mvcur.mvData;
- 876. - var commshown = '';
- 877. - if (mv.commcount > mv.commshown) {
- 878. - commshown = getLang('video_show_previous_comments', mv.commcount - mv.commshown);
- 879. - }
- 880. - (commshown ? show : hide)(ge('mv_comments_header'));
- 881. - ge('mv_comments_header').innerHTML = commshown;
- 882. - Videoview.recache();
- 883. - if (!cur.mvComments) cur.mvComments = {};
- 884. - cur.mvComments[mvcur.videoRaw] = ge('mv_comments_wrap');
- 885. - },
- 886. - commentClick: function(el, event, from) {
- 887. - var comm = el.id.replace('mv_comment', ''), cmnt = comm.split('_');
- 888. - if (Wall.checkReplyClick(el, event)) return;
- 889. -
- 890. - var moreLink = geByClass1('wall_reply_more', el, 'a');
- 891. - if (moreLink && isVisible(moreLink)) {
- 892. - removeClass(el, 'reply_moreable');
- 893. - moreLink.onclick();
- 894. - return;
- 895. - }
- 896. - if (from && cmnt[1] && ge('mv_comment')) {
- 897. - Videoview.commentTo(comm, from, event);
- 898. - }
- 899. - },
- 900. - commentChanged: function() {
- 901. - checkTextLength(mvcur.mvCommLimit, ge('mv_comment'), ge('mv_comment_warn'));
- 902. - },
- 903. - commentTo: function(comm, toId, event) {
- 904. - 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');
- 905. -
- 906. - if (comm) {
- 907. - mvcur.mvReplyTo = [toId, commId];
- 908. - val(tl, replyName[0] || '');
- 909. - show(tl, 'mv_del_reply_to');
- 910. - 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});
- 911. - } else {
- 912. - mvcur.mvReplyTo = false;
- 913. - hide(tl, 'mv_del_reply_to');
- 914. - }
- 915. - cur.mvReplyIn = mvcur.videoRaw;
- 916. - cur.mvReplyTo = mvcur.mvReplyTo;
- 917. -
- 918. - var v = trim(val(rf)), cEl = comm && geByClass1('mv_reply_to', ge('mv_comment' + comm));
- 919. - if (!v || replyNameOld && !winToUtf(replyNameOld[1]).indexOf(v) || comm === false) {
- 920. - val(rf, (comm && !checkEvent(event)) ? replaceEntities(replyName[1]) : '');
- 921. - }
- 922. - toggleClass(asGroup, 'on', !!(cEl && cEl.getAttribute('rid') === cmnt[0]));
- 923. - if (comm) {
- 924. - elfocus(rf);
- 925. - }
- 926. - },
- 927. - receiveComms: function(text, names, noOld, toUp) {
- 928. - 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');
- 929. - for (var el = domLC(n); el; el = domLC(n)) {
- 930. - if (commField) addClass(el, 'reply_replieable');
- 931. - while (current && Videoview.cmp(current.id, el.id) > 0) {
- 932. - current = domPS(current);
- 933. - }
- 934. - if (current && !Videoview.cmp(current.id, el.id)) {
- 935. - comms.replaceChild(el, current);
- 936. - current = el;
- 937. - } else {
- 938. - if (current && domNS(current)) {
- 939. - comms.insertBefore(el, domNS(current));
- 940. - } else if (!current && domFC(comms)) {
- 941. - if (noOld === true) {
- 942. - --mv.commshown;
- 943. - n.removeChild(el);
- 944. - } else {
- 945. - comms.insertBefore(el, domFC(comms));
- 946. - }
- 947. - } else {
- 948. - comms.appendChild(el);
- 949. - }
- 950. - ++mv.commshown;
- 951. - }
- 952. - }
- 953. - if (toUp && last) {
- 954. - mvLayerWrap.scrollTop += getXY(last, true)[1] - frm;
- 955. - }
- 956. - mv.comments = comms.innerHTML;
- 957. - extend(mvcur.mvReplyNames, names);
- 958. - window.updateWndVScroll && updateWndVScroll();
- 959. - Videoview.updateComms();
- 960. - },
- 961. - commSaved: function(post) {
- 962. - if (!mvcur.mvShown || mvcur.minimized) return;
- 963. - var comms = ge('mv_comments_wrap'), vd = comms ? mvcur.videoRaw : false, comm = post.match(/^(-?\d+)video(_\d+)/);
- 964. - if (!vd || !comm || !ge('mv_comment' + comm[1] + comm[2])) return;
- 965. - if (!cur.mvComments) cur.mvComments = {};
- 966. - cur.mvComments[mvcur.videoRaw] = comms;
- 967. - },
- 968. -
- 969. - sendComment: function() {
- 970. - var fld = ge('mv_comment'), comp = fld && data(fld, 'composer'),
- 971. - params = comp ? Composer.getSendParams(comp, Videoview.sendComment) : {message: trim(val(fld))},
- 972. - replyToName = (mvcur.mvReplyNames[(mvcur.mvReplyTo || {})[0]] || [])[1], btn = 'mv_comment_send';
- 973. -
- 974. - if (params.delayed) return;
- 975. -
- 976. - if (!params.attach1_type && (!params.message || replyToName && !replyToName.indexOf(params.message))) {
- 977. - elfocus(fld);
- 978. - return;
- 979. - }
- 980. -
- 981. - hide('mv_comment_warn');
- 982. - ajax.post('al_video.php', Wall.fixPostParams(extend(params, {
- 983. - act: 'post_comment',
- 984. - video: mvcur.mvData.videoRaw,
- 985. - hash: mvcur.mvData.hash,
- 986. - fromview: 1,
- 987. - videoviewer: 1,
- 988. - from_group: isChecked(ge('mv_reply_as_group')),
- 989. - reply_to: (mvcur.mvReplyTo || {})[1]
- 990. - })), {
- 991. - onDone: function(text, names) {
- 992. - ++mvcur.mvData.commcount;
- 993. - Videoview.receiveComms(text, names, true);
- 994. - var fld = ge('mv_comment');
- 995. - if (fld && data(fld, 'composer')) {
- 996. - Composer.reset(data(fld, 'composer'));
- 997. - } else {
- 998. - val(fld, '');
- 999. - }
- 1000. - fld.blur();
- 1001. - mvcur.mvReplyTo = false;
- 1002. - hide('mv_reply_to_title', 'mv_del_reply_to');
- 1003. - },
- 1004. - onFail: function(text) {
- 1005. - if (fld) {
- 1006. - showTooltip(fld, {text: text, showdt: 200, forcetodown: 0, slide: 15});
- 1007. - elfocus(fld);
- 1008. - return true;
- 1009. - }
- 1010. - }, showProgress: lockButton.pbind(btn), hideProgress: unlockButton.pbind(btn)
- 1011. - });
- 1012. - },
- 1013. -
- 1014. - activate: function(el, control, fast) {
- 1015. - if (control == 2) {
- 1016. - animate(el, {color: '#FFFFFF'}, (typeof(fast) != 'undefined') ? 0 : 200);
- 1017. - } else {
- 1018. - animate(el, {opacity: 1}, 200);
- 1019. - }
- 1020. - },
- 1021. -
- 1022. - deactivate: function(el, control) {
- 1023. - if (control == 2) {
- 1024. - animate(el, {color: '#777777'}, (typeof(fast) != 'undefined') ? 0 : 200);
- 1025. - } else {
- 1026. - animate(el, {opacity: 0.5}, 200);
- 1027. - }
- 1028. - },
- 1029. -
- 1030. - addVideo: function(videoRaw, hash, obj, gid, accessHash, from) {
- 1031. - if (window.mvcur && mvcur.statusVideo) {
- 1032. - var params = {
- 1033. - act: 'external_add',
- 1034. - status: videoRaw,
- 1035. - hash: hash,
- 1036. - from: from || 'videoviewer'
- 1037. - };
- 1038. - var url = 'al_video_external.php';
- 1039. - } else {
- 1040. - var params = {
- 1041. - act: 'a_add',
- 1042. - video: videoRaw,
- 1043. - hash: hash,
- 1044. - from: from || 'videoviewer',
- 1045. - module: cur.module || ''
- 1046. - };
- 1047. - if (gid) {
- 1048. - params.gid = gid;
- 1049. - }
- 1050. - var url = 'al_video.php';
- 1051. - }
- 1052. - if (accessHash) {
- 1053. - params['access_hash'] = accessHash;
- 1054. - }
- 1055. - ajax.post(url, params, {
- 1056. - onDone: function(text, row, hash, shareHash) {
- 1057. - if (obj) {
- 1058. - obj.parentNode.innerHTML = text;
- 1059. - }
- 1060. - try {
- 1061. - row = eval('('+row+')');
- 1062. - } catch(e) {
- 1063. - }
- 1064. - if (window.Video && cur.oid && (vk.id == cur.oid || gid)) {
- 1065. - Video.addToList('all', row);
- 1066. - }
- 1067. - if (window.mvcur) {
- 1068. - if (mvcur.mvData && mvcur.mvData.afterAdd) {
- 1069. - mvcur.mvData.afterAdd(row[0]+'_'+row[1], shareHash);
- 1070. - } else {
- 1071. - mvcur.mvData.addedVideo = row[0]+'_'+row[1];
- 1072. - mvcur.mvData.addedVideoHash = hash;
- 1073. - mvcur.mvData.addedVideoShareHash = shareHash;
- 1074. - }
- 1075. - }
- 1076. - var videoEl = ge('video_cont'+videoRaw);
- 1077. - if (videoEl) {
- 1078. - addClass(videoEl, 'video_row_added');
- 1079. - }
- 1080. - if (from == 'list') {
- 1081. - showDoneBox(text);
- 1082. - }
- 1083. - }
- 1084. - });
- 1085. - //}
- 1086. - return false;
- 1087. - },
- 1088. -
- 1089. - likeUpdate: function(my, count, title, nott) {
- 1090. - count = intval(count);
- 1091. -
- 1092. - var mv = mvcur.mvData;
- 1093. - var likeType = (mvcur.statusVideo) ? 'wall' : 'video';
- 1094. -
- 1095. - var rows = ge('like_table_' + likeType + mv.videoRaw);
- 1096. - var titleNode = ge('like_title_' + likeType + mv.videoRaw)
- 1097. - var countInput = ge('like_real_count_' + likeType + mv.videoRaw) || {};
- 1098. -
- 1099. - var countNode = ge('mv_like_count');
- 1100. - var icon = ge('mv_like_icon');
- 1101. - var tt = icon.parentNode.tt || {}, opts = clone(tt.opts || {}), newleft = (my ? 0 : -36);
- 1102. -
- 1103. - if (title && titleNode) {
- 1104. - val(titleNode, title);
- 1105. - }
- 1106. - mv.likes = countInput.value = count;
- 1107. - animateCount(countNode, count);
- 1108. -
- 1109. - if (mvcur.statusVideo) {
- 1110. - var wallCount = ge('like_count' + mv.videoRaw);
- 1111. - if (wallCount) {
- 1112. - wallCount.innerHTML = count ? count : '';
- 1113. - (ge('like_real_count_wall' + mv.videoRaw) || {}).value = count;
- 1114. - var statusIcon = ge('like_icon' + mv.videoRaw);
- 1115. - if (statusIcon) {
- 1116. - if (my) {
- 1117. - addClass(statusIcon, 'my_like');
- 1118. - } else {
- 1119. - removeClass(statusIcon, 'my_like');
- 1120. - }
- 1121. - if (count) {
- 1122. - removeClass(statusIcon, 'no_likes');
- 1123. - setStyle(statusIcon, {opacity: 1, visibility: 'visible'});
- 1124. - } else {
- 1125. - addClass(statusIcon, 'no_likes');
- 1126. - setStyle(statusIcon, {opacity: 0, visibility: 'hidden'});
- 1127. - }
- 1128. - }
- 1129. - }
- 1130. - }
- 1131. -
- 1132. - mv.liked = my;
- 1133. - if (!my) {
- 1134. - var cb = ge('like_share_video' + mv.videoRaw);
- 1135. - if (cb) checkbox(cb, false);
- 1136. - } else {
- 1137. - setStyle(icon, {opacity: 1});
- 1138. - }
- 1139. - if (count) {
- 1140. - var styleName = vk.rtl ? 'right' : 'left';
- 1141. - if (tt.el && !isVisible(tt.container) && !title) {
- 1142. - rows.style[styleName] = newleft + 'px';
- 1143. - if (nott !== true) {
- 1144. - tooltips.show(tt.el, extend(opts, {showdt: 0}));
- 1145. - }
- 1146. - } else if (rows) {
- 1147. - var params = {};
- 1148. - params[styleName] = newleft;
- 1149. - animate(rows, params, 200);
- 1150. - }
- 1151. - removeClass(icon, 'no_likes');
- 1152. - } else {
- 1153. - if (tt.el) tt.hide();
- 1154. - addClass(icon, 'no_likes');
- 1155. - }
- 1156. - },
- 1157. -
- 1158. - likeSmall: function() {
- 1159. - Videoview.like();
- 1160. - addClass(ge('mv_like_line'), 'video_liked');
- 1161. - return false;
- 1162. - },
- 1163. -
- 1164. - addSmall: function(videoRaw, hash, gid, accessHash) {
- 1165. - Videoview.addVideo(videoRaw, hash, false, gid, accessHash);
- 1166. - hide('video_add_action_link');
- 1167. - addClass(ge('mv_like_line'), 'video_added');
- 1168. - },
- 1169. -
- 1170. - share: function(videoRaw, obj) {
- 1171. - if (!vk.id) return;
- 1172. - showBox('like.php', {act: 'publish_box', object: 'video'+(mvcur.mvData.addedVideo || videoRaw)});
- 1173. - return false;
- 1174. - },
- 1175. -
- 1176. - like: function() {
- 1177. - if (!vk.id) return;
- 1178. - var mv = mvcur.mvData;
- 1179. - if (mvcur.statusVideo) {
- 1180. - var object = 'wall' + mv.videoRaw;
- 1181. - } else {
- 1182. - var object = 'video' + mv.videoRaw;
- 1183. - }
- 1184. - ajax.post('like.php', {act: 'a_do_' + (mv.liked ? 'un' : '') + 'like', object: object, hash: mv.likeHash, short_view: 1, from: 'videoview'}, {
- 1185. - onDone: Videoview.likeUpdate.pbind(!mv.liked)
- 1186. - });
- 1187. - Videoview.likeUpdate(!mv.liked, mv.likes + (mv.liked ? -1 : 1));
- 1188. - },
- 1189. -
- 1190. - likeShare: function(hash) {
- 1191. - if (!vk.id) return;
- 1192. - var mv = mvcur.mvData;
- 1193. - if (mvcur.statusVideo) {
- 1194. - var object = 'wall' + mv.videoRaw;
- 1195. - } else {
- 1196. - var object = 'video' + mv.videoRaw;
- 1197. - }
- 1198. - var el = ge('like_share_video' + mv.videoRaw), was = isChecked(el);
- 1199. - checkbox(el);
- 1200. - ajax.post('like.php', {act: 'a_do_' + (was ? 'un' : '') + 'publish', object: object, hash: hash, short_view: 1, list: mvcur.listId}, {
- 1201. - onDone: Videoview.likeUpdate.pbind(true)
- 1202. - });
- 1203. - Videoview.likeUpdate(true, mv.likes + (mv.liked ? 0 : 1));
- 1204. - },
- 1205. -
- 1206. - likeOver: function() {
- 1207. - var mv = mvcur.mvData;
- 1208. - var icon = ge('mv_like_icon'),
- 1209. - link = ge('mv_like_link');
- 1210. -
- 1211. - if (!mv.liked) {
- 1212. - setTimeout(animate.pbind(icon, {opacity: 1}, 200, false), 1);
- 1213. - } else {
- 1214. - setStyle(icon, {opacity: 1});
- 1215. - }
- 1216. - var leftShift = vk.id ? 36 : 56;
- 1217. - if (mvcur.statusVideo) {
- 1218. - var object = 'wall' + mv.videoRaw;
- 1219. - } else {
- 1220. - var object = 'video' + mv.videoRaw;
- 1221. - }
- 1222. - var linkW = link.offsetWidth;
- 1223. -
- 1224. - showTooltip(icon.parentNode, {
- 1225. - url: 'like.php',
- 1226. - params: {act: 'a_get_stats', object: object, list: mvcur.listId},
- 1227. - slide: 15,
- 1228. - shift: [0, 5, 9],
- 1229. - ajaxdt: 100,
- 1230. - showdt: 400,
- 1231. - hidedt: 200,
- 1232. - className: 'rich like_tt',
- 1233. - no_shadow: (mvcur.videoAds || mvcur.statusVideo) ? 1 : 0,
- 1234. - init: function (tt) {
- 1235. - if (!tt.container) return;
- 1236. - var bp = geByClass1('bottom_pointer', tt.container, 'div');
- 1237. - var tp = geByClass1('top_pointer', tt.container, 'div');
- 1238. - setStyle(bp, {marginLeft: linkW + 2});
- 1239. - setStyle(tp, {marginLeft: linkW + 2});
- 1240. - }
- 1241. - });
- 1242. - },
- 1243. -
- 1244. - likeOut: function() {
- 1245. - var mv = mvcur.mvData;
- 1246. - if (!mv.liked) {
- 1247. - setTimeout(animate.pbind(ge('mv_like_icon'), {opacity: 0.4}, 200, false), 1);
- 1248. - } else if (mvcur.videoAds || mvcur.statusVideo) {
- 1249. - setTimeout(animate.pbind(ge('mv_like_icon'), {opacity: 0.7}, 200, false), 1);
- 1250. - }
- 1251. - },
- 1252. -
- 1253. - showEditBox: function(vid, oid, ev) {
- 1254. - Videoview.hidePlayer();
- 1255. - var box = showBox('al_video.php', {act: 'edit_box', vid: vid, oid: oid}, {stat: ['privacy.js', 'privacy.css', 'video.css'], dark: 1});
- 1256. - box.setOptions({onHide: function() {
- 1257. - Videoview.showPlayer();
- 1258. - }});
- 1259. - return cancelEvent(ev);
- 1260. - },
- 1261. -
- 1262. - restoreVideo: function(vid, oid, hash, from, ev) {
- 1263. - var warning = ge('mv_warning');
- 1264. - if (warning) {
- 1265. - warning.innerHTML = '<img style="margin-left: 100px;" src="/images/upload.gif" />';
- 1266. - }
- 1267. - ajax.post('al_video.php', {
- 1268. - act: 'restore_video',
- 1269. - vid: vid,
- 1270. - oid: oid,
- 1271. - hash: hash,
- 1272. - from: from || 'videoviewer'
- 1273. - }, {
- 1274. - onDone: function(row) {
- 1275. - if (from == 'list' && cur.restoreRaw && cur.restoreRaw[oid+'_'+vid]) {
- 1276. - var rowCont = ge('video_row'+oid+'_'+vid);
- 1277. - rowCont.innerHTML = cur.restoreRaw[oid+'_'+vid];
- 1278. -
- 1279. - removeClass(rowCont, 'video_row_loading');
- 1280. - removeClass(rowCont, 'video_row_deleted');
- 1281. - setStyle(geByClass1('video_row_icon_delete', rowCont), {opacity: 0.8});
- 1282. - var skipClear = true;
- 1283. - } else {
- 1284. - var skipClear = false;
- 1285. - }
- 1286. - hide('mv_warning');
- 1287. - show('mv_controls');
- 1288. - show('mv_controls_line');
- 1289. - if (cur.claimedVideoText) {
- 1290. - ge('video_player').innerHTML = cur.claimedVideoText;
- 1291. - cur.claimedVideoText = "";
- 1292. - }
- 1293. - if (window.mvcur && mvcur.mvCommentsData) {
- 1294. - show(mvcur.mvCommentsData);
- 1295. - }
- 1296. - var row = eval('('+row+')');
- 1297. - if (window.Video) {
- 1298. - Video.addToList('all', row, skipClear);
- 1299. - }
- 1300. - },
- 1301. - onFail: function(text) {
- 1302. - setTimeout(showFastBox(getLang('global_error'), text).hide, 5000);
- 1303. - return true;
- 1304. - }
- 1305. - });
- 1306. - return cancelEvent(ev);
- 1307. - },
- 1308. -
- 1309. - deleteVideo: function(vid, oid, hash, sure, from, obj, callback) {
- 1310. - if (obj && hasClass(obj, 'loading')) return;
- 1311. - ajax.post('al_video.php', {
- 1312. - act: 'delete_video',
- 1313. - vid: vid,
- 1314. - oid: oid,
- 1315. - hash: hash,
- 1316. - sure: (sure) ? 1 : 0,
- 1317. - from: from
- 1318. - }, {onDone: function(type, removeInfo, text, do_button, cancel_button) {
- 1319. - Videoview.recache(oid+'_'+vid);
- 1320. - if (type == 'sure') {
- 1321. - Videoview.hidePlayer();
- 1322. - var box = showFastBox({title: removeInfo}, text);
- 1323. - box.setOptions({onHide: function() {
- 1324. - Videoview.showPlayer();
- 1325. - }});
- 1326. - box.removeButtons();
- 1327. - box.addButton(cancel_button, box.hide, 'no');
- 1328. - box.addButton(do_button, function() {
- 1329. - box.showProgress();
- 1330. - Videoview.deleteVideo(vid, oid, hash, true, from, obj, box.hide);
- 1331. - }, 'yes');
- 1332. - } else if (type == 'result') {
- 1333. - if (callback) {
- 1334. - callback(text);
- 1335. - }
- 1336. - if (from == 'videoviewer') {
- 1337. - if (mvcur.mvCommentsData) {
- 1338. - hide(mvcur.mvCommentsData);
- 1339. - var warning = ge('mv_warning');
- 1340. - warning.innerHTML = text;
- 1341. - show(warning);
- 1342. - }
- 1343. - text = removeInfo;
- 1344. - }
- 1345. - if (cur.module == 'video') {
- 1346. - var row = ge('video_row'+oid+'_'+vid);
- 1347. - addClass(row, 'video_row_deleted');
- 1348. - re(geByClass1('video_row_controls', row));
- 1349. - var textEl = se(text);
- 1350. - row.insertBefore(textEl, row.firstChild);
- 1351. - setStyle(textEl, {marginTop: getSize(row)[1] / 2 - getSize(textEl)[1] / 2})
- 1352. - Video.removeFromLists(oid+'_'+vid, true);
- 1353. - return true;
- 1354. - }
- 1355. - }
- 1356. - }, showProgress: obj ? addClass.pbind(obj, 'loading') : false, hideProgress: obj ? removeClass.pbind(obj, 'loading') : false});
- 1357. - },
- 1358. - deleteVideoOnClaim: function(vid, oid, hash, sure, from, obj) {
- 1359. - Videoview.deleteVideo(vid, oid, hash, sure, from, obj, function(text) {
- 1360. - if (from == 'videoviewer') {
- 1361. - hide('mv_controls');
- 1362. - hide('mv_controls_line');
- 1363. - cur.claimedVideoText = ge('video_player').innerHTML;
- 1364. - ge('video_player').innerHTML = text;
- 1365. - }
- 1366. - });
- 1367. - },
- 1368. -
- 1369. - tagOver: function(el) {
- 1370. - animate(el, {backgroundColor: '#6B8DB1'}, 200);
- 1371. - showTooltip(el, {text: getLang('video_delete_tag'), shift: [0, -2, 0]});
- 1372. - },
- 1373. -
- 1374. - tagOut: function(el) {
- 1375. - if (!el.parentNode || !el.parentNode.parentNode) return;
- 1376. - animate(el, {backgroundColor: '#C4D2E1'}, 200);
- 1377. - },
- 1378. -
- 1379. - recache: function(videoRaw) {
- 1380. - if (!videoRaw && window.mvcur && mvcur.mvData.videoRaw) {
- 1381. - videoRaw = mvcur.mvData.videoRaw;
- 1382. - }
- 1383. - for (var i in ajaxCache) {
- 1384. - if (i.match(/^\/al_video\.php\#act=show/) && i.match(new RegExp('\&video='+videoRaw+'([^0-9]|$)', ''))) {
- 1385. - delete(ajaxCache[i]);
- 1386. - }
- 1387. - }
- 1388. - },
- 1389. -
- 1390. - deleteTag: function(tagId, usersTag) {
- 1391. - var actionCont = ge('mv_action_info');
- 1392. - actionCont.innerHTML = '<img src="/images/upload.gif" />';
- 1393. - show(actionCont);
- 1394. - mv = mvcur.mvData;
- 1395. - ajax.post('al_video.php', {act: 'delete_tag', video: mv.videoRaw, tag_id: tagId, hash: mv.hash}, {onDone: function(info, tagsList) {
- 1396. - ge('mv_action_info').innerHTML = info;
- 1397. - ge('mv_tags_list').innerHTML = tagsList;
- 1398. - (tagsList ? show : hide)('mv_tags');
- 1399. - (info ? show : hide)('mv_action_info');
- 1400. - Videoview.recache(mv.videoRaw);
- 1401. - if (window.Video && Video.removeFromLists && usersTag) {
- 1402. - Video.removeFromLists(mvcur.mvData.videoRaw);
- 1403. - }
- 1404. - }});
- 1405. - },
- 1406. -
- 1407. - restoreTag: function(tagId) {
- 1408. - var actionCont = ge('mv_action_info');
- 1409. - actionCont.innerHTML = '<img src="/images/upload.gif" />';
- 1410. - show(actionCont);
- 1411. - mv = mvcur.mvData;
- 1412. - ajax.post('al_video.php', {act: 'restore_tag', video: mv.videoRaw, tag_id: tagId, hash: mv.hash}, {onDone: function(info, tagsList) {
- 1413. - ge('mv_action_info').innerHTML = info;
- 1414. - ge('mv_tags_list').innerHTML = tagsList;
- 1415. - (tagsList ? show : hide)('mv_tags');
- 1416. - (info ? show : hide)('mv_action_info');
- 1417. - Videoview.recache(mv.videoRaw);
- 1418. - }});
- 1419. - },
- 1420. -
- 1421. - addTags: function(ids) {
- 1422. - var actionCont = ge('mv_action_info');
- 1423. - actionCont.innerHTML = '<img src="/images/upload.gif" />';
- 1424. - show(actionCont);
- 1425. - mv = mvcur.mvData;
- 1426. - ajax.post('al_video.php', {act: 'add_tags', video: mv.videoRaw, ids: ids.join(','), hash: mv.hash}, {onDone: function(info, tagsList) {
- 1427. - ge('mv_action_info').innerHTML = info;
- 1428. - ge('mv_tags_list').innerHTML = tagsList;
- 1429. - (tagsList ? show : hide)('mv_tags');
- 1430. - (info ? show : hide)('mv_action_info');
- 1431. - Videoview.recache(mv.videoRaw);
- 1432. - }});
- 1433. - },
- 1434. -
- 1435. - getVideoCode: function(oid, vid) {
- 1436. - Videoview.hidePlayer();
- 1437. - var box = showBox('al_video.php', {act: 'video_embed_box', oid: oid, vid: vid}, {
- 1438. - stat: ['ui_controls.js', 'ui_controls.css', 'video.css'],
- 1439. - dark: 1,
- 1440. - params: {
- 1441. - width: 390,
- 1442. - bodyStyle: 'padding: 5px 20px 20px;'
- 1443. - }
- 1444. - });
- 1445. - box.setOptions({onHide: function() {
- 1446. - Videoview.showPlayer();
- 1447. - }});
- 1448. - },
- 1449. -
- 1450. - reportBox: function(oid, vid) {
- 1451. - Videoview.hidePlayer();
- 1452. - showBox('reports.php', {act: 'a_report_video_box', oid: oid, vid: vid}, {onHideAttempt: function() {
- 1453. - Videoview.showPlayer();
- 1454. - }, stat: ['ui_controls.js', 'ui_controls.css'], dark: 1});
- 1455. - },
- 1456. -
- 1457. - setAdult: function(oid, vid, hash) {
- 1458. - ajax.post('al_video.php', {
- 1459. - act: 'set_adult_video',
- 1460. - vid: vid,
- 1461. - oid: oid,
- 1462. - hash: hash
- 1463. - }, {onDone: function(text) {
- 1464. - ge('mv_setadult_line').innerHTML = text;
- 1465. - }});
- 1466. - },
- 1467. -
- 1468. - spamVideo: function(oid, vid, hash, obj, from, sure, callback) {
- 1469. - if (obj) {
- 1470. - addClass(obj, 'loading');
- 1471. - }
- 1472. - ajax.post('al_video.php', {
- 1473. - act: 'spam_video',
- 1474. - vid: vid,
- 1475. - oid: oid,
- 1476. - hash: hash,
- 1477. - sure: (sure) ? 1 : 0,
- 1478. - from: from
- 1479. - }, {onDone: function(type, title, text, do_button, cancel_button) {
- 1480. - if (obj) {
- 1481. - removeClass(obj, 'loading');
- 1482. - }
- 1483. - Videoview.recache(oid+'_'+vid);
- 1484. - if (type == 'sure') {
- 1485. - Videoview.hidePlayer();
- 1486. - var box = showFastBox({title: title}, text);
- 1487. - box.setOptions({onHide: function() {
- 1488. - Videoview.showPlayer();
- 1489. - }});
- 1490. - box.removeButtons();
- 1491. - box.addButton(cancel_button, box.hide, 'no');
- 1492. - box.addButton(do_button, function() {
- 1493. - box.showProgress();
- 1494. - Videoview.spamVideo(oid, vid, hash, obj, from, true, box.hide);
- 1495. - }, 'yes');
- 1496. - } else if (type == 'result') {
- 1497. - if (callback) {
- 1498. - callback();
- 1499. - }
- 1500. - if (from == 'videoviewer') {
- 1501. - if (mvcur.mvCommentsData) {
- 1502. - hide(mvcur.mvCommentsData);
- 1503. - var warning = ge('mv_warning');
- 1504. - warning.innerHTML = text;
- 1505. - show(warning);
- 1506. - }
- 1507. - if (window.Video) {
- 1508. - Video.removeFromLists(oid+'_'+vid);
- 1509. - }
- 1510. - } if (from == 'list') {
- 1511. - ge('video_row'+oid+'_'+vid).innerHTML = '<div class="video_row">'+text+'</div>';
- 1512. - Video.removeFromLists(oid+'_'+vid, true);
- 1513. - return true;
- 1514. - }
- 1515. - } else {
- 1516. - obj.parentNode.innerHTML = type;
- 1517. - }
- 1518. - }});
- 1519. - },
- 1520. -
- 1521. - licensed: function(obj, hash) {
- 1522. - var actionCont = ge('mv_licensed_info');
- 1523. - actionCont.innerHTML = '<img src="/images/upload.gif" />';
- 1524. - show(actionCont);
- 1525. -
- 1526. - ajax.post('al_video.php', {act: 'change_licensed', video: mvcur.mvData.videoRaw, hash: hash}, {onDone: function(text, info) {
- 1527. - actionCont.innerHTML = info;
- 1528. - (info ? show : hide)(actionCont);
- 1529. - obj.innerHTML = text;
- 1530. - }});
- 1531. - },
- 1532. - claimed: function(claim_id, action) {
- 1533. - ge('claim_link').innerHTML = '<img src="/images/upload.gif" />';
- 1534. -
- 1535. - 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() {
- 1536. - if (action == 'claim') {
- 1537. - ge('claim_link').innerHTML = '<a onclick="return Videoview.claimed(' + claim_id + ', \'unclaim\');\">�������</a>';
- 1538. - } else {
- 1539. - ge('claim_link').innerHTML = '<a onclick="return Videoview.claimed(' + claim_id + ', \'claim\');\">������</a>';
- 1540. - }
- 1541. - }});
- 1542. - },
- 1543. -
- 1544. - confirmTag: function(tagId) {
- 1545. - var actionCont = ge('mv_action_info');
- 1546. - ge('mv_approve').innerHTML = '<div style="text-align: center; padding-top: 4px;"><img src="/images/upload.gif"></div>';
- 1547. - ajax.post('al_video.php', {act: 'confirm_tag', video: mvcur.mvData.videoRaw, tag_id: tagId, hash: mvcur.mvData.hash}, {onDone: function(info, tagsList, padres) {
- 1548. - if (_pads.shown == 'vid') {
- 1549. - Pads.vidDone(mvcur.mvData.videoRaw, false, padres);
- 1550. - }
- 1551. - Pads.invalidate('vid');
- 1552. - hide('mv_approve');
- 1553. - ge('mv_tags_list').innerHTML = tagsList;
- 1554. - (tagsList ? show : hide)('mv_tags');
- 1555. - if (window.Video && Video.onTagConfirm) {
- 1556. - Video.onTagConfirm(mvcur.mvData.videoRaw);
- 1557. - }
- 1558. - Videoview.recache(mvcur.mvData.videoRaw);
- 1559. - }});
- 1560. - },
- 1561. -
- 1562. - declineTag: function(tagId) {
- 1563. - var appr = ge('mv_approve');
- 1564. - var back = appr.innerHTML;
- 1565. - appr.innerHTML = '<div style="text-align: center; padding-top: 4px;"><img src="/images/upload.gif"></div>';
- 1566. - ajax.post('al_video.php', {act: 'delete_tag', video: mvcur.mvData.videoRaw, tag_id: tagId, hash: mvcur.mvData.hash}, {
- 1567. - onDone: function(info, tagsList, padres) {
- 1568. - if (_pads.shown == 'vid') {
- 1569. - Pads.vidDone(mvcur.mvData.videoRaw, false, padres);
- 1570. - }
- 1571. - Pads.invalidate('vid');
- 1572. - ge('mv_approve').innerHTML = info;
- 1573. - //hide('mv_approve');
- 1574. - ge('mv_tags_list').innerHTML = tagsList;
- 1575. - (tagsList ? show : hide)('mv_tags');
- 1576. - if (window.Video && Video.removeFromLists) {
- 1577. - Video.removeFromLists(mvcur.mvData.videoRaw);
- 1578. - }
- 1579. - Videoview.recache(mvcur.mvData.videoRaw);
- 1580. - },
- 1581. - onFail: function() {
- 1582. - appr.innerHTML = back;
- 1583. - }
- 1584. - });
- 1585. - },
- 1586. -
- 1587. - setStyle: function(label, obj, style) {
- 1588. - if (!mvcur.restoreStyles) {
- 1589. - mvcur.restoreStyles = {};
- 1590. - }
- 1591. - for (var i in style) {
- 1592. - if (!mvcur.restoreStyles[label]) {
- 1593. - mvcur.restoreStyles[label] = {};
- 1594. - }
- 1595. - mvcur.restoreStyles[label][i] = obj.style[i];
- 1596. - obj.style[i] = style[i];
- 1597. - }
- 1598. - },
- 1599. -
- 1600. - restoreStyle: function(label, obj) {
- 1601. - setStyle(obj, mvcur.restoreStyles[label]);
- 1602. - },
- 1603. -
- 1604. - showVideo: function(title, html, js, desc, info, controlsLine, opt) {
- 1605. - if (!vk.id && !html) {
- 1606. - setTimeout(function() {
- 1607. - Videoview.hide(false, true);
- 1608. - showDoneBox(title);
- 1609. - }, 500);
- 1610. - return;
- 1611. - }
- 1612. -
- 1613. - opt = opt || {};
- 1614. - window.lang = extend(window.lang || {}, opt.lang);
- 1615. - mvcur.mvCommLimit = opt.commlimit;
- 1616. - mvcur.mvData = opt.mvData;
- 1617. - mvcur.videoRaw = opt.mvData.videoRaw;
- 1618. - mvcur.mvMediaTypes = opt.media;
- 1619. - mvcur.mvMediaShare = opt.share;
- 1620. - mvcur.mvReplyNames = opt.names || {};
- 1621. -
- 1622. - if (!mvcur.mvContent) {
- 1623. - mvcur.mvContent = ge('mv_content');
- 1624. - }
- 1625. -
- 1626. - Wall.cancelEdit(true);
- 1627. -
- 1628. - mvcur.mvContent.innerHTML = html;
- 1629. - if (mvcur.mvWide) {
- 1630. - mvcur.mvWide.innerHTML = desc;
- 1631. - }
- 1632. - if (mvcur.mvNarrow) {
- 1633. - mvcur.mvNarrow.innerHTML = info;
- 1634. - }
- 1635. -
- 1636. - Videoview.updateComposer();
- 1637. - if (mvcur.mvData.videoRaw == cur.mvReplyIn) {
- 1638. - mvcur.mvReplyTo = cur.mvReplyTo;
- 1639. - cur.mvReplyIn = mvcur.videoRaw;
- 1640. - cur.mvReplyTo = mvcur.mvReplyTo;
- 1641. - } else {
- 1642. - Videoview.commentTo(false);
- 1643. - }
- 1644. -
- 1645. - if (!cur.mvComments) cur.mvComments = {};
- 1646. - var cms = ge('mv_comments_wrap');
- 1647. - if (cur.mvComments[mvcur.videoRaw]) {
- 1648. - domPN(cms).replaceChild(cur.mvComments[mvcur.videoRaw], cms);
- 1649. - }
- 1650. -
- 1651. - mvcur.mvControlsLine.innerHTML = controlsLine;
- 1652. -
- 1653. - mvcur.finished = false;
- 1654. -
- 1655. - hide(mvcur.mvLoader);
- 1656. - if (js) {
- 1657. - eval('(function(){' + js + '})()');
- 1658. - }
- 1659. - if (opt['taggedInfo']) {
- 1660. - var tagInfo = ge('mv_approve');
- 1661. - tagInfo.innerHTML = opt['taggedInfo'];
- 1662. - show(tagInfo);
- 1663. - }
- 1664. -
- 1665. - Videoview.updateSize();
- 1666. - mvcur.changeCanvasSize = function() {
- 1667. - Videoview.updateSize();
- 1668. - window.checkRBoxes && checkRBoxes();
- 1669. - };
- 1670. -
- 1671. - if (mvcur.minimized) {
- 1672. - Videoview.minimizePlayer();
- 1673. - }
- 1674. -
- 1675. - var titleWidth = (mvcur.minimized) ? mvcur.minSize.wrap.w : false;
- 1676. - Videoview.setTitle(titleWidth);
- 1677. -
- 1678. - if (mvcur.statusVideo) {
- 1679. - var statusCont = ge('like_count' + mvcur.mvData.videoRaw);
- 1680. - if (statusCont) {
- 1681. - var tt = statusCont.parentNode.tt;
- 1682. - if (tt && tt.container) {
- 1683. - re(tt.container)
- 1684. - //re(tt.el);
- 1685. - }
- 1686. - if (statusCont.parentNode.tt) {
- 1687. - delete statusCont.parentNode.tt;
- 1688. - }
- 1689. - }
- 1690. - }
- 1691. - if (opt.showInfo && !mvcur.minimized && !mvcur.options.hideInfo) {
- 1692. - addClass(mvcur.mvControlsLine, 'mv_controls_shown');
- 1693. - show(ge('mv_controls'));
- 1694. - }
- 1695. -
- 1696. - show('mv_content');
- 1697. - window.updateWndVScroll && updateWndVScroll();
- 1698. -
- 1699. - if ((mvcur.options || {}).scroll) {
- 1700. - mvLayerWrap.scrollTop = mvcur.options.scroll;
- 1701. - mvcur.options.scroll = 0;
- 1702. - }
- 1703. - },
- 1704. -
- 1705. - setTitle: function(len) {
- 1706. - len = len || 590;
- 1707. - ge('mv_min_title').innerHTML = mvcur.mvData.title || '';
- 1708. - setStyle(ge('mv_min_title'), {maxWidth: Math.max(0, len - 60)});
- 1709. - },
- 1710. -
- 1711. - getContSize: function() {
- 1712. - if (!mvcur.contSize) {
- 1713. - mvcur.contSize = getSize(mvcur.mvBox);
- 1714. - }
- 1715. - return mvcur.contSize;
- 1716. - },
- 1717. -
- 1718. - getContPlace: function(event, click) {
- 1719. - var mask = 0;
- 1720. - var size = Videoview.getContSize();
- 1721. - var x = event.clientX - mvcur.minSize.wrap.l;
- 1722. - var y = event.clientY - mvcur.minSize.wrap.t;
- 1723. - if (y < 6) mask += 1;
- 1724. - if (x > size[0] - 20) mask += 2;
- 1725. - if (y > size[1] - 10) mask += 4;
- 1726. - if (x < 10) mask += 8;
- 1727. - if (mask == 1 && x > size[0] - 55) {
- 1728. - mask = 0;
- 1729. - }
- 1730. - if (!mask && y < 25 && x < size[0] - 55) {
- 1731. - mask += 16;
- 1732. - }
- 1733. - return mask;
- 1734. - },
- 1735. -
- 1736. - changeCursor: function(event) {
- 1737. - var mask = Videoview.getContPlace(event);
- 1738. - var cursor = 'default';
- 1739. - if (mask && mvcur.minimized) {
- 1740. - var direction = '';
- 1741. - if (mask & 1) direction += 'n';
- 1742. - if (mask & 4) direction += 's';
- 1743. - if (mask & 2) direction += 'e';
- 1744. - if (mask & 8) direction += 'w';
- 1745. - cursor = direction+'-resize';
- 1746. - if (mask & 16) {
- 1747. - cursor = 'move';
- 1748. - }
- 1749. - }
- 1750. - setStyle(mvcur.mvBox, {cursor: cursor});
- 1751. - },
- 1752. -
- 1753. - getMinSize: function() {
- 1754. - extend(mvcur.minSize, {
- 1755. - wrap: {
- 1756. - t: intval(mvLayerWrap.style.top),
- 1757. - l: intval(mvLayerWrap.style.left),
- 1758. - w: intval(mvLayerWrap.style.width),
- 1759. - h: intval(mvLayerWrap.style.height)
- 1760. - },
- 1761. - player: {
- 1762. - w: intval(mvcur.mvPlayer.style.width),
- 1763. - h: intval(mvcur.mvPlayer.style.height)
- 1764. - }
- 1765. - });
- 1766. - },
- 1767. -
- 1768. - startDrag: function(event) {
- 1769. - if (event.button && event.button !== 1) {
- 1770. - return;
- 1771. - }
- 1772. - var mask = Videoview.getContPlace(event, true);
- 1773. - if (!mask) {
- 1774. - return;
- 1775. - }
- 1776. - var dragTime = new Date().getTime();
- 1777. -
- 1778. - Videoview.getMinSize();
- 1779. - extend(mvcur.minSize, {x: event.clientX, y: event.clientY});
- 1780. -
- 1781. - mvcur.resizeDiff = 0;
- 1782. - mvcur.mvPlayerCont = mvcur.mvPlayer.parentNode;
- 1783. -
- 1784. - if (!mask || mask & 16) {
- 1785. - var act = Videoview.onMinMove;
- 1786. - } else {
- 1787. - var act = Videoview.onMinResize;
- 1788. - }
- 1789. - mvcur.resizeMask = mask;
- 1790. - var cb = function (event) {
- 1791. - removeEvent(document, 'mouseup', cb);
- 1792. - removeEvent(document, 'mousemove', act);
- 1793. - removeEvent(document, 'drag', act);
- 1794. - var time = new Date().getTime();
- 1795. - Videoview.getMinSize();
- 1796. - if (mvcur.resizeDiff < 8 && (time - dragTime) < 400 && (mask & 16 || mask == 1)) {
- 1797. - Videoview.unminimize();
- 1798. - }
- 1799. - removeClass(mvLayerWrap, 'mv_resizing');
- 1800. - hide(mvcur.mvLoader);
- 1801. - addEvent(mvcur.mvBox, 'mousemove', Videoview.changeCursor);
- 1802. - ls.set('mv_minSize', mvcur.minSize);
- 1803. - return false;
- 1804. - }
- 1805. - addClass(mvLayerWrap, 'mv_resizing');
- 1806. - show(mvcur.mvLoader);
- 1807. - addEvent(document, 'mouseup', cb);
- 1808. - addEvent(document, 'mousemove', act);
- 1809. - addEvent(document, 'drag', act);
- 1810. - removeEvent(mvcur.mvBox, 'mousemove', Videoview.changeCursor);
- 1811. - return cancelEvent(event);
- 1812. - },
- 1813. -
- 1814. - onMinMove: function(event) {
- 1815. - if (event) {
- 1816. - var diffY = event.clientY - mvcur.minSize.y;
- 1817. - var diffX = event.clientX - mvcur.minSize.x;
- 1818. - } else {
- 1819. - var diffY = 0;
- 1820. - var diffX = 0;
- 1821. - }
- 1822. - if (mvcur.minSize.wrap.t + diffY > mvcur.minSize.ch - mvcur.minSize.wrap.h - 15) {
- 1823. - diffY = mvcur.minSize.ch - mvcur.minSize.wrap.h - mvcur.minSize.wrap.t;
- 1824. - }
- 1825. - if (mvcur.minSize.wrap.l + diffX > mvcur.minSize.cw - mvcur.minSize.wrap.w - 25) {
- 1826. - diffX = mvcur.minSize.cw - mvcur.minSize.wrap.w - mvcur.minSize.wrap.l - 14;
- 1827. - }
- 1828. - if (mvcur.minSize.wrap.t + diffY < 15) {
- 1829. - diffY = -mvcur.minSize.wrap.t;
- 1830. - }
- 1831. - if (mvcur.minSize.wrap.l + diffX < 15) {
- 1832. - diffX = -mvcur.minSize.wrap.l;
- 1833. - }
- 1834. - setStyle(mvLayerWrap, {
- 1835. - top: mvcur.minSize.wrap.t + diffY + 'px',
- 1836. - left: mvcur.minSize.wrap.l + diffX + 'px'
- 1837. - });
- 1838. - mvcur.resizeDiff = Math.max(Math.abs(diffX), Math.max(Math.abs(diffY), mvcur.resizeDiff));
- 1839. - return (event) ? cancelEvent(event) : false;
- 1840. - },
- 1841. -
- 1842. - onMinResize: function(event) {
- 1843. - var diffL = 0;
- 1844. - var diffT = 0;
- 1845. - var mask = mvcur.resizeMask;
- 1846. - var diffY = (mask & 1 || mask & 4) ? event.clientY - mvcur.minSize.y : 0;
- 1847. - var diffX = (mask & 2 || mask & 8) ? event.clientX - mvcur.minSize.x : 0;
- 1848. - if ((mask & 4) && mvcur.minSize.wrap.t + diffY > mvcur.minSize.ch - mvcur.minSize.wrap.h) {
- 1849. - diffY = mvcur.minSize.ch - mvcur.minSize.wrap.h - mvcur.minSize.wrap.t;
- 1850. - }
- 1851. - if ((mask & 1) && mvcur.minSize.wrap.t + diffY < 0) {
- 1852. - diffY = -mvcur.minSize.wrap.t;
- 1853. - }
- 1854. - if ((mask & 2) && mvcur.minSize.wrap.l + diffX > mvcur.minSize.cw - mvcur.minSize.wrap.w - 14) {
- 1855. - diffX = mvcur.minSize.cw - mvcur.minSize.wrap.w - mvcur.minSize.wrap.l - 14;
- 1856. - }
- 1857. - if ((mask & 8) && mvcur.minSize.wrap.l + diffX < 0) {
- 1858. - diffX = -mvcur.minSize.wrap.l;
- 1859. - }
- 1860. - if (mask & 8) {
- 1861. - diffL = diffX;
- 1862. - diffX = -diffX;
- 1863. - }
- 1864. - if (mask & 1) {
- 1865. - diffT = diffY;
- 1866. - diffY = -diffY;
- 1867. - }
- 1868. - if (mvcur.minSize.wrap.w + diffX < 250) {
- 1869. - diffX = 250 - mvcur.minSize.wrap.w;
- 1870. - if (mask & 8) diffL = -diffX;
- 1871. - }
- 1872. - if (mvcur.minSize.wrap.h + diffY < 200) {
- 1873. - diffY = 200 - mvcur.minSize.wrap.h;
- 1874. - if (mask & 1) diffT = -diffY;
- 1875. - }
- 1876. - var change = Math.abs(diffX) + Math.abs(diffY);
- 1877. - var wrapW = mvcur.minSize.wrap.w + diffX;
- 1878. - setStyle(mvLayerWrap, {
- 1879. - top: (mvcur.minSize.wrap.t + diffT) + 'px',
- 1880. - left: positive(mvcur.minSize.wrap.l + diffL) + 'px',
- 1881. - width: wrapW + 'px',
- 1882. - height: (mvcur.minSize.wrap.h + diffY) + 'px'
- 1883. - });
- 1884. - var style = {
- 1885. - height: (mvcur.minSize.player.h + diffY) + 'px',
- 1886. - width: (mvcur.minSize.player.w + diffX) + 'px'
- 1887. - };
- 1888. - if (!mvcur.flashResizeStyle) {
- 1889. - if (change > 4) {
- 1890. - clearTimeout(mvcur.resizeTimeout);
- 1891. - }
- 1892. - mvcur.resizeTimeout = setTimeout(function() {
- 1893. - setStyle(mvcur.mvPlayer, mvcur.flashResizeStyle);
- 1894. - mvcur.flashResizeStyle = false;
- 1895. - }, 200);
- 1896. - }
- 1897. - mvcur.flashResizeStyle = style;
- 1898. - setStyle(mvcur.mvPlayerCont, style);
- 1899. -
- 1900. - mvcur.resizeDiff = Math.max(change, mvcur.resizeDiff);
- 1901. - mvcur.contSize = false;
- 1902. - Videoview.setTitle(wrapW);
- 1903. - if (ge('html5_player') && window.html5video) {
- 1904. - html5video.onResize()
- 1905. - }
- 1906. - return false;
- 1907. - },
- 1908. -
- 1909. - minimize: function(ev) {
- 1910. - ev && cancelEvent(ev);
- 1911. -
- 1912. - if (mvcur.minimized) {
- 1913. - return false;
- 1914. - }
- 1915. -
- 1916. - mvcur.controlsVisibility = isVisible('mv_controls');
- 1917. - hide('mv_controls');
- 1918. - hide('mv_top_controls');
- 1919. - if (isVisible('mv_approve')) {
- 1920. - mvcur.needShowApprove = true;
- 1921. - hide('mv_approve');
- 1922. - } else {
- 1923. - mvcur.needShowApprove = false;
- 1924. - }
- 1925. -
- 1926. - Wall.cancelEdit(true);
- 1927. -
- 1928. - addClass(mvLayerWrap, 'mv_minimized');
- 1929. - if (!mvcur.minSize) {
- 1930. - mvcur.minSize = ls.get('mv_minSize');
- 1931. - }
- 1932. -
- 1933. - var colorClass = 'mv_dark';
- 1934. - removeClass(mvLayerWrap, colorClass);
- 1935. - removeClass(layerBG, colorClass);
- 1936. - layers.fullhide = false;
- 1937. -
- 1938. - if (!mvcur.minSize || !Videoview.enabledResize() || !mvcur.minSize.wrap.w) {
- 1939. - mvcur.minSize = {
- 1940. - wrap: {
- 1941. - w: 300,
- 1942. - h: 210
- 1943. - }
- 1944. - }
- 1945. - }
- 1946. -
- 1947. - var wrap = mvcur.minSize.wrap;
- 1948. - mvcur.minSize.player = {w: wrap.w - 20, h: wrap.h - 37};
- 1949. -
- 1950. - Videoview.setStyle('mvCont', mvcur.mvCont, {
- 1951. - left: '0px',
- 1952. - top: '0px'
- 1953. - });
- 1954. -
- 1955. - mvLayer.style.width = 'auto';
- 1956. -
- 1957. - if (mvcur.mvData) {
- 1958. - Videoview.minimizePlayer();
- 1959. - }
- 1960. -
- 1961. - if (window.tooltips) {
- 1962. - tooltips.destroyAll(cur.mvBox);
- 1963. - }
- 1964. -
- 1965. - removeEvent(window, 'resize', Videoview.onResize);
- 1966. - removeEvent(document, 'keydown', Videoview.onKeyDown);
- 1967. -
- 1968. - addEvent(window, 'resize', Videoview.minResize);
- 1969. - if (Videoview.enabledResize()) {
- 1970. - addEvent(mvcur.mvBox, 'mousedown', Videoview.startDrag);
- 1971. - addEvent(mvcur.mvBox, 'mousemove', Videoview.changeCursor);
- 1972. - mvcur.minDestroy = function() {
- 1973. - removeEvent(mvcur.mvBox, 'mousedown', Videoview.startDrag);
- 1974. - removeEvent(mvcur.mvBox, 'mousemove', Videoview.changeCursor);
- 1975. - setStyle(mvcur.mvBox, {cursor: 'default'});
- 1976. - }
- 1977. - } else {
- 1978. - addEvent(ge('mv_min_title'), 'click', Videoview.unminimize);
- 1979. - mvcur.minDestroy = function() {
- 1980. - removeEvent(ge('mv_min_title'), 'click', Videoview.unminimize);
- 1981. - }
- 1982. - }
- 1983. -
- 1984. - Videoview.setTitle(wrap.w);
- 1985. -
- 1986. - Videoview.minResize();
- 1987. -
- 1988. - Videoview.setStyle('mvLayerWrap', mvLayerWrap, {
- 1989. - width: mvcur.minSize.wrap.w + 'px',
- 1990. - height: mvcur.minSize.wrap.h + 'px'
- 1991. - });
- 1992. -
- 1993. - mvcur.minimized = true;
- 1994. -
- 1995. - // if (window.wkcur && wkcur.shown) {
- 1996. - // WkView.showLayer();
- 1997. - // } else {
- 1998. - layers.wraphide();
- 1999. - // }
- 2000. -
- 2001. - var popLayer = layerQueue.count();
- 2002. - if (!mvcur.noLocChange) {
- 2003. - if (!mvcur.noHistory) {
- 2004. - popLayer = false;
- 2005. - history.go(-1); // return location through history
- 2006. - } else {
- 2007. - Videoview.backLocation();
- 2008. - }
- 2009. - mvcur.noHistory = 1;
- 2010. - }
- 2011. -
- 2012. - layerQueue.skipVideo = true;
- 2013. - if (popLayer) {
- 2014. - debugLog('pop from minimize');
- 2015. - layerQueue.pop();
- 2016. - }
- 2017. -
- 2018. - return false;
- 2019. - },
- 2020. -
- 2021. - enabledResize: function() {
- 2022. - return (browser.safari || browser.chrome || browser.mozilla | browser.opera) && !browser['safari_mobile'];
- 2023. - },
- 2024. -
- 2025. - minimizePlayer: function() {
- 2026. - mvcur.mvPlayer = ge('video_player') || ge('extra_player') || ge('html5_player');
- 2027. - if (mvcur.mvPlayer) {
- 2028. - var style = {
- 2029. - width: mvcur.minSize.player.w + 'px',
- 2030. - height: mvcur.minSize.player.h + 'px'
- 2031. - };
- 2032. - Videoview.setStyle('mvPlayer', mvcur.mvPlayer, style);
- 2033. - Videoview.setStyle('mvPlayerParent', mvcur.mvPlayer.parentNode, style);
- 2034. - if (ge('html5_player') && window.html5video) {
- 2035. - html5video.onResize()
- 2036. - }
- 2037. - }
- 2038. - },
- 2039. -
- 2040. - minResize: function() {
- 2041. - var docEl = document.documentElement;
- 2042. -
- 2043. - mvcur.minSize.ch = window.innerHeight || docEl.clientHeight || bodyNode.clientHeight;
- 2044. - mvcur.minSize.cw = window.innerWidth || docEl.clientWidth || bodyNode.clientWidth;
- 2045. -
- 2046. - var pos = getXY(ge('page_layout'));
- 2047. -
- 2048. - if (mvcur.minSize.wrap.t === undefined) {
- 2049. - mvcur.minSize.wrap.t = mvcur.minSize.ch - mvcur.minSize.wrap.h;
- 2050. - }
- 2051. - if (mvcur.minSize.wrap.l === undefined) {
- 2052. - mvcur.minSize.wrap.l = Math.max(String(pos[0] - mvcur.minSize.player.w / 2), 30);
- 2053. - }
- 2054. -
- 2055. - setStyle(mvLayerWrap, {
- 2056. - left: mvcur.minSize.wrap.l + 'px',
- 2057. - top: mvcur.minSize.wrap.t + 'px'
- 2058. - });
- 2059. -
- 2060. - Videoview.onMinMove();
- 2061. -
- 2062. - if (mvcur.minimized) {
- 2063. - Videoview.getMinSize();
- 2064. - }
- 2065. - },
- 2066. -
- 2067. - updateComposer: function() {
- 2068. - var yc = ge('mv_your_comment');
- 2069. - if (!yc || cur.mvYourComment == yc) return;
- 2070. -
- 2071. - if (cur.mvYourComment) {
- 2072. - domPN(yc).replaceChild(cur.mvYourComment, yc);
- 2073. - return;
- 2074. - }
- 2075. - var comp = data(ge('mv_comment'), 'composer');
- 2076. - if (comp) {
- 2077. - Composer.reset(comp);
- 2078. - Composer.destroy(comp);
- 2079. - }
- 2080. - cur.mvYourComment = yc;
- 2081. - cur.destroy.push(function(c) {
- 2082. - var field = c.pvYourComment && geByTag1('textarea', c.pvYourComment), comp = field && data(field, 'composer');
- 2083. - if (comp) {
- 2084. - Composer.reset(comp);
- 2085. - Composer.destroy(comp);
- 2086. - }
- 2087. - });
- 2088. - Wall.initComposer(ge('mv_comment'), {
- 2089. - lang: {
- 2090. - introText: getLang('profile_mention_start_typing'),
- 2091. - noResult: getLang('profile_mention_not_found')
- 2092. - },
- 2093. - wddClass: 'mv_composer_dd',
- 2094. - width: getSize(domPN(cur.pvYourComment))[0],
- 2095. - media: {
- 2096. - lnk: domFC(ge('mv_add_media')),
- 2097. - preview: ge('mv_media_preview'),
- 2098. - types: mvcur.mvMediaTypes,
- 2099. - options: {limit: 2, disabledTypes: ['album'], toggleLnk: true, onChange: function() {
- 2100. - setTimeout(Videoview.updateArrowsY, 2);
- 2101. - }}
- 2102. - }
- 2103. - });
- 2104. - if (!cur.options) cur.options = {};
- 2105. - if (!cur.options.share) cur.options.share = mvcur.mvMediaShare;
- 2106. - },
- 2107. -
- 2108. - unminimize: function(noLoc, beforeHide, noQueue) {
- 2109. - if (!mvcur.minimized) {
- 2110. - return;
- 2111. - }
- 2112. - if (!noQueue) {
- 2113. - layerQueue.push();
- 2114. - }
- 2115. - if (!beforeHide) {
- 2116. - layerQueue.hide();
- 2117. - setTimeout(function() {
- 2118. - mvcur.noHistory = 1;
- 2119. - layerQueue.noHistory();
- 2120. - layers.wrapshow(mvLayerWrap, 0.7);
- 2121. - layers.fullhide = Videoview.hide;
- 2122. - Videoview.updateComposer();
- 2123. - cur.mvReplyIn = mvcur.videoRaw;
- 2124. - cur.mvReplyTo = mvcur.mvReplyTo;
- 2125. - }, 0);
- 2126. - }
- 2127. - Videoview.hidePlayer(true);
- 2128. -
- 2129. - // if (window.wkLayerWrap && isVisible(window.wkLayerWrap)) {
- 2130. - // hide(wkLayerWrap);
- 2131. - // }
- 2132. -
- 2133. - if (mvcur.controlsVisibility) {
- 2134. - show('mv_controls');
- 2135. - }
- 2136. - //show('mv_right_controls');
- 2137. - show('mv_top_controls');
- 2138. -
- 2139. - mvcur.minimized = false;
- 2140. - removeClass(mvLayerWrap, 'mv_minimized');
- 2141. - Videoview.restoreStyle('mvLayerWrap', mvLayerWrap);
- 2142. -
- 2143. - var colorClass = 'mv_dark';
- 2144. - addClass(mvLayerWrap, colorClass);
- 2145. - addClass(layerBG, colorClass);
- 2146. -
- 2147. - if (mvcur.needShowApprove) {
- 2148. - mvcur.needShowApprove = false;
- 2149. - show('mv_approve');
- 2150. - }
- 2151. -
- 2152. - Videoview.restoreStyle('mvCont', mvcur.mvCont);
- 2153. - if (mvcur.mvPlayer) {
- 2154. - Videoview.restoreStyle('mvPlayer', mvcur.mvPlayer);
- 2155. - Videoview.restoreStyle('mvPlayerParent', mvcur.mvPlayer.parentNode);
- 2156. - if (ge('html5_player') && window.html5video) {
- 2157. - html5video.onResize()
- 2158. - }
- 2159. - }
- 2160. -
- 2161. - // if (cur.pvFixed) {
- 2162. - // hide(cur.pvFixed);
- 2163. - // cur.pvFixedHide = true;
- 2164. - // }
- 2165. - // layers.wrapshow(false, 0.7);
- 2166. -
- 2167. - Videoview.updateSize();
- 2168. -
- 2169. - addEvent(window, 'resize', Videoview.onResize);
- 2170. - addEvent(document, 'keydown', Videoview.onKeyDown);
- 2171. - removeEvent(window, 'resize', Videoview.minResize);
- 2172. -
- 2173. - if (mvcur.minDestroy) {
- 2174. - mvcur.minDestroy();
- 2175. - }
- 2176. - if (!mvcur.noLocChange && noLoc !== true) {
- 2177. - Videoview.setLocation();
- 2178. - }
- 2179. -
- 2180. - onBodyResize(true);
- 2181. -
- 2182. - setStyle(mvLayerWrap, {
- 2183. - left: '0px',
- 2184. - top: '0px'
- 2185. - });
- 2186. -
- 2187. - Videoview.showPlayer(true);
- 2188. -
- 2189. - Videoview.setTitle();
- 2190. -
- 2191. - return false;
- 2192. - },
- 2193. -
- 2194. - sendVideo: function() {
- 2195. - Videoview.hidePlayer();
- 2196. - 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']});
- 2197. - box.setOptions({onHideAttempt: function() {
- 2198. - Videoview.showPlayer();
- 2199. - return true;
- 2200. - }});
- 2201. - },
- 2202. -
- 2203. - showDD: function(obj, dd) {
- 2204. - clearTimeout(cur.hideShareTimer);
- 2205. - obj.blur();
- 2206. - if (hasClass(dd, 'mv_dd_hiding')) {
- 2207. - return;
- 2208. - }
- 2209. - if (isVisible(dd)) {
- 2210. - return fadeIn(dd, 0);
- 2211. - }
- 2212. - if (cur.ddShown) {
- 2213. - videoview.hideDD(0);
- 2214. - }
- 2215. - cur.ddShown = dd;
- 2216. - setTimeout(addEvent.pbind(document, 'click', Videoview.hideDD), 1);
- 2217. - show(dd);
- 2218. - },
- 2219. -
- 2220. - hideDD: function(timeout) {
- 2221. - if (timeout > 0) {
- 2222. - cur.hideShareTimer = setTimeout(Videoview.hideDD.pbind(0), timeout);
- 2223. - return;
- 2224. - }
- 2225. - var dd = cur.ddShown;
- 2226. - if (!dd) return;
- 2227. - if (timeout == -1) {
- 2228. - hide(dd);
- 2229. - } else {
- 2230. - addClass(dd, 'mv_dd_hiding')
- 2231. - fadeOut(dd, 200, function() {
- 2232. - removeClass(dd, 'mv_dd_hiding')
- 2233. - });
- 2234. - }
- 2235. - removeEvent(document, 'click', Videoview.hideDD);
- 2236. - cur.ddShown = false;
- 2237. - },
- 2238. -
- 2239. - createDD: function(obj, items, callback) {
- 2240. - var dd = obj.nextSibling;
- 2241. - if (hasClass(obj, 'mv_report_blocked')) {
- 2242. - return;
- 2243. - }
- 2244. - if (!dd || !hasClass(dd, 'mv_controls_dd')) {
- 2245. - var text = geByClass1('mv_share_text', obj).innerHTML;
- 2246. - var dd = se('<div onmouseover="videoview.showDD(ge(\''+obj.id+'\'), this);" onmouseout="videoview.hideDD(500);" onclick="videoview.hideDD(-1);" class="mv_controls_dd fixed">'+
- 2247. - '<table cellspacing="0" cellpadding="0"><tbody><tr>'+
- 2248. - '<td class="mvs_side_sh">'+
- 2249. - '<div class="mvs_side_sh_el"></div>'+
- 2250. - '</td><td>'+
- 2251. - '<div class="mvs_header_wrap">'+
- 2252. - '<div class="mvs_header">'+
- 2253. - '<span class="mvs_header_text">'+text+'</span>'+
- 2254. - '</div>'+
- 2255. - '</div>'+
- 2256. - '<div class="mvs_acts">'+
- 2257. - '</div>'+
- 2258. - '<div class="mvs_sh1"></div>'+
- 2259. - '<div class="mvs_sh2"></div>'+
- 2260. - '</td><td class="mvs_side_sh">'+
- 2261. - '<div class="mvs_side_sh_el"></div>'+
- 2262. - '</td>'+
- 2263. - '</tr></tbody></table></div>');
- 2264. - var acts = geByClass1('mvs_acts', dd);
- 2265. - for(var i in items) {
- 2266. - var el = ce('a', {className: 'mvs_act', onclick: callback.pbind(items[i][0]), innerHTML: '<span class="mvs_act_text">'+items[i][1]+'</span>'});
- 2267. - acts.appendChild(el)
- 2268. - }
- 2269. - obj.parentNode.insertBefore(dd, obj.nextSibling)
- 2270. - debugLog(dd);
- 2271. - }
- 2272. - videoview.showDD(obj, dd);
- 2273. - },
- 2274. -
- 2275. - showStats: function(oid, vid) {
- 2276. - showBox('al_stats.php', {act: 'video_stat', oid: oid, vid: vid}, {params: {width: 654}, dark: 1});
- 2277. - },
- 2278. -
- 2279. - reportFromDD: function(hash, reason) {
- 2280. - ajax.post('reports.php', {act: 'new_report', type: 'video', reason: reason, hash: hash, oid: mvcur.mvData.oid, item_id: mvcur.mvData.vid}, {
- 2281. - onDone: function(text) {
- 2282. - var cont = ge('mv_report');
- 2283. - cont.parentNode.replaceChild(ce('div', {className: 'mv_report_blocked', innerHTML: text}), cont);
- 2284. - },
- 2285. - showProgress: function() {
- 2286. - var cont = ge('mv_report');
- 2287. - addClass(cont, 'mv_report_blocked');
- 2288. - },
- 2289. - hideProgress: function() {
- 2290. - var cont = ge('mv_report');
- 2291. - removeClass(cont, 'mv_report_blocked');
- 2292. - }
- 2293. - });
- 2294. - },
- 2295. -
- 2296. - reportComment: function(obj, ev, commentRaw) {
- 2297. - stManager.add(['privacy.js', 'privacy.css'], function() {
- 2298. - return Privacy.show(obj, ev, 'report_'+commentRaw);
- 2299. - });
- 2300. - },
- 2301. -
- 2302. - _eof: 1}, videoview = Videoview;try{stManager.done('videoview.js');}catch(e){}
- ------
Advertisement
Add Comment
Please, Sign In to add comment