Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Файл - photoview.js (Старый размер - 115282 | Новый - 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. - if (!dd) {
- 1230. - return;
- 1231. - }
- 1232. - clearTimeout(cur.hideShareTimer);
- 1233. - obj.blur();
- 1234. - if (hasClass(dd, 'pv_dd_hiding')) {
- 1235. - return;
- 1236. - }
- 1237. - if (isVisible(dd)) {
- 1238. - return fadeIn(dd, 0);
- 1239. - }
- 1240. - if (cur.ddShown) {
- 1241. - Photoview.hideDD(0);
- 1242. - }
- 1243. - cur.ddShown = dd;
- 1244. - setTimeout(addEvent.pbind(document, 'click', Photoview.hideDD), 1);
- 1245. - show(dd);
- 1246. - },
- 1247. -
- 1248. - hideDD: function(timeout) {
- 1249. - if (timeout > 0) {
- 1250. - cur.hideShareTimer = setTimeout(Photoview.hideDD.pbind(0), timeout);
- 1251. - return;
- 1252. - }
- 1253. - var dd = cur.ddShown;
- 1254. - if (!dd) return;
- 1255. - if (timeout == -1) {
- 1256. - hide(dd);
- 1257. - } else {
- 1258. - addClass(dd, 'pv_dd_hiding')
- 1259. - fadeOut(dd, 200, function() {
- 1260. - removeClass(dd, 'pv_dd_hiding')
- 1261. - });
- 1262. - }
- 1263. - removeEvent(document, 'click', Photoview.hideDD);
- 1264. - cur.ddShown = false;
- 1265. - },
- 1266. -
- 1267. - createDD: function(rows, name) {
- 1268. - 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>\
- 1269. - <td class="pvs_side_sh"><div class="pvs_side_sh_el"></div></td>\
- 1270. - <td>\
- 1271. - <div class="pvs_header_wrap"><div class="pvs_header"><span class="pvs_header_text">' + name + '</span></div></div>\
- 1272. - <div class="pvs_acts">' + rows + '</div>\
- 1273. - <div class="pvs_sh1"></div><div class="pvs_sh2"></div>\
- 1274. - </td>\
- 1275. - <td class="pvs_side_sh"><div class="pvs_side_sh_el"></div></td>\
- 1276. - </tr></table></div>'
- 1277. - },
- 1278. -
- 1279. - report: function(hash, reason) {
- 1280. - var ids = cur.pvCurPhoto.id.split('_');
- 1281. - ajax.post('reports.php', {act: 'new_report', type: 'photo', reason: reason, hash: hash, oid: ids[0], item_id: ids[1]}, {
- 1282. - onDone: function(text) {
- 1283. - var cont = ge('pv_report');
- 1284. - cont.parentNode.replaceChild(ce('div', {className: 'pv_report_blocked', innerHTML: text}), cont);
- 1285. - },
- 1286. - showProgress: function() {
- 1287. - var cont = ge('pv_report');
- 1288. - addClass(cont, 'pv_report_blocked');
- 1289. - },
- 1290. - hideProgress: function() {
- 1291. - var cont = ge('mv_report');
- 1292. - removeClass(cont, 'pv_report_blocked');
- 1293. - }
- 1294. - });
- 1295. - },
- 1296. -
- 1297. - showShare: function() {
- 1298. - clearTimeout(cur.hideShareTimer);
- 1299. - var dd = ge('pvs_dd');
- 1300. - ge('pv_share').blur();
- 1301. - if (isVisible(dd)) {
- 1302. - return fadeIn(dd, 0);
- 1303. - }
- 1304. - setTimeout(addEvent.pbind(document, 'click', Photoview.hideShare), 1);
- 1305. - show(dd);
- 1306. - },
- 1307. - hideShare: function(timeout) {
- 1308. - if (timeout > 0) {
- 1309. - cur.hideShareTimer = setTimeout(Photoview.hideShare.pbind(0), timeout);
- 1310. - return;
- 1311. - }
- 1312. - var dd = ge('pvs_dd');
- 1313. - if (!dd) return;
- 1314. - if (timeout == -1) {
- 1315. - hide(dd);
- 1316. - } else {
- 1317. - fadeOut(dd, 200);
- 1318. - }
- 1319. - removeEvent(document, 'click', Photoview.hideShare);
- 1320. - },
- 1321. - savePhoto: function() {
- 1322. - var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index];
- 1323. - ajax.post('al_photos.php', {act: 'save_me', photo: ph.id, list: listId, hash: ph.hash}, {progress: 'pv_share_prg', onDone: showDoneBox});
- 1324. - },
- 1325. - sendPhoto: function() {
- 1326. - var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index];
- 1327. - 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']});
- 1328. - },
- 1329. -
- 1330. - setTags: function(tags) {
- 1331. - Photoview.hideTag();
- 1332. - if (!tags) {
- 1333. - hide(cur.pvTags);
- 1334. - return;
- 1335. - }
- 1336. - show(cur.pvTags);
- 1337. - if (window.tooltips) {
- 1338. - each(geByClass('delete', cur.pvTags), function() {
- 1339. - tooltips.destroy(this);
- 1340. - });
- 1341. - }
- 1342. - cur.pvTags.innerHTML = getLang('photos_onthisphoto') + ': ' + tags;
- 1343. - },
- 1344. - preload: function(from, direction) {
- 1345. - window.updateWndVScroll && updateWndVScroll(); // Because called on photo load
- 1346. - var listId = cur.pvListId, count = ((cur.pvData || {})[listId] || {}).length;
- 1347. - if (!count) return;
- 1348. -
- 1349. - var s1 = vk.pvbig ? (cur.pvVeryBig > 1 ? 'z' : (cur.pvVeryBig ? 'z' : 'y')) : 'x';
- 1350. - var s2 = vk.pvbig ? (cur.pvVeryBig > 1 ? 'z' : (cur.pvVeryBig ? 'y' : 'x')) : 0;
- 1351. - var s3 = vk.pvbig ? (cur.pvVeryBig > 1 ? 'y' : (cur.pvVeryBig ? 'x' : 0)) : 0;
- 1352. -
- 1353. - cur.pvLastFrom = from;
- 1354. - cur.pvLastDirection = direction;
- 1355. -
- 1356. - // remove preloaded ones without touching preloading ones
- 1357. - for (var i = 0; i < Math.min(Photoview.cacheSize, count - Photoview.cacheSize); ++i) {
- 1358. - var ind = from + (i + 1) * (-direction);
- 1359. - while (ind >= count) ind -= count;
- 1360. - while (ind < 0) ind += count;
- 1361. -
- 1362. - var p = cur.pvData[listId][ind];
- 1363. - if (!p) continue;
- 1364. - for (var j = 0, l = Photoview.allSizes.length; j < l; ++j) {
- 1365. - var s = Photoview.allSizes[j];
- 1366. - if (p[s] && p[s].src) {
- 1367. - p[s].src = Photoview.blank;
- 1368. - delete(p[s]);
- 1369. - }
- 1370. - }
- 1371. - }
- 1372. - for (var i = 0; i < Photoview.cacheSize; ++i) {
- 1373. - var ind = from + (i + 1) * direction;
- 1374. - while (ind >= count) ind -= count;
- 1375. - while (ind < 0) ind += count;
- 1376. -
- 1377. - var p = cur.pvData[listId][ind];
- 1378. - if (!p || !p.id) {
- 1379. - if (!p || (vkNow() - p > 3000)) {
- 1380. - cur.pvData[listId][ind] = vkNow();
- 1381. - setTimeout(function() {
- 1382. - ajax.post('al_photos.php', {act: 'show', list: listId, offset: Photoview.realOffset(listId, ind, -1), direction: direction}, {onDone: Photoview.loaded});
- 1383. - }, 10);
- 1384. - }
- 1385. - break;
- 1386. - }
- 1387. -
- 1388. - if (p[s1]) continue;
- 1389. - if (p[s1 + '_src']) {
- 1390. - p[s1] = vkImage();
- 1391. - p[s1].src = p[s1 + '_src'];
- 1392. - continue;
- 1393. - } else {
- 1394. - p[s1] = 1;
- 1395. - }
- 1396. -
- 1397. - if (p[s2]) continue;
- 1398. - if (p[s2 + '_src']) {
- 1399. - p[s2] = vkImage();
- 1400. - p[s2].src = p[s2 + '_src'];
- 1401. - continue;
- 1402. - } else {
- 1403. - p[s2] = 1;
- 1404. - }
- 1405. -
- 1406. - if (p[s3]) continue;
- 1407. - if (p[s3 + '_src']) {
- 1408. - p[s3] = vkImage();
- 1409. - p[s3].src = p[s3 + '_src'];
- 1410. - continue;
- 1411. - } else {
- 1412. - p[s3] = 1;
- 1413. - }
- 1414. -
- 1415. - if (p.x) continue;
- 1416. - p.x = vkImage();
- 1417. - p.x.src = p.x_src;
- 1418. - }
- 1419. - },
- 1420. - hide: function(noLoc, fromQueue) {
- 1421. - if (!cur.pvShown || __afterFocus && fromQueue !== true) return;
- 1422. - if (cur.pvCanvas) Photoview.fullscreenStop(true);
- 1423. -
- 1424. - if ((cur.pvJumpTo || {}).z == 'albums' + val('pva_owner') && !cur.pvAlbumsShown && noLoc === 0) {
- 1425. - return Photoview.jumpToAlbums(true);
- 1426. - }
- 1427. - if ((cur.pvJumpTo || {}).z == 'album' + val('pvsa_album') && !cur.pvAlbumShown && noLoc === 0) {
- 1428. - return Photoview.jumpToAlbum(true);
- 1429. - }
- 1430. - if ((cur.pvJumpTo || {}).z == 'tag' + val('pvsa_tag') && !cur.pvPhotoTagShown && noLoc === 0) {
- 1431. - return Photoview.jumpToTagged(true);
- 1432. - }
- 1433. - if (cur.pvListId == 'temp') {
- 1434. - cur.pvCancelLoad();
- 1435. - } else if (!cur.pvNoHistory && !noLoc && cur.pvHistoryLength > 0 && cur.pvHistoryLength < 10) {
- 1436. - cur.pvNoHistory = true;
- 1437. - __adsUpdate('very_lazy');
- 1438. - return history.go(-cur.pvHistoryLength);
- 1439. - }
- 1440. -
- 1441. - if (noLoc !== true && !layerQueue.count()) {
- 1442. - var newLoc;
- 1443. - if (cur.pvRoot) {
- 1444. - if (cur.pvListId.substr(0, 6) == 'newtag') {
- 1445. - newLoc = 'albums' + vk.id + '?act=added';
- 1446. - if (cur.pvListId.indexOf('/rev') != -1) {
- 1447. - newLoc += '&rev=1';
- 1448. - }
- 1449. - } else {
- 1450. - newLoc = cur.pvListId.replace('/rev', '?rev=1');
- 1451. - }
- 1452. - nav.setLoc(newLoc);
- 1453. - } else {
- 1454. - newLoc = clone(nav.objLoc);
- 1455. - delete(newLoc.z);
- 1456. - }
- 1457. - if (nav.strLoc != nav.toStr(newLoc)) {
- 1458. - nav.setLoc(newLoc);
- 1459. - }
- 1460. - __adsUpdate('very_lazy');
- 1461. - }
- 1462. -
- 1463. - window.__pvhideTimer = setTimeout(Photoview.doHide.pbind(cur), 0);
- 1464. - __adsUpdate();
- 1465. -
- 1466. - // if (window.wkcur && wkcur.scrollTop) {
- 1467. - // setTimeout(function() {
- 1468. - // window.wkLayerWrap.scrollTop = wkcur.scrollTop;
- 1469. - // wkcur.scrollTop = false;
- 1470. - // }, 0);
- 1471. - // }
- 1472. - if (cur.pvHHMove) {
- 1473. - removeEvent(layer, 'mousemove', Photoview.photoAct);
- 1474. - cur.pvHHMove = false;
- 1475. - }
- 1476. - cur.pvAlbumsShowing = cur.pvAlbumsShown = false;
- 1477. - cur.pvAlbumShowing = cur.pvAlbumShown = false;
- 1478. - cur.pvPhotoTagShowing = cur.pvPhotoTagShown = false;
- 1479. - cur.pvVideoTagShowing = cur.pvVideoTagsShown = false;
- 1480. - },
- 1481. - doHide: function(c) {
- 1482. - c.pvHistoryLength = 0;
- 1483. - if (cur.pvTagger) Phototag.stopTag();
- 1484. - cleanElems('pv_confirm_tag', 'pv_delete_tag', 'pv_prof_cancel', 'pv_prof_done');
- 1485. - if (c.pvFriends) {
- 1486. - cleanElems('pv_add_tag', 'pv_cancel_tag', c.pvFriends.firstChild.firstChild, c.pvFriends);
- 1487. - re(c.pvFriends);
- 1488. - c.pvFriends = c.pvFriendName = false;
- 1489. - }
- 1490. -
- 1491. - Wall.cancelEdit(true);
- 1492. -
- 1493. - removeEvent(c.pvPhoto, 'mousemove', Photoview.onMouseMove);
- 1494. -
- 1495. - // remove preloaded
- 1496. - var listId = c.pvListId, count = ((c.pvData || {})[listId] || {}).length;
- 1497. - if (c.pvLastDirection && count) {
- 1498. - for (var i = 0; i < Photoview.cacheSize; ++i) {
- 1499. - var ind = c.pvLastFrom + (i + 1) * c.pvLastDirection;
- 1500. - while (ind >= count) ind -= count;
- 1501. - while (ind < 0) ind += count;
- 1502. -
- 1503. - var p = c.pvData[listId][ind];
- 1504. - if (!p) continue;
- 1505. - for (var j = 0, l = Photoview.allSizes.length; j < l; ++j) {
- 1506. - var s = Photoview.allSizes[j];
- 1507. - if (p[s] && p[s].src) {
- 1508. - p[s].src = Photoview.blank;
- 1509. - delete(p[s]);
- 1510. - }
- 1511. - }
- 1512. - }
- 1513. - c.pvLastDirection = c.pvLastFrom = false;
- 1514. - }
- 1515. -
- 1516. - cur.pvYourComment = re(cur.pvYourComment);
- 1517. -
- 1518. - layers.hide();
- 1519. - layers.fullhide = false;
- 1520. -
- 1521. - Photoview.hideTag(true);
- 1522. - each(['pvLeft', 'pvClose', 'pvSwitch', 'pvFixed'], function() {
- 1523. - var n = this + '';
- 1524. - re(c[n]);
- 1525. - c[n] = false;
- 1526. - });
- 1527. - if (window.tooltips) {
- 1528. - tooltips.destroyAll(cur.pvBox);
- 1529. - }
- 1530. -
- 1531. - if (browser.mobile) {
- 1532. - ge('footer').style.height = '';
- 1533. - }
- 1534. -
- 1535. - var colorClass = vk.pvdark ? 'pv_dark' : 'pv_light';
- 1536. - removeClass(layerWrap, colorClass);
- 1537. - removeClass(layerBG, colorClass);
- 1538. - layerBG.style.opacity = '';
- 1539. -
- 1540. - c.pvShown = c.pvListId = c.pvClicked = false;
- 1541. - removeEvent(window, 'resize', Photoview.onResize);
- 1542. - removeEvent(document, 'keydown', Photoview.onKeyDown);
- 1543. - removeEvent(layerWrap, 'click', Photoview.onClick);
- 1544. - removeEvent(layerWrap, 'scroll', Photoview.scrollResize);
- 1545. -
- 1546. - // if (window.wkcur && wkcur.shown) {
- 1547. - // WkView.showLayer();
- 1548. - // }
- 1549. - var onh = cur.pvOptions && cur.pvOptions.onHide;
- 1550. - if (cur.pvOptions) {
- 1551. - var onh = cur.pvOptions.onHide;
- 1552. - cur.pvOptions.onHide = false;
- 1553. - if (onh) onh();
- 1554. - }
- 1555. - layerQueue.pop();
- 1556. -
- 1557. - if (c.pvPreloaded && c === cur) {
- 1558. - var cont = ge('photos_container'), d = ce('div', {innerHTML: c.pvPreloaded});
- 1559. - while (d.firstChild) {
- 1560. - cont.appendChild(d.firstChild);
- 1561. - }
- 1562. - if (cont.qsorter) {
- 1563. - setTimeout(qsorter.added.pbind(cont), 0);
- 1564. - }
- 1565. - c.pvPreloaded = false;
- 1566. - }
- 1567. - },
- 1568. - editPhoto: function() {
- 1569. - },
- 1570. - descTT: function(el) {
- 1571. - return showTooltip(el, {
- 1572. - text: getLang('photos_edit_desc'),
- 1573. - black: 1,
- 1574. - shift: [2, 4, 0],
- 1575. - showdt: 0
- 1576. - });
- 1577. - },
- 1578. - editInline: function(ev, noreq) {
- 1579. - if (((ev || window.event || {}).target || {}).tagName == 'A' || cur.pvEditing) return;
- 1580. -
- 1581. - var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index], noreq = !ph.desc;
- 1582. - var onDone = function(text) {
- 1583. - if (!cur.pvShown || cur.pvListId != listId || cur.pvIndex != index || cur.pvEditing) return;
- 1584. -
- 1585. - cur.pvEditing = [listId, index];
- 1586. - var mrg = '0px 0px 0px', taStyle = '';
- 1587. - if (browser.chrome) {
- 1588. - mrg = '0px 0px -5px';
- 1589. - taStyle = ' style="padding-bottom: 0px"';
- 1590. - } else if (browser.mozilla) {
- 1591. - mrg = '0px -1px 0px';
- 1592. - } else if (browser.msie) {
- 1593. - mrg = '0px 0px -6px';
- 1594. - }
- 1595. - var el = cur.pvDesc.appendChild(ce('div', {innerHTML: '\
- 1596. - <div style="margin: ' + mrg + '">\
- 1597. - <textarea id="pv_edit_text"' + taStyle + ' onkeydown="onCtrlEnter(event, Photoview.saveInline)" placeholder="' + getLang('photos_edit_desc_intro') + '">' + text + '</textarea>\
- 1598. - </div>'}, {display: 'none'})), txt = ge('pv_edit_text');
- 1599. - placeholderSetup(txt, {back: 1});
- 1600. - autosizeSetup(txt, {minHeight: 13});
- 1601. - setTimeout(function() {
- 1602. - show(el);
- 1603. - elfocus(txt);
- 1604. - addEvent(txt, 'blur', Photoview.saveInline);
- 1605. - hide(cur.pvDesc.firstChild);
- 1606. - }, 1);
- 1607. - };
- 1608. - if (!noreq) {
- 1609. - ajax.post('al_photos.php', {act: 'edit_desc', photo: ph.id}, {onDone: onDone, progress: 'pv_inlineedit_prg'});
- 1610. - } else {
- 1611. - onDone('');
- 1612. - }
- 1613. - },
- 1614. - cancelInline: function() {
- 1615. - cur.pvEditing = false;
- 1616. - removeEvent(ge('pv_edit_text'), 'blur');
- 1617. - show(cur.pvDesc.firstChild);
- 1618. - re(cur.pvDesc.firstChild.nextSibling);
- 1619. - },
- 1620. - saveInline: function() {
- 1621. - if (!cur.pvEditing) return;
- 1622. - removeEvent(ge('pv_edit_text'), 'blur');
- 1623. -
- 1624. - var listId = cur.pvEditing[0], index = cur.pvEditing[1], ph = cur.pvData[listId][index];
- 1625. - ajax.post('al_photos.php', {act: 'save_desc', photo: ph.id, hash: ph.hash, text: val('pv_edit_text')}, {onDone: function(text) {
- 1626. - ph.desc = text;
- 1627. -
- 1628. - var shown = cur.pvShown && listId == cur.pvListId && index == cur.pvIndex;
- 1629. - if (!shown) return;
- 1630. -
- 1631. - cur.pvEditing = false;
- 1632. - var d = domFC(cur.pvDesc);
- 1633. - val(d, text || ('<span class="pv_desc_edit">' + getLang('photos_edit_desc') + '</span>'));
- 1634. - d.onmouseover = text ? Photoview.descTT.pbind(d) : function() {};
- 1635. - show(d);
- 1636. - re(domNS(d));
- 1637. - }, progress: 'pv_inlineedit_prg'});
- 1638. - },
- 1639. -
- 1640. - cmp: function(id1, id2) {
- 1641. - var l1 = id1.length, l2 = id2.length;
- 1642. - if (l1 < l2) {
- 1643. - return -1;
- 1644. - } else if (l1 > l2) {
- 1645. - return 1;
- 1646. - } else if (id1 < id2) {
- 1647. - return -1;
- 1648. - } else if (id1 > id2) {
- 1649. - return 1;
- 1650. - }
- 1651. - return 0;
- 1652. - },
- 1653. - receiveComms: function(listId, index, text, names, noOld, toUp) {
- 1654. - if (listId != cur.pvListId || index != cur.pvIndex) return;
- 1655. -
- 1656. - var n = ce('div', {innerHTML: text}), comms = ge('pv_comments'), last = current = domLC(comms), frm = getXY(current, true)[1], ph = cur.pvData[listId][index];
- 1657. - for (var el = domLC(n); el; el = domLC(n)) {
- 1658. - if (ph.actions.comm) addClass(el, 'reply_replieable');
- 1659. - while (current && Photoview.cmp(current.id, el.id) > 0) {
- 1660. - current = domPS(current);
- 1661. - }
- 1662. - if (current && !Photoview.cmp(current.id, el.id)) {
- 1663. - comms.replaceChild(el, current);
- 1664. - current = el;
- 1665. - } else {
- 1666. - if (current && domNS(current)) {
- 1667. - comms.insertBefore(el, domNS(current));
- 1668. - } else if (!current && domFC(comms)) {
- 1669. - if (noOld === true) {
- 1670. - --ph.commshown;
- 1671. - n.removeChild(el);
- 1672. - } else {
- 1673. - comms.insertBefore(el, domFC(comms));
- 1674. - }
- 1675. - } else {
- 1676. - comms.appendChild(el);
- 1677. - }
- 1678. - ++ph.commshown;
- 1679. - }
- 1680. - }
- 1681. - if (toUp && last) {
- 1682. - layerWrap.scrollTop += getXY(last, true)[1] - frm;
- 1683. - }
- 1684. - cur.pvCommsLikes[ph.id][0] = comms;
- 1685. - extend(cur.pvReplyNames, names);
- 1686. - Photoview.updateComms();
- 1687. - },
- 1688. - commSaved: function(post) {
- 1689. - if (!cur.pvShown) return;
- 1690. - var comms = ge('pv_comments'), ph = comms ? cur.pvData[cur.pvListId][cur.pvIndex] : false, comm = post.match(/^(-?\d+)photo(_\d+)/);
- 1691. - if (!ph || !comm || !ge('pv_comment' + comm[1] + comm[2])) return;
- 1692. - cur.pvCommsLikes[ph.id][0] = comms;
- 1693. - },
- 1694. - comments: function(showcomm) {
- 1695. - if (showcomm) {
- 1696. - var frst = domFC(ge('pv_comments')).id || '';
- 1697. - if (
- 1698. - !isVisible('pv_comments_header') ||
- 1699. - isVisible('pv_comments_progress') ||
- 1700. - Photoview.cmp(frst, 'pv_comment' + showcomm) < 0
- 1701. - ) {
- 1702. - return;
- 1703. - }
- 1704. - }
- 1705. - var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index];
- 1706. - var prg = ge('pv_comments_progress');
- 1707. - ajax.post('al_photos.php', {act: 'photo_comments', offset: ph.commshown, photo: ph.id}, {
- 1708. - onDone: function(text, names) {
- 1709. - Photoview.receiveComms(listId, index, text, names, false, showcomm);
- 1710. - if (showcomm && ge('pv_comment' + showcomm)) {
- 1711. - Photoview.showComment(showcomm);
- 1712. - }
- 1713. - },
- 1714. - showProgress: function() {
- 1715. - hide(prg.previousSibling);
- 1716. - show(prg);
- 1717. - }, hideProgress: function() {
- 1718. - hide(prg);
- 1719. - show(prg.previousSibling);
- 1720. - }
- 1721. - });
- 1722. - },
- 1723. - updateComms: function() {
- 1724. - setTimeout(Photoview.updateHeight, 2);
- 1725. -
- 1726. - var ph = cur.pvData[cur.pvListId][cur.pvIndex];
- 1727. - var commshown = '', commprg = ge('pv_comments_progress'), commheader = ge('pv_comments_header');
- 1728. - if (ph.commcount > ph.commshown) {
- 1729. - commshown = getLang('photos_show_prev_comments', ph.commcount - ph.commshown);
- 1730. - }
- 1731. - (commshown ? show : hide)(commheader);
- 1732. - domPS(commprg).innerHTML = commshown;
- 1733. - },
- 1734. - commentClick: function(el, event, from) {
- 1735. - var comm = el.id.replace('pv_comment', ''), cmnt = comm.split('_');
- 1736. - if (Wall.checkReplyClick(el, event)) return;
- 1737. -
- 1738. - var moreLink = geByClass1('wall_reply_more', el, 'a');
- 1739. - if (moreLink && isVisible(moreLink)) {
- 1740. - removeClass(el, 'reply_moreable');
- 1741. - moreLink.onclick();
- 1742. - return;
- 1743. - }
- 1744. - if (from && cmnt[1] && isVisible(cur.pvYourComment)) {
- 1745. - Photoview.commentTo(comm, from, event);
- 1746. - }
- 1747. - },
- 1748. - commentChanged: function() {
- 1749. - checkTextLength(cur.pvCommLimit, cur.pvComment, ge('pv_comment_warn'));
- 1750. - cur.pvCommenting = cur.pvData[cur.pvListId][cur.pvIndex].id;
- 1751. - },
- 1752. - commentTo: function(comm, toId, event) {
- 1753. - 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');
- 1754. -
- 1755. - cur.pvCommenting = ph.id;
- 1756. -
- 1757. - if (comm) {
- 1758. - cur.pvReplyTo = [toId, commId];
- 1759. - val(tl, replyName[0]);
- 1760. - show(tl, 'pv_del_reply_to');
- 1761. - 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});
- 1762. - } else {
- 1763. - cur.pvReplyTo = false;
- 1764. - hide(tl, 'pv_del_reply_to');
- 1765. - }
- 1766. -
- 1767. - var v = trim(val(rf)), cEl = comm && geByClass1('pv_reply_to', ge('pv_comment' + comm));
- 1768. - if (!v || replyNameOld && !winToUtf(replyNameOld[1]).indexOf(v)) {
- 1769. - val(rf, (comm && !checkEvent(event)) ? replaceEntities(replyName[1]) : '');
- 1770. - }
- 1771. - toggleClass(cur.pvAsGroup, 'on', !!(ph.actions.asgr && cEl && cEl.getAttribute('rid') === cmnt[0]));
- 1772. - elfocus(rf);
- 1773. - },
- 1774. - sendComment: function() {
- 1775. - var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index],
- 1776. - fld = cur.pvComment, comp = fld && data(fld, 'composer'),
- 1777. - params = comp ? Composer.getSendParams(comp, Photoview.sendComment) : {message: trim(val(fld))},
- 1778. - replyToName = (cur.pvReplyNames[(cur.pvReplyTo || {})[0]] || [])[1], btn = 'pv_comment_send';
- 1779. -
- 1780. - if (params.delayed) return;
- 1781. -
- 1782. - if (!params.attach1_type && (!params.message || replyToName && !replyToName.indexOf(params.message))) {
- 1783. - elfocus(fld);
- 1784. - return;
- 1785. - }
- 1786. -
- 1787. - hide('pv_comment_warn');
- 1788. - ajax.post('al_photos.php', Wall.fixPostParams(extend(params, {
- 1789. - act: 'post_comment',
- 1790. - photo: ph.id,
- 1791. - hash: ph.hash,
- 1792. - fromview: 1,
- 1793. - from_group: isVisible(cur.pvAsGroup) ? isChecked(cur.pvAsGroup) : '',
- 1794. - reply_to: (cur.pvReplyTo || {})[1]
- 1795. - })), {onDone: function(text, names) {
- 1796. - ++ph.commcount;
- 1797. - Photoview.receiveComms(listId, index, text, names, true);
- 1798. - if (data(cur.pvComment, 'composer')) {
- 1799. - Composer.reset(data(cur.pvComment, 'composer'));
- 1800. - } else {
- 1801. - val(cur.pvComment, '');
- 1802. - }
- 1803. - cur.pvComment.blur();
- 1804. - cur.pvReplyTo = false;
- 1805. - hide('pv_reply_to_title', 'pv_del_reply_to');
- 1806. - }, showProgress: lockButton.pbind(btn), hideProgress: unlockButton.pbind(btn)});
- 1807. - },
- 1808. - highlightComment: function(el) {
- 1809. - el = ge(el);
- 1810. - if (!el) return;
- 1811. -
- 1812. - var hlfunc = animate.pbind(el, {backgroundColor: '#ECEFF3'}, 200, function() {
- 1813. - setTimeout(function() {
- 1814. - animate(el, {backgroundColor: '#FFF'}, 200, function() {
- 1815. - setStyle(el, {backgroundColor: ''});
- 1816. - });
- 1817. - }, 1000);
- 1818. - }), top = getXY(el, true)[1];
- 1819. -
- 1820. - if (top < 0 || top > lastWindowHeight - 200) {
- 1821. - animate(layerWrap, {scrollTop: layerWrap.scrollTop + top - 50}, 300, hlfunc);
- 1822. - } else {
- 1823. - hlfunc();
- 1824. - }
- 1825. - },
- 1826. - showComment: function(comm) {
- 1827. - var p = ge('pv_comment' + comm);
- 1828. - if (p) {
- 1829. - Photoview.highlightComment(p);
- 1830. - } else {
- 1831. - Photoview.comments(comm);
- 1832. - }
- 1833. - return false;
- 1834. - },
- 1835. - commDone: function(comm, context, text, del, script) {
- 1836. - var node = ge('pv_comment' + comm + context);
- 1837. - if (!node) return;
- 1838. -
- 1839. - var msg = node.firstChild.nextSibling, ph = context ? false : cur.pvData[cur.pvListId][cur.pvIndex];
- 1840. - if (!text) {
- 1841. - show(node.firstChild);
- 1842. - hide(msg);
- 1843. - if (ph) {
- 1844. - ++ph.commcount;
- 1845. - ++ph.commshown;
- 1846. - Photoview.updateComms();
- 1847. - } else if (window.photos && cur.offset) {
- 1848. - photos.recache(cur.offset, 1);
- 1849. - }
- 1850. - return;
- 1851. - }
- 1852. - if (msg) {
- 1853. - msg.innerHTML = text;
- 1854. - show(msg);
- 1855. - } else {
- 1856. - node.appendChild(ce('div', {innerHTML: text}));
- 1857. - }
- 1858. - hide(node.firstChild);
- 1859. - if (del) {
- 1860. - if (ph) {
- 1861. - --ph.commshown;
- 1862. - --ph.commcount;
- 1863. - Photoview.updateComms();
- 1864. - } else if (window.photos && cur.offset) {
- 1865. - photos.recache(cur.offset, -1);
- 1866. - }
- 1867. - } else {
- 1868. - Photoview.updateHeight();
- 1869. - }
- 1870. - if (ph) {
- 1871. - cur.pvCommsLikes[ph.id][0] = ge('pv_comments');
- 1872. - }
- 1873. - if (script) {
- 1874. - eval(script);
- 1875. - }
- 1876. - },
- 1877. - commProgress: function(comm, sh) {
- 1878. - var acts = ge('pv_actions' + comm);
- 1879. - if (!acts) return;
- 1880. -
- 1881. - var prg = acts.firstChild.nextSibling;
- 1882. - if (sh !== true) {
- 1883. - hide(prg);
- 1884. - show(acts.firstChild);
- 1885. - return;
- 1886. - }
- 1887. - hide(acts.firstChild);
- 1888. - if (!prg) {
- 1889. - prg = acts.appendChild(ce('div', {className: 'progress'}));
- 1890. - }
- 1891. - show(prg);
- 1892. - },
- 1893. - commParams: function(comm, context) {
- 1894. - return {
- 1895. - onDone: Photoview.commDone.pbind(comm, context),
- 1896. - progress: 'pv_progress' + comm + context,
- 1897. - stat: ['privacy.js', 'privacy.css']
- 1898. - }
- 1899. - },
- 1900. - commAction: function(act, comm, context, hash) {
- 1901. - if (isVisible('pv_progress' + comm + context)) return;
- 1902. - ajax.post('al_photos.php', {act: act + '_comment', comment: comm, context: context, hash: hash}, Photoview.commParams(comm, context));
- 1903. - },
- 1904. -
- 1905. - onClick: function(e, skipClicked) {
- 1906. - if (cur.pvClicked && !skipClicked || __afterFocus) {
- 1907. - cur.pvClicked = false;
- 1908. - return;
- 1909. - }
- 1910. - if (e && (e.button == 2 || e.which == 3 || e.pvHandle)) return;
- 1911. - if (e) e.pvHandle = true;
- 1912. - var px = e.pageX, py = e.pageY;
- 1913. - if (px == null && e.clientX != null) {
- 1914. - var doc = document.documentElement, body = bodyNode;
- 1915. - px = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0);
- 1916. - py = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0);
- 1917. - }
- 1918. - var dx = Math.abs(px - intval(cur.pvOldX));
- 1919. - var dy = Math.abs(py - intval(cur.pvOldY));
- 1920. - if (dx > 3 || dy > 3) {
- 1921. - if (vkNow() - intval(cur.pvOldT) > 300) {
- 1922. - if (cur.pvTagger) {
- 1923. - Phototag.stopTag();
- 1924. - } else {
- 1925. - Photoview.hide(0);
- 1926. - }
- 1927. - }
- 1928. - }
- 1929. - },
- 1930. - onMouseMove: function(ev) {
- 1931. - var el = cur.pvPhoto.firstChild;
- 1932. - if (cur.pvTagger || !el) return;
- 1933. -
- 1934. - var elemXY = getXY(el), ph = cur.pvData[cur.pvListId][cur.pvIndex];
- 1935. - var x = (ev.pageX - elemXY[0]) * 100 / cur.pvPhWidth, y = (ev.pageY - elemXY[1]) * 100 / cur.pvPhHeight;
- 1936. - for (var i in ph.tags) {
- 1937. - var coords = ph.tags[i];
- 1938. - if (x > coords[0] && x < coords[2] && y > coords[1] && y < coords[3]) {
- 1939. - Photoview.showDynTag(i);
- 1940. - return;
- 1941. - }
- 1942. - }
- 1943. - Photoview.hideTag();
- 1944. - },
- 1945. - onKeyDown: function(e) {
- 1946. - if (e.returnValue === false) return false;
- 1947. - if (e.keyCode == KEY.ESC && cur.pvEditing) {
- 1948. - Photoview.cancelInline();
- 1949. - return cancelEvent(e);
- 1950. - }
- 1951. - if (e.altKey && e.keyCode == KEY.RETURN && Photoview.canFullscreen()) {
- 1952. - (cur.pvCanvas ? Photoview.fullscreenStop() : Photoview.fullscreen());
- 1953. - }
- 1954. - if (e.target && (e.target.tagName == 'INPUT' || e.target.tagName == 'TEXTAREA' || e.target.tagName == 'DIV' && e.target.contentEditable)) {
- 1955. - return true;
- 1956. - }
- 1957. - if (e.keyCode == KEY.ESC) {
- 1958. - if (cur.pvCanvas) {
- 1959. - Photoview.fullscreenStop();
- 1960. - } else if (cur.pvTagger) {
- 1961. - Phototag.stopTag();
- 1962. - } else if (!e.vkCanceled && !curBox()) {
- 1963. - Photoview.hide(0);
- 1964. - }
- 1965. - return cancelEvent(e);
- 1966. - } else if (!cur.pvTagger && !boxQueue.count() && (!cur.pvComment || !cur.pvComment.focused)) {
- 1967. - if (e.keyCode == KEY.RIGHT) {
- 1968. - Photoview.show(cur.pvListId, cur.pvIndex + 1);
- 1969. - } else if (e.keyCode == KEY.LEFT) {
- 1970. - Photoview.show(cur.pvListId, cur.pvIndex - 1);
- 1971. - }
- 1972. - }
- 1973. - },
- 1974. - onResize: function() {
- 1975. - var dwidth = lastWindowWidth, dheight = lastWindowHeight, sbw = sbWidth();
- 1976. - if (cur.pvCanvas) {
- 1977. - var sizeChanged = false, oldverybig = cur.pvVeryBig, w = cur.pvCanvas.offsetWidth, h = cur.pvCanvas.offsetHeight;
- 1978. - cur.pvVeryBig = (w > 1280 || h > 1280) ? 2 : ((w > 807 || h > 807) ? 1 : false);
- 1979. - if (sizeChanged = (oldverybig != cur.pvVeryBig)) {
- 1980. - setTimeout(Photoview.preload.pbind(cur.pvIndex, cur.pvLastDirection || 1), 10);
- 1981. - }
- 1982. - return;
- 1983. - }
- 1984. - if (cur.pvAlbumsShown || cur.pvAlbumShown || cur.pvPhotoTagShown) {
- 1985. - cur.pvActualWidth = (cur.pvsaMini && !cur.pvAlbumsShown) ? 536 : 804;
- 1986. - cur.pvCont.style.width = (cur.pvActualWidth + 154) + 'px';
- 1987. - domPN(cur.pvSummary).style.width = (cur.pvActualWidth - 4) + 'px';
- 1988. - } else if (vk.pvbig) {
- 1989. - var w = dwidth - sbw - 2 - 120 - 34 - 50, h = dheight - 31 - 28 - 72;
- 1990. - if (w > 1280) { // less than full hd - not size > 2
- 1991. - w = 1280;
- 1992. - } else if (w > 807 && w < 907) { // 1024x768 - not size > 1
- 1993. - w = 807;
- 1994. - } else if (w < 604) {
- 1995. - w = 604;
- 1996. - }
- 1997. - if (h < 453) {
- 1998. - h = 453;
- 1999. - }
- 2000. - cur.pvWidth = w;
- 2001. - cur.pvHeight = h;
- 2002. -
- 2003. - var sizeChanged = false, oldverybig = cur.pvVeryBig;
- 2004. - cur.pvVeryBig = (w > 1280) ? 2 : (w > 807 ? 1 : false);
- 2005. - sizeChanged = (oldverybig != cur.pvVeryBig);
- 2006. -
- 2007. - var lnk = cur.pvPhoto;
- 2008. - if (lnk && lnk.firstChild && cur.pvCurData.src == lnk.firstChild.src && cur.pvCurData.width) {
- 2009. - var c = (cur.pvCurData.width > cur.pvWidth) ? (cur.pvWidth / cur.pvCurData.width) : 1;
- 2010. - if (cur.pvCurData.height * c > cur.pvHeight) {
- 2011. - c = cur.pvHeight / cur.pvCurData.height;
- 2012. - }
- 2013. - var w = cur.pvPhWidth = Math.floor(cur.pvCurData.width * c);
- 2014. - var h = cur.pvPhHeight = Math.floor(cur.pvCurData.height * c);
- 2015. - cur.pvActualWidth = Math.max(604, w);
- 2016. -
- 2017. - if (vk.pvbig) {
- 2018. - cur.pvCont.style.width = (cur.pvActualWidth + 154) + 'px';
- 2019. - domPN(cur.pvSummary).style.width = (cur.pvActualWidth - 4) + 'px';
- 2020. - }
- 2021. -
- 2022. - lnk.style.height = Math.max(453, h) + 'px';
- 2023. - lnk.firstChild.style.width = w + 'px';
- 2024. - lnk.firstChild.style.height = h + 'px';
- 2025. - if (cur.pvTagger && cur.pvTagger != 'loading') {
- 2026. - cur.pvTagger.resize(w, h);
- 2027. - }
- 2028. -
- 2029. - var x = lnk.firstChild.offsetLeft, y = lnk.firstChild.offsetTop;
- 2030. - if (browser.msie7 || browser.msie6) {
- 2031. - x += lnk.offsetLeft;
- 2032. - y += lnk.offsetTop;
- 2033. - }
- 2034. - setStyle(cur.pvTagFrame.firstChild, {
- 2035. - width: w + 'px',
- 2036. - height: h + 'px'
- 2037. - });
- 2038. - setStyle(cur.pvTagFaded, {
- 2039. - width: w + 'px',
- 2040. - height: h + 'px',
- 2041. - left: x + 'px',
- 2042. - top: y + 'px'
- 2043. - });
- 2044. - setStyle(cur.pvTagFrame, {
- 2045. - left: (x - 3) + 'px', // 3 - tag frame border
- 2046. - top: (y - 3) + 'px'
- 2047. - });
- 2048. - setStyle(cur.pvTagPerson, {
- 2049. - left: x + 'px',
- 2050. - top: y + 'px'
- 2051. - });
- 2052. -
- 2053. - if (sizeChanged) {
- 2054. - setTimeout(Photoview.preload.pbind(cur.pvIndex, cur.pvLastDirection || 1), 10);
- 2055. - }
- 2056. - } else {
- 2057. - cur.pvActualWidth = intval(getStyle(cur.pvBox, 'width'));
- 2058. - }
- 2059. - }
- 2060. - if (!cur.pvPhoto) return;
- 2061. - if (browser.mozilla && cur.pvPhoto.firstChild) {
- 2062. - var x = cur.pvPhoto.firstChild.offsetLeft, deltaX = ((lastWindowWidth - cur.pvActualWidth) % 2) && ((cur.pvActualWidth - cur.pvPhWidth) % 2) ? 4 : 3;
- 2063. - setStyle(cur.pvTagFrame, {
- 2064. - left: (x - deltaX) + 'px' // 3 - tag w border, mozilla buggy
- 2065. - });
- 2066. - }
- 2067. - Photoview.updateArrows();
- 2068. - Photoview.updateHeight();
- 2069. - cur.pvHH.style.marginLeft = Math.ceil((cur.pvActualWidth + 50 - 72) / 2) + 'px';
- 2070. -
- 2071. - Photoview.scrollResize();
- 2072. - // if (ge('pv_date')) { // debug
- 2073. - // ge('pv_date').innerHTML = lastWindowWidth + ' ' + cur.pvActualWidth + ' ' + cur.pvPhWidth;
- 2074. - // }
- 2075. - },
- 2076. - updateSize: function() {
- 2077. - if (!vk.pvbig) {
- 2078. - cur.pvActualWidth = 604;
- 2079. - domPN(cur.pvSummary).style.width = '600px';
- 2080. - cur.pvCont.style.width = '758px';
- 2081. - cur.pvPhoto.innerHTML = '';
- 2082. - }
- 2083. - onBodyResize();
- 2084. - Photoview.onResize();
- 2085. - },
- 2086. -
- 2087. - switchSize: function() {
- 2088. - vk.pvbig = !vk.pvbig;
- 2089. -
- 2090. - ge('pv_large_link').innerHTML = getLang(vk.pvbig ? 'photos_smaller' : 'photos_larger');
- 2091. - if (cur.pvTagger) Phototag.stopTag();
- 2092. - Photoview.updateSize();
- 2093. - Photoview.show(cur.pvListId, cur.pvIndex);
- 2094. - if (vk.id) {
- 2095. - clearTimeout(cur.pvSaveBig);
- 2096. - cur.pvSaveBig = setTimeout(ajax.post.pbind('al_photos.php', {act: 'viewer_big', big: (vk.pvbig ? 1 : ''), hash: cur.pvHash}), 1000);
- 2097. - }
- 2098. - },
- 2099. - switchColor: function(el) {
- 2100. - var old = vk.pvdark ? 'pv_dark' : 'pv_light';
- 2101. - vk.pvdark = !vk.pvdark;
- 2102. - var cl = vk.pvdark ? 'pv_dark' : 'pv_light';
- 2103. -
- 2104. - setStyle(el, 'opacity', vk.pvdark ? 1 : 0.7);
- 2105. -
- 2106. - layerBG.className = layerBG.className.replace(old, cl);
- 2107. - layerWrap.className = layerWrap.className.replace(old, cl);
- 2108. - cur.pvFixed.className = cur.pvFixed.className.replace(old, cl);
- 2109. - if (vk.id) {
- 2110. - clearTimeout(cur.pvSaveColor);
- 2111. - cur.pvSaveColor = setTimeout(ajax.post.pbind('al_photos.php', {act: 'viewer_color', dark: (vk.pvdark ? 1 : ''), hash: cur.pvHash}), 1000);
- 2112. - }
- 2113. - },
- 2114. -
- 2115. - activate: function(arrow) {
- 2116. - if (arrow && arrow.timeout) {
- 2117. - clearTimeout(arrow.timeout);
- 2118. - removeAttr(arrow, 'timeout');
- 2119. - } else if (isVisible(arrow)) {
- 2120. - fadeTo(arrow, 200, vk.pvdark ? 1 : 0.7);
- 2121. - }
- 2122. - },
- 2123. - deactivate: function(arrow) {
- 2124. - if (!arrow || !isVisible(arrow) || arrow.timeout) {
- 2125. - return;
- 2126. - }
- 2127. - arrow.timeout = setTimeout(function() {
- 2128. - removeAttr(arrow, 'timeout');
- 2129. - fadeTo(arrow, 200, 0.4);
- 2130. - }, 1);
- 2131. - },
- 2132. -
- 2133. - deletePhoto: function(sure) {
- 2134. - var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index], box = curBox();
- 2135. - var prg = box ? box.progress : 'pv_delete_progress';
- 2136. - if (isVisible(prg)) return;
- 2137. -
- 2138. - if (cur.pvTagger && ev !== false) {
- 2139. - Phototag.stopTag();
- 2140. - return;
- 2141. - }
- 2142. -
- 2143. - 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) {
- 2144. - if (box) {
- 2145. - box.hide();
- 2146. - return nav.go('/id0', false, {nocur: true});
- 2147. - }
- 2148. - if (html) {
- 2149. - return showFastBox(text, html, getLang('global_delete'), Photoview.deletePhoto.pbind(1), getLang('global_cancel'));
- 2150. - }
- 2151. - ph.deleted = text;
- 2152. - if (listId == cur.pvListId && index == cur.pvIndex) {
- 2153. - cleanElems('pv_confirm_tag', 'pv_delete_tag', 'pv_prof_cancel', 'pv_prof_done');
- 2154. - cur.pvTagInfo.innerHTML = ph.deleted;
- 2155. - show(cur.pvTagInfo);
- 2156. - hide(cur.pvCommentsData);
- 2157. - Photoview.updateHeight();
- 2158. - }
- 2159. - }, progress: prg});
- 2160. - },
- 2161. - restorePhoto: function() {
- 2162. - var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index];
- 2163. - if (isVisible('pv_restore_progress')) return;
- 2164. -
- 2165. - ajax.post('al_photos.php', {act: 'restore_photo', photo: ph.id, hash: ph.hash}, {onDone: function(text) {
- 2166. - ph.deleted = false;
- 2167. - if (listId == cur.pvListId && index == cur.pvIndex) {
- 2168. - cleanElems('pv_confirm_tag', 'pv_delete_tag', 'pv_prof_cancel', 'pv_prof_done');
- 2169. - if (ph.taginfo) {
- 2170. - cur.pvTagInfo.innerHTML = '\
- 2171. - <table cellspacing="0" cellpadding="0"><tr>\
- 2172. - <td class="info">' + ph.taginfo + '</td>\
- 2173. - <td><nobr><div class="button_blue"><button id="pv_confirm_tag">' + getLang('photos_confirm_tag') + '</button></div></td>\
- 2174. - <td><nobr><div class="button_gray"><button id="pv_delete_tag">' + getLang('photos_delete_tag') + '</button></div></td>\
- 2175. - <td><div id="pv_tag_handling" class="progress"></div></td>\
- 2176. - </tr></table>';
- 2177. - show(cur.pvTagInfo);
- 2178. - ge('pv_confirm_tag').onclick = Photoview.confirmTag.pbind(ph.tagid);
- 2179. - ge('pv_delete_tag').onclick = Photoview.deleteTag.pbind(ph.tagid);
- 2180. - } else {
- 2181. - cur.pvTagInfo.innerHTML = '';
- 2182. - hide(cur.pvTagInfo);
- 2183. - }
- 2184. - show(cur.pvCommentsData);
- 2185. - Photoview.updateHeight();
- 2186. - }
- 2187. - }, progress: 'pv_restore_progress'});
- 2188. - },
- 2189. - spamPhoto: function(prg, spamHash) {
- 2190. - var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index];
- 2191. - if (isVisible(prg)) return;
- 2192. -
- 2193. - if (cur.pvTagger && ev !== false) {
- 2194. - Phototag.stopTag();
- 2195. - return;
- 2196. - }
- 2197. -
- 2198. - ajax.post('al_photos.php', {act: 'spam_photo', photo: ph.id, hash: ph.hash, spam_hash: spamHash}, {onDone: function(text, del) {
- 2199. - if (del) ph.deleted = text;
- 2200. - if (listId == cur.pvListId && index == cur.pvIndex) {
- 2201. - cleanElems('pv_confirm_tag', 'pv_delete_tag', 'pv_prof_cancel', 'pv_prof_done');
- 2202. - cur.pvTagInfo.innerHTML = text;
- 2203. - show(cur.pvTagInfo);
- 2204. - if (del) hide(cur.pvCommentsData);
- 2205. - Photoview.updateHeight();
- 2206. - }
- 2207. - }, progress: prg});
- 2208. - },
- 2209. - rotatePhoto: function(to) {
- 2210. - var prg = ge('pv_rotate_progress');
- 2211. - if (isVisible(prg)) return;
- 2212. -
- 2213. - show(prg);
- 2214. - ge('pv_rotate').appendChild(ce('div', {id: 'pv_rotate_frame', className: 'upload_frame', innerHTML: '<iframe name="pv_rotate_frame"></iframe>'}));
- 2215. - var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index], form = ge('pv_rotate_form');
- 2216. - form.innerHTML = '';
- 2217. - form.action = ph.rotate[0];
- 2218. - var data = extend({act: 'do_rotate', to: to, list_id: listId, index: index, fid: ph.id}, ph.rotate);
- 2219. - to = (to + 4) % 4;
- 2220. - if (data.act == 'rotate_photo') {
- 2221. - data.angle = (data.angle + to) % 4;
- 2222. - }
- 2223. - if (data['rot'+to]) {
- 2224. - data.act = 'done_rotate';
- 2225. - data.complete = 1;
- 2226. - ajax.post('/al_photos.php', data, {
- 2227. - onDone: Photoview.rotateDone,
- 2228. - onFail: function() {
- 2229. - Photoview.rotateDone();
- 2230. - }
- 2231. - });
- 2232. - return;
- 2233. - }
- 2234. - for (var i in data) {
- 2235. - if (i != 0) {
- 2236. - form.appendChild(ce('input', {type: 'hidden', name: i, value: data[i]}));
- 2237. - }
- 2238. - }
- 2239. - form.submit();
- 2240. - },
- 2241. - rotateDone: function(data) {
- 2242. - hide('pv_rotate_progress');
- 2243. - var el = ge('pv_rotate_frame');
- 2244. -
- 2245. - if (!el) return;
- 2246. - re(el);
- 2247. -
- 2248. - if (!data) return;
- 2249. - var listId = data.list_id, index = data.index, ph = cur.pvData[listId][index];
- 2250. - 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})
- 2251. - extend(ph.rotate, {photo: data.photo, hash: data.hash, rhash: data.rhash, angle: data.angle, rot1: data.rot1, rot3: data.rot3});
- 2252. - if (listId == cur.pvListId && index == cur.pvIndex) {
- 2253. - Photoview.show(listId, index);
- 2254. - }
- 2255. - },
- 2256. -
- 2257. - likeUpdate: function(my, count, title) {
- 2258. - count = intval(count);
- 2259. -
- 2260. - var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index];
- 2261. - var countInput = ge('like_real_count_photo' + ph.id) || {}, rows = ge('like_table_photo' + ph.id);
- 2262. - var titleNode = ge('like_title_photo' + ph.id), countNode = ge('pv_like_count');
- 2263. - var icon = cur.pvLikeIcon;
- 2264. - var tt = icon.parentNode.tt || {}, opts = clone(tt.opts || {}), newleft = (my ? 0 : -36);
- 2265. -
- 2266. - if (title && titleNode) {
- 2267. - val(titleNode, title);
- 2268. - }
- 2269. - cur.pvCommsLikes[ph.id][1] = countInput.value = count;
- 2270. - animateCount(countNode, count);
- 2271. -
- 2272. - ph.liked = my;
- 2273. - (my ? addClass : removeClass)(cur.pvHH, 'pvs_hh_liked');
- 2274. - if (!my) {
- 2275. - var cb = ge('like_share_photo' + ph.id);
- 2276. - if (cb) checkbox(cb, false);
- 2277. - } else {
- 2278. - setStyle(icon, {opacity: 1});
- 2279. - }
- 2280. - if (count) {
- 2281. - var styleName = vk.rtl ? 'right' : 'left';
- 2282. - if (tt.el && !isVisible(tt.container) && !title) {
- 2283. - rows.style[styleName] = newleft + 'px';
- 2284. - tooltips.show(tt.el, extend(opts, {showdt: 0}));
- 2285. - } else if (rows) {
- 2286. - var params = {};
- 2287. - params[styleName] = newleft;
- 2288. - animate(rows, params, 200);
- 2289. - }
- 2290. - removeClass(icon, 'no_likes');
- 2291. - } else {
- 2292. - if (tt.el) tt.hide();
- 2293. - addClass(icon, 'no_likes');
- 2294. - }
- 2295. - },
- 2296. - like: function() {
- 2297. - if (!vk.id) return;
- 2298. - var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index], my = !ph.liked;
- 2299. - ajax.post('like.php', {act: 'a_do_' + (my ? '' : 'un') + 'like', object: 'photo' + ph.id, hash: ph.hash, from: 'photo_viewer'}, {
- 2300. - onDone: function(count, title) {
- 2301. - if (cur.pvListId == listId && cur.pvIndex == index) {
- 2302. - return Photoview.likeUpdate(my, count, title);
- 2303. - }
- 2304. - cur.pvCommsLikes[ph.id][1] = count;
- 2305. - ph.liked = my;
- 2306. - }
- 2307. - });
- 2308. - Photoview.likeUpdate(my, cur.pvCommsLikes[ph.id][1] + (my ? 1 : -1));
- 2309. - },
- 2310. - likeShare: function(hash) {
- 2311. - if (!vk.id) return;
- 2312. - var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index];
- 2313. - var el = ge('like_share_photo' + ph.id), was = isChecked(el);
- 2314. - checkbox(el);
- 2315. - ajax.post('like.php', {act: 'a_do_' + (was ? 'un' : '') + 'publish', object: 'photo' + ph.id, list: listId, hash: hash, from: 'photo_viewer'}, {
- 2316. - onDone: function(count, title) {
- 2317. - if (cur.pvListId == listId && cur.pvIndex == index) {
- 2318. - return Photoview.likeUpdate(true, count, title);
- 2319. - }
- 2320. - cur.pvCommsLikes[ph.id][1] = count;
- 2321. - ph.liked = true;
- 2322. - }
- 2323. - });
- 2324. - Photoview.likeUpdate(true, cur.pvCommsLikes[ph.id][1] + (ph.liked ? 0 : 1));
- 2325. - },
- 2326. - likeOver: function() {
- 2327. - var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index];
- 2328. - var icon = cur.pvLikeIcon;
- 2329. - if (!ph.liked) {
- 2330. - setTimeout(animate.pbind(icon, {opacity: 1}, 200, false), 1);
- 2331. - } else {
- 2332. - setStyle(icon, {opacity: 1});
- 2333. - }
- 2334. - var linkW = cur.pvLikeLink.offsetWidth;
- 2335. -
- 2336. - showTooltip(icon.parentNode, {
- 2337. - url: 'like.php',
- 2338. - params: {act: 'a_get_stats', object: 'photo' + ph.id, list: listId},
- 2339. - slide: 15,
- 2340. - shift: [0, 5, 9],
- 2341. - ajaxdt: 100,
- 2342. - showdt: 400,
- 2343. - hidedt: 200,
- 2344. - className: 'rich like_tt',
- 2345. - init: function (tt) {
- 2346. - if (!tt.container) return;
- 2347. - var bp = geByClass1('bottom_pointer', tt.container, 'div');
- 2348. - var tp = geByClass1('top_pointer', tt.container, 'div');
- 2349. - setStyle(bp, {marginLeft: linkW + 2});
- 2350. - setStyle(tp, {marginLeft: linkW + 2});
- 2351. - }
- 2352. - });
- 2353. - },
- 2354. - likeOut: function() {
- 2355. - var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index];
- 2356. - if (!ph.liked) {
- 2357. - setTimeout(animate.pbind(cur.pvLikeIcon, {opacity: 0.4}, 200, false), 1);
- 2358. - }
- 2359. - },
- 2360. -
- 2361. - tagOver: function(el) {
- 2362. - animate(el, {backgroundColor: '#6B8DB1'}, 200);
- 2363. - showTooltip(el, {text: getLang('photos_delete_tag'), shift: [0, -2, 0]});
- 2364. - },
- 2365. - tagOut: function(el) {
- 2366. - if (!el.parentNode || !el.parentNode.parentNode) return;
- 2367. - animate(el, {backgroundColor: '#C4D2E1'}, 200);
- 2368. - },
- 2369. - deleteTag: function(tagId) {
- 2370. - var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index];
- 2371. - if (ph.tagid) {
- 2372. - if (isVisible('pv_tag_handling')) return;
- 2373. - } else {
- 2374. - if (ge('pv_action_progress')) return;
- 2375. - }
- 2376. -
- 2377. - ajax.post('al_photos.php', {act: 'delete_tag', photo: ph.id, tag: tagId, hash: ph.hash}, {onDone: function(text, tags, tagged, html, padres) {
- 2378. - if (_pads.shown == 'ph') {
- 2379. - Pads.phDone(ph.id, false, padres);
- 2380. - }
- 2381. - Pads.invalidate('ph');
- 2382. - if (ph.tagid) {
- 2383. - ph.taginfo = ph.tagid = false;
- 2384. - cleanElems('pv_confirm_tag', 'pv_delete_tag', 'pv_prof_cancel', 'pv_prof_done');
- 2385. - cur.pvTagInfo.innerHTML = '<div class="progress fl_r" id="pv_spam_progress"></div><div class="pv_info">' + text + '</div>';
- 2386. - } else {
- 2387. - Photoview.actionInfo().innerHTML = text;
- 2388. - }
- 2389. - Photoview.updateHeight();
- 2390. - if (tags !== undefined) {
- 2391. - ph.tags = tags;
- 2392. - ph.tagged = tagged;
- 2393. - ph.tagshtml = html;
- 2394. - if (cur.pvListId == listId && cur.pvIndex == index) {
- 2395. - Photoview.setTags(html);
- 2396. -
- 2397. - ((!ph.taginfo && ph.actions.tag && tags[0] < cur.pvMaxTags) ? show : hide)(cur.pvTagLink);
- 2398. - }
- 2399. - }
- 2400. - }, onFail: function(text) {
- 2401. - if (!text) return;
- 2402. - Photoview.actionInfo().innerHTML = text;
- 2403. - return true;
- 2404. - }, showProgress: function() {
- 2405. - if (ph.tagid) {
- 2406. - hide(ge('pv_confirm_tag').parentNode, ge('pv_delete_tag').parentNode);
- 2407. - show('pv_tag_handling');
- 2408. - } else {
- 2409. - Photoview.actionInfo().innerHTML = '<div id="pv_action_progress" class="progress" style="display: block"></div>';
- 2410. - }
- 2411. - }, hideProgress: function() {
- 2412. - if (ph.tagid) {
- 2413. - hide('pv_tag_handling');
- 2414. - show(ge('pv_confirm_tag').parentNode, ge('pv_delete_tag').parentNode);
- 2415. - } else {
- 2416. - re(Photoview.actionInfo());
- 2417. - }
- 2418. - }});
- 2419. - },
- 2420. - restoreTag: function(tagId) {
- 2421. - if (ge('pv_action_progress')) return;
- 2422. -
- 2423. - var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index];
- 2424. - ajax.post('al_photos.php', {act: 'restore_tag', photo: ph.id, tag: tagId, hash: ph.hash}, {onDone: function(text, tags, tagged, html) {
- 2425. - if (tags !== undefined) {
- 2426. - ph.tags = tags;
- 2427. - ph.tagged = tagged;
- 2428. - ph.tagshtml = html;
- 2429. - if (cur.pvListId == listId && cur.pvIndex == index) {
- 2430. - Photoview.setTags(html);
- 2431. - ((!ph.taginfo && ph.actions.tag && tags[0] < cur.pvMaxTags) ? show : hide)(cur.pvTagLink);
- 2432. - }
- 2433. - }
- 2434. - Photoview.actionInfo().innerHTML = text;
- 2435. - }, onFail: function(text) {
- 2436. - if (!text) return;
- 2437. - Photoview.actionInfo().innerHTML = text;
- 2438. - return true;
- 2439. - }, showProgress: function() {
- 2440. - Photoview.actionInfo().innerHTML = '<div id="pv_action_progress" class="progress" style="display: block"></div>';
- 2441. - }, hideProgress: function() {
- 2442. - re(Photoview.actionInfo());
- 2443. - }});
- 2444. - },
- 2445. -
- 2446. - confirmTag: function(tagId) {
- 2447. - var listId = cur.pvListId, index = cur.pvIndex, ph = cur.pvData[listId][index];
- 2448. - if (isVisible('pv_tag_handling')) return;
- 2449. -
- 2450. - ajax.post('al_photos.php', {act: 'confirm_tag', tag: tagId, photo: ph.id, hash: ph.hash}, {onDone: function(tags, tagged, html, padres) {
- 2451. - if (_pads.shown == 'ph') {
- 2452. - Pads.phDone(ph.id, false, padres);
- 2453. - }
- 2454. - Pads.invalidate('ph');
- 2455. - ph.tags = tags;
- 2456. - ph.tagged = tagged;
- 2457. - ph.tagshtml = html;
- 2458. - ph.taginfo = ph.tagid = false;
- 2459. - if (listId == cur.pvListId && index == cur.pvIndex) {
- 2460. - Photoview.setTags(html);
- 2461. - ((!ph.taginfo && ph.actions.tag && tags[0] < cur.pvMaxTags) ? show : hide)(cur.pvTagLink);
- 2462. - cleanElems('pv_confirm_tag', 'pv_delete_tag', 'pv_prof_cancel', 'pv_prof_done');
- 2463. - cur.pvTagInfo.innerHTML = '';
- 2464. - hide(cur.pvTagInfo);
- 2465. - }
- 2466. - Photoview.updateHeight();
- 2467. - }, showProgress: function() {
- 2468. - hide(ge('pv_confirm_tag').parentNode, ge('pv_delete_tag').parentNode);
- 2469. - show('pv_tag_handling');
- 2470. - }, hideProgress: function() {
- 2471. - hide('pv_tag_handling');
- 2472. - show(ge('pv_confirm_tag').parentNode, ge('pv_delete_tag').parentNode);
- 2473. - }});
- 2474. - },
- 2475. -
- 2476. - toProfileTag: function() {
- 2477. - var tag = cur.pvData[cur.pvListId][cur.pvIndex].tagged[vk.id];
- 2478. - if (tag && !cur.pvTagger) {
- 2479. - Photoview.showTag(tag);
- 2480. - }
- 2481. - },
- 2482. - showTag: function(tagId) {
- 2483. - clearTimeout(cur.pvHidingTag);
- 2484. - if (cur.pvShowingTag == tagId) return;
- 2485. -
- 2486. - var coords = clone(cur.pvData[cur.pvListId][cur.pvIndex].tags[tagId]);
- 2487. - each(coords, function(i, v) {
- 2488. - var wh = cur[(i % 2) ? 'pvPhHeight' : 'pvPhWidth'];
- 2489. - coords[i] = Math.max(3, Math.min(wh - 3, positive(v * wh / 100)));
- 2490. - });
- 2491. - setStyle(cur.pvTagFrame, {
- 2492. - marginLeft: coords[0] + 'px',
- 2493. - marginTop: coords[1] + 'px',
- 2494. - width: (coords[2] - coords[0]) + 'px',
- 2495. - height: (coords[3] - coords[1]) + 'px'
- 2496. - });
- 2497. - setStyle(cur.pvTagFrame.firstChild, {
- 2498. - marginLeft: -coords[0] + 'px',
- 2499. - marginTop: -coords[1] + 'px'
- 2500. - });
- 2501. - cur.pvShowingTag = tagId;
- 2502. - if (browser.msie) {
- 2503. - show(cur.pvTagFrame, cur.pvTagFaded);
- 2504. - } else {
- 2505. - fadeIn(cur.pvTagFrame, 200);
- 2506. - fadeIn(cur.pvTagFaded, 200);
- 2507. - }
- 2508. - },
- 2509. - showDynTag: function(tagId) {
- 2510. - clearTimeout(cur.pvHidingTag);
- 2511. - if (cur.pvShowingTag == tagId) return;
- 2512. -
- 2513. - var coords = clone(cur.pvData[cur.pvListId][cur.pvIndex].tags[tagId]), el = ge('pv_tag' + tagId);
- 2514. - if (!el) return;
- 2515. -
- 2516. - each(coords, function(i, v) {
- 2517. - coords[i] = positive(v * cur[(i % 2) ? 'pvPhHeight' : 'pvPhWidth'] / 100);
- 2518. - });
- 2519. - setStyle(cur.pvTagPerson, {
- 2520. - marginLeft: coords[0] + 'px',
- 2521. - marginTop: coords[3] + 'px',
- 2522. - minWidth: (coords[2] - coords[0]) + 'px'
- 2523. - });
- 2524. - cur.pvTagPerson.innerHTML = el.firstChild.innerHTML;
- 2525. - var s = getSize(cur.pvTagPerson);
- 2526. - if (coords[3] + s[1] > cur.pvPhHeight) {
- 2527. - setStyle(cur.pvTagPerson, {marginTop: (cur.pvPhHeight - s[1]) + 'px'});
- 2528. - }
- 2529. - cur.pvTagPerson.onmouseover = Photoview.showDynTag.pbind(tagId);
- 2530. - cur.pvShowingTag = tagId;
- 2531. - if (browser.msie){
- 2532. - show(cur.pvTagPerson);
- 2533. - } else {
- 2534. - fadeIn(cur.pvTagPerson, 200);
- 2535. - }
- 2536. - },
- 2537. - hideTag: function(quick) {
- 2538. - if (quick === true) {
- 2539. - clearTimeout(cur.pvHidingTag);
- 2540. - hide(cur.pvTagFaded, cur.pvTagFrame, cur.pvTagPerson);
- 2541. - cur.pvShowingTag = false;
- 2542. - }
- 2543. - if (!cur.pvShowingTag) return;
- 2544. -
- 2545. - clearTimeout(cur.pvHidingTag);
- 2546. - cur.pvHidingTag = setTimeout(function() {
- 2547. - if (browser.msie) {
- 2548. - hide(cur.pvTagFaded, cur.pvTagFrame, cur.pvTagPerson);
- 2549. - } else if (cur.pvShowingTag) {
- 2550. - fadeOut(cur.pvTagFaded, 200);
- 2551. - fadeOut(cur.pvTagFrame, 200);
- 2552. - fadeOut(cur.pvTagPerson, 200);
- 2553. - }
- 2554. - cur.pvShowingTag = false;
- 2555. - }, 0);
- 2556. - },
- 2557. - realOffset: function(listId, offset, inc) {
- 2558. - var res = offset;
- 2559. - if (!cur.pvData || !cur.pvData[listId]) {
- 2560. - return res;
- 2561. - }
- 2562. - for (var i = 0; i < offset; i++) {
- 2563. - if (cur.pvData[listId][i] && (cur.pvData[listId][i].deleted || cur.pvData[listId][i].moved)) {
- 2564. - res += inc;
- 2565. - }
- 2566. - }
- 2567. - return res;
- 2568. - },
- 2569. - realCount: function(listId, count) {
- 2570. - var res = count;
- 2571. - if (!cur.pvData || !cur.pvData[listId]) {
- 2572. - return res;
- 2573. - }
- 2574. - for (var i = 0; i < cur.pvData[listId].length; i++) {
- 2575. - if (cur.pvData[listId][i] && (cur.pvData[listId][i].deleted || cur.pvData[listId][i].moved)) {
- 2576. - res++;
- 2577. - }
- 2578. - }
- 2579. - return res;
- 2580. - },
- 2581. -
- 2582. - list: function(photoId, listId, realList) {
- 2583. - if (realList == 'deleted') return;
- 2584. - if (!cur.pvList) cur.pvList = {};
- 2585. - cur.pvList[photoId + '_' + listId] = realList;
- 2586. - },
- 2587. - loaded: function(listId, count, offset, data, opts) {
- 2588. - if (listId == 'deleted') return;
- 2589. - if (opts) {
- 2590. - extend(cur, {
- 2591. - lang: extend(cur.lang || {}, opts.lang),
- 2592. - pvHash: opts.hash,
- 2593. - pvCommLimit: opts.commlimit,
- 2594. - pvMaxTags: opts.maxtags,
- 2595. - pvReasons: opts.reasons,
- 2596. - pvReplyNames: extend(cur.pvReplyNames || {}, opts.names || {}),
- 2597. - pvMediaTypes: opts.media
- 2598. - });
- 2599. - if (!cur.options) cur.options = {};
- 2600. - if (!cur.options.share) cur.options.share = opts.share;
- 2601. - val(cur.pvAsGroup, '<div></div>' + getLang('wall_reply_as_group'));
- 2602. - val('pv_comment_header', getLang('photos_yourcomment'));
- 2603. - val(domFC(ge('pv_add_media')), getLang('global_add_media'));
- 2604. - }
- 2605. - count = Photoview.realCount(listId, count);
- 2606. - offset = Photoview.realOffset(listId, offset, 1);
- 2607. - if (!cur.pvData) cur.pvData = {};
- 2608. - if (!cur.pvCommsLikes) cur.pvCommsLikes = {};
- 2609. - if (!cur.pvData[listId]) {
- 2610. - cur.pvData[listId] = new Array(count);
- 2611. - } else if (cur.pvData[listId].length < count) {
- 2612. - for (var i = cur.pvData[listId].length; i < count; ++i) {
- 2613. - cur.pvData[listId].push(undefined);
- 2614. - }
- 2615. - } else if (cur.pvData[listId].length > count) {
- 2616. - cur.pvData[listId] = cur.pvData[listId].slice(0, count);
- 2617. - }
- 2618. - var nw = vkNow();
- 2619. - for (var i = 0, len = data.length; i < len; ++i) {
- 2620. - var index = (offset + i), ph = clone(data[i]);
- 2621. - while (index >= count) index -= count;
- 2622. - cur.pvCommsLikes[ph.id] = [ph.comments, ph.likes, vkNow(), false];
- 2623. - delete(ph.comments);
- 2624. - delete(ph.likes);
- 2625. - cur.pvData[listId][index] = ph;
- 2626. - }
- 2627. - },
- 2628. - showDeleted: function(lst, msg, spm) {
- 2629. - if (cur.pvShown && cur.pvListId == 'temp') {
- 2630. - msg += '<br><br>' + spm;
- 2631. - }
- 2632. -
- 2633. - showFastBox({title: getLang('global_error'), onHide: function() {
- 2634. - if (cur.pvShown && cur.pvListId == 'temp') {
- 2635. - Photoview.hide(true);
- 2636. - }
- 2637. - }}, msg);
- 2638. - },
- 2639. - spamDeleted: function(el, ph, hash) {
- 2640. - if (isVisible(curBox().progress)) return;
- 2641. - ajax.post('al_photos.php', {act: 'spam_photo', photo: ph, hash: hash, from: 'deleted'}, {onDone: function(text) {
- 2642. - domPN(el).replaceChild(ce('span', {innerHTML: text}), el);
- 2643. - }, showProgress: curBox().showProgress, hideProgress: curBox().hideProgress});
- 2644. - },
- 2645. - showPhoto: function(photoId, listId, options, just) {
- 2646. - if (!cur.pvShown || cur.pvListId == 'temp' && !cur.pvWasShown || options.noHistory !== undefined) {
- 2647. - debugLog('in showPhoto noHistory: ' + options.noHistory);
- 2648. - cur.pvNoHistory = options.noHistory;
- 2649. - cur.pvHistoryLength = options.noHistory ? 0 : (options.histLen || 0);
- 2650. - }
- 2651. - extend(cur, {
- 2652. - pvJumpTo: options.jumpTo || false,
- 2653. - pvJumpFrom: false,
- 2654. - pvJumpSteps: 0
- 2655. - });
- 2656. - listId = cur.pvList && cur.pvList[photoId + '_' + listId] || listId;
- 2657. - if (!cur.pvData || !cur.pvData[listId]) {
- 2658. - return;
- 2659. - }
- 2660. - var data = cur.pvData[listId], whole = true, onh = cur.pvOptions && cur.pvOptions.onHide;
- 2661. - cur.pvOptions = options;
- 2662. - if (!cur.pvOptions.onHide) cur.pvOptions.onHide = onh;
- 2663. - for (var i = 0, len = data.length; i < len; ++i) {
- 2664. - if (data[i]) {
- 2665. - if (data[i].id === photoId) {
- 2666. - Photoview.show(listId, i, false, options.root);
- 2667. - if (options.onShow) {
- 2668. - options.onShow();
- 2669. - }
- 2670. - return false;
- 2671. - }
- 2672. - } else {
- 2673. - whole = false;
- 2674. - }
- 2675. - }
- 2676. - if (whole && just) {
- 2677. - if (options.onEmpty) {
- 2678. - options.onEmpty();
- 2679. - }
- 2680. - return false;
- 2681. - }
- 2682. - },
- 2683. -
- 2684. - loadedAlbums: function(ownerId, html, preload, preloadPhotos, opts) {
- 2685. - if (!cur.pvAlbumsData) return;
- 2686. -
- 2687. - ajax.preload('al_photos.php', extend({offset: opts.offset, part: 1, owner: ownerId}, {act: 'show_albums'}), preload);
- 2688. - ajax.preload('al_photos.php', extend({offset: opts.photos_offset, part: 1, owner: ownerId}, {act: 'show_albums', only_photos: 1}), preloadPhotos);
- 2689. -
- 2690. - cur.pvAlbumsData[ownerId] = {
- 2691. - html: html,
- 2692. - opts: opts
- 2693. - };
- 2694. - if (cur.pvAlbumsShowing == ownerId) {
- 2695. - Photoview.doShowAlbums(ownerId, false);
- 2696. - boxRefreshCoords(layer);
- 2697. - }
- 2698. - },
- 2699. - showAlbums: function(ownerId, options) {
- 2700. - ownerId = intval(ownerId);
- 2701. - if (!cur.pvAlbumsData) cur.pvAlbumsData = {};
- 2702. - if (cur.pvListId == 'temp') {
- 2703. - cur.pvCancelLoad();
- 2704. - }
- 2705. -
- 2706. - cur.pvNoHistory = options.noHistory;
- 2707. - cur.pvHistoryLength = 0;
- 2708. - cur.pvAlbumsShowing = ownerId;
- 2709. - var of = options.onFail;
- 2710. - if (!cur.pvAlbumsData[ownerId]) {
- 2711. - cur.pvAlbumsData[ownerId] = 'loading';
- 2712. - ajax.post('al_photos.php', {act: 'show_albums', owner: ownerId}, extend(options, {onDone: Photoview.loadedAlbums, onFail: function(t) {
- 2713. - if (of) of(t);
- 2714. - delete(cur.pvAlbumsData[ownerId]);
- 2715. - cur.pvAlbumsData[ownerId];
- 2716. - layers.fullhide(true);
- 2717. - return true;
- 2718. - }
- 2719. - }));
- 2720. - } else if (cur.pvAlbumsData[ownerId] != 'loading') {
- 2721. - Photoview.doShowAlbums(ownerId, false);
- 2722. - boxRefreshCoords(layer);
- 2723. - }
- 2724. - },
- 2725. - loadedAlbum: function(albumRaw, html, preload, opts) {
- 2726. - if (!cur.pvAlbumData) return;
- 2727. -
- 2728. - if (preload) {
- 2729. - ajax.preload('al_photos.php', extend({offset: opts.offset, part: 1, album: albumRaw}, {act: 'show_album'}), preload);
- 2730. - }
- 2731. -
- 2732. - cur.pvAlbumData[albumRaw] = {
- 2733. - html: html,
- 2734. - opts: opts
- 2735. - };
- 2736. - if (cur.pvAlbumShowing == albumRaw) {
- 2737. - Photoview.doShowAlbum(albumRaw, false);
- 2738. - boxRefreshCoords(layer);
- 2739. - }
- 2740. - },
- 2741. - showAlbum: function(albumRaw, options) {
- 2742. - if (!cur.pvAlbumData) cur.pvAlbumData = {};
- 2743. - if (cur.pvListId == 'temp') {
- 2744. - cur.pvCancelLoad();
- 2745. - }
- 2746. -
- 2747. - cur.pvNoHistory = options.noHistory;
- 2748. - cur.pvHistoryLength = 0;
- 2749. - cur.pvAlbumShowing = albumRaw;
- 2750. - var of = options.onFail;
- 2751. - if (!cur.pvAlbumData[albumRaw]) {
- 2752. - cur.pvAlbumData[albumRaw] = 'loading';
- 2753. - ajax.post('al_photos.php', {act: 'show_album', album: albumRaw}, extend(options, {onDone: Photoview.loadedAlbum, onFail: function(t) {
- 2754. - if (of) of(t);
- 2755. - delete(cur.pvAlbumData[albumRaw]);
- 2756. - cur.pvAlbumData[albumRaw];
- 2757. - layers.fullhide(true);
- 2758. - return true;
- 2759. - }
- 2760. - }));
- 2761. - } else if (cur.pvAlbumData[albumRaw] != 'loading') {
- 2762. - Photoview.doShowAlbum(albumRaw, false);
- 2763. - boxRefreshCoords(layer);
- 2764. - }
- 2765. - },
- 2766. - loadedTagged: function(ownerId, html, preload, preloadPhotos, opts) {
- 2767. - if (!cur.pvPhotoTagData) return;
- 2768. -
- 2769. - ajax.preload('al_photos.php', extend({offset: opts.offset, part: 1, owner: ownerId}, {act: 'show_tag'}), preload);
- 2770. - ajax.preload('al_photos.php', extend({offset: opts.photos_offset, part: 1, owner: ownerId}, {act: 'show_tag', only_photos: 1}), preloadPhotos);
- 2771. -
- 2772. - cur.pvPhotoTagData[ownerId] = {
- 2773. - html: html,
- 2774. - opts: opts
- 2775. - };
- 2776. - if (cur.pvPhotoTagShowing == ownerId) {
- 2777. - Photoview.doShowTagged(ownerId, false);
- 2778. - boxRefreshCoords(layer);
- 2779. - }
- 2780. - },
- 2781. - showTagged: function(ownerId, options) {
- 2782. - ownerId = intval(ownerId);
- 2783. - if (!cur.pvPhotoTagData) cur.pvPhotoTagData = {};
- 2784. - if (cur.pvListId == 'temp') {
- 2785. - cur.pvCancelLoad();
- 2786. - }
- 2787. -
- 2788. - cur.pvNoHistory = options.noHistory;
- 2789. - cur.pvHistoryLength = 0;
- 2790. - cur.pvPhotoTagShowing = ownerId;
- 2791. - var of = options.onFail;
- 2792. - if (!cur.pvPhotoTagData[ownerId]) {
- 2793. - cur.pvPhotoTagData[ownerId] = 'loading';
- 2794. - ajax.post('al_photos.php', {act: 'show_tag', mid: ownerId}, extend(options, {onDone: Photoview.loadedTagged, onFail: function(t) {
- 2795. - if (of) of(t);
- 2796. - delete(cur.pvPhotoTagData[ownerId]);
- 2797. - cur.pvPhotoTagData[ownerId];
- 2798. - layers.fullhide(true);
- 2799. - return true;
- 2800. - }
- 2801. - }));
- 2802. - } else if (cur.pvPhotoTagData[ownerId] != 'loading') {
- 2803. - Photoview.doShowTagged(ownerId, false);
- 2804. - boxRefreshCoords(layer);
- 2805. - }
- 2806. - },
- 2807. - loadedVideoTags: function(ownerId, html, preload, opts) {
- 2808. - ajax.preload('/al_video.php', {act: 'show_video_tags', offset: opts.offset, part: 1, mid: ownerId}, preload);
- 2809. -
- 2810. - cur.pvVideoTagsData = {
- 2811. - html: html,
- 2812. - opts: opts
- 2813. - };
- 2814. - if (cur.pvVideoTagShowing == ownerId) {
- 2815. - Photoview.doShowVideoTags(ownerId, false);
- 2816. - boxRefreshCoords(layer);
- 2817. - }
- 2818. - },
- 2819. - showVideoTags: function(ownerId, options) {
- 2820. - cur.pvNoHistory = options.noHistory;
- 2821. - cur.pvHistoryLength = 0;
- 2822. - cur.pvVideoTagShowing = ownerId;
- 2823. - var of = options.onFail;
- 2824. - if (!cur.pvVideoTagsData) {
- 2825. - cur.pvVideoTagsData = 'loading';
- 2826. - ajax.post('/al_video.php', {act: 'show_video_tags', mid: ownerId}, extend(options, {onDone: Photoview.loadedVideoTags, onFail: function(t) {
- 2827. - if (of) of(t);
- 2828. - delete(cur.pvVideoTagsData);
- 2829. - layers.fullhide && layers.fullhide(true);
- 2830. - return true;
- 2831. - }
- 2832. - }));
- 2833. - } else if (cur.pvVideoTagsData != 'loading') {
- 2834. - Photoview.doShowVideoTags(ownerId, false);
- 2835. - boxRefreshCoords(layer);
- 2836. - }
- 2837. - },
- 2838. - scrollResize: function() {
- 2839. - if (browser.mobile || !cur.pvShown || (!cur.pvAlbumsShown && !cur.pvAlbumShown && !cur.pvPhotoTagShown && !cur.pvVideoTagsShown)) return;
- 2840. -
- 2841. - var bt = lastWindowHeight,
- 2842. - lnk = cur.pvVideoTagsShown ? ge('pva_more_videos') : (cur.pvAlbumsShown ? ge('pva_more_photos') : ge('pvsa_more_photos')),
- 2843. - albumsLnk = ge('pva_more');
- 2844. -
- 2845. - if (isVisible(lnk) && bt > getXY(lnk)[1] - (browser.msie6 ? 0 : scrollGetY())) {
- 2846. - if (cur.pvVideoTagsShown) {
- 2847. - Photoview.loadVideoTags();
- 2848. - } else if (cur.pvPhotoTagShown) {
- 2849. - Photoview.loadTaggedPhotos();
- 2850. - } else if (cur.pvAlbumsShown) {
- 2851. - Photoview.loadAlbumsPhotos();
- 2852. - } else {
- 2853. - Photoview.loadAlbumPhotos();
- 2854. - }
- 2855. - }
- 2856. - if (cur.pvAlbumsShown && cur.pvShowAllAlbums && isVisible(albumsLnk) && bt > getXY(albumsLnk)[1] - (browser.msie6 ? 0 : scrollGetY())) {
- 2857. - Photoview.loadAlbums();
- 2858. - }
- 2859. - },
- 2860. - loadAlbums: function() {
- 2861. - cur.pvShowAllAlbums = true;
- 2862. - Photoview.loadAlbumsPhotos(true);
- 2863. - },
- 2864. - loadedAlbumsPhotos: function(off, rows, albums) {
- 2865. - cur.pvaLoading = 0;
- 2866. -
- 2867. - if (!cur.pvAlbumsShown) return;
- 2868. -
- 2869. - if (albums) {
- 2870. - cur.pvaOffset = off;
- 2871. - } else {
- 2872. - cur.pvaPhotosOffset = off;
- 2873. - }
- 2874. -
- 2875. - var cont = albums ? ge('pva_content') : ge('pva_content_photos'),
- 2876. - more = albums ? ge('pva_more') : ge('pva_more_photos'),
- 2877. - opts = albums ? {act: 'show_albums'} : {act: 'show_albums', only_photos: 1},
- 2878. - offset = albums ? cur.pvaOffset : cur.pvaPhotosOffset,
- 2879. - count = albums ? cur.pvaCount : cur.pvaPhotosCount,
- 2880. - d = ce('div', {innerHTML: rows});
- 2881. - if (!cont) return;
- 2882. -
- 2883. - while (d.firstChild) {
- 2884. - cont.appendChild(d.firstChild);
- 2885. - }
- 2886. -
- 2887. - Photoview.onResize();
- 2888. -
- 2889. - if (off >= count || !rows) {
- 2890. - hide(more);
- 2891. - return;
- 2892. - }
- 2893. - cur.pvaLoading = 1;
- 2894. -
- 2895. - ajax.post('al_photos.php', extend({offset: offset, part: 1, owner: cur.pvAlbumsShown}, opts || {}), {cache: 1, onDone: function() {
- 2896. - debugLog('preload done: ' + cur.pvaLoading);
- 2897. - if (cur.pvaLoading == 2) {
- 2898. - Photoview.loadedAlbumsPhotos.apply(window, arguments);
- 2899. - } else {
- 2900. - cur.pvaLoading = false;
- 2901. - }
- 2902. - }, onFail: function() {
- 2903. - cur.pvaLoading = 0;
- 2904. - return true;
- 2905. - }});
- 2906. - },
- 2907. - loadAlbumsPhotos: function(albums) {
- 2908. - var more = albums ? ge('pva_more') : ge('pva_more_photos'),
- 2909. - progress = albums ? ge('pva_more_prg') : ge('pva_more_photos_prg'),
- 2910. - opts = albums ? {act: 'show_albums'} : {act: 'show_albums', only_photos: 1},
- 2911. - offset = albums ? cur.pvaOffset : cur.pvaPhotosOffset;
- 2912. - if (!cur.pvAlbumsShown || !more || !isVisible(more) || isVisible(progress)) return;
- 2913. -
- 2914. - if (cur.pvaLoading) {
- 2915. - cur.pvaLoading = 2;
- 2916. - return;
- 2917. - }
- 2918. -
- 2919. - ajax.post('al_photos.php', extend({offset: offset, part: 1, owner: cur.pvAlbumsShown}, opts || {}), {onDone: Photoview.loadedAlbumsPhotos, onFail: function() {
- 2920. - cur.pvaLoading = 0;
- 2921. - return true;
- 2922. - }, showProgress: function() {
- 2923. - show(progress);
- 2924. - hide(more.firstChild);
- 2925. - }, hideProgress: function() {
- 2926. - show(more.firstChild);
- 2927. - hide(progress);
- 2928. - }, cache: 1});
- 2929. - },
- 2930. - loadedAlbumPhotos: function(off, rows) {
- 2931. - cur.pvaLoading = 0;
- 2932. -
- 2933. - if (!cur.pvAlbumShown) return;
- 2934. -
- 2935. - cur.pvsaOffset = off;
- 2936. -
- 2937. - var cont = ge('pvsa_content_photos'),
- 2938. - more = ge('pvsa_more_photos');
- 2939. - if (!cont) return;
- 2940. -
- 2941. - cont.appendChild(cf(rows));
- 2942. -
- 2943. - if (off >= cur.pvsaCount) {
- 2944. - hide(more);
- 2945. - Photoview.onResize();
- 2946. - return;
- 2947. - }
- 2948. -
- 2949. - Photoview.onResize();
- 2950. - cur.pvsaLoading = 1;
- 2951. -
- 2952. - ajax.post('al_photos.php', extend({offset: cur.pvsaOffset, part: 1, album: cur.pvAlbumShown}, {act: 'show_album'}), {cache: 1, onDone: function() {
- 2953. - debugLog('preload done: ', cur.pvsaLoading);
- 2954. - if (cur.pvsaLoading == 2) {
- 2955. - Photoview.loadedAlbumPhotos.apply(window, arguments);
- 2956. - } else {
- 2957. - cur.pvsaLoading = false;
- 2958. - }
- 2959. - }, onFail: function() {
- 2960. - cur.pvsaLoading = 0;
- 2961. - return true;
- 2962. - }});
- 2963. - },
- 2964. - loadAlbumPhotos: function() {
- 2965. - var more = ge('pvsa_more_photos'),
- 2966. - progress = ge('pvsa_more_photos_prg'),
- 2967. - offset = cur.pvsaOffset;
- 2968. - if (!cur.pvAlbumShown || !more || !isVisible(more) || isVisible(progress)) return;
- 2969. -
- 2970. - if (cur.pvsaLoading) {
- 2971. - cur.pvsaLoading = 2;
- 2972. - return;
- 2973. - }
- 2974. -
- 2975. - ajax.post('al_photos.php', {act: 'show_album', album: cur.pvAlbumShown, offset: offset, part: 1}, {onDone: Photoview.loadedAlbumPhotos, onFail: function() {
- 2976. - cur.pvsaLoading = 0;
- 2977. - return true;
- 2978. - }, showProgress: function() {
- 2979. - show(progress);
- 2980. - hide(more.firstChild);
- 2981. - }, hideProgress: function() {
- 2982. - show(more.firstChild);
- 2983. - hide(progress);
- 2984. - }, cache: 1});
- 2985. - },
- 2986. - loadedTaggedPhotos: function(off, rows) {
- 2987. - cur.pvaLoading = 0;
- 2988. -
- 2989. - if (!cur.pvPhotoTagShown) return;
- 2990. -
- 2991. - cur.pvsaOffset = off;
- 2992. -
- 2993. - var cont = ge('pvsa_content_photos'),
- 2994. - more = ge('pvsa_more_photos');
- 2995. - if (!cont) return;
- 2996. -
- 2997. - cont.appendChild(cf(rows));
- 2998. -
- 2999. - Photoview.onResize();
- 3000. -
- 3001. - if (off >= cur.pvsaCount || !rows) {
- 3002. - hide(more);
- 3003. - return;
- 3004. - }
- 3005. - cur.pvsaLoading = 1;
- 3006. -
- 3007. - ajax.post('al_photos.php', extend({offset: cur.pvsaOffset, part: 1, mid: cur.pvPhotoTagShown}, {act: 'show_tag'}), {cache: 1, onDone: function() {
- 3008. - debugLog('preload done: ', cur.pvsaLoading);
- 3009. - if (cur.pvsaLoading == 2) {
- 3010. - Photoview.loadedTaggedPhotos.apply(window, arguments);
- 3011. - } else {
- 3012. - cur.pvsaLoading = false;
- 3013. - }
- 3014. - }, onFail: function() {
- 3015. - cur.pvsaLoading = 0;
- 3016. - return true;
- 3017. - }});
- 3018. - },
- 3019. - loadTaggedPhotos: function(albums) {
- 3020. - var more = ge('pvsa_more_photos'),
- 3021. - progress = ge('pvsa_more_photos_prg'),
- 3022. - offset = cur.pvsaOffset;
- 3023. - if (!cur.pvPhotoTagShown || !more || !isVisible(more) || isVisible(progress)) return;
- 3024. -
- 3025. - if (cur.pvsaLoading) {
- 3026. - cur.pvsaLoading = 2;
- 3027. - return;
- 3028. - }
- 3029. -
- 3030. - ajax.post('al_photos.php', {act: 'show_tag', mid: cur.pvPhotoTagShown, offset: offset, part: 1}, {onDone: Photoview.loadedTaggedPhotos, onFail: function() {
- 3031. - cur.pvsaLoading = 0;
- 3032. - return true;
- 3033. - }, showProgress: function() {
- 3034. - show(progress);
- 3035. - hide(more.firstChild);
- 3036. - }, hideProgress: function() {
- 3037. - show(more.firstChild);
- 3038. - hide(progress);
- 3039. - }, cache: 1});
- 3040. - },
- 3041. - loadedMoreVideoTags: function(off, rows) {
- 3042. - cur.pvaLoading = 0;
- 3043. -
- 3044. - if (!cur.pvVideoTagsShown) return;
- 3045. -
- 3046. - cur.pvsaOffset = off;
- 3047. -
- 3048. - var cont = ge('pva_video_tags'),
- 3049. - more = ge('pva_more_videos');
- 3050. - if (!cont) return;
- 3051. -
- 3052. - cont.appendChild(cf(rows));
- 3053. -
- 3054. - Photoview.onResize();
- 3055. -
- 3056. - if (off >= cur.pvsaCount || !rows) {
- 3057. - hide(more);
- 3058. - return;
- 3059. - }
- 3060. - cur.pvsaLoading = 1;
- 3061. -
- 3062. - ajax.post('/al_video.php', extend({act: 'show_video_tags', offset: cur.pvsaOffset, part: 1, mid: cur.pvVideoTagsShown}), {cache: 1, onDone: function() {
- 3063. - debugLog('preload done: ', cur.pvsaLoading);
- 3064. - if (cur.pvsaLoading == 2) {
- 3065. - Photoview.loadedMoreVideoTags.apply(window, arguments);
- 3066. - } else {
- 3067. - cur.pvsaLoading = false;
- 3068. - }
- 3069. - }, onFail: function() {
- 3070. - cur.pvsaLoading = 0;
- 3071. - return true;
- 3072. - }});
- 3073. - },
- 3074. - loadVideoTags: function(albums) {
- 3075. - var more = ge('pva_more_videos'),
- 3076. - progress = ge('pva_more_videos_prg'),
- 3077. - offset = cur.pvsaOffset;
- 3078. - if (!cur.pvVideoTagsShown || !more || !isVisible(more) || isVisible(progress)) return;
- 3079. -
- 3080. - if (cur.pvsaLoading) {
- 3081. - cur.pvsaLoading = 2;
- 3082. - return;
- 3083. - }
- 3084. -
- 3085. - ajax.post('/al_video.php', {act: 'show_video_tags', mid: cur.pvVideoTagsShown, offset: offset, part: 1}, {onDone: Photoview.loadedMoreVideoTags, onFail: function() {
- 3086. - cur.pvsaLoading = 0;
- 3087. - return true;
- 3088. - }, showProgress: function() {
- 3089. - show(progress);
- 3090. - hide(more.firstChild);
- 3091. - }, hideProgress: function() {
- 3092. - show(more.firstChild);
- 3093. - hide(progress);
- 3094. - }, cache: 1});
- 3095. - },
- 3096. - thumbOver: function(obj, id) {
- 3097. - clearTimeout((cur.pvHideTO || {})[id]);
- 3098. - var title = geByClass1('pva_title', obj), r = title.previousSibling, descY = getSize(geByClass1('pva_desc', obj))[1];
- 3099. - if (descY < 5) return;
- 3100. -
- 3101. - animate(title, {marginTop: 238 - (descY + 7)}, {duration: 200, transition: Fx.Transitions.easeOutCirc});
- 3102. - if (r.className == 'pva_repeat') {
- 3103. - animate(r, {marginTop: 86 - Math.floor((descY + 7) / 2)}, {duration: 200, transition: Fx.Transitions.easeOutCirc});
- 3104. - }
- 3105. - },
- 3106. - thumbOut: function(obj, id) {
- 3107. - if (!cur.pvHideTO) cur.pvHideTO = {};
- 3108. - cur.pvHideTO[id] = setTimeout(function() {
- 3109. - var title = geByClass1('pva_title', obj), r = title.previousSibling;
- 3110. - animate(title, {marginTop: 238}, 200);
- 3111. - if (r.className == 'pva_repeat') {
- 3112. - animate(r, {marginTop: 86}, 200);
- 3113. - }
- 3114. - }, 150);
- 3115. - },
- 3116. -
- 3117. - photoAct: function(ev) {
- 3118. - if (cur.pvAlbumsShown || cur.pvAlbumShown || cur.pvPhotoTagShown || !cur.pvCurPhoto.author) return;
- 3119. -
- 3120. - var pos = getXY(cur.pvHH, true);
- 3121. - if (pos[0]) {
- 3122. - cur.hhPos = pos;
- 3123. - } else {
- 3124. - pos = cur.hhPos;
- 3125. - }
- 3126. -
- 3127. - var next = cur.pvHH;
- 3128. -
- 3129. - var dx = Math.abs(ev.clientX - pos[0] - 36);
- 3130. - var dy = ev.clientY - pos[1];
- 3131. -
- 3132. - if (dx < 120 && dy < 130 && dy > -30) {
- 3133. - if (cur.pvHHShowing) return;
- 3134. - cur.pvHHShowing = true;
- 3135. - show(next);
- 3136. - animate(next.firstChild, {opacity: 1}, 400);
- 3137. -
- 3138. - if (!cur.rvPreloadBig) {
- 3139. - vkImage().src = '/images/icons/post_big_hh.png';
- 3140. - cur.rvPreloadBig = true;
- 3141. - }
- 3142. - } else {
- 3143. - if (!cur.pvHHShowing) return;
- 3144. - cur.pvHHShowing = false;
- 3145. - animate(next.firstChild, {opacity: 0}, 400);
- 3146. - }
- 3147. -
- 3148. - },
- 3149. -
- 3150. - hhLiked: function(obj, act) {
- 3151. - return (act || hasClass)(obj.parentNode.parentNode, 'pvs_hh_liked');
- 3152. - },
- 3153. - hhOver: function(obj) {
- 3154. - clearTimeout(obj.parentNode.parentNode.getAttribute('timer'));
- 3155. - var params = Photoview.hhLiked(obj) ? [0.25, 1] : [0.28, 0.65];
- 3156. - animate(obj.previousSibling, {opacity: params[0]}, 200);
- 3157. - animate(obj, {opacity: params[1]}, 200);
- 3158. - },
- 3159. - hhOut: function(obj) {
- 3160. - var params = Photoview.hhLiked(obj) ? [0.25, 1] : [0.2, 0.5];
- 3161. - animate(obj.previousSibling, {opacity: params[0]}, 200);
- 3162. - animate(obj, {opacity: params[1]}, 200);
- 3163. - },
- 3164. - hhClick: function(obj, ev, pv) {
- 3165. - if (ev.button == 2) return;
- 3166. - var liked = Photoview.hhLiked(obj);
- 3167. -
- 3168. - Photoview.like();
- 3169. - liked && Photoview.likeOut();
- 3170. -
- 3171. - Photoview.hhOver(obj);
- 3172. -
- 3173. - if (!liked && !(browser.msie && intval(browser.version) < 9 || browser.mozilla && intval(browser.version) < 9)) {
- 3174. - obj.innerHTML = '<img class="pvs_hh_ah" width="38" height="34" src="/images/icons/post_big_hh.png" />';
- 3175. - var img = obj.firstChild;
- 3176. - animate(img, {marginLeft: -3, marginTop: 3, width: 78, height: 71, opacity: 0}, {duration: 600, transition: Fx.Transitions.easeOutCubic});
- 3177. - }
- 3178. -
- 3179. - return cancelEvent(ev);
- 3180. - },
- 3181. - hhCheck: function() {
- 3182. - return (!browser.msie || intval(browser.version) > 8) && !cur.pvNoLikes;
- 3183. - },
- 3184. -
- 3185. - showRepeat: function(row) {
- 3186. - if (!row || geByClass1('pva_repeat', row)) return;
- 3187. -
- 3188. - geByClass1('pva_link', row).insertBefore(ce('div', {className: 'pva_repeat', innerHTML: '\
- 3189. - <div class="pva_repeat_blob">\
- 3190. - <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>\
- 3191. - </div>'}), geByClass1('pva_title', row));
- 3192. - },
- 3193. -
- 3194. - showPlace: function() {
- 3195. - var geohash = cur.pvCurPhoto.geohash;
- 3196. - showBox('al_places.php', {act: 'show_photo_place', geohash: geohash, photo: cur.pvCurPhoto.id}, {width: 708, hideButtons: true, title: false, cache: 1});
- 3197. - },
- 3198. -
- 3199. - editPlace: function() {
- 3200. - var geohash = cur.pvCurPhoto.geohash;
- 3201. - showBox('al_places.php', {act: 'show_photo_place', edit: 1, geohash: geohash || '', photo: cur.pvCurPhoto.id});
- 3202. - },
- 3203. -
- 3204. - updatePlace: function(photo, place) {
- 3205. - var placeCont = ge('pv_edit_place');
- 3206. - if (place) {
- 3207. - placeCont && (placeCont.innerHTML = place ? place + '.' : '');
- 3208. - 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>' : '';
- 3209. - hide('pv_add_place');
- 3210. - } else {
- 3211. - setTimeout(function() {
- 3212. - ajax.post('al_photos.php', {act: 'get_photo_place', photo: photo}, {
- 3213. - onDone: function(place, placeGeoHash) {
- 3214. - Photoview.updatePlace(photo, place);
- 3215. - }
- 3216. - })
- 3217. - }, 1000);
- 3218. - }
- 3219. - },
- 3220. -
- 3221. - nearProgress: function(obj) {
- 3222. - obj.insertBefore(ce('div', {className: 'pv_load_near'}), obj.firstChild);
- 3223. - },
- 3224. -
- 3225. - reportComment: function(obj, ev, commentRaw) {
- 3226. - stManager.add(['privacy.js', 'privacy.css'], function() {
- 3227. - return Privacy.show(obj, ev, 'report_'+commentRaw);
- 3228. - });
- 3229. - }
- 3230. -
- 3231. - }, photoview = Photoview;
- 3232. -
- 3233. - try{stManager.done('photoview.js');}catch(e){}
- ------
Advertisement
Add Comment
Please, Sign In to add comment