Файл: wysiwyg/ace/files/snippets/javascript.js
Строк: 366
<?php
ace.define("ace/snippets/javascript",["require","exports","module"],function(e,t,n){"use strict";t.snippetText='# Prototypensnippet proton ${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) {n ${4:// body...}n };n# Functionnsnippet funn function ${1?:function_name}(${2:argument}) {n ${3:// body...}n }n# Anonymous Functionnregex /((=)\s*|(:)\s*|(\()|\b)/f/(\))?/nsnippet fn function${M1?: ${1:functionName}}($2) {n ${0:$TM_SELECTED_TEXT}n }${M2?;}${M3?,}${M4?)}n# Immediate functionntrigger \(?f\(nendTrigger \)?nsnippet f(n (function(${1}) {n ${0:${TM_SELECTED_TEXT:/* code */}}n }(${1}));n# ifnsnippet ifn if (${1:true}) {n ${0}n }n# if ... elsensnippet ifen if (${1:true}) {n ${2}n } else {n ${0}n }n# tertiary conditionalnsnippet tern ${1:/* condition */} ? ${2:a} : ${3:b}n# switchnsnippet switchn switch (${1:expression}) {n case '${3:case}':n ${4:// code}n break;n ${5}n default:n ${2:// code}n }n# casensnippet casen case '${1:case}':n ${2:// code}n break;n ${3}nn# while (...) {...}nsnippet whn while (${1:/* condition */}) {n ${0:/* code */}n }n# trynsnippet tryn try {n ${0:/* code */}n } catch (e) {}n# do...whilensnippet don do {n ${2:/* code */}n } while (${1:/* condition */});n# Object Methodnsnippet :fnregex /([,{[])|^\s*/:f/n ${1:method_name}: function(${2:attribute}) {n ${0}n }${3:,}n# setTimeout functionnsnippet setTimeoutnregex /\b/st|timeout|setTimeo?u?t?/n setTimeout(function() {${3:$TM_SELECTED_TEXT}}, ${1:10});n# Get Elementsnsnippet gettn getElementsBy${1:TagName}('${2}')${3}n# Get Elementnsnippet getn getElementBy${1:Id}('${2}')${3}n# console.log (Firebug)nsnippet cln console.log(${1});n# returnnsnippet retn return ${1:result}n# for (property in object ) { ... }nsnippet forin for (var ${1:prop} in ${2:Things}) {n ${0:$2[$1]}n }n# hasOwnPropertynsnippet hasn hasOwnProperty(${1})n# docstringnsnippet /**n /**n * ${1:description}n *n */nsnippet @parnregex /^\s*\*\s*/@(para?m?)?/n @param {${1:type}} ${2:name} ${3:description}nsnippet @retn @return {${1:type}} ${2:description}n# JSON.parsensnippet jsonpn JSON.parse(${1:jstr});n# JSON.stringifynsnippet jsonsn JSON.stringify(${1:object});n# self-defining functionnsnippet sdfn var ${1:function_name} = function(${2:argument}) {n ${3:// initial code ...}nn $1 = function($2) {n ${4:// main code}n };n }n# singletonnsnippet singn function ${1:Singleton} (${2:argument}) {n // the cached instancen var instance;nn // rewrite the constructorn $1 = function $1($2) {n return instance;n };n n // carry over the prototype propertiesn $1.prototype = this;nn // the instancen instance = new $1();nn // reset the constructor pointern instance.constructor = $1;nn ${3:// code ...}nn return instance;n }n# classnsnippet classnregex /^\s*/clas{0,2}/n var ${1:class} = function(${20}) {n $40$0n };n n (function() {n ${60:this.prop = ""}n }).call(${1:class}.prototype);n n exports.${1:class} = ${1:class};n# nsnippet for-n for (var ${1:i} = ${2:Things}.length; ${1:i}--; ) {n ${0:${2:Things}[${1:i}];}n }n# for (...) {...}nsnippet forn for (var ${1:i} = 0; $1 < ${2:Things}.length; $1++) {n ${3:$2[$1]}$0n }n# for (...) {...} (Improved Native For-Loop)nsnippet forrn for (var ${1:i} = ${2:Things}.length - 1; $1 >= 0; $1--) {n ${3:$2[$1]}$0n }nnn#modulesnsnippet defn define(function(require, exports, module) {n "use strict";n var ${1/.*\///} = require("${1}");n n $TM_SELECTED_TEXTn });nsnippet reqnguard ^\s*n var ${1/.*\///} = require("${1}");n $0nsnippet requnguard ^\s*n var ${1/.*\/(.)/\u$1/} = require("${1}").${1/.*\/(.)/\u$1/};n $0n',t.scope="javascript"}); (function() {
ace.require(["ace/snippets/javascript"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();
?>