1
0
Fork 0

Compare commits

..

No commits in common. "16eef14e04e289722bbe6f4b13d90bc6960d4cce" and "51b1fa2b17ab3fa6b44a0a53e4b991d5f1f2afe7" have entirely different histories.

4 changed files with 6 additions and 38 deletions

View File

@ -27,9 +27,9 @@
"devDependencies": {
"elm": "^0.18.0",
"elm-live": "^2.7.4",
"elm-test": "^0.18.13",
"elm-test": "^0.18.3",
"gh-pages": "^0.12.0",
"rimraf": "^2.6.1",
"uglify-js": "^3.15.3"
"uglify-js": "^3.0.1"
}
}

View File

@ -212,8 +212,6 @@ span.applink {
display: block;
float: left;
width: 50px;
height: 50px;
object-fit: cover;
border-radius: 50%;
margin-top: 2px;
}
@ -1164,9 +1162,3 @@ audio.viewer-content {
height: 18px;
margin: 0 1px;
}
.emoji-custom {
width: 24px;
height: 24px;
vertical-align: bottom;
}

View File

@ -396,7 +396,7 @@ accountView subView currentUser accountInfo =
else
text ""
]
, span [ class "account-note" ] (formatContent account.note [] account.emojis)
, span [ class "account-note" ] (formatContent account.note [] [])
]
]
, fields subView account

View File

@ -1,6 +1,7 @@
module View.Formatter exposing (formatContent, textContent)
import Dict
import Elmoji
import Html exposing (..)
import Html.Attributes exposing (..)
import HtmlParser
@ -10,8 +11,6 @@ import Mastodon.Model exposing (..)
import String.Extra exposing (replace, rightOf)
import Types exposing (..)
import View.Events exposing (..)
import Regex
import Json.Encode
formatContent : String -> List Mention -> List Emoji -> List (Html Msg)
@ -120,32 +119,9 @@ toVirtualDomEach mentions emoji node =
text ""
-- VERY janky.
handleEmoji : String -> List Emoji -> Html Msg
handleEmoji s emojis =
span [ property "innerHTML" <| Json.Encode.string <| Regex.replace Regex.All shortcodeRegex (\{match} -> displayEmoji match emojis) <| s ] []
displayEmoji : String -> List Emoji -> String
displayEmoji s emojis =
case (lookupEmoji (String.slice 1 -1 s) emojis) of
Just emoji ->
"<img src=\""++emoji.url++"\" title=\""++s++"\" class=\"emoji-custom\">"
Nothing ->
s
lookupEmoji : String -> List Emoji -> Maybe Emoji
lookupEmoji shortcode emojis =
emojis
|> List.filter (\m -> m.shortcode == shortcode)
|> List.head
shortcodeRegex : Regex.Regex
shortcodeRegex =
Regex.regex ":[^:]*(?:::]*)*:"
handleEmoji s emoji =
Elmoji.text_ s -- todo
toAttribute : ( String, String ) -> Attribute msg