Skip to content

Instantly share code, notes, and snippets.

@agusibrahim
Last active December 14, 2024 15:46
Show Gist options
  • Save agusibrahim/6c3ab64f23a8d235d8dbdfd950df7bd8 to your computer and use it in GitHub Desktop.
Save agusibrahim/6c3ab64f23a8d235d8dbdfd950df7bd8 to your computer and use it in GitHub Desktop.
fetch ayah block from https://quran.ksu.edu.sa/ for block/highlighting ayah
function drawHilites2(i,t,e){i||(i=currPage),hilites[currMosshaf]||(hilites[currMosshaf]={}),hilites[currMosshaf][i]?hilitePage2(i,t,e):jxr.hilites=$.get(url_interface+"&do=hilites&mosshaf="+currMosshaf+"&t=28&page="+i,function(h){for(var l in h[i]);hilites[currMosshaf][i]=h[i],hilitePage2(i,t,e)},"json")}function hilitePage2(i,t,e){var h,l,f,o,a,s,g,r,n,m,p,_,d,c,u,v,w,P,b=hilites[currMosshaf][i];if(i%2)var y="img_right_cont";else var y="img_left_cont";var z=$("#"+y).offset().top,j=$("#"+y).offset().left;P="hilite",u=_hlMeta[currMosshaf].height,g=_hlMeta[currMosshaf].mgwidth,r=_hlMeta[currMosshaf].twidth,n=_hlMeta[currMosshaf].ofwidth,m=_hlMeta[currMosshaf].ofheight,p=_hlMeta[currMosshaf].fasel_sura,_=_hlMeta[currMosshaf].page_top,d=_hlMeta[currMosshaf].page_sura_top,t&&(P="hilite_memorize",u=_hlMeta[currMosshaf].mem_height,m=_hlMeta[currMosshaf].mem_ofheight),(1==i||2==i)&&(u=_hlMeta[currMosshaf].fp_height,g=_hlMeta[currMosshaf].fp_mgwidth,r=_hlMeta[currMosshaf].fp_twidth,n=_hlMeta[currMosshaf].fp_ofwidth,m=_hlMeta[currMosshaf].fp_ofheight),a=null,s=null;var C=1;for(var H in b)f=b[(h=H.split("_")[0])+"_"+(l=H.split("_")[1])][1]-m,o=b[h+"_"+l][0]-n,c=0,w=h+"_"+l+"__hilite_1",1==C?(s=r,a=1==i||2==i?270:1==l?d:_):1==l&&(a+=p,s=r),(v=f-a)>1.6*u?(e(h+"_"+l+"__hilite_1",a,g,s-g,u,z,j,y,P),e(h+"_"+l+"__hilite_2",f,o,r-o,u,z,j,y,P),e(h+"_"+l+"__hilite_3",a+u,g,r-g,v-u,z,j,y,P)):v>.6*u?(e(h+"_"+l+"__hilite_1",a,g,s-g,u,z,j,y,P),e(h+"_"+l+"__hilite_2",f,o,r-o,u,z,j,y,P)):(c=s-o,e(w,f,o,c,u,z,j,y,P)),C++,a=f,s=o;if(t){$(".hiliter.copy").addClass("memorize"),memorize_hiliteAya(memorize_currAya),$(".img_cont").css("visibility","visible");return}setTimeout(function(){hiliteCurrAya()},200)}
var data = []
for (let index = 1; index < 605; index++) {
drawHilites2(index,false,(id , top , left , width , height , b_top , b_left , img_id , hilite_id)=>{
_ = id.split("_")
data.push({
"ayah": parseInt(_[1]),
"surah": parseInt(_[0]),
"w": width,
"h": height,
"t": top,
"p": index,
"l": left
})
if (data.length == 13528) {
document.body.outerText=JSON.stringify(data)
}
})
}
//https://zapp.run/edit/flutter-zyla06ihzlb0?entry=lib/main.dart&file=lib/main.dart
//.
//..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment