çµç·¯
- ï¼ãã¤ãï¼èµ·æ¥ãããï¼
- ååºãWebãµã¤ãã«è¼ããä¼æ¥ãã´ãèããªããï¼
- ããããªä¼æ¥ãã´ãæ¤ç´¢âè¦ãâåå¼·
- æ¤ç´¢ãããã¿ãå°½ãã¦ããã
- CrunchBaseã§ç®ã¼ããä¼ç¤¾ã®ãã´ãã¯ãªãã¯ãã¦è¦ç¶ããã
- ã¯ãªãã¯ããã®é¢åèããªã£ã¦ããããã
- ä¸æ°ã«è¦ããï¼
- http://www.crunchbase.com/help/api ãªãã¦ãããçºè¦ã
- Greasemonkeyã¹ã¯ãªããä½ãã
- ä¸æ°ã«è¦ãã¦ãã¾ã¼ãçºããã«ã¯æé©ï¼âãã¾ãã
CrunchBaseã«ç»é²ããã¦ããä¼æ¥ãã´ãä¸æ°ã«è¦ãGreasemonkeyã¹ã¯ãªãã
// ==UserScript== // @name CrunchBaseLogoViewer // @namespace gabu // @include http://www.crunchbase.com/companies* // ==/UserScript== // Add jQuery var GM_JQ = document.createElement('script'); GM_JQ.src = 'http://jquery.com/src/jquery-latest.js'; GM_JQ.type = 'text/javascript'; document.getElementsByTagName('head')[0].appendChild(GM_JQ); // Check if jQuery's loaded function GM_wait() { if(typeof unsafeWindow.jQuery == 'undefined') { window.setTimeout(GM_wait,100); } else { $ = unsafeWindow.jQuery; letsJQuery(); } } GM_wait(); // All your GM code must be inside this function function letsJQuery() { $.each($(".listing a"), function(key, value){ var href = value.href; var permalink = href.substr(href.lastIndexOf("/") + 1, href.length - href.lastIndexOf("/")); $.getJSON("http://api.crunchbase.com/v/1/company/" + permalink + ".js?callback=?", function(data){ if (data.image != null) { var src = "http://api.crunchbase.com/" + data.image.available_sizes[0][1]; $("<img/>").attr("src", src).appendTo(value); } }); }); }
注æäºé
- jQueryããããã¯ã¼ã¯è¶ãã«ãã¼ãããã®ã§éãã
- ä¼æ¥ä¸è¦§ãã¼ã¸ã®ãªã³ã¯å ã1件ãã¤æ¤ç´¢ããã®ã§éãã
- ãã¼ã¸ã«ãã£ã¦ã¯ç»åãã¡ã¤ã«ã大éã«è¡¨ç¤ºãããã®ã§éãã
- abcãªã©ã®ã¤ãã·ã£ã«ã®ãã¼ã¸ã¯ãããªãä¼æ¥æ°ãå¤ãã®ã§ããã®ã¤ããã§ããã
ãã®å¾
CrunchBase APIã使ãã°CrunchBaseã«ç»é²ããã¦ãå ¨ä¼æ¥ã®ãã´ããã¦ã³ãã¼ãããããã°ã©ã ãæ¸ãããã©ãä½ä¸ãã¡ã¤ã«ã«ãªãã®ã§ãã£ã¹ã¯å®¹éã¨ç¸è«ããªãã
ãã§èå¿ã®ä¼æ¥ãã´ã ãã©ãå½ããå¤ãããããã©ããã¾ã«æ´ç·´ããã¦ããã´ã»ç¾ãããã´ã»ããèãããã¦ãããã´ããã£ã¦åå¼·ã«ãªãã¾ãããã¨ã¯å¥½ã¿ããããã©ã
çºãã¦ããã ãã§ã楽ããã§ããã¼ã