<pluginname="NoteExtender"author="Crowley"id="c49e43d9dce931263263088b"language="Lua"purpose="Note output and hyperlinks"save_state="y"date_written="2022-03-09 11:02:09"requires="5.07"version="1.0"sequence="10">
while startIdx<= endIdx and not tbl[startIdx][1].text:find("~") and not tbl[strtIdx][1].text:find("No more new") do
table.remove(tbl, startIdx)
startIdx = startIdx + 1
end
while endIdx >= 1 and not tbl[endIdx][1].text:find("~") and not tbl[endIdx][1].text:find("There are no") and not tbl[endIdx][1].text:find("Changed to") do
table.remove(tbl, endIdx)
endIdx = endIdx -1
end
return tbl
end
function addToWindow(lines)
local lines = findBoundaries(lines)
NotesWin:clear(false)
NotesWin:add_text(lines, false)
@ -128,36 +114,8 @@ function addToWindow(lines)
end
function findBoundaries(lines)
local first_index = nil
local last_index = nil
-- Find the first and last indices with ~ in the text field
for i, v in ipairs(lines) do
if (string.find(v[1].text, "~") or string.find(v[1].text, "No more new posts")) and not first_index then
first_index = i
end
if (string.find(v[1].text, "~") or string.find(v[1].text, "There are no new")) then
last_index = i
end
end
-- Remove all the entries before the first ~ and after the last ~
if first_index and last_index then
for i = #lines, last_index + 1, -1 do
table.remove(lines, i)
end
for i = first_index - 1, 1, -1 do
table.remove(lines, i)
end
end
return lines
end
function hyperlinknotes(lines)
for i,v in ipairs(findBoundaries(lines)) do
for i,v in ipairs(lines) do
if i < 5ori ==#linesthen
Simulate(stylesToANSI(v) .. "\n")
else
@ -174,29 +132,36 @@ function hyperlinknotes(lines)
end
function toggleNoteWin(name, line, wildcards)
if wildcards[1] == "on" or wildcards[1] == "show" then