Log in

View Full Version : Javascript & CSS Highlighter



Master_script_maker
03-27-2009, 08:33 PM
Many people have been seeking this for javascript and css, so I have created a highlighter which will add colors. This is still a work in progress and is not efficient for long code, but it should work. Try it out: http://masterscriptmaker.co.cc/tools/hl.php

Snookerman
03-27-2009, 08:38 PM
Nice! This should be really useful here on the forums (Nile has really put a lot of work into highlighting his codes :D). It still has some quirks but I'm sure you'll get to them.

Master_script_maker
03-27-2009, 08:50 PM
Yeah. Actually If you look at his signature you'll see he has been using my highlighter.

Nile
03-27-2009, 08:53 PM
Yes, I have been snookerman. :D Now make a php one with the highlighting of Notepad++.

Give it a little style MSM. (http://www.smashingmagazine.com/2006/11/11/css-based-forms-modern-solutions/)

It also seems that I have to have indentation for the css one to work, so either run it through a beautifier, make a beautifier, or fix it. Lol. :D
Also, short hexed color funny (start with #), your regexp is probably wrong.

Maybe Ddadmin would be willing to make a little window at the top of the quick reply thing(like "Phrase Center"), having this. And at the bottom: made by Master_Script_Maker. :D

Master_script_maker
03-27-2009, 09:22 PM
I've fixed both css problems, and am now working of styling the form.

Nile
03-27-2009, 09:23 PM
I'll work on the styling if you like.

This (http://www.emblematiq.com/projects/niceforms/) looks pretty nice.

I made a little preview of it, if you want me to make it for you:
http://localhostr.com/files/87ae29/capture.png

Master_script_maker
03-27-2009, 09:48 PM
No thanks, I've already started. ;)

Nile
03-27-2009, 10:09 PM
Oh, I've finished. :D

Tell me if you like it:
http://localhostr.com/files/1a3fca/capture.png

Master_script_maker
03-28-2009, 04:30 PM
I made a style for it along with javascript to apply it, but yours looks nicer nile.

Snookerman
03-28-2009, 05:53 PM
This is a bit off topic. If you firebug the radio buttons, they disappear :eek:

Master_script_maker
03-28-2009, 06:05 PM
Yes, it seems like it does not fire the mouseover event. Clicking the text brings them back though.

Nile
03-29-2009, 01:49 AM
So, do you want it or not. :D

Master_script_maker
03-29-2009, 11:55 AM
No thanks.

Nile
03-29-2009, 02:58 PM
Ok. :D

boogyman
03-31-2009, 06:52 PM
This is a good idea, but I found a few bugs in the script. Please see the attached screen shots.

Schmoopy
03-31-2009, 06:53 PM
You'll need to upload them again in a higher resolution, can't make out what's going wrong.

Snookerman
03-31-2009, 06:55 PM
@boogyman - If you don't have a server: http://beta.localhostr.com/ (http://beta.localhostr.com/)

Master_script_maker
03-31-2009, 09:06 PM
I fixed the javascript part, and am totally rewriting the css part to be more efficient.

techietim
04-01-2009, 08:55 PM
This CSS code does not get highlighted correctly:


body{
background: url(my{FILE}.png);
}

Master_script_maker
04-01-2009, 09:07 PM
This is because of the { and }. The css portion is based on syntax and will break if the syntax seems to be incorrect (Notepad++ also breaks with your code).

techietim
04-01-2009, 09:18 PM
Yeah, I knew what was causing it, but it would be nice if it would colour it correctly, considering it is correct CSS.

Snookerman
04-01-2009, 09:35 PM
Is it really valid CSS?? I've never seen that before. What does it do?

Snookerman
04-01-2009, 09:51 PM
Yeah, I looked at that too but if you read it carefully it doesn't say curly braces aren't allowed. Also, the W3C CSS validator (http://jigsaw.w3.org/css-validator/) doesn't complain. I'm just curious to what it actually does.
Oops, I see you removed your post.

techietim
04-01-2009, 10:00 PM
Really? It's not valid?

Did you run it through here: http://jigsaw.w3.org/css-validator/#validate_by_input


body {
background : url(my{FILE}.png);
}

Master_script_maker
04-01-2009, 11:56 PM
@Snookerman: yeah, i was mistaken so i deleted it :p

I changed the css highlighter. It is now almost fully functional. The only part that is buggy is when you have comments inside the {}. Hopefully most of the bugs are gone now ;)

Snookerman
04-02-2009, 05:45 AM
Really? It's not valid?

Did you run it through here: http://jigsaw.w3.org/css-validator/#validate_by_input
I did run it through the validator and I had no errors:

the W3C CSS validator (http://jigsaw.w3.org/css-validator/) doesn't complain.
Then again, it doesn't throw an error for this either so I guess almost anything goes:

body {
background: url(my<-!?+*§~^½[{&%¤#@€µ:FILE:µ€@#¤%&}]½^~§*+?!->.png);
}
So I'm still curious techieteam, what does the code you posted do, what is it for?
Ahh.. now I get it, it's not CSS, it's just part of the name of the file, I tried renaming a file in Windows and I was allowed to use curly braces in the name.

boogyman
04-02-2009, 03:41 PM
You'll need to upload them again in a higher resolution, can't make out what's going wrong.

Most of the issues have since been resolved, however I did find the issues below.
And yes I know the background-image declaration won't validate.

http://localhostr.com/files/68c4b0/css.png

http://localhostr.com/files/68c4b0/css.png



@boogyman - If you don't have a server: http://beta.localhostr.com/ (http://beta.localhostr.com/)

Thanks, I do have a server, but I am having some technical hardware issues.

Master_script_maker
04-02-2009, 10:13 PM
Well you must end the values in a semicolon:
selector {property:value !important;}

div p#id.class:hover {background-image: url('/path/image.png') no-repeat left top;}

body > h2#id.class:first-child {overflow:hidden;text-decoration:underline;}

ul li, li + li {display:inline /* comment */;}

div:nth-of-type(n+2), p > span {property:value;} here is the highlighter's output:
selector {
property:value !important;
}
div p#id.class:hover {
background-image: url('/path/image.png') no-repeat left top;
}
body > h2#id.class:first-child {
overflow:hidden;
text-decoration:underline;
}
ul li, li + li {
display:inline /* comment */;
}
div:nth-of-type(n+2), p > span {
property:value;
}

Nile
04-03-2009, 12:09 PM
Someone dig this!