ãªãLOVEå¤ä¼ç¬¬2å¼¾ãã¤ãããã®JavaScriptã
http://kakutani.com/20051222.html#p01
http://rails2u.com/misc/imadoki/ (è³æããã¼ãã¼ãã®s, wã§ãã¬ã¼ã³æä½å¯è½)
ã§ã²ã¹ãè¬å¸«ãã¦ãã¾ãããåå è
ã®çãããã»ããã£ã³ã°ããã¼ã¸ã£å
¼å¹¹äº1.0ã®è§è°·ããããç²ãæ§ã§ããã
ã¨ããããã§JavaScript, Ajax, prototype.js ããã¦Giza(ãªã¬ãªã¬JavaScript Framework inspired by ããããã)ã«ã¤ãã¦æ¾è«ã¨ãããã¨ã§ç·©ãæãã«ã ãã ãã¨ã話ãããã¦ãã¾ããããã®ä¸ã§ã¨ãããGiza.Eventsã«ã¤ãã¦é¢å¿ãæãããæ¹ãå¤ãã£ããããªã®ã§ãGiza.Eventsã«ã¤ãã¦ã®èª¬æãã¡ãã£ã¨ã
Giza.Eventsã¯ä¸»ã«ä¸ã¤ã®æ©è½ãããã¾ãã
giza:a, giza:c ãªã©ã®giza: æ¥é è¾ã¤ãã®æ¡å¼µå±æ§ãå©ç¨ããã³ã³ããã¼ã©ãã¢ã¯ã·ã§ã³ã®å¼ã³åºã
å ·ä½çã«ã¯
<a giza:c='page' giza:a='index'>ãã¼ã¸ä¸è¦§</a> # ã¯ãªãã¯ãããpageã³ã³ããã¼ã©ãã¢ã¯ã·ã§ã³indexãå®è¡ <a giza:a='move' giza:p='TopPage'>ããããã¼ã¸</a> # ã¯ãªãã¯ãããããã©ã«ãã³ã³ããã¼ã©ãã¢ã¯ã·ã§ã³moveããã©ã¡ã¼ã¿TopPageãå®è¡
ã¿ãããªé¢¨ã«ç°¡åã«giza: æ¡å¼µå±æ§ãè¨è¿°ããè¦ç´ ããclickã§ã¢ã¯ã·ã§ã³ã®å®è¡ãå¯è½ã§ãã
behaviour.jsãå©ç¨ããEventç»é²
behaviour.jsã®ä¸é¨æ©è½ãå©ç¨ããCSSã®ã»ã¬ã¯ã¿å½¢å¼ã®ãã¿ã¼ã³ããããè¨è¿°ãããã¨ã§ç°¡åã«Eventã®ç»é²ãè¡ãã¾ãã
Giza.Events.clickRegister({ '#submit': function(){ $Giza('submit'); return false; }, '#preview_button': function(){ $Giza('preview'); return false; } }); Giza.Events.register({ '#view': function(element){ Event.observe(element,'dblclick', function(){ $Giza('edit'); }); } });
ãã使ãã¯ãªãã¯ã®ã¤ãã³ãã¯Giza.Events.clickRegisterã«ç»é²ããã®ä»ã®ã¤ãã³ãã¯Giza.Events.registerã«ç»é²ãã¾ããä¸è¨ä¾ã®ä¸çªä¸ã§ã®è¨å®ã ã¨idãsubmitã®è¦ç´ ãã¯ãªãã¯ããã¨ãã«ããã©ã«ãã³ã³ããã¼ã©ãã¢ã¯ã·ã§ã³submitãå®è¡ããã¾ãã
hotkey.jsãå©ç¨ããããããã¼ã®ç»é²
hotkey.jsãå©ç¨ãã¦ãããç°¡åã«ããããã¼ã®ç»é²ãè¡ãã¾ãã
Giza.Events.HotKeyRegister({ s: function(){$Giza('next');}, w: function(){$Giza('prev');} });
ãã®ä¾ã§ã¯ãã¼ãã¼ãã®ãsããæ¼ãããã¨ããããã©ã«ãã³ã³ããã¼ã©ãã¢ã¯ã·ã§ã³nextãããwããæ¼ãããã¨ãããã©ã«ãã³ã³ããã¼ã©ãã¢ã¯ã·ã§ã³prevãå®è¡ããã¾ãã
ããããgiza/events.jsã«è¨è¿°ãããã¨ã«ãããååãã¼ã(onload)æã«ã¤ãã³ããç»é²ããã¾ãããªã«ãã«ããªã便å©ã§ãã
ç¾å¨ã®Gizaèªä½ã¯ã³ã³ããã¼ã©ä¸å¿ã®ãã¬ã¼ã ã¯ã¼ã¯ãMVCã§ããã¨ããã®Cã®ã¿ã®ãã¬ã¼ã ã¯ã¼ã¯ã§ãããããGizaã®å®è£ ã¨Gizaãã¤ãã£ãã¢ããªã±ã¼ã·ã§ã³ã®å®è£ ããããéãJavaScriptã§ä¸çªéè¦ãããã¨ã¯ã³ã³ããã¼ã©ã»ã¢ã¯ã·ã§ã³ãè¨è¿°ã§ããäºããããã¤ãã³ããã³ãã©ã®ç»é²ã ãªãã¨ã²ãã²ãã¨æãã¾ãããJavaScriptã®ãã¬ã¼ã ã¯ã¼ã¯ã¯ããããã³ã³ããã¼ã©ã»ã¢ã¯ã·ã§ã³ãå®ç¾©ãã¦äºã ã®ãã¬ã¼ã ã¯ã¼ã¯ããããã©ããã£ã¦ã¤ãã³ããç»é²ããããããã¤åå©ç¨ãå¯è½ãªå½¢ã§ã³ã¼ããæ¸ããããã«ç¦ç¹ãåãããã¤ãã³ãéè¦ã®ãã¬ã¼ã ã¯ã¼ã¯ããã¹ããªããããªãããªã¼ãã¨ãããããGizaãæ¡å¼µããéã¯ã³ã³ããã¼ã©ã»ã¢ã¯ã·ã§ã³çãªæ¦å¿µã«ã¨ãããããã¨ãªããã£ã¡ã®æ¹åã«åããããã¨æã£ã¦ã¾ãã
ãããã®è¨äºä¸çªä¸ã®è³æãGizaã使ã£ã¦å®è£ ãã¦ã¾ãã®ã§ãããããç©ããããã¾ãããGizaã®ã½ã¼ã¹ãè¦ããæ¹ã¯ã©ããããããã¯restwiki*1 ãGizaã使ã£ã¦å®è£ ãã¦ãã®ã§ãããã¦ã©ããã