Skip to content

Instantly share code, notes, and snippets.

@5S
Created September 14, 2017 15:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 5S/b563ca7ce1df5abe876bc325ccae637d to your computer and use it in GitHub Desktop.
Save 5S/b563ca7ce1df5abe876bc325ccae637d to your computer and use it in GitHub Desktop.
LINE STORE で配布されているテーマを .zip 形式でダウンロードするボタンを追加する Greasemonkey 用スクリプト
// ==UserScript==
// @name LINE Theme Downloader
// @namespace https://twitter.com/A90
// @version 0.1
// @description Add download button to LINE STORE
// @author LOZTPX
// @match https://store.line.me/themeshop/product/*
// @grant none
// ==/UserScript==
(function() {
var head = document.head;
var pattern = 'https://shop.line-scdn.net/themeshop/v1/products/';
var begin = head.innerHTML.indexOf(pattern);
var baseUrl;
if(begin !== -1){
baseUrl = head.innerHTML.substr(begin, 97);
}
var ul = document.evaluate('/html/body/div[1]/div/div[2]/div/section/div[1]/div[1]/div[2]/ul', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
var mdCMN08Ul;
var li = document.createElement('li');
if(ul.snapshotLength) {
mdCMN08Ul = document.getElementsByClassName('mdCMN08Ul');
li.innerHTML = '<li class="mdCMN08Li"><a class="MdBtn01 mdBtn02" href="' + baseUrl + 'ANDROID/theme.zip"><span class="mdBtn01Inner"><span class="mdBtn01Txt">ダウンロードする</span></span></a></li>';
mdCMN08Ul[0].insertBefore(li, mdCMN08Ul[0].firstChild);
} else {
console.log('ul タグが見つかりませんでした');
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment