New revs

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: New revs
« Reply #360, on November 21st, 2010, 12:55 AM »
Re the todo: see other comment, it 'should' be OK - if in doubt, try removing it, then putting it in debug mode (logged in as admin, add debug to the GET URL, e.g. index.php?debug) and see whether the browser gets pissy about having been given invalid HTML or not.
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 #361, on November 21st, 2010, 11:20 AM »
I tend to forget that debug mode != stats at the bottom... I never use debug mode, myself.
Well, I tested under Safari and it works just fine. (Safari because I need memory for another app right now and Opera with its 350 tabs is a bit too demanding right now.)
Re: New revs
« Reply #362, on November 21st, 2010, 10:18 PM »
rev 275

- Deleted the validation unit test. Seriously, what was that anyway? And we're going HTML5 now... (other/unittest/validation/*)
- Deleted the forced XHTML header from debug pages. (Load.php, Subs.php)
- Deleted the strict doctype fix, as, known song, we're going HTML5. (Subs.php, index.template.php)
! A class could be empty at some point... Bad logic, change logic. (Memberlist.template.php)
* Turned stand-alone nowrap styles into a nowrap class. (Admin.template.php, index.css, Errors.template.php, Install.english.php, Install.french.php, ManageBoards.template.php, Memberlist.template.php)
* Turned small stand-alone pages to HTML5 as well, even if it's not needed. Consistency. (install.php, Class-Editor.php, Errors.php, Load.php, ViewQuery.php, Errors.template.php, Help.template.php, ModerationCenter.template.php, Packages.template.php, Post.template.php, Printpage.template.php, Register.template.php)
Posted: November 21st, 2010, 09:46 PM

rev 276

* Turned a few addcslashes into more semantic JavaScriptEscape calls. (Class-Editor.php)
* Commenazi. (index.template.php)

(Small, but I don't know if I'll be able to commit later tonight.)
Re: New revs
« Reply #363, on November 21st, 2010, 11:22 PM »
rev 277

! There's probably never going to be something as stupidly exciting as rewriting a feature that took you dozens of lines in dozens of files, in ONE single line. Fixed XMLHttpRequest calls for different domains and subdomains. (script.js)
! Fixed a potential JS error. (topic.js)
! Syntax error. (ViewQuery.php)
* Converted MessageIndex template to HTML5, moved more inline code to footer, etc. (MessageIndex.template.php)

Seriously -- that domain name fix...? Why didn't I think of that in the first place, uh? I don't EVEN need to specify a proper variable with a subdomain like on wedgeforum.com (smf_suburl).
Posted: November 21st, 2010, 11:16 PM

Not too impressive, but thanks to that silly trick, my noisen patch is down from 480 to 467KB...
Re: New revs
« Reply #364, on November 22nd, 2010, 10:38 AM »
rev 278

* Hopefully converted all of Packages and Profile to HTML5. (Packages.template.php, Profile.template.php)
* More JSE fixes. (Register.template.php, Profile.template.php, Login.english.php, Login.french.php)
- Removed DOMContentLoaded calls, as they're unneeded when JS is only loaded at the end of the page. (profile.js, script.js)
! Fixed Moderator list being empty in linktree when board has no owner. (Load.php)

I'm dying of boredom... HTML5 conversion has got to be the most annoying thing I've done in months. It makes IE6 compatibility look like heaven. So many deprecated elements... And not always for the better! Why isn't there a "transitional" setting for HTML5, that would do without the deprecated align/valign/width stuff...? It really, REALLY eats a lot of space to turn these all into inline CSS.
Re: New revs
« Reply #365, on November 22nd, 2010, 12:34 PM »
rev 279

* Mega-update with the end of cellspacing's, cellpadding's, align's, valign's, width's and other things that are deprecated in HTML5. Most boring task of the month. (Class-Editor.php, Modlog.php, Subs.php, index.css, editor.js, ManageSettings.french.php, ManageSettings.english.php, TEMPLATES: pretty much *all* of them so please don't force me to look into it)
* More JSE fixes. (index.english.php, index.french.php, ManageBans/Boards/Maintenance/Membergroups/News/Paid.template.php, PersonalMessage.template.php, Profile.template.php)

