docs: function(data, fm, target) {
  			if (!!data.checked || data.type == 'files') {
  				return data.files;
  			} else if (data.type == 'data') {
  				var dfrd = $.Deferred(),
  				scanDfd = $.Deferred(),
  				files = [],
  				paths = [],
  				dirctorys = [],
  				processing = 0,
  				items,
  				mkdirs = [],
  				cancel = false,
  				toArray = function(list) {
  					return Array.prototype.slice.call(list || [], 0);
  				},
  				doScan = function(items) {
  					var entry, readEntries,
  						excludes = fm.options.folderUploadExclude[fm.OS] || null,
  						length = items.length,
  						check = function() {
  							if (--processing < 1 && scanDfd.state() === 'pending') {
  								scanDfd.resolve();
  							}
  						},
  						pushItem = function(file) {
  							if (! excludes || ! file.name.match(excludes)) {
  								paths.push(entry.fullPath || '');
  								files.push(file);
  							}
  							check();
  						},
  						readEntries = function(dirReader) {
  							var entries = [],
  								read = function() {
  									dirReader.readEntries(function(results) {
  										if (cancel || !results.length) {
  											for (var i = 0; i < entries.length; i++) {
  												if (cancel) {
  													scanDfd.reject();
  													break;
  												}
  												doScan([entries[i]]);
  											}
  											check();
  										} else {
  											entries = entries.concat(toArray(results));
  											read();
  										}
  									}, check);
  								};
  							read();
  						};
  					
  					processing++;
  					for (var i = 0; i < length; i++) {
  						if (cancel) {
  							scanDfd.reject();
  							break;
  						}
  						entry = items[i];
  						if (entry) {
  							if (entry.isFile) {
  								processing++;
  								entry.file(pushItem, check);
  							} else if (entry.isDirectory) {
  								if (fm.api >= 2.1) {
  									processing++;
  									mkdirs.push(entry.fullPath);
  									readEntries(entry.createReader()); // Start reading dirs.
  								}
  							}
  						}
  					}
  					check();
  					return scanDfd;
  				}, hasDirs;
  				
  				items = $.map(data.files.items, function(item){
  					return item.getAsEntry? item.getAsEntry() : item.webkitGetAsEntry();
  				});
  				$.each(items, function(i, item) {
  					if (item.isDirectory) {
  						hasDirs = true;
  						return false;
  					}
  				});
  				if (items.length > 0) {
  					fm.uploads.checkExists(items, target, fm, hasDirs).done(function(renames, hashes){
  						var dfds = [];
  						if (fm.options.overwriteUploadConfirm && fm.option('uploadOverwrite', target)) {
  							if (renames === null) {
  								data.overwrite = 0;
  								renames = [];
  							}
  							items = $.grep(items, function(item){
  								var i, bak, hash, dfd, hi;
  								if (item.isDirectory && renames.length) {
  									i = $.inArray(item.name, renames);
  									if (i !== -1) {
  										renames.splice(i, 1);
  										bak = fm.uniqueName(item.name + fm.options.backupSuffix , null, '');
  										$.each(hashes, function(h, name) {
  											if (item.name == name) {
  												hash = h;
  												return false;
  											}
  										});
  										if (! hash) {
  											hash = fm.fileByName(item.name, target).hash;
  										}
  										fm.lockfiles({files : [hash]});
  										dfd = fm.request({
  											data   : {cmd : 'rename', target : hash, name : bak},
  											notify : {type : 'rename', cnt : 1}
  										})
  										.fail(function(error) {
  											item._remove = true;
  											fm.sync();
  										})
  										.always(function() {
  											fm.unlockfiles({files : [hash]});
  										});
  										dfds.push(dfd);
  									}
  								}
  								return !item._remove? true : false;
  							});
  						}
  						$.when.apply($, dfds).done(function(){
  							var notifyto, msg,
  								id = +new Date();
  							
  							if (items.length > 0) {
  								msg = fm.escape(items[0].name);
  								if (items.length > 1) {
  									msg += ' ... ' + items.length + fm.i18n('items');
  								}
  								notifyto = setTimeout(function() {
  									fm.notify({
  										type : 'readdir',
  										id : id,
  										cnt : 1,
  										hideCnt: true,
  										msg : fm.i18n('ntfreaddir') + ' (' + msg + ')',
  										cancel: function() {
  											cancel = true;
  										}
  									});
  								}, fm.options.notifyDelay);
  								doScan(items).done(function() {
  									notifyto && clearTimeout(notifyto);
  									fm.notify({type : 'readdir', id: id, cnt : -1});
  									if (cancel) {
  										dfrd.reject();
  									} else {
  										dfrd.resolve([files, paths, renames, hashes, mkdirs]);
  									}
  								}).fail(function() {
  									dfrd.reject();
  								});
  							} else {
  								dfrd.reject();
  							}
  						});
  					});
  					return dfrd.promise();
  				} else {
  					return dfrd.reject();
  				}
  			} else {
  				var ret = [];
  				var check = [];
  				var str = data.files[0];
  				if (data.type == 'html') {
  					var tmp = $("<html/>").append($.parseHTML(str.replace(/ src=/ig, ' _elfsrc='))),
  						atag;
  					$('img[_elfsrc]', tmp).each(function(){
  						var url, purl,
  						self = $(this),
  						pa = self.closest('a');
  						if (pa && pa.attr('href') && pa.attr('href').match(/\.(?:jpe?g|gif|bmp|png)/i)) {
  							purl = pa.attr('href');
  						}
  						url = self.attr('_elfsrc');
  						if (url) {
  							if (purl) {
  								$.inArray(purl, ret) == -1 && ret.push(purl);
  								$.inArray(url, check) == -1 &&  check.push(url);
  							} else {
  								$.inArray(url, ret) == -1 && ret.push(url);
  							}
  						}
  						// Probably it's clipboard data
  						if (ret.length === 1 && ret[0].match(/^data:image\/png/)) {
  							data.clipdata = true;
  						}
  					});
  					atag = $('a[href]', tmp);
  					atag.each(function(){
  						var text, loc,
  							parseUrl = function(url) {
  								var a = document.createElement('a');
  								a.href = url;
  								return a;
  							};
  						if (text = $(this).text()) {
  							loc = parseUrl($(this).attr('href'));
  							if (loc.href && (atag.length === 1 || ! loc.pathname.match(/(?:\.html?|\/[^\/.]*)$/i) || $.trim(text).match(/\.[a-z0-9-]{1,10}$/i))) {
  								if ($.inArray(loc.href, ret) == -1 && $.inArray(loc.href, check) == -1) ret.push(loc.href);
  							}
  						}
  					});
  				} else {
  					var regex, m, url;
  					regex = /(http[^<>"{}|\\^\[\]`\s]+)/ig;
  					while (m = regex.exec(str)) {
  						url = m[1].replace(/&amp;/g, '&');
  						if ($.inArray(url, ret) == -1) ret.push(url);
  					}
  				}
  				return ret;
  			}
  		}