Man, I'm starting to get frustrated with Platypus + Greasemonkey. I'm sure that Greasemonkey works just fine, but Platypus is horrid. None of the changes I make are saved.
I'm slowly figuring out how to piece together a script without using Platypus, but I'm using the code Platypus generates to guide me.
If there's a kind soul out there who has made Greasemonkey scripts in the past and doesn't mind helping me, I'd like to convert the regex and string manipulation commands below from Visual Basic to Javascript. If you could get a fully functional script going, all the better.
Also, feel free to point out any mistakes I've made.
Code:
Public Function GetForcast(ByVal str As String) As String
Dim myMatch As Match
Dim myMatches As MatchCollection
myMatch = Regex.Match(str, "WINTHROP")
str = str.Substring(myMatch.Index())
myMatch = Regex.Match(str, "\n")
str = str.Substring(0, myMatch.Index())
str = str.Replace("<P>", "")
myMatch = Regex.Match(str, "-\d")
str = str.Substring(myMatch.Index() + 1)
str = str.Replace(". .", "..")
str = str.Replace("....", "<br><br><b>")
str = str.Replace("...", "</b><br>")
str = str.Replace("..", "<br><br><b>")
myMatch = Regex.Match(str, "M")
str = str.Insert(myMatch.Index() - 4, ":")
str = str.Insert(0, "<html><center><b><FONT FACE=""Verdana"" SIZE=""1"">")
str = str.Insert(str.Length, "</FONT></center></html>")
str = str.Replace(".", "<br>")
myMatches = Regex.Matches(str, "[A-Z]\d")
For Each myMatch In myMatches
str = str.Insert(myMatch.Index() + 3, " ")
Next
Return str
End Function
EDIT:
I finally fixed my Greasemonkey script and I have a pretty good result. The Visual Basic program, for some reason, let me control which text is bold and which is not with more fidelity, but I can't figure out how to get exactly the same result with the Greasemonkey script. Whatever, I did it. Hooray!
__________________