Вход Регистрация
Файл: static/js/custom/photos_add.js
Строк: 68
<?php
var count=0;var max_files=50;var error_add=false;var uploader=new plupload.Uploader({runtimes:"html5,html4",browse_button:"pickfiles",container:"container",url:"/modules/photos_add/?category="+$("#filelist").attr("data-category"),filters:[{title:"Image files",extensions:"jpg,gif,png,jpeg"}],resize:{width:1024,height:1024,quality:90}});$("#page_photos_add").bind("pageshow",function(){uploader.bind("Init",function(a,b){});$("#uploadfiles").click(function(a){uploader.start();a.preventDefault()});uploader.init();uploader.bind("FilesAdded",function(a,c){if(count==0){$("#filelist").html("").trigger("create").trigger("refresh")}var d="";var b=0;$.each(c,function(){b++});$.each(c,function(f,e){if(count+1>max_files){a.removeFile(e);error_add=true}else{if(count==0){d+='<ul data-role="listview" data-inset="true" id="files"><li data-role="list-divider">Файлы</li>'}d+='<li id="'+e.id+'"><h3>'+e.name+"</h3><p>"+plupload.formatSize(e.size)+'</p> <span class="ui-li-count">0%</span></li>';if(b-1==f){d+="</ul>"}count++}});if(error_add){alert_message("Нельзя добавлять более "+max_files+" "+word(max_files,"файла","файлов","файлов")+".","information",3)}div_text=$("#filelist").html().replace("</ul>","")+d;$("#filelist").html(div_text).trigger("create").trigger("refresh");a.refresh()});uploader.bind("UploadProgress",function(a,b){$("#"+b.id+" span").html(b.percent+"%")});uploader.bind("FileUploaded",function(a,c,b){b=jQuery.parseJSON(b.response);if(b.error.code>0){$("#"+c.id+" p").html(b.error.message)}$("#"+c.id+" span").html("100%")})});uploader.bind("UploadComplete",function(a,b){alert_message("Загрузка завершена.","information",3)});$("#page_photos_add").bind("pagehide",function(){$("#page_photos_add").remove()});$("#page_photos_add").on("click","#clean",function(){clean_files()});function clean_files(){uploader.splice();count=0;error_add=false;$("#filelist").html("").trigger("create").trigger("refresh")};
?>
Онлайн: 0
Реклама