1 | if (!window.console) console = {}; |
---|
2 | console.log = console.log || function(){}; |
---|
3 | console.warn = console.warn || function(){}; |
---|
4 | console.error = console.error || function(){}; |
---|
5 | console.info = console.info || function(){}; |
---|
6 | var fire_count=0; |
---|
7 | //http://4loc.wordpress.com/2009/04/28/documentready-vs-windowload/ |
---|
8 | //jQuery(document).ready(function (jQuery) { |
---|
9 | //jQuery(window).load(function () { |
---|
10 | jQuery("#ret_autosize").live("ON", function (e, a) { |
---|
11 | /* |
---|
12 | a.width= largeur de l'image |
---|
13 | a.height= hauteur de l'image |
---|
14 | a.theImage= l'objet image |
---|
15 | a.src_img= url de l'image |
---|
16 | */ |
---|
17 | fire_count = fire_count+1; |
---|
18 | if(dyn_mode=='FLOW' || dyn_mode=='FLOW0'){ |
---|
19 | console.log('info : returned by autosize are these a.width x a.height :'+a.width+'x'+a.height); |
---|
20 | console.log('info : returned by autosize are these a.window_width x a.window_height :'+a.window_width+'x'+a.window_height); |
---|
21 | |
---|
22 | console.log('saving in cookie the actual size ('+a.window_width+'x'+a.window_height+') for next pic'); |
---|
23 | jQuery.cookie("dynamic_width", a.window_width); |
---|
24 | jQuery.cookie("dynamic_height", a.window_height); |
---|
25 | }else if(dyn_mode =='XHR'){ |
---|
26 | //trying to download actual picture |
---|
27 | |
---|
28 | if (typeof dyn_src_img == "undefined") { |
---|
29 | console.error('var dyn_src_img is not defined !! please check template'); |
---|
30 | }else if(fire_count>1){ |
---|
31 | console.log('source not downloaded again'); |
---|
32 | }else{ |
---|
33 | console.log(dyn_src_img); |
---|
34 | console.log("fire_count:"+fire_count); |
---|
35 | //@todo: deal with alternative methods |
---|
36 | dyn_src='/slir/w'+a.width+'-h'+a.height+'/'+dyn_src_img; |
---|
37 | //dyn_src_img=dyn_src_img+'&dyn_width='+a.width+'&dyn_height='+a.height; |
---|
38 | console.log('dyn_src_img:'+dyn_src_img); |
---|
39 | a.theImage.src = dyn_src_img; |
---|
40 | } |
---|
41 | } |
---|
42 | }) |
---|
43 | //}) |
---|
44 | //}) |
---|
45 | function fire_ret_autosize(){ |
---|
46 | jQuery("#ret_autosize").trigger("ON"); |
---|
47 | } |
---|
48 | |
---|
49 | jQuery(document).ready(function (jQuery) { |
---|
50 | jQuery(window).load(function () { |
---|
51 | $("<div />").attr({ |
---|
52 | id: "prefetchContainer", |
---|
53 | }).appendTo("#tabZone").css({ display: "none" }); |
---|
54 | |
---|
55 | simpleLoad(next_dyn_url); |
---|
56 | |
---|
57 | }) |
---|
58 | }) |
---|
59 | |
---|
60 | |
---|
61 | |
---|
62 | |
---|
63 | |
---|
64 | |
---|
65 | |
---|
66 | |
---|
67 | |
---|
68 | //simple image load |
---|
69 | function simpleLoad(fileName) { |
---|
70 | $("<img />").attr({ |
---|
71 | id: "next_pic", |
---|
72 | src: fileName, |
---|
73 | title: fileName |
---|
74 | }).appendTo("#prefetchContainer").css({ display: "none" }); |
---|
75 | }; |
---|
76 | |
---|
77 | |
---|
78 | |
---|
79 | |
---|
80 | |
---|