New revs

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: New revs
« Reply #1905, on February 8th, 2013, 06:28 PM »
rev 1905 -- Display is now a mini-skeleton! Also, celebrating page 2^7 of this topic :P
(5 files, 17kb)

+ Finally adding the mini-skeleton system we've been talking about for weeks. The Display template now relies on weSkeleton to show individual posts. You can reorder elements in posts as much as you like. Life is beautiful. (Class-Skeleton.php, Subs-Cache.php, Display.template.php, skeleton.xml)

+ Added ability to skip a block/layer only in the next render pass. Just call $your_skeleton->skip('your_block') before $your_skeleton->render(). (Class-Skeleton.php)

* Moved all of the skeleton parsing (and skin-dictated skeleton moves) to the skeleton class, rather than Subs-Cache... (Class-Skeleton.php, Load.php, Subs-Cache.php)

* Naoism: weSkeleton->build didn't really need a reference to the array. I probably did that in memory of the days I didn't know PHP did copy-on-write. (Class-Skeleton.php)

- $removableMessageIDs was not used since rev 1546, where I removed its raison d'être. I forgot to remove it, though... Bad me. Note to SMF/Elk devs: you can also remove it easily and do a search on a specific class name instead... It's always good to save bytes. Also, $alternate wasn't used either (being a duplicate). (Display.template.php)
Re: New revs
« Reply #1906, on February 8th, 2013, 11:19 PM »
rev 1906 -- XML skeleton operations
(5 files +1, 30kb)

+ Added skeleton operations to skeleton.xml files: move, rename and remove blocks/layers within any skeleton. More to come..? Right now, skin.xml move operations will not work, I'm trying to determine what's the best file to put them in. Also, operations are now found through a more generic function, so eventually I should be able to allow for all regular skeleton operations to be used in the XML files. (Class-Skeleton.php, Load.php, Subs-Cache.php)

* Moved Msg skeleton template functions to their own template. Well, at least it's funny, it gave me the opportunity to confirm that Wedge can perfectly call loadTemplate twice in a row... (Display.php, Display.template.php, Msg.template.php)

- Forgot to remove a useless param. (Class-Skeleton.php)
Re: New revs
« Reply #1907, on February 9th, 2013, 04:42 PM »
rev 1907
(1 file, 2kb) (for a day's worth of work, really? Not well paid :P)

! Choosing to merge jQuery with script files *and* not minify JS files would result in a JavaScript error. This was technically fixed in jQuery 1.9.1 (not 2.0b1 though), but it doesn't matter, I should have done that before. Also added a quick hack to remove // comments on a file's last line (which could generate that bug), even though it wasn't needed, I'm not going to take any chances. (Subs-Cache.php)

* Ensuring that if inheritance causes a skeleton's block to receive the same operation multiple times, the last one should override the previous ones. For instance, if you're going to rename it, the following occurrence might not know of the new name... I'd rather always prioritize the latest request. (Subs-Cache.php)

* Now allowing for custom.xml to be loaded even if no skin.xml is found in the folder, you can even override its type but that would be unwise. Also, it now supports skeleton.xml hacks. Likewise, don't abuse it! (Subs-Cache.php)

* Naoism: some double quotes were used in preg replacements, and they were not always needed. Especially that "$1/*" one... Seriously?! (Subs-Cache.php)
Re: New revs
« Reply #1908, on February 9th, 2013, 04:43 PM »
rev 1908
(1 file +1-1, 95kb)

* Updated jQuery 1.9 branch to v1.9.1, it saves 250+ gzipped bytes, me likey. It also adds the responseXML bug that I reported (and had fixed) in the upcoming v1.9.2, which isn't a problem because I fixed it on my side a few commits ago. (Load.php, jquery-1.9.*.min.js)

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: New revs
« Reply #1909, on February 9th, 2013, 06:21 PM »
(6 files, 3KB)

Revision: 1909
Author: arantor
Date: 09 February 2013 17:19:56
Message:
! Stats shouldn't be including liked thoughts as part of top liked posts. (Stats.php)

! Legacy function call removal. (Post.template.php)

! The sessrewrite should be called a little more often, because there are times when PURLs won't be active but the rewriting buffer is still needed (i.e. for the scripturl injection) (Subs-Template.php)[1]

! Likes are now magically AJAXive. I apologise in advance for the number of new bytes in topic view. Testing would be appreciated. There's also probably a better way to do this in terms of finding the right selector, too. (Like.php, Msg.template.php, topic.js)
----
Modified : /trunk/Sources/Like.php
Modified : /trunk/Sources/Stats.php
Modified : /trunk/Sources/Subs-Template.php
Modified : /trunk/Themes/default/Msg.template.php
Modified : /trunk/Themes/default/Post.template.php
Modified : /trunk/Themes/default/scripts/topic.js
 1. It was breaking my likes code, because <URL> was getting into the AJAX response because although clean_output was called appropriately, the buffer rewrite was not happening because I roll with PURLs disabled. And that IS how I roll.
When we unite against a common enemy that attacks our ethos, it nurtures group solidarity. Trolls are sensational, yes, but we keep everyone honest. | Game Memorial

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: New revs
« Reply #1910, on February 9th, 2013, 09:06 PM »
rev 1910 -- nothing interesting for normal human beings, you can skip that one!
(7 files, 4kb)

* Naoism: Optimized (very slightly) the likePost function and saved about 15 bytes. Thanks to function reordering, the filesize is only increased by 30 bytes ;) (topic.js)

