Skip to content

Instantly share code, notes, and snippets.

@pafnuty

pafnuty/JavaScript.xml

Last active Apr 22, 2016
Embed
What would you like to do?
Live template в шторме
<templateSet group="JavaScript">
<template name="js_number_format" value="/**&#10; * Separate the price of thousands of&#10; *&#10; * @author Pavel Belousov &#10; * @date 19.02.2015&#10; *&#10; * @method numberFormat&#10; * @param {string} str Price&#10; * @return {string} Formatted price (1 000 000)&#10; */&#10;function numberFormat(str) {&#10;&#9;return (str + '').replace(/(\d)(?=(\d\d\d)+([^\d]|$))/g, '$1 ');&#10;}$END$" description="Price Format like: XX XXX XXX" toReformat="true" toShortenFQNames="true">
<context>
<option name="JAVA_SCRIPT" value="true" />
<option name="JS_EXPRESSION" value="true" />
<option name="JSX_HTML" value="true" />
<option name="JS_STATEMENT" value="true" />
</context>
</template>
<template name="ready" value="jQuery(document).ready(function($) {&#10;&#9;$TEXT$&#10;});$END$" description="jQuery Document Ready" toReformat="false" toShortenFQNames="true">
<variable name="TEXT" expression="" defaultValue="&quot;текст&quot;" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
<option name="JS_EXPRESSION" value="true" />
<option name="JSX_HTML" value="true" />
<option name="JS_STATEMENT" value="true" />
</context>
</template>
<template name="for_each" value="for each (var $VAR$ in $ARRAY$) {&#10; $END$&#10;}" description="Iterate (for each..in)" toReformat="false" toShortenFQNames="true">
<variable name="ARRAY" expression="jsArrayVariable()" defaultValue="&quot;array &quot;" alwaysStopAt="true" />
<variable name="VAR" expression="jsSuggestVariableName()" defaultValue="&quot;o&quot;" alwaysStopAt="true" />
<context>
<option name="HTML_TEXT" value="false" />
<option name="HTML" value="false" />
<option name="XSL_TEXT" value="false" />
<option name="XML" value="false" />
<option name="JSP" value="false" />
<option name="CSS" value="false" />
<option name="JAVA_SCRIPT" value="true" />
<option name="JS_STATEMENT" value="true" />
<option name="HAML" value="false" />
<option name="OTHER" value="false" />
</context>
</template>
<template name="for_in" value="for (var $VAR$ in $ARRAY$) {&#10; $END$&#10;}" description="Iterate (for..in)" toReformat="false" toShortenFQNames="true">
<variable name="ARRAY" expression="jsArrayVariable()" defaultValue="&quot;array &quot;" alwaysStopAt="true" />
<variable name="VAR" expression="jsSuggestVariableName()" defaultValue="&quot;o&quot;" alwaysStopAt="true" />
<context>
<option name="HTML_TEXT" value="false" />
<option name="HTML" value="false" />
<option name="XSL_TEXT" value="false" />
<option name="XML" value="false" />
<option name="JSP" value="false" />
<option name="CSS" value="false" />
<option name="JAVA_SCRIPT" value="true" />
<option name="JS_STATEMENT" value="true" />
<option name="HAML" value="false" />
<option name="OTHER" value="false" />
</context>
</template>
<template name="for_" value="for (var $INDEX$ = 0; $INDEX$ &lt; $ARRAY$.length; $INDEX$++) {&#10; var $VAR$ = $ARRAY$[$INDEX$];&#10; $END$&#10;}" description="Iterate elements of array" toReformat="false" toShortenFQNames="true">
<variable name="INDEX" expression="jsSuggestIndexName()" defaultValue="&quot;i&quot;" alwaysStopAt="true" />
<variable name="ARRAY" expression="jsArrayVariable()" defaultValue="&quot;array&quot;" alwaysStopAt="true" />
<variable name="VAR" expression="jsSuggestVariableName()" defaultValue="&quot;o&quot;" alwaysStopAt="true" />
<context>
<option name="HTML_TEXT" value="false" />
<option name="HTML" value="false" />
<option name="XSL_TEXT" value="false" />
<option name="XML" value="false" />
<option name="JSP" value="false" />
<option name="CSS" value="false" />
<option name="JAVA_SCRIPT" value="true" />
<option name="JS_STATEMENT" value="true" />
<option name="HAML" value="false" />
<option name="OTHER" value="false" />
</context>
</template>
<template name="for_reverse" value="for (var $INDEX$ = $ARRAY$.length - 1; $INDEX$ &gt;= 0; $INDEX$--) {&#10; var $VAR$ = $ARRAY$[$INDEX$];&#10; $END$&#10;}" description="Iterate elements of array in reverse order" toReformat="false" toShortenFQNames="true">
<variable name="INDEX" expression="jsSuggestIndexName()" defaultValue="&quot;i&quot;" alwaysStopAt="true" />
<variable name="ARRAY" expression="jsArrayVariable()" defaultValue="&quot;array&quot;" alwaysStopAt="true" />
<variable name="VAR" expression="jsSuggestVariableName()" defaultValue="&quot;o&quot;" alwaysStopAt="true" />
<context>
<option name="HTML_TEXT" value="false" />
<option name="HTML" value="false" />
<option name="XSL_TEXT" value="false" />
<option name="XML" value="false" />
<option name="JSP" value="false" />
<option name="CSS" value="false" />
<option name="JAVA_SCRIPT" value="true" />
<option name="JS_STATEMENT" value="true" />
<option name="HAML" value="false" />
<option name="OTHER" value="false" />
</context>
</template>
<template name="if" value="if ($CONDITION$) {&#10; $END$&#10;}" description="'if' statement" toReformat="false" toShortenFQNames="true">
<variable name="CONDITION" expression="completeSmart()" defaultValue="&quot;condition&quot;" alwaysStopAt="true" />
<context>
<option name="HTML_TEXT" value="false" />
<option name="HTML" value="false" />
<option name="XSL_TEXT" value="false" />
<option name="XML" value="false" />
<option name="JSP" value="false" />
<option name="CSS_PROPERTY_VALUE" value="false" />
<option name="CSS_DECLARATION_BLOCK" value="false" />
<option name="CSS_RULESET_LIST" value="false" />
<option name="CSS" value="false" />
<option name="JAVA_SCRIPT" value="true" />
<option name="TypeScript" value="false" />
<option name="HAML" value="false" />
<option name="JADE" value="false" />
<option name="CoffeeScript" value="false" />
<option name="DART" value="false" />
<option name="OTHER" value="false" />
</context>
</template>
<template name="ife" value="if ($CONDITION$) {&#10; $END$&#10;} else {&#10;&#10;}" description="'if-else' statement" toReformat="false" toShortenFQNames="true">
<variable name="CONDITION" expression="completeSmart()" defaultValue="&quot;condition&quot;" alwaysStopAt="true" />
<context>
<option name="HTML_TEXT" value="false" />
<option name="HTML" value="false" />
<option name="XSL_TEXT" value="false" />
<option name="XML" value="false" />
<option name="JSP" value="false" />
<option name="CSS_PROPERTY_VALUE" value="false" />
<option name="CSS_DECLARATION_BLOCK" value="false" />
<option name="CSS_RULESET_LIST" value="false" />
<option name="CSS" value="false" />
<option name="JAVA_SCRIPT" value="true" />
<option name="TypeScript" value="false" />
<option name="HAML" value="false" />
<option name="JADE" value="false" />
<option name="CoffeeScript" value="false" />
<option name="DART" value="false" />
<option name="OTHER" value="false" />
</context>
</template>
<template name="ifeif" value="if ($CONDITION$) {&#10; $END$&#10;} else if ($NEXTCONDITION$) {&#10;&#10;} else {&#10;&#10;}" description="'if-else if -else' statement" toReformat="false" toShortenFQNames="true">
<variable name="CONDITION" expression="completeSmart()" defaultValue="&quot;condition&quot;" alwaysStopAt="true" />
<variable name="NEXTCONDITION" expression="completeSmart()" defaultValue="&quot;nextCondition&quot;" alwaysStopAt="true" />
<context>
<option name="HTML_TEXT" value="false" />
<option name="HTML" value="false" />
<option name="XSL_TEXT" value="false" />
<option name="XML" value="false" />
<option name="JSP" value="false" />
<option name="CSS_PROPERTY_VALUE" value="false" />
<option name="CSS_DECLARATION_BLOCK" value="false" />
<option name="CSS_RULESET_LIST" value="false" />
<option name="CSS" value="false" />
<option name="JAVA_SCRIPT" value="true" />
<option name="TypeScript" value="false" />
<option name="HAML" value="false" />
<option name="JADE" value="false" />
<option name="CoffeeScript" value="false" />
<option name="DART" value="false" />
<option name="OTHER" value="false" />
</context>
</template>
<template name="switch" value="switch ($EXPRESSION$) {&#10;case $EXPVALUE1$:&#10; $END$&#10; break;&#10;case $EXPVALUE2$:&#10;&#10; break;&#10;default:&#10;&#10;}" description="'switch' statement" toReformat="false" toShortenFQNames="true">
<variable name="EXPRESSION" expression="completeSmart()" defaultValue="&quot;expression&quot;" alwaysStopAt="true" />
<variable name="EXPVALUE1" expression="" defaultValue="&quot;val1&quot;" alwaysStopAt="true" />
<variable name="EXPVALUE2" expression="" defaultValue="&quot;val2&quot;" alwaysStopAt="true" />
<context>
<option name="HTML_TEXT" value="false" />
<option name="HTML" value="false" />
<option name="XSL_TEXT" value="false" />
<option name="XML" value="false" />
<option name="JSP" value="false" />
<option name="CSS_PROPERTY_VALUE" value="false" />
<option name="CSS_DECLARATION_BLOCK" value="false" />
<option name="CSS_RULESET_LIST" value="false" />
<option name="CSS" value="false" />
<option name="JAVA_SCRIPT" value="true" />
<option name="TypeScript" value="false" />
<option name="HAML" value="false" />
<option name="JADE" value="false" />
<option name="CoffeeScript" value="false" />
<option name="DART" value="false" />
<option name="OTHER" value="false" />
</context>
</template>
<template name="while" value="while ($CONDITION$) {&#10; $END$&#10;}" description="Loop 'while' loops through a block of code with condition" toReformat="false" toShortenFQNames="true">
<variable name="CONDITION" expression="completeSmart()" defaultValue="" alwaysStopAt="true" />
<context>
<option name="HTML_TEXT" value="false" />
<option name="HTML" value="false" />
<option name="XSL_TEXT" value="false" />
<option name="XML" value="false" />
<option name="JSP" value="false" />
<option name="CSS_PROPERTY_VALUE" value="false" />
<option name="CSS_DECLARATION_BLOCK" value="false" />
<option name="CSS_RULESET_LIST" value="false" />
<option name="CSS" value="false" />
<option name="JAVA_SCRIPT" value="true" />
<option name="TypeScript" value="false" />
<option name="HAML" value="false" />
<option name="JADE" value="false" />
<option name="CoffeeScript" value="false" />
<option name="DART" value="false" />
<option name="OTHER" value="false" />
</context>
</template>
<template name="do" value="do {&#10; $END$&#10;} while ($CONDITION$);" description="Loop 'do-while' execute the code block once, before checking if the condition." toReformat="false" toShortenFQNames="true">
<variable name="CONDITION" expression="completeSmart()" defaultValue="" alwaysStopAt="true" />
<context>
<option name="HTML_TEXT" value="false" />
<option name="HTML" value="false" />
<option name="XSL_TEXT" value="false" />
<option name="XML" value="false" />
<option name="JSP" value="false" />
<option name="CSS_PROPERTY_VALUE" value="false" />
<option name="CSS_DECLARATION_BLOCK" value="false" />
<option name="CSS_RULESET_LIST" value="false" />
<option name="CSS" value="false" />
<option name="JAVA_SCRIPT" value="true" />
<option name="TypeScript" value="false" />
<option name="HAML" value="false" />
<option name="JADE" value="false" />
<option name="CoffeeScript" value="false" />
<option name="DART" value="false" />
<option name="OTHER" value="false" />
</context>
</template>
<template name="try" value="try {&#10; $END$&#10;} catch (err) {&#10;&#10;}" description="'try-catch' statement" toReformat="false" toShortenFQNames="true">
<context>
<option name="HTML_TEXT" value="false" />
<option name="HTML" value="false" />
<option name="XSL_TEXT" value="false" />
<option name="XML" value="false" />
<option name="JSP" value="false" />
<option name="CSS_PROPERTY_VALUE" value="false" />
<option name="CSS_DECLARATION_BLOCK" value="false" />
<option name="CSS_RULESET_LIST" value="false" />
<option name="CSS" value="false" />
<option name="JAVA_SCRIPT" value="true" />
<option name="TypeScript" value="false" />
<option name="HAML" value="false" />
<option name="JADE" value="false" />
<option name="CoffeeScript" value="false" />
<option name="DART" value="false" />
<option name="OTHER" value="false" />
</context>
</template>
<template name="throw" value="throw new $ERRTYPE$('$MSG$', '$MODULENAME$');" description="Throw new error" toReformat="false" toShortenFQNames="true">
<variable name="ERRTYPE" expression="enum(&quot;Error&quot;, &quot;RangeError&quot;, &quot;ReferenceError&quot;, &quot;TypeError&quot;, &quot;URIError&quot;, &quot;EvalError&quot;, &quot;SyntaxError&quot;)" defaultValue="&quot;Error&quot;" alwaysStopAt="true" />
<variable name="MSG" expression="" defaultValue="&quot;Error description&quot;" alwaysStopAt="true" />
<variable name="MODULENAME" expression="fileNameWithoutExtension()" defaultValue="&quot;Module&quot;" alwaysStopAt="true" />
<context>
<option name="HTML_TEXT" value="false" />
<option name="HTML" value="false" />
<option name="XSL_TEXT" value="false" />
<option name="XML" value="false" />
<option name="JSP" value="false" />
<option name="CSS_PROPERTY_VALUE" value="false" />
<option name="CSS_DECLARATION_BLOCK" value="false" />
<option name="CSS_RULESET_LIST" value="false" />
<option name="CSS" value="false" />
<option name="JAVA_SCRIPT" value="true" />
<option name="TypeScript" value="false" />
<option name="HAML" value="false" />
<option name="JADE" value="false" />
<option name="CoffeeScript" value="false" />
<option name="DART" value="false" />
<option name="OTHER" value="false" />
</context>
</template>
<template name="?" value="$VAR$ = ($CONDITION$) ? $VAL1$ : $VAL2$" description="Conditional operator that assigns a value to a variable based on some condition" toReformat="false" toShortenFQNames="true">
<variable name="VAR" expression="jsSuggestVariableName()" defaultValue="&quot;val&quot;" alwaysStopAt="true" />
<variable name="CONDITION" expression="completeSmart()" defaultValue="&quot;condititon&quot;" alwaysStopAt="true" />
<variable name="VAL1" expression="" defaultValue="&quot;value1&quot;" alwaysStopAt="true" />
<variable name="VAL2" expression="" defaultValue="&quot;value2&quot;" alwaysStopAt="true" />
<context>
<option name="HTML_TEXT" value="false" />
<option name="HTML" value="false" />
<option name="XSL_TEXT" value="false" />
<option name="XML" value="false" />
<option name="JSP" value="false" />
<option name="CSS_PROPERTY_VALUE" value="false" />
<option name="CSS_DECLARATION_BLOCK" value="false" />
<option name="CSS_RULESET_LIST" value="false" />
<option name="CSS" value="false" />
<option name="JAVA_SCRIPT" value="true" />
<option name="TypeScript" value="false" />
<option name="HAML" value="false" />
<option name="JADE" value="false" />
<option name="CoffeeScript" value="false" />
<option name="DART" value="false" />
<option name="OTHER" value="false" />
</context>
</template>
<template name="fun" value="function ($PARAMETERS$) {&#10; 'use strict';&#10; var self = this;&#10; $END$&#10;}" description="Add new function" toReformat="false" toShortenFQNames="true">
<variable name="PARAMETERS" expression="completeSmart()" defaultValue="&quot;params&quot;" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
</context>
</template>
<template name="us" value="'use strict';&#10;$END$" description="Inserts 'use strict' statement" toReformat="true" toShortenFQNames="true">
<context />
</template>
</templateSet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.