├── .gitignore ├── .jshintrc ├── Gruntfile.coffee ├── Makefile ├── README.md ├── demo ├── bootstrap │ ├── css │ │ ├── bootstrap-theme.css │ │ ├── bootstrap-theme.min.css │ │ ├── bootstrap.css │ │ └── bootstrap.min.css │ ├── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ └── glyphicons-halflings-regular.woff │ └── js │ │ ├── bootstrap.js │ │ └── bootstrap.min.js ├── config.js ├── default.png ├── favicon.ico ├── js │ ├── Respond-1.4.2 │ │ └── respond.min.js │ ├── highlight │ │ ├── highlight.css │ │ └── highlight.js │ ├── html5shiv.js │ ├── jquery-1.9.1.min.js │ ├── jquery.min.map │ ├── main.js │ ├── plupload │ │ ├── Moxie.swf │ │ ├── Moxie.xap │ │ ├── i18n │ │ │ └── zh_CN.js │ │ ├── jquery.plupload.queue │ │ │ ├── css │ │ │ │ └── jquery.plupload.queue.css │ │ │ ├── img │ │ │ │ ├── backgrounds.gif │ │ │ │ ├── buttons-disabled.png │ │ │ │ ├── buttons.png │ │ │ │ ├── delete.gif │ │ │ │ ├── done.gif │ │ │ │ ├── error.gif │ │ │ │ ├── throbber.gif │ │ │ │ └── transp50.png │ │ │ ├── jquery.plupload.queue.js │ │ │ └── jquery.plupload.queue.min.js │ │ ├── jquery.ui.plupload │ │ │ ├── css │ │ │ │ └── jquery.ui.plupload.css │ │ │ ├── img │ │ │ │ ├── loading.gif │ │ │ │ └── plupload.png │ │ │ ├── jquery.ui.plupload.js │ │ │ └── jquery.ui.plupload.min.js │ │ ├── moxie.js │ │ ├── moxie.min.js │ │ ├── plupload.dev.js │ │ ├── plupload.full.min.js │ │ └── plupload.min.js │ └── ui.js ├── loading.gif ├── main.css ├── server.js └── views │ └── index.html ├── package.json └── src ├── qiniu.js └── qiniu.min.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_* 2 | .DS_Store 3 | demo/js/qiniu.js 4 | Gruntfile.js 5 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | /************************************************************* 2 | * JSHint Docs: 3 | * http://www.jshint.com/docs 4 | * 5 | * NOTICE: All of our javascript file should pass check of jsHint. 6 | * 7 | * by MaYiqing 8 | *************************************************************/ 9 | 10 | { 11 | // Global objects 12 | "predef": [ 13 | "Q", // global namespace 14 | "model", // UserViewModel 15 | "ko", // knockout.js 16 | "Highcharts", // highcharts.js 17 | "phpjs", // php.js 18 | "_bucketName" // defined in bucket_box_layout.html 19 | ], 20 | 21 | // Enforcing options 22 | //"quotmark": "single", // always use single quotes 23 | "noarg": true, // forbiden arguments.calle and arguments.caller 24 | "noempty": true, // don't let statements blocks empty 25 | "eqeqeq": true, // always use === to compare 26 | "undef": true, // don't use undefined object 27 | "unused": "vars", // warning when there are some var never use in the file 28 | "curly": true, // always put curly braces around blocks in loops and conditionals 29 | "forin": true, // use hasOwnProperty when use "for(key in obj){}" 30 | "newcap": true, // must capitalize names of constructor functions 31 | 32 | // Relaxing options 33 | "expr": true, // suppresses warnings about the use of expressions where function calls 34 | "boss": true, // suppresses warnings about the use of assignments in cases where comparisons are expected 35 | 36 | // Enviroments 37 | "browser": true, // globals exposed by modern browsers, like document, window, etc. 38 | "devel": true, // globals that are usually used for logging poor-man's debugging: console, alert, etc. 39 | "jquery": true // jquery library 40 | } 41 | -------------------------------------------------------------------------------- /Gruntfile.coffee: -------------------------------------------------------------------------------- 1 | module.exports = (grunt) -> 2 | JS_PATH = 'src/' 3 | JS_FILE = JS_PATH+'qiniu.js' 4 | 5 | grunt.initConfig 6 | jshint: 7 | options: 8 | jshintrc: '.jshintrc' 9 | all: [JS_FILE] 10 | 11 | uglify: 12 | compress: 13 | options: 14 | report: 'min' 15 | files: 16 | 'src/qiniu.min.js' : [JS_FILE] 17 | copy: 18 | main: 19 | expand: true 20 | flatten: true 21 | src: 'src/qiniu.js' 22 | dest: 'demo/js/' 23 | watch: 24 | options: 25 | livereload: true 26 | debounceDelay: 600 27 | js: 28 | files: JS_FILE 29 | tasks: 'jshint' 30 | options: 31 | spawn:false 32 | copy: 33 | files: [JS_FILE] 34 | tasks: 'copy' 35 | uglify: 36 | options: 37 | report: 'min' 38 | files: [JS_FILE] 39 | tasks: 'uglify' 40 | 41 | grunt.loadNpmTasks 'grunt-contrib-watch' 42 | grunt.loadNpmTasks 'grunt-contrib-uglify' 43 | grunt.loadNpmTasks 'grunt-contrib-jshint' 44 | grunt.loadNpmTasks 'grunt-contrib-copy' 45 | 46 | grunt.event.on 'watch', (action, filepath) -> 47 | grunt.config ['jshint', 'all'], filepath 48 | 49 | grunt.registerTask 'production', [ 50 | 'jshint' 51 | 'copy' 52 | 'uglify:compress' 53 | ] 54 | 55 | grunt.registerTask 'default', [ 56 | 'jshint' 57 | 'copy' 58 | 'uglify:compress' 59 | ] 60 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | install : all 2 | 3 | all : 4 | npm install 5 | grunt 6 | node demo/server.js 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | qiniu-js-sdk 2 | ============ 3 | 4 | 基于七牛API及Plupload开发的前端JavaScript SDK 5 | 6 | 示例网站:[七牛JavaScript SDK 示例网站 - 配合七牛nodejs SDK ](http://jssdk.demo.qiniu.io/) 7 | ## 概述 8 | 9 | 本SDK适用于IE8+、Chrome、Firefox、Safari 等浏览器,基于 七牛云存储官方API 构建,其中上传功能基于 Plupload 插件封装。开发者使用本 SDK 可以方便的从浏览器端上传文件至七牛云存储,并对上传成功后的图片进行丰富的数据处理操作。本 SDK 可使开发者忽略上传底层实现细节,而更多的关注 UI 层的展现。 10 | 11 | ### 功能简介 12 | 13 | * 上传 14 | * html5模式大于4M时可分块上传,小于4M时直传 15 | * Flash、html4模式直接上传 16 | * 继承了Plupload的功能,可筛选文件上传、拖曳上传等 17 | * 下载(公开资源) 18 | * 数据处理(图片) 19 | * imageView2(缩略图) 20 | * imageMogr2(高级处理,包含缩放、裁剪、旋转等) 21 | * imageInfo (获取基本信息) 22 | * exif (获取图片EXIF信息) 23 | * watermark (文字、图片水印) 24 | * pipeline (管道,可对imageView2、imageMogr2、watermark进行链式处理) 25 | 26 | ### SDK构成介绍 27 | * Plupload ,建议 2.1.1 及以上版本 28 | * qiniu.js,SDK主体文件,上传功能\数据处理实现 29 | 30 | 31 | ## 安装和运行程序 32 | * 服务端准备 33 | 34 | 本SDK依赖服务端颁发upToken,可以通过以下二种方式实现: 35 | * 利用[七牛服务端SDK](http://developer.qiniu.com/docs/v6/sdk/)构建后端服务 36 | * 利用七牛底层API构建服务,详见七牛[上传策略](http://developer.qiniu.com/docs/v6/api/reference/security/put-policy.html)和[上传凭证](http://developer.qiniu.com/docs/v6/api/reference/security/upload-token.html) 37 | 38 | 39 | 后端服务应提供一个URL地址,供SDK初始化使用,前端通过Ajax请求该地址后获得upToken。Ajax请求成功后,服务端应返回如下格式的json: 40 | 41 | ``` 42 | { 43 | "uptoken": "0MLvWPnyya1WtPnXFy9KLyGHyFPNdZceomL..." 44 | } 45 | ``` 46 | * 引入Plupload 47 | 48 | * [Plupload下载](http://plupload.com/download),建议 2.1.1 及以上版本 49 | 50 | * 引入`plupload.full.min.js`(产品环境)或 引入`plupload.dev.js`和`moxie.js`(开发调试) 51 | 52 | * 引入qiniu.js 53 | * 获取SDK源码 `git clone git@github.com:qiniupd/qiniu-js-sdk.git`,`qiniu.js`位于`src`目录内 54 | 55 | * 初始化上传 56 | 57 | ```javascript 58 | 59 | var uploader = Qiniu.uploader({ 60 | runtimes: 'html5,flash,html4', //上传模式,依次退化 61 | browse_button: 'pickfiles', //上传选择的点选按钮,**必需** 62 | uptoken_url: '/uptoken', //Ajax请求upToken的Url,**强烈建议设置**(服务端提供) 63 | // downtoken_url: '/downtoken', 64 | // Ajax请求downToken的Url,私有空间时使用,JS-SDK将向该地址POST文件的key和domain,服务端返回的JSON必须包含`url`字段,`url`值为该文件的下载地址 65 | // uptoken : '', //若未指定uptoken_url,则必须指定 uptoken ,uptoken由其他程序生成 66 | // unique_names: true, // 默认 false,key为文件名。若开启该选项,SDK会为每个文件自动生成key(文件名) 67 | // save_key: true, // 默认 false。若在服务端生成uptoken的上传策略中指定了 `sava_key`,则开启,SDK在前端将不对key进行任何处理 68 | domain: 'http://qiniu-plupload.qiniudn.com/', //bucket 域名,下载资源时用到,**必需** 69 | container: 'container', //上传区域DOM ID,默认是browser_button的父元素, 70 | max_file_size: '100mb', //最大文件体积限制 71 | flash_swf_url: 'js/plupload/Moxie.swf', //引入flash,相对路径 72 | max_retries: 3, //上传失败最大重试次数 73 | dragdrop: true, //开启可拖曳上传 74 | drop_element: 'container', //拖曳上传区域元素的ID,拖曳文件或文件夹后可触发上传 75 | chunk_size: '4mb', //分块上传时,每片的体积 76 | auto_start: true, //选择文件后自动上传,若关闭需要自己绑定事件触发上传, 77 | //x_vals : { 78 | // 自定义变量,参考http://developer.qiniu.com/docs/v6/api/overview/up/response/vars.html 79 | // 'time' : function(up,file) { 80 | // var time = (new Date()).getTime(); 81 | // do something with 'time' 82 | // return time; 83 | // }, 84 | // 'size' : function(up,file) { 85 | // var size = file.size; 86 | // do something with 'size' 87 | // return size; 88 | // } 89 | //}, 90 | init: { 91 | 'FilesAdded': function(up, files) { 92 | plupload.each(files, function(file) { 93 | // 文件添加进队列后,处理相关的事情 94 | }); 95 | }, 96 | 'BeforeUpload': function(up, file) { 97 | // 每个文件上传前,处理相关的事情 98 | }, 99 | 'UploadProgress': function(up, file) { 100 | // 每个文件上传时,处理相关的事情 101 | }, 102 | 'FileUploaded': function(up, file, info) { 103 | // 每个文件上传成功后,处理相关的事情 104 | // 其中 info 是文件上传成功后,服务端返回的json,形式如 105 | // { 106 | // "hash": "Fh8xVqod2MQ1mocfI4S4KpRL6D98", 107 | // "key": "gogopher.jpg" 108 | // } 109 | // 参考http://developer.qiniu.com/docs/v6/api/overview/up/response/simple-response.html 110 | 111 | // var domain = up.getOption('domain'); 112 | // var res = parseJSON(info); 113 | // var sourceLink = domain + res.key; 获取上传成功后的文件的Url 114 | }, 115 | 'Error': function(up, err, errTip) { 116 | //上传出错时,处理相关的事情 117 | }, 118 | 'UploadComplete': function() { 119 | //队列文件处理完毕后,处理相关的事情 120 | }, 121 | 'Key': function(up, file) { 122 | // 若想在前端对每个文件的key进行个性化处理,可以配置该函数 123 | // 该配置必须要在 unique_names: false , save_key: false 时才生效 124 | 125 | var key = ""; 126 | // do something with key here 127 | return key 128 | } 129 | } 130 | }); 131 | 132 | // domain 为七牛空间(bucket)对应的域名,选择某个空间后,可通过"空间设置->基本设置->域名设置"查看获取 133 | 134 | // uploader 为一个plupload对象,继承了所有plupload的方法,参考http://plupload.com/docs 135 | ``` 136 | 137 | * 运行网站,通过点击`pickfiles`元素,选择文件后上传 138 | 139 | * 对上传成功的图片进行数据处理 140 | 141 | * watermark(水印) 142 | 143 | ```javascript 144 | 145 | // key 为每个文件上传成功后,服务端返回的json字段,即资源的最终名字,下同 146 | // key 可在每个文件'FileUploaded'事件被触发时获得 147 | 148 | var imgLink = Qiniu.watermark({ 149 | mode: 1, // 图片水印 150 | image: 'http://www.b1.qiniudn.com/images/logo-2.png', // 图片水印的Url,mode = 1 时 **必需** 151 | dissolve: 50, // 透明度,取值范围1-100,非必需,下同 152 | gravity: 'SouthWest', // 水印位置,为以下参数[NorthWest、North、NorthEast、West、Center、East、SouthWest、South、SouthEast]之一 153 | dx: 100, // 横轴边距,单位:像素(px) 154 | dy: 100 // 纵轴边距,单位:像素(px) 155 | }, key); // key 为非必需参数,下同 156 | 157 | // imgLink 可以赋值给 html 的 img 元素的 src 属性,下同 158 | 159 | // 若未指定key,可以通过以下方式获得完整的 imgLink,下同 160 | // imgLink = '/?' + imgLink 161 | // 为七牛空间(bucket)对应的域名,选择某个空间后,可通过"空间设置->基本设置->域名设置"查看获取 162 | 163 | ``` 164 | 165 | 或 166 | 167 | ```javascript 168 | 169 | var imgLink = Qiniu.watermark({ 170 | mode: 2, // 文字水印 171 | text: 'hello world !', // 水印文字,mode = 2 时 **必需** 172 | dissolve: 50, // 透明度,取值范围1-100,非必需,下同 173 | gravity: 'SouthWest', // 水印位置,同上 174 | fontsize: 500, // 字体大小,单位: 缇 175 | font : '黑体', // 水印文字字体 176 | dx: 100, // 横轴边距,单位:像素(px) 177 | dy: 100, // 纵轴边距,单位:像素(px) 178 | fill: '#FFF000' // 水印文字颜色,RGB格式,可以是颜色名称 179 | }, key); 180 | 181 | ``` 182 | 具体水印参数解释见[水印(watermark)](http://developer.qiniu.com/docs/v6/api/reference/fop/image/watermark.html) 183 | * imageView2 184 | 185 | ```javascript 186 | 187 | var imgLink = Qiniu.imageView2({ 188 | mode: 3, // 缩略模式,共6种[0-5] 189 | w: 100, // 具体含义由缩略模式决定 190 | h: 100, // 具体含义由缩略模式决定 191 | q: 100, // 新图的图像质量,取值范围:1-100 192 | format: 'png' // 新图的输出格式,取值范围:jpg,gif,png,webp等 193 | }, key); 194 | 195 | ``` 196 | 具体缩略参数解释见[图片处理(imageView2)](http://developer.qiniu.com/docs/v6/api/reference/fop/image/imageview2.html) 197 | * imageMogr2 198 | 199 | ```javascript 200 | 201 | var imgLink = Qiniu.imageMogr2({ 202 | auto-orient: true, // 布尔值,是否根据原图EXIF信息自动旋正,便于后续处理,建议放在首位。 203 | strip: true, // 布尔值,是否去除图片中的元信息 204 | thumbnail: '1000x1000' // 缩放操作参数 205 | crop: '!300x400a10a10', // 裁剪操作参数 206 | gravity: 'NorthWest', // 裁剪锚点参数 207 | quality: 40, // 图片质量,取值范围1-100 208 | rotate: 20, // 旋转角度,取值范围1-360,缺省为不旋转。 209 | format: 'png',// 新图的输出格式,取值范围:jpg,gif,png,webp等 210 | blur:'3x5' // 高斯模糊参数 211 | }, key); 212 | 213 | ``` 214 | 215 | 具体高级图像处理参数解释见[高级图像处理(imageMogr2)](http://developer.qiniu.com/docs/v6/api/reference/fop/image/imagemogr2.html) 216 | * imageInfo 217 | 218 | ```javascript 219 | var imageInfoObj = Qiniu.imageInfo(key); 220 | ``` 221 | 具体 imageInfo 解释见[图片基本信息(imageInfo)](http://developer.qiniu.com/docs/v6/api/reference/fop/image/imageinfo.html) 222 | 223 | Ajax跨域限制,IE系列此函数只支持IE10+ 224 | * exif 225 | 226 | ```javascript 227 | var exifOjb = Qiniu.exif(key); 228 | ``` 229 | 230 | 具体 exif 解释见[图片EXIF信息(exif)](http://developer.qiniu.com/docs/v6/api/reference/fop/image/exif.html) 231 | 232 | Ajax跨域限制,IE系列此函数只支持IE10+ 233 | * pipeline(管道操作) 234 | 235 | ```javascript 236 | 237 | var fopArr = [{ 238 | fop: 'watermark', // 指定watermark操作 239 | mode: 2, // 此参数同watermark函数的参数,下同。 240 | text: 'hello world !', 241 | dissolve: 50, 242 | gravity: 'SouthWest', 243 | fontsize: 500, 244 | font : '黑体', 245 | dx: 100, 246 | dy: 100, 247 | fill: '#FFF000' 248 | },{ 249 | fop: 'imageView2', // 指定imageView2操作 250 | mode: 3, // 此参数同imageView2函数的参数,下同 251 | w: 100, 252 | h: 100, 253 | q: 100, 254 | format: 'png' 255 | },{ 256 | fop: 'imageMogr2', // 指定imageMogr2操作 257 | auto-orient: true, // 此参数同imageMogr2函数的参数,下同。 258 | strip: true, 259 | thumbnail: '1000x1000' 260 | crop: '!300x400a10a10', 261 | gravity: 'NorthWest', 262 | quality: 40, 263 | rotate: 20, 264 | format: 'png', 265 | blur:'3x5' 266 | }]; 267 | 268 | // fopArr 可以为三种类型'watermark'、'imageMogr2'、'imageView2'中的任意1-3个 269 | // 例如只对'watermark'、'imageMogr2'进行管道操作,则如下即可 270 | // var fopArr = [{ 271 | // fop: 'watermark', // 指定watermark操作 272 | // mode: 2, // 此参数同watermark函数的参数,下同。 273 | // text: 'hello world !', 274 | // dissolve: 50, 275 | // gravity: 'SouthWest', 276 | // fontsize: 500, 277 | // font : '黑体', 278 | // dx: 100, 279 | // dy: 100, 280 | // fill: '#FFF000' 281 | // },{ 282 | // fop: 'imageMogr2', // 指定imageMogr2操作 283 | // auto-orient: true, // 此参数同imageMogr2函数的参数,下同。 284 | // strip: true, 285 | // thumbnail: '1000x1000' 286 | // crop: '!300x400a10a10', 287 | // gravity: 'NorthWest', 288 | // quality: 40, 289 | // rotate: 20, 290 | // format: 'png', 291 | // blur:'3x5' 292 | // }]; 293 | 294 | 295 | var imgLink = Qiniu.pipeline(fopArr, key)); 296 | 297 | ``` 298 | 具体管道操作解释见[管道操作](http://developer.qiniu.com/docs/v6/api/overview/fop/pipeline.html) 299 | 300 | ## 运行示例 301 | 302 | 直接运行本SDK示例网站的服务 303 | 304 | * 安装 [Nodejs](http://nodejs.org/download/)、[npm](https://www.npmjs.org/) 305 | 306 | * 获取源代码: 307 | `git clone git@github.com:qiniupd/qiniu-js-sdk.git` 308 | * 进入`demo`目录,修改`config.js`,`Access Key`和`Secret Key` 按如下方式获取 309 | 310 | * [开通七牛开发者帐号](https://portal.qiniu.com/signup) 311 | * [登录七牛开发者自助平台,查看 AccessKey 和 SecretKey](https://portal.qiniu.com/setting/key) 。 312 | 313 | ```javascript 314 | 315 | module.exports = { 316 | 'ACCESS_KEY': '', 317 | 'SECRET_KEY': '', 318 | 'Bucket_Name': '', 319 | 'Port': 18080, 320 | 'Uptoken_Url': '', 321 | 'Domain': '' 322 | } 323 | 324 | ``` 325 | 326 | * 在根目录运行`make`启动 327 | 328 | * 访问`http://127.0.0.1:18080/`或`http://localhost:18080/` 329 | 330 | ## 说明 331 | 332 | 1. 本SDK依赖Plupload,初始化之前请引入Plupload。 333 | 334 | 2. 本SDK依赖uptoken,可以通过提供Ajax请求地址 `uptoken_url` 或者直接设置 `uptoken` 实现,强烈建议前者。 335 | 336 | 3. 如果您想了解更多七牛的上传策略,建议您仔细阅读 [七牛官方文档-上传](http://developer.qiniu.com/docs/v6/api/reference/up/)。 337 | 另外,七牛的上传策略是在后端服务指定的,本SDK的 setOption API 只是设置 Plupload的初始化参数,和上传策略无关。 338 | 339 | 4. 如果您想了解更多七牛的图片处理,建议您仔细阅读 [七牛官方文档-图片处理](http://developer.qiniu.com/docs/v6/api/reference/fop/image/) 340 | 341 | 5. 本SDK示例生成upToken时,指定的`Bucket Name`为公开空间,所以可以公开访问上传成功后的资源。若您生成upToken时,指定的`Bucket Name`为私有空间,那您还需要在服务端进行额外的处理才能访问您上传的资源。具体参见[下载凭证](http://developer.qiniu.com/docs/v6/api/reference/security/download-token.html)。本SDK数据处理部分功能不适用于私有空间。 342 | 343 | ## 贡献代码 344 | 345 | 1. 登录 https://github.com 346 | 347 | 2. Fork git@github.com:qiniupd/qiniu-js-sdk.git 348 | 349 | 3. 创建您的特性分支 (git checkout -b new-feature) 350 | 351 | 4. 提交您的改动 (git commit -am 'Added some features or fixed a bug') 352 | 353 | 5. 将您的改动记录提交到远程 git 仓库 (git push origin new-feature) 354 | 355 | 6. 然后到 github 网站的该 git 远程仓库的 new-feature 分支下发起 Pull Request 356 | 357 | 358 | ## 许可证 359 | 360 | > Copyright (c) 2014 qiniu.com 361 | 362 | ## 基于 GPL V2 协议发布: 363 | 364 | > [www.gnu.org/licenses/gpl-2.0.html](http://www.gnu.org/licenses/gpl-2.0.html) 365 | -------------------------------------------------------------------------------- /demo/bootstrap/css/bootstrap-theme.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap v3.0.3 (http://getbootstrap.com) 3 | * Copyright 2013 Twitter, Inc. 4 | * Licensed under http://www.apache.org/licenses/LICENSE-2.0 5 | */ 6 | 7 | .btn-default, 8 | .btn-primary, 9 | .btn-success, 10 | .btn-info, 11 | .btn-warning, 12 | .btn-danger { 13 | text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2); 14 | -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 1px rgba(0, 0, 0, 0.075); 15 | box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 1px rgba(0, 0, 0, 0.075); 16 | } 17 | 18 | .btn-default:active, 19 | .btn-primary:active, 20 | .btn-success:active, 21 | .btn-info:active, 22 | .btn-warning:active, 23 | .btn-danger:active, 24 | .btn-default.active, 25 | .btn-primary.active, 26 | .btn-success.active, 27 | .btn-info.active, 28 | .btn-warning.active, 29 | .btn-danger.active { 30 | -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); 31 | box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); 32 | } 33 | 34 | .btn:active, 35 | .btn.active { 36 | background-image: none; 37 | } 38 | 39 | .btn-default { 40 | text-shadow: 0 1px 0 #fff; 41 | background-image: -webkit-linear-gradient(top, #ffffff 0%, #e0e0e0 100%); 42 | background-image: linear-gradient(to bottom, #ffffff 0%, #e0e0e0 100%); 43 | background-repeat: repeat-x; 44 | border-color: #dbdbdb; 45 | border-color: #ccc; 46 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0); 47 | filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); 48 | } 49 | 50 | .btn-default:hover, 51 | .btn-default:focus { 52 | background-color: #e0e0e0; 53 | background-position: 0 -15px; 54 | } 55 | 56 | .btn-default:active, 57 | .btn-default.active { 58 | background-color: #e0e0e0; 59 | border-color: #dbdbdb; 60 | } 61 | 62 | .btn-primary { 63 | background-image: -webkit-linear-gradient(top, #428bca 0%, #2d6ca2 100%); 64 | background-image: linear-gradient(to bottom, #428bca 0%, #2d6ca2 100%); 65 | background-repeat: repeat-x; 66 | border-color: #2b669a; 67 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff2d6ca2', GradientType=0); 68 | filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); 69 | } 70 | 71 | .btn-primary:hover, 72 | .btn-primary:focus { 73 | background-color: #2d6ca2; 74 | background-position: 0 -15px; 75 | } 76 | 77 | .btn-primary:active, 78 | .btn-primary.active { 79 | background-color: #2d6ca2; 80 | border-color: #2b669a; 81 | } 82 | 83 | .btn-success { 84 | background-image: -webkit-linear-gradient(top, #5cb85c 0%, #419641 100%); 85 | background-image: linear-gradient(to bottom, #5cb85c 0%, #419641 100%); 86 | background-repeat: repeat-x; 87 | border-color: #3e8f3e; 88 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff419641', GradientType=0); 89 | filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); 90 | } 91 | 92 | .btn-success:hover, 93 | .btn-success:focus { 94 | background-color: #419641; 95 | background-position: 0 -15px; 96 | } 97 | 98 | .btn-success:active, 99 | .btn-success.active { 100 | background-color: #419641; 101 | border-color: #3e8f3e; 102 | } 103 | 104 | .btn-warning { 105 | background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #eb9316 100%); 106 | background-image: linear-gradient(to bottom, #f0ad4e 0%, #eb9316 100%); 107 | background-repeat: repeat-x; 108 | border-color: #e38d13; 109 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffeb9316', GradientType=0); 110 | filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); 111 | } 112 | 113 | .btn-warning:hover, 114 | .btn-warning:focus { 115 | background-color: #eb9316; 116 | background-position: 0 -15px; 117 | } 118 | 119 | .btn-warning:active, 120 | .btn-warning.active { 121 | background-color: #eb9316; 122 | border-color: #e38d13; 123 | } 124 | 125 | .btn-danger { 126 | background-image: -webkit-linear-gradient(top, #d9534f 0%, #c12e2a 100%); 127 | background-image: linear-gradient(to bottom, #d9534f 0%, #c12e2a 100%); 128 | background-repeat: repeat-x; 129 | border-color: #b92c28; 130 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc12e2a', GradientType=0); 131 | filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); 132 | } 133 | 134 | .btn-danger:hover, 135 | .btn-danger:focus { 136 | background-color: #c12e2a; 137 | background-position: 0 -15px; 138 | } 139 | 140 | .btn-danger:active, 141 | .btn-danger.active { 142 | background-color: #c12e2a; 143 | border-color: #b92c28; 144 | } 145 | 146 | .btn-info { 147 | background-image: -webkit-linear-gradient(top, #5bc0de 0%, #2aabd2 100%); 148 | background-image: linear-gradient(to bottom, #5bc0de 0%, #2aabd2 100%); 149 | background-repeat: repeat-x; 150 | border-color: #28a4c9; 151 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2aabd2', GradientType=0); 152 | filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); 153 | } 154 | 155 | .btn-info:hover, 156 | .btn-info:focus { 157 | background-color: #2aabd2; 158 | background-position: 0 -15px; 159 | } 160 | 161 | .btn-info:active, 162 | .btn-info.active { 163 | background-color: #2aabd2; 164 | border-color: #28a4c9; 165 | } 166 | 167 | .thumbnail, 168 | .img-thumbnail { 169 | -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075); 170 | box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075); 171 | } 172 | 173 | .dropdown-menu > li > a:hover, 174 | .dropdown-menu > li > a:focus { 175 | background-color: #e8e8e8; 176 | background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%); 177 | background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%); 178 | background-repeat: repeat-x; 179 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0); 180 | } 181 | 182 | .dropdown-menu > .active > a, 183 | .dropdown-menu > .active > a:hover, 184 | .dropdown-menu > .active > a:focus { 185 | background-color: #357ebd; 186 | background-image: -webkit-linear-gradient(top, #428bca 0%, #357ebd 100%); 187 | background-image: linear-gradient(to bottom, #428bca 0%, #357ebd 100%); 188 | background-repeat: repeat-x; 189 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff357ebd', GradientType=0); 190 | } 191 | 192 | .navbar-default { 193 | background-image: -webkit-linear-gradient(top, #ffffff 0%, #f8f8f8 100%); 194 | background-image: linear-gradient(to bottom, #ffffff 0%, #f8f8f8 100%); 195 | background-repeat: repeat-x; 196 | border-radius: 4px; 197 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0); 198 | filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); 199 | -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 5px rgba(0, 0, 0, 0.075); 200 | box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 5px rgba(0, 0, 0, 0.075); 201 | } 202 | 203 | .navbar-default .navbar-nav > .active > a { 204 | background-image: -webkit-linear-gradient(top, #ebebeb 0%, #f3f3f3 100%); 205 | background-image: linear-gradient(to bottom, #ebebeb 0%, #f3f3f3 100%); 206 | background-repeat: repeat-x; 207 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff3f3f3', GradientType=0); 208 | -webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, 0.075); 209 | box-shadow: inset 0 3px 9px rgba(0, 0, 0, 0.075); 210 | } 211 | 212 | .navbar-brand, 213 | .navbar-nav > li > a { 214 | text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25); 215 | } 216 | 217 | .navbar-inverse { 218 | background-image: -webkit-linear-gradient(top, #3c3c3c 0%, #222222 100%); 219 | background-image: linear-gradient(to bottom, #3c3c3c 0%, #222222 100%); 220 | background-repeat: repeat-x; 221 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0); 222 | filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); 223 | } 224 | 225 | .navbar-inverse .navbar-nav > .active > a { 226 | background-image: -webkit-linear-gradient(top, #222222 0%, #282828 100%); 227 | background-image: linear-gradient(to bottom, #222222 0%, #282828 100%); 228 | background-repeat: repeat-x; 229 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff222222', endColorstr='#ff282828', GradientType=0); 230 | -webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, 0.25); 231 | box-shadow: inset 0 3px 9px rgba(0, 0, 0, 0.25); 232 | } 233 | 234 | .navbar-inverse .navbar-brand, 235 | .navbar-inverse .navbar-nav > li > a { 236 | text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); 237 | } 238 | 239 | .navbar-static-top, 240 | .navbar-fixed-top, 241 | .navbar-fixed-bottom { 242 | border-radius: 0; 243 | } 244 | 245 | .alert { 246 | text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2); 247 | -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05); 248 | box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05); 249 | } 250 | 251 | .alert-success { 252 | background-image: -webkit-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%); 253 | background-image: linear-gradient(to bottom, #dff0d8 0%, #c8e5bc 100%); 254 | background-repeat: repeat-x; 255 | border-color: #b2dba1; 256 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0); 257 | } 258 | 259 | .alert-info { 260 | background-image: -webkit-linear-gradient(top, #d9edf7 0%, #b9def0 100%); 261 | background-image: linear-gradient(to bottom, #d9edf7 0%, #b9def0 100%); 262 | background-repeat: repeat-x; 263 | border-color: #9acfea; 264 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0); 265 | } 266 | 267 | .alert-warning { 268 | background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%); 269 | background-image: linear-gradient(to bottom, #fcf8e3 0%, #f8efc0 100%); 270 | background-repeat: repeat-x; 271 | border-color: #f5e79e; 272 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0); 273 | } 274 | 275 | .alert-danger { 276 | background-image: -webkit-linear-gradient(top, #f2dede 0%, #e7c3c3 100%); 277 | background-image: linear-gradient(to bottom, #f2dede 0%, #e7c3c3 100%); 278 | background-repeat: repeat-x; 279 | border-color: #dca7a7; 280 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0); 281 | } 282 | 283 | .progress { 284 | background-image: -webkit-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%); 285 | background-image: linear-gradient(to bottom, #ebebeb 0%, #f5f5f5 100%); 286 | background-repeat: repeat-x; 287 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0); 288 | } 289 | 290 | .progress-bar { 291 | background-image: -webkit-linear-gradient(top, #428bca 0%, #3071a9 100%); 292 | background-image: linear-gradient(to bottom, #428bca 0%, #3071a9 100%); 293 | background-repeat: repeat-x; 294 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3071a9', GradientType=0); 295 | } 296 | 297 | .progress-bar-success { 298 | background-image: -webkit-linear-gradient(top, #5cb85c 0%, #449d44 100%); 299 | background-image: linear-gradient(to bottom, #5cb85c 0%, #449d44 100%); 300 | background-repeat: repeat-x; 301 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0); 302 | } 303 | 304 | .progress-bar-info { 305 | background-image: -webkit-linear-gradient(top, #5bc0de 0%, #31b0d5 100%); 306 | background-image: linear-gradient(to bottom, #5bc0de 0%, #31b0d5 100%); 307 | background-repeat: repeat-x; 308 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0); 309 | } 310 | 311 | .progress-bar-warning { 312 | background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #ec971f 100%); 313 | background-image: linear-gradient(to bottom, #f0ad4e 0%, #ec971f 100%); 314 | background-repeat: repeat-x; 315 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0); 316 | } 317 | 318 | .progress-bar-danger { 319 | background-image: -webkit-linear-gradient(top, #d9534f 0%, #c9302c 100%); 320 | background-image: linear-gradient(to bottom, #d9534f 0%, #c9302c 100%); 321 | background-repeat: repeat-x; 322 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0); 323 | } 324 | 325 | .list-group { 326 | border-radius: 4px; 327 | -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075); 328 | box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075); 329 | } 330 | 331 | .list-group-item.active, 332 | .list-group-item.active:hover, 333 | .list-group-item.active:focus { 334 | text-shadow: 0 -1px 0 #3071a9; 335 | background-image: -webkit-linear-gradient(top, #428bca 0%, #3278b3 100%); 336 | background-image: linear-gradient(to bottom, #428bca 0%, #3278b3 100%); 337 | background-repeat: repeat-x; 338 | border-color: #3278b3; 339 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3278b3', GradientType=0); 340 | } 341 | 342 | .panel { 343 | -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); 344 | box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); 345 | } 346 | 347 | .panel-default > .panel-heading { 348 | background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%); 349 | background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%); 350 | background-repeat: repeat-x; 351 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0); 352 | } 353 | 354 | .panel-primary > .panel-heading { 355 | background-image: -webkit-linear-gradient(top, #428bca 0%, #357ebd 100%); 356 | background-image: linear-gradient(to bottom, #428bca 0%, #357ebd 100%); 357 | background-repeat: repeat-x; 358 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff357ebd', GradientType=0); 359 | } 360 | 361 | .panel-success > .panel-heading { 362 | background-image: -webkit-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%); 363 | background-image: linear-gradient(to bottom, #dff0d8 0%, #d0e9c6 100%); 364 | background-repeat: repeat-x; 365 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0); 366 | } 367 | 368 | .panel-info > .panel-heading { 369 | background-image: -webkit-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%); 370 | background-image: linear-gradient(to bottom, #d9edf7 0%, #c4e3f3 100%); 371 | background-repeat: repeat-x; 372 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0); 373 | } 374 | 375 | .panel-warning > .panel-heading { 376 | background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%); 377 | background-image: linear-gradient(to bottom, #fcf8e3 0%, #faf2cc 100%); 378 | background-repeat: repeat-x; 379 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0); 380 | } 381 | 382 | .panel-danger > .panel-heading { 383 | background-image: -webkit-linear-gradient(top, #f2dede 0%, #ebcccc 100%); 384 | background-image: linear-gradient(to bottom, #f2dede 0%, #ebcccc 100%); 385 | background-repeat: repeat-x; 386 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0); 387 | } 388 | 389 | .well { 390 | background-image: -webkit-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%); 391 | background-image: linear-gradient(to bottom, #e8e8e8 0%, #f5f5f5 100%); 392 | background-repeat: repeat-x; 393 | border-color: #dcdcdc; 394 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0); 395 | -webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 0 rgba(255, 255, 255, 0.1); 396 | box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 0 rgba(255, 255, 255, 0.1); 397 | } -------------------------------------------------------------------------------- /demo/bootstrap/css/bootstrap-theme.min.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap v3.0.3 (http://getbootstrap.com) 3 | * Copyright 2013 Twitter, Inc. 4 | * Licensed under http://www.apache.org/licenses/LICENSE-2.0 5 | */ 6 | 7 | .btn-default,.btn-primary,.btn-success,.btn-info,.btn-warning,.btn-danger{text-shadow:0 -1px 0 rgba(0,0,0,0.2);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.15),0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 0 rgba(255,255,255,0.15),0 1px 1px rgba(0,0,0,0.075)}.btn-default:active,.btn-primary:active,.btn-success:active,.btn-info:active,.btn-warning:active,.btn-danger:active,.btn-default.active,.btn-primary.active,.btn-success.active,.btn-info.active,.btn-warning.active,.btn-danger.active{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,0.125);box-shadow:inset 0 3px 5px rgba(0,0,0,0.125)}.btn:active,.btn.active{background-image:none}.btn-default{text-shadow:0 1px 0 #fff;background-image:-webkit-linear-gradient(top,#fff 0,#e0e0e0 100%);background-image:linear-gradient(to bottom,#fff 0,#e0e0e0 100%);background-repeat:repeat-x;border-color:#dbdbdb;border-color:#ccc;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#ffe0e0e0',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-default:hover,.btn-default:focus{background-color:#e0e0e0;background-position:0 -15px}.btn-default:active,.btn-default.active{background-color:#e0e0e0;border-color:#dbdbdb}.btn-primary{background-image:-webkit-linear-gradient(top,#428bca 0,#2d6ca2 100%);background-image:linear-gradient(to bottom,#428bca 0,#2d6ca2 100%);background-repeat:repeat-x;border-color:#2b669a;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca',endColorstr='#ff2d6ca2',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-primary:hover,.btn-primary:focus{background-color:#2d6ca2;background-position:0 -15px}.btn-primary:active,.btn-primary.active{background-color:#2d6ca2;border-color:#2b669a}.btn-success{background-image:-webkit-linear-gradient(top,#5cb85c 0,#419641 100%);background-image:linear-gradient(to bottom,#5cb85c 0,#419641 100%);background-repeat:repeat-x;border-color:#3e8f3e;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c',endColorstr='#ff419641',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-success:hover,.btn-success:focus{background-color:#419641;background-position:0 -15px}.btn-success:active,.btn-success.active{background-color:#419641;border-color:#3e8f3e}.btn-warning{background-image:-webkit-linear-gradient(top,#f0ad4e 0,#eb9316 100%);background-image:linear-gradient(to bottom,#f0ad4e 0,#eb9316 100%);background-repeat:repeat-x;border-color:#e38d13;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e',endColorstr='#ffeb9316',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-warning:hover,.btn-warning:focus{background-color:#eb9316;background-position:0 -15px}.btn-warning:active,.btn-warning.active{background-color:#eb9316;border-color:#e38d13}.btn-danger{background-image:-webkit-linear-gradient(top,#d9534f 0,#c12e2a 100%);background-image:linear-gradient(to bottom,#d9534f 0,#c12e2a 100%);background-repeat:repeat-x;border-color:#b92c28;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f',endColorstr='#ffc12e2a',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-danger:hover,.btn-danger:focus{background-color:#c12e2a;background-position:0 -15px}.btn-danger:active,.btn-danger.active{background-color:#c12e2a;border-color:#b92c28}.btn-info{background-image:-webkit-linear-gradient(top,#5bc0de 0,#2aabd2 100%);background-image:linear-gradient(to bottom,#5bc0de 0,#2aabd2 100%);background-repeat:repeat-x;border-color:#28a4c9;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de',endColorstr='#ff2aabd2',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-info:hover,.btn-info:focus{background-color:#2aabd2;background-position:0 -15px}.btn-info:active,.btn-info.active{background-color:#2aabd2;border-color:#28a4c9}.thumbnail,.img-thumbnail{-webkit-box-shadow:0 1px 2px rgba(0,0,0,0.075);box-shadow:0 1px 2px rgba(0,0,0,0.075)}.dropdown-menu>li>a:hover,.dropdown-menu>li>a:focus{background-color:#e8e8e8;background-image:-webkit-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5',endColorstr='#ffe8e8e8',GradientType=0)}.dropdown-menu>.active>a,.dropdown-menu>.active>a:hover,.dropdown-menu>.active>a:focus{background-color:#357ebd;background-image:-webkit-linear-gradient(top,#428bca 0,#357ebd 100%);background-image:linear-gradient(to bottom,#428bca 0,#357ebd 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca',endColorstr='#ff357ebd',GradientType=0)}.navbar-default{background-image:-webkit-linear-gradient(top,#fff 0,#f8f8f8 100%);background-image:linear-gradient(to bottom,#fff 0,#f8f8f8 100%);background-repeat:repeat-x;border-radius:4px;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#fff8f8f8',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.15),0 1px 5px rgba(0,0,0,0.075);box-shadow:inset 0 1px 0 rgba(255,255,255,0.15),0 1px 5px rgba(0,0,0,0.075)}.navbar-default .navbar-nav>.active>a{background-image:-webkit-linear-gradient(top,#ebebeb 0,#f3f3f3 100%);background-image:linear-gradient(to bottom,#ebebeb 0,#f3f3f3 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb',endColorstr='#fff3f3f3',GradientType=0);-webkit-box-shadow:inset 0 3px 9px rgba(0,0,0,0.075);box-shadow:inset 0 3px 9px rgba(0,0,0,0.075)}.navbar-brand,.navbar-nav>li>a{text-shadow:0 1px 0 rgba(255,255,255,0.25)}.navbar-inverse{background-image:-webkit-linear-gradient(top,#3c3c3c 0,#222 100%);background-image:linear-gradient(to bottom,#3c3c3c 0,#222 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c',endColorstr='#ff222222',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.navbar-inverse .navbar-nav>.active>a{background-image:-webkit-linear-gradient(top,#222 0,#282828 100%);background-image:linear-gradient(to bottom,#222 0,#282828 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff222222',endColorstr='#ff282828',GradientType=0);-webkit-box-shadow:inset 0 3px 9px rgba(0,0,0,0.25);box-shadow:inset 0 3px 9px rgba(0,0,0,0.25)}.navbar-inverse .navbar-brand,.navbar-inverse .navbar-nav>li>a{text-shadow:0 -1px 0 rgba(0,0,0,0.25)}.navbar-static-top,.navbar-fixed-top,.navbar-fixed-bottom{border-radius:0}.alert{text-shadow:0 1px 0 rgba(255,255,255,0.2);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.25),0 1px 2px rgba(0,0,0,0.05);box-shadow:inset 0 1px 0 rgba(255,255,255,0.25),0 1px 2px rgba(0,0,0,0.05)}.alert-success{background-image:-webkit-linear-gradient(top,#dff0d8 0,#c8e5bc 100%);background-image:linear-gradient(to bottom,#dff0d8 0,#c8e5bc 100%);background-repeat:repeat-x;border-color:#b2dba1;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8',endColorstr='#ffc8e5bc',GradientType=0)}.alert-info{background-image:-webkit-linear-gradient(top,#d9edf7 0,#b9def0 100%);background-image:linear-gradient(to bottom,#d9edf7 0,#b9def0 100%);background-repeat:repeat-x;border-color:#9acfea;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7',endColorstr='#ffb9def0',GradientType=0)}.alert-warning{background-image:-webkit-linear-gradient(top,#fcf8e3 0,#f8efc0 100%);background-image:linear-gradient(to bottom,#fcf8e3 0,#f8efc0 100%);background-repeat:repeat-x;border-color:#f5e79e;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3',endColorstr='#fff8efc0',GradientType=0)}.alert-danger{background-image:-webkit-linear-gradient(top,#f2dede 0,#e7c3c3 100%);background-image:linear-gradient(to bottom,#f2dede 0,#e7c3c3 100%);background-repeat:repeat-x;border-color:#dca7a7;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede',endColorstr='#ffe7c3c3',GradientType=0)}.progress{background-image:-webkit-linear-gradient(top,#ebebeb 0,#f5f5f5 100%);background-image:linear-gradient(to bottom,#ebebeb 0,#f5f5f5 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb',endColorstr='#fff5f5f5',GradientType=0)}.progress-bar{background-image:-webkit-linear-gradient(top,#428bca 0,#3071a9 100%);background-image:linear-gradient(to bottom,#428bca 0,#3071a9 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca',endColorstr='#ff3071a9',GradientType=0)}.progress-bar-success{background-image:-webkit-linear-gradient(top,#5cb85c 0,#449d44 100%);background-image:linear-gradient(to bottom,#5cb85c 0,#449d44 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c',endColorstr='#ff449d44',GradientType=0)}.progress-bar-info{background-image:-webkit-linear-gradient(top,#5bc0de 0,#31b0d5 100%);background-image:linear-gradient(to bottom,#5bc0de 0,#31b0d5 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de',endColorstr='#ff31b0d5',GradientType=0)}.progress-bar-warning{background-image:-webkit-linear-gradient(top,#f0ad4e 0,#ec971f 100%);background-image:linear-gradient(to bottom,#f0ad4e 0,#ec971f 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e',endColorstr='#ffec971f',GradientType=0)}.progress-bar-danger{background-image:-webkit-linear-gradient(top,#d9534f 0,#c9302c 100%);background-image:linear-gradient(to bottom,#d9534f 0,#c9302c 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f',endColorstr='#ffc9302c',GradientType=0)}.list-group{border-radius:4px;-webkit-box-shadow:0 1px 2px rgba(0,0,0,0.075);box-shadow:0 1px 2px rgba(0,0,0,0.075)}.list-group-item.active,.list-group-item.active:hover,.list-group-item.active:focus{text-shadow:0 -1px 0 #3071a9;background-image:-webkit-linear-gradient(top,#428bca 0,#3278b3 100%);background-image:linear-gradient(to bottom,#428bca 0,#3278b3 100%);background-repeat:repeat-x;border-color:#3278b3;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca',endColorstr='#ff3278b3',GradientType=0)}.panel{-webkit-box-shadow:0 1px 2px rgba(0,0,0,0.05);box-shadow:0 1px 2px rgba(0,0,0,0.05)}.panel-default>.panel-heading{background-image:-webkit-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5',endColorstr='#ffe8e8e8',GradientType=0)}.panel-primary>.panel-heading{background-image:-webkit-linear-gradient(top,#428bca 0,#357ebd 100%);background-image:linear-gradient(to bottom,#428bca 0,#357ebd 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca',endColorstr='#ff357ebd',GradientType=0)}.panel-success>.panel-heading{background-image:-webkit-linear-gradient(top,#dff0d8 0,#d0e9c6 100%);background-image:linear-gradient(to bottom,#dff0d8 0,#d0e9c6 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8',endColorstr='#ffd0e9c6',GradientType=0)}.panel-info>.panel-heading{background-image:-webkit-linear-gradient(top,#d9edf7 0,#c4e3f3 100%);background-image:linear-gradient(to bottom,#d9edf7 0,#c4e3f3 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7',endColorstr='#ffc4e3f3',GradientType=0)}.panel-warning>.panel-heading{background-image:-webkit-linear-gradient(top,#fcf8e3 0,#faf2cc 100%);background-image:linear-gradient(to bottom,#fcf8e3 0,#faf2cc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3',endColorstr='#fffaf2cc',GradientType=0)}.panel-danger>.panel-heading{background-image:-webkit-linear-gradient(top,#f2dede 0,#ebcccc 100%);background-image:linear-gradient(to bottom,#f2dede 0,#ebcccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede',endColorstr='#ffebcccc',GradientType=0)}.well{background-image:-webkit-linear-gradient(top,#e8e8e8 0,#f5f5f5 100%);background-image:linear-gradient(to bottom,#e8e8e8 0,#f5f5f5 100%);background-repeat:repeat-x;border-color:#dcdcdc;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8',endColorstr='#fff5f5f5',GradientType=0);-webkit-box-shadow:inset 0 1px 3px rgba(0,0,0,0.05),0 1px 0 rgba(255,255,255,0.1);box-shadow:inset 0 1px 3px rgba(0,0,0,0.05),0 1px 0 rgba(255,255,255,0.1)} -------------------------------------------------------------------------------- /demo/bootstrap/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bearyinnovative/qiniu-js-sdk/6675d08ed9661f76cae30e8a6b77eee3cf17c88f/demo/bootstrap/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /demo/bootstrap/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bearyinnovative/qiniu-js-sdk/6675d08ed9661f76cae30e8a6b77eee3cf17c88f/demo/bootstrap/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /demo/bootstrap/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bearyinnovative/qiniu-js-sdk/6675d08ed9661f76cae30e8a6b77eee3cf17c88f/demo/bootstrap/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /demo/bootstrap/js/bootstrap.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap v3.0.3 (http://getbootstrap.com) 3 | * Copyright 2013 Twitter, Inc. 4 | * Licensed under http://www.apache.org/licenses/LICENSE-2.0 5 | */ 6 | 7 | if("undefined"==typeof jQuery)throw new Error("Bootstrap requires jQuery");+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]}}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one(a.support.transition.end,function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b()})}(jQuery),+function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype.close=function(b){function c(){f.trigger("closed.bs.alert").remove()}var d=a(this),e=d.attr("data-target");e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,""));var f=a(e);b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one(a.support.transition.end,c).emulateTransitionEnd(150):c())};var d=a.fn.alert;a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("bs.alert");e||d.data("bs.alert",e=new c(this)),"string"==typeof b&&e[b].call(d)})},a.fn.alert.Constructor=c,a.fn.alert.noConflict=function(){return a.fn.alert=d,this},a(document).on("click.bs.alert.data-api",b,c.prototype.close)}(jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d)};b.DEFAULTS={loadingText:"loading..."},b.prototype.setState=function(a){var b="disabled",c=this.$element,d=c.is("input")?"val":"html",e=c.data();a+="Text",e.resetText||c.data("resetText",c[d]()),c[d](e[a]||this.options[a]),setTimeout(function(){"loadingText"==a?c.addClass(b).attr(b,b):c.removeClass(b).removeAttr(b)},0)},b.prototype.toggle=function(){var a=this.$element.closest('[data-toggle="buttons"]'),b=!0;if(a.length){var c=this.$element.find("input");"radio"===c.prop("type")&&(c.prop("checked")&&this.$element.hasClass("active")?b=!1:a.find(".active").removeClass("active")),b&&c.prop("checked",!this.$element.hasClass("active")).trigger("change")}b&&this.$element.toggleClass("active")};var c=a.fn.button;a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof c&&c;e||d.data("bs.button",e=new b(this,f)),"toggle"==c?e.toggle():c&&e.setState(c)})},a.fn.button.Constructor=b,a.fn.button.noConflict=function(){return a.fn.button=c,this},a(document).on("click.bs.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle"),b.preventDefault()})}(jQuery),+function(a){"use strict";var b=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter",a.proxy(this.pause,this)).on("mouseleave",a.proxy(this.cycle,this))};b.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},b.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},b.prototype.getActiveIndex=function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},b.prototype.to=function(b){var c=this,d=this.getActiveIndex();return b>this.$items.length-1||0>b?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(this.$items[b]))},b.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition.end&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},b.prototype.next=function(){return this.sliding?void 0:this.slide("next")},b.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},b.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g="next"==b?"left":"right",h="next"==b?"first":"last",i=this;if(!e.length){if(!this.options.wrap)return;e=this.$element.find(".item")[h]()}this.sliding=!0,f&&this.pause();var j=a.Event("slide.bs.carousel",{relatedTarget:e[0],direction:g});if(!e.hasClass("active")){if(this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid.bs.carousel",function(){var b=a(i.$indicators.children()[i.getActiveIndex()]);b&&b.addClass("active")})),a.support.transition&&this.$element.hasClass("slide")){if(this.$element.trigger(j),j.isDefaultPrevented())return;e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid.bs.carousel")},0)}).emulateTransitionEnd(600)}else{if(this.$element.trigger(j),j.isDefaultPrevented())return;d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid.bs.carousel")}return f&&this.cycle(),this}};var c=a.fn.carousel;a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c),g="string"==typeof c?c:f.slide;e||d.data("bs.carousel",e=new b(this,f)),"number"==typeof c?e.to(c):g?e[g]():f.interval&&e.pause().cycle()})},a.fn.carousel.Constructor=b,a.fn.carousel.noConflict=function(){return a.fn.carousel=c,this},a(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(b){var c,d=a(this),e=a(d.attr("data-target")||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"")),f=a.extend({},e.data(),d.data()),g=d.attr("data-slide-to");g&&(f.interval=!1),e.carousel(f),(g=d.attr("data-slide-to"))&&e.data("bs.carousel").to(g),b.preventDefault()}),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var b=a(this);b.carousel(b.data())})})}(jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.DEFAULTS={toggle:!0},b.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},b.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b=a.Event("show.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.$parent&&this.$parent.find("> .panel > .in");if(c&&c.length){var d=c.data("bs.collapse");if(d&&d.transitioning)return;c.collapse("hide"),d||c.data("bs.collapse",null)}var e=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[e](0),this.transitioning=1;var f=function(){this.$element.removeClass("collapsing").addClass("in")[e]("auto"),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return f.call(this);var g=a.camelCase(["scroll",e].join("-"));this.$element.one(a.support.transition.end,a.proxy(f,this)).emulateTransitionEnd(350)[e](this.$element[0][g])}}},b.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return a.support.transition?(this.$element[c](0).one(a.support.transition.end,a.proxy(d,this)).emulateTransitionEnd(350),void 0):d.call(this)}}},b.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var c=a.fn.collapse;a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c);e||d.data("bs.collapse",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.collapse.Constructor=b,a.fn.collapse.noConflict=function(){return a.fn.collapse=c,this},a(document).on("click.bs.collapse.data-api","[data-toggle=collapse]",function(b){var c,d=a(this),e=d.attr("data-target")||b.preventDefault()||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,""),f=a(e),g=f.data("bs.collapse"),h=g?"toggle":d.data(),i=d.attr("data-parent"),j=i&&a(i);g&&g.transitioning||(j&&j.find('[data-toggle=collapse][data-parent="'+i+'"]').not(d).addClass("collapsed"),d[f.hasClass("in")?"addClass":"removeClass"]("collapsed")),f.collapse(h)})}(jQuery),+function(a){"use strict";function b(){a(d).remove(),a(e).each(function(b){var d=c(a(this));d.hasClass("open")&&(d.trigger(b=a.Event("hide.bs.dropdown")),b.isDefaultPrevented()||d.removeClass("open").trigger("hidden.bs.dropdown"))})}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}var d=".dropdown-backdrop",e="[data-toggle=dropdown]",f=function(b){a(b).on("click.bs.dropdown",this.toggle)};f.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){if("ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a(''}),b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),b.prototype.constructor=b,b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content")[this.options.html?"html":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},b.prototype.hasContent=function(){return this.getTitle()||this.getContent()},b.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},b.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var c=a.fn.popover;a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof c&&c;e||d.data("bs.popover",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.popover.Constructor=b,a.fn.popover.noConflict=function(){return a.fn.popover=c,this}}(jQuery),+function(a){"use strict";function b(c,d){var e,f=a.proxy(this.process,this);this.$element=a(c).is("body")?a(window):a(c),this.$body=a("body"),this.$scrollElement=this.$element.on("scroll.bs.scroll-spy.data-api",f),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||(e=a(c).attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.offsets=a([]),this.targets=a([]),this.activeTarget=null,this.refresh(),this.process()}b.DEFAULTS={offset:10},b.prototype.refresh=function(){var b=this.$element[0]==window?"offset":"position";this.offsets=a([]),this.targets=a([]);var c=this;this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#\w/.test(e)&&a(e);return f&&f.length&&[[f[b]().top+(!a.isWindow(c.$scrollElement.get(0))&&c.$scrollElement.scrollTop()),e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){c.offsets.push(this[0]),c.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,d=c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(b>=d)return g!=(a=f.last()[0])&&this.activate(a);for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(!e[a+1]||b<=e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,a(this.selector).parents(".active").removeClass("active");var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")};var c=a.fn.scrollspy;a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=c,this},a(window).on("load",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(jQuery),+function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a")[0],f=a.Event("show.bs.tab",{relatedTarget:e});if(b.trigger(f),!f.isDefaultPrevented()){var g=a(d);this.activate(b.parent("li"),c),this.activate(g,g.parent(),function(){b.trigger({type:"shown.bs.tab",relatedTarget:e})})}}},b.prototype.activate=function(b,c,d){function e(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),g?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var f=c.find("> .active"),g=d&&a.support.transition&&f.hasClass("fade");g?f.one(a.support.transition.end,e).emulateTransitionEnd(150):e(),f.removeClass("in")};var c=a.fn.tab;a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new b(this)),"string"==typeof c&&e[c]()})},a.fn.tab.Constructor=b,a.fn.tab.noConflict=function(){return a.fn.tab=c,this},a(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})}(jQuery),+function(a){"use strict";var b=function(c,d){this.options=a.extend({},b.DEFAULTS,d),this.$window=a(window).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(c),this.affixed=this.unpin=null,this.checkPosition()};b.RESET="affix affix-top affix-bottom",b.DEFAULTS={offset:0},b.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},b.prototype.checkPosition=function(){if(this.$element.is(":visible")){var c=a(document).height(),d=this.$window.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.top,h=f.bottom;"object"!=typeof f&&(h=g=f),"function"==typeof g&&(g=f.top()),"function"==typeof h&&(h=f.bottom());var i=null!=this.unpin&&d+this.unpin<=e.top?!1:null!=h&&e.top+this.$element.height()>=c-h?"bottom":null!=g&&g>=d?"top":!1;this.affixed!==i&&(this.unpin&&this.$element.css("top",""),this.affixed=i,this.unpin="bottom"==i?e.top-d:null,this.$element.removeClass(b.RESET).addClass("affix"+(i?"-"+i:"")),"bottom"==i&&this.$element.offset({top:document.body.offsetHeight-h-this.$element.height()}))}};var c=a.fn.affix;a.fn.affix=function(c){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof c&&c;e||d.data("bs.affix",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.affix.Constructor=b,a.fn.affix.noConflict=function(){return a.fn.affix=c,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var b=a(this),c=b.data();c.offset=c.offset||{},c.offsetBottom&&(c.offset.bottom=c.offsetBottom),c.offsetTop&&(c.offset.top=c.offsetTop),b.affix(c)})})}(jQuery); -------------------------------------------------------------------------------- /demo/config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | 'ACCESS_KEY': '', 3 | 'SECRET_KEY': '', 4 | 'Bucket_Name': '', 5 | 'Port': 18080, 6 | 'Uptoken_Url': '/uptoken', 7 | 'Domain': 'http://qiniu-plupload.qiniudn.com/' 8 | }; 9 | -------------------------------------------------------------------------------- /demo/default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bearyinnovative/qiniu-js-sdk/6675d08ed9661f76cae30e8a6b77eee3cf17c88f/demo/default.png -------------------------------------------------------------------------------- /demo/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bearyinnovative/qiniu-js-sdk/6675d08ed9661f76cae30e8a6b77eee3cf17c88f/demo/favicon.ico -------------------------------------------------------------------------------- /demo/js/Respond-1.4.2/respond.min.js: -------------------------------------------------------------------------------- 1 | /*! Respond.js v1.4.2: min/max-width media query polyfill * Copyright 2013 Scott Jehl 2 | * Licensed under https://github.com/scottjehl/Respond/blob/master/LICENSE-MIT 3 | * */ 4 | 5 | !function(a){"use strict";a.matchMedia=a.matchMedia||function(a){var b,c=a.documentElement,d=c.firstElementChild||c.firstChild,e=a.createElement("body"),f=a.createElement("div");return f.id="mq-test-1",f.style.cssText="position:absolute;top:-100em",e.style.background="none",e.appendChild(f),function(a){return f.innerHTML='­',c.insertBefore(e,d),b=42===f.offsetWidth,c.removeChild(e),{matches:b,media:a}}}(a.document)}(this),function(a){"use strict";function b(){u(!0)}var c={};a.respond=c,c.update=function(){};var d=[],e=function(){var b=!1;try{b=new a.XMLHttpRequest}catch(c){b=new a.ActiveXObject("Microsoft.XMLHTTP")}return function(){return b}}(),f=function(a,b){var c=e();c&&(c.open("GET",a,!0),c.onreadystatechange=function(){4!==c.readyState||200!==c.status&&304!==c.status||b(c.responseText)},4!==c.readyState&&c.send(null))};if(c.ajax=f,c.queue=d,c.regex={media:/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\([\s]*min\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/,maxw:/\([\s]*max\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/},c.mediaQueriesSupported=a.matchMedia&&null!==a.matchMedia("only all")&&a.matchMedia("only all").matches,!c.mediaQueriesSupported){var g,h,i,j=a.document,k=j.documentElement,l=[],m=[],n=[],o={},p=30,q=j.getElementsByTagName("head")[0]||k,r=j.getElementsByTagName("base")[0],s=q.getElementsByTagName("link"),t=function(){var a,b=j.createElement("div"),c=j.body,d=k.style.fontSize,e=c&&c.style.fontSize,f=!1;return b.style.cssText="position:absolute;font-size:1em;width:1em",c||(c=f=j.createElement("body"),c.style.background="none"),k.style.fontSize="100%",c.style.fontSize="100%",c.appendChild(b),f&&k.insertBefore(c,k.firstChild),a=b.offsetWidth,f?k.removeChild(c):c.removeChild(b),k.style.fontSize=d,e&&(c.style.fontSize=e),a=i=parseFloat(a)},u=function(b){var c="clientWidth",d=k[c],e="CSS1Compat"===j.compatMode&&d||j.body[c]||d,f={},o=s[s.length-1],r=(new Date).getTime();if(b&&g&&p>r-g)return a.clearTimeout(h),h=a.setTimeout(u,p),void 0;g=r;for(var v in l)if(l.hasOwnProperty(v)){var w=l[v],x=w.minw,y=w.maxw,z=null===x,A=null===y,B="em";x&&(x=parseFloat(x)*(x.indexOf(B)>-1?i||t():1)),y&&(y=parseFloat(y)*(y.indexOf(B)>-1?i||t():1)),w.hasquery&&(z&&A||!(z||e>=x)||!(A||y>=e))||(f[w.media]||(f[w.media]=[]),f[w.media].push(m[w.rules]))}for(var C in n)n.hasOwnProperty(C)&&n[C]&&n[C].parentNode===q&&q.removeChild(n[C]);n.length=0;for(var D in f)if(f.hasOwnProperty(D)){var E=j.createElement("style"),F=f[D].join("\n");E.type="text/css",E.media=D,q.insertBefore(E,o.nextSibling),E.styleSheet?E.styleSheet.cssText=F:E.appendChild(j.createTextNode(F)),n.push(E)}},v=function(a,b,d){var e=a.replace(c.regex.keyframes,"").match(c.regex.media),f=e&&e.length||0;b=b.substring(0,b.lastIndexOf("/"));var g=function(a){return a.replace(c.regex.urls,"$1"+b+"$2$3")},h=!f&&d;b.length&&(b+="/"),h&&(f=1);for(var i=0;f>i;i++){var j,k,n,o;h?(j=d,m.push(g(a))):(j=e[i].match(c.regex.findStyles)&&RegExp.$1,m.push(RegExp.$2&&g(RegExp.$2))),n=j.split(","),o=n.length;for(var p=0;o>p;p++)k=n[p],l.push({media:k.split("(")[0].match(c.regex.only)&&RegExp.$2||"all",rules:m.length-1,hasquery:k.indexOf("(")>-1,minw:k.match(c.regex.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:k.match(c.regex.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}u()},w=function(){if(d.length){var b=d.shift();f(b.href,function(c){v(c,b.href,b.media),o[b.href]=!0,a.setTimeout(function(){w()},0)})}},x=function(){for(var b=0;b 4 | 5 | */ 6 | 7 | pre code { 8 | display:block; 9 | padding:0.5em; 10 | font:12px Arial; 11 | line-height:2.0em 12 | } 13 | pre .comment,pre .template_comment,pre .diff .header,pre .javadoc { 14 | color:#998; 15 | font-style:italic 16 | } 17 | pre .keyword,pre .css .rule .keyword,pre .winutils,pre .javascript .title,pre .nginx .title,pre .subst,pre .request,pre .status { 18 | //color:#333; 19 | color: #787878; 20 | font-weight:bold 21 | } 22 | pre .number,pre .hexcolor,pre .ruby .constant { 23 | color:#099; 24 | } 25 | pre .string,pre .tag .value,pre .phpdoc,pre .tex .formula { 26 | /*color:#d14*/ 27 | color: #409B1C; 28 | } 29 | pre .title,pre .id { 30 | color:#900; 31 | font-weight:bold 32 | } 33 | pre .javascript .title,pre .lisp .title,pre .clojure .title,pre .subst { 34 | font-weight:normal 35 | } 36 | pre .class .title,pre .haskell .type,pre .vhdl .literal,pre .tex .command { 37 | color:#458; 38 | font-weight:bold 39 | } 40 | pre .tag,pre .tag .title,pre .rules .property,pre .django .tag .keyword { 41 | color:#000080; 42 | font-weight:normal 43 | } 44 | pre .attribute,pre .variable,pre .lisp .body { 45 | /*color:#008080*/ 46 | color: #FF7800; 47 | } 48 | pre .regexp { 49 | color:#009926 50 | } 51 | pre .class { 52 | color:#458; 53 | font-weight:bold 54 | } 55 | pre .symbol,pre .ruby .symbol .string,pre .lisp .keyword,pre .tex .special,pre .prompt { 56 | color:#990073 57 | } 58 | pre .built_in,pre .lisp .title,pre .clojure .built_in { 59 | color:#0086b3 60 | } 61 | pre .preprocessor,pre .pi,pre .doctype,pre .shebang,pre .cdata { 62 | color:#999; 63 | font-weight:bold 64 | } 65 | pre .deletion { 66 | background:#fdd 67 | } 68 | pre .addition { 69 | background:#dfd 70 | } 71 | pre .diff .change { 72 | background:#0086b3 73 | } 74 | pre .chunk { 75 | color:#aaa 76 | } 77 | -------------------------------------------------------------------------------- /demo/js/highlight/highlight.js: -------------------------------------------------------------------------------- 1 | var hljs=new function(){function l(o){return o.replace(/&/gm,"&").replace(//gm,">")}function b(p){for(var o=p.firstChild;o;o=o.nextSibling){if(o.nodeName=="CODE"){return o}if(!(o.nodeType==3&&o.nodeValue.match(/\s+/))){break}}}function h(p,o){return Array.prototype.map.call(p.childNodes,function(q){if(q.nodeType==3){return o?q.nodeValue.replace(/\n/g,""):q.nodeValue}if(q.nodeName=="BR"){return"\n"}return h(q,o)}).join("")}function a(q){var p=(q.className+" "+q.parentNode.className).split(/\s+/);p=p.map(function(r){return r.replace(/^language-/,"")});for(var o=0;o"}while(x.length||v.length){var u=t().splice(0,1)[0];y+=l(w.substr(p,u.offset-p));p=u.offset;if(u.event=="start"){y+=s(u.node);r.push(u.node)}else{if(u.event=="stop"){var o,q=r.length;do{q--;o=r[q];y+=("")}while(o!=u.node);r.splice(q,1);while(q'+L[0]+""}else{r+=L[0]}N=A.lR.lastIndex;L=A.lR.exec(K)}return r+K.substr(N)}function z(){if(A.sL&&!e[A.sL]){return l(w)}var r=A.sL?d(A.sL,w):g(w);if(A.r>0){v+=r.keyword_count;B+=r.r}return''+r.value+""}function J(){return A.sL!==undefined?z():G()}function I(L,r){var K=L.cN?'':"";if(L.rB){x+=K;w=""}else{if(L.eB){x+=l(r)+K;w=""}else{x+=K;w=r}}A=Object.create(L,{parent:{value:A}});B+=L.r}function C(K,r){w+=K;if(r===undefined){x+=J();return 0}var L=o(r,A);if(L){x+=J();I(L,r);return L.rB?0:r.length}var M=s(A,r);if(M){if(!(M.rE||M.eE)){w+=r}x+=J();do{if(A.cN){x+=""}A=A.parent}while(A!=M.parent);if(M.eE){x+=l(r)}w="";if(M.starts){I(M.starts,"")}return M.rE?0:r.length}if(t(r,A)){throw"Illegal"}w+=r;return r.length||1}var F=e[D];f(F);var A=F;var w="";var B=0;var v=0;var x="";try{var u,q,p=0;while(true){A.t.lastIndex=p;u=A.t.exec(E);if(!u){break}q=C(E.substr(p,u.index-p),u[0]);p=u.index+q}C(E.substr(p));return{r:B,keyword_count:v,value:x,language:D}}catch(H){if(H=="Illegal"){return{r:0,keyword_count:0,value:l(E)}}else{throw H}}}function g(s){var o={keyword_count:0,r:0,value:l(s)};var q=o;for(var p in e){if(!e.hasOwnProperty(p)){continue}var r=d(p,s);r.language=p;if(r.keyword_count+r.r>q.keyword_count+q.r){q=r}if(r.keyword_count+r.r>o.keyword_count+o.r){q=o;o=r}}if(q.language){o.second_best=q}return o}function i(q,p,o){if(p){q=q.replace(/^((<[^>]+>|\t)+)/gm,function(r,v,u,t){return v.replace(/\t/g,p)})}if(o){q=q.replace(/\n/g,"
")}return q}function m(r,u,p){var v=h(r,p);var t=a(r);if(t=="no-highlight"){return}var w=t?d(t,v):g(v);t=w.language;var o=c(r);if(o.length){var q=document.createElement("pre");q.innerHTML=w.value;w.value=j(o,c(q),v)}w.value=i(w.value,u,p);var s=r.className;if(!s.match("(\\s|^)(language-)?"+t+"(\\s|$)")){s=s?(s+" "+t):t}r.innerHTML=w.value;r.className=s;r.result={language:t,kw:w.keyword_count,re:w.r};if(w.second_best){r.second_best={language:w.second_best.language,kw:w.second_best.keyword_count,re:w.second_best.r}}}function n(){if(n.called){return}n.called=true;Array.prototype.map.call(document.getElementsByTagName("pre"),b).filter(Boolean).forEach(function(o){m(o,hljs.tabReplace)})}function k(){window.addEventListener("DOMContentLoaded",n,false);window.addEventListener("load",n,false)}var e={};this.LANGUAGES=e;this.highlight=d;this.highlightAuto=g;this.fixMarkup=i;this.highlightBlock=m;this.initHighlighting=n;this.initHighlightingOnLoad=k;this.IR="[a-zA-Z][a-zA-Z0-9_]*";this.UIR="[a-zA-Z_][a-zA-Z0-9_]*";this.NR="\\b\\d+(\\.\\d+)?";this.CNR="(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)";this.BNR="\\b(0b[01]+)";this.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|\\.|-|-=|/|/=|:|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";this.BE={b:"\\\\[\\s\\S]",r:0};this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE],r:0};this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE],r:0};this.CLCM={cN:"comment",b:"//",e:"$"};this.CBLCLM={cN:"comment",b:"/\\*",e:"\\*/"};this.HCM={cN:"comment",b:"#",e:"$"};this.NM={cN:"number",b:this.NR,r:0};this.CNM={cN:"number",b:this.CNR,r:0};this.BNM={cN:"number",b:this.BNR,r:0};this.inherit=function(q,r){var o={};for(var p in q){o[p]=q[p]}if(r){for(var p in r){o[p]=r[p]}}return o}}();hljs.LANGUAGES.cs=function(a){return{k:"abstract as base bool break byte case catch char checked class const continue decimal default delegate do double else enum event explicit extern false finally fixed float for foreach goto if implicit in int interface internal is lock long namespace new null object operator out override params private protected public readonly ref return sbyte sealed short sizeof stackalloc static string struct switch this throw true try typeof uint ulong unchecked unsafe ushort using virtual volatile void while ascending descending from get group into join let orderby partial select set value var where yield",c:[{cN:"comment",b:"///",e:"$",rB:true,c:[{cN:"xmlDocTag",b:"///|"},{cN:"xmlDocTag",b:""}]},a.CLCM,a.CBLCLM,{cN:"preprocessor",b:"#",e:"$",k:"if else elif endif define undef warning error line region endregion pragma checksum"},{cN:"string",b:'@"',e:'"',c:[{b:'""'}]},a.ASM,a.QSM,a.CNM]}}(hljs);hljs.LANGUAGES.ruby=function(e){var a="[a-zA-Z_][a-zA-Z0-9_]*(\\!|\\?)?";var j="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?";var g={keyword:"and false then defined module in return redo if BEGIN retry end for true self when next until do begin unless END rescue nil else break undef not super class case require yield alias while ensure elsif or include"};var c={cN:"yardoctag",b:"@[A-Za-z]+"};var k=[{cN:"comment",b:"#",e:"$",c:[c]},{cN:"comment",b:"^\\=begin",e:"^\\=end",c:[c],r:10},{cN:"comment",b:"^__END__",e:"\\n$"}];var d={cN:"subst",b:"#\\{",e:"}",l:a,k:g};var i=[e.BE,d];var b=[{cN:"string",b:"'",e:"'",c:i,r:0},{cN:"string",b:'"',e:'"',c:i,r:0},{cN:"string",b:"%[qw]?\\(",e:"\\)",c:i},{cN:"string",b:"%[qw]?\\[",e:"\\]",c:i},{cN:"string",b:"%[qw]?{",e:"}",c:i},{cN:"string",b:"%[qw]?<",e:">",c:i,r:10},{cN:"string",b:"%[qw]?/",e:"/",c:i,r:10},{cN:"string",b:"%[qw]?%",e:"%",c:i,r:10},{cN:"string",b:"%[qw]?-",e:"-",c:i,r:10},{cN:"string",b:"%[qw]?\\|",e:"\\|",c:i,r:10}];var h={cN:"function",bWK:true,e:" |$|;",k:"def",c:[{cN:"title",b:j,l:a,k:g},{cN:"params",b:"\\(",e:"\\)",l:a,k:g}].concat(k)};var f=k.concat(b.concat([{cN:"class",bWK:true,e:"$|;",k:"class module",c:[{cN:"title",b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?",r:0},{cN:"inheritance",b:"<\\s*",c:[{cN:"parent",b:"("+e.IR+"::)?"+e.IR}]}].concat(k)},h,{cN:"constant",b:"(::)?(\\b[A-Z]\\w*(::)?)+",r:0},{cN:"symbol",b:":",c:b.concat([{b:j}]),r:0},{cN:"symbol",b:a+":",r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{cN:"number",b:"\\?\\w"},{cN:"variable",b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},{b:"("+e.RSR+")\\s*",c:k.concat([{cN:"regexp",b:"/",e:"/[a-z]*",i:"\\n",c:[e.BE,d]}]),r:0}]));d.c=f;h.c[1].c=f;return{l:a,k:g,c:f}}(hljs);hljs.LANGUAGES.javascript=function(a){return{k:{keyword:"in if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const",literal:"true false null undefined NaN Infinity"},c:[a.ASM,a.QSM,a.CLCM,a.CBLCLM,a.CNM,{b:"("+a.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[a.CLCM,a.CBLCLM,{cN:"regexp",b:"/",e:"/[gim]*",i:"\\n",c:[{b:"\\\\/"}]},{b:"<",e:">;",sL:"xml"}],r:0},{cN:"function",bWK:true,e:"{",k:"function",c:[{cN:"title",b:"[A-Za-z$_][0-9A-Za-z$_]*"},{cN:"params",b:"\\(",e:"\\)",c:[a.CLCM,a.CBLCLM],i:"[\"'\\(]"}],i:"\\[|%"}]}}(hljs);hljs.LANGUAGES.xml=function(a){var c="[A-Za-z0-9\\._:-]+";var b={eW:true,c:[{cN:"attribute",b:c,r:0},{b:'="',rB:true,e:'"',c:[{cN:"value",b:'"',eW:true}]},{b:"='",rB:true,e:"'",c:[{cN:"value",b:"'",eW:true}]},{b:"=",c:[{cN:"value",b:"[^\\s/>]+"}]}]};return{cI:true,c:[{cN:"pi",b:"<\\?",e:"\\?>",r:10},{cN:"doctype",b:"",r:10,c:[{b:"\\[",e:"\\]"}]},{cN:"comment",b:"",r:10},{cN:"cdata",b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"|$)",e:">",k:{title:"style"},c:[b],starts:{e:"",rE:true,sL:"css"}},{cN:"tag",b:"|$)",e:">",k:{title:"script"},c:[b],starts:{e:"<\/script>",rE:true,sL:"javascript"}},{b:"<%",e:"%>",sL:"vbscript"},{cN:"tag",b:"",c:[{cN:"title",b:"[^ />]+"},b]}]}}(hljs);hljs.LANGUAGES.http=function(a){return{i:"\\S",c:[{cN:"status",b:"^HTTP/[0-9\\.]+",e:"$",c:[{cN:"number",b:"\\b\\d{3}\\b"}]},{cN:"request",b:"^[A-Z]+ (.*?) HTTP/[0-9\\.]+$",rB:true,e:"$",c:[{cN:"string",b:" ",e:" ",eB:true,eE:true}]},{cN:"attribute",b:"^\\w",e:": ",eE:true,i:"\\n|\\s|=",starts:{cN:"string",e:"$"}},{b:"\\n\\n",starts:{sL:"",eW:true}}]}}(hljs);hljs.LANGUAGES.java=function(a){return{k:"false synchronized int abstract float private char boolean static null if const for true while long throw strictfp finally protected import native final return void enum else break transient new catch instanceof byte super volatile case assert short package default double public try this switch continue throws",c:[{cN:"javadoc",b:"/\\*\\*",e:"\\*/",c:[{cN:"javadoctag",b:"@[A-Za-z]+"}],r:10},a.CLCM,a.CBLCLM,a.ASM,a.QSM,{cN:"class",bWK:true,e:"{",k:"class interface",i:":",c:[{bWK:true,k:"extends implements",r:10},{cN:"title",b:a.UIR}]},a.CNM,{cN:"annotation",b:"@[A-Za-z]+"}]}}(hljs);hljs.LANGUAGES.php=function(a){var e={cN:"variable",b:"\\$+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*"};var b=[a.inherit(a.ASM,{i:null}),a.inherit(a.QSM,{i:null}),{cN:"string",b:'b"',e:'"',c:[a.BE]},{cN:"string",b:"b'",e:"'",c:[a.BE]}];var c=[a.BNM,a.CNM];var d={cN:"title",b:a.UIR};return{cI:true,k:"and include_once list abstract global private echo interface as static endswitch array null if endwhile or const for endforeach self var while isset public protected exit foreach throw elseif include __FILE__ empty require_once do xor return implements parent clone use __CLASS__ __LINE__ else break print eval new catch __METHOD__ case exception php_user_filter default die require __FUNCTION__ enddeclare final try this switch continue endfor endif declare unset true false namespace trait goto instanceof insteadof __DIR__ __NAMESPACE__ __halt_compiler",c:[a.CLCM,a.HCM,{cN:"comment",b:"/\\*",e:"\\*/",c:[{cN:"phpdoc",b:"\\s@[A-Za-z]+"}]},{cN:"comment",eB:true,b:"__halt_compiler.+?;",eW:true},{cN:"string",b:"<<<['\"]?\\w+['\"]?$",e:"^\\w+;",c:[a.BE]},{cN:"preprocessor",b:"<\\?php",r:10},{cN:"preprocessor",b:"\\?>"},e,{cN:"function",bWK:true,e:"{",k:"function",i:"\\$|\\[|%",c:[d,{cN:"params",b:"\\(",e:"\\)",c:["self",e,a.CBLCLM].concat(b).concat(c)}]},{cN:"class",bWK:true,e:"{",k:"class",i:"[:\\(\\$]",c:[{bWK:true,eW:true,k:"extends",c:[d]},d]},{b:"=>"}].concat(b).concat(c)}}(hljs);hljs.LANGUAGES.python=function(a){var f={cN:"prompt",b:"^(>>>|\\.\\.\\.) "};var c=[{cN:"string",b:"(u|b)?r?'''",e:"'''",c:[f],r:10},{cN:"string",b:'(u|b)?r?"""',e:'"""',c:[f],r:10},{cN:"string",b:"(u|r|ur)'",e:"'",c:[a.BE],r:10},{cN:"string",b:'(u|r|ur)"',e:'"',c:[a.BE],r:10},{cN:"string",b:"(b|br)'",e:"'",c:[a.BE]},{cN:"string",b:'(b|br)"',e:'"',c:[a.BE]}].concat([a.ASM,a.QSM]);var e={cN:"title",b:a.UIR};var d={cN:"params",b:"\\(",e:"\\)",c:["self",a.CNM,f].concat(c)};var b={bWK:true,e:":",i:"[${=;\\n]",c:[e,d],r:10};return{k:{keyword:"and elif is global as in if from raise for except finally print import pass return exec else break not with class assert yield try while continue del or def lambda nonlocal|10",built_in:"None True False Ellipsis NotImplemented"},i:"(|\\?)",c:c.concat([f,a.HCM,a.inherit(b,{cN:"function",k:"def"}),a.inherit(b,{cN:"class",k:"class"}),a.CNM,{cN:"decorator",b:"@",e:"$"},{b:"\\b(print|exec)\\("}])}}(hljs);hljs.LANGUAGES.perl=function(e){var a="getpwent getservent quotemeta msgrcv scalar kill dbmclose undef lc ma syswrite tr send umask sysopen shmwrite vec qx utime local oct semctl localtime readpipe do return format read sprintf dbmopen pop getpgrp not getpwnam rewinddir qqfileno qw endprotoent wait sethostent bless s|0 opendir continue each sleep endgrent shutdown dump chomp connect getsockname die socketpair close flock exists index shmgetsub for endpwent redo lstat msgctl setpgrp abs exit select print ref gethostbyaddr unshift fcntl syscall goto getnetbyaddr join gmtime symlink semget splice x|0 getpeername recv log setsockopt cos last reverse gethostbyname getgrnam study formline endhostent times chop length gethostent getnetent pack getprotoent getservbyname rand mkdir pos chmod y|0 substr endnetent printf next open msgsnd readdir use unlink getsockopt getpriority rindex wantarray hex system getservbyport endservent int chr untie rmdir prototype tell listen fork shmread ucfirst setprotoent else sysseek link getgrgid shmctl waitpid unpack getnetbyname reset chdir grep split require caller lcfirst until warn while values shift telldir getpwuid my getprotobynumber delete and sort uc defined srand accept package seekdir getprotobyname semop our rename seek if q|0 chroot sysread setpwent no crypt getc chown sqrt write setnetent setpriority foreach tie sin msgget map stat getlogin unless elsif truncate exec keys glob tied closedirioctl socket readlink eval xor readline binmode setservent eof ord bind alarm pipe atan2 getgrent exp time push setgrent gt lt or ne m|0 break given say state when";var d={cN:"subst",b:"[$@]\\{",e:"\\}",k:a,r:10};var b={cN:"variable",b:"\\$\\d"};var i={cN:"variable",b:"[\\$\\%\\@\\*](\\^\\w\\b|#\\w+(\\:\\:\\w+)*|[^\\s\\w{]|{\\w+}|\\w+(\\:\\:\\w*)*)"};var f=[e.BE,d,b,i];var h={b:"->",c:[{b:e.IR},{b:"{",e:"}"}]};var g={cN:"comment",b:"^(__END__|__DATA__)",e:"\\n$",r:5};var c=[b,i,e.HCM,g,{cN:"comment",b:"^\\=\\w",e:"\\=cut",eW:true},h,{cN:"string",b:"q[qwxr]?\\s*\\(",e:"\\)",c:f,r:5},{cN:"string",b:"q[qwxr]?\\s*\\[",e:"\\]",c:f,r:5},{cN:"string",b:"q[qwxr]?\\s*\\{",e:"\\}",c:f,r:5},{cN:"string",b:"q[qwxr]?\\s*\\|",e:"\\|",c:f,r:5},{cN:"string",b:"q[qwxr]?\\s*\\<",e:"\\>",c:f,r:5},{cN:"string",b:"qw\\s+q",e:"q",c:f,r:5},{cN:"string",b:"'",e:"'",c:[e.BE],r:0},{cN:"string",b:'"',e:'"',c:f,r:0},{cN:"string",b:"`",e:"`",c:[e.BE]},{cN:"string",b:"{\\w+}",r:0},{cN:"string",b:"-?\\w+\\s*\\=\\>",r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{b:"("+e.RSR+"|\\b(split|return|print|reverse|grep)\\b)\\s*",k:"split return print reverse grep",r:0,c:[e.HCM,g,{cN:"regexp",b:"(s|tr|y)/(\\\\.|[^/])*/(\\\\.|[^/])*/[a-z]*",r:10},{cN:"regexp",b:"(m|qr)?/",e:"/[a-z]*",c:[e.BE],r:0}]},{cN:"sub",bWK:true,e:"(\\s*\\(.*?\\))?[;{]",k:"sub",r:5},{cN:"operator",b:"-\\w\\b",r:0}];d.c=c;h.c[1].c=c;return{k:a,c:c}}(hljs);hljs.LANGUAGES.json=function(a){var e={literal:"true false null"};var d=[a.QSM,a.CNM];var c={cN:"value",e:",",eW:true,eE:true,c:d,k:e};var b={b:"{",e:"}",c:[{cN:"attribute",b:'\\s*"',e:'"\\s*:\\s*',eB:true,eE:true,c:[a.BE],i:"\\n",starts:c}],i:"\\S"};var f={b:"\\[",e:"\\]",c:[a.inherit(c,{cN:null})],i:"\\S"};d.splice(d.length,0,b,f);return{c:d,k:e,i:"\\S"}}(hljs);hljs.LANGUAGES.cpp=function(a){var b={keyword:"false int float while private char catch export virtual operator sizeof dynamic_cast|10 typedef const_cast|10 const struct for static_cast|10 union namespace unsigned long throw volatile static protected bool template mutable if public friend do return goto auto void enum else break new extern using true class asm case typeid short reinterpret_cast|10 default double register explicit signed typename try this switch continue wchar_t inline delete alignof char16_t char32_t constexpr decltype noexcept nullptr static_assert thread_local restrict _Bool complex",built_in:"std string cin cout cerr clog stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap array shared_ptr"};return{k:b,i:"",k:b,r:10,c:["self"]}]}}(hljs);hljs.LANGUAGES.go=function(a){var b={keyword:"break default func interface select case map struct chan else goto package switch const fallthrough if range type continue for import return var go defer",constant:"true false iota nil",typename:"bool byte complex64 complex128 float32 float64 int8 int16 int32 int64 string uint8 uint16 uint32 uint64 int uint uintptr rune",built_in:"append cap close complex copy imag len make new panic print println real recover delete"};return{k:b,i:"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}"; 6 | c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode|| 7 | "undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:"3.7.0",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f); 8 | if(g)return a.createDocumentFragment();for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;d 360 ? rotate - 270 : rotate + 90; 152 | } 153 | fopArr.push({ 154 | 'fop': 'imageMogr2', 155 | 'auto-orient': true, 156 | 'strip': true, 157 | 'rotate': rotate, 158 | 'format': 'png' 159 | }); 160 | } 161 | 162 | $('#myModal-img .modal-body-footer').find('a.disabled').each(function() { 163 | 164 | var watermark = $(this).data('watermark'); 165 | var imageView = $(this).data('imageview'); 166 | var imageMogr = $(this).data('imagemogr'); 167 | 168 | if (watermark) { 169 | fopArr.push({ 170 | fop: 'watermark', 171 | mode: 1, 172 | image: 'http://www.b1.qiniudn.com/images/logo-2.png', 173 | dissolve: 100, 174 | gravity: watermark, 175 | dx: 100, 176 | dy: 100 177 | }); 178 | } 179 | 180 | if (imageView) { 181 | var height; 182 | switch (imageView) { 183 | case 'large': 184 | height = originHeight; 185 | break; 186 | case 'middle': 187 | height = originHeight * 0.5; 188 | break; 189 | case 'small': 190 | height = originHeight * 0.1; 191 | break; 192 | default: 193 | height = originHeight; 194 | break; 195 | } 196 | fopArr.push({ 197 | fop: 'imageView2', 198 | mode: 3, 199 | h: parseInt(height, 10), 200 | q: 100, 201 | format: 'png' 202 | }); 203 | } 204 | 205 | if (imageMogr === 'no-rotate') { 206 | fopArr.push({ 207 | 'fop': 'imageMogr2', 208 | 'auto-orient': true, 209 | 'strip': true, 210 | 'rotate': 0, 211 | 'format': 'png' 212 | }); 213 | } 214 | }); 215 | 216 | var newUrl = Qiniu.pipeline(fopArr, key); 217 | 218 | var newImg = new Image(); 219 | img.attr('src', 'loading.gif'); 220 | newImg.onload = function() { 221 | img.attr('src', newUrl); 222 | img.parent('a').attr('href', newUrl); 223 | }; 224 | newImg.src = newUrl; 225 | return false; 226 | }); 227 | 228 | }); 229 | -------------------------------------------------------------------------------- /demo/js/plupload/Moxie.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bearyinnovative/qiniu-js-sdk/6675d08ed9661f76cae30e8a6b77eee3cf17c88f/demo/js/plupload/Moxie.swf -------------------------------------------------------------------------------- /demo/js/plupload/Moxie.xap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bearyinnovative/qiniu-js-sdk/6675d08ed9661f76cae30e8a6b77eee3cf17c88f/demo/js/plupload/Moxie.xap -------------------------------------------------------------------------------- /demo/js/plupload/i18n/zh_CN.js: -------------------------------------------------------------------------------- 1 | // Chinese (China) (zh_CN) 2 | plupload.addI18n({"Stop Upload":"停止上传","Upload URL might be wrong or doesn't exist.":"上传的URL可能是错误的或不存在。","tb":"tb","Size":"大小","Close":"关闭","Init error.":"初始化错误。","Add files to the upload queue and click the start button.":"将文件添加到上传队列,然后点击”开始上传“按钮。","Filename":"文件名","Image format either wrong or not supported.":"图片格式错误或者不支持。","Status":"状态","HTTP Error.":"HTTP 错误。","Start Upload":"开始上传","mb":"mb","kb":"kb","Duplicate file error.":"重复文件错误。","File size error.":"文件大小错误。","N/A":"N/A","gb":"gb","Error: Invalid file extension:":"错误:无效的文件扩展名:","Select files":"选择文件","%s already present in the queue.":"%s 已经在当前队列里。","File: %s":"文件: %s","b":"b","Uploaded %d/%d files":"已上传 %d/%d 个文件","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"每次只接受同时上传 %d 个文件,多余的文件将会被删除。","%d files queued":"%d 个文件加入到队列","File: %s, size: %d, max file size: %d":"文件: %s, 大小: %d, 最大文件大小: %d","Drag files here.":"把文件拖到这里。","Runtime ran out of available memory.":"运行时已消耗所有可用内存。","File count error.":"文件数量错误。","File extension error.":"文件扩展名错误。","Error: File too large:":"错误: 文件太大:","Add Files":"增加文件"}); -------------------------------------------------------------------------------- /demo/js/plupload/jquery.plupload.queue/css/jquery.plupload.queue.css: -------------------------------------------------------------------------------- 1 | /* 2 | Plupload 3 | ------------------------------------------------------------------- */ 4 | 5 | .plupload_button { 6 | display: -moz-inline-box; /* FF < 3*/ 7 | display: inline-block; 8 | font: normal 12px sans-serif; 9 | text-decoration: none; 10 | color: #42454a; 11 | border: 1px solid #bababa; 12 | padding: 2px 8px 3px 20px; 13 | margin-right: 4px; 14 | background: #f3f3f3 url('../img/buttons.png') no-repeat 0 center; 15 | outline: 0; 16 | 17 | /* Optional rounded corners for browsers that support it */ 18 | -moz-border-radius: 3px; 19 | -khtml-border-radius: 3px; 20 | -webkit-border-radius: 3px; 21 | border-radius: 3px; 22 | } 23 | 24 | .plupload_button:hover { 25 | color: #000; 26 | text-decoration: none; 27 | } 28 | 29 | .plupload_disabled, a.plupload_disabled:hover { 30 | color: #737373; 31 | border-color: #c5c5c5; 32 | background: #ededed url('../img/buttons-disabled.png') no-repeat 0 center; 33 | cursor: default; 34 | } 35 | 36 | .plupload_add { 37 | background-position: -181px center; 38 | } 39 | 40 | .plupload_wrapper { 41 | font: normal 11px Verdana,sans-serif; 42 | width: 100%; 43 | } 44 | 45 | .plupload_container { 46 | padding: 8px; 47 | background: url('../img/transp50.png'); 48 | /*-moz-border-radius: 5px;*/ 49 | } 50 | 51 | .plupload_container input { 52 | border: 1px solid #DDD; 53 | font: normal 11px Verdana,sans-serif; 54 | width: 98%; 55 | } 56 | 57 | .plupload_header {background: #2A2C2E url('../img/backgrounds.gif') repeat-x;} 58 | .plupload_header_content { 59 | background: url('../img/backgrounds.gif') no-repeat 0 -317px; 60 | min-height: 56px; 61 | padding-left: 60px; 62 | color: #FFF; 63 | } 64 | .plupload_header_title { 65 | font: normal 18px sans-serif; 66 | padding: 6px 0 3px; 67 | } 68 | .plupload_header_text { 69 | font: normal 12px sans-serif; 70 | } 71 | 72 | .plupload_filelist { 73 | margin: 0; 74 | padding: 0; 75 | list-style: none; 76 | } 77 | 78 | .plupload_scroll .plupload_filelist { 79 | height: 185px; 80 | background: #F5F5F5; 81 | overflow-y: scroll; 82 | } 83 | 84 | .plupload_filelist li { 85 | padding: 10px 8px; 86 | background: #F5F5F5 url('../img/backgrounds.gif') repeat-x 0 -156px; 87 | border-bottom: 1px solid #DDD; 88 | } 89 | 90 | .plupload_filelist_header, .plupload_filelist_footer { 91 | background: #DFDFDF; 92 | padding: 8px 8px; 93 | color: #42454A; 94 | } 95 | .plupload_filelist_header { 96 | border-top: 1px solid #EEE; 97 | border-bottom: 1px solid #CDCDCD; 98 | } 99 | 100 | .plupload_filelist_footer {border-top: 1px solid #FFF; height: 22px; line-height: 20px; vertical-align: middle;} 101 | .plupload_file_name {float: left; overflow: hidden} 102 | .plupload_file_status {color: #777;} 103 | .plupload_file_status span {color: #42454A;} 104 | .plupload_file_size, .plupload_file_status, .plupload_progress { 105 | float: right; 106 | width: 80px; 107 | } 108 | .plupload_file_size, .plupload_file_status, .plupload_file_action {text-align: right;} 109 | 110 | .plupload_filelist .plupload_file_name { 111 | width: 205px; 112 | white-space: nowrap; 113 | text-overflow: ellipsis; 114 | } 115 | 116 | .plupload_file_action { 117 | float: right; 118 | width: 16px; 119 | height: 16px; 120 | margin-left: 15px; 121 | } 122 | 123 | .plupload_file_action * { 124 | display: none; 125 | width: 16px; 126 | height: 16px; 127 | } 128 | 129 | li.plupload_uploading {background: #ECF3DC url('../img/backgrounds.gif') repeat-x 0 -238px;} 130 | li.plupload_done {color:#AAA} 131 | 132 | li.plupload_delete a { 133 | background: url('../img/delete.gif'); 134 | } 135 | 136 | li.plupload_failed a { 137 | background: url('../img/error.gif'); 138 | cursor: default; 139 | } 140 | 141 | li.plupload_done a { 142 | background: url('../img/done.gif'); 143 | cursor: default; 144 | } 145 | 146 | .plupload_progress, .plupload_upload_status { 147 | display: none; 148 | } 149 | 150 | .plupload_progress_container { 151 | margin-top: 3px; 152 | border: 1px solid #CCC; 153 | background: #FFF; 154 | padding: 1px; 155 | } 156 | .plupload_progress_bar { 157 | width: 0px; 158 | height: 7px; 159 | background: #CDEB8B; 160 | } 161 | 162 | .plupload_scroll .plupload_filelist_header .plupload_file_action, .plupload_scroll .plupload_filelist_footer .plupload_file_action { 163 | margin-right: 17px; 164 | } 165 | 166 | /* Floats */ 167 | 168 | .plupload_clear,.plupload_clearer {clear: both;} 169 | .plupload_clearer, .plupload_progress_bar { 170 | display: block; 171 | font-size: 0; 172 | line-height: 0; 173 | } 174 | 175 | li.plupload_droptext { 176 | background: transparent; 177 | text-align: center; 178 | vertical-align: middle; 179 | border: 0; 180 | line-height: 165px; 181 | } 182 | -------------------------------------------------------------------------------- /demo/js/plupload/jquery.plupload.queue/img/backgrounds.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bearyinnovative/qiniu-js-sdk/6675d08ed9661f76cae30e8a6b77eee3cf17c88f/demo/js/plupload/jquery.plupload.queue/img/backgrounds.gif -------------------------------------------------------------------------------- /demo/js/plupload/jquery.plupload.queue/img/buttons-disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bearyinnovative/qiniu-js-sdk/6675d08ed9661f76cae30e8a6b77eee3cf17c88f/demo/js/plupload/jquery.plupload.queue/img/buttons-disabled.png -------------------------------------------------------------------------------- /demo/js/plupload/jquery.plupload.queue/img/buttons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bearyinnovative/qiniu-js-sdk/6675d08ed9661f76cae30e8a6b77eee3cf17c88f/demo/js/plupload/jquery.plupload.queue/img/buttons.png -------------------------------------------------------------------------------- /demo/js/plupload/jquery.plupload.queue/img/delete.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bearyinnovative/qiniu-js-sdk/6675d08ed9661f76cae30e8a6b77eee3cf17c88f/demo/js/plupload/jquery.plupload.queue/img/delete.gif -------------------------------------------------------------------------------- /demo/js/plupload/jquery.plupload.queue/img/done.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bearyinnovative/qiniu-js-sdk/6675d08ed9661f76cae30e8a6b77eee3cf17c88f/demo/js/plupload/jquery.plupload.queue/img/done.gif -------------------------------------------------------------------------------- /demo/js/plupload/jquery.plupload.queue/img/error.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bearyinnovative/qiniu-js-sdk/6675d08ed9661f76cae30e8a6b77eee3cf17c88f/demo/js/plupload/jquery.plupload.queue/img/error.gif -------------------------------------------------------------------------------- /demo/js/plupload/jquery.plupload.queue/img/throbber.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bearyinnovative/qiniu-js-sdk/6675d08ed9661f76cae30e8a6b77eee3cf17c88f/demo/js/plupload/jquery.plupload.queue/img/throbber.gif -------------------------------------------------------------------------------- /demo/js/plupload/jquery.plupload.queue/img/transp50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bearyinnovative/qiniu-js-sdk/6675d08ed9661f76cae30e8a6b77eee3cf17c88f/demo/js/plupload/jquery.plupload.queue/img/transp50.png -------------------------------------------------------------------------------- /demo/js/plupload/jquery.plupload.queue/jquery.plupload.queue.js: -------------------------------------------------------------------------------- 1 | /** 2 | * jquery.plupload.queue.js 3 | * 4 | * Copyright 2009, Moxiecode Systems AB 5 | * Released under GPL License. 6 | * 7 | * License: http://www.plupload.com/license 8 | * Contributing: http://www.plupload.com/contributing 9 | */ 10 | 11 | /* global jQuery:true, alert:true */ 12 | 13 | /** 14 | jQuery based implementation of the Plupload API - multi-runtime file uploading API. 15 | 16 | To use the widget you must include _jQuery_. It is not meant to be extended in any way and is provided to be 17 | used as it is. 18 | 19 | @example 20 | 21 |
22 |

Your browser doesn't have Flash, Silverlight or HTML5 support.

23 |
24 | 25 | 36 | 37 | @example 38 | // Retrieving a reference to plupload.Uploader object 39 | var uploader = $('#uploader').pluploadQueue(); 40 | 41 | uploader.bind('FilesAdded', function() { 42 | 43 | // Autostart 44 | setTimeout(uploader.start, 1); // "detach" from the main thread 45 | }); 46 | 47 | @class pluploadQueue 48 | @constructor 49 | @param {Object} settings For detailed information about each option check documentation. 50 | @param {String} settings.url URL of the server-side upload handler. 51 | @param {Number|String} [settings.chunk_size=0] Chunk size in bytes to slice the file into. Shorcuts with b, kb, mb, gb, tb suffixes also supported. `e.g. 204800 or "204800b" or "200kb"`. By default - disabled. 52 | @param {String} [settings.file_data_name="file"] Name for the file field in Multipart formated message. 53 | @param {Array} [settings.filters=[]] Set of file type filters, each one defined by hash of title and extensions. `e.g. {title : "Image files", extensions : "jpg,jpeg,gif,png"}`. Dispatches `plupload.FILE_EXTENSION_ERROR` 54 | @param {String} [settings.flash_swf_url] URL of the Flash swf. 55 | @param {Object} [settings.headers] Custom headers to send with the upload. Hash of name/value pairs. 56 | @param {Number|String} [settings.max_file_size] Maximum file size that the user can pick, in bytes. Optionally supports b, kb, mb, gb, tb suffixes. `e.g. "10mb" or "1gb"`. By default - not set. Dispatches `plupload.FILE_SIZE_ERROR`. 57 | @param {Number} [settings.max_retries=0] How many times to retry the chunk or file, before triggering Error event. 58 | @param {Boolean} [settings.multipart=true] Whether to send file and additional parameters as Multipart formated message. 59 | @param {Object} [settings.multipart_params] Hash of key/value pairs to send with every file upload. 60 | @param {Boolean} [settings.multi_selection=true] Enable ability to select multiple files at once in file dialog. 61 | @param {Boolean} [settings.prevent_duplicates=false] Do not let duplicates into the queue. Dispatches `plupload.FILE_DUPLICATE_ERROR`. 62 | @param {String|Object} [settings.required_features] Either comma-separated list or hash of required features that chosen runtime should absolutely possess. 63 | @param {Object} [settings.resize] Enable resizng of images on client-side. Applies to `image/jpeg` and `image/png` only. `e.g. {width : 200, height : 200, quality : 90, crop: true}` 64 | @param {Number} [settings.resize.width] If image is bigger, it will be resized. 65 | @param {Number} [settings.resize.height] If image is bigger, it will be resized. 66 | @param {Number} [settings.resize.quality=90] Compression quality for jpegs (1-100). 67 | @param {Boolean} [settings.resize.crop=false] Whether to crop images to exact dimensions. By default they will be resized proportionally. 68 | @param {String} [settings.runtimes="html5,flash,silverlight,html4"] Comma separated list of runtimes, that Plupload will try in turn, moving to the next if previous fails. 69 | @param {String} [settings.silverlight_xap_url] URL of the Silverlight xap. 70 | @param {Boolean} [settings.unique_names=false] If true will generate unique filenames for uploaded files. 71 | 72 | @param {Boolean} [settings.dragdrop=true] Enable ability to add file to the queue by drag'n'dropping them from the desktop. 73 | @param {Boolean} [settings.rename=false] Enable ability to rename files in the queue. 74 | @param {Boolean} [settings.multiple_queues=true] Re-activate the widget after each upload procedure. 75 | */ 76 | (function($, o) { 77 | var uploaders = {}; 78 | 79 | function _(str) { 80 | return plupload.translate(str) || str; 81 | } 82 | 83 | function renderUI(id, target) { 84 | // Remove all existing non plupload items 85 | target.contents().each(function(i, node) { 86 | node = $(node); 87 | 88 | if (!node.is('.plupload')) { 89 | node.remove(); 90 | } 91 | }); 92 | 93 | target.prepend( 94 | '
' + 95 | '
' + 96 | '
' + 97 | '
' + 98 | '
' + 99 | '
' + _('Select files') + '
' + 100 | '
' + _('Add files to the upload queue and click the start button.') + '
' + 101 | '
' + 102 | '
' + 103 | 104 | '
' + 105 | '
' + 106 | '
' + _('Filename') + '
' + 107 | '
 
' + 108 | '
' + _('Status') + '
' + 109 | '
' + _('Size') + '
' + 110 | '
 
' + 111 | '
' + 112 | 113 | '
    ' + 114 | 115 | '' + 133 | '
    ' + 134 | '
    ' + 135 | '
    ' + 136 | '' + 137 | '
    ' 138 | ); 139 | } 140 | 141 | $.fn.pluploadQueue = function(settings) { 142 | if (settings) { 143 | this.each(function() { 144 | var uploader, target, id, contents_bak; 145 | 146 | target = $(this); 147 | id = target.attr('id'); 148 | 149 | if (!id) { 150 | id = plupload.guid(); 151 | target.attr('id', id); 152 | } 153 | 154 | contents_bak = target.html(); 155 | renderUI(id, target); 156 | 157 | settings = $.extend({ 158 | dragdrop : true, 159 | browse_button : id + '_browse', 160 | container : id 161 | }, settings); 162 | 163 | // Enable drag/drop (see PostInit handler as well) 164 | if (settings.dragdrop) { 165 | settings.drop_element = id + '_filelist'; 166 | } 167 | 168 | uploader = new plupload.Uploader(settings); 169 | 170 | uploaders[id] = uploader; 171 | 172 | function handleStatus(file) { 173 | var actionClass; 174 | 175 | if (file.status == plupload.DONE) { 176 | actionClass = 'plupload_done'; 177 | } 178 | 179 | if (file.status == plupload.FAILED) { 180 | actionClass = 'plupload_failed'; 181 | } 182 | 183 | if (file.status == plupload.QUEUED) { 184 | actionClass = 'plupload_delete'; 185 | } 186 | 187 | if (file.status == plupload.UPLOADING) { 188 | actionClass = 'plupload_uploading'; 189 | } 190 | 191 | var icon = $('#' + file.id).attr('class', actionClass).find('a').css('display', 'block'); 192 | if (file.hint) { 193 | icon.attr('title', file.hint); 194 | } 195 | } 196 | 197 | function updateTotalProgress() { 198 | $('span.plupload_total_status', target).html(uploader.total.percent + '%'); 199 | $('div.plupload_progress_bar', target).css('width', uploader.total.percent + '%'); 200 | $('span.plupload_upload_status', target).html( 201 | o.sprintf(_('Uploaded %d/%d files'), uploader.total.uploaded, uploader.files.length) 202 | ); 203 | } 204 | 205 | function updateList() { 206 | var fileList = $('ul.plupload_filelist', target).html(''), inputCount = 0, inputHTML; 207 | 208 | $.each(uploader.files, function(i, file) { 209 | inputHTML = ''; 210 | 211 | if (file.status == plupload.DONE) { 212 | if (file.target_name) { 213 | inputHTML += ''; 214 | } 215 | 216 | inputHTML += ''; 217 | inputHTML += ''; 218 | 219 | inputCount++; 220 | 221 | $('#' + id + '_count').val(inputCount); 222 | } 223 | 224 | fileList.append( 225 | '
  • ' + 226 | '
    ' + file.name + '
    ' + 227 | '
    ' + 228 | '
    ' + file.percent + '%
    ' + 229 | '
    ' + plupload.formatSize(file.size) + '
    ' + 230 | '
     
    ' + 231 | inputHTML + 232 | '
  • ' 233 | ); 234 | 235 | handleStatus(file); 236 | 237 | $('#' + file.id + '.plupload_delete a').click(function(e) { 238 | $('#' + file.id).remove(); 239 | uploader.removeFile(file); 240 | 241 | e.preventDefault(); 242 | }); 243 | }); 244 | 245 | $('span.plupload_total_file_size', target).html(plupload.formatSize(uploader.total.size)); 246 | 247 | if (uploader.total.queued === 0) { 248 | $('span.plupload_add_text', target).html(_('Add Files')); 249 | } else { 250 | $('span.plupload_add_text', target).html(o.sprintf(_('%d files queued'), uploader.total.queued)); 251 | } 252 | 253 | $('a.plupload_start', target).toggleClass('plupload_disabled', uploader.files.length == (uploader.total.uploaded + uploader.total.failed)); 254 | 255 | // Scroll to end of file list 256 | fileList[0].scrollTop = fileList[0].scrollHeight; 257 | 258 | updateTotalProgress(); 259 | 260 | // Re-add drag message if there is no files 261 | if (!uploader.files.length && uploader.features.dragdrop && uploader.settings.dragdrop) { 262 | $('#' + id + '_filelist').append('
  • ' + _("Drag files here.") + '
  • '); 263 | } 264 | } 265 | 266 | function destroy() { 267 | delete uploaders[id]; 268 | uploader.destroy(); 269 | target.html(contents_bak); 270 | uploader = target = contents_bak = null; 271 | } 272 | 273 | uploader.bind("UploadFile", function(up, file) { 274 | $('#' + file.id).addClass('plupload_current_file'); 275 | }); 276 | 277 | uploader.bind('Init', function(up, res) { 278 | // Enable rename support 279 | if (!settings.unique_names && settings.rename) { 280 | target.on('click', '#' + id + '_filelist div.plupload_file_name span', function(e) { 281 | var targetSpan = $(e.target), file, parts, name, ext = ""; 282 | 283 | // Get file name and split out name and extension 284 | file = up.getFile(targetSpan.parents('li')[0].id); 285 | name = file.name; 286 | parts = /^(.+)(\.[^.]+)$/.exec(name); 287 | if (parts) { 288 | name = parts[1]; 289 | ext = parts[2]; 290 | } 291 | 292 | // Display input element 293 | targetSpan.hide().after(''); 294 | targetSpan.next().val(name).focus().blur(function() { 295 | targetSpan.show().next().remove(); 296 | }).keydown(function(e) { 297 | var targetInput = $(this); 298 | 299 | if (e.keyCode == 13) { 300 | e.preventDefault(); 301 | 302 | // Rename file and glue extension back on 303 | file.name = targetInput.val() + ext; 304 | targetSpan.html(file.name); 305 | targetInput.blur(); 306 | } 307 | }); 308 | }); 309 | } 310 | 311 | $('#' + id + '_container').attr('title', 'Using runtime: ' + res.runtime); 312 | 313 | $('a.plupload_start', target).click(function(e) { 314 | if (!$(this).hasClass('plupload_disabled')) { 315 | uploader.start(); 316 | } 317 | 318 | e.preventDefault(); 319 | }); 320 | 321 | $('a.plupload_stop', target).click(function(e) { 322 | e.preventDefault(); 323 | uploader.stop(); 324 | }); 325 | 326 | $('a.plupload_start', target).addClass('plupload_disabled'); 327 | }); 328 | 329 | uploader.bind("Error", function(up, err) { 330 | var file = err.file, message; 331 | 332 | if (file) { 333 | message = err.message; 334 | 335 | if (err.details) { 336 | message += " (" + err.details + ")"; 337 | } 338 | 339 | if (err.code == plupload.FILE_SIZE_ERROR) { 340 | alert(_("Error: File too large:") + " " + file.name); 341 | } 342 | 343 | if (err.code == plupload.FILE_EXTENSION_ERROR) { 344 | alert(_("Error: Invalid file extension:") + " " + file.name); 345 | } 346 | 347 | file.hint = message; 348 | $('#' + file.id).attr('class', 'plupload_failed').find('a').css('display', 'block').attr('title', message); 349 | } 350 | 351 | if (err.code === plupload.INIT_ERROR) { 352 | setTimeout(function() { 353 | destroy(); 354 | }, 1); 355 | } 356 | }); 357 | 358 | uploader.bind("PostInit", function(up) { 359 | // features are populated only after input components are fully instantiated 360 | if (up.settings.dragdrop && up.features.dragdrop) { 361 | $('#' + id + '_filelist').append('
  • ' + _("Drag files here.") + '
  • '); 362 | } 363 | }); 364 | 365 | uploader.init(); 366 | 367 | uploader.bind('StateChanged', function() { 368 | if (uploader.state === plupload.STARTED) { 369 | $('li.plupload_delete a,div.plupload_buttons', target).hide(); 370 | $('span.plupload_upload_status,div.plupload_progress,a.plupload_stop', target).css('display', 'block'); 371 | $('span.plupload_upload_status', target).html('Uploaded ' + uploader.total.uploaded + '/' + uploader.files.length + ' files'); 372 | 373 | if (settings.multiple_queues) { 374 | $('span.plupload_total_status,span.plupload_total_file_size', target).show(); 375 | } 376 | } else { 377 | updateList(); 378 | $('a.plupload_stop,div.plupload_progress', target).hide(); 379 | $('a.plupload_delete', target).css('display', 'block'); 380 | 381 | if (settings.multiple_queues && uploader.total.uploaded + uploader.total.failed == uploader.files.length) { 382 | $(".plupload_buttons,.plupload_upload_status", target).css("display", "inline"); 383 | $(".plupload_start", target).addClass("plupload_disabled"); 384 | $('span.plupload_total_status,span.plupload_total_file_size', target).hide(); 385 | } 386 | } 387 | }); 388 | 389 | uploader.bind('FilesAdded', updateList); 390 | 391 | uploader.bind('FilesRemoved', function() { 392 | // since the whole file list is redrawn for every change in the queue 393 | // we need to scroll back to the file removal point to avoid annoying 394 | // scrolling to the bottom bug (see #926) 395 | var scrollTop = $('#' + id + '_filelist').scrollTop(); 396 | updateList(); 397 | $('#' + id + '_filelist').scrollTop(scrollTop); 398 | }); 399 | 400 | uploader.bind('FileUploaded', function(up, file) { 401 | handleStatus(file); 402 | }); 403 | 404 | uploader.bind("UploadProgress", function(up, file) { 405 | // Set file specific progress 406 | $('#' + file.id + ' div.plupload_file_status', target).html(file.percent + '%'); 407 | 408 | handleStatus(file); 409 | updateTotalProgress(); 410 | }); 411 | 412 | // Call setup function 413 | if (settings.setup) { 414 | settings.setup(uploader); 415 | } 416 | }); 417 | 418 | return this; 419 | } else { 420 | // Get uploader instance for specified element 421 | return uploaders[$(this[0]).attr('id')]; 422 | } 423 | }; 424 | })(jQuery, mOxie); 425 | -------------------------------------------------------------------------------- /demo/js/plupload/jquery.plupload.queue/jquery.plupload.queue.min.js: -------------------------------------------------------------------------------- 1 | ;(function(e,t){function r(e){return plupload.translate(e)||e}function i(t,n){n.contents().each(function(t,n){n=e(n),n.is(".plupload")||n.remove()}),n.prepend('
    '+'
    '+'
    '+'
    '+'
    '+r("Select files")+"
    "+'
    '+r("Add files to the upload queue and click the start button.")+"
    "+"
    "+"
    "+'
    '+'
    '+'
    '+r("Filename")+"
    "+'
     
    '+'
    '+r("Status")+"
    "+'
    '+r("Size")+"
    "+'
     
    '+"
    "+'
      '+'"+"
      "+"
      "+"
      "+''+"
      ")}var n={};e.fn.pluploadQueue=function(s){return s?(this.each(function(){function c(t){var n;t.status==plupload.DONE&&(n="plupload_done"),t.status==plupload.FAILED&&(n="plupload_failed"),t.status==plupload.QUEUED&&(n="plupload_delete"),t.status==plupload.UPLOADING&&(n="plupload_uploading");var r=e("#"+t.id).attr("class",n).find("a").css("display","block");t.hint&&r.attr("title",t.hint)}function h(){e("span.plupload_total_status",a).html(u.total.percent+"%"),e("div.plupload_progress_bar",a).css("width",u.total.percent+"%"),e("span.plupload_upload_status",a).html(t.sprintf(r("Uploaded %d/%d files"),u.total.uploaded,u.files.length))}function p(){var n=e("ul.plupload_filelist",a).html(""),i=0,s;e.each(u.files,function(t,r){s="",r.status==plupload.DONE&&(r.target_name&&(s+=''),s+='',s+='',i++,e("#"+f+"_count").val(i)),n.append('
    • '+'
      '+r.name+"
      "+'
      '+'
      '+r.percent+"%
      "+'
      '+plupload.formatSize(r.size)+"
      "+'
       
      '+s+"
    • "),c(r),e("#"+r.id+".plupload_delete a").click(function(t){e("#"+r.id).remove(),u.removeFile(r),t.preventDefault()})}),e("span.plupload_total_file_size",a).html(plupload.formatSize(u.total.size)),u.total.queued===0?e("span.plupload_add_text",a).html(r("Add Files")):e("span.plupload_add_text",a).html(t.sprintf(r("%d files queued"),u.total.queued)),e("a.plupload_start",a).toggleClass("plupload_disabled",u.files.length==u.total.uploaded+u.total.failed),n[0].scrollTop=n[0].scrollHeight,h(),!u.files.length&&u.features.dragdrop&&u.settings.dragdrop&&e("#"+f+"_filelist").append('
    • '+r("Drag files here.")+"
    • ")}function d(){delete n[f],u.destroy(),a.html(l),u=a=l=null}var u,a,f,l;a=e(this),f=a.attr("id"),f||(f=plupload.guid(),a.attr("id",f)),l=a.html(),i(f,a),s=e.extend({dragdrop:!0,browse_button:f+"_browse",container:f},s),s.dragdrop&&(s.drop_element=f+"_filelist"),u=new plupload.Uploader(s),n[f]=u,u.bind("UploadFile",function(t,n){e("#"+n.id).addClass("plupload_current_file")}),u.bind("Init",function(t,n){!s.unique_names&&s.rename&&a.on("click","#"+f+"_filelist div.plupload_file_name span",function(n){var r=e(n.target),i,s,o,u="";i=t.getFile(r.parents("li")[0].id),o=i.name,s=/^(.+)(\.[^.]+)$/.exec(o),s&&(o=s[1],u=s[2]),r.hide().after(''),r.next().val(o).focus().blur(function(){r.show().next().remove()}).keydown(function(t){var n=e(this);t.keyCode==13&&(t.preventDefault(),i.name=n.val()+u,r.html(i.name),n.blur())})}),e("#"+f+"_container").attr("title","Using runtime: "+n.runtime),e("a.plupload_start",a).click(function(t){e(this).hasClass("plupload_disabled")||u.start(),t.preventDefault()}),e("a.plupload_stop",a).click(function(e){e.preventDefault(),u.stop()}),e("a.plupload_start",a).addClass("plupload_disabled")}),u.bind("Error",function(t,n){var i=n.file,s;i&&(s=n.message,n.details&&(s+=" ("+n.details+")"),n.code==plupload.FILE_SIZE_ERROR&&alert(r("Error: File too large:")+" "+i.name),n.code==plupload.FILE_EXTENSION_ERROR&&alert(r("Error: Invalid file extension:")+" "+i.name),i.hint=s,e("#"+i.id).attr("class","plupload_failed").find("a").css("display","block").attr("title",s)),n.code===plupload.INIT_ERROR&&setTimeout(function(){d()},1)}),u.bind("PostInit",function(t){t.settings.dragdrop&&t.features.dragdrop&&e("#"+f+"_filelist").append('
    • '+r("Drag files here.")+"
    • ")}),u.init(),u.bind("StateChanged",function(){u.state===plupload.STARTED?(e("li.plupload_delete a,div.plupload_buttons",a).hide(),e("span.plupload_upload_status,div.plupload_progress,a.plupload_stop",a).css("display","block"),e("span.plupload_upload_status",a).html("Uploaded "+u.total.uploaded+"/"+u.files.length+" files"),s.multiple_queues&&e("span.plupload_total_status,span.plupload_total_file_size",a).show()):(p(),e("a.plupload_stop,div.plupload_progress",a).hide(),e("a.plupload_delete",a).css("display","block"),s.multiple_queues&&u.total.uploaded+u.total.failed==u.files.length&&(e(".plupload_buttons,.plupload_upload_status",a).css("display","inline"),e(".plupload_start",a).addClass("plupload_disabled"),e("span.plupload_total_status,span.plupload_total_file_size",a).hide()))}),u.bind("FilesAdded",p),u.bind("FilesRemoved",function(){var t=e("#"+f+"_filelist").scrollTop();p(),e("#"+f+"_filelist").scrollTop(t)}),u.bind("FileUploaded",function(e,t){c(t)}),u.bind("UploadProgress",function(t,n){e("#"+n.id+" div.plupload_file_status",a).html(n.percent+"%"),c(n),h()}),s.setup&&s.setup(u)}),this):n[e(this[0]).attr("id")]}})(jQuery,mOxie); -------------------------------------------------------------------------------- /demo/js/plupload/jquery.ui.plupload/css/jquery.ui.plupload.css: -------------------------------------------------------------------------------- 1 | /* 2 | Plupload 3 | ------------------------------------------------------------------- */ 4 | 5 | .plupload_button { 6 | cursor: pointer; 7 | outline: none; 8 | } 9 | 10 | .plupload_wrapper { 11 | font: normal 11px Verdana,sans-serif; 12 | width: 100%; 13 | min-width: 520px; 14 | } 15 | 16 | .plupload_container { 17 | _height: 300px; 18 | min-height: 300px; 19 | position: relative; 20 | } 21 | 22 | .plupload_filelist_footer {border-width: 1px 0 0 0} 23 | .plupload_file {border-width: 0 0 1px 0} 24 | .plupload_container .plupload_header {border-width: 0 0 1px 0; position: relative;} 25 | 26 | .plupload_delete .ui-icon, 27 | .plupload_done .ui-icon, 28 | .plupload_failed .ui-icon { 29 | cursor:pointer; 30 | } 31 | 32 | .plupload_header_content { 33 | height: 56px; 34 | padding: 0 160px 0 60px; 35 | position: relative; 36 | } 37 | 38 | .plupload_logo { 39 | width: 40px; 40 | height: 40px; 41 | background: url('../img/plupload.png') no-repeat 0 0; 42 | position: absolute; 43 | top: 8px; 44 | left: 8px; 45 | } 46 | 47 | .plupload_header_content_bw .plupload_logo { 48 | background-position: -40px 0; 49 | } 50 | 51 | .plupload_header_title { 52 | font: normal 18px sans-serif; 53 | padding: 6px 0 3px; 54 | } 55 | 56 | .plupload_header_text { 57 | font: normal 12px sans-serif; 58 | } 59 | 60 | .plupload_view_switch { 61 | position: absolute; 62 | right: 16px; 63 | bottom: 8px; 64 | margin: 0; 65 | display: none; 66 | } 67 | 68 | .plupload_view_switch .ui-button { 69 | margin-right: -0.31em; 70 | } 71 | 72 | .plupload_content { 73 | position: absolute; 74 | top: 87px; 75 | bottom: 44px; 76 | left: 0; 77 | right: 0; 78 | overflow-y: auto; 79 | width: 100%; 80 | } 81 | 82 | .plupload_filelist { 83 | border-collapse: collapse; 84 | border-left: none; 85 | border-right: none; 86 | margin: 0; 87 | padding: 0; 88 | width: 100%; 89 | -moz-user-select: none; 90 | -webkit-user-select: none; 91 | user-select: none; 92 | } 93 | 94 | .plupload_filelist_content { 95 | padding: 0; 96 | margin: 0; 97 | } 98 | 99 | .plupload_cell {padding: 8px 6px;} 100 | 101 | .plupload_file { 102 | list-style: none; 103 | display: block; 104 | position: relative; 105 | overflow: hidden; 106 | width: 100%; 107 | } 108 | 109 | .plupload_file_thumb { 110 | position: absolute; 111 | left: 6px; 112 | top: 6px; 113 | background: #eee url(../img/loading.gif) center no-repeat; 114 | } 115 | 116 | .plupload_file_thumb_loaded .plupload_file_thumb { 117 | background-image: none; 118 | } 119 | 120 | .plupload_file_name { 121 | overflow: hidden; 122 | text-overflow: ellipsis; 123 | white-space: nowrap; 124 | } 125 | 126 | .plupload_filelist_header { 127 | border-top: none; 128 | } 129 | 130 | .plupload_filelist_footer { 131 | position: absolute; 132 | bottom: 0; 133 | left: 0; 134 | right: 0; 135 | } 136 | 137 | .plupload_buttons { 138 | position: relative; 139 | } 140 | 141 | /* list view */ 142 | .plupload_view_list .plupload_file { 143 | border-left: none; 144 | border-right: none; 145 | border-top: none; 146 | height: 29px; 147 | } 148 | 149 | .plupload_view_list div.plupload_file_size, 150 | .plupload_view_list div.plupload_file_status, 151 | .plupload_view_list div.plupload_file_action { 152 | padding: 8px 6px; 153 | position: absolute; 154 | top: 0; 155 | right: 0; 156 | } 157 | 158 | .plupload_view_list div.plupload_file_name { 159 | margin-right: 156px; 160 | padding: 8px 6px; 161 | _width: 75%; 162 | } 163 | 164 | .plupload_view_list div.plupload_file_size { 165 | right: 28px; 166 | } 167 | 168 | .plupload_view_list div.plupload_file_status { 169 | right: 82px; 170 | } 171 | 172 | .plupload_view_list .plupload_file_rename { 173 | margin-left: -2px; 174 | } 175 | 176 | .plupload_view_list .plupload_file_size, 177 | .plupload_view_list .plupload_file_status, 178 | .plupload_filelist_footer .plupload_file_size, 179 | .plupload_filelist_footer .plupload_file_status { 180 | text-align: right; 181 | width: 52px; 182 | } 183 | 184 | .plupload_view_list .plupload_file_thumb, 185 | .plupload_view_list .plupload_file_dummy { 186 | top: -999px; 187 | } 188 | 189 | .plupload_view_list .plupload_file_progress { 190 | display: none; 191 | } 192 | 193 | 194 | /* thumbs view */ 195 | .plupload_view_thumbs .plupload_content { 196 | top: 57px; 197 | } 198 | 199 | .plupload_view_thumbs .plupload_filelist_header { 200 | display: none; 201 | } 202 | 203 | .plupload_view_thumbs .plupload_file { 204 | width: 100px; 205 | padding: 72px 6px 6px; 206 | margin: 10px; 207 | border: 1px solid #fff; 208 | float: left; 209 | } 210 | 211 | .plupload_view_thumbs .plupload_file_thumb, 212 | .plupload_view_thumbs .plupload_file_dummy { 213 | width: 100px; 214 | height: 60px; 215 | text-align: center; 216 | overflow: hidden; 217 | } 218 | 219 | .plupload_view_thumbs .plupload_file_dummy { 220 | font-size: 21px; 221 | font-weight: bold; 222 | text-transform: lowercase; 223 | overflow: hidden; 224 | line-height: 60px; 225 | border: none; 226 | } 227 | 228 | .plupload_view_thumbs div.plupload_file_action { 229 | position: absolute; 230 | top: 0; 231 | right: 0; 232 | } 233 | 234 | .plupload_view_thumbs div.plupload_file_name { 235 | padding: 0; 236 | font-weight: bold; 237 | } 238 | 239 | .plupload_view_thumbs .plupload_file_rename { 240 | padding: 1px 0; 241 | width: 100% !important; 242 | } 243 | 244 | .plupload_view_thumbs div.plupload_file_size { 245 | font-size: 0.8em; 246 | font-weight: normal; 247 | } 248 | 249 | .plupload_view_thumbs div.plupload_file_status { 250 | position: absolute; 251 | top: 67px; 252 | left: 6px; 253 | width: 100px; 254 | height: 3px; 255 | overflow: hidden; 256 | text-indent: -999px; 257 | } 258 | 259 | .plupload_view_thumbs div.plupload_file_progress { 260 | border: none; 261 | height: 100%; 262 | } 263 | 264 | .plupload .ui-sortable-helper, 265 | .plupload .ui-sortable .plupload_file { 266 | cursor:move; 267 | } 268 | 269 | .plupload_file_action {width: 16px;} 270 | .plupload_file_name { 271 | overflow: hidden; 272 | padding-left: 10px; 273 | } 274 | 275 | .plupload_file_rename { 276 | border: none; 277 | font: normal 11px Verdana, sans-serif; 278 | padding: 1px 2px; 279 | line-height: 11px; 280 | height: 11px; 281 | } 282 | 283 | .plupload_progress {width: 60px;} 284 | .plupload_progress_container {padding: 1px;} 285 | 286 | 287 | /* Floats */ 288 | 289 | .plupload_right {float: right;} 290 | .plupload_left {float: left;} 291 | .plupload_clear,.plupload_clearer {clear: both;} 292 | .plupload_clearer, .plupload_progress_bar { 293 | display: block; 294 | font-size: 0; 295 | line-height: 0; 296 | } 297 | .plupload_clearer {height: 0;} 298 | 299 | /* Misc */ 300 | .plupload_hidden {display: none;} 301 | 302 | .plupload_droptext { 303 | position: absolute; 304 | top: 0; 305 | left: 0; 306 | right: 0; 307 | bottom: 0; 308 | background: transparent; 309 | text-align: center; 310 | vertical-align: middle; 311 | border: 0; 312 | line-height: 160px; 313 | display: none; 314 | } 315 | 316 | .plupload_dropbox .plupload_droptext { 317 | display: block; 318 | } 319 | 320 | .plupload_buttons, .plupload_upload_status {float: left} 321 | 322 | .plupload_message { 323 | position: absolute; 324 | top: -1px; 325 | left: -1px; 326 | height: 100%; 327 | width: 100%; 328 | } 329 | 330 | .plupload_message p { 331 | padding:0.7em; 332 | margin:0; 333 | } 334 | 335 | .plupload_message strong { 336 | font-weight: bold; 337 | } 338 | 339 | plupload_message i { 340 | font-style: italic; 341 | } 342 | 343 | .plupload_message p span.ui-icon { 344 | float: left; 345 | margin-right: 0.3em; 346 | } 347 | 348 | .plupload_header_content .ui-state-error, 349 | .plupload_header_content .ui-state-highlight { 350 | border:none; 351 | } 352 | 353 | .plupload_message_close { 354 | position:absolute; 355 | top:5px; 356 | right:5px; 357 | cursor:pointer; 358 | } 359 | 360 | .plupload .ui-sortable-placeholder { 361 | height:35px; 362 | } 363 | -------------------------------------------------------------------------------- /demo/js/plupload/jquery.ui.plupload/img/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bearyinnovative/qiniu-js-sdk/6675d08ed9661f76cae30e8a6b77eee3cf17c88f/demo/js/plupload/jquery.ui.plupload/img/loading.gif -------------------------------------------------------------------------------- /demo/js/plupload/jquery.ui.plupload/img/plupload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bearyinnovative/qiniu-js-sdk/6675d08ed9661f76cae30e8a6b77eee3cf17c88f/demo/js/plupload/jquery.ui.plupload/img/plupload.png -------------------------------------------------------------------------------- /demo/js/plupload/jquery.ui.plupload/jquery.ui.plupload.min.js: -------------------------------------------------------------------------------- 1 | ;(function(e,t,n,r,i){function o(e){return n.translate(e)||e}function u(e){e.id=e.attr("id"),e.html('
      '+o("Select files")+"
      "+'
      '+o("Add files to the upload queue and click the start button.")+"
      "+'
      '+'"+'"+"
      "+"
      "+"
      "+''+""+'"+'"+'"+''+""+"
      '+o("Filename")+"'+o("Status")+"'+o("Size")+" 
      "+'
      '+'
      '+o("Drag files here.")+"
      "+'
      '+'
       
      '+"
      "+''+""+'"+''+''+''+""+""+"
      "+''+"
      ")}var s={};i.widget("ui.plupload",{widgetEventPrefix:"",contents_bak:"",options:{browse_button_hover:"ui-state-hover",browse_button_active:"ui-state-active",dragdrop:!0,multiple_queues:!0,buttons:{browse:!0,start:!0,stop:!0},views:{list:!0,thumbs:!1,active:"list",remember:!0},autostart:!1,sortable:!1,rename:!1,max_file_count:0},FILE_COUNT_ERROR:-9001,_create:function(){var e=this.element.attr("id");e||(e=n.guid(),this.element.attr("id",e)),this.id=e,this.contents_bak=this.element.html(),u(this.element),this.container=i(".plupload_container",this.element).attr("id",e+"_container"),this.content=i(".plupload_content",this.element),i.fn.resizable&&this.container.resizable({handles:"s",minHeight:300}),this.filelist=i(".plupload_filelist_content",this.container).attr({id:e+"_filelist",unselectable:"on"}),this.browse_button=i(".plupload_add",this.container).attr("id",e+"_browse"),this.start_button=i(".plupload_start",this.container).attr("id",e+"_start"),this.stop_button=i(".plupload_stop",this.container).attr("id",e+"_stop"),this.thumbs_switcher=i("#"+e+"_view_thumbs"),this.list_switcher=i("#"+e+"_view_list"),i.ui.button&&(this.browse_button.button({icons:{primary:"ui-icon-circle-plus"},disabled:!0}),this.start_button.button({icons:{primary:"ui-icon-circle-arrow-e"},disabled:!0}),this.stop_button.button({icons:{primary:"ui-icon-circle-close"}}),this.list_switcher.button({text:!1,icons:{secondary:"ui-icon-grip-dotted-horizontal"}}),this.thumbs_switcher.button({text:!1,icons:{secondary:"ui-icon-image"}})),this.progressbar=i(".plupload_progress_container",this.container),i.ui.progressbar&&this.progressbar.progressbar(),this.counter=i(".plupload_count",this.element).attr({id:e+"_count",name:e+"_count"}),this._initUploader()},_initUploader:function(){var e=this,t=this.id,u,a={container:t+"_buttons",browse_button:t+"_browse"};i(".plupload_buttons",this.element).attr("id",t+"_buttons"),e.options.dragdrop&&(this.filelist.parent().attr("id",this.id+"_dropbox"),a.drop_element=this.id+"_dropbox"),u=this.uploader=s[t]=new n.Uploader(i.extend(this.options,a)),e.options.views.thumbs&&(u.settings.required_features.display_media=!0),u.bind("Error",function(t,i){var s,u="";s=""+i.message+"";switch(i.code){case n.FILE_EXTENSION_ERROR:u=r.sprintf(o("File: %s"),i.file.name);break;case n.FILE_SIZE_ERROR:u=r.sprintf(o("File: %s, size: %d, max file size: %d"),i.file.name,i.file.size,n.parseSize(e.options.max_file_size));break;case n.FILE_DUPLICATE_ERROR:u=r.sprintf(o("%s already present in the queue."),i.file.name);break;case e.FILE_COUNT_ERROR:u=r.sprintf(o("Upload element accepts only %d file(s) at a time. Extra files were stripped."),e.options.max_file_count);break;case n.IMAGE_FORMAT_ERROR:u=o("Image format either wrong or not supported.");break;case n.IMAGE_MEMORY_ERROR:u=o("Runtime ran out of available memory.");break;case n.HTTP_ERROR:u=o("Upload URL might be wrong or doesn't exist.")}s+="
      "+u+"",e._trigger("error",null,{up:t,error:i}),i.code===n.INIT_ERROR?setTimeout(function(){e.destroy()},1):e.notify("error",s)}),u.bind("PostInit",function(t){e.options.buttons.browse?e.browse_button.button("enable"):(e.browse_button.button("disable").hide(),t.disableBrowse(!0)),e.options.buttons.start||e.start_button.button("disable").hide(),e.options.buttons.stop||e.stop_button.button("disable").hide(),!e.options.unique_names&&e.options.rename&&e._enableRenaming(),e.options.dragdrop&&t.features.dragdrop&&e.filelist.parent().addClass("plupload_dropbox"),e._enableViewSwitcher(),e.start_button.click(function(t){i(this).button("option","disabled")||e.start(),t.preventDefault()}),e.stop_button.click(function(t){e.stop(),t.preventDefault()}),e._trigger("ready",null,{up:t})}),e.options.max_file_count&&(e.options.multiple_queues=!1,u.bind("FilesAdded",function(t,n){var r=n.length,i=t.files.length+r-e.options.max_file_count;i>0&&(n.splice(r-i,i),t.trigger("Error",{code:e.FILE_COUNT_ERROR,message:o("File count error.")}))})),u.init(),u.bind("FileFiltered",function(t,n){e._addFiles(n)}),u.bind("FilesAdded",function(t,n){e._trigger("selected",null,{up:t,files:n}),e.options.sortable&&i.ui.sortable&&e._enableSortingList(),e._trigger("updatelist",null,{filelist:e.filelist}),e.options.autostart&&setTimeout(function(){e.start()},10)}),u.bind("FilesRemoved",function(t,n){e._trigger("removed",null,{up:t,files:n})}),u.bind("QueueChanged StateChanged",function(){e._handleState()}),u.bind("UploadFile",function(t,n){e._handleFileStatus(n)}),u.bind("FileUploaded",function(t,n){e._handleFileStatus(n),e._trigger("uploaded",null,{up:t,file:n})}),u.bind("UploadProgress",function(t,n){e._handleFileStatus(n),e._updateTotalProgress(),e._trigger("progress",null,{up:t,file:n})}),u.bind("UploadComplete",function(t,n){e._addFormFields(),e._trigger("complete",null,{up:t,files:n})})},_setOption:function(e,t){var n=this;e=="buttons"&&typeof t=="object"&&(t=i.extend(n.options.buttons,t),t.browse?(n.browse_button.button("enable").show(),n.uploader.disableBrowse(!1)):(n.browse_button.button("disable").hide(),n.uploader.disableBrowse(!0)),t.start?n.start_button.button("enable").show():n.start_button.button("disable").hide(),t.stop?n.start_button.button("enable").show():n.stop_button.button("disable").hide()),n.uploader.settings[e]=t},start:function(){this.uploader.start(),this._trigger("start",null,{up:this.uploader})},stop:function(){this.uploader.stop(),this._trigger("stop",null,{up:this.uploader})},enable:function(){this.browse_button.button("enable"),this.uploader.disableBrowse(!1)},disable:function(){this.browse_button.button("disable"),this.uploader.disableBrowse(!0)},getFile:function(e){var t;return typeof e=="number"?t=this.uploader.files[e]:t=this.uploader.getFile(e),t},getFiles:function(){return this.uploader.files},removeFile:function(e){n.typeOf(e)==="string"&&(e=this.getFile(e)),this._removeFiles(e)},clearQueue:function(){this.uploader.splice()},getUploader:function(){return this.uploader},refresh:function(){this.uploader.refresh()},notify:function(e,t){var n=i('
      '+'

      '+t+"

      "+"
      ");n.addClass("ui-state-"+(e==="error"?"error":"highlight")).find("p .ui-icon").addClass("ui-icon-"+(e==="error"?"alert":"info")).end().find(".plupload_message_close").click(function(){n.remove()}).end(),i(".plupload_header",this.container).append(n)},destroy:function(){this._removeFiles([].slice.call(this.uploader.files)),this.uploader.destroy(),i(".plupload_button",this.element).unbind(),i.ui.button&&i(".plupload_add, .plupload_start, .plupload_stop",this.container).button("destroy"),i.ui.progressbar&&this.progressbar.progressbar("destroy"),i.ui.sortable&&this.options.sortable&&i("tbody",this.filelist).sortable("destroy"),this.element.empty().html(this.contents_bak),this.contents_bak="",i.Widget.prototype.destroy.apply(this)},_handleState:function(){var e=this.uploader;e.state===n.STARTED?(i(this.start_button).button("disable"),i([]).add(this.stop_button).add(".plupload_started").removeClass("plupload_hidden"),i(".plupload_upload_status",this.element).html(r.sprintf(o("Uploaded %d/%d files"),e.total.uploaded,e.files.length)),i(".plupload_header_content",this.element).addClass("plupload_header_content_bw")):e.state===n.STOPPED&&(i([]).add(this.stop_button).add(".plupload_started").addClass("plupload_hidden"),this.options.multiple_queues?i(".plupload_header_content",this.element).removeClass("plupload_header_content_bw"):(i([]).add(this.browse_button).add(this.start_button).button("disable"),e.disableBrowse()),e.files.length===e.total.uploaded+e.total.failed?this.start_button.button("disable"):this.start_button.button("enable"),this._updateTotalProgress()),e.total.queued===0?i(".ui-button-text",this.browse_button).html(o("Add Files")):i(".ui-button-text",this.browse_button).html(r.sprintf(o("%d files queued"),e.total.queued)),e.refresh()},_handleFileStatus:function(e){var t=this,r,s;if(!i("#"+e.id).length)return;switch(e.status){case n.DONE:r="plupload_done",s="ui-icon ui-icon-circle-check";break;case n.FAILED:r="ui-state-error plupload_failed",s="ui-icon ui-icon-alert";break;case n.QUEUED:r="plupload_delete",s="ui-icon ui-icon-circle-minus";break;case n.UPLOADING:r="ui-state-highlight plupload_uploading",s="ui-icon ui-icon-circle-arrow-w";var o=i(".plupload_scroll",this.container),u=o.scrollTop(),a=o.height(),f=i("#"+e.id).position().top+i("#"+e.id).height();a
      %ext%
      %name%
      %size%
      %percent%
      ',n.typeOf(e)!=="array"&&(e=[e]),i.each(e,function(e,i){var o=r.Mime.getFileExtension(i.name)||"none";t.filelist.append(s.replace(/%(\w+)%/g,function(e,t){return"size"===t?n.formatSize(i.size):"ext"===t?o:i[t]||""})),t._handleFileStatus(i)})},_removeFiles:function(e){var t=this,r=this.uploader;n.typeOf(e)!=="array"&&(e=[e]),i.ui.sortable&&this.options.sortable&&i("tbody",t.filelist).sortable("destroy"),i.each(e,function(e,t){i("#"+t.id).toggle("highlight",function(){this.remove()}),r.removeFile(t)}),r.files.length&&this.options.sortable&&i.ui.sortable&&this._enableSortingList(),this._trigger("updatelist",null,{filelist:this.filelist})},_addFormFields:function(){var e=this;i(".plupload_file_fields",this.filelist).html(""),n.each(this.uploader.files,function(t,r){var s="",o=e.id+"_"+r;t.target_name&&(s+=''),s+='',s+='',i("#"+t.id).find(".plupload_file_fields").html(s)}),this.counter.val(this.uploader.files.length)},_viewChanged:function(e){this.options.views.remember&&i.cookie&&i.cookie("plupload_ui_view",e,{expires:7,path:"/"}),r.Env.browser==="IE"&&r.Env.version<7&&this.content.attr("style",'height:expression(document.getElementById("'+this.id+"_container"+'").clientHeight - '+(e==="list"?133:103)+");"),this.container.removeClass("plupload_view_list plupload_view_thumbs").addClass("plupload_view_"+e),this.view_mode=e,this._trigger("viewchanged",null,{view:e})},_enableViewSwitcher:function(){var e=this,t,r=i(".plupload_view_switch",this.container),s,o;n.each(["list","thumbs"],function(t){e.options.views[t]||r.find('[for="'+e.id+"_view_"+t+'"], #'+e.id+"_view_"+t).remove()}),s=r.find(".plupload_button"),s.length===1?(r.hide(),t=s.eq(0).data("view"),this._viewChanged(t)):i.ui.button&&s.length>1?(this.options.views.remember&&i.cookie&&(t=i.cookie("plupload_ui_view")),~n.inArray(t,["list","thumbs"])||(t=this.options.views.active),r.show().buttonset().find(".ui-button").click(function(n){t=i(this).data("view"),e._viewChanged(t),n.preventDefault()}),o=r.find('[for="'+e.id+"_view_"+t+'"]'),o.length&&o.trigger("click")):(r.show(),this._viewChanged(this.options.views.active)),this.options.views.thumbs&&this._displayThumbs()},_enableRenaming:function(){var e=this;this.filelist.dblclick(function(t){var n=i(t.target),r,s,o,u,a="";if(!n.hasClass("plupload_file_namespan"))return;s=e.uploader.getFile(n.closest(".plupload_file")[0].id),u=s.name,o=/^(.+)(\.[^.]+)$/.exec(u),o&&(u=o[1],a=o[2]),r=i('').width(n.width()).insertAfter(n.hide()),r.val(u).blur(function(){n.show().parent().scrollLeft(0).end().next().remove()}).keydown(function(e){var t=i(this);i.inArray(e.keyCode,[13,27])!==-1&&(e.preventDefault(),e.keyCode===13&&(s.name=t.val()+a,n.html(s.name)),t.blur())})[0].focus()})},_enableSortingList:function(){var e=this;if(i(".plupload_file",this.filelist).length<2)return;i("tbody",this.filelist).sortable("destroy"),this.filelist.sortable({items:".plupload_delete",cancel:"object, .plupload_clearer",stop:function(){var t=[];i.each(i(this).sortable("toArray"),function(n,r){t[t.length]=e.uploader.getFile(r)}),t.unshift(t.length),t.unshift(0),Array.prototype.splice.apply(e.uploader.files,t)}})}})})(window,document,plupload,mOxie,jQuery); -------------------------------------------------------------------------------- /demo/js/plupload/plupload.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Plupload - multi-runtime File Uploader 3 | * v2.1.1 4 | * 5 | * Copyright 2013, Moxiecode Systems AB 6 | * Released under GPL License. 7 | * 8 | * License: http://www.plupload.com/license 9 | * Contributing: http://www.plupload.com/contributing 10 | * 11 | * Date: 2014-01-16 12 | */ 13 | ;(function(e,t,n){function s(e){function r(e,t,r){var i={chunks:"slice_blob",jpgresize:"send_binary_string",pngresize:"send_binary_string",progress:"report_upload_progress",multi_selection:"select_multiple",dragdrop:"drag_and_drop",drop_element:"drag_and_drop",headers:"send_custom_headers",canSendBinary:"send_binary",triggerDialog:"summon_file_dialog"};i[e]?n[i[e]]=t:r||(n[e]=t)}var t=e.required_features,n={};return typeof t=="string"?o.each(t.split(/\s*,\s*/),function(e){r(e,!0)}):typeof t=="object"?o.each(t,function(e,t){r(t,e)}):t===!0&&(e.multipart||(n.send_binary_string=!0),e.chunk_size>0&&(n.slice_blob=!0),e.resize.enabled&&(n.send_binary_string=!0),o.each(e,function(e,t){r(t,!!e,!0)})),n}var r=e.setTimeout,i={},o={VERSION:"2.1.1",STOPPED:1,STARTED:2,QUEUED:1,UPLOADING:2,FAILED:4,DONE:5,GENERIC_ERROR:-100,HTTP_ERROR:-200,IO_ERROR:-300,SECURITY_ERROR:-400,INIT_ERROR:-500,FILE_SIZE_ERROR:-600,FILE_EXTENSION_ERROR:-601,FILE_DUPLICATE_ERROR:-602,IMAGE_FORMAT_ERROR:-700,IMAGE_MEMORY_ERROR:-701,IMAGE_DIMENSIONS_ERROR:-702,mimeTypes:t.mimes,ua:t.ua,typeOf:t.typeOf,extend:t.extend,guid:t.guid,get:function(n){var r=[],i;t.typeOf(n)!=="array"&&(n=[n]);var s=n.length;while(s--)i=t.get(n[s]),i&&r.push(i);return r.length?r:null},each:t.each,getPos:t.getPos,getSize:t.getSize,xmlEncode:function(e){var t={"<":"lt",">":"gt","&":"amp",'"':"quot","'":"#39"},n=/[<>&\"\']/g;return e?(""+e).replace(n,function(e){return t[e]?"&"+t[e]+";":e}):e},toArray:t.toArray,inArray:t.inArray,addI18n:t.addI18n,translate:t.translate,isEmptyObj:t.isEmptyObj,hasClass:t.hasClass,addClass:t.addClass,removeClass:t.removeClass,getStyle:t.getStyle,addEvent:t.addEvent,removeEvent:t.removeEvent,removeAllEvents:t.removeAllEvents,cleanName:function(e){var t,n;n=[/[\300-\306]/g,"A",/[\340-\346]/g,"a",/\307/g,"C",/\347/g,"c",/[\310-\313]/g,"E",/[\350-\353]/g,"e",/[\314-\317]/g,"I",/[\354-\357]/g,"i",/\321/g,"N",/\361/g,"n",/[\322-\330]/g,"O",/[\362-\370]/g,"o",/[\331-\334]/g,"U",/[\371-\374]/g,"u"];for(t=0;t0?"&":"?")+n),e},formatSize:function(e){function t(e,t){return Math.round(e*Math.pow(10,t))/Math.pow(10,t)}if(e===n||/\D/.test(e))return o.translate("N/A");var r=Math.pow(1024,4);return e>r?t(e/r,1)+" "+o.translate("tb"):e>(r/=1024)?t(e/r,1)+" "+o.translate("gb"):e>(r/=1024)?t(e/r,1)+" "+o.translate("mb"):e>1024?Math.round(e/1024)+" "+o.translate("kb"):e+" "+o.translate("b")},parseSize:t.parseSizeStr,predictRuntime:function(e,n){var r,i;return r=new o.Uploader(e),i=t.Runtime.thatCan(r.getOption().required_features,n||e.runtimes),r.destroy(),i},addFileFilter:function(e,t){i[e]=t}};o.addFileFilter("mime_types",function(e,t,n){e.length&&!e.regexp.test(t.name)?(this.trigger("Error",{code:o.FILE_EXTENSION_ERROR,message:o.translate("File extension error."),file:t}),n(!1)):n(!0)}),o.addFileFilter("max_file_size",function(e,t,n){var r;e=o.parseSize(e),t.size!==r&&e&&t.size>e?(this.trigger("Error",{code:o.FILE_SIZE_ERROR,message:o.translate("File size error."),file:t}),n(!1)):n(!0)}),o.addFileFilter("prevent_duplicates",function(e,t,n){if(e){var r=this.files.length;while(r--)if(t.name===this.files[r].name&&t.size===this.files[r].size){this.trigger("Error",{code:o.FILE_DUPLICATE_ERROR,message:o.translate("Duplicate file error."),file:t}),n(!1);return}}n(!0)}),o.Uploader=function(e){function g(){var e,t=0,n;if(this.state==o.STARTED){for(n=0;n0?Math.ceil(e.loaded/e.size*100):100,b()}function b(){var e,t;d.reset();for(e=0;e0?Math.ceil(d.uploaded/f.length*100):0:(d.bytesPerSec=Math.ceil(d.loaded/((+(new Date)-p||1)/1e3)),d.percent=d.size>0?Math.ceil(d.loaded/d.size*100):0)}function w(){var e=c[0]||h[0];return e?e.getRuntime().uid:!1}function E(e,n){if(e.ruid){var r=t.Runtime.getInfo(e.ruid);if(r)return r.can(n)}return!1}function S(){this.bind("FilesAdded",C),this.bind("CancelUpload",M),this.bind("BeforeUpload",k),this.bind("UploadFile",L),this.bind("UploadProgress",A),this.bind("StateChanged",O),this.bind("QueueChanged",b),this.bind("Error",D),this.bind("FileUploaded",_),this.bind("Destroy",P)}function x(e,n){var r=this,i=0,s=[],u={accept:e.filters.mime_types,runtime_order:e.runtimes,required_caps:e.required_features,preferred_caps:l,swf_url:e.flash_swf_url,xap_url:e.silverlight_xap_url};o.each(e.runtimes.split(/\s*,\s*/),function(t){e[t]&&(u[t]=e[t])}),e.browse_button&&o.each(e.browse_button,function(n){s.push(function(s){var a=new t.FileInput(o.extend({},u,{name:e.file_data_name,multiple:e.multi_selection,container:e.container,browse_button:n}));a.onready=function(){var e=t.Runtime.getInfo(this.ruid);t.extend(r.features,{chunks:e.can("slice_blob"),multipart:e.can("send_multipart"),multi_selection:e.can("select_multiple")}),i++,c.push(this),s()},a.onchange=function(){r.addFile(this.files)},a.bind("mouseenter mouseleave mousedown mouseup",function(r){v||(e.browse_button_hover&&("mouseenter"===r.type?t.addClass(n,e.browse_button_hover):"mouseleave"===r.type&&t.removeClass(n,e.browse_button_hover)),e.browse_button_active&&("mousedown"===r.type?t.addClass(n,e.browse_button_active):"mouseup"===r.type&&t.removeClass(n,e.browse_button_active)))}),a.bind("error runtimeerror",function(){a=null,s()}),a.init()})}),e.drop_element&&o.each(e.drop_element,function(e){s.push(function(n){var s=new t.FileDrop(o.extend({},u,{drop_zone:e}));s.onready=function(){var e=t.Runtime.getInfo(this.ruid);r.features.dragdrop=e.can("drag_and_drop"),i++,h.push(this),n()},s.ondrop=function(){r.addFile(this.files)},s.bind("error runtimeerror",function(){s=null,n()}),s.init()})}),t.inSeries(s,function(){typeof n=="function"&&n(i)})}function T(e,n,r){var i=new t.Image;try{i.onload=function(){i.downsize(n.width,n.height,n.crop,n.preserve_headers)},i.onresize=function(){r(this.getAsBlob(e.type,n.quality)),this.destroy()},i.onerror=function(){r(e)},i.load(e)}catch(s){r(e)}}function N(e,n,r){function f(e,t,n){var r=a[e];switch(e){case"max_file_size":e==="max_file_size"&&(a.max_file_size=a.filters.max_file_size=t);break;case"chunk_size":if(t=o.parseSize(t))a[e]=t;break;case"filters":o.typeOf(t)==="array"&&(t={mime_types:t}),n?o.extend(a.filters,t):a.filters=t,t.mime_types&&(a.filters.mime_types.regexp=function(e){var t=[];return o.each(e,function(e){o.each(e.extensions.split(/,/),function(e){/^\s*\*\s*$/.test(e)?t.push("\\.*"):t.push("\\."+e.replace(new RegExp("["+"/^$.*+?|()[]{}\\".replace(/./g,"\\$&")+"]","g"),"\\$&"))})}),new RegExp("("+t.join("|")+")$","i")}(a.filters.mime_types));break;case"resize":n?o.extend(a.resize,t,{enabled:!0}):a.resize=t;break;case"prevent_duplicates":a.prevent_duplicates=a.filters.prevent_duplicates=!!t;break;case"browse_button":case"drop_element":t=o.get(t);case"container":case"runtimes":case"multi_selection":case"flash_swf_url":case"silverlight_xap_url":a[e]=t,n||(u=!0);break;default:a[e]=t}n||i.trigger("OptionChanged",e,t,r)}var i=this,u=!1;typeof e=="object"?o.each(e,function(e,t){f(t,e,r)}):f(e,n,r),r?(a.required_features=s(o.extend({},a)),l=s(o.extend({},a,{required_features:!0}))):u&&(i.trigger("Destroy"),x.call(i,a,function(e){e?(i.runtime=t.Runtime.getInfo(w()).type,i.trigger("Init",{runtime:i.runtime}),i.trigger("PostInit")):i.trigger("Error",{code:o.INIT_ERROR,message:o.translate("Init error.")})}))}function C(e,t){[].push.apply(f,t),e.trigger("QueueChanged"),e.refresh()}function k(e,t){if(a.unique_names){var n=t.name.match(/\.([^.]+)$/),r="part";n&&(r=n[1]),t.target_name=t.id+"."+r}}function L(e,n){function h(){u-->0?r(p,1e3):(n.loaded=f,e.trigger("Error",{code:o.HTTP_ERROR,message:o.translate("HTTP Error."),file:n,response:m.responseText,status:m.status,responseHeaders:m.getAllResponseHeaders()}))}function p(){var d,v,g,y;if(n.status==o.DONE||n.status==o.FAILED||e.state==o.STOPPED)return;g={name:n.target_name||n.name},s&&a.chunks&&c.size>s?(y=Math.min(s,c.size-f),d=c.slice(f,f+y)):(y=c.size,d=c),s&&a.chunks&&(e.settings.send_chunk_number?(g.chunk=Math.ceil(f/s),g.chunks=Math.ceil(c.size/s)):(g.offset=f,g.total=c.size)),m=new t.XMLHttpRequest,m.upload&&(m.upload.onprogress=function(t){n.loaded=Math.min(n.size,f+t.loaded),e.trigger("UploadProgress",n)}),m.onload=function(){if(m.status>=400){h();return}u=e.settings.max_retries,y=c.size?(n.size!=n.origSize&&(c.destroy(),c=null),e.trigger("UploadProgress",n),n.status=o.DONE,e.trigger("FileUploaded",n,{response:m.responseText,status:m.status,responseHeaders:m.getAllResponseHeaders()})):r(p,1)},m.onerror=function(){h()},m.onloadend=function(){this.destroy(),m=null},e.settings.multipart&&a.multipart?(g.name=n.target_name||n.name,m.open("post",i,!0),o.each(e.settings.headers,function(e,t){m.setRequestHeader(t,e)}),v=new t.FormData,o.each(o.extend(g,e.settings.multipart_params),function(e,t){v.append(t,e)}),v.append(e.settings.file_data_name,d),m.send(v,{runtime_order:e.settings.runtimes,required_caps:e.settings.required_features,preferred_caps:l,swf_url:e.settings.flash_swf_url,xap_url:e.settings.silverlight_xap_url})):(i=o.buildUrl(e.settings.url,o.extend(g,e.settings.multipart_params)),m.open("post",i,!0),m.setRequestHeader("Content-Type","application/octet-stream"),o.each(e.settings.headers,function(e,t){m.setRequestHeader(t,e)}),m.send(d,{runtime_order:e.settings.runtimes,required_caps:e.settings.required_features,preferred_caps:l,swf_url:e.settings.flash_swf_url,xap_url:e.settings.silverlight_xap_url}))}var i=e.settings.url,s=e.settings.chunk_size,u=e.settings.max_retries,a=e.features,f=0,c;n.loaded&&(f=n.loaded=s*Math.floor(n.loaded/s)),c=n.getSource(),e.settings.resize.enabled&&E(c,"send_binary_string")&&!!~t.inArray(c.type,["image/jpeg","image/png"])?T.call(this,c,e.settings.resize,function(e){c=e,n.size=e.size,p()}):p()}function A(e,t){y(t)}function O(e){if(e.state==o.STARTED)p=+(new Date);else if(e.state==o.STOPPED)for(var t=e.files.length-1;t>=0;t--)e.files[t].status==o.UPLOADING&&(e.files[t].status=o.QUEUED,b())}function M(){m&&m.abort()}function _(e){b(),r(function(){g.call(e)},1)}function D(e,t){t.file&&(t.file.status=o.FAILED,y(t.file),e.state==o.STARTED&&(e.trigger("CancelUpload"),r(function(){g.call(e)},1)))}function P(e){e.stop(),o.each(f,function(e){e.destroy()}),f=[],c.length&&(o.each(c,function(e){e.destroy()}),c=[]),h.length&&(o.each(h,function(e){e.destroy()}),h=[]),l={},v=!1,p=m=null,d.reset()}var u=o.guid(),a,f=[],l={},c=[],h=[],p,d,v=!1,m;a={runtimes:t.Runtime.order,max_retries:0,chunk_size:0,multipart:!0,multi_selection:!0,file_data_name:"file",flash_swf_url:"js/Moxie.swf",silverlight_xap_url:"js/Moxie.xap",filters:{mime_types:[],prevent_duplicates:!1,max_file_size:0},resize:{enabled:!1,preserve_headers:!0,crop:!1},send_chunk_number:!0},N.call(this,e,null,!0),d=new o.QueueProgress,o.extend(this,{id:u,uid:u,state:o.STOPPED,features:{},runtime:null,files:f,settings:a,total:d,init:function(){var e=this;typeof a.preinit=="function"?a.preinit(e):o.each(a.preinit,function(t,n){e.bind(n,t)});if(!a.browse_button||!a.url){this.trigger("Error",{code:o.INIT_ERROR,message:o.translate("Init error.")});return}S.call(this),x.call(this,a,function(n){typeof a.init=="function"?a.init(e):o.each(a.init,function(t,n){e.bind(n,t)}),n?(e.runtime=t.Runtime.getInfo(w()).type,e.trigger("Init",{runtime:e.runtime}),e.trigger("PostInit")):e.trigger("Error",{code:o.INIT_ERROR,message:o.translate("Init error.")})})},setOption:function(e,t){N.call(this,e,t,!this.runtime)},getOption:function(e){return e?a[e]:a},refresh:function(){c.length&&o.each(c,function(e){e.trigger("Refresh")}),this.trigger("Refresh")},start:function(){this.state!=o.STARTED&&(this.state=o.STARTED,this.trigger("StateChanged"),g.call(this))},stop:function(){this.state!=o.STOPPED&&(this.state=o.STOPPED,this.trigger("StateChanged"),this.trigger("CancelUpload"))},disableBrowse:function(){v=arguments[0]!==n?arguments[0]:!0,c.length&&o.each(c,function(e){e.disable(v)}),this.trigger("DisableBrowse",v)},getFile:function(e){var t;for(t=f.length-1;t>=0;t--)if(f[t].id===e)return f[t]},addFile:function(e,n){function l(e,n){var r=[];t.each(s.settings.filters,function(t,n){i[n]&&r.push(function(r){i[n].call(s,t,e,function(e){r(!e)})})}),t.inSeries(r,n)}function c(e){var i=t.typeOf(e);if(e instanceof t.File){if(!e.ruid&&!e.isDetached()){if(!f)return!1;e.ruid=f,e.connectRuntime(f)}c(new o.File(e))}else e instanceof t.Blob?(c(e.getSource()),e.destroy()):e instanceof o.File?(n&&(e.name=n),u.push(function(t){l(e,function(n){n||(a.push(e),s.trigger("FileFiltered",e)),r(t,1)})})):t.inArray(i,["file","blob"])!==-1?c(new t.File(null,e)):i==="node"&&t.typeOf(e.files)==="filelist"?t.each(e.files,c):i==="array"&&(n=null,t.each(e,c))}var s=this,u=[],a=[],f;f=w(),c(e),u.length&&t.inSeries(u,function(){a.length&&s.trigger("FilesAdded",a)})},removeFile:function(e){var t=typeof e=="string"?e:e.id;for(var n=f.length-1;n>=0;n--)if(f[n].id===t)return this.splice(n,1)[0]},splice:function(e,t){var r=f.splice(e===n?0:e,t===n?f.length:t),i=!1;return this.state==o.STARTED&&(i=!0,this.stop()),this.trigger("FilesRemoved",r),o.each(r,function(e){e.destroy()}),this.trigger("QueueChanged"),this.refresh(),i&&this.start(),r},bind:function(e,t,n){var r=this;o.Uploader.prototype.bind.call(this,e,function(){var e=[].slice.call(arguments);return e.splice(0,1,r),t.apply(this,e)},0,n)},destroy:function(){this.trigger("Destroy"),a=d=null,this.unbindAll()}})},o.Uploader.prototype=t.EventTarget.instance,o.File=function(){function n(n){o.extend(this,{id:o.guid(),name:n.name||n.fileName,type:n.type||"",size:n.size||n.fileSize,origSize:n.size||n.fileSize,loaded:0,percent:0,status:o.QUEUED,lastModifiedDate:n.lastModifiedDate||(new Date).toLocaleString(),getNative:function(){var e=this.getSource().getSource();return t.inArray(t.typeOf(e),["blob","file"])!==-1?e:null},getSource:function(){return e[this.id]?e[this.id]:null},destroy:function(){var t=this.getSource();t&&(t.destroy(),delete e[this.id])}}),e[this.id]=n}var e={};return n}(),o.QueueProgress=function(){var e=this;e.size=0,e.loaded=0,e.uploaded=0,e.failed=0,e.queued=0,e.percent=0,e.bytesPerSec=0,e.reset=function(){e.size=e.loaded=e.uploaded=e.failed=e.queued=e.percent=e.bytesPerSec=0}},e.plupload=o})(window,mOxie); -------------------------------------------------------------------------------- /demo/js/ui.js: -------------------------------------------------------------------------------- 1 | /*global plupload */ 2 | /*global qiniu */ 3 | function FileProgress(file, targetID) { 4 | this.fileProgressID = file.id; 5 | this.file = file; 6 | 7 | this.opacity = 100; 8 | this.height = 0; 9 | this.fileProgressWrapper = $('#' + this.fileProgressID); 10 | if (!this.fileProgressWrapper.length) { 11 | //
      12 | //
      13 | // 20% Complete 14 | //
      15 | //
      16 | 17 | this.fileProgressWrapper = $(''); 18 | var Wrappeer = this.fileProgressWrapper; 19 | Wrappeer.attr('id', this.fileProgressID).addClass('progressContainer'); 20 | 21 | var progressText = $(""); 22 | progressText.addClass('progressName').text(file.name); 23 | 24 | 25 | var fileSize = plupload.formatSize(file.size).toUpperCase(); 26 | var progressSize = $(""); 27 | progressSize.addClass("progressFileSize").text(fileSize); 28 | 29 | var progressBarTd = $(""); 30 | var progressBarBox = $("
      "); 31 | progressBarBox.addClass('info'); 32 | var progressBarWrapper = $("
      "); 33 | progressBarWrapper.addClass("progress progress-striped"); 34 | 35 | 36 | var progressBar = $("
      "); 37 | progressBar.addClass("progress-bar progress-bar-info") 38 | .attr('role', 'progressbar') 39 | .attr('aria-valuemax', 100) 40 | .attr('aria-valuenow', 0) 41 | .attr('aria-valuein', 0) 42 | .width('0%'); 43 | 44 | var progressBarPercent = $(''); 45 | progressBarPercent.text(fileSize); 46 | 47 | 48 | var progressCancel = $(''); 49 | progressCancel.hide().addClass('progressCancel').text(''); 50 | 51 | 52 | progressBar.append(progressBarPercent); 53 | progressBarWrapper.append(progressBar); 54 | progressBarBox.append(progressBarWrapper); 55 | progressBarBox.append(progressCancel); 56 | 57 | 58 | var progressBarStatus = $('
      '); 59 | progressBarBox.append(progressBarStatus); 60 | progressBarTd.append(progressBarBox); 61 | 62 | 63 | Wrappeer.append(progressText); 64 | Wrappeer.append(progressSize); 65 | Wrappeer.append(progressBarTd); 66 | 67 | $('#' + targetID).append(Wrappeer); 68 | } else { 69 | this.reset(); 70 | } 71 | 72 | this.height = this.fileProgressWrapper.offset().top; 73 | this.setTimer(null); 74 | } 75 | 76 | FileProgress.prototype.setTimer = function(timer) { 77 | this.fileProgressWrapper.FP_TIMER = timer; 78 | }; 79 | 80 | FileProgress.prototype.getTimer = function(timer) { 81 | return this.fileProgressWrapper.FP_TIMER || null; 82 | }; 83 | 84 | FileProgress.prototype.reset = function() { 85 | this.fileProgressWrapper.attr('class', "progressContainer"); 86 | this.fileProgressWrapper.find('td .progress .progress-bar-info').attr('aria-valuenow', 0).width('0%').find('span').text(''); 87 | this.appear(); 88 | }; 89 | 90 | FileProgress.prototype.setChunkProgess = function(chunk_size) { 91 | var chunk_amount = Math.ceil(this.file.size / chunk_size); 92 | if (chunk_amount === 1) { 93 | return false; 94 | } 95 | 96 | var viewProgess = $(''); 97 | 98 | var progressBarChunkTr = $(''); 99 | var progressBarChunk = $('
      '); 100 | for (var i = 1; i <= chunk_amount; i++) { 101 | var col = $('
      '); 102 | var progressBarWrapper = $('
      "); 105 | progressBar.addClass("progress-bar progress-bar-info text-left") 106 | .attr('role', 'progressbar') 107 | .attr('aria-valuemax', 100) 108 | .attr('aria-valuenow', 0) 109 | .attr('aria-valuein', 0) 110 | .width('0%') 111 | .attr('id', this.file.id + '_' + i) 112 | .text(''); 113 | 114 | var progressBarStatus = $(''); 115 | progressBarStatus.addClass('chunk-status').text(); 116 | 117 | progressBarWrapper.append(progressBar); 118 | progressBarWrapper.append(progressBarStatus); 119 | 120 | col.append(progressBarWrapper); 121 | progressBarChunk.append(col); 122 | } 123 | this.fileProgressWrapper.find('td>div').append(viewProgess); 124 | 125 | progressBarChunkTr.hide().find('td').append(progressBarChunk); 126 | 127 | progressBarChunkTr.insertAfter(this.fileProgressWrapper); 128 | }; 129 | 130 | FileProgress.prototype.setProgress = function(percentage, speed, chunk_size) { 131 | this.fileProgressWrapper.attr('class', "progressContainer green"); 132 | 133 | var file = this.file; 134 | var uploaded = file.loaded; 135 | 136 | var size = plupload.formatSize(uploaded).toUpperCase(); 137 | var formatSpeed = plupload.formatSize(speed).toUpperCase(); 138 | var progressbar = this.fileProgressWrapper.find('td .progress').find('.progress-bar-info'); 139 | this.fileProgressWrapper.find('.status').text("已上传: " + size + " 上传速度: " + formatSpeed + "/s"); 140 | percentage = parseInt(percentage, 10); 141 | if (file.status !== plupload.DONE && percentage === 100) { 142 | percentage = 99; 143 | } 144 | progressbar.attr('aria-valuenow', percentage).css('width', percentage + '%'); 145 | 146 | if (chunk_size) { 147 | var chunk_amount = Math.ceil(file.size / chunk_size); 148 | if (chunk_amount === 1) { 149 | return false; 150 | } 151 | var current_uploading_chunk = Math.ceil(uploaded / chunk_size); 152 | var pre_chunk, text; 153 | 154 | for (var index = 0; index < current_uploading_chunk; index++) { 155 | pre_chunk = $('#' + file.id + "_" + index); 156 | pre_chunk.width('100%').removeClass().addClass('alert-success').attr('aria-valuenow', 100); 157 | text = "块" + index + "上传进度100%"; 158 | pre_chunk.next().html(text); 159 | } 160 | 161 | var currentProgessBar = $('#' + file.id + "_" + current_uploading_chunk); 162 | var current_chunk_percent; 163 | if (current_uploading_chunk < chunk_amount) { 164 | if (uploaded % chunk_size) { 165 | current_chunk_percent = ((uploaded % chunk_size) / chunk_size * 100).toFixed(2); 166 | } else { 167 | current_chunk_percent = 100; 168 | currentProgessBar.removeClass().addClass('alert-success'); 169 | } 170 | } else { 171 | var last_chunk_size = file.size - chunk_size * (chunk_amount - 1); 172 | var left_file_size = file.size - uploaded; 173 | if (left_file_size % last_chunk_size) { 174 | current_chunk_percent = ((uploaded % chunk_size) / last_chunk_size * 100).toFixed(2); 175 | } else { 176 | current_chunk_percent = 100; 177 | currentProgessBar.removeClass().addClass('alert-success'); 178 | } 179 | } 180 | currentProgessBar.width(current_chunk_percent + '%'); 181 | currentProgessBar.attr('aria-valuenow', current_chunk_percent); 182 | text = "块" + current_uploading_chunk + "上传进度" + current_chunk_percent + '%'; 183 | currentProgessBar.next().html(text); 184 | } 185 | 186 | this.appear(); 187 | }; 188 | 189 | FileProgress.prototype.setComplete = function(up, info) { 190 | var td = this.fileProgressWrapper.find('td:eq(2) .progress'); 191 | 192 | var res = $.parseJSON(info); 193 | var url; 194 | if (res.url) { 195 | url = res.url; 196 | str = "" + 197 | "
      Hash:" + res.hash + "
      "; 198 | } else { 199 | var domain = up.getOption('domain'); 200 | url = domain + encodeURI(res.key); 201 | var link = domain + res.key; 202 | str = "" + 203 | "
      Hash:" + res.hash + "
      "; 204 | } 205 | 206 | td.html(str).removeClass().next().next('.status').hide(); 207 | 208 | var progressNameTd = this.fileProgressWrapper.find('.progressName'); 209 | var imageView = '?imageView2/1/w/100/h/100'; 210 | 211 | var isImage = function(url) { 212 | var res, suffix = ""; 213 | var imageSuffixes = ["png", "jpg", "jpeg", "gif", "bmp"]; 214 | var suffixMatch = /\.([a-zA-Z0-9]+)(\?|\@|$)/; 215 | 216 | if (!url || !suffixMatch.test(url)) { 217 | return false; 218 | } 219 | res = suffixMatch.exec(url); 220 | suffix = res[1].toLowerCase(); 221 | for (var i = 0, l = imageSuffixes.length; i < l; i++) { 222 | if (suffix === imageSuffixes[i]) { 223 | return true; 224 | } 225 | } 226 | return false; 227 | }; 228 | 229 | var isImg = isImage(url); 230 | 231 | var Wrapper = $('
      '); 232 | var imgWrapper = $('
      '); 233 | var linkWrapper = $(''); 234 | var showImg = $(''); 235 | 236 | progressNameTd.append(Wrapper); 237 | 238 | if (!isImg) { 239 | showImg.attr('src', 'default.png'); 240 | Wrapper.addClass('default'); 241 | 242 | imgWrapper.append(showImg); 243 | Wrapper.append(imgWrapper); 244 | } else { 245 | linkWrapper.append(showImg); 246 | imgWrapper.append(linkWrapper); 247 | Wrapper.append(imgWrapper); 248 | 249 | var img = new Image(); 250 | if (!/imageView/.test(url)) { 251 | url += imageView 252 | } 253 | $(img).attr('src', url); 254 | 255 | var height_space = 340; 256 | $(img).on('load', function() { 257 | showImg.attr('src', url); 258 | 259 | linkWrapper.attr('href', url).attr('title', '查看原图'); 260 | 261 | function initImg(url, key, height) { 262 | $('#myModal-img').modal(); 263 | var modalBody = $('#myModal-img').find('.modal-body'); 264 | if (height <= 300) { 265 | $('#myModal-img').find('.text-warning').show(); 266 | } 267 | var newImg = new Image(); 268 | modalBody.find('img').attr('src', 'loading.gif'); 269 | newImg.onload = function() { 270 | modalBody.find('img').attr('src', url).data('key', key).data('h', height); 271 | modalBody.find('.modal-body-wrapper').find('a').attr('href', url); 272 | }; 273 | newImg.src = url; 274 | } 275 | 276 | var infoWrapper = $('
      '); 277 | 278 | 279 | var fopLink = $('
      '); 280 | fopLink.attr('data-key', res.key).text('查看处理效果'); 281 | infoWrapper.append(fopLink); 282 | fopLink.on('click', function() { 283 | var key = $(this).data('key'); 284 | var height = parseInt($(this).parents('.Wrapper').find('.origin-height').text(), 10); 285 | if (height > $(window).height() - height_space) { 286 | height = parseInt($(window).height() - height_space, 10); 287 | } else { 288 | height = parseInt(height, 10) || 300; 289 | //set a default height 300 for ie9- 290 | } 291 | var fopArr = []; 292 | fopArr.push({ 293 | fop: 'imageView2', 294 | mode: 3, 295 | h: height, 296 | q: 100, 297 | format: 'png' 298 | }); 299 | fopArr.push({ 300 | fop: 'watermark', 301 | mode: 1, 302 | image: 'http://www.b1.qiniudn.com/images/logo-2.png', 303 | dissolve: 100, 304 | gravity: 'SouthEast', 305 | dx: 100, 306 | dy: 100 307 | }); 308 | var url = Qiniu.pipeline(fopArr, key); 309 | $('#myModal-img').on('hide.bs.modal', function() { 310 | $('#myModal-img').find('.btn-default').removeClass('disabled'); 311 | $('#myModal-img').find('.text-warning').hide(); 312 | }).on('show.bs.modal', function() { 313 | $('#myModal-img').find('.imageView').find('a:eq(0)').addClass('disabled'); 314 | $('#myModal-img').find('.watermark').find('a:eq(3)').addClass('disabled'); 315 | $('#myModal-img').find('.text-warning').hide(); 316 | }); 317 | 318 | initImg(url, key, height); 319 | 320 | return false; 321 | }); 322 | 323 | var ie = Qiniu.detectIEVersion(); 324 | if (!(ie && ie <= 9)) { 325 | var exif = Qiniu.exif(res.key); 326 | if (exif) { 327 | var exifLink = $('查看exif'); 328 | exifLink.attr('href', url + '?exif'); 329 | infoWrapper.append(exifLink); 330 | } 331 | 332 | var imageInfo = Qiniu.imageInfo(res.key); 333 | var infoArea = $('
      '); 334 | var infoInner = '
      格式:' + imageInfo.format + '
      ' + 335 | '
      宽度:' + imageInfo.width + 'px
      ' + 336 | '
      高度:' + imageInfo.height + 'px
      '; 337 | infoArea.html(infoInner); 338 | 339 | infoWrapper.append(infoArea); 340 | } 341 | 342 | Wrapper.append(infoWrapper); 343 | 344 | }).on('error', function() { 345 | showImg.attr('src', 'default.png'); 346 | Wrapper.addClass('default'); 347 | }); 348 | } 349 | }; 350 | FileProgress.prototype.setError = function() { 351 | this.fileProgressWrapper.find('td:eq(2)').attr('class', 'text-warning'); 352 | this.fileProgressWrapper.find('td:eq(2) .progress').css('width', 0).hide(); 353 | this.fileProgressWrapper.find('button').hide(); 354 | this.fileProgressWrapper.next('.chunk-status-tr').hide(); 355 | }; 356 | 357 | FileProgress.prototype.setCancelled = function(manual) { 358 | var progressContainer = 'progressContainer'; 359 | if (!manual) { 360 | progressContainer += ' red'; 361 | } 362 | this.fileProgressWrapper.attr('class', progressContainer); 363 | this.fileProgressWrapper.find('td .progress .progress-bar-info').css('width', 0); 364 | }; 365 | 366 | FileProgress.prototype.setStatus = function(status, isUploading) { 367 | if (!isUploading) { 368 | this.fileProgressWrapper.find('.status').text(status).attr('class', 'status text-left'); 369 | } 370 | }; 371 | 372 | 373 | FileProgress.prototype.appear = function() { 374 | if (this.getTimer() !== null) { 375 | clearTimeout(this.getTimer()); 376 | this.setTimer(null); 377 | } 378 | 379 | if (this.fileProgressWrapper[0].filters) { 380 | try { 381 | this.fileProgressWrapper[0].filters.item("DXImageTransform.Microsoft.Alpha").opacity = 100; 382 | } catch (e) { 383 | // If it is not set initially, the browser will throw an error. This will set it if it is not set yet. 384 | this.fileProgressWrapper.css('filter', "progid:DXImageTransform.Microsoft.Alpha(opacity=100)"); 385 | } 386 | } else { 387 | this.fileProgressWrapper.css('opacity', 1); 388 | } 389 | 390 | this.fileProgressWrapper.css('height', ''); 391 | 392 | this.height = this.fileProgressWrapper.offset().top; 393 | this.opacity = 100; 394 | this.fileProgressWrapper.show(); 395 | 396 | }; 397 | -------------------------------------------------------------------------------- /demo/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bearyinnovative/qiniu-js-sdk/6675d08ed9661f76cae30e8a6b77eee3cf17c88f/demo/loading.gif -------------------------------------------------------------------------------- /demo/main.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: '微软雅黑'; 3 | overflow: scroll; 4 | } 5 | h1 { 6 | border-bottom: 1px solid #d2d2d2; 7 | padding-bottom: 15px; 8 | position: relative; 9 | font-weight: bold; 10 | margin-bottom: 15px; 11 | font-family: '微软雅黑'; 12 | } 13 | h3,h4 { 14 | color: #d2d2d2; 15 | font-family: '微软雅黑',"Helvetica Neue", Helvetica, Arial, sans-serif; 16 | } 17 | h1 .view_github { 18 | display: block; 19 | font-size: 14px; 20 | line-height: 30px; 21 | position: absolute; 22 | right: 0; 23 | bottom: 0; 24 | border: 1px solid #d2d2d2; 25 | border-bottom: none; 26 | border-radius:0; 27 | 28 | } 29 | h1 .view_github:hover,h1 .view_code:hover { 30 | background-color: #f5f5f5; 31 | } 32 | 33 | h1 .view_code { 34 | display: block; 35 | font-size: 14px; 36 | line-height: 30px; 37 | position: absolute; 38 | right: 225px; 39 | bottom: 0; 40 | border: 1px solid #d2d2d2; 41 | border-bottom: none; 42 | border-radius:0; 43 | height: 45px; 44 | } 45 | .col-md-12.no-padding { 46 | padding-left:0; 47 | padding-right:0; 48 | } 49 | .info { 50 | position: relative; 51 | height: 100%; 52 | } 53 | tr .progress-bar { 54 | min-height: 20px; 55 | float: none; 56 | } 57 | tr .progress, tr .progress div { 58 | height: 20px; 59 | } 60 | 61 | tr .progress .chunk-status { 62 | position: absolute; 63 | left: 24px; 64 | top: 0; 65 | } 66 | .status { 67 | position: absolute; 68 | width: 100%; 69 | top:0; 70 | left: 24px; 71 | } 72 | .tip { 73 | padding-left: 30px; 74 | } 75 | .tip p { 76 | line-height: 1; 77 | } 78 | #container { 79 | margin-bottom: 20px; 80 | border-width: 2px; 81 | border-radius: 3px; 82 | border-color: #dcdcdc; 83 | cursor: default; 84 | } 85 | #container:hover,#container:active { 86 | background-color:#fff; 87 | border-color: #dcdcdc; 88 | -webkit-box-shadow:none; 89 | box-shadow:none; 90 | } 91 | #container.draging { 92 | background-color:#fff; 93 | border-color:#999999; 94 | } 95 | #success { 96 | line-height: 30px; 97 | height: 30px; 98 | margin:20px 0 0 0; 99 | } 100 | #success div { 101 | padding-left: 24px; 102 | } 103 | #container a { 104 | width: 15%; 105 | min-width: 145px; 106 | 107 | 108 | } 109 | 110 | button { 111 | border-radius: 3px; 112 | -webkit-box-shadow: 0 1px 0 rgba(243, 243, 243, 0.75); 113 | box-shadow: 0 1px 0 rgba(243, 243, 243, 0.75); 114 | color: #646464; 115 | border: 1px solid #d2d2d2; 116 | text-align: center; 117 | -webkit-transition: background-color 0.218s, border-color 0.218s, box-shadow 0.218s; 118 | transition: background-color 0.218s, border-color 0.218s, box-shadow 0.218s; 119 | -webkit-user-select: none; 120 | outline: none; 121 | } 122 | td .Wrapper { 123 | margin-top: 20px; 124 | text-align: center; 125 | overflow: hidden; 126 | } 127 | td .Wrapper .infoWrapper{ 128 | width:50%; 129 | height:100px; 130 | margin-left: 10px; 131 | text-align: left; 132 | line-height: 25px; 133 | } 134 | td .Wrapper .infoWrapper a:first-child{ 135 | margin-right: 10px; 136 | } 137 | td .Wrapper.default { 138 | margin-top: 20px; 139 | text-align: left; 140 | } 141 | td .Wrapper.default img{ 142 | width:100px; 143 | height:100px; 144 | } 145 | td .imgWrapper { 146 | position: relative; 147 | width:100px; 148 | height: 100px; 149 | } 150 | td .imgWrapper .linkWrapper { 151 | position: absolute; 152 | left: 15px; 153 | top: 0; 154 | width:100px; 155 | height: 100px; 156 | cursor: pointer; 157 | } 158 | td .imgWrapper .linkWrapper a{ 159 | line-height: 50px; 160 | 161 | } 162 | table td .hash { 163 | margin-bottom: 20px; 164 | } 165 | pre { 166 | margin-top: 20px; 167 | } 168 | 169 | .container .modal-dialog { 170 | width: 45%; 171 | } 172 | .container .modal-dialog .modal-content { 173 | max-height: 90%; 174 | } 175 | .container .modal-dialog .modal-body img{ 176 | max-width: 95%; 177 | max-height: 70%; 178 | } 179 | .container .modal-body-footer , .container .modal-body-footer div{ 180 | margin-top: 10px; 181 | margin-bottom: 10px; 182 | } 183 | .container .modal-dialog .modal-body-footer { 184 | margin-top: 0px; 185 | } 186 | .container .modal-dialog .modal-body-footer span { 187 | margin-right: 20px; 188 | } 189 | .container .modal-dialog .modal-body-footer .text-warning,.container .modal-dialog .modal-footer span ,.container .modal-dialog .modal-footer a{ 190 | font-size: 12px; 191 | } 192 | .body .btn-default { 193 | border-radius: 3px; 194 | -webkit-box-shadow: 0 1px 0 rgba(243, 243, 243, 0.75); 195 | box-shadow: 0 1px 0 rgba(243, 243, 243, 0.75); 196 | color: #646464; 197 | border: 1px solid #d2d2d2; 198 | text-align: center; 199 | -webkit-transition: background-color 0.218s, border-color 0.218s, box-shadow 0.218s; 200 | transition: background-color 0.218s, border-color 0.218s, box-shadow 0.218s; 201 | -webkit-user-select: none; 202 | outline: none; 203 | } 204 | .body .btn-default:hover,.body .btn-default:active,.body .btn-default:focus ,.no-padding button:hover,.no-padding button:active,.no-padding button:focus{ 205 | border-color: #bebebe; 206 | text-decoration: none; 207 | background-color: #fff; 208 | color: #262626; 209 | outline: none; 210 | -webkit-box-shadow: 0 1px 0 rgba(230, 230, 230, 0.8); 211 | box-shadow: 0 1px 0 rgba(230, 230, 230, 0.8); 212 | } 213 | 214 | a { 215 | cursor: pointer; 216 | } 217 | -------------------------------------------------------------------------------- /demo/server.js: -------------------------------------------------------------------------------- 1 | var qiniu = require('qiniu'); 2 | var express = require('express'); 3 | var config = require('./config.js'); 4 | var app = express(); 5 | 6 | app.configure(function() { 7 | app.use(express.static(__dirname + '/')); 8 | }); 9 | 10 | 11 | app.set('views', __dirname + '/views'); 12 | app.engine('html', require('ejs').renderFile); 13 | 14 | app.use(express.urlencoded()); 15 | 16 | app.get('/uptoken', function(req, res, next) { 17 | var token = uptoken.token(); 18 | res.header("Cache-Control", "max-age=0, private, must-revalidate"); 19 | res.header("Pragma", "no-cache"); 20 | res.header("Expires", 0); 21 | if (token) { 22 | res.json({ 23 | uptoken: token 24 | }); 25 | } 26 | }); 27 | 28 | app.post('/downtoken', function(req, res) { 29 | 30 | var key = req.body.key, 31 | domain = req.body.domain; 32 | 33 | //trim 'http://' 34 | if (domain.indexOf('http://') != -1) { 35 | domain = domain.substr(7); 36 | } 37 | //trim 'https://' 38 | if (domain.indexOf('https://') != -1) { 39 | domain = domain.substr(8); 40 | } 41 | //trim '/' if the domain's last char is '/' 42 | if (domain.lastIndexOf('/') === domain.length - 1) { 43 | domain = domain.substr(0, domain.length - 1); 44 | } 45 | 46 | var baseUrl = qiniu.rs.makeBaseUrl(domain, key); 47 | var deadline = 3600 + Math.floor(Date.now() / 1000); 48 | 49 | baseUrl += '?e=' + deadline; 50 | var signature = qiniu.util.hmacSha1(baseUrl, config.SECRET_KEY); 51 | var encodedSign = qiniu.util.base64ToUrlSafe(signature); 52 | var downloadToken = config.ACCESS_KEY + ':' + encodedSign; 53 | 54 | if (downloadToken) { 55 | res.json({ 56 | downtoken: downloadToken, 57 | url: baseUrl + '&token=' + downloadToken 58 | }) 59 | } 60 | }); 61 | 62 | app.get('/', function(req, res) { 63 | res.render('index.html', { 64 | domain: config.Domain, 65 | uptoken_url: config.Uptoken_Url 66 | }); 67 | }); 68 | 69 | qiniu.conf.ACCESS_KEY = config.ACCESS_KEY; 70 | qiniu.conf.SECRET_KEY = config.SECRET_KEY; 71 | 72 | var uptoken = new qiniu.rs.PutPolicy(config.Bucket_Name); 73 | 74 | 75 | app.listen(config.Port, function() { 76 | console.log('Listening on port %d', config.Port); 77 | }); 78 | -------------------------------------------------------------------------------- /demo/views/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 七牛云存储 - JavaScript SDK 6 | 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 |
      17 |
      18 |

      19 | 七牛云存储 - JavaScript SDK 20 | 21 | 查看初始化代码 22 | 23 | 24 | 25 | View Source on Github 26 | 27 |

      28 | 29 | 30 |
        31 |
      • 32 | 33 | JavaScript SDK 基于 Plupload 开发,可以通过 Html5 或 Flash 等模式上传文件至七牛云存储。 34 | 35 |
      • 36 |
      • 37 | 临时上传的空间不定时清空,请勿保存重要文件。 38 |
      • 39 |
      • 40 | Html5模式大于4M文件采用分块上传。 41 |
      • 42 |
      • 43 | 上传图片可查看处理效果。 44 |
      • 45 |
      • 46 | 本示例限制最大上传文件100M。 47 |
      • 48 |
      49 |
      50 |
      51 |
      52 | 58 |
      59 | 60 | 65 |
      66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 |
      78 |
      79 | 159 | 233 |
      234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "qiniu-js-sdk", 3 | "version": "1.0.0-beta", 4 | "private": false, 5 | "scripts": { 6 | "start": "node demo/server.js" 7 | }, 8 | "dependencies": { 9 | "express": "~3.4.7", 10 | "qiniu": "~6.1.1", 11 | "ejs": "~1.0.0", 12 | "grunt": "~0.4.2", 13 | "grunt-cli": "~0.1.13", 14 | "grunt-contrib-jshint": "~0.7.2", 15 | "grunt-contrib-watch": "~0.5.3", 16 | "grunt-contrib-uglify": "~0.2.2", 17 | "grunt-contrib-copy": "~0.5.0" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/qiniu.min.js: -------------------------------------------------------------------------------- 1 | function QiniuJsSDK(){this.detectIEVersion=function(){for(var a=4,b=document.createElement("div"),c=b.getElementsByTagName("i");b.innerHTML="",c[0];)a++;return a>4?a:!1},this.isImage=function(a){var b,c="",d=["png","jpg","jpeg","gif","bmp"],e=/\.([a-zA-Z0-9]+)(\?|\@|$)/;if(!a||!e.test(a))return!1;b=e.exec(a),c=b[1].toLowerCase();for(var f=0,g=d.length;g>f;f++)if(c===d[f])return!0;return!1},this.getFileExtension=function(a){var b,c=a.split(".");return b=1===c.length||""===c[0]&&2===c.length?"":c.pop().toLowerCase()},this.utf8_encode=function(a){if(null===a||"undefined"==typeof a)return"";var b,c,d=a+"",e="",f=0;b=c=0,f=d.length;for(var g=0;f>g;g++){var h=d.charCodeAt(g),i=null;if(128>h)c++;else if(h>127&&2048>h)i=String.fromCharCode(h>>6|192,63&h|128);else if(63488&h^!0)i=String.fromCharCode(h>>12|224,h>>6&63|128,63&h|128);else{if(64512&h^!0)throw new RangeError("Unmatched trail surrogate at "+g);var j=d.charCodeAt(++g);if(64512&j^!0)throw new RangeError("Unmatched lead surrogate at "+(g-1));h=((1023&h)<<10)+(1023&j)+65536,i=String.fromCharCode(h>>18|240,h>>12&63|128,h>>6&63|128,63&h|128)}null!==i&&(c>b&&(e+=d.slice(b,c)),e+=i,b=c=g+1)}return c>b&&(e+=d.slice(b,f)),e},this.base64_encode=function(a){var b,c,d,e,f,g,h,i,j="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",k=0,l=0,m="",n=[];if(!a)return a;a=this.utf8_encode(a+"");do b=a.charCodeAt(k++),c=a.charCodeAt(k++),d=a.charCodeAt(k++),i=b<<16|c<<8|d,e=i>>18&63,f=i>>12&63,g=i>>6&63,h=63&i,n[l++]=j.charAt(e)+j.charAt(f)+j.charAt(g)+j.charAt(h);while(k=f&&b.chunk_size&&b.runtimes.indexOf("flash")>=0?b.chunk_size=0:g?b.chunk_size=0:(c=20,d=4<d&&(b.chunk_size=d))};g();var h=function(){if(b.uptoken)a.token=b.uptoken;else{var c=a.createAjax();c.open("GET",a.uptoken_url,!0),c.setRequestHeader("If-Modified-Since","0"),c.onreadystatechange=function(){if(4===c.readyState&&200===c.status){var b=a.parseJSON(c.responseText);a.token=b.uptoken}},c.send()}},i=function(c,d,e){var f="",g=!1;if(!b.save_key)if(g=c.getOption&&c.getOption("unique_names"),g=g||c.settings&&c.settings.unique_names){var h=a.getFileExtension(d.name);f=h?d.id+"."+h:d.id}else f="function"==typeof e?e(c,d):d.name;return f};plupload.extend(c,b,{url:"http://up.qiniu.com",multipart_params:{token:""}});var j=new plupload.Uploader(c);return j.bind("Init",function(){h()}),j.init(),j.bind("FilesAdded",function(a,b){var c=a.getOption&&a.getOption("auto_start");c=c||a.settings&&a.settings.auto_start,c&&$.each(b,function(){a.start()}),a.refresh()}),j.bind("BeforeUpload",function(c,d){f="";var e=function(c,d,e){var f;f=b.save_key?{token:a.token}:{key:i(c,d,e),token:a.token};var g=b.x_vars;if(void 0!==g&&"object"==typeof g)for(var h in g)g.hasOwnProperty(h)&&("function"==typeof g[h]?f["x:"+h]=g[h](c,d):"object"!=typeof g[h]&&(f["x:"+h]=g[h]));c.setOption({url:"http://up.qiniu.com/",multipart:!0,chunk_size:void 0,multipart_params:f})},g=c.getOption&&c.getOption("chunk_size");if(g=g||c.settings&&c.settings.chunk_size,"html5"===j.runtime&&g)if(d.sized.size&&(k=d.size-h.ctx)),c.setOption({url:"http://up.qiniu.com/mkblk/"+k,multipart:!1,chunk_size:g,required_features:"chunks",headers:{Authorization:"UpToken "+a.token},multipart_params:{}})}else e(c,d,a.key_handler)}),j.bind("ChunkUploaded",function(b,c,d){var e=a.parseJSON(d.response);f=f?f+","+e.ctx:e.ctx;var g=d.total-d.offset,h=b.getOption&&b.getOption("chunk_size");h=h||b.settings&&b.settings.chunk_size,h>g&&b.setOption({url:"http://up.qiniu.com/mkblk/"+g}),localStorage.setItem(c.name,JSON.stringify({ctx:f,percent:c.percent,total:d.total,offset:d.offset}))}),j.bind("Error",function(b){return function(c,d){var e="",f=d.file;if(f){switch(d.code){case plupload.FAILED:e="上传失败。请稍后再试。";break;case plupload.FILE_SIZE_ERROR:var g=c.getOption&&c.getOption("max_file_size");g=g||c.settings&&c.settings.max_file_size,e="浏览器最大可上传"+g+"。更大文件请使用命令行工具。";break;case plupload.FILE_EXTENSION_ERROR:e="文件验证失败。请稍后重试。";break;case plupload.HTTP_ERROR:var h=a.parseJSON(d.response),i=h.error;switch(d.status){case 400:e="请求报文格式错误。";break;case 401:e="客户端认证授权失败。请重试或提交反馈。";break;case 405:e="客户端请求错误。请重试或提交反馈。";break;case 579:e="资源上传成功,但回调失败。";break;case 599:e="网络连接异常。请重试或提交反馈。";break;case 614:e="文件已存在。";try{h=a.parseJSON(h.error),i=h.error||"file exists"}catch(k){throw"invalid json format"}break;case 631:e="指定空间不存在。";break;case 701:e="上传数据块校验出错。请重试或提交反馈。";break;default:e="未知错误。"}e=e+"("+d.status+":"+i+")";break;case plupload.SECURITY_ERROR:e="安全配置错误。请联系网站管理员。";break;case plupload.GENERIC_ERROR:e="上传失败。请稍后再试。";break;case plupload.IO_ERROR:e="上传失败。请稍后再试。";break;case plupload.INIT_ERROR:e="网站配置错误。请联系网站管理员。",j.destroy();break;default:e=d.message+d.details}b&&b(c,d,e)}c.refresh()}}(d)),j.bind("FileUploaded",function(c){return function(d,e,g){var h=function(d,e,f){if(b.downtoken_url){var g=a.createAjax();g.open("POST",b.downtoken_url,!0),g.setRequestHeader("Content-type","application/x-www-form-urlencoded"),g.onreadystatechange=function(){if(4===g.readyState)if(200===g.status){var b;try{b=a.parseJSON(g.responseText)}catch(h){throw"invalid json format"}var i={};plupload.extend(i,a.parseJSON(f),b),c&&c(d,e,JSON.stringify(i))}else j.trigger("Error",{status:g.status,response:g.responseText,file:e,code:plupload.HTTP_ERROR})},g.send("key="+a.parseJSON(f).key+"&domain="+b.domain)}else c&&c(d,e,f)},k=a.parseJSON(g.response);if(f=f?f:k.ctx){var l="";b.save_key||(l=i(d,e,a.key_handler),l=l?"/key/"+a.URLSafeBase64Encode(l):"");var m=b.x_vars,n="",o="";if(void 0!==m&&"object"==typeof m)for(var p in m)m.hasOwnProperty(p)&&("function"==typeof m[p]?n=a.URLSafeBase64Encode(m[p](d,e)):"object"!=typeof m[p]&&(n=a.URLSafeBase64Encode(m[p])),o+="/x:"+p+"/"+n);var q="http://up.qiniu.com/mkfile/"+e.size+l+o,r=a.createAjax();r.open("POST",q,!0),r.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),r.setRequestHeader("Authorization","UpToken "+a.token),r.onreadystatechange=function(){if(4===r.readyState)if(200===r.status){var a=r.responseText;h(d,e,a),localStorage.removeItem(e.name)}else j.trigger("Error",{status:r.status,response:r.responseText,file:e,code:-200})},r.send(f)}else h(d,e,g.response)}}(e)),j},this.getUrl=function(a){if(!a)return!1;a=encodeURI(a);var b=this.domain;return"/"!==b.slice(b.length-1)&&(b+="/"),b+a},this.imageView2=function(a,b){var c=a.mode||"",d=a.w||"",e=a.h||"",f=a.quality||"",g=a.format||"";if(!c)return!1;if(!d&&!e)return!1;var h="imageView2/"+c;return h+=d?"/w/"+d:"",h+=e?"/h/"+e:"",h+=f?"/q/"+f:"",h+=g?"/format/"+g:"",b&&(h=this.getUrl(b)+"?"+h),h},this.imageMogr2=function(a,b){var c=a["auto-orient"]||"",d=a.thumbnail||"",e=a.strip||"",f=a.gravity||"",g=a.crop||"",h=a.quality||"",i=a.rotate||"",j=a.format||"",k=a.blur||"",l="imageMogr2";return l+=c?"/auto-orient":"",l+=d?"/thumbnail/"+d:"",l+=e?"/strip":"",l+=f?"/gravity/"+f:"",l+=h?"/quality/"+h:"",l+=g?"/crop/"+g:"",l+=i?"/rotate/"+i:"",l+=j?"/format/"+j:"",l+=k?"/blur/"+k:"",b&&(l=this.getUrl(b)+"?"+l),l},this.watermark=function(a,b){var c=a.mode;if(!c)return!1;var d="watermark/"+c;if(1===c){var e=a.image||"";if(!e)return!1;d+=e?"/image/"+this.URLSafeBase64Encode(e):""}else{if(2!==c)return!1;var f=a.text?a.text:"",g=a.font?a.font:"",h=a.fontsize?a.fontsize:"",i=a.fill?a.fill:"";if(!f)return!1;d+=f?"/text/"+this.URLSafeBase64Encode(f):"",d+=g?"/font/"+this.URLSafeBase64Encode(g):"",d+=h?"/fontsize/"+h:"",d+=i?"/fill/"+this.URLSafeBase64Encode(i):""}var j=a.dissolve||"",k=a.gravity||"",l=a.dx||"",m=a.dy||"";return d+=j?"/dissolve/"+j:"",d+=k?"/gravity/"+k:"",d+=l?"/dx/"+l:"",d+=m?"/dy/"+m:"",b&&(d=this.getUrl(b)+"?"+d),d},this.imageInfo=function(a){if(!a)return!1;var b,c=this.getUrl(a)+"?imageInfo",d=this.createAjax(),e=this;return d.open("GET",c,!1),d.onreadystatechange=function(){4===d.readyState&&200===d.status&&(b=e.parseJSON(d.responseText))},d.send(),b},this.exif=function(a){if(!a)return!1;var b,c=this.getUrl(a)+"?exif",d=this.createAjax(),e=this;return d.open("GET",c,!1),d.onreadystatechange=function(){4===d.readyState&&200===d.status&&(b=e.parseJSON(d.responseText))},d.send(),b},this.get=function(a,b){return b&&a?"exif"===a?this.exif(b):"imageInfo"===a?this.imageInfo(b):!1:!1},this.pipeline=function(a,b){var c,d,e="[object Array]"===Object.prototype.toString.call(a),f="";if(e){for(var g=0,h=a.length;h>g;g++){if(c=a[g],!c.fop)return!1;switch(c.fop){case"watermark":f+=this.watermark(c)+"|";break;case"imageView2":f+=this.imageView2(c)+"|";break;case"imageMogr2":f+=this.imageMogr2(c)+"|";break;default:d=!0}if(d)return!1}if(b){f=this.getUrl(b)+"?"+f;var i=f.length;"|"===f.slice(i-1)&&(f=f.slice(0,i-1))}return f}return!1}}var Qiniu=new QiniuJsSDK; --------------------------------------------------------------------------------