Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/site/app/webroot/js/editors.js
diff options
context:
space:
mode:
Diffstat (limited to 'site/app/webroot/js/editors.js')
-rw-r--r--site/app/webroot/js/editors.js136
1 files changed, 19 insertions, 117 deletions
diff --git a/site/app/webroot/js/editors.js b/site/app/webroot/js/editors.js
index e79a91a..6a00292 100644
--- a/site/app/webroot/js/editors.js
+++ b/site/app/webroot/js/editors.js
@@ -11,54 +11,15 @@ function hideMenu() {
/*************************************************
* editors/queue *
*************************************************/
-var editors_queue = {
- init: function() {
- $('#filterHeader').click(this.toggleFilters);
-
- $('input#FilterAddonOrAuthor').autocomplete(addonAutocompleteUrl, {
- minChars: 4,
- max: 40,
- formatItem: function(row) {
- // encode results using a temporary jquery element
- return '<b>' + $('<div/>').text(row[0]).html() + '</b>';
- },
- formatResult: function(row) { return row[0]; },
- });
-
- $('select#FilterApplication').change(this.populateAppVersions);
-
- if (! $('select#FilterApplication').val()) {
- $('select#FilterMaxVersion').attr('disabled', 'disabled');
- }
- },
-
- /**
- * Expand/collapse the filter box
- */
- toggleFilters: function() {
- var div = document.getElementById('filterTable');
- if (div.style.display == 'none') {
- div.style.display = '';
- }
- else {
- div.style.display = 'none';
- }
- },
-
- /**
- * Fill the maxVersion select dropdown based on selected application
- */
- populateAppVersions: function() {
- var appId = $('select#FilterApplication').val();
- var selectNode = $('select#FilterMaxVersion');
- if (appId) {
- selectNode.attr('disabled', '');
- selectNode.load(appversionLookupUrl+appId);
- } else {
- selectNode.html('');
- selectNode.attr('disabled', 'disabled');
- }
- },
+//Expand/collapse the filter box
+function toggleFilters() {
+ var div = document.getElementById('filterTable');
+ if (div.style.display == 'none') {
+ div.style.display = '';
+ }
+ else {
+ div.style.display = 'none';
+ }
}
/*************************************************
@@ -210,15 +171,19 @@ function clearInput(input) {
Most likely done on focus to reduce # of objects instantiated on page load
*/
function prepAutocomplete(tagid) {
- $('#new-addon-id-' + tagid).autocomplete(autocompleteurl,
- {
- minChars:4,
- formatItem: function(row) { return '<b>' + row[0] + '</b><br><i>' + row[1] + '</i>'; },
- formatResult: function(row) { return row[2]; }
- });
+ $('#new-addon-id-' + tagid).autocomplete(autocompleteurl, {minChars:4, formatItem: formatResult, formatValue: formatData });
$('#new-addon-id-' + tagid).focus();
}
+//Formatting functions for autocomplete results returned from server
+function formatResult(row) {
+ return '<b>' + row[0] + '</b><br><i>' + row[1] + '</i>';
+}
+
+function formatData(row) {
+ return row[2];
+}
+
/*
Parses input for addon id and name, then sends to server
*/
@@ -370,66 +335,3 @@ function removeFeature(tagid, addonid) {
});
return false;
}
-
-/*************************************************
-* editors/performance *
-*************************************************/
-var editors_performance = {
- init: function() {
- $('.performanceHeader.collapsible').click(function() {
- var el = $(this).next();
- if(! $(':animated', el).length) {
- if ($(':visible', el).length) {
- el.slideUp('200', function(){});
- $(this).removeClass('expanded');
- } else {
- el.slideDown('200', function(){});
- $(this).addClass('expanded');
- }
- }
- });
-
- $('select#performanceUser').change(this.switchUser);
-
- $('#historyTable').tablesorter({cssHeader:'headerSort'});
- },
-
- switchUser: function() {
- var qs = '?user='+encodeURIComponent($('select#performanceUser').val());
- if (document.location.search.length > 0) {
- var params = document.location.search.substr(1).split("&");
- for (var i = 0; i < params.length; i++) {
- if (params[i].substr(0, 5) != 'user=') {
- qs = qs + '&' + params[i];
- }
- }
- }
- window.location.search = qs;
- },
-
- showChartTooltip: function(x, y, contents) {
- $('<div id="chartTip">' + contents + '</div>').css( {
- position: 'absolute',
- display: 'none',
- top: y - 25,
- left: x + 5,
- border: '1px solid #fdd',
- padding: '2px',
- 'background-color': '#fee',
- opacity: 0.80
- }).appendTo('body').fadeIn(100);
- },
-
- pieLegendEntry: function(color, text, value, total, id) {
- var percent = 0;
- if (total > 0) {
- percent = 100 * value / total;
- }
- var precision = 0;
- if (percent < 1 && percent > 0) {
- precision = 2;
- }
- var label = text + ' ' + percent.toFixed(precision) + '%';
- return $('<div id="' + id + '">' + label + '</div>').css('border-left','1.5em solid '+color);
- }
-}