GMX standalone view

Set option to open email in standalone window (gmx / web.de)

目前为 2020-05-24 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name GMX standalone view
  3. // @name:de GMX Standalone-Ansicht
  4. // @name:fr GMX email - fenêtre séparée
  5. // @namespace https://github.com/Procyon-b
  6. // @version 0.5.1
  7. // @description Set option to open email in standalone window (gmx / web.de)
  8. // @description:de Stellen Sie die Option so ein, dass E-Mails im eigenständigen Fenster geöffnet werden (gmx / web.de)
  9. // @description:fr Réactiver l'ouverture des emails dans une fenêtre popup (gmx / web.de)
  10. // @author Achernar
  11. // @match https://3c.gmx.net/mail/client/home*
  12. // @match https://3c.gmx.net/mail/client/folder*
  13. // @match https://3c.gmx.net/mail/client/search*
  14. // @match https://3c-bap.gmx.net/mail/client/home*
  15. // @match https://3c-bap.gmx.net/mail/client/folder*
  16. // @match https://3c-bap.gmx.net/mail/client/search*
  17. // @include https://3c-bs.gmx.tld/mail/client/home*
  18. // @include https://3c-bs.gmx.tld/mail/client/folder*
  19. // @include https://3c-bs.gmx.tld/mail/client/search*
  20. // @match https://3c.web.de/mail/client/home*
  21. // @match https://3c.web.de/mail/client/folder*
  22. // @match https://3c.web.de/mail/client/search*
  23. // @match https://3c-bap.web.de/mail/client/home*
  24. // @match https://3c-bap.web.de/mail/client/folder*
  25. // @match https://3c-bap.web.de/mail/client/search*
  26. // @run-at document-body
  27. // @grant GM_setValue
  28. // @grant GM_getValue
  29. // ==/UserScript==
  30.  
  31. (function() {
  32. "use strict";
  33.  
  34. const maxRetry=40;
  35. var e, r, retry=maxRetry;
  36.  
  37. function toggle(ev) {
  38. if (!e) return;
  39. var v=(typeof ev == 'object')? !phx.vars.enableStandaloneView : ev;
  40. e.checked=v;
  41. phx.vars.enableStandaloneView=v;
  42. try{
  43. GM_setValue('option', v);
  44. }catch(er){
  45. window.sessionStorage._popup_=v;
  46. }
  47. }
  48.  
  49.  
  50. function addChk() {
  51. if (!(r=document.querySelector('.widget.menubar .button-container.left'))) {
  52. if (retry--) {
  53. setTimeout(addChk,10);
  54. }
  55. return;
  56. }
  57. retry=maxRetry;
  58. e=document.createElement('input');
  59. e.type='checkbox';
  60. e.id='standaloneView';
  61. e.title='Standalone view';
  62. e.style='margin-top: 6px;';
  63. r.appendChild(e);
  64. e.onclick=toggle;
  65. try{
  66. toggle(GM_getValue('option',true));
  67. }catch(er){
  68. let v=window.sessionStorage._popup_;
  69. if (v === undefined) v=true;
  70. else v=JSON.parse(v);
  71. toggle(v);
  72. }
  73. }
  74.  
  75. addChk();
  76.  
  77. const obs = new MutationObserver(function(mutL){
  78. for (let mut of mutL) {
  79. for (let el of mut.addedNodes) {
  80. if (el.classList && el.classList.contains('menubar')) {
  81. r=document.querySelector('.widget.menubar .button-container.left');
  82. addChk();
  83. return;
  84. }
  85. }
  86. }
  87. });
  88.  
  89. var t=document.querySelector('#panel-mail-table .panel-body form');
  90. if (t) obs.observe(t, {subtree: false, childList: true, attributes: false} );
  91.  
  92. })();