Changeset 7124 for extensions
- Timestamp:
- Oct 7, 2010, 1:00:14 PM (14 years ago)
- Location:
- extensions/Autosize
- Files:
-
- 6 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Autosize/admin/template/admin.tpl
r6983 r7124 1 1 {html_head} 2 2 <script type="text/javascript"> 3 var thumbnail = '{$thumbnail}'; 3 4 var theme = '{$theme}'; 5 var version = '{$version}'; 6 var scaled_width = '{$SCALED_WIDTH}'; // valeur par defaut 7 var scaled_height = '{$SCALED_HEIGHT}'; // valeur par defaut 4 8 var img_width = '{$IMG_WIDTH }'; 5 9 var img_height = '{ $IMG_HEIGHT }'; 10 6 11 var marge_basse = '{ $MARGE_BASSE }'; 7 12 var echelle_max = '{ $ECHELLE_MAX }'; -
extensions/Autosize/include/affiche.php
r6978 r7124 2 2 3 3 $visible=(isset($visible))?$visible:true; 4 $img_width=isset($picture['current']['width'])?$picture['current']['width']: 200;5 $img_height=isset($picture['current']['height'])?$picture['current']['height']: 200;4 $img_width=isset($picture['current']['width'])?$picture['current']['width']:480; 5 $img_height=isset($picture['current']['height'])?$picture['current']['height']:320; 6 6 $version=isset($version)?$version:""; 7 7 $theme=$user['theme']; … … 10 10 $template->assign( 11 11 array( 12 'thumbnail' => $conf['prefix_thumbnail'], 12 13 'visible' => $visible, 13 14 'version' => $version, 14 15 'AUTOSIZE_PATH' => AUTOSIZE_PATH, 15 16 'theme' => $theme, 16 'SCALED_WIDTH' 17 'SCALED_HEIGHT' 17 'SCALED_WIDTH' => $picture['current']['scaled_width'], 18 'SCALED_HEIGHT' => $picture['current']['scaled_height'], 18 19 'IMG_WIDTH' => $img_width, 19 20 'IMG_HEIGHT' => $img_height, -
extensions/Autosize/js/Affiche_script.js
r7013 r7124 1 2 //==== remplace $(... avec jQuery( ==== 3 var ov_map; 1 /* 2 var thumbnail= '{$thumbnail}'; 3 var theme = '{$theme}'; 4 var version = '{$version}'; 5 var scaled_width = '{$SCALED_WIDTH}'; // valeur par defaut 6 var scaled_height = '{$SCALED_HEIGHT}'; // valeur par defaut 7 var img_width = '{$IMG_WIDTH }'; 8 var img_height = '{ $IMG_HEIGHT }';$picture['current']['height'] 9 10 var marge_basse = '{ $MARGE_BASSE }'; 11 var echelle_max = '{ $ECHELLE_MAX }'; 12 var mini_width = '{ $MINI_WIDTH }'; 13 var mini_height = '{ $MINI_HEIGHT }'; 14 15 var webmaster_width = '{$webmaster_width }'; 16 var webmaster_height = '{ $webmaster_height }'; 17 var admin_width = '{ $admin_width }'; 18 var admin_height = '{ $admin_height }'; 19 var generic_width = '{ $generic_width }'; 20 var generic_height = '{ $generic_height }'; 21 var guest_width = '{ $guest_width }'; 22 var guest_height = '{$guest_height}'; 23 var normal_width = '{$normal_width}'; 24 var normal_height = '{$normal_height}'; 25 var user_status = '{$user_status}'; 26 var user_status = '{$user_status}'; 27 var check_auto_w = '{$check_auto_w}'; 28 */ 29 4 30 var d1 = 0; 5 var init_tb = 0; 6 function $(element) { 7 //========== test jQuery =============== 8 new_element = jQuery(element); 9 jq = new_element.selector; 10 if (jQuery("#Panorama").length) { 11 12 return new_element; 13 } 14 afq = jQuery(document).data("initialized") ; //2 15 if (element == window && afq != 1) 16 if (init_tb==1) { 17 init_tb = 2; 18 return new_element; 19 } 20 21 if (new_element.context && afq!=1 && afq != undefined ) { 22 if (init_tb != 2) init_tb = 1; 23 return new_element; 31 var init_tb = 0; 32 33 function set_autosize() { 34 visible = !visible; 35 36 } 37 38 /* ready 39 * 40 * 41 */ 42 jQuery(document).ready( 43 44 function (jQuery) { 45 /* jQuery */ 46 var img_init = { height: img_height, width: img_width }; // taille initiale 47 var img_defaut = { height: scaled_height, width: scaled_width }; 48 var img_reelle = { height: img_height, width: img_width }; 49 var img_finale = { height: 0, width: 0 }; 50 var zone_affichage = { height: 0, width: 0 }; 51 /* 52 * recherche la plus grande image (hauteur ou largeur) 53 */ 54 function Get_Img_Maxi(myobj) { 55 var w00 = 0; 56 var TheImg = null; 57 jQuery(myobj).each(function (i) { 58 w0 = this.width; 59 h0 = this.height; 60 if (h0 > w0) w0 = h0; 61 if (w0 > w00) { 62 if (!this.nameProp.match(RegExp(thumbnail, "g"))) { 63 TheImg = this; 64 w00 = w0; 65 } 66 67 } 68 }); 69 return TheImg; 24 70 } 25 if (new_element.context) 26 if (new_element.context.loaded) { 27 return new_element; 71 /* 72 * Get_val_int 73 * params: element,valeur maxi 74 * return: valeur entiere 75 */ 76 function Get_Val_int(myObj, Maxi_val) { 77 var val = 0; 78 var reg1 = new RegExp("%", "g") 79 Maxi_val = parseInt(Maxi_val || 400); 80 81 if (!myObj) return Maxi_val; 82 if (myObj == "none") return Maxi_val; 83 if (myObj == "auto") return Maxi_val; 84 if (myObj.match(reg1)) 85 val = myObj * Maxi_val / 100; 86 else 87 val = parseInt(myObj); 88 if (typeof (val) == "NaN") return Maxi_val; 89 return val; 28 90 } 29 init_tb = 0; 30 tp1 = typeof(MooTools); 31 if (tp1 != "undefined") { 32 //==== mootools prototype ==== 33 if (MooTools.version == "1.2.4") { 34 return jQuery(element).get(0); 35 36 }else if( MooTools.version == "1.11") { 37 B = element; 38 if (!B) { 39 if (typeof (B) == "boolean") return null; 40 return jQuery(); 41 } 42 if (B.htmlElement) { 43 return Garbage.collect(B); 44 91 92 /* 93 * Marge_haute 94 * params: element,boolean ajoute_h(ajoute la hauteur de l'element) 95 * return: valeur margin+padding+[hauteur] 96 */ 97 function Marge_haute(myObj, ajoute_h) { 98 Mon_obj = jQuery(myObj); 99 if (Mon_obj.length == 0) return 0; 100 101 if (ajoute_h) h_p = parseInt(jQuery(myObj).height()); 102 else h_p = 0; 103 104 if (jQuery(myObj).css("marginTop")) 105 if (jQuery(myObj).css("marginTop") != "auto") h_p += parseInt(jQuery(myObj).css("marginTop")); 106 if (jQuery(myObj).css("marginBottom")) 107 if (jQuery(myObj).css("marginBottom") != "auto") h_p += parseInt(jQuery(myObj).css("marginBottom")); 108 if (jQuery(myObj).css("paddingTop")) 109 if (jQuery(myObj).css("paddingTop") != "auto") h_p += parseInt(jQuery(myObj).css("paddingTop")); 110 if (parseInt(jQuery(myObj).css("paddingBottom"))) 111 if (jQuery(myObj).css("paddingBottom") != "auto") h_p += parseInt(jQuery(myObj).css("paddingBottom")); 112 return h_p; 113 } 114 //=================================================================== 115 var old_w = 0; 116 var old_h = 0; 117 var rapport = -1; 118 var init_taille_thumblink = { height: 0, width: 0 }; 119 /* 120 * window .resize 121 */ 122 jQuery(window).resize(function (event, ui) { 123 if (typeof (event) == 'undefined') return; 124 125 w1 = jQuery(window).width(); 126 h1 = jQuery(window).height(); 127 128 129 if (!visible) return; 130 if (old_w == w1 && old_h == h1) return; 131 132 if (old_w != w1) { 133 old_w = w1; 134 } else { 135 if (old_h != h1) old_h = h1; 136 } 137 var Type_Img = ""; 138 //====== détection du type d'images ====== 139 if (jQuery("#charlie").length > 0) { 140 Type_Img = "charlie"; 141 } else if (jQuery("#pamoorama").length) { 142 Type_Img = "pamoorama"; 143 } else if (jQuery("#theImage embed").length > 0) { 144 Type_Img = "embed"; 145 } else if (jQuery("#map").length) { 146 Type_Img = "map"; 147 } else if (jQuery("#Panorama").length) { 148 Type_Img = "panorama"; 149 } else if (jQuery("#theImage").find("img").length > 0) { 150 Type_Img = "img"; 151 } else if (jQuery("img").length > 0) { 152 Type_Img = "img_autre"; 153 return; 154 } else { 155 return; 156 } 157 158 var winwidth = old_w; 159 var twidth = jQuery("#imageHeaderBar").width(); 160 var twidth1 = jQuery("#imageToolBar").width(); 161 162 var winheight = old_h; 163 //==== récupère Img la plus grande ===== 164 if (jQuery("#theImg")) IMG = "#theImg"; 165 else IMG = "#theImage"; 166 167 TheImg2 = Get_Img_Maxi(IMG + " img"); 168 //================================================================= 169 if (TheImg2 == null) { 170 if (jQuery("#theImage").find("img").length > 0) { 171 IMG = "#theImage"; 172 TheImg = Get_Img_Maxi("#theImage img"); 45 173 } 46 if ([window, document].contains(B)) { return B; } 47 var A = $type(B); 48 if (A == "string") { B = document.getElementById(B); A = (B) ? "element" : false; } 49 if (A != "element") { 50 return null; 174 } else { 175 TheImg = TheImg2 176 177 } 178 179 //================================================================= 180 switch (Type_Img) { 181 case "map": 182 183 jQuery("#content").height(winheight); 184 185 var TheImg = jQuery("#map").get(0); 186 pos_image = jQuery("#map").position(); 187 pos_page = jQuery("#the_page").position(); 188 189 190 break 191 192 193 case "panorama": 194 195 var w00 = 0; 196 jQuery("#Panorama img").each(function (i) { 197 w0 = this.width; 198 if (w0 > w00) { 199 TheImg = this; 200 n = TheImg.nameProp; 201 w00 = w0; 202 } 203 }); 204 205 pos_image = jQuery(TheImg).position(); 206 pos_page = jQuery("#the_page").position(); 207 208 break 209 case "img": 210 211 if (!TheImg) return; 212 pos_image = jQuery(TheImg).position(); 213 pos_page = jQuery("#the_page").position(); 214 215 216 break 217 case "img_autre": 218 if (!TheImg) return; 219 pos_image = jQuery(TheImg).position(); 220 pos_page = jQuery("#the_page").position(); 221 222 223 break 224 case "embed": 225 // 226 227 var TheImg = jQuery("#theImage").find("embed"); 228 229 pos_image = jQuery("#theImage").position(); 230 pos_page = jQuery("#the_page").position(); 231 if (rapport < 0) { 232 img_height = parseInt(TheImg.height); 233 img_width = parseInt(TheImg.width); 234 235 img_reelle.height = parseInt(TheImg.height); 236 img_reelle.width = parseInt(TheImg.width); 237 } 238 239 break 240 case "charlie": 241 242 var TheImg = jQuery('#charlie object').get(0); 243 pos_image = jQuery("#theImage").position(); 244 pos_page = jQuery("#the_page").position(); 245 if (rapport < 0) { 246 img_height = parseInt(TheImg.height); 247 img_width = parseInt(TheImg.width); 248 249 img_reelle.height = parseInt(TheImg.height); 250 img_reelle.width = parseInt(TheImg.width); 251 } 252 253 break 254 case "pamoorama": 255 //========================================================= 256 var Images = jQuery("#pamoorama img"); 257 var Image = jQuery("#pamoorama").find("img"); 258 259 pos_image = jQuery("#pamoorama").position(); 260 pos_page = jQuery("#the_page").position(); 261 break 262 return; 263 264 } 265 //=============== Vérification taille minimale autorizée ====================== 266 miniWidth = Get_Val_int(jQuery(TheImg).css("min-width"), mini_width); 267 miniHeight = Get_Val_int(jQuery(TheImg).css("min-height"), mini_height); 268 maxWidth = Get_Val_int(jQuery(TheImg).css("max-width"), winwidth); 269 maxHeight = Get_Val_int(jQuery(TheImg).css("max-height"), winheight); 270 271 mini_width = parseInt(miniWidth); 272 mini_height = parseInt(miniHeight); 273 274 img_reelle.width = parseInt(img_reelle.width); 275 if (img_reelle.width < mini_width) return; 276 277 img_reelle.height = parseInt(img_reelle.height); 278 if (img_reelle.height < parseInt(mini_height)) return; 279 //================================================================================== 280 if (rapport < 0) { 281 img_init.height = parseInt(img_height || TheImg.height); 282 img_init.width = parseInt(img_width || TheImg.width); 283 rapport = img_width / img_height; 284 if (Type_Img != "map") 285 rapport = (img_init.width / img_init.height); 286 else 287 rapport = -1; 288 289 } 290 291 292 //=============== Zone d'affichage ============================ 293 zone_affichage.width = winwidth - 0 - (pos_page.left * 2) - 5; 294 zone_affichage.height = winheight - 0 - pos_page.top; 295 296 297 //=========================================================================== 298 var sel0 = { top: 0 }; 299 sel0.top += Marge_haute("#theHeader", true); 300 301 sel0.top += Marge_haute("#imageHeaderBar", true); 302 if (!theme.match(RegExp("gally", "g"))) { 303 sel0.top += Marge_haute("#imageToolBar", true); 304 } else { 305 sel0.top += Marge_haute(TheImg, false); 306 } 307 if (jQuery("#theImage").css("marginTop")) 308 if (jQuery("#theImage").css("marginTop") != "auto") 309 sel0.top += parseInt(jQuery("#theImage").css("marginTop")); 310 if (jQuery("#theImage").css("paddingTop")) 311 if (jQuery("#theImage").css("paddingTop") != "auto") 312 sel0.top += parseInt(jQuery("#theImage").css("paddingTop")); 313 314 img_top = 0; 315 if (jQuery("#theImage").css("position") != "absolute") 316 zone_affichage.height -= sel0.top; 317 318 if (theme.match(RegExp("gally", "g"))) { img_top = sel0.top } 319 jQuery("#theImage").css("top", img_top + "px") 320 321 jQuery("#theImage #theImg IMG").css("marginTop", "0px") 322 323 324 325 var lmt = 0; 326 h = 0; 327 //================ Licence ======================== 328 var Licence = jQuery("#theImage span"); 329 if (Licence.length > 0) { 330 jQuery("#theImage span").css("background", "blue"); 331 t1 = jQuery("#theImage span").position(); 332 h = jQuery("#theImage span").height(); 333 } 334 //==== paragraphe supplèmentaire === 335 if (jQuery("#theImage table")) { 336 jQuery("#theImage table").css("background", "yellow"); 337 t1 = jQuery("#theImage table").position(); 338 } 339 340 if (jQuery("#theImage p")) { 341 jQuery("#theImage p").css("background", "red"); 342 t1 = jQuery("#theImage p").position(); 343 h += jQuery("#theImage p").height(); 344 } 345 if (jQuery("#theImage br")) { 346 347 348 } 349 350 351 352 lmt = jQuery("#theImage span").height() - jQuery("#theImage p").height(); 353 354 //========================================================================== 355 Marge_Basse = parseInt(marge_basse || 0); 356 zone_affichage.height = zone_affichage.height - Marge_Basse; 357 358 var Image_height = zone_affichage.height - h; 359 360 var height_user = eval(user_status + "_height"); 361 362 //============================================================= 363 var reg1 = new RegExp("%", "g"); 364 if (height_user.match(reg1)) 365 Image_height = Image_height * parseInt(height_user) / 100; 366 else 367 Image_height = parseInt(height_user); 368 369 //============================================================ 370 echelle_max = parseFloat(echelle_max, '3'); 371 var echelle = parseFloat(Image_height / img_reelle.height, 3); 372 373 if (echelle > echelle_max) { echelle = echelle_max; } 374 375 Image_height = parseInt(img_reelle.height * echelle); 376 377 if (rapport > 0) var Image_Width = parseInt(Image_height * rapport); 378 else var Image_Width = parseInt(img_reelle.width * echelle); 379 //=============================================================== 380 381 align_auto = "center"; 382 if (jQuery("#theImg").css("textAlign")) 383 align_auto = jQuery("#theImg").css("textAlign"); 384 385 if (check_auto_w == 'checked="checked"') { 386 // if (Type_Img != "pamoorama" && Type_Img != "panorama" ) { 387 //==== largeur à atteindre === 388 var width_user = eval(user_status + "_width"); 389 // Largeur maximale en fonction du statut 390 if (width_user.match(reg1)) 391 // pourcentage 392 widthmin = twidth * parseInt(width_user) / 100; 393 else 394 widthmin = parseInt(width_user); 395 396 if (Image_Width > widthmin) { 397 // Image_Width largeur à atteindre 398 // Calcul du rapport d'agrandissement 399 var echelle_w = parseFloat(widthmin / img_reelle.width, 3); 400 if (echelle_w > echelle_max) { echelle_w = echelle_max; } 401 Image_Width = parseInt(img_reelle.width * echelle_w); 51 402 } 52 if (B.htmlElement) { return Garbage.collect(B); } 53 if (["object", "embed"].contains(B.tagName.toLowerCase())) { return B; } 54 $extend(B, Element.prototype); 55 B.htmlElement = function () { }; 56 return Garbage.collect(B); 57 } 58 // 59 } 60 tp1 = typeof(Prototype); 61 if (tp1 == "undefined") { return jQuery(element); } 62 if (Prototype.Version != '1.6.0.2') { 63 return jQuery(element); 64 } 65 66 //======== prototype.js ===================== 67 if (arguments.length > 1) { 68 for (var i = 0, elements = [], length = arguments.length; i < length; i++) 69 elements.push($(arguments[i])); 70 new_element= elements; 71 } 72 if (typeof(element)=="string") 73 element = jQuery("#" + element).get(0); 74 try { 75 new_element = Element.extend(element); 76 } catch (e) { 77 return new_element; 78 } 79 //================================================== 80 if (typeof (new_element) == "undefined") { 81 jQuery(document).data("initialized", 1); 82 return jQuery(); 83 } 84 return new_element; 85 86 } 87 88 jQuery(document).ready( 89 function (jQuery) { 90 91 function Marge_haute(myObj, ajoute_h) { 92 Mon_obj = jQuery(myObj); 93 if (Mon_obj.length == 0) return 0; 94 95 if (ajoute_h) h_p = parseInt(jQuery(myObj).height()); 96 else h_p = 0; 97 98 if (jQuery(myObj).css("marginTop")) 99 if (jQuery(myObj).css("marginTop") != "auto") h_p += parseInt(jQuery(myObj).css("marginTop")); 100 if (jQuery(myObj).css("marginBottom")) 101 if (jQuery(myObj).css("marginBottom") != "auto") h_p += parseInt(jQuery(myObj).css("marginBottom")); 102 if (jQuery(myObj).css("paddingTop")) 103 if (jQuery(myObj).css("paddingTop") != "auto") h_p += parseInt(jQuery(myObj).css("paddingTop")); 104 if (parseInt(jQuery(myObj).css("paddingBottom"))) 105 if (jQuery(myObj).css("paddingBottom") != "auto") h_p += parseInt(jQuery(myObj).css("paddingBottom")); 106 return h_p; 107 } 108 //=================================================================== 109 110 jQuery(window).resize(function (event, ui) { 111 if (typeof (event) == 'undefined') return; 112 t = event.type; 113 var Type_Img = ""; 114 //====== détection du type d'images ====== 115 var Image = jQuery("#theImage").find("embed"); 116 if (Image.length > 0) { 117 Type_Img = "embed"; 118 } else if (jQuery("#map").length) { 119 120 Type_Img = "map"; 121 122 123 } else if (jQuery("#pamoorama").length) { 124 125 Type_Img = "pamoorama"; 126 } else if (jQuery("#Panorama").length) { 127 128 Type_Img = "panorama"; 403 404 if (rapport > 0) Image_height = parseInt(Image_Width / rapport); 405 406 } 407 408 409 // } 410 411 zoom = echelle; 412 413 if (TheImg.src) { 414 w_init = TheImg.width; 415 h_init = TheImg.height; 416 } 417 // zone_affichage.height *= zoom; 418 // zone_affichage.width *= zoom; 419 //=============LLGBO2 =========================== 420 marges = 0; 421 422 if (jQuery("#gbo") && jQuery("#gbo div:first").length > 0) { 423 llgboframe = jQuery("#gbo div:first"); 424 marges = jQuery(llgboframe).width() - jQuery("#gbo div:last").width(); 425 cadre = {}; 426 m1 = jQuery(llgboframe).height(); 427 t1 = jQuery(llgboframe).position(); 428 429 430 if (TheImg.src) { 431 Image_height = Image_height - marges; 432 Image_Width = Image_Width - marges; 433 434 jQuery("#gbo").width(Image_Width + marges); 435 jQuery("#gbo").height(Image_height + marges); 436 jQuery("#gbo").css("width", Image_Width + marges + "px"); 437 jQuery("#gbo").css("height", Image_height + marges + "px"); 438 } else { 439 440 jQuery("#gbo").width(zone_affichage.width - marges); 441 jQuery("#gbo").height(Image_height + marges) 442 jQuery("#gbo").css("width", zone_affichage.width - marges + "px"); 443 jQuery("#gbo").css("height", Image_height - marges + "px") 444 445 } 446 447 448 449 if (jQuery("#prevnext")) { 450 areas = jQuery("area"); 451 452 } 453 454 455 } 456 457 //========================================================= 458 zone_affichage.height = (Image_height + marges) 459 jQuery("#linkNext").height(Image_height); 460 jQuery("#linkPrev").height(Image_height); 461 //================ Zone affichage ========================= 462 // Image_height, Image_Width = valeur a atteindre. 463 jQuery("#theImage").css("backgroundColor", "green"); 464 jQuery("#theImage").height(zone_affichage.height); 465 jQuery("#theImage").width(zone_affichage.width); 466 //============================================================== 467 img_finale.height = Image_height; 468 img_finale.width = Image_Width; 469 //============================================================== 470 471 if (Type_Img == "charlie") { 472 t1 = jQuery("#charlie").position(); 473 /**/ 474 pdf = 2 * parseInt(jQuery(".none_2").css("paddingRight")); 475 jQuery("#charlie").css("width", Image_Width + pdf); 476 jQuery("#charlie").css("height", Image_height); 477 jQuery("#charlie").css("margin", "auto"); 478 479 480 jQuery("#player").css("width", Image_Width + 100 + "px"); 481 jQuery("#player").css("height", Image_height); 482 483 jQuery("#embedplayer").css("width", Image_Width); 484 jQuery("#embedplayer").css("height", Image_height); 485 486 487 jQuery("object").width(Image_Width); 488 jQuery("object").height(Image_height); 489 } else if (Type_Img == "panorama") { 490 jQuery(TheImg).height(img_finale.height); 491 jQuery(TheImg).width(img_finale.width); 492 jQuery("#Panorama div").height(Image_height); 493 // class=simple_panorama 494 jQuery(TheImg).attr("id", "Img1"); 495 var settings = { 496 viewport_width: 600, 497 speed: 20000, 498 direction: 'left', 499 control_display: 'auto', 500 start_position: 0, 501 auto_start: true, 502 mode_360: true, 503 loop_180: true 504 }; 505 element = TheImg; //panorama_animate(element, elemWidth, settings); 506 n = $.fn; 507 pc = jQuery(TheImg) 508 options = pc.extend(); 509 510 if (options) jQuery.extend(settings, options); 511 512 513 n = 1; 514 ; 515 516 517 /* 518 jQuery("DIV .panoramaContainer").css("background", "red"); 519 jQuery("DIV .panoramaContainer").css("background", "red"); 520 jQuery("DIV .panoramaViewport").css("background", "red"); 521 jQuery("DIV .panoramaControl").css("background", "red"); 522 */ 523 524 } else if (Type_Img == "pamoorama") { 525 526 527 jQuery("#pamoorama").css("height", Image_height + "px"); 528 jQuery("#pamoorama").css("width", twidth + "px"); 529 530 jQuery("#pamoorama").height(Image_height); 531 jQuery("#pamoorama").width(twidth); 532 533 534 535 jQuery("#pamoorama_outter").height(Image_height); 536 jQuery("#pamoorama_outter").width(twidth); 537 538 jQuery("#pamoorama_outter").css("height", Image_height + "px"); 539 jQuery("#pamoorama_outter").css("width", twidth + "px"); 540 jQuery("#pamoorama_footer").width(twidth); 541 jQuery("#pamoorama_footer").css('width', twidth + "px"); 542 zoom = Image_height / img_height; 543 544 h_frame = jQuery("#pamoorama_frame").height(); 545 h_width = jQuery("#pamoorama_frame").width(); 546 jQuery(TheImg).css("zoom", zoom); 547 548 549 550 } else if (TheImg.src) { 551 //--- background ?? --- 552 jQuery(TheImg).height(img_finale.height); 553 jQuery(TheImg).width(img_finale.width); 554 jQuery(TheImg).css("height", img_finale.height + "px"); 555 jQuery(TheImg).css("width", img_finale.width + "px"); 556 557 } else { 558 559 jQuery(TheImg).height(img_finale.height); 560 jQuery(TheImg).width(img_finale.width); 561 } 562 563 564 try { 565 if (theme.match(RegExp("gally", "g"))) { 566 if (init_taille_thumblink.height == 0) 567 init_taille_thumblink = { height: jQuery(".thumbLink").height(), width: jQuery(".thumbLink").height() }; 568 569 jQuery(".thumbLink").css("height", init_taille_thumblink.height + "px"); 570 jQuery(".thumbLink").css("width", init_taille_thumblink.width + "px"); 571 } 572 } catch (e) { 573 574 } 575 // 576 jQuery(window).resize(); 129 577 return; 130 } else if (jQuery("#theImage").find("img").length > 0) { 131 Type_Img = "img"; 132 } else if (jQuery("img").length > 0) { 133 Type_Img = "img_autre"; 134 } else { 135 return; 136 } 137 var winheight = jQuery(window).height(); 138 var winwidth = jQuery(window).width(); 139 //================================================================= 140 switch (Type_Img) { 141 case "map": 142 143 144 jQuery("#content").height(winheight); 145 var Image = jQuery("#map"); 146 var TheImg = jQuery("#map").get(0); 147 position = jQuery("#map").position(); 148 l2 = jQuery("#the_page").position(); 149 img_height = winheight - position.top - l2.top; 150 img_width = winwidth - position.left - (l2.left * 2) - 5; 151 152 153 break 154 case "img": 155 var Image = jQuery("#theImage").find("img"); 156 var TheImg = jQuery("#theImg").find("img").get(0); 157 if (!TheImg) 158 TheImg = jQuery(Image).get(0); 159 break 160 case "img_autre": 161 var Image = jQuery("img"); 162 var TheImg = jQuery(Image).get(0); 163 break 164 case "embed": 165 var Image = jQuery("#theImage").find("embed"); 166 var TheImg = jQuery(Image).get(0); 167 img_height = TheImg.clientHeight; 168 img_width = TheImg.clientWidth; 169 break 170 case "pamoorama": 171 //========================================================= 172 var Images = jQuery("#pamoorama"); 173 var Image = jQuery(Images).get(0); 174 175 var TheImg = jQuery("#pamoorama").get(0); 176 if (!TheImg) return; 177 TheImg = jQuery("#pamoorama_inner"); 178 if (TheImg.length < 1) return; 179 180 break 181 } 182 183 //================================================================================== 184 185 var sel0 = jQuery(TheImg).position(); 186 jQuery("#theImage").css("top", sel0.top + "px") 187 jQuery().relativize("#theImage"); 188 if (!sel0) return; 189 type_pos = jQuery(TheImg).css("position"); //static 190 191 sel0.top = 0; 192 sel0.top += Marge_haute("#theHeader", true); 193 194 sel0.top += Marge_haute("#imageHeaderBar", true); 195 if (!theme.match(RegExp("gally", "g"))) { 196 sel0.top += Marge_haute("#imageToolBar", true); 197 } else { 198 sel0.top += Marge_haute(TheImg, false); 199 } 200 if (jQuery("#theImage").css("marginTop")) 201 if (jQuery("#theImage").css("marginTop") != "auto") 202 sel0.top += parseInt(jQuery("#theImage").css("marginTop")); 203 if (jQuery("#theImage").css("paddingTop")) 204 if (jQuery("#theImage").css("paddingTop") != "auto") 205 sel0.top += parseInt(jQuery("#theImage").css("paddingTop")); 206 207 img_top = 0; 208 209 if (theme.match(RegExp("gally", "g"))) { img_top = sel0.top } 210 jQuery("#theImage").css("top", img_top + "px") 211 212 213 mini_width = parseInt(mini_width); 214 mini_height = parseInt(mini_height); 215 216 W0 = parseInt(img_width); 217 if (W0 < mini_width) return; 218 219 H0 = parseInt(img_height); 220 if (H0 < parseInt(mini_height)) return; 221 if (Type_Img != "map") 222 var rapport = (W0 / H0); 223 else 224 var rapport = -1; 225 226 //========================================================================== 227 var Licence = jQuery("#theImage").find(".licencetag"); 228 if (Licence.length > 0) { 229 var lmt = jQuery(Licence.get(0)).height(); 230 h_p = jQuery(Licence.get(0)).height(); 231 jQuery(Licence.get(0)).css("position", "relative"); 232 233 jQuery(Licence.get(0)).css("top", "0px"); 234 235 } else { 236 var lmt = 0; 237 238 } 239 //==== paragraphe supplèmentaire === 240 if (jQuery("#theImage").find("p")) { 241 h_p = 0; 242 Pars = jQuery("#theImage").find("p"); 243 244 for (var i = 0; i < Pars.length; i++) { 245 P0 = Pars.get(i); 246 h_p += Marge_haute(P0, true); 247 } 248 249 // n_t = (p_p.top - Image_height) + h_p; 250 251 lmt += h_p; 252 jQuery("#theImage").css("paddingBottom", 0 + "px"); 253 } 254 255 //========================================================================== 256 257 var Image_height = (winheight - sel0.top) - parseInt(marge_basse) - lmt; 258 var height_user = eval(user_status + "_height"); 259 260 //============================================================= 261 var reg1 = new RegExp("%", "g"); 262 if (height_user.match(reg1)) 263 Image_height = Image_height * parseInt(height_user) / 100; 264 else 265 Image_height = parseInt(height_user); 266 267 //============================================================ 268 echelle_max = parseFloat(echelle_max, '3'); 269 var echelle = parseFloat(Image_height / H0, 3); 270 271 if (echelle > echelle_max) { 272 echelle = echelle_max; 273 Image_height = parseInt(H0 * echelle); 274 } 275 276 if (rapport > 0) 277 var Image_Width = parseInt(Image_height * rapport); 278 else 279 var Image_Width = parseInt(W0); 280 //=============================================================== 281 twidth = jQuery("#imageHeaderBar").width(); 282 img_la = jQuery(TheImg).width(); //initiale 283 offset = jQuery(TheImg).position(); 284 285 var width_user = eval(user_status + "_width"); 286 align_auto = "center"; 287 if (check_auto_w == 'checked="checked"') { 288 if (Type_Img != "pamoorama") { 289 widthmin = (winwidth - offset.left); 290 291 if (Image_Width > widthmin) { 292 //============================================================= 293 if (width_user.match(reg1)) 294 Image_Width = Image_Width * parseInt(width_user) / 100; 295 else 296 Image_Width = parseInt(width_user); 297 298 var echelle_w = parseFloat(winwidth / W0, 3); 299 if (echelle_w > echelle_max) { 300 echelle_w = echelle_max; 301 Image_Width = parseInt(W0 * echelle_w); 302 } 303 Image_Width = parseInt(W0 * echelle_w); 304 305 align_auto = "left"; 306 } else { 307 308 align_auto = "center"; 309 } 310 Image_height = parseInt(Image_Width / rapport); 311 312 } 313 314 315 } 316 //============================================================= 317 318 if (Type_Img == "pamoorama") { 319 320 321 jQuery("#pamoorama").css("height", Image_height + "px"); 322 jQuery("#pamoorama").css("width", twidth + "px"); 323 324 jQuery("#pamoorama").height(Image_height + "px"); 325 jQuery("#pamoorama").width(twidth + "px"); 326 327 328 329 jQuery("#pamoorama_outter").height(Image_height + "px"); 330 jQuery("#pamoorama_outter").width(twidth + "px"); 331 332 jQuery("#pamoorama_outter").css("height", Image_height + "px"); 333 jQuery("#pamoorama_outter").css("width", twidth + "px"); 334 335 zoom = Image_height / img_height; 336 337 h_frame = jQuery("#pamoorama_frame").height(); 338 h_width = jQuery("#pamoorama_frame").width(); 339 jQuery(TheImg).css("zoom", zoom); 340 341 342 343 } else { 344 345 346 if (jQuery("#theImg").css("textAlign")) 347 jQuery("#theImg").css("textAlign", align_auto); 348 349 jQuery(TheImg).height(Image_height + "px"); 350 jQuery(TheImg).width(Image_Width + "px"); 351 jQuery(TheImg).css("height", Image_height + "px"); 352 jQuery(TheImg).css("width", Image_Width + "px"); 353 354 } 355 try { 356 if (theme.match(RegExp("gally", "g"))) { 357 358 m = jQuery("#theImg"); 359 if (m.length > 0) initializeImageMode('resize'); 360 361 362 } else if (theme.match(RegExp("luciano", "g"))) { 363 jQuery("#theImage").height(Image_height); 364 } 365 } catch (e) { 366 367 } 368 // 369 370 return; 371 }); 372 373 //=================================================================== 374 375 376 jQuery(window).resize(); 377 jQuery(window).resize(); 378 379 380 /* */ 381 382 383 }); 578 }); 579 580 //=================================================================== 581 582 583 jQuery(window).resize(); 584 jQuery(window).resize(); 585 586 } // function 587 ); // ready 588 589 /* Extension 590 * absolutize: 591 * relativize: 592 */ 384 593 //========================================================= 385 594 jQuery.fn.extend({ 386 //-----------------------------------------------------------------387 absolutize: function(element) {388 element = jQuery(element).get(0);389 if (element.getStyle('position') == 'absolute') return;390 // Position.prepare(); // To be done manually by Scripty when it needs it.391 392 var offsets = element.positionedOffset();393 var top= offsets[1];394 var left= offsets[0];395 var width= element.clientWidth;396 var height= element.clientHeight;397 398 element._originalLeft = left - parseFloat(element.style.left|| 0);399 element._originalTop = top- parseFloat(element.style.top || 0);400 element._originalWidth= element.style.width;401 element._originalHeight = element.style.height;402 403 element.style.position = 'absolute';404 element.style.top= top + 'px';405 element.style.left= left + 'px';406 element.style.width= width + 'px';407 element.style.height = height + 'px';408 return element;409 },410 411 relativize: function(element) {412 element = jQuery(element).get(0);;413 if (jQuery(element).css('position') == 'relative') return;414 // Position.prepare(); // To be done manually by Scripty when it needs it.415 element._originalLeft =parseFloat(element.style.left || 0);416 element._originalTop =parseFloat(element.style.top || 0);417 element._originalWidth = element.style.width;418 element._originalHeight = element.style.height;419 420 element.style.position = 'relative';421 var top = parseFloat(element.style.top|| 0) - (element._originalTop || 0);422 var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);423 424 element.style.top= top + 'px';425 element.style.left= left + 'px';426 // element.style.height = element._originalHeight;427 // element.style.width = element._originalWidth;428 return element;429 }430 //=========================================================431 });// fin extend595 //------------------------------------------------------- 596 absolutize: function (element) { 597 element = jQuery(element).get(0); 598 if (element.getStyle('position') == 'absolute') return; 599 // Position.prepare(); // To be done manually by Scripty when it needs it. 600 601 var offsets = element.positionedOffset(); 602 var top = offsets[1]; 603 var left = offsets[0]; 604 var width = element.clientWidth; 605 var height = element.clientHeight; 606 607 element._originalLeft = left - parseFloat(element.style.left || 0); 608 element._originalTop = top - parseFloat(element.style.top || 0); 609 element._originalWidth = element.style.width; 610 element._originalHeight = element.style.height; 611 612 element.style.position = 'absolute'; 613 element.style.top = top + 'px'; 614 element.style.left = left + 'px'; 615 element.style.width = width + 'px'; 616 element.style.height = height + 'px'; 617 return element; 618 }, 619 620 relativize: function (element) { 621 element = jQuery(element).get(0); ; 622 if (jQuery(element).css('position') == 'relative') return; 623 // Position.prepare(); // To be done manually by Scripty when it needs it. 624 element._originalLeft = parseFloat(element.style.left || 0); 625 element._originalTop = parseFloat(element.style.top || 0); 626 element._originalWidth = element.style.width; 627 element._originalHeight = element.style.height; 628 629 element.style.position = 'relative'; 630 var top = parseFloat(element.style.top || 0) - (element._originalTop || 0); 631 var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0); 632 633 element.style.top = top + 'px'; 634 element.style.left = left + 'px'; 635 // element.style.height = element._originalHeight; 636 // element.style.width = element._originalWidth; 637 return element; 638 } 639 //========================================================= 640 }); // fin extend -
extensions/Autosize/language/en_UK/lang.php
r6934 r7124 1 1 <?php 2 2 global $lang; 3 3 $lang['cl_autosize_info_2'] = "No resizing Display."; 4 $lang['cl_autosize_info'] = 'Allows automatic resizing of the display with respect to explorer window.'; 4 5 $lang['cl_autosize_Howto'] = 'Display management'; 5 6 -
extensions/Autosize/language/fr_FR/description.txt
r6912 r7124 1 Permet d'ajuster automatiquement l'affichage en fonction de la fenêtre de l'explorateur.1 Permet d'ajuster automatiquement l'affichage en fonction de la fenêtre de l'explorateur. -
extensions/Autosize/language/fr_FR/lang.php
r6936 r7124 1 1 <?php 2 2 global $lang; 3 $lang['cl_autosize_info'] = "Permet d'ajuster automatiquement l'affichage en fonction de la fenêtre de l'explorateur."; 4 $lang['cl_autosize_info_2'] = "Affichage fixe."; 3 5 $lang['cl_autosize_Howto'] = "Gestion affichage"; 4 6 -
extensions/Autosize/main.inc.php
r7013 r7124 2 2 /* 3 3 Plugin Name: AutoSize 4 Version: 1.1.2 14 Version: 1.1.22 5 5 Description: Ajuste l'affichage des photos en fonction de la hauteur de la fenetre de navigation 6 6 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=448 … … 23 23 global $infos_message,$erreur_message; 24 24 global $conf,$lang ,$user; 25 load_language('lang', AUTOSIZE_PATH); 26 25 27 if ( $page['body_id']=='thePicturePage' ) { 26 28 if ( isset($picture['current'])){ … … 28 30 $autosize_parametres = cl_autosize_Get_Options(); 29 31 include (AUTOSIZE_PATH."include/affiche.php"); 32 33 $template->assign('cl_autosize_button', array( 34 'cl_autosize_info' => 'cl_autosize_info' , 35 'cl_autosize_info_2' => 'cl_autosize_info_2' , 36 37 'URL' => $_SERVER['REQUEST_URI'] , 38 'ICON2' => AUTOSIZE_PATH . 'icons/button-maximize.png', 39 'ICON' => AUTOSIZE_PATH . 'icons/button-minimize.png' 40 )); 41 42 $template->set_filenames(array('cl_bp' => $my_path. '/template/picture.tpl')); 43 $template->concat('PLUGIN_PICTURE_ACTIONS', $template->parse('cl_bp', true)); 30 44 31 45 $template->set_filenames( … … 131 145 $infos_message .=l10n("cl_autosize_save_config")."<br>"; 132 146 $autosize_parametres=cl_autosize_Set_Options(); 133 147 134 148 if ( isset($autosize_parametres) ) 135 149 { … … 145 159 } 146 160 //======================================================================= 147 //add_event_handler('render_element_content', 'cl_autosize_script', 98, 2 ); 161 add_event_handler('loc_end_section_init', 'cl_autosize_script', 60 ); 162 163 164 function cl_autosize_script() 165 { 166 $my_path = dirname(__FILE__).'/'; 148 167 149 function cl_autosize_script($content, $image) 150 { 151 global $user, $picture, $template,$page; 168 global $template; 152 169 153 global $element_info;154 global $infos_message,$erreur_message;155 global $conf,$lang ,$user;156 157 $my_path = dirname(__FILE__).'/';158 170 $template->set_filenames( 159 171 array('autosize_cl_init'=> $my_path.'template/cl_conflit.tpl') … … 164 176 ) 165 177 ); 166 return $content;178 return $template->parse( 'autosize_cl_init', false); 167 179 168 180 } -
extensions/Autosize/template/autosize.tpl
r7008 r7124 3 3 4 4 {known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.packed.js" now=1} 5 {known_script id="conflit_script" src=$AUTOSIZE_PATH|@cat:"js/conflit.js"} 5 6 {*jQuery is always available by default*} 6 7 <script type="text/javascript"> 7 var theme = '{$theme}'; 8 var img_width='{$IMG_WIDTH }'; 9 var img_height='{ $IMG_HEIGHT }'; 10 var marge_basse='{ $MARGE_BASSE }'; 11 var echelle_max='{ $ECHELLE_MAX }'; 12 var mini_width='{ $MINI_WIDTH }'; 13 var mini_height = '{ $MINI_HEIGHT }'; 8 var thumbnail = '{$thumbnail}'; 9 var theme = '{$theme}'; 10 var visible = '{$visible}'; 11 var version = '{$version}'; 12 var scaled_width = '{$SCALED_WIDTH}'; // valeur par defaut 13 var scaled_height = '{$SCALED_HEIGHT}'; // valeur par defaut 14 var img_width='{$IMG_WIDTH }'; 15 var img_height = '{ $IMG_HEIGHT }'; 14 16 15 var webmaster_width='{$webmaster_width }'; 16 var webmaster_height='{ $webmaster_height }'; 17 var admin_width='{ $admin_width }'; 18 var admin_height='{ $admin_height }'; 19 var generic_width='{ $generic_width }'; 20 var generic_height='{ $generic_height }'; 21 var guest_width='{ $guest_width }'; 22 var guest_height='{$guest_height}'; 23 var normal_width='{$normal_width}'; 24 var normal_height='{$normal_height}'; 25 var user_status='{$user_status}'; 26 var user_status = '{$user_status}'; 27 var check_auto_w = '{$check_auto_w}'; 17 var marge_basse='{ $MARGE_BASSE }'; 18 var echelle_max='{ $ECHELLE_MAX }'; 19 var mini_width='{ $MINI_WIDTH }'; 20 var mini_height = '{ $MINI_HEIGHT }'; 21 22 var webmaster_width='{$webmaster_width }'; 23 var webmaster_height='{ $webmaster_height }'; 24 var admin_width='{ $admin_width }'; 25 var admin_height='{ $admin_height }'; 26 var generic_width='{ $generic_width }'; 27 var generic_height='{ $generic_height }'; 28 var guest_width='{ $guest_width }'; 29 var guest_height='{$guest_height}'; 30 var normal_width='{$normal_width}'; 31 var normal_height='{$normal_height}'; 32 var user_status='{$user_status}'; 33 var user_status = '{$user_status}'; 34 var check_auto_w = '{$check_auto_w}'; 28 35 </script> 29 36 <style type="text/css"> 30 37 #theImage p{ldelim} 31 38 height:auto; 32 33 39 } 34 40 </style> … … 39 45 {known_script id="Affiche_script" src=$AUTOSIZE_PATH|@cat:"js/Affiche_script.js"} 40 46 <!-- << autosize/template/picture.tpl body --> 41 42 {html_head} 47 {html_head} 43 48 {/html_head} -
extensions/Autosize/template/picture.tpl
r6936 r7124 1 {* $Id: autosize/template/picture.tpl *}2 <!-- autosize/template/picture.tpl -->3 {html_head}4 {known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.packed.js" now=1}5 {*jQuery is always available by default*}6 <script type="text/javascript">7 //test 8 var img_width='{$IMG_WIDTH }';9 var img_height='{ $IMG_HEIGHT }';10 var marge_basse='{ $MARGE_BASSE }';11 var echelle_max='{ $ECHELLE_MAX }';12 var mini_width='{ $MINI_WIDTH }';13 var mini_height = '{ $MINI_HEIGHT }';1 <a><input id="bp_cla" 2 type="image" 3 style=" float:right;border:0px;" 4 src="{$cl_autosize_button.ICON}" 5 onclick = " Toggle_bp() " 6 title="{'cl_autosize_info_2'|@translate}" 7 alt="{'cl_autosize_info_2'|@translate}" /> 8 </a> 9 <script language=javascript type="text/javascript"> 10 src1="{$cl_autosize_button.ICON}"; 11 src2="{$cl_autosize_button.ICON2}"; 12 src3="{'cl_autosize_info_2'|@translate}"; 13 src4="{'cl_autosize_info'|@translate}"; 14 14 15 var webmaster_width='{$webmaster_width }'; 16 var webmaster_height='{ $webmaster_height }'; 17 var admin_width='{ $admin_width }'; 18 var admin_height='{ $admin_height }'; 19 var generic_width='{ $generic_width }'; 20 var generic_height='{ $generic_height }'; 21 var guest_width='{ $guest_width }'; 22 var guest_height='{ $guest_height }'; 23 var normal_width='{ $normal_width }'; 24 var normal_height='{ $normal_height }'; 25 var user_status='{ $user_status }'; 15 function Toggle_bp() 16 {ldelim} 17 visible = !visible ; 18 if (visible) src=src1 ; 19 else src=src2 ; 20 if (visible) src_info=src3 ; 21 else src_info=src4 ; 26 22 27 </script> 28 <style type="text/css"> 29 #theImage p{ldelim} 30 height:auto; 23 jQuery('#bp_cla').get(0).src=src ; 24 jQuery('#bp_cla').attr('alt',src_info); 25 jQuery('#bp_cla').attr('title',src_info); 26 old_w = 0; 27 jQuery(window).resize(); 28 } 29 </script> 31 30 32 }33 </style>34 {known_script id="Affiche_script" src=$AUTOSIZE_PATH|@cat:"js/Affiche_script.js"}35 <!-- << autosize/template/picture.tpl -->36 {/html_head}
Note: See TracChangeset
for help on using the changeset viewer.