changeset 447:8a8083283ce1

Updated javascript snippets
author unexist
date Fri, 26 Jul 2013 16:12:14 +0200
parents f0f67ef4aefe
children 02c62f37f4aa
files .vim/snippets/javascript.snippets
diffstat 1 files changed, 56 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/.vim/snippets/javascript.snippets	Thu Feb 28 15:22:47 2013 +0100
+++ b/.vim/snippets/javascript.snippets	Fri Jul 26 16:12:14 2013 +0200
@@ -1,32 +1,44 @@
 # Prototype
 snippet proto
 	${1:class_name}.prototype.${2:method_name} =
-	function(${3:first_argument}) {
-		${4:// body...}
+	function(${3:first_argument})
+	{
+		${4:// code...}
 	};
 # Function
 snippet fun
-	function ${1:function_name} (${2:argument}) {
-		${3:// body...}
+	function ${1:function_name( ${2:argument})
+	{
+		${3:// code...}
 	}
 # Anonymous Function
 snippet f
 	function(${1}) {${2}};
 # if
 snippet if
-	if (${1:true}) {${2}};
+	if(${1:true})
+		{
+			${2}
+		}
 # if ... else
 snippet ife
-	if (${1:true}) {${2}}
-	else{${3}};
+	if(${1:true})
+		{
+			${2:// code}
+		}
+	else
+		{
+			${3:// code}
+		};
 # tertiary conditional
 snippet t
 	${1:/* condition */} ? ${2:a} : ${3:b}
 # switch
 snippet switch
-	switch(${1:expression}) {
-		case '${3:case}':
-			${4:// code}
+	switch(${1:expression})
+		{
+			case '${3:case}':
+				${4:// code}
 			break;
 		${5}
 		default:
@@ -40,27 +52,32 @@
 	${3}
 # for (...) {...}
 snippet for
-	for (var ${2:i} = 0; $2 < ${1:Things}.length; $2${3:++}) {
-		${4:$1[$2]}
-	};
+	for(var ${2:i} = 0; $2 < ${1:arry}.length; $2${3:++})
+		{
+			${4:$1[$2]}
+		};
 # for (...) {...} (Improved Native For-Loop)
 snippet forr
-	for (var ${2:i} = ${1:Things}.length - 1; $2 >= 0; $2${3:--}) {
-		${4:$1[$2]}
-	};
+	for(var ${2:i} = ${1:array}.length - 1; $2 >= 0; $2${3:--})
+		{
+			${4:$1[$2]}
+		};
 # while (...) {...}
 snippet wh
-	while (${1:/* condition */}) {
-		${2:/* code */}
-	}
+	while(${1:true})
+		{
+			${2:/* code */}
+		}
 # do...while
 snippet do
-	do {
+	do
+	{
 		${2:/* code */}
-	} while (${1:/* condition */});
+	} while(${1:true});
 # Object Method
-snippet :f
-	${1:method_name}: function(${2:attribute}) {
+snippet meth
+	${1:method_name}: function(${2:attribute})
+	{
 		${4}
 	}${3:,}
 # setTimeout function
@@ -72,3 +89,19 @@
 # Get Element
 snippet gett
 	getElementBy${1:Id}('${2}')${3}
+snippet ss
+	$("${1:name}")${2}
+snippet sho
+	${1:name}.show();${2}
+snippet hid
+	${1:name}.hide();${2}
+snippet var
+	var ${1:name} = ${2};
+snippet doc
+	/** ${1:function_name}
+	 * ${2:description}
+	 * @author <a href="mailto:chkappel@gmail.com">Christoph Kappel</a>
+	 ${3}
+	 **/
+snippet param
+	 * @param {${1:type}}  ${2:name}  ${3:description}