Skip to content

Commit

Permalink
Starting with next version and need to reverse the steps
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Gaunt committed Oct 20, 2016
1 parent c7d3865 commit b2dff28
Show file tree
Hide file tree
Showing 41 changed files with 250 additions and 807 deletions.
4 changes: 0 additions & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{
"extends": ["eslint:recommended", "google"],
"env": {
"browser": true,
"serviceworker": true
},
"rules": {
"no-var": 2,
"no-console": 0,
Expand Down
5 changes: 5 additions & 0 deletions app/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"rules": {
"no-unused-vars": 0
}
}
24 changes: 22 additions & 2 deletions app/index.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,36 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Push Notification codelab</title>
<title>Push codelab</title>

<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://code.getmdl.io/1.2.1/material.indigo-pink.min.css">
<script defer src="https://code.getmdl.io/1.2.1/material.min.js"></script>
<link rel="stylesheet" href="styles/index.css">
</head>

<body>

<h1>Push Notification codelab</h1>
<header>
<h1>Push Codelab</h1>
</header>

<main>
<p>Welcome to the push messaging codelab. The button below needs to be
fixed to support subscribing to push.</p>
<p>
<button disabled class="js-push-btn mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect">
Enable Push Messaging
</button>
</p>
</main>

<script src="js/main.js"></script>

<script src="https://code.getmdl.io/1.2.1/material.min.js"></script>
</body>
</html>
44 changes: 43 additions & 1 deletion app/js/main.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,45 @@
/*
*
* Push Notifications codelab
* Copyright 2015 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License
*
*/

/* eslint-env browser, es6 */

'use strict';

// TODO
/* eslint-disable max-len */
const applicationServerPublicKey = '';
/* eslint-enable max-len */

const pushButton = document.querySelector('.js-push-btn');
let isSubscribed = false;
let swRegistration = null;

function urlBase64ToUint8Array(base64String) {
const padding = '='.repeat((4 - base64String.length % 4) % 4);
const base64 = (base64String + padding)
.replace(/\-/g, '+')
.replace(/_/g, '/');

const rawData = window.atob(base64);
const outputArray = new Uint8Array(rawData.length);

for (let i = 0; i < rawData.length; ++i) {
outputArray[i] = rawData.charCodeAt(i);
}
return outputArray;
}
30 changes: 30 additions & 0 deletions app/styles/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
html {
height: 100%;
}

html, body {
width: 100%;
padding: 0;
margin: 0;
}

body {
min-height: auto;
box-sizing: border-box;
}

header {
padding: 115px 16px 32px 16px;
box-sizing: border-box;
background-color: #00bcd4;
color: white;
}

main, header > h1 {
width: 760px;
margin: 0 auto;
}

main {
padding: 24px 0;
}
2 changes: 0 additions & 2 deletions app/sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
*
*/

// Version 0.1

'use strict';

// TODO
18 changes: 0 additions & 18 deletions completed/01-get-started/index.html

This file was deleted.

32 changes: 0 additions & 32 deletions completed/01-get-started/js/main.js

This file was deleted.

38 changes: 0 additions & 38 deletions completed/01-get-started/sw.js

This file was deleted.

20 changes: 0 additions & 20 deletions completed/02-sw-install/index.html

This file was deleted.

32 changes: 0 additions & 32 deletions completed/02-sw-install/js/main.js

This file was deleted.

38 changes: 0 additions & 38 deletions completed/02-sw-install/sw.js

This file was deleted.

20 changes: 0 additions & 20 deletions completed/03-sw-events/index.html

This file was deleted.

34 changes: 0 additions & 34 deletions completed/03-sw-events/js/main.js

This file was deleted.

Loading

0 comments on commit b2dff28

Please sign in to comment.