New revs

Nao

  • Dadman with a boy
  • Posts: 16,063
Re: New revs
« Reply #1215, on December 23rd, 2011, 06:39 PM »Last edited on December 23rd, 2011, 06:57 PM by Nao
rev 1215
(2 files, 6kb)

* Down to 2057 bytes, lost another 90![1] Done mainly by turning extraWidth() into a normal function, removing offsetFrom() entirely, moving some function calls around, moving named functions to unnamed status or simple code blocks (like clickSB, destroySB and delayPositionSB), and other things like that. (sbox.js)

+ Instead of using the space key, using the arrow keys on a closed but focused box will open it. It feels more natural somehow. (sbox.js)

! The display area's active class toggler didn't work properly. Hadn't for quite for time, actually... (sbox.js)

* Replaced untouched minilogo with the new one. (other/images/minilogo.png)

:edit: Currently at 2041 bytes... :^^;:
 1. It may be doable to go under 2000 just for fun, but... It's probably going to be quite hard if I want to keep all features in. Then again, until an hour ago I never noticed that some of the functions didn't need to be called at all...
Re: New revs
« Reply #1216, on December 24th, 2011, 12:30 AM »
rev 1216
(3 files, 6kb)

* Down to 1996 bytes... I knew it could be done![1] Tricks involved: clearTimeout() on an undefined variable doesn't generate an exception, no need to preset it to null. Removed custom CSS class name, as planned some time ago. The new namespace is 'sbox'. Removed the IE7 glitch fixing code -- I tested it under IE7, obviously, and couldn't see any difference... Got rid of '.display.active' in favor of '.focused .display' (also implies a few CSS changes). Skipped adding the select box to the body -- went directly for after the original element.

! The original plugin had a minor bug in which it tested for the .focused class in $display instead of $sb. (sbox.js)

* Hopefully made the select box CSS a bit cleaner. (index.css)

+ Just added a small disclaimer in WeCSS's comments. Whatever. (Class-CSS.php)
 1. And I'm definitely putting an end to my research... From this point on, the size will go UPWARDS. I don't think I could have gone below 1900 bytes without removing support for ARIA.
Re: New revs
« Reply #1217, on December 24th, 2011, 12:39 PM »
rev 1217
(3 files, 2kb)

! Hitting a function key with a select box opened would ignore it. (sbox.js)

! The change event for the original select box was never triggered. (sbox.js)

! Fixed bad positioning (again?!) when using drop-ups instead of drop-downs. (sbox.js)

- Set default maxHeight to 500, because after experimenting with a 600px one... It's just too imposing. (sbox.js)

! Syntax errors in board management JavaScript code. Thanks John for reporting it. (ManageBoards.template.php)

! template_permission_index() used a silly optgroup emulation in a long select box, instead of... well, optgroup tags?! (ManagePermissions.template.php)
Re: New revs
« Reply #1218, on December 24th, 2011, 03:55 PM »
rev 1218
(3 files, 2kb)

! Fixed main menu's position relative to owner when JavaScript is disabled (becomes usable again.) (index.css)

+ Added a transparency effect to the select box background. This is best experienced on the PM View select box, which also demonstrates how a select box can be customized (in this case, size reduction.) (index.css)

* A few minor cleanups to the select box code. Still proudly under 2000 bytes. It won't last, though...! (sbox.js)

* Indenazi. (ManagePermissions.template.php)
Re: New revs
« Reply #1219, on December 25th, 2011, 12:31 PM »
rev 1219
(2 files, 2kb)

+ Added support for additional lines of text in selectbox lists. These lines won't show up in the display area when selected, so it's the perfect place to give custom details like explaining what the option does, etc. It's also very easy to add them to the original text. Because it's likely to break the layout if JavaScript is disabled, I at least made sure that IE6 can support our custom select boxes, which is why I worked on IE6 support recently. (sbox.js, index.css)

- Removed all public methods for the select box, for simplicity. Now calling $(object).sb() will either create the custom select box, or simply refresh it based on any changes applied to the original select box. Also removed a superfluous call to .removeClass('above'). (sbox.js)

! Fixed this annoying bug where select boxes would be duplicated instead of refreshed. This was due to the associated DOM element being cleaned up a bit too thoroughly. (sbox.js)

