diff --git a/index.html b/index.html index 52466ba..5fdb8b2 100644 --- a/index.html +++ b/index.html @@ -1,5 +1,6 @@ + JianMiau - LIFF @@ -27,5 +28,5 @@ style="color: #3f3f3f;">Ari. © 2019 --> - + \ No newline at end of file diff --git a/liff-starter.js b/liff-starter.js index a1e1655..7853416 100644 --- a/liff-starter.js +++ b/liff-starter.js @@ -5,7 +5,7 @@ window.onload = function (_0xe315c8) { }) .then(() => { if (!liff.isLoggedIn()) { - liff.login(); + liff.login({ redirectUri: location.href }); } else { getP(); } @@ -55,12 +55,16 @@ function getP() { sendMessages(data); }); } else { + document.body.innerHTML = ""; makeText(); makeImage(); makeVideo(); makeAudio(); makeSticker(); meProfile(); + // makeTest(); + // makeDouDou(); + makeBW(); } } function getParameterByName(stringParam, window_href) { @@ -137,6 +141,7 @@ function makeSticker() { var stk = getParameterByName("stk"); var sid = getParameterByName("sid"); var pkg = getParameterByName("pkg"); + var size = getParameterByName("size") ?? "mega"; var pngtype = ""; if (stk === "anim") { pngtype = "/IOS/sticker_animation@2x.png"; @@ -144,28 +149,94 @@ function makeSticker() { pngtype = "/IOS/sticker@2x.png"; } - const data = [{ - "type": "template", + const data1 = [{ + "type": "flex", "altText": "Sticker", - "template": { - "type": "image_carousel", - "columns": [{ - "imageUrl": "https://stickershop.line-scdn.net/stickershop/v1/sticker/" + sid + pngtype, - "action": { - "type": "uri", - "uri": "line://shop/sticker/detail/" + pkg + "contents": + { + "type": "carousel", + "contents": [ + { + "type": "bubble", + "size": size, + "body": { + "type": "box", + "layout": "vertical", + "contents": [ + { + "type": "image", + "url": "https://stickershop.line-scdn.net/stickershop/v1/sticker/85913166/IOS/sticker_animation@2x.png", + "size": "full", + "aspectMode": "cover", + "animated": true, + "backgroundColor": "#FFFFFF00" + } + ], + "paddingAll": "none" + }, + "action": { + "type": "uri", + "label": "action", + "uri": "https://line.me/S/sticker/12378" + } } - }] + ] } }]; + const data = [{ + "type": "flex", + "altText": "Sticker", + "contents": + { + "type": "bubble", + "size": size, + "body": { + "type": "box", + "layout": "vertical", + "contents": [ + { + "type": "image", + "url": "https://stickershop.line-scdn.net/stickershop/v1/sticker/" + sid + pngtype, + "size": "full", + "aspectMode": "cover", + "animated": true, + "backgroundColor": "#FFFFFF00" + } + ], + "paddingAll": "none" + }, + "action": { + "type": "uri", + "label": "action", + "uri": "https://line.me/S/sticker/" + pkg + } + } + }]; + + // const data = [{ + // "type": "template", + // "altText": "Sticker", + // "template": { + // "type": "image_carousel", + // "columns": [{ + // "imageUrl": "https://stickershop.line-scdn.net/stickershop/v1/sticker/" + sid + pngtype, + // "action": { + // "type": "uri", + // // "uri": "line://shop/sticker/detail/" + pkg + // "uri": "https://line.me/S/sticker/" + pkg + // } + // }] + // } + // }]; + sendMessages(data); } } function meProfile() { var type = getParameterByName("type"); - liff.getProfile().then(function (data) { - var statusMessage = data.statusMessage; + liff.getProfile().then(function (profileData) { + var statusMessage = profileData.statusMessage; if (statusMessage == null) { var statusMessage = ""; } @@ -175,13 +246,13 @@ function meProfile() { if (type === "profile") { const data = [{ "type": "template", - "altText": "Profile " + data.displayName, + "altText": "Profile " + profileData.displayName, "template": { "type": "buttons", - "thumbnailImageUrl": data.pictureUrl, + "thumbnailImageUrl": profileData.pictureUrl, "imageAspectRatio": "square", "imageSize": "cover", - "title": data.displayName, + "title": profileData.displayName, "text": statusMessage, "actions": [{ "type": "uri", @@ -196,6 +267,119 @@ function meProfile() { }); } +function makeTest() { + var type = getParameterByName("type"); + if (type === "test") { + const data = [{ + "type": "flex", + "altText": "ㄟ, 我跟你說件事", + "contents": + { + "type": "bubble", + "size": "mega", + "body": { + "type": "box", + "layout": "vertical", + "contents": [ + { + "type": "image", + "url": "https://i.imgur.com/BNF0CiC.png", + "size": "full", + "aspectRatio": "20:13", + "aspectMode": "cover", + "animated": false, + "backgroundColor": "#FFFFFF00" + } + ], + "paddingAll": "none" + }, + "action": { + "type": "uri", + "label": "action", + "uri": "https://i.imgur.com/BNF0CiC.png" + } + } + }]; + + sendMessages(data); + } +} + +function makeDouDou() { + var type = getParameterByName("type"); + if (type === "豆豆") { + const data = [{ + "type": "flex", + "altText": "ㄟ, 我跟你說件事", + "contents": + { + "type": "bubble", + "size": "mega", + "body": { + "type": "box", + "layout": "vertical", + "contents": [ + { + "type": "image", + "url": "https://i.imgur.com/BNF0CiC.png", + "size": "full", + "aspectRatio": "20:13", + "aspectMode": "cover", + "animated": false, + "backgroundColor": "#FFFFFF00" + } + ], + "paddingAll": "none" + }, + "action": { + "type": "uri", + "label": "action", + "uri": "https://i.imgur.com/BNF0CiC.png" + } + } + }]; + + sendMessages(data); + } +} +function makeBW() { + var type = getParameterByName("type"); + if (type === "柏威") { + const data = [{ + "type": "flex", + "altText": "ㄟ, 我跟你說件事", + "contents": + { + "type": "bubble", + "size": "mega", + "body": { + "type": "box", + "layout": "vertical", + "contents": [ + { + "type": "image", + "url": "https://i.imgur.com/BNF0CiC.png", + "size": "full", + "aspectRatio": "20:13", + "aspectMode": "cover", + "animated": false, + "backgroundColor": "#FFFFFF00" + } + ], + "paddingAll": "none" + }, + "action": { + "type": "uri", + "label": "action", + "uri": "https://i.imgur.com/BNF0CiC.png" + } + } + }]; + + sendMessages(data); + } +} + function sendMessages(data) { if (liff.isInClient()) { liff.sendMessages(data).then(function () { @@ -216,6 +400,4 @@ function sendMessages(data) { document.getElementById("error").innerHTML = `你的 LINE App 暫時不支援 Share Target Picker`; } } - - } \ No newline at end of file