LINE Sticker Download

Add download button for line sticker/emoji/theme store.

当前为 2019-07-19 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name LINE Sticker Download
  3. // @name:zh-CN LINE Sticker Download
  4. // @name:ja LINE Sticker Download
  5. // @include https://store.line.me/stickershop/product/*
  6. // @include https://store.line.me/emojishop/product/*
  7. // @include https://store.line.me/themeshop/product/*
  8. // @namespace https://veltlion.github.io/line-sticker-download
  9. // @icon https://secure.gravatar.com/avatar/6b0d31e600391e6f15240323202f5482
  10. // @version 1.7
  11. // @description Add download button for line sticker/emoji/theme store.
  12. // @description:zh-cn 在 LINE STORE 的 Sticker/Emoji/Theme 页面添加下载按钮。
  13. // @description:ja LINE STORE にダウンロードボタンを追加する。
  14. // @author 空
  15. // @grant GM_download
  16. // ==/UserScript==
  17.  
  18. (function(){
  19. 'use strict';
  20.  
  21. var path, id, btn, btn2, btnstr, link2, filename, link, lang ;
  22. path = window.location.pathname;
  23. id = path.replace(/\/(emoji|sticker)shop\/product\/([a-f\d]+).*/, '$2');
  24. //var lang = navigator.language;
  25. lang = document.documentElement.lang;
  26. btnstr = 'Download';
  27. if (lang.indexOf('zh') > -1) btnstr = '下载';
  28. else if (lang.indexOf('ja') > -1) btnstr = 'ダウンロードする';
  29. if (path.indexOf('stickershop') > -1) {
  30. if ($('span').hasClass('MdIcoAni_b') || $('span').hasClass('MdIcoPlay_b') ||$('span').hasClass('MdIcoSound_b') ||
  31. $('span').hasClass('MdIcoFlashAni_b') || $('span').hasClass('MdIcoFlash_b')) {
  32. link = 'https://sdl-stickershop.line.naver.jp/stickershop/v1/product/' + id + '/iphone/stickerpack@2x.zip';
  33. } else {
  34. link = 'https://sdl-stickershop.line.naver.jp/stickershop/v1/product/' + id + '/iphone/stickers@2x.zip';
  35. }
  36. btn = '<li><button class="MdBtn01P01" id="download" style="background: #33b1ff" >'
  37. + btnstr
  38. + '</button></li>';
  39. $('.mdCMN38Item01Ul').find('li:eq(0)').remove();
  40. $('.mdCMN38Item01Ul').prepend(btn);
  41. btn = '<li class="mdCMN08Li" style="list-style-type: none">'
  42. + '<a class="MdBtn01 mdBtn01" id="download" style="background: #33b1ff">'
  43. + '<span class="mdBtn01Inner">'
  44. + '<span class="mdBtn01Txt">' + btnstr + '</span>'
  45. + '</span></a></li>';
  46. } else if (path.indexOf('emojishop') > -1) {
  47. link = "http://dl.stickershop.line.naver.jp/sticonshop/v1/" + id + "/sticon/iphone/package.zip?v=1";
  48. btn = '<li class="mdCMN08Li" style="list-style-type: none">'
  49. + '<a class="MdBtn01 mdBtn01" id="download" style="background: #33b1ff">'
  50. + '<span class="mdBtn01Inner">'
  51. + '<span class="mdBtn01Txt">' + btnstr + '</span>'
  52. + '</span></a></li>';
  53. $('.mdCMN08Ul').find('li:eq(0)').remove();
  54. $('.mdCMN08Ul').prepend(btn);
  55. } else {
  56. id = $("div.mdCMN08Img>img").attr("src").replace(/https\:\/\/shop.line-scdn.net\/themeshop\/v1\/products\/(.+)\/WEBSTORE\/.+/, '$1');
  57. link = 'https://shop.line-scdn.net/themeshop/v1/products/' + id + '/ANDROID/theme.zip';
  58. link2 = 'https://shop.line-scdn.net/themeshop/v1/products/' + id + '/IOS/theme.zip';
  59. btn = '<li class="mdCMN08Li" style="list-style-type: none">'
  60. + '<a class="MdBtn01 mdBtn02" id="download" style="background: #00b84f">'
  61. + '<span class="mdBtn01Inner">'
  62. + '<span class="mdBtn01Txt">' + btnstr + ' (Android)</span>'
  63. + '</span></a></li>';
  64. btn2 = '<li class="mdCMN08Li" style="list-style-type: none">'
  65. + '<a class="MdBtn01 mdBtn01" id="download2" style="background: #33b1ff">'
  66. + '<span class="mdBtn01Inner">'
  67. + '<span class="mdBtn01Txt">' + btnstr + ' (iOS)</span>'
  68. + '</span></a></li>';
  69. $('.mdCMN08Ul').find('li:eq(0)').remove();
  70. $('.mdCMN08Ul').find('li:eq(0)').remove();
  71. $('.mdCMN08Ul').prepend(btn2);
  72. $('.mdCMN08Ul').prepend(btn);
  73. }
  74.  
  75. if ($('div').hasClass('mdMN05Btn')) {
  76. //$('.MdBtn01').remove();
  77. $('.mdMN05Btn').prepend(btn2);
  78. $('.mdMN05Btn').prepend(btn);
  79. }
  80.  
  81. filename = document.title.replace(/(.+) (-|–) .+/g, '$1');
  82. filename = filename.replace(/\"|\\|\/|\:|\*|\?|\<|\>|\|/g, "");
  83. var file = { url: link, name: filename + '.zip' };
  84. var file2 = { url: link2, name: filename + ' (iOS).zip' };
  85.  
  86. $('body').on('click', '#download2', function(){ var result = GM_download(file2); });
  87. $('body').on('click', '#download', function(){ var result = GM_download(file); });
  88.  
  89. }());