Файл: static/js/custom/daily.js
Строк: 88
<?php
var n=0;var max_n=0;var e=10;$("#page_daily").on("click","#delete",function(){$.get("/modules/daily_category_delete/?id="+category,function(){load_categories(true)})});$("#page_daily").on("taphold","#categories li",function(){if((!$("#page_daily").attr("data-auth")&&$("#categories").attr("data-user")!=$("#page_daily").attr("data-user"))||!$("#page_daily").attr("data-admin")){return}category=$(this).attr("data-id");$("#page_daily #popup").popup("open",{positionTo:"window",transition:"flip"})});$("#page_daily").bind("pageshow",function(){e=parseInt($("#daily_last").attr("data-e"));load_notes(n,true);load_categories(true)});$("#page_daily").bind("pagehide",function(){$("#page_daily").remove()});$("#page_daily").on("click","#next",next_page);$("#page_daily").on("click","#back",back_page);$("#page_daily").on("swipeleft","#daily_last",back_page);$("#page_daily").on("swiperight","#daily_last",next_page);function load_categories(a){if($("#page_daily").attr("data-auth")==0&&$("#categories").attr("data-user")!=$("#page_daily").attr("data-auth")){return}if(a){$.mobile.showPageLoadingMsg()}$.getJSON("/modules/daily_category_get/?user="+$("#categories").attr("data-user"),function(c){if(c=="false"){if(a){$.mobile.hidePageLoadingMsg()}return}var b="";b+='<ul data-role="listview" data-inset="true"><li data-role="list-divider">Категории</li>';$.each(c,function(d,f){b+='<li data-icon="false" data-id="'+f.id+'"><a href="/daily_category/?category='+f.id+"&user="+f.user+'"><h3>'+f.name+"</h3>";if(f.about!=""){b+="<p>"+f.about+"</p>"}b+='<span class="ui-li-count">'+f.count+"</span></a></li>"});b+="</ul>";$("#categories").html(b).trigger("create").trigger("refresh");if(a){$.mobile.hidePageLoadingMsg()}})}function load_notes(b,a){if(a){$.mobile.showPageLoadingMsg()}$.getJSON("/modules/daily_last/?user="+$("#daily_last").attr("data-user")+"&n="+b,function(d){var c="";$.each(d,function(f,g){if(f==0){c+='<ul data-role="listview" id="daily_list" data-inset="true" data-max="'+g+'"><li data-role="list-divider">Записи</li>';max_n=g}else{c+='<li data-id="'+g.id+'" data-icon="false"><a href="'+g.url+'"><img id="user_avatar" data-user="'+g.user+'" class="image-radius" style="opacity: 1.0" src="/modules/get_avatar/?id='+g.user+'&size=2" alt=""><h3 style="font-size: 14px">'+g.topic+"</h3><p>"+g.text+'</p><p class="ui-li-aside">'+g.date+"</p></a></li>"}});if(max_n==0){c+="<li>Записей нет.</li>"}c+="</ul>";$("#daily_last").html(c).trigger("create").trigger("refresh");update_navigation();if(a){$.mobile.hidePageLoadingMsg()}})}function next_page(){if((n-e)<0){return}n=n-e;load_notes(n,true)}function back_page(){if((n+e)>=max_n){return}n=parseInt(n+e);load_notes(n,true)};
?>