5
5
@touchstart =" onTouchStart"
6
6
@touchend =" onTouchEnd"
7
7
>
8
- <VueMasteryBanner
9
- v-if =" isBannerOpen"
10
- @close-banner =" closeBanner"
11
- ref =" vueMasteryBanner"
12
- />
13
8
<Navbar v-if =" shouldShowNavbar" @toggle-sidebar =" toggleSidebar" />
14
9
15
10
<div class =" sidebar-mask" @click =" toggleSidebar(false)" />
@@ -53,7 +48,6 @@ import Home from '@theme/components/Home.vue'
53
48
import Navbar from ' @theme/components/Navbar.vue'
54
49
import Page from ' @theme/components/Page.vue'
55
50
import Sidebar from ' @theme/components/Sidebar.vue'
56
- import VueMasteryBanner from ' @theme/components/sponsors/VueMasteryBanner.vue'
57
51
import BuySellAds from ' @theme/components/BuySellAds.vue'
58
52
import CarbonAds from ' @theme/components/CarbonAds.vue'
59
53
import { resolveSidebarItems } from ' ../util'
@@ -66,18 +60,13 @@ export default {
66
60
Page,
67
61
Sidebar,
68
62
Navbar,
69
- VueMasteryBanner,
70
63
BuySellAds,
71
64
CarbonAds
72
65
},
73
66
74
67
data () {
75
68
return {
76
- isSidebarOpen: false ,
77
- isBannerOpen: true ,
78
- isMenuFixed: false ,
79
- nameStorage: ' vuemastery-black-firday-2020-banner' ,
80
- menuPosition: 0
69
+ isSidebarOpen: false
81
70
}
82
71
},
83
72
@@ -121,9 +110,7 @@ export default {
121
110
{
122
111
' no-navbar' : ! this .shouldShowNavbar ,
123
112
' sidebar-open' : this .isSidebarOpen ,
124
- ' no-sidebar' : ! this .shouldShowSidebar ,
125
- ' vuemastery-menu-fixed' : this .isMenuFixed ,
126
- ' vuemastery-promo' : this .isBannerOpen
113
+ ' no-sidebar' : ! this .shouldShowSidebar
127
114
},
128
115
userPageClass
129
116
]
@@ -138,13 +125,6 @@ export default {
138
125
this .$router .afterEach (() => {
139
126
this .isSidebarOpen = false
140
127
})
141
-
142
- // Load component according to user preferences
143
- if (! localStorage .getItem (this .nameStorage )) {
144
- this .initBanner ()
145
- } else {
146
- this .isBannerOpen = false
147
- }
148
128
},
149
129
150
130
methods: {
@@ -171,54 +151,6 @@ export default {
171
151
this .toggleSidebar (false )
172
152
}
173
153
}
174
- },
175
-
176
- // Vue Mastery Banner
177
- initBanner () {
178
- // Add event listeners
179
- this .toggleBannerEvents (true )
180
- // Add class to the body to push fixed elements
181
- this .isBannerOpen = true
182
- // Get the menu position
183
- this .getMenuPosition ()
184
- // Check current page offset position
185
- this .isMenuFixed = this .isUnderBanner ()
186
- },
187
-
188
- closeBanner (e ) {
189
- // Remove events
190
- this .toggleBannerEvents (false )
191
- // Hide the banner
192
- this .isBannerOpen = false
193
- // Save action in the local storage
194
- localStorage .setItem (this .nameStorage , true )
195
- },
196
-
197
- getMenuPosition () {
198
- this .menuPosition = this .$refs .vueMasteryBanner .$el .clientHeight
199
- },
200
-
201
- isUnderBanner () {
202
- return window .pageYOffset > this .menuPosition
203
- },
204
-
205
- fixMenuAfterBanner () {
206
- if (this .isUnderBanner ()) {
207
- if (! this .isMenuFixed ) {
208
- // The menu will be fixed
209
- this .isMenuFixed = true
210
- }
211
- } else if (this .isMenuFixed ) {
212
- // The menu stay under the banner
213
- this .isMenuFixed = false
214
- }
215
- },
216
-
217
- toggleBannerEvents (on ) {
218
- // Add or remove event listerners attached to the DOM
219
- let method = on ? ' addEventListener' : ' removeEventListener'
220
- window [method](' resize' , this .getMenuPosition )
221
- window [method](' scroll' , this .fixMenuAfterBanner )
222
154
}
223
155
}
224
156
}
0 commit comments