LINE Sticker Download

Add download button for line sticker store

当前为 2018-10-12 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name LINE Sticker Download
  3. // @name:zh-CN LINE Sticker Download
  4. // @namespace https://veltlion.github.io/line-sticker-download
  5. // @include https://store.line.me/stickershop/product/*
  6. // @version 1.4.1
  7. // @description Add download button for line sticker store
  8. // @description:zh-cn 在 LINE STORE Sticker 页面添加下载按钮
  9. // @author 空
  10. // @grant GM_download
  11. // ==/UserScript==
  12.  
  13. var id = window.location.pathname.replace(/[^\d]/g, '');
  14. var link = 'https://sdl-stickershop.line.naver.jp/stickershop/v1/product/' + id + '/iphone/stickers@2x.zip';
  15. var aslink = 'https://sdl-stickershop.line.naver.jp/stickershop/v1/product/' + id + '/iphone/stickerpack@2x.zip';
  16. if ($('span').hasClass('MdIcoAni_b') || $('span').hasClass('MdIcoPlay_b') ||$('span').hasClass('MdIcoSound_b') ||
  17. $('span').hasClass('MdIcoFlashAni_b') || $('span').hasClass('MdIcoFlash_b')) link = aslink;
  18. var file = { url: link, name: document.title.replace(/(.+) (-|–) .+/g, '$1') + '.zip' };
  19. var lang = navigator.language;
  20. var btnstr = 'Download';
  21. if (lang.indexOf('zh') > -1) btnstr = '下载';
  22. else if (lang.indexOf('ja') > -1) btnstr = 'ダウンロード';
  23. var btn = '<li class="mdCMN08Li" style="list-style-type: none">';
  24. btn += '<a class="MdBtn01 mdBtn01" id="download" style="background: #33b1ff">';
  25. btn += '<span class="mdBtn01Inner">';
  26. btn += '<span class="mdBtn01Txt">' + btnstr + '</span>';
  27. btn += '</span></a></li>';
  28. if ($('div').hasClass('mdCMN08Txt')) {
  29. $('.mdCMN08Txt>ul').find('li:eq(0)').remove();
  30. $('.mdCMN08Ul').prepend(btn);
  31. }
  32. else if ($('div').hasClass('mdMN05Btn')) {
  33. //$('.MdBtn01').remove();
  34. $('.mdMN05Btn').prepend(btn);
  35. }
  36. $('body').on('click', '#download', function(){
  37. var result = GM_download(file);
  38. });