使用浏览器书签实现博客网站留言评论时一键填写昵称/邮箱/网址

具体的使用方法:

  1. 将本页添加到收藏夹保存为书签;
  2. 右键刚刚创建的书签,选择“编辑”或“属性”;
  3. 将“名称”一栏改为“一键填写留言评论信息”(见名知意即可,名称可换成其它的),并将“网址”或“地址”或“url”一栏原有的网址链接替换成上述 javascript 代码(代码里面的相关个人信息改为自己的哦~~),确定即可。
  4. 以后遇到留言评论时,点一个这个书签即可自动一键填写个人信息!


javascript: void
function() {
    var lauthor = ["#author","input[name='comname']","#inpName","input[name='author']","#ds-dialog-name","#name","input[name='nick']","#comment_author"],
	lmail =["#mail","#email","input[name='commail']","#inpEmail","input[name='email']","#ds-dialog-email","input[name='mail']","#comment_email"],
	lurl =["#url","input[name='comurl']","#inpHomePage","#ds-dialog-url","input[name='url']","input[name='website']","#website","input[name='link']","#comment_url"];
    for (i = 0; i < lauthor.length; i++) {
        var author = document.querySelector(lauthor[i]);
        if (author != null) {
            author.value = '你的昵称';
            author.dispatchEvent(new Event('input'));
            author.dispatchEvent(new Event('change'));
            break;
        }
    }
    for (j = 0; j < lmail.length; j++) {
        var mail = document.querySelector(lmail[j]);
        if (mail != null) {
            mail.value = '你的邮箱';
            mail.dispatchEvent(new Event('input'));
            mail.dispatchEvent(new Event('change'));
            break;
        }
    }
    for (k = 0; k < lurl.length; k++) {
        var url = document.querySelector(lurl[k]);
        if (url != null) {
            url.value = '你的网址';
            url.dispatchEvent(new Event('input'));
            url.dispatchEvent(new Event('change'));
            break;
        }
    }
    return ! 1;
} ()