Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- app.Toolbox = function(tool) {
- function Toolbox() {}
- Toolbox.prototype = $.extend({
- flag:function() {
- app.flags[tool.name] = true;
- },
- unflag:function() {
- delete app.flags[tool.name];
- },
- initTool:function() {
- if (tool.flags) {
- if (app.flags[tool.name]) {
- alert("You can only launch one "+tool.description+" at a time.");
- return false;
- } else {
- this.flag();
- }
- }
- tool.$el.data(tool.name,this);
- return this.init();
- },
- takeDown:function() {
- tool.destroy.call(this);
- tool.$el.removeData(tool.name);
- tool.flags && this.unflag();
- }
- },tool);
- return new Toolbox().initTool();
- };
Add Comment
Please, Sign In to add comment