Файл: static/js/custom/news_category.js
Строк: 67
<?php
var n=0;var max_n=0;var e=10;$("#page_news_category").bind("pageshow",function(){e=parseInt($("#news").attr("data-e"));load_news(0,true)});$("#page_news_category").bind("pagehide",function(){$("#page_news_category").remove()});$("#page_news_category #next").on("click",next_page);$("#page_news_category #back").on("click",back_page);$("#page_news_category").on("swipeleft","#news",back_page);$("#page_news_category").on("swiperight","#news",next_page);function load_news(b,a){if(a){$.mobile.showPageLoadingMsg()}$.getJSON("/modules/get_news/?category="+$("#news").attr("data-category")+"&n="+b+"&hide=0",function(d){var c="";$.each(d,function(f,g){if(f==0){c+='<ul data-role="listview" id="news_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>";$("#news").html(c).trigger("create").trigger("refresh");update_navigation();if(a){$.mobile.hidePageLoadingMsg()}})}function next_page(){if((n-e)<0){return}n=n-e;load_news(n,true)}function back_page(){if((n+e)>=max_n){return}n=n+e;load_news(n,true)};
?>