Giter Club home page Giter Club logo

refined-gmail-userscript's Introduction

Karl Horky - Teacher, Co-Founder @ UpLeveled

Hi ๐Ÿ‘‹ย ย I'm Karl, an Austrian-Canadian programmer living in Vienna, Austria (originally from Vancouver / Victoria in B.C., Canada).

Currently I'm passionate about building UpLeveled to provide high quality tech education. This is where I spend most of my time - ensuring that our students get the best education outcomes possible.

Karl teaching students

Projects

Some of my open source projects:

refined-gmail-userscript's People

Contributors

karlhorky avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

refined-gmail-userscript's Issues

Implementation Strategy

Implementation strategy for: Always window.open new windows on clicks to Compose button and Reply button

Use DOM modification and event interception + modification to do this:

  1. Compose button
    1. Add new "click catcher" element to the DOM inside the compose button
    2. Stop propagation on the original event
    3. Fire new event with shiftKey: true
  2. Reply and Forward button
    1. Listen for "new email viewed" event (maybe with add an XHR interceptor like gmail.js and then search for the .Bu div.if .ams.bkH (Reply) and .Bu div.if .ams.bkH (Forward))
    2. Add new "click catcher" element to the DOM inside the reply/forward button
    3. Stop propagation on the original event
    4. Fire new event with shiftKey: true
    5. Unfortunately, this will only open up a compose div inside the application. So we need to continue:
    6. Wait for this element (use mutationObserver?)
    7. Trigger a mousedown and mouseup (with shiftKey: true) on the little diagonal arrow in the top right of this compose div

Some incomplete code:

// The relatively-stable compose button selector in Gmail
const composeButtonSelector = ".T-I.J-J5-Ji.T-I-KE.L3";

// TODO: Create full-sized element with the class `clickCatcher` inside compose button selector to intercept clicks

document.querySelector(`${composeButtonSelector} > .clickCatcher`).onclick = (
  event
) => {
  event.stopPropagation();
  const composeButton = document.querySelector(composeButtonSelector);
  // Need mousedown and mouseup for Gmail
  // Source: https://stackoverflow.com/a/57512820/1268612
  composeButton.dispatchEvent(new MouseEvent("mousedown", { shiftKey: true }));
  setTimeout(() =>
    composeButton.dispatchEvent(new MouseEvent("mouseup", { shiftKey: true }))
  );
};

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.