{"id":262,"date":"2016-02-12T07:08:03","date_gmt":"2016-02-11T22:08:03","guid":{"rendered":"https:\/\/blog.srytk.com\/aquei\/?p=262"},"modified":"2016-02-12T07:08:03","modified_gmt":"2016-02-11T22:08:03","slug":"js%e3%81%a7%e3%82%af%e3%83%aa%e3%83%83%e3%83%97%e3%83%9c%e3%83%bc%e3%83%89%e3%81%ab%e3%82%b3%e3%83%94%e3%83%bc%e3%81%8c%e5%87%ba%e6%9d%a5%e3%82%8b%e3%81%8b%e5%88%a4%e5%ae%9a%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/blog.srytk.com\/aquei\/262.html","title":{"rendered":"js\u3067\u30af\u30ea\u30c3\u30d7\u30dc\u30fc\u30c9\u306b\u30b3\u30d4\u30fc\u304c\u51fa\u6765\u308b\u304b\u5224\u5b9a\u3059\u308b"},"content":{"rendered":"<p>\u898f\u6a21\u306e\u5927\u5c0f\u306b\u95a2\u308f\u3089\u305a\u3001\u3069\u3093\u306a\u30a6\u30a7\u30d6\u30b5\u30a4\u30c8\u306b\u3082\u6587\u5b57\u5217\u3092\u30b3\u30d4\u30fc\u3067\u304d\u308b\u6a5f\u80fd\u304c\u3042\u308b\u3068\u4fbf\u5229\u3060\u3002\u4f8b\u3048\u3070RSS\u30d5\u30a3\u30fc\u30c9\u306eURL\u3092\u30b3\u30d4\u30fc\u3067\u304d\u308b\u30dc\u30bf\u30f3\u304c\u3042\u308c\u3070\u3001\u305d\u308c\u3060\u3051\u3067\u30b5\u30a4\u30c8\u3092\u8cfc\u8aad\u3057\u3066\u304f\u308c\u308b\u4eba\u304c\u5897\u3048\u308b\u304b\u3082\u3057\u308c\u306a\u3044\u3002\u30c1\u30e7\u30c3\u30c8\u3057\u305f\u89aa\u5207\u304c\u6020\u60f0\u306a\u30e6\u30fc\u30b6\u306b\u306f\u3042\u308a\u304c\u305f\u3044\u3082\u306e\u3060\u3002<\/p>\n<p>\u4e00\u6614\u524d\u307e\u3067\u30af\u30ea\u30c3\u30d7\u30dc\u30fc\u30c9\u306b\u30b3\u30d4\u30fc\u3059\u308b\u306b\u306fflash(<a href=\"http:\/\/zeroclipboard.org\/\">zeroclipboard<\/a>)\u3092\u4f7f\u3046\u306e\u304c\u4e00\u822c\u7684\u3060\u3063\u305f\u3002\u73fe\u5728\u3067\u306fflash\u96e2\u308c\u3068\u30d6\u30e9\u30a6\u30b6\u306e\u9032\u6b69\u306b\u3088\u3063\u3066\u3001<a href=\"https:\/\/clipboardjs.com\/\">clipboard.js<\/a>\u306a\u3069\u3092\u4f7f\u3063\u3066\u30d6\u30e9\u30a6\u30b6\u306eAPI\u304b\u3089\u30af\u30ea\u30c3\u30d7\u30dc\u30fc\u30c9\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3082\u591a\u3044\u3002\u3068\u3053\u308d\u304c\u4e00\u90e8\u306e\u30d6\u30e9\u30a6\u30b6\uff08\u3068\u3044\u3046\u304b\u4e3b\u306bsafari)\u306f\u30af\u30ea\u30c3\u30d7\u30dc\u30fc\u30c9\u306b\u30b3\u30d4\u30fc\u3059\u308b\u70ba\u306e\u4e00\u90e8API\u3092\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u306a\u3044\u305f\u3081\u3001\u30b3\u30d4\u30fc\u6a5f\u80fd\u304c\u5229\u7528\u3067\u304d\u306a\u3044\u3002<\/p>\n<p>\u30e6\u30fc\u30b6\u304c\u300c\u30b3\u30d4\u30fc\u30dc\u30bf\u30f3\u300d\u3092\u30af\u30ea\u30c3\u30af\u3057\u305f\u306e\u306b\u5b9f\u969b\u306f\u30b3\u30d4\u30fc\u3055\u308c\u3066\u306a\u3044\u3068\u3044\u3046\u306e\u306f\u8981\u3089\u306c\u6df7\u4e71\u3092\u751f\u3080\u3057\u3001\u30e6\u30fc\u30b6\u30a2\u30af\u30b7\u30e7\u30f3\u306e\u5f8c\u306b\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u8868\u793a\u3059\u308b\u3001\u3068\u3044\u3046\u306e\u3082\u6b8b\u5ff5\u306e\u4e00\u8a00\u3060\u3002\u30af\u30ea\u30c3\u30d7\u30dc\u30fc\u30c9\u306b\u30b3\u30d4\u30fc\u3067\u304d\u306a\u3044\u30d6\u30e9\u30a6\u30b6\u3092\u5229\u7528\u3057\u3066\u3044\u308b\u5834\u5408\u306f\u521d\u3081\u304b\u3089\u300c\u30b3\u30d4\u30fc\u30dc\u30bf\u30f3\u300d\u3092\u5229\u7528\u3067\u304d\u306a\u3044\u3088\u3046\u306b\u3059\u308b\u306e\u304c\u30b9\u30de\u30fc\u30c8\u306a\u8a2d\u8a08\u3060\u308d\u3046\u3002<\/p>\n<p>\u305d\u3053\u3067\u3001\u30d6\u30e9\u30a6\u30b6\u304c\u30af\u30ea\u30c3\u30d7\u30dc\u30fc\u30c9\u306b\u30b3\u30d4\u30fc\u3067\u304d\u308b\u304b\u3069\u3046\u304b\u3092\u691c\u51fa\u3059\u308b\u65b9\u6cd5\u3092\u8abf\u3079\u3066\u307f\u305f\u3002<\/p>\n<p><!--more--><\/p>\n<p>js\u304b\u3089\u30af\u30ea\u30c3\u30d7\u30dc\u30fc\u30c9\u306b\u30b3\u30d4\u30fc\u3059\u308b\u306b\u306f\u3001\u30b3\u30d4\u30fc\u3057\u305f\u3044\u6587\u5b57\u5217\u7b49\u3092\u9078\u629e\u72b6\u614b\u306b\u3057\u3001\u30d6\u30e9\u30a6\u30b6\u306e\u30b3\u30d4\u30fc\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3068\u3044\u3046\u624b\u9806\u306b\u306a\u308b\u3002\u5177\u4f53\u7684\u306b\u306f<a href=\"https:\/\/developer.mozilla.org\/ja\/docs\/Web\/API\/Document\/createRange\">document.createRange<\/a>\u306a\u3069\u304b\u3089<a href=\"https:\/\/developer.mozilla.org\/ja\/docs\/Web\/API\/range\">range<\/a>\u3092\u4f5c\u308a\u3001<a href=\"https:\/\/developer.mozilla.org\/ja\/docs\/Web\/API\/Selection\">selection<\/a>\u306brange\u3092\u8ffd\u52a0\u3001<a href=\"https:\/\/developer.mozilla.org\/ja\/docs\/Web\/API\/Document\/execCommand\">document.execCommand(&#8216;copy&#8217;)<\/a>\u3067\u9078\u629e\u90e8\u5206\u3092\u30b3\u30d4\u30fc\u3059\u308b\u3002<\/p>\n<p>\u3064\u307e\u308a\u3001\u3053\u308c\u3089\u306e\u30e1\u30bd\u30c3\u30c9\u304c\u5229\u7528\u3067\u304d\u308b\u304b\u8abf\u3079\u308c\u3070\u826f\u3055\u305d\u3046\u3060\u304c\u3001document.execCommand\u306f\u5358\u306b\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u8abf\u3079\u308b\u3060\u3051\u3067\u306f\u306a\u304f\u3066\u3001<a href=\"https:\/\/developer.mozilla.org\/ja\/docs\/Web\/API\/document\/queryCommandSupported\">document.queryCommandSupported<\/a>(&#8216;copy&#8217;)\u3067\u30b3\u30d4\u30fc\u30b3\u30de\u30f3\u30c9\u304c\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u308b\u304b\u3092\u8abf\u3079\u308b\u5fc5\u8981\u304c\u3042\u308b\u3002<\/p>\n<pre><code>if('getSelection' in window &amp;&amp;\r\n\t'createRange' in document &amp;&amp;\r\n\t'execCommand' in document &amp;&amp;\r\n\t'queryCommandSupported' in document &amp;&amp;\r\n\tdocument.queryCommandSupported('copy')){\r\n\t\/\/\u591a\u5206\u30b3\u30d4\u30fc\u3067\u304d\u308b\r\n}else{\r\n\t\/\/\u591a\u5206\u30b3\u30d4\u30fc\u51fa\u6765\u306a\u3044\uff1f\r\n}<\/code><\/pre>\n<p>\u3053\u3093\u306a\u611f\u3058\u3060\u308d\u3046\u304b\u3002<\/p>\n<p>\u3068\u3053\u308d\u3067MDN\u3092\u773a\u3081\u3066\u3044\u308b\u3068\u3001<a href=\"https:\/\/developer.mozilla.org\/ja\/docs\/Web\/API\/Document\/execCommand#Browser_Compatibility\">execCommand<\/a>\u3084<a href=\"https:\/\/developer.mozilla.org\/ja\/docs\/Web\/API\/document\/queryCommandSupported#%E3%83%96%E3%83%A9%E3%82%A6%E3%82%B6%E3%81%AE%E4%BA%92%E6%8F%9B%E6%80%A7\">queryCommandSupported<\/a>\u3001<a href=\"https:\/\/github.com\/guardian\/scribe\/blob\/master\/BROWSERINCONSISTENCIES.md\">selection\u306f\u3042\u307e\u308a\u4fe1\u7528\u3067\u304d\u306a\u3044<\/a>\u3002\u6700\u65b0\u30d0\u30fc\u30b8\u30e7\u30f3\u306e\u30d6\u30e9\u30a6\u30b6\u306a\u3089\u554f\u984c\u306a\u3044\u3088\u3046\u3060\u304c\u3001\u53e4\u3044\u3082\u306e\u3092\u4f7f\u3063\u3066\u3044\u308b\u5834\u5408\u3001\u306a\u3093\u3068\u3082\u4e0d\u5b89\u5b9a\u306a\u5370\u8c61\u3092\u3046\u3051\u308b\u3002\u306a\u3093\u3060\u304b\u306a\u3042\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u898f\u6a21\u306e\u5927\u5c0f\u306b\u95a2\u308f\u3089\u305a\u3001\u3069\u3093\u306a\u30a6\u30a7\u30d6\u30b5\u30a4\u30c8\u306b\u3082\u6587\u5b57\u5217\u3092\u30b3\u30d4\u30fc\u3067\u304d\u308b\u6a5f\u80fd\u304c\u3042\u308b\u3068\u4fbf\u5229\u3060\u3002\u4f8b\u3048\u3070RSS\u30d5\u30a3\u30fc\u30c9\u306eURL\u3092\u30b3\u30d4\u30fc\u3067\u304d\u308b\u30dc\u30bf\u30f3\u304c\u3042\u308c\u3070\u3001\u305d\u308c\u3060\u3051\u3067\u30b5\u30a4\u30c8\u3092\u8cfc\u8aad\u3057\u3066\u304f\u308c\u308b\u4eba\u304c\u5897\u3048\u308b\u304b\u3082\u3057\u308c\u306a\u3044\u3002\u30c1\u30e7\u30c3\u30c8\u3057\u305f\u89aa\u5207\u304c\u6020\u60f0 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"activitypub_content_warning":"","activitypub_content_visibility":"local","activitypub_max_image_attachments":5,"footnotes":""},"categories":[2],"tags":[],"class_list":["post-262","post","type-post","status-publish","format-standard","hentry","category-tech"],"_links":{"self":[{"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/posts\/262","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/comments?post=262"}],"version-history":[{"count":3,"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/posts\/262\/revisions"}],"predecessor-version":[{"id":266,"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/posts\/262\/revisions\/266"}],"wp:attachment":[{"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/media?parent=262"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/categories?post=262"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/tags?post=262"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}