Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Файл - audio.js (Старый размер - 92328 | Новый - 0):
- 0. - var Audio = {
- 1. - address: '/audio',
- 2. - scrollnode: browser.msie6 ? pageNode : window,
- 3. - fixedScroll: !(browser.msie && browser.version < 8 || browser.mobile),
- 4. - init: function(obj, audioTpl) {
- 5. - extend(cur, {
- 6. - searchCont: ge('audio_search'),
- 7. - aSearch: ge('s_search'),
- 8. - clearSearch: ge('audio_query_reset'),
- 9. - aContent: ge('initial_list'),
- 10. - sContent: ge('search_list'),
- 11. - sPreload: ge('search_preload'),
- 12. - showMore: ge('more_link'),
- 13. - sShowMore: ge('s_more_link'),
- 14. - sWrap: ge('audio_search_wrap'),
- 15. - sSummary: ge('audio_search_summary'),
- 16. - albumFilters: ge('album_filters'),
- 17. - albumFiltered: ge('album_filtered'),
- 18. - searchFilters: ge('audio_search_filters'),
- 19. - popularFilters: ge('audio_popular_filters'),
- 20. - popularOwners: ge('audio_popular_owners'),
- 21. - audioFriends: ge('audio_friends'),
- 22. - audioAlbums: ge('audio_albums'),
- 23. - audioAlbumsWrap: ge('audio_albums_wrap'),
- 24. - audioWrap: ge('audio_wrap'),
- 25. - searchInfoCont: ge('audio_search_info'),
- 26. - searchStr: "",
- 27. - autoComplete: 1,
- 28. - audioTpl: audioTpl,
- 29. - audioEl: {
- 30. - head: ge('page_header'),
- 31. - bar: ge('ac'),
- 32. - cont: ge('audio'),
- 33. - filters: ge('side_filters')
- 34. - }
- 35. - });
- 36. -
- 37. - if (ge('ac') && window.audioPlayer) {
- 38. - audioPlayer.initEvents();
- 39. - audioPlayer.registerPlayer('ac', {
- 40. - container: ge('ac'),
- 41. - performer: ge('ac_performer'),
- 42. - title: ge('ac_title'),
- 43. - titleWrap: ge('ac_name'),
- 44. - duration: ge('ac_duration'),
- 45. - load: ge('ac_load_line'),
- 46. - progress: ge('ac_pr_line'),
- 47. - progressArea: ge('ac_pr'),
- 48. - volume: ge('ac_vol_line'),
- 49. - volumeArea: ge('ac_vol'),
- 50. - play: ge('ac_play'),
- 51. - prev: ge('ac_prev'),
- 52. - next: ge('ac_next'),
- 53. - add: ge('ac_add'),
- 54. - repeat: ge('ac_repeat'),
- 55. - shuffle: ge('ac_shuffle'),
- 56. - rec: ge('ac_rec'),
- 57. - status: ge('ac_status'),
- 58. - fixed: !(browser.msie && browser.version < 8 || browser.mobile)
- 59. - });
- 60. - }
- 61. - if (browser.mobile) {
- 62. - hide('ac_vol');
- 63. - setStyle('ac_duration', {margin: 0});
- 64. - }
- 65. -
- 66. - if (!cur.allAudiosIndex) cur.allAudiosIndex = 'all';
- 67. -
- 68. - extend(cur, obj);
- 69. - cur.module = 'audio';
- 70. - //cur.disableAutoMore = true;
- 71. - if (cur.aSearch) {
- 72. - cur.aSearch.value = cur.q;
- 73. - toggleClass(cur.clearSearch, 'shown', !!cur.q);
- 74. - placeholderSetup(cur.aSearch, {back: true});
- 75. - setTimeout(function() {
- 76. - cur.aSearch.focus();
- 77. - }, 0);
- 78. - }
- 79. -
- 80. - Audio.scrollnode = browser.msie6 ? pageNode : window;
- 81. - Audio.fixedScroll = !(browser.msie && browser.version < 8 || browser.mobile);
- 82. - window.scrollTop = bodyNode.scrollTop = pageNode.scrollTop = htmlNode.scrollTop = 0;
- 83. - Audio.startEvents();
- 84. - cur.destroy.push(function() {
- 85. - Audio.stopEvents();
- 86. - });
- 87. -
- 88. - cur.nav.push(function(changed, old, n) {
- 89. - if (changed.act == 'popular') {
- 90. - Audio.loadPopular(true, intval(n.genre));
- 91. - return false;
- 92. - }
- 93. - });
- 94. -
- 95. -
- 96. - var _a = window.audioPlayer;
- 97. - if (_a && _a.showCurrentTrack) {
- 98. - _a.shuffle = false;
- 99. - _a.showCurrentTrack();
- 100. - }
- 101. -
- 102. - cur.audios = {};
- 103. - hide(cur.sContent);
- 104. -
- 105. - cur.silent = true;
- 106. - var query = {act: 'load_audios_silent', id: (cur.allAudiosIndex == 'all' ? cur.id : cur.audioFriend), gid: cur.gid, please_dont_ddos: 2};
- 107. - if (cur.allAudiosIndex != 'all') {
- 108. - Audio.cacheFriendsList();
- 109. - }
- 110. - if (cur.club) {
- 111. - cur.curSection = 'club' + cur.club;
- 112. - query.club = cur.club;
- 113. - cur.searchStr = cur.q;
- 114. - }
- 115. - ajax.post(Audio.address, query, {onDone: (function(data, opts) {
- 116. - opts = eval('('+opts+')');
- 117. - if (opts.exp) {
- 118. - _a.statusExport = opts.exp;
- 119. - checkbox('currinfo_audio', (_a.hasStatusExport()));
- 120. - if (_a && _a.showCurrentTrack) _a.showCurrentTrack();
- 121. - delete opts.exp;
- 122. - }
- 123. - extend(cur, opts);
- 124. - if (cur.hashes && cur.hashes.add_hash && !_a.addHash) {
- 125. - _a.addHash = cur.hashes.add_hash;
- 126. - }
- 127. - if (query.id > 0) {
- 128. - cur.allFriendsTitles = cur.allFriendsTitles || {};
- 129. - cur.allFriendsTitles[query.id] = opts.summaryLang.all_friend_title;
- 130. - cur.allFriendsHTitles = cur.allFriendsHTitles || {};
- 131. - cur.allFriendsHTitles[query.id] = opts.summaryLang.all_friend_htitle;
- 132. - }
- 133. - var obj = eval('('+data+')');
- 134. - if (!obj) {
- 135. - return;
- 136. - }
- 137. - cur.audiosList = cur.audiosList || {};
- 138. - if ((query.club || query.id < 0) && obj.club) {
- 139. - var club = query.club || -query.id;
- 140. - cur.allClubsHTitles = cur.allClubsHTitles || {};
- 141. - cur.allClubsHTitles[club] = opts.summaryLang.all_club_htitle || cur.htitle;
- 142. - cur.allFriendsHTitles = cur.allFriendsHTitles || {};
- 143. - cur.allFriendsHTitles[-club] = opts.summaryLang.all_club_htitle || cur.htitle;
- 144. - cur.curList = 'club' + club;
- 145. - cur.audiosList[cur.curList] = obj.club;
- 146. - } else {
- 147. - cur.curList = (cur.album_id) ? 'album'+cur.album_id : cur.allAudiosIndex;
- 148. - }
- 149. - cur.searchOffset = 0;
- 150. - cur.audiosList[cur.allAudiosIndex] = obj.all ? obj.all : [];
- 151. - if (cur.allAudiosIndex == 'all') Audio.generateAlbums();
- 152. - cur.sectionCount = (cur.audiosList[cur.curList] || []).length;
- 153. - if (cur.canEdit && nav.objLoc.act != 'popular' && nav.objLoc.act != 'recommendations' && nav.objLoc.act != 'feed' && !browser.mobile && cur.allAudiosIndex == 'all' && !cur.shuffled) {
- 154. - if (cur.sectionCount) {
- 155. - var opts = {onReorder: Audio.onAudioReorder, onMouseDown: Audio.onDragStart, onMouseUp: Audio.onDragEnd, noMoveCursor: 1};
- 156. - if (cur.audioAlbumsWrap) {
- 157. - extend(opts, {target: cur.audioAlbumsWrap, onDragOver: Audio.onDragOver, onDragOut: Audio.onDragOut});
- 158. - }
- 159. - sorter.init(cur.aContent, opts);
- 160. - }
- 161. - }
- 162. - if (cur.albums) {
- 163. - Audio.initAlbumsSort();
- 164. - }
- 165. - this.indexAll(function() {
- 166. - cur.silent = false;
- 167. - if (cur.onSilentLoad) {
- 168. - cur.onSilentLoad();
- 169. - }
- 170. - if (!cur.q || cur.club) {
- 171. - if (cur.curSection == 'recommendations' || cur.curSection == 'popular' || cur.curSection == 'feed') {
- 172. - if (cur[cur.curSection+'Audios']) {
- 173. - var k = 0;
- 174. - for (var i in cur[cur.curSection+'Audios']) {
- 175. - cur[cur.curSection+'Audios'][i]._order = k++;
- 176. - }
- 177. - audioPlayer.genPlaylist(cur[cur.curSection+'Audios'], false);
- 178. - }
- 179. - } else {
- 180. - audioPlayer.genPlaylist(cur.audiosList[cur.curList], false, cur.curList == 'all' && cur.oid == vk.id);
- 181. - }
- 182. - } else if (!query.club) {
- 183. - Audio.selectPerformer(null, cur.q);
- 184. - }
- 185. - if (cur.audio_id) {
- 186. - var audio = cur.audios[cur.audio_id];
- 187. - if (audio) {
- 188. - var audio_id = audio[0] + '_' + audio[1];
- 189. - if (audio[11] && parseInt(audio[11])) {
- 190. - var claim = parseInt(audio[11]) || 0;
- 191. - if (claim == -2) claim = 0;
- 192. - Audio.showAudioClaimWarning(audio_id, claim, audio[5] + ' – ' + audio[6]);
- 193. - } else {
- 194. - try{
- 195. - playAudioNew(audio_id);
- 196. - }catch(e){};
- 197. - }
- 198. - }
- 199. - }
- 200. - });
- 201. - }).bind(this), local: 1});
- 202. - },
- 203. -
- 204. - startEvents: function() {
- 205. - addEvent(Audio.scrollnode, 'scroll', Audio.scrollCheck);
- 206. - addEvent(window, 'resize', Audio.scrollCheck);
- 207. - addEvent(cur.aSearch, 'blur', Audio.searchBlur);
- 208. - addEvent(cur.aSearch, 'focus', Audio.searchFocus);
- 209. - cur.gpHidden = true;
- 210. - toggleGlobalPlayer(false);
- 211. - if (Audio.fixedScroll) {
- 212. - var els = geByClass('top_info_wrap', ge('page_wrap'));
- 213. - each(els, function() { hide(this); });
- 214. - hide(_stlSide);
- 215. - setTimeout(function() {
- 216. - each(els, function() { hide(this); });
- 217. - hide(_stlSide);
- 218. - }, 110);
- 219. - var headH = cur.audioEl.head.clientHeight,
- 220. - headT = getXY(cur.audioEl.head)[1],
- 221. - audioNavH = cur.audioEl.bar.offsetHeight,
- 222. - headW = cur.audioEl.head.clientWidth,
- 223. - contentY = headH + audioNavH;
- 224. - setStyle(cur.audioEl.head, {width: headW, top: headT});
- 225. - setStyle('side_bar', {top: headH + headT});
- 226. - setStyle(cur.audioEl.bar, {top: headH + headT});
- 227. - setStyle(cur.audioEl.cont, {paddingTop: contentY});
- 228. - setStyle(cur.audioEl.filters, {top: contentY});
- 229. -
- 230. - addClass(bodyNode, 'audio_fixed_nav');
- 231. - _fixedNav = true;
- 232. - }
- 233. - Audio.updateAlbumsTitles();
- 234. - Audio.handleFilterPos();
- 235. - },
- 236. -
- 237. - stopEvents: function() {
- 238. - removeEvent(Audio.scrollnode, 'scroll', Audio.scrollCheck);
- 239. - removeEvent(window, 'resize', Audio.scrollCheck);
- 240. - removeEvent(cur.aSearch, 'blur', Audio.searchBlur);
- 241. - removeEvent(cur.aSearch, 'focus', Audio.searchFocus);
- 242. - if (Audio.fixedScroll) {
- 243. - var els = geByClass('top_info_wrap', ge('page_wrap'));
- 244. - each(els, function() { show(this); });
- 245. - setStyle(cur.audioEl.head, {width: '', top: ''});
- 246. - setStyle('side_bar', {top: ''});
- 247. -
- 248. - removeClass(bodyNode, 'audio_fixed_nav');
- 249. - _fixedNav = false;
- 250. -
- 251. - show(_stlSide, 'debuglogwrap');
- 252. - }
- 253. - audioPlayer.deregisterPlayer('ac');
- 254. - setTimeout(function() {
- 255. - toggleGlobalPlayer(true);
- 256. - updGlobalPlayer();
- 257. - }, 100);
- 258. - },
- 259. -
- 260. - searchFocus: function() {
- 261. - var alist = ge('audios_list');
- 262. - if (!hasClass(alist, 'light')) addClass(alist, 'light');
- 263. - },
- 264. -
- 265. - searchBlur: function() {
- 266. - var alist = ge('audios_list');
- 267. - if (hasClass(alist, 'light')) removeClass(alist, 'light');
- 268. - },
- 269. -
- 270. - clearSearch: function(el, event) {
- 271. - setStyle(el, {opacity: .6});
- 272. - cur.aSearch.focus();
- 273. - if (cur.allAudiosIndex == 'all') {
- 274. - Audio.loadAlbum(0);
- 275. - } else {
- 276. - this.filterTimeout = setTimeout((function() {
- 277. - val(cur.aSearch, '');
- 278. - removeClass(cur.clearSearch, 'shown');
- 279. - this.updateList(null, cur.aSearch);
- 280. - this.hideSearchResults();
- 281. - scrollToTop();
- 282. - }).bind(this), 10);
- 283. - }
- 284. - if (isVisible(cur.searchInfoCont)) {
- 285. - hide(cur.searchInfoCont);
- 286. - }
- 287. - },
- 288. -
- 289. - updateSorterRows: function(fromEl) {
- 290. - if (fromEl && fromEl.parentNode.sorter){
- 291. - sorter.update(fromEl);
- 292. - }
- 293. - },
- 294. -
- 295. - showLyrics: function(id, lid, top) {
- 296. - var lyrics_div = ge('lyrics'+id);
- 297. - if (!isVisible(lyrics_div)) {
- 298. - show(lyrics_div);
- 299. - lyrics_div.innerHTML = "<div style='text-align: center; height: 50px; padding: 30px 10px 10px 10px'><img valign='middle' src='/images/progress7.gif'></div>";
- 300. - Audio.updateSorterRows(ge('audio'+id));
- 301. - ajax.post(Audio.address, {act: 'get_lyrics', lid: lid, aid: id, top: top ? 1 : 0}, {cache: 1, onDone: (function(responseText) {
- 302. - lyrics_div.innerHTML = responseText;
- 303. - Audio.updateSorterRows(ge('audio'+id));
- 304. - }).bind(this)});
- 305. - } else {
- 306. - lyrics_div.innerHTML = "";
- 307. - hide(lyrics_div);
- 308. - Audio.updateSorterRows(ge('audio'+id));
- 309. - Audio.handleFilterPos();
- 310. - }
- 311. - },
- 312. -
- 313. - allAudios: function() {
- 314. - return cur.audiosList ? cur.audiosList[cur.allAudiosIndex] || [] : [];
- 315. - },
- 316. -
- 317. - showRows: function(start, end, force) {
- 318. - if (cur.curSection == 'recommendations') {
- 319. - Audio.loadRecommendations();
- 320. - return;
- 321. - } else if (cur.curSection == 'popular') {
- 322. - Audio.loadPopular();
- 323. - return;
- 324. - } else if (cur.curSection == 'feed') {
- 325. - Audio.loadFeed();
- 326. - return;
- 327. - }
- 328. - if (cur.silent) {
- 329. - cur.onSilentLoad = function() {
- 330. - Audio.showRows(start, end, force);
- 331. - };
- 332. - return;
- 333. - }
- 334. - var list = cur.audiosList[cur.curList] || [];
- 335. - if (list[0] && list[0]._order !== undefined) {
- 336. - list = list.sort(function(a,b) {return a._order - b._order});
- 337. - }
- 338. - list = Audio.filterClaimed(list);
- 339. - cur.sectionCount = list.length;
- 340. - if (!cur.searchStr) {
- 341. - list = Audio.filterDeleted(list);
- 342. - if (cur.filterUnsorted) {
- 343. - list = Audio.filterByAlbum(list, 0);
- 344. - }
- 345. - cur.sectionCount = list.length;
- 346. - }
- 347. - if (start == undefined) {
- 348. - start = cur.shownAudios;
- 349. - }
- 350. - if (end == undefined) {
- 351. - end = cur.shownAudios + cur.audiosPerPage;
- 352. - }
- 353. - if (window.tooltips && cur.tooltips) {
- 354. - for (var i = 0; i < cur.tooltips.length; ++i) {
- 355. - if (cur.tooltips[i].el) {
- 356. - if (hasClass(cur.tooltips[i].el, 'audio_friend')) continue;
- 357. - if (cur.tooltips[i].el.ttimer) {
- 358. - clearTimeout(cur.tooltips[i].el.ttimer);
- 359. - }
- 360. - }
- 361. - cur.tooltips[i].hide({fasthide: true});
- 362. - }
- 363. - }
- 364. - var _a = window.audioPlayer;
- 365. - if (!list || !list.length) {
- 366. - if (cur.shownAudios == 0 && (cur.album_id || (!Audio.allAudios().length && !cur.searchStr))) {
- 367. - var msg;
- 368. - if (Audio.allAudios().length) {
- 369. - msg = (cur.album_id) ? getLang('audio_album_no_recs') : getLang('audio_no_audios_found').split('{query}').join('<b>'+cur.searchStr.replace(/([<>&#]*)/g, '')+'</b>');
- 370. - } else {
- 371. - if (cur.oid > 0 && !cur.audioFriend) {
- 372. - if (cur.id == vk.id && cur.allAudiosIndex == 'all') {
- 373. - msg = getLang('audio_no_rec_load_msg').split('{link}').join('<a href="#" onclick="Audio.addAudio(); return false">').split('{/link}').join('</a>');
- 374. - } else {
- 375. - msg = getLang('audio_user_no_recs');
- 376. - }
- 377. - } else {
- 378. - msg = cur.audioFriend > 0 ? getLang('audio_user_no_recs') : getLang('audio_group_no_recs');
- 379. - }
- 380. - }
- 381. - cur.aContent.innerHTML = '<div id="not_found" class="info_msg">'+msg+'</div>';
- 382. - }
- 383. - hide(cur.showMore);
- 384. - } else {
- 385. - if (!cur.shownAudios) cur.aContent.innerHTML = '';
- 386. - var audios = list.slice(start, end);
- 387. - if (!audios.length) {
- 388. - if (cur.shownAudios >= cur.sectionCount) {
- 389. - hide(cur.showMore);
- 390. - if (cur.searchStr) {
- 391. - this.loadRows();
- 392. - }
- 393. - }
- 394. - return;
- 395. - }
- 396. - var html = [];
- 397. - for (i in audios) {
- 398. - var audio = audios[i].slice();
- 399. - if (cur.selection) {
- 400. - audio[5] = audio[5].replace(cur.selection.re, cur.selection.val).replace(/&#(\d*)<span>(\d+)<\/span>(\d*);/g, "&#$1$2$3;");
- 401. - audio[6] = audio[6].replace(cur.selection.re, cur.selection.val).replace(/&#(\d*)<span>(\d+)<\/span>(\d*);/g, "&#$1$2$3;");
- 402. - }
- 403. - html.push(this.drawAudio(audio));
- 404. - cur.shownAudios += 1;
- 405. - }
- 406. - var au = ce('div', {innerHTML: html.join('')});
- 407. - while (au.firstChild) {
- 408. - var el = au.firstChild;
- 409. - cur.aContent.appendChild(el);
- 410. - }
- 411. - if (cur.canEdit && nav.objLoc.act != 'popular' && nav.objLoc.act != 'recommendations' && nav.objLoc.act != 'feed' && !browser.mobile && !cur.searchStr && cur.sectionCount && cur.allAudiosIndex == 'all' && !cur.shuffled) {
- 412. - if (start > 0) {
- 413. - setTimeout(sorter.added.pbind(cur.aContent), 0);
- 414. - } else {
- 415. - setTimeout(function(){
- 416. - var opts = {onReorder: Audio.onAudioReorder, onMouseDown: Audio.onDragStart, onMouseUp: Audio.onDragEnd, noMoveCursor: 1};
- 417. - if (cur.audioAlbumsWrap) {
- 418. - extend(opts, {target: cur.audioAlbumsWrap, onDragOver: Audio.onDragOver, onDragOut: Audio.onDragOut});
- 419. - }
- 420. - sorter.init(cur.aContent, opts);
- 421. - }, 0);
- 422. - }
- 423. - }
- 424. - if (cur.searchCount && isVisible(cur.sContent)) {
- 425. - show(cur.sWrap);
- 426. - cur.sContent.style.paddingTop = '12px';
- 427. - cur.sSummary.innerHTML = langNumeric(cur.searchCount, cur.summaryLang['list_found'], true);
- 428. - }
- 429. - if (_a && _a.showCurrentTrack) _a.showCurrentTrack();
- 430. - }
- 431. - setTimeout(Audio.handleFilterPos, 0);
- 432. - var aid = currentAudioId(), clubList = (cur.curSection && cur.curSection.substr(0, 4) == 'club');
- 433. - if (_a && _a.gpDisabled && aid) {
- 434. - var track_id = aid.split('_')[1];
- 435. - if (!cur.audios[track_id]) _a.stop();
- 436. - }
- 437. - if (cur.justShuffled) {
- 438. - toggle(cur.showMore, cur.shownAudios < cur.sectionCount);
- 439. - return;
- 440. - }
- 441. - if (clubList) {
- 442. - Audio.hideSearchResults();
- 443. - }
- 444. - if (force) return;
- 445. - if (cur.shownAudios >= cur.sectionCount) {
- 446. - hide(cur.showMore);
- 447. - if (cur.searchStr && !clubList) {
- 448. - this.loadRows();
- 449. - } else {
- 450. - Audio.setQLoc(cur.searchStr);
- 451. - }
- 452. - } else {
- 453. - show(cur.showMore);
- 454. - Audio.setQLoc(cur.searchStr);
- 455. - }
- 456. - },
- 457. -
- 458. - loadRows: function() {
- 459. - if (cur.sPreload.innerHTML) {
- 460. - while (cur.sPreload.firstChild) {
- 461. - var el = cur.sPreload.firstChild
- 462. - cur.sContent.appendChild(el);
- 463. - }
- 464. - }
- 465. - clearTimeout(this.searchTimeout);
- 466. - this.searchTimeout = setTimeout((function() {
- 467. - Audio.searchRequest(cur.searchStr, cur.searchOffset);
- 468. - }).bind(this), 300);
- 469. - },
- 470. -
- 471. - searchRequest: function(val, offset) {
- 472. - if (!val) return;
- 473. - if (val[val.length - 1] == ' ') {
- 474. - val[val.length - 1] = '_';
- 475. - }
- 476. - addClass(cur.searchCont, 'loading');
- 477. - setStyle(cur.clearSearch, {opacity: .6});
- 478. - var query = {act: 'search', q: val, offset: offset, id: cur.id, gid: cur.gid, performer: cur.searchTypeMenu ? cur.searchTypeMenu.val() : 0};
- 479. - var l = ge('audio_lyrics_filter');
- 480. - var s = ge('selectedItems');
- 481. - if (l && parseInt(l.value)) query.lyrics = 1;
- 482. - if (s) query.sort = s.value;
- 483. - if (cur.autoComplete) query.autocomplete = cur.autoComplete;
- 484. - if (nav.objLoc.claim) query.claim = nav.objLoc.claim;
- 485. - ajax.post(Audio.address, query, {onDone: function(res, preload, options) {
- 486. - removeClass(cur.searchCont, 'loading');
- 487. - var newVal = cur.searchStr;
- 488. - if (newVal[newVal.length - 1] == ' ') {
- 489. - newVal[newVal.length - 1] = '_';
- 490. - }
- 491. - if (val != newVal) {
- 492. - return;
- 493. - }
- 494. - if (res) {
- 495. - cur.sContent.innerHTML = res;
- 496. - }
- 497. - if (preload) {
- 498. - cur.sPreload.innerHTML = preload;
- 499. - }
- 500. - Audio.applyOptions(options, offset);
- 501. - show(cur.sContent);
- 502. - if (!cur.sectionCount) {
- 503. - hide(cur.sWrap);
- 504. - cur.sContent.style.paddingTop = '0px';
- 505. - Audio.changeSummary(true);
- 506. - cur.aContent.innerHTML = '';
- 507. - if (!cur.searchCount && !res && !preload) {
- 508. - msg = getLang('audio_no_audios_found').split('{query}').join('<b>'+cur.searchStr.replace(/([<>&#]*)/g, '')+'</b>');
- 509. - cur.aContent.innerHTML = '<div id="not_found" class="info_msg">'+msg+'</div>';
- 510. - hide(cur.showMore);
- 511. - hide(cur.sContent);
- 512. - }
- 513. - } else {
- 514. - cur.sContent.style.paddingTop = '12px';
- 515. - if (cur.searchCount) {
- 516. - cur.sSummary.innerHTML = langNumeric(cur.searchCount, cur.summaryLang['list_found'], true);
- 517. - show(cur.sWrap);
- 518. - } else {
- 519. - Audio.hideSearchResults();
- 520. - hide(cur.sWrap);
- 521. - }
- 522. - }
- 523. - Audio.scrollCheck();
- 524. - if (!offset) Audio.setQLoc(cur.searchStr);
- 525. - var _a = window.audioPlayer;
- 526. - if (_a && _a.showCurrentTrack) _a.showCurrentTrack();
- 527. - },
- 528. - onFail: function() {
- 529. - removeClass(cur.searchCont, 'loading');
- 530. - },
- 531. - showProgress: function () {
- 532. - cur.isAudioLoading = true;
- 533. - },
- 534. - hideProgress: function () {
- 535. - cur.isAudioLoading = false;
- 536. - }
- 537. - });
- 538. - },
- 539. -
- 540. - changeSearchFilters: function() {
- 541. - cur.searchOffset = 0;
- 542. - Audio.searchRequest(cur.searchStr, 0);
- 543. - },
- 544. -
- 545. - hideSearchResults: function() {
- 546. - setTimeout(function(){
- 547. - cur.sContent.innerHTML = '';
- 548. - if (cur.curSection != 'recommendations' && cur.curSection != 'popular' && cur.curSection != 'feed') cur.sPreload.innerHTML = '';
- 549. - hide(cur.sContent);
- 550. - hide(cur.sWrap);
- 551. - hide(cur.sShowMore);
- 552. - Audio.scrollCheck();
- 553. - }, 0);
- 554. - },
- 555. -
- 556. - drawAudio: function(audio) {
- 557. - return cur.audioTpl(audio, cur.curSection);
- 558. - },
- 559. -
- 560. - applyOptions: function(options, offset) {
- 561. - extend(cur, options);
- 562. - if (!cur.has_more) {
- 563. - hide(cur.sShowMore);
- 564. - } else {
- 565. - show(cur.sShowMore);
- 566. - }
- 567. - if (!offset) {
- 568. - if (options.searchInfo) {
- 569. - cur.searchInfoCont.innerHTML = options.searchInfo;
- 570. - if (!isVisible(cur.searchInfoCont)) {
- 571. - show(cur.searchInfoCont);
- 572. - }
- 573. - each(geByClass('audio_friend_name_now', cur.searchInfoCont), function() {
- 574. - if (this.scrollWidth > this.clientWidth) {
- 575. - this.setAttribute('title', this.innerText || this.textContent);
- 576. - } else {
- 577. - this.removeAttribute('title');
- 578. - }
- 579. - })
- 580. - } else if (isVisible(cur.searchInfoCont)) {
- 581. - hide(cur.searchInfoCont);
- 582. - }
- 583. - }
- 584. - },
- 585. -
- 586. - handleFilterPos: function() {
- 587. - if (!Audio.fixedScroll || !cur.audioEl) return false;
- 588. - var headH = cur.audioEl.head.clientHeight, audioNavH = cur.audioEl.bar.offsetHeight,
- 589. - contentY = headH + audioNavH,
- 590. - st = Math.max(0, scrollGetY()), wh = window.lastWindowHeight || 0, pos = 0,
- 591. - filt = ge('side_panel'), filtPos = getXY(filt)[1], filtY = getSize(filt)[1],
- 592. - sf = ge('side_filters'), sfPos = (getStyle(sf, 'position') == 'fixed') ? parseInt(getStyle(sf, 'top')) : getXY(sf)[1], sfY = getSize(sf)[1],
- 593. - bottomPad = Math.max(0, st + wh - filtY - contentY),
- 594. - tooBig = (filtPos + filtY - sfPos - sfY < 20),
- 595. - lastPos = cur.filterLastPos || 100, lastSt = cur.lastSt || 0;
- 596. -
- 597. - if (!tooBig) {
- 598. - addClass(sf, 'fixed');
- 599. - pos = (wh > sfY + contentY) ? Math.min(contentY, wh - sfY - bottomPad) : Math.max(Math.min(contentY, lastPos + lastSt - st), wh - sfY - bottomPad);
- 600. - } else {
- 601. - removeClass(sf, 'fixed');
- 602. - pos = 0;
- 603. - }
- 604. - cur.filterLastPos = pos;
- 605. - cur.lastSt = st;
- 606. - setStyle(sf, {top: pos + 'px'});
- 607. -
- 608. - if (!browser.mozilla && !browser.msie && cur.lastWW !== lastWindowWidth) {
- 609. - cur.lastWW = lastWindowWidth;
- 610. - var goodLeft1 = ge('page_layout').offsetLeft,
- 611. - goodLeft2 = goodLeft1 + cur.audioEl.cont.offsetLeft,
- 612. - goodLeft3 = goodLeft2 + getSize(cur.audioEl.cont)[0] - getSize(cur.audioEl.filters)[0] - 10;
- 613. - cur.audioEl.head.style.left = ge('side_bar').style.left = goodLeft1 + 'px';
- 614. - cur.audioEl.bar.style.left = goodLeft2 + 'px';
- 615. - cur.audioEl.filters.style.left = goodLeft3 + 'px';
- 616. - setTimeout(Audio.resetStyles, 0);
- 617. - }
- 618. - },
- 619. -
- 620. - resetStyles: function() {
- 621. - cur.audioEl.head.style.left = ge('side_bar').style.left =
- 622. - cur.audioEl.bar.style.left = cur.audioEl.filters.style.left = '';
- 623. - },
- 624. -
- 625. - scrollCheck: function () {
- 626. - Audio.handleFilterPos();
- 627. - if (browser.mobile || cur.isAudioLoading || cur.disableAutoMore) return;
- 628. -
- 629. - if (!isVisible(cur.showMore) && !isVisible(cur.sShowMore)) return;
- 630. - if (!cur.curList) {
- 631. - setTimeout(Audio.scrollCheck, 50);
- 632. - return;
- 633. - }
- 634. -
- 635. - var docEl = document.documentElement;
- 636. - var ch = window.innerHeight || docEl.clientHeight || bodyNode.clientHeight;
- 637. - var st = scrollGetY();
- 638. -
- 639. - if (isVisible(cur.showMore) && st + ch + 400 > cur.showMore.offsetTop) {
- 640. - Audio.showRows();
- 641. - }
- 642. - if (isVisible(cur.sShowMore) && st + ch + 400 > cur.sShowMore.offsetTop) {
- 643. - Audio.loadRows();
- 644. - }
- 645. - },
- 646. -
- 647. - updateList: function(e, obj, force, showAlbums, fromIndex) {
- 648. - if (cur.silent) {
- 649. - cur.onSilentLoad = function() {
- 650. - Audio.updateList(e, obj, force, showAlbums);
- 651. - };
- 652. - return;
- 653. - }
- 654. - if (e && (e.keyCode == 10 || e.keyCode == 13) || cur.forceNoAutoComplete) {
- 655. - delete cur.forceNoAutoComplete
- 656. - delete cur.autoComplete;
- 657. - } else {
- 658. - cur.autoComplete = 1;
- 659. - }
- 660. - clearTimeout(this.filterTimeout);
- 661. - this.filterTimeout = setTimeout((function() {
- 662. - var str = trim(obj.value), el;
- 663. - if (str == cur.searchStr && cur.autoComplete && !cur.ignoreEqual) {
- 664. - return;
- 665. - }
- 666. - delete cur.ignoreEqual;
- 667. - delete nav.objLoc.album_id;
- 668. - delete nav.objLoc.audio_id;
- 669. - if (nav.objLoc.act == 'recommendations' || nav.objLoc.act == 'popular' || nav.objLoc.act == 'feed' || nav.objLoc.act == 'albums') delete nav.objLoc.act;
- 670. - if (showAlbums) {
- 671. - nav.objLoc.act = 'albums';
- 672. - }
- 673. - if (cur.allAudiosIndex == 'all') {
- 674. - cur.album_id = 0;
- 675. - }
- 676. - each(geByClass('audio_filter', cur.albumFilters), function(i, e) {
- 677. - removeClass(e, 'selected');
- 678. - });
- 679. - var c = Audio.allAudios().length;
- 680. - if (str) {
- 681. - el = cur.albumFiltered;
- 682. - hide(cur.audioFriends, cur.audioAlbums);
- 683. - addClass(cur.clearSearch, 'shown');
- 684. - show(cur.searchFilters);
- 685. - hide(cur.searchInfoCont);
- 686. - if (!c && cur.allAudiosIndex == 'all') removeClass(cur.audioWrap, 'audio_no_recs');
- 687. - } else {
- 688. - if (showAlbums || cur.oid != vk.id) {
- 689. - if (cur.allAudiosIndex == 'all') {
- 690. - el = ge('audios_albums') || ge('album0');
- 691. - }
- 692. - hide(cur.audioFriends);
- 693. - show(cur.audioAlbums);
- 694. - Audio.updateAlbums();
- 695. - } else if (fromIndex == 2) {
- 696. - hide(cur.audioAlbums);
- 697. - hide(cur.audioFriends);
- 698. - cur.searchInfoCont.innerHTML = cur.performerInfo[cur.allAudiosIndex];
- 699. - show(cur.searchInfoCont);
- 700. - } else {
- 701. - hide(cur.audioAlbums);
- 702. - show(cur.audioFriends);
- 703. - hide(cur.searchInfoCont);
- 704. - if (cur.allAudiosIndex == 'all') {
- 705. - el = ge('album0');
- 706. - var curEl = geByClass1('current', ge('audio_friends_list'));
- 707. - if (curEl) removeClass(curEl, 'current');
- 708. - }
- 709. - }
- 710. - removeClass(cur.clearSearch, 'shown');
- 711. - removeClass(cur.albumFiltered, 'selected');
- 712. - hide(cur.searchFilters);
- 713. - if (!c && cur.allAudiosIndex == 'all' && cur.oid <= 0) addClass(cur.audioWrap, 'audio_no_recs');
- 714. - }
- 715. - if (el) addClass(el, 'selected');
- 716. - hide(cur.popularFilters, cur.popularOwners);
- 717. - cur.searchStr = str;
- 718. - this.searchAudios(str, cur.allAudiosIndex, force);
- 719. -
- 720. - scrollToTop();
- 721. - }).bind(this), fromIndex ? 0 :10);
- 722. - },
- 723. -
- 724. - selectPerformer: function(event, name) {
- 725. - cur.aSearch.setValue(name);
- 726. - cur.forceNoAutoComplete = true;
- 727. - if (event) {
- 728. - cur.searchTypeMenu.value = 1;
- 729. - cur.searchTypeChanged({target: {index: 1}}, true);
- 730. - }
- 731. - Audio.updateList(null, cur.aSearch);
- 732. - if (event) cancelEvent(event);
- 733. - },
- 734. -
- 735. - searchAudios: function(str, type, force) {
- 736. - cur.shownAudios = 0;
- 737. - cur.curSection = type;
- 738. - var clubList = (type && type.substr(0, 4) == 'club');
- 739. - if (!clubList && cur.searchSortFilter) {
- 740. - cur.searchSortFilter.disable(false);
- 741. - cur.searchLyricsFilter.disable(false);
- 742. - removeClass(cur.albumFiltered, 'club_shown');
- 743. - delete cur.club;
- 744. - }
- 745. - if (str) {
- 746. - var htmlentities = function(s){
- 747. - var el = document.createElement('div');
- 748. - el.innerText = el.textContent = s;
- 749. - s = el.innerHTML;
- 750. - delete el;
- 751. - return s.split('"').join('"');
- 752. - }
- 753. - var htmlencode = function(str){
- 754. - return str.toLowerCase().replace(/\u2013|\u2014/g, '-');
- 755. - var aStr = str.toLowerCase().replace(/\u2013|\u2014/g, '-').split(''), i = aStr.length, aRet = [];
- 756. - while (i--) {
- 757. - var iC = aStr[i].charCodeAt();
- 758. - if ((iC > 127 && iC < 994)) {
- 759. - aRet.push('&#'+iC+';');
- 760. - } else if (iC == 36) {
- 761. - aRet.push('�'+iC+';');
- 762. - } else {
- 763. - aRet.push(htmlentities(aStr[i]));
- 764. - }
- 765. - }
- 766. - return aRet.reverse().join('');
- 767. - }
- 768. - var res = cur.audiosIndex.search(htmlencode(str));
- 769. - var newList = cur.curSection;
- 770. - newList += '_search_'+str;
- 771. -
- 772. - cur.curList = newList;
- 773. - cur.audiosList[cur.curList] = res.sort(function(a,b) {return a._order - b._order});
- 774. - audioPlayer.genPlaylist(res, false);
- 775. -
- 776. - if (str) {
- 777. - str += ' '+(parseLatin(str) || '');
- 778. - str = trim(escapeRE(str.replace(/\)/g, '')).split('&').join('&'));
- 779. - cur.selection = {
- 780. - re: new RegExp('('+str.replace(cur.audiosIndex.delimiter, '|').replace(/(^\||\|$|\?)/g, '')+')', 'gi'),
- 781. - val: '<span>$1</span>'
- 782. - };
- 783. - }
- 784. - } else {
- 785. - if (!clubList) Audio.hideSearchResults();
- 786. - cur.curList = cur.curSection;
- 787. - audioPlayer.genPlaylist(cur.audiosList[cur.curList], false, cur.curList == 'all' && cur.oid == vk.id);
- 788. - cur.selection = false;
- 789. - }
- 790. -
- 791. - cur.sectionCount = (cur.audiosList[cur.curList]) ? cur.audiosList[cur.curList].length : 0;
- 792. - this.filterTimeout = setTimeout((function() {
- 793. - if (!force) {
- 794. - hide(cur.sShowMore);
- 795. - cur.searchOffset = 0;
- 796. - }
- 797. - this.showRows(null, null, force);
- 798. - if (cur.sectionCount || !cur.searchStr) {
- 799. - this.changeSummary();
- 800. - }
- 801. - if (cur.justShuffled) {
- 802. - delete cur.justShuffled;
- 803. - var aid = currentAudioId();
- 804. - if (cur.nextPlaylist && (!aid || window.audioPlaylist && !window.audioPlaylist[aid])) {
- 805. - window.audioPlaylist = clone(cur.nextPlaylist);
- 806. - }
- 807. - if (Pads.updateAudioPlaylist) {
- 808. - Pads.updateAudioPlaylist();
- 809. - }
- 810. - }
- 811. - }).bind(this), 10);
- 812. - },
- 813. -
- 814. - indexAll: function(callback) {
- 815. - var all = Audio.allAudios(),
- 816. - replacer = function(str, p) {
- 817. - var c = intval(p);
- 818. - return (c >= 33 && c < 48) ? String.fromCharCode(c) : str;
- 819. - };
- 820. -
- 821. - cur.audiosIndex = new vkIndexer(all, function(obj) {
- 822. - cur.audios[parseInt(obj[1])] = obj;
- 823. - return (obj[5]+' '+obj[6]).replace(/\&\#(\d+);?/gi, replacer);
- 824. - }, function() {
- 825. - if (callback) {
- 826. - callback();
- 827. - }
- 828. - });
- 829. - },
- 830. -
- 831. - changeAllIndex: function(index, albumSelected, showAlbums, owner) {
- 832. - if (!cur.audiosList[index]) return;
- 833. - cur.allAudiosIndex = cur.curList = index;
- 834. - this.indexAll(function() {
- 835. - var _a = window.audioPlayer;
- 836. - Audio.mixAllAudios(_a && _a.shuffle, true);
- 837. - audioPlayer.genPlaylist(cur.audiosList[cur.curList], false, index == 'all' && cur.oid == vk.id);
- 838. - each(geByTag('div', cur.albumFilters), function(i, e) {
- 839. - removeClass(e, 'loading');
- 840. - });
- 841. - cur.ignoreEqual = true;
- 842. -
- 843. - setStyle(cur.clearSearch, {opacity: .6});
- 844. - val(cur.aSearch, '');
- 845. - removeClass(cur.clearSearch, 'shown');
- 846. - cur.searchStr = '';
- 847. - Audio.hideSearchResults();
- 848. - if (albumSelected) {
- 849. - Audio.loadAlbum(albumSelected);
- 850. - } else {
- 851. - Audio.updateList(null, cur.aSearch, undefined, showAlbums, owner ? 2 : 1);
- 852. - }
- 853. - });
- 854. - },
- 855. -
- 856. - generateAlbums: function() {
- 857. - for (var i in cur.audiosList) {
- 858. - if (i.substr(0, 5) == 'album') cur.audiosList[i] = [];
- 859. - }
- 860. - var all = Audio.allAudios();
- 861. - for (var i in all) {
- 862. - var el = all[i];
- 863. - if (el[8] && parseInt(el[8])) {
- 864. - if (!cur.audiosList['album'+el[8]]) cur.audiosList['album'+el[8]] = [];
- 865. - cur.audiosList['album'+el[8]].push(el);
- 866. - }
- 867. - }
- 868. - },
- 869. -
- 870. - changeHTitle: function(count, from_search) {
- 871. - // Updating document title
- 872. - var htitle = cur.htitle;
- 873. - if (cur.curSection && !cur.curSection.indexOf('album')) {
- 874. - htitle = ge(cur.curSection).innerHTML;
- 875. - } else if (cur.curSection && cur.curSection == 'recommendations') {
- 876. - htitle = cur.recommendTitle ? cur.recommendTitle : getLang('audio_recommended_audios');
- 877. - } else if (cur.curSection && cur.curSection == 'popular') {
- 878. - htitle = cur.popularTitle ? cur.popularTitle : getLang('audio_popular_audios');
- 879. - } else if (cur.curSection && cur.curSection.indexOf('owner') === 0) {
- 880. - htitle = cur.allFriendsHTitles[cur.audioFriend];
- 881. - } else if (from_search) {
- 882. - htitle = getLang('audio_title_search').replace('{q}', val('s_search'));
- 883. - } else if (cur.curSection && !cur.curSection.indexOf('club')) {
- 884. - htitle = cur.allClubsHTitles[cur.club] || htitle;
- 885. - } else if (cur.audioFriend && cur.allAudiosIndex && !cur.allAudiosIndex.indexOf('friend')) {
- 886. - htitle = cur.allFriendsHTitles[cur.audioFriend];
- 887. - }
- 888. - if (count && cur.lang.audio_N_recs) {
- 889. - htitle += ' | ' + getLang('audio_N_recs', count);
- 890. - }
- 891. - document.title = replaceEntities(stripHTML(htitle));
- 892. - },
- 893. -
- 894. - changeSummary: function(from_search) {
- 895. - var count = (from_search) ? cur.searchCount : cur.sectionCount;
- 896. - Audio.changeHTitle(count, from_search);
- 897. - },
- 898. -
- 899. - setQLoc: function(query) {
- 900. - clearTimeout(this.qTimeout);
- 901. - this.qTimeout = setTimeout(function() {
- 902. - if (cur.allAudiosIndex != 'all') {
- 903. - if (cur.allAudiosIndex && cur.allAudiosIndex.substr(0, 5) == 'owner') {
- 904. - extend(nav.objLoc, {owner: cur.audioFriend});
- 905. - } else {
- 906. - extend(nav.objLoc, {friend: cur.audioFriend});
- 907. - }
- 908. - } else {
- 909. - delete nav.objLoc.owner;
- 910. - delete nav.objLoc.friend;
- 911. - }
- 912. - if (cur.curSection && cur.curSection.substr(0, 4) == 'club') {
- 913. - extend(nav.objLoc, {club: cur.club});
- 914. - } else {
- 915. - delete nav.objLoc.club;
- 916. - delete nav.objLoc.genre;
- 917. - }
- 918. - if (query) {
- 919. - extend(nav.objLoc, {q: query});
- 920. - var performer = cur.searchTypeMenu ? parseInt(cur.searchTypeMenu.val()) : 0;
- 921. - if (performer) {
- 922. - extend(nav.objLoc, {performer: performer});
- 923. - } else {
- 924. - delete nav.objLoc.performer;
- 925. - }
- 926. - } else {
- 927. - delete nav.objLoc.q;
- 928. - }
- 929. - nav.setLoc(nav.objLoc);
- 930. - }, 500);
- 931. - },
- 932. -
- 933. - filterClaimed: function(arr) {
- 934. - var len = arr.length;
- 935. - var res = [];
- 936. - for (var i = 0; i < len; i++) {
- 937. - var t = arr[i];
- 938. - if (t && (!(t[11] && parseInt(t[11])) || t[12] && parseInt(t[12])) || nav.objLoc.claim) {
- 939. - res.push(t);
- 940. - }
- 941. - }
- 942. - return res;
- 943. - },
- 944. -
- 945. - filterDeleted: function(arr) {
- 946. - var len = arr.length;
- 947. - var res = [];
- 948. - for (var i = 0; i < len; i++) {
- 949. - var t = arr[i];
- 950. - if (cur.audios && cur.audios[t[1]] && !cur.audios[t[1]].deleted) {
- 951. - res.push(t);
- 952. - }
- 953. - }
- 954. - return res;
- 955. - },
- 956. -
- 957. - filterByAlbum: function(arr, album) {
- 958. - var len = arr.length;
- 959. - var res = [];
- 960. - for (var i = 0; i < len; i++) {
- 961. - var t = arr[i];
- 962. - if (album == t[8]) {
- 963. - res.push(t);
- 964. - }
- 965. - }
- 966. - return res;
- 967. - },
- 968. -
- 969. - animateAdded: function(el, speed) {
- 970. - var c = se('<div class="audio_add_wrap anim fl_r"><div class="audio_add_anim_wrap"><div class="audio_add_anim clear_fix"><div class="audio_add fl_l"></div><div class="audio_add done fl_l"></div></div></div></div>');
- 971. - el.parentNode.replaceChild(c, el);
- 972. - el = c;
- 973. - setTimeout(function() {
- 974. - var anim = geByClass1('audio_add_anim', el), add = anim.firstChild, added = add.nextSibling;
- 975. - cssAnim(anim, {left: '-15px'}, {duration: speed}, function() {
- 976. - setStyle(anim.parentNode, {width: '15px'});
- 977. - setStyle(anim.parentNode.parentNode, {paddingLeft: '2px'});
- 978. - setStyle(anim, {left: '-13px'});
- 979. - });
- 980. - cssAnim(add, {opacity: 0}, {duration: speed});
- 981. - cssAnim(added, {opacity: 1}, {duration: speed});
- 982. - }, 0);
- 983. - return el;
- 984. - },
- 985. -
- 986. - addShareAudio: function(el, aid, oid, hash, gid, top) {
- 987. - if (el.tt) el.tt.hide();
- 988. - el = Audio.animateAdded(el, 200);
- 989. - var query = {act:'add', aid:aid, oid:oid, hash:hash, top:top};
- 990. - if (gid) query.gid = cur.gid;
- 991. - if (cur.curSection == 'recommendations') query.recommendation = 1;
- 992. - if ((cur.module == 'audio' || cur.module == 'feed') && nav.objLoc['q'] || cur.module == 'search' && nav.objLoc['c[q]']) query.search = 1;
- 993. - ajax.post(Audio.address, query, {
- 994. - onDone: function (data, res) {
- 995. - var obj = eval('('+data+')');
- 996. - if (((!cur.gid && cur.id == vk.id) || (cur.gid && gid)) && obj) {
- 997. - setTimeout(function(){
- 998. - obj = obj['all'][0];
- 999. - var all_list = cur.audiosList['all'];
- 1000. - if (all_list && all_list.length) {
- 1001. - obj._order = all_list[0]._order - 1;
- 1002. - cur.audiosList['all'].splice(0,0,obj);
- 1003. - } else {
- 1004. - obj._order = 0;
- 1005. - cur.audiosList['all'] = [obj];
- 1006. - }
- 1007. - cur.audios[obj[1]] = obj;
- 1008. - if (cur.allAudiosIndex == 'all') {
- 1009. - cur.audiosIndex.add(obj);
- 1010. - }
- 1011. - }, 0);
- 1012. - }
- 1013. - var showShare = function() {
- 1014. - addClass(ge('audio'+oid+'_'+aid), 'tt_shown');
- 1015. - showTooltip(el, {
- 1016. - content: res.content,
- 1017. - slide: 15,
- 1018. - shift: [59, 5, 0],
- 1019. - black: 1,
- 1020. - hidedt: 200,
- 1021. - className: 'audio_add_tt wall_tt rich',
- 1022. - onHide: function() {
- 1023. - removeClass(ge('audio'+oid+'_'+aid), 'tt_shown');
- 1024. - }
- 1025. - });
- 1026. - var tip = el.tt;
- 1027. - if (tip && !tip.inited) {
- 1028. - var a = geByClass('add_cont', tip.container)[0];
- 1029. - tip.onClean = function() {
- 1030. - tip.inited = false;
- 1031. - removeEvent(tip.container, 'mouseover', tip.show);
- 1032. - removeEvent(tip.container, 'mouseout', tip.hide);
- 1033. - }
- 1034. - addEvent(tip.container, 'mouseover', tip.show);
- 1035. - addEvent(tip.container, 'mouseout', tip.hide);
- 1036. - addEvent(a, 'click', function(){
- 1037. - toggleClass(this, 'on');
- 1038. - var share_q = {act: 'share_audio', audio:res.audio, status: tip.status? tip.status : 0, check: hasClass(a, 'on')?1:0, hash: res.hash};
- 1039. - if (gid) share_q.gid = cur.gid;
- 1040. - ajax.post(Audio.address, share_q, {
- 1041. - onDone: function(data) {
- 1042. - if (data) tip.status = data;
- 1043. - }
- 1044. - });
- 1045. - });
- 1046. - tip.inited = true;
- 1047. - }
- 1048. - }
- 1049. - addEvent(el, 'mouseover', showShare);
- 1050. - if (!cur.addedIds) cur.addedIds = {};
- 1051. - cur.addedIds[oid+'_'+aid] = 1;
- 1052. - if (window.audioPlayer && currentAudioId()) {
- 1053. - var cur_aids = currentAudioId().split('_');
- 1054. - if (cur_aids[0] == oid && cur_aids[1] == aid) {
- 1055. - audioPlayer.showCurrentAdded();
- 1056. - }
- 1057. - }
- 1058. - }
- 1059. - });
- 1060. - },
- 1061. -
- 1062. - alistOver: function(obj){
- 1063. - if (!hasClass(obj, 'audio_list_cell_on')) {
- 1064. - obj.className = 'audio_list_cell_over';
- 1065. - }
- 1066. - },
- 1067. -
- 1068. - alistOff: function(obj) {
- 1069. - if (!hasClass(obj, 'audio_list_cell_on')){
- 1070. - obj.className = 'audio_list_cell';
- 1071. - }
- 1072. - },
- 1073. -
- 1074. - listOut: function(obj) {
- 1075. - removeClass(obj, 'over');
- 1076. - },
- 1077. -
- 1078. - listOver: function(obj) {
- 1079. - addClass(obj, 'over');
- 1080. - },
- 1081. -
- 1082. - loadAlbum: function(album_id, filter, showAlbums) {
- 1083. - if (cur.silent) {
- 1084. - cur.onSilentLoad = function() {
- 1085. - Audio.loadAlbum(album_id, filter, showAlbums);
- 1086. - };
- 1087. - return;
- 1088. - }
- 1089. - if (!album_id && !showAlbums && (cur.oid == vk.id) && isVisible('audio_more_friends')) {
- 1090. - cur.shownFriends = [];
- 1091. - Audio.showMoreFriends(addClass.pbind(ge('album0'), 'loading'), removeClass.pbind(ge('album0'), 'loading'));
- 1092. - }
- 1093. - //if (cur.searchStr && isVisible(cur.searchInfoCont)) {
- 1094. - hide(cur.searchInfoCont);
- 1095. - //}
- 1096. - if (cur.allAudiosIndex != 'all') {
- 1097. - Audio.loadFriendsAudios(vk.id, 'all', album_id, showAlbums);
- 1098. - return;
- 1099. - }
- 1100. - if (!Audio.allAudios().length && cur.allAudiosIndex == 'all' && cur.oid <= 0) {
- 1101. - addClass(cur.audioWrap, 'audio_no_recs');
- 1102. - }
- 1103. - if (filter) {
- 1104. - cur.filterUnsorted = 1;
- 1105. - } else {
- 1106. - delete cur.filterUnsorted;
- 1107. - }
- 1108. - var curSel = cur.filterUnsorted ? ge('album_unsorted') : (showAlbums ? ge('audios_albums') : ge('album' + album_id));
- 1109. - cur.lastAct = 'album' + album_id;
- 1110. - album_id = album_id || 0;
- 1111. - each(geByClass('audio_filter', cur.albumFilters), function(i, e) {
- 1112. - removeClass(e, 'selected');
- 1113. - });
- 1114. - if (curSel) addClass(curSel, 'selected');
- 1115. - removeClass(cur.albumFiltered, 'selected');
- 1116. - hide(cur.popularFilters, cur.popularOwners, cur.searchFilters);
- 1117. - if (album_id == 0 && !showAlbums && (cur.oid == vk.id)) {
- 1118. - hide(cur.audioAlbums);
- 1119. - show(cur.audioFriends);
- 1120. - var curEl = geByClass1('current', ge('audio_friends_list'));
- 1121. - if (curEl) removeClass(curEl, 'current');
- 1122. - } else {
- 1123. - hide(cur.audioFriends);
- 1124. - show(cur.audioAlbums);
- 1125. - }
- 1126. - if (showAlbums && !filter && !album_id) {
- 1127. - Audio.updateAlbums();
- 1128. - }
- 1129. - delete nav.objLoc.q;
- 1130. - delete nav.objLoc.owner;
- 1131. - delete nav.objLoc.friend;
- 1132. - delete cur.recsOffset;
- 1133. - delete cur.popularOffset;
- 1134. - delete nav.objLoc.club;
- 1135. - delete nav.objLoc.genre;
- 1136. - delete nav.objLoc.audio_id;
- 1137. - delete cur._back;
- 1138. - if (nav.objLoc.act == 'recommendations' || nav.objLoc.act == 'popular' || nav.objLoc.act == 'feed' || nav.objLoc.act == 'albums') delete nav.objLoc.act;
- 1139. - if (album_id) {
- 1140. - extend(nav.objLoc, {album_id: album_id});
- 1141. - } else if (showAlbums) {
- 1142. - extend(nav.objLoc, {act: 'albums'});
- 1143. - } else {
- 1144. - delete nav.objLoc.album_id;
- 1145. - }
- 1146. - nav.setLoc(nav.objLoc);
- 1147. - clearTimeout(this.filterTimeout);
- 1148. - this.filterTimeout = setTimeout((function() {
- 1149. - val(cur.aSearch, '');
- 1150. - removeClass(cur.clearSearch, 'shown');
- 1151. - cur.searchStr = '';
- 1152. - cur.album_id = album_id;
- 1153. - var type = (album_id) ? 'album'+album_id : cur.allAudiosIndex;
- 1154. - this.searchAudios('', type);
- 1155. - this.hideSearchResults();
- 1156. - scrollToTop();
- 1157. - }).bind(this), 10);
- 1158. - if (cur.oid == vk.id) {
- 1159. - ajax.post(Audio.address, {act: 'list_stats', albums: (album_id || showAlbums) ? 1 : 0});
- 1160. - }
- 1161. - },
- 1162. -
- 1163. - addAudio: function(params, event) {
- 1164. - if (cur.uploadBanned) {
- 1165. - setTimeout(showFastBox(getLang('audio_no_upload_title'), getLang('audio_claims_no_upload')).hide, 5000);
- 1166. - if (event) cancelEvent(event);
- 1167. - return false;
- 1168. - }
- 1169. - showBox(Audio.address, extend(params || {}, {act: 'new_audio', gid: cur.gid}), {
- 1170. - params: {width: '440px', bodyStyle: 'padding: 0px; position: relative;'}
- 1171. - });
- 1172. - if (event) cancelEvent(event);
- 1173. - return false;
- 1174. - },
- 1175. -
- 1176. - mixAllAudios: function(mix, noShuffle) {
- 1177. - var all_list = Audio.allAudios(), _a = window.audioPlayer, current = 0;
- 1178. - if (!all_list) return;
- 1179. - if (mix) {
- 1180. - if (all_list[0] && all_list[0]._old_order !== undefined) return;
- 1181. - for (var i = all_list.length; i; ) {
- 1182. - var j = parseInt(Math.random() * i)
- 1183. - var x = all_list[--i];
- 1184. - all_list[i] = all_list[j];
- 1185. - all_list[i]._old_order = all_list[i]._order;
- 1186. - all_list[i]._order = i;
- 1187. - if (currentAudioId() == all_list[i][0]+'_'+all_list[i][1]) {
- 1188. - current = i;
- 1189. - }
- 1190. - all_list[j] = x;
- 1191. - };
- 1192. - if (current) {
- 1193. - var x = all_list[current];
- 1194. - all_list[current] = all_list[0];
- 1195. - all_list[current]._order = current;
- 1196. - all_list[0] = x;
- 1197. - all_list[0]._order = 0;
- 1198. - }
- 1199. - } else {
- 1200. - for (var i in all_list) {
- 1201. - if (all_list[i]._old_order !== undefined) {
- 1202. - all_list[i]._order = all_list[i]._old_order;
- 1203. - delete all_list[i]._old_order;
- 1204. - }
- 1205. - };
- 1206. - }
- 1207. - if (!noShuffle) cur.justShuffled = true;
- 1208. - },
- 1209. - mixAudios: function() {
- 1210. - if (cur.curSection == 'recommendations') {
- 1211. - Audio.loadRecommendations({update: 'remix'});
- 1212. - return;
- 1213. - }
- 1214. - if (cur.curSection == 'popular') {
- 1215. - Audio.loadPopular('remix');
- 1216. - return;
- 1217. - }
- 1218. - if (cur.silent) {
- 1219. - cur.onSilentLoad = function() {
- 1220. - Audio.mixAudios();
- 1221. - };
- 1222. - return;
- 1223. - }
- 1224. - var _a = window.audioPlayer;
- 1225. - Audio.mixAllAudios(_a && _a.shuffle);
- 1226. - cur.ignoreEqual = true;
- 1227. - if (cur.album_id) {
- 1228. - this.loadAlbum(cur.album_id);
- 1229. - } else {
- 1230. - this.updateList(null, cur.aSearch, undefined, nav.objLoc.act == 'albums');
- 1231. - }
- 1232. - cur.shuffled = _a && _a.shuffle;
- 1233. - },
- 1234. -
- 1235. - loadRecommendations: function(opts) {
- 1236. - if (cur.loadingRecs) return;
- 1237. - opts = opts || {};
- 1238. - var update = opts.update, audioId = opts.audioId;
- 1239. - if (update) {
- 1240. - delete cur.recsOffset;
- 1241. - delete cur.recommendIds;
- 1242. - delete cur.recommendAudios;
- 1243. - delete cur.preloadJSON;
- 1244. - }
- 1245. - if (audioId) {
- 1246. - cur.recsAudioId = audioId;
- 1247. - } else if (update === true) {
- 1248. - delete cur.recsAudioId;
- 1249. - }
- 1250. - each(geByClass('audio_filter', cur.albumFilters), function(i, e) {
- 1251. - removeClass(e, 'selected');
- 1252. - });
- 1253. - if (cur.searchStr && isVisible(cur.searchInfoCont)) {
- 1254. - hide(cur.searchInfoCont);
- 1255. - }
- 1256. - var rec_filter = ge('recommendations');
- 1257. - addClass(rec_filter, 'selected');
- 1258. - removeClass(cur.albumFiltered, 'selected');
- 1259. - hide(cur.searchFilters, cur.popularFilters);
- 1260. - if (cur.oid == vk.id) {
- 1261. - hide(cur.audioFriends, cur.audioAlbums);
- 1262. - hide(cur.searchInfoCont);
- 1263. - }
- 1264. - removeClass(cur.albumFiltered, 'club_shown');
- 1265. - Audio.handleFilterPos();
- 1266. - cur.lastSection = cur.curSection;
- 1267. - cur.curSection = 'recommendations';
- 1268. - if (cur.recsOffset === undefined) {
- 1269. - cur.recsOffset = 0;
- 1270. - } else {
- 1271. - addClass(cur.showMore, 'loading');
- 1272. - }
- 1273. - if (cur.recommendIds === undefined) cur.recommendIds = [];
- 1274. - if (cur.recommendAudios === undefined) cur.recommendAudios = [];
- 1275. - if (cur.recsCount === undefined) cur.recsCount = 0;
- 1276. - if (cur.sPreload.innerHTML) {
- 1277. - while (cur.sPreload.firstChild) {
- 1278. - var el = cur.sPreload.firstChild;
- 1279. - cur.aContent.appendChild(el);
- 1280. - cur.recsCount++;
- 1281. - }
- 1282. - }
- 1283. - if (cur.preloadJSON) {
- 1284. - json = cur.preloadJSON['all'];
- 1285. - var cur_order = cur.recsCount;
- 1286. - for (var i in json) {
- 1287. - var audio = json[i];
- 1288. - audio._order = cur_order++;
- 1289. - if (indexOf(cur.recommendIds, audio[0]+"_"+audio[1]) == -1) {
- 1290. - cur.recommendIds.push(audio[0]+"_"+audio[1]);
- 1291. - cur.recommendAudios.push(audio);
- 1292. - }
- 1293. - }
- 1294. - var aid = currentAudioId(), needs_update = (aid && cur.recommendIds && indexOf(cur.recommendIds, aid) != -1);
- 1295. - audioPlayer.genPlaylist(cur.recommendAudios, needs_update);
- 1296. - }
- 1297. - if (cur.noRecommendations) {
- 1298. - hide(cur.showMore);
- 1299. - delete cur.noRecommendations;
- 1300. - return;
- 1301. - }
- 1302. - if (opts.tt) {
- 1303. - opts.tt.hide();
- 1304. - }
- 1305. - cur.loadingRecs = true;
- 1306. - cur.lastAct = 'recommendations';
- 1307. - var offset = cur.recsOffset, query = {act: 'get_recommendations', id: cur.id, offset: offset},
- 1308. - needsUpdate = window.audioPlayer && audioPlayer.shuffle;
- 1309. - if (update == 'remix' || needsUpdate != cur.recsRemix) {
- 1310. - cur.recsRemix = needsUpdate;
- 1311. - query.remix = needsUpdate ? 1 : 0;
- 1312. - var aid = currentAudioId();
- 1313. - if (aid && window.audioPlaylist && audioPlaylist[aid] && audioPlaylist.address && audioPlaylist.address.indexOf('act=recommendations') > 0) {
- 1314. - var a = audioPlaylist[aid];
- 1315. - if (a[10]) query.current = a[10]+' '+aid;
- 1316. - }
- 1317. - }
- 1318. - if (cur.recsAudioId) {
- 1319. - query.audio_id = cur.recsAudioId;
- 1320. - }
- 1321. - ajax.post(Audio.address, query, {
- 1322. - onDone: function(rows, preload, json, preload_json, options, ownersRows) {
- 1323. - delete cur.loadingRecs;
- 1324. - if (cur.lastAct != 'recommendations') return;
- 1325. - if (!offset) {
- 1326. - if (ownersRows) {
- 1327. - val('audio_popular_owners_rows', ownersRows);
- 1328. - show(cur.popularOwners);
- 1329. - } else {
- 1330. - hide(cur.popularOwners);
- 1331. - }
- 1332. - }
- 1333. - if (options.recsCount === 0 && offset) {
- 1334. - cur.noRecommendations = true;
- 1335. - delete options.recsOffset;
- 1336. - }
- 1337. - if (json) {
- 1338. - json = eval('('+json+')');
- 1339. - json = json['all'];
- 1340. - var cur_order = cur.recsCount;
- 1341. - for (var i in json) {
- 1342. - var audio = json[i];
- 1343. - audio._order = cur_order++;
- 1344. - if (indexOf(cur.recommendIds, audio[0]+"_"+audio[1]) == -1) {
- 1345. - cur.recommendIds.push(audio[0]+"_"+audio[1]);
- 1346. - cur.recommendAudios.push(audio);
- 1347. - }
- 1348. - }
- 1349. - var aid = currentAudioId(), needs_update = (aid && cur.recommendIds && indexOf(cur.recommendIds, aid) != -1);
- 1350. - audioPlayer.genPlaylist(cur.recommendAudios, needs_update);
- 1351. - if (query.audio_id) {
- 1352. - cur.nextPlaylist.rec = 1;
- 1353. - }
- 1354. - }
- 1355. - removeClass(cur.showMore, 'loading');
- 1356. - if (offset) {
- 1357. - delete options.recsCount;
- 1358. - }
- 1359. - if (options) extend(cur, options);
- 1360. - if (!offset) {
- 1361. - cur.aContent.innerHTML = rows;
- 1362. - }
- 1363. -
- 1364. - cur.preloadJSON = preload_json ? eval('('+preload_json+')') : false;
- 1365. - cur.sPreload.innerHTML = '';
- 1366. - var au = ce('div', {innerHTML: preload});
- 1367. - while (au.firstChild) {
- 1368. - if (!ge(au.firstChild.id)) {
- 1369. - var el = au.firstChild;
- 1370. - cur.sPreload.appendChild(el);
- 1371. - } else {
- 1372. - au.removeChild(au.firstChild);
- 1373. - }
- 1374. - }
- 1375. -
- 1376. - if (cur.recsCount && !query.audio_id) {
- 1377. - show(cur.showMore);
- 1378. - } else {
- 1379. - hide(cur.showMore);
- 1380. - }
- 1381. - if (query.remix) {
- 1382. - cur.justShuffled = true;
- 1383. - }
- 1384. - Audio.changeHTitle();
- 1385. - val(cur.aSearch, '');
- 1386. - removeClass(cur.clearSearch, 'shown');
- 1387. - cur.searchStr = '';
- 1388. - cur.album_id = 0;
- 1389. - Audio.hideSearchResults();
- 1390. - hide(cur.sShowMore);
- 1391. - if (!offset) scrollToTop();
- 1392. - delete nav.objLoc.q;
- 1393. - delete nav.objLoc.owner;
- 1394. - delete nav.objLoc.friend;
- 1395. - delete nav.objLoc.album_id;
- 1396. - delete nav.objLoc.club;
- 1397. - delete nav.objLoc.genre;
- 1398. - delete cur._back;
- 1399. - extend(nav.objLoc, {act: 'recommendations'});
- 1400. - if (query.audio_id) {
- 1401. - extend(nav.objLoc, {audio_id: query.audio_id});
- 1402. - } else {
- 1403. - delete nav.objLoc.audio_id;
- 1404. - }
- 1405. - nav.setLoc(nav.objLoc);
- 1406. - var _a = window.audioPlayer;
- 1407. - if (_a && _a.showCurrentTrack) _a.showCurrentTrack();
- 1408. - if (window.Pads && Pads.updateAudioPlaylist) {
- 1409. - Pads.updateAudioPlaylist();
- 1410. - }
- 1411. - },
- 1412. - onFail: function(msg) {
- 1413. - delete cur.loadingRecs;
- 1414. - cur.curSection = cur.lastSection;
- 1415. - removeClass(ge('recommendations'), 'selected');
- 1416. - setTimeout(showFastBox(getLang('global_error'), msg).hide, 3000);
- 1417. - return true;
- 1418. - },
- 1419. - showProgress: function () {
- 1420. - addClass(rec_filter, 'loading');
- 1421. - },
- 1422. - hideProgress: function () {
- 1423. - removeClass(rec_filter, 'loading');
- 1424. - }
- 1425. - });
- 1426. - cur.recsOffset += offset ? 50 : 100;
- 1427. - },
- 1428. -
- 1429. - loadPopular: function(update, genre) {
- 1430. - if (cur.silent) {
- 1431. - cur.onSilentLoad = function() {
- 1432. - Audio.loadPopular(update, genre);
- 1433. - };
- 1434. - return;
- 1435. - }
- 1436. - if (cur.loadingPopular) return;
- 1437. - if (cur.popularAudios === undefined) {
- 1438. - cur.popularAudios = [];
- 1439. - }
- 1440. - if (update) {
- 1441. - delete cur.popularOffset;
- 1442. - delete cur.popularIds;
- 1443. - delete cur.popularAudios[genre];
- 1444. - delete cur.preloadJSON;
- 1445. - if (genre !== undefined) {
- 1446. - cur.genre = genre;
- 1447. - }
- 1448. - }
- 1449. - each(geByClass('audio_filter', cur.albumFilters), function(i, e) {
- 1450. - removeClass(e, 'selected');
- 1451. - });
- 1452. - if (cur.searchStr && isVisible(cur.searchInfoCont)) {
- 1453. - hide(cur.searchInfoCont);
- 1454. - }
- 1455. - var genre_filter = false;
- 1456. - if (cur.genre) {
- 1457. - var prevGenre = geByClass1('selected', ge('audio_genres'));
- 1458. - if (prevGenre) {
- 1459. - removeClass(prevGenre, 'selected');
- 1460. - }
- 1461. -
- 1462. - genre_filter = ge('audio_genre_'+cur.genre);
- 1463. - if (genre_filter) {
- 1464. - addClass(genre_filter, 'selected');
- 1465. - } else {
- 1466. - cur.genre = 0;
- 1467. - }
- 1468. - }
- 1469. - var pop_filter = ge('top_audios');
- 1470. - addClass(pop_filter, 'selected');
- 1471. - removeClass(cur.albumFiltered, 'selected');
- 1472. - toggle(cur.audioFriends, false);
- 1473. - hide(cur.searchInfoCont);
- 1474. - if (cur.popularFilters) {
- 1475. - show(cur.popularFilters);
- 1476. - hide(cur.audioAlbums);
- 1477. - } else {
- 1478. - show(cur.audioAlbums);
- 1479. - Audio.updateAlbums();
- 1480. - }
- 1481. - removeClass(cur.albumFiltered, 'club_shown');
- 1482. - hide(cur.searchFilters, cur.popularOwners);
- 1483. - Audio.handleFilterPos();
- 1484. - cur.curSection = 'popular';
- 1485. - if (cur.popularOffset === undefined) {
- 1486. - cur.popularOffset = 0;
- 1487. - } else {
- 1488. - addClass(cur.showMore, 'loading');
- 1489. - }
- 1490. - if (cur.popularIds === undefined) cur.popularIds = [];
- 1491. - if (cur.popularAudios[genre] === undefined) cur.popularAudios[genre] = [];
- 1492. - if (cur.popularCount === undefined) cur.popularCount = 0;
- 1493. - if (cur.sPreload.innerHTML) {
- 1494. - while (cur.sPreload.firstChild) {
- 1495. - var el = cur.sPreload.firstChild;
- 1496. - cur.aContent.appendChild(el);
- 1497. - cur.popularCount++;
- 1498. - }
- 1499. - }
- 1500. - if (cur.preloadJSON) {
- 1501. - json = cur.preloadJSON['all'];
- 1502. - var cur_order = cur.popularCount;
- 1503. - for (var i in json) {
- 1504. - var audio = json[i];
- 1505. - audio._order = cur_order++;
- 1506. - if (indexOf(cur.popularIds, audio[0]+"_"+audio[1]) == -1) {
- 1507. - cur.popularIds.push(audio[0]+"_"+audio[1]);
- 1508. - cur.popularAudios[genre].push(audio);
- 1509. - }
- 1510. - }
- 1511. - var aid = currentAudioId(), needs_update = (aid && cur.popularIds && indexOf(cur.popularIds, aid) != -1);
- 1512. - audioPlayer.genPlaylist(cur.popularAudios[genre], needs_update);
- 1513. - }
- 1514. - if (cur.noPopular) {
- 1515. - hide(cur.showMore);
- 1516. - delete cur.noPopular;
- 1517. - return;
- 1518. - }
- 1519. - cur.loadingPopular = true;
- 1520. - cur.lastAct = 'popular';
- 1521. - var offset = cur.popularOffset, query = {act: 'get_popular', offset: offset},
- 1522. - needsUpdate = window.audioPlayer && audioPlayer.shuffle;
- 1523. - if (nav.objLoc.update) {
- 1524. - query.update = 1;
- 1525. - }
- 1526. - if (needsUpdate && !offset) query.offset = -1;
- 1527. - if (update == 'remix' || needsUpdate != cur.popRemix) {
- 1528. - cur.popRemix = needsUpdate;
- 1529. - query.remix = needsUpdate ? 1 : 0;
- 1530. - var aid = currentAudioId();
- 1531. - if (aid && window.audioPlaylist && audioPlaylist[aid] && audioPlaylist.address && audioPlaylist.address.indexOf('act=popular') > 0) {
- 1532. - query.current = aid;
- 1533. - }
- 1534. - }
- 1535. - if (cur.topType !== undefined) {
- 1536. - query.type = cur.topType;
- 1537. - delete cur.topType;
- 1538. - }
- 1539. - if (cur.genre) {
- 1540. - query.genre = cur.genre;
- 1541. - }
- 1542. - ajax.post(Audio.address, query, {
- 1543. - onDone: function(rows, preload, json, preload_json, options, genres) {
- 1544. - delete cur.loadingPopular;
- 1545. - if (cur.lastAct != 'popular') return;
- 1546. - if (options.popularCount === 0 && offset) {
- 1547. - cur.noPopular = true;
- 1548. - delete options.popularOffset;
- 1549. - }
- 1550. - if (json) {
- 1551. - json = eval('('+json+')');
- 1552. - json = json['all'];
- 1553. - var cur_order = cur.popularCount;
- 1554. - for (var i in json) {
- 1555. - var audio = json[i];
- 1556. - audio._order = cur_order++;
- 1557. - if (indexOf(cur.popularIds, audio[0]+"_"+audio[1]) == -1) {
- 1558. - cur.popularIds.push(audio[0]+"_"+audio[1]);
- 1559. - cur.popularAudios[genre].push(audio);
- 1560. - }
- 1561. - }
- 1562. - var aid = currentAudioId(), needs_update = (aid && cur.popularIds && indexOf(cur.popularIds, aid) != -1);
- 1563. - audioPlayer.genPlaylist(cur.popularAudios[genre], needs_update);
- 1564. - }
- 1565. - removeClass(cur.showMore, 'loading');
- 1566. - if (offset) {
- 1567. - delete options.popularCount;
- 1568. - }
- 1569. - if (options) extend(cur, options);
- 1570. - if (!offset) {
- 1571. - cur.aContent.innerHTML = rows;
- 1572. - }
- 1573. -
- 1574. - if (preload_json) {
- 1575. - cur.preloadJSON = eval('('+preload_json+')');
- 1576. - } else {
- 1577. - cur.preloadJSON = {};
- 1578. - }
- 1579. - cur.sPreload.innerHTML = '';
- 1580. - var au = ce('div', {innerHTML: preload});
- 1581. - while (au.firstChild) {
- 1582. - if (!ge(au.firstChild.id)) {
- 1583. - var el = au.firstChild;
- 1584. - cur.sPreload.appendChild(el);
- 1585. - } else {
- 1586. - au.removeChild(au.firstChild);
- 1587. - }
- 1588. - }
- 1589. -
- 1590. - if (cur.popularCount) {
- 1591. - show(cur.showMore);
- 1592. - } else {
- 1593. - hide(cur.showMore);
- 1594. - }
- 1595. - if (update == 'remix') {
- 1596. - cur.justShuffled = true;
- 1597. - }
- 1598. - if (genres) {
- 1599. - ge('audio_genres').innerHTML = genres;
- 1600. - }
- 1601. - Audio.changeHTitle();
- 1602. - val(cur.aSearch, '');
- 1603. - removeClass(cur.clearSearch, 'shown');
- 1604. - cur.searchStr = '';
- 1605. - cur.album_id = 0;
- 1606. - Audio.hideSearchResults();
- 1607. - hide(cur.sShowMore);
- 1608. - if (!offset) scrollToTop();
- 1609. - delete nav.objLoc.q;
- 1610. - delete nav.objLoc.owner;
- 1611. - delete nav.objLoc.friend;
- 1612. - delete nav.objLoc.album_id;
- 1613. - delete nav.objLoc.club;
- 1614. - delete nav.objLoc.genre;
- 1615. - delete nav.objLoc.audio_id;
- 1616. - nav.objLoc.act = 'popular';
- 1617. - if (cur.genre) {
- 1618. - nav.objLoc.genre = cur.genre;
- 1619. - } else {
- 1620. - delete nav.objLoc.genre;
- 1621. - }
- 1622. - nav.setLoc(nav.objLoc);
- 1623. - var _a = window.audioPlayer;
- 1624. - if (_a && _a.showCurrentTrack) _a.showCurrentTrack();
- 1625. - if (window.tooltips) {
- 1626. - tooltips.destroyAll();
- 1627. - }
- 1628. - if (window.Pads && Pads.updateAudioPlaylist) {
- 1629. - Pads.updateAudioPlaylist();
- 1630. - }
- 1631. - if (options.infoJS) {
- 1632. - eval('(function(){' + options.infoJS + ';})()');
- 1633. - }
- 1634. - },
- 1635. - showProgress: function () {
- 1636. - addClass(genre_filter || pop_filter, 'loading');
- 1637. - },
- 1638. - hideProgress: function () {
- 1639. - removeClass(genre_filter || pop_filter, 'loading');
- 1640. - }
- 1641. - });
- 1642. - cur.popularOffset += offset ? 50 : 100;
- 1643. - },
- 1644. -
- 1645. - loadFeed: function(update) {
- 1646. - if (cur.silent) {
- 1647. - cur.onSilentLoad = function() {
- 1648. - Audio.loadFeed(update);
- 1649. - };
- 1650. - return;
- 1651. - }
- 1652. - if (cur.isFeedLoading) return;
- 1653. - cur.isFeedLoading = true;
- 1654. - if (cur.audiosList['all'] && cur.allAudiosIndex != 'all') {
- 1655. - cur.allAudiosIndex = 'all';
- 1656. - this.indexAll();
- 1657. - var curEl = geByClass1('current', ge('audio_friends_list'));
- 1658. - if (curEl) removeClass(curEl, 'current');
- 1659. - }
- 1660. - if (update) {
- 1661. - delete cur.feedFrom;
- 1662. - delete cur.feedOffset;
- 1663. - delete cur.feedIds;
- 1664. - delete cur.feedAudios;
- 1665. - if (update === 'reload') {
- 1666. - var params = {act: 'feed', part: 1, update: 1}, q = Audio.address + '#' + ajx2q(params);
- 1667. - delete window.ajaxCache[q];
- 1668. - }
- 1669. - }
- 1670. - each(geByClass('audio_filter', cur.albumFilters), function(i, e) {
- 1671. - removeClass(e, 'selected');
- 1672. - });
- 1673. - if (cur.searchStr && isVisible(cur.searchInfoCont)) {
- 1674. - hide(cur.searchInfoCont);
- 1675. - }
- 1676. - var feed_filter = ge('feed_filter');
- 1677. - addClass(feed_filter, 'selected');
- 1678. - removeClass(cur.albumFiltered, 'selected');
- 1679. - hide(cur.searchFilters, cur.popularFilters, cur.popularOwners);
- 1680. - if (cur.oid == vk.id) {
- 1681. - show(cur.audioFriends);
- 1682. - hide(cur.searchInfoCont);
- 1683. - hide(cur.audioAlbums);
- 1684. - }
- 1685. - removeClass(cur.albumFiltered, 'club_shown');
- 1686. - Audio.handleFilterPos();
- 1687. - cur.lastSection = cur.curSection;
- 1688. - cur.curSection = 'feed';
- 1689. - if (!update) {
- 1690. - addClass(cur.showMore, 'loading');
- 1691. - }
- 1692. - cur.lastAct = 'feed';
- 1693. - ajax.post(Audio.address, {act: 'feed', offset: cur.feedOffset, from: cur.feedFrom, part: 1, update: update ? 1 : ''}, {
- 1694. - onDone: function (rows, script) {
- 1695. - if (cur.lastAct != 'feed') return;
- 1696. - if (rows) {
- 1697. - if (update) {
- 1698. - cur.aContent.innerHTML = rows;
- 1699. - } else {
- 1700. - var au = ce('div'), par = geByClass1('wall_module', cur.aContent), row;
- 1701. - au.innerHTML = rows;
- 1702. - if (par && update) {
- 1703. - par.innerHTML = '';
- 1704. - }
- 1705. - while (row = au.firstChild) {
- 1706. - if (!row.id || ge(row.id)) {
- 1707. - au.removeChild(row);
- 1708. - continue;
- 1709. - }
- 1710. - if (par) {
- 1711. - par.appendChild(row);
- 1712. - }
- 1713. - }
- 1714. - }
- 1715. - } else {
- 1716. - hide(cur.showMore);
- 1717. - }
- 1718. - if (script) {
- 1719. - eval(script);
- 1720. - }
- 1721. - var aid = currentAudioId(), needs_update = (aid && cur.feedIds && indexOf(cur.feedIds, aid) != -1);
- 1722. - audioPlayer.genPlaylist(cur.feedAudios, needs_update);
- 1723. - removeClass(cur.showMore, 'loading');
- 1724. - Audio.changeHTitle();
- 1725. - val(cur.aSearch, '');
- 1726. - removeClass(cur.clearSearch, 'shown');
- 1727. - cur.searchStr = '';
- 1728. - cur.album_id = 0;
- 1729. - Audio.hideSearchResults();
- 1730. - hide(cur.sShowMore);
- 1731. - if (update) scrollToTop();
- 1732. - delete nav.objLoc.q;
- 1733. - delete nav.objLoc.owner;
- 1734. - delete nav.objLoc.friend;
- 1735. - delete nav.objLoc.album_id;
- 1736. - delete nav.objLoc.club;
- 1737. - delete nav.objLoc.genre;
- 1738. - delete nav.objLoc.audio_id;
- 1739. - delete cur._back;
- 1740. - extend(nav.objLoc, {act: 'feed'});
- 1741. - nav.setLoc(nav.objLoc);
- 1742. - var _a = window.audioPlayer;
- 1743. - if (_a && _a.showCurrentTrack) _a.showCurrentTrack();
- 1744. - },
- 1745. - showProgress: function () {
- 1746. - cur.isFeedLoading = true;
- 1747. - addClass(feed_filter, 'loading');
- 1748. - },
- 1749. - hideProgress: function () {
- 1750. - cur.isFeedLoading = false;
- 1751. - removeClass(feed_filter, 'loading');
- 1752. - },
- 1753. - cache: 1
- 1754. - });
- 1755. - },
- 1756. -
- 1757. - reorderPlaylist: function(aid, before_id, after_id) {
- 1758. - each([window.audioPlaylist, cur.nextPlaylist], function(i, e) {
- 1759. - var list = e;
- 1760. - if (before_id && !after_id && list && list[before_id]) {
- 1761. - after_id = list[before_id]._prev;
- 1762. - }
- 1763. - if (list && list[aid] && after_id && list[after_id] && after_id != aid) {
- 1764. - var next_id = list[aid]._next, prev_id = list[aid]._prev;
- 1765. - if (next_id != aid) {
- 1766. - list[next_id]._prev = prev_id;
- 1767. - list[prev_id]._next = next_id;
- 1768. - list[aid]._prev = after_id;
- 1769. - list[aid]._next = list[after_id]._next;
- 1770. - list[after_id]._next = list[list[after_id]._next]._prev = aid;
- 1771. - }
- 1772. - }
- 1773. - });
- 1774. - var plist = ls.get('pad_playlist');
- 1775. - if (plist && plist[aid] && after_id && plist[after_id] && after_id != aid && window.audioPlayer) {
- 1776. - audioPlayer.setPadPlaylist();
- 1777. - }
- 1778. - },
- 1779. -
- 1780. - removeFromPlaylist: function(aid) {
- 1781. - each([window.audioPlaylist, cur.nextPlaylist], function(i, e) {
- 1782. - var list = e;
- 1783. - if (list && list[aid]) {
- 1784. - var next_id = list[aid]._next, prev_id = list[aid]._prev;
- 1785. - if (next_id != aid) {
- 1786. - // delete list[aid];
- 1787. - list[next_id]._prev = prev_id;
- 1788. - list[prev_id]._next = next_id;
- 1789. - }
- 1790. - }
- 1791. - });
- 1792. - var plist = ls.get('pad_playlist');
- 1793. - if (plist && plist[aid] && window.audioPlayer) {
- 1794. - audioPlayer.setPadPlaylist();
- 1795. - }
- 1796. - },
- 1797. -
- 1798. - backToPlaylist: function(aid) {
- 1799. - each([window.audioPlaylist, cur.nextPlaylist], function(i, e) {
- 1800. - var list = e;
- 1801. - if (list && list[aid]) {
- 1802. - var next_id = list[aid]._next, prev_id = list[aid]._prev;
- 1803. - if (next_id != aid) {
- 1804. - list[next_id]._prev = list[prev_id]._next = aid;
- 1805. - }
- 1806. - }
- 1807. - });
- 1808. - var plist = ls.get('pad_playlist');
- 1809. - if (plist && plist[aid] && window.audioPlayer) {
- 1810. - audioPlayer.setPadPlaylist();
- 1811. - }
- 1812. - },
- 1813. -
- 1814. - hideRecommendation: function(aid, q, hash, event) {
- 1815. - if (window.audioPlayer && currentAudioId() == aid) {
- 1816. - audioPlayer.nextTrack(true);
- 1817. - }
- 1818. - var recRow = ge('audio'+aid);
- 1819. - if (recRow) {
- 1820. - if (window.tooltips) {
- 1821. - tooltips.hide(ge('remove'+aid))
- 1822. - }
- 1823. - slideUp(recRow, 200, function() {
- 1824. - recRow.parentNode.removeChild(recRow);
- 1825. - Audio.removeFromPlaylist(aid);
- 1826. - cur.recsCount--;
- 1827. - Audio.changeHTitle();
- 1828. - });
- 1829. - }
- 1830. - ajax.post(Audio.address, {act: 'hide_recommendation', q: q, hash: hash});
- 1831. - if (event) cancelEvent(event);
- 1832. - return false;
- 1833. - },
- 1834. -
- 1835. - _animDelX: function(el, opacity, set_active) {
- 1836. - if (!el) return;
- 1837. - if (set_active !== undefined) {
- 1838. - el.active = set_active;
- 1839. - } else if (el.active) {
- 1840. - return;
- 1841. - }
- 1842. - animate(el, {opacity: opacity}, 200);
- 1843. - },
- 1844. -
- 1845. - rowActive: function(el, tt, sh) {
- 1846. - Audio._animDelX(el, 1, 1);
- 1847. - if (tt) showTooltip(el, {text: tt, showdt: 0, black: 1, shift: (sh ? sh : [12, 4, 0])});
- 1848. - },
- 1849. - rowInactive: function(el, light) {
- 1850. - var opacity = light ? 0.6 : 0.4;
- 1851. - Audio._animDelX(el, opacity, 0);
- 1852. - },
- 1853. -
- 1854. - switchToFriends: function() {
- 1855. - each(geByClass('audio_filter', cur.albumFilters), function(i, e) {
- 1856. - removeClass(e, 'selected');
- 1857. - });
- 1858. - addClass(ge('friends_audios'), 'selected');
- 1859. - removeClass(cur.albumFiltered, 'selected');
- 1860. - var showFriends = function() {
- 1861. - show(cur.audioFriends);
- 1862. - hide(cur.searchInfoCont);
- 1863. - hide(cur.audioAlbums, cur.searchFilters, cur.popularFilters, cur.popularOwners);
- 1864. - }
- 1865. - if (!cur.audioFriendPlaying && cur.shownFriends.length <= 10) {
- 1866. - Audio.cacheFriendsList();
- 1867. - showFriends();
- 1868. - Audio.selectFriend(cur.audioFriend);
- 1869. - } else {
- 1870. - addClass(ge('friends_audios'), 'loading');
- 1871. - var query = {act: 'more_friends'};
- 1872. - if (cur.audioFriendPlaying) query.owner = cur.audioFriendPlaying;
- 1873. - else if (cur.audioFriend) query.owner = cur.audioFriend;
- 1874. - ajax.post(Audio.address, query, {
- 1875. - cache: 1,
- 1876. - onDone: function(cont, friends) {
- 1877. - if (cont) {
- 1878. - ge('audio_friends_list').innerHTML = cont;
- 1879. - }
- 1880. - addClass(ge('audio_friend'+cur.audioFriend), 'current');
- 1881. - removeClass(ge('friends_audios'), 'loading');
- 1882. - showFriends();
- 1883. - cur.shownFriends = friends;
- 1884. - var fid = cur.audioFriendPlaying ? cur.audioFriendPlaying : cur.audioFriend;
- 1885. - Audio.selectFriend(fid);
- 1886. - },
- 1887. - onFail: function() {removeClass(ge('friends_audios'), 'loading');}
- 1888. - });
- 1889. - }
- 1890. - },
- 1891. - selectFriend: function(id, ev) {
- 1892. - if (cur.skipSelectFriend) {
- 1893. - cur.skipSelectFriend = false;
- 1894. - return;
- 1895. - }
- 1896. - each(geByTag('div', cur.audioFriends), function(i, e) {
- 1897. - removeClass(e, 'current');
- 1898. - });
- 1899. - addClass(ge('audio_friend' + id), 'current');
- 1900. - addClass(ge('album0'), 'loading');
- 1901. - each(geByClass('audio_filter', cur.albumFilters), function(i, e) {
- 1902. - removeClass(e, 'selected');
- 1903. - });
- 1904. - Audio.loadFriendsAudios(id, 'friend'+id);
- 1905. - if (id && cur.oid == vk.id) {
- 1906. - ajax.post(Audio.address, {act: 'list_stats', owner: id});
- 1907. - }
- 1908. - return ev ? cancelEvent(ev) : false;
- 1909. - },
- 1910. - skipSelectFriend: function() {
- 1911. - cur.skipSelectFriend = true;
- 1912. - },
- 1913. - selectCommunity: function(id, ev) {
- 1914. - if (cur.skipSelectCommunity) {
- 1915. - cur.skipSelectCommunity = false;
- 1916. - return;
- 1917. - }
- 1918. - each(geByClass('audio_friend', cur.searchInfoCont), function(i, e) {
- 1919. - removeClass(e, 'current');
- 1920. - });
- 1921. - addClass(ge('audio_community' + id), 'current');
- 1922. - mentionOver(ge('audio_community' + id), {shift: [47, 7, 7]});
- 1923. - each(geByClass('audio_filter', cur.albumFilters), function(i, e) {
- 1924. - removeClass(e, 'selected');
- 1925. - });
- 1926. - addClass(cur.albumFiltered, 'club_shown');
- 1927. - cur.searchSortFilter.disable(true);
- 1928. - cur.searchLyricsFilter.disable(true);
- 1929. - removeClass(cur.albumFiltered, 'selected');
- 1930. - cur.club = id;
- 1931. - Audio.loadCommunityAudios(id, 'club'+id);
- 1932. - if (id && cur.oid == vk.id) {
- 1933. - ajax.post(Audio.address, {act: 'list_stats', club: id});
- 1934. - }
- 1935. - return ev ? cancelEvent(ev) : false;
- 1936. - },
- 1937. - skipSelectCommunity: function() {
- 1938. - cur.skipSelectCommunity = true;
- 1939. - },
- 1940. - backToSearch: function() {
- 1941. - if (cur.curSection && cur.curSection.substr(0, 4) == 'club') {
- 1942. - cur.ignoreEqual = true;
- 1943. - each(geByClass('audio_friend', cur.searchInfoCont), function() {
- 1944. - removeClass(this, 'current');
- 1945. - });
- 1946. - this.updateList(null, cur.aSearch);
- 1947. - }
- 1948. - },
- 1949. - playCurrent: function(el, hash, ev) {
- 1950. - var _a = window.audioPlayer, aid = currentAudioId(), audioId = el.getAttribute('data-audio');
- 1951. - if (_a) _a.gpDisabled = false;
- 1952. - if ((window.audioPlaylist || {})[audioId]) {
- 1953. - if (!_a || aid != audioId || _a.player.paused()) playAudioNew(audioId);
- 1954. - return cancelEvent(ev);
- 1955. - }
- 1956. -
- 1957. - var prg = el.nextSibling || el.parentNode.appendChild(ce('span', {className: 'progress_inline current_audio_prg'}));
- 1958. - stManager.add(['audioplayer.css', 'audioplayer.js']);
- 1959. - ajax.post(Audio.address, {act: 'play_audio_status', id: audioId, hash: hash}, {
- 1960. - onDone: function(info, data, uid) {
- 1961. - if (data && uid && window.audioPlayer) {
- 1962. - audioPlayer.statusData = audioPlayer.statusData || {};
- 1963. - audioPlayer.statusData[uid] = data;
- 1964. - }
- 1965. - if (!info) return;
- 1966. -
- 1967. - if (!window.audioPlaylist) {
- 1968. - window.audioPlaylist = {};
- 1969. - }
- 1970. - audioPlaylist[audioId] = info;
- 1971. - audioPlaylist.start = audioId;
- 1972. - if (!audioPlaylist.searchStr) {
- 1973. - window.lastPlaylist = clone(audioPlaylist);
- 1974. - }
- 1975. - if (window.audioPlayer) {
- 1976. - audioPlayer.setPadPlaylist();
- 1977. - }
- 1978. - delete audioPlaylist.searchStr;
- 1979. - playAudioNew(audioId);
- 1980. - },
- 1981. - showProgress: function() {
- 1982. - show(prg);
- 1983. - hide(el);
- 1984. - },
- 1985. - hideProgress: function() {
- 1986. - hide(prg);
- 1987. - show(el);
- 1988. - }
- 1989. - });
- 1990. - return cancelEvent(ev);
- 1991. - },
- 1992. - loadFriendsAudios: function(id, index, album, showAlbums, owner) {
- 1993. - if (cur.silent) {
- 1994. - cur.onSilentLoad = function() {
- 1995. - Audio.loadFriendsAudios(id, index, album, showAlbums);
- 1996. - };
- 1997. - return;
- 1998. - }
- 1999. - if (!cur.audiosList[index]) {
- 2000. - if (index == 'all') {
- 2001. - each(geByClass('audio_filter', cur.albumFilters), function(i, e) {
- 2002. - removeClass(e, 'selected');
- 2003. - });
- 2004. - if (showAlbums) {
- 2005. - addClass(ge('audios_albums'), 'selected loading');
- 2006. - } else {
- 2007. - addClass(ge('album0'), 'selected loading');
- 2008. - }
- 2009. - removeClass(cur.albumFiltered, 'selected');
- 2010. - }
- 2011. - cur.lastAct = index;
- 2012. - var query = {act: 'load_audios_silent', id: id, please_dont_ddos: 3};
- 2013. - if (owner) {
- 2014. - query.is_owner = 1;
- 2015. - }
- 2016. - if (index != 'all' && !ge('audio_friend' + id) && !owner) {
- 2017. - cur.shownFriends = [];
- 2018. - var txt = domFC(ge('audio_more_friends')), prg = domLC(ge('audio_more_friends'));
- 2019. - Audio.showMoreFriends(function() {
- 2020. - hide(txt);
- 2021. - show(prg);
- 2022. - }, function() {
- 2023. - hide(prg);
- 2024. - show(txt);
- 2025. - }, id);
- 2026. - }
- 2027. - ajax.post(Audio.address, query, {
- 2028. - cache: 1,
- 2029. - onDone: function(data, opts) {
- 2030. - if (cur.lastAct != index) return;
- 2031. - opts = eval('('+opts+')');
- 2032. - if (id < 0) {
- 2033. - cur.allFriendsHTitles = cur.allFriendsHTitles || {};
- 2034. - cur.allFriendsHTitles[id] = opts.summaryLang.all_club_htitle;
- 2035. - } else {
- 2036. - cur.allFriendsTitles = cur.allFriendsTitles || {};
- 2037. - cur.allFriendsTitles[id] = opts.summaryLang.all_friend_title;
- 2038. - cur.allFriendsHTitles = cur.allFriendsHTitles || {};
- 2039. - cur.allFriendsHTitles[id] = opts.summaryLang.all_friend_htitle;
- 2040. - }
- 2041. - var obj = eval('('+data+')');
- 2042. - if (!obj) return;
- 2043. - cur.audiosList[index] = obj['all'];
- 2044. - if (id == vk.id && index == 'all') {
- 2045. - cur.allAudiosIndex = 'all';
- 2046. - Audio.generateAlbums();
- 2047. - }
- 2048. - if (!cur.performerInfo) {
- 2049. - cur.performerInfo = {};
- 2050. - }
- 2051. - cur.performerInfo[index] = opts.performerInfo;
- 2052. - if (opts.backLink) {
- 2053. - cur.backLink = opts.backLink;
- 2054. - showBackLink('/audio?act=popular'+(cur.genre ? '&genre='+cur.genre : ''), cur.backLink);
- 2055. - }
- 2056. - if (index != 'all') cur.audioFriend = id;
- 2057. - Audio.changeAllIndex(index, album, showAlbums, owner);
- 2058. - Audio.cacheFriendsList();
- 2059. - }
- 2060. - });
- 2061. - } else {
- 2062. - if (index != 'all') cur.audioFriend = id;
- 2063. - if (owner) {
- 2064. - showBackLink('/audio?act=popular'+(cur.genre ? '&genre='+cur.genre : ''), cur.backLink);
- 2065. - }
- 2066. - Audio.changeAllIndex(index, album, showAlbums, owner);
- 2067. - }
- 2068. - },
- 2069. - loadCommunityAudios: function(gid, index) {
- 2070. - if (cur.silent) {
- 2071. - cur.onSilentLoad = function() {
- 2072. - Audio.loadCommunityAudios(gid, index);
- 2073. - };
- 2074. - return;
- 2075. - }
- 2076. - if (!cur.audiosList[index]) {
- 2077. - cur.lastAct = index;
- 2078. - ajax.post(Audio.address, {act: 'load_audios_silent', gid: gid, please_dont_ddos: 1}, {
- 2079. - cache: 1,
- 2080. - showProgress: addClass.pbind(ge('album0'), 'loading'),
- 2081. - hideProgress: removeClass.pbind(ge('album0'), 'loading'),
- 2082. - onDone: function(data, opts) {
- 2083. - if (cur.lastAct != index) return;
- 2084. - opts = eval('('+opts+')');
- 2085. - cur.allClubsHTitles = cur.allClubsHTitles || {};
- 2086. - cur.allClubsHTitles[gid] = opts.summaryLang.all_club_htitle;
- 2087. - var obj = eval('('+data+')');
- 2088. - if (!obj) return;
- 2089. - cur.audiosList[index] = obj['all'];
- 2090. - Audio.searchAudios('', index);
- 2091. - scrollToTop();
- 2092. - }
- 2093. - });
- 2094. - } else {
- 2095. - Audio.searchAudios('', index);
- 2096. - scrollToTop();
- 2097. - }
- 2098. - },
- 2099. - showMoreFriends: function(showProgress, hideProgress, friend) {
- 2100. - if (cur.moreFriendsSent) {
- 2101. - return;
- 2102. - }
- 2103. - cur.moreFriendsSent = true;
- 2104. - var query = {act: 'more_friends', ids: cur.shownFriends};
- 2105. - if (friend) {
- 2106. - query.owner = friend;
- 2107. - }
- 2108. - ajax.post(Audio.address, query, {
- 2109. - onDone: function(cont, friends, reset) {
- 2110. - cur.moreFriendsSent = false;
- 2111. - if (cont) {
- 2112. - var list = ge('audio_friends_list');
- 2113. - re('audio_friends_old');
- 2114. - var old = ce('div', {innerHTML: '<div id="audio_friends_old" style="position: absolute;">'+list.innerHTML+'</div>'}).firstChild;
- 2115. - list.parentNode.insertBefore(old, list);
- 2116. - list.innerHTML = '';
- 2117. - setStyle(list, {display: 'none'});
- 2118. - list.innerHTML = cont;
- 2119. - var oldRows = geByClass('audio_friend', old), oldCnt = oldRows.length,
- 2120. - newCnt = geByClass('audio_friend', list).length;
- 2121. - if (oldCnt > newCnt) {
- 2122. - oldRows = oldRows.slice(newCnt);
- 2123. - each(oldRows, function() {
- 2124. - re(this);
- 2125. - });
- 2126. - }
- 2127. - setTimeout(Audio.handleFilterPos, 0);
- 2128. - fadeIn(list, 400, re.pbind(old));
- 2129. - if (friends) {
- 2130. - cur.shownFriends = reset ? friends : cur.shownFriends.concat(friends);
- 2131. - }
- 2132. - } else {
- 2133. - hide(el.parentNode.parentNode);
- 2134. - Audio.handleFilterPos();
- 2135. - }
- 2136. - },
- 2137. - onFail: function() {
- 2138. - cur.moreFriendsSent = false;
- 2139. - },
- 2140. - showProgress: showProgress,
- 2141. - hideProgress: hideProgress
- 2142. - });
- 2143. - },
- 2144. - cacheFriendsList: function() {
- 2145. - var query = {act: 'more_friends'};
- 2146. - if (cur.audioFriendPlaying) query.owner = cur.audioFriendPlaying;
- 2147. - else if (cur.audioFriend) query.owner = cur.audioFriend;
- 2148. - ajax.post(Audio.address, query, {cache: 1});
- 2149. - },
- 2150. -
- 2151. - // Audio Edit functions
- 2152. -
- 2153. - showAudioClaimWarning: function(aid, claim_id, title, reason) {
- 2154. - if (cur.silent) {
- 2155. - cur.onSilentLoad = function() {
- 2156. - Audio.showAudioClaimWarning(aid, claim_id, title, reason);
- 2157. - };
- 2158. - return;
- 2159. - }
- 2160. - var claimText, claimTitle;
- 2161. - if (reason == 'crap') {
- 2162. - claimText = getLang(claim_id >= 0 ? 'audio_crap_warning_text' : 'audio_crap_warning') || getLang(claim_id > 0 ? 'audio_claim_warning_objection' : (claim_id == 0 ? 'audio_claim_warning_text' : 'audio_claim_warning'));
- 2163. - claimTitle = getLang('audio_crap_warning_title') || getLang('audio_claim_warning_title');
- 2164. - } else {
- 2165. - claimText = (claim_id > 0) ? getLang('audio_claim_warning_objection') : (claim_id == 0 ? getLang('audio_claim_warning_text') : getLang('audio_claim_warning'));
- 2166. - claimTitle = getLang('audio_claim_warning_title');
- 2167. - }
- 2168. - claimText = claimText.split('{audio}').join('<b>' + title + '</b>');
- 2169. - claimText = claimText.split('{objection_link}').join('<a href="/help?act=cc_objection&claim=' + claim_id + '&content=audio' + aid + '">' + getLang('audio_claim_objection') + '</a>');
- 2170. - claimText = claimText.split('{delete_link}').join('<a href="#" onclick="Audio.deleteAudio(\'' + aid + '\'); return false;">' + getLang('audio_claim_delete') + '</a>');
- 2171. - cur.claimWarning = showFastBox(claimTitle, claimText);
- 2172. - },
- 2173. -
- 2174. - deleteAudio: function(id) {
- 2175. - if (cur.silent) {
- 2176. - cur.onSilentLoad = function() {
- 2177. - Audio.deleteAudio(id);
- 2178. - };
- 2179. - return;
- 2180. - }
- 2181. - if (cur.deleting) {
- 2182. - return false;
- 2183. - }
- 2184. - cur.deleting = true;
- 2185. - var el = ge('audio' + id), aid = id.split('_')[1];
- 2186. - if (!cur.deletedAudios) cur.deletedAudios = [];
- 2187. - cur.deletedAudios[aid] = el.innerHTML;
- 2188. - var acts = geByClass1('actions', el);
- 2189. - each(acts.children, function(){if (this.tt && this.tt.hide) this.tt.hide()});
- 2190. - var a = (cur.audios || {})[aid] || [], lyrics = isVisible(ge('lyrics'+id)),
- 2191. - _tw = el && geByClass1('title_wrap', el),
- 2192. - performer = a[5] || _tw && (geByTag1('a', _tw) || {}).innerHTML || '',
- 2193. - title = a[6] || _tw && (geByClass1('title', _tw) || {}).innerHTML || '';
- 2194. - el.innerHTML = rs(cur.deletedTpl, {
- 2195. - audio_id: id,
- 2196. - performer: performer.split('<span>').join('').split('</span>').join(''),
- 2197. - title: title,
- 2198. - delete_all: ''
- 2199. - });
- 2200. - var _a = window.audioPlayer;
- 2201. - if (currentAudioId() == id) {
- 2202. - _a.showCurrentTrack();
- 2203. - }
- 2204. - if (lyrics) {
- 2205. - Audio.updateSorterRows(ge('audio'+id));
- 2206. - }
- 2207. - var addBtn = ge('audio_add'+id);
- 2208. - if (addBtn) {
- 2209. - addBtn.onmouseover = function() {};
- 2210. - }
- 2211. - ajax.post(Audio.address, {act: 'delete_audio', oid: cur.oid, aid: aid, hash: cur.hashes.delete_hash, restore: 1}, {
- 2212. - onDone: function(action, delete_all) {
- 2213. - cur.deleting = false;
- 2214. - if (cur.claimWarning) {
- 2215. - cur.claimWarning.hide();
- 2216. - }
- 2217. - var acts = geByClass1('actions', el);
- 2218. - each(acts.children, function(){if (this.tt) this.tt.hide()});
- 2219. - el.innerHTML = rs(cur.deletedTpl, {
- 2220. - audio_id: id,
- 2221. - performer: performer.split('<span>').join('').split('</span>').join(''),
- 2222. - title: title,
- 2223. - delete_all: action ? action : ''
- 2224. - });
- 2225. - el.style.cursor = 'auto';
- 2226. - el.setAttribute('nosorthandle', '1');
- 2227. - if (currentAudioId() == id) {
- 2228. - _a.showCurrentTrack();
- 2229. - }
- 2230. - if (delete_all) {
- 2231. - cur.lang = cur.lang || {};
- 2232. - cur.lang.audio_delete_all = delete_all;
- 2233. - }
- 2234. - if (cur.audios[aid]) {
- 2235. - cur.audiosIndex.remove(cur.audios[aid]);
- 2236. - cur.audios[aid].deleted = true;
- 2237. - }
- 2238. - Audio.removeFromPlaylist(id);
- 2239. - cur.sectionCount--;
- 2240. - if (cur.shownAudios) cur.shownAudios--;
- 2241. - Audio.changeSummary();
- 2242. - },
- 2243. - onFail: function() {
- 2244. - cur.deleting = false;
- 2245. - }
- 2246. - });
- 2247. - return false;
- 2248. - },
- 2249. -
- 2250. - restoreAudio: function(id) {
- 2251. - if (cur.restoring) {
- 2252. - return;
- 2253. - }
- 2254. - cur.restoring = true;
- 2255. - var el = ge('audio' + id), aid = id.split('_')[1];
- 2256. - ajax.post(Audio.address, {act: 'restore_audio', oid: cur.oid, aid: aid, hash: cur.hashes.restore_hash}, {
- 2257. - onDone: function() {
- 2258. - cur.restoring = false;
- 2259. - var acts = geByClass1('actions', el);
- 2260. - each(acts.children, function(){if (this.tt) this.tt.hide()});
- 2261. - el.innerHTML = cur.deletedAudios[aid];
- 2262. - var lyrics = isVisible(ge('lyrics'+id));
- 2263. - if (lyrics) {
- 2264. - Audio.updateSorterRows(ge('audio'+id));
- 2265. - }
- 2266. - el.removeAttribute('nosorthandle');
- 2267. - if (cur.audios[aid]) {
- 2268. - cur.audiosIndex.add(cur.audios[aid]);
- 2269. - cur.audios[aid].deleted = false;
- 2270. - }
- 2271. - Audio.backToPlaylist(id);
- 2272. - cur.sectionCount++;
- 2273. - if (cur.shownAudios) cur.shownAudios++;
- 2274. - Audio.changeSummary();
- 2275. - toggleClass(ge('play'+id), 'playing', id == currentAudioId());
- 2276. - },
- 2277. - onFail: function() {
- 2278. - cur.restoring = false;
- 2279. - }
- 2280. - });
- 2281. - },
- 2282. -
- 2283. - deleteAll: function(object_id, from_id, to_id, hash) {
- 2284. - var box = showFastBox(getLang('audio_delete_all_title'), getLang('audio_delete_all') || '', getLang('global_delete'), function(btn){
- 2285. - ajax.post(Audio.address, {act: 'delete_all', object_id: object_id, to_id: to_id, from_id: from_id, hash: hash}, {
- 2286. - showProgress: lockButton.pbind(btn),
- 2287. - onDone: function() {
- 2288. - nav.reload();
- 2289. - },
- 2290. - onFail: box.hide
- 2291. - });
- 2292. - }, getLang('global_cancel'));
- 2293. - },
- 2294. -
- 2295. - editAudio: function(aid, event){
- 2296. - showBox(Audio.address, {act: 'edit_audio_box', aid: aid}, {
- 2297. - params: {width: '430px', bodyStyle: 'padding: 15px;'}
- 2298. - });
- 2299. - if (event) cancelEvent(event);
- 2300. - return false;
- 2301. - },
- 2302. -
- 2303. - editTopAudio: function(full_aid, event) {
- 2304. - showBox('al_search.php', {act: 'audio_top_edit_box', id: full_aid, full_id: full_aid}, {
- 2305. - params: {width: '430px', bodyStyle: 'padding: 15px;'}
- 2306. - });
- 2307. - if (event) cancelEvent(event);
- 2308. - return false;
- 2309. - },
- 2310. -
- 2311. - removeFromTop: function(audio_hash, hash, full_aid, event) {
- 2312. - ajax.post('al_search.php', {act: 'save_top_audio', deleted: 1, audio_hash: audio_hash, hash: hash, id: full_aid}, {
- 2313. - onDone: function() {
- 2314. - var audioRow = ge('audio'+full_aid);
- 2315. - slideUp(audioRow, 100);
- 2316. - }
- 2317. - })
- 2318. - },
- 2319. -
- 2320. - updateAlbums: function() {
- 2321. - if (!cur.canEdit || browser.mobile) return;
- 2322. - each (cur.audioAlbumsWrap.sorter.elems, function() {
- 2323. - setStyle(this, {top: 'auto', left: 'auto', width: 'auto'});
- 2324. - });
- 2325. - cur.audioAlbumsWrap.sorter.destroy();
- 2326. - this.initAlbumsSort();
- 2327. - this.updateAlbumsTitles();
- 2328. - },
- 2329. -
- 2330. - updateAlbumsTitles: function() {
- 2331. - if (!cur.audioAlbumsWrap) return;
- 2332. -
- 2333. - each (geByClass('label', cur.audioAlbumsWrap), function() {
- 2334. - if (this.scrollWidth > this.clientWidth) {
- 2335. - this.setAttribute('title', this.innerText || this.textContent);
- 2336. - } else {
- 2337. - this.removeAttribute('title');
- 2338. - }
- 2339. - });
- 2340. - },
- 2341. -
- 2342. - initAlbumsSort: function() {
- 2343. - if (!cur.canEdit || browser.mobile || !cur.audioAlbumsWrap) return;
- 2344. - sorter.init(cur.audioAlbumsWrap, {onMouseDown: Audio.hideAlbumsTT, onReorder: Audio.onAlbumReorder, noMoveCursor: 1});
- 2345. - },
- 2346. -
- 2347. - hideAlbumsTT: function() {
- 2348. - each(geByClass('icon_wrap', cur.audioAlbumsWrap), function() {
- 2349. - if (this.tt) this.tt.hide();
- 2350. - })
- 2351. - },
- 2352. -
- 2353. - onAlbumReorder: function(album, before, after) {
- 2354. - var aid = album.id.replace('album', '');
- 2355. - var before_id = (before && before.id || '').replace('album', '');
- 2356. - var after_id = (after && after.id || '').replace('album', '');
- 2357. - ajax.post(Audio.address, {act: 'reorder_albums', oid: cur.oid, aid: aid, before: before_id, after: after_id, hash: cur.hashes.reorder_hash});
- 2358. - },
- 2359. -
- 2360. - editAlbum: function(aid){
- 2361. - if (cur.silent) {
- 2362. - cur.onSilentLoad = function() {
- 2363. - Audio.editAlbum(aid);
- 2364. - };
- 2365. - return;
- 2366. - }
- 2367. - if (!cur.audiosList) {
- 2368. - return;
- 2369. - }
- 2370. - var box = showTabbedBox(Audio.address, {act: 'edit_album_box', album_id: aid, oid: cur.oid}, {stat: ['privacy.js', 'privacy.css', 'ui_controls.js', 'ui_controls.css', 'indexer.js']});
- 2371. - cur.onOListSave = Audio.saveAlbum.pbind(box, aid);
- 2372. - return false;
- 2373. - },
- 2374. -
- 2375. - createAlbum: function() {
- 2376. - return this.editAlbum(0);
- 2377. - },
- 2378. -
- 2379. - saveAlbum: function(box, aid, audio_ids) {
- 2380. - var btn = geByClass1('button_blue', box.bodyNode.nextSibling).firstChild,
- 2381. - albumName = val('album_name');
- 2382. - if (!albumName) {
- 2383. - notaBene('album_name');
- 2384. - return false;
- 2385. - }
- 2386. - var query = {act: 'save_album', album_id: aid, name: albumName, gid: cur.gid, Audios: audio_ids.join(','), hash: cur.hashes.save_album_hash};
- 2387. - ajax.post(Audio.address, query, {
- 2388. - showProgress: lockButton.pbind(btn),
- 2389. - hideProgress: unlockButton.pbind(btn),
- 2390. - onFail: box.hide,
- 2391. - onDone: function(album_id, audio_ids, filters) {
- 2392. - try{
- 2393. - cur.audioAlbumsWrap.innerHTML = filters;
- 2394. - var old = cur.audiosList['album'+album_id];
- 2395. - if (old) {
- 2396. - for (var i in old) {
- 2397. - cur.audios[old[i][1]][8] = 0;
- 2398. - }
- 2399. - }
- 2400. - for (var i in audio_ids) {
- 2401. - cur.audios[audio_ids[i]][8] = album_id;
- 2402. - }
- 2403. - cur.albums[album_id] = {id: album_id, title: clean(albumName)};
- 2404. - Audio.generateAlbums();
- 2405. - Audio.loadAlbum(album_id);
- 2406. - Audio.initAlbumsSort();
- 2407. - Audio.updateAlbumsTitles();
- 2408. - box.hide();
- 2409. - }catch(e){}
- 2410. - }
- 2411. - });
- 2412. - return false;
- 2413. - },
- 2414. -
- 2415. - deleteAlbum: function(aid, hash){
- 2416. - var box = showFastBox(getLang('audio_delete_album_title'), getLang('audio_delete_album_are_you_sure'), getLang('audio_delete_album_button'), function(btn){
- 2417. - ajax.post(Audio.address, {act: 'delete_album', album_id: aid, hash: hash, gid: cur.gid}, {
- 2418. - showProgress: lockButton.pbind(btn),
- 2419. - hideProgress: unlockButton.pbind(btn),
- 2420. - onDone: function(audio_ids, filters){
- 2421. - try{
- 2422. - re('album'+aid);
- 2423. - boxQueue.hideAll();
- 2424. - for (var i in audio_ids) {
- 2425. - cur.audios[audio_ids[i]][8] = 0;
- 2426. - }
- 2427. - delete cur.albums[aid];
- 2428. - Audio.generateAlbums();
- 2429. - if (cur.album_id == aid) {
- 2430. - Audio.loadAlbum(0, undefined, true);
- 2431. - }
- 2432. - Audio.updateAlbums();
- 2433. - }catch(e){}
- 2434. - },
- 2435. - onFail: function(){
- 2436. - box.hide(200);
- 2437. - }
- 2438. - });
- 2439. - }, getLang('global_cancel'));
- 2440. - },
- 2441. -
- 2442. - moveAudio: function(full_id, album_id) {
- 2443. - var id = full_id.split('_')[1];
- 2444. - ajax.post(Audio.address, {act:'move_to_album', album_id:album_id, audio_id:id, gid:cur.gid, hash:cur.hashes.move_hash}, {
- 2445. - onDone: function(text) {
- 2446. - if((cur.album_id && cur.album_id != album_id) || cur.filterUnsorted){
- 2447. - var el = ge('audio'+full_id);
- 2448. - fadeOut(el, 300, function(){
- 2449. - el.parentNode.removeChild(el);
- 2450. - each (cur.aContent.sorter.elems, function() {
- 2451. - setStyle(this, {top: 'auto', left: 'auto'});
- 2452. - });
- 2453. - cur.aContent.sorter.destroy();
- 2454. - var opts = {onReorder: Audio.onAudioReorder, onMouseDown: Audio.onDragStart, onMouseUp: Audio.onDragEnd, noMoveCursor: 1};
- 2455. - if (cur.albumFilters) {
- 2456. - extend(opts, {target: cur.albumFilters, onDragOver: Audio.onDragOver, onDragOut: Audio.onDragOut});
- 2457. - }
- 2458. - sorter.init(cur.aContent, opts);
- 2459. - cur.sectionCount--;
- 2460. - Audio.changeSummary();
- 2461. - if (cur.sectionCount == 0) {
- 2462. - cur.aContent.innerHTML = '<div id="not_found" class="info_msg">'+getLang('audio_album_no_recs')+'</div>';
- 2463. - }
- 2464. - hide(cur.showMore);
- 2465. - });
- 2466. - }
- 2467. - cur.audios[id][8] = album_id;
- 2468. - Audio.generateAlbums();
- 2469. - }
- 2470. - });
- 2471. - },
- 2472. -
- 2473. - onAudioReorder: function(audio, before, after) {
- 2474. - var aid = audio.id.replace('audio', '').split('_')[1];
- 2475. - var before_id = (before && before.id || '').replace('audio', '').split('_')[1];
- 2476. - var after_id = (after && after.id || '').replace('audio', '').split('_')[1];
- 2477. - ajax.post(Audio.address, {act: 'reorder_audios', oid: cur.oid, aid: aid, before: before_id, after: after_id, hash: cur.hashes.reorder_hash}, {
- 2478. - onDone: function(data) {
- 2479. - var val;
- 2480. - if (before_id && !after_id) {
- 2481. - val = cur.audios[before_id]._order - 0.01;
- 2482. - } else {
- 2483. - val = cur.audios[after_id]._order + 0.01;
- 2484. - }
- 2485. - cur.audios[aid]._order = val;
- 2486. - Audio.reorderPlaylist(cur.oid + '_' + aid, before_id ? cur.oid + '_' + before_id : '', after_id ? cur.oid + '_' + after_id : '');
- 2487. - }
- 2488. - });
- 2489. - },
- 2490. -
- 2491. - onDragStart: function(el) {
- 2492. - // addClass(ge('page_body'), 'no_overflow');
- 2493. - cur.dragStartTimer = setTimeout(function() {
- 2494. - addClass(cur.audioAlbumsWrap, 'drag');
- 2495. - hide('album_add');
- 2496. - var ids = el.id.substr(5), id = parseInt(ids.split('_')[1]);
- 2497. - var album_id = (cur.audios) ? cur.audios[id][8] : cur.album_id;
- 2498. - each(geByClass('audio_filter', cur.audioAlbumsWrap), function(i,v) {
- 2499. - if ('album'+album_id == v.id || (album_id == 0 && v.id == 'album_unsorted')) {
- 2500. - return;
- 2501. - }
- 2502. - addClass(v, 'drag_on');
- 2503. - });
- 2504. - animate(el, {opacity: .8}, 200);
- 2505. - }, 300);
- 2506. - },
- 2507. -
- 2508. - onDragEnd: function(el, target) {
- 2509. - if (cur.dragStartTimer) clearTimeout(cur.dragStartTimer);
- 2510. - // removeClass(ge('page_body'), 'no_overflow');
- 2511. - each(geByClass('audio_filter', cur.audioAlbumsWrap), function(i,v) {
- 2512. - removeClass(v, 'drag_on');
- 2513. - });
- 2514. - show('album_add');
- 2515. - if (target) {
- 2516. - var new_album, full_id = el.id.substr(5), aid = parseInt(full_id.split('_')[1]);
- 2517. - var album_id = (cur.audios) ? cur.audios[aid][8] : cur.album_id;
- 2518. - if (target.id != 'album_unsorted') {
- 2519. - new_album = parseInt(target.id.substr(5));
- 2520. - } else {
- 2521. - new_album = 0;
- 2522. - }
- 2523. - if (new_album != album_id) {
- 2524. - Audio.moveAudio(full_id, new_album);
- 2525. - }
- 2526. - }
- 2527. - removeClass(cur.audioAlbumsWrap, 'drag');
- 2528. - animate(el, {opacity: 1}, 200);
- 2529. - },
- 2530. -
- 2531. - onDragOver: function(el, target) {
- 2532. - cur.targetId = target.id || '';
- 2533. - var ids = el.id.substr(5), id = parseInt(ids.split('_')[1]);
- 2534. - var album_id = (cur.audios) ? cur.audios[id][8] : cur.album_id;
- 2535. - if ('album'+album_id == target.id || (album_id == 0 && target.id == 'album_unsorted')) {
- 2536. - return;
- 2537. - }
- 2538. - if (cur.dragOutTimer) {
- 2539. - clearTimeout(cur.dragOutTimer);
- 2540. - }
- 2541. - addClass(target, 'drag_over');
- 2542. - setStyle(el, {opacity: .4});
- 2543. - },
- 2544. -
- 2545. - onDragOut: function(el, target) {
- 2546. - removeClass(target, 'drag_over');
- 2547. - if (target.id && cur.targetId != target.id) return;
- 2548. - cur.dragOutTimer = setTimeout(function(){setStyle(el, {opacity: .8});}, 200);
- 2549. - },
- 2550. -
- 2551. - ignoreOwner: function (post_raw, owner_id, hash, btn) {
- 2552. - triggerEvent(ge('delete_post' + post_raw), 'mouseout');
- 2553. - cur.feedEntriesHTML = cur.feedEntriesHTML || {};
- 2554. - if (post_raw) {
- 2555. - cur.feedEntriesHTML[post_raw + '_ignored'] = val('post' + post_raw);
- 2556. - }
- 2557. - ajax.post(Audio.address, {act: 'a_ignore_owner', post_raw: post_raw, owner_id: owner_id, hash: hash}, {
- 2558. - onDone:function(html) {
- 2559. - val('post' + post_raw, html);
- 2560. - each(geByClass('post', cur.aContent), function(i,v) {
- 2561. - var ids = this.id.match(/post((-?\d+)_(-?\d+)(_\d+)?)/);
- 2562. - if (ids[1] != post_raw && (!ids[4] && ids[2] == owner_id || ids[4] && ids[3] == owner_id)) {
- 2563. - hide(this);
- 2564. - }
- 2565. - });
- 2566. - }
- 2567. - });
- 2568. - },
- 2569. -
- 2570. - unignoreOwner: function (post_raw, owner_id, hash) {
- 2571. - ajax.post(Audio.address, {act: 'a_unignore_owner', post_raw: post_raw || '', owner_id: owner_id, hash: hash}, {
- 2572. - onDone:function(html) {
- 2573. - if (post_raw) {
- 2574. - val('post' + post_raw, cur.feedEntriesHTML[post_raw + '_ignored']);
- 2575. - } else {
- 2576. - val('ignore_row' + owner_id, html);
- 2577. - }
- 2578. - each(geByClass('post', cur.aContent), function(i,v) {
- 2579. - var ids = this.id.match(/post((-?\d+)_(-?\d+)(_\d+)?)/);
- 2580. - if (!ids[4] && ids[2] == owner_id || ids[4] && ids[3] == owner_id) {
- 2581. - show(this);
- 2582. - }
- 2583. - });
- 2584. - }
- 2585. - });
- 2586. - },
- 2587. -
- 2588. - editHidden: function () {
- 2589. - showTabbedBox('al_settings.php', {act: 'a_edit_owners_list', list: 'audio', height: lastWindowHeight}, {stat: ['privacy.js', 'privacy.css', 'ui_controls.js', 'ui_controls.css', 'indexer.js']});
- 2590. - cur.onOListSave = Audio.onHiddenSave;
- 2591. - return false;
- 2592. - },
- 2593. -
- 2594. - onHiddenSave: function(white, black, list, options) {
- 2595. - var box = curBox(), params = {act: 'a_ignore_olist', hash: options.hash};
- 2596. - if (white.length < black.length) {
- 2597. - params.White = white.join(',');
- 2598. - } else {
- 2599. - params.Black = black.join(',');
- 2600. - }
- 2601. - ajax.post(Audio.address, params, {
- 2602. - onDone: function(control, rules) {
- 2603. - box.hide();
- 2604. - Audio.loadFeed('reload');
- 2605. - },
- 2606. - showProgress: box.showProgress,
- 2607. - hiderogress: box.hideProgress
- 2608. - });
- 2609. - return false;
- 2610. - },
- 2611. -
- 2612. - loadGenre: function(genre_id, ev) {
- 2613. - if (checkEvent(ev)) {
- 2614. - return true;
- 2615. - }
- 2616. - Audio.loadPopular(true, genre_id);
- 2617. - return cancelEvent(ev);
- 2618. - },
- 2619. -
- 2620. - loadPerformer: function(oid, ev) {
- 2621. - if (checkEvent(ev)) {
- 2622. - return true;
- 2623. - }
- 2624. - var index = 'owner'+oid;
- 2625. - Audio.loadFriendsAudios(oid, index, undefined, undefined, true);
- 2626. - return cancelEvent(ev);
- 2627. - },
- 2628. -
- 2629. - moreCatalog: function(obj) {
- 2630. - if (hasClass(obj, 'audio_performer_shown')) {
- 2631. - var height = getSize(ge('audio_more_performers'))[1];
- 2632. - removeClass(obj, 'audio_performer_shown');
- 2633. - hide('audio_more_performers');
- 2634. - if (height > 300) {
- 2635. - scrollToTop(0);
- 2636. - }
- 2637. - } else {
- 2638. - if (ge('audio_more_performers')) {
- 2639. - show('audio_more_performers')
- 2640. - addClass(obj, 'audio_performer_shown');
- 2641. - return false;
- 2642. - }
- 2643. - var exclude = [];
- 2644. - var nodes = ge('audio_performers').childNodes;
- 2645. - for (var i in nodes) {
- 2646. - if (hasClass(nodes[i], 'audio_owner')) {
- 2647. - exclude.push(intval(nodes[i].getAttribute('ref')));
- 2648. - }
- 2649. - }
- 2650. - ajax.post('al_audio.php', {act: 'get_more_performers', offset: 4, exclude: exclude.join(','), genre: parseInt(cur.genre)}, {
- 2651. - onDone: function(rows) {
- 2652. - ge('audio_performers').appendChild(ce('div', {
- 2653. - id: 'audio_more_performers',
- 2654. - innerHTML: rows
- 2655. - }));
- 2656. - addClass(obj, 'audio_performer_shown');
- 2657. - },
- 2658. - showProgress: addClass.pbind(obj, 'audio_performer_loading'),
- 2659. - hideProgress: removeClass.pbind(obj, 'audio_performer_loading')
- 2660. - });
- 2661. - }
- 2662. - },
- 2663. -
- 2664. - _eof: 1
- 2665. - }
- 2666. - try{stManager.done('audio.js');}catch(e){}
- ------
- Файл - friends.js (Старый размер - 62624 | Новый - 0):
- 0. - var Friends = {
- 1. - init: function(obj, friendsTpl, commonTpl) {
- 2. - extend(cur, {
- 3. - fSearch: ge('s_search'),
- 4. - module: 'friends',
- 5. - fListEl: ge('friends_list'),
- 6. - showMore: ge('show_more'),
- 7. - pageEnd: ge('page_end'),
- 8. - fContent: ge('list_content'),
- 9. - friendsTpl: friendsTpl,
- 10. - commonTpl: commonTpl,
- 11. - savedMasks: {},
- 12. - bigphCache: {},
- 13. - bigphShown: {}
- 14. - });
- 15. - extend(cur, obj);
- 16. -
- 17. - if (!cur.secData) {
- 18. - cur.secData = {};
- 19. - }
- 20. -
- 21. - cur.curList = cur.section;
- 22. -
- 23. - placeholderSetup(cur.fSearch, {back: true})
- 24. - elfocus(cur.fSearch);
- 25. -
- 26. - Friends.scrollNode = browser.msie6 ? pageNode : window;
- 27. -
- 28. - addEvent(Friends.scrollNode, 'scroll', Friends.scrollResize);
- 29. -
- 30. - setTimeout(function() {
- 31. - cur.destroy.push(function() {
- 32. - clearTimeout(cur.resizeTimeout);
- 33. - removeEvent(Friends.scrollNode, 'scroll', Friends.scrollResize);
- 34. - });
- 35. - }, 0);
- 36. -
- 37. - cur.friends = {};
- 38. -
- 39. - if (!cur.silent) {
- 40. - this.indexAll(function() {
- 41. - if (cur.section.substr(0, 4) == 'list') {
- 42. - cur.friendsList[cur.section] = Friends.filter(cur.friendsList['all'], cur.section);
- 43. - }
- 44. - if (!cur.friendsList[cur.section] || !cur.friendsList[cur.section].length) {
- 45. - if (cur.section != 'requests' || !cur.suggCount) {
- 46. - show('not_found');
- 47. - }
- 48. - }
- 49. - });
- 50. - }
- 51. -
- 52. - cur.timeouts = {};
- 53. -
- 54. - cur.nav.push((function(changed, old, n) {
- 55. - if ('id' in changed || 'sort' in changed || isEmpty(changed)) {
- 56. - return true;
- 57. - }
- 58. - if (n[0] == 'friends' || n[0] == 'al_friends.php' && (changed.section)) {
- 59. - var s = changed.section;
- 60. -
- 61. - if ((s == 'requests' || s == 'all_requests' || s == 'out_requests') && !cur.requestsCount && !cur.suggCount && !cur.allRequestsCount && !cur.outRequestsCount) {
- 62. - return nav.change({section: 'all'});
- 63. - } else if (s == 'requests' && !cur.requestsCount && !cur.suggCount) {
- 64. - return nav.change({section: cur.allRequestsCount ? 'all_requests' : 'out_requests'});
- 65. - } else if (s == 'all_requests' && !cur.allRequestsCount) {
- 66. - return nav.change({section: cur.requestsCount || cur.suggCount ? 'requests' : 'out_requests'});
- 67. - } else if (s == 'out_requests' && !cur.outRequestsCount) {
- 68. - return nav.change({section: 'all'});
- 69. - }
- 70. -
- 71. - if (s == 'all' || s == 'online' || s == 'requests' || s == 'all_requests' || s == 'out_requests') {
- 72. - __adsUpdate('force');
- 73. - }
- 74. - if (s == 'all_requests' && !('sort' in changed) && !cur.sortByDate) {
- 75. - delete n.sort;
- 76. - setTimeout(Friends.changeSummary, 0);
- 77. - }
- 78. - this.section(n.section, (function() {
- 79. - this.changeSummary();
- 80. - nav.setLoc(n);
- 81. - }).bind(this));
- 82. - return false;
- 83. - } else if (n[0] == 'al_friends.php' || n[0] == 'friends') {
- 84. - return false;
- 85. - }
- 86. - }).bind(this));
- 87. -
- 88. - if (cur.silent) {
- 89. - addClass(cur.showMore, 'load_more');
- 90. - ajax.post('al_friends.php', {act: 'load_friends_silent', id: cur.oid, gid: cur.gid, sort: nav.objLoc.sort}, {
- 91. - onDone: (function(data, universities, filters) {
- 92. - removeClass(cur.showMore, 'load_more');
- 93. - cur.silent = false;
- 94. - var obj = eval('('+data+')');
- 95. - // load friends json
- 96. - if (!obj) {
- 97. - return;
- 98. - }
- 99. - cur.universities = universities;
- 100. - for (var i in obj) {
- 101. - cur.friendsList[i] = obj[i];
- 102. - }
- 103. - this.indexAll(function() {
- 104. - //Friends.selectTabAndSection(cur.section);
- 105. - if (cur.section.substr(0, 4) == 'list') {
- 106. - cur.friendsList[cur.section] = Friends.filter(cur.friendsList['all'], cur.section);
- 107. - }
- 108. - (cur.onSilentLoad || Friends.showMore)();
- 109. - });
- 110. - if (filters.cities) {
- 111. - stManager.add(['ui_controls.js', 'ui_controls.css'], function() {
- 112. - cur.cityFilter.setData(filters.cities);
- 113. - if (cur.cityFilterOpened) {
- 114. - hide('friends_fltr_progress');
- 115. - cur.cityFilter.showDefaultList()
- 116. - }
- 117. - });
- 118. - }
- 119. - }).bind(this), local: 1
- 120. - });
- 121. - }
- 122. -
- 123. - },
- 124. - indexAll: function(callback) {
- 125. - var all = cur.friendsList['all'];
- 126. -
- 127. - cur.friendsIndex = new vkIndexer(all, function(obj) {
- 128. - var mid = parseInt(obj[0]);
- 129. - if (cur.friends && mid) {
- 130. - cur.friends[mid] = obj;
- 131. - }
- 132. - return obj[5] || '';
- 133. - }, function() {
- 134. - if (!cur.silent) {
- 135. - cur.friendsList['online'] = Friends.filter(all, 'online');
- 136. - if (cur.section == 'common') {
- 137. - cur.friendsList['common'] = Friends.filter(all, 'common');
- 138. - }
- 139. - if (callback) {
- 140. - callback();
- 141. - }
- 142. - }
- 143. - Friends.initBackFunc();
- 144. - });
- 145. -
- 146. - if (cur.section == 'phonebook') {
- 147. - Friends.indexPhone();
- 148. - }
- 149. - },
- 150. - indexPhone: function() {
- 151. - cur.phoneIndex = new vkIndexer(cur.friendsList['phonebook'], function(obj) {
- 152. - var mobile = obj[10][0] || '';
- 153. - var home = obj[10][1] || '';
- 154. - return [obj[5], mobile, mobile.replace(/[^0-9\+]/g, ''), home, home.replace(/[^0-9\+]/g, '')].join(' ');
- 155. - });
- 156. - },
- 157. - initBackFunc: function() {
- 158. - cur._back = {show: [function() {
- 159. - addEvent(Friends.scrollNode, 'scroll', Friends.scrollResize);
- 160. - }], hide: [function() {
- 161. - if (Friends.searchTimout) {
- 162. - clearTimeout(Friends.searchTimout);
- 163. - }
- 164. - if (cur.timeouts) {
- 165. - for (var i in cur.timeouts) {
- 166. - clearTimeout(cur.timeouts);
- 167. - }
- 168. - }
- 169. - for (var i in cur.bigphShown) {
- 170. - animate(cur.bigphShown[i], {marginTop: 100}, 0);
- 171. - }
- 172. - cur.bigphShown = {};
- 173. - removeEvent(Friends.scrollNode, 'scroll', Friends.scrollResize);
- 174. - }], text: cur.backLang};
- 175. - },
- 176. - switchTab: function(section, ev) {
- 177. - var param = {'0':'friends', section: section};
- 178. - return checkEvent(ev) || nav.change(param);
- 179. - },
- 180. - filter: function(arr, type) {
- 181. - var len = (arr) ? arr.length : 0;
- 182. - var res = [];
- 183. - if (type.substr(0, 4) == 'list') {
- 184. - var listNum = parseInt(type.substr(4));
- 185. - type = 'list';
- 186. - }
- 187. - for (var i = 0; i < len; i++) {
- 188. - var obj = arr[i];
- 189. - if (cur.filterIds && !cur.filterIds[parseInt(obj[0])]) {
- 190. - continue;
- 191. - }
- 192. - switch (type) {
- 193. - case 'online':
- 194. - if (intval(obj[4])) {
- 195. - res.push(obj);
- 196. - }
- 197. - break;
- 198. - case 'common':
- 199. - if (cur.commonCount && obj[10]) {
- 200. - res.push(obj);
- 201. - }
- 202. - break;
- 203. - case 'list':
- 204. - if (parseInt(obj[6]) & (1 << listNum)) {
- 205. - res.push(obj);
- 206. - }
- 207. - break;
- 208. - default:
- 209. - res.push(obj);
- 210. - break;
- 211. - }
- 212. - }
- 213. - return res;
- 214. - },
- 215. - loadMore: function(start, end) {
- 216. - var section = cur.section;
- 217. - var list = cur.curList;
- 218. - var curData = cur.secData[section];
- 219. - if (curData.loading) {
- 220. - return;
- 221. - }
- 222. - curData.loading = true;
- 223. - addClass(cur.showMore, 'load_more');
- 224. - show(cur.showMore);
- 225. - ajax.post('/friends', extend({
- 226. - act: 'get_section_friends',
- 227. - section: section,
- 228. - offset: start,
- 229. - gid: cur.gid,
- 230. - sort: nav.objLoc.sort,
- 231. - sugg_rev: cur.suggRev
- 232. - }, cur.filter), {
- 233. - onDone: (function(data, preload) {
- 234. - removeClass(cur.showMore, 'load_more');
- 235. - var response = eval('('+data+')')
- 236. - if (!cur.friendsList) {
- 237. - return;
- 238. - }
- 239. - if (!cur.friendsList[list]) {
- 240. - cur.friendsList[list] = [];
- 241. - }
- 242. - Array.prototype.push.apply(cur.friendsList[list], response[section]);
- 243. - if (list == 'requests' && response['sugg_requests']) {
- 244. - Array.prototype.push.apply(cur.friendsList['sugg_requests'], response['sugg_requests']);
- 245. - }
- 246. - this.showMore(false, start, end);
- 247. - curData.loading = false;
- 248. - curData.preload = preload;
- 249. - }).bind(this)
- 250. - });
- 251. - },
- 252. - canSugSwitch: function(list) {
- 253. - if (!list) {
- 254. - return cur.suggCount ? true : true;
- 255. - }
- 256. - if (cur.suggRev) {
- 257. - return list.length >= cur.suggCount || !cur.secData.requests.preload;
- 258. - } else {
- 259. - return list.length >= cur.requestsCount || !cur.secData.requests.preload;
- 260. - }
- 261. - },
- 262. - showMore: function(clear, start, end, plain) {
- 263. - if (!cur.friendsList) {
- 264. - return false;
- 265. - }
- 266. - var clist = cur.curList;
- 267. - var list = cur.friendsList[clist];
- 268. - if (start == undefined) {
- 269. - start = cur.shownFriends;
- 270. - }
- 271. - if (end == undefined) {
- 272. - end = cur.shownFriends + cur.friendsPerPage;
- 273. - }
- 274. - if (cur.section == 'requests') {
- 275. - if (cur.suggRev) {
- 276. - list = (cur.friendsList['sugg_requests'] || []).slice();
- 277. - if (Friends.canSugSwitch(list)) {
- 278. - var suggSwitch = parseInt(cur.suggCount);
- 279. - list.push.apply(list, cur.friendsList[cur.curList] || []);
- 280. - }
- 281. - } else if (!cur.suggRev && cur.requestsCount < end && Friends.canSugSwitch(list)) {
- 282. - list = (list || []).slice();
- 283. - var suggSwitch = parseInt(cur.requestsCount);
- 284. - list.push.apply(list, cur.friendsList['sugg_requests']);
- 285. - }
- 286. - }
- 287. - if (!list || !list.length) {
- 288. - if (cur.shownFriends == 0 && !cur.searchCount) {
- 289. - if (cur.isLoading) {
- 290. - return false; // Dont show empty msg while search
- 291. - }
- 292. - if (cur.searchStr) {
- 293. - addClass(ge('not_found'), 'f_search');
- 294. - ge('search_ph').innerHTML = cur.searchStr.replace(/([<>&#]*)/g, '');
- 295. - } else {
- 296. - removeClass(ge('not_found'), 'f_search');
- 297. - }
- 298. - var text = '';
- 299. - if (cur.curList.substr(0, 4) == 'list') {
- 300. - if (cur.filterIds) {
- 301. - text = cur.summaryLang['list_not_found_filter'];
- 302. - text = text.replace('{link}', '<a onclick="Friends.clearFilter(true);">').replace('{/link}', '</a>');
- 303. - } else {
- 304. - text = cur.summaryLang['list_not_found'];
- 305. - text = text.replace('{link}', '<a onclick="Friends.editList(-1);">').replace('{/link}', '</a>');
- 306. - }
- 307. - } else if (cur.filter) {
- 308. - text = cur.summaryLang['not_found_filter'];
- 309. - text = text.replace('{link}', '<a onclick="Friends.clearFilter(true);">').replace('{/link}', '</a>');
- 310. - } else {
- 311. - text = cur.summaryLang['not_found'];
- 312. - }
- 313. - ge('not_found_text').innerHTML = text;
- 314. - show('not_found');
- 315. - }
- 316. - if (clear) {
- 317. - cur.fContent.innerHTML = '';
- 318. - }
- 319. - if (cur.searchCount) {
- 320. - Friends.serverSearchMore();
- 321. - }
- 322. - hide('show_more');
- 323. - return;
- 324. - } else if (isVisible('not_found')) {
- 325. - hide('not_found');
- 326. - }
- 327. -
- 328. - var friends = list.slice(start, end);
- 329. - if (!friends.length) {
- 330. - // can upload
- 331. - var secData = cur.secData[cur.section];
- 332. - if (secData && secData.preload) {
- 333. - Friends.loadMore(start, end);
- 334. - }
- 335. - if (cur.searchCount) {
- 336. - Friends.serverSearchMore();
- 337. - }
- 338. - if (cur.shownFriends >= cur.sectionCount) {
- 339. - hide('show_more');
- 340. - }
- 341. - return;
- 342. - }
- 343. - var html = [];
- 344. - var first = (cur.shownFriends == 0) ? ' user_block_first' : '';
- 345. - if (clear) {
- 346. - cur.fContent.innerHTML = '';
- 347. - }
- 348. - for (i in friends) {
- 349. - var iSt = parseInt(i) + start;
- 350. - if (suggSwitch && suggSwitch == iSt) {
- 351. - if (cur.suggRev) {
- 352. - var summaryText = langNumeric(cur.requestsCount, cur.summaryLang['requests']);
- 353. - if (nav.objLoc.sort != 'date') {
- 354. - summaryText += '<span class="divide">|</span><span><a href="/friends?section=' + cur.section + '&sort=date">' + cur.summaryLang['friends_sort_by_date'] + '</a></span>';
- 355. - } else {
- 356. - summaryText += '<span class="divide">|</span><span><a href="/friends?section=' + cur.section + '">' + cur.summaryLang['friends_sort_by_common'] + '</a></span>';
- 357. - }
- 358. - } else {
- 359. - var summaryText = langNumeric(cur.suggCount, cur.summaryLang['friends_sugg_summary']);
- 360. - }
- 361. - html.push('<div id="friends_sub_summary" class="summary_wrap"><div class="summary">',summaryText,'</div></div>');
- 362. - first = ' user_block_first';
- 363. - }
- 364. - if (cur.selection) {
- 365. - var friend = friends[i].slice();
- 366. - friend[5] = friend[5].replace(cur.selection.re, cur.selection.val);
- 367. - } else {
- 368. - var friend = friends[i];
- 369. - }
- 370. - if (cur.importCount && cur.importCount == cur.shownFriends && cur.section == 'suggestions') {
- 371. - html.push('<div id="friends_sub_summary" class="summary_wrap"><div class="summary">',cur.summaryLang['suggestions'],'</div></div>');
- 372. - first = ' user_block_first';
- 373. - }
- 374. - /*if (friend[0] && ge('user_block' + friend[0])) { // bad with search
- 375. - debugLog('here');
- 376. - continue;
- 377. - }*/
- 378. - ++cur.shownFriends;
- 379. - if (!friend) {
- 380. - continue;
- 381. - }
- 382. - var tplType = '';
- 383. - if (cur.section == 'requests') {
- 384. - if (suggSwitch <= iSt) {
- 385. - tplType = (!cur.suggRev ? 'sugg_requests' : '');
- 386. - } else {
- 387. - tplType = (!cur.suggRev ? '' : 'sugg_requests');
- 388. - }
- 389. - }
- 390. - Array.prototype.push.apply(html, Friends.drawFriend(friend, first, tplType));
- 391. - first = '';
- 392. - }
- 393. - if (plain) {
- 394. - return '<div>'+html.join('')+'</div>';
- 395. - }
- 396. - cur.fContent.appendChild(ce('div', {innerHTML: html.join('')}));
- 397. - if (cur.shownFriends >= cur.sectionCount) {
- 398. - hide('show_more');
- 399. - } else {
- 400. - show('show_more');
- 401. - }
- 402. - },
- 403. -
- 404. - updateList: function(e, obj, force) {
- 405. - if (!obj || e.keyCode == KEY.ESC) {
- 406. - obj = cur.fSearch;
- 407. - val(obj, '');
- 408. - cur.searchStr = '';
- 409. - }
- 410. - if (cur.silent) {
- 411. - cur.onSilentLoad = function() {
- 412. - Friends.updateList(e, obj, true);
- 413. - };
- 414. - if (trim(obj.value)) {
- 415. - hide(cur.showMore);
- 416. - cur.fContent.innerHTML = '<div class="wide_loading"></div>';
- 417. - }
- 418. - return;
- 419. - }
- 420. - clearTimeout(this.searchTimout);
- 421. - this.searchTimout = setTimeout((function() {
- 422. - var str = trim(obj.value);
- 423. - if (str && cur.searchStr == str) return;
- 424. - cur.searchStr = str;
- 425. - if (str) {
- 426. - if (cur.section != 'all' && cur.section != 'phonebook') {
- 427. - this.selectTab('all');
- 428. - this.selectSection('all');
- 429. - cur.curList = cur.section = 'all';
- 430. -
- 431. - nav.setLoc(extend(nav.objLoc, {'section': 'all'}));
- 432. - }
- 433. - this.search(str, cur.section);
- 434. - this.changeSummary();
- 435. - } else if (cur.section != cur.curList || force) {
- 436. - this.showSection();
- 437. - this.changeSummary();
- 438. - this.showMore();
- 439. - } else {
- 440. - this.hideLoading();
- 441. - cur.searchCount = 0;
- 442. - this.showMore();
- 443. - }
- 444. - }).bind(this), 10);
- 445. - },
- 446. - showSection: function(section) {
- 447. - cur.shownFriends = 0;
- 448. - cur.curList = cur.section = section || cur.section;
- 449. - if (vk.id == cur.oid) {
- 450. - if (cur.section == 'requests' || cur.section == 'all_requests' || cur.section == 'out_requests') {
- 451. - hide('friends_search');
- 452. - var tabsCount = ((cur.requestsCount || cur.suggCount) ? 1 : 0) + (cur.allRequestsCount ? 1 : 0) + (cur.outRequestsCount ? 1 : 0);
- 453. - toggle('friends_req_tabs', tabsCount > 1);
- 454. - toggle('friends_hide_all', (cur.section == 'requests') && (cur.requestsCount > 1 || cur.suggCount));
- 455. - toggle(ge('sum_tab_requests').parentNode, cur.requestsCount > 0 || cur.suggCount > 0);
- 456. - toggle(ge('sum_tab_all_requests').parentNode, cur.allRequestsCount > 0);
- 457. - toggle(ge('sum_tab_out_requests').parentNode, cur.outRequestsCount > 0);
- 458. - show('tab_requests');
- 459. - addClass(ge('main_class'), 'wide');
- 460. - } else {
- 461. - show('friends_search');
- 462. - hide('friends_req_tabs');
- 463. - (cur.allFriendsCount ? removeClass : addClass)(ge('main_class'), 'wide');
- 464. - }
- 465. - toggle('tab_requests', nav.objLoc.act != 'invite' && (cur.requestsCount || cur.allRequestsCount || cur.outRequestsCount || cur.suggCount));
- 466. - }
- 467. - if (cur.filterIds) {
- 468. - cur.curList += '_filter';
- 469. - }
- 470. - var list = cur.friendsList[cur.curList];
- 471. - if (!list) {
- 472. - if (section == 'recent' || section == 'phonebook' || section == 'requests') {
- 473. - var friendsList = section;
- 474. - } else {
- 475. - var friendsList = 'all';
- 476. - }
- 477. - list = cur.friendsList[cur.curList] = this.filter(cur.friendsList[friendsList], cur.section);
- 478. - }
- 479. - cur.sectionCount = (list) ? list.length : 0;
- 480. - cur.selection = false;
- 481. - if (cur.filter && !cur.filterIds && section != 'suggestions') {
- 482. - Friends.changeFilter();
- 483. - if (!cur.searchStr) {
- 484. - hide('friends_reset_search');
- 485. - this.clearServerSearch();
- 486. - }
- 487. - return false;
- 488. - }
- 489. - this.showMore(true);
- 490. - if (!cur.searchStr) {
- 491. - hide('friends_reset_search');
- 492. - this.clearServerSearch();
- 493. - }
- 494. - },
- 495. -
- 496. - updateView: function() {
- 497. - cur.fContent.innerHTML = this.showMore(false, 0, cur.shownFriends, true);
- 498. - },
- 499. -
- 500. - showLoading: function() {
- 501. - cur.isLoading = 1;
- 502. - show('friends_loading');
- 503. - hide('friends_reset_search');
- 504. - },
- 505. -
- 506. - hideLoading: function() {
- 507. - cur.isLoading = 0;
- 508. - hide('friends_loading');
- 509. - if (cur.searchStr) {
- 510. - show('friends_reset_search');
- 511. - }
- 512. - },
- 513. -
- 514. - serverSearchMore: function() {
- 515. - if (cur.serverLoadingMore) {
- 516. - return;
- 517. - }
- 518. - if (cur.searchFinished) {
- 519. - return;
- 520. - }
- 521. - cur.serverLoadingMore = true;
- 522. - ajax.post('friends', {
- 523. - act: 'server_search',
- 524. - q: cur.searchStr,
- 525. - offset: cur.searchOffset
- 526. - }, {
- 527. - onDone: function(html, found, summary, newOffset) {
- 528. - cur.searchFinished = !found;
- 529. - if (cur.searchFinished) {
- 530. - hide('friends_search_more');
- 531. - }
- 532. - cur.searchOffset = newOffset;
- 533. - cur.serverLoadingMore = false;
- 534. - ge('friends_search_cont').appendChild(ce('div', {innerHTML: html}));
- 535. - },
- 536. - showProgress: function() {
- 537. - addClass(ge('friends_search_more'), 'load_more');
- 538. - },
- 539. - hideProgress: function() {
- 540. - removeClass(ge('friends_search_more'), 'load_more');
- 541. - }
- 542. - });
- 543. - },
- 544. -
- 545. - serverSearch: function(str, count, exclude) {
- 546. - cur.searchCount = 0;
- 547. - Friends.showLoading();
- 548. - cur.serverSearchStr = str;
- 549. - clearTimeout(cur.serverSearchTimeout);
- 550. - var excludeList = [];
- 551. - for (var i in exclude) {
- 552. - excludeList.push(exclude[i][0]);
- 553. - }
- 554. - cur.serverSearchTimeout = setTimeout((function() {
- 555. - ajax.post('friends', {
- 556. - act: 'server_search',
- 557. - q: str,
- 558. - exclude: excludeList.join(',')
- 559. - }, {
- 560. - onDone: function(html, found, summary, newOffset) {
- 561. - cur.searchOffset = newOffset;
- 562. - cur.searchFinished = !found;
- 563. - Friends.hideLoading();
- 564. - if (cur.searchStr != str) return;
- 565. - var cont = ge('friends_search_cont');
- 566. - cur.searchCount = found;
- 567. - if (cur.shownFriends == 0) {
- 568. - hide(cont);
- 569. - cur.fContent.innerHTML = '';
- 570. - Friends.showMore();
- 571. - }
- 572. - if (!found) {
- 573. - Friends.changeSummary();
- 574. - return;
- 575. - }
- 576. - if (cur.searchFinished) {
- 577. - hide('friends_search_more');
- 578. - } else {
- 579. - show('friends_search_more');
- 580. - }
- 581. - cur.searchSummary = summary;
- 582. - if (count) {
- 583. - html = '<div class="summary_wrap"><div class="summary">'+summary+'</div></div>'+html;
- 584. - }
- 585. - cont.innerHTML = html;
- 586. - show(cont);
- 587. - Friends.changeSummary();
- 588. - hide('not_found');
- 589. - },
- 590. - onFail: Friends.hideLoading
- 591. - });
- 592. - }).bind(this), 300);
- 593. - },
- 594. -
- 595. - clearServerSearch: function() {
- 596. - hide('friends_search_cont');
- 597. - hide('friends_search_more');
- 598. - cur.searchCount = 0;
- 599. - },
- 600. -
- 601. - goToSearch: function(obj) {
- 602. - nav.go('search?c%5Bname%5D=1&c%5Bq%5D='+encodeURIComponent(cur.searchStr)+'&c%5Bsection%5D=people');
- 603. - },
- 604. -
- 605. - search: function(str, type, callback, filter) {
- 606. - cur.shownFriends = 0;
- 607. - cur.section = type;
- 608. - if (str) {
- 609. - var index = (type == 'phonebook') ? cur.phoneIndex : cur.friendsIndex;
- 610. - var checkTime = new Date().getTime();
- 611. - if (str == -1) {
- 612. - if (type == 'recent' || type == 'phonebook') {
- 613. - var friendsList = type;
- 614. - } else {
- 615. - var friendsList = 'all';
- 616. - }
- 617. - var res = this.filter(cur.friendsList[friendsList], type);
- 618. - str = '';
- 619. - if (str != cur.searchStr) {
- 620. - this.clearServerSearch();
- 621. - }
- 622. - } else {
- 623. - var res = index.search(str);
- 624. - if (cur.filterIds) {
- 625. - res = this.filter(res, type);
- 626. - }
- 627. - var count = res.length;
- 628. - if (count) {
- 629. - if (str != cur.serverSearchStr && !cur.sectionCount) {
- 630. - this.clearServerSearch();
- 631. - }
- 632. - }
- 633. - if (count < 5 && cur.oid == vk.id) { // try to find some on the server side
- 634. - this.serverSearch(str, count, res);
- 635. - }
- 636. - }
- 637. - var newList = cur.section;
- 638. - if (cur.filterIds) {
- 639. - newList += '_filter';
- 640. - }
- 641. - if (str) {
- 642. - newList += '_search_'+str;
- 643. - }
- 644. - if (cur.curList == newList && !filter) {
- 645. - return; // now at this section
- 646. - }
- 647. - cur.curList = newList;
- 648. - cur.friendsList[cur.curList] = res;
- 649. -
- 650. - if (str) {
- 651. - str += ' '+(parseLatin(str) || '');
- 652. - str = trim(escapeRE(str.replace(/[,]/g, '')));
- 653. - cur.selection = {
- 654. - re: new RegExp('('+str.replace(index.delimiter, '|').replace(/(^\||\|$|\?)/g, '')+')', 'gi'),
- 655. - val: '<em>$1</em>'
- 656. - };
- 657. - }
- 658. - if (!cur.isLoading) {
- 659. - show('friends_reset_search');
- 660. - }
- 661. - } else {
- 662. - cur.curList = cur.section;
- 663. - cur.selection = false;
- 664. - hide('friends_reset_search');
- 665. - if (cur.searchStr) {
- 666. - this.clearServerSearch();
- 667. - }
- 668. - }
- 669. -
- 670. - cur.sectionCount = cur.friendsList[cur.curList].length;
- 671. - this.searchTimout = setTimeout((function() {
- 672. - this.showMore(true);
- 673. - if (callback) {
- 674. - Friends.onSectionChange();
- 675. - callback();
- 676. - }
- 677. - }).bind(this), 10);
- 678. - },
- 679. -
- 680. - changeSummary: function() {
- 681. - var sum = ge('friends_summary');
- 682. - var html = '';
- 683. - if (cur.curList.indexOf('_search_') != -1 || cur.filterIds) {
- 684. - if (!cur.sectionCount) {
- 685. - if (cur.searchCount) {
- 686. - html = cur.searchSummary;
- 687. - } else {
- 688. - if (cur.isLoading) {
- 689. - return; // no update while loading
- 690. - }
- 691. - html = cur.summaryLang['search_no'];
- 692. - }
- 693. - } else {
- 694. - html = langNumeric(cur.sectionCount, cur.summaryLang['search'], true);
- 695. - }
- 696. - } else if (cur.curList.slice(0, 4) == 'list') {
- 697. - var langKey = (parseInt(cur.curList.slice(4)) < 25) ? 'list' : 'pub_list';
- 698. - if (cur.sectionCount) {
- 699. - html = langNumeric(cur.sectionCount, cur.summaryLang[langKey], true);
- 700. - } else {
- 701. - html = cur.summaryLang[langKey+'_no'];
- 702. - }
- 703. - } else if (cur.section == 'suggestions') {
- 704. - if (!cur.importCount) {
- 705. - html = cur.summaryLang['suggestions'];
- 706. - } else {
- 707. - html = cur.summaryLang['import'];
- 708. - }
- 709. - } else if (cur.section == 'recent') {
- 710. - html = cur.summaryLang['recent'];
- 711. - } else if (cur.section == 'requests' && cur.requestsCount > 0) {
- 712. - if (cur.suggRev && cur.suggCount > 0) {
- 713. - html = langNumeric(cur.suggCount, cur.summaryLang['friends_sugg_summary'], true);
- 714. - } else {
- 715. - html = langNumeric(cur.requestsCount, cur.summaryLang[cur.section], true);
- 716. - }
- 717. - } else if (cur.section == 'requests' && cur.suggCount > 0) {
- 718. - html = langNumeric(cur.suggCount, cur.summaryLang['friends_sugg_summary'], true);
- 719. - } else if (cur.section == 'all_requests' && cur.sectionCount > 0) {
- 720. - html = langNumeric(cur.allRequestsCount, cur.summaryLang[cur.section], true);
- 721. - } else if (cur.section == 'out_requests' && cur.sectionCount > 0) {
- 722. - html = langNumeric(cur.outRequestsCount, cur.summaryLang[cur.section], true);
- 723. - } else if (cur.sectionCount > 0) {
- 724. - html = langNumeric(cur.sectionCount, cur.summaryLang[cur.section], true);
- 725. - } else {
- 726. - html = cur.summaryLang['all_no'];
- 727. - }
- 728. - if (cur.section.indexOf('list') == 0 && cur.oid == vk.id) {
- 729. - listNum = parseInt(cur.curList.substr(4));
- 730. - var list_edit_text = cur.summaryLang[(cur.sectionCount ? 'list_edit': 'list_start_edit')];
- 731. - html += '<span class="divider">|</span><span><a onclick="Friends.editList('+listNum+');">'+list_edit_text+'</a></span>';
- 732. - if (listNum < 25) {
- 733. - html += '<span class="divider">|</span><span><a onclick="Friends.deleteList('+listNum+');">'+cur.summaryLang['list_delete']+'</a></span>';
- 734. - }
- 735. - }
- 736. - if (vk.id != cur.oid) {
- 737. - html += '<span class="divider">|</span><span>' + cur.summaryLang['to_users_page'] + '</span>';
- 738. - }
- 739. - if ((cur.section == 'requests' && cur.requestsCount > 50) || cur.section == 'all_requests') {
- 740. - if (!cur.suggRev || !cur.suggCount) {
- 741. - if (nav.objLoc.sort != 'date') {
- 742. - html += '<span class="divide">|</span><span><a href="/friends?section=' + cur.section + '&sort=date">' + cur.summaryLang['friends_sort_by_date'] + '</a></span>';
- 743. - } else {
- 744. - html += '<span class="divide">|</span><span><a href="/friends?section=' + cur.section + '">' + cur.summaryLang['friends_sort_by_common'] + '</a></span>';
- 745. - }
- 746. - }
- 747. -
- 748. - }
- 749. - sum.innerHTML = html;
- 750. -
- 751. - document.title = replaceEntities(stripHTML(cur.htitles[cur.section] || cur.htitles.all));
- 752. - },
- 753. - selectTab: function(tab) {
- 754. - var section = geByClass1('active_link', ge('friends_tabs'));
- 755. - removeClass(section, 'active_link');
- 756. - addClass(ge('tab_' + tab), 'active_link');
- 757. - if (cur.oid != vk.id) {
- 758. - toggleClass(ge('main_class'), 'wide', tab != 'all' || !cur.allFriendsCount);
- 759. - }
- 760. - },
- 761. - selectSection: function(tab) {
- 762. - var section = geByClass1('cur_section', ge('sections_block'));
- 763. - removeClass(section, 'cur_section');
- 764. - addClass(ge('section_' + tab), 'cur_section');
- 765. - },
- 766. - selectSumTab: function(tab) {
- 767. - var section = geByClass1('summary_tab_sel', ge('friends_req_tabs'));
- 768. - removeClass(section, 'summary_tab_sel');
- 769. - addClass(section, 'summary_tab');
- 770. - var el = ge('sum_tab_' + tab).parentNode;
- 771. - removeClass(el, 'summary_tab');
- 772. - addClass(el, 'summary_tab_sel');
- 773. - },
- 774. - selectTabAndSection: function(type) {
- 775. - if (type == 'all' || type == 'online' || type == 'common' || type == 'members') {
- 776. - this.selectTab(type);
- 777. - this.selectSection('all');
- 778. - } else if (type == 'all_requests' || type == 'requests' || type == 'out_requests') {
- 779. - this.selectTab('requests');
- 780. - this.selectSumTab(type);
- 781. - } else {
- 782. - this.selectTab('all');
- 783. - this.selectSection(type);
- 784. - }
- 785. - },
- 786. - onSectionChange: function() {
- 787. - if (window.tooltips) {
- 788. - tooltips.hideAll();
- 789. - }
- 790. - },
- 791. - section: function(type, callback, updateData) {
- 792. - Friends.clearServerSearch();
- 793. - if (!type) {
- 794. - type = 'all';
- 795. - }
- 796. - //if (!updateData && (type != 'all' || cur.section != type) && type.substr(0, 4) != 'list') {
- 797. - if (!updateData && ((type == 'online' && cur.oid != vk.id) || type.indexOf('requests') != -1) && type.substr(0, 4) != 'list') {
- 798. - Friends.clearFilter();
- 799. - }
- 800. - if (!type) {
- 801. - if ((cur.requestsCount && cur.requestsCount > 0 && cur.requestsCount < 100) || cur.suggCount) {
- 802. - type = 'requests';
- 803. - } else {
- 804. - type = 'all';
- 805. - }
- 806. - }
- 807. - if (!cur.requestsCount && !cur.suggCount && !cur.allRequestsCount && !cur.outRequestsCount) {
- 808. - hide('tab_requests');
- 809. - }
- 810. - if (type != cur.section) {
- 811. - cur.fSearch.setValue('');
- 812. - cur.searchStr = '';
- 813. - }
- 814. - // Select section filter
- 815. - this.selectTabAndSection(type);
- 816. -
- 817. - if (cur.silent && type != 'suggestions' && type != 'out_requests') {
- 818. - cur.onSilentLoad = function() {
- 819. - Friends.section(type, callback);
- 820. - };
- 821. - if (type != cur.section) {
- 822. - hide(cur.showMore);
- 823. - cur.fContent.innerHTML = '<div class="wide_loading"></div>';
- 824. - }
- 825. - return;
- 826. - }
- 827. -
- 828. -
- 829. - if (!cur.secData[type]) {
- 830. - cur.secData[type] = {};
- 831. - }
- 832. - // from cache
- 833. - if (!updateData && cur.friendsList[type] || type == 'all' || (type == 'requests' && cur.friendsList['sugg_requests'])) {
- 834. - if (!cur.filter || type != 'suggestions') {
- 835. - this.showSection(type);
- 836. - callback();
- 837. - Friends.onSectionChange();
- 838. - return;
- 839. - }
- 840. - }
- 841. - // generate
- 842. - switch (type) {
- 843. - case 'online':
- 844. - case 'common':
- 845. - this.search(-1, type, callback);
- 846. - break;
- 847. - case 'phonebook':
- 848. - this.loadingState('phonebook');
- 849. - ajax.post('/al_friends.php', {act: 'phonebook', id: nav.objLoc.id}, {onDone: (function(data) {
- 850. - if (!data) {
- 851. - return;
- 852. - }
- 853. - cur.shownFriends = 0;
- 854. - cur.curList = cur.section = type;
- 855. - var list = cur.friendsList['all'];
- 856. - var phoneList = [];
- 857. - if (list) {
- 858. - for (var i = 0, len = list.length; i < len; i++) {
- 859. - var friend = list[i];
- 860. - var phone = data[friend[0]];
- 861. - if (phone) {
- 862. - friend.push(phone);
- 863. - phoneList.push(friend);
- 864. - }
- 865. - }
- 866. - }
- 867. - cur.friendsList[cur.section] = phoneList;
- 868. - cur.sectionCount = phoneList.length;
- 869. - cur.fContent.innerHTML = '';
- 870. - this.loadingState('phonebook', true);
- 871. - Friends.onSectionChange();
- 872. - callback();
- 873. - Friends.indexPhone();
- 874. - if (cur.filterIds) {
- 875. - cur.curList += '_filter';
- 876. - Friends.search(cur.searchStr || -1, cur.section, false, true);
- 877. - Friends.changeSummary();
- 878. - return;
- 879. - }
- 880. - this.showMore();
- 881. - }).bind(this)});
- 882. - break;
- 883. - case 'recent':
- 884. - this.loadingState('recent');
- 885. - ajax.post('/al_friends.php', {act: 'recent'}, {onDone: (function(data) {
- 886. - if (!data) {
- 887. - return;
- 888. - }
- 889. - cur.shownFriends = 0;
- 890. - cur.curList = cur.section = type;
- 891. - var list = [];
- 892. - len = data.length;
- 893. - for (var i = 0; i < len; i++) {
- 894. - var f = cur.friends[data[i]];
- 895. - if (f) {
- 896. - list.push(f);
- 897. - }
- 898. - }
- 899. - cur.friendsList[cur.section] = list;
- 900. - cur.sectionCount = list.length;
- 901. - cur.fContent.innerHTML = '';
- 902. - this.loadingState('recent', true);
- 903. - Friends.onSectionChange();
- 904. - callback();
- 905. - if (cur.filterIds) {
- 906. - cur.curList += '_filter';
- 907. - Friends.search(cur.searchStr || -1, cur.section, false, true);
- 908. - Friends.changeSummary();
- 909. - return;
- 910. - }
- 911. - this.showMore();
- 912. - }).bind(this)});
- 913. - break;
- 914. - case 'suggestions':
- 915. - this.loadingState('suggestions');
- 916. - ajax.post('/friends', extend({
- 917. - act: 'get_section_friends',
- 918. - section: 'suggestions'
- 919. - }, cur.filter || {}), {
- 920. - onDone: (function(list, preload, data) {
- 921. - var list = eval('('+list+')');
- 922. - extend(cur, data || {});
- 923. - var keyType = type + (cur.filterIds ? '_filter' : '');
- 924. - cur.friendsList[keyType] = list[type];
- 925. - this.loadingState(type, true);
- 926. - this.showSection(type);
- 927. - cur.secData[type].preload = preload;
- 928. - Friends.onSectionChange();
- 929. - callback();
- 930. - }).bind(this)
- 931. - });
- 932. - break;
- 933. - case 'out_requests':
- 934. - hide(cur.showMore, 'friends_hide_all');
- 935. - cur.fContent.innerHTML = '<div class="wide_loading"></div>';
- 936. - ajax.post('/friends', {act: 'out_requests'}, {onDone: (function(data, universities) {
- 937. - var obj = eval('('+data+')');
- 938. -
- 939. - // load friends json
- 940. - if (!obj) {
- 941. - return;
- 942. - }
- 943. - extend(cur.universities, universities);
- 944. - extend(cur.friendsList, obj);
- 945. -
- 946. - this.indexAll(function() {
- 947. - Friends.section(type, callback);
- 948. - });
- 949. - }).bind(this)});
- 950. - break;
- 951. - default:
- 952. - if (type.substr(0, 4) == 'list') {
- 953. - this.search(-1, type, callback);
- 954. - }
- 955. -
- 956. - }
- 957. - },
- 958. - loadingState: function(section, state) {
- 959. - if (state) {
- 960. - if (cur.oldSection) {
- 961. - removeClass(cur.oldSection, 'loading');
- 962. - }
- 963. - } else {
- 964. - cur.oldSection = ge('section_' + section);
- 965. - addClass(cur.oldSection, 'loading');
- 966. - }
- 967. - },
- 968. - scrollResize: function() {
- 969. - if (browser.mobile) return;
- 970. - var docEl = document.documentElement;
- 971. - var ch = window.innerHeight || docEl.clientHeight || bodyNode.clientHeight;
- 972. - var st = scrollGetY();
- 973. - if (!cur.pageEnd) {
- 974. - return;
- 975. - }
- 976. - if (st + ch * 3 > cur.pageEnd.offsetTop) {
- 977. - setTimeout(function() {
- 978. - Friends.showMore();
- 979. - }, 0);
- 980. - }
- 981. - },
- 982. - drawFriend: function(friend, first, type) {
- 983. - if (cur.section == 'requests' || cur.section == 'all_requests' || cur.section == 'out_requests' || cur.section == 'suggestions') {
- 984. - return cur.commonTpl(friend, type || cur.section, first);
- 985. - } else {
- 986. - return cur.friendsTpl(friend, cur.section, first);
- 987. - }
- 988. - },
- 989. -
- 990. - inviteToGroup: function(ev, gid, mid, invited, hash) {
- 991. - var setInvited = function(invited) {
- 992. - for(var i in cur.friendsList[cur.curList]) {
- 993. - var row = cur.friendsList[cur.curList][i];
- 994. - if (row[0] == mid) {
- 995. - row[10] = invited;
- 996. - //Friends.updateView();
- 997. - var block = ge('user_block'+mid), link = '';
- 998. - if (invited) {
- 999. - link = '<a href="" onclick="return Friends.inviteToGroup(event, '+gid+', '+mid+', 1, \''+row[11]+'\')">'+getLang('friends_cancel_invite')+'</a>';
- 1000. - } else {
- 1001. - link = '<a href="" onclick="return Friends.inviteToGroup(event, '+gid+', '+mid+', 0, \''+row[11]+'\')">'+getLang('friends_send_invite')+'</a>';
- 1002. - }
- 1003. - geByClass('actions', block)[0].innerHTML = link;
- 1004. - break;
- 1005. - }
- 1006. - }
- 1007. - }
- 1008. - if (invited) {
- 1009. - ajax.post('/al_page.php', {act:'a_cancel_invite', mid:mid, gid:gid, hash:hash}, {onDone:function(res){ }});
- 1010. - setInvited(0);
- 1011. - } else {
- 1012. - ajax.post('/al_page.php', {act:'a_invite', mid:mid, gid:gid, hash:hash}, {onDone:function(res, message) {
- 1013. - if (!res) {
- 1014. - setInvited(0);
- 1015. - ge('res'+mid).innerHTML = '<div class="res">'+message+'</div>';
- 1016. - hide('lists'+mid);
- 1017. - var block = ge('user_block'+mid);
- 1018. - hide(geByClass('actions', block)[0]);
- 1019. - }
- 1020. - }});
- 1021. - setInvited(1);
- 1022. - }
- 1023. - return false;
- 1024. - },
- 1025. -
- 1026. - acceptRequest: function(mid, hash, el) {
- 1027. - var controls = ge('request_controls_'+mid);
- 1028. - var controlsCont = controls.parentNode;
- 1029. - if (!el) {
- 1030. - controls.innerHTML = '<div align="center"><img src="/images/upload.gif"></div>';
- 1031. - }
- 1032. - ajax.post('al_friends.php', {act: 'add', mid: mid, hash: hash, request: 1, 'select_list': 1}, {onDone: function(text) {
- 1033. - controls.innerHTML = text;
- 1034. - delete cur.friendsList['recent'];
- 1035. - }, onFail: function(text) {
- 1036. - if (!text) return;
- 1037. -
- 1038. - showFastBox(getLang('global_error'), text);
- 1039. - return true;
- 1040. - }, showProgress: lockButton.pbind(el), hideProgress: unlockButton.pbind(el)});
- 1041. - Friends.processRequest(mid, true);
- 1042. - delete cur.friendsList['online'];
- 1043. - Friends.indexAll();
- 1044. - },
- 1045. -
- 1046. - declineRequest: function(mid, hash, el) {
- 1047. - var controls = ge('request_controls_'+mid);
- 1048. - var controlsCont = controls.parentNode;
- 1049. - if (!el) {
- 1050. - controls.innerHTML = '<div align="center"><img src="/images/upload.gif"></div>';
- 1051. - }
- 1052. - ajax.post('al_friends.php', {act: 'remove', mid: mid, hash: hash, report_spam: 1, from_section: cur.section}, {onDone: function(text) {
- 1053. - controls.innerHTML = text;
- 1054. - }, onFail: function(text) {
- 1055. - if (!text) return;
- 1056. -
- 1057. - showFastBox(getLang('global_error'), text);
- 1058. - return true;
- 1059. - }, showProgress: lockButton.pbind(el), hideProgress: unlockButton.pbind(el)});
- 1060. -
- 1061. - Friends.processRequest(mid, false);
- 1062. - },
- 1063. -
- 1064. - processRequest: function(mid, add, sugg) {
- 1065. - var reqs = cur.friendsList[sugg ? 'sugg_requests' : 'requests'] || [];
- 1066. - var len = reqs.length, found = false;
- 1067. - while (len--) {
- 1068. - if (reqs[len][0] == mid) {
- 1069. - var friend = reqs.splice(len, 1)[0];
- 1070. - if (sugg) {
- 1071. - --cur.suggCount;
- 1072. - } else {
- 1073. - --cur.requestsCount;
- 1074. - }
- 1075. - val(geByClass1('tab_word', ge('tab_requests')), cur.summaryLang['requests_title'] + (cur.requestsCount ? ('<span class="count">+' + cur.requestsCount + '</span>') : ''));
- 1076. - toggleClass(ge('tab_requests'), 'count', !!cur.requestsCount);
- 1077. - if (add) {
- 1078. - found = true;
- 1079. - friend.pop();
- 1080. - if (cur.friendsList['all']) {
- 1081. - cur.friendsList['all'].push(friend);
- 1082. - } else {
- 1083. - cur.friendsList['all'] = [friend];
- 1084. - }
- 1085. - cur.friends[friend[0]] = friend;
- 1086. - }
- 1087. - }
- 1088. - }
- 1089. - if (add) {
- 1090. - var reqs = cur.friendsList['all_requests'] || [];
- 1091. - var len = reqs.length;
- 1092. - while (len--) {
- 1093. - if (reqs[len][0] == mid) {
- 1094. - var friend = reqs.splice(len, 1)[0];
- 1095. - --cur.allRequestsCount;
- 1096. - if (!found) {
- 1097. - friend.pop();
- 1098. - if (cur.friendsList['all']) {
- 1099. - cur.friendsList['all'].push(friend);
- 1100. - } else {
- 1101. - cur.friendsList['all'] = [friend];
- 1102. - }
- 1103. - cur.friends[friend[0]] = friend;
- 1104. - }
- 1105. - }
- 1106. - }
- 1107. - } else {
- 1108. - var reqs = cur.friendsList['out_requests'] || [];
- 1109. - var len = reqs.length;
- 1110. - while (len--) {
- 1111. - if (reqs[len][0] == mid) {
- 1112. - var friend = reqs.splice(len, 1)[0];
- 1113. - --cur.outRequestsCount;
- 1114. - }
- 1115. - }
- 1116. - }
- 1117. - },
- 1118. -
- 1119. - reportSpam: function(mid, hash) {
- 1120. - var controls = ge('request_controls_' + mid);
- 1121. - if (!controls) {
- 1122. - controls = ge('result_msg');
- 1123. - removeClass(controls, 'msg');
- 1124. - }
- 1125. - controls.innerHTML = '<div align="center"><img src="/images/upload.gif"></div>';
- 1126. - ajax.post('al_friends.php', {act: 'report_spam', mid: mid, hash: hash}, {onDone: function(text) {
- 1127. - controls.innerHTML = text;
- 1128. - }});
- 1129. - },
- 1130. -
- 1131. - restoreFriend: function(el, id) {
- 1132. - var back = el.innerHTML;
- 1133. - ajax.post('al_friends.php', {act: 'add', mid: id, hash: cur.userHash, cats: cur.savedMasks[id]}, {
- 1134. - onDone: Friends.onRemoveFriend.pbind(id, true),
- 1135. - showProgress: function() {
- 1136. - el.innerHTML = '<center><img src="/images/upload.gif" /></center>';
- 1137. - },
- 1138. - hideProgress: function() {
- 1139. - el.innerHTML = back;
- 1140. - }
- 1141. - });
- 1142. - },
- 1143. -
- 1144. - deleteFriend: function(e, id, el) {
- 1145. - var back = el.innerHTML;
- 1146. - ajax.post('al_friends.php', {act: 'remove', mid: id, hash: cur.userHash}, {
- 1147. - onDone: Friends.onRemoveFriend.pbind(id, false),
- 1148. - showProgress: function() {
- 1149. - el.innerHTML = '<center><img src="/images/upload.gif" /></center>';
- 1150. - },
- 1151. - hideProgress: function() {
- 1152. - el.innerHTML = back;
- 1153. - }
- 1154. - });
- 1155. - return false;
- 1156. - },
- 1157. -
- 1158. - onRemoveFriend: function(mid, res) {
- 1159. - var needUpdateView = (cur.friendsList[cur.curList] || []).length < 10;
- 1160. -
- 1161. - for (var i in cur.friendsList) {
- 1162. - if (i != 'all' && i != 'requests' && i != 'all_requests' && i != 'out_requests' && i != 'suggestions') {
- 1163. - delete cur.friendsList[i];
- 1164. - }
- 1165. - }
- 1166. - var list = cur.friendsList['all'];
- 1167. - var len = list.length;
- 1168. - mid = positive(mid);
- 1169. -
- 1170. - var block = ge('user_block' + mid);
- 1171. - var fr = cur.friends[mid];
- 1172. - if (fr && block) {
- 1173. - if (res) {
- 1174. - fr[6] = cur.savedMasks[mid];
- 1175. - delete(cur.savedMasks[mid]);
- 1176. - } else {
- 1177. - cur.savedMasks[mid] = fr[6];
- 1178. - fr[6] = 0; // zero mask - removed friend
- 1179. - }
- 1180. - block.parentNode.replaceChild(ce('div', {innerHTML: cur.friendsTpl(fr, cur.section, hasClass(block, 'user_block_first') ? ' user_block_first' : '').join('')}).firstChild, block);
- 1181. - } else {
- 1182. - re(block);
- 1183. - }
- 1184. -
- 1185. - Friends.indexAll(function() {
- 1186. - });
- 1187. - },
- 1188. - showCommonBox: function(e, id, hash) {
- 1189. - if (checkEvent(e)) return true;
- 1190. - showBox('al_friends.php', {act: 'common_friends', mid: id, hash: hash}, {params: {bodyStyle: "padding: 0px;"}});
- 1191. - return false;
- 1192. - },
- 1193. - toList: function(num) {
- 1194. - nav.change({'0':'al_friends.php', section:'list' + num});
- 1195. - scrollToTop(0);
- 1196. - return false;
- 1197. - },
- 1198. -
- 1199. - /*ddShowSearchActs: function(obj, ev, uid) {
- 1200. - var elems = [];
- 1201. - elems.push('<a class="friends_dd_item" onclick="Friends.ddHide(ge(\'friends_dd_menu_'+uid+'\'), '+uid+');return showWriteMessageBox(event, '+uid+')">'+cur.summaryLang['global_write_msg']+'</a>');
- 1202. - Friends.ddShowCustom(obj, ev, elems, uid);
- 1203. - },*/
- 1204. -
- 1205. - ttActToggle: function(obj, uid, hash, add) {
- 1206. - var back = obj.innerHTML;
- 1207. - ajax.post('al_friends.php', {act: add ? 'add' : 'remove', mid: uid, hash: hash, from: 'friends'}, {
- 1208. - onDone: function(text) {
- 1209. - //re(obj);
- 1210. - cur['friends_info'+uid] = add;
- 1211. - showDoneBox('<div class="friends_done">'+text+'</div>')
- 1212. - tooltips.destroyAll();
- 1213. - //ge('friends_tt_cont_'+uid).tt.close();
- 1214. - },
- 1215. - showProgress: function() {
- 1216. - obj.innerHTML = '<center><img src="/images/upload.gif" /></center>';
- 1217. - },
- 1218. - hideProgress: function() {
- 1219. - obj.innerHTML = back;
- 1220. - }
- 1221. - })
- 1222. - },
- 1223. -
- 1224. - ttActGift: function(uid) {
- 1225. - return !showBox('al_gifts.php', {act: 'get_gift_box', mid: uid, fr: (uid == vk.id ? 1 : 0)}, {stat: ['gifts.css', 'ui_controls.js', 'ui_controls.css'], cache: 1}, false);
- 1226. - },
- 1227. -
- 1228. - ttActsMenu: function(obj, ev, uid, hash) {
- 1229. - if (obj.tt) {
- 1230. - if (!obj.tt.show) return;
- 1231. - return obj.tt.show();
- 1232. - }
- 1233. - if (window.tooltips) {
- 1234. - tooltips.hideAll();
- 1235. - }
- 1236. - var info = cur['friends_info'+uid] || '';
- 1237. - var html = ['<div class="friends_tt_menu">'];
- 1238. - html.push('<a class="friends_tt_item" onclick="return showWriteMessageBox(event, '+uid+')"><div class="friends_tt_icon friends_tt_msg"></div>'+cur.summaryLang['global_write_msg']+'</a>');
- 1239. - if (info) {
- 1240. - html.push('<a class="friends_tt_item" onclick="return Friends.ttActToggle(this, '+uid+', \''+hash+'\', 0);"><div class="friends_tt_icon friends_tt_cancel"></div>'+cur.summaryLang['friends_add_cancel']+'</a>');
- 1241. - } else if (!cur.friends[uid]) {
- 1242. - html.push('<a class="friends_tt_item" onclick="return Friends.ttActToggle(this, '+uid+', \''+hash+'\', 1);"><div class="friends_tt_icon friends_tt_add"></div>'+cur.summaryLang['friends_add_act']+'</a>');
- 1243. - }
- 1244. - html.push('<a class="friends_tt_item" onclick="return Friends.ttActGift('+uid+');"><div class="friends_tt_icon friends_tt_gift"></div>'+cur.summaryLang['friends_gift_act']+'</a>');
- 1245. - html.push('</div>');
- 1246. - showTooltip(obj, {
- 1247. - text: html.join(''),
- 1248. - className: 'friends_tt wall_tt',
- 1249. - shift: [0, 0, -2],
- 1250. - forcetodown: 1,
- 1251. - hasover: 1,
- 1252. - center: 1
- 1253. - });
- 1254. - },
- 1255. -
- 1256. - ddShow: function(uid, obj, ev) {
- 1257. - if (cur.silent) {
- 1258. - cur.onSilentLoad = function() {
- 1259. - Friends.ddShow(uid, obj, ev);
- 1260. - };
- 1261. - return;
- 1262. - }
- 1263. -
- 1264. - var friend = cur.friends[parseInt(uid)];
- 1265. - var cats = parseInt(friend[6]);
- 1266. -
- 1267. - var elems = [];
- 1268. -
- 1269. - var publicLists = [28, 29, 27, 25, 26];
- 1270. - for (var j = 0, i; j < 5; ++j) {
- 1271. - i = publicLists[j];
- 1272. - if (cur.publicLists[i]) {
- 1273. - elems.push('<a class="friends_dd_item'+((cats & (1 << parseInt(i))) ? ' checked' : '')+'" onclick="Friends.checkCat(this, '+uid+', '+i+');">'+cur.publicLists[i]+'</a>');
- 1274. - }
- 1275. - }
- 1276. - for (var i in cur.userLists) {
- 1277. - if (i < 25) {
- 1278. - var lname = cur.userLists[i];
- 1279. - if (lname.length > 20) {
- 1280. - lname = trim(lname.substr(0, 18))+'...';
- 1281. - }
- 1282. - elems.push('<a class="friends_dd_item'+((cats & (1 << parseInt(i))) ? ' checked' : '')+'" onclick="Friends.checkCat(this, '+uid+', '+i+');">'+lname+'</a>');
- 1283. - }
- 1284. - }
- 1285. - Friends.ddShowCustom(obj, ev, elems, uid);
- 1286. - },
- 1287. -
- 1288. - ddShowCustom: function(obj, event, elems, ddId) {
- 1289. - var text = obj.innerHTML;
- 1290. - var pos = getXY(obj);
- 1291. - var height = window.innerHeight ? window.innerHeight : (document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.offsetHeight);
- 1292. - var posY = pos[1] - scrollGetY();
- 1293. - var ddHeight = elems.length * 22;
- 1294. -
- 1295. - var params = {
- 1296. - className: 'lists_menu'
- 1297. - }
- 1298. -
- 1299. - var styleAdd = '';
- 1300. - var headerAdd = '';
- 1301. -
- 1302. - if (posY > (height / 2) && (height - posY) < ddHeight) {
- 1303. - headerAdd = ' friends_header_up';
- 1304. - elems = elems.reverse();
- 1305. - styleAdd = ' style="margin-top: -'+(ddHeight + 1)+'px;"';
- 1306. - }
- 1307. -
- 1308. - var htmlH = ['<div id="friends_dd_menu_',ddId,'" onmouseout="Friends.ddHide(this, ',ddId,');" onmouseover="Friends.ddActive(this, ',ddId,');"><div class="lists_header', headerAdd,'"><div>', text, '</div></div><div class="lists_body" ', styleAdd,'><table cellspacing="0" cellpadding="0"><tbody><tr><td class="lists_shad_l"><div></div></td><td><div class="lists_shad_t2"></div><div class="lists_shad_t"></div><div class="lists_rows"><div id="rows3">'];
- 1309. -
- 1310. - var htmlF = '</div></div><div class="lists_shad_b"></div><div class="lists_shad_b2"></div></td><td class="lists_shad_r"><div> </div></td></tr></tbody></table></div></div>';
- 1311. -
- 1312. - params.innerHTML = htmlH.join('') + elems.join('') + htmlF;
- 1313. -
- 1314. - var dd = ce('div', params);
- 1315. -
- 1316. - obj.parentNode.insertBefore(dd, obj);
- 1317. - cur.onMouseClick = function(ev) {
- 1318. - var menuId = 'friends_dd_menu_'+ddId;
- 1319. - var obj = ev.target;
- 1320. - while (obj) {
- 1321. - if (hasClass(obj, 'lists_select') || obj.id == menuId) {
- 1322. - return false;
- 1323. - }
- 1324. - obj = obj.parentNode;
- 1325. - }
- 1326. - if (ev.target)
- 1327. - Friends.ddHide(ge(menuId), ddId, 1);
- 1328. - }
- 1329. - },
- 1330. -
- 1331. - ddHide: function(obj, ddId, fast) {
- 1332. - cur.timeouts['dd_fade'+ddId] = setTimeout(function() {
- 1333. - fadeOut(obj, fast ? 0 : 100, function() {
- 1334. - var parentEl = obj.parentNode.parentNode;
- 1335. - if (parentEl) {
- 1336. - parentEl.removeChild(obj.parentNode);
- 1337. - }
- 1338. - });
- 1339. - }, fast ? 0 : 600);
- 1340. - },
- 1341. - ddActive: function(obj, ddId) {
- 1342. - if (cur.timeouts['dd_fade'+ddId]) {
- 1343. - clearTimeout(cur.timeouts['dd_fade'+ddId]);
- 1344. - }
- 1345. - },
- 1346. - checkCat: function(obj, uid, listId, from) {
- 1347. - if (from == 1) {
- 1348. - var checked = isChecked(obj);
- 1349. - } else {
- 1350. - var checked = hasClass(obj, 'checked');
- 1351. - var lists = ge('lists' + uid);
- 1352. - }
- 1353. - var friend = cur.friends[uid];
- 1354. - if (!friend) {
- 1355. - return false;
- 1356. - }
- 1357. - friend[6] = parseInt(friend[6]);
- 1358. - if (checked) {
- 1359. - if (friend[6] & (1 << listId)) {
- 1360. - friend[6] -= (1 << listId);
- 1361. - }
- 1362. - if (lists) {
- 1363. - lists.innerHTML = Friends.getLists(friend[6]);
- 1364. - }
- 1365. - } else {
- 1366. - if (!(friend[6] & (1 << listId))) {
- 1367. - friend[6] += (1 << listId);
- 1368. - }
- 1369. - if (lists) {
- 1370. - lists.innerHTML = Friends.getLists(friend[6]);
- 1371. - }
- 1372. - }
- 1373. -
- 1374. - if (from == 1) {
- 1375. - checkbox(obj);
- 1376. - } else {
- 1377. - (checked ? removeClass : addClass)(obj, 'checked');
- 1378. - }
- 1379. - if (cur.timeouts['list'+uid]) {
- 1380. - clearTimeout(cur.timeouts['list'+uid]);
- 1381. - }
- 1382. - delete cur.friendsList['list'+listId];
- 1383. - delete cur.friendsList['list'+friend[6]]
- 1384. - cur.timeouts['list'+uid] = setTimeout(function() {
- 1385. - ajax.post('al_friends.php', {act: 'save_cats', uid: uid, cats: friend[6], hash: cur.userHash}, {
- 1386. - onDone: function(text) {
- 1387. - if (from) {
- 1388. - var info = ge('friends_added_'+uid);
- 1389. - if (!cur['fr_add_text_'+uid] && info) {
- 1390. - cur['fr_add_text_'+uid] = info.innerHTML;
- 1391. - }
- 1392. - fadeTo(info, 100, 0, function() {
- 1393. - info.innerHTML = text;
- 1394. - fadeTo(info, 100, 1);
- 1395. - });
- 1396. - clearTimeout(cur['fr_add_timeout_'+uid]);
- 1397. - cur['fr_add_timeout_'+uid] = setTimeout(function() {
- 1398. - fadeTo(info, 100, 0, function() {
- 1399. - info.innerHTML = cur['fr_add_text_'+uid];
- 1400. - fadeTo(info, 100, 1);
- 1401. - });
- 1402. - }, 2000);
- 1403. - }
- 1404. - }
- 1405. - });
- 1406. - });
- 1407. - },
- 1408. - getLists: function(cats) {
- 1409. - var info = [];
- 1410. - for (var i = 29; i >= 25; i--) {
- 1411. - if ((1 << i) & cats && cur.publicLists[i]) {
- 1412. - info.push('<span class="group', (i - 1) % 8 + 1, ' fl_l" onmousedown="Friends.toList(', i, ');">', cur.publicLists[i], '</span>');
- 1413. - }
- 1414. - }
- 1415. - if (vk.id == cur.oid) {
- 1416. - for (var i in cur.userLists) {
- 1417. - if ((1 << i) & cats && !cur.publicLists[i] && cur.userLists[i]) {
- 1418. - info.push('<span class="group', (i - 1) % 8 + 1, ' fl_l" onmousedown="Friends.toList(', i, ');">', cur.userLists[i], '</span>');
- 1419. - }
- 1420. - }
- 1421. - }
- 1422. - return info.join('');
- 1423. - },
- 1424. - subscribeAllRequests: function(obj, hash) {
- 1425. - ajax.post('al_friends.php', {act: 'subscribe_all_requests', hash: hash, once: 1}, {
- 1426. - showProgress: lockButton.pbind(obj),
- 1427. - hideProgress: unlockButton.pbind(obj)
- 1428. - });
- 1429. - },
- 1430. - onAllRequestsRemove: function() {
- 1431. - return nav.go('/friends?section=all_requests', false, {nocur: true});
- 1432. - },
- 1433. - editList: function(listId) {
- 1434. - var checked = [];
- 1435. - if (listId == -1) {
- 1436. - listId = intval(cur.curList.substr(4));
- 1437. - }
- 1438. - if (listId) {
- 1439. - var list = Friends.filter(cur.friendsList['all'], cur.curList);
- 1440. - var len = list.length;
- 1441. - while (len--) {
- 1442. - checked.push(list[len][0]);
- 1443. - }
- 1444. - } else {
- 1445. - listId = 0;
- 1446. - }
- 1447. - showTabbedBox('al_friends.php', {
- 1448. - act: 'select_friends_box',
- 1449. - Checked: checked.join(','),
- 1450. - from: 'list',
- 1451. - list_name: (listId ? cur.userLists[listId] : ''),
- 1452. - list_id: listId
- 1453. - }, {
- 1454. - stat: ['privacy.js', 'ui_controls.js', 'ui_controls.css'],
- 1455. - cache: 1,
- 1456. - onFail: function(text) {
- 1457. - setTimeout(showFastBox(getLang('global_error'), text).hide, 3000);
- 1458. - return true;
- 1459. - }
- 1460. - });
- 1461. - cur.onFlistSave = function (ids, list, hash, title) {
- 1462. - var friendsList = [];
- 1463. - for (var i in list) {
- 1464. - friendsList.push(parseInt(i));
- 1465. - }
- 1466. -
- 1467. - ajax.post('al_friends.php', {act: 'save_list', title: title, cat_id: listId, Friends: friendsList.join(','), hash: hash}, {
- 1468. - onDone: function(id, title) {
- 1469. - Friends.editListClient(listId, id, title, friendsList);
- 1470. - },
- 1471. - onFail: function(text) {
- 1472. - setTimeout(showFastBox({title: getLang('global_error')}, text, getLang('global_close')).hide, 4000);
- 1473. - return true;
- 1474. - }
- 1475. - });
- 1476. -
- 1477. - Friends.clearFilter();
- 1478. -
- 1479. - return false;
- 1480. - };
- 1481. -
- 1482. - },
- 1483. - editListClient: function(listId, id, title, friendsList) {
- 1484. - var listName = 'list' + id;
- 1485. - if (listId == 0) {
- 1486. - var html = '<a onmousedown="return nav.change({\'0\':\'al_friends.php\', section:\'list'+id+'\'});" id="section_list'+id+'" class="side_filter">'+title+'</a>';
- 1487. - ge('sections_block').insertBefore(ce('div', {
- 1488. - innerHTML: html
- 1489. - }), ge('friends_create_list'));
- 1490. - var len = friendsList.length;
- 1491. - var mask = 1 << parseInt(id);
- 1492. - cur.friendsList[listName] = [];
- 1493. - while (len--) {
- 1494. - var friend = cur.friends[friendsList[len]];
- 1495. - friend[6] = parseInt(friend[6]);
- 1496. -
- 1497. - if (!(friend[6] & mask)) {
- 1498. - friend[6] += mask;
- 1499. - cur.friendsList[listName].push(friend)
- 1500. - }
- 1501. - }
- 1502. - cur.userLists[id] = title;
- 1503. - //Friends.indexAll();
- 1504. - Friends.indexAll();
- 1505. - removeClass(ge('main_class'), 'no_lists');
- 1506. - return nav.change({'0':'friends', section: listName});
- 1507. - } else {
- 1508. - if (id < 25) {
- 1509. - ge('section_list'+id).innerHTML = title;
- 1510. - cur.userLists[id] = title;
- 1511. - }
- 1512. - var mask = (1 << id);
- 1513. - cur.friendsList[listName] = [];
- 1514. - for (var i in cur.friends) {
- 1515. - var friend = cur.friends[i];
- 1516. - var inList = (friendsList.indexOf(parseInt(friend[0])) != -1);
- 1517. - if (inList) {
- 1518. - cur.friendsList[listName].push(friend);
- 1519. - }
- 1520. - friend[6] = parseInt(friend[6]);
- 1521. - if (friend[6] & mask) {
- 1522. - if (!inList) {
- 1523. - friend[6] -= mask;
- 1524. - }
- 1525. - } else {
- 1526. - if (inList) {
- 1527. - friend[6] += mask;
- 1528. - }
- 1529. - }
- 1530. - }
- 1531. - Friends.indexAll();
- 1532. - return Friends.section(listName, function() {
- 1533. - Friends.changeSummary();
- 1534. - nav.setLoc({'0':'friends', section: listName});
- 1535. - });
- 1536. - }
- 1537. - },
- 1538. - createList: function(event) {
- 1539. - Friends.editList(0);
- 1540. - },
- 1541. - deleteList: function(listId) {
- 1542. - showBox('al_friends.php', {act: 'delete_list_box', list_id: listId});
- 1543. - },
- 1544. - deleteListClient: function(listId) {
- 1545. - var listSection = ge('section_list'+listId);
- 1546. - listSection.parentNode.removeChild(listSection);
- 1547. - var mask = (1 << listId);
- 1548. - for (var i in cur.friends) {
- 1549. - if (cur.friends[i][6] & mask) {
- 1550. - cur.friends[i][6] -= mask;
- 1551. - }
- 1552. - }
- 1553. - delete cur.userLists[listId];
- 1554. - var listsCount = 0;
- 1555. - for (var i in cur.userLists) listsCount++;
- 1556. - if (!listsCount) {
- 1557. - addClass(ge('main_class'), 'no_lists');
- 1558. - }
- 1559. - //Friends.indexAll();
- 1560. - return nav.change({'0':'friends', section:'all'});
- 1561. - },
- 1562. - searchForFriends: function() {
- 1563. - showBox('al_friends.php', {act: 'search'}, {stat: ['friends_search.js', 'friends_search.css'], dark: 1});
- 1564. - },
- 1565. - selectList: function(obj, id, event) {
- 1566. - Friends.ddShow(id, obj, event);
- 1567. - },
- 1568. - _animDelX: function(color, new_active, post) {
- 1569. - if (post === undefined) {
- 1570. - post = new_active;
- 1571. - new_active = undefined;
- 1572. - }
- 1573. - var el = ge('delete_row' + post);
- 1574. - if (!el) return;
- 1575. - if (new_active !== undefined) {
- 1576. - el.active = new_active;
- 1577. - } else if (el.active) {
- 1578. - return;
- 1579. - }
- 1580. - animate(el, {backgroundColor: color}, 200);
- 1581. - },
- 1582. - hideSuggestion: function(mid, hash, el) {
- 1583. - var controls = ge('request_controls_'+mid);
- 1584. - var controlsCont = controls.parentNode;
- 1585. - (el || controls).innerHTML = '<div align="center"><img src="/images/upload.gif"></div>';
- 1586. - ajax.post('al_friends.php', {act: 'hide_suggestion', mid: mid, hash: hash, report_spam: 1}, {onDone: function(text) {
- 1587. - controls.innerHTML = text;
- 1588. - cur.suggCount -= 1;
- 1589. - }, onFail: function(text) {
- 1590. - if (!text) return;
- 1591. -
- 1592. - showFastBox(getLang('global_error'), text);
- 1593. - return true;
- 1594. - }});
- 1595. - Friends.processRequest(mid, false, true);
- 1596. -
- 1597. - },
- 1598. - addRecommend: function(mid, uid, hash, obj) {
- 1599. - obj = obj.parentNode;
- 1600. - obj.innerHTML = '<img src="/images/upload.gif" />';
- 1601. - ajax.post('al_friends.php', {
- 1602. - act: 'a_suggest_friends',
- 1603. - mid: mid,
- 1604. - uids: uid,
- 1605. - hash: hash,
- 1606. - from: 'add'
- 1607. - }, {
- 1608. - onDone: function(text) {
- 1609. - obj.innerHTML = text;
- 1610. - },
- 1611. - onFail: function(text) {
- 1612. - obj.innerHTML = text;
- 1613. - }
- 1614. - })
- 1615. -
- 1616. - },
- 1617. - suggestBox: function(mid) {
- 1618. - var box = showBox('al_friends.php', {
- 1619. - act: 'select_friends_box',
- 1620. - from: 'suggest_friends',
- 1621. - friend_id: mid
- 1622. - }, {stat: ['privacy.js', 'privacy.css', 'indexer.js', 'profile.css']});
- 1623. - box.leaveOnSave = true;
- 1624. - cur.onFlistSave = function(ids, list, hash) {
- 1625. - //if (!ids || !ids.length) return;
- 1626. - ajax.post('al_friends.php', {
- 1627. - act: 'a_suggest_friends',
- 1628. - mid: mid,
- 1629. - ids: ids.join(','),
- 1630. - hash: hash
- 1631. - }, {
- 1632. - onDone: function(text) {
- 1633. - box.hide();
- 1634. - showDoneBox(text);
- 1635. - },
- 1636. - showProgress: box.showProgress,
- 1637. - hideProgress: box.hideProgress
- 1638. - });
- 1639. - }
- 1640. - },
- 1641. - getAgeFromData: function(max, opts) {
- 1642. - max = parseInt(max);
- 1643. - if (!max > 0) max = opts.ageTo;
- 1644. - return Friends.getRangeData(opts.ageFrom, max, 1, opts.langAgeFrom+' ', opts.langAgeFromEmpty);
- 1645. - },
- 1646. - getAgeToData: function(min, opts) {
- 1647. - min = parseInt(min);
- 1648. - if (!min > 0) min = opts.ageFrom;
- 1649. - return Friends.getRangeData(min, opts.ageTo, 1, opts.langAgeTo+' ', opts.langAgeToEmpty);
- 1650. - },
- 1651. - getRangeData: function(min, max, step, prefix, label) {
- 1652. - if (min > max) return false;
- 1653. - var ret = [[0, label]];
- 1654. - if (step < 0) {
- 1655. - for (var i = max; i >= min; i += step)
- 1656. - ret.push([i, prefix + i]);
- 1657. - } else if (step > 0) {
- 1658. - for (var i = min; i <= max; i += step)
- 1659. - ret.push([i, prefix + i]);
- 1660. - }
- 1661. - return ret;
- 1662. - },
- 1663. - radioFilter: function(el, value, fireEvent) {
- 1664. - radiobtn(el, value, 'friends_radio_sex');
- 1665. - if (fireEvent || fireEvent == undefined) {
- 1666. - Friends.changeFilter();
- 1667. - }
- 1668. - },
- 1669. - initFilters: function(opts) {
- 1670. - stManager.add(['ui_controls.js', 'ui_controls.css'], function() {
- 1671. - cur.cityFilter = new Dropdown(ge('friends_fltr_city'), opts.cities, {
- 1672. - width: 150,
- 1673. - zeroPlaceholder: true,
- 1674. - placeholder: opts.citiesPl,
- 1675. - placeholderColor: '#777',
- 1676. - //selectedItems: '{$school_year}',
- 1677. - onChange: Friends.changeFilter,
- 1678. - onShow: function() {
- 1679. - if (cur.silent) {
- 1680. - cur.cityFilterOpened = true;
- 1681. - show('friends_fltr_progress');
- 1682. - }
- 1683. - }
- 1684. - });
- 1685. -
- 1686. - cur.ageFromFilter = new Dropdown(ge('friends_age_from'), Friends.getAgeFromData(opts.ageTo, opts), {
- 1687. - zeroPlaceholder: true,
- 1688. - placeholderColor: '#777',
- 1689. - width: 70,
- 1690. - onChange: function(value){
- 1691. - cur.ageToFilter.setData(Friends.getAgeToData(value, opts));
- 1692. - Friends.changeFilter();
- 1693. - }
- 1694. - });
- 1695. -
- 1696. - cur.ageToFilter = new Dropdown(ge('friends_age_to'), Friends.getAgeToData(opts.ageFrom, opts), {
- 1697. - zeroPlaceholder: true,
- 1698. - placeholderColor: '#777',
- 1699. - width: 70,
- 1700. - onChange: function(value){
- 1701. - cur.ageFromFilter.setData(Friends.getAgeFromData(value, opts));
- 1702. - Friends.changeFilter();
- 1703. - }
- 1704. - });
- 1705. -
- 1706. - window.radioBtns['friends_radio_sex'] = {
- 1707. - els: Array.prototype.slice.apply(geByClass('radiobtn', ge('friends_radio_sex'))),
- 1708. - val: 0
- 1709. - }
- 1710. - });
- 1711. - },
- 1712. - clearFilter: function(fireEvent) {
- 1713. - if (!cur.cityFilter) return;
- 1714. - cur.cityFilter.selectItem(0, false);
- 1715. - cur.ageFromFilter.selectItem(0, false);
- 1716. - cur.ageToFilter.selectItem(0, false);
- 1717. - Friends.radioFilter(ge('friends_radio_any'), 0, false);
- 1718. - cur.filterIds = false;
- 1719. - cur.filter = false;
- 1720. - if (fireEvent) {
- 1721. - Friends.changeFilter();
- 1722. - }
- 1723. - },
- 1724. - filterParams: function() {
- 1725. - var p = {
- 1726. - city: parseInt(cur.cityFilter.val()),
- 1727. - sex: parseInt(radioBtns['friends_radio_sex'].val),
- 1728. - age_from: parseInt(cur.ageFromFilter.val()),
- 1729. - age_to: parseInt(cur.ageToFilter.val())
- 1730. - }
- 1731. - if (p.city || p.sex || p.age_from || p.age_to) {
- 1732. - return p;
- 1733. - } else {
- 1734. - return false;
- 1735. - }
- 1736. - },
- 1737. - changeFilter: function() {
- 1738. - if (cur.silent) {
- 1739. - cur.onSilentLoad = function() {
- 1740. - Friends.changeFilter();
- 1741. - };
- 1742. - hide(cur.showMore);
- 1743. - cur.fContent.innerHTML = '<div class="wide_loading"></div>';
- 1744. - return;
- 1745. - }
- 1746. - cur.filter = Friends.filterParams();
- 1747. - if (cur.section == 'suggestions') {
- 1748. - return Friends.section(cur.section, function() {}, cur.filter || true);
- 1749. - }
- 1750. - if (cur.filter) {
- 1751. - ajax.post('friends', extend({act: 'filter_friends', uid: cur.oid}, cur.filter), {
- 1752. - onDone: function(ids) {
- 1753. - cur.filterIds = {};
- 1754. - for (var i in ids) {
- 1755. - cur.filterIds[ids[i]] = 1;
- 1756. - }
- 1757. - for (var i in cur.friendsList) {
- 1758. - if (i.split('_').pop() == 'filter') {
- 1759. - delete cur.friendsList[i];
- 1760. - }
- 1761. - }
- 1762. - Friends.search(cur.searchStr || -1, cur.section, false, true);
- 1763. - Friends.changeSummary();
- 1764. - },
- 1765. - progress: 'friends_fltr_progress',
- 1766. - cache: 1
- 1767. - })
- 1768. - } else {
- 1769. - if (cur.filterIds) {
- 1770. - cur.filterIds = false;
- 1771. - }
- 1772. - Friends.updateList();
- 1773. - }
- 1774. - },
- 1775. -
- 1776. - bigphOver: function(obj, uid) {
- 1777. - if (!window.lang || !lang.global_photo_full_size || browser.mobile) return;
- 1778. - var o = obj.firstChild, ch = cur.bigphCache[uid];
- 1779. - if (o.tagName != 'A' || o.className != 'friends_bigph') {
- 1780. - (o = obj.insertBefore(ce('a', {className: 'friends_bigph', href: ch && ch._id ? ('/photo' + ch._id + '?all=1') : ('/albums' + uid), innerHTML: '<span class="friends_bigph_label">' + getLang('global_photo_full_size') + '</span>'}), obj.firstChild)).onclick = Friends.bigphClick.pbind(uid);
- 1781. - o._uid = uid;
- 1782. - }
- 1783. -
- 1784. - clearTimeout(o.hideTO);
- 1785. - animate(o, {marginTop: 75}, {duration: 200, transition: Fx.Transitions.easeOutCirc});
- 1786. - cur.bigphShown[uid] = o;
- 1787. -
- 1788. - if (ch === undefined) {
- 1789. - cur.bigphCache[uid] = 'load';
- 1790. - ajax.post('al_photos.php', {act: 'fast_get_photo', oid: uid}, {onDone: function(res) {
- 1791. - if (!res) {
- 1792. - obj.onmouseover = function() {};
- 1793. - re(obj.firstChild);
- 1794. - return;
- 1795. - }
- 1796. - var sh = (cur.bigphCache[uid] == 'show');
- 1797. - cur.bigphCache[uid] = res;
- 1798. - o.href = '/photo' + res._id + '?all=1';
- 1799. - if (sh) Friends.bigphClick(uid);
- 1800. - }, onFail: function() {
- 1801. - obj.onmouseover = function() {};
- 1802. - re(obj.firstChild);
- 1803. - return true;
- 1804. - }});
- 1805. - }
- 1806. -
- 1807. - if (!obj.onmouseout) obj.onmouseout = Friends.bigphOut.pbind(obj);
- 1808. - },
- 1809. - bigphOut: function(obj) {
- 1810. - var o = obj.firstChild;
- 1811. - if (!o || o.tagName != 'A' || o.className != 'friends_bigph') return;
- 1812. -
- 1813. - clearTimeout(o.hideTO);
- 1814. - o.hideTO = setTimeout(function() {
- 1815. - animate(o, {marginTop: 100}, 200);
- 1816. - delete(cur.bigphShown[o._uid]);
- 1817. - }, 150);
- 1818. - },
- 1819. - bigphClick: function(uid, ev) {
- 1820. - if (checkEvent(ev) !== false) return;
- 1821. -
- 1822. - var ch = cur.bigphCache[uid];
- 1823. - if (ch == 'load' || ch == 'show') {
- 1824. - cur.bigphCache[uid] = 'show';
- 1825. - return cancelEvent(ev);
- 1826. - }
- 1827. - if (!ch) return;
- 1828. - return showPhoto(ch._id, 'album' + uid + '_0/rev', extend({jumpTo: {z: 'albums' + uid}}, ch), ev);
- 1829. - }
- 1830. -
- 1831. - }
- 1832. -
- 1833. - extend(Friends, {
- 1834. - rowOver: Friends._animDelX.pbind('#C4D2E1'),
- 1835. - rowOut: Friends._animDelX.pbind('#FFF'),
- 1836. - activeDeleteRow: function(post, tt) {
- 1837. - Friends._animDelX('#6B8DB1', 1, post);
- 1838. - if (tt) showTooltip(ge('delete_row' + post), {text: tt, showdt: 500, black: 1});
- 1839. - },
- 1840. - deactiveDeleteRow: Friends._animDelX.pbind('#C4D2E1', 0),
- 1841. - deleteRow: function(row, hash) {
- 1842. - rowInfo = row.split('_');
- 1843. - var obj = ge('suggestion'+row);
- 1844. - if (hasClass(obj, 'user_block_first')) {
- 1845. - nobj = obj.nextSibling;
- 1846. - while (nobj && !isVisible(nobj)) {
- 1847. - nobj = nobj.nextSibling;
- 1848. - }
- 1849. - if (nobj) {
- 1850. - if (nobj.id == 'friends_sub_summary') {
- 1851. - var summ = nobj.childNodes[0].innerHTML;
- 1852. - ge('friends_summary').innerHTML = summ;
- 1853. - re(nobj);
- 1854. - } else if (nobj.className) {
- 1855. - addClass(nobj, 'user_block_first')
- 1856. - }
- 1857. - }
- 1858. - }
- 1859. - slideUp('suggestion' + row, 100);
- 1860. - if (tooltips) {
- 1861. - tooltips.hide(ge('delete_row' + row))
- 1862. - }
- 1863. - ajax.post('al_friends.php', {act: 'hide_possible', mid: rowInfo[1], hash: hash}, {onDone: function() {
- 1864. - }});
- 1865. - var list = cur.friendsList['suggestions'];
- 1866. - row = row.split('_');
- 1867. - for (var i in list) {
- 1868. - if (parseInt(list[i][0]) == parseInt(row[1])) {
- 1869. - cur.friendsList['suggestions'].splice(i, 1);
- 1870. - }
- 1871. - }
- 1872. - cur.importCount -= 1;
- 1873. - }
- 1874. - });
- 1875. -
- 1876. - try{stManager.done('friends.js');}catch(e){}
- ------
- Файл - video.js (Старый размер - 44157 | Новый - 0):
- 0. - var Video = {
- 1. - regBR: new RegExp('<br>', 'g'),
- 2. - init: function(obj) {
- 3. - extend(cur, obj);
- 4. - extend(cur, {
- 5. - vSearch: ge('v_search'),
- 6. - videoSearch: ge('video_search'),
- 7. - vRows: ge('video_rows'),
- 8. - vList: ge('video_list'),
- 9. - vSearchRows: ge('video_search_rows'),
- 10. - more: ge('show_more'),
- 11. - notFound: ge('not_found'),
- 12. - pageEnd: ge('page_end'),
- 13. - summary: ge('video_summary'),
- 14. - hTab: ge('video_tab_hidden'),
- 15. - searchSummary: ge('video_search_summary'),
- 16. - secFilter: ge('video_section_filter'),
- 17. - albumsCont: ge('video_albums_wrap'),
- 18. - albumsContMore: ge('video_albums_more'),
- 19. - module: 'video',
- 20. - vOrder: 2
- 21. - });
- 22. - placeholderSetup(cur.vSearch, {back: true});
- 23. - onDomReady(function() {
- 24. - elfocus(cur.vSearch);
- 25. - });
- 26. - if (browser.mobile) {
- 27. - cur.cansort = false;
- 28. - }
- 29. -
- 30. - cur.perPage = 15;
- 31. - cur.searchCount = {};
- 32. - if (!cur.searchData) {
- 33. - cur.searchData = {};
- 34. - }
- 35. -
- 36. - cur.restoreRaw = {};
- 37. -
- 38. - var list = cur.videoList[cur.vSection];
- 39. -
- 40. - if (cur.vSection != 'all' && list) {
- 41. - len = list.length;
- 42. - }
- 43. -
- 44. - this.scrollNode = browser.msie6 ? pageNode : window;
- 45. -
- 46. - addEvent(this.scrollNode, 'scroll', this.scrollResize);
- 47. -
- 48. - setTimeout((function() {
- 49. - cur.destroy.push(function() {
- 50. - removeEvent(this.scrollNode, 'scroll', this.scrollResize);
- 51. - });
- 52. - }).bind(this), 0);
- 53. -
- 54. - setTimeout((function() {
- 55. - this.indexAll(cur.onIndexFinish);
- 56. - }).bind(this), 0);
- 57. -
- 58. -
- 59. - cur.timeouts = {};
- 60. - cur.destroy.push(function() {
- 61. - if (cur.timeouts) {
- 62. - for (var i in cur.timeouts) {
- 63. - clearTimeout(cur.timeouts);
- 64. - }
- 65. - }
- 66. - removeEvent(Video.scrollNode, 'scroll', Video.scrollResize);
- 67. - });
- 68. -
- 69. - if (cur.cansort) {
- 70. - cur.qsorterRowClass = 'video_row_cont';
- 71. - cur.qsorterRowUpClass = 'video_row_cont video_row_up';
- 72. - var videoRows = ge('video_rows');
- 73. - if (videoRows) {
- 74. - cur.sorter = qsorter.init(videoRows, {
- 75. - onReorder: Video.onReorder,
- 76. - xsize: 2,
- 77. - width: 308,
- 78. - height: 188,
- 79. - noMoveCursor: 1,
- 80. - canDrag: function(el) {
- 81. - if (hasClass(el.firstChild.firstChild, 'video_row_deleted')) {
- 82. - return 0;
- 83. - }
- 84. - if (cur.vSection == 'tagged') {
- 85. - return 0;
- 86. - }
- 87. - return hasClass(el.firstChild, 'video_can_edit') ? 1 : 0;
- 88. - },
- 89. - dragCont: cur.albumsCont,
- 90. - dragEls: geByClass('video_album_candrop', cur.albumsCont),
- 91. - onDrop: Video.albumDrop,
- 92. - onDragOver: Video.albumDragOver,
- 93. - onDragOut: Video.albumDragOut
- 94. - });
- 95. - }
- 96. - }
- 97. - if (cur.canEditAlbums && cur.albumsCont) {
- 98. - cur.qsorterRowClass = 'video_album video_album_candrop';
- 99. - cur.qsorterRowUpClass = 'video_album video_album_candrop video_row_up';
- 100. - cur.albumsSorter = qsorter.init(cur.albumsCont, {
- 101. - onReorder: Video.onAlbumReorder,
- 102. - xsize: 3,
- 103. - width: 205,
- 104. - height: 157,
- 105. - noMoveCursor: 1
- 106. - });
- 107. - }
- 108. -
- 109. - cur.nav.push((function(changed, old, n, opts) {
- 110. - if (typeof(changed.act) != 'undefined') {
- 111. - return;
- 112. - }
- 113. - if (window.mvcur) {
- 114. - var m = (changed[0] || '').match(/^video(-?\d+_\d+)/), owner;
- 115. - if (m) {
- 116. - if (!mvcur.mvShown || mvcur.videoRaw == m[1]) {
- 117. - showVideo(m[1], '', {});
- 118. - return false;
- 119. - }
- 120. - }
- 121. - if (!m && mvcur.mvShown && (owner = old[0].match(/^video(-?\d+)_\d+/))) {
- 122. - owner = intval(owner[1]);
- 123. - if (n[0] == 'video' && (owner == vk.id && !n.gid || owner < 0 && n.gid == -owner) || owner > 0 && n[0] == 'videos' + owner) {
- 124. - videoview.hide(opts.hist ? 2 : false);
- 125. - return false;
- 126. - }
- 127. - }
- 128. - }
- 129. - if (changed.q !== undefined) {
- 130. - cur.vSearch.value = changed.q;
- 131. - Video.searchVideos(changed.q);
- 132. - }
- 133. - if (old[0] == n[0] && (n.section || changed.section != undefined)) {
- 134. - if (!changed.id) {
- 135. - this.section(n.section);
- 136. - if (n.section != 'search') {
- 137. - delete n.q;
- 138. - }
- 139. - nav.setLoc(n);
- 140. - return false;
- 141. - }
- 142. - }
- 143. - }).bind(this));
- 144. -
- 145. - if (cur.silent) {
- 146. - this.loadSilent();
- 147. - } else {
- 148. - Video.onListInit();
- 149. - }
- 150. -
- 151. - if (cur.editmode) {
- 152. - VideoEdit.init();
- 153. - }
- 154. - cur.deleteAllToggle = Video.deleteAllToggle;
- 155. - },
- 156. - deleteAllToggle: function(obj) {
- 157. - var msg = geByClass1('video_row_deleted_msg', obj);
- 158. - if (msg) {
- 159. - var backTop = getStyle(msg, 'marginTop');
- 160. - setStyle(msg, {marginTop: 10});
- 161. - cur.cancelDeleteAllToggle = function(obj) {
- 162. - setStyle(msg, {marginTop: backTop});
- 163. - }
- 164. - }
- 165. - },
- 166. - privateTooltip: function(obj) {
- 167. - showTooltip(obj, {
- 168. - black: 1,
- 169. - text: '<div style="padding: 2px;">'+getLang('video_is_private_tt')+'</div>',
- 170. - center: 0,
- 171. - shift: [14, 6, 0],
- 172. - });
- 173. -
- 174. - },
- 175. - privateClick: function(obj, ev) {
- 176. - geByClass1('video_row_icon_edit', obj.parentNode.parentNode.parentNode).click();
- 177. - return cancelEvent(ev);
- 178. -
- 179. - },
- 180. - onReorder: function(video, before, after) {
- 181. - var video_id = video.id.replace('video_cont', '');
- 182. - var before_id = (before && before.id || '').replace('video_cont', '');
- 183. - var after_id = (after && after.id || '').replace('video_cont', '');
- 184. - ajax.post('al_video.php', {act: 'reorder_videos', video: video_id, before: before_id, after: after_id, hash: cur.hash});
- 185. - var list = cur.videoList[cur.vSection];
- 186. - var element = false;
- 187. - for (var i = 0, len = list.length; i < len; i++) {
- 188. - if (list[i][0]+'_'+list[i][1] == video_id) {
- 189. - element = list[i];
- 190. - list.splice(i, 1);
- 191. - break;
- 192. - }
- 193. - }
- 194. - if (!element) return;
- 195. - for (var i = 0, len = list.length; i < len; i++) {
- 196. - if (list[i][0]+'_'+list[i][1] == before_id) {
- 197. - list.splice(i, 0, element);
- 198. - return;
- 199. - }
- 200. - if (list[i][0]+'_'+list[i][1] == after_id) {
- 201. - list.splice(i+1, 0, element);
- 202. - return;
- 203. - }
- 204. - }
- 205. - },
- 206. - onAlbumReorder: function(album, before, after) {
- 207. - var album_id = album.id.replace('video_album_', '');
- 208. - var before_id = (before && before.id || '').replace('video_album_', '');
- 209. - var after_id = (after && after.id || '').replace('video_album_', '');
- 210. - ajax.post('al_video.php', {act: 'reorder_albums', oid: cur.oid, aid: album_id, before: before_id, after: after_id, hash: cur.reorder_hash});
- 211. -
- 212. - if (!cur.aIndex || !cur.aIndex.list) return;
- 213. - var list = cur.aIndex.list;
- 214. - var element = false;
- 215. - for (var i = 0, len = list.length; i < len; i++) {
- 216. - if (list[i][0] == album_id) {
- 217. - element = list[i];
- 218. - list.splice(i, 1);
- 219. - break;
- 220. - }
- 221. - }
- 222. - if (!element) return;
- 223. - for (var i = 0, len = list.length; i < len; i++) {
- 224. - if (list[i][0] == before_id) {
- 225. - element._order = list[i]._order - 0.01;
- 226. - list.splice(i, 0, element);
- 227. - return;
- 228. - }
- 229. - if (list[i][0] == after_id) {
- 230. - element._order = list[i]._order + 0.01;
- 231. - list.splice(i + 1, 0, element);
- 232. - return;
- 233. - }
- 234. - }
- 235. - },
- 236. - onListInit: function() {
- 237. - if (!cur.videoList[cur.vSection] && cur.vSection != 'comments') {
- 238. - this.generateList(cur.vSection);
- 239. - }
- 240. - },
- 241. - loadSilent: function() {
- 242. - cur.loadSilentRequests = (cur.loadSilentRequests || 0) + 1;
- 243. - if (cur.loadSilentRequests > 3) {
- 244. - return true;
- 245. - }
- 246. - ajax.post('al_video.php', {act: 'load_videos_silent', oid: cur.oid, offset: (cur.silentAll) ? 0 : cur.videoList['all'].length}, {
- 247. - onDone: function(list) {
- 248. - var list = eval('('+list+')');
- 249. - /*wideLoading = ge('video_wide_loading');
- 250. - if (wideLoading) {
- 251. - cur.vRows.removeChild(wideLoading);
- 252. - }*/
- 253. - cur.silent = false;
- 254. - for (var i in list) {
- 255. - if (!cur.videoList[i]) {
- 256. - cur.videoList[i] = list[i];
- 257. - } else {
- 258. - if (cur.silentAll) {
- 259. - cur.videoList[i] = list[i];
- 260. - } else {
- 261. - Array.prototype.push.apply(cur.videoList[i], list[i]);
- 262. - }
- 263. - }
- 264. - }
- 265. -
- 266. - if (cur.onSilentLoad) {
- 267. - cur.onSilentLoad();
- 268. - }
- 269. - Video.onListInit();
- 270. -
- 271. - Video.scrollResize();
- 272. - Video.indexAll();
- 273. - },
- 274. - onFail: function(text) {
- 275. - Video.loadSilent();
- 276. - }, local: 1
- 277. - });
- 278. - },
- 279. - show: function(e, videoId, opts, obj) {
- 280. - if (obj && hasClass(obj, 'video_row_deleted')) {
- 281. - return false;
- 282. - }
- 283. - if (!vk.id && obj && hasClass(obj, 'video_row_not_public')) {
- 284. - showDoneBox(getLang('video_please_sign_in'));
- 285. - return false;
- 286. - }
- 287. - var options = extend({root: 1, autoplay: 1}, opts || {});
- 288. - var videoData = videoId.split('_')
- 289. - if (cur.vSection == 'search' && parseInt(videoData[0]) != vk.id) {
- 290. - options.hideInfo = true;
- 291. - }
- 292. - if (cur.oid < 0) {
- 293. - var listId = 'club' + (-cur.oid);
- 294. - } else if (cur.vSection == 'tagged') {
- 295. - var listId = 'tag'+cur.oid;
- 296. - } else if (cur.pvVideoTagsShown && cur.pvShown) {
- 297. - var listId = 'tag'+cur.pvVideoTagsShown;
- 298. - } else {
- 299. - var listId = '';
- 300. - }
- 301. - return showVideo(videoId, listId, options, e);
- 302. - },
- 303. - indexAll: function(callback, onlyAlbums) {
- 304. - var all = cur.videoList['all'];
- 305. - var indexed = 0;
- 306. - var hub = new callHub(callback, onlyAlbums ? 1 : 2);
- 307. - if (!onlyAlbums) {
- 308. - cur.vIndex = new vkIndexer(all, function(obj) {
- 309. - return obj[3];
- 310. - }, function() {
- 311. - if (callback) {
- 312. - hub.done();
- 313. - }
- 314. - });
- 315. - }
- 316. - var albums = [];
- 317. - for(var i in cur.sections) {
- 318. - if (cur.sections[i][0] > 0) {
- 319. - albums.push(cur.sections[i]);
- 320. - }
- 321. - }
- 322. - cur.aIndex = new vkIndexer(albums, function(obj) {
- 323. - return obj[1];
- 324. - }, function() {
- 325. - if (callback) {
- 326. - hub.done();
- 327. - }
- 328. - });
- 329. - },
- 330. - addToList: function(list, row, silent) {
- 331. - if (!cur.videoList) return;
- 332. - var restore = cur.restoreRaw['d_'+row[0]+'_'+row[1]];
- 333. - if (restore) {
- 334. - for (var i in restore) {
- 335. - cur.videoList[restore[i].section].splice(restore[i].pos, 0, restore[i].val)
- 336. - }
- 337. - delete cur.restoreRaw['d_'+row[0]+'_'+row[1]];
- 338. - } else {
- 339. - cur.videoList[list].unshift(row);
- 340. - }
- 341. - cur.vIndex.add(row);
- 342. - if (!silent && cur.vSection != 'search') {
- 343. - Video.clearOutput();
- 344. - Video.showMore();
- 345. - }
- 346. - },
- 347. - onTagConfirm: function(mvData) {
- 348. - if (cur.videoList['tagged']) {
- 349. - var len = cur.videoList['tagged'].length;
- 350. - while(len--) {
- 351. - var item = cur.videoList['tagged'][len];
- 352. - if (item[0]+'_'+item[1] == mvData && item[8] & 2) {
- 353. - item[8] -= 2;
- 354. - }
- 355. - }
- 356. - }
- 357. - var videoRow = ge('video_row'+mvData);
- 358. - if (videoRow) {
- 359. - hide(geByClass1('video_tag_label', videoRow));
- 360. - }
- 361. - delete ajaxCache['/al_video.php#act=show&list=&module=video&video='+mvData];
- 362. - delete ajaxCache['/al_video.php#act=show&autoplay=1&list=&module=video&video='+mvData];
- 363. - },
- 364. - removeFromLists: function(mvData, silent) {
- 365. - cur.restoreRaw['d_'+mvData] = [];
- 366. - for (var i in cur.videoList) {
- 367. - var len = cur.videoList[i].length;
- 368. - while(len--) {
- 369. - var item = cur.videoList[i][len];
- 370. - if (item[0]+'_'+item[1] == mvData) {
- 371. - var val = cur.videoList[i].splice(len, 1)[0];
- 372. - cur.restoreRaw['d_'+mvData].push({
- 373. - section: i,
- 374. - pos: len,
- 375. - val: val
- 376. - });
- 377. - cur.vIndex.remove(item);
- 378. - }
- 379. - }
- 380. - }
- 381. - if (!silent) {
- 382. - var videoRow = ge('video_row'+mvData);
- 383. - if (videoRow) {
- 384. - videoRow.parentNode.removeChild(videoRow);
- 385. - }
- 386. - }
- 387. - },
- 388. - onDeleteClick: function(vid, oid, hash, obj, ev) {
- 389. - if (!cur.restoreRaw) cur.restoreRaw = {};
- 390. - var vidCont = ge('video_row'+oid+'_'+vid);
- 391. - cur.restoreRaw[oid+'_'+vid] = vidCont.innerHTML;
- 392. - addClass(vidCont, 'video_row_loading');
- 393. - videoview.deleteVideo(vid, oid, hash, false, 'list', this);
- 394. - return cancelEvent(ev);
- 395. - },
- 396. - searchAlbums: function(str) {
- 397. - if (str) {
- 398. - var a = cur.aIndex.search(str);
- 399. - a = a.sort(function(i,j) {return i._order - j._order});
- 400. - var summary = langNumeric(a.length, cur.lang['video_albums_found_summary'])
- 401. - } else {
- 402. - var a = clone(cur.aIndex.list);
- 403. - for(var i in cur.sections) {
- 404. - if (cur.sections[i][0] == -1) {
- 405. - a.unshift([-1, cur.sections[i][1]]);
- 406. - }
- 407. - }
- 408. - var summary = langNumeric(a.length, cur.lang['video_albums_summary'])
- 409. - }
- 410. - if (a.length) {
- 411. - ge('video_albums_summary').innerHTML = summary;
- 412. - var html = more_html = '';
- 413. - var num = 0;
- 414. - for (var i in a) {
- 415. - var alb = a[i][0];
- 416. - for(var i in cur.sections) {
- 417. - if (cur.sections[i][0] == alb) {
- 418. - var v = cur.sections[i];
- 419. - }
- 420. - }
- 421. - var title = v[1];
- 422. - if (cur.selection && str) {
- 423. - title = title.replace(cur.selection.re, cur.selection.val);
- 424. - }
- 425. - if (num >= 3) {
- 426. - more_html += cur.albumsTpl(alb, v, title);
- 427. - } else {
- 428. - html += cur.albumsTpl(alb, v, title);
- 429. - }
- 430. - num += 1;
- 431. - }
- 432. - if (cur.albumsCont) {
- 433. - cur.albumsCont.innerHTML = html;
- 434. - }
- 435. - if (cur.albumsContMore) {
- 436. - cur.albumsContMore.innerHTML = more_html;
- 437. - }
- 438. - if (ge('video_albums_show_more')) {
- 439. - ge('video_albums_show_more').innerHTML = langNumeric(a.length, cur.lang['video_show_all_albums']);
- 440. - toggle(ge('video_albums_show_more'), num > 3);
- 441. - }
- 442. - } else {
- 443. - addClass(ge('video_content'), 'video_albums_hidden');
- 444. - }
- 445. - },
- 446. - updateAlbums: function(newList) {
- 447. - for(var i in cur.sections) {
- 448. - if (cur.sections[i][0] > 0) {
- 449. - delete cur.sections[i];
- 450. - }
- 451. - }
- 452. - for(var i in newList) {
- 453. - cur.sections.push(newList[i]);
- 454. - }
- 455. - var num = 0;
- 456. - for(var i in cur.sections) num += 1;
- 457. - if (num) {
- 458. - removeClass(ge('video_content'), 'video_no_albums');
- 459. - hide('video_tabs_link');
- 460. - removeClass(ge('video_content'), 'video_albums_hidden');
- 461. - } else {
- 462. - addClass(ge('video_content'), 'video_no_albums');
- 463. - show('video_tabs_link');
- 464. - }
- 465. - Video.indexAll(function() {
- 466. - Video.searchAlbums(cur.vSection == 'search' ? cur.vStr : false);
- 467. - if (cur.canEditAlbums && cur.albumsSorter && !(trim(cur.vStr) && cur.vStr != '""')) {
- 468. - qsorter.update(cur.albumsCont);
- 469. - }
- 470. - if (cur.cansort) {
- 471. - qsorter.update(cur.vRows, {dragEls: geByClass('video_album_candrop', cur.albumsCont)});
- 472. - }
- 473. - }, true);
- 474. - },
- 475. - searchVideos: function(str, force) {
- 476. - var hd = cur.vHD ? cur.vHD : 0;
- 477. - cur.searchData[str + hd.toString() + cur.vOrder.toString()] = {
- 478. - count: 0,
- 479. - list: [],
- 480. - offset: 0
- 481. - };
- 482. - cur.loading = false;
- 483. - if (str) {
- 484. - if (cur.vSection != 'search') {
- 485. - cur.beforeSearch = cur.vSection;
- 486. - cur.vStr = '';
- 487. - /*if (browser.mobile) {
- 488. - cur.vSection = 'search';
- 489. - } else {*/
- 490. - nav.change({section: 'search'});
- 491. - /*}*/
- 492. - }
- 493. - show('video_search_options');
- 494. - addClass(ge('video_reset_search'), 'video_reset_search_shown');
- 495. - Video.showOptions();
- 496. - var v = cur.vIndex.search(str);
- 497. - cur.vStr = str;
- 498. - var sec = cur.vSection+'_'+str;
- 499. - if (cur.vHD) {
- 500. - sec += '_opt_hd'+cur.vHD;
- 501. - }
- 502. - cur.videoList[sec] = v;
- 503. - if (!str.replace(/\|/g, '').length) {
- 504. - cur.selection = false;
- 505. - } else {
- 506. - cur.selection = {
- 507. - re: new RegExp('('+str.replace(/\|/g, '').replace(cur.vIndex.delimiter, '|').replace(/^\||\|$/g, '').replace(/([\+\*\)\(])/g, '\\$1')+')', 'gi'),
- 508. - val: '<em>$1</em>'
- 509. - };
- 510. - }
- 511. - Video.searchAlbums(str);
- 512. - var len = v.length;
- 513. - if (len < 10) {
- 514. - //show(cur.more);
- 515. - //addClass(cur.more, 'load_more');
- 516. - if (cur.searchTimout) {
- 517. - clearTimeout(cur.searchTimout);
- 518. - }
- 519. - cur.loading = true;
- 520. - cur.searchTimout = setTimeout((function() {
- 521. - this.loadFromSearch(str);
- 522. - }).bind(this), (force ? 0 : 500));
- 523. - addClass(cur.videoSearch, 'v_loading');
- 524. - }
- 525. - if (len) {
- 526. - this.clearOutput();
- 527. - this.showMore();
- 528. - if (cur.cansort) {
- 529. - qsorter.update(cur.vRows, {dragEls: geByClass('video_album_candrop', cur.albumsCont)});
- 530. - }
- 531. - this.changeSummary();
- 532. - } else {
- 533. - cur.clearOnSearch = true;
- 534. - }
- 535. - } else {
- 536. - Video.searchAlbums(str);
- 537. - if (cur.vSection == 'search') {
- 538. - hide('video_search_options');
- 539. - if (cur.beforeSearch) {
- 540. - nav.change({section: cur.beforeSearch});
- 541. - }
- 542. - removeClass(ge('video_reset_search'), 'video_reset_search_shown');
- 543. - Video.hideOptions();
- 544. - removeClass(cur.videoSearch, 'v_loading');
- 545. - cur.vStr = '';
- 546. - cur.selection = false;
- 547. - cur.vSearch.focus();
- 548. - /*this.clearOutput();
- 549. - this.showMore();
- 550. - this.changeSummary();
- 551. - cur.vSearch.setValue('');
- 552. - cur.vSearch.focus();*/
- 553. - }
- 554. - if (cur.canEditAlbums && cur.albumsSorter) {
- 555. - qsorter.update(cur.albumsCont);
- 556. - }
- 557. - }
- 558. - this.changeUrl();
- 559. - },
- 560. - toggleFilter: function (obj, target) {
- 561. - if (hasClass(obj, 'filter_shut') || !isVisible(target)) {
- 562. - addClass(obj, 'filter_open');
- 563. - removeClass(obj, 'filter_shut');
- 564. - var extraH = slideDown(target, 200).to.height;
- 565. - } else {
- 566. - slideUp(target, 200, function(){
- 567. - addClass(obj, 'filter_shut');
- 568. - removeClass(obj, 'filter_open');
- 569. - });
- 570. - }
- 571. - },
- 572. - toggleLength: function(el, value, noSearch) {
- 573. - removeClass(geByClass1('video_length_sel', ge('video_search_controls')), 'video_length_sel');
- 574. - addClass(el, 'video_length_sel');
- 575. - cur.vLength = value;
- 576. - if (!noSearch) {
- 577. - this.searchVideos(cur.vStr);
- 578. - this.doChangeUrl();
- 579. - }
- 580. - },
- 581. - toggleHD: function(hd, noSearch) {
- 582. - if (noSearch && hd) {
- 583. - checkbox(ge('video_hd_option'));
- 584. - }
- 585. - cur.vHD = isChecked('video_hd_option') ? 1 : 0;
- 586. - (cur.vHD ? show : hide)('video_hd2_option');
- 587. - if (cur.vHD) {
- 588. - show('video_hd2_option');
- 589. - cur.vHD += isChecked('video_hd2_option') ? 1 : 0;
- 590. - } else {
- 591. - hide('video_hd2_option');
- 592. - }
- 593. - if (!noSearch) {
- 594. - this.searchVideos(cur.vStr);
- 595. - this.doChangeUrl();
- 596. - }
- 597. - },
- 598. - toggleOrder: function(type) {
- 599. - cur.vOrder = type;
- 600. - this.searchVideos(cur.vStr);
- 601. - },
- 602. - toggleExt: function(type) {
- 603. - cur.vExt = type;
- 604. - this.searchVideos(cur.vStr);
- 605. - },
- 606. - toggleAdult: function() {
- 607. - var updateAdult = function(val) {
- 608. - cur.adult = val;
- 609. - Video.searchVideos(cur.vStr);
- 610. - }
- 611. - var cancelAgreed = function() {
- 612. - if (cur.isAdult || getCookie('adult_agreed')) {
- 613. - return true;
- 614. - }
- 615. - addClass(ge('video_adult_option'), 'on');
- 616. - }
- 617. - var checkAgreed = function(val) {
- 618. - if (!val || cur.isAdult || getCookie('adult_agreed')) {
- 619. - return true;
- 620. - }
- 621. - var box = showFastBox({title: getLang('video_adult_box_title'), onHide: cancelAgreed}, getLang('video_adult_box_text'), getLang('global_continue'), function() {
- 622. - cur.isAdult = true;
- 623. - setCookie('adult_agreed', 1);
- 624. - updateAdult(1);
- 625. - box.hide();
- 626. - }, getLang('global_cancel'), function() {
- 627. - cancelAgreed();
- 628. - box.hide();
- 629. - });
- 630. - return false;
- 631. - }
- 632. - var new_val = !isChecked('video_adult_option') ? 1 : 0
- 633. - if (checkAgreed(new_val)) {
- 634. - updateAdult(new_val);
- 635. - }
- 636. - },
- 637. - setQuery: function(str) {
- 638. - cur.onIndexFinish = function() {
- 639. - cur.onIndexFinish = false;
- 640. - vk.loaded = true;
- 641. - Video.searchVideos(str, true);
- 642. - cur.vSearch.setValue(str);
- 643. - }
- 644. - },
- 645. - doChangeUrl: function() {
- 646. - if (trim(cur.vStr) && cur.vStr != '""') {
- 647. - nav.objLoc['q'] = cur.vStr;
- 648. - } else {
- 649. - delete nav.objLoc['q'];
- 650. - }
- 651. - if (cur.vLength) {
- 652. - nav.objLoc['len'] = cur.vLength;
- 653. - } else {
- 654. - delete nav.objLoc['len'];
- 655. - }
- 656. - if (cur.vHD) {
- 657. - nav.objLoc['hd'] = cur.vHD;
- 658. - } else {
- 659. - delete nav.objLoc['hd'];
- 660. - }
- 661. - nav.setLoc(nav.objLoc);
- 662. - },
- 663. - changeUrl: function() {
- 664. - if (cur.timeouts && cur.timeouts.changeUrl) {
- 665. - clearTimeout(cur.timeouts.changeUrl);
- 666. - }
- 667. - cur.timeouts.changeUrl = setTimeout(Video.doChangeUrl, 2000);
- 668. - },
- 669. - changeSummary: function() {
- 670. - var str, searchStr, oldSearhSummary = false, htitle;
- 671. - var sec = cur.vSection;
- 672. - if (sec == 'comments') {
- 673. - if (cur.commentsCount) {
- 674. - cur.summary.innerHTML = langNumeric(cur.commentsCount, cur.lang['video_X_comms'], true);
- 675. - } else {
- 676. - cur.summary.innerHTML = getLang('video_no_comments');
- 677. - }
- 678. -
- 679. - hide(cur.searchSummary);
- 680. - htitle = cur.htitle_comments + (cur.commentsCount ? ' | ' + getLang('video_X_comms', cur.commentsCount) : '');
- 681. - document.title = replaceEntities(stripHTML(htitle));
- 682. - hide('video_comments_link');
- 683. -
- 684. - return true;
- 685. - } else if (sec == 'recommendations') {
- 686. - cur.summary.innerHTML = cur.recommsSummary;
- 687. - document.title = replaceEntities(stripHTML(cur.recommsSummary));
- 688. - hide('video_comments_link');
- 689. - return true;
- 690. - }
- 691. - if (cur.vSection == 'search' && cur.vStr) {
- 692. - var hd = cur.vHD ? cur.vHD : 0;
- 693. - var searchData = cur.searchData[cur.vStr + hd.toString() + cur.vOrder.toString()];
- 694. - var len = (searchData) ? searchData.count : 0;
- 695. - if (len/* || !cur.loading*/) {
- 696. - searchStr = langNumeric(len, cur.lang['video_num_found_files'], true);
- 697. - }
- 698. - if (!len && cur.loading) {
- 699. - oldSearhSummary = true;
- 700. - }
- 701. - htitle = getLang('video_title_search').replace('{q}', cur.vStr) + (len ? ' | ' + getLang('video_title_search_X_found', len) : '');
- 702. - }
- 703. -
- 704. - var sec = cur.vSection;
- 705. - if (cur.vSection == 'search') {
- 706. - if (cur.vStr) {
- 707. - sec += '_'+cur.vStr;
- 708. - } else {
- 709. - sec = 'all';
- 710. - }
- 711. - if (cur.vHD) {
- 712. - sec += '_opt_hd'+cur.vHD;
- 713. - }
- 714. - }
- 715. - if (cur.videoList[sec]) {
- 716. - var len = cur.videoList[sec].length;
- 717. - }
- 718. -
- 719. - if (cur.vSection == 'tagged') {
- 720. - htitle = cur.htitle_videos + (len ? ' | ' + langNumeric(len, cur.lang['video_title_X_videos_tagged'], true) : '').replace('{user}', cur.htitle_tagged_user);
- 721. - }
- 722. - if (!htitle) {
- 723. - htitle = cur.htitle_videos + (len ? ' | ' + langNumeric(len, cur.lang['video_title_X_videos'], true) : '');
- 724. - }
- 725. - if (len) {
- 726. - str = len + ' ' + langNumeric(len, cur.lang['videofile_num'], true);
- 727. - }
- 728. -
- 729. - var searchSummary = false;
- 730. - if (str) {
- 731. - if (searchStr) {
- 732. - cur.searchSummary.innerHTML = '<div class="summary">' + searchStr + '</div>';
- 733. - show(cur.searchSummary);
- 734. - } else if (!oldSearhSummary) {
- 735. - hide(cur.searchSummary);
- 736. - }
- 737. - } else {
- 738. - if (searchStr) {
- 739. - str = searchStr;
- 740. - searchSummary = true;
- 741. - } else {
- 742. - str = cur.lang['video_novideo'];
- 743. - show(cur.notFound);
- 744. - if (cur.vSection.indexOf('album_') === 0) {
- 745. - cur.notFound.className = 'video_info_msg video_v_album';
- 746. - } else if (cur.vSection != 'search') {
- 747. - cur.notFound.className = 'video_info_msg';
- 748. - } else {
- 749. - cur.notFound.className = 'video_info_msg video_v_search';
- 750. - searchSummary = true;
- 751. - }
- 752. - if (cur.vSection.indexOf('album_') === 0) {
- 753. - addClass(cur.notFound, 'video_v_album');
- 754. - }
- 755. - hide(cur.more);
- 756. - }
- 757. - hide(cur.searchSummary);
- 758. - }
- 759. - if (!searchSummary) {
- 760. - if (cur.vSection.indexOf('album_') === 0) {
- 761. - if (vk.id == cur.oid || (cur.oid < 0 && cur.isGroupAdmin)) {
- 762. - str += '<span class="divider">|</span><span><a onclick="Video.deleteAlbum(\'' + cur.vSection + '\');">' + getLang('video_delete_album') + '</a></span>';
- 763. - }
- 764. - } else if (cur.vSection == 'tagged' && cur.tagsCount > 10) {
- 765. - str += '<span class="divider">|</span><span><a onclick="Video.removeAllTags();">' + getLang('video_remove_all_tags') + '</a></span>';
- 766. - }
- 767. - show('video_comments_link')
- 768. - } else {
- 769. - hide('video_comments_link');
- 770. - }
- 771. - cur.summary.innerHTML = str;
- 772. - document.title = replaceEntities(stripHTML(htitle));
- 773. - },
- 774. - loadFromSearch: function(str) {
- 775. - var hd = cur.vHD ? cur.vHD : 0;
- 776. - if (!cur.searchData[str+hd.toString()+cur.vOrder.toString()]) {
- 777. - cur.searchData[str+hd.toString()+cur.vOrder.toString()] = {
- 778. - count: 0,
- 779. - list: [],
- 780. - offset: 0
- 781. - };
- 782. - }
- 783. - var searchData = cur.searchData[str+hd.toString()+cur.vOrder.toString()];
- 784. - ajax.post('al_video.php', {
- 785. - act: 'search_video',
- 786. - q: str,
- 787. - offset: searchData.offset,
- 788. - hd: hd,
- 789. - length: cur.vLength || 0,
- 790. - show_adult: cur.adult ? 1 : 0,
- 791. - ext: cur.vExt,
- 792. - order: cur.vOrder
- 793. - }, {
- 794. - onDone: (function(count, data) {
- 795. - if (!cur.silent) {
- 796. - removeClass(cur.videoSearch, 'v_loading');
- 797. - removeClass(cur.more, 'load_more');
- 798. - } else {
- 799. - cur.onSilentLoad = function() {
- 800. - removeClass(cur.videoSearch, 'v_loading');
- 801. - removeClass(cur.more, 'load_more');
- 802. - }
- 803. - }
- 804. - data = eval('('+data+')');
- 805. -
- 806. - Array.prototype.push.apply(searchData.list, data);
- 807. - if (str != cur.vStr) {
- 808. - return false;
- 809. - }
- 810. - if (cur.clearOnSearch) {
- 811. - this.clearOutput();
- 812. - cur.clearOnSearch = false;
- 813. - }
- 814. - if (data.length === 0) {
- 815. - //cur.videoCount[sec][1] = cur.videoList[sec].length;
- 816. - searchData.ended = true;
- 817. - if (!searchData.count && !cur.shown) {
- 818. - show(cur.notFound);
- 819. - hide(cur.more);
- 820. - cur.notFound.className = 'video_info_msg video_v_search';
- 821. - ge('search_ph').innerHTML = cur.vStr.replace(/([<>&#]*)/g, '');
- 822. - }
- 823. - } else {
- 824. - searchData.count = parseInt(count);
- 825. - Video.showMore();
- 826. - cur.loading = false;
- 827. - if (cur.canEditAlbums && cur.albumsSorter && !(trim(str) && str != '""')) {
- 828. - qsorter.update(cur.albumsCont);
- 829. - }
- 830. - if (cur.cansort) {
- 831. - qsorter.update(cur.vRows, {dragEls: geByClass('video_album_candrop', cur.albumsCont)});
- 832. - }
- 833. - }
- 834. - searchData.offset += data.length;
- 835. - this.changeSummary();
- 836. - }).bind(this),
- 837. - cache: 1
- 838. - });
- 839. - },
- 840. - clearOutput: function() {
- 841. - cur.vRows.innerHTML = '';
- 842. - cur.vSearchRows.innerHTML = '';
- 843. - hide(cur.notFound);
- 844. - hide(cur.searchSummary);
- 845. - cur.shown = 0;
- 846. - if (cur.editmode) {
- 847. - VideoEdit.onChanging();
- 848. - }
- 849. - },
- 850. - scrollResize: function() {
- 851. - if (browser.mobile) return;
- 852. - var docEl = document.documentElement;
- 853. - var ch = window.innerHeight || docEl.clientHeight || bodyNode.clientHeight;
- 854. - var st = scrollGetY();
- 855. - if (!cur.pageEnd) {
- 856. - return;
- 857. - }
- 858. - if (st + ch > cur.pageEnd.offsetTop) {
- 859. - setTimeout(function() {
- 860. - Video.showMore();
- 861. - }, 0);
- 862. - }
- 863. - },
- 864. - showMore: function() {
- 865. - var sec = cur.vSection;
- 866. - if (sec == 'search') {
- 867. - if (cur.vStr) {
- 868. - sec += '_'+cur.vStr;
- 869. - } else {
- 870. - sec = 'all';
- 871. - }
- 872. - if (cur.vHD) {
- 873. - sec += '_opt_hd'+cur.vHD;
- 874. - }
- 875. - }
- 876. - if (sec == 'comments' || sec == 'recommendations') {
- 877. - if (cur.shown < cur[sec + 'Count']) {
- 878. - this.loadSection(sec, cur.shown);
- 879. - addClass(cur.more, 'load_more');
- 880. - show(cur.more);
- 881. - return;
- 882. - }
- 883. - }
- 884. -
- 885. - var list = cur.videoList[sec];
- 886. - if (!list) {
- 887. - return;
- 888. - }
- 889. - var usersLen = list.length;
- 890. -
- 891. - var added = false;
- 892. -
- 893. - //var listLen = usersLen + searchCount;
- 894. - var limit = cur.shown + cur.perPage;
- 895. - if (usersLen < limit) {
- 896. - limit = usersLen;
- 897. - }
- 898. - if (cur.vSection == 'tagged' || cur.vSection == 'uploaded') {
- 899. - var linkAddr = '?'+cur.vSection+'='+cur.oid;
- 900. - } else {
- 901. - var linkAddr = '';
- 902. - }
- 903. - var linkAddr = '?section='+cur.vSection
- 904. - for (var i = cur.shown; i < limit; i++) {
- 905. - cur.vRows.appendChild(se(this.drawVideo(list[i], linkAddr)));
- 906. - cur.shown++;
- 907. - added = true;
- 908. - }
- 909. - if (cur.cansort) {
- 910. - qsorter.added(cur.vRows);
- 911. - }
- 912. -
- 913. - if (cur.vSection == 'search' && cur.vStr) { // search
- 914. - var hd = cur.vHD ? cur.vHD : 0;
- 915. - var searchData = cur.searchData[cur.vStr+hd.toString()+cur.vOrder.toString()];
- 916. -
- 917. - var searchCount = (searchData) ? searchData.count : 0;
- 918. - var searchLen = (searchData) ? searchData.list.length : 0;
- 919. - if (!cur.loading && cur.vStr && searchLen < searchCount && cur.shown + cur.perPage/* + 20*/ > searchLen) {
- 920. - cur.loading = true;
- 921. - this.loadFromSearch(cur.vStr);
- 922. - //show(cur.more);
- 923. - addClass(cur.more, 'load_more');
- 924. - }
- 925. -
- 926. - if (cur.shown >= usersLen) {
- 927. - var startPos = cur.shown - usersLen;
- 928. - //if (startPos < searchLen) {
- 929. - for (var i = startPos; i < searchLen; i++) {
- 930. - cur.vSearchRows.appendChild(se(this.drawVideo(searchData.list[i], linkAddr)));
- 931. - cur.shown++;
- 932. - added = true;
- 933. - }
- 934. - //}
- 935. - }
- 936. - if (usersLen + searchCount > cur.shown && !searchData.ended) {
- 937. - show(cur.more);
- 938. - } else {
- 939. - hide(cur.more);
- 940. - }
- 941. - } else {
- 942. - if (cur.silent && cur.shown == limit && cur.shown < cur.videoCount) {
- 943. - addClass(cur.more, 'load_more');
- 944. - show(cur.more);
- 945. - } else if (usersLen > cur.shown) {
- 946. - show(cur.more);
- 947. - } else {
- 948. - hide(cur.more);
- 949. - }
- 950. - }
- 951. -
- 952. - if (cur.updateSorter) {
- 953. - added = true;
- 954. - delete cur.updateSorter;
- 955. - }
- 956. -
- 957. - if (added && cur.editmode) {
- 958. - setTimeout(function() {
- 959. - VideoEdit.onAdding();
- 960. - }, 0);
- 961. - }
- 962. - },
- 963. - drawVideo: function(video, linkAddr) {
- 964. - v = video.slice();
- 965. - if (cur.selection) {
- 966. - v[3] = v[3].replace(cur.selection.re, cur.selection.val);
- 967. - }
- 968. - return cur.videoTpl(v, (v[11].substr(0, 1) != '_') ? ' video_can_edit' : '');
- 969. - },
- 970. - updateList: function(e, obj) {
- 971. - if (e.keyCode == 27) {
- 972. - return Video.searchVideos(false);
- 973. - }
- 974. - clearTimeout(cur.searchTimeout);
- 975. - setTimeout((function() {
- 976. - var str = trim(obj.value);
- 977. - if (str != cur.vStr) {
- 978. - this.searchVideos(str);
- 979. - }
- 980. - }).bind(this), 10);
- 981. - },
- 982. - recache: function(videoRaw) {
- 983. - if (!videoRaw && window.mvcur && mvcur.mvData.videoRaw) {
- 984. - videoRaw = mvcur.mvData.videoRaw;
- 985. - }
- 986. - delete ajaxCache['/al_video.php#act=show&list=&module=video&video=' + videoRaw];
- 987. - delete ajaxCache['/al_video.php#act=show&autoplay=1&list=&module=video&video=' + videoRaw];
- 988. - },
- 989. - loadSection: function(section, offset) {
- 990. - if (cur[section+'Loading']) {
- 991. - return;
- 992. - }
- 993. - cur[section+'Loading'] = true;
- 994. - if (offset == 0) {
- 995. - addClass(ge('video_section_' + section), 'loading');
- 996. - cur.vSection = section;
- 997. - }
- 998. - var params = {
- 999. - act: 'load_section_'+section,
- 1000. - oid: cur.oid,
- 1001. - offset: offset
- 1002. - };
- 1003. - if (section == 'recommendations' && nav.objLoc.like) {
- 1004. - params['like'] = nav.objLoc.like;
- 1005. - }
- 1006. - ajax.post('al_video.php', params, {
- 1007. - onDone: function(count, shown, data, curExt) {
- 1008. - if (curExt) {
- 1009. - extend(cur, curExt);
- 1010. - }
- 1011. - if (offset == 0) {
- 1012. - Video.clearOutput();
- 1013. - cur[section + 'Count'] = count;
- 1014. - removeClass(ge('video_section_' + section), 'loading');
- 1015. - }
- 1016. - removeClass(cur.more, 'load_more');
- 1017. - hide(cur.more);
- 1018. - cur.shown = shown;
- 1019. - var cont = ce('div', {
- 1020. - innerHTML: data
- 1021. - });
- 1022. - cur.vRows.appendChild(cont);
- 1023. - Video.changeSummary();
- 1024. - Video.onSwitchTabs(section);
- 1025. - if (cur.cansort) {
- 1026. - qsorter.update(cur.vRows, {dragEls: geByClass('video_album_candrop', cur.albumsCont)});
- 1027. - }
- 1028. - if (offset == 0 && shown == 0 && section != 'comments') {
- 1029. - show(cur.notFound);
- 1030. - }
- 1031. - delete cur[section+'Loading'];
- 1032. - },
- 1033. -
- 1034. - onFail: function() {
- 1035. - delete cur[section+'Loading'];
- 1036. - },
- 1037. - showProgress: function() {
- 1038. - show('video_tabs_progress');
- 1039. - hide('video_tabs_link');
- 1040. - },
- 1041. - hideProgress: function() {
- 1042. - hide('video_tabs_progress');
- 1043. - var num = 0;
- 1044. - for(var i in cur.sections) num += 1;
- 1045. - if (!num) {
- 1046. - show('video_tabs_link');
- 1047. - }
- 1048. - }
- 1049. - });
- 1050. - },
- 1051. - loadFrom: function(url, params, section) {
- 1052. - addClass(ge('video_section_'+section), 'loading');
- 1053. - cur.vSection = section;
- 1054. - // pass
- 1055. - ajax.post(url, params, {onDone: (function(count, data, obj) {
- 1056. - removeClass(ge('video_section_'+section), 'loading');
- 1057. - if (obj) {
- 1058. - extend(cur, obj);
- 1059. - }
- 1060. - cur.vSection = section;
- 1061. - data = eval('('+data+')');
- 1062. - cur.videoList[section] = data;
- 1063. - if (cur.vSection == section) {
- 1064. - this.clearOutput();
- 1065. - this.showMore();
- 1066. - if (cur.canEditAlbums && cur.albumsSorter && !(trim(cur.vStr) && cur.vStr != '""')) {
- 1067. - qsorter.update(cur.albumsCont);
- 1068. - }
- 1069. - if (cur.cansort) {
- 1070. - qsorter.update(cur.vRows, {dragEls: geByClass('video_album_candrop', cur.albumsCont)});
- 1071. - }
- 1072. - this.changeSummary();
- 1073. - this.onSwitchTabs(section);
- 1074. - }
- 1075. - }).bind(this)})
- 1076. -
- 1077. - },
- 1078. - filter: function(cond, list) {
- 1079. - var all = cur.videoList['all'];
- 1080. - var len = all.length;
- 1081. - var result = [];
- 1082. - for (var i = 0; i < len; i++) {
- 1083. - var obj = all[i];
- 1084. - if (cond(obj)) {
- 1085. - result.push(obj);
- 1086. - }
- 1087. - }
- 1088. - cur.videoList[list] = result;
- 1089. -
- 1090. - len = result.length;
- 1091. - return result;
- 1092. - },
- 1093. - clearSearch: function() {
- 1094. - cur.selection = false;
- 1095. - cur.vSearch.setValue('');
- 1096. - },
- 1097. - generateList: function(section) {
- 1098. - if (!section) return;
- 1099. - if (section == 'uploaded') {
- 1100. - this.filter(function(obj) {
- 1101. - return obj[8];
- 1102. - }, section);
- 1103. - this.onSwitchTabs(section);
- 1104. - } else if (section == 'tagged') {
- 1105. - this.loadFrom('al_video.php', {act: 'get_tagged_video', mid: cur.oid}, section);
- 1106. - return false;
- 1107. - } else if (section == 'recommendations') {
- 1108. - this.loadSection(section, 0);
- 1109. - return false;
- 1110. - } else if (section == 'comments') {
- 1111. - stManager.add(['videoview.js'], (function() {
- 1112. - this.loadSection(section, 0);
- 1113. - }).bind(this));
- 1114. - return false;
- 1115. - } else if (section.substr(0, 6) == 'album_') {
- 1116. - var album = parseInt(section.substr(6));
- 1117. - this.filter(function(obj) {
- 1118. - return obj[6] == album;
- 1119. - }, section);
- 1120. - this.onSwitchTabs(section);
- 1121. - }
- 1122. - return true;
- 1123. - },
- 1124. - section: function(section) {
- 1125. - if (!section) {
- 1126. - section = 'all';
- 1127. - }
- 1128. -
- 1129. - if (cur.silent && section != 'tagged' && section != 'comments') {
- 1130. - cur.onSilentLoad = function() {
- 1131. - Video.section(section);
- 1132. - }
- 1133. - Video.clearOutput();
- 1134. - cur.vRows.innerHTML = '<div id="video_wide_loading" class="wide_loading"></div>';
- 1135. - hide(cur.more);
- 1136. - cur.vSection = section;
- 1137. - return true;
- 1138. - }
- 1139. - if (section != 'search') {
- 1140. - this.clearSearch();
- 1141. - hide('video_addition_options', 'video_sort_dd', 'video_external_dd_wrap');
- 1142. - } else {
- 1143. - if (cur.vStr) {
- 1144. - cur.vSearch.setValue(cur.vStr);
- 1145. - }
- 1146. - if (!cur.editmode) {
- 1147. - show('video_addition_options', 'video_sort_dd', 'video_external_dd_wrap');
- 1148. - } else {
- 1149. - hide('video_addition_options', 'video_sort_dd', 'video_external_dd_wrap');
- 1150. - }
- 1151. - }
- 1152. -
- 1153. - /*if (section != 'all') {
- 1154. - addClass(ge('video_content'), 'video_albums_hidden');
- 1155. - } else {
- 1156. - removeClass(ge('video_content'), 'video_albums_hidden');
- 1157. - }*/
- 1158. -
- 1159. - if (!cur.videoList[section]) {
- 1160. - if (!this.generateList(section)) {
- 1161. - return;
- 1162. - }
- 1163. - }
- 1164. - /*if (!cur.videoCount[section] && cur.videoList[section]) {
- 1165. - var len = cur.videoList[section].length;
- 1166. - cur.videoCount[section] = [len, len, 0];
- 1167. - }*/
- 1168. - cur.vSection = section;
- 1169. - this.clearOutput();
- 1170. - this.showMore();
- 1171. - if (cur.cansort) {
- 1172. - qsorter.update(cur.vRows, {dragEls: geByClass('video_album_candrop', cur.albumsCont)});
- 1173. - }
- 1174. - this.changeSummary();
- 1175. - if (section != 'search' || !cur.vStr) {
- 1176. - removeClass(ge('video_reset_search'), 'video_reset_search_shown');
- 1177. - Video.hideOptions();
- 1178. - } else {
- 1179. - addClass(ge('video_reset_search'), 'video_reset_search_shown');
- 1180. - Video.showOptions();
- 1181. - }
- 1182. - this.onSwitchTabs(section);
- 1183. - if (cur.canEditAlbums && cur.albumsSorter && !(trim(cur.vStr) && cur.vStr != '""')) {
- 1184. - qsorter.update(cur.albumsCont);
- 1185. - }
- 1186. - },
- 1187. - onSwitchTabs: function(section) {
- 1188. - var newTab = ge('video_tab_'+(section == 'search' ? 'all' : section));
- 1189. - var oldTab = geByClass1('active_link', ge('video_tabs'));
- 1190. - if (newTab != oldTab) {
- 1191. - removeClass(oldTab, 'active_link');
- 1192. - addClass(newTab, 'active_link');
- 1193. - }
- 1194. -
- 1195. - if (section.substr(0, 6) == 'album_' || section == 'tagged' || section == 'comments') {
- 1196. - cur.hTab.className = 'active_link';
- 1197. - if (section == 'comments') {
- 1198. - var tabName = getLang('video_comments_review');
- 1199. - } else {
- 1200. - var tabName = '';
- 1201. - for (var i in cur.sections) {
- 1202. - if (cur.sections[i][0] == ((section == 'tagged') ? -1 : parseInt(section.substr(6)))) {
- 1203. - tabName = cur.sections[i][1];
- 1204. - }
- 1205. -
- 1206. - }
- 1207. - }
- 1208. - geByClass1('tab_word', cur.hTab).firstChild.innerHTML = tabName;
- 1209. -
- 1210. - addClass(ge('video_content'), 'video_albums_hidden');
- 1211. - } else {
- 1212. - cur.hTab.className = 'video_tab_hidden';
- 1213. - if (section != 'search') {
- 1214. - removeClass(ge('video_content'), 'video_albums_hidden');
- 1215. - }
- 1216. - }
- 1217. - toggleClass(ge('video_rows'), 'wall_module', section == 'comments');
- 1218. - if (cur.sorter) {
- 1219. - cur.sorter.updateDragCont();
- 1220. - }
- 1221. - },
- 1222. - showAlbums: function(obj) {
- 1223. - while (ge('video_albums_more') && ge('video_albums_more').firstChild) {
- 1224. - var el = ge('video_albums_more').firstChild;
- 1225. - ge('video_albums_wrap').appendChild(el);
- 1226. - }
- 1227. - hide(obj);
- 1228. - if (cur.canEditAlbums && cur.albumsSorter && !(trim(cur.vStr) && cur.vStr != '""')) {
- 1229. - qsorter.added(cur.albumsCont);
- 1230. - }
- 1231. - if (cur.cansort) {
- 1232. - qsorter.update(cur.vRows, {dragEls: geByClass('video_album_candrop', cur.albumsCont)});
- 1233. - }
- 1234. - },
- 1235. - deleteAlbum: function(section, ev) {
- 1236. - showBox('al_video.php', {act: 'delete_album', aid: section.substr(6), oid: cur.oid}, {dark: 1});
- 1237. - return cancelEvent(ev);
- 1238. - },
- 1239. - editAlbum: function(aid, ev) {
- 1240. - showBox('al_video.php', {act: 'edit_album', oid: cur.oid, aid: aid, oid: cur.oid}, {dark: 1});
- 1241. - return cancelEvent(ev);
- 1242. - },
- 1243. - createAlbum: function() {
- 1244. - showBox('al_video.php', {act: 'edit_album', oid: cur.oid}, {dark: 1});
- 1245. - },
- 1246. - uploadVideoBox: function() {
- 1247. - if (cur.uploadBanned) {
- 1248. - setTimeout(showFastBox({title: getLang('video_no_upload_title'), dark: 1}, getLang('video_claims_no_upload')).hide, 5000);
- 1249. - return false;
- 1250. - }
- 1251. - var box = showTabbedBox('al_video.php', {act: 'upload_box', oid: cur.oid}, {stat: ['video_edit.css', 'privacy.css', 'privacy.js'], params: {bodyStyle: 'position: relative;', dark: 1}});
- 1252. - return false;
- 1253. - },
- 1254. - removeAllTags: function() {
- 1255. - showBox('al_video.php', {act: 'remove_all_tags_box'}, {dark: 1});
- 1256. - },
- 1257. -
- 1258. - xRow: function(event, opacity, row, hint) {
- 1259. - if (hint) showTooltip(row, {text: hint, showdt: 500});
- 1260. - animate(hasClass(row, 'video_close') ? row : geByClass1('video_close', row), {opacity: opacity}, 200);
- 1261. - return cancelEvent(event);
- 1262. - },
- 1263. -
- 1264. - removeRecomm: function(obj) {
- 1265. - var el = obj.parentNode;
- 1266. - while(el && !hasClass(el, 'video_row_cont')) {
- 1267. - el = el.parentNode;
- 1268. - }
- 1269. - if (!el) return;
- 1270. - slideUp(el, 50);
- 1271. - ajax.post('al_video.php', {act: 'hide_recommendation', video: el.id.substr(9), hash: cur.hash});
- 1272. - },
- 1273. - albumOver: function(obj) {
- 1274. - if (cur.canEditAlbums && obj.id.split('_')[2] > 0) {
- 1275. - Video.activate(geByClass1('video_album_controls', obj));
- 1276. - }
- 1277. - },
- 1278. - albumOut: function(obj) {
- 1279. - if (cur.canEditAlbums) {
- 1280. - Video.deactivate(geByClass1('video_album_controls', obj), 0);
- 1281. - }
- 1282. - },
- 1283. -
- 1284. - addFromList: function(videoRaw, hash, ev) {
- 1285. - var videoCont = ge('video_cont'+videoRaw);
- 1286. - if (hasClass(videoCont, 'video_row_added')) {
- 1287. - return cancelEvent(ev);
- 1288. - }
- 1289. - videoview.addVideo(videoRaw, hash, false, false, false, 'list');
- 1290. - var videoEl = geByClass1('video_row_icon_add', videoCont);
- 1291. - if (videoEl && videoEl.tt) {
- 1292. - videoEl.tt.hide();
- 1293. - }
- 1294. - return cancelEvent(ev);
- 1295. - },
- 1296. -
- 1297. - rowOver: function(obj) {
- 1298. - var animEl = geByClass1((hasClass(obj.parentNode, 'video_can_edit')) ? 'video_row_controls' : 'video_row_add', obj);
- 1299. - Video.activate(animEl);
- 1300. - if (hasClass(obj, 'video_row_overed')) {
- 1301. - return;
- 1302. - }
- 1303. - addClass(obj, 'video_row_overed')
- 1304. - var line = geByClass1('video_row_info_line', obj);
- 1305. - var name = geByClass1('video_raw_info_name', obj);
- 1306. - var size = getSize(name);
- 1307. - var height = Math.max(16, Math.min(size[1], 54));
- 1308. - cssAnim(line, {height: height, marginTop: 150 - (height - 16)}, {duration: 200, transition: Fx.Transitions.easeOutCubic});
- 1309. - },
- 1310. - rowOut: function(obj) {
- 1311. - var animEl = geByClass1((hasClass(obj.parentNode, 'video_can_edit')) ? 'video_row_controls' : 'video_row_add', obj);
- 1312. - Video.deactivate(animEl, 0);
- 1313. - var line = geByClass1('video_row_info_line', obj);
- 1314. - removeClass(obj, 'video_row_overed')
- 1315. - cssAnim(line, {height: 16, marginTop: 150}, {duration: 200, transition: Fx.Transitions.easeOutCubic});
- 1316. - },
- 1317. - activate: function(obj, ttLng, check) {
- 1318. - animate(obj, {opacity: 1}, 100);
- 1319. - if (ttLng) {
- 1320. - if (check == 1 && hasClass(obj.parentNode.parentNode.parentNode.parentNode, 'video_row_added')) {
- 1321. - return false;
- 1322. - }
- 1323. - showTooltip(obj, {
- 1324. - black: 1,
- 1325. - center: 1,
- 1326. - shift: [0,2,0],
- 1327. - text: getLang('video_'+ttLng)
- 1328. - });
- 1329. - }
- 1330. - },
- 1331. - deactivate: function(obj, value) {
- 1332. - animate(obj, {opacity: value === undefined ? 0.8 : value}, 100);
- 1333. - },
- 1334. - albumDragOver: function(el) {
- 1335. - fadeOut(geByClass1('video_album_info', el), 200);
- 1336. - fadeOut(geByClass1('videos_album_tags', el), 200);
- 1337. - var moveEl = geByClass1('videos_album_move', el)
- 1338. - if (!moveEl) {
- 1339. - moveEl = ce('div', {className: 'videos_album_move'})
- 1340. - el.insertBefore(moveEl, el.firstChild);
- 1341. - }
- 1342. - moveEl.innerHTML = getLang('video_drop_to_move');
- 1343. - setStyle(moveEl, {marginTop: getSize(el)[1] / 2 - getSize(moveEl)[1] / 2})
- 1344. - fadeIn(moveEl, 200);
- 1345. - },
- 1346. - albumDragOut: function(el) {
- 1347. - fadeIn(geByClass1('video_album_info', el), 200);
- 1348. - fadeIn(geByClass1('videos_album_tags', el), 200);
- 1349. - fadeOut(geByClass1('videos_album_move', el), 200);
- 1350. - },
- 1351. - updateVideoAlbum: function(vid, albumId) {
- 1352. - var oldAlbum = 0;
- 1353. - var list = cur.videoList['all'];
- 1354. - for (var i in list) {
- 1355. - if (list[i][1] == vid) {
- 1356. - oldAlbum = list[i][6];
- 1357. - if (oldAlbum == albumId) {
- 1358. - return false;
- 1359. - }
- 1360. - list[i][6] = albumId;
- 1361. - }
- 1362. - }
- 1363. - delete cur.videoList['album_'+oldAlbum];
- 1364. - delete cur.videoList['album_'+albumId];
- 1365. - if (cur.vSection == 'album_'+oldAlbum) {
- 1366. - Video.section('album_'+oldAlbum);
- 1367. - }
- 1368. - },
- 1369. - albumDrop: function(el, obj) {
- 1370. - var moveEl = geByClass1('videos_album_move', el)
- 1371. - if (moveEl) {
- 1372. - moveEl.innerHTML = '<div class="progress_inline progress_inv" style="height: '+(getSize(moveEl)[1] - 16)+'px"></div>';
- 1373. - }
- 1374. - var videoId = obj.id.replace('video_cont', '').split('_');
- 1375. - var oid = videoId[0];
- 1376. - var vid = videoId[1];
- 1377. - var albumId = el.id.replace('video_album_', '');
- 1378. - ajax.post('al_video.php', {act: 'move_to_album', album_id: albumId, hash: cur.moveHash, oid: oid, vid: vid, from: 'list'}, {
- 1379. - onDone: function(text, newList) {
- 1380. - showDoneBox(text);
- 1381. - Video.updateAlbums(newList);
- 1382. - /*moveEl.innerHTML = text;
- 1383. - setStyle(moveEl, {height: 'auto'});
- 1384. - setStyle(moveEl, {marginTop: getSize(el)[1] / 2 - getSize(moveEl)[1] / 2})
- 1385. - setTimeout(Video.albumDragOut.pbind(el), 3000);*/
- 1386. - Video.updateVideoAlbum(vid, albumId);
- 1387. - }
- 1388. - });
- 1389. - return true;
- 1390. - },
- 1391. - showOptions: function() {
- 1392. - if (cur.shownOptions) return;
- 1393. - cur.shownOptions = true;
- 1394. - addClass(cur.videoSearch, 'video_search_extended');
- 1395. - },
- 1396. - hideOptions: function() {
- 1397. - if (!cur.shownOptions) return;
- 1398. - cur.shownOptions = false;
- 1399. - removeClass(cur.videoSearch, 'video_search_extended');
- 1400. - }
- 1401. - }
- 1402. -
- 1403. - try{stManager.done('video.js');}catch(e){}
- ------
- Файл - groups_list.js (Старый размер - 35510 | Новый - 0):
- 0. - var GroupsList = {
- 1. - rand: function() {
- 2. - return Math.floor(Math.random() * 10000);
- 3. - },
- 4. - enter: function(el, gid, hash, act, past) {
- 5. - if (cur.invSwitching) {
- 6. - setTimeout(GroupsList.enter.pbind(el, gid, hash, act, past), 100);
- 7. - return false;
- 8. - }
- 9. - var sp, hp, tab = cur.scrollList.tab;
- 10. -
- 11. - if (el.tagName.toLowerCase() != 'button') {
- 12. - if (!el.backhtml) {
- 13. - el.backhtml = el.innerHTML;
- 14. - }
- 15. - sp = function() {
- 16. - var w = getSize(el)[0];
- 17. - el.innerHTML = '<span class="progress_inline"></span>';
- 18. - setStyle(el, {width: w - 30});
- 19. - }
- 20. - hp = function() {
- 21. - el.innerHTML = el.backhtml;
- 22. - }
- 23. - } else {
- 24. - sp = lockButton.pbind(el);
- 25. - hp = unlockButton.pbind(el);
- 26. - }
- 27. -
- 28. - var key = GroupsList.rand(), value = GroupsList.rand();
- 29. - cur.scrollList[key] = value;
- 30. -
- 31. - var context = (cur.scrollList.tab == 'groups') ? '2' : '1';
- 32. -
- 33. - var shown = false;
- 34. - cur.invSwitching = true;
- 35. - if (GroupsList.switchInvite(gid, (act == 'decline' && !past))) {
- 36. - shown = true;
- 37. - sp = false;
- 38. - hp = false;
- 39. - }
- 40. -
- 41. - ajax.post('al_groups.php', {
- 42. - act: 'enter',
- 43. - gid: gid,
- 44. - hash: hash,
- 45. - context: context + (act ? '_' + act : ''),
- 46. - inv_shown: cur.scrollList.invShown
- 47. - }, {
- 48. - onDone: function(newRow, added) {
- 49. - cur.invSwitching = false;
- 50. - if (!cur.scrollList || cur.scrollList[key] != value) return;
- 51. -
- 52. - var list = cur.scrollList.lists[tab], newStatus = past ? 5 : 1;
- 53. - if (act == 'unsure') {
- 54. - newStatus = past ? 5 : 3;
- 55. - } else if (act == 'decline') {
- 56. - newStatus = past ? -3 : -1;
- 57. - } else if (act == 'undecided') {
- 58. - newStatus = 4;
- 59. - }
- 60. - if (!list || list == 'loading' || list == 'update') {
- 61. - cur.scrollList.processed[tab][gid] = newStatus;
- 62. - } else {
- 63. - for (var i = 0, count = list.length; i < count; ++i) {
- 64. - if (list[i][2] == gid) {
- 65. - list[i][1] = newStatus;
- 66. - }
- 67. - }
- 68. - }
- 69. -
- 70. - var row = ge('gl_' + tab + gid);
- 71. -
- 72. - GroupsList.addInvite(newRow, added, act);
- 73. -
- 74. - var rowEl = geByClass1('group_list_row', ge('groups_list_content'));
- 75. - if (rowEl && rowEl.id == 'gl_' + tab + gid) {
- 76. - setStyle(rowEl, {backgroundColor: '#FEFAE4'});
- 77. - animate(rowEl, {backgroundColor: '#FFF'}, 2000);
- 78. - }
- 79. -
- 80. - if (shown) {
- 81. - if (cur.switchedInvite && act == 'decline' && !past) {
- 82. - var switchedHtml = getLang('groups_event_left') + ' <a onclick="GroupsList.spam(this.parentNode, ' + gid + ', \'' + hash + '\', cur.switchedInvite)">' + getLang('its_spam') + '</a>';
- 83. - if (ge('clubinv' + gid)) switchedHtml += '<div class="group_row_blockinv"><a onclick="GroupsList.spam(domPN(domPN(this)), ' + gid + ', \'' + hash + '\', cur.switchedInvite, 1)">' + getLang('groups_block_clubinv').replace('{club}', '<b>' + val(domPS(ge('clubinv' + gid))) + '</b>') + '</a></div>';
- 84. - cur.switchedInvite.innerHTML = switchedHtml;
- 85. - }
- 86. - return;
- 87. - }
- 88. -
- 89. - if (!row) return;
- 90. -
- 91. - var status = geByClass1('group_row_status', row), actions = geByClass1('group_row_actions', row), old = status.basehtml;
- 92. - var actOld = actions.basehtml;
- 93. - status.basehtml = status.innerHTML;
- 94. - actions.basehtml = actions.innerHTML;
- 95. - if (act == 'undecided') {
- 96. - actions.innerHTML = actOld || '';
- 97. - status.innerHTML = old || '\
- 98. - <div class="group_row_buttons">\
- 99. - <div class="group_row_button button_blue fl_l">\
- 100. - <button onclick="GroupsList.enter(this, ' + gid + ', \'' + hash + '\', \'join\')">' + getLang('groups_event_go_btn') + '</button>\
- 101. - </div>\
- 102. - <div class="group_row_button button_blue fl_l">\
- 103. - <button onclick="GroupsList.enter(this, ' + gid + ', \'' + hash + '\', \'unsure\')">' + getLang('groups_event_maybe_btn') + '</button>\
- 104. - </div>\
- 105. - <div class="group_row_button button_cancel fl_l">\
- 106. - <div class="button" onclick="GroupsList.enter(this, ' + gid + ', \'' + hash + '\', \'decline\')">' + getLang('groups_event_cant_btn') + '</div>\
- 107. - </div>\
- 108. - </div>';
- 109. - } else if (act) {
- 110. - if (past) {
- 111. - var statHTML = getLang('groups_was_on_event');
- 112. - if (act == 'decline') {
- 113. - actions.innerHTML = '<a onclick="GroupsList.enter(this.parentNode, ' + gid + ', \'' + hash + '\', \'join\', true)">' + getLang('groups_return_event') + '</a>';
- 114. - } else {
- 115. - actions.innerHTML = '<a onclick="GroupsList.enter(this.parentNode, ' + gid + ', \'' + hash + '\', \'decline\', true)">' + getLang('groups_remove_event') + '</a>';
- 116. - }
- 117. - } else {
- 118. - var acts = '<a onclick="GroupsList.enter(this.parentNode, ' + gid + ', \'' + hash + '\', \'undecided\')">' + getLang('groups_event_change') + '</a>';
- 119. - if (act == 'unsure') {
- 120. - var statHTML = getLang('groups_unsure_event');
- 121. - } else if (act == 'decline') {
- 122. - var statHTML = getLang('groups_event_left');
- 123. - acts += '<span class="divider">|</span><a onclick="GroupsList.spam(this.parentNode, ' + gid + ', \'' + hash + '\')">' + getLang('its_spam') + '</a>';
- 124. - if (ge('clubinv' + gid)) acts += '<div class="group_row_blockinv"><a onclick="GroupsList.spam(domPN(domPN(this)), ' + gid + ', \'' + hash + '\', false, 1)">' + getLang('groups_block_clubinv').replace('{club}', '<b>' + val(domPS(ge('clubinv' + gid))) + '</b>') + '</a></div>';
- 125. - } else {
- 126. - var statHTML = getLang('groups_you_in_event');
- 127. - }
- 128. - actions.innerHTML = acts;
- 129. - }
- 130. - status.innerHTML = '<div class="groups_acted_text">'+statHTML+'</div>';
- 131. - cur.lst = status;
- 132. - } else {
- 133. - status.innerHTML = '<div class="groups_acted_text">'+getLang('groups_group_enter_message')+'</div>';
- 134. - actions.innerHTML = '<a onclick="GroupsList.cancel(this.parentNode, ' + gid + ', \'' + hash + '\')">' + getLang('global_cancel') + '</a>';
- 135. - }
- 136. -
- 137. - if (tab == 'inv') {
- 138. - var row = ge('gl_groups'+ gid);
- 139. - if (row) {
- 140. - var statusOne = geByClass1('group_row_status', row), actionsOne = geByClass1('group_row_actions', row);
- 141. - statusOne.innerHTML = status.innerHTML;
- 142. - actionsOne.innerHTML = actions.innerHTML;
- 143. - }
- 144. - }
- 145. - if (act == 'join' || act == 'unsure') {
- 146. - GroupsList.updateEventsList(gid);
- 147. - } else if (act == 'undecided') {
- 148. - GroupsList.updateEventsList(false);
- 149. - }
- 150. - /*var list = cur.scrollList.lists[tab];
- 151. - if (act == 'join' || act == 'unsure' || act == 'decline') {
- 152. - GroupsList.updateEventsList();
- 153. - for(var i in list) {
- 154. - if (list[i][2] == gid) {
- 155. - cur['gid_restore_el'+gid] = [list.splice(i, 1), i];
- 156. - }
- 157. - }
- 158. - } else if (act == 'undecided' && cur['gid_restore_el'+gid]) {
- 159. - list.splice(cur['gid_restore_el'+gid][1], 0, cur['gid_restore_el'+gid][0][0]);
- 160. - }*/
- 161. - },
- 162. - onFail: function(text) {
- 163. - if (text) {
- 164. - setTimeout(showFastBox(getLang('global_error'), text).hide, 3000);
- 165. - return true;
- 166. - }
- 167. - },
- 168. - showProgress: sp, hideProgress: hp
- 169. - });
- 170. - },
- 171. -
- 172. - addInvite: function(newRow, added, act) {
- 173. - if (newRow) {
- 174. - var moreCont = ge('gle_invites_more');
- 175. - moreCont.appendChild(se(newRow));
- 176. - cur.scrollList.invShown += 1;
- 177. - if (cur.scrollList.invSwitchGid) {
- 178. - GroupsList.switchInvite(cur.scrollList.invSwitchGid);
- 179. - cur.scrollList.invSwitchGid = false;
- 180. - }
- 181. - }
- 182. -
- 183. - if (added && cur.scrollList.lists.groups) {
- 184. - var l = cur.scrollList.lists.groups;
- 185. - if (act == 'join' || act == 'unsure') {;
- 186. - l.push(added);
- 187. - } else if (!act) {
- 188. - l.unshift(added); // add to the start
- 189. - } else if (act == 'undecided') {
- 190. - for (var i in l) {
- 191. - if (l[i][2] == added[2]) {
- 192. - l.splice(i, 1)
- 193. - }
- 194. - }
- 195. - }
- 196. - cur.scrollList.cache['groups'] = {all: []};
- 197. - var c = cur.scrollList.cache['groups'];
- 198. - for (var i in l) {
- 199. - c.all.push(i);
- 200. - }
- 201. - cur.scrollList.index['groups'] = new vkIndexer(c.all, function(obj) {
- 202. - return l[obj][0];
- 203. - });
- 204. - GroupsList.showMore(true);
- 205. - }
- 206. - },
- 207. -
- 208. - switchInvite: function(gid, prepareActs) {
- 209. - var tab = cur.scrollList.tab;
- 210. - if (tab != 'groups') {
- 211. - return false;
- 212. - }
- 213. -
- 214. - var row = ge('gl_' + tab + gid);
- 215. -
- 216. - var moreCont = ge('gle_invites_more');
- 217. - var newRows = moreCont.childNodes;
- 218. - if (!newRows.length) {
- 219. - if (cur.scrollList.invShown < cur.scrollList.invCount) {
- 220. - cur.scrollList.invSwitchGid = gid;
- 221. - return true;
- 222. - }
- 223. - return false;
- 224. - }
- 225. - var newRow = newRows[0];
- 226. -
- 227. - if (!newRow) {
- 228. - return false;
- 229. - }
- 230. -
- 231. - if (cur.switchedInvite) {
- 232. - slideUp(cur.switchedInvite);
- 233. - }
- 234. - if (prepareActs) {
- 235. - cur.switchedInvite = ce('div', {className: 'gle_invites_actions', innerHTML: '<div class="progress_inline"></div>'});
- 236. - newRow.insertBefore(cur.switchedInvite, newRow.firstChild)
- 237. - }
- 238. -
- 239. - cur.scrollList.invShown -= 1;
- 240. - cur.scrollList.invCount -= 1;
- 241. -
- 242. - var cont = row.parentNode;
- 243. - var size = getSize(cont);
- 244. - setStyle(newRow, {opacity: 0, overflow: 'hidden', height: 1, position: 'absolute'});
- 245. - cont.appendChild(newRow);
- 246. - animate(newRow, {marginTop: -size[1], opacity: 1, height: size[1]}, 200, function() {
- 247. - hide(row);
- 248. - setStyle(newRow, {marginTop: 0, position: 'static', height: 'auto'});
- 249. - });
- 250. -
- 251. - if (cur.scrollList.invCount) {
- 252. - ge('gle_inv_summary').innerHTML = langNumeric(cur.scrollList.invCount, cur.scrollList.summaries.inv);
- 253. - } else {
- 254. - ge('gle_inv_summary').innerHTML = cur.scrollList.summaries.invEmpty;
- 255. - }
- 256. - return true;
- 257. - },
- 258. -
- 259. - leave: function(el, gid, hash, pp) {
- 260. - if (cur.invSwitching) {
- 261. - setTimeout(GroupsList.leave.pbind(el, gid, hash, pp), 100);
- 262. - return false;
- 263. - }
- 264. - var sp, hp, tab = cur.scrollList.tab;
- 265. -
- 266. - if (el.firstChild && el.firstChild.className == 'progress_inline') return;
- 267. - sp = function() {
- 268. - var w = getSize(el)[0];
- 269. - el.oldhtml = el.innerHTML;
- 270. - el.innerHTML = '<span class="progress_inline"></span>';
- 271. - setStyle(el, {width: w - 30});
- 272. - }
- 273. - hp = function() {
- 274. - el.innerHTML = el.oldhtml;
- 275. - }
- 276. -
- 277. - var key = GroupsList.rand(), value = GroupsList.rand();
- 278. - cur.scrollList[key] = value;
- 279. -
- 280. - var shown = false;
- 281. - cur.invSwitching = true;
- 282. - if (GroupsList.switchInvite(gid, true)) {
- 283. - shown = true;
- 284. - sp = false;
- 285. - hp = false;
- 286. - }
- 287. -
- 288. - var context = (cur.scrollList.tab == 'groups') ? '2' : '1';
- 289. -
- 290. - ajax.post('al_groups.php', {
- 291. - act: 'leave',
- 292. - gid: gid,
- 293. - hash: hash,
- 294. - context: context,
- 295. - inv_shown: cur.scrollList.invShown
- 296. - }, {
- 297. - onDone: function(newRow) {
- 298. - cur.invSwitching = false;
- 299. - if (!cur.scrollList || cur.scrollList[key] != value) return;
- 300. -
- 301. - var list = cur.scrollList.lists[tab];
- 302. - if (!list || list == 'loading' || list == 'update') {
- 303. - cur.scrollList.processed[tab][gid] = -1;
- 304. - } else {
- 305. - for (var i = 0, count = list.length; i < count; ++i) {
- 306. - if (list[i][2] == gid) {
- 307. - list[i][1] = -1;
- 308. - }
- 309. - }
- 310. - }
- 311. -
- 312. - var row = ge('gl_' + tab + gid);
- 313. - if (!row) return;
- 314. -
- 315. - var acts = '<a onclick="GroupsList.cancel(this.parentNode, ' + gid + ', \'' + hash + '\')">' + getLang('global_cancel') + '</a><span class="divider">|</span><a onclick="GroupsList.spam(this.parentNode, ' + gid + ', \'' + hash + '\')">' + getLang('its_spam') + '</a>';
- 316. -
- 317. - var text = '';
- 318. - if (tab == 'groups') {
- 319. - text = getLang(pp ? 'public_you_unsubscribed' : 'groups_group_left');
- 320. - } else {
- 321. - text = getLang('groups_group_deny_message');
- 322. - }
- 323. -
- 324. - GroupsList.addInvite(newRow, false, false);
- 325. -
- 326. - if (shown) {
- 327. - if (cur.switchedInvite) {
- 328. - cur.switchedInvite.innerHTML = text+' <a onclick="GroupsList.spam(this.parentNode, ' + gid + ', \'' + hash + '\', cur.switchedInvite)">' + getLang('its_spam') + '</a>';
- 329. - }
- 330. - return;
- 331. - }
- 332. -
- 333. - var status = geByClass1('group_row_status', row), actions = geByClass1('group_row_actions', row);
- 334. - status.basehtml = status.innerHTML;
- 335. - actions.basehtml = actions.innerHTML;
- 336. - status.innerHTML = text;
- 337. - actions.innerHTML = acts;
- 338. - },
- 339. - showProgress: sp, hideProgress: hp
- 340. - });
- 341. - },
- 342. - rejectAll: function(el, hash) {
- 343. - var box = showFastBox(getLang('global_warning'), getLang('groups_sure_reject_all'), getLang('groups_members_application_decline'), function() {
- 344. - ajax.post('al_groups.php', {act: 'reject_all', hash: hash}, {progress: box.progress});
- 345. - }, getLang('global_cancel'));
- 346. - },
- 347. - spam: function(el, gid, hash, applyCont, block) {
- 348. - var sp, hp, tab = cur.scrollList.tab;
- 349. -
- 350. - if (el.firstChild && el.firstChild.className == 'progress_inline') return;
- 351. - sp = function() {
- 352. - el.oldhtml = el.innerHTML;
- 353. - el.innerHTML = '<span class="progress_inline"></span>';
- 354. - }
- 355. - hp = function() {
- 356. - el.innerHTML = el.oldhtml;
- 357. - }
- 358. -
- 359. - var key = GroupsList.rand(), value = GroupsList.rand();
- 360. - cur.scrollList[key] = value;
- 361. -
- 362. - ajax.post('al_groups.php', {act: 'spam', gid: gid, hash: hash, context: 1, block: block}, {
- 363. - onDone: function(respText) {
- 364. - if (!cur.scrollList || cur.scrollList[key] != value) return;
- 365. - if (block > 0) {
- 366. - respText = respText.replace('{club}', '<b>' + val(domPS(ge('clubinv' + gid))) + '</b>');
- 367. - }
- 368. - if (applyCont) {
- 369. - if (block < 0) {
- 370. - applyCont.innerHTML = applyCont.basehtml;
- 371. - } else {
- 372. - applyCont.basehtml = applyCont.innerHTML;
- 373. - var applyContText = respText;
- 374. - if (block > 0) {
- 375. - respText += '<div class="group_row_blockinv"><a onclick="GroupsList.spam(domPN(domPN(this)), ' + gid + ', \'' + hash + '\', cur.switchedInvite, -1)">' + getLang('global_cancel') + '</div>';
- 376. - } else if (ge('clubinv' + gid)) {
- 377. - respText += '<div class="group_row_blockinv"><a onclick="GroupsList.spam(domPN(domPN(this)), ' + gid + ', \'' + hash + '\', cur.switchedInvite, 1)">' + getLang('groups_block_clubinv').replace('{club}', '<b>' + val(domPS(ge('clubinv' + gid))) + '</b>') + '</a></div>'
- 378. - }
- 379. - applyCont.innerHTML = respText;
- 380. - }
- 381. - }
- 382. -
- 383. - if (!block) {
- 384. - var list = cur.scrollList.lists[tab];
- 385. - if (!list || list == 'loading' || list == 'update') {
- 386. - cur.scrollList.processed[tab][gid] = -2;
- 387. - } else {
- 388. - for (var i = 0, count = list.length; i < count; ++i) {
- 389. - if (list[i][2] == gid) {
- 390. - list[i][1] = -2;
- 391. - }
- 392. - }
- 393. - }
- 394. - }
- 395. -
- 396. - var row = ge('gl_' + tab + gid);
- 397. - if (!row) return;
- 398. -
- 399. - var status = geByClass1('group_row_status', row), actions = geByClass1('group_row_actions', row);
- 400. - if (block < 0) {
- 401. - status.innerHTML = status.blockhtml;
- 402. - actions.innerHTML = actions.blockhtml;
- 403. - } else {
- 404. - if (block) {
- 405. - status.blockhtml = status.innerHTML;
- 406. - actions.blockhtml = actions.innerHTML;
- 407. - status.innerHTML = '<div class="group_row_blockinv">' + respText + '</div>';
- 408. - actions.innerHTML = '<div class="group_row_blockinv"><a onclick="GroupsList.spam(domPN(domPN(this)), ' + gid + ', \'' + hash + '\', false, -1)">' + getLang('global_cancel') + '</a></div>';
- 409. - } else {
- 410. - status.basehtml = status.innerHTML;
- 411. - actions.basehtml = actions.innerHTML;
- 412. - status.innerHTML = getLang('groups_ajax_inv_declined_spam');
- 413. - actions.innerHTML = '';
- 414. - }
- 415. - }
- 416. - },
- 417. - showProgress: sp, hideProgress: hp
- 418. - });
- 419. - },
- 420. - cancel: function(el, gid, hash) {
- 421. - var sp, hp, tab = cur.scrollList.tab;
- 422. -
- 423. - if (el.firstChild && el.firstChild.className == 'progress_inline') return;
- 424. - sp = function() {
- 425. - el.oldhtml = el.innerHTML;
- 426. - el.innerHTML = '<span class="progress_inline"></span>';
- 427. - }
- 428. - hp = function() {
- 429. - el.innerHTML = el.oldhtml;
- 430. - }
- 431. -
- 432. - var key = GroupsList.rand(), value = GroupsList.rand();
- 433. - cur.scrollList[key] = value;
- 434. -
- 435. - ajax.post('al_groups.php', {act: 'cancel', gid: gid, hash: hash, context: 1}, {
- 436. - onDone: function() {
- 437. - if (!cur.scrollList || cur.scrollList[key] != value) return;
- 438. -
- 439. - var list = cur.scrollList.lists[tab], elem = false;
- 440. - if (!list || list == 'loading' || list == 'update') {
- 441. - cur.scrollList.processed[tab][gid] = 0;
- 442. - } else {
- 443. - for (var i in list) {
- 444. - if (list[i][2] == gid) {
- 445. - list.splice(i, 1)
- 446. - }
- 447. - }
- 448. - cur.scrollList.cache['groups'] = {all: []};
- 449. - var c = cur.scrollList.cache['groups'];
- 450. - for (var i in list) {
- 451. - c.all.push(i);
- 452. - }
- 453. - cur.scrollList.index[tab] = new vkIndexer(c.all, function(obj) {
- 454. - return list[obj][0];
- 455. - });
- 456. - }
- 457. - /*} else {
- 458. - for (var i = 0, count = list.length; i < count; ++i) {
- 459. - if (list[i][2] == gid) {
- 460. - list[i][1] = 0;
- 461. - elem = list[i];
- 462. - break;
- 463. - }
- 464. - }
- 465. - }*/
- 466. -
- 467. - var row = ge('gl_' + tab + gid);
- 468. - if (!row) return;
- 469. -
- 470. - if (elem) {
- 471. - var name = elem[0], q = trim(cur.scrollList.query.value);
- 472. - if (q) {
- 473. - var highlight = GroupsList.getHighlight(q);
- 474. - name = name.replace(highlight.re, highlight.val);
- 475. - }
- 476. - var newRow = (cur.scrollList.genRow(elem, name)) ? cur.scrollList.genInvRow(elem, name) : cur.scrollList.genRow(elem, name);
- 477. - row.parentNode.replaceChild(ce('div', {innerHTML: newRow}).firstChild, row);
- 478. - } else {
- 479. - var status = geByClass1('group_row_status', row), actions = geByClass1('group_row_actions', row);
- 480. - status.innerHTML = status.basehtml;
- 481. - actions.innerHTML = actions.basehtml;
- 482. - }
- 483. - },
- 484. - showProgress: sp, hideProgress: hp
- 485. - });
- 486. - },
- 487. -
- 488. - scrollCheck: function() {
- 489. - if (browser.mobile) return;
- 490. - var lnk = ge(cur.scrollList.prefix + cur.scrollList.tab + '_more');
- 491. - if (!isVisible(lnk)) {
- 492. - return;
- 493. - }
- 494. -
- 495. - var docEl = document.documentElement;
- 496. - var ch = window.innerHeight || docEl.clientHeight || bodyNode.clientHeight;
- 497. - var st = scrollGetY();
- 498. -
- 499. - if (st + ch > lnk.offsetTop || (cur.searchOffset && st + 2*ch > lnk.offsetTop)) {
- 500. - GroupsList.showMore();
- 501. - }
- 502. - },
- 503. - initScroll: function() {
- 504. - addEvent((browser.msie6 ? pageNode : window), 'scroll', GroupsList.scrollCheck);
- 505. - addEvent(window, 'resize', GroupsList.scrollCheck);
- 506. - },
- 507. -
- 508. - locNav: function(changed, oldLoc, newLoc) {
- 509. - var changedTab = changed.tab, tab = changedTab || 'groups';
- 510. - delete(changed.tab);
- 511. - if (!isEmpty(changed) || changedTab === undefined) return;
- 512. -
- 513. - ge('groups_tab_' + cur.scrollList.tab).className = '';
- 514. - hide('groups_list_tab_' + cur.scrollList.tab);
- 515. - cur.scrollList.tab = tab;
- 516. - show('groups_list_tab_' + tab);
- 517. - var tabEl = ge('groups_tab_' + tab);
- 518. - tabEl.className = 'active_link';
- 519. - show(tabEl);
- 520. -
- 521. - if (cur.scrollList.events) {
- 522. - toggle(cur.scrollList.events, tab == 'groups' && ge('gle_list_cont').innerHTML);
- 523. - cur.scrollList.eventsShow = false;
- 524. - if (isVisible(cur.scrollList.eventsMore)) {
- 525. - hide(cur.scrollList.eventsMore);
- 526. - show(cur.scrollList.eventsMoreLnk);
- 527. - }
- 528. - }
- 529. - if (cur.scrollList.invites) {
- 530. - toggle(cur.scrollList.invites, tab == 'groups');
- 531. - }
- 532. - if (cur.scrollList.invites || cur.scrollList.events) {
- 533. - ((tab == 'groups') ? addClass : removeClass)(cur.scrollList.summary.parentNode, 'gl_summary_short');
- 534. - }
- 535. -
- 536. - toggle('gl_about_events', (tab == 'groups' || tab == 'inv'));
- 537. -
- 538. - nav.setLoc(newLoc);
- 539. - ge('groups_list_search').setValue('');
- 540. - setTimeout(elfocus.pbind('groups_list_search'), 0);
- 541. -
- 542. - cur.scrollList.summary.innerHTML = cur.scrollList.summaries[tab];
- 543. - cur.scrollList.offset = ge('groups_list_' + tab).childNodes.length;
- 544. -
- 545. - GroupsList.showMore(true);
- 546. -
- 547. - return false;
- 548. - },
- 549. -
- 550. - init: function(opts) {
- 551. - placeholderSetup('groups_list_search', {back: true});
- 552. - setTimeout(elfocus.pbind('groups_list_search'), 0);
- 553. - extend(cur, {
- 554. - module: 'groups_list',
- 555. - _back: {
- 556. - text: getLang('groups_back_to_list'),
- 557. - show: [GroupsList.initScroll],
- 558. - hide: [function() {
- 559. - removeEvent((browser.msie6 ? pageNode : window), 'scroll', GroupsList.scrollCheck);
- 560. - removeEvent(window, 'resize', GroupsList.scrollCheck);
- 561. - }]
- 562. - },
- 563. -
- 564. - scrollList: {
- 565. - tab: opts.tab,
- 566. -
- 567. - url: 'al_groups.php',
- 568. - params: {act: 'get_list', mid: opts.mid},
- 569. - prefix: 'groups_list_',
- 570. - query: ge('groups_list_search'),
- 571. - summary: ge('groups_list_summary'),
- 572. - events: ge('gle_list_wrap'),
- 573. - eventsMore: ge('gle_list_more'),
- 574. - eventsMoreLnk: ge('gle_list_more_lnk'),
- 575. - invites: ge('gle_invites_wrap'),
- 576. - searchCont: ge('groups_list_search_cont'),
- 577. -
- 578. - perpage: 20,
- 579. - offset: ge('groups_list_' + opts.tab).childNodes.length,
- 580. -
- 581. - lists: {},
- 582. - cache: {},
- 583. - index: {},
- 584. - processed: {'groups': {}, 'admin': {}, 'inv': {}},
- 585. - filtered: {},
- 586. - queries: {},
- 587. - summaries: opts.summaries,
- 588. -
- 589. - genEmpty: opts.genEmpty,
- 590. - genRow: opts.genRow,
- 591. - genEvent: opts.genEvent,
- 592. - genInvRow: opts.genInvRow,
- 593. - genSummary: opts.genSummary,
- 594. - genGroupsSummary: opts.genGroupsSummary,
- 595. - invShown: opts.invShown,
- 596. - invCount: opts.invCount
- 597. - },
- 598. - filter: opts.filter
- 599. - });
- 600. -
- 601. - cur.nav.push(GroupsList.locNav);
- 602. -
- 603. - setTimeout(GroupsList.load, 0);
- 604. - if (vk.version) {
- 605. - addEvent(window, 'load', GroupsList.initScroll);
- 606. - } else {
- 607. - GroupsList.initScroll();
- 608. - }
- 609. - },
- 610. - load: function(force, forceTab) {
- 611. - var tab = forceTab || cur.scrollList.tab;
- 612. - if (cur.scrollList.lists[tab]) return;
- 613. -
- 614. - var key = GroupsList.rand(), value = GroupsList.rand();
- 615. - cur.scrollList[key] = value;
- 616. -
- 617. - cur.scrollList.lists[tab] = 'loading';
- 618. - ajax.post(cur.scrollList.url, extend(cur.scrollList.params, {tab: tab}), {onDone: function(result) {
- 619. - if (!cur.scrollList || cur.scrollList[key] != value) return;
- 620. -
- 621. - var upd = (cur.scrollList.lists[tab] == 'update');
- 622. - if (!upd && cur.scrollList.lists[tab] != 'loading') return;
- 623. -
- 624. - cur.scrollList.cache[tab] = {all: []};
- 625. - var processed = cur.scrollList.processed[tab], gid;
- 626. - for (var i = 0, count = result.length; i < count; ++i) {
- 627. - res = processed[result[i][2]];
- 628. - if (res) {
- 629. - result[i][1] = res;
- 630. - }
- 631. - cur.scrollList.cache[tab].all.push(i);
- 632. - }
- 633. - cur.scrollList.lists[tab] = result;
- 634. -
- 635. - var callback = upd ? function() {
- 636. - if (cur.scrollList && cur.scrollList[key] == value && cur.scrollList.tab == tab) {
- 637. - GroupsList.showMore(force);
- 638. - }
- 639. - } : function() {};
- 640. -
- 641. - cur.scrollList.index[tab] = new vkIndexer(cur.scrollList.cache[tab].all, function(obj) {
- 642. - return cur.scrollList.lists[tab][obj][0];
- 643. - }, callback);
- 644. -
- 645. - if (cur.scrollList.eventsShow) {
- 646. - GroupsList.eventsMore();
- 647. - }
- 648. - }, local: 1});
- 649. - },
- 650. -
- 651. - htmlencode: function(str) {
- 652. - var res = [];
- 653. - for (var i = 0, l = str.length; i < l; ++i) {
- 654. - var c = str.charCodeAt(i);
- 655. - if (c == 33 || c == 39 || (c > 127 && c < 1040) || c > 1103) {
- 656. - res.push('&#' + c + ';');
- 657. - } else if (c == 36) {
- 658. - res.push('�' + c + ';');
- 659. - } else {
- 660. - c = str.charAt(i);
- 661. - switch (c) {
- 662. - case '>': res.push('>'); break;
- 663. - case '<': res.push('<'); break;
- 664. - case '"': res.push('"'); break;
- 665. - case '&': res.push('&'); break;
- 666. - default: res.push(c); break;
- 667. - }
- 668. - }
- 669. - }
- 670. - return res.join('');
- 671. - },
- 672. - getHighlight: function(q) {
- 673. - var indxr = cur.scrollList.index[cur.scrollList.tab], delimiter = indxr.delimiter, trimmer = indxr.trimmer;
- 674. -
- 675. - q += ' ' + (parseLatin(q) || '');
- 676. - q = escapeRE(q).replace(/&/g, '&');
- 677. - q = q.replace(trimmer, '').replace(delimiter, '|');
- 678. - return {
- 679. - re: new RegExp('(' + q + ')', 'gi'),
- 680. - val: '<span class="group_row_highlight">$1</span>'
- 681. - }
- 682. - },
- 683. - updateEvents: function() {
- 684. - if (!cur.scrollList.events || cur.scrollList.tab != 'groups') return;
- 685. - toggle(cur.scrollList.events, !cur.scrollList.query.value && ge('gle_list_cont').innerHTML);
- 686. - cur.scrollList.eventsShow = false;
- 687. - if (isVisible(cur.scrollList.eventsMore)) {
- 688. - hide(cur.scrollList.eventsMore);
- 689. - show(cur.scrollList.eventsMoreLnk);
- 690. - }
- 691. - if (cur.scrollList.invites) {
- 692. - toggle(cur.scrollList.invites, !cur.scrollList.query.value);
- 693. - }
- 694. - (!cur.scrollList.query.value ? addClass : removeClass)(cur.scrollList.summary.parentNode, 'gl_summary_short');
- 695. - },
- 696. - updateEventsList: function(addedGid) {
- 697. - ajax.post('groups', {act: 'update_events'}, {
- 698. - onDone: function(html, more) {
- 699. - var gleCont = ge('gle_list_cont');
- 700. - val(gleCont, html);
- 701. - toggle(cur.scrollList.events, !!html);
- 702. - hide(cur.scrollList.eventsMore);
- 703. - val(cur.scrollList.eventsMore, '');
- 704. - val(cur.scrollList.eventsMoreLnk, more || '');
- 705. - toggle(cur.scrollList.eventsMoreLnk, !!more);
- 706. - cur.scrollList.eventsShow = false;
- 707. - if (addedGid) {
- 708. - var addedRow = ge('gle_block_'+addedGid);
- 709. - if (addedRow) {
- 710. - setStyle(addedRow, {backgroundColor: '#FEFAE4'});
- 711. - animate(addedRow, {backgroundColor: '#FFF'}, 2000);
- 712. - }
- 713. - }
- 714. - }
- 715. - })
- 716. - },
- 717. - eventsMore: function() {
- 718. - var list = cur.scrollList.lists['groups'];
- 719. - if (!list || list == 'loading' || list == 'update') {
- 720. - cur.scrollList.eventsShow = true;
- 721. - return;
- 722. - }
- 723. -
- 724. - hide(cur.scrollList.eventsMoreLnk);
- 725. - if (val(cur.scrollList.eventsMore)) {
- 726. - show(cur.scrollList.eventsMore);
- 727. - } else {
- 728. - var res = {}, shown = {}, dates = {}, list = [], html = [];
- 729. - each(ge('gle_list_cont').childNodes, function(k, v) {
- 730. - var id = intval(((v || {}).id || '').replace(/^gle_block_/, ''));
- 731. - if (id) shown[id] = true;
- 732. - });
- 733. - each(cur.scrollList.lists['groups'], function(k, v) {
- 734. - var gid = intval(v[2]);
- 735. - if (!v[11] || shown[gid]) return;
- 736. - list.push(gid);
- 737. - res[gid] = cur.scrollList.genEvent(v);
- 738. - dates[gid] = intval(v[11].split('<*>')[0]);
- 739. - });
- 740. - list.sort(function(gid1, gid2) {
- 741. - return (dates[gid1] < dates[gid2]) ? -1 : ((dates[gid2] < dates[gid1]) ? 1 : 0);
- 742. - });
- 743. - each(list, function(k, v) {
- 744. - html.push(res[v]);
- 745. - });
- 746. - if (html.length) {
- 747. - val(cur.scrollList.eventsMore, html.join(''));
- 748. - show(cur.scrollList.eventsMore);
- 749. - }
- 750. - }
- 751. - },
- 752. - showMore: function(force) {
- 753. - var tab = cur.scrollList.tab, list = cur.scrollList.lists[tab];
- 754. - if (!list || list == 'loading' || list == 'update') {
- 755. - if (!list) GroupsList.load(force);
- 756. - cur.scrollList.lists[tab] = 'update';
- 757. - return;
- 758. - }
- 759. -
- 760. - var tab = cur.scrollList.tab, list = cur.scrollList.cache[tab].all;
- 761. -
- 762. - var q = trim(cur.scrollList.query.value);
- 763. - cur.searchStr = q;
- 764. - if (!cur.loadingShown) {
- 765. - if (q) {
- 766. - show('groups_reset_search');
- 767. - } else {
- 768. - hide('groups_reset_search');
- 769. - }
- 770. - }
- 771. -
- 772. - if (cur.scrollList.queries[tab] === undefined) {
- 773. - cur.scrollList.queries[tab] = '';
- 774. - }
- 775. - var refresh = (force || q != cur.scrollList.queries[tab]);
- 776. - if (!refresh && force === false) return;
- 777. -
- 778. - cur.scrollList.queries[tab] = q;
- 779. -
- 780. - var highlight = false;
- 781. - if (q) {
- 782. - list = cur.scrollList.cache[tab]['_' + q];
- 783. - if (list === undefined) {
- 784. - var tmp = cur.scrollList.index[tab].search(q), mp = {};
- 785. - list = [];
- 786. - for (var i = 0, l = tmp.length; i < l; ++i) {
- 787. - if (!mp[tmp[i]]) {
- 788. - mp[tmp[i]] = true;
- 789. - list.push(tmp[i]);
- 790. - }
- 791. - }
- 792. - list.sort(function(a,b){return a-b;});
- 793. - cur.scrollList.cache[tab]['_' + q] = list;
- 794. - }
- 795. - highlight = GroupsList.getHighlight(q);
- 796. - }
- 797. -
- 798. - var len = list.length;
- 799. -
- 800. - var cont = ge(cur.scrollList.prefix + tab), more = ge(cur.scrollList.prefix + tab + '_more');
- 801. - if (!len) {
- 802. - if (q && tab == 'groups') {
- 803. - if (refresh) {
- 804. - GroupsList.serverSearch(cont, q, true);
- 805. - hide(more);
- 806. - } else if (cur.searchOffset) {
- 807. - GroupsList.serverSearchMore(cont, q);
- 808. - }
- 809. - } else {
- 810. - q = cur.scrollList.query.value;
- 811. - cont.innerHTML = cur.scrollList.genEmpty(q);
- 812. - cur.scrollList.summary.innerHTML = q ? cur.scrollList.genSummary(len) : cur.scrollList.summaries[tab];
- 813. - hide(more);
- 814. - hide(cur.scrollList.searchCont);
- 815. - cur.searchOffset = 0;
- 816. - }
- 817. - return;
- 818. - } else if (tab == 'groups' && cur.scrollList.params.mid == vk.id) {
- 819. - cur.scrollList.summary.innerHTML = cur.scrollList.genGroupsSummary(len);
- 820. - } else {
- 821. - cur.scrollList.summary.innerHTML = q ? cur.scrollList.genSummary(len) : cur.scrollList.summaries[tab];
- 822. - }
- 823. -
- 824. - var start = refresh ? 0 : cur.scrollList.offset, end = Math.min(len, start + cur.scrollList.perpage);
- 825. - var html = [];
- 826. -
- 827. - for (var i = start; i < end; ++i) {
- 828. - var row = cur.scrollList.lists[tab][list[i]];
- 829. - if (!row) continue;
- 830. - var name = row[0];
- 831. - if (highlight) {
- 832. - name = name.replace(highlight.re, highlight.val);
- 833. - }
- 834. - if (cur.scrollList.tab == 'inv') {
- 835. - html.push(cur.scrollList.genInvRow(row, name));
- 836. - } else {
- 837. - html.push(cur.scrollList.genRow(row, name));
- 838. - }
- 839. - }
- 840. -
- 841. - if (!q && (!start || refresh)) {
- 842. - hide(cur.scrollList.searchCont);
- 843. - cur.searchOffset = 0;
- 844. - }
- 845. -
- 846. - if (refresh) {
- 847. - cont.innerHTML = html.join('');
- 848. - cur.searchOffset = false;
- 849. - if (list.length < 10 && q && tab == 'groups') {
- 850. - var exclude = [];
- 851. - for (var i in list) {
- 852. - var el = cur.scrollList.lists[tab][list[i]];
- 853. - exclude.push(el[2]);
- 854. - }
- 855. - GroupsList.serverSearch(cont, q, false, exclude);
- 856. - } else {
- 857. - hide(cur.scrollList.searchCont);
- 858. - cur.searchOffset = 0;
- 859. - }
- 860. - } else {
- 861. - cont.innerHTML += html.join('');
- 862. - if (cur.searchOffset) {
- 863. - GroupsList.serverSearchMore(cont, q);
- 864. - }
- 865. - }
- 866. - cur.scrollList.offset = end;
- 867. -
- 868. - if (!cur.searchOffset) {
- 869. - (end < len ? show : hide)(more);
- 870. - }
- 871. - },
- 872. -
- 873. - serverSearchMore: function(cont, q) {
- 874. - if (cur.searchLoadingMore) return;
- 875. - cur.searchLoadingMore = 1;
- 876. - var more = ge(cur.scrollList.prefix + cur.scrollList.tab + '_more');
- 877. - var back = more.innerHTML;
- 878. - ajax.post('al_groups.php', {
- 879. - act: 'server_search',
- 880. - q: q,
- 881. - offset: cur.searchOffset,
- 882. - exclude: cur.searchExclude.join(',')
- 883. - }, {
- 884. - onDone: function(count, rows, finish) {
- 885. - cur.searchLoadingMore = 0;
- 886. - if (count) {
- 887. - cur.searchOffset += count;
- 888. - cur.scrollList.searchCont.appendChild(cf(rows));
- 889. - } else {
- 890. - cur.searchOffset = 0;
- 891. - }
- 892. - (finish ? hide : show)(cur.scrollList.prefix + cur.scrollList.tab + '_more');
- 893. - debugLog((finish ? 'hide' : 'show'));
- 894. - },
- 895. - onFail: function() {
- 896. - cur.searchLoadingMore = 0;
- 897. - },
- 898. - showProgress: function() {
- 899. - more.innerHTML = '<img src="/images/upload.gif" />';
- 900. - },
- 901. - hideProgress: function() {
- 902. - more.innerHTML = back;
- 903. - }
- 904. - })
- 905. - },
- 906. -
- 907. - serverSearch: function(cont, q, emptyLocal, exclude) {
- 908. - if (cur.scrollList.tab != 'groups') {
- 909. - return false;
- 910. - }
- 911. - clearTimeout(cur.searchTimeout);
- 912. - cur.searchTimeout = setTimeout(function() {
- 913. - if (cur.searchStr != q) return;
- 914. - cur.searchExclude = exclude || [];
- 915. - ajax.post('al_groups.php', {
- 916. - act: 'server_search',
- 917. - q: q,
- 918. - empty: emptyLocal ? 1 : 0,
- 919. - exclude: cur.searchExclude.join(',')
- 920. - }, {
- 921. - onDone: function(count, rows, summary, finish) {
- 922. - if (cur.searchStr != q) return;
- 923. - if (count) {
- 924. - var last = geByClass('group_list_row', cont).pop();
- 925. - if (last) {
- 926. - addClass(last, 'groups_list_last_row');
- 927. - }
- 928. - cur.scrollList.searchCont.innerHTML = rows;
- 929. - show(cur.scrollList.searchCont);
- 930. - if (emptyLocal) {
- 931. - cur.scrollList.summary.innerHTML = summary;
- 932. - cont.innerHTML = '';
- 933. - }
- 934. - if (!finish) {
- 935. - show(cur.scrollList.prefix + cur.scrollList.tab + '_more');
- 936. - }
- 937. - } else {
- 938. - cur.scrollList.searchCont.innerHTML = '';
- 939. - hide(cur.scrollList.searchCont);
- 940. - if (emptyLocal) {
- 941. - cont.innerHTML = cur.scrollList.genEmpty(q);
- 942. - cur.scrollList.summary.innerHTML = cur.scrollList.genSummary(0);
- 943. - }
- 944. - }
- 945. - cur.searchOffset = count;
- 946. - },
- 947. - showProgress: GroupsList.showLoading,
- 948. - hideProgress: GroupsList.hideLoading
- 949. - })
- 950. - }, 300);
- 951. - },
- 952. -
- 953. - resetSearch: function() {
- 954. - val(cur.scrollList.query, '');
- 955. - GroupsList.showMore(true);
- 956. - GroupsList.updateEvents();
- 957. - },
- 958. -
- 959. - showLoading: function() {
- 960. - cur.loadingShown = 1;
- 961. - show('groups_loading');
- 962. - hide('groups_reset_search');
- 963. - },
- 964. -
- 965. - hideLoading: function() {
- 966. - cur.loadingShown = 0;
- 967. - hide('groups_loading');
- 968. - if (cur.scrollList.query.value) {
- 969. - show('groups_reset_search');
- 970. - }
- 971. - },
- 972. -
- 973. - goToSearch: function() {
- 974. - var q = trim(cur.scrollList.query.value);
- 975. - nav.go('search?c%5Bq%5D='+encodeURIComponent(q)+'&c%5Bsection%5D=communities');
- 976. - },
- 977. -
- 978. - showInvites: function(obj) {
- 979. - removeClass(obj.previousSibling, 'groups_list_last_row');
- 980. - hide(obj);
- 981. - show(obj.nextSibling);
- 982. - },
- 983. -
- 984. - ttShow: function(obj, text) {
- 985. - var showsp = 200;
- 986. - if (cur.groupMemTT && cur.groupMemTT != obj && window.tooltips) {
- 987. - tooltips.hideAll();
- 988. - cur.groupMemTT = false;
- 989. - showsp = 0;
- 990. - }
- 991. - cur.groupMemTT = obj;
- 992. - return showTooltip(obj, {
- 993. - center: 1,
- 994. - black: 1,
- 995. - showsp: showsp,
- 996. - shift: [0, 2, 10],
- 997. - text: text
- 998. - });
- 999. - },
- 1000. -
- 1001. - showMapBox: function(place, zoom, link) {
- 1002. - if (window.showZeroZoneBox && showZeroZoneBox('places', function() {
- 1003. - GroupsList.showMapBox(place, zoom, link);
- 1004. - })) { return; }
- 1005. -
- 1006. - showTabbedBox('places.php', {act: 'a_get_place_box', id: place}, {stat: ['places.css', 'map.css', 'maps.js', 'ui_controls.css', 'ui_controls.js']});
- 1007. - },
- 1008. -
- 1009. - feedbanGroup: function(el, gid, hash) {
- 1010. - var oid = -gid;
- 1011. - ajax.post('al_fans.php', {act: 'feedtgl', oid: oid, hash: hash}, {
- 1012. - onDone: function(val, str) {
- 1013. - el.innerHTML = str;
- 1014. - if (!cur.scrollList.lists || !cur.scrollList.lists.groups) {
- 1015. - return;
- 1016. - }
- 1017. - var lst = cur.scrollList.lists.groups;
- 1018. - if (lst && lst.length) {
- 1019. - for (var i = 0, l = lst.length; i < l; ++i) {
- 1020. - if (lst[i][2] == gid) {
- 1021. - cur.scrollList.lists.groups[i][12] = val;
- 1022. - break;
- 1023. - }
- 1024. - }
- 1025. - }
- 1026. - },
- 1027. - showProgress: function() {
- 1028. - el.innerHTML = '<span class="progress_inline"></span>';
- 1029. - }
- 1030. - });
- 1031. - }
- 1032. - }
- 1033. -
- 1034. - try{stManager.done('groups_list.js');}catch(e){}
- ------
Advertisement
Add Comment
Please, Sign In to add comment