Skip to content

Commit cfaf595

Browse files
committed
Add helper/alert notifications about HTTPS only providers
1 parent 3113f6c commit cfaf595

File tree

4 files changed

+34
-34
lines changed

4 files changed

+34
-34
lines changed

demos/bikeindex.html

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<!DOCTYPE html>
22

33
<link rel="stylesheet" href="/adorn/adorn.css"/>
4+
<link rel="stylesheet" href="./helper/alert.css"/>
45
<script src="/adorn/adorn.js" async></script>
56

67
<script src="client_ids.js"></script>
@@ -10,6 +11,8 @@
1011
<title>hello( bikeindex )</title>
1112
<h1>hello( bikeindex )</h1>
1213

14+
<script src="./helper/alert-https.js"></script>
15+
1316
<button id='bikeindex' onclick="login('bikeindex');">bikeindex</button>
1417
<pre id="result">Signin to get a list of bikes</pre>
1518
<script class="pre">

demos/box.html

+2-34
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,7 @@
22
<link rel="stylesheet" href="/adorn/adorn.css"/>
33
<script src="/adorn/adorn.js" async></script>
44
<script src="client_ids.js"></script>
5-
<style>
6-
.alert {
7-
display: block;
8-
padding: 15px;
9-
margin-bottom: 20px;
10-
border: 1px solid rgba(0, 0, 0, 0);
11-
border-radius: 4px;
12-
}
13-
.alert-warning{
14-
color: #8A6D3B;
15-
background-color: #FCF8E3;
16-
border-color: #FAEBCC;
17-
}
18-
.alert.alert-warning:before {
19-
content: "Warning: ";
20-
font-weight: bold;
21-
}
22-
</style>
23-
5+
<link rel="stylesheet" href="./helper/alert.css"/>
246

257
<title>hello( box )</title>
268
<h1>hello( box )</h1>
@@ -30,21 +12,7 @@ <h1>hello( box )</h1>
3012
Box.com only provides authentication from apps which are using HTTPS. <a href="https://developers.box.com/docs/#api-basics">See Box.com API documentation</a>
3113
</blockquote>
3214

33-
<script>
34-
if(document.location.href.indexOf('https://')!==0){
35-
document.body.appendChild((function(){
36-
var div = document.createElement('div');
37-
div.className = "alert alert-warning";
38-
div.appendChild((function(){
39-
var a = document.createElement('a');
40-
a.href = document.location.href.replace('http://', 'https://');
41-
a.innerHTML = "Launch page with secure protocol - https://";
42-
return a;
43-
})());
44-
return div;
45-
})());
46-
}
47-
</script>
15+
<script src="./helper/alert-https.js"></script>
4816

4917
<button onclick="login();" id="profile">Login Box</button>
5018

demos/helper/alert-https.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
if(document.location.href.indexOf('https://')!==0){
2+
document.body.appendChild((function(){
3+
var div = document.createElement('div');
4+
div.className = "alert alert-warning";
5+
div.appendChild((function(){
6+
var a = document.createElement('a');
7+
a.href = document.location.href.replace('http://', 'https://');
8+
a.innerHTML = "Launch page with secure protocol - https://";
9+
return a;
10+
})());
11+
return div;
12+
})());
13+
}

demos/helper/alert.css

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.alert {
2+
display: block;
3+
padding: 15px;
4+
margin-bottom: 20px;
5+
border: 1px solid rgba(0, 0, 0, 0);
6+
border-radius: 4px;
7+
}
8+
.alert-warning{
9+
color: #8A6D3B;
10+
background-color: #FCF8E3;
11+
border-color: #FAEBCC;
12+
}
13+
.alert.alert-warning:before {
14+
content: "Warning: ";
15+
font-weight: bold;
16+
}

0 commit comments

Comments
 (0)