From 422b3be0c55d554c20133c8e92dac3c25a58407e Mon Sep 17 00:00:00 2001 From: hide_d Date: Mon, 24 Sep 2018 04:17:54 +0900 Subject: [PATCH] =?UTF-8?q?flip=20image=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/js/common.js | 39 +++++++++++++++++++++++++++++++++++++++ hwe/js/dipcenter.js | 4 +++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/hwe/js/common.js b/hwe/js/common.js index 782b9de9..e8c02f32 100644 --- a/hwe/js/common.js +++ b/hwe/js/common.js @@ -143,6 +143,41 @@ function getIconPath(imgsvr, picture){ } } +function activeFlip($obj){ + var $result; + if($obj === undefined){ + $result = $('img[data-flip]'); + } + else{ + $result = $obj.find('img[data-flip]'); + } + + $result.each(function(){ + activeFlipItem($(this)); + }); + +} + +function activeFlipItem($img){ + var imageList = []; + imageList.push($img.attr('src')); + imageList = imageList.concat($img.data('flip').split(',')); + if(imageList.length <= 1){ + return; + } + $img.data('computed_flip_array', imageList); + $img.data('computed_flip_idx', 0); + + $img.click(function(){ + var arr = $img.data('computed_flip_array'); + var idx = $img.data('computed_flip_idx'); + idx = (idx + 1)%(arr.length); + $img.attr('src', arr[idx]); + $img.data('computed_flip_idx', idx); + }); + $img.css('cursor','pointer'); +} + jQuery(function($){ $('.obj_tooltip').each(function(){ var $objTooltip = $(this); @@ -164,10 +199,14 @@ jQuery(function($){ }); + activeFlip(); + var customCSS = localStorage.getItem('sam_customCSS'); if(customCSS){ var $style = $(''); $style.text(customCSS); $style.appendTo($('head')); } + + }); diff --git a/hwe/js/dipcenter.js b/hwe/js/dipcenter.js index ebc8f30c..e5796b16 100644 --- a/hwe/js/dipcenter.js +++ b/hwe/js/dipcenter.js @@ -20,7 +20,7 @@ jQuery(function($){ if(!inputText || inputText == '

'){ inputText = '


'; } - console.log(inputText); + $editForm.removeClass('viewer').summernote({ minHeight:200, maxHeight:null, @@ -97,10 +97,12 @@ jQuery(function($){ $editForm.summernote('destroy'); $cancelEdit.hide(); $editForm.html($noticeInput.val()).addClass('viewer'); + activeFlip($editForm); } $cancelEdit.hide(); $editForm.html($noticeInput.val()); + activeFlip($editForm); if(editable){ $submitBtn.prop('disabled', false); }