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

Commit e91cd2c

Browse files
committed
docs: fix contact chips CodePens and update Copyright years
1 parent 74dd2cd commit e91cd2c

File tree

4 files changed

+29
-30
lines changed

4 files changed

+29
-30
lines changed

LICENSE

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License
22

3-
Copyright (c) 2014-2018 Google LLC. https://angularjs.org
3+
Copyright (c) 2020 Google LLC. https://angularjs.org
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
THE SOFTWARE.
22-

docs/app/js/codepen.js

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
.factory('codepenDataAdapter', CodepenDataAdapter)
44
.factory('codepen', ['$demoAngularScripts', '$document', 'codepenDataAdapter', Codepen]);
55

6-
// Provides a service to open a code example in codepen.
6+
// Provides a service to open a code example in CodePen.
77
function Codepen($demoAngularScripts, $document, codepenDataAdapter) {
88

99
// The following URL used to be HTTP and not HTTPS to allow us to do localhost testing
@@ -15,20 +15,22 @@
1515
editOnCodepen: editOnCodepen
1616
};
1717

18-
// Creates a codepen from the given demo model by posting to Codepen's API
19-
// using a hidden form. The hidden form is necessary to avoid a CORS issue.
18+
// Creates a CodePen from the given demo model by posting to CodePen's API
19+
// using a hidden form. The hidden form is necessary to avoid a CORS issue.
2020
// See http://blog.codepen.io/documentation/api/prefill
2121
function editOnCodepen(demo) {
2222
var externalScripts = $demoAngularScripts.all();
23-
externalScripts.push('https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.1/moment.js');
23+
externalScripts.push('https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.js');
24+
// Needed for contact chips demos
25+
externalScripts.push('https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/md5.js');
2426
var data = codepenDataAdapter.translate(demo, externalScripts);
2527
var form = buildForm(data);
2628
$document.find('body').append(form);
2729
form[0].submit();
2830
form.remove();
2931
}
3032

31-
// Builds a hidden form with data necessary to create a codepen.
33+
// Builds a hidden form with data necessary to create a CodePen.
3234
function buildForm(data) {
3335
var form = angular.element(
3436
'<form style="display: none;" method="post" target="_blank" action="' +
@@ -40,14 +42,14 @@
4042
return form;
4143
}
4244

43-
// Recommended by Codepen to escape quotes.
45+
// Recommended by CodePen to escape quotes.
4446
// See http://blog.codepen.io/documentation/api/prefill
4547
function escapeJsonQuotes(json) {
4648
return JSON.stringify(json)
4749
.replace(/'/g, "&amp;apos;")
4850
.replace(/"/g, "&amp;quot;")
4951
/**
50-
* Codepen was unescaping &lt; (<) and &gt; (>) which caused, on some demos,
52+
* CodePen was unescaping &lt; (<) and &gt; (>) which caused, on some demos,
5153
* an unclosed elements (like <md-select>).
5254
* Used different unicode lookalike characters so it won't be considered as an element
5355
*/
@@ -56,7 +58,7 @@
5658
}
5759
}
5860

59-
// Translates demo metadata and files into Codepen's post form data. See api documentation for
61+
// Translates demo metadata and files into CodePen's post form data. See api documentation for
6062
// additional fields not used by this service. http://blog.codepen.io/documentation/api/prefill
6163
function CodepenDataAdapter() {
6264

@@ -70,12 +72,11 @@
7072
var UNSECURE_CACHE_JS = 'http://ngmaterial.assets.s3.amazonaws.com/svg-assets-cache.js';
7173
var ASSET_CACHE_JS = 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/t-114/svg-assets-cache.js';
7274

73-
7475
return {
7576
translate: translate
7677
};
7778

78-
// Translates a demo model to match Codepen's post data
79+
// Translates a demo model to match CodePen's post data
7980
// See http://blog.codepen.io/documentation/api/prefill
8081
function translate(demo, externalScripts) {
8182
var files = demo.files;
@@ -93,7 +94,7 @@
9394
});
9495
}
9596

96-
// Modifies index.html with necessary changes in order to display correctly in codepen
97+
// Modifies index.html with necessary changes in order to display correctly in CodePen
9798
// See each processor to determine how each modifies the html
9899
function processHtml(demo) {
99100

@@ -132,7 +133,7 @@
132133

133134
return content + '\n\n'+
134135
commentStart + '\n'+
135-
'Copyright 2018 Google LLC. All Rights Reserved. \n'+
136+
'Copyright 2020 Google LLC. All Rights Reserved. \n'+
136137
'Use of this source code is governed by an MIT-style license that can be found\n'+
137138
'in the LICENSE file at http://material.angularjs.org/HEAD/license.\n'+
138139
commentEnd;
@@ -142,9 +143,9 @@
142143
}
143144

144145

145-
// Applies modifications the javascript prior to sending to codepen.
146-
// Currently merges js files and replaces the module with the Codepen
147-
// module. See documentation for replaceDemoModuleWithCodepenModule.
146+
// Applies modifications the JavaScript prior to sending to CodePen.
147+
// Currently merges js files and replaces the module with the CodePen
148+
// module. See documentation for replaceDemoModuleWithCodepenModule.
148149
function processJs(jsFiles) {
149150
var mergedJs = mergeFiles(jsFiles).join(' ');
150151
var script = replaceDemoModuleWithCodepenModule(mergedJs);
@@ -158,13 +159,13 @@
158159
});
159160
}
160161