* Naoism: Got inspired by the above, and renamed both $.get calls to $.post in the main script file. Saved plenty of bytes, yay. Then I looked into the Ajax code and realized that it was outdated. The 'time' variable wasn't used anywhere anymore. As a result, saved a total of 17 bytes. (script.js, JSOption.php)

* Naoism: A few minor modifications to the homepage intro. (Home.template.php, Home.language.php)

* Naoism: the current convention in JS files is to only have objects be capitalized, rather than function names. (Msg.template.php, topic.js)

@PS to Pete: no need to apologize, optimizing is my hobby :P I love doing that. Also, implementing Ajax here was surprisingly easy, as I can see! And the magic of gzipping makes it that your .replaceWith() call is actually better optimized than rewriting with $(target).load() instead!
Re: New revs
« Reply #1911, on February 10th, 2013, 12:32 PM »Last edited on February 11th, 2013, 07:49 AM
rev 1911 -- the bytenazi strikes again.
(12 files, 5kb)

* Rewrote weToggle object to simplify it to death. altExpanded is replaced with the optional toggle-wide (rather than per-state and per-image) opt.title (which is actually never used... but you never know), and msgCollapsed/msgExpanded is completely removed (see below). Also updated upshrink_description to be more generic. (Admin.template.php, Boards.template.php, index.template.php, ManagePermissions.template.php, Packages.template.php, Post.template.php, script.js, stats.js, index.language.php)

* Rewrote Thought object to move all text strings to it. (:edit: script.js)

@ Sometimes, you spend time converting some JS to jQuery and save bytes, and that's all good. One day, you go through the code in a logical manner, and start wondering, why the hell is my HTML being rewritten? Then you realize you blindly ported some code when it could have been removed entirely. Saves something like 20 bytes AND as a freebie we get to integrate the upshrink_description text string, which means it saves an additional 20 bytes or so *per page load*. I nearly fainted.

@ Total overall cost of script.js's new features in this commit: 12 gzipped bytes. The 'click for new thought' string itself is 45 bytes... And HTML pages for members are now shorter by several dozen bytes (weToggler and Thought strings combined).

@ I need my pills.
Re: New revs
« Reply #1912, on February 10th, 2013, 04:17 PM »Last edited on February 11th, 2013, 07:49 AM
rev 1912 -- Bytenazi vs the world.
(10 files, 27kb)

+ Added support for @if/@else/@endif to JS files. No @elseif because there are only two possible states right now, guest and member. As you can imagine, this allows you to have your JS file only print whatever code is written for guests or members. For instance, removing the cookie code for members saved about 50 bytes, and removing objects related to non-guest permissions (Thought, auto-draft, quick edit...), saved over 800 bytes in script.js, over 400 bytes in editor-func.js, and over 1500 bytes in topic.js. And I'm talking about gzipped ones. Yaysir. (Subs-Cache.php, editor-func.js, script.js, topic.js)

@ Note that you don't have to indent code inside @if tags, it's just a personal preference of mine.

* In case I need it later -- and I will, believed me -- added a $supports_flexbox variable to the CSS commons, stating which exact browser versions can use the latest flexible box layout model. (common.css)

* Guests shouldn't be served any code that allows them to quick edit something... That doesn't make any sense. (Display.template.php)

* Merged sCookie with sOptionName into sOption. The idea is that there's no reason not to use the option name as the cookie name, as cookies support underscores and all... The only drawback is that it adds a couple of bytes to guest pages. But you're not going to blame me for that, are you...? Also, who decided that it would be a smart idea to test against guest status in an... admin page?! (Boards.template.php, index.template.php, ManagePermissions.template.php, :edit: script.js...)

