1var g_thumb_loader = { 2 _container: null, 3 _timer: null, 4 _array: null, 5 _onLoading: false, 6 init: function(container){ 7 var self = this; 8 this._container = container; 9 10 this.stop(); 11 12 this._array = new Array(0); 13 14 var find_class_name = "fcb"; 15 /* 16 var find_class_name = "picDiv"; 17 if(g_list_view.get()==1){ 18 find_class_name = "listDiv"; 19 } 20 */ 21 22 this._container.find("."+find_class_name).each(function( index ) { 23 if($(this).attr("data-thumb")==1){ 24 self._array.push({ item_con: $(this).find("#fileviewicon"), 25 uhref: $(this).attr("uhref"), 26 filename: $(this).attr("data-name") }); 27 28 } 29 }); 30 31 }, 32 setImage: function(item_con, thumb_image){ 33 var html_img = '<img src="data:image/jpeg;base64,' + thumb_image + '" width="80px" height="60px" onload="javascript:DrawImage(this,80,60);"></img>'; 34 35 item_con.attr("class", ""); 36 $(html_img).appendTo(item_con); 37 }, 38 start: function(){ 39 var self = this; 40 41 if(this._array.length<=0) 42 return; 43 44 this._timer = setInterval(function(){ 45 if(self._array.length<=0){ 46 clearInterval(self._timer); 47 return; 48 } 49 50 if(self._onLoading == true) return; 51 52 self._onLoading = true; 53 54 var load_item = self._array[0]; 55 var item_con = load_item.item_con; 56 var item_uhref = load_item.uhref; 57 var filename = myencodeURI(load_item.filename); 58 var loc = (g_storage.get('openurl')==undefined) ? "/" : g_storage.get('openurl'); 59 60 var thumb_image = g_storage.getl(item_uhref); 61 62 if(thumb_image!=undefined && thumb_image!=""){ 63 self.setImage(item_con, thumb_image); 64 self._array.shift(); 65 self._onLoading = false; 66 } 67 else{ 68 g_webdav_client.GETTHUMBIMAGE(loc, filename, function(error, statusstring, content){ 69 if(error==200){ 70 var data = parseXml(content); 71 var thumb_image = $(data).find('thumb_image').text(); 72 73 if(thumb_image!=""){ 74 self.setImage(item_con, thumb_image); 75 //g_storage.setl(item_uhref, thumb_image); 76 } 77 } 78 79 self._array.shift(); 80 self._onLoading = false; 81 }); 82 } 83 84 }, 100 ); 85 }, 86 stop: function(){ 87 this._array = null; 88 clearInterval(this._timer); 89 } 90};