161-
// Adds class to parent element so that styles are applied correctly
162-
// Adds ng-app attribute. This is the same module name provided in the asset-cache.js
162+
// Adds class to parent element so that styles are applied correctly.
163+
// Adds ng-app attribute. This is the same module name provided in the asset-cache.js
163164
function applyAngularAttributesToParentElement(html, demo) {
164165
var tmp;
165166

166167
// Grab only the DIV for the demo...
167-
angular.forEach(angular.element(html), function(it,key){
168+
angular.forEach(angular.element(html), function(it, key) {
168169
if ((it.nodeName != "SCRIPT") && (it.nodeName != "#text")) {
169170
tmp = angular.element(it);
170171
}
@@ -175,7 +176,7 @@
175176
return tmp[0].outerHTML;
176177
}
177178

178-
// Adds templates inline in the html, so that templates are cached in the example
179+
// Adds templates inline in the html, so that templates are cached in the example.
179180
function insertTemplatesAsScriptTags(indexHtml, demo) {
180181
if (demo.files.html.length) {
181182
var tmp = angular.element(indexHtml);
@@ -190,23 +191,22 @@
190191
return indexHtml;
191192
}
192193

193-
// Escapes ampersands so that after codepen unescapes the html the escaped code block
194-
// uses the correct escaped characters
194+
// Escapes ampersands so that after CodePen unescapes the html the escaped code block
195+
// uses the correct escaped characters.
195196
function htmlEscapeAmpersand(html) {
196197
return html
197198
.replace(/&/g, "&amp;");
198199
}
199200

200-
// Required to make codePen work. Demos define their own module when running on the
201-
// docs site. In order to ensure the codepen example can use the svg-asset-cache.js, the
201+
// Required to make CodePen work. Demos define their own module when running on the
202+
// docs site. In order to ensure the CodePen example can use the svg-asset-cache.js, the
202203
// module needs to match so that the $templateCache is populated with the necessary
203204
// assets.
204-
205205
function replaceDemoModuleWithCodepenModule(file) {
206206
var matchAngularModule = /\.module\(('[^']*'|"[^"]*")\s*,(\s*\[([^\]]*)\]\s*\))/ig;
207207
var modules = "['ngMaterial', 'ngMessages', 'material.svgAssetsCache']";
208208

209-
// See scripts.js for list of external AngularJS libraries used for the demos
209+
// See scripts.js for list of external AngularJS libraries used for the demos.
210210

211211
return file.replace(matchAngularModule, ".module('MyApp', "+ modules + ")");
212212
}

docs/app/partials/license.tmpl.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<p>The MIT License</p>
44

55
<p>
6-
Copyright (c) 2014-2018 Google LLC
6+
Copyright (c) 2020 Google LLC.
77
<a href="http://angularjs.org">https://angularjs.org</a>
88
</p>
99

@@ -31,4 +31,4 @@
3131
THE SOFTWARE.
3232
</p>
3333
</md-content>
34-
</div>
34+
</div>

src/components/chips/demoContactChips/script.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(function () {
22
'use strict';
33

4-
// If we do not have CryptoJS defined; import it
4+
// If we do not have CryptoJS defined; import it. This works for our docs site, but not CodePen.
55
if (typeof CryptoJS === 'undefined') {
66
var cryptoSrc = 'https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/md5.js';
77
var scriptTag = document.createElement('script');

0 commit comments

Comments
 (0)