{"id":401,"date":"2015-05-16T09:08:26","date_gmt":"2015-05-16T16:08:26","guid":{"rendered":"http:\/\/alexboisvert.com\/musings\/?p=401"},"modified":"2015-05-16T09:08:26","modified_gmt":"2015-05-16T16:08:26","slug":"how-to-embed-puzzles-with-the-nexus-jpz-solver","status":"publish","type":"post","link":"https:\/\/alexboisvert.com\/musings\/2015\/05\/16\/how-to-embed-puzzles-with-the-nexus-jpz-solver\/","title":{"rendered":"How to embed puzzles with the Nexus JPZ Solver"},"content":{"rendered":"<p>So you&#8217;re aware that the <a href=\"http:\/\/www.crosswordnexus.com\/solve\" target=\"_blank\">Crossword Nexus JPZ Solver<\/a> exists, and you know it can be embedded in websites. But how can you get it into yours? It&#8217;s a fairly easy process and I&#8217;ll walk you through it right now.<br \/>\n<!--more--><br \/>\n<strong>Initial Setup<\/strong><\/p>\n<ol>\n<li style=\"text-align: left;\">First you&#8217;ll need to get the <a href=\"https:\/\/github.com\/crosswordnexus\/html5-crossword-solver\" target=\"_blank\">code from github<\/a> onto your website somehow.\u00a0 If you have SSH access you can just do a git clone: go to your web root (usually ~\/public_html) and enter the following command:\n<pre>git clone https:\/\/github.com\/crosswordnexus\/html5-crossword-solver.git html5-crossword-solver<\/pre>\n<p>If you don&#8217;t, the easiest thing to do is to <a href=\"https:\/\/github.com\/crosswordnexus\/html5-crossword-solver\/archive\/master.zip\">download the code<\/a> and then unzip it in a new directory in your web root. I&#8217;m going to assume you unzipped it in ~\/public_html\/html5-crossword-solver. The advantage of the first method is that whenever there&#8217;s an update to the code, you can just do a<\/p>\n<pre>git pull<\/pre>\n<p>command, whereas the second requires you to download and unzip the code all over again if you want to update.<\/li>\n<li style=\"text-align: left;\">You then need to add a few lines to the &lt;head&gt; of any page where you want to embed the solver:<br \/>\n<code>&lt;link href=\"\/html5-crossword-solver\/css\/crosswordnexus.css\" rel=\"stylesheet\"&gt;<br \/>\n&lt;script src=\"\/html5-crossword-solver\/js\/crosswords.js\"&gt;&lt;\/script&gt;<br \/>\n&lt;script src=\"\/html5-crossword-solver\/lib\/jquery.js\"&gt;&lt;\/script&gt;<br \/>\n&lt;script src=\"\/html5-crossword-solver\/lib\/zip\/zip.js\"&gt;&lt;\/script&gt;<br \/>\n&lt;style&gt;<br \/>\ndiv.crossword { position: relative; margin: 20px auto; width: 100%; min-width: 300px; height: 400px; text-align: center; }<br \/>\n&lt;\/style&gt;<\/code><br \/>\nYou can change the &#8220;height&#8221; (or any of the other parameters) to whatever suits you.\u00a0 NOTE: If you have a WordPress site, you make these changes under Appearance -&gt; Editor -&gt; Header.<\/li>\n<\/ol>\n<p><strong>Embedding a puzzle<\/strong><\/p>\n<p>Now that you&#8217;ve got the initial setup, it&#8217;s time to actually embed a crossword.\u00a0 Upload a JPZ file to somewhere on your website (let&#8217;s assume it&#8217;s in http:\/\/mywebsite.com\/downloads\/xw.jpz). Wherever you want to embed the crossword, add this little bit of code (replacing MY_CROSSWORD_NAME with whatever you want to call your crossword):<\/p>\n<p><code>&lt;div class=\"crossword MY_CROSSWORD_NAME\"&gt;&lt;\/div&gt;<\/code><\/p>\n<p>and then somewhere below that, add the following:<\/p>\n<p><code>&lt;script&gt;<br \/>\n(function(){<br \/>\nvar params = {<br \/>\nhover_enabled: false,<br \/>\nsettings_enabled: true,<br \/>\ncolor_selected: '#FF0000',<br \/>\ncolor_word: '#FFFF00',<br \/>\nsavegame_name: 'MY_CROSSWORD_NAME',<br \/>\npuzzle_file: {url: '\/downloads\/xw.jpz', type: 'jpz'}<br \/>\n};<br \/>\nCrosswordNexus.createCrossword($('div.MY_CROSSWORD_NAME'), params);<br \/>\n})();<br \/>\n&lt;\/script&gt;<\/code><\/p>\n<p>That&#8217;s it!  If you try it let me know.  Also, let me know if I can improve these instructions somehow.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So you&#8217;re aware that the Crossword Nexus JPZ Solver exists, and you know it can be embedded in websites. But how can you get it into yours? It&#8217;s a fairly easy process and I&#8217;ll walk you through it right now.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,5],"tags":[],"class_list":["post-401","post","type-post","status-publish","format-standard","hentry","category-coding","category-puzzles"],"_links":{"self":[{"href":"https:\/\/alexboisvert.com\/musings\/wp-json\/wp\/v2\/posts\/401","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alexboisvert.com\/musings\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alexboisvert.com\/musings\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alexboisvert.com\/musings\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/alexboisvert.com\/musings\/wp-json\/wp\/v2\/comments?post=401"}],"version-history":[{"count":1,"href":"https:\/\/alexboisvert.com\/musings\/wp-json\/wp\/v2\/posts\/401\/revisions"}],"predecessor-version":[{"id":402,"href":"https:\/\/alexboisvert.com\/musings\/wp-json\/wp\/v2\/posts\/401\/revisions\/402"}],"wp:attachment":[{"href":"https:\/\/alexboisvert.com\/musings\/wp-json\/wp\/v2\/media?parent=401"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alexboisvert.com\/musings\/wp-json\/wp\/v2\/categories?post=401"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alexboisvert.com\/musings\/wp-json\/wp\/v2\/tags?post=401"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}