;(function(global) {

  var slice = Array.prototype.slice,
      document = global.document;

  // Internal: Initializes a 'Page' object.
  // Browser environments does not need to call this constructor
  // since a 'page' object will be exported in the global namespace.
  var Page = function() {
    this.initializers = {};
  };

  // Public: registers a function under the given scope to be executed
  // when the a scope is called.
  // These functions will be called with the current scope as its only
  // argument, and returning 'false' from any function will stop the
  // execution and the next registered functions will not be called.
  //
  // Examples
  //
  // # scope will be 'home'.
  // page.at('home', function(scope) { });
  //
  // # This second function will be called.
  // page.at('home', function() { return false; });
  // page.at('home', function() { });
  //
  // Returns nothing.
  Page.prototype.at = function(scope, fn) {
    this.initializers[scope] = this.initializers[scope] || [];
    this.initializers[scope].push(fn);
  };

  // Public: recognizes the current scope and execute all the registered
  // functions. If there is any functions registered under the ':before'
  // and ':after' scopes they will always be executed around the current
  // scope functions.
  //
  // Examples
  //
  // page.recognize();
  //
  // Returns nothing.
  Page.prototype.recognize = function() {
    var scope = this._detect(),
        chain = this._buildChain(scope);

    this._executeChain(chain, scope);
  };

  // Internal: detects the current scope through the 'data-page'
  // attribute on the 'body' tag.
  //
  // Returns a String.
  Page.prototype._detect = function() {
    var body = document.getElementsByTagName('body')[0];

    return body && body.getAttribute('data-page');
  };

  // Internal: builds a collection of functions to be called for the given
  // scope. The functions under the ':before' and ':after' scopes will be
  // inserted before and after the scope functions.
  //
  // Returns an Array.
  Page.prototype._buildChain = function(scope) {
    var before  = this.initializers[':before'] || [],
        current = this.initializers[scope] || [],
        after   = this.initializers[':after'] || [];

    return before.concat(current).concat(after);
  };

  // Internal: executes the chain of given functions using the
  // scope as the only argument. If the
  //
  // Returns nothing.
  Page.prototype._executeChain = function(chain, scope) {
    var result;
    for (var index = 0, len = chain.length; index < len; index++) {
      result = chain[index](scope);
      if(result === false) {
        return;
      }
    };
  };

  // Export the page object for Node.JS
  if (typeof module !== 'undefined') {
    module.exports = Page;
  } else {
    global.page = new Page;
  }
})(this);

@@ -634,24 +634,152 @@
  be called.%0A
+  // You can register the same function to multiple scopes by passing%0A  // a space separated String with all the wanted scopes.%0A
   //%0A  // Ex
@@ -863,24 +863,126 @@
  %7B %7D);%0A  //%0A
+  // # scope will be 'home' or 'dashboard'.%0A  // page.at('home dashboard', function(scope) %7B %7D);%0A  //%0A
   // # This 
@@ -1170,16 +1170,17 @@
 cope
+s
 , fn) %7B%0A
     
@@ -1171,24 +1171,172 @@
 opes, fn) %7B%0A
+    var scope;%0A    scopes = scopes.split(' ');%0A%0A    for (var index = 0, len = scopes.length; index %3C len; index++) %7B%0A      scope = scopes%5Bindex%5D;%0A  
     this.ini
@@ -1386,24 +1386,26 @@
  %7C%7C %5B%5D;%0A    
+  
 this.initial
@@ -1427,16 +1427,23 @@
 sh(fn);%0A
+    %7D;%0A
   %7D;%0A%0A  

Support multiple scopes in `page.at`.