링크 : https://github.com/rogerwang/node-webkit


이제 자바스크립트로 어플리케이션을 만드는 날이 왔구나.

연구해 봐야겠다.

posted by 뚱2

[JavaScript] use strict

JavaScript/JavaScript 2013. 12. 25. 21:33

링크 : http://msdn.microsoft.com/ko-kr/library/ie/br230269(v=vs.94).aspx

posted by 뚱2

링크 : http://www.regexper.com/

'JavaScript > JavaScript' 카테고리의 다른 글

[JavaScript] 클로져(Closures)  (0) 2014.01.22
[JavaScript] use strict  (0) 2013.12.25
[JavaScript] JavaScript OOP Tutorial  (0) 2013.12.04
[JavaScript] 자바스크립트 모듈화 require.js  (0) 2013.10.18
[JavaScript] Date Format  (0) 2013.10.15
posted by 뚱2

링크 : http://jcf.daewoobrenic.co.kr/blog/?p=235

posted by 뚱2

링크 : http://www.techumber.com/2013/08/javascript-object-oriented-programming-tutorial.html

posted by 뚱2

[CKEditor] Fileupload

JavaScript/CKEditor 2013. 10. 30. 18:27

링크 : http://docs.ckeditor.com/#!/guide/dev_file_browse_upload

링크 : http://docs.cksource.com/CKFinder_2.x/Developers_Guide/Java/CKEditor_Integration

posted by 뚱2
posted by 뚱2

링크 : http://underscorejs.org/

posted by 뚱2

[JavaScript] Date Format

JavaScript/JavaScript 2013. 10. 15. 14:15

링크 : http://blog.stevenlevithan.com/archives/date-time-format

 

posted by 뚱2

    $.fn.serializeObject = function() {
        var o = {};
        var a = this.serializeArray();

        $.each(a, function() {
            if ( o[this.name] ) {
                if ( !o[this.name].push ) {
                    o[this.name] = [o[this.name]];
                }
                o[this.name].push(this.value || '');
            } else {
                o[this.name] = this.value || '';
            }
        });
        return o;
    };

posted by 뚱2

[respond.js] respond.js

JavaScript/respondjs 2013. 8. 26. 15:07

구 버전 브라우져에서 반응형 웹 구현에 도움을 주는 스크립트

링크 : https://github.com/scottjehl/Respond

 

posted by 뚱2

html5를 지원하지 않는 브라우져에서 사용가능하게 하는 자바스크립트

 

링크 : http://code.google.com/p/html5shiv/

 

 

posted by 뚱2

링크 : http://getbootstrap.com/

 

'JavaScript > Bootstrap' 카테고리의 다른 글

[Bootstrap] bootstrap-live-customizer  (0) 2015.07.28
[Bootstrap] Bootstrap-datepicker  (0) 2014.04.24
posted by 뚱2

/*

* strTemp  : [필수] 크로스사이트 스크립팅을 검사할 문자열

* level    : [옵션] 검사레벨

*            0 (기본) -> XSS취약한 문자 제거

*            1 (선택) -> 단순한 <, > 치환

*/

