<!-- Saved on Wednesday, March 09, 2022, 11:04 AM -->
<!-- MuClient version 5.07-pre -->
<!-- Plugin "RoomCharWindow" generated by Plugin Wizard -->
<muclient>
<plugin
name="NoteWindow"
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"
>
<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
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
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
-- 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
return tbl
end
return lines
function addToWindow(lines)
local lines = findBoundaries(lines)
NotesWin:clear(false)
NotesWin:add_text(lines, false)
NotesWin:fit_contents(850, 500)
NotesWin:set_scroll(1)
NotesWin:show()
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,26 +132,33 @@ function hyperlinknotes(lines)
end
function toggleNoteWin(name, line, wildcards)
if wildcards[1] == "on" or wildcards[1] == "show" then