(I had to do all of these manually. One by one. AM I THROUGH NOW? :sob:)
Re: New revs
« Reply #366, on November 22nd, 2010, 05:06 PM »
rev 280

- Deleted all type="text/javascript" from script tags, as it's no longer required in HTML5. (All files)
* Tablenazi. (Packages.template.php)
Re: New revs
« Reply #367, on November 23rd, 2010, 12:13 AM »
rev 281

* Added two defines, SCRIPT_HEADER and SCRIPT_FOOTER, to make it easier to declare Javascript snippets with proper CDATA protection. You may still use <script> alone, it's up to you. Converting a few files to use these. (index.php, BoardIndex.php, Class-Editor.php, Subs.php, GenericMenu.template.php, index.template.php, Packages.template.php)
* More JSE fixes and footer movement. (Packages.template.php)
* When showing the footer Javascript, make sure to delete any redundant script tags. This may not be worth the trouble, but you know me and my regular expressions... (index.template.php)
* addLoadEvent() is not for dogs. (French saying.) (Subs.php)

Would like some opinions on SCRIPT_HEADER and SCRIPT_FOOTER...
Basically, this turns something like this:

Code: [Select]
$context['footer'] .= '
<script><!-- // --><![CDATA[
initMenu(document.getElementById("amen' . ($mid > 1 ? '_' . ($mid-1) : '') . '"));
// ]]></script>';

Into this:

Code: [Select]
$context['footer'] .= SCRIPT_HEADER . '
initMenu(document.getElementById("amen' . ($mid > 1 ? '_' . ($mid-1) : '') . '"));' . SCRIPT_FOOTER;

Is it worth it? Would you, as programmers, be more like to use these instead of typing the CDATA from memory or copying it from other code stuff?
Would it be more natural/less confusing to just do something like this?

Code: [Select]
$context['footer'] .= '
<script>' . CDATA_HEADER . '
initMenu(document.getElementById("amen' . ($mid > 1 ? '_' . ($mid-1) : '') . '"));
' . CDATA_FOOTER . '</script>';

I like CDATA_HEADER better, but I figured most people would rather have SCRIPT_HEADER from the beginning...
Posted: November 22nd, 2010, 11:47 PM

Silly me... Alternatively, I could do it this way: users write scripts with <script> (no CDATA), and at runtime I'll simply add the CDATA before printing the tag. I'd just need to make sure not to add CDATA header/footer to <script url="something"></script>
(Obviously, it would take a bit more server CPU time to process. Not much though...)

live627

  • Should five per cent appear too small / Be thankful I don't take it all / 'Cause I'm the taxman, yeah I'm the taxman
  • Posts: 1,670
Re: New revs
« Reply #368, on November 23rd, 2010, 12:43 AM »
rev 282

* More converting deprecated attributes to CSS equivalents (Themes.template.php, Search.template.php, Profile.template.php, Packages.template.php, MessageIndex.template.php, Login.template.php, Display.template.php, Admin.template.php)
Posted: November 23rd, 2010, 12:33 AM

The CDATA... bit hard to say. CDATA_HEADER seems more logical because it gives the impressiion that a CDATA tag is being used. SCRIPT_HEADER...... sounds like it contains <script>. To me, anywzay.

Is it worth it? No idea..
A confident man keeps quiet.whereas a frightened man keeps talking, hiding his fear.

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: New revs
« Reply #369, on November 23rd, 2010, 12:45 AM »
* Arantor would prefer to use CDATA_ rather than SCRIPT_

live627

  • Should five per cent appear too small / Be thankful I don't take it all / 'Cause I'm the taxman, yeah I'm the taxman
  • Posts: 1,670
Re: New revs
« Reply #370, on November 23rd, 2010, 06:55 AM »
Oh wait... the actual tag is included. Perhaps SCRIPT_HEADER fits after all.
Posted: November 23rd, 2010, 02:36 AM

rev 284 (:edit: :P)

