// 숫자 유형에서 쓸 수 있도록 format() 함수 추가 Number.prototype.format = function(){ if(this==0) return 0; var reg = /(^[+-]?\d+)(\d{3})/; var n = (this + ''); while (reg.test(n)) n = n.replace(reg, '$1' + ',' + '$2'); return n; }; // 문자열 유형에서 쓸 수 있도록 format() 함수 추가 String.prototype.format = function(){ var num = parseFloat(this); if( isNaN(num) ) return "0"; return num.format(); };
먼저 함수를 추가해 주시고
jQuery('.format-exps').text(function() { jQuery(this).text( jQuery(this).text().format() ); });
해당 클래스에 따른 작동을 선언합니다
상기 두 개의 코드는 레이아웃에서 구동되는 js 파일 가장 하단에 추가 하셔도 됩니다
<span class="format-exps"> {$val->experience} </span>
경험치 랭킹 위젯의 list.html의 경험치 출력 함수를 감싸는 java에서 선언한 class를 선언하면 됩니다
경험치 랭킹 위젯에서 잘 표시되는지 확인하면 됩니다