xxqg-helper
xxqg-helper copied to clipboard
又“徐特立”了
是否能更新一下题库。谢谢
测试了一下,只有每日答题的填空题有问题,表现为获取不到题目,其他功能正常
function getFitbQuestion() { var questionCollections = className("EditText").findOnce().parent().parent();
在function getFitbQuestion() 加一个.parent()可以获取题目, 但是填空的焦点获取方式变了,默认只有第一个blank可以编辑,所以“空格数”计算方式需要改变 可以通过indexInParent计算有几个空格思路有了,但是不会写,
function getFitbQuestion() { var questionCollections = className("EditText").findOnce().parent().parent();
在function getFitbQuestion() 加一个.parent()可以获取题目, 但是填空的焦点获取方式变了,默认只有第一个blank可以编辑,所以“空格数”计算方式需要改变 可以通过indexInParent计算有几个空格思路有了,但是不会写,
我试了试,用childCount()方法来获取子控件的数量(比实际的多1)
然后那段for循环看的有点蒙,就瞎改了一下
改完测试一下完美运行
function getFitbQuestion() {
var questionCollections = className("EditText").findOnce().parent().parent();
var questionArray = [];
var findBlank = false;
var blankCount = 0;
var blankNumStr = "";
var i = 0;
questionCollections.children().forEach(item => {
if (item.className() != "android.widget.EditText") {
if (item.text() != "") {//题目段
if (findBlank) {
blankNumStr = "|" + blankCount.toString();
questionArray.push(blankNumStr);
findBlank = false;
}
questionArray.push(item.text());
}
else {
findBlank = true;
blankCount = (className("EditText").findOnce(i).parent().childCount() - 1);
i++;
}
}
});
return questionArray;
}
函数GETFITBQUEST(){var questionCollections = className("EditText").findOnce().parent()父子关系() ; In function getFitbQuestion () plus a.Parent (), you can get the title. However, the way to get the focus of the blank is changed. The first blank can be edited by default, so the calculation of the blank number needs to be changed. You can calculate several spaces by indexInParent, but you can't write them.
I tried to use the childCount () method to get the number of child controls (1 more than the actual ones).
Then the for loop looked a bit blinded, and it changed blindly.
After testing, perfect operation.
function getFitbQuestion() { var questionCollections = className("EditText").findOnce().parent().parent(); var questionArray = []; var findBlank = false; var blankCount = 0; var blankNumStr = ""; questionCollections.children().forEach(item => { if (item.className() != "android.widget.EditText") { if (item.text() != "") {//题目段 if (findBlank) { blankNumStr = "|" + blankCount.toString(); questionArray.push(blankNumStr); findBlank = false; } questionArray.push(item.text()); } else { findBlank = true; blankCount = (className("EditText").findOnce().parent().childCount() - 1); } } }); return questionArray; }
我的理解是 "EditText"他伯伯突然长了一辈,变成他爷爷了,所以parent()后面要再加个parent() "EditText"他爸爸只允许先大老婆先进,小老婆都只能看着 老哥你用空白格数-1 为啥啊
@xiaodiaoz 因为用childCount()获取到的子控件的数量比实际的格数多一,但是我有点不明白为什么(菜)
看了一下布局,应该不能答那种双填空的题(还是菜)不过我答了半天没有找到双填空
EditText和其他空格在同一层 indexInParent值为0,而其他四个空格 classname是view. View indexInParent 依次是 1234所以要减一
function getFitbQuestion() { var questionCollections = className("EditText").findOnce().parent().parent(); 在function getFitbQuestion() 加一个.parent()可以获取题目, 但是填空的焦点获取方式变了,默认只有第一个blank可以编辑,所以“空格数”计算方式需要改变 可以通过indexInParent计算有几个空格思路有了,但是不会写,
我试了试,用childCount()方法来获取子控件的数量(比实际的多1)
然后那段for循环看的有点蒙,就瞎改了一下
改完测试一下完美运行
function getFitbQuestion() { var questionCollections = className("EditText").findOnce().parent().parent(); var questionArray = []; var findBlank = false; var blankCount = 0; var blankNumStr = ""; questionCollections.children().forEach(item => { if (item.className() != "android.widget.EditText") { if (item.text() != "") {//题目段 if (findBlank) { blankNumStr = "|" + blankCount.toString(); questionArray.push(blankNumStr); findBlank = false; } questionArray.push(item.text()); } else { findBlank = true; blankCount = (className("EditText").findOnce().parent().childCount() - 1); } } }); return questionArray; }
可以,能用
function getFitbQuestion() { var questionCollections = className("EditText").findOnce().parent().parent(); 在function getFitbQuestion() 加一个.parent()可以获取题目, 但是填空的焦点获取方式变了,默认只有第一个blank可以编辑,所以“空格数”计算方式需要改变 可以通过indexInParent计算有几个空格思路有了,但是不会写,
我试了试,用childCount()方法来获取子控件的数量(比实际的多1)
然后那段for循环看的有点蒙,就瞎改了一下
改完测试一下完美运行
function getFitbQuestion() { var questionCollections = className("EditText").findOnce().parent().parent(); var questionArray = []; var findBlank = false; var blankCount = 0; var blankNumStr = ""; questionCollections.children().forEach(item => { if (item.className() != "android.widget.EditText") { if (item.text() != "") {//题目段 if (findBlank) { blankNumStr = "|" + blankCount.toString(); questionArray.push(blankNumStr); findBlank = false; } questionArray.push(item.text()); } else { findBlank = true; blankCount = (className("EditText").findOnce().parent().childCount() - 1); } } }); return questionArray; }
太屌了,完美解决
function getFitbQuestion() { var questionCollections = className("EditText").findOnce().parent().parent(); 在function getFitbQuestion() 加一个.parent()可以获取题目, 但是填空的焦点获取方式变了,默认只有第一个blank可以编辑,所以“空格数”计算方式需要改变 可以通过indexInParent计算有几个空格思路有了,但是不会写,
我试了试,用childCount()方法来获取子控件的数量(比实际的多1)
然后那段for循环看的有点蒙,就瞎改了一下
改完测试一下完美运行
function getFitbQuestion() { var questionCollections = className("EditText").findOnce().parent().parent(); var questionArray = []; var findBlank = false; var blankCount = 0; var blankNumStr = ""; questionCollections.children().forEach(item => { if (item.className() != "android.widget.EditText") { if (item.text() != "") {//题目段 if (findBlank) { blankNumStr = "|" + blankCount.toString(); questionArray.push(blankNumStr); findBlank = false; } questionArray.push(item.text()); } else { findBlank = true; blankCount = (className("EditText").findOnce().parent().childCount() - 1); } } }); return questionArray; }
调试一天,没解决,大佬厉害,秒了徐特立
@xiaodiaoz 因为用childCount()获取到的子控件的数量比实际的格数多一,但是我有点不明白为什么(菜)
看了一下布局,应该不能答那种双填空的题(还是菜)不过我答了半天没有找到双填空
每日答题网页版可以写个JavaScript脚本吗
@xiaodiaoz 因为用childCount()获取到的子控件的数量比实际的格数多一,但是我有点不明白为什么(菜)
看了一下布局,应该不能答那种双填空的题(还是菜)不过我答了半天没有找到双填空
每日答题网页版可以写个JavaScript脚本吗
我上次瞅了一眼,找不到提示里的答案在哪
@xiaodiaoz 因为用childCount()获取到的子控件的数量比实际的格数多一,但是我有点不明白为什么(菜)
看了一下布局,应该不能答那种双填空的题(还是菜)不过我答了半天没有找到双填空
每日答题网页版可以写个JavaScript脚本吗
用python开了个头,然后发现网页版没有挑战答题,所以暂时鸽了(真的只写了一点点,获取题目都没动)
每日答题,徐特立
@xiaodiaoz 因为用childCount()获取到的子控件的数量比实际的格数多一,但是我有点不明白为什么(菜)
看了一下布局,应该不能答那种双填空的题(还是菜)不过我答了半天没有找到双填空
每日答题网页版可以写个JavaScript脚本吗
用python开了个头,然后发现网页版没有挑战答题,所以暂时鸽了(真的只写了一点点,获取题目都没动)
我找不到提示里的答案。。。 这就比较尴尬了,所以这个就放那了
@xiaodiaoz 因为用childCount()获取到的子控件的数量比实际的格数多一,但是我有点不明白为什么(菜)
看了一下布局,应该不能答那种双填空的题(还是菜)不过我答了半天没有找到双填空
每日答题网页版可以写个JavaScript脚本吗
用python开了个头,然后发现网页版没有挑战答题,所以暂时鸽了(真的只写了一点点,获取题目都没动)
我找不到提示里的答案。。。 这就比较尴尬了,所以这个就放那了
看来网页版的难度不小噢