Skip to content

Commit

Permalink
Fixing JSHint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Gaunt committed Aug 27, 2015
1 parent ad7be0f commit 168c254
Show file tree
Hide file tree
Showing 54 changed files with 167 additions and 56 deletions.
5 changes: 4 additions & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
"self": false,
"window": false,
"navigator": false,
"document": false
"document": false,
"fetch": false,
"Uint8Array": false,
"Audio": false
}
}
4 changes: 2 additions & 2 deletions arrows-es6/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ <h3>Background</h3>
setInterval(function() {
that.seconds++;
}, 1000); // or }.bind(this), 1000) and skip that = this
}
};

var counterA = new counter_es5();
setTimeout(function() {
Expand All @@ -70,7 +70,7 @@ <h3>Background</h3>
let counter_es6 = function() {
this.seconds = 0;
setInterval(() => this.seconds++, 1000);
}
};

let counterB = new counter_es6();
setTimeout(() => ChromeSamples.log(counterB.seconds), 1200);
Expand Down
8 changes: 5 additions & 3 deletions battery-status/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ <h2>Battery Information</h2>

if(!!navigator.getBattery) {
navigator.getBattery().then(batterySuccess, batteryFailure);
}
}
else {
warngingEl.textContent = "Battery Status API is not supported on this platform.";
}
Expand Down Expand Up @@ -143,7 +143,7 @@ <h2>Battery Information</h2>
else if(battery.charging === false) {
chargingStateEl.textContent = "Discharging";
}
}
};

var batterySuccess = function(battery) {
updateBatteryUI(battery);
Expand Down Expand Up @@ -174,7 +174,7 @@ <h2>Battery Information</h2>

if(!!navigator.getBattery) {
navigator.getBattery().then(batterySuccess, batteryFailure);
}
}
else {
warngingEl.textContent = "Battery Status API is not supported on this platform.";
}
Expand All @@ -184,12 +184,14 @@ <h2>Battery Information</h2>


<script>
/* jshint ignore:start */
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-53563471-1', 'auto');
ga('send', 'pageview');
/* jshint ignore:end */
</script>
<!-- Built with love using Web Starter Kit -->
</body>
Expand Down
2 changes: 2 additions & 0 deletions beacon/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,14 @@ <h1>Beacon Sample</h1>


<script>
/* jshint ignore:start */
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-53563471-1', 'auto');
ga('send', 'pageview');
/* jshint ignore:end */
</script>
<!-- Built with love using Web Starter Kit -->
</body>
Expand Down
10 changes: 6 additions & 4 deletions classes-es6/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ <h1>Classes (ES6) Sample</h1>
}

sayHistory() {
log('"Polygon" is derived from the Greek polus (many) and gonia (angle).')
log('"Polygon" is derived from the Greek polus (many) and gonia (angle).');
}

// We will look at static and subclassed methods shortly
Expand All @@ -123,7 +123,7 @@ <h1>Classes (ES6) Sample</h1>
getPolyName() {
log('Hi. I was created with a Class expression. My name is ' + Poly.name);
}
}
};

let inst = new MyPoly();
inst.getPolyName();
Expand Down Expand Up @@ -195,7 +195,7 @@ <h1>Classes (ES6) Sample</h1>
// with a class, but not with an instance of the class.
static tripple(n) {
n = n | 1;
return n * 3
return n * 3;
}
}

Expand Down Expand Up @@ -271,7 +271,7 @@ <h1>Classes (ES6) Sample</h1>

// Note: The V8 in Chrome 42 supports subclassing built-ins but Arrays.
// Subclassing arrays supported in Chrome 43.

class Stack extends Array {
constructor() {
super();
Expand All @@ -291,12 +291,14 @@ <h1>Classes (ES6) Sample</h1>
<!-- // [END code-block] -->

<script>
/* jshint ignore:start */
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-53563471-1', 'auto');
ga('send', 'pageview');
/* jshint ignore:end */
</script>
<!-- Built with love using Web Starter Kit -->
</body>
Expand Down
2 changes: 2 additions & 0 deletions collections-iterators-es6/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,14 @@ <h1>Collections and Iterators (ES6) Sample</h1>
<!-- // [END code-block] -->

<script>
/* jshint ignore:start */
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-53563471-1', 'auto');
ga('send', 'pageview');
/* jshint ignore:end */
</script>
<!-- Built with love using Web Starter Kit -->
</body>
Expand Down
4 changes: 4 additions & 0 deletions computed-properties-es6/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,14 @@ <h1>Computed Property Names (ES6) Sample</h1>
[prefix + 'bar']: 'hello', [prefix + 'baz']: 'world', [prefix + prefix.toUpperCase()]: true
};

/* jshint ignore:start */
log(myObject['foobar']);
// -> hello
log(myObject['foobaz']);
// -> world
log(myObject['fooFOO']);
// -> true
/* jshint ignore:end */

// Example 2
log('\nUsing Computed method names in an object literal:');
Expand Down Expand Up @@ -118,6 +120,7 @@ <h1>Computed Property Names (ES6) Sample</h1>
<!-- // [END code-block] -->

<script>
/* jshint ignore:start */
(function(i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function() {
Expand All @@ -131,6 +134,7 @@ <h1>Computed Property Names (ES6) Sample</h1>
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-53563471-1', 'auto');
ga('send', 'pageview');
/* jshint ignore:end */
</script>
<!-- Built with love using Web Starter Kit -->
</body>
Expand Down
2 changes: 2 additions & 0 deletions csp-upgrade-insecure-requests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,14 @@ <h1>Upgrade Insecure Requests Sample</h1>
</div>

<script>
/* jshint ignore:start */
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-53563471-1', 'auto');
ga('send', 'pageview');
/* jshint ignore:end */
</script>
<!-- Built with love using Web Starter Kit -->
</body>
Expand Down
2 changes: 2 additions & 0 deletions css-shapes/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,14 @@ <h2>Shape spacing</h2>
<!-- // [END shape-outside-content-box] -->

<script>
/* jshint ignore:start */
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-53563471-1', 'auto');
ga('send', 'pageview');
/* jshint ignore:end */
</script>
<!-- Built with love using Web Starter Kit -->
</body>
Expand Down
20 changes: 11 additions & 9 deletions cut-and-copy/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,18 @@ <h1>Cut and Copy Sample</h1>
<!-- // [START code-block] -->
<h2>Simple Cut Example</h2>
<p><textarea class="js-cuttextarea">Hello I'm some text</textarea></p>

<p><button class="js-textareacutbtn">Cut Textarea</button></p>

<h2>Simple Copy Example</h2>
<p>Email me at <a class="js-emaillink" href="mailto:[email protected]" >[email protected]</a></p>
<p><button class="js-emailcopybtn">Copy Email Address</button></p>

<h1>Log</h1>
<div class="output">
<pre id="log"></pre>
</div>

<script>
function log() {
document.querySelector('#log').textContent += Array.prototype.join.call(arguments, '') + '\n';
Expand All @@ -78,8 +78,8 @@ <h1>Log</h1>
var range = document.createRange();
range.selectNode(emailLink);
window.getSelection().addRange(range);
try {

try {
var successful = document.execCommand('copy');
var msg = successful ? 'successful' : 'unsuccessful';
log('Copy email command was ' + msg);
Expand All @@ -93,15 +93,15 @@ <h1>Log</h1>
var hasSelection = document.queryCommandEnabled('cut');
var cutTextarea = document.querySelector('.js-cuttextarea');
cutTextarea.select();

try {
var successful = document.execCommand('cut');
var msg = successful ? 'successful' : 'unsuccessful';
log('Cutting text command was ' + msg);
} catch(err) {
log('execCommand Error', err);
}
}
}

// Get the buttons
var cutTextareaBtn = document.querySelector('.js-textareacutbtn');
Expand All @@ -114,8 +114,8 @@ <h1>Log</h1>
// TODO: The initial state should be disabled
// then enable based on queryCommandSupported
// This is currently a bug: crbug.com/476508
// Set the initial state

// Set the initial state
/**
cutTextareaBtn.disabled = !document.queryCommandSupported('cut');
copyEmailBtn.disabled = !document.queryCommandSupported('copy');
Expand All @@ -125,12 +125,14 @@ <h1>Log</h1>
<!-- // [END code-block] -->

<script>
/* jshint ignore:start */
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-53563471-1', 'auto');
ga('send', 'pageview');
/* jshint ignore:end */
</script>
<!-- Built with love using Web Starter Kit -->
</body>
Expand Down
2 changes: 2 additions & 0 deletions dialog/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,14 @@ <h1>&lt;dialog&gt; Element Sample</h1>
<!-- // [END code-block] -->

<script>
/* jshint ignore:start */
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-53563471-1', 'auto');
ga('send', 'pageview');
/* jshint ignore:end */
</script>
<!-- Built with love using Web Starter Kit -->
</body>
Expand Down
4 changes: 3 additions & 1 deletion encoding-api/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ <h1>Encoding API Sample</h1>
fetchAndDecode(file, filesToEncoding[file]);
});
} else {
document.querySelector('#results').textContent = 'Your browser does not support the Encoding API.'
document.querySelector('#results').textContent = 'Your browser does not support the Encoding API.';
}

// Use XHR to fetch `file` and interpret its contents as being encoded with `encoding`.
Expand Down Expand Up @@ -109,12 +109,14 @@ <h1>Encoding API Sample</h1>
<!-- // [END code-block] -->

<script>
/* jshint ignore:start */
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-53563471-1', 'auto');
ga('send', 'pageview');
/* jshint ignore:end */
</script>
<!-- Built with love using Web Starter Kit -->
</body>
Expand Down
2 changes: 2 additions & 0 deletions extended-object-literals-es6/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,14 @@ <h1>Extended Object Literals (ES6) Sample</h1>
<!-- // [END code-block] -->

<script>
/* jshint ignore:start */
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-53563471-1', 'auto');
ga('send', 'pageview');
/* jshint ignore:end */
</script>
<!-- Built with love using Web Starter Kit -->
</body>
Expand Down
4 changes: 4 additions & 0 deletions extended-unicode-escapes/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,21 @@ <h1>Extended Unicode Escapes in Strings Sample</h1>
<div class="output"></div>

<script>
/* jshint ignore:start */
document.querySelector('.output').textContent = 'This is an umbrella: \u{1F302}';
/* jshint ignore:end */
</script>
<!-- // [END code-block] -->

<script>
/* jshint ignore:start */
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-53563471-1', 'auto');
ga('send', 'pageview');
/* jshint ignore:end */
</script>
<!-- Built with love using Web Starter Kit -->
</body>
Expand Down
4 changes: 3 additions & 1 deletion fetch-api/fetch-html.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,22 @@ <h1>Fetch API HTML Sample</h1>

fetch('users.html')
.then(function(response) {
return response.text()
return response.text();
}).then(function(body) {
log(body);
});
</script>
<!-- // [END code-block] -->

<script>
/* jshint ignore:start */
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-53563471-1', 'auto');
ga('send', 'pageview');
/* jshint ignore:end */
</script>
<!-- Built with love using Web Starter Kit -->
</body>
Expand Down
Loading

0 comments on commit 168c254

Please sign in to comment.