[RFC|Merged] Include and use jQuery (originally for 3.2)

These requests for comments/change have lead to an implemented feature that has been successfully merged into the 3.1/Ascraeus branch. Everything listed in this forum will be available in phpBB 3.1.
Post Reply
User avatar
Ger
Registered User
Posts: 270
Joined: Mon Jul 26, 2010 1:55 pm
Location: 192.168.1.100
Contact:

Re: [RFC|Accepted] Include and use jQuery

Post by Ger » Mon May 09, 2011 9:49 am

RMcGirr83 wrote:IIRC, it must be hosted locally, no CDN, etc.
Actually, Google has a project "Let's make the web faster". As I've heard, they plan (or already do) to rank pages not only on relevance but also on speed. As the use of CDN can speed up a website (since the library might already be loaded in the cache because of a previous visited site that uses the same CDN) I would recommend the use of a CDN for this. Or even better: use a fallback system:
  1. Is there already a cached JS with that name? -> use that
  2. None cached? -> Use CDN preference 1 (e.g. Google)
  3. CDN preference 1 not available? -> Use CDN preference 2 (e.g. Microsoft CDN)
Above message may contain errors in grammar, spelling or wrongly chosen words. This is because I'm not a native speaker. My apologies in advance.

User avatar
Sierron
Registered User
Posts: 62
Joined: Wed Aug 25, 2010 11:41 am
Contact:

Re: [RFC|Accepted] Include and use jQuery

Post by Sierron » Mon May 09, 2011 2:08 pm

Ger wrote:
RMcGirr83 wrote:IIRC, it must be hosted locally, no CDN, etc.
Actually, Google has a project "Let's make the web faster". As I've heard, they plan (or already do) to rank pages not only on relevance but also on speed. As the use of CDN can speed up a website (since the library might already be loaded in the cache because of a previous visited site that uses the same CDN) I would recommend the use of a CDN for this. Or even better: use a fallback system:
  1. Is there already a cached JS with that name? -> use that
  2. None cached? -> Use CDN preference 1 (e.g. Google)
  3. CDN preference 1 not available? -> Use CDN preference 2 (e.g. Microsoft CDN)
Yeah and still, I for me, would want to select which options is taken. You cannot optimize a forum that much other than real homepages. And as far as I know that speed of a website thing is a small plus for the rating. Just because google said they add it to their rating thing it doesn't mean that they put 50% of their rating into it. Read the google blog about that.

User avatar
Ger
Registered User
Posts: 270
Joined: Mon Jul 26, 2010 1:55 pm
Location: 192.168.1.100
Contact:

Re: [RFC|Accepted] Include and use jQuery

Post by Ger » Mon May 09, 2011 2:24 pm

Sierron wrote:Yeah and still, I for me, would want to select which options is taken.
Why not?
Sierron wrote:And as far as I know that speed of a website thing is a small plus for the rating. Just because google said they add it to their rating thing it doesn't mean that they put 50% of their rating into it.
I didn't say that.
However, even if it would only count for 0,1% of the rating, why wouldn't you serve the choice to the board admin?

Every plus is still a plus. And besides that: it is user-friendly as well.

Basically the choice here is:
1. Provide the complete choice for the board admin
2. Make a CDN default, not offering the choice. The board admin could MOD so it's served localhost. (very easy MOD)
3. Make locahost default, not offering the choice. The board admin could MOD so it's served by CDN. (very easy MOD)

I prefer option 1, with the addition of a fallback system as described in my previous post. The system as described by VSE+ seems OK to use.
Above message may contain errors in grammar, spelling or wrongly chosen words. This is because I'm not a native speaker. My apologies in advance.

User avatar
ToonArmy
Registered User
Posts: 335
Joined: Fri Mar 26, 2004 7:31 pm
Location: Bristol, UK
Contact:

Re: [RFC|Accepted] Include and use jQuery

Post by ToonArmy » Mon May 09, 2011 10:43 pm

Couple of things I've picked up on.

First off jQuery's no conflict option should be enabled by default, it stops people using the $ shortcut directly. All phpBB JS should be wrapped in a closure or use the jQuery wellvariable directly, this keeps things clean and means people who embed their board don't end up with a conflicting version of jQuery or another framework all together. I've been using jQuery quite extensively at work, enforcing the no conflict option made integrating some code that used MooTools painless.

