Everything you need to know before making a pull request
- Please test your PR before submitting it
- Using
console.log
while testing is fine but please remove them from your PR when pushing it - Don't fix more than one issue by PR if possible, make multiple PRs when you want to work on multiple issues.
- Don't be afraid to ask questions!
Survol is a browser extension, the goal is to provide a preview for every hoverable link on a page (every <a href="..." element).
We might use "survol-able" to say that a link works with the extension.
It defines functions like :
insertSurvolDiv
: it injects a div into the DOM which we refer as the "survol container". The div follows the cursor and is displayed only when the cursor hovers an anchor linksurvolBackgroundRequest
: which sends data to the background, using browser messages, script when we need to make a request in order to avoid CORS.- other simple functions related to finding anchor links and affecting them the correct implemetation.
There are 2 types of templates :
Every templates has a bindToContainer
function in which it attachs itself to the survol div.
This file is used to preview anything that hasn't a custom implementation, it pulls data by doing a background request and parses meta tags (title, description, thumbnail) to build the preview
These files are custom implementations of a certain website, they pull data using APIs and display more data (reddit upvote count and post date, twitter tweet's author profile picture, ...)
They also check if they are not affecting native integrations, Github, wikipedia already provide preview for everything on their site so custom templates shouldn't work when the site already has an implementation (i.e: disable wikipedia template on wikipedia)
A template might implement multiple things depending on the link type (reddit comments vs reddit posts, youtube channels vs videos, tweet vs twitter profile) ...
Everything related to request should be done here in order to avoid CORS. It communicates with the front script using browser background messages.