bootstrap-italia 2.8.5 → 2.8.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/bootstrap-italia.min.css +1 -1
- package/dist/js/bootstrap-italia.bundle.min.js +21 -21
- package/dist/js/bootstrap-italia.min.js +21 -21
- package/dist/plugins/backToTop.js +1 -1
- package/dist/plugins/backToTop.js.map +1 -1
- package/dist/plugins/cookiebar.js +12 -0
- package/dist/plugins/cookiebar.js.map +1 -1
- package/dist/plugins/fonts-loader.js +3 -0
- package/dist/plugins/fonts-loader.js.map +1 -1
- package/dist/plugins/form-validate.js +1 -10
- package/dist/plugins/form-validate.js.map +1 -1
- package/dist/plugins/history-back.js +3 -1
- package/dist/plugins/history-back.js.map +1 -1
- package/dist/plugins/init.js +1 -1
- package/dist/plugins/init.js.map +1 -1
- package/dist/plugins/input-number.js +16 -50
- package/dist/plugins/input-number.js.map +1 -1
- package/dist/plugins/input-password.js +0 -39
- package/dist/plugins/input-password.js.map +1 -1
- package/dist/plugins/input-search-autocomplete.js +14 -6
- package/dist/plugins/input-search-autocomplete.js.map +1 -1
- package/dist/plugins/input.js +8 -6
- package/dist/plugins/input.js.map +1 -1
- package/dist/plugins/masonry.js +3 -6
- package/dist/plugins/masonry.js.map +1 -1
- package/dist/plugins/navscroll.js +3 -0
- package/dist/plugins/navscroll.js.map +1 -1
- package/dist/plugins/select-autocomplete.js +3 -0
- package/dist/plugins/select-autocomplete.js.map +1 -1
- package/dist/plugins/sticky.js +4 -1
- package/dist/plugins/sticky.js.map +1 -1
- package/dist/plugins/track-focus.js +3 -0
- package/dist/plugins/track-focus.js.map +1 -1
- package/dist/plugins/upload-dragdrop.js +8 -6
- package/dist/plugins/upload-dragdrop.js.map +1 -1
- package/dist/plugins/util/device.js +3 -1
- package/dist/plugins/util/device.js.map +1 -1
- package/dist/plugins/util/on-document-scroll.js +3 -0
- package/dist/plugins/util/on-document-scroll.js.map +1 -1
- package/dist/plugins/util/pageScroll.js +15 -7
- package/dist/plugins/util/pageScroll.js.map +1 -1
- package/dist/plugins/util/tween.js +3 -0
- package/dist/plugins/util/tween.js.map +1 -1
- package/dist/plugins/util/youtube-video.js +12 -0
- package/dist/plugins/util/youtube-video.js.map +1 -1
- package/dist/plugins/videoplayer.js +3 -1
- package/dist/plugins/videoplayer.js.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +1 -1
- package/src/js/plugins/backToTop.js +1 -1
- package/src/js/plugins/cookiebar.js +12 -0
- package/src/js/plugins/fonts-loader.js +3 -0
- package/src/js/plugins/form-validate.js +1 -13
- package/src/js/plugins/history-back.js +3 -1
- package/src/js/plugins/init.js +1 -1
- package/src/js/plugins/input-number.js +16 -51
- package/src/js/plugins/input-password.js +0 -39
- package/src/js/plugins/input-search-autocomplete.js +14 -6
- package/src/js/plugins/input.js +8 -6
- package/src/js/plugins/masonry.js +3 -6
- package/src/js/plugins/navscroll.js +3 -0
- package/src/js/plugins/select-autocomplete.js +3 -0
- package/src/js/plugins/sticky.js +4 -1
- package/src/js/plugins/track-focus.js +3 -0
- package/src/js/plugins/upload-dragdrop.js +8 -6
- package/src/js/plugins/util/device.js +3 -1
- package/src/js/plugins/util/on-document-scroll.js +3 -0
- package/src/js/plugins/util/pageScroll.js +15 -7
- package/src/js/plugins/util/tween.js +3 -0
- package/src/js/plugins/util/youtube-video.js +12 -0
- package/src/js/plugins/videoplayer.js +3 -1
- package/src/js/version.js +1 -1
- package/src/scss/custom/_version.scss +1 -1
|
@@ -112,17 +112,8 @@ class FormValidate {
|
|
|
112
112
|
if (legend) {
|
|
113
113
|
legend.setAttribute('aria-describedby', errIds.join(' '))
|
|
114
114
|
legend.setAttribute('aria-invalid', 'true')
|
|
115
|
-
|
|
116
|
-
//not needed anymore
|
|
117
|
-
/*const span = document.createElement('span')
|
|
118
|
-
span.classList.add('sr-only')
|
|
119
|
-
span.classList.add(CLASS_NAME_SRONLY)
|
|
120
|
-
span.textContent = errTexts.join(' ')
|
|
121
|
-
legend.append(span)*/
|
|
122
115
|
}
|
|
123
|
-
}
|
|
124
|
-
console.warn('[JustValidateIt] the element is invalid but no error message was found', { target })
|
|
125
|
-
}*/
|
|
116
|
+
}
|
|
126
117
|
}
|
|
127
118
|
/**
|
|
128
119
|
* Removes the fieldset ARIA attributes
|
|
@@ -186,7 +177,4 @@ const ValidatorSelectAutocomplete = (inputId, config = {}) => {
|
|
|
186
177
|
}
|
|
187
178
|
}
|
|
188
179
|
|
|
189
|
-
//window.JustValidateIt = JustValidateIt
|
|
190
|
-
//window.JustValidateItValidatorSelectAutocomplete = JustValidateItValidatorSelectAutocomplete
|
|
191
|
-
|
|
192
180
|
export { FormValidate, ValidatorSelectAutocomplete }
|
package/src/js/plugins/init.js
CHANGED
|
@@ -3,7 +3,7 @@ import TrackFocus from './track-focus'
|
|
|
3
3
|
import BOOTSTRAP_ITALIA_VERSION from '../version'
|
|
4
4
|
|
|
5
5
|
const init = () => {
|
|
6
|
-
if (!window.BOOTSTRAP_ITALIA_VERSION) {
|
|
6
|
+
if (typeof window !== 'undefined' && !window.BOOTSTRAP_ITALIA_VERSION) {
|
|
7
7
|
new TrackFocus()
|
|
8
8
|
window.BOOTSTRAP_ITALIA_VERSION = BOOTSTRAP_ITALIA_VERSION
|
|
9
9
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import BaseComponent from 'bootstrap/js/src/base-component'
|
|
2
2
|
import EventHandler from 'bootstrap/js/src/dom/event-handler'
|
|
3
3
|
import SelectorEngine from 'bootstrap/js/src/dom/selector-engine'
|
|
4
|
-
//import Manipulator from 'bootstrap/js/src/dom/manipulator'
|
|
5
4
|
|
|
6
5
|
import InputLabel from './input-label'
|
|
7
6
|
|
|
@@ -14,11 +13,9 @@ const EVENT_CLICK = `click${EVENT_KEY}`
|
|
|
14
13
|
const EVENT_CHANGE = `change${EVENT_KEY}`
|
|
15
14
|
const EVENT_INPUT = `input`
|
|
16
15
|
|
|
17
|
-
//const EVENT_FOCUS_DATA_API = `focus${EVENT_KEY}${DATA_API_KEY}`
|
|
18
16
|
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`
|
|
19
17
|
|
|
20
18
|
const CLASS_NAME_ADAPTIVE = 'input-number-adaptive'
|
|
21
|
-
//const CLASS_NAME_INCREMENT = 'input-number-add'
|
|
22
19
|
const CLASS_NAME_DECREMENT = 'input-number-sub'
|
|
23
20
|
|
|
24
21
|
const SELECTOR_WRAPPER = '.input-number'
|
|
@@ -69,14 +66,10 @@ class InputNumber extends BaseComponent {
|
|
|
69
66
|
_inputResize() {
|
|
70
67
|
if (this._wrapperElement.classList.contains(CLASS_NAME_ADAPTIVE)) {
|
|
71
68
|
let newWidth = null
|
|
72
|
-
//let newWidthIE = null
|
|
73
|
-
//74px - buttons (30px) and possible validation icon (40px)
|
|
74
69
|
newWidth = 'calc(70px + ' + this._element.value.length + 'ch)'
|
|
75
|
-
//newWidthIE = 'calc(44px + (1.5 * ' + this._element.value.length + 'ch))'
|
|
76
70
|
|
|
77
71
|
if (newWidth) {
|
|
78
72
|
this._element.style.width = newWidth
|
|
79
|
-
//IE - this._element.style.width = calcIe
|
|
80
73
|
}
|
|
81
74
|
}
|
|
82
75
|
}
|
|
@@ -127,35 +120,6 @@ class InputNumber extends BaseComponent {
|
|
|
127
120
|
* ------------------------------------------------------------------------
|
|
128
121
|
*/
|
|
129
122
|
|
|
130
|
-
/*const inputs = SelectorEngine.find(SELECTOR_INPUT)
|
|
131
|
-
inputs.forEach((input) => {
|
|
132
|
-
EventHandler.one(input, EVENT_FOCUS_DATA_API, (evt) => {
|
|
133
|
-
evt.preventDefault()
|
|
134
|
-
InputNumber.getOrCreateInstance(input)
|
|
135
|
-
EventHandler.trigger(input, 'focus')
|
|
136
|
-
})
|
|
137
|
-
})
|
|
138
|
-
|
|
139
|
-
const inputsButtons = SelectorEngine.find(SELECTOR_WRAPPER + ' ' + SELECTOR_BTN)
|
|
140
|
-
inputsButtons.forEach((button) => {
|
|
141
|
-
EventHandler.one(button, EVENT_CLICK_DATA_API, (evt) => {
|
|
142
|
-
if (button.classList.contains(CLASS_NAME_INCREMENT) || button.classList.contains(CLASS_NAME_DECREMENT)) {
|
|
143
|
-
const wrapper = button.closest(SELECTOR_WRAPPER)
|
|
144
|
-
if (wrapper) {
|
|
145
|
-
const input = SelectorEngine.findOne(SELECTOR_INPUT, wrapper)
|
|
146
|
-
if (input) {
|
|
147
|
-
const inputNumber = InputNumber.getInstance(input)
|
|
148
|
-
if (!inputNumber) {
|
|
149
|
-
evt.preventDefault()
|
|
150
|
-
InputNumber.getOrCreateInstance(input)
|
|
151
|
-
EventHandler.trigger(button, 'click')
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
})
|
|
157
|
-
})*/
|
|
158
|
-
|
|
159
123
|
const createInput = (element) => {
|
|
160
124
|
if (element && element.matches(SELECTOR_INPUT) && element.parentNode.querySelector(SELECTOR_BTN)) {
|
|
161
125
|
return InputNumber.getOrCreateInstance(element)
|
|
@@ -163,22 +127,23 @@ const createInput = (element) => {
|
|
|
163
127
|
return null
|
|
164
128
|
}
|
|
165
129
|
|
|
166
|
-
document
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
130
|
+
if (typeof document !== 'undefined') {
|
|
131
|
+
document.addEventListener('DOMContentLoaded', function () {
|
|
132
|
+
var frmel = document.querySelectorAll(SELECTOR_INPUT + ', label')
|
|
133
|
+
frmel.forEach(function (item) {
|
|
134
|
+
const target = InputLabel.getInputFromLabel(item) || item
|
|
135
|
+
createInput(target)
|
|
136
|
+
})
|
|
171
137
|
})
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
InputNumber.getOrCreateInstance(input)
|
|
138
|
+
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_BTN, function () {
|
|
139
|
+
const wrapper = this.closest(SELECTOR_WRAPPER)
|
|
140
|
+
if (wrapper) {
|
|
141
|
+
const input = SelectorEngine.findOne(SELECTOR_INPUT, wrapper)
|
|
142
|
+
if (input) {
|
|
143
|
+
InputNumber.getOrCreateInstance(input)
|
|
144
|
+
}
|
|
180
145
|
}
|
|
181
|
-
}
|
|
182
|
-
}
|
|
146
|
+
})
|
|
147
|
+
}
|
|
183
148
|
|
|
184
149
|
export default InputNumber
|
|
@@ -89,38 +89,6 @@ class InputPassword extends BaseComponent {
|
|
|
89
89
|
|
|
90
90
|
_init() {
|
|
91
91
|
if (this._meter) {
|
|
92
|
-
/*this._grayBarElement = document.createElement('div')
|
|
93
|
-
this._grayBarElement.classList.add('password-meter', 'progress', 'rounded-0', 'position-absolute')
|
|
94
|
-
this._grayBarElement.innerHTML = `<div class="row position-absolute w-100 m-0">
|
|
95
|
-
<div class="col-3 border-start border-end border-white"></div>
|
|
96
|
-
<div class="col-3 border-start border-end border-white"></div>
|
|
97
|
-
<div class="col-3 border-start border-end border-white"></div>
|
|
98
|
-
<div class="col-3 border-start border-end border-white"></div>
|
|
99
|
-
</div>`
|
|
100
|
-
|
|
101
|
-
this._colorBarElement = document.createElement('div')
|
|
102
|
-
this._colorBarElement.classList.add('progress-bar')
|
|
103
|
-
this._colorBarElement.setAttribute('role', 'progressbar')
|
|
104
|
-
this._colorBarElement.setAttribute('aria-valuenow', '0')
|
|
105
|
-
this._colorBarElement.setAttribute('aria-valuemin', '0')
|
|
106
|
-
this._colorBarElement.setAttribute('aria-valuemax', '100')
|
|
107
|
-
|
|
108
|
-
const wrapper = document.createElement('div')
|
|
109
|
-
wrapper.classList.add('password-strength-meter')
|
|
110
|
-
|
|
111
|
-
this._grayBarElement.appendChild(this._colorBarElement)
|
|
112
|
-
|
|
113
|
-
if (this._config.showText) {
|
|
114
|
-
this._textElement = document.createElement('small')
|
|
115
|
-
this._textElement.classList.add('form-text', 'text-muted')
|
|
116
|
-
this._textElement.innerHTML = this._config.enterPass
|
|
117
|
-
wrapper.appendChild(this._textElement)
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
wrapper.appendChild(this._grayBarElement)
|
|
121
|
-
|
|
122
|
-
this._element.parentNode.insertBefore(wrapper, this._element.nextSibling)*/
|
|
123
|
-
|
|
124
92
|
this._grayBarElement = this._meter.querySelector(SELECTOR_METER_GRAYBAR)
|
|
125
93
|
this._colorBarElement = this._meter.querySelector(SELECTOR_METER_COLBAR)
|
|
126
94
|
this._textElement = this._meter.querySelector(SELECTOR_TEXT)
|
|
@@ -130,13 +98,6 @@ class InputPassword extends BaseComponent {
|
|
|
130
98
|
}
|
|
131
99
|
}
|
|
132
100
|
if (this._isCustom) {
|
|
133
|
-
/*this._capsElement = document.createElement('small')
|
|
134
|
-
this._capsElement.style.display = 'none'
|
|
135
|
-
this._capsElement.classList.add('password-caps', 'form-text', 'text-warning', 'position-absolute', 'bg-white', 'w-100')
|
|
136
|
-
this._capsElement.innerHTML = this._config.alertCaps
|
|
137
|
-
|
|
138
|
-
this._element.parentNode.appendChild(this._capsElement)*/
|
|
139
|
-
|
|
140
101
|
this._capsElement = this._element.parentNode.querySelector(SELECTOR_CAPS)
|
|
141
102
|
}
|
|
142
103
|
|
|
@@ -88,6 +88,9 @@ class InputSearch extends BaseComponent {
|
|
|
88
88
|
|
|
89
89
|
_init() {
|
|
90
90
|
if (this._element.classList.contains(CLASS_NAME_AUTOCOMPLETE)) {
|
|
91
|
+
if (typeof document === 'undefined') {
|
|
92
|
+
return
|
|
93
|
+
}
|
|
91
94
|
this._items = this._getItems()
|
|
92
95
|
this._autocompleteElement = document.createElement('ul')
|
|
93
96
|
this._autocompleteElement.classList.add('autocomplete-list')
|
|
@@ -100,6 +103,9 @@ class InputSearch extends BaseComponent {
|
|
|
100
103
|
}
|
|
101
104
|
|
|
102
105
|
_createOption(link, text, label, icon) {
|
|
106
|
+
if (typeof document === 'undefined') {
|
|
107
|
+
return
|
|
108
|
+
}
|
|
103
109
|
const option = document.createElement('li')
|
|
104
110
|
option.innerHTML = `<a href="${link}">
|
|
105
111
|
${icon}
|
|
@@ -134,12 +140,14 @@ const createInput = (element) => {
|
|
|
134
140
|
return null
|
|
135
141
|
}
|
|
136
142
|
|
|
137
|
-
document
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
143
|
+
if (typeof document !== 'undefined') {
|
|
144
|
+
document.addEventListener('DOMContentLoaded', function () {
|
|
145
|
+
var frmel = document.querySelectorAll(SELECTOR_SEARCH + ', label')
|
|
146
|
+
frmel.forEach(function (item) {
|
|
147
|
+
const target = InputLabel.getInputFromLabel(item) || item
|
|
148
|
+
createInput(target)
|
|
149
|
+
})
|
|
142
150
|
})
|
|
143
|
-
}
|
|
151
|
+
}
|
|
144
152
|
|
|
145
153
|
export default InputSearch
|
package/src/js/plugins/input.js
CHANGED
|
@@ -80,12 +80,14 @@ const createInput = (element) => {
|
|
|
80
80
|
return null
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
document
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
83
|
+
if (typeof document !== 'undefined') {
|
|
84
|
+
document.addEventListener('DOMContentLoaded', function () {
|
|
85
|
+
var frmel = document.querySelectorAll('input, textarea, label')
|
|
86
|
+
frmel.forEach(function (item) {
|
|
87
|
+
const target = InputLabel.getInputFromLabel(item) || item
|
|
88
|
+
createInput(target)
|
|
89
|
+
})
|
|
88
90
|
})
|
|
89
|
-
}
|
|
91
|
+
}
|
|
90
92
|
|
|
91
93
|
export default Input
|
|
@@ -20,14 +20,8 @@ const Default = {
|
|
|
20
20
|
percentPosition: true,
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
//const MASONRY_EXISTS = !!window.Masonry
|
|
24
|
-
|
|
25
23
|
class Masonry extends BaseComponent {
|
|
26
24
|
constructor(element, config) {
|
|
27
|
-
/*if (!MASONRY_EXISTS) {
|
|
28
|
-
throw new Error("[Masonry] you can't instantiate Mesonry component without Masonry Library")
|
|
29
|
-
}*/
|
|
30
|
-
|
|
31
25
|
super(element)
|
|
32
26
|
|
|
33
27
|
this._config = this._getConfig(config)
|
|
@@ -92,6 +86,9 @@ class Masonry extends BaseComponent {
|
|
|
92
86
|
}
|
|
93
87
|
|
|
94
88
|
_createLoader() {
|
|
89
|
+
if (typeof document === 'undefined') {
|
|
90
|
+
return
|
|
91
|
+
}
|
|
95
92
|
const loader = document.createElement('div')
|
|
96
93
|
loader.classList.add(CLASS_NAME_LOADER, 'fade', 'd-flex', 'justify-content-center', 'align-items-center')
|
|
97
94
|
loader.innerHTML = '<div class="progress-spinner progress-spinner-active"><span class="visually-hidden">Caricamento...</span></div>'
|
|
@@ -198,6 +198,9 @@ class NavScroll extends BaseComponent {
|
|
|
198
198
|
|
|
199
199
|
_onScroll() {
|
|
200
200
|
const sectionsContainerTop = this._sectionContainer ? this._sectionContainer.offsetTop : 0
|
|
201
|
+
if (typeof document === 'undefined') {
|
|
202
|
+
return
|
|
203
|
+
}
|
|
201
204
|
const scrollDistance = document.scrollingElement.scrollTop - sectionsContainerTop
|
|
202
205
|
|
|
203
206
|
const navItems = SelectorEngine.find(SELECTOR_LINK, this._element)
|
|
@@ -36,6 +36,9 @@ class SelectAutocomplete extends BaseComponent {
|
|
|
36
36
|
accessibleAutocomplete.enhanceSelectElement(Object.assign({}, { selectElement: this._element }, this._config))
|
|
37
37
|
setTimeout(() => {
|
|
38
38
|
if (this._hasFormControl) {
|
|
39
|
+
if (typeof document === 'undefined') {
|
|
40
|
+
return
|
|
41
|
+
}
|
|
39
42
|
const inputField = document.getElementById(this.element_original_id)
|
|
40
43
|
inputField.classList.add('form-control')
|
|
41
44
|
onClassChange(inputField, (node) => {
|
package/src/js/plugins/sticky.js
CHANGED
|
@@ -150,7 +150,7 @@ class Sticky extends BaseComponent {
|
|
|
150
150
|
this._setLimit()
|
|
151
151
|
}
|
|
152
152
|
const limit = this._getLimit()
|
|
153
|
-
if (window.pageYOffset > limit) {
|
|
153
|
+
if (typeof window !== 'undefined' && window.pageYOffset > limit) {
|
|
154
154
|
this._setSticky()
|
|
155
155
|
} else {
|
|
156
156
|
this._unsetSticky()
|
|
@@ -191,6 +191,9 @@ class Sticky extends BaseComponent {
|
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
_createWrapper() {
|
|
194
|
+
if (typeof document === 'undefined') {
|
|
195
|
+
return
|
|
196
|
+
}
|
|
194
197
|
const wrapper = document.createElement('div')
|
|
195
198
|
wrapper.classList.add(CLASS_NAME_WRAPPER)
|
|
196
199
|
wrapper.style.width = '100%' //this._element.getBoundingClientRect().width + 'px'
|
|
@@ -134,11 +134,13 @@ const createInput = (element) => {
|
|
|
134
134
|
return null
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
document
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
137
|
+
if (typeof document !== 'undefined') {
|
|
138
|
+
document.addEventListener('dragenter', function (evt) {
|
|
139
|
+
createInput(evt.target)
|
|
140
|
+
})
|
|
141
|
+
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_FORM + ' label', function () {
|
|
142
|
+
createInput(this)
|
|
143
|
+
})
|
|
144
|
+
}
|
|
143
145
|
|
|
144
146
|
export default UploadDragDrop
|
|
@@ -4,7 +4,9 @@ const MEDIA_PHONE = ''
|
|
|
4
4
|
const MEDIA_DESKTOP = ''*/
|
|
5
5
|
|
|
6
6
|
const isScreenMobile = () => {
|
|
7
|
-
|
|
7
|
+
if (typeof window !== 'undefined') {
|
|
8
|
+
return window.matchMedia(MEDIA_MOBILE).matches
|
|
9
|
+
}
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
export { isScreenMobile }
|
|
@@ -5,22 +5,30 @@
|
|
|
5
5
|
const CLASS_SCROLL_DISABLED = 'pagescroll-scroll-disabled'
|
|
6
6
|
|
|
7
7
|
let disabled = false
|
|
8
|
-
let currentScrollPos = document.scrollingElement.scrollTop
|
|
9
|
-
const htmlContainer = document.querySelector('html')
|
|
8
|
+
let currentScrollPos = typeof document === 'undefined' ? 0 : document.scrollingElement.scrollTop
|
|
9
|
+
const htmlContainer = typeof document === 'undefined' ? null : document.querySelector('html')
|
|
10
10
|
|
|
11
11
|
export function disablePageScroll() {
|
|
12
|
+
if (typeof document === 'undefined') {
|
|
13
|
+
return
|
|
14
|
+
}
|
|
12
15
|
disabled = true
|
|
13
16
|
currentScrollPos = document.scrollingElement.scrollTop
|
|
14
17
|
htmlContainer.classList.add(CLASS_SCROLL_DISABLED)
|
|
15
18
|
}
|
|
16
19
|
|
|
17
20
|
export function enablePageScroll() {
|
|
21
|
+
if (typeof document === 'undefined') {
|
|
22
|
+
return
|
|
23
|
+
}
|
|
18
24
|
disabled = false
|
|
19
25
|
htmlContainer.classList.remove(CLASS_SCROLL_DISABLED)
|
|
20
26
|
}
|
|
21
27
|
|
|
22
|
-
document
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
28
|
+
if (typeof document !== 'undefined') {
|
|
29
|
+
document.addEventListener('scroll', () => {
|
|
30
|
+
if (disabled) {
|
|
31
|
+
document.scrollingElement.scrollTop = currentScrollPos
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
}
|
|
@@ -11,6 +11,9 @@ const AnimeDefault = {
|
|
|
11
11
|
* @param {Object} config - duration, easing, complete, update, ...
|
|
12
12
|
*/
|
|
13
13
|
export const documentScrollTo = (scrollTop, config) => {
|
|
14
|
+
if (typeof document === 'undefined') {
|
|
15
|
+
return
|
|
16
|
+
}
|
|
14
17
|
const onComplete = (typeof config === 'object' ? config : {}).complete
|
|
15
18
|
const scrollElement = window.document.scrollingElement || window.document.body || window.document.documentElement
|
|
16
19
|
const prevScrollBehavior = scrollElement.style.scrollBehavior
|
|
@@ -80,6 +80,9 @@ const initYoutubePlugin = (videojs) => {
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
createEl() {
|
|
83
|
+
if (typeof document === 'undefined') {
|
|
84
|
+
return
|
|
85
|
+
}
|
|
83
86
|
var div = document.createElement('div');
|
|
84
87
|
div.setAttribute('id', this.options_.techId);
|
|
85
88
|
div.setAttribute('style', 'width:100%;height:100%;top:0;left:0;position:absolute');
|
|
@@ -648,6 +651,9 @@ const initYoutubePlugin = (videojs) => {
|
|
|
648
651
|
}
|
|
649
652
|
|
|
650
653
|
supportsFullScreen() {
|
|
654
|
+
if (typeof document === 'undefined') {
|
|
655
|
+
return
|
|
656
|
+
}
|
|
651
657
|
return document.fullscreenEnabled ||
|
|
652
658
|
document.webkitFullscreenEnabled ||
|
|
653
659
|
document.mozFullScreenEnabled ||
|
|
@@ -725,6 +731,9 @@ const initYoutubePlugin = (videojs) => {
|
|
|
725
731
|
}
|
|
726
732
|
|
|
727
733
|
function loadScript(src, callback) {
|
|
734
|
+
if (typeof document === 'undefined') {
|
|
735
|
+
return
|
|
736
|
+
}
|
|
728
737
|
var loaded = false;
|
|
729
738
|
var tag = document.createElement('script');
|
|
730
739
|
var firstScriptTag = document.getElementsByTagName('script')[0];
|
|
@@ -750,6 +759,9 @@ const initYoutubePlugin = (videojs) => {
|
|
|
750
759
|
}
|
|
751
760
|
|
|
752
761
|
function injectCss() {
|
|
762
|
+
if (typeof document === 'undefined') {
|
|
763
|
+
return
|
|
764
|
+
}
|
|
753
765
|
var css = // iframe blocker to catch mouse events
|
|
754
766
|
'.vjs-youtube .vjs-iframe-blocker { display: none; }' +
|
|
755
767
|
'.vjs-youtube.vjs-user-inactive .vjs-iframe-blocker { display: block; }' +
|
|
@@ -107,7 +107,9 @@ const DEFAULT_CONFIG = { languages: { it: itLang }, language: 'it' }
|
|
|
107
107
|
|
|
108
108
|
const Default = {}
|
|
109
109
|
|
|
110
|
-
window
|
|
110
|
+
if (typeof window !== 'undefined') {
|
|
111
|
+
window.videojs = videojs
|
|
112
|
+
}
|
|
111
113
|
|
|
112
114
|
class VideoPlayer extends BaseComponent {
|
|
113
115
|
constructor(element, config) {
|
package/src/js/version.js
CHANGED