[RFC|Merged] Use Google's jQuery

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
VSE
Extension Customisations
Extension Customisations
Posts: 670
Joined: Mon Mar 08, 2010 9:18 am

Re: Use Google's jQuery

Post by VSE » Sun Sep 25, 2011 5:10 pm

Oh alright. I will create the ACP option to choose local or CDN. But I will not do the versioning since that would require including all those versions as local files with phpbb, and would be a bit excessive IMHO.
Has an irascible disposition.

Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: Use Google's jQuery

Post by Oleg » Sun Sep 25, 2011 6:09 pm

The version requested from a CDN should match the version we have in the tree.

We should try to prevent a situation where one of the chosen CDNs does not have a version that we ship (at some point in the future).

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

Re: Use Google's jQuery

Post by VSE » Sun Sep 25, 2011 6:37 pm

We will only allow the use of the version from CDN's that equals the version we are shipping.

My question is, we need to store the version as a variable or constant somewhere. Where is the best place/way to do that?

I think we could either:
1) hard-code the version numbers into the function that creates the links to the various CDNs
2) Define it as a constant
3) Store it as a config variable in the database

The question here is really, what is the best method to use to ease the update process of phpBB? Where will the dev team remember and know where to find and change this version number when they also update the hard-copy of jQuery that is included?
Has an irascible disposition.

Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: Use Google's jQuery

Post by Oleg » Sun Sep 25, 2011 7:19 pm

I think a constant would be the best approach.

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

Re: Use Google's jQuery

Post by VSE » Sun Sep 25, 2011 7:24 pm

Oleg wrote:I think a constant would be the best approach.
OK, so I will define the constant in constants.php
Has an irascible disposition.

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

Re: Use Google's jQuery

Post by VSE » Sun Sep 25, 2011 10:22 pm

Here it is.

ACP option to select Localhost, Google, Microsoft or jQuery CDNs.
Located in ACP under Board Features -> Load Settings

Also has a fall back to the local copy included with phpBB if the CDN fails, or if the board is being used offline.

Pull Request: https://github.com/phpbb/phpbb3/pull/389
Tracker: http://tracker.phpbb.com/browse/PHPBB3-10390
Has an irascible disposition.

User avatar
igorw
Registered User
Posts: 500
Joined: Thu Jan 04, 2007 11:47 pm

Re: Use Google's jQuery

Post by igorw » Sun Sep 25, 2011 11:07 pm

This really seems like the kind of configuration settings we want to avoid. We all know that the ACP is scary because of all of the options. So if we add this, the UI needs to be simple. Something among the lines of: "Serve jQuery from CDN: ON/OFF". And we choose one, that we will support. The user simply does not want to worry about which CDN to choose.

Also, this must be disabled by default. The privacy issue and the issue of including remote javascript make this a MUST opt-in.

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

Re: Use Google's jQuery

Post by naderman » Sun Sep 25, 2011 11:26 pm

VSE+ wrote:Here it is.
Thanks!

Thinking about Igor's point, I tend to agree that just a yes/no would be nicer for the ACP. But then the question is: which one do we pick? We can probably still have a config variable in the database (for our future about:config like config editor) that stores the actual CDN URL or something along those lines. So someone who really wants a different CDN, can pick a different one through the db.

What do you think?
VSE+ wrote:Also has a fall back to the local copy included with phpBB if the CDN fails, or if the board is being used offline.
Yup, that looks good, thanks.

Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: Use Google's jQuery

Post by Oleg » Mon Sep 26, 2011 12:06 am

"localhost" is incorrect for just about all live boards. I would suggest something along the lines of "included" or "bundled" copy instead of "localhost" and change the question to "Use the included/bundled copy of jQuery hosted on your server or use jQuery hosted by a third-party CDN", which is perhaps longer but more reflective of the actual option.

Note that the fallback option is going to be useless in cases where the browser never gets to it. Firefox will hang forever/infinitely loop in certain network conditions on an inline <script> tag like the one used for the cdn, never executing anything after it in the markup.

Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: Use Google's jQuery

Post by Oleg » Mon Sep 26, 2011 12:11 am

igorw wrote: Also, this must be disabled by default. The privacy issue and the issue of including remote javascript make this a MUST opt-in.
Agreed, but looking at the code this seems to be the case?

Post Reply