@ Current size for sbox is 1995 bytes, the lowest yet. And that's taking into account the 30+ bytes needed for the 'details' feature described above. Oh, and Merry Christmas :)
Re: New revs
« Reply #1220, on December 25th, 2011, 12:32 PM »
rev 1220
(1 file, 1kb)

! Oops, committed by mistake a few lines of code that aren't working for now. (sbox.js)

(They were commented out, but still... Faulty is faulty, even when not executed :P)
Re: New revs
« Reply #1221, on December 25th, 2011, 10:54 PM »
rev 1221
(14 files +1 -1, 15kb -- my Christmas-weekend commit.)

! Fixed the label attribution code in the PM area to... well, actually work. Also converted it to use the new select box system. Made various optimizations or jQuery conversions in the PM template. (PersonalMessage.template.php, PersonalMessage.language.php, index.member.css)

! Fixed permission profile deletion code in the Media area. (mediadmin.js)

! Don't trigger the original select box's focus event if refreshing the item, to avoid an infinite loop. (sbox.js)

! Select box refreshing would get incorrect $sb.is(':open') values, that was quite obviously wrong of me. (sbox.js)

! Various select box styling glitches. Mostly avoiding a FOUC before the select box is transformed, by hiding all regular select boxes from view. (index.css, sections.css)

* Moved John's own take of the select box code to the wip folder (a good place to die. It's really too short and smart to kill it any other way.) (Unused-SelectBox.js, script.js)

* Renamed a wip file while I was at it. (Unused.php, Unused-imgBlank.php)

+ An example of the select box's 'details' feature. (ManageSettings.language.php)

* Unclear translation needed an extra comment, I reckon. (PersonalMessage.language.php)

* Spacinazi. (ManageMedia.language.php)
Re: New revs
« Reply #1222, on December 26th, 2011, 01:14 AM »
rev 1222
(3 files +1, 2kb)

* If select box width is set to fixed, ensure the dropdown's width is set not to break individual items. (sbox.js)

! Fixed width of select box display area. Was a bit off due to my adding some padding... (sbox.js, index.css)

! Forgot that IE6/7 don't support string indexing like str[0], so I restored the .charAt(0) thingy. (script.js)

* Moved linkMagic function to the wip folder. (Unused-linkMagic.js, script.js)

@ Note: sbox.js is currently at 2028 bytes... And it's unlikely it'll go under 2000 bytes at this point. At least it's still under 2 kilobytes... :P
Re: New revs
« Reply #1223, on December 26th, 2011, 10:02 AM »
rev 1223
(3 files +1, 5kb)

+ Added (or restored?) the ability to change options while refreshing the custom select boxes. It's just a few bytes... (sbox.js)

* Set the default 'fixed' param in select boxes to 'true', because... Well, I've tried it, improved it a bit and it's better. Plus, I'm going to go through all select boxes anyway so I'll quickly spot any box that needs fixing. (sbox.js)

* Did more proper calculation of maximum select box width in non-fixed mode, taking padding and margin into account. (sbox.js, index.css)

* Moved the testStyle function out of the script and into the wip folder. Turns out I hadn't been using can_borderradius or can_boxshadow for quite some time. If someone wants to use them, well... I guess I can distribute the file on the forum or something. (script.js, Unused-testStyle.js)
Re: New revs
« Reply #1224, on December 26th, 2011, 11:37 PM »
rev 1224
(3 files, 3kb)

+ Added a very nice little animation to fixed select boxes when an item is clicked. Definitely adds to it! (sbox.js)

* Now with pixel-perfect positioning of select box arrow button next to display area. (sbox.js, index.css)

! Went through all main browsers to test the keyboard accessibility of the select box. Turns out only Opera, Firefox and IE9 (I think) were behaving nicely, so I had to fix it for IE 6-8 and Webkit by conditionally moving the event to keydown. Grmpf. (sbox.js)

! Icon selector in the Post template wasn't using a tabindex, and because other elements were using it, it wouldn't be selected when cycling through elements with the Tab key. (Post.template.php)
Re: New revs
« Reply #1225, on December 27th, 2011, 01:58 PM »
rev 1225
(5 files, 4kb)

