awscdn.detik.net.id Open in urlscan Pro
103.49.221.172  Public Scan

URL: https://awscdn.detik.net.id/assets/js/loadmore.js?v=dd1334ee
Submission: On June 10 via api from US — Scanned from DE

Form analysis 0 forms found in the DOM

Text Content

$.fn.loadMore=function(o){o=o||{};var obj={page:1,url:null,busy:false,el:null,max:null,tag:null,init:function(el)
{var me=this;me.el=el;me.url=me.cleaningUrl(el.attr('href'));me.max=o.max||null;me.tag=el.attr('tag')||null;if(typeof o.mode!='undefined'&&o.mode=='click')
{me.onClick();}else{me.onScroll();}
return this;},onClick:function()
{var me=this;me.el.click(function(){if(me.busy)
return;if(me.max!==null&&me.page>me.max)
return true;me.showTime();return false;});return this;},onScroll:function()
{var me=this,st=0,tt=20,wh=$(window).height();var iScrollPos=0;$(document).scroll(function(e){var iCurScrollPos=$(this).scrollTop();var downScroll=iCurScrollPos>iScrollPos;iScrollPos=iCurScrollPos;if(downScroll)
{st=$(this).scrollTop()+wh;tt=me.el.offset().top-20;if(st<tt||me.busy)
return;if(me.max!==null&&me.page>me.max)
return;me.showTime();}});return this;},cleaningUrl:function(url)
{if(url.substr(url.length-1)!=='/')
{url+='/';}
return url;},showTime:function()
{var me=this;me.busy=true;me.page++;if(typeof o.onLoading!='undefined')
{o.onLoading(me.el);}
var params={};if(typeof o.getParams!='undefined')
{params=o.getParams(me.el);}
var tag=me.tag!==null?'?tag='+me.tag:'',final_url=me.url+me.page+tag;$.each(params,function(key,val){final_url+=(final_url.indexOf('?')>=0?'&':'?')+key+'='+val;});$.getJSON(final_url,function(result)
{if(typeof result.is_last!=='undefined'&&result.is_last===true){o.onReceive(me.el,result);return o.onEnd(me.el);}
if(parseInt(result.status)!==200)
{me.page=me.max+1;if(typeof o.onMax!=='undefined')
{o.onMax(me.el);}
return;}
if(typeof o.onReceive!=='undefined')
{o.onReceive(me.el,result);}
if(me.max!==null&&me.page>me.max&&typeof o.onMax!=='undefined')
{o.onMax(me.el);}}).fail(function(){me.page--;}).always(function(){me.busy=false;if(typeof o.onFinish!=='undefined')
{o.onFinish(me.el);}});return this;}}
return this.each(function(){obj.init($(this));});}
$(function(){$('.loading[href]').each(function(){var _this=$(this),maximum=typeof _this.attr('max')==='undefined'?1:(_this.attr('max')==='nil'?1000:parseInt(_this.attr('max')));if(typeof _this.attr('d:extend')!='undefined'&&(typeof _this.attr('d:mode')!='undefined'&&typeof _this.attr('d:mode')=='scroll'))
{_this.attr('style','visibility: hidden;');}
_this.loadMore({max:maximum,mode:typeof _this.attr('d:mode')!='undefined'?_this.attr('d:mode'):'scroll',current:0,getParams:function(el)
{var params={};if(typeof lt!=='undefined')
{params.lt=lt;}
return params;},onLoading:function(el)
{if(typeof el.attr('d:before')!='undefined')
{el.parent().find(' > .spinner').removeClass('hide-element');el.hide();}
if(typeof el.attr('d:extend-class-spinner')!='undefined')
{$('body').find('.'+el.attr('d:extend-class-spinner')).removeClass('hide-element');el.hide();}},onReceive:function(el,result)
{el.parent().find(' > .spinner').addClass('hide-element');if(typeof result.lastdate!=='undefined')
{lt=result.lastdate;}
if($('[target-item]').length>0)
{$('[target-item]').append(result.content);return;}
if(typeof el.attr('d:target')!='undefined')
{el.show();$(el.attr('d:target')).append(result.content);return;}
if(typeof el.attr('d:before')!='undefined')
{el.show();el.closest(el.attr('d:before')).before(result.content);return;}
el.before(result.content);},onFinish:function(el){this.current++;try{$(".lqd:not(.imgLiquid_ready)").imgLiquid();}catch(e){}
$('.share_content a:not([ready])').attr({ready:true}).click(function(){shareBox.regShare(this);return false;});if(typeof modal_zoom!=='undefined')
{modal_zoom();}
if(this.current==1)
{}else if(this.current==2)
{}
$(document.body).trigger("sticky_kit:recalc");},onEnd:function(el){el.parent().find(' > .spinner').remove();el.remove();return;},onMax:function(el){if(typeof el.attr('d:pt_indeks')!='undefined')
{this.appendPt(el);}
if(typeof el.attr('d:before')!='undefined')
{if(typeof el.attr('d:url')!='undefined')
{el.attr({href:el.attr('d:url')});}
if(typeof el.attr('d:finish')!='undefined')
{el.html(el.attr('d:finish'));}
el.parent().find(' > .spinner').remove();return;}
el.parent().find(' > .more').removeClass('hide-element');if(typeof _this.attr('d:extend')==='undefined')
{el.remove();}
else
{if(typeof el.attr('d:url')!='undefined')
{el.attr({href:el.attr('d:url')});}
if(typeof el.attr('d:finish')!='undefined')
{el.removeAttr('style');el.html(el.attr('d:finish'));}
$('body').find('.'+el.attr('d:extend-class-spinner')).remove();el.removeAttr('d:extend-class-spinner');}},appendPt:function(el){el.attr('onclick','_pt(this, '+el.attr('d:pt_indeks')+')');el.removeAttr('d:pt_indeks');}});});});