Skip to content

Instantly share code, notes, and snippets.

@ViKingIX
Last active May 15, 2023 10:03
Show Gist options
  • Save ViKingIX/205696d061e6d60d18e7121cbd6749fe to your computer and use it in GitHub Desktop.
Save ViKingIX/205696d061e6d60d18e7121cbd6749fe to your computer and use it in GitHub Desktop.
(function confirmRiskItemChained($taskList_html = null) {
let taskList_url = 'personalManagement.do?action=listPersonalTask';
if (!$taskList_html)
$taskList_page = $(document);
else
$taskList_page = $($taskList_html);
if ($taskList_page.find('table#countTask1 tr td:nth-child(7) a').length == 0)
console.log('finished');
$.each($taskList_page.find('table#countTask1 tr td:nth-child(7) a'), function(i, elem) {
let task = $taskList_page.find('table#countTask1 tr td:nth-child(2)')[i].innerHTML.split(/\s+/).join(' ');
if (task == localStorage.getItem('task')) {
setTimeout(() => {
$.get(taskList_url, function (taskList_html) {
confirmRiskItemChained(taskList_html)});
}, 1500).fail(function () {
location.reload();
});
} else {
$.get(elem.href, function(page) {
let $page = $(page);
$page.find('input[name=action]').val('confirmRiskItem');
data = $page.find('#risk_form').serialize();
setTimeout(function() {
$.post('riskManagement.do', data, function (resp) {
console.log(`${$page.find('#customizedId')[0].value} finished`);
setTimeout(() => {
$.get(taskList_url, function (taskList_html) {
confirmRiskItemChained(taskList_html)
}).fail(function () {
location.reload();
});
}, 1500);
});
}, 500);
});
}
return false;
});
})();
@ViKingIX
Copy link
Author

ViKingIX commented May 15, 2023

!function t(n=null){let i="personalManagement.do?action=listPersonalTask";$taskList_page=n?$(n):$(document),0==$taskList_page.find("table#countTask1 tr td:nth-child(7) a").length&&console.log("finished"),$.each($taskList_page.find("table#countTask1 tr td:nth-child(7) a"),(function(n,e){return $taskList_page.find("table#countTask1 tr td:nth-child(2)")[n].innerHTML.split(/\s+/).join(" ")==localStorage.getItem("task")?setTimeout((()=>{$.get(i,(function(n){t(n)}))}),1500).fail((function(){location.reload()})):$.get(e.href,(function(n){let e=$(n);e.find("input[name=action]").val("confirmRiskItem"),data=e.find("#risk_form").serialize(),setTimeout((function(){$.post("riskManagement.do",data,(function(n){console.log(`${e.find("#customizedId")[0].value} finished`),setTimeout((()=>{$.get(i,(function(n){t(n)})).fail((function(){location.reload()}))}),1500)}))}),500)})),!1}))}();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment