diff --git a/css/config.css b/css/config.css index f5b02819..d0ef052c 100644 --- a/css/config.css +++ b/css/config.css @@ -166,6 +166,17 @@ a.samButton.disabled { content:'】' } +.tooltip_copyable_info .tooltiptext{ + display: inline; + color: rgba(0,0,0,0); + font-size: 0; +} + .tooltiptext { display: none; +} + +.hidden_but_copyable{ + color: rgba(0,0,0,0); + font-size: 0; } \ No newline at end of file diff --git a/hwe/css/common.css b/hwe/css/common.css index e4e82438..32187cc5 100644 --- a/hwe/css/common.css +++ b/hwe/css/common.css @@ -192,10 +192,21 @@ div.bar_out div.bar_in{ font-family: '맑은 고딕'; } +.tooltip_copyable_info .tooltiptext{ + display: inline; + color: rgba(0,0,0,0); + font-size: 0; +} + .tooltiptext { display: none; } +.hidden_but_copyable{ + color: rgba(0,0,0,0); + font-size: 0; +} + .btn-group-xs > .btn, .btn-xs { padding : .25rem .4rem; font-size : .875rem; diff --git a/hwe/j_server_basic_info.php b/hwe/j_server_basic_info.php index a3fc9c9d..9206b06d 100644 --- a/hwe/j_server_basic_info.php +++ b/hwe/j_server_basic_info.php @@ -3,6 +3,38 @@ namespace sammo; include "lib.php"; +$templates = new \League\Plates\Engine(__dir__.'/templates'); + +function getAutorunInfo($autorunOption){ + global $templates; + $auto_info = []; + foreach($autorunOption['options'] as $auto_option => $value){ + assert($value); + switch($auto_option){ + case 'develop': $auto_info['내정'] = '내정'; break; + case 'warp': $auto_info['순간이동'] = '순간이동'; break; + case 'recruit': $auto_info['징병'] = $auto_info['징병']??'징병'; break; + case 'recruit_high': $auto_info['징병'] = '모병'; break; + case 'train': $auto_info['훈사'] = '훈련/사기진작'; break; + case 'battle': $auto_info['출병'] = '출병'; break; + } + } + $limit = Util::toInt($autorunOption['limit_minutes']); + if($limit % 60 == 0){ + $auto_info['제한'] = ($limit/60).'시간 유효'; + } + else{ + $auto_info['제한'] = ($limit).'분 유효'; + } + $auto_info = join(', ', array_values($auto_info)); + return $templates->render('tooltip', [ + 'text'=>'자율행동', + 'info'=>$auto_info, + 'style'=>'text-decoration:underline', + 'copyable_info'=>true + ]); +} + $session = Session::requireLogin([ 'game'=>null, 'me'=>null @@ -16,7 +48,6 @@ if(!class_exists('\\sammo\\DB')){ ]); } -$templates = new \League\Plates\Engine(__dir__.'/templates'); $db = DB::db(); $gameStor = KVStorage::getStorage($db, 'game_env'); @@ -41,24 +72,7 @@ if(file_exists(__dir__.'/.htaccess')){ } if($options['autorun_user']['limit_minutes']??false){ - $auto_info = []; - foreach($options['autorun_user']['options'] as $auto_option => $value){ - assert($value); - switch($auto_option){ - case 'develop': $auto_info['내정'] = '내정'; break; - case 'warp': $auto_info['순간이동'] = '순간이동'; break; - case 'recruit': $auto_info['징병'] = $auto_info['징병']??'징병'; break; - case 'recruit_high': $auto_info['징병'] = '모병'; break; - case 'train': $auto_info['훈사'] = '훈련/사기진작'; break; - case 'battle': $auto_info['출병'] = '출병'; break; - } - } - $auto_info = join(', ', array_values($auto_info)); - $otherTextInfo[] = $templates->render('tooltip', [ - 'text'=>'자율행동', - 'info'=>$auto_info, - 'style'=>'text-decoration:underline' - ]); + $otherTextInfo[] = getAutorunInfo($options['autorun_user']); } if(!$otherTextInfo){ @@ -117,27 +131,8 @@ if($admin['join_mode'] == 'onlyRandom'){ $otherTextInfo[] = '랜덤 임관 전용'; } - if($admin['autorun_user']['limit_minutes']??false){ - - $auto_info = []; - foreach($admin['autorun_user']['options'] as $auto_option => $value){ - assert($value); - switch($auto_option){ - case 'develop': $auto_info['내정'] = '내정'; break; - case 'warp': $auto_info['순간이동'] = '순간이동'; break; - case 'recruit': $auto_info['징병'] = $auto_info['징병']??'징병'; break; - case 'recruit_high': $auto_info['징병'] = '모병'; break; - case 'train': $auto_info['훈사'] = '훈련/사기진작'; break; - case 'battle': $auto_info['출병'] = '출병'; break; - } - } - $auto_info = join(', ', array_values($auto_info)); - $otherTextInfo[] = $templates->render('tooltip', [ - 'text'=>'자율행동', - 'info'=>$auto_info, - 'style'=>'text-decoration:underline' - ]); + $otherTextInfo[] = getAutorunInfo($admin['autorun_user']); } if(!$otherTextInfo){ diff --git a/hwe/templates/tooltip.php b/hwe/templates/tooltip.php index 32fcac20..987d1817 100644 --- a/hwe/templates/tooltip.php +++ b/hwe/templates/tooltip.php @@ -1,6 +1,6 @@ ->[] \ No newline at end of file