LINE Sticker
by h__zr
HTML
<p><label for="userInput">LINE Sticker Page Link/ID: </label><input id="userInput" name="userInput" type=text /></p>
<p><span>Normal: <a id="normalDownload" class="filelink" target="_blank">-</a></span></p>
<p><span>Animated/Sound: <a id="animatedDownload" class="animated filelink" target="_blank">-</a></span></p>
<img id="mainPng" />
JavaScript
function reset() {
Array.from(document.getElementsByClassName("filelink"))
.forEach(el => {
el.removeAttribute("href");
el.textContent = "N/A";
});
document.getElementById("mainPng").removeAttribute("src");
}
function onChange() {
var re = /product\/(\d+)/.exec(document.getElementById("userInput").value);
if (re == null)
re = /^(\d+)$/.exec(document.getElementById("userInput").value);
if (re == null) {
reset();
return;
}
var storeId = re[1];
var mainPngPrefix = "https://stickershop.line-scdn.net/stickershop/v1/product/";
var mainPngSuffix = "/LINEStorePC/main.png;compress=true";
var downloadLinkPrefix = "http://dl.stickershop.line.naver.jp/products/0/0/1/";
var normalSuffix = "/iphone/stickers@2x.zip";
var animatedSuffix = "/iphone/stickerpack@2x.zip";
var mainPngLink = mainPngPrefix + storeId + mainPngSuffix;
var normalDownloadLink = downloadLinkPrefix + storeId + normalSuffix;
var animatedDownloadLink = downloadLinkPrefix + storeId + animatedSuffix;
console.log("Normal: " + normalDownloadLink);
console.log("Animated/Sound: " + animatedDownloadLink);
document.getElementById("mainPng").setAttribute("src", mainPngLink);
document.getElementById("normalDownload").setAttribute("href", normalDownloadLink);
document.getElementById("normalDownload").textContent = normalDownloadLink;
document.getElementById("animatedDownload").setAttribute("href", animatedDownloadLink);
document.getElementById("animatedDownload").textContent = animatedDownloadLink;
}
function onLoad() {
reset();
document.getElementById("userInput").addEventListener('input', onChange);
}
window.addEventListener("load", onLoad);