diff options
| author | Igor Minar | 2010-11-05 21:12:37 -0700 |
|---|---|---|
| committer | Igor Minar | 2010-11-09 22:27:31 -0800 |
| commit | 324694a58b6d0ed33e05b511be4767573d9187dd (patch) | |
| tree | 0b7243e721da17e9b5c5a1111ed9c0d28829b309 /docs/wiki_widgets.js | |
| parent | effcd340e9d41a2ab8368e4de06a1a83a206ac32 (diff) | |
| download | angular.js-324694a58b6d0ed33e05b511be4767573d9187dd.tar.bz2 | |
Better example widget
- syntax highlighting
- tabless design
- rename widget to doc:example
- rename widget files (wiki_widget.* -> doc_widget.*)
- example section is now optional
Diffstat (limited to 'docs/wiki_widgets.js')
| -rw-r--r-- | docs/wiki_widgets.js | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/docs/wiki_widgets.js b/docs/wiki_widgets.js deleted file mode 100644 index 771d3f8c..00000000 --- a/docs/wiki_widgets.js +++ /dev/null @@ -1,51 +0,0 @@ -(function(){ - var HTML_TEMPLATE = - '<!DOCTYPE HTML>\n' + - '<html xmlns:ng="http://angularjs.org">\n' + - ' <head>\n' + - ' <script type="text/javascript"\n' + - ' src="http://angularjs.org/ng/js/angular-debug.js" ng:autobind></script>\n' + - ' </head>\n' + - ' <body>\n' + - '_HTML_SOURCE_\n' + - ' </body>\n' + - '</html>'; - - angular.widget('WIKI:SOURCE', function(element){ - this.descend(true); - var html = element.text(); - element.show(); - var tabs = angular.element( - '<ul class="tabs">' + - '<li class="tab selected" to="angular"><angular/></li>' + - '<li class="tab" to="plain">plain</li>' + - '<li class="tab" to="source">source</li>' + - '<li class="pane selected angular example">' + html + '</li>' + - '<li class="pane plain" ng:non-bindable>' + html + '</li>' + - '<li class="pane source" ng:non-bindable><pre class="brush: js; html-script: true"></pre></li>' + - '</ul>'); - var pre = tabs. - find('>li.source>pre'). - text(HTML_TEMPLATE.replace('_HTML_SOURCE_', html)); - var color = element.attr('color') || 'white'; - element.html(''); - element.append(tabs); - element.find('>ul.tabs>li.pane').css('background-color', color); - var script = (html.match(/<script[^\>]*>([\s\S]*)<\/script>/) || [])[1] || ''; - try { - eval(script); - } catch (e) { - alert(e); - } - return function(element){ - element.find('>ul.tabs>li.tab').click(function(){ - if ($(this).is(".selected")) return; - element. - find('>ul.tabs>li.selected'). - add(this). - add(element.find('>ul>li.pane.' + angular.element(this).attr('to'))). - toggleClass('selected'); - }); - }; - }); -})();
\ No newline at end of file |
