Requires

Provides

Application.js

A class to handle execution and bootstraping of LSD

License:
Public domain (http://unlicense.org).
Authors:
Yaroslaff Fedin
  1. 23
  2. 24
  3. 25
  4. 26
  5. 27
  6. 28
  7. 29
  8. 30
  9. 31
  10. 32
  11. 33
  12. 34
  13. 35
  14. 36
  15. 37
  16. 38
  17. 39
  18. 40
  19. 41
  20. 42
  21. 43
  22. 44
  23. 45
  24. 46
  25. 47
  26. 48
  27. 49
  28. 50
  29. 51
  30. 52
  31. 53
  32. 54
  33. 55
  34. 56
  35. 57
  36. 58
  37. 59
  38. 60
  39. 61
  40. 62
  41. 63
  42. 64
  43. 65
  44. 66
  45. 67
  46. 68
  47. 69
  48. 70
  49. 71
  50. 72
  51. 73
  52. 74
  53. 75
  54. 76
LSD.Application = new Class({ Extends: LSD.Node, options: { method: 'augment' }, initialize: function(document, options) { if (!LSD.application) LSD.application = this; this.param = (location.search.length > 1) ? location.search.substr(1, location.search.length - 1).parseQueryString() : {} this.parent.apply(this, arguments); document.addEvent('domready', function() { if (this.param.benchmark != null) console.profile(); this.setDocument(document); if (this.param.benchmark != null) console.profileEnd(); }.bind(this)); }, setHead: function(head) { for (var i = 0, el, els = head.getElementsByTagName('meta'); el = els[i++];) { var type = el.getAttribute('rel'); if (type) { if (!this[type]) this[type] = {}; this[type][el.getAttribute('name')] = el.getAttribute('content'); } } }, setDocument: function(document) { this.setHead(document.head); var element = this.element = document.body; this.setBody(document.body); }, setBody: function(element) { this.fireEvent('beforeBody', element); var body = this.body = new (this.getBodyClass(element))(element); this.fireEvent('body', [body, element]); return body; }, getBodyClass: function() { return LSD.Element.find('body'); }, getBody: function() { return this.body; }, redirect: function(url) { window.location.href = url; } });