|
| 1 | +/* |
| 2 | + ************************************************ |
| 3 | + * |
| 4 | + * 南京航空航天大学 |
| 5 | + * 2017届本科毕业生职业定位调查问卷(http://yunsi.nuaa.edu.cn/bkwj3/Index.asp) |
| 6 | + * 自动填写插件V1.0 @Javascript |
| 7 | + * |
| 8 | + * 使用方法:问卷页面F12运行,根据提示填写主观信息即可 |
| 9 | + * |
| 10 | + * 功能: 1.客观选项自动处理 |
| 11 | + * 2.主观选项统一填写 |
| 12 | + * 3.自动匹配学院 |
| 13 | + * |
| 14 | + * |
| 15 | + * 如有问题联系开发者 ↓↓↓↓ |
| 16 | + * |
| 17 | + * || Copyright ©2016 LDZ |
| 18 | + |
| 19 | + * || Github: https://github.com/fbambi |
| 20 | + * |
| 21 | + * 2016.6.15 |
| 22 | + */ |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | +(function() { |
| 27 | + var radio = document.querySelectorAll("input[msg]"), |
| 28 | + number, whichcollege, sex, major, salary, conf, |
| 29 | + l = radio.length; |
| 30 | + |
| 31 | + number = prompt("你的学号是:", "0213106").trim(); |
| 32 | + sex = prompt("你的性别是(男->1,女->0)", "1").trim(); |
| 33 | + major = prompt("你的专业是", "飞行器动力工程").trim(); |
| 34 | + salary = prompt("你的期望月薪是", "3000").trim(); |
| 35 | + email = prompt("你的邮箱是", "@nuaa.edu.cn").trim(); |
| 36 | + |
| 37 | + function isNumber(number) { |
| 38 | + number = (number.length === 9) ? number : null; |
| 39 | + if (!number) { |
| 40 | + isNumber(prompt("请输入正确的学号", "0213106").trim()); |
| 41 | + } else { |
| 42 | + document.querySelector("input[name=Options_0]").value = number; |
| 43 | + whichcollege = parseInt(number.slice(0, 2)); |
| 44 | + return; |
| 45 | + } |
| 46 | + } |
| 47 | + |
| 48 | + function isNum(clg) { |
| 49 | + clg = (clg > 12) ? clg - 2 : clg; |
| 50 | + document.querySelector("select[name=Options_2]").querySelectorAll("option[value]")[clg].selected = true; |
| 51 | + } |
| 52 | + |
| 53 | + function isSex(sex) { |
| 54 | + sex = (sex.match(/^1$/) ^ sex.match(/^0$/)) ? sex : null; |
| 55 | + if (!sex) { |
| 56 | + isSex(prompt("请重新输入性别(男->1,女->0)", "1").trim()); |
| 57 | + } else { |
| 58 | + document.querySelectorAll("input[name=Options_1]")[Math.abs(1 - sex)].selected = true; |
| 59 | + return; |
| 60 | + } |
| 61 | + } |
| 62 | + |
| 63 | + function isMajor(major) { |
| 64 | + major = (!major) ? null : major; |
| 65 | + if (!major) { |
| 66 | + isMajor(prompt("请输入专业").trim()); |
| 67 | + } else { |
| 68 | + document.querySelector("input[name=Options_3]").value = major; |
| 69 | + return; |
| 70 | + } |
| 71 | + } |
| 72 | + |
| 73 | + function isEmail(email) { |
| 74 | + email = (email.match(/^[a-zA-Z0-9_-]+@[a-zA-Z0-9]+.[a-zA-Z0-9_-]+$|^[a-zA-Z0-9_-]+@[a-zA-Z0-9]+.[a-zA-Z0-9_-]+.[a-zA-Z0-9_-]+$/)) ? email : (confirm("您输入的邮箱为" + email + ",格式不正确,要继续吗?") ? email : null); |
| 75 | + if (!email) { |
| 76 | + isEmail(prompt("请再次输入邮箱", "@nuaa.edu.cn")); |
| 77 | + } else { |
| 78 | + radio[radio.length - 1].value = email; |
| 79 | + } |
| 80 | + } |
| 81 | + |
| 82 | + isNumber(number); |
| 83 | + isNum(whichcollege); |
| 84 | + isSex(sex); |
| 85 | + isMajor(major); |
| 86 | + isEmail(email); |
| 87 | + |
| 88 | + document.querySelector("textarea[name=Options_46]").value = "没有什么建议"; |
| 89 | + document.querySelector("textarea[name=Options_47]").value = "没有什么建议"; |
| 90 | + document.querySelector("input[name=Options_18]").value = salary; |
| 91 | + document.querySelector("input[name=Options_32]").click(); |
| 92 | + |
| 93 | + for (var i = 0; i < l; i++) { |
| 94 | + if (radio[i].previousElementSibling.previousElementSibling.className === radio[i].className) { |
| 95 | + radio[i].previousElementSibling.previousElementSibling.click(); |
| 96 | + } else { |
| 97 | + radio[i].click(); |
| 98 | + } |
| 99 | + } |
| 100 | + |
| 101 | + conf = (confirm("你不想检查,现在就提交吗?")) ? document.getElementById("Submit").querySelector("input[type=submit]").click() : null; |
| 102 | + |
| 103 | +})(); |
0 commit comments