canvas_lti_third_party_cookies 0.3.3 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,115 +0,0 @@
1
- <%= javascript_tag do -%>
2
- const requestStorageAccess = () => {
3
- document
4
- .requestStorageAccess()
5
- .then(() => redirectToSetCookies())
6
- .catch(() => requestFullWindowLaunch());
7
- };
8
-
9
- const requestFullWindowLaunch = () => {
10
- window.parent.postMessage(
11
- {
12
- messageType: "requestFullWindowLaunch",
13
- data: "<%= launch_url %>",
14
- },
15
- "*"
16
- );
17
- };
18
-
19
- const redirectToSetCookies = () => {
20
- const form = document.getElementById("relaunch");
21
- form.submit();
22
- };
23
-
24
- document.addEventListener("DOMContentLoaded", () => {
25
- document.getElementById("request").addEventListener("click", requestStorageAccess)
26
- document
27
- .hasStorageAccess()
28
- .then((hasStorageAccess) => {
29
- if (hasStorageAccess) {
30
- redirectToSetCookies();
31
- }
32
- })
33
- .catch((err) => console.error(err));
34
- });
35
- <% end %>
36
- <style type="text/css">
37
- .flex-container {
38
- display: flex;
39
- flex-direction: column;
40
- height: 100%;
41
- font-family: "Segoe UI", Frutiger, "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", Arial, sans-serif;
42
- font-size: 1.1em;
43
- padding: 0 75px 0 75px;
44
- }
45
-
46
- .flex-item {
47
- margin-bottom: 10px;
48
- text-align: center;
49
- }
50
-
51
- .first {
52
- margin-top: 50px;
53
- }
54
-
55
- p {
56
- margin: 0 0 0.5em 0;
57
- }
58
-
59
- button {
60
- background: #008EE2;
61
- color: #ffffff;
62
- border: 1px solid;
63
- border-color: #0079C1;
64
- border-radius: 3px;
65
- transition: background-color 0.2s ease-in-out;
66
- display: inline-block;
67
- position: relative;
68
- padding: 8px 14px;
69
- margin-bottom: 0;
70
- font-size: 16px;
71
- font-size: 1rem;
72
- line-height: 20px;
73
- text-align: center;
74
- vertical-align: middle;
75
- cursor: pointer;
76
- text-decoration: none;
77
- overflow: hidden;
78
- text-shadow: none;
79
- -webkit-user-select: none;
80
- -moz-user-select: none;
81
- }
82
-
83
- #safari-logo {
84
- width: 100px;
85
- height: 100px;
86
- }
87
- </style>
88
-
89
- <div class="flex-container">
90
- <div class="flex-item first">
91
- <img id="safari-logo" src="https://upload.wikimedia.org/wikipedia/commons/5/52/Safari_browser_logo.svg" alt="Safari Logo" />
92
- </div>
93
-
94
- <div class="flex-item">
95
- <strong>It looks like you are using Safari.</strong>
96
- </div>
97
-
98
- <div class="flex-item">
99
- <p>Safari requires your interaction with this app before logging you in.</p>
100
- <p>A dialog may appear asking you to allow this app to use cookies while browsing Canvas.</p>
101
- <p>For the best experience, click Allow.</p>
102
- <p>A dialog may also appear asking you to navigate somewhere else.</p>
103
- <p>If it does, save your work first and then click Leave Page.</p>
104
- </div>
105
-
106
- <div class="flex-item">
107
- <button id="request">Continue to App</button>
108
- </div>
109
- <div>
110
- </div>
111
- <form id="relaunch" method="POST" action="<%= relaunch_url %>">
112
- <% launch_data.each do |key, value| -%>
113
- <%= hidden_field_tag key, value %>
114
- <% end -%>
115
- </form>