gecko/browser/base/content/tabcandy/app/switch.js
Ian Gilman 8f5edff379 + Major reorg: moved all visualizations into "candies" folder, moved core js files into "core" folder, and js files shared by a couple of visualizations into "shared" folder
+ the top level index.html now automatically grabs all the different visualizations and lists them
+ Added a visualization switcher that can be dropped into any visualization; drop down in the upper left of the window
+ The Utils routines log(), trace() and error() now take in any number of parameters. If a parameter is an object, its first level is automatically expanded
+ Fixed lasso in the "original" visualization

--HG--
rename : browser/base/content/tabcandy/jquery-ui.js => browser/base/content/tabcandy/app/jquery-ui.js
rename : browser/base/content/tabcandy/jquery.js => browser/base/content/tabcandy/core/jquery.js
rename : browser/base/content/tabcandy/app/jquery.lasso.js => browser/base/content/tabcandy/shared/jquery.lasso.js
rename : content/ian1/index.html => content/candies/ian1/index.html
rename : content/ian1/ui.js => content/candies/ian1/js/ui.js
rename : content/line/index.html => content/candies/line/index.html
rename : content/line/js/jquery.line.js => content/candies/line/js/jquery.line.js
rename : content/line/js/jquery.select.js => content/candies/line/js/jquery.select.js
rename : content/tab.html => content/candies/original/index.html
rename : content/select/index.html => content/candies/select/index.html
rename : content/stacks/index.html => content/candies/stacks/index.html
rename : content/stacks/js/jquery.select.js => content/candies/stacks/js/jquery.select.js
rename : content/stacks/js/ui.js => content/candies/stacks/js/ui.js
2010-03-05 15:14:10 -08:00

35 lines
920 B
JavaScript

(function(){
window.Switch = {
insert: function(selector, style) {
var chunks = window.location.toString().split('/');
var myName = chunks[chunks.length - 2];
var html = '<div style="font-size: 11px; margin: 5px 0px 0px 5px;'
+ style
+ '">Visualization: <select id="visualization-select">';
var names = Utils.getVisualizationNames();
var count = names.length;
var a;
for(a = 0; a < count; a++) {
var name = names[a];
html += '<option value="'
+ name
+ '"'
+ (name == myName ? ' selected="true"' : '')
+ '>'
+ name
+ '</option>';
}
html += '</select>';
$(selector).prepend(html);
$('#visualization-select').change(function () {
var name = $(this).val();
window.location = '../' + name + '/index.html';
});
}
};
})();