<!doctype html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>使用plugins简化插件加载的demo</title>
    <script src="http://a.tbcdn.cn/s/kissy/1.3.0/kissy-min.js" charset="utf-8"></script>

</head>
<body>
<h2>使用plugins简化插件加载的demo</h2>
<p>只需要use('gallery/uploader/1.4/plugins/plugins')</p>
<div class="grid">
    <input type="file" class="g-u" id="J_UploaderBtn" value="上传图片" name="Filedata" >
    <input type="hidden" id="J_Urls" name="urls" value="" />
    <div class="g-u">还可以上传<span id="J_UploadCount">3</span>张图片</div>
</div>
<ul id="J_UploaderQueue" class="grid"></ul>
<script>
    var S = KISSY;
    if(S.Config.debug){
        var srcPath = "../../../../";
        S.config({
            packages:[
                {
                    name:"gallery",
                    path:srcPath,
                    charset:"utf-8"
                }
            ]
        });
    }

    S.use('gallery/uploader/1.4/index,gallery/uploader/1.4/themes/imageUploader/index,gallery/uploader/1.4/themes/imageUploader/style.css', function (S, Uploader,ImageUploader) {
        S.use('gallery/uploader/1.4/plugins/plugins',function(S,plugins){
            var uploader = new Uploader('#J_UploaderBtn',{
                //处理上传的服务器端脚本路径
                action:"http://aop.daily.taobao.net/json/uploadImg.htm",
                multiple:true
            });
            //使用主题
            uploader.theme(new ImageUploader({
                queueTarget:'#J_UploaderQueue'
            }));
            //验证插件
            uploader.plug(new plugins.Auth({
                        //最多上传个数
                        max:3,
                        //图片最大允许大小
                        maxSize:2000
                    }))
                    //url保存插件
                    .plug(new plugins.UrlsInput({target:'#J_Urls'}))
                    //进度条集合
                    .plug(new plugins.ProBars())
                    //拖拽上传
                    .plug(new plugins.Filedrop())
                    //图片预览
                    .plug(new plugins.Preview())
            ;
        });
    })

</script>
</body>
</html>