{"id":3390,"date":"2020-05-04T00:11:46","date_gmt":"2020-05-03T15:11:46","guid":{"rendered":"https:\/\/okamurax.com\/?p=3390"},"modified":"2020-05-04T00:27:29","modified_gmt":"2020-05-03T15:27:29","slug":"chrome%e6%8b%a1%e5%bc%b5%e6%a9%9f%e8%83%bd-%e6%96%b0%e8%a6%8f%e3%82%bf%e3%83%96%e3%81%ab%e3%83%87%e3%83%bc%e3%82%bf%e3%82%92%e6%b8%a1%e3%81%99","status":"publish","type":"post","link":"https:\/\/appbay.org\/?p=3390","title":{"rendered":"Chrome\u62e1\u5f35\u6a5f\u80fd \u65b0\u898f\u30bf\u30d6\u306b\u30c7\u30fc\u30bf\u3092\u6e21\u3059"},"content":{"rendered":"<p>\u53f3\u30af\u30ea\u30c3\u30af\u306b\u30e1\u30cb\u30e5\u30fc\u3092\u8868\u793a\u3057\u3001\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u30a2\u30af\u30c6\u30a3\u30d6\u30bf\u30d6\u306e\u30bf\u30a4\u30c8\u30eb\u3068URL\u3092\u65b0\u3057\u3044\u30bf\u30d6(\u30ed\u30fc\u30ab\u30ebhtml)\u306b\u6e21\u3059\u30b5\u30f3\u30d7\u30eb\u3002<\/p>\n<p>\u30d5\u30a9\u30eb\u30c0\u306b\u306f\u4e0b\u8a184\u3064\u306e\u30d5\u30a1\u30a4\u30eb\u3068jquery-3.5.0.min.js\u3092\u5165\u308c\u3066\u3042\u308b\u3002<\/p>\n<p>manifest.json<\/p>\n<pre class=\"lang:default decode:true \">{\r\n\t\"manifest_version\": 2,\r\n\t\"name\": \"\u53f3\u30af\u30ea\u30c3\u30af\",\r\n\t\"description\": \"\",\r\n\t\"version\": \"1.0\",\r\n\t\"background\" : {\r\n\t\t\"scripts\" : [\"background.js\"]\r\n\t},\r\n\t\"permissions\" : [\"contextMenus\",\"tabs\",\"storage\"]\r\n}<\/pre>\n<p>background.js<\/p>\n<pre class=\"lang:js decode:true \">chrome.contextMenus.create({\r\n  \"title\" : \"Bookmark\",\r\n  \"type\"  : \"normal\",\r\n  \"contexts\" : [\"page\"],\r\n  \"onclick\" : () =&gt; {\r\n\t\tchrome.tabs.getSelected((currentTab) =&gt; {\r\n\t\t\tlet values = {\r\n\t\t\t\t'title':currentTab.title,\r\n\t\t\t\t'url':currentTab.url\r\n\t\t\t};\r\n\t\t\tchrome.storage.sync.set(values, null);\r\n\t\t\tchrome.tabs.create({url: \"test.html\"}, null);\r\n\t\t});\r\n\t}\r\n});\r\n\r\n\r\n<\/pre>\n<p>test.html<\/p>\n<pre class=\"lang:xhtml decode:true \">&lt;p id=\"msg\"&gt;&lt;\/p&gt;\r\n&lt;script src=\"jquery-3.5.0.min.js\"&gt;&lt;\/script&gt;\r\n&lt;script src=\"test.js\"&gt;&lt;\/script&gt;<\/pre>\n<p>test.js<\/p>\n<pre class=\"lang:js decode:true \">$(window).on('load',function(){\r\n  chrome.storage.sync.get(['title', 'url'], (items) =&gt; {\r\n    alert(items.title);\r\n    $(\"#msg\").text(items.url);\r\n  });\r\n});\r\n\r\n<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u53f3\u30af\u30ea\u30c3\u30af\u306b\u30e1\u30cb\u30e5\u30fc\u3092\u8868\u793a\u3057\u3001\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u30a2\u30af\u30c6\u30a3\u30d6\u30bf\u30d6\u306e\u30bf\u30a4\u30c8\u30eb\u3068URL\u3092\u65b0\u3057\u3044\u30bf\u30d6(\u30ed\u30fc\u30ab\u30ebhtml)\u306b\u6e21\u3059\u30b5\u30f3\u30d7\u30eb\u3002 \u30d5\u30a9\u30eb\u30c0\u306b\u306f\u4e0b\u8a184\u3064\u306e\u30d5\u30a1\u30a4\u30eb\u3068jquery-3.5.0.min.js\u3092\u5165\u308c\u3066\u3042\u308b\u3002 mani &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/appbay.org\/?p=3390\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;Chrome\u62e1\u5f35\u6a5f\u80fd \u65b0\u898f\u30bf\u30d6\u306b\u30c7\u30fc\u30bf\u3092\u6e21\u3059&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[91],"class_list":["post-3390","post","type-post","status-publish","format-standard","hentry","category-1","tag-chrome"],"_links":{"self":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/3390","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3390"}],"version-history":[{"count":2,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/3390\/revisions"}],"predecessor-version":[{"id":3392,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/3390\/revisions\/3392"}],"wp:attachment":[{"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3390"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3390"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3390"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}