Line Store Easy Sticker Downloader

This script allows users to easily download stickers from the Line Store website. By left-clicking on any sticker, the preview image will open in a new tab, making it simple to view or download the sticker using the right-click menu.

目前為 2024-08-15 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name:zh-tw      Line Store 貼圖輕鬆下載器
// @name            Line Store Easy Sticker Downloader
// @namespace       com.sherryyue.linestickerstoredownloader
// @version         0.5
// @description:zh-tw 此腳本讓用戶能輕鬆下載 Line 貼圖商店網站上的貼圖。左鍵點擊任何貼圖時,預覽圖將在新分頁中開啟,方便瀏覽或右鍵下載貼圖。
// @description       This script allows users to easily download stickers from the Line Store website. By left-clicking on any sticker, the preview image will open in a new tab, making it simple to view or download the sticker using the right-click menu.
// @author          SherryYue
// @copyright       SherryYue
// @license         MIT
// @match           https://store.line.me/*
// @supportURL      [email protected]
// @icon            https://sherryyuechiu.github.io/card/images/logo/maskable_icon_x96.png
// @require         https://code.jquery.com/jquery-3.6.0.js
// @require         https://code.jquery.com/ui/1.13.1/jquery-ui.js
// @supportURL      "https://github.com/sherryyuechiu/GreasyMonkeyScripts/issues"
// @homepage        "https://github.com/sherryyuechiu/GreasyMonkeyScripts"
// @grant           GM_addStyle
// ==/UserScript==

(function () {
  let downloadImage = (url) => {
    var a = document.createElement('a');
    a.href = url;
    a.download = url;
    document.body.appendChild(a);
    a.click();
    document.body.removeChild(a);
  }

  let main = () => {
    $('.FnStickerPreviewItem').on("click", function () {
      let data = JSON.parse($(this).attr('data-preview'));
      let clearImageUrl = data.fallbackStaticUrl;
      downloadImage(clearImageUrl);
      console.warn('data', data)
    });
  }

  function observerFallBack(mutations, obs) {
    if (!document.querySelector(".FnStickerPreviewItem")) return;
    setTimeout(main, 250);
    observer.disconnect();
  }

  let observer = new MutationObserver(observerFallBack);
  observer.observe(document.querySelector("body"), {
    childList: true,
    subtree: true
  });
  setTimeout(observerFallBack, 250);

  document.getElementsByTagName('head')[0].append(
    '<link '
    + 'href="//code.jquery.com/ui/1.13.1/themes/base/jquery-ui.css" '
    + ' type="text/css">'
  );
})();