diff options
Diffstat (limited to 'docs/src/example.js')
| -rw-r--r-- | docs/src/example.js | 30 | 
1 files changed, 24 insertions, 6 deletions
| diff --git a/docs/src/example.js b/docs/src/example.js index 7477b0a5..eadc218f 100644 --- a/docs/src/example.js +++ b/docs/src/example.js @@ -57,12 +57,27 @@ exports.Example.prototype.addSource = function(name, content) {    }  }; +exports.Example.prototype.enableAnimations = function() { +  this.animations = true; +}; + +exports.Example.prototype.disableAnimations = function() { +  this.animations = false; +}; +  exports.Example.prototype.toHtml = function() { -  return '<h2>Source</h2>\n' + -          this.toHtmlEdit() + -          this.toHtmlTabs() + -          '<h2>Demo</h2>\n' + -          this.toHtmlEmbed(); +  var html = "<h2>Source</h2>\n"; +  html += this.toHtmlEdit(); +  html += this.toHtmlTabs(); +  if(this.animations) { +    html += '<div class="pull-right">'; +    html += ' <button class="btn btn-primary" ng-click="animationsOff=true" ng-hide="animationsOff">Animations on</button>'; +    html += ' <button class="btn btn-primary disabled" ng-click="animationsOff=false" ng-show="animationsOff">Animations off</button>'; +    html += '</div>'; +  } +  html += "<h2>Demo</h2>\n"; +  html += this.toHtmlEmbed(); +  return html;  }; @@ -116,7 +131,10 @@ exports.Example.prototype.toHtmlTabs = function() {  exports.Example.prototype.toHtmlEmbed = function() {    var out = []; -  out.push('<div class="well doc-example-live"'); +  out.push('<div class="well doc-example-live animator-container"'); +  if(this.animations) { +    out.push(" ng-class=\"{'animations-off':animationsOff == true}\""); +  }    out.push(' ng-embed-app="' + this.module + '"');    out.push(' ng-set-html="' + this.html[0].id + '"');    out.push(' ng-eval-javascript="' + ids(this.js) + '">'); | 
