New revs


  • Dadman with a boy
  • Posts: 16,078
Re: New revs
« Reply #1185, on December 4th, 2011, 11:42 PM »
rev 1185
(6 files, 9kb) -- my work for the weekend... Good luck trying to understand any of it.

+ Added support for ISO to UTF8 conversions in the westr class. New functions: is_utf8(), force_utf8() and to_utf8(). New variables: $can_utf and $can_iconv. Made $can_* variables public because it's mostly harmless. (Class-String.php)

! The westr class wasn't being initialized at all, thus Subs-Charset was never loaded, and self::$can_mb wasn't set. (Load.php)

- There's no need to specify 'public' in front of public methods. It may be clearer, but it also takes space for nothing. (Class-String.php)

* Benchmarked these regex variations in westr and it turned out that the longer ones were faster... Uh. (Class-String.php)

* Scarcely used westr::safe() now is the equivalent of westr::htmlspecialchars, only the $force_utf8 and $double_enc param defaults are reversed. (Class-String.php)

! Fixed Aeva Media throwing out an 'empty post' error when all of these conditions were set: PHP < 5.4, title lookups enabled, and title had an entity that was decoded to an unsafe character (i.e. something that doesn't convert to the same byte sequence in UTF-8 and ISO-8859-1). Also fixed an unrelated call in the BBC parser that uses the same function. (Aeva-Embed.php, Subs-BBC.php)

* A few necessary rewrites for subject and post sanitation (sanitizing?), used the opportunity to be bitchy and play with fire by forcing ENT_NOQUOTES on the htmlspecialchars calls... Let's see how it goes. (Post2.php)

* Various &amp; fixes. Don't ask, it's complicated. (ManageBoards.php)
Re: New revs
« Reply #1186, on December 7th, 2011, 05:54 PM »
rev 1186
(12 files, 14kb)

+ Added a new routine to the post code that will check for extra or missing tags and send an error instead of trying to fix, generally badly. The error message also indicates the number of expected and found tags. (Post.php, Post2.php, Errors.language.php)

! The Post() function's error handling code was pretty messed up to begin with. Rewrote it to use the same system as in Post2(), as well as avoid rebuilding the error list in case an error was found in Post2(). (Post.php)

- Why exactly does SMF/Wedge still show a hidden error box when there are no errors to show in the first place...? That's silly. (Post.template.php, sections.css)

! SMF bug (doesn't matter here, but just so they know if they're reading our changelogs...): $context['post_errors'] is set in Post(), instead of $context['post_error']. Fixing this will break Post2() error handling though... (Post.php)

* Harmonized other occurrences of $context['post_errors'] to $context['post_error']. Well, technically post_errors is better suited, but there are far more to fix if we start going that way... I have a life, too. (Profile-Actions.php, Profile.php, Report.php, Profile.template.php, SendTopic.template.php)

@ Note: I have yet to cache the BBC list for the mismatched tag check code. Actually, I'm not even sure it's worth caching it... It's a tiny table and the code is only run when posting a message... What do you think?
Re: New revs
« Reply #1187, on December 7th, 2011, 07:40 PM »
rev 1187
(4 files, 3kb)

! Mismatched tag code wouldn't work when openers had parameters. (Post2.php)

* Rewrote mismatched tag logic to generate an error in, for instance, a situation where you'll have matching openers and closers but in the wrong order. (Post.php, Post2.php, Errors.language.php)
Re: New revs
« Reply #1188, on December 8th, 2011, 09:47 AM »
rev 1188
(6 files, 5kb)

* Well, if it isn't magical... Rewrote the mismatch code again, and moved it to the wedit object. This time, it's shorter, it's easier to grasp and it actually yells at you if you do [tag1][tag2][/tag1][/tag2]. Give me another day and I'll have a full HTML5 parser for ya... Will that be all m'am? Maybe a pound of apples? (Post.php, Post2.php, Class-Editor.php, Errors.language.php, sections.css)

* Some regex simplifications. You've got to face it, a regex IS complex, whatever way you look at it. Making it longer won't make it any simpler. (Class-Editor.php)
Re: New revs
« Reply #1189, on December 11th, 2011, 11:43 PM »
rev 1189
(2 files, 18kb) (that one was pretty annoying... and I don't even get to commit it on an even number like 1190? :P)

* Moved mismatched tag fixer to preparsecode(), and added ability to either return an error message (when Wedge allows it), or fix the errors automatically. The automatic fixes are pretty solid, but it won't be able to rewrite your post if you enjoy mismatching plenty of tags in a row, forgetting openers and closers and doing strange things altogether. (Class-Editor.php, Post2.php)

* Hopefully a more solid code tag handler. If Wedge meets a code opener inside a code block, it will rewrite it to prevent further processing errors. (Class-Editor.php)

+ Wedge will now clearly indicate where the mismatch errors are located inside the post. (Class-Editor.php)

+ Added a check for posts opening a block-level tag when some non-block tags are still opened. Will attempt to fix automatically. (Class-Editor.php)

+ Wedge will also now attempt to turn block-level closers to openers if they're at the start of a new line *and* no matching opener was found before them. (Class-Editor.php)

* It will also no longer attempt to fix (or report) "errors" inside a code, html or nobbc block. (Class-Editor.php)


The following lines require some testing: (i.e. I made last minute logic changes to them but didn't test them on my test suite)
2364: if ($found === false || !$really_found) (original had something like if (!$found || !$really_found))
2375: $text = substr_replace($text, '', $pos, strlen($full_tag)); (original had a 0 instead of the strlen...)
Re: New revs
« Reply #1190, 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)
Re: New revs
« Reply #1191, 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)
Re: New revs
« Reply #1192, 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)
Re: New revs
« Reply #1193, 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...
Re: New revs
« Reply #1194, on December 13th, 2011, 07:13 PM »
rev 1194
(1 file, 4kb)

* And again, optimizing the select box for size... obj.access is never used so it's gone, obj.init is always there so it's not tested, getDDCtx will now always return o.ctx (couldn't find a reason to support setting 'self' or a function on it), moved the init code to the top of the object (only saves 6 bytes but it's also cleaner), replaced a substring() with the [0] equivalent, hardcoded acTimeout (who needs to fine-tune the timeout between key presses when typing a string? I doubt people even know they can do that), hardcoded the space threshold to 50 pixels (and would probably benefit from being even smaller), and rewrote positionSB in a smarter and shorter way. Current gzipped size: 2827 bytes, down from 2941. Now we're talking... (sbox.js)

@ I doubt I can go below 2500 bytes, BTW... Even going below 2800 is going to be hard, at this point. The only thing I can see here is getting rid of $ddCtx but that would imply that skins are no longer able to set a margin on the body... OTOH, why would they do that? It's just that if someone doesn't think of adding an extra div, I'm just not sure I want to see them ask for support because suddenly their select boxes are broken...

@ Also, I just noticed a small bug in the plugin. If you select an item and close a SB, if you reopen it, sometimes the selected item will still have the hover class on it, even though the code correctly removes it... Oh, I don't feel like hunting that one... :-/
Re: New revs
« Reply #1195, on December 14th, 2011, 01:22 PM »
rev 1195
(2 files, 5kb)

* Down from 2827 to 2751. It's harder to save space now... I won't save much if I don't disable more features, like ARIA, so I need a bit of reading on this. Changing .size() to .length is faster (no function call overhead), and compresses better. The optionFormat simplification saves a lot. optgroup handling wasted a local var. Also, flickerDisplay doesn't need its own function as it's called only once (plus, I couldn't see any issues in IE7 even when disabled.) And a newly created option tag doesn't need a default empty value because that's what it gets anyway. (sbox.js)

* Menu arrows were off by a pixel. (index.css)
Re: New revs
« Reply #1196, on December 14th, 2011, 06:19 PM »
rev 1196
(1 file, 5kb) -- hey, this one actually has bug fixes and all! :P

* Down from 2751 to 2700. Removed the triggerHandler helper because it turned out closeAll() was never used, and thus there was only one actual use of it. Saved a few bytes by replacing some events and function calls (blurOrig, focusOrig, getEnabled, getSelected, positionSBIfOpen) with their actual contents. And finally, some local vars don't need to be set to null because they're set anyway as soon as the object is created. (sbox.js)

- Removed .options({...}) public method. I can't think of any good reason to actually change an option for a select box *after* it was created... (sbox.js)

! Fixed that annoying bug with hover states. It adds ~20 bytes to the gzipped file (the is_closed stuff) but it's better than a frigging bug! (sbox.js)

! Prevented consecutive select box clicks from selecting text around the select box (the mousedown stuff). Gzipping will always fascinate me: adding an extra line of code actually removed an extra byte from the final file... (sbox.js)
Re: New revs
« Reply #1197, on December 15th, 2011, 10:38 AM »
rev 1197
(1 file, 1kb)

! Forgot to load Class-Editor before preparsing thoughts. Now this is where that auto-loader would have been useful eh... (Ajax.php)
Re: New revs
« Reply #1198, on December 15th, 2011, 12:22 PM »Last edited on December 15th, 2011, 01:45 PM by Nao
rev 1198
(5 files, 3kb)

+ Down from 2700 to 2696, but added support for per-option CSS (used in quick access). The next commits will probably see the size go a bit up, which is okay. I'm really only trying to keep it below 3000... (sbox.js)

! Fixed optgroup support (was broken by a careless edit), and apparently optionFormat doesn't even require to retrieve the label for optgroups, text() will figure it out for itself. (sbox.js)

! Fixed optgroup styling, too, and improved box shadow. (sbox.js, index.css)

* Moved message_index_jump_to's associated floatright to the ID itself, and fixed top padding. (MessageIndex.template.php, sections.css)

* Incomplete comment. (index.member.css)
Re: New revs
« Reply #1199, on December 15th, 2011, 06:50 PM »
rev 1199
(9 files, 4kb) (another one coming up.)

! Fixed the 'extends' keyword appearing directly in compiled CSS files for IE6. (Class-CSS.php)

! Fixed submenu arrows and post backgrounds in IE6. Hey, first actual use of 'unextends' in my code! (index.ie6.css, skin.xml)

! Fixed menu arrow positions in all browsers, and a few color issues in Wuthering. (index.ie7.css, Warm/index.css, Wuthering/index.css, Wuthering/index.ie6.css)

! Syntax error (: instead of ::). (ManageMedia.php)

! $txt['who_index'] contains {forum_name}, yet was set in a code block that didn't through the {forum_name} replacement. (Who.php)