From 39bfced7271a0b7d547428417a69344e36178194 Mon Sep 17 00:00:00 2001 From: Matt Claypotch Date: Thu, 7 Apr 2011 16:00:59 -0700 Subject: [PATCH] JS restructuring. Outside code now lives in js/lib. --- .../js/{zamboni => lib}/excanvas.compiled.js | 0 media/js/{zamboni => lib}/highcharts.src.js | 0 media/js/{zamboni => lib}/jqmobile.js | 0 media/js/{zamboni => lib}/jquery-1.4.2.min.js | 0 media/js/{zamboni => lib}/jquery-1.5.min.js | 0 .../js/{zamboni => lib}/jquery-datepicker.js | 0 media/js/{zamboni => lib}/jquery-ui/README | 0 .../jquery-ui/custom-1.8.5.min.js | 0 media/js/{ => lib}/jquery-ui/jqModal.js | 0 media/js/{ => lib}/jquery-ui/ui.lightbox.js | 0 media/js/{ => lib}/jquery.cookie.js | 0 .../jquery.hoverIntent.min.js | 0 media/js/{zamboni => lib}/jquery.mockjax.js | 0 .../{zamboni => lib}/jquery.sparkline.min.js | 0 .../jquery.tablesorter.min.js | 0 media/js/{zamboni => lib}/jstestnet.js | 0 .../stats => workers}/stats_worker.js | 4 --- media/js/zamboni/stats/stats_manager.js | 2 +- media/js/zamboni/underscore-min.js | 17 ----------- settings.py | 30 +++++++++---------- templates/qunit.html | 2 +- 21 files changed, 17 insertions(+), 38 deletions(-) rename media/js/{zamboni => lib}/excanvas.compiled.js (100%) rename media/js/{zamboni => lib}/highcharts.src.js (100%) rename media/js/{zamboni => lib}/jqmobile.js (100%) rename media/js/{zamboni => lib}/jquery-1.4.2.min.js (100%) rename media/js/{zamboni => lib}/jquery-1.5.min.js (100%) rename media/js/{zamboni => lib}/jquery-datepicker.js (100%) rename media/js/{zamboni => lib}/jquery-ui/README (100%) rename media/js/{zamboni => lib}/jquery-ui/custom-1.8.5.min.js (100%) rename media/js/{ => lib}/jquery-ui/jqModal.js (100%) rename media/js/{ => lib}/jquery-ui/ui.lightbox.js (100%) rename media/js/{ => lib}/jquery.cookie.js (100%) rename media/js/{zamboni => lib}/jquery.hoverIntent.min.js (100%) rename media/js/{zamboni => lib}/jquery.mockjax.js (100%) rename media/js/{zamboni => lib}/jquery.sparkline.min.js (100%) rename media/js/{zamboni => lib}/jquery.tablesorter.min.js (100%) rename media/js/{zamboni => lib}/jstestnet.js (100%) rename media/js/{zamboni/stats => workers}/stats_worker.js (99%) delete mode 100644 media/js/zamboni/underscore-min.js diff --git a/media/js/zamboni/excanvas.compiled.js b/media/js/lib/excanvas.compiled.js similarity index 100% rename from media/js/zamboni/excanvas.compiled.js rename to media/js/lib/excanvas.compiled.js diff --git a/media/js/zamboni/highcharts.src.js b/media/js/lib/highcharts.src.js similarity index 100% rename from media/js/zamboni/highcharts.src.js rename to media/js/lib/highcharts.src.js diff --git a/media/js/zamboni/jqmobile.js b/media/js/lib/jqmobile.js similarity index 100% rename from media/js/zamboni/jqmobile.js rename to media/js/lib/jqmobile.js diff --git a/media/js/zamboni/jquery-1.4.2.min.js b/media/js/lib/jquery-1.4.2.min.js similarity index 100% rename from media/js/zamboni/jquery-1.4.2.min.js rename to media/js/lib/jquery-1.4.2.min.js diff --git a/media/js/zamboni/jquery-1.5.min.js b/media/js/lib/jquery-1.5.min.js similarity index 100% rename from media/js/zamboni/jquery-1.5.min.js rename to media/js/lib/jquery-1.5.min.js diff --git a/media/js/zamboni/jquery-datepicker.js b/media/js/lib/jquery-datepicker.js similarity index 100% rename from media/js/zamboni/jquery-datepicker.js rename to media/js/lib/jquery-datepicker.js diff --git a/media/js/zamboni/jquery-ui/README b/media/js/lib/jquery-ui/README similarity index 100% rename from media/js/zamboni/jquery-ui/README rename to media/js/lib/jquery-ui/README diff --git a/media/js/zamboni/jquery-ui/custom-1.8.5.min.js b/media/js/lib/jquery-ui/custom-1.8.5.min.js similarity index 100% rename from media/js/zamboni/jquery-ui/custom-1.8.5.min.js rename to media/js/lib/jquery-ui/custom-1.8.5.min.js diff --git a/media/js/jquery-ui/jqModal.js b/media/js/lib/jquery-ui/jqModal.js similarity index 100% rename from media/js/jquery-ui/jqModal.js rename to media/js/lib/jquery-ui/jqModal.js diff --git a/media/js/jquery-ui/ui.lightbox.js b/media/js/lib/jquery-ui/ui.lightbox.js similarity index 100% rename from media/js/jquery-ui/ui.lightbox.js rename to media/js/lib/jquery-ui/ui.lightbox.js diff --git a/media/js/jquery.cookie.js b/media/js/lib/jquery.cookie.js similarity index 100% rename from media/js/jquery.cookie.js rename to media/js/lib/jquery.cookie.js diff --git a/media/js/zamboni/jquery.hoverIntent.min.js b/media/js/lib/jquery.hoverIntent.min.js similarity index 100% rename from media/js/zamboni/jquery.hoverIntent.min.js rename to media/js/lib/jquery.hoverIntent.min.js diff --git a/media/js/zamboni/jquery.mockjax.js b/media/js/lib/jquery.mockjax.js similarity index 100% rename from media/js/zamboni/jquery.mockjax.js rename to media/js/lib/jquery.mockjax.js diff --git a/media/js/zamboni/jquery.sparkline.min.js b/media/js/lib/jquery.sparkline.min.js similarity index 100% rename from media/js/zamboni/jquery.sparkline.min.js rename to media/js/lib/jquery.sparkline.min.js diff --git a/media/js/zamboni/jquery.tablesorter.min.js b/media/js/lib/jquery.tablesorter.min.js similarity index 100% rename from media/js/zamboni/jquery.tablesorter.min.js rename to media/js/lib/jquery.tablesorter.min.js diff --git a/media/js/zamboni/jstestnet.js b/media/js/lib/jstestnet.js similarity index 100% rename from media/js/zamboni/jstestnet.js rename to media/js/lib/jstestnet.js diff --git a/media/js/zamboni/stats/stats_worker.js b/media/js/workers/stats_worker.js similarity index 99% rename from media/js/zamboni/stats/stats_worker.js rename to media/js/workers/stats_worker.js index ebf54db34d..c9c2f523de 100644 --- a/media/js/zamboni/stats/stats_worker.js +++ b/media/js/workers/stats_worker.js @@ -151,7 +151,3 @@ addEventListener('message', function(e) { } }, false); - - - - diff --git a/media/js/zamboni/stats/stats_manager.js b/media/js/zamboni/stats/stats_manager.js index 671d2c5de4..0c57785743 100644 --- a/media/js/zamboni/stats/stats_manager.js +++ b/media/js/zamboni/stats/stats_manager.js @@ -53,7 +53,7 @@ // Worker pool for Web Worker management - var stats_worker_url = z.media_url+"js/zamboni/stats/stats_worker.js"; + var stats_worker_url = z.media_url+"js/workers/stats_worker.js"; var StatsWorkerPool = new WorkerPool(4); diff --git a/media/js/zamboni/underscore-min.js b/media/js/zamboni/underscore-min.js deleted file mode 100644 index 2c8b499882..0000000000 --- a/media/js/zamboni/underscore-min.js +++ /dev/null @@ -1,17 +0,0 @@ -(function(){var j=this,n=j._,i=function(a){this._wrapped=a},m=typeof StopIteration!=="undefined"?StopIteration:"__break__",b=j._=function(a){return new i(a)};if(typeof exports!=="undefined")exports._=b;var k=Array.prototype.slice,o=Array.prototype.unshift,p=Object.prototype.toString,q=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;b.VERSION="0.5.6";b.each=function(a,c,d){try{if(a.forEach)a.forEach(c,d);else if(b.isArray(a)||b.isArguments(a))for(var e=0,f=a.length;e=e.computed&&(e={value:f,computed:g})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a))return Math.min.apply(Math,a);var e={computed:Infinity};b.each(a,function(f,g,h){g=c?c.call(d,f,g,h):f;gf?1:0}),"value")};b.sortedIndex=function(a,c,d){d=d||b.identity;for(var e=0,f=a.length;e>1;d(a[g])=0})})};b.zip=function(){for(var a=b.toArray(arguments),c=b.max(b.pluck(a,"length")),d=new Array(c),e=0;e0?f-c:c-f)>=0)return e;e[g++]=f}};b.bind=function(a,c){var d=b.rest(arguments,2);return function(){return a.apply(c||j,d.concat(b.toArray(arguments)))}};b.bindAll=function(a){var c=b.rest(arguments);if(c.length==0)c=b.functions(a);b.each(c,function(d){a[d]=b.bind(a[d],a)}); -return a};b.delay=function(a,c){var d=b.rest(arguments,2);return setTimeout(function(){return a.apply(a,d)},c)};b.defer=function(a){return b.delay.apply(b,[a,1].concat(b.rest(arguments)))};b.wrap=function(a,c){return function(){var d=[a].concat(b.toArray(arguments));return c.apply(c,d)}};b.compose=function(){var a=b.toArray(arguments);return function(){for(var c=b.toArray(arguments),d=a.length-1;d>=0;d--)c=[a[d].apply(this,c)];return c[0]}};b.keys=function(a){if(b.isArray(a))return b.range(0,a.length); -var c=[];for(var d in a)q.call(a,d)&&c.push(d);return c};b.values=function(a){return b.map(a,b.identity)};b.functions=function(a){return b.select(b.keys(a),function(c){return b.isFunction(a[c])}).sort()};b.extend=function(a,c){for(var d in c)a[d]=c[d];return a};b.clone=function(a){if(b.isArray(a))return a.slice(0);return b.extend({},a)};b.tap=function(a,c){c(a);return a};b.isEqual=function(a,c){if(a===c)return true;var d=typeof a;if(d!=typeof c)return false;if(a==c)return true;if(!a&&c||a&&!c)return false; -if(a.isEqual)return a.isEqual(c);if(b.isDate(a)&&b.isDate(c))return a.getTime()===c.getTime();if(b.isNaN(a)&&b.isNaN(c))return true;if(b.isRegExp(a)&&b.isRegExp(c))return a.source===c.source&&a.global===c.global&&a.ignoreCase===c.ignoreCase&&a.multiline===c.multiline;if(d!=="object")return false;if(a.length&&a.length!==c.length)return false;d=b.keys(a);var e=b.keys(c);if(d.length!=e.length)return false;for(var f in a)if(!b.isEqual(a[f],c[f]))return false;return true};b.isEmpty=function(a){return b.keys(a).length== -0};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=function(a){return!!(a&&a.concat&&a.unshift)};b.isArguments=function(a){return a&&b.isNumber(a.length)&&!b.isArray(a)&&!r.call(a,"length")};b.isFunction=function(a){return!!(a&&a.constructor&&a.call&&a.apply)};b.isString=function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)};b.isNumber=function(a){return p.call(a)==="[object Number]"};b.isDate=function(a){return!!(a&&a.getTimezoneOffset&&a.setUTCFullYear)};b.isRegExp=function(a){return!!(a&& -a.test&&a.exec&&(a.ignoreCase||a.ignoreCase===false))};b.isNaN=function(a){return b.isNumber(a)&&isNaN(a)};b.isNull=function(a){return a===null};b.isUndefined=function(a){return typeof a=="undefined"};b.noConflict=function(){j._=n;return this};b.identity=function(a){return a};b.breakLoop=function(){throw m;};var s=0;b.uniqueId=function(a){var c=s++;return a?a+c:c};b.templateSettings={start:"<%",end:"%>",interpolate:/<%=(.+?)%>/g};b.template=function(a,c){var d=b.templateSettings;a=new Function("obj", -"var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+a.replace(/[\r\t\n]/g," ").replace(new RegExp("'(?=[^"+d.end[0]+"]*"+d.end+")","g"),"\t").split("'").join("\\'").split("\t").join("'").replace(d.interpolate,"',$1,'").split(d.start).join("');").split(d.end).join("p.push('")+"');}return p.join('');");return c?a(c):a};b.forEach=b.each;b.foldl=b.inject=b.reduce;b.foldr=b.reduceRight;b.filter=b.select;b.every=b.all;b.some=b.any;b.head=b.first;b.tail=b.rest;b.methods=b.functions; -var l=function(a,c){return c?b(a).chain():a};b.each(b.functions(b),function(a){var c=b[a];i.prototype[a]=function(){var d=b.toArray(arguments);o.call(d,this._wrapped);return l(c.apply(b,d),this._chain)}});b.each(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var c=Array.prototype[a];i.prototype[a]=function(){c.apply(this._wrapped,arguments);return l(this._wrapped,this._chain)}});b.each(["concat","join","slice"],function(a){var c=Array.prototype[a];i.prototype[a]=function(){return l(c.apply(this._wrapped, -arguments),this._chain)}});i.prototype.chain=function(){this._chain=true;return this};i.prototype.value=function(){return this._wrapped}})(); diff --git a/settings.py b/settings.py index f52ce1d580..2503844b28 100644 --- a/settings.py +++ b/settings.py @@ -395,9 +395,9 @@ MINIFY_BUNDLES = { 'js': { # JS files common to the entire site. 'common': ( - 'js/zamboni/jquery-1.4.2.min.js', - 'js/zamboni/jquery-ui/custom-1.8.5.min.js', - 'js/zamboni/underscore-min.js', + 'js/lib/jquery-1.4.2.min.js', + 'js/lib/jquery-ui/custom-1.8.5.min.js', + 'js/lib/underscore-min.js', 'js/zamboni/browser.js', 'js/amo2009/addons.js', 'js/zamboni/init.js', @@ -405,10 +405,10 @@ MINIFY_BUNDLES = { 'js/zamboni/buttons.js', 'js/zamboni/tabs.js', - 'js/jquery.cookie.js', + 'js/lib/jquery.cookie.js', 'js/zamboni/global.js', 'js/amo2009/global.js', - 'js/jquery-ui/jqModal.js', + 'js/lib/jquery-ui/jqModal.js', 'js/amo2009/home.js', 'js/zamboni/l10n.js', 'js/zamboni/storage.js', @@ -417,14 +417,14 @@ MINIFY_BUNDLES = { 'js/zamboni/homepage.js', # Add-ons details page - 'js/jquery-ui/ui.lightbox.js', + 'js/lib/jquery-ui/ui.lightbox.js', 'js/get-satisfaction-v2.js', 'js/zamboni/contributions.js', 'js/zamboni/addon_details.js', 'js/zamboni/reviews.js', # Personas - 'js/zamboni/jquery.hoverIntent.min.js', + 'js/lib/jquery.hoverIntent.min.js', 'js/zamboni/personas.js', # Collections @@ -443,22 +443,22 @@ MINIFY_BUNDLES = { 'js/global/menu.js', ), 'zamboni/discovery': ( - 'js/zamboni/jquery-1.4.2.min.js', - 'js/zamboni/underscore-min.js', + 'js/lib/jquery-1.4.2.min.js', + 'js/lib/underscore-min.js', 'js/zamboni/browser.js', 'js/zamboni/init.js', 'js/zamboni/format.js', # Add-ons details 'js/zamboni/buttons.js', - 'js/jquery-ui/ui.lightbox.js', + 'js/lib/jquery-ui/ui.lightbox.js', # Personas - 'js/zamboni/jquery.hoverIntent.min.js', + 'js/lib/jquery.hoverIntent.min.js', 'js/zamboni/personas.js', 'js/zamboni/truncation.js', - 'js/jquery.cookie.js', + 'js/lib/jquery.cookie.js', 'js/zamboni/storage.js', 'js/zamboni/discovery_addons.js', 'js/zamboni/discovery_pane.js', @@ -476,9 +476,9 @@ MINIFY_BUNDLES = { 'js/zamboni/files.js', ), 'zamboni/mobile': ( - 'js/zamboni/jquery-1.5.min.js', - 'js/zamboni/jqmobile.js', - 'js/jquery.cookie.js', + 'js/lib/jquery-1.5.min.js', + 'js/lib/jqmobile.js', + 'js/lib/jquery.cookie.js', 'js/zamboni/browser.js', 'js/zamboni/init.js', 'js/zamboni/format.js', diff --git a/templates/qunit.html b/templates/qunit.html index e5ef37f2db..51ad488632 100644 --- a/templates/qunit.html +++ b/templates/qunit.html @@ -270,7 +270,7 @@ {{ js('common') }} - + {% for url in suite.extra_urls %} {% endfor %}