source: extensions/Autosize/js/Affiche_script.js @ 6932

Last change on this file since 6932 was 6932, checked in by cljosse, 14 years ago

[Autosize]compatibles pamooramics


File size: 3.1 KB
RevLine 
[6932]1jQuery.noConflict();
2jQuery(document).ready(
[6912]3function (jQuery) {
4    //===================================================================       
5
6
7    jQuery(window).resize(function (event, ui) {
8        if (typeof (event) == 'undefined') return;
[6932]9
10
[6913]11        var Image = jQuery("#theImage").find("embed");
12        if (Image.length == 0) {
13
14            var Image = jQuery("#theImage").find("img");
[6932]15            if (Image.length == 0) {
16                Image = jQuery("#pamoorama");
17                if (!Image) return;
18
19            }
[6913]20        } else {
21            var TheImg = jQuery(Image).get(0);
22            img_height = TheImg.clientHeight;
23            img_width = TheImg.clientWidth;
24        }
[6912]25        var TheImg = jQuery(Image).get(0);
[6932]26
[6913]27        H00 = jQuery(TheImg).height();
28        W00 = jQuery(TheImg).width();
[6912]29
30        var sel0 = jQuery(TheImg).position();
31        if (!sel0) return;
[6913]32
[6932]33        mini_width = parseInt(mini_width);
34        mini_height = parseInt(mini_height);
35
[6912]36        W0 = parseInt(img_width);
[6932]37        if (W0 < mini_width) return;
[6912]38
39        H0 = parseInt(img_height);
[6915]40        if (H0 < parseInt(mini_height)) return;
[6912]41
42        var rapport = (W0 / H0);
[6932]43
[6912]44        var Licence = jQuery("#theImage").find(".licencetag");
45        if (Licence.length > 0) {
46            var lmt = jQuery(Licence.get(0)).height();
47            jQuery(Licence.get(0)).css("top", "0px");
48
49        } else { var lmt = 0; }
50
51
52        var winheight = jQuery(window).height();
[6915]53        var Image_height = (winheight - sel0.top) - parseInt(marge_basse) - lmt;
[6912]54        var height_user = eval(user_status + "_height");
55        var width_user = eval(user_status + "_width");
[6915]56        //=============================================================
[6912]57        var reg1 = new RegExp("%", "g");
58        if (height_user.match(reg1))
59            Image_height = Image_height * parseInt(height_user) / 100;
60        else
61            Image_height = parseInt(height_user);
[6915]62        //=============================================================
[6912]63
64        var echelle = Image_height / H0;
65
66        if (echelle > parseInt(echelle_max)) {
67            echelle = echelle_max;
68            Image_height = parseInt(img_height * echelle);
69        }
70
71        var Imgage_Width = parseInt(Image_height * rapport);
72
73        jQuery(TheImg).height(Image_height + "px");
74        jQuery(TheImg).width(Imgage_Width + "px");
75
76        jQuery("img.logo88x31").css("position", "relative");
77        jQuery("#theImage").css("paddingBottom", "0px");
78        lmt = jQuery("#theImage span").height();
79        var top = jQuery("#theImage").position().top;
[6932]80
[6912]81        jQuery("#theImage").height(Image_height + "px");
82
[6932]83
84
[6912]85        jQuery("#theImage").width("100%");
86        try {
87            // pour les themes Gally
88            initializeImageMode('resize');
89        } catch (e) { }
90        return;
91    });
92
93    //===================================================================         
94    jQuery(window).resize();
95
96    jQuery(window).resize();
97
98});   
99
100//=========================================================
101 
Note: See TracBrowser for help on using the repository browser.