{
  "always_run_in_app" : false,
  "icon" : {
    "color" : "deep-blue",
    "glyph" : "theater-masks"
  },
  "name" : "Latest Hype Forum Posts",
  "script" : "\/**\n* Hype ScriptableActions Latest Posts 1.1\n* Fetch latest forum posts from Hype Forum\n* based on example script and tweaked from there.\n*\/\n\nlet forumURL = \"https:\/\/forums.tumult.com\"\nlet url = forumURL+\"\/posts.json\"\nlet req = new Request(url)\nlet json = await req.loadJSON()\nlet table = new UITable()\nlet posts = json.latest_posts\nfor (i = 0; i < posts.length; i++) {\n  let item = posts[i]\n  let row = new UITableRow()\n  row.onSelect = (idx) => {\n     let item = posts[idx]\n     Safari.open(forumURL+'\/t\/'+item.topic_id+'\/'+item.post_number)\n  }\n  let imageURL = item.avatar_template.replace('{size}', 240);\n  if (imageURL.indexOf('http')!=0) {\n     imageURL = forumURL+imageURL\n  }\n  let title = item.topic_title\n  let subtitle = '@'+item.username+' '+item.name\n  let imageCell = row.addImageAtURL(imageURL)\n  let titleCell = row.addText(title, subtitle)\n  imageCell.widthWeight = 20\n  titleCell.widthWeight = 80\n  row.height = 80\n  row.cellSpacing = 10\n  table.addRow(row)\n}\n\nQuickLook.present(table)\n\nif (config.runsWithSiri) {\n  Speech.speak(\"Here are the latest posts.\")\n}\n\nScript.complete()\n",
  "share_sheet_inputs" : [

  ]
}