How to Auto Complete Comment Form using Javascript?

Posted on Posted in browsers, chrome browser, javascript

The bloggers have the comment forms in their blogs, which normally require the visitors to fill in the email address, the name, the optional URL and the comment text if they want to leave a comment. Usually for the first time, you have to manually complete the same details, which could be made easy using the following method.

In Chrome Browser, you can bookmark a piece of javascript code, which allows you to auto-complete your details in the comment form for different blog systems: WordPress, Z-Blog, Typecho, and Emblog.

Be noted to modify your details (between ****s), so next time, you just need to click the bookmark, which will automatically insert your details to the comment form in the current page.

javascript:var myName="****YOUR NAME****",myEmail="****YOUR EMAIL****",myUrl="****YOUR WEBSITE****";function fillForm(r,e,m,t){if(null!=r){var n=document.querySelector(r);if(null==n)return!1}var u=document.querySelector(e);if(null==u)return!1;u.setAttribute("value",myName);var l=document.querySelector(m);if(null!=l){l.setAttribute("value",myUrl);}var o=document.querySelector(t);return null==o?!1:(o.setAttribute("value",myEmail),!0)};[function(){return fillForm("#commentform","#author","#url","#email")},function(){return fillForm("#comment_form","#author","#url","#mail")},function(){return fillForm("#frmSumbit","#inpName","#inpHomePage","#inpEmail")},function(){return fillForm("#commentform",'input[name="comname"]','input[name="comurl"]','input[name="commail"]')}].some(function(r){return r()});