* More mini-byte saving, such as: the eves array was indented by one tab too many (how come I never noticed..?!), and I removed the generator string, which the W3C no longer cares about. Also added a [] fallback to aSwapContainers. It's never needed, but because the other options do that, it actually saves a byte. (index.template.php, Subs-Template.php, script.js)

* I'm a naughty boy... And I've been doing something naughty. It's all in the name of saving trees, mind you. Well, at least if anyone's trying to print out the HTML source code of your forum. Which might happen. Don't deny it. (Subs-Template.php)

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: New revs
« Reply #1913, on February 10th, 2013, 07:10 PM »
(2 files, 1KB, it needed to be done, couldn't find anything more useful in the time right now.)

Revision: 1913
Author: arantor
Date: 10 February 2013 18:09:50
Message:
! Fix for PMs loading the wrong template for skellingtons. (PersonalMessage.php)
! Use the correct URL when a manual override has been indicated. (Admin.template.php)
----
Modified : /trunk/Sources/PersonalMessage.php
Modified : /trunk/Themes/default/Admin.template.php

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: New revs
« Reply #1914, on February 11th, 2013, 01:23 PM »
rev 1914 -- registration process optimization, no biggie.
(14 files, 15kb)

* Moved registration/reminder text strings to their JS file. Overhauled said file to be much shorter (by around 200 bytes), even after adding the strings. Not that it's gonna be noticeable on your bandwidth meter, but whatever... Every little helps. Plus, I was always put off by that unused index #3 in verification field arrays. Also... Why the heck did I leave these Optimize strings in the JS file, when Packer will always minify them anyway? (Register.template.php, Reminder.template.php, register.js)

* Moved draft removal text string to its JS file. (Class-Editor.php, editor-func.js)

* Rewrote captcha sound to use the generic popup. Also fixed the 'Play again' link to avoid jumping to the top of the page. (VerificationCode.php, Register.template.php, Login.language.php)

* Added placeholder text for e-mail input at registration time. You never know... (Register.template.php, Login.language.php)

! Adding to $context['footer_js'] directly is bad practice, and could even break the feature. Modified all instances to add to a local string and then call add_js with this string as a parameter. (Class-Editor.php, Aeva-Foxy.php, Aeva-Gallery2.php, Display.template.php, PersonalMessage.template.php)

! If a captcha was failed, the second instance wouldn't allow for the sound popup to be run. (Subs-Editor.php)

! Fixed minor typo in French translation. Eh, my bad... (index.french.php)
Re: New revs
« Reply #1915, on February 11th, 2013, 07:10 PM »
rev 1915 -- mouse wheel fix, more love for the skin selector, and index language cleanup.
(16 files, 13kb)

! Fixed mouse wheel no longer working on select boxes. Thanks to jQuery 1.7.1 for that one, ahem... (sbox.js)

* Rewrote wedge_show_skins to return a string rather than echo it. Well, technically I should rename the function as well, but I couldn't care less... The resulting string probably won't be long enough to have any impact on performance, and this has the advantage of filling in a name array where I can then get any skin's name from its path, which surprisingly isn't available from the get go. I really should store skin details in the database or in some kind of cache... Probably will do at some point, unless Pete beats me to it first... Anyway, this was all to allow the skin selector plugin to show the default skin (if it's the one selected) without the Default flag in the select box. (It should only be shown in the dropdown.) Ah, yes, because I added a parameter that enables adding a 'Default' flag next to the default skins (desktop and mobile). Which is cool... Do what you want with it. Again, this is all tested with only ONE theme enabled, so it may break or behave inconsistently on multiple themes. (Themes.php, ManageBoards.template.php, Themes.template.php, index.language.php)

- Got rid of plenty of obsolete index language entries. Apparently, we didn't finish our review process for them..?! (index.language.php)

! Fixed syntax of meta viewport tag. Apparently, BlackBerry devices don't like the semi-colons. Not that I ever tested Wedge on a BlackBerry, mind you... I don't even know if it's spelled BlackBerry or Blackberry. (index.template.php)

* Moved debug language entries to Stats language. Technically, they're debug stats, the stat language files are very short to begin with, and these strings should only be loaded for those who have the rights to see them, i.e. not everyone... No need to spend time loading them for everyone, then. (index.language.php, Stats.language.php, Subs-Template.php)

* Moved (and renamed) totalTimeLogged strings to the two files they really belonged to: Profile and Stats. Also got rid of the first one, which was obsolete. (Profile-View.php, Stats.php, index.language.php, Profile.language.php, Stats.language.php)

* Moved some smiley strings to the Profile language files. (Themes.php, index.language.php, Profile.language.php)

* Memberlist search page needed a bit of extra love. (Memberlist.template.php, sections.css)

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: New revs
« Reply #1916, on February 12th, 2013, 06:15 AM »
(4 files, 6KB)

Revision: 1916
Author: arantor
Date: 12 February 2013 05:14:01
Message:
! Installer needs to actually set permissions on news, not trim a character off it and make it admin only by accident. (install.sql)

! Enhanced passive mode support in FTP, proper response changing for type changes, and some extra debugging nonsense. (Class-FTP.php)

! Updated credit for Crystal icons, to the most accurate I can come up with for now.

! Theoretically better compliance with RFC2407, as well as pruning some old legacy pre UTF-8 code. Not tested, but seems harmless enough. (Subs-Post.php)
----
Modified : /trunk/Sources/Class-FTP.php
Modified : /trunk/Sources/Credits.php
Modified : /trunk/Sources/Subs-Post.php
Modified : /trunk/root/install.sql


@ The FTP stuff is essentially IPv6 support for FTP servers. Yay. As if FTP didn't grind my gears enough already. The plugin uploader is definitely getting there!

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: New revs
« Reply #1917, on February 12th, 2013, 07:03 PM »
rev 1917 -- more JS fixes... including an 'amusing' one.
(12 files, 9kb)

! Fixed another bug in the ask() code -- Invisible groups option in Manage Membergroups and de-admin option in Profiles were broken. Let's get technical: we shouldn't call !ask() (emphasis on '!') without ensuring that it isn't being used to actually cancel something, instead we should use its callback feature in these situations. Also, checkbox magic means that some !ask calls can stay in, such as the one in mediadmin. Just sayin'. (ManageMembergroups.template.php, Profile.template.php)

! In-topic moderation was also impacted by the bug above. However, it had 3 more bugs (in such a short function, must be a new record!) that needed fixing: it generated the wrong action URL when pretty URLs were enabled, it tested for '.modrem' against the wrong element, and it took message IDs from the wrong element too. Instead, it needed my now infamous .closest('.root') trick. I still love that one, it saves us so many bytes... Well, in this case the topic JS file is now 28 bytes larger... Most of which is due to the PURL fix. I hate the recycle bin. When do we remove that thing?! (topic.js)

+ Another minor thing, but long coming: added a shortcut to the default skin/theme selection page in the admin page introduction. This is something that even I sometimes had trouble finding, so... Also made some words stand out in the intro text, to ensure you can see what you want at a glance. (Admin.php, Admin.template.php, Admin.language.php)

* Moved total_* stat strings to the Stats language file... Is this never gonna end? ;) (SSI.php, index.language.php, Stats.language.php)

! Harmonized background colors in membergroup manager, and fixed the Add new membergroup page, which didn't get the extra styling of the rewritten board permission form. (ManageMembergroups.template.php, mana.css)

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: New revs
« Reply #1918, on February 12th, 2013, 07:31 PM »
2 files, 11KB

Revision: 1918
Author: arantor
Date: 12 February 2013 18:20:20
Message:
! Some more FTP fixes: response checking, a little cleanup, put-string actually works. (Class-FTP.php)

! I don't entirely believe it myself, but I'm going to check it in anyway. This version of the plugin handler still spews a bunch of debugging information for now, and a silly message on success but right now I don't care. It has other bugs too, but as of today I was able to upload a plugin successfully and have it all unpacked on the server and everything. WITH CORRECT PERMISSIONS AND NOT A 777 IN SIGHT. I'm finally on the end of a very long journey, and I'm happy with that. (Subs-Plugins.php)
----
Modified : /trunk/Sources/Class-FTP.php
Modified : /trunk/Sources/Subs-Plugins.php


Yup, the plugin uploader is actually working. Big thanks to Liroy for letting me abuse his server in the testing of this part.
Re: New revs
« Reply #1919, on February 12th, 2013, 08:51 PM »
2 files, 1KB)

Revision: 1919
Author: arantor
Date: 12 February 2013 19:50:37
Message:
! Fixed handling of empty files. (Class-ZipExtract.php)

! Some bug fixes: corrected handling of folders to extract, plus proper saving/restoring of details. (Subs-Plugins.php)
----
Modified : /trunk/Sources/Class-ZipExtract.php
Modified : /trunk/Sources/Subs-Plugins.php