Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
libai
/
footseen-large-website
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
3e28e05a
authored
Nov 23, 2022
by
libai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
测试
parent
2b039874
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
27 deletions
mTest/index.html
mTest/index.js
mTest/index.html
View file @
3e28e05a
...
...
@@ -37,7 +37,7 @@
<link
rel=
"stylesheet"
href=
"css/index.css?v=2022112313"
>
<link
rel=
"stylesheet"
href=
"css/login.css?v=2022112313"
>
<script
src=
"index.js?v=2022112326"
defer=
""
></script>
<link
rel=
"manifest"
href=
"manifest.webmanifest?v=20221123
26
"
/>
<link
rel=
"manifest"
href=
"manifest.webmanifest?v=20221123
08
"
/>
<script
src=
"https://accounts.google.com/gsi/client"
async
defer
></script>
<script
async
defer
crossorigin=
"anonymous"
src=
"https://connect.facebook.net/en_US/sdk.js"
></script>
...
...
@@ -84,9 +84,9 @@
</style>
</head>
<body
style=
"background: #d9d9d9"
>
<button
class=
"add-button"
>
<
!-- <
button class="add-button">
<div class="add-button-close"></div>
</button>
</button>
-->
<div
class=
"bottom-nav"
>
<div><div
class=
"bottom-nav-img1 bottom-nav-img1-click"
></div></div>
<div><div
class=
"bottom-nav-img2"
></div></div>
...
...
mTest/index.js
View file @
3e28e05a
...
...
@@ -15,29 +15,29 @@ const addBtn = document.querySelector('.add-button');
addBtn
.
style
.
display
=
'none'
;
window
.
addEventListener
(
'beforeinstallprompt'
,
(
e
)
=>
{
setTimeout
(
function
()
{
// Prevent Chrome 67 and earlier from automatically showing the prompt
e
.
preventDefault
();
// Stash the event so it can be triggered later.
deferredPrompt
=
e
;
// Update UI to notify the user they can add to home screen
addBtn
.
style
.
display
=
'block'
;
addBtn
.
addEventListener
(
'click'
,
()
=>
{
// hide our user interface that shows our A2HS button
addBtn
.
style
.
display
=
'none'
;
// Show the prompt
deferredPrompt
.
prompt
();
// Wait for the user to respond to the prompt
deferredPrompt
.
userChoice
.
then
((
choiceResult
)
=>
{
if
(
choiceResult
.
outcome
===
'accepted'
)
{
console
.
log
(
'User accepted the A2HS prompt'
);
}
else
{
console
.
log
(
'User dismissed the A2HS prompt'
);
}
deferredPrompt
=
null
;
});
});
},
5000
);
//
setTimeout(function() {
//
// Prevent Chrome 67 and earlier from automatically showing the prompt
//
e.preventDefault();
//
// Stash the event so it can be triggered later.
//
deferredPrompt = e;
//
// Update UI to notify the user they can add to home screen
//
addBtn.style.display = 'block';
//
addBtn.addEventListener('click', () => {
//
// hide our user interface that shows our A2HS button
//
addBtn.style.display = 'none';
//
// Show the prompt
//
deferredPrompt.prompt();
//
// Wait for the user to respond to the prompt
//
deferredPrompt.userChoice.then((choiceResult) => {
//
if (choiceResult.outcome === 'accepted') {
//
console.log('User accepted the A2HS prompt');
//
} else {
//
console.log('User dismissed the A2HS prompt');
//
}
//
deferredPrompt = null;
//
});
//
});
//
}, 5000);
});
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment