// 버튼 클릭 했을 때
function onClick_clipboard(){
	/* Get the text field */
	var copyText = document.getElementById("clipboard");

	var isIOS = (UserAgent.match(/i(Phone|Pod)/i) != null ) true : false;
	if(isIOS){
    	// ios 일때
		iosCopyToClipboard(copyText);
	}else{
    	// ios가 아닐때
		copyToClipboard(copyText);
	}


	/* Alert the copied text */
	alert("copy 되었습니다.");
	return false;
}

// ios가 아닐 때
function copyToClipboard(copyText){
	/* Select the text field */
	copyText.select();

	/* Copy the text inside the text field */
	document.execCommand("copy");
}

// ios 일때
function iosCopyToClipboard(el) {
	var oldContentEditable = el.contentEditable,
		oldReadOnly = el.readOnly,
		range = document.createRange();

	el.contentEditable = true;
	el.readOnly = false;
	range.selectNodeContents(el);

	var s = window.getSelection();
	s.removeAllRanges();
	s.addRange(range);

	// A big number, to cover anything that could be inside the element.
	el.setSelectionRange(0, 999999); 

	el.contentEditable = oldContentEditable;
	el.readOnly = oldReadOnly;

	document.execCommand('copy');
}
Posted by august5pm
,

1. 터미널에서 npm 으로  node-sass 설치

npm install node-sass –g

 

 

 

2. 웹스톰에서 node-sass 설정

1) Program

C:\Users\DF-125_USER\AppData\Roaming\npm\node-sass

 

2) Arguments

--source-map true --output-style compressed $FilePathRelativeToProjectRoot$ $FileParentDir$/css/$FileNameWithoutExtension$.css

 

3) Output paths to refresh

$FileParentDir$/css/$FileNameWithoutExtension$.css:$FileParentDir$/css/$FileNameWithoutExtension$.css.map

 

4)  Working directory
$ProjectFileDir$

 

Posted by august5pm
,
/**
 *	페이지 이름 가져오기
 *	@return pageName 현재 페이지 이름
 */
function getPageName(){
	var pageName = "";

	var tempPageName = window.location.href;
	var strPageName = tempPageName.split("/");
	pageName = strPageName[strPageName.length-1].split("?")[0];

	return pageName;
}
Posted by august5pm
,
/**
 *	숫자만 입력받게 하기
 *	ex) this.$el.find("#inp-call").on("keydown", _.bind(this.onKeydown_inputPhone, this))
 *	onKeydown_inputPhone : function(e){
 *		return App.appView.utilView.onlyNumberTypeInput(e);
 *	}
 */
function onlyNumberTypeInput(event){
	event = event || window.event;
	var keyID = (event.which) ? event.which : event.keyCode;

	if( ( keyID >=48 && keyID <= 57 ) || ( keyID >=96 && keyID <= 105 ) || keyID == 8
            || keyID == 9 || keyID == 46 || keyID == 37 || keyID == 39 )
	{
		return;
	}
	else
	{
		return false;
	}
}
Posted by august5pm
,
// 숫자 유효성검사 정규식
var EXP_NUMBER = /^[0-9]*$/;

// 핸드폰 번호 유효성검사 정규식
var EXP_MOBILENUMBER = /^(01[016789]{1}|02|0[3-9]{1}[0-9]{1})-?[0-9]{3,4}-?[0-9]{4}$/;

// 공백 유효성검사 정규식
var EXP_BLANK = /^\s+|\s+$/g;

// 이메일 유효성검사 정규식
var EXP_EMAIL = /^[0-9a-zA-Z]([-_\.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-_\.]?[0-9a-zA-Z])*\.[a-zA-Z]{2,3}$/i;


/**
 *	정규식 검사하기
 *	@param exp 정규식
 *	@param val 인풋텍스트필드에 입력된 값
 */
function checkExp(exp, val){
	var isExpTest = true;
	if(exp == EXP_BLANK){
		// 공백체크 경우
		if(val.replace( exp, '' ) == ""){
			isExpTest = false;
		}
	}else{
		// 공백체크 아닌 경우
		if(!exp.test(val)){
			isExpTest = false;
		}
	}
	return isExpTest;
}


1. 숫자 유효성 검사
var isCheckNumber = checkExp(EXP_NUMBER, inputVar) // true or false


2. 휴대폰번호 유효성 검사
var isCheckMobileNumber = checkExp(EXP_MOBILENUMBER, inputVar) // true or false


3. 공백 유효성 검사
var isCheckBlank = checkExp(EXP_BLANK, inputVar) // true or false


4. 이메일 유효성 검사
var isCheckEmail = checkExp(EXP_EMAIL, inputVar) // true or false
Posted by august5pm
,
/**
 *	3자리수 마다 쉼표
 *	@param n 숫자
 */
function commify(n) {
	var reg = /(^[+-]?\d+)(\d{3})/;   // 정규식
	n += '';                          // 숫자를 문자열로 변환

	while (reg.test(n))
		n = n.replace(reg, '$1' + ',' + '$2');

	return n;
}
Posted by august5pm
,
1. 오름차순 정렬
/**
 *	오름차순 정렬
 *	@param a 숫자
 *	@param b 숫자
 *	array.sort(compNumber)
 */
 function compNumber(a,b){
	return a - b;
}


2. 내림차순 정렬
/**
 *	내림차순 정렬
 *	@param a 숫자
 *	@param b 숫자
 *	array.sort(compNumberReverse)
 */
function compNumberReverse(a,b){
	return b - a;
}
Posted by august5pm
,
/**
 *	리사이즈 비율 계산
 *	@param targetWidth 변한 넓이
 *	@param targetHeight 변한 높이
 *	@param defaultWidth 원래 넓이
 *	@param defaultHeight 원래 높이
 *	@return per 비율값
 */
function sumSizePer(targetWidth, targetHeight, defaultWidth, defaultHeight){
	var perWidth = targetWidth / defaultWidth;
	var perHeight = targetHeight / defaultHeight;
	var per = 0;

	if(perWidth > perHeight){
		per = perWidth;
	}else{
		per = perHeight;
	}

	return per;
}
Posted by august5pm
,
/**
 *	10의 자리 체크 (10의 자리가 아닐때는 앞에 0을 붙인다)
 *	@param num 숫자
 *	@return tempNum 10의 자리가 아닌경우 앞자리에 0을 붙인 값
 */
function digit(num){
	var tempNum = 0;

	if(num<10){
		tempNum = "0"+num;
	}else{
		tempNum = num;
	}

	return tempNum;
}
Posted by august5pm
,
/**
 *	1차 방정식
 *	@param a, b, c
 */
function linearEquation(a, b, c){
	var xx = (b*c)/a;
	return xx
}
Posted by august5pm
,