Greasy Fork

Flickr WideScreen BigONE - Classic Group - HI-RES Pics v.2

Higher resolution shots (by NotYou and DuckDuckGo IA)

目前为 2024-10-02 提交的版本。查看 最新版本

// ==UserScript==
// @name         Flickr WideScreen BigONE - Classic Group - HI-RES Pics v.2
// @description  Higher resolution shots (by NotYou and DuckDuckGo IA)
// @version      2.0
// @author       decembre
// @namespace    https://greasyfork.org/fr/users/8-decembre
// @icon         https://external-content.duckduckgo.com/ip3/blog.flickr.net.ico

// @match     https://www.flickr.com/groups_pool.gne*
// @match      https://www.flickr.com/groups/*

// @include      https://www.flickr.com/groups_pool.gne*
// @include      https://www.flickr.com/groups/*

// @require https://code.jquery.com/jquery-3.6.0.min.js
// @grant GM_addStyle
// ==/UserScript==

(function() {
  var $ = window.jQuery;

  // FLICKR 1 - POOL SMALL
  // #pool-photos.sm .thumb img:not(.video-play-icon)[src$="_t.jpg"]
  (function() {
    document.querySelectorAll('#pool-photos.sm .thumb img:not(.video-play-icon)[src$="_t.jpg"]').forEach(elem => {
      if(elem.tagName.toLowerCase() === 'source') {
        const newSrcset = elem.srcset.replace(/\_t\.jpg$/, getNewSource);

        elem.srcset = newSrcset;
      } else {
        const newSource = elem.src.replace(/\_t\.jpg$/, getNewSource);

        elem.src = newSource;
      }

      function getNewSource(m) {
        const indexOfDot = m.indexOf('.')
        const fileExtenstion = m.slice(indexOfDot)
        const fileName = m.slice(0, indexOfDot)

        return fileName.replace('t', 'w') + fileExtenstion
      }

    });

  })();

  // FLICKR 2 - JUSTIFIED VIEW (for large blurry image)
  (function() {
    document.querySelectorAll('.ju.photo-display-container .pool-photo.photo-display-item [src$="_t.jpg"]').forEach(elem => {
      const newSource = elem.src.replace(/\_t\.jpg$/, '_b.jpg');
      elem.src = newSource;
    });
  })();

  // Ajout de CSS
  $ ('head').append(`
    <style type='text/css'>
    /* SMALL VIEW */
       /*#pool-photos.sm .thumb img:not(.video-play-icon)[src$="_w.jpg"]{
        border: 1px dashed aqua  !important;
      }*/
      /* JUSTIFIED VIEW - BLURRY IMAG */
      /*.ju.photo-display-container .pool-photo.photo-display-item [src$="_b.jpg"] {
        border: 1px dotted aqua  !important;
      }*/
    </style>
  `);
})();