andrewb icon

ll_client1.r

andrewb | PRO | 09/18/15 02:32:16 AM UTC | 0 ⭐ | 11380 👁️ | Never ⏰ | []
REBOL |

1.14 KB

|

None

|

0 👍

/

0 👎

rebol [
    Title: "Lady Lawful Client"
    Version: 0.1
    Purpose: [To learn a bit more about REBOL.]
]
 
prtz: []
 
get-ll-json: func [jurl] [
  json: read jurl
  parts: parse json {[{" "} "," ":"]}
  clear prtz
  foreach [p] parts [
    if not zero? length? p [ append prtz p ]
  ]
  prtz
]
 
getPic: func [gurl] [ to-image (load-image (load to-string gurl)) ]
 
getPrev: func [] [ get-ll-json http://ladylawful.com/prev ]
 
getNext: func [] [ get-ll-json http://ladylawful.com/next ]
 
getCurrent: func [] [ get-ll-json http://ladylawful.com/img ]
 
picFull: func [ json ] [ json/2 ]
 
picSmall: func [ json ] [ json/4 ]
 
picThumb: func [ json ] [ json/6 ]
 
setSize: func[ pic ] [
    tx: pic/size/x + 20
    ty: pic/size/y + 20
    to-pair (as-pair tx ty)
]
 
refreshPic: func [w i n] [
    i /clear
    i/size: n/size
    set-face i n
    w/size: setSize n
    show w
]
 
v1: layout [
  at 10x10 b: image getPic picSmall getCurrent
  at 10x10 btn "PREV" [
    refreshPic v1 b getPic picSmall getPrev
  ]
  at 60x10 btn "NEXT" [
    refreshPic v1 b getPic picSmall getNext
  ]
  at 110x10 btn "QUIT" [quit]
]
 
view v1

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