webp 지원하도록 수정중
This commit is contained in:
@ -1,64 +1,67 @@
|
|||||||
<!DOCTYPE HTML>
|
<!DOCTYPE HTML>
|
||||||
<html lang="ko">
|
<html lang="ko">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
|
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
|
||||||
<title>사진 첨부하기 :: SmartEditor2</title>
|
<title>사진 첨부하기 :: SmartEditor2</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<!-- Generic page styles -->
|
<!-- Generic page styles -->
|
||||||
<link rel="stylesheet" href="css/style.css?v=140715">
|
<link rel="stylesheet" href="css/style.css?v=140715">
|
||||||
<!-- CSS to style the file input field as button and adjust the Bootstrap progress bars -->
|
<!-- CSS to style the file input field as button and adjust the Bootstrap progress bars -->
|
||||||
<link rel="stylesheet" href="css/jquery.fileupload.css">
|
<link rel="stylesheet" href="css/jquery.fileupload.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="container pop_container">
|
<div class="container pop_container">
|
||||||
<!-- header -->
|
<!-- header -->
|
||||||
<div id="pop_header">
|
<div id="pop_header">
|
||||||
<h1>사진 첨부하기</h1>
|
<h1>사진 첨부하기</h1>
|
||||||
</div>
|
</div>
|
||||||
<!-- //header -->
|
<!-- //header -->
|
||||||
<div class="content_container">
|
<div class="content_container">
|
||||||
<div class="drag_explain">
|
<div class="drag_explain">
|
||||||
<p>마우스로 드래그하여 순서를 바꿀수 있습니다.</p>
|
<p>마우스로 드래그하여 순서를 바꿀수 있습니다.</p>
|
||||||
<div class="file_selet_group">
|
<div class="file_selet_group">
|
||||||
<span class="btn btn-success fileinput-button">
|
<span class="btn btn-success fileinput-button">
|
||||||
<span>파일선택</span>
|
<span>파일선택</span>
|
||||||
<!-- The file input field used as target for the file upload widget -->
|
<!-- The file input field used as target for the file upload widget -->
|
||||||
<input id="fileupload" type="file" name="files[]" multiple accept="image/*">
|
<input id="fileupload" type="file" name="files[]" multiple accept="image/*">
|
||||||
</span>
|
</span>
|
||||||
<button type="button" class="btn btn-danger delete" id="all_remove_btn">
|
<button type="button" class="btn btn-danger delete" id="all_remove_btn">
|
||||||
<span>전체삭제</span>
|
<span>전체삭제</span>
|
||||||
</button>
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="drag_area" id="drag_area">
|
||||||
|
<ul class="sortable" id="sortable">
|
||||||
|
</ul>
|
||||||
|
<em class="blind">마우스로 드래그해서 이미지를 추가해주세요.</em><span id="guide_text" class="bg hidebg"></span>
|
||||||
|
</div>
|
||||||
|
<div class="seletion_explain">이미지는 한번에 10개까지 선택할수 있습니다. 움직이는 webp 이미지는 업로드 불가합니다.</div>
|
||||||
|
<div class="btn_group">
|
||||||
|
<button type="button" class="btn" id="img_upload_submit">
|
||||||
|
<span>등록</span>
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn" id="close_w_btn">
|
||||||
|
<span>취소</span>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="drag_area" id="drag_area">
|
|
||||||
<ul class="sortable" id="sortable">
|
|
||||||
</ul>
|
|
||||||
<em class="blind">마우스로 드래그해서 이미지를 추가해주세요.</em><span id="guide_text" class="bg hidebg"></span>
|
|
||||||
</div>
|
|
||||||
<div class="seletion_explain">이미지는 한번에 10개까지 선택할수 있습니다.</div>
|
|
||||||
<div class="btn_group">
|
|
||||||
<button type="button" class="btn" id="img_upload_submit">
|
|
||||||
<span>등록</span>
|
|
||||||
</button>
|
|
||||||
<button type="button" class="btn" id="close_w_btn" >
|
|
||||||
<span>취소</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
|
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
|
||||||
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script>
|
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script>
|
||||||
<!-- The Iframe Transport is required for browsers without support for XHR file uploads -->
|
<!-- The Iframe Transport is required for browsers without support for XHR file uploads -->
|
||||||
<script src="./js/jquery.iframe-transport.js"></script>
|
<script src="./js/jquery.iframe-transport.js"></script>
|
||||||
|
|
||||||
<script type="text/javascript" src="./swfupload/swfupload.js"></script>
|
<script type="text/javascript" src="./swfupload/swfupload.js"></script>
|
||||||
<script type="text/javascript" src="./swfupload/jquery.swfupload.js"></script>
|
<script type="text/javascript" src="./swfupload/jquery.swfupload.js"></script>
|
||||||
|
|
||||||
<!-- The basic File Upload plugin -->
|
<!-- The basic File Upload plugin -->
|
||||||
<script src="./js/jquery.fileupload.js?v=140715"></script>
|
<script src="./js/jquery.fileupload.js?v=140715"></script>
|
||||||
|
|
||||||
|
<script src="./js/basic.js?v3"></script>
|
||||||
|
</body>
|
||||||
|
|
||||||
<script src="./js/basic.js?v3"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
</html>
|
||||||
@ -1,9 +1,9 @@
|
|||||||
jQuery.fn.bindAll = function(options) {
|
jQuery.fn.bindAll = function (options) {
|
||||||
var $this = this;
|
var $this = this;
|
||||||
jQuery.each(options, function(key, val){
|
jQuery.each(options, function (key, val) {
|
||||||
$this.bind(key, val);
|
$this.bind(key, val);
|
||||||
});
|
});
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
jQuery(function ($) {
|
jQuery(function ($) {
|
||||||
@ -11,130 +11,130 @@ jQuery(function ($) {
|
|||||||
|
|
||||||
var ed_nonce = '';
|
var ed_nonce = '';
|
||||||
|
|
||||||
if( !!opener && !!opener.window && !!opener.window.nhn ){
|
if (!!opener && !!opener.window && !!opener.window.nhn) {
|
||||||
ed_nonce = opener.window.nhn.husky.SE2M_Configuration.SE2M_Accessibility.ed_nonce;
|
ed_nonce = opener.window.nhn.husky.SE2M_Configuration.SE2M_Accessibility.ed_nonce;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change this to the location of your server-side upload handler:
|
// Change this to the location of your server-side upload handler:
|
||||||
var gnu = {
|
var gnu = {
|
||||||
url : './php/?_nonce='+ed_nonce,
|
url: './php/?_nonce=' + ed_nonce,
|
||||||
container_el : 'body',
|
container_el: 'body',
|
||||||
dreg_area : '#drag_area',
|
dreg_area: '#drag_area',
|
||||||
dreg_area_list : '#drag_area > ul',
|
dreg_area_list: '#drag_area > ul',
|
||||||
progress_bar : '#progress .progress-bar',
|
progress_bar: '#progress .progress-bar',
|
||||||
filter : /^(image\/bmp|image\/gif|image\/jpg|image\/jpeg|image\/png|image\/webp)$/i,
|
filter: /^(image\/bmp|image\/gif|image\/jpg|image\/jpeg|image\/png|image\/webp)$/i,
|
||||||
files : [],
|
files: [],
|
||||||
file_limit : 10, //한번에 올릴수 파일갯수 제한
|
file_limit: 10, //한번에 올릴수 파일갯수 제한
|
||||||
imgw : 100,
|
imgw: 100,
|
||||||
imgh : 70,
|
imgh: 70,
|
||||||
file_api_support : !!(window.ProgressEvent && window.FileReader),
|
file_api_support: !!(window.ProgressEvent && window.FileReader),
|
||||||
$elTextGuide : $("#guide_text"),
|
$elTextGuide: $("#guide_text"),
|
||||||
init : function(){
|
init: function () {
|
||||||
$(this.dreg_area_list).sortable({
|
$(this.dreg_area_list).sortable({
|
||||||
'cursor':'pointer',
|
'cursor': 'pointer',
|
||||||
'placeholder':'placeholder'
|
'placeholder': 'placeholder'
|
||||||
});
|
});
|
||||||
$(this.dreg_area_list).disableSelection();
|
$(this.dreg_area_list).disableSelection();
|
||||||
if( this.file_api_support ) this.$elTextGuide.removeClass("hidebg").addClass("showbg");
|
if (this.file_api_support) this.$elTextGuide.removeClass("hidebg").addClass("showbg");
|
||||||
},
|
},
|
||||||
file_push : function(file){
|
file_push: function (file) {
|
||||||
var othis = this,
|
var othis = this,
|
||||||
last = othis.files.length;
|
last = othis.files.length;
|
||||||
|
|
||||||
othis.files.push(file);
|
othis.files.push(file);
|
||||||
},
|
},
|
||||||
_readymodebg : function(){
|
_readymodebg: function () {
|
||||||
if( this.file_api_support ) {
|
if (this.file_api_support) {
|
||||||
var sClass = this.$elTextGuide.attr('class');
|
var sClass = this.$elTextGuide.attr('class');
|
||||||
if(sClass.indexOf('hidebg') > 0){
|
if (sClass.indexOf('hidebg') > 0) {
|
||||||
this.$elTextGuide.removeClass('hidebg');
|
this.$elTextGuide.removeClass('hidebg');
|
||||||
this.$elTextGuide.addClass('showbg');
|
this.$elTextGuide.addClass('showbg');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_startmodebg : function(){
|
_startmodebg: function () {
|
||||||
if( this.file_api_support ) {
|
if (this.file_api_support) {
|
||||||
var sClass = this.$elTextGuide.attr('class');
|
var sClass = this.$elTextGuide.attr('class');
|
||||||
if(sClass.indexOf('hidebg') < 0){
|
if (sClass.indexOf('hidebg') < 0) {
|
||||||
this.$elTextGuide.removeClass('showbg');
|
this.$elTextGuide.removeClass('showbg');
|
||||||
this.$elTextGuide.addClass('hidebg');
|
this.$elTextGuide.addClass('hidebg');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_delete : function(e){
|
_delete: function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var othis = gnu,
|
var othis = gnu,
|
||||||
$button = $(e.currentTarget),
|
$button = $(e.currentTarget),
|
||||||
delete_url = $button.attr("data-delete");
|
delete_url = $button.attr("data-delete");
|
||||||
if( delete_url ){
|
if (delete_url) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: othis.url+"&del=1&file="+ delete_url
|
url: othis.url + "&del=1&file=" + delete_url
|
||||||
}).done(function (result) {
|
}).done(function (result) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
$button.parents('li.sort_list').fadeOut(300, function(){
|
$button.parents('li.sort_list').fadeOut(300, function () {
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
var $dreg_area = $(othis.dreg_area_list);
|
var $dreg_area = $(othis.dreg_area_list);
|
||||||
$dreg_area.sortable('refresh');
|
$dreg_area.sortable('refresh');
|
||||||
if( !$dreg_area.children('li').length ) othis._readymodebg();
|
if (!$dreg_area.children('li').length) othis._readymodebg();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
_add : function(e, data, preload){
|
_add: function (e, data, preload) {
|
||||||
var othis = this;
|
var othis = this;
|
||||||
othis._startmodebg();
|
othis._startmodebg();
|
||||||
data.context = $('<li/>').addClass("sort_list").appendTo(this.dreg_area_list);
|
data.context = $('<li/>').addClass("sort_list").appendTo(this.dreg_area_list);
|
||||||
$.each(data.files, function (index, file) {
|
$.each(data.files, function (index, file) {
|
||||||
if ( !preload && !othis.filter.test(file.type)) {
|
if (!preload && !othis.filter.test(file.type)) {
|
||||||
data.context.remove();
|
data.context.remove();
|
||||||
alert('이미지만 허용합니다.');
|
alert('이미지만 허용합니다.');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
var node = $('<div/>')
|
var node = $('<div/>')
|
||||||
.append($('<span/>').text(file.name))
|
.append($('<span/>').text(file.name))
|
||||||
.append($('<span/>').addClass("delete_img").attr({"data-delete":file.name,"data-url":file.url}).html("<img src='./img/system_delete.png' alt='삭제' title='삭제' >")),
|
.append($('<span/>').addClass("delete_img").attr({ "data-delete": file.name, "data-url": file.url }).html("<img src='./img/system_delete.png' alt='삭제' title='삭제' >")),
|
||||||
$img = "<img src='./img/loading.gif' class='pre_thumb' />",
|
$img = "<img src='./img/loading.gif' class='pre_thumb' />",
|
||||||
size_text = '';
|
size_text = '';
|
||||||
|
|
||||||
if ( preload && preload != 'swfupload' ){
|
if (preload && preload != 'swfupload') {
|
||||||
var ret = othis.get_ratio( file.width, file.height ),
|
var ret = othis.get_ratio(file.width, file.height),
|
||||||
size_text = file.width+" x "+file.height;
|
size_text = file.width + " x " + file.height;
|
||||||
$img = "<img src='"+file.url+"' width='"+ret['width']+"' height='"+ret['height']+"' class='pre_thumb' />";
|
$img = "<img src='" + file.url + "' width='" + ret['width'] + "' height='" + ret['height'] + "' class='pre_thumb' />";
|
||||||
|
|
||||||
}
|
}
|
||||||
if (!index) {
|
if (!index) {
|
||||||
node.prepend('<br>')
|
node.prepend('<br>')
|
||||||
.prepend($img);
|
.prepend($img);
|
||||||
if(size_text){
|
if (size_text) {
|
||||||
node.append('<br>')
|
node.append('<br>')
|
||||||
.append($('<span/>').text(size_text))
|
.append($('<span/>').text(size_text))
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
node.appendTo(data.context);
|
node.appendTo(data.context);
|
||||||
node.find(".delete_img").on("click", othis._delete);
|
node.find(".delete_img").on("click", othis._delete);
|
||||||
});
|
});
|
||||||
$(othis.dreg_area_list).sortable('refresh');
|
$(othis.dreg_area_list).sortable('refresh');
|
||||||
},
|
},
|
||||||
get_file_all : function(){
|
get_file_all: function () {
|
||||||
var othis = this,
|
var othis = this,
|
||||||
oDate = new Date();
|
oDate = new Date();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
// Uncomment the following to send cross-domain cookies:
|
// Uncomment the following to send cross-domain cookies:
|
||||||
//xhrFields: {withCredentials: true},
|
//xhrFields: {withCredentials: true},
|
||||||
//url: $('#fileupload').fileupload('option', 'url'),
|
//url: $('#fileupload').fileupload('option', 'url'),
|
||||||
url: this.url+"&t="+ oDate.getTime(),
|
url: this.url + "&t=" + oDate.getTime(),
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
context: $('#fileupload')[0]
|
context: $('#fileupload')[0]
|
||||||
}).always(function () {
|
}).always(function () {
|
||||||
//$(this).removeClass('fileupload-processing');
|
//$(this).removeClass('fileupload-processing');
|
||||||
}).done(function (result) {
|
}).done(function (result) {
|
||||||
$.each(result.files, function (index, data) {
|
$.each(result.files, function (index, data) {
|
||||||
var tmp = { files : [] };
|
var tmp = { files: [] };
|
||||||
tmp.files[0] = data;
|
tmp.files[0] = data;
|
||||||
othis._add( $.Event('add'), tmp, 'preload' );
|
othis._add($.Event('add'), tmp, 'preload');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
_processalways : function(e, data){
|
_processalways: function (e, data) {
|
||||||
var index = data.index,
|
var index = data.index,
|
||||||
file = data.files[index],
|
file = data.files[index],
|
||||||
node = $(data.context.children()[index]);
|
node = $(data.context.children()[index]);
|
||||||
@ -149,29 +149,29 @@ jQuery(function ($) {
|
|||||||
.prop('disabled', !!data.files.error);
|
.prop('disabled', !!data.files.error);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
obj_to_arr : function(obj){
|
obj_to_arr: function (obj) {
|
||||||
var array = $.map(obj, function(value, index) {
|
var array = $.map(obj, function (value, index) {
|
||||||
return [value];
|
return [value];
|
||||||
});
|
});
|
||||||
return array;
|
return array;
|
||||||
},
|
},
|
||||||
_done : function(e, data){
|
_done: function (e, data) {
|
||||||
var othis = this;
|
var othis = this;
|
||||||
$.each(data.result.files, function (index, file) {
|
$.each(data.result.files, function (index, file) {
|
||||||
if (file.url && !file.error) {
|
if (file.url && !file.error) {
|
||||||
var ret = othis.get_ratio( file.width, file.height ),
|
var ret = othis.get_ratio(file.width, file.height),
|
||||||
node = $(data.context.children()[index]),
|
node = $(data.context.children()[index]),
|
||||||
size_text = file.width+" x "+file.height,
|
size_text = file.width + " x " + file.height,
|
||||||
//$img = "<img src='"+file.url+"' width='"+ret['width']+"' height='"+ret['height']+"' />",
|
//$img = "<img src='"+file.url+"' width='"+ret['width']+"' height='"+ret['height']+"' />",
|
||||||
link = $('<a>')
|
link = $('<a>')
|
||||||
.attr('target', '_blank')
|
.attr('target', '_blank')
|
||||||
.prop('href', file.url);
|
.prop('href', file.url);
|
||||||
node
|
node
|
||||||
//.wrap(link)
|
//.wrap(link)
|
||||||
.append('<br>')
|
.append('<br>')
|
||||||
.append($('<span/>').text(size_text))
|
.append($('<span/>').text(size_text))
|
||||||
.find("img.pre_thumb").attr({"src":file.url,"width":ret['width'],"height":ret['height']})
|
.find("img.pre_thumb").attr({ "src": file.url, "width": ret['width'], "height": ret['height'] })
|
||||||
.end().find(".delete_img").attr({"data-delete":file.name,"data-url":file.url});
|
.end().find(".delete_img").attr({ "data-delete": file.name, "data-url": file.url });
|
||||||
} else if (file.error) {
|
} else if (file.error) {
|
||||||
var error = $('<span class="text-danger"/>').text(file.error);
|
var error = $('<span class="text-danger"/>').text(file.error);
|
||||||
$(data.context.children()[index])
|
$(data.context.children()[index])
|
||||||
@ -181,20 +181,20 @@ jQuery(function ($) {
|
|||||||
othis.file_push(file);
|
othis.file_push(file);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
get_ratio : function(width, height){
|
get_ratio: function (width, height) {
|
||||||
var ratio = 0,
|
var ratio = 0,
|
||||||
ret_img = [];
|
ret_img = [];
|
||||||
if( !width || !height ){
|
if (!width || !height) {
|
||||||
ret_img['width'] = this.imgw;
|
ret_img['width'] = this.imgw;
|
||||||
ret_img['height'] = this.imgh;
|
ret_img['height'] = this.imgh;
|
||||||
return ret_img;
|
return ret_img;
|
||||||
}
|
}
|
||||||
if(width > this.imgw){
|
if (width > this.imgw) {
|
||||||
ratio = this.imgw / width;
|
ratio = this.imgw / width;
|
||||||
height = height * ratio;
|
height = height * ratio;
|
||||||
width = this.imgw;
|
width = this.imgw;
|
||||||
}
|
}
|
||||||
if( height > this.imgh ){
|
if (height > this.imgh) {
|
||||||
ratio = this.imgh / height;
|
ratio = this.imgh / height;
|
||||||
width = width * ratio;
|
width = width * ratio;
|
||||||
height = this.imgh;
|
height = this.imgh;
|
||||||
@ -203,7 +203,7 @@ jQuery(function ($) {
|
|||||||
ret_img['height'] = parseInt(height);
|
ret_img['height'] = parseInt(height);
|
||||||
return ret_img;
|
return ret_img;
|
||||||
},
|
},
|
||||||
setPhotoToEditor : function(oFileInfo){
|
setPhotoToEditor: function (oFileInfo) {
|
||||||
if (!!opener && !!opener.nhn && !!opener.nhn.husky && !!opener.nhn.husky.PopUpManager) {
|
if (!!opener && !!opener.nhn && !!opener.nhn.husky && !!opener.nhn.husky.PopUpManager) {
|
||||||
//스마트 에디터 플러그인을 통해서 넣는 방법 (oFileInfo는 Array)
|
//스마트 에디터 플러그인을 통해서 넣는 방법 (oFileInfo는 Array)
|
||||||
opener.nhn.husky.PopUpManager.setCallback(window, 'SET_PHOTO', [oFileInfo]);
|
opener.nhn.husky.PopUpManager.setCallback(window, 'SET_PHOTO', [oFileInfo]);
|
||||||
@ -220,19 +220,19 @@ jQuery(function ($) {
|
|||||||
dropZone: $(gnu.dreg_area),
|
dropZone: $(gnu.dreg_area),
|
||||||
autoUpload: true,
|
autoUpload: true,
|
||||||
sequentialUploads: true,
|
sequentialUploads: true,
|
||||||
acceptFileTypes: /(\.|\/)(gif|jpe?g|bmp|png)$/i,
|
acceptFileTypes: /(\.|\/)(gif|jpe?g|bmp|png|webp)$/i,
|
||||||
// Enable image resizing, except for Android and Opera,
|
// Enable image resizing, except for Android and Opera,
|
||||||
// which actually support image resizing, but fail to
|
// which actually support image resizing, but fail to
|
||||||
// send Blob objects via XHR requests:
|
// send Blob objects via XHR requests:
|
||||||
disableImageResize: true,
|
disableImageResize: true,
|
||||||
limit_filesLength : gnu.file_limit
|
limit_filesLength: gnu.file_limit
|
||||||
}).on('fileuploadadd', function (e, data) {
|
}).on('fileuploadadd', function (e, data) {
|
||||||
gnu._add(e, data);
|
gnu._add(e, data);
|
||||||
}).on('fileuploadprocessalways', function (e, data) {
|
}).on('fileuploadprocessalways', function (e, data) {
|
||||||
gnu._processalways(e, data);
|
gnu._processalways(e, data);
|
||||||
}).on('fileuploaddone', function (e, data) {
|
}).on('fileuploaddone', function (e, data) {
|
||||||
|
|
||||||
gnu._done( e, data );
|
gnu._done(e, data);
|
||||||
|
|
||||||
}).on('fileuploadfail', function (e, data) {
|
}).on('fileuploadfail', function (e, data) {
|
||||||
$.each(data.files, function (index, file) {
|
$.each(data.files, function (index, file) {
|
||||||
@ -246,85 +246,84 @@ jQuery(function ($) {
|
|||||||
|
|
||||||
gnu.init();
|
gnu.init();
|
||||||
|
|
||||||
var listeners = {
|
var listeners = {
|
||||||
data : {},
|
data: {},
|
||||||
log : false,
|
log: false,
|
||||||
swfuploadLoaded: function(event){
|
swfuploadLoaded: function (event) {
|
||||||
if(this.log) $('.log', this).append('<li>Loaded</li>');
|
if (this.log) $('.log', this).append('<li>Loaded</li>');
|
||||||
},
|
},
|
||||||
fileQueued: function(event, file){
|
fileQueued: function (event, file) {
|
||||||
if(this.log) $('.log', this).append('<li>File queued - '+file.name+'</li>');
|
if (this.log) $('.log', this).append('<li>File queued - ' + file.name + '</li>');
|
||||||
// start the upload once it is queued
|
// start the upload once it is queued
|
||||||
// but only if this queue is not disabled
|
// but only if this queue is not disabled
|
||||||
if (!$('input[name=disabled]:checked', this).length) {
|
if (!$('input[name=disabled]:checked', this).length) {
|
||||||
$(this).swfupload('startUpload');
|
$(this).swfupload('startUpload');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fileQueueError: function(event, file, errorCode, message){
|
fileQueueError: function (event, file, errorCode, message) {
|
||||||
switch (errorCode)
|
switch (errorCode) {
|
||||||
{
|
case -100:
|
||||||
case -100 :
|
alert("파일을 " + message + "개 이하로 선택해주세요.");
|
||||||
alert("파일을 "+message+"개 이하로 선택해주세요.");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(this.log) $('.log', this).append('<li>File queue error - '+message+'</li>');
|
if (this.log) $('.log', this).append('<li>File queue error - ' + message + '</li>');
|
||||||
},
|
},
|
||||||
fileDialogStart: function(event){
|
fileDialogStart: function (event) {
|
||||||
if(this.log) $('.log', this).append('<li>File dialog start</li>');
|
if (this.log) $('.log', this).append('<li>File dialog start</li>');
|
||||||
},
|
},
|
||||||
fileDialogComplete: function(event, numFilesSelected, numFilesQueued){
|
fileDialogComplete: function (event, numFilesSelected, numFilesQueued) {
|
||||||
if(this.log) $('.log', this).append('<li>File dialog complete</li>');
|
if (this.log) $('.log', this).append('<li>File dialog complete</li>');
|
||||||
},
|
},
|
||||||
uploadStart: function(event, file){
|
uploadStart: function (event, file) {
|
||||||
listeners.data.files = $.makeArray(file);
|
listeners.data.files = $.makeArray(file);
|
||||||
gnu._add( event, listeners.data, 'swfupload' );
|
gnu._add(event, listeners.data, 'swfupload');
|
||||||
if(this.log) $('.log', this).append('<li>Upload start - '+file.name+'</li>');
|
if (this.log) $('.log', this).append('<li>Upload start - ' + file.name + '</li>');
|
||||||
},
|
},
|
||||||
uploadProgress: function(event, file, bytesLoaded){
|
uploadProgress: function (event, file, bytesLoaded) {
|
||||||
if(this.log) $('.log', this).append('<li>Upload progress - '+bytesLoaded+'</li>');
|
if (this.log) $('.log', this).append('<li>Upload progress - ' + bytesLoaded + '</li>');
|
||||||
},
|
},
|
||||||
uploadSuccess: function(event, file, serverData){
|
uploadSuccess: function (event, file, serverData) {
|
||||||
listeners.data.result = jQuery.parseJSON( serverData );
|
listeners.data.result = jQuery.parseJSON(serverData);
|
||||||
gnu._done( event, listeners.data );
|
gnu._done(event, listeners.data);
|
||||||
if(this.log) $('.log', this).append('<li>Upload success - '+file.name+'</li>');
|
if (this.log) $('.log', this).append('<li>Upload success - ' + file.name + '</li>');
|
||||||
|
|
||||||
},
|
},
|
||||||
uploadComplete: function(event, file){
|
uploadComplete: function (event, file) {
|
||||||
if(this.log) $('.log', this).append('<li>Upload complete - '+file.name+'</li>');
|
if (this.log) $('.log', this).append('<li>Upload complete - ' + file.name + '</li>');
|
||||||
// upload has completed, lets try the next one in the queue
|
// upload has completed, lets try the next one in the queue
|
||||||
// but only if this queue is not disabled
|
// but only if this queue is not disabled
|
||||||
if (!$('input[name=disabled]:checked', this).length) {
|
if (!$('input[name=disabled]:checked', this).length) {
|
||||||
$(this).swfupload('startUpload');
|
$(this).swfupload('startUpload');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
uploadError: function(event, file, errorCode, message){
|
uploadError: function (event, file, errorCode, message) {
|
||||||
if(this.log) $('.log', this).append('<li>Upload error - '+message+'</li>');
|
if (this.log) $('.log', this).append('<li>Upload error - ' + message + '</li>');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$(gnu.container_el).bindAll(listeners);
|
$(gnu.container_el).bindAll(listeners);
|
||||||
/* listeners이벤트 */
|
/* listeners이벤트 */
|
||||||
|
|
||||||
$(gnu.dreg_area).bind('drop dragover', function (e) {
|
$(gnu.dreg_area).bind('drop dragover', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if( !gnu.file_api_support && e.type == 'drop' ) alert("브라우저가 드래그 앤 드랍을 지원하지 않습니다.");
|
if (!gnu.file_api_support && e.type == 'drop') alert("브라우저가 드래그 앤 드랍을 지원하지 않습니다.");
|
||||||
});
|
});
|
||||||
$("#all_remove_btn").bind("click", function(e){
|
$("#all_remove_btn").bind("click", function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if( $(gnu.dreg_area_list).children().length ){
|
if ($(gnu.dreg_area_list).children().length) {
|
||||||
if (confirm("추가한 이미지가 있습니다.정말 삭제 하시겠습니까?")){
|
if (confirm("추가한 이미지가 있습니다.정말 삭제 하시겠습니까?")) {
|
||||||
$(gnu.dreg_area_list).find(".delete_img").each( function(i){
|
$(gnu.dreg_area_list).find(".delete_img").each(function (i) {
|
||||||
$(this).trigger("click");
|
$(this).trigger("click");
|
||||||
});
|
});
|
||||||
$(gnu.dreg_area_list).sortable('refresh');
|
$(gnu.dreg_area_list).sortable('refresh');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$("#img_upload_submit").bind("click", function(e){
|
$("#img_upload_submit").bind("click", function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var aResult = [], j = 0;
|
var aResult = [], j = 0;
|
||||||
$(gnu.dreg_area_list).find(".delete_img").each( function(i, f){
|
$(gnu.dreg_area_list).find(".delete_img").each(function (i, f) {
|
||||||
if( !$(this).attr("data-url") ) return true;
|
if (!$(this).attr("data-url")) return true;
|
||||||
aResult[j] = [];
|
aResult[j] = [];
|
||||||
aResult[j]['bNewLine'] = 'true';
|
aResult[j]['bNewLine'] = 'true';
|
||||||
aResult[j]['sAlign'] = '';
|
aResult[j]['sAlign'] = '';
|
||||||
@ -332,13 +331,13 @@ jQuery(function ($) {
|
|||||||
aResult[j]['sFileURL'] = $(this).attr("data-url");
|
aResult[j]['sFileURL'] = $(this).attr("data-url");
|
||||||
j++;
|
j++;
|
||||||
});
|
});
|
||||||
if( aResult.length ){
|
if (aResult.length) {
|
||||||
gnu.setPhotoToEditor(aResult);
|
gnu.setPhotoToEditor(aResult);
|
||||||
aResult = null;
|
aResult = null;
|
||||||
}
|
}
|
||||||
window.close();
|
window.close();
|
||||||
});
|
});
|
||||||
$("#close_w_btn").bind("click", function(e){
|
$("#close_w_btn").bind("click", function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
window.close();
|
window.close();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user