[add] 登入後跳轉到一樣參數的分享

This commit is contained in:
建喵 2022-12-29 10:53:27 +08:00
parent 81d86648db
commit f6b10993cc
2 changed files with 202 additions and 19 deletions

View File

@ -1,5 +1,6 @@
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>JianMiau - LIFF</title>
<link rel="stylesheet" href="style.css">
</head>
@ -27,5 +28,5 @@
style="color: #3f3f3f;"><i><a href="https://ari-yk.github.io/" style="color: #3f3f3f; text-decoration: none;">Ari.</a> &copy; 2019</i></code>
</h3>
</center> -->
<script src="liff-starter.js"></script>
<script type="text/javascript" language="javascript" src="liff-starter.js" charset="utf-8"></script>
</body>

View File

@ -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,
"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",
"uri": "line://shop/sticker/detail/" + pkg
"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`;
}
}
}