Arc Forumnew | comments | leaders | submit | markkat's commentslogin
1 point by markkat 5373 days ago | link | parent | on: Noobing with news.arc

I wasn't sure if this warranted a new submission, so I am just adding it here for now:

Continuing my news.arc mods, I am currently trying to create a 'hover-over' effect on the .comhead that isn't just text-style, but pulls up the top comment in a popup. For example, ATM, the comment of fallintothis would popup onmouseover on the mainpage. I might be over my head here yet, but any pointers would be appreciated.

-----

1 point by rocketnia 5373 days ago | link

It sounds like you're talking about what forums usually accomplish using the HTML "title" attribute. Doing it in JavaScript lets your bubble be more stylish, and there might even be a way to do stylish bubbles using just CSS (having a separate :hover style or something, with the regular style hiding the children), but "title" should be the easiest to try first:

  <a href="http:..." title="Agreed.">Ask so-and-so: ...</a>
Something you might find convenient here is Arc's 'ellipsize function, which shortens long strings and puts ... at the end.

-----

1 point by markkat 5372 days ago | link

Thanks. Struggling with it, but I'll keep at it. Will title really work if I am referencing a call to comment text? I'm going to give the :hover route a shot. Not too worried about style though. :)

Ellipsize will definitely come in handy. Thanks for the tip.

-----

1 point by markkat 5370 days ago | link

Hm. This is breaking my brain. I can create a td class for comments that enables an independent hover effect, but I get a large space in the preceding subtext class cell, which I can't seem to resolve.

Using spanclass the spacing is conserved, but I only get some attributes onto the comment, but not hover. Here's where I am working, with a spanclass comref that only seems to be able to override the color of the subtext class.

  (def commentlink (i user)
    (when (cansee user i) 
      (pr bar*)
      (tag (a href (item-url i!id))
        (let n (- (visible-family user i) 1)
          (if (> n 0)
              (spanclass comref
              (do (pr (plural n "comment"))
                  (awhen (and show-threadavg* (admin user) (threadavg i))
                    (pr " (@(num it 1 t t))"))))
              (pr "Add comment"))))))
I tried to define an ID class, but #class doesn't seem to work as a declaration? Not sure if it is a failing of my CSS, Arc, or both. :/

If anyone has an idea how to create a hover effect on comments when n<0, please throw me a bone. :)

-----

2 points by akkartik 5372 days ago | link

One suggestion: position the popup to the right of the main panel (like on google search)

-----

1 point by markkat 5372 days ago | link

That is a great idea. I have no clue how to do it, but I am trying... Like I said, I am a noob.

I often find myself clicking through to comments on HN and reddit, just curious to see what the highest rated one is. -I thought it be nice to be able to save the trip.

I've set out to refashion news.arc in my own way, and teach myself some programming along the way. I'll share it once I'm done. So far I am enjoying it. Arc is a bit terse, but clear once I can get a handle on a concept. Slowly, I am getting familiar with it. I've been able to modify karma from a point system into a type of currency on my own, and I am pretty happy at that.

-----

2 points by markkat 5377 days ago | link | parent | on: Noobing with news.arc

Wow. Thanks for such a thorough response! Funny, I had 'last-log' in the deftem profile, and was tweaking ensure-news-user. I couldn't get it working, but's nice to know I was tweaking in the right places. BTW, your interpretation of what I meant by 'new day' was spot on.

I am going to spend some time trying this out. Thank you. I'll let you know how it goes.

-----

1 point by markkat 5376 days ago | link

Thanks again. Based on the login issue shader pointed out, I decided to change things up a bit, and ++ karma if it is a new day, and the user comments or replies. This is what I did, and it seems to work. I started with process-comment:

  (deftem profile
  ...
  karmadate nil
  ...
  )

  (def process-comment (user parent text ip whence)
  ...
         (day-karma user)
         whence)))

  (def day-karma (u)
    (when (~iso (date) (uvar u karmadate))
      (++ (karma u))
    (update-karmadate u)))

  (def update-karmadate (u)
    (= (uvar u karmadate) (date))
    (save-prof u))
But now looking at akkartik's

  (unless (is (date) (uvar u last-login))
    (++ karma.u)
    (= (uvar u last-login) (date)))
Maybe I'll go for that. BTW, karma.u what's up with the . ?

-----

3 points by shader 5376 days ago | link

Arc has a feature called "ssyntax", short for symbol syntax, that allows us to use certain characters in a symbol as shorthand for a commonly used longer form.

In this case, "karma.u" expands to (karma u), which is a macro that looks up the users karma. Functions applied to single arguments are extremely common in arc, so it is quite useful to have an abbreviation.

Other ssyntax include:

  a!b -> (a 'b)
  ~a -> (no a)
  a~b -> (compose a (no b))
  a:b -> (compose a b) ;(a:b c) is equivalent to (a (b c))

-----

1 point by markkat 5376 days ago | link

Ah... thanks. Great way to throw noobs like me off though. :) I was wondering about the colon too, I couldn't find an explanation anywhere.

-----

1 point by akkartik 5376 days ago | link

Don't forget to replace is with iso like rocketnia pointed out.

-----

1 point by markkat 5376 days ago | link

Will do. Thanks for that.

-----