! Parse error (LogInOut.php)
* Converted another file to HTML5. Moving Javascript to the footer, using data-onclick (Register.template.php)
! Audio verification close button should close an iframe and not a window (Register.template.php)
* Changed an inline style to its equivalent class (Register.template.php)
! SMF bug: Refreshing the CAPTCHA would bring you to the top of the page (GenericControls.template.php)



Note to whoever finishes converting that file (probably me): Only the guest registration area was tackled; the other tmpl functions still need looked at.

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: New revs
« Reply #371, on November 23rd, 2010, 11:48 AM »
rev 285

! Fixed captcha sound popup and simplified Javascript. (GenericControls.template.php, Register.template.php, captcha.js)
! Reverted Profile template to revision 281. (Profile.template.php)
! Reverted all <img style="width/height"> changes, as HTML5 perfectly supports <img width/height>. (Display.template.php, Login.template.php, MessageIndex.template.php, Packages.template.php, Search.template.php)
* Fixed cat_bar margins and indentation in the admin settings. (Admin.template.php, admin.css)
* Added a seamless parameter to the preview iframe, as recommended in HTML5. (Themes.template.php)
Re: New revs
« Reply #372, on November 23rd, 2010, 03:42 PM »
rev 286

* Split $context['footer'] into $context['footer'] (regular HTML) and $context['footer_js'] (postponed Javascript). (Load.php, index.template.php, etc.)
- Removed SCRIPT_HEADER/SCRIPT_FOOTER because of the better implementation. (index.php, etc.)
+ Added new Javascript encapsulator. add_js() (temp name) will add your postponed Javascript to $context['footer_js'] and deal with the layout for you. You can still manually add to $context['footer_js'], for instead if you need to manipulate the JS buffer or add characters without newlines. The main benefit is that you can call add_js('hello', $world) and it will behave the same as add_js('hello' . $world'), which makes it easy to convert older templates. (BoardIndex.php, Class-Editor.php, Load.php, ManageBoards.php, ManageMail.php, ManageNews.php, ManagePaid.php, ManageRegistration.php, ManageSearchEngines.php, ManageSettings.php, QueryString.php, Subs.php, TEMPLATES: Admin, Calendar, Display, GenericMenu, MessageIndex, Packages, Post, Register, Stats)
+ Also added add_js_file() function, to specify a JS file to load later, or a list of files. Warning: doing add_js_file($scripturl, '?something') will consider $scripturl as a standalone script. I could improve the behavior but I don't know if it's worth it. (Class-Editor.php, QueryString.php, TEMPLATES: Admin, Display, MessageIndex, Register, Stats)

Now, finishing inline JS should be a piece of cake... :)
Will still need to finish the data-* fixes (has to be done manually because of the hitme complexity + some onclick calls don't require postponing). And I'll be done...

live627

  • Should five per cent appear too small / Be thankful I don't take it all / 'Cause I'm the taxman, yeah I'm the taxman
  • Posts: 1,670
Re: New revs
« Reply #373, on November 24th, 2010, 01:41 AM »
rev 287

! JSE fix on alert (Register.template.php)
* Moving Javascript to the footer using add_js() (Profile.template.php, Register.template.php)
Re: New revs
« Reply #374, on November 24th, 2010, 06:55 AM »Last edited on November 24th, 2010, 07:03 AM by live627
rev 288

* Moved more Javascript to the bottom (TEMPLATES: Admin, Announce, BoardIndex, Errors, GenericList, index, Login, ManageAttachments, ManageBans, ManageBoards, ManageCalendar, ManageMaintenance, ManageMembergroups, ManageMembers, ManageNews)
! More JSE fixes (ManageMembers.template.php, ManageNews.template.php)



I went ahead and sent IE's HTML5 JS hack in index.template to the bottom - is this the right thing to do? I don't have IE (in Linuxland) so can't test that.

Login.template has Javascripts to set focus to the username inputs. Why not take advantage of HTML5's autofocus feature?

:edit: Perhaps the username field on the registration page can have the autofocus attribute as well.