Regedit FFH4x
Regedit FFH4x
Regedit FFH4x
title.textColor = Color.purple();
widget.addSpacer();
stack1.addSpacer();
widget.addSpacer();
stack2.addSpacer();
widget.addSpacer();
// 𝗩𝗲𝗿𝘀𝗶𝗼𝗻
let Text = widget.addText("𝐕𝐄𝐑𝐒𝐈𝐎𝐍 𝐕𝟔");
Text.textColor = Color.purple();
Text.rightAlignText();
//
if (config.runsInWidget) {
Script.setWidget(widget);
} else {
widget.presentMedium();
}
Script.complete();
function createTable(items) {
let table = new UITable()
for (item of items) {
let row = new UITableRow()
let imageURL = extractImageURL(item)
let title = decode(item.title)
let imageCell = row.addImageAtURL(imageURL)
let titleCell = row.addText(title)
imageCell.widthWeight = 20
titleCell.widthWeight = 80
row.height = 60
row.cellSpacing = 10
row.onSelect = (idx) => {
let item = items[idx]
Safari.open(item.url)
}
row.dismissOnSelect = false
table.addRow(row)
}
return table
}
function extractImageURL(item) {
let regex = /<img src="(.*)" alt="/
let html = item["content_html"]
let matches = html.match(regex)
if (matches && matches.length >= 2) {
return matches[1]
} else {
return null
}
}
function decode(str) {
let regex = /&#(\d+);/g
return str.replace(regex, (match, dec) => {
return String.fromCharCode(dec)
})
}