forked from aces/brainbrowser
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
296 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
.tutorial-nav { | ||
margin-left: 175px; | ||
color: black; | ||
margin-top: 2em; | ||
margin-bottom: 2em; | ||
} | ||
|
||
.tutorial-nav a { | ||
color: white; | ||
} | ||
|
||
.tutorial-nav a:hover { | ||
color: white; | ||
text-decoration: none; | ||
} | ||
|
||
.spacer { | ||
height: 1em; | ||
} | ||
|
||
|
||
.icon-cog { | ||
line-height: 13px; | ||
} | ||
|
||
|
||
|
||
/* =============================== */ | ||
/* Content */ | ||
/* =============================== */ | ||
|
||
.hint { | ||
font-size: .7em; | ||
color: #c0c0c0; | ||
} | ||
|
||
.content h2, | ||
.content h3, | ||
.content h4, | ||
.content h5 { | ||
margin-top: 1em; | ||
} | ||
|
||
ul.parameters > li > p, | ||
.returns > p { | ||
display: inline; | ||
} | ||
|
||
ul.methods > li, | ||
ul.properties > li, | ||
ul.events > li { | ||
list-style: none; | ||
min-height: 20px; | ||
padding: 19px; | ||
margin-bottom: 20px; | ||
background-color: #f5f5f5; | ||
border: 1px solid #eee; | ||
border: 1px solid rgba(0, 0, 0, 0.05); | ||
-webkit-border-radius: 4px; | ||
-moz-border-radius: 4px; | ||
border-radius: 4px; | ||
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); | ||
-moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); | ||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); | ||
} | ||
|
||
.member.method > h2, | ||
.member.property > h2, | ||
.member.event > h2 { | ||
margin-bottom: .5em; | ||
} | ||
|
||
ul.methods > li > h3, | ||
ul.properties > li > h3, | ||
ul.events > li > h3 { | ||
margin: -19px -19px 1em -19px; | ||
padding: .25em 19px; | ||
background-color: #d3d3d3; | ||
font-family: monospace; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,193 @@ | ||
|
||
/*============= THIS IS THE NAMESPACED API FOR EXTENDING THE MAIN MODULE FOR THE UI ============*/ | ||
|
||
var docsApp = docsApp || {}; | ||
docsApp.directive = docsApp.directive || {}; | ||
docsApp.controller = docsApp.controller || {}; | ||
docsApp.serviceFactory = docsApp.serviceFactory || {}; | ||
|
||
|
||
/*============= HERE WE EXTEND THE MAIN MODULE WITH SOME ANGULAR SPECIFIC DIRECTIVES ===========*/ | ||
|
||
docsApp.directive.sourceEdit = function(getEmbeddedTemplate) { | ||
return { | ||
template: '<div class="btn-group pull-right">' + | ||
'<a class="btn dropdown-toggle btn-primary" data-toggle="dropdown" href>' + | ||
' <i class="icon-pencil icon-white"></i> Edit<span class="caret"></span>' + | ||
'</a>' + | ||
'<ul class="dropdown-menu">' + | ||
' <li><a ng-click="plunkr($event)" href="">In Plunkr</a></li>' + | ||
' <li><a ng-click="fiddle($event)" href="">In JsFiddle</a></li>' + | ||
'</ul>' + | ||
'</div>', | ||
scope: true, | ||
controller: function($scope, $attrs, openJsFiddle, openPlunkr) { | ||
var sources = { | ||
module: $attrs.sourceEdit, | ||
deps: read($attrs.sourceEditDeps), | ||
html: read($attrs.sourceEditHtml), | ||
css: read($attrs.sourceEditCss), | ||
js: read($attrs.sourceEditJs), | ||
unit: read($attrs.sourceEditUnit), | ||
scenario: read($attrs.sourceEditScenario) | ||
}; | ||
$scope.fiddle = function(e) { | ||
e.stopPropagation(); | ||
openJsFiddle(sources); | ||
}; | ||
$scope.plunkr = function(e) { | ||
e.stopPropagation(); | ||
openPlunkr(sources); | ||
}; | ||
} | ||
} | ||
|
||
function read(text) { | ||
var files = []; | ||
angular.forEach(text ? text.split(' ') : [], function(refId) { | ||
// refId is index.html-343, so we need to strip the unique ID when exporting the name | ||
files.push({name: refId.replace(/-\d+$/, ''), content: getEmbeddedTemplate(refId)}); | ||
}); | ||
return files; | ||
} | ||
}; | ||
|
||
docsApp.directive.docTutorialNav = function(templateMerge) { | ||
var pages = [ | ||
'', | ||
'step_00', 'step_01', 'step_02', 'step_03', 'step_04', | ||
'step_05', 'step_06', 'step_07', 'step_08', 'step_09', | ||
'step_10', 'step_11', 'the_end' | ||
]; | ||
return { | ||
compile: function(element, attrs) { | ||
var seq = 1 * attrs.docTutorialNav, | ||
props = { | ||
seq: seq, | ||
prev: pages[seq], | ||
next: pages[2 + seq], | ||
diffLo: seq ? (seq - 1): '0~1', | ||
diffHi: seq | ||
}; | ||
|
||
element.addClass('btn-group'); | ||
element.addClass('tutorial-nav'); | ||
element.append(templateMerge( | ||
'<li class="btn btn-primary"><a href="tutorial/{{prev}}"><i class="icon-step-backward"></i> Previous</a></li>\n' + | ||
'<li class="btn btn-primary"><a href="http://angular.github.com/angular-phonecat/step-{{seq}}/app"><i class="icon-play"></i> Live Demo</a></li>\n' + | ||
'<li class="btn btn-primary"><a href="https://github.com/angular/angular-phonecat/compare/step-{{diffLo}}...step-{{diffHi}}"><i class="icon-search"></i> Code Diff</a></li>\n' + | ||
'<li class="btn btn-primary"><a href="tutorial/{{next}}">Next <i class="icon-step-forward"></i></a></li>', props)); | ||
} | ||
}; | ||
}; | ||
|
||
docsApp.directive.docTutorialReset = function() { | ||
function tab(name, command, id, step) { | ||
return '' + | ||
' <div class=\'tab-pane well\' title="' + name + '" value="' + id + '">\n' + | ||
' <ol>\n' + | ||
' <li><p>Reset the workspace to step ' + step + '.</p>' + | ||
' <pre>' + command + '</pre></li>\n' + | ||
' <li><p>Refresh your browser or check the app out on <a href="http://angular.github.com/angular-phonecat/step-' + step + '/app">Angular\'s server</a>.</p></li>\n' + | ||
' </ol>\n' + | ||
' </div>\n'; | ||
} | ||
|
||
return { | ||
compile: function(element, attrs) { | ||
var step = attrs.docTutorialReset; | ||
element.html( | ||
'<div ng-hide="show">' + | ||
'<p><a href="" ng-click="show=true;$event.stopPropagation()">Workspace Reset Instructions ➤</a></p>' + | ||
'</div>\n' + | ||
'<div class="tabbable" ng-show="show" ng-model="$cookies.platformPreference">\n' + | ||
tab('Git on Mac/Linux', 'git checkout -f step-' + step, 'gitUnix', step) + | ||
tab('Git on Windows', 'git checkout -f step-' + step, 'gitWin', step) + | ||
'</div>\n'); | ||
} | ||
}; | ||
}; | ||
|
||
docsApp.serviceFactory.openPlunkr = function(templateMerge, formPostData, angularUrls) { | ||
return function(content) { | ||
var allFiles = [].concat(content.js, content.css, content.html); | ||
var indexHtmlContent = '<!doctype html>\n' + | ||
'<html ng-app>\n' + | ||
' <head>\n' + | ||
' <script src="{{angularJSUrl}}"></script>\n' + | ||
'{{scriptDeps}}\n' + | ||
' </head>\n' + | ||
' <body>\n\n' + | ||
'{{indexContents}}' + | ||
'\n\n </body>\n' + | ||
'</html>\n'; | ||
var scriptDeps = ''; | ||
angular.forEach(content.deps, function(file) { | ||
if (file.name !== 'angular.js') { | ||
scriptDeps += ' <script src="' + file.name + '"></script>\n' | ||
} | ||
}); | ||
indexProp = { | ||
angularJSUrl: angularUrls['angular.js'], | ||
scriptDeps: scriptDeps, | ||
indexContents: content.html[0].content | ||
}; | ||
var postData = {}; | ||
angular.forEach(allFiles, function(file, index) { | ||
if (file.content && file.name != 'index.html') { | ||
postData['files[' + file.name + ']'] = file.content; | ||
} | ||
}); | ||
|
||
postData['files[index.html]'] = templateMerge(indexHtmlContent, indexProp); | ||
postData['tags[]'] = "angularjs"; | ||
|
||
postData.private = true; | ||
postData.description = 'AngularJS Example Plunkr'; | ||
|
||
formPostData('http://plnkr.co/edit/?p=preview', postData); | ||
}; | ||
}; | ||
|
||
docsApp.serviceFactory.openJsFiddle = function(templateMerge, formPostData, angularUrls) { | ||
|
||
var HTML = '<div ng-app=\"{{module}}\">\n{{html:2}}</div>', | ||
CSS = '</style> <!-- Ugly Hack due to jsFiddle issue: http://goo.gl/BUfGZ --> \n' + | ||
'{{head:0}}<style>\n.ng-invalid { border: 1px solid red; }\n{{css}}', | ||
SCRIPT = '{{script}}', | ||
SCRIPT_CACHE = '\n\n<!-- {{name}} -->\n<script type="text/ng-template" id="{{name}}">\n{{content:2}}</script>'; | ||
|
||
return function(content) { | ||
var prop = { | ||
module: content.module, | ||
html: '', | ||
css: '', | ||
script: '' | ||
}; | ||
|
||
prop.head = templateMerge('<script src="{{url}}"></script>', {url: angularUrls['angular.js']}); | ||
|
||
angular.forEach(content.html, function(file, index) { | ||
if (index) { | ||
prop.html += templateMerge(SCRIPT_CACHE, file); | ||
} else { | ||
prop.html += file.content; | ||
} | ||
}); | ||
|
||
angular.forEach(content.js, function(file, index) { | ||
prop.script += file.content; | ||
}); | ||
|
||
angular.forEach(content.css, function(file, index) { | ||
prop.css += file.content; | ||
}); | ||
|
||
formPostData("http://jsfiddle.net/api/post/library/pure/", { | ||
title: 'AngularJS Example', | ||
html: templateMerge(HTML, prop), | ||
js: templateMerge(SCRIPT, prop), | ||
css: templateMerge(CSS, prop) | ||
}); | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Copyright (C) 2011 McGill University | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
/* brainbrowser v1.2.0 */ | ||
$(function(){"use strict";$(".button").button(),$(".tabs").tabs(),$(".title").append(' <span id="title-version">v'+BrainBrowser.version+"</span>");var a=$("#html5-warnings");a&&(BrainBrowser.utils.canvasEnabled()||(a.css("display","inline-block"),a.find("#canvas-warning").show()),BrainBrowser.utils.webglEnabled()||(a.css("display","inline-block"),a.find("#webgl-warning").show()),BrainBrowser.utils.webWorkersEnabled()||(a.css("display","inline-block"),a.find("#webworker-warning").show()))}); |