Greasy Fork

Greasy Fork is available in English.

Flickr WideScreen BigONE - HI-RES Pics v.3

Higher resolution shots (by NotYou and DuckDuckGo IA)

当前为 2024-10-03 提交的版本,查看 最新版本

// ==UserScript==
// @name         Flickr WideScreen BigONE -  HI-RES Pics v.3
// @description  Higher resolution shots (by NotYou and DuckDuckGo IA)
// @version      3.0
// @author       decembre
// @namespace    http://greasyfork.icu/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/*
// @match      https://www.flickr.com/notifications

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

// @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;
    });
  })();

      // FLICKR 3 - NOTIFICATIONS PAGES VIEW
    //style="background-image: url(//live.staticflickr.com/65535/49726613923_022f7fb3c2_t.jpg);"
    // style="background-image: url(//live.staticflickr.com/65535/49726613923_022f7fb3c2_b.jpg);"
// FLICKR 3 - NOTIFICATIONS PAGES VIEW
// FLICKR 3 - NOTIFICATIONS PAGES VIEW
// FLICKR 3 - NOTIFICATIONS PAGES VIEW
(function() {
  console.log('Code exécuté');
  var observer = new MutationObserver(function(mutations) {
    var elements = document.querySelectorAll('html.fluid.html-notification-center-page-view .notification-center-page-view .notification-item .thumb-container a.notification-photo-thumb:not(.HD)');
    if (elements.length > 0) {
      console.log('Éléments trouvés !');
      elements.forEach(function(elem) {
        var style = elem.style.backgroundImage;
        if (style && style.indexOf('_t.jpg') !== -1) {
          console.log('Background trouvé : ' + style);
          var newStyle = style.replace('_t.jpg', '_b.jpg');
          elem.style.backgroundImage = newStyle;
          console.log('Background modifié : ' + newStyle);
          elem.classList.add('HD');
        } else {
          console.log('Pas de background trouvé pour l\'élément : ' + elem);
        }
      });
    }
  });
  observer.observe(document, {
    childList: true,
    subtree: true
  });
})();


  // Ajout de CSS pour supprimer la bordure
  $ ('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>
  `);
})();