天天看點

Js,jQuery版Zencoding之webstorm & phpstorm

zencoding自從2009年因html,css的擴充而風靡業界,而webstorm自從2.0之後就已經內建。

無意中被不斷輸入的console.log,console.dir搞的很惱火,是以才有了今天的js之webstorm。由于其它編輯器對zencoding的外延不是做的很好,現下流行的編輯器裡邊,隻有webstorm才可以擴充以下提到的指令。當然,他除了擴充js之後,還可以擴充:xml,php(phpstorm),xsl,使用者也可以自定義添加:JSP,SQL,Haml或者其它的。隻是提供一個思路,抛磚引玉,具體的還要看每個人自己的code習慣。webstorm比eclipse,aptana中的更改zencoding友善之處,不用重新開機。而比其它ide的好處在于,他可以更改。

這裡提幾個比較重要簡單的擴充原則。  

2. 上面檔案,左邊即為輸入部分,右邊為擴充後,如果手動添加,還需要在下方 :

No applicable contexts yet. Define

Define中選擇你的類型:

Js,jQuery版Zencoding之webstorm & phpstorm

//zencoding-js

// C:\Users\jikey\.WebIde10\config\templates

//core

try:

trycatch

ae: addEventListener

at: attachEvent

rn: return null

p: prototype

c: constructor

ag: arguments

ri: return this;

l: length;

v: var

tg: tagName()

rfa: return false;

del: delete

rtr: return true;

re: removeEventListener

det: detachEvent

lh:location.href

lo: location

tr: true;

fa: false;

st: setTimeout()

stf: setTimeout(function(){});

si: setInterval();

sif: setInterval(function(){});

r: return;

// dom相關

w: window

d:  document

db:  document.body

di:  document.getElementById($END$);

dn:  document.getElementsByName($END$);

dw:  document.write($END$);

dct: document.createTextNode

de: documentElement;

gt: getElementsByTagName

df: document.createDocumentFragment()

dc: document.createElement();

qs: querySelectorAll

// function 相關

bb:

(function(){

    $END$

})();

f  function $END$(){

}

fc: // 建立一個對象

function $INDEX$(){

$INDEX$.prototype = {

    name: function (){

    }

mf:

$END$: function(){

va:var $END$ = [];

vf:

var $END$ = function(){

vo:

var $END$ = {

    name: function(){

rm: return {

    $end$: function(){

// 流程控制

fi:

for (var $VAR$ in $ARRAY$) {

  $END$

for:

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

if:

if($END$){        

ifel:

} else {

while:

while($END$){

ifif: if($end$){

} else if(){

el: else{}

elif: else if(){}

ib: insertBefore

ap: appendChild

dba: document.body.appendChild

// jQuery

#: $('#$END$')

j:  $('$END$')

>:  $('.$END$')

fn:

(function($){

    $.fn.$END$ = function(options){

        var defaults = {

        };

        opts = $.extend({}, defaults, options);

        return this.each(function(){

        });

})(jQuery);

ji:$(this)

jfl:$().filter()

t.:that.me = me;

i.:this.me = me;

i: this

t that

jc: $().click

jh: $().hover

jl: $().live('click', function(){ });

jd: $().delegate('click', function(){ });

// 其它

fu:function

wd;width()

h:height();

$src:

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>

// firebug debug

cl:  console.log($END$);

cti:console.time('1');

cte:console.timeEnd('1');

Js,jQuery版Zencoding之webstorm & phpstorm

本文轉自豪情部落格園部落格,原文連結:http://www.cnblogs.com/jikey/archive/2012/03/28/2420704.html,如需轉載請自行聯系原作者

繼續閱讀