Code Line Numbers

Line numbers for code ;)

  • (5 Pages)
  • +
  • 1
  • 2
  • 3
  • 4
  • 5

63 Replies - 4676 Views - Last Post: 05 July 2010 - 07:52 AM

#31 JackOfAllTrades   User is offline

  • Saucy!
  • member icon

Reputation: 6260
  • View blog
  • Posts: 24,030
  • Joined: 23-August 08

Re: Code Line Numbers

Posted 10 June 2010 - 11:06 AM

Doesn't look like it from the changelog. The greasemonkey script written by Atli works very well. I modified it so it only numbers scripts with more than 10 lines, but otherwise functions extremely well.
Was This Post Helpful? 0
  • +
  • -

#32 moopet   User is offline

  • binary decision maker
  • member icon

Reputation: 345
  • View blog
  • Posts: 1,190
  • Joined: 02-April 09

Re: Code Line Numbers

Posted 13 June 2010 - 02:40 PM

View Postskyhawk133, on 10 June 2010 - 04:04 PM, said:

That's the one we're using moopet. Have they updated it any to include line numbers and such?


I think... I think that somewhere in the middle of me typing away I forgot what the OP was. So no :)
Was This Post Helpful? 0
  • +
  • -

#33 moopet   User is offline

  • binary decision maker
  • member icon

Reputation: 345
  • View blog
  • Posts: 1,190
  • Joined: 02-April 09

Re: Code Line Numbers

Posted 25 June 2010 - 02:27 PM

I just noticed that code now has numbers and is full width. Outstanding!
Was This Post Helpful? 0
  • +
  • -

#34 eZACKe   User is offline

  • Garbage Collector

Reputation: 120
  • View blog
  • Posts: 1,278
  • Joined: 01-June 09

Re: Code Line Numbers

Posted 25 June 2010 - 02:28 PM

Just me or is the code taking a little while to load now?
Was This Post Helpful? 0
  • +
  • -

#35 skyhawk133   User is offline

  • Head DIC Head
  • member icon

Reputation: 1981
  • View blog
  • Posts: 20,434
  • Joined: 17-March 01

Re: Code Line Numbers

Posted 25 June 2010 - 02:30 PM

You guys are gonna have to pick your battles. Yes, the code takes a while to "highlight" because the syntax highlighter has to come back in and edit all of it in the DOM. I've tried to set it up so it "falls back" gracefully until the syntax highlighter loads.


Please though, provide feedback. It looks like it's working much better than the original version of the script, and I think it provides most of the functionality everyone wanted, the only drawback is it is a bit slower because it's a MUCH more heavyweight script (lots more going on in the background)
Was This Post Helpful? 0
  • +
  • -

#36 m-e-g-a-z   User is offline

  • Winning
  • member icon


Reputation: 497
  • View blog
  • Posts: 1,457
  • Joined: 19-October 09

Re: Code Line Numbers

Posted 25 June 2010 - 02:33 PM

I found it to load ok, although, it would be good if there was some sort of scroll bar for the code itself as some people post long bits of code. Looking good though, especially being able to copy the full code onto the clipboard without line numbers :^: .
Was This Post Helpful? 0
  • +
  • -

#37 eZACKe   User is offline

  • Garbage Collector

Reputation: 120
  • View blog
  • Posts: 1,278
  • Joined: 01-June 09

Re: Code Line Numbers

Posted 25 June 2010 - 02:34 PM

I like it too, but have to agree a scroll bar could be nice. Having 400 lines of code without a scroll bar can be a little excessive.
Was This Post Helpful? 0
  • +
  • -

#38 Atli   User is offline

  • Enhance Your Calm
  • member icon

Reputation: 4241
  • View blog
  • Posts: 7,216
  • Joined: 08-June 10

Re: Code Line Numbers

Posted 25 June 2010 - 02:51 PM

It doesn't seem to highlight much, though. Just look at the Javascript on page 2 of this thread. It doesn't even highlight the comments.
Was This Post Helpful? 0
  • +
  • -

#39 KingCuddles   User is offline

  • D.I.C Regular

Reputation: 176
  • View blog
  • Posts: 496
  • Joined: 20-December 08

Re: Code Line Numbers

Posted 25 June 2010 - 02:54 PM

View Postskyhawk133, on 25 June 2010 - 01:30 PM, said:

You guys are gonna have to pick your battles. Yes, the code takes a while to "highlight" because the syntax highlighter has to come back in and edit all of it in the DOM. I've tried to set it up so it "falls back" gracefully until the syntax highlighter loads.


Please though, provide feedback. It looks like it's working much better than the original version of the script, and I think it provides most of the functionality everyone wanted, the only drawback is it is a bit slower because it's a MUCH more heavyweight script (lots more going on in the background)



