Вход Регистрация
Файл: static/js/custom/files.js
Строк: 138
<?php
var n=0;var max_n=0;var e=10;$("#page_files").on("click","#delete",function(){$.get("/modules/files_category_delete/?id="+category_tap,function(){load_files(n,true);load_categories(true)})});$("#page_files").on("click","#categories_list a",function(){category=parseInt($(this).attr("data-id"));n=0;load_files(n,true);load_categories(true);update_buttons()});$("#page_files").on("click","#add_category a",function(){$.mobile.changePage("/files_category_add/?category="+category,{transition:"flip",reloadPage:true})});$("#page_files").on("click","#add_files a",function(){$.mobile.changePage("/files_add/?category="+category,{transition:"flip",reloadPage:true})});$("#page_files").on("click","#files_edit a",function(){$.mobile.changePage("/files_edit/?category="+category,{transition:"flip",reloadPage:true})});$("#page_files").on("click","#category_edit a",function(){$.mobile.changePage("/files_category_add/?id="+category,{transition:"flip",reloadPage:true})});$("#page_files").on("click","#category_back",function(){category=parseInt($("#files_list").attr("data-parent"));n=0;load_files(n,true);load_categories(true);update_buttons()});$("#page_files").on("taphold","#categories li",function(){if($("#page_files").attr("data-admin")==0){return}category_tap=$(this).attr("data-id");$("#page_files #popup").popup("open",{transition:"flip"})});$("#page_files").bind("pageshow",function(){e=parseInt($("#files").attr("data-e"));category=parseInt($("#files").attr("data-category"));n=parseInt($("#files").attr("data-n"));update_buttons();load_files(n,true);load_categories(true)});$("#page_files").bind("pagehide",function(){$("#page_files").remove()});$("#page_files").on("click","#next",next_page);$("#page_files").on("click","#back",back_page);$("#page_files").on("swipeleft","#files",back_page);$("#page_files").on("swiperight","#files",next_page);function load_categories(a){if(a){$.mobile.showPageLoadingMsg()}$.getJSON("/modules/files_category_get/?category="+category,function(c){if(c=="false"){$("#categories").html("").trigger("create").trigger("refresh");if(a){$.mobile.hidePageLoadingMsg()}return}var b="";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-icon="false" data-id="'+f.id+'"><a href="#" data-id="'+f.id+'"><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_files(b,a){if(a){$.mobile.showPageLoadingMsg()}$.getJSON("/modules/files_get/?category="+category+"&n="+b,function(d){var c="";$.each(d,function(f,g){if(f==0){c+='<ul data-role="listview" id="files_list" data-inset="true" data-max="'+g.count+'" data-parent="'+g.parent+'"><li data-role="list-divider">Файлы</li>';max_n=g.count}else{c+='<li data-id="'+g.id+'" data-icon="false"><a href="'+g.url+'"><img class="image-radius" src="'+g.image+'" alt=""><h3 style="font-size: 14px">'+g.name+'</h3><p class="ui-li-aside">'+g.date+"</p></a></li>"}});if(max_n==0){c+="<li>Файлов нет.</li>"}c+="</ul>";$("#files").html(c).trigger("create").trigger("refresh");update_navigation();if(a){$.mobile.hidePageLoadingMsg()}})}function next_page(){if((n-e)<0){return}n=n-e;load_files(n,true)}function back_page(){if((n+e)>=max_n){return}n=parseInt(n+e);load_files(n,true)}function update_buttons(){if(category==0){$("#category_navigation").hide();$("#category_edit").hide();$("#files_edit").hide();$("#add_files").hide()}else{$("#category_navigation").show();$("#category_edit").show();$("#files_edit").show();$("#add_files").show()}};
?>
Онлайн: 1
Реклама