gideonsenku / Scriptable

A iOS app named Scriptable's scripts
844 stars 145 forks source link

更新[Env],增加对列表项 url 的支持 #37

Closed microud closed 3 years ago

microud commented 3 years ago

在兼容原来的 createWidget() 方法的基础上,增加了对链接跳转的支持,使用方法为传入结构为:

{
  text: 'raw text',
  url: 'target uri'
}

如改造 @evilbutcher 的 BilibiliMonitor.js 创建组件部分代码为:

const opts = {
  title,
  texts: {
    text1: { text: `• ${group[0].title}`, url: group[0].uri },
    text2: { text: `• ${group[1].title}`, url: group[1].uri },
    text3: { text: `• ${group[2].title}`, url: group[2].uri },
    text4: { text: `• ${group[3].title}`, url: group[3].uri },
    text5: { text: `• ${group[4].title}`, url: group[4].uri },
    text6: { text: `• ${group[5].title}`, url: group[5].uri },
    battery: "true",
  },
  preview,
  spacing,
};

let widget = await $.createWidget(opts);
evilbutcher commented 3 years ago

大佬🐂🍺

microud commented 3 years ago

@evilbutcher 我在调试 Bilibili、微博、豆瓣和知乎的跳转,等下提个 PR 😂

evilbutcher commented 3 years ago

@evilbutcher 我在调试 Bilibili、微博、豆瓣和知乎的跳转,等下提个 PR 😂

感谢大佬!!我太忙了没时间搞,大佬辛苦啦~