! Fixed Welcome page to show Modify/Reply buttons in thoughts area when clicking a thought (as opposed to simply clicking the thought's author link, which was totally counter-intuitive... Thank Apple for their strange handling of hovers.) (Welcome.php)

+ A custom select box's display area should now inherit all of its original's events, effectively dealing with onclick etc without us having to worry about them. This also forced me to add 16 bytes to the .data("eve") retrieval method on every page (because of an IE bug, who else?), although if there are more than 8 event calls on the page, which is quite likely, it'll actually make it shorter. (Subs-Template.php, sbox.js)

* Custom select boxes will no longer trigger their original's events willingly. This is to avoid triggering the select box behavior on my iPod, which although very usable, is also unable to cope with HTML and multi-line elements unlike Wedge's. (sbox.js)

* Optimized select box animation from last commit for size (a bit). Current gzipped minified size is 2074 bytes, which is still quite good! (sbox.js)

* Minor CSS cleanup, including fixing select boxes when inside cat/title headers. (index.css, sections.css)
Re: New revs
« Reply #1226, on December 28th, 2011, 12:08 PM »
rev 1226
(2 files, 3kb)

+ Move jQuery and script.js to the *top* of the page if the user is logged in and was seen less than 10 minutes ago, making it likely their scripts are already cached and the page will actually finish loading faster. Needs some further benchmarking, but as of now this is one of those ideas that seem so incredibly simple, and yet no one seems to have ever considered it before, so it's probably the genius at work... (Or the village idiot, more likely.) (index.template.php)

! $dd was already part of $sb, no need to re-insert it at open time... Current size is thus 2071 bytes. Still working on the custom scrollbar and not making much progress... Yep, definitely village idiot material here. (sbox.js)
Re: New revs
« Reply #1227, on December 29th, 2011, 12:43 AM »
rev 1227
(8 files, 8kb)

! Fixed select boxes in post editor. Focused style still sucks a bit. (post.js, sections.css)

+ Added previews of font face, font size and font color inside the post editor select boxes. Always wanted to do that... (post.js)

* Reordered colors in color selector in post editor. Ooooh, rainbow! (Class-Editor.php)

* Simplified $post_errors code by putting long_message errors into an array, like mismatched_tags. I hope I didn't screw anything up, as I did this quite in a hurry. John, I'm counting on you to check this out :) (Class-Editor.php, JSModify.php, PersonalMessage.php, Post.php, Post2.php)

! Always put scripts to the bottom if using IE6. It's too slow. (index.template.php)
Re: New revs
« Reply #1228, on December 29th, 2011, 10:16 PM »
rev 1228
(4 files, 6kb)

* Rewrote select box navigation logic to match normal select boxes' behavior as much as possible. Basically, clicking outside of an opened select box or pressing the Space bar will revert the selection to the original's. Pressing Return will confirm it. Same for Tab, although in this case it's different from the original behavior (a personal preference.) Behavior is also buggy in conjunction with the post editor, because of conflicting events. Ahh well. Can't have everything... Current gzipped size: 2110 bytes. Still acceptable. (sbox.js)

* Added a small hack to the post editor to specify a tabindex on select boxes in such a way that they'll be seen in the order they appear, rather than after all elements have been tabbed through. (Class-Editor.php)

! Fixed a couple of issues due to select box animations not being properly completed and breaking subsequent actions. (sbox.js)

! Non-dropdown select boxes such as the local avatar selector were made invisible. Oops. (index.css)

! Fixed styling for post editor's select boxes. Should be good now... (sections.css)

@ Personal thought... I'm starting to regret implement the new select box system. Although I'm pretty much done with it, I'm not exactly eager to check all existing select boxes in Wedge and see if they behave as expected... :-/
Re: New revs
« Reply #1229, on December 29th, 2011, 10:46 PM »
rev 1229
(3 files, 11kb) -- oops, once again committed my WIP for sbox... Reverting in the next commit.

* Rewrote mouse hover functions to behave as if the user was navigating with the keyboard. This allows for the same animations, and to avoid using two different background colors (selected and hover) in the list box. (sbox.js, index.css)

! Fixed invisible select boxes in 'Add Rules' page of PM area. (PersonalMessage.template.php)