view.js 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368
  1. /**
  2. * Copyright (c) UNA, Inc - https://una.io
  3. * MIT License - https://opensource.org/licenses/MIT
  4. *
  5. * @defgroup Timeline Timeline
  6. * @ingroup UnaModules
  7. *
  8. * @{
  9. */
  10. function BxTimelineView(oOptions) {
  11. BxTimelineMain.call(this, oOptions);
  12. this._sActionsUri = oOptions.sActionUri;
  13. this._sActionsUrl = oOptions.sActionUrl;
  14. this._sObjName = oOptions.sObjName == undefined ? 'oTimelineView' : oOptions.sObjName;
  15. this._sObjNameMenuFeeds = oOptions.sObjNameMenuFeeds == undefined ? 'bx_timeline_menu_feeds' : oOptions.sObjNameMenuFeeds;
  16. this._sName = oOptions.sName == undefined ? '' : oOptions.sName;
  17. this._sView = oOptions.sView == undefined ? 'timeline' : oOptions.sView;
  18. this._sType = oOptions.sType == undefined ? 'public' : oOptions.sType;
  19. this._iOwnerId = oOptions.iOwnerId == undefined ? 0 : oOptions.iOwnerId;
  20. this._sReferrer = oOptions.sReferrer == undefined ? '' : oOptions.sReferrer;
  21. this._sAnimationEffect = oOptions.sAnimationEffect == undefined ? 'slide' : oOptions.sAnimationEffect;
  22. this._iAnimationSpeed = oOptions.iAnimationSpeed == undefined ? 'slow' : oOptions.iAnimationSpeed;
  23. this._sVideosAutoplay = oOptions.sVideosAutoplay == undefined ? 'off' : oOptions.sVideosAutoplay;
  24. this._bEventsToLoad = oOptions.bEventsToLoad == undefined ? false : oOptions.bEventsToLoad;
  25. this._bAutoMarkAsViewed = oOptions.bAutoMarkAsViewed == undefined ? false : oOptions.bAutoMarkAsViewed;
  26. this._aMarkAsViewed = oOptions.aMarkAsViewed == undefined ? [] : oOptions.aMarkAsViewed;
  27. this._aMarkedAsViewed = oOptions.aMarkedAsViewed == undefined ? [] : oOptions.aMarkedAsViewed;
  28. this._iLimitAttachLinks = oOptions.iLimitAttachLinks == undefined ? 0 : oOptions.iLimitAttachLinks;
  29. this._sLimitAttachLinksErr = oOptions.sLimitAttachLinksErr == undefined ? '' : oOptions.sLimitAttachLinksErr;
  30. this._oAttachedLinks = oOptions.oAttachedLinks == undefined ? {} : oOptions.oAttachedLinks;
  31. this._aHtmlIds = oOptions.aHtmlIds == undefined ? {} : oOptions.aHtmlIds;
  32. this._oRequestParams = oOptions.oRequestParams == undefined ? {} : oOptions.oRequestParams;
  33. this._bInfScroll = oOptions.bInfScroll == undefined ? false : oOptions.bInfScroll;
  34. this._iInfScrollAutoPreloads = oOptions.iInfScrollAutoPreloads == undefined ? 10 : oOptions.iInfScrollAutoPreloads;
  35. this._sInfScrollAfter = 'item';
  36. this._iInfScrollAfterItem = 2; //--- Preload more info when scroll reached N item from the end of Timeline block.
  37. this._fInfScrollAfterPercent = 0.25; //--- Preload more info when specified portion of Timeline block's content was already scrolled.
  38. this._bInfScrollBusy = false;
  39. this._iInfScrollPreloads = 1; //--- First portion is loaded with page loading or 'Load More' button click.
  40. this._fOutsideOffset = 0.8;
  41. this._oSaved = {};
  42. this._fVapOffsetStart = 0.8;
  43. this._fVapOffsetStop = 0.2;
  44. this._bLiveUpdatePaused = false;
  45. this._oFiltersPopupOptions = {};
  46. if(typeof window.glBxTimelineVapPlayers === 'undefined')
  47. window.glBxTimelineVapPlayers = [];
  48. //--- Use Scroll for Attachments.
  49. this._bScrollForFiles = true;
  50. this._bAutoMarkBusy = false;
  51. //--- Get currently active 'view'.
  52. this.initView();
  53. //--- Initialize components on currently active 'view'.
  54. this.init();
  55. }
  56. BxTimelineView.prototype = Object.create(BxTimelineMain.prototype);
  57. BxTimelineView.prototype.constructor = BxTimelineView;
  58. BxTimelineView.prototype.init = function(bForceInit)
  59. {
  60. var $this = this;
  61. if(!this.oView || bForceInit)
  62. this.initView();
  63. if(this.bViewTimeline) {
  64. //-- Check content to show 'See More'
  65. this.initSeeMore(this.oView, true);
  66. //--- Init Video Autoplay
  67. if(this._sVideosAutoplay != 'off') {
  68. this.initVideosAutoplay(this.oView);
  69. this.oView.on('hide')
  70. $(window).on('scroll', function() {
  71. if(!$this.oView.is(':visible'))
  72. return;
  73. if(!window.requestAnimationFrame)
  74. setTimeout(function() {
  75. $this.autoplayVideos($this.oView, $this._fVapOffsetStart, $this._fVapOffsetStop);
  76. }, 100);
  77. else
  78. window.requestAnimationFrame(function() {
  79. $this.autoplayVideos($this.oView, $this._fVapOffsetStart, $this._fVapOffsetStop);
  80. });
  81. });
  82. }
  83. //--- Blink (highlight) necessary items
  84. this.blink(this.oView);
  85. //--- Load 'Jump To'
  86. this.initJumpTo(this.oView);
  87. //--- Init 'Infinite Scroll'
  88. this.initInfiniteScroll(this.oView);
  89. //--- Init calendar
  90. this.initCalendar();
  91. //--- Init mark as viewed
  92. if(this._bAutoMarkAsViewed) {
  93. $(window).on('load scroll', function() {
  94. if(!$this.oView.is(':visible'))
  95. return;
  96. if(!window.requestAnimationFrame)
  97. setTimeout(function() {
  98. $this.markPostAsViewed($this.oView);
  99. }, 100);
  100. else
  101. window.requestAnimationFrame(function() {
  102. $this.markPostAsViewed($this.oView);
  103. });
  104. });
  105. window.addEventListener('beforeunload', (event) => {
  106. $this.sendMarkPostAsViewed();
  107. });
  108. }
  109. }
  110. if(this.bViewOutline) {
  111. this.initMasonry();
  112. this.oView.find('.' + this.sClassItem).resize(function() {
  113. $this.reloadMasonry();
  114. });
  115. this.oView.find('img.' + this.sClassItemImage).load(function() {
  116. $this.reloadMasonry();
  117. });
  118. //--- Init Video Layout
  119. if(this._sVideosAutoplay != 'off')
  120. this.initVideos(this.oView);
  121. //--- Blink (highlight) necessary items
  122. this.blink(this.oView);
  123. //--- Load 'Jump To'
  124. this.initJumpTo(this.oView);
  125. //--- Init 'Infinite Scroll'
  126. this.initInfiniteScroll(this.oView);
  127. }
  128. if(this.bViewItem) {
  129. //-- Check content to show 'See More'
  130. this.initSeeMore(this.oView, false);
  131. //--- Init Video Layout
  132. if(this._sVideosAutoplay != 'off')
  133. this.initVideos(this.oView);
  134. }
  135. //--- Init Flickity
  136. this.initFlickity(this.oView);
  137. };
  138. BxTimelineView.prototype.initView = function()
  139. {
  140. BxTimelineMain.prototype.initView.call(this);
  141. this.oView = $(this._getHtmlId('main', this._oRequestParams));
  142. if(!this.oView.length)
  143. return;
  144. if(this.oView.hasClass(this.sClassView + '-timeline'))
  145. this.bViewTimeline = true;
  146. else if(this.oView.hasClass(this.sClassView + '-outline'))
  147. this.bViewOutline = true;
  148. else if(this.oView.hasClass(this.sClassView + '-item'))
  149. this.bViewItem = true;
  150. };
  151. BxTimelineView.prototype.initSeeMore = function(oParent, bInItems)
  152. {
  153. var $this = this;
  154. var oSubParent = oParent;
  155. if(bInItems)
  156. oSubParent = oParent.find('.' + this.sClassItem);
  157. oSubParent.find('.bx-tl-item-text .bx-tl-content').bxCheckOverflowHeight(this.sSP + '-overflow', function(oElement) {
  158. $this.onFindOverflow(oElement);
  159. });
  160. if(oSubParent.find('.bx-tl-item-text .bx-tl-content .bx-embed-link').length != 0)
  161. setTimeout(function() {
  162. oSubParent.find('.bx-tl-item-text .bx-tl-content:not(.' + $this.sSP + '-overflow)').has('.bx-embed-link').bxCheckOverflowHeight($this.sSP + '-overflow', function(oElement) {
  163. $this.onFindOverflow(oElement);
  164. });
  165. }, 4000);
  166. };
  167. BxTimelineView.prototype.initJumpTo = function(oParent)
  168. {
  169. var oJumpTo = $(oParent).find('.' + this.sClassJumpTo);
  170. if(!oJumpTo || oJumpTo.length == 0 || oJumpTo.html() != '')
  171. return;
  172. bx_loading_btn(oJumpTo, true);
  173. jQuery.post (
  174. this._sActionsUrl + 'get_jump_to/',
  175. this._getDefaultData(oParent),
  176. function(oData) {
  177. oData.holder = oJumpTo;
  178. processJsonData(oData);
  179. },
  180. 'json'
  181. );
  182. };
  183. BxTimelineView.prototype.onGetJumpTo = function(oData)
  184. {
  185. if(!oData.holder || oData.content == undefined)
  186. return;
  187. $(oData.holder).html(oData.content);
  188. };
  189. BxTimelineView.prototype.initInfiniteScroll = function(oParent)
  190. {
  191. var $this = this;
  192. if(!this._bInfScroll || !this._bEventsToLoad)
  193. return;
  194. $(window).bind('scroll', function(oEvent) {
  195. if(!$this.oView.is(':visible'))
  196. return;
  197. if($this.oView.attr('id') != $this._getHtmlId('main', {name: $this._sName, view: $this._sView, type: $this._sType}, {hash: false}))
  198. return;
  199. if(!$this._bEventsToLoad || $this._bInfScrollBusy || $this._iInfScrollPreloads >= $this._iInfScrollAutoPreloads)
  200. return;
  201. var iScrollTop = parseInt($(window).scrollTop());
  202. var iWindowHeight = $(window).height();
  203. //--- Auto-scroll by reaching the N item from the end of parent block.
  204. if($this._sInfScrollAfter == 'item') {
  205. var oItems = oParent.find('.' + $this.sClassItem);
  206. if((iScrollTop + iWindowHeight) <= ($(oItems.get(oItems.length - $this._iInfScrollAfterItem)).offset().top))
  207. return;
  208. }
  209. //--- Auto-scroll by reaching the percent of parent block's height.
  210. if($this._sInfScrollAfter == 'percent') {
  211. var iParentTop = parseInt(oParent.offset().top);
  212. var iParentHeight = parseInt(oParent.height());
  213. if((iScrollTop + iWindowHeight) <= (iParentTop + iParentHeight * $this._fInfScrollAfterPercent))
  214. return;
  215. }
  216. var iStart = $this._oRequestParams.start + ($this._oRequestParams.start == 0 ? $this._oRequestParams.per_page_default : $this._oRequestParams.per_page);
  217. $this._bInfScrollBusy = true;
  218. $this._getPage(undefined, iStart, $this._oRequestParams.per_page, function(oData) {
  219. $this._bEventsToLoad = oData.events_to_load;
  220. $this._iInfScrollPreloads += 1;
  221. $this._bInfScrollBusy = false;
  222. });
  223. });
  224. };
  225. BxTimelineView.prototype.initVideosAutoplay = function(oParent)
  226. {
  227. var $this = this;
  228. if(this._sVideosAutoplay == 'off')
  229. return;
  230. this.initVideos(oParent);
  231. var sPrefix = oParent.hasClass(this.sClassView) ? oParent.attr('id') : oParent.parents('.' + this.sClassView + ':first').attr('id');
  232. oParent.find('iframe').each(function() {
  233. var sPlayer = sPrefix + '_' + $(this).attr('id');
  234. if(window.glBxTimelineVapPlayers[sPlayer])
  235. return;
  236. var oPlayer = new playerjs.Player(this);
  237. if($this._sVideosAutoplay == 'on_mute')
  238. oPlayer.mute();
  239. var fFixHeight = function () {
  240. $('#' + sPlayer).height(($('#' + sPlayer).contents().find('video').height()) + 'px');
  241. };
  242. oPlayer.on('ready', fFixHeight);
  243. oPlayer.on('play', fFixHeight);
  244. window.glBxTimelineVapPlayers[sPlayer] = oPlayer;
  245. });
  246. };
  247. BxTimelineView.prototype.autoplayVideos = function(oView, fOffsetStart, fOffsetStop)
  248. {
  249. var $this = this;
  250. var oItems = oView.find('.' + this.sClassItem);
  251. var sPrefix = oView.attr('id') + '_';
  252. oItems.each(function() {
  253. $(this).find('iframe').each(function() {
  254. var oFrame = $(this);
  255. var oPlayer = window.glBxTimelineVapPlayers[sPrefix + oFrame.attr('id')];
  256. if(!oPlayer)
  257. return;
  258. var iFrameTop = oFrame.offset().top;
  259. var iFrameBottom = iFrameTop + oFrame.height();
  260. var iWindowTop = $(window).scrollTop();
  261. var iWindowHeight = $(window).height();
  262. if(iFrameTop <= iWindowTop + iWindowHeight * fOffsetStart && iFrameBottom >= iWindowTop + iWindowHeight * fOffsetStop)
  263. oPlayer.play();
  264. else
  265. oPlayer.pause();
  266. });
  267. });
  268. };
  269. BxTimelineView.prototype.playVideos = function(oView)
  270. {
  271. var $this = this;
  272. var oItems = oView.find('.' + this.sClassItem);
  273. var sPrefix = oView.attr('id') + '_';
  274. oItems.each(function() {
  275. $(this).find('iframe').each(function() {
  276. var oFrame = $(this);
  277. var oPlayer = window.glBxTimelineVapPlayers[sPrefix + oFrame.attr('id')];
  278. if(!oPlayer)
  279. return;
  280. oPlayer.play();
  281. });
  282. });
  283. };
  284. BxTimelineView.prototype.pauseVideos = function(oView)
  285. {
  286. var $this = this;
  287. var oItems = oView.find('.' + this.sClassItem);
  288. var sPrefix = oView.attr('id') + '_';
  289. oItems.each(function() {
  290. $(this).find('iframe').each(function() {
  291. var oFrame = $(this);
  292. var oPlayer = window.glBxTimelineVapPlayers[sPrefix + oFrame.attr('id')];
  293. if(!oPlayer)
  294. return;
  295. oPlayer.pause();
  296. });
  297. });
  298. };
  299. BxTimelineView.prototype.reload = function(oSource, onLoad)
  300. {
  301. var $this = this;
  302. this.loadingInBlock(oSource, true);
  303. this._oRequestParams.start = 0;
  304. this._getPosts(oSource, function(oData) {
  305. processJsonData(oData);
  306. $this.init(true);
  307. if(typeof onLoad == 'function')
  308. onLoad();
  309. });
  310. };
  311. BxTimelineView.prototype.changeView = function(oLink, sType, oRequestParams)
  312. {
  313. var $this = this;
  314. var oViews = $(this._getHtmlId('views_content', this._oRequestParams, {with_type: false}));
  315. var oViewBefore = $(this._getHtmlId('main', this._oRequestParams));
  316. if(!oViewBefore.length)
  317. oViewBefore = oViews.children(':visible');
  318. var oViewPlaceholder = $(this._getHtmlId('main', jQuery.extend({}, this._oRequestParams, {type: 'placeholder'})));
  319. var bViewPlaceholder = oViewPlaceholder && oViewPlaceholder.length != 0;
  320. if(this._sVideosAutoplay != 'off')
  321. this.pauseVideos(oViewBefore);
  322. this._oRequestParams.start = 0;
  323. this._oRequestParams.per_page = undefined;
  324. this._oRequestParams.per_page_default = undefined;
  325. this._oRequestParams.type = sType;
  326. var oTab = $(oLink);
  327. var sTabActive = 'bx-menu-tab-active';
  328. oTab.parents('.bx-db-menu:first').find('li.' + sTabActive).removeClass(sTabActive);
  329. oTab.parents('li:first').addClass(sTabActive);
  330. var sView = this._getHtmlId('main', this._oRequestParams);
  331. if(oViews.find(sView).length !== 0) {
  332. oViewBefore.hide();
  333. if(bViewPlaceholder) {
  334. oViewPlaceholder.bx_anim('show', this._sAnimationEffect, this._iAnimationSpeed, function() {
  335. oViewPlaceholder.hide();
  336. oViews.find(sView).show();
  337. });
  338. }
  339. else
  340. oViews.find(sView).show();
  341. this.initView();
  342. return;
  343. }
  344. var oData = this._getDefaultData(oLink);
  345. if(oRequestParams != undefined)
  346. oData = jQuery.extend({}, oData, oRequestParams);
  347. if(bViewPlaceholder) {
  348. oViewBefore.hide();
  349. oViewPlaceholder.show();
  350. }
  351. else
  352. this.loadingIn(oLink, true);
  353. jQuery.get (
  354. this._sActionsUrl + 'get_view',
  355. oData,
  356. function(oResponse) {
  357. if(bViewPlaceholder)
  358. oViewPlaceholder.hide();
  359. else
  360. $this.loadingIn(oLink, false);
  361. if(!oResponse.content) {
  362. if(oViewBefore.is(':hidden'))
  363. oViewBefore.show();
  364. return;
  365. }
  366. oViews.append(oResponse.content).find(sView).bxProcessHtml();
  367. },
  368. 'json'
  369. );
  370. };
  371. BxTimelineView.prototype.changePage = function(oLink, iStart, iPerPage, onLoad)
  372. {
  373. if(this._bInfScroll)
  374. this._iInfScrollPreloads = 1;
  375. this._getPage(oLink, iStart, iPerPage, onLoad);
  376. };
  377. BxTimelineView.prototype.changeFilter = function(oLink)
  378. {
  379. var sId = $(oLink).attr('id');
  380. sId = sId.substr(sId.lastIndexOf('-') + 1, sId.length);
  381. this.loadingInBlock(oLink, true);
  382. this._oRequestParams.start = 0;
  383. this._oRequestParams.filter = sId;
  384. this._getPosts(oLink);
  385. };
  386. BxTimelineView.prototype.changeTimeline = function(oLink, sDate)
  387. {
  388. var $this = this;
  389. oLink = $(oLink);
  390. var bLink = oLink.length > 0;
  391. var bLoadingInButton = bLink && oLink.hasClass('bx-btn');
  392. if(bLink) {
  393. if(bLoadingInButton)
  394. this.loadingInButton(oLink, true);
  395. else
  396. this.loadingInBlock(oLink, true);
  397. }
  398. this._oRequestParams.start = 0;
  399. this._oRequestParams.timeline = sDate;
  400. this._getPosts(oLink, function(oData) {
  401. if(bLink) {
  402. if(bLoadingInButton)
  403. $this.loadingInButton(oLink, false);
  404. else
  405. $this.loadingInBlock(oLink, false);
  406. }
  407. window.scrollTo(0, $this.oView.offset().top - 150);
  408. processJsonData(oData);
  409. });
  410. };
  411. BxTimelineView.prototype.initCalendar = function()
  412. {
  413. var $this = this;
  414. var oInput = $('.' + $this.sSP + '-jump-to-calendar');
  415. if(!oInput.length)
  416. return;
  417. var oInputPicker = oInput.parents('.flatpickr:first');
  418. if(!oInputPicker.length)
  419. return;
  420. flatpickr(oInputPicker.get(0), {
  421. wrap: true,
  422. dateFormat: "Y-m-d",
  423. minDate: 1900,
  424. maxDate: "today",
  425. onValueUpdate: function(aDates, sDate, oPicker){
  426. $this.changeTimeline(oInputPicker.find('.bx-btn'), sDate);
  427. }
  428. });
  429. };
  430. /**
  431. * Isn't needed for now, because 'flatpickr' picker is used.
  432. * Saved for possible future usage.
  433. */
  434. BxTimelineView.prototype.showCalendar = function(oLink)
  435. {
  436. };
  437. BxTimelineView.prototype.showMore = function(oLink)
  438. {
  439. var sClassOverflow = this.sSP + '-overflow';
  440. $(oLink).parents('.' + this.sClassItem + ':first').find('.' + sClassOverflow).css('max-height', 'none').removeClass(sClassOverflow);
  441. $(oLink).parents('.' + this.sSP + '-content-show-more:first').remove();
  442. if(this.bViewOutline)
  443. this.reloadMasonry();
  444. };
  445. BxTimelineView.prototype.showItem = function(oLink, iId, sMode, oParams)
  446. {
  447. var $this = this;
  448. var oData = $.extend({}, this._getDefaultData(), {id: iId, mode: sMode}, (oParams != undefined ? oParams : {}));
  449. $(".bx-popup-full-screen.bx-popup-applied:visible").dolPopupHide();
  450. $(window).dolPopupAjax({
  451. id: {
  452. value: this._getHtmlId('item_popup', this._oRequestParams, {whole: false, hash: false}) + iId,
  453. force: true
  454. },
  455. url: bx_append_url_params(this._sActionsUrl + 'get_item_brief', oData),
  456. closeOnOuterClick: false,
  457. removeOnClose: true,
  458. fullScreen: true,
  459. displayMode: 'box',
  460. onLoad: function(oPopup) {
  461. var sClassImages = $this.sSP + '-bview-images';
  462. var sClassImage = $this.sSP + '-bview-image';
  463. var oParent = $(oPopup).find('.' + sClassImages);
  464. if(oParent.length > 0 && oParent.find('.' + sClassImage).length > 1)
  465. $this.initFlickityImages(oParent, '.' + sClassImage);
  466. }
  467. });
  468. return false;
  469. };
  470. BxTimelineView.prototype.commentItem = function(oLink, sSystem, iId)
  471. {
  472. var $this = this;
  473. var oData = this._getDefaultData(oLink);
  474. oData['system'] = sSystem;
  475. oData['id'] = iId;
  476. var oComments = $(oLink).parents('.' + this.sClassItem + ':first').find('.' + this.sClassItemComments);
  477. if(oComments.children().length > 0) {
  478. oComments.bx_anim('toggle', this._sAnimationEffect, this._iAnimationSpeed);
  479. $(oLink).parents('.cmt-counter').toggleClass('cmt-counter-opened');
  480. return;
  481. }
  482. if(oLink)
  483. this.loadingInItem(oLink, true);
  484. jQuery.get (
  485. this._sActionsUrl + 'get_comments',
  486. oData,
  487. function(oData) {
  488. if(oLink)
  489. $this.loadingInItem(oLink, false);
  490. if(!oData.content)
  491. return;
  492. oComments.html($(oData.content).hide()).children(':hidden').bxProcessHtml().bx_anim('show', $this._sAnimationEffect, $this._iAnimationSpeed);
  493. $(oLink).parents('.cmt-counter').toggleClass('cmt-counter-opened');
  494. },
  495. 'json'
  496. );
  497. };
  498. BxTimelineView.prototype.pinPost = function(oLink, iId, iWay)
  499. {
  500. this._markPost(oLink, iId, iWay, 'pin');
  501. };
  502. BxTimelineView.prototype.onPinPost = function(oData)
  503. {
  504. this._onMarkPost(oData, 'pin');
  505. };
  506. BxTimelineView.prototype.stickPost = function(oLink, iId, iWay)
  507. {
  508. this._markPost(oLink, iId, iWay, 'stick');
  509. };
  510. BxTimelineView.prototype.onStickPost = function(oData)
  511. {
  512. this._onMarkPost(oData, 'stick');
  513. };
  514. BxTimelineView.prototype.promotePost = function(oLink, iId, iWay)
  515. {
  516. var $this = this;
  517. var oData = this._getDefaultData();
  518. oData['id'] = iId;
  519. $(oLink).parents('.bx-popup-applied:first:visible').dolPopupHide({
  520. onHide: function(oPopup) {
  521. $(oPopup).remove();
  522. }
  523. });
  524. var oLoadingContainer = $(this._getHtmlId('item', this._oRequestParams, {whole: false}) + iId);
  525. this.loadingInItem(oLoadingContainer, true);
  526. $.post(
  527. this._sActionsUrl + 'promote/',
  528. oData,
  529. function(oData) {
  530. $this.loadingInItem(oLoadingContainer, false);
  531. processJsonData(oData);
  532. },
  533. 'json'
  534. );
  535. };
  536. /**
  537. * Sends request to a server everytime an Item was viewed.
  538. * Note. Isn't used for now.
  539. */
  540. BxTimelineView.prototype.markPostAsViewedSingle = function(oView)
  541. {
  542. var $this = this;
  543. var oItems = oView.find('.' + this.sClassItem);
  544. var sPrefix = this._getHtmlId('item', this._oRequestParams, {whole: false}).replace('#', '');
  545. oItems.each(function() {
  546. if($this._bAutoMarkBusy)
  547. return;
  548. var oItem = $(this);
  549. var iId = parseInt(oItem.attr('id').replace(sPrefix, ''));
  550. if($this._aMarkedAsViewed.includes(iId))
  551. return;
  552. var iItemTop = oItem.offset().top;
  553. var iItemBottom = iItemTop + oItem.height();
  554. var iWindowTop = $(window).scrollTop();
  555. var iWindowHeight = $(window).height();
  556. if(iItemBottom < iWindowTop + iWindowHeight) {
  557. $this._bAutoMarkBusy = true;
  558. var oData = $this._getDefaultData();
  559. oData['id'] = iId;
  560. $.post(
  561. $this._sActionsUrl + 'mark_as_read/',
  562. oData,
  563. function(oData) {
  564. if(oData && oData.id != undefined)
  565. $this._aMarkedAsViewed.push(oData.id);
  566. $this._bAutoMarkBusy = false;
  567. },
  568. 'json'
  569. );
  570. }
  571. });
  572. };
  573. /**
  574. * Collects all viewed items in an array and sends only one request to a server on 'beforeunload'.
  575. */
  576. BxTimelineView.prototype.markPostAsViewed = function(oView)
  577. {
  578. var $this = this;
  579. var oItems = oView.find('.' + this.sClassItem);
  580. var sPrefix = this._getHtmlId('item', this._oRequestParams, {whole: false}).replace('#', '');
  581. oItems.each(function() {
  582. var oItem = $(this);
  583. var iId = parseInt(oItem.attr('id').replace(sPrefix, ''));
  584. if($this._aMarkAsViewed.includes(iId) || $this._aMarkedAsViewed.includes(iId))
  585. return;
  586. var iItemTop = oItem.offset().top;
  587. var iItemBottom = iItemTop + oItem.height();
  588. var iWindowTop = $(window).scrollTop();
  589. var iWindowHeight = $(window).height();
  590. if(iItemBottom < iWindowTop + iWindowHeight)
  591. $this._aMarkAsViewed.push(iId);
  592. });
  593. };
  594. BxTimelineView.prototype.sendMarkPostAsViewed = function()
  595. {
  596. var $this = this;
  597. var oData = $this._getDefaultData();
  598. oData['id'] = this._aMarkAsViewed;
  599. $.post({
  600. url: this._sActionsUrl + 'mark_as_read/',
  601. data: oData,
  602. dataType: 'json',
  603. success: function(oData) {
  604. if(!oData || !oData.id)
  605. return;
  606. if(Array.isArray(oData.id))
  607. $this._aMarkedAsViewed = [...$this._aMarkedAsViewed, ...oData.id];
  608. else
  609. $this._aMarkedAsViewed.push(oData.id);
  610. },
  611. async: false
  612. });
  613. };
  614. BxTimelineView.prototype.muteAuthor = function(oLink, iId)
  615. {
  616. var $this = this;
  617. var oData = this._getDefaultData();
  618. oData['id'] = iId;
  619. $(oLink).parents('.bx-popup-applied:first:visible').dolPopupHide({
  620. onHide: function(oPopup) {
  621. $(oPopup).remove();
  622. }
  623. });
  624. var oLoadingContainer = $(this._getHtmlId('item', this._oRequestParams, {whole: false}) + iId);
  625. this.loadingInItem(oLoadingContainer, true);
  626. $.post(
  627. this._sActionsUrl + 'mute/',
  628. oData,
  629. function(oData) {
  630. $this.loadingInItem(oLoadingContainer, false);
  631. processJsonData(oData);
  632. },
  633. 'json'
  634. );
  635. };
  636. BxTimelineView.prototype.initFormEdit = function(sFormId, iEventId)
  637. {
  638. var $this = this;
  639. var oForm = $('#' + sFormId);
  640. var oTextarea = oForm.find('textarea');
  641. autosize(oTextarea);
  642. oForm.ajaxForm({
  643. dataType: "json",
  644. beforeSubmit: function (formData, jqForm, options) {
  645. window[$this._sObjName].beforeFormEditSubmit(oForm);
  646. },
  647. success: function (oData) {
  648. window[$this._sObjName].afterFormEditSubmit(oForm, oData);
  649. }
  650. });
  651. this.initTrackerInsertSpace(sFormId, iEventId);
  652. var sContent = oTextarea.val();
  653. if(sContent && sContent.length > 0)
  654. this.parseContent(oForm, iEventId, sContent, false);
  655. oForm.bxConvertEmbeds();
  656. };
  657. BxTimelineView.prototype.beforeFormEditSubmit = function(oForm)
  658. {
  659. this.loadingInButton($(oForm).children().find(':submit'), true);
  660. };
  661. BxTimelineView.prototype.afterFormEditSubmit = function (oForm, oData)
  662. {
  663. var $this = this;
  664. var fContinue = function() {
  665. var iId = 0;
  666. if(oData && oData.id != undefined)
  667. iId = parseInt(oData.id);
  668. if(oData && oData.form != undefined && oData.form_id != undefined) {
  669. $('#' + oData.form_id).replaceWith(oData.form);
  670. $this.initFormEdit(oData.form_id, iId);
  671. return;
  672. }
  673. if(iId > 0)
  674. $this._getPost($this.oView, iId, $this._oRequestParams);
  675. };
  676. this.loadingInButton($(oForm).children().find(':submit'), false);
  677. // Saved: a subtle success; the form back with an error: error.
  678. if(oData && typeof(bx_sound) == 'function')
  679. if(oData.form != undefined && oData.form_id != undefined)
  680. bx_sound('error');
  681. else if(oData.id != undefined && parseInt(oData.id) > 0)
  682. bx_sound('success', {emphasis: 'subtle'});
  683. if(oData && oData.message != undefined)
  684. bx_alert(oData.message, fContinue);
  685. else
  686. fContinue();
  687. };
  688. BxTimelineView.prototype.editPost = function(oLink, iId)
  689. {
  690. var $this = this;
  691. var oData = this._getDefaultData(oLink);
  692. oData['id'] = iId;
  693. $(oLink).parents('.bx-popup-applied:first:visible').dolPopupHide();
  694. var oItem = this.oView.find(this._getHtmlId('item', this._oRequestParams, {whole: false}) + iId);
  695. var oContent = oItem.find('.' + this.sClassItemContent);
  696. if(oContent.find('form').length) {
  697. $(oContent).bx_anim('hide', this._sAnimationEffect, this._iAnimationSpeed, function() {
  698. $(this).html($this._oSaved[iId]).bx_anim('show', $this._sAnimationEffect, $this._iAnimationSpeed);
  699. });
  700. return;
  701. }
  702. else
  703. this._oSaved[iId] = oContent.html();
  704. this.loadingInItem(oItem, true);
  705. jQuery.post (
  706. this._sActionsUrl + 'get_edit_form/' + iId + '/',
  707. oData,
  708. function (oData) {
  709. processJsonData(oData);
  710. },
  711. 'json'
  712. );
  713. };
  714. BxTimelineView.prototype.onEditPost = function(oData)
  715. {
  716. var $this = this;
  717. if(!oData || !oData.id)
  718. return;
  719. var oItem = $(this._getHtmlId('item', this._oRequestParams, {whole: false}) + oData.id);
  720. this.loadingInItem(oItem, false);
  721. if(oData && oData.form != undefined && oData.form_id != undefined) {
  722. oItem.find('.' + this.sClassItemContent).bx_anim('hide', this._sAnimationEffect, this._iAnimationSpeed, function() {
  723. $(this).html(oData.form).bx_anim('show', $this._sAnimationEffect, $this._iAnimationSpeed, function() {
  724. $this.initFormEdit(oData.form_id, oData.id);
  725. });
  726. });
  727. }
  728. };
  729. BxTimelineView.prototype.editPostCancel = function(oButton, iId)
  730. {
  731. this.editPost(oButton, iId);
  732. };
  733. BxTimelineView.prototype.deletePost = function(oLink, iId)
  734. {
  735. var $this = this;
  736. $(oLink).parents('.bx-popup-applied:first:visible').dolPopupHide();
  737. bx_confirm('', function() {
  738. var oData = $this._getDefaultData();
  739. oData['id'] = iId;
  740. $this.loadingInItem($($this._getHtmlId('item', $this._oRequestParams, {whole: false}) + iId), true);
  741. $.post(
  742. $this._sActionsUrl + 'delete/',
  743. oData,
  744. function(oData) {
  745. processJsonData(oData);
  746. },
  747. 'json'
  748. );
  749. });
  750. };
  751. BxTimelineView.prototype.onDeletePost = function(oData)
  752. {
  753. var $this = this;
  754. var oItem = $(this._getHtmlId('item', this._oRequestParams, {whole: false}) + oData.id);
  755. //--- Delete from 'Timeline' (if available)
  756. if(this.bViewTimeline) {
  757. oItem.bx_anim('hide', this._sAnimationEffect, this._iAnimationSpeed, function() {
  758. $(this).remove();
  759. if($this.oView.find('.' + $this.sClassItem).length == 0) {
  760. $this.oView.find('.' + $this.sClassDividerToday).hide();
  761. $this.oView.find('.' + $this.sSP + '-load-more').hide();
  762. $this.oView.find('.' + $this.sSP + '-empty').show();
  763. }
  764. });
  765. return;
  766. }
  767. //--- Delete from 'Outline' (if available)
  768. if(this.bViewOutline) {
  769. oItem.bx_anim('hide', this._sAnimationEffect, this._iAnimationSpeed, function() {
  770. $(this).remove();
  771. if($this.oView.find('.' + $this.sClassItem).length == 0) {
  772. $this.destroyMasonry();
  773. $this.oView.find('.' + $this.sSP + '-load-more').hide();
  774. $this.oView.find('.' + $this.sSP + '-empty').show();
  775. }
  776. else
  777. $this.reloadMasonry();
  778. });
  779. return;
  780. }
  781. //--- Delete from 'View Item' page.
  782. if(this._sReferrer.length != 0)
  783. document.location = this._sReferrer;
  784. };
  785. BxTimelineView.prototype.onConnect = function(eElement, oData)
  786. {
  787. $(eElement).remove();
  788. };
  789. /*----------------------------*/
  790. /*--- Live Updates methods ---*/
  791. /*----------------------------*/
  792. BxTimelineView.prototype.goTo = function(oLink, sGoToId, sBlinkIds, onLoad)
  793. {
  794. var $this = this;
  795. this.loadingInPopup(oLink, true);
  796. this._oRequestParams.start = 0;
  797. this._oRequestParams.blink = sBlinkIds;
  798. this._getPosts(this.oView, function(oData) {
  799. $this.loadingInPopup(oLink, false);
  800. $(oLink).parents('.bx-popup-applied:first:visible').dolPopupHide();
  801. oData.go_to = sGoToId;
  802. processJsonData(oData);
  803. });
  804. };
  805. BxTimelineView.prototype.goToBtn = function(oLink, sGoToId, sBlinkIds, onLoad)
  806. {
  807. var $this = this;
  808. this.loadingInButton(oLink, true);
  809. this._oRequestParams.start = 0;
  810. this._oRequestParams.blink = sBlinkIds;
  811. this._getPosts(this.oView, function(oData) {
  812. oData.go_to = sGoToId;
  813. processJsonData(oData);
  814. $this.loadingInButton(oLink, false);
  815. $(oLink).parents('.' + $this.sSP + '-live-update-button:first').remove();
  816. $this.resumeLiveUpdates();
  817. });
  818. };
  819. /*
  820. * Show only one live update notification for all new events.
  821. *
  822. * Note. oData.count_old and oData.count_new are also available and can be checked or used in notification popup.
  823. */
  824. BxTimelineView.prototype.showLiveUpdate = function(oData)
  825. {
  826. if(!oData.code)
  827. return;
  828. var oButton = $(oData.code);
  829. var sId = oButton.attr('id');
  830. $('#' + sId).remove();
  831. oButton.prependTo(this.oView);
  832. };
  833. /*
  834. * Show separate live update notification for each new Event.
  835. *
  836. * Note. This way to display live update notifications isn't used for now.
  837. * See BxTimelineView::showLiveUpdate method instead.
  838. *
  839. * Note. oData.count_old and oData.count_new are also available and can be checked or used in notification popup.
  840. */
  841. BxTimelineView.prototype.showLiveUpdates = function(oData)
  842. {
  843. if(!oData.code)
  844. return;
  845. var $this = this;
  846. var oItems = $(oData.code);
  847. var sId = oItems.attr('id');
  848. $('#' + sId).remove();
  849. oItems.prependTo('body').dolPopup({
  850. position: 'fixed',
  851. left: '1rem',
  852. top: 'auto',
  853. bottom: '1rem',
  854. fog: false,
  855. onBeforeShow: function() {
  856. },
  857. onBeforeHide: function() {
  858. },
  859. onShow: function() {
  860. setTimeout(function() {
  861. $('.bx-popup-chain.bx-popup-applied:visible:first').dolPopupHide();
  862. }, 5000);
  863. },
  864. onHide: function() {
  865. $this.resumeLiveUpdates();
  866. }
  867. });
  868. };
  869. BxTimelineView.prototype.previousLiveUpdate = function(oLink)
  870. {
  871. var fPrevious = function() {
  872. var sClass = 'bx-popup-chain-item';
  873. $(oLink).parents('.' + sClass + ':first').hide().prev('.' + sClass).show();
  874. };
  875. if(!this.pauseLiveUpdates(fPrevious));
  876. fPrevious();
  877. };
  878. BxTimelineView.prototype.hideLiveUpdate = function(oLink)
  879. {
  880. $(oLink).parents('.bx-popup-applied:visible:first').dolPopupHide();
  881. };
  882. BxTimelineView.prototype.resumeLiveUpdates = function(onLoad)
  883. {
  884. if(!this._bLiveUpdatePaused)
  885. return false;
  886. var $this = this;
  887. this.changeLiveUpdates('resume_live_update', function() {
  888. $this._bLiveUpdatePaused = false;
  889. if(typeof onLoad == 'function')
  890. onLoad();
  891. });
  892. return true;
  893. };
  894. BxTimelineView.prototype.pauseLiveUpdates = function(onLoad)
  895. {
  896. if(this._bLiveUpdatePaused)
  897. return false;
  898. var $this = this;
  899. this.changeLiveUpdates('pause_live_update', function() {
  900. $this._bLiveUpdatePaused = true;
  901. if(typeof onLoad == 'function')
  902. onLoad();
  903. });
  904. return true;
  905. };
  906. BxTimelineView.prototype.changeLiveUpdates = function(sAction, onLoad)
  907. {
  908. var $this = this;
  909. var oParams = this._getDefaultActions();
  910. oParams['action'] = sAction;
  911. jQuery.get(
  912. this._sActionsUrl + sAction + '/',
  913. oParams,
  914. function() {
  915. if(typeof onLoad == 'function')
  916. onLoad();
  917. }
  918. );
  919. };
  920. BxTimelineView.prototype.copyToClipboard = function(oElement, sLink)
  921. {
  922. bx_copy_to_clipboard(sLink, function() {
  923. $('.bx-popup-applied:visible').dolPopupHide();
  924. });
  925. };
  926. BxTimelineView.prototype.blink = function(oParent)
  927. {
  928. oParent.find('.' + this.sClassBlink + '-plate:visible').animate({
  929. opacity: 0
  930. },
  931. 5000,
  932. function() {
  933. oParent.find('.' + this.sClassBlink).removeClass(this.sClassBlink);
  934. });
  935. };
  936. /*------------------------------------*/
  937. /*--- Internal (protected) methods ---*/
  938. /*------------------------------------*/
  939. BxTimelineView.prototype._getPage = function(oElement, iStart, iPerPage, onLoad)
  940. {
  941. var $this = this;
  942. if(oElement)
  943. this.loadingIn(oElement, true);
  944. this._oRequestParams.start = iStart;
  945. this._oRequestParams.per_page = iPerPage;
  946. this._getPosts(oElement, function(oData) {
  947. if(oElement)
  948. $this.loadingIn(oElement, false);
  949. var sItems = $.trim(oData.items);
  950. if($this.bViewTimeline)
  951. $this.oView.find('.' + $this.sClassItems).append($(sItems).hide()).find('.' + $this.sClassItem + ':hidden').bx_anim('show', $this._sAnimationEffect, $this._iAnimationSpeed, function() {
  952. $(this).bxProcessHtml();
  953. //-- Check content to show 'See More'
  954. $this.initSeeMore($(this), false);
  955. //-- Init Flickity
  956. $this.initFlickity($this.oView);
  957. //--- Init Video Autoplay
  958. $this.initVideosAutoplay($this.oView);
  959. });
  960. if($this.bViewOutline)
  961. $this.appendMasonry($(sItems).bxProcessHtml(), function(oItems) {
  962. //-- Check content to show 'See More'
  963. $this.initSeeMore(oItems, false);
  964. //-- Init Flickity
  965. $this.initFlickity($this.oView);
  966. //--- Init Video Layout
  967. if($this._sVideosAutoplay != 'off')
  968. $this.initVideos($this.oView);
  969. });
  970. if(oData && oData.load_more != undefined) {
  971. $this.oView.find('.' + $this.sSP + '-load-more-holder').html($.trim(oData.load_more));
  972. $this.initCalendar();
  973. }
  974. if(oData && oData.back != undefined)
  975. $this.oView.find('.' + $this.sSP + '-back-holder').html($.trim(oData.back));
  976. if(oData && oData.empty != undefined && !$this.oView.find('.' + $this.sClassItem).length)
  977. $this.oView.find('.' + $this.sSP + '-empty-holder').html($.trim(oData.empty));
  978. if(typeof onLoad == 'function')
  979. onLoad(oData);
  980. });
  981. };
  982. BxTimelineView.prototype._getPosts = function(oElement, onComplete)
  983. {
  984. var $this = this;
  985. var oData = this._getDefaultData(oElement);
  986. jQuery.get(
  987. this._sActionsUrl + 'get_posts/',
  988. oData,
  989. function(oData) {
  990. if(typeof onComplete === 'function')
  991. return onComplete(oData);
  992. if(oElement)
  993. $this.loadingInBlock(oElement, false);
  994. processJsonData(oData);
  995. },
  996. 'json'
  997. );
  998. };
  999. BxTimelineView.prototype._onGetPosts = function(oData)
  1000. {
  1001. var $this = this;
  1002. var onComplete = function() {
  1003. if(oData && oData.go_to != undefined)
  1004. location.hash = oData.go_to;
  1005. if(oData && oData.load_more != undefined) {
  1006. $this.oView.find('.' + $this.sSP + '-load-more-holder').html($.trim(oData.load_more));
  1007. $this.initCalendar();
  1008. }
  1009. if(oData && oData.back != undefined)
  1010. $this.oView.find('.' + $this.sSP + '-back-holder').html($.trim(oData.back));
  1011. if(oData && oData.empty != undefined)
  1012. $this.oView.find('.' + $this.sSP + '-empty-holder').html($.trim(oData.empty));
  1013. };
  1014. if(oData && oData.items != undefined) {
  1015. var sItems = $.trim(oData.items);
  1016. if(this.bViewTimeline) {
  1017. var oItems = this.oView.find('.' + this.sClassItems);
  1018. oItems.html(sItems).bxProcessHtml();
  1019. this.blink(oItems);
  1020. this.initFlickity(this.oView);
  1021. onComplete();
  1022. return;
  1023. }
  1024. if(this.bViewOutline) {
  1025. oItems = this.oView.find('.' + this.sClassItems);
  1026. oItems.html(sItems).bxProcessHtml();
  1027. if(this.isMasonry())
  1028. this.destroyMasonry();
  1029. if(!this.isMasonryEmpty())
  1030. this.initMasonry();
  1031. this.blink(oItems);
  1032. this.initFlickity(this.oView);
  1033. onComplete();
  1034. return;
  1035. }
  1036. }
  1037. };
  1038. BxTimelineView.prototype._onGetPost = function(oData)
  1039. {
  1040. if(!$.trim(oData.item).length)
  1041. return;
  1042. var $this = this;
  1043. var sItem = this._getHtmlId('item', this._oRequestParams, {whole:false}) + oData.id;
  1044. this.oView.find(sItem).replaceWith($(oData.item).bxProcessHtml());
  1045. this.oView.find(sItem).find('.bx-tl-item-text .bx-tl-content').bxCheckOverflowHeight(this.sSP + '-overflow', function(oElement) {
  1046. $this.onFindOverflow(oElement);
  1047. });
  1048. this.initFlickity(this.oView);
  1049. };
  1050. BxTimelineView.prototype._markPost = function(oLink, iId, iWay, sAction)
  1051. {
  1052. var oData = this._getDefaultData();
  1053. oData['id'] = iId;
  1054. $(oLink).parents('.bx-popup-applied:first:visible').dolPopupHide({
  1055. onHide: function(oPopup) {
  1056. $(oPopup).remove();
  1057. }
  1058. });
  1059. this.loadingInItem($(this._getHtmlId('item', this._oRequestParams, {whole:false}) + iId), true);
  1060. $.post(
  1061. this._sActionsUrl + sAction + '/',
  1062. oData,
  1063. function(oData) {
  1064. processJsonData(oData);
  1065. },
  1066. 'json'
  1067. );
  1068. };
  1069. BxTimelineView.prototype._onMarkPost = function(oData, sAction)
  1070. {
  1071. var $this = this;
  1072. var sItem = this._getHtmlId('item', this._oRequestParams, {whole:false}) + oData.id;
  1073. this._oRequestParams.start = 0;
  1074. //--- Mark on Timeline (if available)
  1075. if(this.bViewTimeline)
  1076. this._getPosts(this.oView, function(oData) {
  1077. $(sItem).bx_anim('hide', $this._sAnimationEffect, $this._iAnimationSpeed, function() {
  1078. $(this).remove();
  1079. processJsonData(oData);
  1080. });
  1081. });
  1082. //--- Mark on Outline (if available)
  1083. if(this.bViewOutline)
  1084. this._getPosts(this.oView, function(oData) {
  1085. $this.removeMasonry(sItem, function() {
  1086. processJsonData(oData);
  1087. });
  1088. });
  1089. };