The base64 always starts with "g" so that's another character we can save
This commit is contained in:
parent
bc7227c5bd
commit
d9974a3288
|
@ -28,7 +28,7 @@ import List.Extra exposing (elemIndex, getAt)
|
||||||
import Maybe exposing (andThen)
|
import Maybe exposing (andThen)
|
||||||
import Maybe.Extra exposing (isJust)
|
import Maybe.Extra exposing (isJust)
|
||||||
import Result exposing (toMaybe)
|
import Result exposing (toMaybe)
|
||||||
import String exposing (fromInt, isEmpty, replace, toLower)
|
import String exposing (dropLeft, fromInt, isEmpty, replace, toLower)
|
||||||
import String.Extra exposing (isBlank)
|
import String.Extra exposing (isBlank)
|
||||||
import Svg exposing (path, Svg, svg)
|
import Svg exposing (path, Svg, svg)
|
||||||
import Svg.Attributes exposing (d, fill, height, stroke, viewBox, width)
|
import Svg.Attributes exposing (d, fill, height, stroke, viewBox, width)
|
||||||
|
@ -394,6 +394,7 @@ save model =
|
||||||
|> CE.encode
|
|> CE.encode
|
||||||
|> B64E.bytes
|
|> B64E.bytes
|
||||||
|> B64E.encode
|
|> B64E.encode
|
||||||
|
|> dropLeft 1
|
||||||
|> replace "=" ""
|
|> replace "=" ""
|
||||||
|> (++) "#"
|
|> (++) "#"
|
||||||
|> pushUrl model.browserKey
|
|> pushUrl model.browserKey
|
||||||
|
@ -401,6 +402,7 @@ save model =
|
||||||
load : Key -> Url -> Maybe Model
|
load : Key -> Url -> Maybe Model
|
||||||
load key url =
|
load key url =
|
||||||
url.fragment
|
url.fragment
|
||||||
|
|> Maybe.map ((++) "g")
|
||||||
|> andThen (B64D.decode B64D.bytes >> toMaybe)
|
|> andThen (B64D.decode B64D.bytes >> toMaybe)
|
||||||
|> andThen (CD.decode (loadModel key))
|
|> andThen (CD.decode (loadModel key))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue