Skip to content

Commit 955e7fd

Browse files
committed
update notice
1 parent 2a5528f commit 955e7fd

File tree

1 file changed

+4
-39
lines changed

1 file changed

+4
-39
lines changed

themes/vue/source/js/v3-notice.js

Lines changed: 4 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,6 @@
1212
typeof __pageRedirects !== 'undefined' && __pageRedirects[location.hash]
1313
const finalUrl = hashRedirect || v3Url
1414

15-
const preferV3 = localStorage.getItem('prefer-v3')
16-
if (preferV3 === 'true') {
17-
location.href = `https://vuejs.org${finalUrl}`
18-
} else if (preferV3 === 'false') {
19-
return
20-
}
21-
22-
const today = new Date()
23-
const target = new Date('2022-05-07')
24-
const timeinmilisec = target.getTime() - today.getTime()
25-
const days = Math.ceil(timeinmilisec / (1000 * 60 * 60 * 24))
26-
2715
const el = document.createElement('div')
2816
el.className = `v3-notice`
2917
el.innerHTML = `
@@ -32,21 +20,11 @@
3220
This page contains documentation for Vue 2. The Vue 3 version of the URL you are visiting is: <a id="v3-url" target="_blank"></a>.
3321
</p>
3422
<p>
35-
The original URL, <code>https://vuejs.org<span id="original-url"></span></code>
36-
will permanantly redirect to the v3 URL above after <b>May 7th, 2022 (${days} days from now).</b> If you need
37-
future access to this v2 page, please use the v2-prefixed URL
38-
<code>https://v2.vuejs.org<span id="current-url"></span></code>.
39-
</p>
40-
<p>
4123
You can learn more about the Vue 2 -> Vue 3 default version switch in
4224
<a target="_blank" href="https://blog.vuejs.org/posts/vue-3-as-the-new-default.html">this blog post</a>.
4325
</p>
4426
<p>
45-
Would you like to start redirecting all v2 URLs to v3 right now?
46-
</p>
47-
<p>
48-
<a class="go">Yes</a>
49-
<a class="stay">Not yet</a>
27+
<a class="stay">Stay on Vue 2 docs</a>
5028
</p>
5129
`.trim()
5230

@@ -91,23 +69,10 @@ Would you like to start redirecting all v2 URLs to v3 right now?
9169
document.body.appendChild(style)
9270
document.body.appendChild(el)
9371

94-
el.querySelector('#original-url').textContent = location.pathname
95-
el.querySelector('#current-url').textContent = location.pathname
96-
const v3Link = el.querySelector('#v3-url')
97-
98-
v3Link.textContent =
99-
v3Link.href =
100-
el.querySelector('.go').href =
101-
`https://vuejs.org${finalUrl}`
102-
103-
el.querySelector('.go').addEventListener('click', () => {
104-
localStorage.setItem('prefer-v3', 'true')
105-
})
106-
10772
el.querySelector('.stay').addEventListener('click', () => {
108-
localStorage.setItem('prefer-v3', 'false')
10973
document.body.removeChild(el)
110-
document.body.removeChild(style)
111-
location.href = location.pathname
11274
})
75+
76+
const v3Link = el.querySelector('#v3-url')
77+
v3Link.textContent = v3Link.href = `https://vuejs.org${finalUrl}`
11378
})()

0 commit comments

Comments
 (0)