Permalink
Browse files

MINOR Reducing number of asset downloads by combining files in LeftAn…

…dMain->init() and including full jquery.ui.css instead of multiple @import statements
  • Loading branch information...
1 parent d916140 commit 43491c264180a835a3924400375bff87f4848ac7 @chillu chillu committed Apr 25, 2011
View
@@ -194,45 +194,37 @@ function init() {
Requirements::css(SAPPHIRE_ADMIN_DIR . '/css/screen.css');
- Requirements::javascript(SAPPHIRE_DIR . '/javascript/prototypefix/intro.js');
- Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/prototype/prototype.js');
- Requirements::javascript(SAPPHIRE_DIR . '/javascript/prototypefix/outro.js');
+ Requirements::javascript(THIRDPARTY_DIR . '/prototype/prototype.js');
- Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery/jquery.js');
+ Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
Requirements::javascript(SAPPHIRE_DIR . '/javascript/jquery_improvements.js');
- Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-ui/jquery-ui.js'); //import all of jquery ui
+ Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js'); //import all of jquery ui
- Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/json-js/json2.js');
- Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-metadata/jquery.metadata.js');
+ Requirements::javascript(THIRDPARTY_DIR . '/json-js/json2.js');
+ Requirements::javascript(THIRDPARTY_DIR . '/jquery-metadata/jquery.metadata.js');
// entwine
- Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-entwine/dist/jquery.entwine-dist.js');
+ Requirements::javascript(THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js');
Requirements::javascript(SAPPHIRE_ADMIN_DIR . '/javascript/ssui.core.js');
// @todo Load separately so the CSS files can be inlined
- Requirements::css(SAPPHIRE_DIR . '/thirdparty/jquery-ui-themes/smoothness/jquery.ui.all.css');
+ Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css');
// Required for TreeTools panel above tree
Requirements::javascript(SAPPHIRE_DIR . '/javascript/TabSet.js');
Requirements::javascript(SAPPHIRE_ADMIN_DIR . '/thirdparty/jsizes/lib/jquery.sizes.js');
Requirements::javascript(SAPPHIRE_ADMIN_DIR . '/thirdparty/jlayout/lib/jlayout.border.js');
Requirements::javascript(SAPPHIRE_ADMIN_DIR . '/thirdparty/jlayout/lib/jquery.jlayout.js');
- Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/behaviour/behaviour.js');
- Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-cookie/jquery.cookie.js');
+ Requirements::javascript(THIRDPARTY_DIR . '/behaviour/behaviour.js');
+ Requirements::javascript(THIRDPARTY_DIR . '/jquery-cookie/jquery.cookie.js');
Requirements::javascript(SAPPHIRE_ADMIN_DIR . '/thirdparty/jquery-notice/jquery.notice.js');
Requirements::javascript(SAPPHIRE_DIR . '/javascript/jquery-ondemand/jquery.ondemand.js');
Requirements::javascript(SAPPHIRE_ADMIN_DIR . '/javascript/jquery-changetracker/lib/jquery.changetracker.js');
Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang');
Requirements::add_i18n_javascript(SAPPHIRE_ADMIN_DIR . '/javascript/lang');
- Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/scriptaculous/effects.js');
- Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/scriptaculous/dragdrop.js');
- Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/scriptaculous/controls.js');
-
- Requirements::javascript(THIRDPARTY_DIR . '/tree/tree.js');
- Requirements::css(THIRDPARTY_DIR . '/tree/tree.css');
Requirements::javascript(THIRDPARTY_DIR . '/jstree/jquery.jstree.js');
Requirements::css(THIRDPARTY_DIR . '/jstree/themes/apple/style.css');
@@ -257,30 +249,44 @@ function init() {
}
Requirements::css(SAPPHIRE_ADMIN_DIR . '/css/unjquery.css');
-
+
// Javascript combined files
Requirements::combine_files(
- 'base.js',
+ 'lib.js',
array(
- 'sapphire/thirdparty/prototype/prototype.js',
- 'sapphire/thirdparty/behaviour/behaviour.js',
- 'sapphire/thirdparty/jquery/jquery.js',
- 'sapphire/thirdparty/jquery-livequery/jquery.livequery.js',
- 'sapphire/javascript/jquery-ondemand/jquery.ondemand.js',
- 'sapphire/thirdparty/jquery-ui/jquery-ui.js',
- 'sapphire/javascript/i18n.js',
+ THIRDPARTY_DIR . '/prototype/prototype.js',
+ THIRDPARTY_DIR . '/behaviour/behaviour.js',
+ THIRDPARTY_DIR . '/jquery/jquery.js',
+ SAPPHIRE_DIR . '/javascript/jquery_improvements.js',
+ THIRDPARTY_DIR . '/jquery-livequery/jquery.livequery.js',
+ SAPPHIRE_DIR . '/javascript/jquery-ondemand/jquery.ondemand.js',
+ THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js',
+ THIRDPARTY_DIR . '/json-js/json2.js',
+ THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js',
+ THIRDPARTY_DIR . '/jquery-cookie/jquery.cookie.js',
+ SAPPHIRE_ADMIN_DIR . '/thirdparty/jquery-notice/jquery.notice.js',
+ THIRDPARTY_DIR . '/jquery-metadata/jquery.metadata.js',
+ SAPPHIRE_ADMIN_DIR . '/thirdparty/jsizes/lib/jquery.sizes.js',
+ SAPPHIRE_ADMIN_DIR . '/thirdparty/jlayout/lib/jlayout.border.js',
+ SAPPHIRE_ADMIN_DIR . '/thirdparty/jlayout/lib/jquery.jlayout.js',
+ THIRDPARTY_DIR . '/jstree/jquery.jstree.js',
+ SAPPHIRE_ADMIN_DIR . '/javascript/jquery-changetracker/lib/jquery.changetracker.js',
+ SAPPHIRE_DIR . '/javascript/TreeDropdownField.js',
+ SAPPHIRE_DIR . '/javascript/TabSet.js',
+ SAPPHIRE_DIR . '/javascript/Validator.js',
+ SAPPHIRE_DIR . '/javascript/i18n.js',
+ SAPPHIRE_ADMIN_DIR . '/javascript/ssui.core.js',
)
);
Requirements::combine_files(
'leftandmain.js',
array(
- 'sapphire/thirdparty/scriptaculous/effects.js',
- 'sapphire/thirdparty/scriptaculous/dragdrop.js',
- 'sapphire/thirdparty/scriptaculous/controls.js',
- 'sapphire/admin/javascript/LeftAndMain.js',
- 'sapphire/javascript/tree/tree.js',
- 'sapphire/javascript/TreeDropdownField.js',
+ SAPPHIRE_ADMIN_DIR . '/javascript/LeftAndMain.js',
+ SAPPHIRE_ADMIN_DIR . '/javascript/LeftAndMain.Tree.js',
+ SAPPHIRE_ADMIN_DIR . '/javascript/LeftAndMain.EditForm.js',
+ SAPPHIRE_ADMIN_DIR . '/javascript/LeftAndMain.AddForm.js',
+ SAPPHIRE_ADMIN_DIR . '/javascript/LeftAndMain.BatchActions.js',
)
);
@@ -1,3 +0,0 @@
-#i18nStatus {
- margin-left: 0;
-}
@@ -51,7 +51,7 @@ public function dataClass() {
* @return string
*/
public function Field() {
- Requirements::css(SAPPHIRE_DIR . '/thirdparty/jquery-ui-themes/smoothness/jquery.ui.all.css');
+ Requirements::css(SAPPHIRE_DIR . '/thirdparty/jquery-ui-themes/smoothness/jquery-ui.css');
Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang');
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery/jquery.js');
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-ui/jquery-ui.js');
View
@@ -75,8 +75,7 @@ public function FieldHolder() {
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-ui/jquery-ui.js');
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-cookie/jquery.cookie.js');
- Requirements::css(SAPPHIRE_DIR . '/thirdparty/jquery-ui-themes/smoothness/jquery.ui.all.css');
- Requirements::css(SAPPHIRE_DIR . '/thirdparty/jquery-ui-themes/smoothness/jquery.ui.tabs.css');
+ Requirements::css(SAPPHIRE_DIR . '/thirdparty/jquery-ui-themes/smoothness/jquery.ui.css');
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-entwine/dist/jquery.entwine-dist.js');
@@ -121,7 +121,7 @@ public function Field() {
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jstree/jquery.jstree.js');
Requirements::javascript(SAPPHIRE_DIR . '/javascript/TreeDropdownField.js');
- Requirements::css(SAPPHIRE_DIR . '/thirdparty/jquery-ui-themes/smoothness/jquery.ui.all.css');
+ Requirements::css(SAPPHIRE_DIR . '/thirdparty/jquery-ui-themes/smoothness/jquery-ui.css');
Requirements::css(SAPPHIRE_DIR . '/css/TreeDropdownField.css');
if($this->Value() && $record = $this->objectForKey($this->Value())) {
@@ -87,7 +87,7 @@ function Field() {
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jstree/jquery.jstree.js');
Requirements::javascript(SAPPHIRE_DIR . '/javascript/TreeDropdownField.js');
- Requirements::css(SAPPHIRE_DIR . '/thirdparty/jquery-ui-themes/smoothness/jquery.ui.all.css');
+ Requirements::css(SAPPHIRE_DIR . '/thirdparty/jquery-ui-themes/smoothness/jquery-ui.css');
Requirements::css(SAPPHIRE_DIR . '/css/TreeDropdownField.css');
$value = '';
@@ -1,7 +0,0 @@
-Prototype replaces document.getElementsByClassName with it's own version. However many browsers
-now come with their own implementation, and prototype's is much slower.
-
-This fixes this by restoring the original after prototype is loaded.
-
-@todo: Safari 3 used to come with a broken document.getElementsByClassName. We should use
-the same checks jQuery does and not restore the function if it doesn't work the same as the spec.
@@ -1 +0,0 @@
-var browserGetElementsByClassName = document.getElementsByClassName;
@@ -1 +0,0 @@
-if (browserGetElementsByClassName) document.getElementsByClassName = browserGetElementsByClassName;
View
@@ -1633,17 +1633,8 @@ class Member_ProfileForm extends Form {
function __construct($controller, $name, $member) {
Requirements::clear();
Requirements::css(CMS_DIR . '/css/typography.css');
- Requirements::css(CMS_DIR . '/css/cms_right.css');
- Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/prototype/prototype.js");
- Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/behaviour/behaviour.js");
- Requirements::javascript(SAPPHIRE_DIR . "/javascript/prototype_improvements.js");
- Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/scriptaculous/scriptaculous.js");
- Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/scriptaculous/controls.js");
Requirements::css(SAPPHIRE_DIR . "/css/Form.css");
- Requirements::css(SAPPHIRE_DIR . "/css/MemberProfileForm.css");
-
-
$fields = $member->getCMSFields();
$fields->push(new HiddenField('ID','ID',$member->ID));
View
@@ -365,10 +365,6 @@ public function login() {
// only display tabs when more than one authenticator is provided
// to save bandwidth and reduce the amount of custom styling needed
if(count($forms) > 1) {
- Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/prototype/prototype.js");
- Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/behaviour/behaviour.js");
- Requirements::javascript(SAPPHIRE_DIR . "/javascript/prototype_improvements.js");
- Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/scriptaculous/effects.js");
Requirements::css(SAPPHIRE_DIR . "/css/Form.css");
// Needed because the <base href=".."> in the template makes problems
@@ -381,8 +377,7 @@ public function login() {
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-entwine/dist/jquery.entwine-dist.js');
- Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery.ui.all.css');
- Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery.ui.tabs.css');
+ Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css');
Requirements::css(SAPPHIRE_DIR . '/css/Security_login.css');
@@ -438,11 +433,6 @@ function basicauthlogin() {
* @return string Returns the "lost password" page as HTML code.
*/
public function lostpassword() {
- Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/prototype/prototype.js');
- Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/behaviour/behaviour.js');
- Requirements::javascript(SAPPHIRE_DIR . '/javascript/prototype_improvements.js');
- Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/scriptaculous/effects.js');
-
if(class_exists('SiteTree')) {
$tmpPage = new Page();
$tmpPage->Title = _t('Security.LOSTPASSWORDHEADER', 'Lost Password');
@@ -501,11 +491,6 @@ public function LostPasswordForm() {
* @return string Returns the "password sent" page as HTML code.
*/
public function passwordsent($request) {
- Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/behaviour/behaviour.js');
- Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/prototype/prototype.js');
- Requirements::javascript(SAPPHIRE_DIR . '/javascript/prototype_improvements.js');
- Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/scriptaculous/effects.js');
-
if(class_exists('SiteTree')) {
$tmpPage = new Page();
$tmpPage->Title = _t('Security.LOSTPASSWORDHEADER');

0 comments on commit 43491c2

Please sign in to comment.