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); }