Guest User

Untitled

a guest
May 26th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. app.Toolbox = function(tool) {
  2. function Toolbox() {}
  3. Toolbox.prototype = $.extend({
  4. flag:function() {
  5. app.flags[tool.name] = true;
  6. },
  7. unflag:function() {
  8. delete app.flags[tool.name];
  9. },
  10. initTool:function() {
  11. if (tool.flags) {
  12. if (app.flags[tool.name]) {
  13. alert("You can only launch one "+tool.description+" at a time.");
  14. return false;
  15. } else {
  16. this.flag();
  17. }
  18. }
  19. tool.$el.data(tool.name,this);
  20. return this.init();
  21. },
  22. takeDown:function() {
  23. tool.destroy.call(this);
  24. tool.$el.removeData(tool.name);
  25. tool.flags && this.unflag();
  26. }
  27. },tool);
  28. return new Toolbox().initTool();
  29. };
Add Comment
Please, Sign In to add comment