File: /var/www/html/breadsecret.com/wp-content/plugins/lets-live-blog/frontend/js/functions.min.js
/**
* Copyright: Codetipi
* Plugin: Let's Live Blog
* Version: 1.2.1
*/
!function(s){var a={init:function(){this.cacheDom(),this.cacheData(),this.bindEvents(),this.ajaxCheck("init"),this.shareCheck()},cacheDom:function(){this.$doc=s(document),this.$win=s(window),this.$body=s("body"),this.$entry=s(".lets-live-blog-wrap"),this.$hls=s("#lets-live-blog-highlights"),this.$hlsa=this.$hls.find("a"),this.$entryWrap=this.$entry.find(".lets-live-blog-entry-wrap"),this.$entryHl=this.$entry.find(".lets-live-blog-entry-hl-wrap"),this.$pagi=this.$entry.find(".lets-live-blog-pagi"),this.$broadcasting=this.$entry.data("status"),this.higlightTitleLdd=!1,this.hashRun=!1,this.$entryCount="",this.todoList="",this.hash=window.location.hash},cacheData:function(){this.$winWidth=this.$win.width()},bindEvents:function(){this.$win.on("resize",this.resize.bind(this)),this.$hlsa.on("click",this.jumphl),this.$body.on("click",".lets-live-blog-pagi",this.pagi)},shareCheck:function(){0<this.hash.length&&this.hash.includes("live-feed")&&(this.hashRun=s(".lets-live-blog-pagi"),this.hashRun.click())},ajaxCheck:function(t){var i;2==this.$broadcasting&&(i=this,s.ajax({method:"GET",url:letsLiveBlogJs.root_full+"history",data:"pid="+letsLiveBlogJs.data.pid+"×tamp="+(new Date).getTime(),beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",letsLiveBlogJs.nonce)},success:function(e){"init"===t&&(i.$entryCount=e.length,i.ajaxUpdate()),e.length!==i.$entryCount&&(i.todoList=e.slice(-(e.length-i.$entryCount)),i.theQueue(),i.$entryCount=e.length)},fail:function(e){console.log("ERROR:",e)}}))},theQueue:function(){var e=this.todoList.shift();void 0!==e&&("add"===e[0]?this.ajaxAdd({item:e[1],hl:e[3]}):"del"===e[0]?this.ajaxRemove(e[1]):this.ajaxUpdates(e))},ajaxAdd:function(i){var n=this;s.ajax({method:"GET",url:letsLiveBlogJs.root_full+"entry",data:{add:i.item},beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",letsLiveBlogJs.nonce)},success:function(e){var t;void 0===i.pos?(n.$entryWrap.prepend(e[0].rendered),!1!==i.hl&&(n.checkHlTitle(),n.$entryHl.prepend(e[0].renderedHl))):(n.$entryWrap.children(":eq("+i.pos+")").attr("id",i.item).replaceWith(e[0].rendered),t=s("#live-feed-hl-"+i.oldItem),!1!==i.hl?(n.checkHlTitle(),0<t.length?t.replaceWith(e[0].renderedHl):n.$entryHl.prepend(e[0].renderedHl)):void 0!==i.oldItem&&t.remove()),n.theQueue()},fail:function(e){console.log("ERROR:",e)}})},jumphl:function(e){e.preventDefault();e=s(this).attr("href");a.hash=e,void 0===s(e)[0]?(a.hashRun=s(".lets-live-blog-pagi"),a.$pagi.trigger("click")):s(e)[0].scrollIntoView({block:"start",behavior:"smooth"})},pagi:function(e){e.preventDefault();var i=s(this),e=i.data(),n=new Date(e.start).getTime();s.ajax({method:"GET",url:letsLiveBlogJs.root_full+"pagi",data:{data:e},beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",letsLiveBlogJs.nonce)},success:function(e){var t=!1;new Date(e[e.length-1].data.comment_date).getTime()<=n&&(i.parent().addClass("lets-live-blog-end"),t=!0),s.each(e,function(){a.$entryWrap.append(this.rendered)}),!1!==a.hashRun&&(0===s(a.hash).length?a.hashRun.click():(s(a.hash)[0].scrollIntoView({block:"start"}),a.hashFinish=!0)),i.data("date",e[e.length-1].data.comment_date),!0===t&&(a.hashRun=!1)},fail:function(e){console.log("ERROR:",e)}})},checkHlTitle:function(){!0!==this.higlightTitleLdd&&(this.$entryHl.prev().hasClass("box-pre-title")||this.$entryHl.before('<div class="box-pre-title">'+letsLiveBlogJs.data.i18n.jumphl+"</div>"),this.higlightTitleLdd=!0)},ajaxUpdates:function(e){this.ajaxAdd({item:e[1],pos:e[2],hl:e[3],oldItem:e[4]})},ajaxRemove:function(e){s("#live-feed-"+e).remove(),s("#live-feed-hl-"+e).remove(),this.theQueue()},ajaxUpdate:function(){var e=this;setInterval(function(){e.ajaxCheck()},letsLiveBlogJs.data.timeInterval)},resize:function(e,t){this.cacheData()}};a.init()}(jQuery);