{"id":926,"date":"2013-02-01T04:28:11","date_gmt":"2013-01-31T19:28:11","guid":{"rendered":"http:\/\/appsweets.net\/blog\/?p=926"},"modified":"2013-02-01T04:28:11","modified_gmt":"2013-01-31T19:28:11","slug":"scripting-5","status":"publish","type":"post","link":"https:\/\/appsweets.net\/blog\/2013\/02\/01\/scripting-5\/","title":{"rendered":"Scripting #5"},"content":{"rendered":"<div class=\"db9cc8cdb64025d13c1cc9dad0a0e262\" data-index=\"1\" style=\"float: left; margin: 16px 16px 16px 0;\">\n<script type=\"text\/javascript\"><!--\r\ngoogle_ad_client = \"ca-pub-5825700137064158\";\r\n\/* 250sq, appsweets-blog *\/\r\ngoogle_ad_slot = \"4837931762\";\r\ngoogle_ad_width = 250;\r\ngoogle_ad_height = 250;\r\n\/\/-->\r\n<\/script>\r\n<script type=\"text\/javascript\"\r\nsrc=\"http:\/\/pagead2.googlesyndication.com\/pagead\/show_ads.js\">\r\n<\/script>\n<\/div>\n<p>\u7279\u306b Chrome \u306b\u5bfe\u3057\u3066\u91cd\u8981\u306a\u5909\u66f4\u3092\u65bd\u3057\u305f\u3002<\/p>\n<p>wasavi \u304c\u5c5e\u3059\u308b\u6587\u66f8\u3068\u30b9\u30af\u30ea\u30d7\u30c8\u30d5\u30ec\u30fc\u30e0\u304c\u5c5e\u3059\u308b\u6587\u66f8\u306f\u3001\u540c\u4e00\u306e\u30aa\u30ea\u30b8\u30f3\u3067\u3042\u308b\u5fc5\u8981\u304c\u3042\u308b\u3002\u3053\u308c\u306f\u3001wasavi \u5074\u304b\u3089 scriptframe.contentWindow.dispatchEvent(ev) \u3068\u3057\u305f\u308a\u3001\u3042\u308b\u3044\u306f\u9006\u306b\u30b9\u30af\u30ea\u30d7\u30c8\u30d5\u30ec\u30fc\u30e0\u5074\u304b\u3089 window.parent.dispatchEvent(ev); \u3068\u3059\u308b\u305f\u3081\u3060\u3002\u540c\u4e00\u30aa\u30ea\u30b8\u30f3\u3058\u3083\u306a\u3044\u3068 dispatchEvent() \u306f\u62d2\u5426\u3055\u308c\u308b\u3002dispatchEvent() \u3092\u7528\u3044\u308b\u306e\u306f\u3001\u305d\u308c\u304c\u540c\u671f\u7684\u306b\u5b9f\u884c\u3055\u308c\u308b\u304b\u3089\u3067\u3001postMessage() \u3092\u4f7f\u3046\u3068\u3044\u308d\u3044\u308d\u3068\u8a71\u304c\u3084\u3084\u3053\u3057\u304f\u306a\u308b\u3002<\/p>\n<p>\u3068\u3053\u308d\u3067 Chrome \u3067\u306f\u3001wasavi \u304c\u5c5e\u3059\u308b\u6587\u66f8\u306f\u30a8\u30af\u30b9\u30c6\u30f3\u30b7\u30e7\u30f3\u5185\u306e\u3082\u306e\u306b\u3057\u3066\u3044\u305f\u3002\u3064\u307e\u308a chrome-extension:\/\/\u306a\u3093\u3061\u3083\u3089\u3001\u3068\u3044\u3046 URL \u306e\u6587\u66f8\u3002\u3068\u3053\u308d\u304c\u3001\u3053\u306e URL \u306b\u5c5e\u3059\u308b\u6587\u66f8\u306b\u4ed8\u968f\u3059\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u306f content script \u3068\u540c\u3058\u6271\u3044\u306b\u306a\u308b\u306e\u3060\u3063\u305f\u3002\u3053\u306e\u74b0\u5883\u3067\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u52d5\u304b\u3059\u306b\u306f\u3001\u6a29\u9650\u304c\u9ad8\u3059\u304e\u308b\u3002<\/p>\n<p>Opera \u3084 Firefox(Add-on SDK) \u3067\u306f\u3001\u30a8\u30af\u30b9\u30c6\u30f3\u30b7\u30e7\u30f3\u5185\u306e\u6587\u66f8\u3092\u901a\u5e38\u306e\u30da\u30fc\u30b8\u306e iframe \u306e\u5185\u5bb9\u3068\u3057\u3066\u8868\u793a\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u306a\u3044\uff08Firefox \u3067\u306f\u306a\u306b\u304b\u65b9\u6cd5\u306f\u3042\u308b\u3068\u601d\u3046\u304c\u8abf\u3079\u3066\u306a\u3044\uff09\u306e\u3067\u3001appsweets.net \u4e0a\u306e\u6587\u66f8\u3092\u53c2\u7167\u3057\u3066\u3044\u308b\u3002\u3053\u308c\u306a\u3089\u3001\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u52d5\u304b\u3059\u969b\u306b\u4e00\u822c\u306e web \u30da\u30fc\u30b8\u306e\u6a29\u9650\u304c\u9069\u7528\u3055\u308c\u308b\u3002<\/p>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001Chrome \u3067\u3082\u305d\u306e\u6d41\u5100\u306b\u5f93\u3046\u3088\u3046\u306b\u3057\u305f\u3002\u3053\u308c\u306f manifest \u306e\u5909\u66f4\u3092\u610f\u5473\u3059\u308b\u3002\u305f\u3060\u3057\u3088\u308a\u5f37\u3044\u6a29\u9650\u3092\u8981\u6c42\u3059\u308b\u306e\u3067\u306f\u306a\u304f\u305d\u306e\u9006\u3067\u3001web_accessible_resources \u304c\u4e0d\u8981\u306b\u306a\u308b\u3002\u3057\u304b\u3057\u4e00\u65b9\u3067\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u30e1\u30cb\u30e5\u30fc\u306e\u305f\u3081\u306b permissions \u306b contextMenus \u3092\u8ffd\u52a0\u3057\u305f\u306e\u3067\u3001\u6b21\u306e\u30ea\u30ea\u30fc\u30b9\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u969b\u306b\u306f\u306a\u306b\u304c\u3057\u304b\u306e\u30c0\u30a4\u30a2\u30ed\u30b0\u306f\u51fa\u308b\u306f\u305a\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b Chrome \u306e\u4e0d\u601d\u8b70\u306a\u7279\u6027\u3068\u3057\u3066\u3001\u30b3\u30f3\u30c6\u30f3\u30c8\u30b9\u30af\u30ea\u30d7\u30c8\u304b\u3089\u3001\u30b3\u30f3\u30c6\u30f3\u30c8\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u5f71\u97ff\u4e0b\u306b\u306a\u3044\u7d20\u306e Window \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u306a\u3044\u3002\u3064\u307e\u308a scriptframe.contentWindow \u3092\u89e6\u308c\u306a\u3044\u3002\u305d\u3046\u3044\u3046\u308f\u3051\u306a\u306e\u3067\u3001wasavi \u5074\u306e\u6587\u66f8\u3067 script \u8981\u7d20\u3092\u751f\u6210\u3057\u3001\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092 text \u5c5e\u6027\u306b\u7a81\u3063\u8fbc\u3080:<\/p>\n<p><code lang=\"javascript\"><br \/>\ndocument.addEventListener('WasaviScriptRequest', function (e) {<br \/>\n\tvar ev = document.createEvent('CustomEvent');<br \/>\n\tev.initCustomEvent('WasaviScriptRequest', false, false, e.detail);<br \/>\n\tdocument.getElementById('wasavi_script').contentWindow.dispatchEvent(ev);<br \/>\n}, false);<br \/>\n<\/code><\/p>\n<p>\u3067\u3001wasavi \u5074\u304b\u3089\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u547c\u3073\u51fa\u3059\u969b\u306f\u81ea\u3089\u306e\u6587\u66f8\u306b\u5bfe\u3057\u3066\u30a4\u30d9\u30f3\u30c8\u8d77\u3053\u3059:<\/p>\n<p><code lang=\"javascript\"><br \/>\nvar ev = document.createEvent('CustomEvent');<br \/>\nev.initCustomEvent('WasaviScriptRequest', false, false, {code:\"console.log('hello, world')\"});<br \/>\ndocument.dispatchEvent(ev);<br \/>\n<\/code><\/p>\n<div class=\"db9cc8cdb64025d13c1cc9dad0a0e262\" data-index=\"1\" style=\"float: left; margin: 16px 16px 16px 0;\">\n<script type=\"text\/javascript\"><!--\r\ngoogle_ad_client = \"ca-pub-5825700137064158\";\r\n\/* 250sq, appsweets-blog *\/\r\ngoogle_ad_slot = \"4837931762\";\r\ngoogle_ad_width = 250;\r\ngoogle_ad_height = 250;\r\n\/\/-->\r\n<\/script>\r\n<script type=\"text\/javascript\"\r\nsrc=\"http:\/\/pagead2.googlesyndication.com\/pagead\/show_ads.js\">\r\n<\/script>\n<\/div>\n\n<div style=\"font-size: 0px; height: 0px; line-height: 0px; margin: 0; padding: 0; clear: both;\"><\/div>","protected":false},"excerpt":{"rendered":"<p>\u7279\u306b Chrome \u306b\u5bfe\u3057\u3066\u91cd\u8981\u306a\u5909\u66f4\u3092\u65bd\u3057\u305f\u3002 wasavi \u304c\u5c5e\u3059\u308b\u6587\u66f8\u3068\u30b9\u30af\u30ea\u30d7\u30c8\u30d5\u30ec\u30fc\u30e0\u304c\u5c5e\u3059\u308b\u6587\u66f8\u306f\u3001\u540c\u4e00\u306e\u30aa\u30ea\u30b8\u30f3\u3067\u3042\u308b\u5fc5\u8981\u304c\u3042\u308b\u3002\u3053\u308c\u306f\u3001wasavi \u5074\u304b\u3089 scriptframe.contentWindow.dispatchEvent(ev) \u3068\u3057\u305f\u308a\u3001\u3042\u308b\u3044\u306f\u9006\u306b\u30b9\u30af\u30ea\u30d7\u30c8\u30d5\u30ec\u30fc\u30e0\u5074\u304b\u3089 window.parent.dispatchEvent(ev); \u3068\u3059\u308b\u305f\u3081\u3060\u3002\u540c\u4e00\u30aa\u30ea\u30b8\u30f3\u3058\u3083\u306a\u3044\u3068 dispatchEvent() \u306f\u62d2\u5426\u3055\u308c\u308b\u3002dispatchEvent() \u3092\u7528\u3044\u308b\u306e\u306f\u3001\u305d\u308c\u304c\u540c\u671f\u7684\u306b\u5b9f\u884c\u3055\u308c\u308b\u304b\u3089\u3067\u3001postMessage() \u3092\u4f7f\u3046\u3068\u3044\u308d\u3044\u308d\u3068\u8a71\u304c\u3084\u3084\u3053\u3057\u304f\u306a\u308b\u3002 \u3068\u3053\u308d\u3067 Chrome \u3067\u306f\u3001wasavi \u304c\u5c5e\u3059\u308b\u6587\u66f8\u306f\u30a8\u30af\u30b9\u30c6\u30f3\u30b7\u30e7\u30f3\u5185\u306e\u3082\u306e\u306b\u3057\u3066\u3044\u305f\u3002\u3064\u307e\u308a chrome-extension:\/\/\u306a\u3093\u3061\u3083\u3089\u3001\u3068\u3044\u3046 URL \u306e\u6587\u66f8\u3002\u3068\u3053\u308d\u304c\u3001\u3053\u306e URL \u306b\u5c5e\u3059\u308b\u6587\u66f8\u306b\u4ed8\u968f\u3059\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u306f content script \u3068\u540c\u3058\u6271\u3044\u306b\u306a\u308b\u306e\u3060\u3063\u305f\u3002\u3053\u306e\u74b0\u5883\u3067\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u52d5\u304b\u3059\u306b\u306f\u3001\u6a29\u9650\u304c\u9ad8\u3059\u304e\u308b\u3002 Opera \u3084 Firefox(Add-on SDK) \u3067\u306f\u3001\u30a8\u30af\u30b9\u30c6\u30f3\u30b7\u30e7\u30f3\u5185\u306e\u6587\u66f8\u3092\u901a\u5e38\u306e\u30da\u30fc\u30b8\u306e iframe \u306e\u5185\u5bb9\u3068\u3057\u3066\u8868\u793a\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u306a\u3044\uff08Firefox \u3067\u306f\u306a\u306b\u304b\u65b9\u6cd5\u306f\u3042\u308b\u3068\u601d\u3046\u304c\u8abf\u3079\u3066\u306a\u3044\uff09\u306e\u3067\u3001appsweets.net \u4e0a\u306e\u6587\u66f8\u3092\u53c2\u7167\u3057\u3066\u3044\u308b\u3002\u3053\u308c\u306a\u3089\u3001\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u52d5\u304b\u3059\u969b\u306b\u4e00\u822c\u306e web \u30da\u30fc\u30b8\u306e\u6a29\u9650\u304c\u9069\u7528\u3055\u308c\u308b\u3002 \u3068\u3044\u3046\u3053\u3068\u3067\u3001Chrome \u3067\u3082\u305d\u306e\u6d41\u5100\u306b\u5f93\u3046\u3088\u3046\u306b\u3057\u305f\u3002\u3053\u308c\u306f manifest &hellip; <a href=\"https:\/\/appsweets.net\/blog\/2013\/02\/01\/scripting-5\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[5,3,4],"class_list":["post-926","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-javascript","tag-vi","tag-wasavi"],"_links":{"self":[{"href":"https:\/\/appsweets.net\/blog\/wp-json\/wp\/v2\/posts\/926","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/appsweets.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/appsweets.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/appsweets.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/appsweets.net\/blog\/wp-json\/wp\/v2\/comments?post=926"}],"version-history":[{"count":2,"href":"https:\/\/appsweets.net\/blog\/wp-json\/wp\/v2\/posts\/926\/revisions"}],"predecessor-version":[{"id":928,"href":"https:\/\/appsweets.net\/blog\/wp-json\/wp\/v2\/posts\/926\/revisions\/928"}],"wp:attachment":[{"href":"https:\/\/appsweets.net\/blog\/wp-json\/wp\/v2\/media?parent=926"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/appsweets.net\/blog\/wp-json\/wp\/v2\/categories?post=926"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/appsweets.net\/blog\/wp-json\/wp\/v2\/tags?post=926"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}