MyOwner.HashMgr.AddHashToHistory(hash.Trim, False)
MyOwner.AddNewTabForSearch(hash)
Exit Sub
- ElseIf e.Url.AbsoluteUri.StartsWith("http://twitter.com/") Then
- MyOwner.AddNewTabForUserTimeline(e.Url.AbsoluteUri.Remove(0, "http://twitter.com/".Length))
- Exit Sub
- ElseIf e.Url.AbsoluteUri.StartsWith("https://twitter.com/") Then
- MyOwner.AddNewTabForUserTimeline(e.Url.AbsoluteUri.Remove(0, "https://twitter.com/".Length))
- Exit Sub
Else
- MyOwner.OpenUriAsync(e.Url.OriginalString)
+ Dim m As Match = Regex.Match(e.Url.AbsoluteUri, "^https?://twitter.com/(#!/)?(?<name>[a-zA-Z0-9_]+)$")
+ If m.Success AndAlso MyOwner.IsTwitterId(m.Result("${name}")) Then
+ MyOwner.AddNewTabForUserTimeline(m.Result("${name}"))
+ Else
+ MyOwner.OpenUriAsync(e.Url.OriginalString)
+ End If
End If
End If
End Sub
' TwitterIDでない固定文字列を調べる(文字列検証のみ 実際に取得はしない)
' URLから切り出した文字列を渡す
- Private Function IsTwitterId(ByVal name As String) As Boolean
+ Public Function IsTwitterId(ByVal name As String) As Boolean
Return Not Regex.Match(name, "^(about|jobs|tos|privacy)$").Success
End Function