Home > front end >  Fill in the blanks about the questionnaire star multiline text how to set up automatic fill in conte
Fill in the blanks about the questionnaire star multiline text how to set up automatic fill in conte

Time:09-17

Questionnaire address https://www.wjx.cn/jq/79564363.aspx
Multiline text box is

Currently on the Internet to find useful script cannot solve automatic input these last few fill in the blanks, attached to the script code
Copy is not complete code address: https://greasyfork.org/zh-CN/scripts/403205-%E9%97%AE%E5%8D%
//==UserScript==

//form
//- radio
//- multiple
//radio
//a multiple-choice
//the stars
//dropdown
//brace
Fill in the blanks//default is empty
//order
//picture
//@ author ZainCheung
//@ include https://www.wjx.cn/jq/*. Aspx
//@ include https://www.wjx.cn/wjx/join/complete.aspx *
//@ grant none
//@ namespace http://tampermonkey.net/
//==/UserScript==

(function () {
'use strict;

//configure the answer to fill in the blanks, if not configured, the default fill without
Var config=[
{
Id: 2,
Answer: "so-and-so vocational and technical college 2017", "so-and-so vocational and technical college 2019"]//randomly selected an answer
},
{
Id: 9,
Answer: "no")
},
{
Id: 13,
Answer: "no", "no", "no", "no", "no", "no", "no"]
}
];



//the answer over, open a new questionnaire
(function openNew () {
Var currentURL=window. The location. Href;
Var pat=/complete \. Aspx \? Q=(\ d +)/;
Var obj=pat. The exec (currentURL);
If (obj) {
Window. The location. Href="https://www.wjx.cn/jq/" + obj + [1] ". Aspx ";
} else {
The console. The log (" not "pat, obj);
}
}) ();


Var currentURL=window. The location. Href;
//automatically converted into computer web version
(function redirect () {
Try {
Var=/pat (HTTPS: \ \/WWW \. WJX \. Cn \/) (jq | m)/g (. *);
Var obj=pat. The exec (currentURL);
If (obj [2]=="m") {
The console. The log (" redirect now ");
Window. The location. [1] + href=https://bbs.csdn.net/topics/obj "jq + obj" [3].
} else {
The console. The log (" do!" );
}
} the catch (error) {}
}) ();


/* *
*
*
* @ param {int} min The minimum value in The range
* @ param {int} Max The maxmum value in The range
* @ return {int} return Returns a random number within this range (both include)
*/
The function randint (min and Max) {
Return Math. Floor (Math. The random () * (Max - min + 1) + min);
}

The function getRandomArrayElements (arr, count) {
Var shuffled=arr. Slice (0), I=arr. Length, min=I - count, temp, index;
While (I - & gt; Min) {
Index=Math. Floor ((I + 1) * Math in the random ());
Temp=shuffled [index];
Shuffled [index]=shuffled [I];
Shuffled [I]=temp;
}
Return shuffled. Slice (min);
}


/* *
* @ the description the function used to automatically select
*/
The function RandomChoose () {
/* *
* @ name ordinary single topic randomly choose
* @ param {object} subject single subject
*/
Enclosing singleChoose=function (a subject) {
If (subject. QuerySelectorAll (" img ") [0]) {//with a picture, not directly click tag & lt; Li>
Var img=subject. QuerySelectorAll (" img ");
Img [randint (0, img. Length - 1)], click ();
} else {
Var list=subject. QuerySelectorAll (" li ");
Var no;
for(var i=0; I & lt; List. Length; I++) {
If (a list [I] querySelector (" underline ")!=null) {
No=I;
}
}
Var index=randint (0, the list. The length - 1);
While (index==no) {index=randint (0, the list. The length - 1); }
The list [index]. Click ();

}
}

/* * * *
* @ name common multiple choice random
* @ param {object} subject single subject
*
*/
Enclosing multiChoose=function (a subject) {
Var list=subject. QuerySelectorAll (" li ");
Var arr=new Array ();
For (var I=0; I & lt; List. Length; I++) {
If (a list [I] querySelectorAll (" input ") [0]. Checked==true) {
The list [I]. Click ();
}
Arr. Push (the list [I]);
}
Var times=randint (3, arr. Length - 1);//multiple choice choose the number, is generally not less than 3
Var indexAry=getRandomArrayElements (arr, times);//to the selected item
Var no;//prohibited items
For (var j=0; J & lt; IndexAry. Length; J++) {
If (indexAry [j]. Journal of querySelector (" underline ")!=null) {//remove item need to fill in the blanks in the boxes,
The console. The log (indexAry [j]);
No=j;
}
}
for (i=0; I & lt; IndexAry. Length; I++) {
If (indexAry [I] querySelectorAll (" input ") [0]. Checked==false & amp; & (I!=no)) {
IndexAry [I]. Click ();
}
}
//for (I=0; I & lt; Times; I++) {
//var randomChoose=arr. Splice (randint (0, arr. Length - 1), 1) [0].
//if (randomChoose querySelectorAll (" input ") [0]. Checked==false) {
//randomChoose. Click ();
//}
//}
}



//random sort topic
Enclosing randomSort=function (a subject) {
Var list=subject. QuerySelectorAll (" li ");
Var arr=new Array ();
For (var I=0; I & lt; List. Length; I++) {
The list [I] querySelectorAll (" input ") [0]. Checked=false;
The list [I] querySelectorAll (" span ") [0]. ClassList. Remove (" sortnum - sel ");//in fact this is just a style, the real choice is checkd=true | | false
Arr. Push (the list [I]);
}
for (i=0; I & lt; List. Length; I++) {
Var randomChoose=arr. Splice (randint (0, arr. Length - 1), 1) [0].
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related