自制灌水脚本

    做了个自动填充文本框的js脚本,必须要以.user.js为文件的结尾,安装到ff上即可,当然人家网站用的编码格式不都是UTF-8,所以,要用转码工具,把中文都转成UTF-8
转译代码如下:
public class Conversion {
    public static String chinaToUnicode(String str) {
        String result = null;
        for (int i = 0; i < str.length(); i++) {
            int chr1 = (char) str.charAt(i);
            result += "\\u" + Integer.toHexString(chr1);
        }
        return result;
    }

    public static void main(String[] args) {
        System.out.println(chinaToUnicode("继续啊等着看呢"));
    }
}

var names = new Array(10);
names[0] = "/qiang /qiang /qiang /qiang";
names[1] = ":rose: :rose:  \u8fdb\u6765\u5173\u6ce8\u4e0b";
names[2] = ":D :D  LZ\u7ee7\u7eed\u554a\u7b49\u7740\u770b\u5462";
names[3] = ":cool: :cool: :cool: :cool: :cool:";
names[4] = ":o :o:o :o  \u7559\u5370\u5148";
names[5] = ":v: :v: :v: :v: \u8fd8\u7b97\u9760\u524d";
names[6] = ":dy :dy :dy  \u8fdb\u6765\u505a\u4e2amark";
names[7] = ":D :D :D  \u4e0d\u9519\u4e0d\u9519";
names[8] = ":D :D :D :D :D";
names[9] = ":lo: :lo: :lo: :lo: :lo:";

var textFields = document.getElementsByTagName("textarea");
for (var i = 0; i < textFields.length; i++) {
    var theField = textFields[i].name;
    if (!theField) theField = textFields[i].id;
    if (theField == "message") textFields[i].value = suiji();
}

function suiji() {
    number = parseInt(Math.random() * 10);
    return names[number];
}

你可能感兴趣的:(脚本)