Skip to:
Content

BuddyPress.org

Opened 11 years ago

Closed 10 years ago

Last modified 7 years ago

#1673 closed enhancement (fixed)

global.js - for packaged jQuery plugins use minify version when possible

Reported by: r-a-y Owned by: DJPaul
Milestone: 1.5 Priority: minor
Severity: normal Version:
Component: Core Keywords:
Cc:

Description

Instead of including the .pack versions of jQuery scripts, when possible try to use .min (minify) versions.

Minified scripts offer a performance boost (when gzip'd).

In global.js, the Cookie plugin and querystring plugin are packed.

cookie.min.js can be found here - http://dev.jqueryui.com/browser/tags/1.6rc6/external/cookie/jquery.cookie.min.js?rev=2024

An online minify javascript tool can be found here - http://jscompress.com/

Change History (6)

#1 @r-a-y
11 years ago

Okay, so this can almost be closed!
cookie.js is now minified in global.js.

Now if we can only minify the querystring plugin!

See below for a minifed version of the querystring plugin:

(function($){function QueryStringParser(){this.load();}
$.extend(QueryStringParser.prototype,{load:function(suppliedQueryString){this.Values=new Object();var queryString=suppliedQueryString||document.URL;var qsIndex=(suppliedQueryString||document.URL).indexOf('?');if(qsIndex<0)
return;queryString=queryString.substring(qsIndex);if(queryString.length<=1){return;}
var pairs=queryString.split('&');for(var i=0;i<pairs.length;i++){this.Values[pairs[i].split('=')[0].toLowerCase()]=decodeURIComponent(pairs[i].split('=')[1]);}},get:function(key){return(this.Values[key.toLowerCase()])?this.Values[key.toLowerCase()]:'';},set:function(key,value){this.Values[key.toLowerCase()]=value;return this;}});QueryStringParser.prototype.toString=function(){var params=[];for(var prop in this.Values){params.push(prop+"="+encodeURIComponent(this.Values[prop]));}
return'?'+params.join('&');};$.Params=new QueryStringParser();})(jQuery);

#2 @DJPaul
11 years ago

  • Milestone changed from 1.2 to 1.2.1

#3 @boonebgorges
10 years ago

  • Component set to Core
  • Owner set to DJPaul
  • Status changed from new to assigned

DJPaul - I'm assigning this to you since you've already looked into the issue of js minification. Let me know if you think it's in the cards for 1.3.

#4 @DJPaul
10 years ago

Sure, it should be relatively straightforward.

#5 @DJPaul
10 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

As this ticket referred to the (old) packed versions of some javascript libraries included in global.js, which have since been replaced by minified versions, I'm marking this ticket as resolved. #1891 covers CSS/JS minify for other parts of core and BP-Default.

#6 @johnjamesjacoby
7 years ago

  • Severity set to normal

See r8453 and #5208.

Note: See TracTickets for help on using tickets.