Hormold

VK Change (#1380402904)

Sep 28th, 2013
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 22.04 KB | None | 0 0
  1. Файл - fansbox.js (Старый размер - 18442 | Новый - 0):
  2. 0.  - var FansBox = {
  3. 1.  -   init: function(box, opts) {
  4. 2.  -     if (cur.lSTL) re(cur.lSTL);
  5. 3.  -     extend(cur, {
  6. 4.  -       fnbxOffsets: cur.fnbxOffsets || {},
  7. 5.  -       fnbxPhCache: cur.fnbxPhCache || {},
  8. 6.  -       fnbxPhShown: cur.fnbxPhShown || {},
  9. 7.  -       fnbxIdolsList: cur.fnbxIdolsList || {},
  10. 8.  -       fnbxIdolsCache: cur.fnbxIdolsCache || {},
  11. 9.  -       fnbxIdolsIndex: cur.fnbxIdolsIndex || {},
  12. 10.  -       fnbxIdolsProcessed: cur.fnbxIdolsProcessed || {},
  13. 11.  -       fnbxIdolsQuery: cur.fnbxIdolsQuery || '',
  14. 12.  -
  15. 13.  -       fnbxAutoload: true,
  16. 14.  -       fnbxWasScroll: false,
  17. 15.  -       fnbxHash: opts.hash,
  18. 16.  -       fnbxOwnerId: opts.ownerId,
  19. 17.  -       fnbxId: box.tbId,
  20. 18.  -       fnbxSearchLink: opts.searchLink || '',
  21. 19.  -       fnbxPage: opts.address || 'al_fans.php',
  22. 20.  -
  23. 21.  -       lSTL: boxLayerWrap.appendChild(ce('div', {id: 'layer_stl', innerHTML: '<div id="layer_stl_bg" class="fixed"></div><div id="layer_stl_cl"></div><nobr id="layer_stl_text" class="fixed">' + getLang('global_to_top') + '</nobr>', el: box.bodyNode, onclick: cancelEvent, onmousedown: FansBox.lSTLDown, sc: FansBox.onScroll})),
  24. 22.  -       lSTLShown: 0,
  25. 23.  -       lSTLWas: 0,
  26. 24.  -       lSTLWasSet: 0
  27. 25.  -     });
  28. 26.  -     cur.fnbxOffsets[opts.tab] = opts.offset;
  29. 27.  -
  30. 28.  -     ajax.preload(cur.fnbxPage, {
  31. 29.  -       act: cur.fnbxAct || 'box',
  32. 30.  -       tab: opts.tab,
  33. 31.  -       oid: opts.ownerId,
  34. 32.  -       offset: opts.offset
  35. 33.  -     }, opts.preload);
  36. 34.  -
  37. 35.  -     box.setOptions({width: opts.intro ? 630 : 620, bodyStyle: opts.intro ? 'padding: 0px' : 'margin-top: 50px', onShow: function() {
  38. 36.  -       if (cur.fnbxWasScroll) {
  39. 37.  -         boxLayerWrap.scrollTop = cur.fnbxWasScroll;
  40. 38.  -         cur.fnbxWasScroll = false;
  41. 39.  -       }
  42. 40.  -       addEvent(boxLayerWrap, 'scroll', FansBox.onScroll);
  43. 41.  -       setTimeout(FansBox.onScroll, 0);
  44. 42.  -     }, onHide: function() {
  45. 43.  -       removeEvent(boxLayerWrap, 'scroll', FansBox.onScroll);
  46. 44.  -       hide(cur.lSTL);
  47. 45.  -       cur.lSTLShown = 0;
  48. 46.  -       if (opts.onHide) {
  49. 47.  -         opts.onHide();
  50. 48.  -       }
  51. 49.  -     }});
  52. 50.  -
  53. 51.  -     if (!box.tbDeinit) {
  54. 52.  -       extend(box, {
  55. 53.  -         tbDeinit: function() {
  56. 54.  -           cur.fnbxOwnerId = cur.fnbxOffsets = cur.fnbxPhShown = false;
  57. 55.  -           re(cur.lSTL);
  58. 56.  -           removeEvent(boxLayerWrap, 'scroll', FansBox.onScroll);
  59. 57.  -         },
  60. 58.  -         tbcShowProgress: function() {
  61. 59.  -           hide('fans_idol_search');
  62. 60.  -           if (cur.fnbxSearchLink) hide(cur.fnbxSearchLink);
  63. 61.  -         },
  64. 62.  -         tbcOnLoad: function() {
  65. 63.  -           if (curBox().tbVis == 'idols') {
  66. 64.  -             if (ge('fans_rowsidols') && ge('fans_rowsidols').childNodes.length > 10) {
  67. 65.  -               show('fans_idol_search');
  68. 66.  -               var oid = cur.fnbxOwnerId;
  69. 67.  -               if (!cur.fnbxIdolsList[oid]) {
  70. 68.  -                 cur.fnbxIdolsList[oid] = 'loading';
  71. 69.  -                 ajax.post(cur.fnbxPage, {act: 'load_idols', oid: oid}, {onDone: function(result) {
  72. 70.  -                   if (!cur.fnbxIdolsList) return;
  73. 71.  -
  74. 72.  -                   var rf = (cur.fnbxIdolsList[oid] == 'update'), upd = rf || (cur.fnbxIdolsList[oid] == 'more');
  75. 73.  -                   cur.fnbxIdolsCache[oid] = {all: []};
  76. 74.  -                   var processed = cur.fnbxIdolsProcessed;
  77. 75.  -                   for (var i = 0, count = result.length; i < count; ++i) {
  78. 76.  -                     if (processed[result[i][0]] !== undefined) {
  79. 77.  -                       result[i][1] = processed[result[i][0]];
  80. 78.  -                     }
  81. 79.  -                     cur.fnbxIdolsCache[oid].all.push(i);
  82. 80.  -                   }
  83. 81.  -                   cur.fnbxIdolsList[oid] = result;
  84. 82.  -
  85. 83.  -                   cur.fnbxIdolsIndex[oid] = new vkIndexer(cur.fnbxIdolsCache[oid].all, function(obj) {
  86. 84.  -                     return cur.fnbxIdolsList[oid][obj][2];
  87. 85.  -                   }, upd ? function() {
  88. 86.  -                     if (cur.fnbxOwnerId == oid && curBox().tbId == cur.fnbxId && curBox().tbVis == 'idols') {
  89. 87.  -                       FansBox.moreIdols(rf);
  90. 88.  -                     }
  91. 89.  -                   } : function() {});
  92. 90.  -                 }});
  93. 91.  -               } else if (cur.fnbxIdolsQuery) {
  94. 92.  -                 FansBox.moreIdols(true);
  95. 93.  -               }
  96. 94.  -             }
  97. 95.  -           } else {
  98. 96.  -             hide('fans_idol_search');
  99. 97.  -             if (cur.fnbxSearchLink) show(cur.fnbxSearchLink);
  100. 98.  -           }
  101. 99.  -         }
  102. 100.  -       });
  103. 101.  -       addEvent(boxLayerWrap, 'scroll', FansBox.onScroll);
  104. 102.  -     }
  105. 103.  -
  106. 104.  -     placeholderSetup('fans_idol_search_inp', {back: true});
  107. 105.  -     box.tbcOnLoad();
  108. 106.  -
  109. 107.  -     if (cur.fnbxLoaded) cur.fnbxLoaded();
  110. 108.  -     onBodyResize();
  111. 109.  -     FansBox.onScroll();
  112. 110.  -   },
  113. 111.  -   getHighlight: function(q) {
  114. 112.  -     var indxr = cur.fnbxIdolsIndex[cur.fnbxOwnerId], delimiter = indxr.delimiter, trimmer = indxr.trimmer;
  115. 113.  -
  116. 114.  -     q += ' ' + (parseLatin(q) || '');
  117. 115.  -     q = escapeRE(q).replace(/&/g, '&amp;');
  118. 116.  -     q = q.replace(trimmer, '').replace(delimiter, '|');
  119. 117.  -     return {
  120. 118.  -       re: new RegExp('(' + q + ')', 'gi'),
  121. 119.  -       val: '<span class="fans_row_highlight">$1</span>'
  122. 120.  -     }
  123. 121.  -   },
  124. 122.  -   moreIdols: function(force) {
  125. 123.  -     var oid = cur.fnbxOwnerId, list = cur.fnbxIdolsList[oid];
  126. 124.  -     if (curBox().tbId != cur.fnbxId) return;
  127. 125.  -
  128. 126.  -     if (!list || list == 'loading' || list == 'update' || list == 'more') {
  129. 127.  -       if (list == 'loading') cur.fnbxIdolsList[oid] = 'more';
  130. 128.  -       return;
  131. 129.  -     }
  132. 130.  -
  133. 131.  -     var list = cur.fnbxIdolsCache[oid].all, q = trim(val('fans_idol_search_inp'));
  134. 132.  -     toggle('fans_reset_search', !!q);
  135. 133.  -
  136. 134.  -     if (!isVisible('fans_idol_search')) {
  137. 135.  -       q = '';
  138. 136.  -     }
  139. 137.  -
  140. 138.  -     var refresh = (force || q != cur.fnbxIdolsQuery), highlight = false;
  141. 139.  -     cur.fnbxIdolsQuery = q;
  142. 140.  -     if (q) {
  143. 141.  -       list = cur.fnbxIdolsCache[oid]['_' + q];
  144. 142.  -       if (list === undefined) {
  145. 143.  -         var tmp = cur.fnbxIdolsIndex[oid].search(q), mp = {};
  146. 144.  -         list = [];
  147. 145.  -         for (var i = 0, l = tmp.length; i < l; ++i) {
  148. 146.  -           if (!mp[tmp[i]]) {
  149. 147.  -             mp[tmp[i]] = true;
  150. 148.  -             list.push(tmp[i]);
  151. 149.  -           }
  152. 150.  -         }
  153. 151.  -         list.sort(function(a,b){return a-b;});
  154. 152.  -         cur.fnbxIdolsCache[oid]['_' + q] = list;
  155. 153.  -       }
  156. 154.  -       highlight = FansBox.getHighlight(q);
  157. 155.  -     }
  158. 156.  -
  159. 157.  -     var len = list.length, cont = ge('fans_rowsidols'), more = ge('fans_more_linkidols');
  160. 158.  -     if (!len) {
  161. 159.  -       hide(more);
  162. 160.  -       val(cont, FansBox.genIdolEmpty(val('fans_idol_search_inp')));
  163. 161.  -       return;
  164. 162.  -     }
  165. 163.  -
  166. 164.  -     var start = refresh ? 0 : cont.childNodes.length, end = Math.min(len, start + 32), html = [];
  167. 165.  -     for (var i = start; i < end; ++i) {
  168. 166.  -       var row = cur.fnbxIdolsList[oid][list[i]], name = row[2];
  169. 167.  -       if (!row) continue;
  170. 168.  -       row = FansBox.genIdolRow(row, highlight ? name.replace(highlight.re, highlight.val) : name);
  171. 169.  -       if (refresh) {
  172. 170.  -         html.push(row);
  173. 171.  -       } else {
  174. 172.  -         cont.appendChild(se(row));
  175. 173.  -       }
  176. 174.  -     }
  177. 175.  -     if (refresh) {
  178. 176.  -       val(cont, html.join(''));
  179. 177.  -       curBox().tbToTop();
  180. 178.  -     }
  181. 179.  -     toggle(more, end < len);
  182. 180.  -   },
  183. 181.  -   genIdolEmpty: function(q) {
  184. 182.  -     var lnk = '<a href="/search?c[section]=groups&c[q]=' + encodeURIComponent(q) + '">';
  185. 183.  -     var text = trim(q) ? (getLang('fans_idols_not_found') + '<br><br>' + getLang('groups_you_can_find').replace('{term}', lnk + clean(q) + '</a>').replace('{link}', lnk).replace('{/link}', '</a>')) : getLang('fans_no_idols');
  186. 184.  -     return '<div class="fans_no_rows">' + text + '</div>';
  187. 185.  -   },
  188. 186.  -   genIdolRow: function(row, name) {
  189. 187.  -     var oid = row[0], evs = row[6] ? ' onmouseover="FansBox.bigphOver(this, ' + oid + ')"' : '', href = '/' + (row[4] ? row[4] : (oid > 0 ? 'id' + oid : 'public' + (-oid))), photo = row[3], size = getLang('public_N_followers', row[5], true), non = ' style="display: none"', status = row[7].length ? row[7] : getLang(oid > 0 ? 'profile_own_profile' : 'groups_type_public'), btns = vk.id && vk.id != oid;
  190. 188.  -     var feed_act = row[8] ? '<a onclick="FansBox.feedToggle(this, ' + oid + ')">'+getLang('public_feedunblock')+'</a>' : '';
  191. 189.  -     return ['\
  192. 190.  - <div class="fans_idol_row inl_bl">\
  193. 191.  -   <div class="fans_idolph_wrap fl_l"', evs, '>\
  194. 192.  -     <a class="fans_idol_ph" href="', href, '">\
  195. 193.  -       <img class="fans_idol_img" src="', photo, '" />\
  196. 194.  -     </a>\
  197. 195.  -   </div>\
  198. 196.  -   <div class="fans_idol_info fl_l">\
  199. 197.  -     <div class="fans_idol_name"><a class="fans_idol_lnk" href="', href, '">', name, '</a></div>\
  200. 198.  -     <div class="fans_idol_status">', status, '</div><div class="fans_idol_size">', size, '</div>\
  201. 199.  -     <div id="fans_idol_sub', oid, '" class="button_blue fans_idol_sub"', ((row[1] || !btns) ? non : ''), '>\
  202. 200.  -       <button onclick="FansBox.subscribe(this, ', oid, ')">', getLang('public_subscribe'), '</button>\
  203. 201.  -     </div>\
  204. 202.  -     <div id="fans_idol_feedact', oid, '" class="fans_idol_space"', (row[1] && btns ? '' : non), '>', feed_act,'</div>\
  205. 203.  -     <div id="fans_idol_unsub', oid, '" class="fans_idol_unsub"', (row[1] && btns ? '' : non), '>\
  206. 204.  -       <a onclick="FansBox.unsubscribe(this, ', oid, ')">', getLang('public_unsubscribe'), '</a>\
  207. 205.  -     </div>\
  208. 206.  -   </div>\
  209. 207.  - </div>'].join('');
  210. 208.  -   },
  211. 209.  -
  212. 210.  -   resetSearch: function() {
  213. 211.  -     val('fans_idol_search_inp', '');
  214. 212.  -     FansBox.moreIdols(true);
  215. 213.  -     setTimeout(elfocus.pbind('fans_idol_search_inp'), 0);
  216. 214.  -   },
  217. 215.  -   more: function() {
  218. 216.  -     var t = curBox().tbCur;
  219. 217.  -     if (t == 'idols') return FansBox.moreIdols();
  220. 218.  -     if (isVisible('fans_more_prg' + t)) return;
  221. 219.  -     ajax.post(cur.fnbxPage, {act: cur.fnbxAct || 'box', tab: t, oid: cur.fnbxOwnerId, offset: cur.fnbxOffsets[t]}, {
  222. 220.  -       onDone: function(rows, newOffset, needMore) {
  223. 221.  -         var el = ce('div', {innerHTML: rows}), cnt = ge('fans_rows' + t);
  224. 222.  -         if (!cnt) return;
  225. 223.  -
  226. 224.  -         for (var e = domFC(el); e; e = domFC(el)) {
  227. 225.  -           cnt.appendChild(e);
  228. 226.  -         }
  229. 227.  -         cur.fnbxOffsets[t] = newOffset;
  230. 228.  -         if (needMore) {
  231. 229.  -           FansBox.preload();
  232. 230.  -         } else {
  233. 231.  -           hide('fans_more_link' + t);
  234. 232.  -         }
  235. 233.  -       }, showProgress: function() {
  236. 234.  -         hide('fans_more_link' + t);
  237. 235.  -         show('fans_more_prg' + t);
  238. 236.  -       }, hideProgress: function() {
  239. 237.  -         show('fans_more_link' + t);
  240. 238.  -         hide('fans_more_prg' + t);
  241. 239.  -       }, cache: 1
  242. 240.  -     });
  243. 241.  -     cur.fnbxAutoload = true;
  244. 242.  -   },
  245. 243.  -   preload: function() {
  246. 244.  -     var t = curBox().tbCur;
  247. 245.  -     ajax.post(cur.fnbxPage, {act: cur.fnbxAct || 'box', tab: t, oid: cur.fnbxOwnerId, offset: cur.fnbxOffsets[t]}, {
  248. 246.  -       cache: 1
  249. 247.  -     });
  250. 248.  -   },
  251. 249.  -   markSubsc: function(oid, v) {
  252. 250.  -     cur.fnbxIdolsProcessed[oid] = v;
  253. 251.  -     var lst = cur.fnbxIdolsList[cur.fnbxOwnerId];
  254. 252.  -     if (lst && lst.length) {
  255. 253.  -       for (var i = 0, l = lst.length; i < l; ++i) {
  256. 254.  -         if (lst[i][0] == oid) {
  257. 255.  -           cur.fnbxIdolsList[cur.fnbxOwnerId][i][1] = v;
  258. 256.  -           break;
  259. 257.  -         }
  260. 258.  -       }
  261. 259.  -     }
  262. 260.  -   },
  263. 261.  -
  264. 262.  -   subscribe: function(el, oid) {
  265. 263.  -     ajax.post('al_feed.php', {act: 'subscr', oid: oid, hash: cur.fnbxHash}, {
  266. 264.  -       onDone: function() {
  267. 265.  -         hide('fans_idol_sub' + oid);
  268. 266.  -         show('fans_idol_unsub' + oid);
  269. 267.  -         show('fans_idol_feedact' + oid);
  270. 268.  -         if (cur.fnbxOwnerId == vk.id) {
  271. 269.  -           FansBox.recache(1);
  272. 270.  -         }
  273. 271.  -         FansBox.markSubsc(oid, 1);
  274. 272.  -       },
  275. 273.  -       showProgress: lockButton.pbind(el),
  276. 274.  -       hideProgress: unlockButton.pbind(el)
  277. 275.  -     });
  278. 276.  -   },
  279. 277.  -   blacklistTip: function(el) {
  280. 278.  -     showTooltip(el, {
  281. 279.  -       text: getLang('fans_block_fan'),
  282. 280.  -       shift: [13, 1, 1],
  283. 281.  -       black: 1
  284. 282.  -     });
  285. 283.  -   },
  286. 284.  -   blacklist: function(el, oid, ev) {
  287. 285.  -     if (el.tt && el.tt.destroy) el.tt.destroy();
  288. 286.  -     cur.fnbxWasScroll = boxLayerWrap.scrollTop;
  289. 287.  -     showBox(cur.fnbxPage, {act: 'block', oid: oid});
  290. 288.  -     return cancelEvent(ev);
  291. 289.  -   },
  292. 290.  -   unsubscribe: function(el, oid) {
  293. 291.  -     ajax.post(cur.fnbxPage, {act: 'unsub', oid: oid, hash: cur.fnbxHash, from: 'box'}, {
  294. 292.  -       onDone: function() {
  295. 293.  -         show('fans_idol_sub' + oid);
  296. 294.  -         hide('fans_idol_unsub' + oid);
  297. 295.  -         hide('fans_idol_feedact' + oid);
  298. 296.  -         if (cur.fnbxOwnerId == vk.id) {
  299. 297.  -           FansBox.recache(-1);
  300. 298.  -         }
  301. 299.  -         FansBox.markSubsc(oid, 0);
  302. 300.  -       },
  303. 301.  -       showProgress: function() {
  304. 302.  -         hide(el);
  305. 303.  -         show(domNS(el) || domPN(el).appendChild(ce('span', {className: 'progress_inline fans_idol_unsub_p'})));
  306. 304.  -       },
  307. 305.  -       hideProgress: function() {
  308. 306.  -         show(el);
  309. 307.  -         re(domNS(el));
  310. 308.  -       }
  311. 309.  -     })
  312. 310.  -   },
  313. 311.  -   feedToggle: function(el, oid) {
  314. 312.  -     ajax.post(cur.fnbxPage, {act: 'feedtgl', oid: oid, hash: cur.fnbxHash, from: 'box'}, {
  315. 313.  -       onDone: function(val, str) {
  316. 314.  -         el.innerHTML = str;
  317. 315.  -         if (cur.fnbxOwnerId == vk.id) {
  318. 316.  -           FansBox.recache(-1);
  319. 317.  -         }
  320. 318.  -         var lst = cur.fnbxIdolsList[cur.fnbxOwnerId];
  321. 319.  -         if (lst && lst.length) {
  322. 320.  -           for (var i = 0, l = lst.length; i < l; ++i) {
  323. 321.  -             if (lst[i][0] == oid) {
  324. 322.  -               cur.fnbxIdolsList[cur.fnbxOwnerId][i][0] = val;
  325. 323.  -               break;
  326. 324.  -             }
  327. 325.  -           }
  328. 326.  -         }
  329. 327.  -       },
  330. 328.  -       showProgress: function() {
  331. 329.  -         el.innerHTML = '<span class="progress_inline"></span>';
  332. 330.  -       }
  333. 331.  -     });
  334. 332.  -   },
  335. 333.  -   lSTLDown: function(e) {
  336. 334.  -     e = e || window.event;
  337. 335.  -     if (checkEvent(e)) return;
  338. 336.  -
  339. 337.  -     if (!__afterFocus) {
  340. 338.  -       var to = 0, st = boxLayerWrap.scrollTop;
  341. 339.  -       if (cur.lSTLWasSet && cur.lSTLWas) {
  342. 340.  -         to = cur.lSTLWas;
  343. 341.  -         cur.lSTLWas = 0;
  344. 342.  -       } else {
  345. 343.  -         cur.lSTLWas = st;
  346. 344.  -       }
  347. 345.  -       boxLayerWrap.scrollTop = to;
  348. 346.  - /*      var diff = st - to;
  349. 347.  -       if (Math.abs(diff) > 6) {
  350. 348.  -         boxLayerWrap.scrollTop = (to + (diff > 0 ? 6 : -6));
  351. 349.  -       }
  352. 350.  -       setTimeout(function() {
  353. 351.  -         animate(boxLayerWrap, {scrollTop: to, transition: Fx.Transitions.easeInCirc}, 100);
  354. 352.  -       }, 0);/**/
  355. 353.  -     }
  356. 354.  -     return cancelEvent(e);
  357. 355.  -   },
  358. 356.  -   onScroll: function() {
  359. 357.  -     var st = boxLayerWrap.scrollTop, mx = 200, vis = cur.lSTLWas || (st > mx), o = 0;
  360. 358.  -     cur.lSTL.style.marginTop = st + 'px';
  361. 359.  -     if (!vis) {
  362. 360.  -       if (cur.lSTLShown !== 0) {
  363. 361.  -         hide(cur.lSTL);
  364. 362.  -         cur.lSTLShown = 0;
  365. 363.  -       }
  366. 364.  -     } else {
  367. 365.  -       if (cur.lSTLShown !== 1) {
  368. 366.  -         show(cur.lSTL);
  369. 367.  -         cur.lSTLShown = 1;
  370. 368.  -       }
  371. 369.  -       if (cur.lSTLWas && st > 500) {
  372. 370.  -         cur.lSTLWas = 0;
  373. 371.  -       }
  374. 372.  -       if (st > mx) {
  375. 373.  -         o = (st - mx) / mx;
  376. 374.  -         if (cur.lSTLWasSet) {
  377. 375.  -           cur.lSTLWasSet = 0;
  378. 376.  -           val(domLC(cur.lSTL), getLang('global_to_top'));
  379. 377.  -           removeClass(domLC(cur.lSTL), 'down');
  380. 378.  -         }
  381. 379.  -       } else {
  382. 380.  -         o = (mx - st) / mx;
  383. 381.  -         if (cur.lSTLWas) {
  384. 382.  -           if (!cur.lSTLWasSet) {
  385. 383.  -             cur.lSTLWasSet = 1;
  386. 384.  -             val(domLC(cur.lSTL), '');
  387. 385.  -             addClass(domLC(cur.lSTL), 'down');
  388. 386.  -           }
  389. 387.  -         }
  390. 388.  -       }
  391. 389.  -     }
  392. 390.  -     setStyle(cur.lSTL, {opacity: Math.min(Math.max(o, 0), 1)});
  393. 391.  -     if (!cur.fnbxAutoload) return;
  394. 392.  -     var bt = lastWindowHeight, objMore = ge('fans_more_link' + curBox().tbCur);
  395. 393.  -     if (isVisible(objMore) && (bt > getXY(objMore, true)[1])) {
  396. 394.  -       objMore.click();
  397. 395.  -     }
  398. 396.  -   },
  399. 397.  -   recache: function(d) {
  400. 398.  -     cur.fnbxOffsets[curBox().tbCur] += d;
  401. 399.  -     for (var i in ajaxCache) {
  402. 400.  -       if (i.match(new RegExp('^\\/' + cur.fnbxPage + '\\#act=' + (cur.fnbxAct || 'box'), ''))) {
  403. 401.  -         delete(ajaxCache[i]);
  404. 402.  -       }
  405. 403.  -     }
  406. 404.  -   },
  407. 405.  -   remove: function(oid) {
  408. 406.  -     re('fans_fan_row' + oid);
  409. 407.  -     FansBox.recache(-1);
  410. 408.  -     FansBox.onScroll();
  411. 409.  -     if (!domFC(ge('fans_rowsfans'))) {
  412. 410.  -       oid = cur.fnbxOwnerId;
  413. 411.  -       curBox().hide();
  414. 412.  -       showBox(cur.fnbxPage, {act: cur.fnbxAct || 'box', tab: 'fans', oid: oid});
  415. 413.  -     }
  416. 414.  -   },
  417. 415.  -
  418. 416.  -   bigphOver: function(obj, uid) {
  419. 417.  -     if (!cur.lang || !cur.lang.global_photo_full_size || !cur.fnbxPhShown || browser.mobile) return;
  420. 418.  -     var o = obj.firstChild, ch = cur.fnbxPhCache[uid];
  421. 419.  -     if (o.tagName != 'A' || o.className != 'fans_fanph') {
  422. 420.  -       (o = obj.insertBefore(ce('a', {className: 'fans_fanph', href: ch && ch._id ? ('/photo' + ch._id + '?all=1') : ('/albums' + uid), innerHTML: '<span class="fans_fanph_label">' + getLang('global_photo_full_size') + '</span>'}), obj.firstChild)).onclick = FansBox.bigphClick.pbind(uid);
  423. 421.  -       o._uid = uid;
  424. 422.  -     }
  425. 423.  -
  426. 424.  -     clearTimeout(o.hideTO);
  427. 425.  -     animate(o, {marginTop: 75}, {duration: 200, transition: Fx.Transitions.easeOutCirc});
  428. 426.  -     cur.fnbxPhShown[uid] = o;
  429. 427.  -
  430. 428.  -     if (!obj.onmouseout) obj.onmouseout = FansBox.bigphOut.pbind(obj);
  431. 429.  -   },
  432. 430.  -   bigphOut: function(obj) {
  433. 431.  -     var o = obj.firstChild;
  434. 432.  -     if (!o || o.tagName != 'A' || o.className != 'fans_fanph') return;
  435. 433.  -
  436. 434.  -     clearTimeout(o.hideTO);
  437. 435.  -     o.hideTO = setTimeout(function() {
  438. 436.  -       animate(o, {marginTop: 100}, 200);
  439. 437.  -       delete(cur.fnbxPhShown[o._uid]);
  440. 438.  -     }, 150);
  441. 439.  -   },
  442. 440.  -   bigphClick: function(uid, ev) {
  443. 441.  -     if (checkEvent(ev) !== false) return;
  444. 442.  -
  445. 443.  -     var ch = cur.fnbxPhCache[uid], t = curBox().tbCur, o = cur.fnbxPhShown[uid], obj = domPN(o);
  446. 444.  -     if (!o || !obj) return;
  447. 445.  -     if (ch === undefined) {
  448. 446.  -       ch = cur.fnbxPhCache[uid] = 'show';
  449. 447.  -       ajax.post('al_photos.php', {act: 'fast_get_photo', oid: uid}, {onDone: function(res) {
  450. 448.  -         if (!res) {
  451. 449.  -           obj.onmouseover = function() {};
  452. 450.  -           re(o);
  453. 451.  -           return;
  454. 452.  -         }
  455. 453.  -         var sh = (cur.fnbxPhCache[uid] == 'show');
  456. 454.  -         cur.fnbxPhCache[uid] = res;
  457. 455.  -         o.href = '/photo' + res._id + '?all=1';
  458. 456.  -         if (sh) FansBox.bigphClick(uid);
  459. 457.  -       }, onFail: function() {
  460. 458.  -         obj.onmouseover = function() {};
  461. 459.  -         re(o);
  462. 460.  -         return true;
  463. 461.  -       }});
  464. 462.  -     }
  465. 463.  -     if (ch == 'show') {
  466. 464.  -       return cancelEvent(ev);
  467. 465.  -     }
  468. 466.  -     if (!ch) return;
  469. 467.  -
  470. 468.  -     for (var i in cur.fnbxPhShown) {
  471. 469.  -       animate(cur.fnbxPhShown[i], {marginTop: 100}, 0);
  472. 470.  -     }
  473. 471.  -     cur.fnbxPhShown = false;
  474. 472.  -     extend(cur, {
  475. 473.  -       fnbxBack: {
  476. 474.  -         tab: t,
  477. 475.  -         initial: curBox().tbInitial,
  478. 476.  -         oid: cur.fnbxOwnerId,
  479. 477.  -         offsets: cur.fnbxOffsets,
  480. 478.  -         scroll: boxLayerWrap.scrollTop,
  481. 479.  -         query: cur.fnbxIdolsQuery,
  482. 480.  -         vis: isVisible('fans_more_link' + t) || isVisible('fans_more_prg' + t),
  483. 481.  -         cont: ge('fans_rows' + t)
  484. 482.  -       }
  485. 483.  -     });
  486. 484.  -     extend(ch, {
  487. 485.  -       jumpTo: {z: 'albums' + uid},
  488. 486.  -       onHide: function() {
  489. 487.  -         cur.fnbxLoaded = function() {
  490. 488.  -           var t = curBox().tbVis, cont = ge('fans_rows' + t), s = cur.fnbxBack.scroll;
  491. 489.  -           if (t != cur.fnbxBack.tab) {
  492. 490.  -             curBox().tbTab(cur.fnbxBack.tab);
  493. 491.  -             return;
  494. 492.  -           }
  495. 493.  -           extend(cur, {
  496. 494.  -             fnbxOffsets: cur.fnbxBack.offsets,
  497. 495.  -             fnbxIdolsQuery: cur.fnbxBack.query
  498. 496.  -           });
  499. 497.  -           domPN(cont).replaceChild(cur.fnbxBack.cont, cont);
  500. 498.  -           toggle('fans_more_link' + t, !!cur.fnbxBack.vis);
  501. 499.  -           hide('fans_more_prg' + t);
  502. 500.  -           cur.fnbxLoaded = cur.fnbxBack = false;
  503. 501.  -
  504. 502.  -           boxLayerWrap.scrollTop = s;
  505. 503.  -           val('fans_idol_search_inp', cur.fnbxIdolsQuery);
  506. 504.  -           if (t == 'idols' && cur.fnbxIdolsQuery) {
  507. 505.  -             elfocus('fans_idol_search_inp');
  508. 506.  -             show('fans_reset_search');
  509. 507.  -           }
  510. 508.  -           setTimeout(function() { boxLayerWrap.scrollTop = s; onBodyResize(); FansBox.onScroll(); }, 0);
  511. 509.  -         }
  512. 510.  -         showBox(cur.fnbxPage, {act: cur.fnbxAct || 'box', tab: cur.fnbxBack.initial, oid: cur.fnbxBack.oid}, {cache: 1});
  513. 511.  -       }
  514. 512.  -     });
  515. 513.  -     cur.fnbxAutoload = false;
  516. 514.  -     return showPhoto(ch._id, 'album' + uid + '_0/rev', ch, ev);
  517. 515.  -   }
  518. 516.  - };
  519. 517.  -
  520. 518.  - try{stManager.done('fansbox.js');}catch(e){}
  521. ------
Advertisement
Add Comment
Please, Sign In to add comment