{"id":23559,"date":"2014-07-03T09:26:49","date_gmt":"2014-07-03T14:26:49","guid":{"rendered":"http:\/\/www.shamusyoung.com\/twentysidedtale\/?p=23559"},"modified":"2014-07-06T20:52:24","modified_gmt":"2014-07-07T01:52:24","slug":"got-a-minute-can-you-help-me-with-my-website","status":"publish","type":"post","link":"https:\/\/www.shamusyoung.com\/twentysidedtale\/?p=23559","title":{"rendered":"Got a minute? Can you help me with my website?"},"content":{"rendered":"<p><strong>EDIT II:<\/strong>Thanks to Roger H&agrave;\u00a5gensen, the old system has been replaced with a new one that should fail gracefully (and not cover the screen in boxes) if Javascript fails for some reason. It also doesn&#8217;t conflict with the comment editing plugin. And it looks a little nicer. Also, each post now has its own numbering, instead of the first post having annotations 1, 2, 3 and the next post having 4, 5, 6. That was&#8230; awkward. <\/p>\n<p>So, solid improvements all around. Thanks to Roger H&agrave;\u00a5gensen for the help.<\/p>\n<p><strong>EDIT: <\/strong>It looks like the problem wasn&#8217;t the Javascript after all. I turned off the JS &#8220;minification&#8221; option and it started working for me.  However, as an admin my page loads with some extra crap<span class='snote' title='1'>An admin bar and logout buttons and such.<\/span> that might skew my results. So I&#8217;ve commented on a fresh browser window, left a comment, and annotations seem to be working.<\/p>\n<p>So we&#8217;re in a state where it works in all cases that I can test. PLEASE let me know if the annotation boxes are stuck open for you. If nobody has any further problems, I&#8217;ll call it fixed. Enough. For now.<\/p>\n<p><strong>Original post:<\/strong><\/p>\n<p>I don&#8217;t know anything about javascript. Which means I really should never use it. I mean, that&#8217;s a pretty basic rule, right? Don&#8217;t copy &#038; paste code you don&#8217;t understand. <\/p>\n<p>But the thing is this: I really, REALLY like annotations. I&#8217;m talking about the little numbers that pop up in a post<span class='snote' title='2'>Like this one, for example.<\/span>. I ran into them on the <a href=\"http:\/\/what-if.xkcd.com\/\">XKCD What-If blog<\/a>.  They&#8217;re great for expanding on a side-thought without cluttering up the main body of the article. They&#8217;re handy when writing faux-technical articles that require lots of footnotes to save me from Death By Nitpick. They&#8217;re great for jokes<span class='snote' title='3'>Since you can hide the punchline.<\/span>. <\/p>\n<p>So I swiped the footnote code from XKCD. It works fine when reading individual posts, but on the <a href=\"http:\/\/www.shamusyoung.com\/twentysidedtale\/\">front page<\/a> of my website the pop-out text isn&#8217;t properly hidden. (I have NO IDEA what it does to RSS feeds. Not too worried about that. People reading via RSS have already decided they want the words but not the formatting. That&#8217;s fine, but it makes sense to design your site for the people who actually visit the site.)<\/p>\n<p>If you read this post by itself, those annotation boxes above will work as intended: They will be hidden until you click the related footnote. If you view the exact same content on the front page, the boxes appear expanded at the outset, and clicking on the footnote does nothing. I am baffled by this problem. <\/p>\n<p>In both cases, the system is driven by this code, which is at the bottom of the HTML:<\/p>\n<pre lang=\"java\" line=\"1\">\r\n      jQuery.noConflict();\r\n      jQuery(function() {\r\n        jQuery(\".refbody\").hide();\r\n        jQuery(\".refnum\").click(function(event) {\r\n          jQuery(this.nextSibling).toggle();\r\n          event.stopPropagation();\r\n        });\r\n        jQuery(\"body\").click(function(event) {\r\n          jQuery(\".refbody\").hide();\r\n        });\r\n      });\r\n<\/pre>\n<p>I don&#8217;t want to give up annotations. Up until now I&#8217;ve hacked around the problem by disabling the annotations on the front page. That prevents the &#8220;Yellow boxes everywhere!&#8221; problem, but it&#8217;s confusing and people keep reporting this as a bug. <\/p>\n<p>I&#8217;ve consulted the Google Oracle, but finding solutions for specific problems like this is pretty difficult. And I&#8217;m not fluent in JS enough to begin to unravel this myself. (The connections between JS and HTML are non-obvious and confusing as hell.) I will say that the JS syntax is deeply alarming to a C programmer. Curly braces INSIDE of parenthesis? Madness! You&#8217;ll kill us all!<\/p>\n<p>This is normally a situation where you&#8217;d need to suck it up and ask folks at (say) <a href=\"http:\/\/stackoverflow.com\/\">Stack Overflow<\/a>. But the path of least resistance is to just ask my readers. The output is right in front of you, we have a reproducible example of the problem in action, and the source is freely available. <\/p>\n<p>For the record: The title of this post is one of the most bone-chilling phrases a friend can say to you. The irony is intentional. I am now the Dumb Friend, oblivious but well-meaning, who figures that since they don&#8217;t understand the problem, it&#8217;ll probably be easy<span class='snote' title='4'>for someone ELSE<\/span> to solve.<\/p>\n<p>Still. I&#8217;m hoping this turns out to be true, that for one person out there this is trivial to solve. Is it you?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>EDIT II:Thanks to Roger H&agrave;\u00a5gensen, the old system has been replaced with a new one that should fail gracefully (and not cover the screen in boxes) if Javascript fails for some reason. It also doesn&#8217;t conflict with the comment editing plugin. And it looks a little nicer. Also, each post now has its own numbering, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[111],"tags":[416],"class_list":["post-23559","post","type-post","status-publish","format-standard","hentry","category-notices","tag-javascript"],"_links":{"self":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/23559","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=23559"}],"version-history":[{"count":0,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/23559\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=23559"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=23559"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=23559"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}