Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 8ccc054

Browse files
docs(examples): add copyright and license info to each plunker file
Closes #13729
1 parent dd14e0c commit 8ccc054

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

docs/app/src/examples.js

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,26 @@ angular.module('examples', [])
2424

2525

2626
.factory('openPlunkr', ['formPostData', '$http', '$q', function(formPostData, $http, $q) {
27-
return function(exampleFolder, clickEvent) {
27+
28+
var COPYRIGHT = 'Copyright ' + (new Date()).getFullYear() + ' Google Inc. All Rights Reserved.\n'
29+
+ 'Use of this source code is governed by an MIT-style license that\n'
30+
+ 'can be found in the LICENSE file at http://angular.io/license';
31+
var COPYRIGHT_JS_CSS = '\n\n/*\n' + COPYRIGHT + '\n*/';
32+
var COPYRIGHT_HTML = '\n\n<!-- \n' + COPYRIGHT + '\n-->';
33+
function getCopyright(filename) {
34+
switch (filename.substr(filename.lastIndexOf('.'))) {
35+
case '.html':
36+
return COPYRIGHT_HTML;
37+
case '.js':
38+
case '.css':
39+
return COPYRIGHT_JS_CSS;
40+
case '.md':
41+
return COPYRIGHT;
42+
}
43+
return '';
44+
}
45+
46+
return function(exampleFolder, clickEvent) {
2847

2948
var exampleName = 'AngularJS Example';
3049
var newWindow = clickEvent.ctrlKey || clickEvent.metaKey;
@@ -67,7 +86,7 @@ angular.module('examples', [])
6786
var postData = {};
6887

6988
angular.forEach(files, function(file) {
70-
postData['files[' + file.name + ']'] = file.content;
89+
postData['files[' + file.name + ']'] = file.content + getCopyright(file.name);
7190
});
7291

7392
postData['tags[0]'] = "angularjs";

0 commit comments

Comments
 (0)