Greasy Fork

Greasy Fork is available in English.

Flickr WideScreen BigONE - HI-RES Pics v.5

Higher resolution shots (by NotYou and DuckDuckGo IA)

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

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Flickr WideScreen BigONE -  HI-RES Pics v.5
// @description  Higher resolution shots (by NotYou and DuckDuckGo IA)
// @version      5.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
// @match      https://www.flickr.com/search/*
// @match      https://www.flickr.com/photosof/*

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

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

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

  // FLICKR 1 - POOL SMALL (SCR)
  // #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 (BACK IMG)
    //style="background-image: url(//live.staticflickr.com/65535/49726613923_022f7fb3c2_t.jpg);"
    // style="background-image: url(//live.staticflickr.com/65535/49726613923_022f7fb3c2_b.jpg);"
(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
  });
})();

// FLICKR 4 - SEARCH PAGES (BACK IMG)
    // .fluid.html-search-photos-unified-page-view main#search-unified-content.main.fluid-centered .search-container-w-sidebar .main.search-photos-results .search-photos-everyone-view .photo-list-view .photo-list-tile-view.forced-aspect-ratio .phot
//  background-image: url('//live.staticflickr.com/5146/5755248605_9480e303d2_m.jpg');
(function() {
  console.log('Code exécuté');
  var observer = new MutationObserver(function(mutations) {
    var elements = document.querySelectorAll('.fluid.html-search-photos-unified-page-view main#search-unified-content.main.fluid-centered .search-container-w-sidebar .main.search-photos-results .search-photos-everyone-view .photo-list-view .photo-list-tile-view.forced-aspect-ratio .photo: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('_m.jpg') !== -1) {
          console.log('Background trouvé : ' + style);
          var newStyle = style.replace('_m.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
  });
})();

    // FLICKR 5 - Photo OF (SRC) (BACK IMG)
    // .HoldPhotos p.RecentPhotos .photo_container a img:not(.video-play-icon)[src$="_t.jpg"]
//  src="https://live.staticflickr.com/4086/35707812856_5b19db2991_t.jpg"
(function() {
    document.querySelectorAll('.HoldPhotos p.RecentPhotos .photo_container a 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;
          elem.classList.add('HD');
      }

      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 6 - POOL Clasique - Defered Images
(function() {
  function updateDeferredImages() {
    document.querySelectorAll('.super-liquid #pool-photos.photo-display-container.ju .pc_img.defer.img').forEach(elem => {
      if (elem.src === "https://combo.staticflickr.com/pw/images/spaceout.gif" && elem.dataset.deferSrc) {
        elem.src = elem.dataset.deferSrc;
      }
    });
  }

  updateDeferredImages();

  // Relancer la fonction après 500ms
  setInterval(updateDeferredImages, 500);
})();

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