2009å¹´03æ14æ¥ 18:41 ã«ãã´ãªããã°ã©ã ã»ã¹ã¯ãªãã jQuery ã® each() ã® continue / break ã¯ã»ã»ã» No Comments No Trackbacks å¿ããããªã®ã§è¦æ¸ã JavaScript ã§é åãªãããã¤ãã¬ã¼ã·ã§ã³å¦çããæã¯ãfor ã使ãã®ãä¸è¬çã â JavaScript ã®æ¸ãæ¹ for (var i=0, numArity=arrHOGE.length; i<numArity; i++) { (ãªããå¦ç); } jQuery ã使ã£ãã¨ãã¯ãã¤ãã¬ã¼ã·ã§ã³ã®ããã« each ãå©ç¨ã§ããã â jQuery ã®æ¸ãæ¹ $(arrHOGE).each( function(i) { (ãªããå¦ç); } ); 便å©ã ãã¼ã â continue / break ã®ããæ¹ ãã¦ãfor ã§ã°ã«ã°ã«åãã¦ããå¦çã ããã®æã
ããã°ãã¯ãéªãéããããªå¯ãæ¥ãç¶ãã¦ãã¾ããã 2015å¹´æ°å ãã£ããã§ãã åµä½æ´»åããã楽ãããªãã·ã§ããä½æãµã¼ãã¹ BOOTHããã®ã¥ããããã£ã¨èº«è¿ã«ãã pixivFACTORY ãªã©ãéãã¦ãã¦ã¼ã¶ã¼ããã«åµä½æ´»åã楽ããã§ããããä»äºããã¦ãã¾ãã ãã¦ãä»æ¥ã¯JSZipã«ãã ã¯ã©ã¤ã¢ã³ããµã¤ãzipçæ & ãã¡ã¤ã«ä¸æ¬DLãç´¹ä»ãã¾ãã ãªãã¯ã©ã¤ã¢ã³ããµã¤ãã§zipçæï¼ ä»åã¯ãWebãã¼ã¸ã®ãã¦ã³ãã¼ããªã³ã¯ãããã¡ã¤ã«ãä¸æ¬ãã¦ã³ãã¼ãããããã«ä½¿ãã¾ãã è¤æ°ã®ãã¦ã³ãã¼ããªã³ã¯ããããã¼ã¸ã§ã¯ããä¸æ¬ãã¦ã³ãã¼ããã®ãã¿ã³ãç¨æããããªãã¾ãããã ãããããµã¼ãã¼ãµã¤ãã§zipãçæãã¦ããã®ã¯è² è·ã大ããã§ãã ããã§ä¾¿å©ãªã®ããã¯ã©ã¤ã¢ã³ããµã¤ãã§ã®zipå§ç¸®ã§ãã ãã©ã¦ã¶ã§zipãã¡ã¤ã«ãä½ããã¨ã§ããµã¼ãã¼ã¸è² è·ããããã«ãä¸æ¬ãã¦ã³ãã¼
JavaScriptã®æ¨æºè¦æ ¼ã®ãECMAScript6ã(2015å¹´6æ17æ¥å ¬é)ã®æ©è½ã§ãããPromiseããInternet Explorerã§ä½¿ç¨ãã¦è¤æ°ã®ãã¡ã¤ã«ãåæã®ããã«é£ç¶ãã¦èªã¿è¾¼ããµã³ãã«ã§ãã Web Workerã使ç¨ããé£ç¶èªã¿è¾¼ã¿ã¯ããã¡ã¤ã«ãåæã»éåæã§èªã¿è¾¼ãã(ãã¤ããªç¨)ãã覧ãã ãããéåæãå·§ã¿ã«ä½¿ç¨ããèªã¿è¾¼ã¿ã¯ãImage.onloadãåæã§èªã¿è¾¼ããã§ãã Promiseãªãã¸ã§ã¯ãã¯IEã«ã¯æè¼ããã¦ãã¾ããã®ã§ããªã¼ãã³ã½ã¼ã¹ã®Polyfillã©ã¤ãã©ãª(ããªãã£ã«)ã使ç¨ãã¾ããPolyfillã¨ã¯IEãªã©ã®ãã©ã¦ã¶ã§æè¼ããã¦ããªãæ°æ©è½ãã©ã¤ãã©ãªã使ç¨ãã¦ä½¿ç¨ã§ããããã«ãããã®ã§ãã ä»åã使ç¨ããã®ã¯MITã©ã¤ã»ã³ã¹ã®ãnative-promise-onlyãã§ãããã¡ã¤ã«ã¯ãnpo.src.jsãã§ç´8.7kbã§ãã
å æã®ã¨ã³ããªã§ãFileSystem APIã§JavaScriptãããã¼ã«ã«ã¹ãã¬ã¼ã¸ã¸ã®ä¿åãèªã¿è¾¼ã¿ãè¡ãæ¹æ³ãã¾ã¨ãã¾ããããä¿åããããã¼ã¿ã¯PCã®ã©ãã«ä¿åãããã®ãï¼ãããããªãã¾ã¾ã ã£ãã®ã§èª¿ã¹ã¦ã¿ã¾ããã ä¿åããããã¼ã¿ã¯PCã®ã©ãã«ä¿åãããã®ãï¼ FileSystem API ã«ã¤ãã¦ç¥ã - HTML5 Rocksã«ããã¨ã FileSystem API ã使ç¨ããã¨ãã¦ã¼ã¶ã¼ã®ãã¼ã«ã« ãã¡ã¤ã« ã·ã¹ãã ã®ãµã³ãããã¯ã¹åãããã»ã¯ã·ã§ã³ã®ä½æãèªã¿åããããã²ã¼ããæ¸ãè¾¼ã¿ãã¦ã§ã ã¢ããªã±ã¼ã·ã§ã³ããè¡ããã¨ãã§ãã¾ãã ãµã³ãããã¯ã¹åã¨ã¯ãããWikipediaã«ããã¾ã㨠ãµã³ãããã¯ã¹ï¼sandboxï¼ã¨ã¯ãå¤é¨ããåãåã£ãããã°ã©ã ãä¿è·ãããé åã§åä½ããããã¨ã«ãã£ã¦ã·ã¹ãã ãä¸æ£ã«æä½ãããã®ãé²ãã»ãã¥ãªãã£ã¢ãã«ã®ãã¨ã å®è¡ãããã
AngularJS 㧠Promise (defer)ã使ã£ã¦ãã¡ã¤ã«ã·ã¹ãã ãããã¡ã¤ã«ãèªã¿è¾¼ã (cordova filesystem)PhoneGapAngularmonaca Monaca & OnsenUI ã§ãã¤ããªããã¢ã㪠OnsenUI = AngularJSãªã®ã§ãMonacaã§AngularJSã®å½¢ã«å¾ããªãããã¢ããªã±ã¼ã·ã§ã³ãä½æãã¦ããã 端æ«ã«ãã¡ã¤ã«ãä¿åï¼èªã¿åãããå ´åãPhoneGap(Cordova) FileAPI ã®ãä¸è©±ã«ãªãã HTML5 File API ã§ãã¡ã¤ã«ãæ±ã ãã¡ã¤ã«ãèªã¿æ¸ãããã ããªãã³ã¼ã«ããã¯é¢æ°ã«ä»äºãã¦ããã£ã¦ã»ã»ã§è¯ããã ãã©ããã¡ã¤ã«ã®ä¸èº«ããªã¹ãå½¢å¼ã§æããã¦ãç»é¢ã«è¡¨ç¤ºã»ã»ã使ç¨ã¨ããã¨ã表示ãããã¿ã¤ãã³ã°ã§ãã¼ã¿ãåå¾åºæ¥ã¦ãããã§ã¯ãªãéåæå¦çã®å£ã«é»ã¾ãããã Promise ã§ãã£ã¦ã¿ã ãã
ãã®ãã¼ã¸ã¯ãCodingManiaãã®ãã¢ãã¼ã¸ã§ã â ã¯ãªãã¯ã§è¡¨ç¤ºãããããããã¦ã³ã¡ãã¥ã¼ã®ãã¢ãã¼ã¸ Menu01 Menu02 Menu02_Aã®ã¿ã¤ãã«ãé·ãå ´å Menu02_B Menu02_C Menu03 Menu04 Menu04_A Menu04_B Menu04_C Menu04_D ãããããã¦ã³ã¯ãMenu02ã¨Menu04ã
æ¯åº¦ããªãã¿ã[æããªãJavaScript + jQuery]ã·ãªã¼ãºã§ãã ä»åã¯ããã¦ã¹ãªã¼ãã¼ã§æ³¨éã表示ãããjsãä½ãã¾ãã ã㢠å®éã«åããã¦ã¿ãã¨ãããªæãã«ãªãã¾ãã ãã¿ã³ã«ãã¦ã¹ãè¼ãã¦ã¿ã¦ãã ããã ãã¢ãå¥ãã¼ã¸ã§éã ãã¡ã¤ã«ä¸å¼ãã¦ã³ãã¼ã Step1ï¼ã¾ãä¸æºå ãã¡ãã¯ãã¤ãã¨åãã§ãããã¾ãå¿ è¦ãªãã¡ã¤ã«ãèªã¿è¾¼ã¿ã¾ãã headerã®ä¸ã«ãjQueryã¨ãèªåã§ä½ã£ãjavascriptã®ãã¡ã¤ã«ï¼ä»å㯠tips.js ã¨ãã¾ãï¼ãèªã¿è¾¼ã¿ã¾ãã <head> <script src=âcommon/js/jquery.jsâ type=âtext/javascriptâ></script> <script src=âcommon/js/tips.jsâ type=âtext/javascriptâ></script> </head>
JavaScript Advent Calendar 2011 (Node.js/WebSocketsã³ã¼ã¹)3æ¥ç®ã®hokacchaã§ããNode.jsã®ãã¹ããã¬ã¼ã ã¯ã¼ã¯ãmochaã«ã¤ãã¦æ¸ãã¾ãã mochaã¯TJãæ°ããä½ãå§ãã¦ãããã¹ããã¬ã¼ã ã¯ã¼ã¯ã§ããããã¥ã¡ã³ããè¦ãã°ã§ãããã¨ã¯å¤§ä½æ¸ãã¦ããã¾ãã®ã§ãããã¥ã¡ã³ããå ã«ã©ããããã¨ãã§ããã®ãã解説ãã¦ããã¾ããç¾æç¹ã§ã®ãã¼ã¸ã§ã³ã¯0.2.0ã§ãã http://visionmedia.github.com/mocha/ shouldã«ã¤ã㦠ã¾ãmochaã§ã©ããããã¨ãã§ãããã®åã«shouldã«ã¤ãã¦è§£èª¬ãã¦ããã¾ããmochaã®ããã¥ã¡ã³ãã«ã¯ç¹ã«èª¬æããªãshouldã使ããã¦ãã¦ãshouldã§ã©ããããã¨ãã§ãããããã£ã¦ãªãã¨ãããã¥ã¡ã³ããèªãã ã¨ãã«mochaã®æ©è½ãªã®ãshouldã®æ©è½ãªã®
Webãã©ã¦ã¶ã«ããã¦ãJavaScript㧠window.open() ã®æ»ãå¤ã¯ãéããåã¦ã¤ã³ãã¦ãªãã¸ã§ã¯ãã®åç §ã§ãã var win = window.open(âurlâ, "windowName"); // win ã¯åã¦ã£ã³ãã¦ãªãã¸ã§ã¯ãã®åç § åã¦ã£ã³ãã¦ããã¯ã window.opener ã§è¦ªã¦ã£ã³ãã¦ãªãã¸ã§ã¯ããåç §ãããã¨ãã§ãã¾ãã ã¾ããã¦ã£ã³ãã¦åããã¦ã¤ã³ãã¦ãªãã¸ã§ã¯ããåç §ãããã¨ãã§ãã¾ãã Gecko DOM ãªãã¡ã¬ã³ã¹ã® window.open ã«ã¯ãã¦ã£ã³ãã¦åããã¦ã¤ã³ãã¦ãªãã¸ã§ã¯ããåç §ããæ¹æ³ãè¨è¼ããã¦ãã¾ãã url ã«ç©ºæååãä¸ãããã¨ã¯ãã¦ã£ã³ãã¦ã®ãã±ã¼ã·ã§ã³ãå¤ããã«ããã®ååã«ãã£ã¦éããã¦ã£ã³ãã¦ã®åç §ãå¾ãããã®æ段ã§ãã window.open â Gecko DOM ãªãã¡ã¬ã³ã¹ ãã¨ãã°ãWindo
ç§ã¯ãã®foreachã大好ãã§ãã foreachã®ãããã§ãé åã好ãã«ãªãã¾ããã 以ä¸ãPerl , PHP, VBA, JavaScriptã§ãé åã®å ¨è¦ç´ ã表示ããä¾ã§ãã Perlããâ» foreach my $item (@items) { print $item; } PHP foreach ( $items as $item){ echo $item; } JavaScript for(var i in items){ alert(items[i]);} VBAããâ» For Each item In items MsgBox item Next â»æ³¨ï¼ Perlã®å ´åã¯ãããã«çãæ¸ãã¾ãã foreach (@items){ print $_ ;}ããã¾ã㯠for(@items){ print $_;}ããããããã¾ã㯠print for @items; â»æ³¨ï¼
if (!navigator.cookieEnabled) { document.write("ãã©ã¦ã¶ã®è¨å®ã«ã¦ã¯ããã¼ã®åãå ¥ããæå¹ã«ãã¦ãã ããã"); } ã¯ããã¼ãå©ç¨å¯è½ã§ããã° navigator.cookieEnabled ã¯ç (true) ã«ãªãã¾ãã®ã§ãçå½å¤ããã§ãã¯ãã¦ä½¿ç¨å¯è½ãã©ãããå¤å¥ãããã¨ãã§ãã¾ãããªããwindow ã¯çç¥ãããã¨ãã§ãã¾ãã <script type="text/javascript"> <!-- var name = "testcookie"; // ã¯ããã¼ã®åå var value = 1; // ã¯ããã¼ã®å¤ var period = 7; // æå¹æéæ¥æ° // çºè¡ããã¯ããã¼ã®åå¾ï¼èªã¿è¾¼ã¿ï¼ if (document.cookie) { var cookies = document.cookie.split(";
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}