mdbootstrap
Advanced tools
Comparing version 4.5.12 to 4.5.13
@@ -1,42 +0,34 @@ | ||
'use strict'; | ||
"use strict"; | ||
var _this = void 0; | ||
(function ($) { | ||
let inputSelector = `${['text', 'password', 'email', 'url', 'tel', 'number', 'search', 'search-md'].map(function (selector) { | ||
return `input[type=${selector}]`; | ||
}).join(', ')}, textarea`; | ||
let textAreaSelector = '.materialize-textarea'; | ||
var inputSelector = ['text', 'password', 'email', 'url', 'tel', 'number', 'search', 'search-md'].map(function (selector) { | ||
return 'input[type=' + selector + ']'; | ||
}).join(', ') + ', textarea'; | ||
var textAreaSelector = '.materialize-textarea'; | ||
var updateTextFields = function updateTextFields($input) { | ||
var $labelAndIcon = $input.siblings('label, i'); | ||
var hasValue = $input.val().length; | ||
var hasPlaceholder = $input.attr('placeholder'); | ||
var addOrRemove = (hasValue || hasPlaceholder ? 'add' : 'remove') + 'Class'; | ||
let updateTextFields = function updateTextFields($input) { | ||
let $labelAndIcon = $input.siblings('label, i'); | ||
let hasValue = $input.val().length; | ||
let hasPlaceholder = $input.attr('placeholder'); | ||
let addOrRemove = `${hasValue || hasPlaceholder ? 'add' : 'remove'}Class`; | ||
$labelAndIcon[addOrRemove]('active'); | ||
}; | ||
var validateField = function validateField($input) { | ||
let validateField = function validateField($input) { | ||
if ($input.hasClass('validate')) { | ||
let value = $input.val(); | ||
let noValue = !value.length; | ||
let isValid = !$input[0].validity.badInput; | ||
var value = $input.val(); | ||
var noValue = !value.length; | ||
var isValid = !$input[0].validity.badInput; | ||
if (noValue && isValid) { | ||
$input.removeClass('valid').removeClass('invalid'); | ||
} else { | ||
let valid = $input.is(':valid'); | ||
let length = Number($input.attr('length')) || 0; | ||
var valid = $input.is(':valid'); | ||
var length = Number($input.attr('length')) || 0; | ||
if (valid && (!length || length > value.length)) { | ||
$input.removeClass('invalid').addClass('valid'); | ||
} else { | ||
$input.removeClass('valid').addClass('invalid'); | ||
@@ -48,13 +40,11 @@ } | ||
var textAreaAutoResize = function textAreaAutoResize() { | ||
let textAreaAutoResize = function textAreaAutoResize() { | ||
let $textarea = $(_this); | ||
var $textarea = $(undefined); | ||
if ($textarea.val().length) { | ||
let $hiddenDiv = $('.hiddendiv'); | ||
let fontFamily = $textarea.css('font-family'); | ||
let fontSize = $textarea.css('font-size'); | ||
var $hiddenDiv = $('.hiddendiv'); | ||
var fontFamily = $textarea.css('font-family'); | ||
var fontSize = $textarea.css('font-size'); | ||
if (fontSize) { | ||
$hiddenDiv.css('font-size', fontSize); | ||
@@ -64,3 +54,2 @@ } | ||
if (fontFamily) { | ||
$hiddenDiv.css('font-family', fontFamily); | ||
@@ -70,12 +59,10 @@ } | ||
if ($textarea.attr('wrap') === 'off') { | ||
$hiddenDiv.css('overflow-wrap', 'normal').css('white-space', 'pre'); | ||
} | ||
$hiddenDiv.text($textarea.val() + '\n'); | ||
var content = $hiddenDiv.html().replace(/\n/g, '<br>'); | ||
$hiddenDiv.html(content); | ||
$hiddenDiv.text(`${$textarea.val()}\n`); | ||
let content = $hiddenDiv.html().replace(/\n/g, '<br>'); | ||
$hiddenDiv.html(content); // When textarea is hidden, width goes crazy. | ||
// Approximate with half of window size | ||
// When textarea is hidden, width goes crazy. | ||
// Approximate with half of window size | ||
$hiddenDiv.css('width', $textarea.is(':visible') ? $textarea.width() : $(window).width() / 2); | ||
@@ -87,27 +74,21 @@ $textarea.css('height', $hiddenDiv.height()); | ||
$(inputSelector).each(function (index, input) { | ||
let $this = $(input); | ||
let $labelAndIcon = $this.siblings('label, i'); | ||
updateTextFields($this); | ||
let isValid = input.validity.badInput; | ||
var $this = $(input); | ||
var $labelAndIcon = $this.siblings('label, i'); | ||
updateTextFields($this); | ||
var isValid = input.validity.badInput; | ||
if (isValid) { | ||
$labelAndIcon.addClass('active'); | ||
} | ||
}); | ||
$(document).on('focus', inputSelector, function (e) { | ||
$(e.target).siblings('label, i').addClass('active'); | ||
}); | ||
$(document).on('blur', inputSelector, function (e) { | ||
let $this = $(e.target); | ||
let noValue = !$this.val(); | ||
let invalid = !e.target.validity.badInput; | ||
let noPlaceholder = $this.attr('placeholder') === undefined; | ||
var $this = $(e.target); | ||
var noValue = !$this.val(); | ||
var invalid = !e.target.validity.badInput; | ||
var noPlaceholder = $this.attr('placeholder') === undefined; | ||
if (noValue && invalid && noPlaceholder) { | ||
$this.siblings('label, i').removeClass('active'); | ||
@@ -118,23 +99,18 @@ } | ||
}); | ||
$(document).on('change', inputSelector, function (e) { | ||
var $this = $(e.target); | ||
let $this = $(e.target); | ||
updateTextFields($this); | ||
validateField($this); | ||
}); | ||
$('input[autofocus]').siblings('label, i').addClass('active'); | ||
$(document).on('reset', function (e) { | ||
let $formReset = $(e.target); | ||
var $formReset = $(e.target); | ||
if ($formReset.is('form')) { | ||
var $formInputs = $formReset.find(inputSelector); | ||
let $formInputs = $formReset.find(inputSelector); | ||
$formInputs.removeClass('valid').removeClass('invalid').each(function (index, input) { | ||
let $this = $(input); | ||
let noDefaultValue = !$this.val(); | ||
let noPlaceholder = !$this.attr('placeholder'); | ||
var $this = $(input); | ||
var noDefaultValue = !$this.val(); | ||
var noPlaceholder = !$this.attr('placeholder'); | ||
if (noDefaultValue && noPlaceholder) { | ||
@@ -144,9 +120,6 @@ $this.siblings('label, i').removeClass('active'); | ||
}); | ||
$formReset.find('select.initialized').each(function (index, select) { | ||
var $select = $(select); | ||
var $visibleInput = $select.siblings('input.select-dropdown'); | ||
var defaultValue = $select.children('[selected]').val(); | ||
let $select = $(select); | ||
let $visibleInput = $select.siblings('input.select-dropdown'); | ||
let defaultValue = $select.children('[selected]').val(); | ||
$select.val(defaultValue); | ||
@@ -159,17 +132,13 @@ $visibleInput.val(defaultValue); | ||
function init() { | ||
let $text = $('.md-textarea-auto'); | ||
var $text = $('.md-textarea-auto'); | ||
if ($text.length) { | ||
let observe; | ||
var observe = void 0; | ||
if (window.attachEvent) { | ||
observe = function observe(element, event, handler) { | ||
element.attachEvent('on' + event, handler); | ||
element.attachEvent(`on${event}`, handler); | ||
}; | ||
} else { | ||
observe = function observe(element, event, handler) { | ||
element.addEventListener(event, handler, false); | ||
@@ -180,13 +149,10 @@ }; | ||
$text.each(function () { | ||
let self = this; | ||
var self = this; | ||
function resize() { | ||
self.style.height = 'auto'; | ||
self.style.height = self.scrollHeight + 'px'; | ||
self.style.height = `${self.scrollHeight}px`; | ||
} | ||
function delayedResize() { | ||
window.setTimeout(resize, 0); | ||
@@ -200,3 +166,2 @@ } | ||
observe(self, 'keydown', delayedResize); | ||
resize(); | ||
@@ -206,8 +171,8 @@ }); | ||
} | ||
init(); | ||
let $body = $('body'); | ||
var $body = $('body'); | ||
if (!$('.hiddendiv').first().length) { | ||
var $hiddenDiv = $('<div class="hiddendiv common"></div>'); | ||
let $hiddenDiv = $('<div class="hiddendiv common"></div>'); | ||
$body.append($hiddenDiv); | ||
@@ -214,0 +179,0 @@ } |
@@ -1,17 +0,12 @@ | ||
'use strict'; | ||
"use strict"; | ||
(function ($) { | ||
var SCROLLING_NAVBAR_OFFSET_TOP = 50; | ||
let SCROLLING_NAVBAR_OFFSET_TOP = 50; | ||
$(window).on('scroll', function () { | ||
let $navbar = $('.navbar'); | ||
var $navbar = $('.navbar'); | ||
if ($navbar.length) { | ||
if ($navbar.offset().top > SCROLLING_NAVBAR_OFFSET_TOP) { | ||
$('.scrolling-navbar').addClass('top-nav-collapse'); | ||
} else { | ||
$('.scrolling-navbar').removeClass('top-nav-collapse'); | ||
@@ -18,0 +13,0 @@ } |
{ | ||
"name": "mdbootstrap", | ||
"version": "4.5.12", | ||
"version": "4.5.13", | ||
"description": "Material Design for Bootstrap (MDB) is a powerful Material Design UI KIT for most popular HTML, CSS, and JS framework - Bootstrap.", | ||
@@ -5,0 +5,0 @@ "main": "js/mdb.min.js", |
@@ -45,3 +45,3 @@ [![Material Design for Bootstrap](https://mdbootstrap.com/img/Marketing/free/social/jquery/mdb-jquery-free.jpg)](https://mdbootstrap.com/material-design-for-bootstrap/) | ||
**MDB - Bootstrap tutorial**: https://mdbootstrap.com/bootstrap-tutorial/ | ||
**MDB - Bootstrap tutorial**: https://mdbootstrap.com/education/bootstrap/ | ||
@@ -131,3 +131,3 @@ **MDB - Wordpress tutorial**: https://mdbootstrap.com/wordpress-tutorial/ | ||
Material Design + Bootstrap Tutorial: https://mdbootstrap.com/bootstrap-tutorial/ | ||
Material Design + Bootstrap Tutorial: https://mdbootstrap.com/education/bootstrap/ | ||
@@ -134,0 +134,0 @@ Material Design + WordPress Tutorial: https://mdbootstrap.com/wordpress-tutorial/ |
Material Design for Bootstrap | ||
version: MDB Free 4.5.12 | ||
version: MDB Free 4.5.13 | ||
@@ -12,3 +12,3 @@ Documentation: | ||
Tutorials: | ||
MDB-Bootstrap: https://mdbootstrap.com/bootstrap-tutorial/ | ||
MDB-Bootstrap: https://mdbootstrap.com/education/bootstrap/ | ||
MDB-Wordpress: https://mdbootstrap.com/wordpress-tutorial/ | ||
@@ -15,0 +15,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4877632
109
66826
18