-
-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(Github Image Viewer) regex pattern improvements + directory detection #82
Comments
@jP6a9b3OR6FN5mVP81pQ2aOrtfMhKEhaBX8WkP1 commented on 14 nov. 2015 05:30 CET:
These changes are awesome! If you want credit you can send a PR. Otherwise I can make the changes if you want.
You mean when folders are named after image extensions, including the dot? |
@jerone commented on [Nov 14, 2015, 12:54 PM GMT+2](https://github.com/jerone/UserScripts/
it will be very kind of you if you do everything by yourself
yes, exactly: prevent GithubImageViewer from triggering by folders with names like "bmp"/".bmp" |
@jP6a9b3OR6FN5mVP81pQ2aOrtfMhKEhaBX8WkP1 commented on 14 nov. 2015 13:19 CET:
I want to stay away from GitHub page elements as much as possible, definitely traveling up the tree and back down again. They change their page layout very often. I was thinking of extending the regex: --- _imageRegex: /(\.jpe?g|\.png|\.gif|\.bmp|\.ico|\.tiff?)$/i,
+++ _imageRegex: /.+(\.jpe?g|\.png|\.gif|\.bmp|\.ico|\.tiff?)$/i, |
agree with such intentions, but unfortunately there no other way in code
3 ups to ".js-navigation-item" and ~ queryselector/queryselectorall[0] ".js-navigation-item .octicon-file-text" )
once or twice per year during last few years or am I wrong? knocking on wood
ok, but it just simply excludes ".bmp"-named file or folder |
@jP6a9b3OR6FN5mVP81pQ2aOrtfMhKEhaBX8WkP1 commented on 14 nov. 2015 15:01 CET:
Anything named |
🎬 Released new version of Github Image Viewer |
the same to you |
• 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)
• 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)) {
The text was updated successfully, but these errors were encountered: