Coder Social home page Coder Social logo

github-issue-filter-safari-extension's Introduction

GitHub Issue Filter Saver

Description

The new GitHub issues is awesome, but unfortunately issue filters are no longer preserved when clicking on the "issues" icon on the right navigation. This extension saves the last filter you used and loads that instead of a blank slate every time you access the main issues page.

This extension is open source. If you encounter any bugs, don't hesitate to make a pull request or file an issue.

If you're looking for the Chrome version of this extension, head over here.

Installation

Just download and install the "GitHub Issues Filter Saver.safariextz" file in the repo. Direct link.

How it works

GitHub issues relies pretty heavily on Javascript & PJAX, and Safari's extension capabilities are a bit restricted as compared to Chrome's (needless to say, the Chrome extension is much simpler). So, here's how it does what it does.

  1. After page load, it goes through every link on the page and converts the targets to absolute URLs and overrides click handlers to call a special function (replaceLinks).
  2. When a link it clicked, the URL is matched to one of two regular expressions; one that indicates it's a filter that should be saved, and one that indicates it's a link that should load the filter (i.e., https://github.com/username/repo/issues). If it's neither, the link is loaded normally.
  3. If it's a URL that should be saved, save it to the extension's Local Storage to a key created by combining the organization / username and repo name.
  4. If it's a URL that should load the filter, it calls preventDefault on the original click event, pulls out the saved URL from Local Strorage, and then tells Safari to load that URL.
  5. Last but not least, it uses MutationObserver to watch the page for DOM changes. When it's initiated, all new links on the page are replaced and overriden with the custom function. This happens when clicking on the "Labels" or "Assignee" dropdowns, since the HTML within those is populated dynamically through AJAX requests.

github-issue-filter-safari-extension's People

Contributors

dlo avatar

Stargazers

Justin Mayer avatar  avatar

Watchers

 avatar James Cloos avatar  avatar

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.