gecko/browser/base/content/tabcandy/app/switch.js

50 lines
1.2 KiB
JavaScript
Raw Normal View History

+ 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
(function(){
// ##########
window.Switch = {
// ----------
get name() {
var chunks = window.location.toString().split('/');
var myName = chunks[chunks.length - 2];
return myName;
},
// ----------
insert: function(selector, style) {
var myName = this.name;
var html = '<div style="font-size: 11px; margin: 5px 0px 0px 5px;'
+ style
+ '">Candy: <select id="visualization-select">';
Utils.getVisualizationNames(function(names) {
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 += '<option disabled="disabled">----------</option>';
html += '<option value="">Home</option>';
html += '</select>';
$(selector).prepend(html);
$('#visualization-select').change(function () {
var name = $(this).val();
if(name)
location.href = '../' + name + '/index.html';
else
location.href = '../../index.html';
});
});
}
};
+ 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
})();