We have to remember that whilst including jQuery will certainly make things easier for MOD authors, that's not why we are including a JS framework; we want to write JS for phpBB itself, easily. There should to be a fixed version served locally, which should rarely need updating. If board owners want to change it to point to a CDN they can; I fail to see why it needs an administration interface, the ACP is already far too complicated. The people that realise the implications of using a CDN are probably clued up enough to make a very simple template change.

Also why is this still in the 3.2 forum?
Chris SmithBlogXMOOhlohArea51WikiNo support via PM/IM
Image

User avatar
naderman
Product Manager
Product Manager
Posts: 1727
Joined: Sun Jan 11, 2004 2:11 am
Location: Karlsruhe, Germany
Contact:

Re: [RFC|Accepted] Include and use jQuery

Post by naderman » Tue May 10, 2011 2:15 am

It was decided to move this to 3.1 only once the pull request is ready to be merged because this was started after the original "feature freeze" which has turned into a bit of a joke ...

User avatar
hanakin Online
Infrastructure Team
Infrastructure Team
Posts: 789
Joined: Sat Dec 25, 2010 9:02 pm
Contact:

Re: [RFC|Accepted] Include and use jQuery

Post by hanakin » Tue May 10, 2011 2:18 am

ToonArmy wrote:If board owners want to change it to point to a CDN they can; I fail to see why it needs an administration interface, the ACP is already far too complicated. The people that realise the implications of using a CDN are probably clued up enough to make a very simple template change.
I agree, while i personally like Gers idea of a fallback there is not really any reason this needs to be included in the acp interface/core by default as its extremely simple for those who would want it to mod or add a CDN

User avatar
RMcGirr83
Registered User
Posts: 357
Joined: Fri Mar 09, 2007 1:51 am
Contact:

Re: [RFC|Accepted] Include and use jQuery

Post by RMcGirr83 » Tue May 10, 2011 2:37 am

Why would one ever need to "fall back". I have never run across a situation where the present jQuery failed to provide what a previous version had provided.
Do not hire Christian Bullock he won't finish the job and will keep your money

User avatar
hanakin Online
Infrastructure Team
Infrastructure Team
Posts: 789
Joined: Sat Dec 25, 2010 9:02 pm
Contact:

Re: [RFC|Accepted] Include and use jQuery

Post by hanakin » Tue May 10, 2011 4:50 am

RMcGirr83 wrote:Why would one ever need to "fall back". I have never run across a situation where the present jQuery failed to provide what a previous version had provided.
not a version fallback a cdn fallback to loacal version/alternate cdn

User avatar
VSE
Extension Customisations
Extension Customisations
Posts: 670
Joined: Mon Mar 08, 2010 9:18 am

Re: [RFC|Accepted] Include and use jQuery

Post by VSE » Tue May 10, 2011 9:22 am

If you use no conflict mode, you can use it to create your own new short-cut alternative to the $, like this for example:

Code: Select all

 <head>
   <script src="jquery.js"></script>
   <script>
     var $phpbb = jQuery.noConflict();
     
     $phpbb(document).ready(function(){
       $phpbb("div").hide();
     });
   </script>
 </head>
We could create any shortcut we want :)
ToonArmy wrote: I fail to see why it needs an administration interface, the ACP is already far too complicated. The people that realise the implications of using a CDN are probably clued up enough to make a very simple template change.
I guess I can agree with that. I mean, if jQuery is included in 1 place - overall_header.html - then it should be easy enough to change it if somebody wants to.
Has an irascible disposition.

User avatar
RMcGirr83
Registered User
Posts: 357
Joined: Fri Mar 09, 2007 1:51 am
Contact:

Re: [RFC|Accepted] Include and use jQuery

Post by RMcGirr83 » Tue May 10, 2011 11:10 am

VSE+ wrote:If you use no conflict mode, you can use it to create your own new short-cut alternative to the $, like this for example:

Code: Select all

 <head>
   <script src="jquery.js"></script>
   <script>
     var $phpbb = jQuery.noConflict();
     
     $phpbb(document).ready(function(){
       $phpbb("div").hide();
     });
   </script>
 </head>
We could create any shortcut we want :)
FWIW, can simply be

Code: Select all

   <script>
     var $phpbb = jQuery.noConflict();
     
     $phpbb(function(){
       $phpbb("div").hide();
     });
   </script>
jQuery does not require document.ready :)
Do not hire Christian Bullock he won't finish the job and will keep your money

Post Reply