mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-10 20:44:28 +09:00
#18073684 * resize_image 애드온 개선
* IE6에서 PNG 파일이 리사이즈 되지 않는 문제 고침 * image_gallery 컴포넌트와의 호환성 확보 #17980094 * image_gallery 컴포넌트 리스트형에서 원본보기가 안되는 문제 고침 git-svn-id: http://xe-core.googlecode.com/svn/sandbox@6660 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
69fbd4cf27
commit
2b4bc511ef
2 changed files with 55 additions and 66 deletions
|
|
@ -157,54 +157,46 @@ function slideshow(event) {
|
||||||
xScreen.xeShow();
|
xScreen.xeShow();
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function(){
|
/* DOM READY */
|
||||||
//if (jQuery.browser.safari && document.readyState != "complete"){
|
$(function() {
|
||||||
//setTimeout( arguments.callee, 100 );
|
var regx_skip = /(?:(modules|addons|classes|common|layouts|libs|widgets|widgetstyles)\/)/i;
|
||||||
//return;
|
var regx_allow_i6pngfix = /(?:common\/tpl\/images\/blank\.gif$)/i;
|
||||||
//}
|
/**
|
||||||
|
* 본문 폭 구하기 위한 개체
|
||||||
|
* IE6에서 본문폭을 넘는 이미지가 있으면 그 크기로 구해지는 문제 우회용
|
||||||
|
**/
|
||||||
|
var dummy = $('<div style="height:1; overflow:hidden; opacity:0; display:block; clear:both;"></div>');
|
||||||
|
|
||||||
var regx_skip = /(?:modules|addons|classes|common|layouts|libs|widgets)/i;
|
$('div.xe_content').each(function() {
|
||||||
var regx_parent = /(?:document|comment)_[0-9]+_[0-9]+/i;
|
dummy.appendTo(this);
|
||||||
|
var contentWidth = dummy.width();
|
||||||
|
dummy.remove();
|
||||||
|
if(!contentWidth) return;
|
||||||
|
|
||||||
$(".xe_content").each(function() {
|
$('img', this).each(function() {
|
||||||
$(this).find("img").each(function(){
|
var $img = $(this);
|
||||||
var img = $(this);
|
var imgSrc = $img.attr('src');
|
||||||
var width = img.attr("width");
|
if(regx_skip.test(imgSrc) && !regx_allow_i6pngfix.test(imgSrc)) return;
|
||||||
if(!width) width = img.width();
|
|
||||||
if(!width) return;
|
$img.attr('rel', 'xe_gallery');
|
||||||
img.attr("orig_width",width);
|
|
||||||
img.attr("width",1);
|
var beforSize = {'width':$img.width(), 'height':$img.height()};
|
||||||
|
if(beforSize.width && beforSize.width < contentWidth) return;
|
||||||
|
var resize_ratio = contentWidth / beforSize.width;
|
||||||
|
|
||||||
|
$img
|
||||||
|
.removeAttr('width').removeAttr('height')
|
||||||
|
.css({
|
||||||
|
'width':contentWidth,
|
||||||
|
'height':parseInt(beforSize.height * resize_ratio, 10)
|
||||||
|
});
|
||||||
});
|
});
|
||||||
var offsetWidth = $(this).width();
|
|
||||||
|
|
||||||
$(this).find("img").each(function(){
|
/* live 이벤트로 적용 (image_gallery 컴포넌트와의 호환 위함) */
|
||||||
var img = $(this);
|
$('img[rel=xe_gallery]', this).live('mouseover', function() {
|
||||||
if(!img.attr("orig_width")) return;
|
var $img = $(this);
|
||||||
var src = img.attr("src");
|
if(!$img.parent('a').length && !$img.attr('onclick')) {
|
||||||
img.attr("width",img.attr("orig_width"));
|
$img.css('cursor', 'pointer').click(slideshow);
|
||||||
img.removeAttr("orig_width",'');
|
|
||||||
var width = img.attr("width");
|
|
||||||
var height = img.attr("height");
|
|
||||||
|
|
||||||
// XE 내부 프로그램 또는 스킨의 이미지라면 이미지 리사이즈를 하지 않음
|
|
||||||
if ( !regx_skip.test(src) ) {
|
|
||||||
// 커스텀 속성 추가
|
|
||||||
img.attr("rel", "xe_gallery");
|
|
||||||
|
|
||||||
// 크기를 계산한다
|
|
||||||
if(width>offsetWidth) {
|
|
||||||
img.attr("width",offsetWidth-10);
|
|
||||||
img.attr("height",parseInt(offsetWidth/width*height,10));
|
|
||||||
}
|
|
||||||
|
|
||||||
// 링크가 설정되어 있거나 onclick 이벤트가 부여되어 있으면 원본 보기를 하지 않음
|
|
||||||
if ( !img.parent("a").size() && !img.attr("onclick") ) {
|
|
||||||
// 스타일 설정
|
|
||||||
img.css("cursor", "pointer");
|
|
||||||
|
|
||||||
// 클릭하면 슬라이드쇼 시작
|
|
||||||
img.click(slideshow);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -72,11 +72,8 @@ function start_list_gallery() {
|
||||||
obj.image.style.marginBottom = "10px";
|
obj.image.style.marginBottom = "10px";
|
||||||
obj.image.style.display = "block";
|
obj.image.style.display = "block";
|
||||||
|
|
||||||
// resize_scale이 1이 아니면, 즉 리사이즈 되었다면 해당 이미지 클릭시 원본을 새창으로 띄워줌
|
// 리사이즈 되었다면 resize_image 애드온의 slideshow() 기능 사용
|
||||||
if(resize_scale!=1 && typeof(showOriginalImage)=='function') {
|
if(resize_scale != 1) obj.image.rel = 'xe_gallery';
|
||||||
obj.image.style.cursor = 'pointer';
|
|
||||||
xAddEventListener(obj.image, 'click', showOriginalImage);
|
|
||||||
}
|
|
||||||
|
|
||||||
zone.appendChild(obj.image);
|
zone.appendChild(obj.image);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue