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
6826
Features / Re: Selectbox
« on December 21st, 2011, 08:30 PM »
Oh, well... I'll have to give up on that for now. I spent most of the day trying to tie the scrollbar into the select box, and it just won't cooperate.

I think... I think the CSS for the select box might need a rewrite first. And something is telling me that I'll break the stuff, and then go back to what it was, and give up altogether on the custom scrollbar...
Even if it's only 600 bytes, it's 600 high-maintenance bytes, a bit like my super-menu code...
6827
Features / Re: New revs
« on December 21st, 2011, 09:18 AM »
rev 1209
(1 file, 3kb)

@ And... Down to 2305 bytes. Ah ah. In order to lose the extra 46 bytes, I add to lose a few feat... Oh, sorry, I mean I fixed bugs and added stuff.

+ Custom option classes should now be correctly transferred to their HTML equivalent, in addition to their already transferred styles. (sbox.js)

! Fixed and simplified item navigation through letter typing: stroke an 'e' and it'll find the first item that starts with an e; hit 'e' again and it'll move onto the next item starting with an 'e', repeatedly until it resets to the first 'e' again. (sbox.js)
6828
Features / Re: Selectbox
« on December 21st, 2011, 12:14 AM »
Okay, second case then!
Maybe I can use the extra space to add a scrollbar replacement plugin... :P

I looked into it, found one (here), about 1KB minified and gzipped, reduced to 600 bytes with my usual talent at crushing bytes (?!), it even supports touch events, unfortunately after all this work, I realized it required adding some shitty extra html like empty divs and such... (Yeah, I know, I can add these through JS too... I just don't think it's very neat to even do it that way. Really, the only redeeming feature is the small size :P)
Any™ opinions™?
6829
Features / Re: Selectbox
« on December 20th, 2011, 09:21 PM »
So... I've got this little thing going on with keyboard navigation, where the original code is completely broken, and my new code is a bit less broken, and my uncommitted code actually works, but I don't know if it's behaving the best possible way...

Basically, I could handle non-special keystrokes in two possible ways.

1/ I hit 'e' and the list is positioned to the first item with an 'e'. I hit 'e' again and it doesn't move until I hit another letter which redirects me to that one, etc. It's basically the default select box behavior I've always seen... Natural, but not very practical.

2/ I hit 'e' and the list is positioned to the first item with an 'e'. I hit 'e' again and it gets positioned to the next item starting with an 'e'. I hit 'e' again and it gets reset to the first item if there's no other 'e' in the list. It's the intended behavior in this selectbox plugin, apparently it is also the default selectbox behavior but I've never seen that happen... Also, the selectbox plugin simply doesn't do that at all.

3/ I hit 'e' and the list is positioned to the first item with an 'e', e.g. 'ebony'. I hit 'e' again and it gets positioned to the first item starting with an 'ee' (notice the two here), or anything AFTER 'ee', e.g. 'elephant'. I hit 'e' again and it stays there because at this point it's looking for 'eee' and there's nothing before 'elephant' anyway.

The 3rd case is probably less natural, BUT it pretty much behaves like a combobox, where you get an extra field that shows you what you've typed, as a 'hint', so basically:

4/ behave like a combo box, i.e. add a temp field somewhere that shows what you've typed, and allow the user to hit Backspace to go back one letter. Obviously, this one will take a bit more time to develop, and a bit more space in the final file... (It could possibly even take 500 extra bytes... Considering the time I spent on saving that extra 1.3KB from the original code, it'd be upsetting for me.) And for something which I'm not sure would be used by anyone at all.

So... Anyone has a favorite in the list?
6830
The Pub / Re: Logo Madness
« on December 20th, 2011, 08:04 PM »
(Bump for more votes. 20 would be good.)
6831
Features / Re: New revs
« on December 20th, 2011, 08:02 PM »
rev 1208
(1 file, 2kb) (although it's about on par with last commit's size... Don't ask.)

+ Seriously improved keyboard usability. It's actually even better than the default select box, if you'll ask me. Press space to unfold the list box (I don't know of any keyboard shortcut to do that in a default), press Tab to switch to the next HTML element -- and yes, it works correctly in both opened and closed states, and press Backspace or Return to confirm a selected entry and close the current select box without submitting the form. If the box is already closed, pressing Return will submit the form.

* Replaced select box's random number with a unique ID that gets increased as required (inside lists). (sbox.js)

* Merged selectNextItemStartsWith and selectMatchingItem. They pretty much both did the same thing... It's still buggy though, but just so you know... The original code actually didn't work at all, so it's an improvement already. (sbox.js)

- Removed select box's destroy method. There's no need for that externally, is there? (sbox.js)

* Even with all of the keyboard shortcut additions, still managed to go from 2386 to 2351... I eat bytes for breakfast. (And if you're French: I said bytes, with a y.) (sbox.js)
6832
Features / Re: New revs
« on December 20th, 2011, 07:04 PM »
rev 1207
(1 file, 4kb)

! Fixed automatic quote splitter: tags like  wouldn't break correctly. (Thanks dorje for the report!) (post.js)
! Fixed automatic quote splitter: mixed case tags would sometimes fail to break. (post.js)
! Fixed automatic quote splitter, what else? Protected and closed tags would break in some situations, too. It's not perfect yet (except for closed tags), but it's close enough. If you type in broken code, it's your problem. (post.js)

@ The modified code is actually shorter than before :P Also, I commented it this time...
6833
Features / Re: New revs
« on December 20th, 2011, 03:31 PM »
rev 1206 (the script.js optimization commit.)
(8 files, 9kb)

* Rewrote the menu system into a closure, and initMenu() into a jQuery pseudo-plugin with the syntax $('#menu').menu(), which is a bit cooler. And saves me from dealing with uncompressed variable/function names. (GenericMenu.template.php, index.template.php, script.js)

- Oh, and closures don't systematically need a jQuery reference... That's only if we're using another library that hijacks the $ sign. It's very unlikely, so off we go. (script.js)

- Removed isEmptyText() to save bandwidth, because it's not used in a lot of places and the code can actually be shortened by not using it. For instance, "isEmptyText(this) || this.value == 0" is equivalent to "$.trim(this.value) == 0". (ManageBoards.template.php, Poll.template.php, Post.template.php, script.js, suggest.js)

* Moved we_setThemeOption into the weToggle object, as it was called only once... And I'm sure if other plugins want to use it, they can perfectly write their own. It's two lines of code. (script.js)

- From the depths of SMF: weCookie declares this.opt and never uses it. Gone. (script.js)

- weToggle's bNow was a synonym of bInit. I don't remember why I introduced that. Gone. (script.js)

- Another one from the depths of SMF: there's no point in straightening out the bInit variable if it's undefined, because it's declared and that's the least JavaScript requires to go without complaining. (script.js)

! And a very, VERY important SMF bug to finish with -- hopefully they're listening: if you collapse any item and it's saved into the database, SMF will systematically re-insert the data into the database on each page load, even if you don't touch the item anymore. Major fail. The fix is very easy: just add a (!bInit) test before the oThemeOptions test. (script.js)

- Brackenazi. (Display.template.php)
6834
Features / Re: Selectbox
« on December 19th, 2011, 10:06 PM »
Quote from Nao on December 19th, 2011, 06:50 PM
Not fantastic either... But it does list the options as you're navigating them with the keyboard. Much more helpful...
Apart from that annoying issue (for which I'd love to find a solution.........), the current local implementation is actually behaving better than a default select box... :eheh:
Basically, I looked at how a default one worked with keyboard shortcuts, and decided which ones felt 'abnormal' and which felt 'natural' to me. I implemented the natural ones, and changed the behavior of the abnormal ones.
Only thing left to do is determine whether I should open the dropdown when pressing the arrow keys on a folded select box (after focusing it with the Tab key, obviously). Currently, the behavior is the same as the default: it navigates through the list, but with the dropdown not triggered. I think it'd be much better if the dropdown was opened automatically. In my version, hitting the Space key would open the dropdown (I couldn't find any key shortcut to do that on a default!), but it still feels a bit unnatural to me.
6835
Features / Re: Selectbox
« on December 19th, 2011, 06:50 PM »
Not fantastic either... But it does list the options as you're navigating them with the keyboard. Much more helpful...
6836
The Pub / Re: Logo Madness
« on December 19th, 2011, 12:42 PM »
Yesterday I uploaded a replacement of the current logo, where the DIN OT font is now replaced with the newer one. Hovering the logo uncovers the alternative logo (same font), and I have to say I really like it more than the square one... Which is a bit of a bother because the square logo works better as a favicon, but anyway, what matters is not 'what works best', but 'what feels right'. I'll still give it a few days of thought but I think I'm close to the end of my search...

In the meantime, I'd like you all to give your opinions and vote for your fave logo. If you really like one logo better than prefer the colors of the other logo, feel free to specify it. Otherwise you can just vote and not comment, as you like. ;) And of course, you can also change your mind later, like I often do :P

Thanks for participating!
6837
Features / Re: Selectbox
« on December 19th, 2011, 12:39 PM »
I'd love to get some feedback on the latest commits... I think it's currently quite stable as it is.

One thing I did today, was download NVDA (an open-source screen reader) and try it on my select boxes. Unfortunately it didn't prove to be very useful... If you're closing your eyes, it sucks: once you get to it, it'll read out the label and then the various options... but if you navigate between options, it doesn't tell you which is which, and even if you select one, it doesn't confirm it. Add to that the fact that pressing Return will submit the entire form... I need to fix that one. But the rest... I'm surprised it doesn't work, given that there's 130 gzipped bytes of Aria processing in all this.
Anyone knows a bit about Aria and accessibility in general...?
6838
Features / Re: New revs
« on December 19th, 2011, 12:25 AM »
rev 1205
(2 files, 7kb)

! Fixed copy-paste error in wetem::remove. Thanks Dragooon! (Subs-Template.php)

! Fixed a few very annoying bugs in the select box's keyboard handling. This was basically due to the events being registered multiple times. I'll be honest and just say I took the easy way out and unregistered the events manually before registering them. I should instead be looking into the source code to find out why the code is being called more times than needed. (sbox.js)

* Personal usability preference: using the up and down arrow keys in a select box will now loop to the other end of the list if you reach the beginning or the end. I always hated the fact that regular select boxes don't do that... (sbox.js)

* 2579 to 2386... Not bad (even went as far as 2372 at one point). Among many other things, removed a duplicate test for duplicate objects (poetic irony), and rewrote the keydown event to something more readable and IMHO actually more usable (see above.) Also, 'new object()' doesn't require the parenthesis. I learn stuff every day. (sbox.js)


@ Note: should disable submitting the form when hitting Return inside a select box... I think?! Should also remove the random ID assignments -- the original developer didn't document why he added them over at github, and I don't see any reason for doing it either. It seems to be a leftover from an older element that was removed anyway... Opinions?
6839
Features / Re: Selectbox
« on December 19th, 2011, 12:24 AM »
Best I could reach was 2372...
Back to 2400+ now, because after fixing the problem above, I found another problem... Pressing the Space bar while under a select box would show an empty select box next to ours (?!). I have no idea what this is about... Bullocks.
I'll deal with that tomorrow. I can prevent the space bar from working, but it still doesn't help when the select box is in an inactive state.
6840
Off-topic / Re: Google Code-in
« on December 18th, 2011, 11:07 PM »
I see you're still first by far! Hopefully remains this way :)