Skip to content

Instantly share code, notes, and snippets.

@Grassboy
Last active April 29, 2016 03:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Grassboy/4ce845b9e8f2cc96aa96ce212033ec8f to your computer and use it in GitHub Desktop.
Save Grassboy/4ce845b9e8f2cc96aa96ce212033ec8f to your computer and use it in GitHub Desktop.
EMS-ODAS 公文全設為已讀 Script
/*
使用方式:
一、至 http://odaswps.cht.com.tw/Portal/Pages/WaitingDocument.aspx 頁面
二、打開 F12 的 Console 貼上這整段後按 Enter
三、如果有跳出瀏覽器防跳出新視窗的通知,請允許瀏覽器開新視窗後再重跑此 Script
已知 bug:「需副知/陳或傳閱公文」這類的公文暫時無法自動已讀,如果超過 20 篇應該就會卡住
*/
(function (win) {
setTimeout(function processPage() {
var x = $(win.document.body).find('.gv_MainBoard_body').filter(function () {
return $(this).find('.DocFlowView,.DocInfo').length == 2;
});
if (x.length == 0) {
alert('全部已讀!');
} else {
(function read(i) {
if (i >= x.length) {
win.location.reload();
setTimeout(function () {
processPage();
}, 15000);
} else {
var dom = $(x[i]);
var id1 = dom.find('.DocFlowView img').attr('onclick').match(/[\d]+/);
var id2 = dom.find('.DocInfo img').attr('onclick').match(/[\d]+/);
$.get('/Portal/PopupPages/TaskPopup/ConfirmPopup.aspx?TaskID=' + id1 + '&DocumentID=' + id2 + '&title=%E7%A2%BA%E8%AA%8D', function (r) {
read(i + 1);
});
}
}) (0);
}
}, 15000);
}) (window.open(location.href));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment