Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
3.3 kB
12
Indexable
var flexStruct = [
{
  "type": "flex",
  "altText": "Hymns",
  "contents":{
  "type": "carousel",
  "contents": []
    }
}
]

var flexHymnsStruct = [
{
  "type": "bubble",
  "size": "giga",
  "body": {
    "type": "box",
    "layout": "vertical",
    "contents": [
      
    ],
    "paddingAll": "0px"
  }
}
]

var flexHymnsListArr = []

var emptyArr = []
var emptyArr1 = []

var flexHymnItemArr = [
{
  "type": "box",
  "layout": "horizontal",
  "contents": [
    {
      "type": "box",
      "layout": "vertical",
      "contents": [

      ]
    },
    {
      "type": "box",
      "layout": "vertical",
      "contents": [

      ],
      "width": "40px",
      "height": "60px"
    }
  ],
  "position": "relative"
}
]

var flexHymnBoxArr = [
{
  "type": "box",
  "layout": "horizontal",
  "contents": [
  ],
  "position": "relative"
}
]

var flexHymnContentArr = [
{
  "type": "text",
  "contents": [
    {
      "type": "span",
      "text": "brown_05",
      "weight": "bold",
      "color": "#000000"
    },
    {
      "type": "span",
      "text": " ",
      "color": "#000000"
    },
    {
      "type": "span",
      "text": "I went to the Brown&Cony cafe in Tokyo and took a picture",
      "color": "#15bbe7"
    }
  ],
  "wrap": true
}
]

var flexHymnUriArr = [
{
  "type": "button",
  "action": {
    "type": "uri",
    "label": "u",
    "uri": "http://linecorp.com/"
  }
}
]

var flexSearchResultArr = [
{
  "type": "box",
  "layout": "horizontal",
  "contents": [
    {
      "type": "box",
      "layout": "vertical",
      "contents": [
        {
          "type": "box",
          "layout": "baseline",
          "contents": [
            {
              "type": "text",
              "text": "<<搜尋結果共>>"
            },
            {
              "type": "text",
              "text": "1,140,753",
              "size": "sm",
              "color": "#bcbcbc"
            }
          ]
        }
      ]
    }
  ],
  "spacing": "xl"
}
]

//////////////////////////////////////////////

function makeFlexMsg() {
  
  // var copyArr = flexHymnItemArr[0]
  flexHymnContentArr[0].contents[0].text = "55555"
  flexHymnContentArr[0].contents[1].text = "55556666"
  flexHymnContentArr[0].contents[2].text = "33445566"
  flexHymnUriArr[0].action.uri = "https://www.google.com"
  flexHymnItemArr[0].contents[0].contents = flexHymnContentArr
  flexHymnItemArr[0].contents[1].contents = flexHymnUriArr
  emptyArr1 = flexHymnItemArr
Logger.log(flexHymnItemArr)
Logger.log(emptyArr1)

  flexHymnContentArr[0].contents[0].text = "1111"
  flexHymnContentArr[0].contents[1].text = "11111111"
  flexHymnContentArr[0].contents[2].text = "11111111"
  flexHymnUriArr[0].action.uri = "https://www.google.com"
  flexHymnItemArr[0].contents[0].contents = flexHymnContentArr
  flexHymnItemArr[0].contents[1].contents = flexHymnUriArr
  emptyArr = emptyArr1.concat(flexHymnItemArr)
Logger.log(flexHymnItemArr)
Logger.log(emptyArr)


  for(var i = 0; i < emptyArr.length; i++) {
    flexHymnsStruct[0].body.contents[i] = emptyArr[i]
  }
  flexStruct[0].contents.contents[0] = flexHymnsStruct[0]


Logger.log(flexStruct)
}