Bahamut mail mark all as read

Mark all as read

  1. // ==UserScript==
  2. // @name Bahamut mail mark all as read
  3. // @namespace https://blog.maple3142.net/
  4. // @version 0.1
  5. // @description Mark all as read
  6. // @author maple3142
  7. // @match https://mailbox.gamer.com.tw/
  8. // @grant none
  9. // @compatible firefox >=52
  10. // @compatible chrome >=55
  11. // ==/UserScript==
  12.  
  13. (function($) {
  14. 'use strict'
  15. const read=sn=>Promise.resolve($.post('https://mailbox.gamer.com.tw/ajax/unreadRead.php',{sn}))
  16. $('#delFrm').before($('<button>').text('全部標記已讀').click(()=>{
  17. const $titles=$('.mailTitle')
  18. const sns=$titles.map((i,e)=>$(e).data('sn')).toArray()
  19. Promise.all(sns.map((sn,i)=>read(sn).then(()=>$($titles[i]).parent().parent().parent().remove()))).then(()=>console.log('ok'))
  20. }))
  21. })(jQuery)