function XSS_Check(strTemp, level) {     

if ( level == undefined || level == 0 ) {

strTemp = strTemp.replace(/\<|\>|\"|\'|\%|\;|\(|\)|\&|\+|\-/g,"");

}

else if (level != undefined && level == 1 ) {

strTemp = strTemp.replace(/\</g, "&lt;");

strTemp = strTemp.replace(/\>/g, "&gt;");

}

return strTemp;

}


posted by 뚱2

링크 : http://dean.edwards.name/packer/ 



posted by 뚱2

var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;

var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;

var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;


posted by 뚱2

링크 : http://blog.naver.com/PostView.nhn?blogId=jjoommnn&logNo=130149113595&parentCategoryNo=22&categoryNo=&viewDate=&isShowPopularPosts=true&from=search 

posted by 뚱2

링크 : http://sizzlejs.com/ 


시간 나는대로 분석해 봐야겠다.

posted by 뚱2

링크 : http://www.w3schools.com/jsref/jsref_regexp_source.asp 

Definition and Usage

The source property returns the text of the RegExp pattern.

Syntax

RegExpObject.source


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The source property is supported in all major browsers.


Example

Example

Return the text of the RegExp pattern:

<script>

var str="Visit W3Schools";
var patt1=/W3S/g;
document.write("The text of the RegExp is: " + patt1.source);

</script>

Try it yourself »

posted by 뚱2

//==================================================================

// 스크립트 오류 메세지

//==================================================================

function myDebug(errmsg, url, linenum)

{

    errWin=window.open('','','width=350,height=220,scrollbars=no');

    errWin.document.open();

    errWin.document.write('<CENTER><H1>스크립트오류 정보</H2></CENTER>');

    errWin.document.write('에러메시지: <FONT COLOR=RED>'+errmsg+'</FONT><BR>');

    errWin.document.write('에러가 난 문서: <FONT COLOR=RED>'+url+'</FONT><BR>');

    errWin.document.write('에러가 난 라인: <FONT COLOR=RED>'+linenum+'</FONT>');

    errWin.document.close();


    return true;

}

window.onerror=myDebug;


posted by 뚱2

var str = "한글 입니다. test";

if ( /.*?[가-힣]+.*?/.test(str) == true ) {

alert("한글이 존재합니다.");

}

else {

alert("한글이 존재하지 않습니다.");

}


posted by 뚱2

;(function(exports, $) {

/**

* 전달받은 인자를 부모로 하는 새로운 객체를 생성한다.

*/

if ( typeof Object.create !== 'function' ) {

Object.create = function(o) {

var F = function() {};

if ( !arguments.length ) {

F.prototype = o;

}

return new F();

};

}

/**

* 객체에 메소드를 추가하는 메소드

* @param name

* @param code

*/

Function.prototype.method = function(name, code) {

if ( !this.prototype[name] ) {

this.prototype[name] = code;

}

};

/**

* 함수설명 : " abcde "  -> "abcde" 공백제거

* 예제     : str.trim();

*/

String.method("trim", function(){

   return this.replace(/(^\s*)|(\s*$)/g, "");

}); 

/**

* 함수설명 : " ab c de "  -> "abcde" 모든 공백제거

* 예제     : str.allTrim()

*/

String.method("allTrim", function(){

   return this.replace(/\s*/g, "");

});


/**

* 함수설명 : " abcd" -> "abcd"

* 왼쪽 공백 제거

*/

String.method("leftTrim", function() {

return this.replace(/(^\s*)/g, "");

});


/**

* 함수설명 : "abcd " -> "abcd"

* 오른쪽 공백 제거

*/

String.method("rightTrim", function() {

return this.replace(/(\s*$)/g, "");

});


/**

*함수설명 : cut 메소드를 추가

*               start  : 잘라낼 시작 위치   (int)

*               length : 잘라낼 문자열 길이 (int)

* 예제     : str.cut(2, 2);

*/

String.method("cut", function(start, length){

   return this.substring(0, start) + this.substr(start + length);

});

/**

* 왼쪽으로 문자열을 잘라낸다. (substring과 같은 기능이다.)

*/

String.method("left", function(len) {

return this.substring(0, len);

});


/**

* 오른쪽에서 문자열을 잘라낸다.

*/

String.method("right", function(len) {

return this.substring(this.length-len);

});

/**

* 가운데에서 문자열을 잘라낸다.

*/

String.method("mid", function(start, len) {

if ( start > 0 ) {

start = start - 1;

}

else {

throw "시작위치는 1부터 입니다.";

}

if ( len == undefined ) {

return this.substring(start);

}

return this.substring(start, start+len);

});

/**

* 문자열을 숫자로 바꿔준다.

* 숫자로 변환할수 없는 문자는 0을 리턴한다.

*/

String.method("toNumber", function() {

var num = Number(this.replace(/[,\s]/g, ""));

return (isNaN(num) ? 0 : num);

});

/**

* 숫자 부분에서 정수만 추출 하는 메소드

*/

Number.method("integer", function() {

return Math[this < 0 ? "ceiling" : "floor"](this);

});



exports.alert = function(msg) {

$.Echo(msg);

};


exports.$ = $;

})(this, WScript);









// 메인

;(function() {

alert("메인입니다.");

})();


posted by 뚱2

// false, NaN, null, undefined, "", 0 이외의 모든것은 true 이다.

(function() {

var arr = [ false, NaN, null, undefined, "", 0 ];

for (var i = 0; i < arr.length; i++) {

if ( arr[i] ) { alert(true);  }

else          { alert(false); }

}//for (var i = 0; i < arr.length; i++) {

})();


posted by 뚱2

결국 arguments의 length 속성을 이용한다.

val: function( value ) {

var hooks, ret, isFunction,

elem = this[0];


if ( !arguments.length ) {

if ( elem ) {

hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];


if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {

return ret;

}


ret = elem.value;


return typeof ret === "string" ?

// handle most common string cases

ret.replace(rreturn, "") :

// handle cases where value is null/undef or number

ret == null ? "" : ret;

}


return;

}


isFunction = jQuery.isFunction( value );


return this.each(function( i ) {

var self = jQuery(this), val;


if ( this.nodeType !== 1 ) {

return;

}


if ( isFunction ) {

val = value.call( this, i, self.val() );

} else {

val = value;

}


// Treat null/undefined as ""; convert numbers to string

if ( val == null ) {

val = "";

} else if ( typeof val === "number" ) {

val += "";

} else if ( jQuery.isArray( val ) ) {

val = jQuery.map(val, function ( value ) {

return value == null ? "" : value + "";

});

}


hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];


// If set returns undefined, fall back to normal setting

if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {

this.value = val;

}

});

}


posted by 뚱2

윈도우에서 javascript를 사용할수 있는 방법
CreateObject로 COM을 사용할수 있기때문에 조금만 머리 굴리면 웬만한건 다 될듯 하다.

 


Object Model : http://msdn.microsoft.com/ko-kr/library/a74hyyw0.aspx
링크         : http://msdn.microsoft.com/ko-kr/library/9bbdkx3k.aspx
Reference : http://msdn.microsoft.com/ko-kr/library/98591fh7.aspx
참고         : http://bybi.tistory.com/320

 

간단한 javascript 코드를 테스트 한다거나 유틸리티성 변환 프로그램을 만들때 쉽고 가볍게 만들수 있어


애용 하고 있습니다.


요즘 추세대로 익명함수를 바로 호출하여 지역화 시켜서 사용하면 편합니다.


Windows Host Script : http://www.taeyo.pe.kr/lecture/20_Tips/wsh_01.htm 


// 테스트 코드

(function($) {

var msg    = "기본신청기간(2011년 11월 01일 ~ 2012년 01월 05일 )";

var result = /.*?\((.*?)\).*?/gi.exec(msg);

if ( result != null )

{

$.Echo(result[1]);

}

})(WScript);


posted by 뚱2

참고 : http://blog.naver.com/PostView.nhn?blogId=gudejrdl102&logNo=150108479957 


// IE와 타 브라우저 호환성

function handler(event) {

    var event = event || window.event;

    var target = event.target || event.srcElement;

}


posted by 뚱2

[CSS] Selector 셀렉터

JavaScript/CSS 2012. 8. 1. 09:09

링크 : http://www.okjsp.pe.kr/seq/197120 

 

Selector

Example

Example description

CSS

.class

.intro

class="intro" 속성을 가진 모든 엘리먼트 선택

1

#id

#firstname

id="firstname" 속성을 가진 엘리먼트 선택

1

*

*

모든 엘리먼트 선택

2

element

p

모든 <p> 엘리먼트 선택

1

element,element

div,p

모든 <div> 엘리먼트와 모든 <p> 엘리먼트 선택

1

element element

div p

<div> 내의 모든 <p> 엘리먼트 선택

1

element>element

div>p

<div> 바로 하위에 있는 모든 <p> 엘리먼트 선택

2

element+element

div+p

<div> 바로 다음에 있는 모든 <p> 엘리먼트 선택

2

[attribute]

[target]

target 속성을 갖고 있는 모든 엘리먼트 선택

2

[attribute=value]

[target=_blank]

target="_blank" 속성을 갖고 있는 모든 엘리먼트 선택

2

[attribute~=value]

[title~=flower]

"flower" 단어를 포함한 title 속성을 갖고 있는 모든 엘리먼트 선택

2

[attribute|=value]

[lang|=en]

lang 속성값이 "en"으로 시작하는 모든 엘리먼트 선택

2

:link

a:link

모든 방문하지 않은 링크 선택

1

:visited

a:visited

모든 방문했던 링크 선택

1

:active

a:active

활성화된 모든 링크 선택

1

:hover

a:hover

마우스 오버된 링크 선택

1

:focus

input:focus

포커스가 있는 <input> 엘리먼트 선택

2

:first-letter

p:first-letter

모든 <p> 엘리먼트의 첫 번째 문자 선택

1

:first-line

p:first-line

모든 <p> 엘리먼트의 첫 번째 줄 선택

1

:first-child

p:first-child

부모가 있는 모든 <p> 엘리먼트의 첫 번째 선택

2

:before

p:before

모든 <p> 엘리먼트 콘텐트의 앞에 선택

2

:after

p:after

모든 <p> 엘리먼트 콘텐트의 뒤 선택

2

:lang(language)

p:lang(it)

lang 속성값이 "it"로 시작하는 모든 <p> 엘리먼트 선택

2

element1~element2

p~ul

<p> 엘리먼트 앞에 있는 모든 <ul> 엘리먼트 선택

3

[attribute^=value]

a[src^="https"]

src 속성값이 "https"로 시작하는 모든 <a> 엘리먼트 선택

3

[attribute$=value]

a[src$=".pdf"]

src 속성값이 ".pdf"로 끝나는 모든 <a> 엘리먼트 선택

3

[attribute*=value]

a[src*="w3schools"]

src 속성값이 "w3schools" 문자열을 포함하는 모든 <a> 엘리먼트 선택

3

:first-of-type

p:first-of-type

부모가 있는 첫번째 <p> 엘리먼트인 모든 <p>엘리먼트 선택

3

:last-of-type

p:last-of-type

부모가 있는 마지막 <p> 엘리먼트인 모든 <p>엘리먼트 선택

3

:only-of-type

p:only-of-type

부모가 있는 유일한 <p> 엘리먼트인 모든 <p>엘리먼트 선택

3

:only-child

p:only-child

부모에게 유일한 자식인 모든 <p>엘리먼트 선택

3

:nth-child(n)

p:nth-child(2)

부모에게 두 번째 자식인 모든 <p>엘리먼트 선택

3

:nth-last-child(n)

p:nth-last-child(2)

부모에게 마지막에서 두 번째 자식인 모든 <p>엘리먼트 선택

3

:nth-of-type(n)

p:nth-of-type(2)

부모에게 두 번째 <p> 엘리먼트인 모든 <p>엘리먼트 선택

3

:nth-last-of-type(n)

p:nth-last-of-type(2)

부모에게 마지막에서 두 번째 <p> 엘리먼트인 모든 <p>엘리먼트 선택

3

:last-child

p:last-child

부모 안에서 마지막 자식인 모든 <p> 엘리먼트 선택

3

:root

:root

문서 루트 엘리먼트 선택

3

:empty

p:empty

하위에 아무것도 없는(텍스트마저도 없는) 모든 <p> 선택

3

:target

#news:target

현재 활성화된 #news 엘리먼트 선택(앵커 이름을 포함한 URL이 클릭된)

3

:enabled

input:enabled

모든 활성화된 <input> 엘리먼트 선택

3

:disabled

input:disabled

모든 비활성화된 <input> 엘리먼트 선택

3

:checked

input:checked

모든 체크된 <input> 엘리먼트 선택

3

:not(selector)

:not(p)

<p> 엘리먼트가 아닌 모든 요소 선택

3

::selection

::selection

사용자가 선택한 부분 선택

3

'JavaScript > CSS' 카테고리의 다른 글

[CSS] Table CSS  (0) 2015.06.25
[CSS] inline, block, inline-block 차이?  (0) 2014.04.15
posted by 뚱2

/**

 * 

 * @param interval : yyyy(년), m(월), d(일)

 * @param number : 증가 년, 월, 일

 * @param dateformat : 날짜 문자열

 * @returns {String} yyyymmdd 8자리로 리턴

 */

function DateAdd(interval, number, dateformat) {

dateformat = clear_DateSTRING(dateformat);

var int_millisecond = 1;

var int_second      = 1000 * int_millisecond;

var int_minute      = 60 * int_second;

var int_hour        = 60 * int_minute;

var int_day         = 24 * int_hour;

var YY_form = CInt(Left(dateformat, 4));

var MM_form = CInt(Mid(dateformat, 5, 2))-1;

var DD_form = CInt(Right(dateformat, 2));

var date = new Date(YY_form, MM_form, DD_form);

var date_milliseconds = date.valueOf();

var add_milliseconds  = 0;

var ret_date = null;

switch (interval) {

case "yyyy":

date.setFullYear(date.getFullYear()+number, date.getMonth(), date.getDate());

ret_date = date;

break;

case "m":

date.setFullYear(date.getFullYear(), date.getMonth()+number, date.getDate());

ret_date = date;

break;

case "d":

add_milliseconds  = number * int_day;

ret_date = new Date(date_milliseconds + add_milliseconds);

break;

}

var year  = ret_date.getFullYear();

var month = ret_date.getMonth() + 1;

if ( month < 10 ) {

month = "0" + month;

}

var day   = ret_date.getDate();

if ( day < 10 ) {

day = "0" + day;

}

return ( "" + year + month + day );

}


posted by 뚱2

출처 : http://www.w3schools.com 

The JavaScript global properties and functions can be used with all the built-in JavaScript objects.


JavaScript Global Properties

PropertyDescription
InfinityA numeric value that represents positive/negative infinity
NaN"Not-a-Number" value
undefinedIndicates that a variable has not been assigned a value

JavaScript Global Functions

FunctionDescription
decodeURI()Decodes a URI
decodeURIComponent()Decodes a URI component
encodeURI()Encodes a URI
encodeURIComponent()Encodes a URI component
escape()Encodes a string
eval()Evaluates a string and executes it as if it was script code
isFinite()Determines whether a value is a finite, legal number
isNaN()Determines whether a value is an illegal number
Number()Converts an object's value to a number
parseFloat()Parses a string and returns a floating point number
parseInt()Parses a string and returns an integer
String()Converts an object's value to a string
unescape()Decodes an encoded string


posted by 뚱2