Файл: static/js/custom/forum.js
Строк: 82
<?php
var n=0;var max_n=0;var e=10;$("#page_forum").on("click","#delete",function(){$.get("/modules/forum_category_delete/?id="+category,function(){load_categories(true)})});$("#page_forum").on("taphold","#categories_list li",function(){if($("#page_forum").attr("data-admin")==0){return}category=$(this).attr("data-id");$("#page_forum #popup").popup("open",{positionTo:"window",transition:"flip"})});$("#page_forum").bind("pageshow",function(){e=parseInt($("#themes").attr("data-e"));load_categories(true);load_themes(0,true)});$("#page_forum").bind("pagehide",function(){$("#page_forum").remove()});function load_categories(a){if(a){$.mobile.showPageLoadingMsg()}$.getJSON("/modules/forum_category_get/",function(c){if(c=="false"){$("#notes").html('<ul data-role="listview" id="themes_list" data-inset="true"><li data-role="list-divider">Категории</li><li>Категорий нет.</li></ul>').trigger("create").trigger("refresh");if(a){$.mobile.hidePageLoadingMsg()}return}var b='<ul data-role="listview" data-inset="true" id="categories_list"><li data-role="list-divider">Категории</li>';$.each(c,function(d,f){b+='<li data-id="'+f.id+'" data-icon="false"><a href="/forum_category/?id='+f.id+'"><h3 style="font-size: 14px">'+f.name+"</h3><p>"+f.description+'</p><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_themes(b,a){if(a){$.mobile.showPageLoadingMsg()}$.getJSON("/modules/forum_themes_get/?category=0&n="+b,function(d){if(d=="false"){$("#themes").html('<ul data-role="listview" id="themes_list" data-inset="true"><li data-role="list-divider">Закладки</li><li>Закладок нет.</li></ul>').trigger("create").trigger("refresh");if(a){$.mobile.hidePageLoadingMsg()}return}var c="";$.each(d,function(f,g){if(f==0){c+='<ul data-role="listview" id="themes_list" data-inset="true"><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.name+"</h3><p>"+g.count+"</p><p>"+g.status+'</p><p class="ui-li-aside">'+g.date+"</p></a></li>"}});c+="</ul>";$("#themes").html(c).trigger("create").trigger("refresh");update_navigation();if(a){$.mobile.hidePageLoadingMsg()}})}function next_page(){if((n-e)<0){return}n=n-e;load_themes(n,true)}function back_page(){if((n+e)>=max_n){return}n=n+e;load_themes(n,true)};
?>