| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 
 |  
 
// Initialisation de imageCache.js
 
var startTest = function() {
			// see console output for debug info
			ImgCache.options.debug = true;
			ImgCache.options.usePersistentCache = true;
 
			ImgCache.init();
		};
 
		if (typeof(cordova) !== 'undefined') {
			// cordova test
			console.log('cordova start');
			document.addEventListener('deviceready', startTest, false);
		} else {
			// normal browser test
			startTest();
		} 
 
 
 // Ramener les données
$.ajax({
            type: "GET",
            url: "http://cs-infoinfoxxxxxxxad/voir_images.php?callback=?",
            dataType: 'json',
             success : function(data) {
                 var localData = JSON.stringify(data); 
                 $.each(data, function(i, item) {  
                   ImgCache.cacheFile(item.items_name);
               });
	        window.localStorage.setItem('MosaicData', localData);
            }
        });
 
 // Appelle des template 
var localData = JSON.parse(window.localStorage.getItem('MosaicData'));
 this.el.find('#mosaique').html(photoView.mosaictemplate(localData));
 
 
 // Gestion du cache
$('img').each(function() {
                     target = $(this);
                    ImgCache.isCached(target.attr('src'), function(path, success){
                         if(success){
                           // already cached
                           ImgCache.useCachedFile(target);
                           console.log(target)
                         } else {
                           // not there, need to cache the image
                           ImgCache.cacheFile(target.attr('src'), function(){
                             ImgCache.useCachedFile(target);
                           });
                         }
                       });
                   });
                }); | 
Partager