Issue Details (XML | Word | Printable)

Key: MDL-14731
Type: New Feature New Feature
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Nicolas Connault
Reporter: Bryce Thornton
Votes: 0
Watchers: 1
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

Allow YUI files to be loaded from Yahoo directly

Created: 07/May/08 10:40 PM   Updated: 25/Jul/08 07:27 PM
Component/s: AJAX
Affects Version/s: 1.9
Fix Version/s: 2.0

File Attachments: 1. File add_external_yui.diff (1 kB)


Database: Any
Participants: Bryce Thornton, Eloy Lafuente (stronk7), Nicolas Connault and Petr Skoda
Security Level: None
Resolved date: 25/Jul/08
Affected Branches: MOODLE_19_STABLE
Fixed Branches: MOODLE_20_STABLE


 Description  « Hide
I am always looking at ways to speed up our page loads. One easy way to get a bit more speed is to load the YUI library directly from Yahoo's servers. They do allow this and have a page dedicated to doing it here: http://developer.yahoo.com/yui/articles/hosting/

I am attaching a patch that is a simple modification to the ajaxlib.php file. It also relies on a CFG parameter to be set. The default is to load the files from the local filesystem. Only if the CFG variable is set will it load them from Yahoo.

One thing that I would like to change with this is that I had to hardcode the YUI version number. It would be great if that was an easier bit of information to pull dynamically. I thought about parsing the YUI README file to get the version, but felt like that was a bit sloppy.

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Nicolas Connault added a comment - 24/Jul/08 09:37 PM
Improved Bryce's patch and applied. YUI version number is kept in a simple version.php file, to be updated manually when updating the YUI libraries.

Eloy Lafuente (stronk7) added a comment - 24/Jul/08 11:17 PM
Hi Nico,

aren't there limits (restrictions) about js only being able to connect to server it comes from, or something similar. Or perhaps I'm wrong and that's only java applets.

Anyway, sounds ok for me to provide that ability via CFG parameter. +1 for it.

Ciao


Bryce Thornton added a comment - 24/Jul/08 11:50 PM
Eloy,

You're thinking of the "same origin" policy for Javascript:

http://www.mozilla.org/projects/security/components/same-origin.html

This refers to calling other servers while executing Javascript. All we're doing here is loading the YUI libraries from Yahoo's server. They will function just like we loaded them from our own server.

Thanks,
Bryce


Petr Skoda added a comment - 25/Jul/08 05:46 AM
this can not be enabled by default, I have changed the default in cvs

Petr Skoda added a comment - 25/Jul/08 05:46 AM
reopening, please add a warning that all users must have internet access

Nicolas Connault added a comment - 25/Jul/08 05:32 PM
Added warning.

Nicolas Connault added a comment - 25/Jul/08 07:27 PM - edited
See this YUI blog article for an interesting approach to loading external JS files:
http://yuiblog.com/blog/2008/07/22/non-blocking-scripts/