{"id":882,"date":"2008-11-22T18:06:58","date_gmt":"2008-11-22T18:06:58","guid":{"rendered":"http:\/\/salguod.net\/blog\/2008\/11\/removing_ajax_from_mid-century_commenting.shtml"},"modified":"2021-05-29T02:44:46","modified_gmt":"2021-05-29T02:44:46","slug":"removing_ajax_from_mid-century_commenting","status":"publish","type":"post","link":"https:\/\/salguod.net\/blog\/2008\/11\/removing_ajax_from_mid-century_commenting.shtml","title":{"rendered":"Removing AJAX from Mid-Century Commenting"},"content":{"rendered":"<p><strong>Edit 2010-04-20<\/strong>: A year and a half after implementing Mid Century, while playing with <a href=\"http:\/\/www.majordojo.com\/\">Byrne Reese&#8217;s<\/a> Mid Century 2.0 I was having these same issues.  I let him know and he tells me that the Mid Century AJAX requires the option &#8220;Use Comment Confirmation Page&#8221; to be turned on under commenting preferences. Bingo! Now everything works.  Probably would have fixed it here too, so if you&#8217;re having commenting issues with Mid Century, try that first.<br \/>\n<strong>Edit 2008-11-26<\/strong>:  I added a download file to make it easier and clarified the instructions.<br \/>\nWhen I changed over to Mid-Century, I had some <a href=\"http:\/\/forums.movabletype.org\/2008\/11\/mid-century-commenting-weirdness.html\">goofy things happening<\/a> with commenting.  It seemed related to the AJAX that powered commenting in Mid-Century.<br \/>\nIn theory, the AJAX is pretty cool.  When a comment is posted, the entire page doesn&#8217;t get rebuilt, only the comment section.  The new comment is then highlighted in yellow, which is neat.  In practice, it didn&#8217;t work at all on my site and adding my Google Analytics code really messed it up.  I decided the AJAX magic wasn&#8217;t worth it, so I went looking for ways to de-AJAX.<br \/>\nHelp wasn&#8217;t very forthcoming from the <a href=\"http:\/\/forums.movabletype.org\/2008\/11\/de-ajax-ing-mid-century-commenting.html\">MT Forums<\/a> or <a href=\"http:\/\/www.jimramsey.net\/\">Jim Ramsey<\/a>, the developer of Mid-Century (hey, people are busy), so I did some detective work.<br \/>\nI created a test blog and loaded the Classic Blog template set to compare Mid-Century to the default templates.  I found that the two template sets to be very similar, with Mid-Century having a few more template modules and an additional javascript index template.  Of course, the template <em>content<\/em> is very different, but the template <em>listings<\/em> are similar.  The problem was in the &#8216;Comments&#8217; template module.<br \/>\nI loaded each into <a href=\"http:\/\/www.editpadpro.com\/\">EditPad Pro<\/a> and hitting &#8216;compare files&#8217; I found a lot of differences.  Digging further, I found that most were due to Mid-Century using old syntax for some MT tags and Mid-Century having an &#8216;Individual Comment&#8217; module that was included into the &#8216;Comments&#8217; module.  Reconciling those differences revealed a couple additional div tags and two script tag differences.  The script tags was what I was looking for.<br \/>\nMid-Century has a long additional script tag just after the &#8216;Comment Greeting&#8217; div and before the form tag.  It&#8217;s also missing the script from the end of the Classic Blog &#8216;Comments&#8217; template, just before the closing &#8216;mt:IfCommentsAccepted&#8217; tag.  Fixing this removed the AJAX and made commenting worked as expected again.<br \/>\nWhile that worked, commenting was fine and the page loaded fine, I did notice that it generated a JavaScript error related to the &#8216;mtEntryOnUnload&#8217; function.  The JavaScript is generated by an index template named, cleverly, &#8216;JavaScript&#8217;.  After comparing the Mid-Century JavaScript template to the Classic Blog JavaScript template, I found several variations (the template is 800+ lines), at least one relating to the &#8216;mtEntryOnUnload&#8217; function.  I don&#8217;t know JavaScript, but I figured I could replace the Mid-Centurry file with the lassic Blog file and see what happens, backing up the original first.  I gave it a shot and it worked, no more JavaScript errors.<br \/>\nSo, removing AJAX is fairly easy.  I made a duplicate of my original JavaScript &#038; Comments templates in MT before I started, just in case.  Here are the changes you need to make:<\/p>\n<ol>\n<li>In your Mid-Century &#8216;Comments&#8217; template module, comment or delete the long script tag just before the form tag.<\/li>\n<li>Also in your Mid-Century &#8216;Comments&#8217; template module, add the short, 6 line script tag from the Classic Blog &#8216;Comments&#8217; template module, just before the closing &#8216;mt:IfCommentsAccepted&#8217; tag.<\/li>\n<li>Swap out the contents of the MidCentury JavaScript template for the contents of the Classic Blog JavaScript template.<\/li>\n<\/ol>\n<p>So you don&#8217;t have to create a new blog to get the Classic Blog template content, you can find the added content in <a href=\"http:\/\/www.salguod.net\/share\/2008-11-26_mid-century_template_additions.txt\">this text file<\/a>.<br \/>\nThat&#8217;s it, now your Mid-Century comment system is de-AJAX&#8217;ed.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Edit 2010-04-20: A year and a half after implementing Mid Century, while playing with Byrne Reese&#8217;s Mid Century 2.0 I was having these same issues. I let him know and<a href=\"https:\/\/salguod.net\/blog\/2008\/11\/removing_ajax_from_mid-century_commenting.shtml\" class=\"more-link\">Read More <span class=\"screen-reader-text\">Removing AJAX from Mid-Century Commenting<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.8.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Removing AJAX from Mid-Century Commenting - salguod.net<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/salguod.net\/blog\/2008\/11\/removing_ajax_from_mid-century_commenting.shtml\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Removing AJAX from Mid-Century Commenting - salguod.net\" \/>\n<meta property=\"og:description\" content=\"Edit 2010-04-20: A year and a half after implementing Mid Century, while playing with Byrne Reese&#8217;s Mid Century 2.0 I was having these same issues. I let him know andRead More Removing AJAX from Mid-Century Commenting\" \/>\n<meta property=\"og:url\" content=\"https:\/\/salguod.net\/blog\/2008\/11\/removing_ajax_from_mid-century_commenting.shtml\" \/>\n<meta property=\"og:site_name\" content=\"salguod.net\" \/>\n<meta property=\"article:published_time\" content=\"2008-11-22T18:06:58+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-05-29T02:44:46+00:00\" \/>\n<meta name=\"author\" content=\"Doug Schaefer\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@salguod\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Doug Schaefer\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/salguod.net\/blog\/2008\/11\/removing_ajax_from_mid-century_commenting.shtml\",\"url\":\"https:\/\/salguod.net\/blog\/2008\/11\/removing_ajax_from_mid-century_commenting.shtml\",\"name\":\"Removing AJAX from Mid-Century Commenting - salguod.net\",\"isPartOf\":{\"@id\":\"https:\/\/salguod.net\/blog\/#website\"},\"datePublished\":\"2008-11-22T18:06:58+00:00\",\"dateModified\":\"2021-05-29T02:44:46+00:00\",\"author\":{\"@id\":\"https:\/\/salguod.net\/blog\/#\/schema\/person\/2237e297e41300051087d8791343043f\"},\"breadcrumb\":{\"@id\":\"https:\/\/salguod.net\/blog\/2008\/11\/removing_ajax_from_mid-century_commenting.shtml#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/salguod.net\/blog\/2008\/11\/removing_ajax_from_mid-century_commenting.shtml\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/salguod.net\/blog\/2008\/11\/removing_ajax_from_mid-century_commenting.shtml#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/salguod.net\/blog\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Removing AJAX from Mid-Century Commenting\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/salguod.net\/blog\/#website\",\"url\":\"https:\/\/salguod.net\/blog\/\",\"name\":\"salguod.net\",\"description\":\"Stuff I Think Up\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/salguod.net\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/salguod.net\/blog\/#\/schema\/person\/2237e297e41300051087d8791343043f\",\"name\":\"Doug Schaefer\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/salguod.net\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d8dde291ac4514740353f4bb9cbd9418?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d8dde291ac4514740353f4bb9cbd9418?s=96&d=mm&r=g\",\"caption\":\"Doug Schaefer\"},\"sameAs\":[\"http:\/\/salguod.net\",\"https:\/\/twitter.com\/salguod\"],\"url\":\"https:\/\/salguod.net\/blog\/author\/salguod\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Removing AJAX from Mid-Century Commenting - salguod.net","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/salguod.net\/blog\/2008\/11\/removing_ajax_from_mid-century_commenting.shtml","og_locale":"en_US","og_type":"article","og_title":"Removing AJAX from Mid-Century Commenting - salguod.net","og_description":"Edit 2010-04-20: A year and a half after implementing Mid Century, while playing with Byrne Reese&#8217;s Mid Century 2.0 I was having these same issues. I let him know andRead More Removing AJAX from Mid-Century Commenting","og_url":"https:\/\/salguod.net\/blog\/2008\/11\/removing_ajax_from_mid-century_commenting.shtml","og_site_name":"salguod.net","article_published_time":"2008-11-22T18:06:58+00:00","article_modified_time":"2021-05-29T02:44:46+00:00","author":"Doug Schaefer","twitter_card":"summary_large_image","twitter_creator":"@salguod","twitter_misc":{"Written by":"Doug Schaefer","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/salguod.net\/blog\/2008\/11\/removing_ajax_from_mid-century_commenting.shtml","url":"https:\/\/salguod.net\/blog\/2008\/11\/removing_ajax_from_mid-century_commenting.shtml","name":"Removing AJAX from Mid-Century Commenting - salguod.net","isPartOf":{"@id":"https:\/\/salguod.net\/blog\/#website"},"datePublished":"2008-11-22T18:06:58+00:00","dateModified":"2021-05-29T02:44:46+00:00","author":{"@id":"https:\/\/salguod.net\/blog\/#\/schema\/person\/2237e297e41300051087d8791343043f"},"breadcrumb":{"@id":"https:\/\/salguod.net\/blog\/2008\/11\/removing_ajax_from_mid-century_commenting.shtml#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/salguod.net\/blog\/2008\/11\/removing_ajax_from_mid-century_commenting.shtml"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/salguod.net\/blog\/2008\/11\/removing_ajax_from_mid-century_commenting.shtml#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/salguod.net\/blog"},{"@type":"ListItem","position":2,"name":"Removing AJAX from Mid-Century Commenting"}]},{"@type":"WebSite","@id":"https:\/\/salguod.net\/blog\/#website","url":"https:\/\/salguod.net\/blog\/","name":"salguod.net","description":"Stuff I Think Up","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/salguod.net\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/salguod.net\/blog\/#\/schema\/person\/2237e297e41300051087d8791343043f","name":"Doug Schaefer","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/salguod.net\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d8dde291ac4514740353f4bb9cbd9418?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d8dde291ac4514740353f4bb9cbd9418?s=96&d=mm&r=g","caption":"Doug Schaefer"},"sameAs":["http:\/\/salguod.net","https:\/\/twitter.com\/salguod"],"url":"https:\/\/salguod.net\/blog\/author\/salguod"}]}},"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":881,"url":"https:\/\/salguod.net\/blog\/2008\/11\/comments_fixed_and_more.shtml","url_meta":{"origin":882,"position":0},"title":"Comments Fixed and More","author":"Doug Schaefer","date":"November 22, 2008","format":false,"excerpt":"OK, after some template detective work, I think I figured out how to strip the AJAX magic that wasn't so magical from the templates. Comments should be back to normal, but please let me know if things still aren't working for you. Also, you may have noticed that I changed\u2026","rel":"","context":"In &quot;Salguod.net stuff&quot;","block_context":{"text":"Salguod.net stuff","link":"https:\/\/salguod.net\/blog\/salguod-net-stuff"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":884,"url":"https:\/\/salguod.net\/blog\/2008\/12\/mid_century_banner_tweaks.shtml","url_meta":{"origin":882,"position":1},"title":"Mid Century Banner Tweaks","author":"Doug Schaefer","date":"December 2, 2008","format":false,"excerpt":"Phase one of the tweaks to the Mid Century Template Set. Added a banner image, moved the nav bar down to make room, added the blog description, shifted the search and feed links to the nav bar, shifted the nav links to the left and changed the Home link to\u2026","rel":"","context":"In &quot;Salguod.net stuff&quot;","block_context":{"text":"Salguod.net stuff","link":"https:\/\/salguod.net\/blog\/salguod-net-stuff"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":866,"url":"https:\/\/salguod.net\/blog\/2008\/11\/ta-da.shtml","url_meta":{"origin":882,"position":2},"title":"Ta-Da! [Redux]","author":"Doug Schaefer","date":"November 1, 2008","format":false,"excerpt":"Welcome to the refreshed salguod.net, again. After doing a little digging, I'm trying again with the new template set. I found a way to work around the change in URLs, more on that later. Comments are still broken, but I'll work on that soon, but maybe not until Monday. They're\u2026","rel":"","context":"In &quot;Salguod.net stuff&quot;","block_context":{"text":"Salguod.net stuff","link":"https:\/\/salguod.net\/blog\/salguod-net-stuff"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":293,"url":"https:\/\/salguod.net\/blog\/2005\/03\/salguod_quickta.shtml","url_meta":{"origin":882,"position":3},"title":"Salguod QuickTags with Preview 0.1","author":"Doug Schaefer","date":"March 28, 2005","format":false,"excerpt":"I've implemented an upgrade to my commenting form that I've been working on. It starts with the Quicktags I first saw at Arvid's Movalog site. He tweaked Alex King's JavaScript Quick Tags that I guess are built into Wordpress. I took Alex's files and hacked my way through them until\u2026","rel":"","context":"In &quot;Salguod.net stuff&quot;","block_context":{"text":"Salguod.net stuff","link":"https:\/\/salguod.net\/blog\/salguod-net-stuff"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":203,"url":"https:\/\/salguod.net\/blog\/2004\/09\/why_blog.shtml","url_meta":{"origin":882,"position":4},"title":"Why blog?","author":"Doug Schaefer","date":"September 27, 2004","format":false,"excerpt":"While I'm on the subject of not writing much, I'd like to comment on the purpose of blogging. I do this blog mainly because writing brings clarity to my thoughts. There's just something about putting words to the page that helps to crystallize things. I can't explain it, it just\u2026","rel":"","context":"In &quot;Salguod.net stuff&quot;","block_context":{"text":"Salguod.net stuff","link":"https:\/\/salguod.net\/blog\/salguod-net-stuff"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":978,"url":"https:\/\/salguod.net\/blog\/2009\/10\/maybe_restoration_wasnt_what_was_needed.shtml","url_meta":{"origin":882,"position":5},"title":"Maybe Restoration Wasn&#8217;t What Was Needed","author":"Doug Schaefer","date":"October 2, 2009","format":false,"excerpt":"Keith Brenton asks if maybe the good hearted men who began the Restoration Movement (of which my church has it's roots) didn't perhaps start off in the wrong direction in the first place. The whole Restoration exercise has made us church-centered instead of Christ-centered. We preach church instead of Christ.\u2026","rel":"","context":"In &quot;BlogWalking&quot;","block_context":{"text":"BlogWalking","link":"https:\/\/salguod.net\/blog\/blogwalking"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/salguod.net\/blog\/wp-json\/wp\/v2\/posts\/882"}],"collection":[{"href":"https:\/\/salguod.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/salguod.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/salguod.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/salguod.net\/blog\/wp-json\/wp\/v2\/comments?post=882"}],"version-history":[{"count":1,"href":"https:\/\/salguod.net\/blog\/wp-json\/wp\/v2\/posts\/882\/revisions"}],"predecessor-version":[{"id":1399,"href":"https:\/\/salguod.net\/blog\/wp-json\/wp\/v2\/posts\/882\/revisions\/1399"}],"wp:attachment":[{"href":"https:\/\/salguod.net\/blog\/wp-json\/wp\/v2\/media?parent=882"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/salguod.net\/blog\/wp-json\/wp\/v2\/categories?post=882"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/salguod.net\/blog\/wp-json\/wp\/v2\/tags?post=882"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}