Sadly I am finding it MUCH slower than before, although I will admit it does look sexy as hell.

But if there was a poll on the matter speed would get my vote as at the minute pages are taking wayyy to long to load, and I have the attention span of an fish :).
Was This Post Helpful? 0
  • +
  • -

#40 skyhawk133   User is offline

  • Head DIC Head
  • member icon

Reputation: 1981
  • View blog
  • Posts: 20,434
  • Joined: 17-March 01

Re: Code Line Numbers

Posted 25 June 2010 - 03:03 PM

I think right now the new one is waiting till everything on the page finishes before it runs, this includes ads, scripts, etc.

Let me see if I can make it load right away.
Was This Post Helpful? 1
  • +
  • -

#41 macosxnerd101   User is offline

  • Games, Graphs, and Auctions
  • member icon




Reputation: 12800
  • View blog
  • Posts: 45,992
  • Joined: 27-December 08

Re: Code Line Numbers

Posted 25 June 2010 - 05:08 PM

One thing I noticed is that inline comments aren't highlighted differently, and they run onto different lines. See the below screenshot, with the comment selected by my cursor.

Attached Image

I'm not sure if this happens with multi-line comments, but I'll test it out:
/* This is a test.
This is a test. 
This is a test.
This is a test.
*/

public class HelloWorld{
   public static void main(String[] args){
       System.out.println("Hello, world!");
   } //end main()
} //end class


This post has been edited by macosxnerd101: 25 June 2010 - 05:09 PM

Was This Post Helpful? 0
  • +
  • -

#42 AdamSpeight2008   User is offline

  • MrCupOfT
  • member icon

Reputation: 2298
  • View blog
  • Posts: 9,535
  • Joined: 29-May 08

Re: Code Line Numbers

Posted 25 June 2010 - 11:27 PM

View Postskyhawk133, on 10 June 2010 - 02:43 AM, said:

The only issue I can find is that it seems you HAVE to specify a language. I'm looking through the BBCODE documentation to see if I can dynamically populate the "brush" (language) some how.

Any other suggestions/scripts that you've seen in the wild, especially on forums?


What about having a similar method to the member button? Only this time it is a list of languages. There must be a way of dynamically specifying the brush, the default being the PlainText one.

Edit: Something like this (it's in Italian)
Edit: and this
Was This Post Helpful? 0
  • +
  • -

#43 moopet   User is offline

  • binary decision maker
  • member icon

Reputation: 345
  • View blog
  • Posts: 1,190
  • Joined: 02-April 09

Re: Code Line Numbers

Posted 26 June 2010 - 01:43 AM

View PostKingCuddles, on 25 June 2010 - 08:54 PM, said:

View Postskyhawk133, on 25 June 2010 - 01:30 PM, said:

You guys are gonna have to pick your battles. Yes, the code takes a while to "highlight" because the syntax highlighter has to come back in and edit all of it in the DOM. I've tried to set it up so it "falls back" gracefully until the syntax highlighter loads.


Please though, provide feedback. It looks like it's working much better than the original version of the script, and I think it provides most of the functionality everyone wanted, the only drawback is it is a bit slower because it's a MUCH more heavyweight script (lots more going on in the background)



Sadly I am finding it MUCH slower than before, although I will admit it does look sexy as hell.

But if there was a poll on the matter speed would get my vote as at the minute pages are taking wayyy to long to load, and I have the attention span of an fish :).


For at least the last couple of months DIC pages have been often taking ~20 seconds to load for me (at home and at work) so I haven't noticed anything different with the pretty code.
Was This Post Helpful? 1
  • +
  • -

#44 jaydscape   User is offline

  • New D.I.C Head

Reputation: -10
  • View blog
  • Posts: 21
  • Joined: 25-June 10

Re: Code Line Numbers

Posted 26 June 2010 - 02:11 AM

Easy enough just to click the view source. Then copy that. I use FF maybe it's different on other browsers.
Was This Post Helpful? 0
  • +
  • -

#45 KingCuddles   User is offline

  • D.I.C Regular

Reputation: 176
  • View blog
  • Posts: 496
  • Joined: 20-December 08

Re: Code Line Numbers

Posted 26 June 2010 - 04:01 AM

View Postmoopet, on 26 June 2010 - 12:43 AM, said:

For at least the last couple of months DIC pages have been often taking ~20 seconds to load for me (at home and at work) so I haven't noticed anything different with the pretty code.


It has also stopped taking ages for me as well :).
Was This Post Helpful? 0
  • +
  • -

  • (5 Pages)
  • +
  • 1
  • 2
  • 3
  • 4
  • 5