Giter Club home page Giter Club logo

localfilebrowser's People

Contributors

qufighter avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

localfilebrowser's Issues

Some suggestions to make the extension more awesome

While looking for a way to easily preview local images I found your extension. Although it doesn't do what I want, I reviewed the code and have some suggestions.

file:// permission - improve usability

  1. The extension requires file:/// access in order to be functional, and you're getting 1-star reviews because people can't be bothered to read your description that explicitly lists this requirement. I suggest to use chrome.extension.isAllowedFileSchemeAccess to check whether the extension has file access, and if not prompt the user for permission (e.g. by opening a new tab).
  2. To complement the above suggestion, add the webNavigation permission (you already have the tabs permission, so there is no permission warning) and use the chrome.webNavigation.onBeforeNavigate event to detect navigations to file://-URLs, and show the permission request when the extension lacks the file permission.

Here is an example (for local PDF files): https://github.com/mozilla/pdf.js/blob/64a409b539bf7974aa695dec82fa414cfcb777ac/extensions/chromium/pdfHandler.js#L191-L215

Note that the above example replaces the tab with an extension page because the extension assumes that Chrome is not able to open the PDF file without the extension. In your case, you probably want to open a new tab instead (chrome.tabs.create).

Fix fragile rotation logic

It seems that you're fighting against the same origin policy in localfiles.user.js and background.js to rotate pictures. The current "solution" is to repeatedly move the image around, capture a screenshot of the tab and assemble the images later. This is fragile, I tested it on one image and it did not work.

I suggest to use XMLHttpRequest with responseType='blob' (from the content script, localfiles.user.js), then get a same-origin URL using URL.createObjectURL(blob), and then directly load this image in an new Image() for straightforward manipulation on a canvas.

This would be much faster than your current method and also less error-prone.

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.