diff --git a/src/View/Account.elm b/src/View/Account.elm index a2acc6f..3c75067 100644 --- a/src/View/Account.elm +++ b/src/View/Account.elm @@ -77,7 +77,7 @@ followButton currentUser relationship account = followView : CurrentUser -> Maybe Relationship -> Account -> Html Msg followView currentUser relationship account = div [ class "follow-entry" ] - [ Common.accountAvatarLink account + [ Common.accountAvatarLink False account , div [ class "userinfo" ] [ strong [] [ a @@ -152,9 +152,9 @@ accountView currentUser account relationship panelContent = ] [ div [ class "opacity-layer" ] [ followButton currentUser relationship account - , img [ src account.avatar ] [] + , Common.accountAvatarLink True account , span [ class "account-display-name" ] [ text account.display_name ] - , span [ class "account-username" ] [ text ("@" ++ account.username) ] + , span [ class "account-username" ] [ Common.accountLink True account ] , span [ class "account-note" ] (formatContent account.note []) ] ] diff --git a/src/View/Common.elm b/src/View/Common.elm index 9ac6482..5f8a068 100644 --- a/src/View/Common.elm +++ b/src/View/Common.elm @@ -14,23 +14,43 @@ import Types exposing (..) import View.Events exposing (..) -accountLink : Account -> Html Msg -accountLink account = - a - [ href account.url - , onClickWithPreventAndStop (LoadAccount account.id) - ] - [ text <| "@" ++ account.username ] +accountLink : Bool -> Account -> Html Msg +accountLink external account = + let + accountHref = + if external then + target "_blank" + else + onClickWithPreventAndStop (LoadAccount account.id) + in + a + [ href account.url + , accountHref + ] + [ text <| "@" ++ account.username ] -accountAvatarLink : Account -> Html Msg -accountAvatarLink account = - a - [ href account.url - , onClickWithPreventAndStop (LoadAccount account.id) - , title <| "@" ++ account.username - ] - [ img [ class "avatar", src account.avatar ] [] ] +accountAvatarLink : Bool -> Account -> Html Msg +accountAvatarLink external account = + let + accountHref = + if external then + target "_blank" + else + onClickWithPreventAndStop (LoadAccount account.id) + + avatarClass = + if external then + "" + else + "avatar" + in + a + [ href account.url + , accountHref + , title <| "@" ++ account.username + ] + [ img [ class avatarClass, src account.avatar ] [] ] closeablePanelheading : String -> String -> String -> Msg -> Html Msg diff --git a/src/View/Draft.elm b/src/View/Draft.elm index 7a8772d..381907e 100644 --- a/src/View/Draft.elm +++ b/src/View/Draft.elm @@ -78,8 +78,8 @@ currentUserView currentUser = case currentUser of Just currentUser -> div [ class "current-user" ] - [ Common.accountAvatarLink currentUser - , div [ class "username" ] [ Common.accountLink currentUser ] + [ Common.accountAvatarLink False currentUser + , div [ class "username" ] [ Common.accountLink False currentUser ] , p [ class "status-text" ] <| formatContent currentUser.note [] ] diff --git a/src/View/Notification.elm b/src/View/Notification.elm index eda5336..835da96 100644 --- a/src/View/Notification.elm +++ b/src/View/Notification.elm @@ -46,11 +46,11 @@ filterNotifications filter notifications = notificationHeading : List Account -> String -> String -> Html Msg notificationHeading accounts str iconType = div [ class "status-info" ] - [ div [ class "avatars" ] <| List.map Common.accountAvatarLink accounts + [ div [ class "avatars" ] <| List.map (Common.accountAvatarLink False) accounts , p [ class "status-info-text" ] <| List.intersperse (text " ") [ Common.icon iconType - , span [] <| List.intersperse (text ", ") (List.map Common.accountLink accounts) + , span [] <| List.intersperse (text ", ") (List.map (Common.accountLink False) accounts) , text str ] ] @@ -78,8 +78,8 @@ notificationFollowView currentUser { accounts } = let profileView account = div [ class "status follow-profile" ] - [ Common.accountAvatarLink account - , div [ class "username" ] [ Common.accountLink account ] + [ Common.accountAvatarLink False account + , div [ class "username" ] [ Common.accountLink False account ] , p [ class "status-text" , onClick <| LoadAccount account.id diff --git a/src/View/Status.elm b/src/View/Status.elm index 4577ce3..216fb26 100644 --- a/src/View/Status.elm +++ b/src/View/Status.elm @@ -217,7 +217,7 @@ statusView context ({ account, content, media_attachments, reblog, mentions } as Nothing -> div [ class "status" ] - [ Common.accountAvatarLink account + [ Common.accountAvatarLink False account , div [ class "username" ] [ a accountLinkAttributes [ text account.display_name