Skip to content

(Github Image Viewer) regex pattern improvements + directory detection #82

@jP6a9b3OR6FN5mVP81pQ2aOrtfMhKEhaBX8WkP1

Description

• with regexp: add .bmp format (e.g. https://github.com/quentinmrzt/Darlizot/tree/master/sprite), escape filetype dots and ignore the case (e.g. https://github.com/PeterLawrence/WinTimeStampUtility)

--- _imageRegex: /(.jpe?g|.png|.gif|.ico|.tiff?)$/,
+++ _imageRegex: /(\.jpe?g|\.png|\.gif|\.bmp|\.ico|\.tiff?)$/i,

• with folders: check icon sibling for '.octicon-file-text' / !'.octicon-file-directory' class (e.g. https://github.com/github/octicons)

if (target.classList && target.classList.contains("js-directory-link")
+++     && target.parentElement.parentElement.parentElement.firstElementChild.firstElementChild.classList.contains("octicon-file-text")
        && GithubImageViewer._imageRegex.test(target.href)) {

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions