{"id":1214,"date":"2014-02-18T22:21:09","date_gmt":"2014-02-18T14:21:09","guid":{"rendered":"http:\/\/www.magicandlove.com\/blog\/?p=1214"},"modified":"2014-03-28T12:52:38","modified_gmt":"2014-03-28T04:52:38","slug":"javascript-test","status":"publish","type":"post","link":"http:\/\/www.magicandlove.com\/blog\/2014\/02\/18\/javascript-test\/","title":{"rendered":"JavaScript Test"},"content":{"rendered":"<p>This is a first test with JavaScript canvas in a WordPress post. There is an external script file with the following content.<br \/>\n<script src=\"http:\/\/www.magicandlove.com\/Scripts\/drawTest01.js\" type=\"text\/javascript\"><\/script><br \/>\n<!--more--><br \/>\n<canvas id=\"canvas1\" width=\"500\" height=\"400\">Here you go.<\/canvas><br \/>\n&nbsp;<\/p>\n<pre lang=\"javascript\">\r\nwindow.addEventListener(\"load\", eventWindowLoaded, false);\r\n\r\nfunction canvasApp() {\r\n\tvar theCanvas = document.getElementById(\"canvas1\");\r\n\tvar context = theCanvas.getContext(\"2d\");\r\n\t\r\n\tcontext.fillStyle = \"#ffffaa\";\r\n\tcontext.fillRect(0, 0, 500, 400);\r\n\t\r\n\tcontext.strokeStype = \"#ff0000\";\r\n\tcontext.strokeRect(10, 10, 480, 380);\r\n}\r\n\r\nfunction eventWindowLoaded() {\r\n\tcanvasApp();\r\n}\r\n<\/pre>\n<p>In the post, I need to specify the script location and the canvas tag similar to the following.<\/p>\n<pre>\r\n&lt;script src=\"http:\/\/yourwebsite.com\/Scripts\/example.js\" type=\"text\/javascript\"&gt;&lt;\/script&gt;\r\n&lt;canvas id=\"canvas1\" width=\"500\" height=\"400\"&gt;Here you go.&lt;\/canvas&gt;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This is a first test with JavaScript canvas in a WordPress post. There is an external script file with the following content.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[66],"tags":[],"class_list":["post-1214","post","type-post","status-publish","format-standard","hentry","category-testing"],"_links":{"self":[{"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/posts\/1214","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/comments?post=1214"}],"version-history":[{"count":7,"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/posts\/1214\/revisions"}],"predecessor-version":[{"id":1216,"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/posts\/1214\/revisions\/1216"}],"wp:attachment":[{"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/media?parent=1214"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/categories?post=1214"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/tags?post=1214"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}