// ==UserScript== // @name GMX standalone view // @name:de GMX Standalone-Ansicht // @name:fr GMX email - fenêtre séparée // @namespace https://github.com/Procyon-b // @version 0.6 // @description Set option to open email in standalone window (gmx / web.de) // @description:de Stellen Sie die Option so ein, dass E-Mails im eigenständigen Fenster geöffnet werden (gmx / web.de) // @description:fr Réactiver l'ouverture des emails dans une fenêtre popup (gmx / web.de) // @author Achernar // @match https://3c.gmx.net/mail/client/* // @match https://3c-bap.gmx.net/mail/client/* // @include https://3c-bs.gmx.tld/mail/client/* // @match https://3c.web.de/mail/client/* // @match https://3c-bap.web.de/mail/client/* // @run-at document-body // @grant GM_setValue // @grant GM_getValue // @downloadURL none // ==/UserScript== (function() { "use strict"; if ( /^\/mail\/client\/(home|folder|search)/.test(location.pathname) ) { const maxRetry=40; var e, r, retry=maxRetry; function toggle(ev) { if (!e) return; var v=(typeof ev == 'object')? !phx.vars.enableStandaloneView : ev; e.checked=v; phx.vars.enableStandaloneView=v; try{ GM_setValue('option', v); }catch(er){ window.sessionStorage._popup_=v; } } function addChk() { if (!(r=document.querySelector('.widget.menubar .button-container.left'))) { if (retry--) { setTimeout(addChk,10); } return; } retry=maxRetry; e=document.createElement('input'); e.type='checkbox'; e.id='standaloneView'; e.title='Standalone view'; e.style='margin-top: 6px;'; r.appendChild(e); e.onclick=toggle; try{ toggle(GM_getValue('option',true)); }catch(er){ let v=window.sessionStorage._popup_; if (v === undefined) v=true; else v=JSON.parse(v); toggle(v); } } addChk(); const obs = new MutationObserver(function(mutL){ for (let mut of mutL) { for (let el of mut.addedNodes) { if (el.classList && el.classList.contains('menubar')) { r=document.querySelector('.widget.menubar .button-container.left'); addChk(); return; } } } }); var t=document.querySelector('#panel-mail-table .panel-body form'); if (t) { obs.observe(t, {subtree: false, childList: true, attributes: false} ); t.addEventListener('click', function(ev){ if (ev.target.classList.contains('mail-open')) { if (phx.vars.enableStandaloneView) { ev.stopPropagation(); let mId=ev.target.closest('tr[data-oao-mailid]'); let u=location.origin+location.pathname.replace(/^.*?;/, '/mail/client/mail/detail;') + '?mailId='+mId.attributes['data-oao-mailid'].value+'&folderId='+mId.attributes['data-folderid'].value+'&standalone=true'; let w=Math.min( Math.max(1024, t.scrollWidth) ,1400); window.open(u, mId.attributes['data-oao-mailid'].value ,'width='+w+',height=600'); } } }, {capture: true} ); } } if (location.href.endsWith('&standalone=true')) { let st=document.createElement('style'); st.innerText='#navigation, #section-0, .section-1 .prev, .section-1 .next, .section-1 .menubar, .ad {display: none;} .section-1 {left: 0;} .mail-display-wrapper {top: 0;} html.can-have-sky .section-content {margin-right: 0 !important;} .section-1 > .section-container {bottom:0 !important;}'; (document.head || document.documentElement).appendChild(st); var t=document.body.querySelector('.section-1 [data-webdriver="MailDetail:Close"]'); if (t) t.addEventListener('click', function(ev){window.close();}, {capture: true}); } })();