/*
This bookmarklet is kind of lazy - opens all media (images and video) in new tabs from
particular post. It checks whether zoom popup is opened. If so it takes media data from
popup slides. (Didn't had opportunity to check it on popups that contain more then 3
media files).
If zoom popup is closed it checks all post elements from posts list to be fully visible.
Thus make sure that post is fully visible including post title. Possibly calculation
could be improved.
It turns out that images in the post items tend to have some size limitations. I turns
out that frequently (not always, probably depends on size of uploaded images) opening
post images in zoom popup has much bigger size. So to get best resolution you have to
open images in zoom mode. Probably it could be automated in future improvements.
*/
/*
Firefox require wrap code in IIFE, otherwise page from which you will call it becomes blank.
So if you want to continue watching other photos from that page it requires page reload.
Which is absolutely inconvenient. Have no idea why it happens, so it easier just to use IIFE.
*/
(function() {
// Kind of minor optimization. Maybe it has no sens.
window._popup ??= document.querySelector('.pswp__container');
window._posts ??= document.querySelector('.g-page-content__body .vue-recycle-scroller__item-wrapper');
getMedia(window._popup, window._posts).map(getSource).map(openMedia);
// Current code can open duplicate found by picture and img tags. Could be improved in
// the future. But at the moment I didn't saw picture tag in page markup.
function getMedia(popup, postsContainer) {
if (popup.getBoundingClientRect().height) {
return [...popup.querySelectorAll('.pswp__zoom-wrap :is(img, picture, video)')];
} else {
let posts = [...postsContainer.querySelectorAll('.vue-recycle-scroller__item-view')];
let postInFocus = posts.find(el => {
let coords = el.getBoundingClientRect();
return...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.