Skip to content

Instantly share code, notes, and snippets.

@ViKingIX
Last active May 26, 2023 09:10
Show Gist options
  • Save ViKingIX/d4e9d4cffdc56bdc7912f2890abcadea to your computer and use it in GitHub Desktop.
Save ViKingIX/d4e9d4cffdc56bdc7912f2890abcadea to your computer and use it in GitHub Desktop.
javascript:(function confirmAsset($taskList_html = null) {
let taskList_url = 'personalManagement.do?action=listPersonalTask';
jQuery.ajaxSetup({async:false});
if (!$taskList_html)
$taskList_page = $(document);
else
$taskList_page = $($taskList_html);
$.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) {
confirmAsset(taskList_html)});
}, 1500);
return false;
} else {
$.get(elem.href, function(page) {
let $page = $(page);
$page.find('input[name=action]').val('confirmAsset');
$page.find('input[name=confirmed][value=0]').prop('checked', true);
data = $page.find('#asset_form').serialize();
setTimeout(function() {
$.post('asset.do', data, function (resp) {
console.log(`${$page.find('#customizedId')[0].value} finished`);
setTimeout(() => {
$.get(taskList_url, function (taskList_html) {
confirmAsset(taskList_html)});
}, 1500);
});
}, 500);
});
return false;
}
});
console.log(`finished`);
})();
@ViKingIX
Copy link
Author

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

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