🎉 欢迎访问GreasyFork.Org 镜像站!本镜像站由公众号【爱吃馍】搭建,用于分享脚本。联系邮箱📮

Greasy fork 爱吃馍镜像

Greasy Fork is available in English.

📂 缓存分发状态(共享加速已生效)
🕒 页面同步时间:2026/02/04 15:27:33
🔄 下次更新时间:2026/02/04 16:27:33
手动刷新缓存

GreasyFork script icon

On a script info page it shows its icon from the script meta block

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey, Greasemonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Userscripts.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een gebruikersscriptbeheerder nodig.

(Ik heb al een user script manager, laat me het downloaden!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

(Ik heb al een beheerder - laat me doorgaan met de installatie!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

// ==UserScript==
// @name        GreasyFork script icon
// @namespace   wOxxOm.scripts
// @description On a script info page it shows its icon from the script meta block
// @icon        https://icons.iconarchive.com/icons/custom-icon-design/mono-general-1/64/information-icon.png
// @version     1.1.8
// @author      wOxxOm
// @match       https://greasyfork.org/*scripts/*
// @include     /^https://(sleazy)fork.org/.*?scripts/.*?/
// @exclude     /^https://(greasy|sleazy)fork\.org/([^/]+/)?scripts/(\D|$)/
// @run-at      document-start
// @connect-src *
// @grant       GM_xmlhttpRequest
// @grant       GM_setValue
// @grant       GM_getValue
// ==/UserScript==

var scriptID = location.href.match(/scripts\/(\d+)/)[1];
var iconsrc = (GM_getValue(scriptID) || '').split('\n');
var iconDate = iconsrc[1];
iconsrc = iconsrc[0];

if (iconsrc.match(/^data:image|^https:/))
  addIcon();

if (true)  {
  GM_xmlhttpRequest({
    method: 'GET',
    url: location.href.replace(/^(https:..)([^/]+).*?(\/scripts\/\d+).*/,'$1update.$2$3/_.user.js'),
    headers: iconDate && {'If-Modified-Since': iconDate},
    timeout: 10000,
    onload: function (r) {
      var url = (r.responseText.match(/\n\s*\/\/\s+@icon(?:url)?\s+((?:https?:\/\/|data:image\/).+)|$/i)[1] || '').trim();
      var date = url && (r.responseHeaders.match(/(\n|^)Last-Modified:\s*(.+)/i) || [])[2];
      if (!url || date && iconDate === date)
        return;
      if (!/^http:/.test(url))
        return addIcon(url, date);
      // download http icon and store it in script db if it's small
      GM_xmlhttpRequest({
        method: 'GET',
        url: url,
        timeout: 10000,
        headers: {'Accept':'image/png,image/*;q=0.8,*/*;q=0.5'},
        responseType: 'arraybuffer',
        onload: function(ri) {
          var /**@type ArrayBuffer*/rb = ri.response, rbl = rb.byteLength;
          if (rbl > 100000) {
            console.log('Script icon exceeds 100k, ignoring');
            return;
          }
          var mime = ri.responseHeaders.match(/(^|\n\s*)Content-Type:\s*(image\/[^;,\s]+)|$/i)[2];
          var rbs = [];
          for (var i = 0, step = 8192; i < rbl; i += step)
            rbs.push(String.fromCharCode.apply(null, new Uint8Array(rb, i, Math.min(step, rbl - i))));
          addIcon('data:image/' + (mime || 'png') + ';base64,' + btoa(rbs.join('')), date);
        }
      });
    }
  });
}

function addIcon(url, date) {
  if (url) {
    if (url === iconsrc && date === iconDate)
      return;
    iconsrc = url;
    iconDate = date || '';
  }
  GM_setValue(scriptID, iconsrc + '\n' + iconDate);

  var h2 = document.querySelector('#script-info header h2');
  h2 ? __add(h2) : __wait();

  function __add(h2) {
    if (!h2)
      if (!(h2 = document.querySelector('#script-info header h2')))
        return;

    h2.insertAdjacentHTML('afterbegin','<div style="\
        position: absolute;\
        width: 80px;\
        margin-left: calc(-80px - 1ex);\
        display: inline-block;\
        text-align: right"></div>');
    var img = h2.firstChild.appendChild(document.createElement('img'));
    img.style.maxWidth = img.style.maxHeight = '64px';
    img.style.width = img.style.height = 'auto';
    img.src = iconsrc;
  }

  function __wait() {
    var ob = new MutationObserver(function(mutations){
      for (var i=0, ml=mutations.length, m; (i<ml) && (m=mutations[i]); i++) {
        if (m.target.localName == 'h2') {
          __add();
          ob.disconnect();
          return;
        }
      }
    });
    ob.observe(document, {subtree:true, childList:true});
  }
}