Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Nao
6886
Features / Re: New revs
« on December 13th, 2011, 03:12 PM »
rev 1193
(1 file, 8kb)

* More size optimizations in the jQuery-Proto area. Sometimes, using local variables to stand for strings will actually increase the size, not after packing the file but after gzipping it. Also, accessing an object property by dot compresses better than by brackets. Also removed support for $.getObject() and function throttling, since we don't use these plugins. Removed 'above' class from drop-up list boxes (i.e. when it opens from the bottom), until I have a good reason to style that. Will probably re-introduce later. Gzipped size for sbox.js is now down to 2941 bytes[1]. (sbox.js)
 1. As a reminder, I started at 3579 bytes, and that's without removing any features -- only removed the ability to change some uninteresting features on the fly. Also, jquery.selectBox.js compresses at 2977 bytes so it's as if I'd started with this one, compressed it even more and added the extra features from the plugin I eventually chose...
6887
Off-topic / Re: I couldn't sleep
« on December 13th, 2011, 11:44 AM »
I went through Thomson TO7/70 (2 years) -> Atari 520 STF (3 years) -> Amiga 500 (a few months) -> Macintosh 68k (a few weeks) -> PC (a few decades), myself...

My favorite is still the Atari so I'm gonna kill y'all in good spirit :P
6888
Features / Re: New revs
« on December 13th, 2011, 11:42 AM »
rev 1192
(2 files + 1, 33kb)

+ Added select box code. Forgot it in the last commit... The starting comment has /** instead of /*! because it's added to script.js so we don't need the duplicate copyright lines in the packed version. (sbox.js, Load.php)

* Use proper nesting on select box styling. Added some padding around the list box. (index.css)
6889
Features / Re: New revs
« on December 12th, 2011, 11:33 PM »
rev 1191
(3 files + 3, 13kb)

+ Added first working version of the select box replacement. Needs more work, as usual, but it works and it gzips to ~3KB. (Load.php, script.js, index.css, images/select_arrow*.gif)
6890
Features / Re: Thought system
« on December 12th, 2011, 07:39 PM »
- It was fixed and working great, at least when I last dealt with it... i.e. it must have broken after that, while fixing something else in an unrelated place. Can you confirm and look into it?

- Just to be clear: if I ever commit "work in progress" code with shitty commented out stuff, it is NOT as planned, unless I'm clearly specifying it in the changelog (I usually apologize for this kind of thing.) I also found out that rev 1186 has my work-in-progress script.js committed... Just the same: it's shitty and not as planned. And again, it's not mentioned in the changelog.

Every time you commit something, I'll make sure to ensure you haven't committed any 'weird' stuff that's not in the changelog, and if there is, I'll ask you about it... I can do that kind of mistake, too, so I was kinda hoping someone was checking on my commits...
6891
Features / Re: Selectbox
« on December 12th, 2011, 07:09 PM »
Well, it's not like sb's source code is gonna disappear overnight anyway... There's plenty of code in it that's too "general" for my taste. For instance, it includes a library called jQuery-Proto that adds some nifty features to JS "classes". That's all good, but it also adds plenty of options that, ahem, aren't used by the SB object at all... So I simply deleted them all, restarted, and it still works... And is much lighter.

Now we're about at 3150 bytes, so that's over 500 bytes less than when I got started. I hope I can actually remove even more...
6892
Features / Re: Thought system
« on December 12th, 2011, 06:03 PM »
Oh my... It would appear the little f*cker is dead.

I don't know why or how. It just doesn't register when I edit or type in a new thought.

Can anyone who tested the thought system (on a local copy) so far give me some feedback on this...? Did you ALWAYS see that issue? Send a thought -> the return copy is empty and nothing is entered into the DB. No errors either...
I really don't want to bother with Ajax debugging right now :(
Posted: December 12th, 2011, 06:01 PM

Oh, and I also messed up rev 1179... It was last month already -- and I committed a file that wasn't supposed to be (index.css), with selectbox styling for a feature that wasn't even in...

Pete or anyone, when you see that kind of file and it's NOT documented, can you report it please...? It usually means I forgot to uncheck a file that's not ready for consumption... (And yes I do have a fair share of files I have to uncheck every time. Pretty annoying really. But if I start putting them on Ignore, I'll just forget to deal with them in the future...)
6893
Features / Re: Selectbox
« on December 12th, 2011, 05:17 PM »
Removed another 100 bytes... I'm starting to consider removing options we don't/won't need. For instance -- support for TIE. It's a plugin that will check the DOM for changes and report them to sb so that it can update the selectbox. However, I'd rather have full control over this and simply trigger sb's update process myself whenever I do changes to the select box... What do you think?
Also has some options like 'displayFormat' which allows you to customize the display... Only, it's not like we're releasing a selectbox plugin... We're simply using it in Wedge. I don't see any reasons to change the HTML outside of the (modified) plugin itself. Do you?
6894
Features / Re: Selectbox
« on December 12th, 2011, 04:32 PM »
This one's funny, too...
(packed version)

var b,e,h,b=c(this);

Realized my mistake, turned it into this...

var e,h,b=c(this);

And voilà! 3 extra bytes to the filesize, ah ah...
6895
Features / Re: Selectbox
« on December 12th, 2011, 03:57 PM »
As I said, I do remember our conversation :P

I simply tried to apply that philosophy to the code and it simply didn't make any sense... Obviously after seeing the param stuff, I looked for other similar functions and didn't find any. Even better -- $(this).each(...) isn't needed, you can simply do this.each(...) in prototypes, but it also adds more bytes... So I went ahead and changed all of the $(this).each() to this.each(), still the same, then I simply went through all $(this) and this, and there were far more this than $(this), actually if I simply used (this) instead of $(this), I'd end up with the same filesize as with $(this)... It would only go up when doing this with nothing else. That's really... funny, in a kind of way.

Anyway, it's only a few bytes so I'm just not going to bother either way...
The best way to save space is to removed dead functions and things like that. There were quite a few in this plugin!

Psychologically, one of my goals is to have the main javascript file under 10KB when zipped. With the original code, it was just a bit over 10KB. Now it sits comfortably under 10KB and I guess I can optimize script.js itself in more ways, too ;)
6896
Features / Re: Selectbox
« on December 12th, 2011, 02:23 PM »
Bump on the above... :whistle:

So, now that I'm done with mismatched tags, I'm trying to get back into the select box stuff.
Decided to try for jquery.sb.js for now, and try to optimize the size (since it's really the only thing I have against it.)

Pete, you remember the discussion we had on the oddities of gzipping? Well, it's back in full force...

something = function (event, params) { otherthing.call(event, params); };

So... I figured out that params was never used, so I removed both params calls.
As a result, the gzipped file is 5 bytes larger. Ah ah.

Now... I have plenty of if (...) { one_instruction(); } in the code. I removed the curly braces. As a result, the more braces I remove, the LARGER the gzipped file becomes.
Okay, so I figured, if it's crazy enough to do things like that, let's tag along and add a preg_replace[1] to add curly braces to all single-line tests...
And guess what? It's the exact same size as before it was modified. I looked into it a bit more, and there's just TWO cases where removing the curly braces will make the file bigger, while in other situations it'll usually save a byte.

Anyway, I'm pretty much done and saved about 350 bytes off the original ~3700 bytes. It's not fantastic, but at least it's getting closer to the other selectboxes, and with the extra features.

Now it's going to be realllllly funny when I actually try to run the plugin on Wedge... Yeah, I didn't even try :P
Posted: December 12th, 2011, 01:51 PM

And... it works :)
 1. for the record, preg_replace('~(\tif \([^{}\n]+\n\t+)([^{}\n]+);(\n)~', '$1{$2}$3', $cont)
6897
Off-topic / Re: I couldn't sleep
« on December 12th, 2011, 01:54 PM »
Quote from Arantor on December 11th, 2011, 10:42 PM
Hmm, I've never played the proper Mahjongg game, though I've heard about it.
It's like a mix between (a bit of) poker and (a lot of) gin rummy, only much more complex and, thus, more interesting. Only problem is, every country (or even region...) has their own custom rules, so it's hard to say what you like etc. I know for a fact that I like the official Chinese rules best, but the Hong Kong and Japan variants are interesting, too!
Quote
Seems like if you found a game you'd love to write and play you'd be well away!
I loved writing it... I just didn't love playing it as much as in the early 90's.
Perhaps because I couldn't help but think of WORK when playing these games? :P

Probably will be the same with any other game, really...
6898
Features / Re: Fixing mismatched BBCode
« on December 12th, 2011, 12:02 AM »
I'll leave it up to you to look into all of this... I feel I have done my share of the work on this for now! :P
6899
Features / Re: New revs
« on December 12th, 2011, 12:01 AM »
rev 1190
(2 files, 1kb)

+ Added php tags to the list of special blocks. (Class-Editor.php)

! php tags should be block-level, while s tags shouldn't be. (install.sql)

! Fixed footnote tags breaking layout when used in code tags. Should also test for other tags... (Class-Editor.php)
6900
Features / Re: Fixing mismatched BBCode
« on December 11th, 2011, 11:45 PM »
Okay, done...

I've made so many tests using my test code, it should really be okay at this point... But you never know.
Also, I need to fix that bug with nb parsing... Grmpf. It's like it never ends... And my code is pretty useless -- I mean, the auto-fixer doesn't really have a point because parse_bbc already accounts for most errors...