plugin updates
This commit is contained in:
@@ -0,0 +1,162 @@
|
||||
(function ( $ ) {
|
||||
// Pseudo contains case insensitive
|
||||
$.expr[":"].contains = $.expr.createPseudo(function(arg) {
|
||||
return function( elem ) {
|
||||
return $(elem).text().toLowerCase().indexOf(arg.toLowerCase()) >= 0;
|
||||
};
|
||||
});
|
||||
|
||||
$(document).ready(function ( $ ) {
|
||||
$('.ju-main-wrapper').show();
|
||||
|
||||
// Toggle left panel on small screen
|
||||
$('.ju-left-panel-toggle').unbind('click').click(function () {
|
||||
var leftPanel = $('.ju-left-panel');
|
||||
var wpLeftPanel = $('#adminmenuwrap');
|
||||
var rtl = $('body').hasClass('rtl');
|
||||
|
||||
if (leftPanel.is(':visible')) {
|
||||
if (wpLeftPanel.is(':visible')) {
|
||||
if (!rtl) {
|
||||
$(this).css('left', 35);
|
||||
} else {
|
||||
$(this).css('right', 35);
|
||||
}
|
||||
} else {
|
||||
if (!rtl) {
|
||||
$(this).css('left', 0);
|
||||
} else {
|
||||
$(this).css('right', 0);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (wpLeftPanel.is(':visible')) {
|
||||
if (!rtl) {
|
||||
$(this).css('left', 335);
|
||||
} else {
|
||||
$(this).css('right', 335);
|
||||
}
|
||||
} else {
|
||||
if (!rtl) {
|
||||
$(this).css('left', 290);
|
||||
} else {
|
||||
$(this).css('right', 290);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
leftPanel.toggle()
|
||||
});
|
||||
|
||||
// Function for searching menus
|
||||
$('.ju-menu-search-input').on('input', function () {
|
||||
$('.ju-right-panel .ju-settings-option').removeClass('search-result');
|
||||
$('.ju-menu-tabs .tab').show();
|
||||
|
||||
var searchKey = $(this).val().trim().toLowerCase();
|
||||
if (searchKey === '') {
|
||||
$('.ju-menu-tabs .tab').show();
|
||||
return false;
|
||||
}
|
||||
|
||||
var searchResult = $('.ju-right-panel .ju-settings-option label:contains("'+searchKey+'")').closest('.ju-settings-option');
|
||||
var searchParent = searchResult.closest('.ju-content-wrapper');
|
||||
var searchSub = searchResult.closest('.tab-content');
|
||||
var tabID = [], subID = [];
|
||||
|
||||
searchResult.addClass('search-result');
|
||||
searchParent.each(function () {
|
||||
tabID.push($(this).attr('id'));
|
||||
});
|
||||
|
||||
searchSub.each(function () {
|
||||
subID.push($(this).attr('id'));
|
||||
});
|
||||
|
||||
$('.ju-menu-tabs .tab .link-tab').each(function () {
|
||||
var href = $(this).attr('href');
|
||||
var text = $(this).text().trim().toLowerCase();
|
||||
var dataHref = $(this).data('href');
|
||||
|
||||
if (href !== undefined) {
|
||||
href = href.replace(/#/g, '');
|
||||
}
|
||||
|
||||
if (dataHref !== undefined) {
|
||||
dataHref = dataHref.replace(/#/, '');
|
||||
}
|
||||
|
||||
if (tabID.indexOf(href) < 0 && text.indexOf(searchKey) < 0 && subID.indexOf(dataHref) < 0) {
|
||||
$(this).closest('li.tab').hide();
|
||||
} else {
|
||||
if ($(this).closest('.ju-submenu-tabs').length > 0) {
|
||||
$(this).closest('.ju-submenu-tabs').closest('li.tab').show();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Add submenus
|
||||
$('.ju-top-tabs').each(function () {
|
||||
var topTab = $(this);
|
||||
var tabClone = $(this).clone();
|
||||
var parentHref = $(this).closest('.ju-content-wrapper').attr('id');
|
||||
tabClone.removeClass('ju-top-tabs').removeClass('tabs').addClass('ju-submenu-tabs');
|
||||
|
||||
tabClone.find('li.tab').each(function () {
|
||||
var currentSubMenu = $(this).closest('.ju-submenu-tabs');
|
||||
var currentTab = $(this).find('a.link-tab').removeClass('waves-effect');
|
||||
var tabClass = currentTab.attr('class');
|
||||
var tabHref = currentTab.attr('href');
|
||||
|
||||
$(this).html('<div class="'+ tabClass +'" data-href="'+ tabHref +'">'+ $(this).text() +'</div>');
|
||||
|
||||
$(this).find('div.link-tab').click(function () {
|
||||
topTab.find('li.tab a[href="'+ tabHref +'"]').click();
|
||||
currentSubMenu.find('li.tab div.link-tab').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
})
|
||||
});
|
||||
|
||||
$('.ju-menu-tabs .tab a.link-tab[href="#'+ parentHref +'"]').closest('.tab').append(tabClone);
|
||||
});
|
||||
|
||||
// Top tab click also navigate submenu tabs
|
||||
$('.ju-top-tabs li.tab').click(function () {
|
||||
var parentHref = $(this).closest('.ju-content-wrapper').attr('id');
|
||||
var tabHref = $(this).find('a.link-tab').attr('href');
|
||||
var subMenu = $('.ju-menu-tabs .tab a.link-tab[href="#'+ parentHref +'"]').closest('li.tab').find('.ju-submenu-tabs');
|
||||
|
||||
subMenu.find('div.link-tab').removeClass('active');
|
||||
subMenu.find('div.link-tab[data-href="'+ tabHref +'"]').addClass('active');
|
||||
});
|
||||
|
||||
// Collapsed the menu when clicking if it opened
|
||||
$('.ju-menu-tabs li.tab a.link-tab').click(function () {
|
||||
if (!$(this).hasClass('active')) {
|
||||
$(this).closest('.ju-menu-tabs').find('li.tab a.link-tab').removeClass('expanded');
|
||||
}
|
||||
|
||||
if ($(this).closest('li.tab').find('.ju-submenu-tabs').length > 0) {
|
||||
$(this).toggleClass('expanded');
|
||||
}
|
||||
});
|
||||
|
||||
// Not show expand icon if this tab has no sub menus
|
||||
$('.ju-menu-tabs li.tab').each(function () {
|
||||
if ($(this).find('.ju-submenu-tabs').length < 1) {
|
||||
$(this).find('a.link-tab').addClass('no-submenus');
|
||||
} else {
|
||||
var linkTab = $(this).find('a.link-tab');
|
||||
if (linkTab.hasClass('active')) {
|
||||
linkTab.addClass('expanded');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Close notice message
|
||||
$('.ju-notice-close').click(function () {
|
||||
$(this).closest('.ju-notice-msg').slideUp();
|
||||
});
|
||||
})
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,159 @@
|
||||
(function ($) {
|
||||
|
||||
var methods = {
|
||||
init: function () {
|
||||
return this.each(function () {
|
||||
|
||||
// For each set of tabs, we want to keep track of
|
||||
// which tab is active and its associated content
|
||||
var $this = $(this),
|
||||
window_width = $(window).width();
|
||||
|
||||
$this.width('100%');
|
||||
var $active, $content, $links = $this.find('li.tab a'),
|
||||
$tabs_width = $this.width(),
|
||||
$tab_width = $this.find('li').first().outerWidth(),
|
||||
$index = 0;
|
||||
|
||||
// If the location.hash matches one of the links, use that as the active tab.
|
||||
$active = $($links.filter('[href="' + location.hash + '"]'));
|
||||
|
||||
// If no match is found, use the first link or any with class 'active' as the initial active tab.
|
||||
if ($active.length === 0) {
|
||||
$active = $(this).find('li.tab a.active').first();
|
||||
}
|
||||
if ($active.length === 0) {
|
||||
$active = $(this).find('li.tab a').first();
|
||||
}
|
||||
|
||||
$active.addClass('active');
|
||||
$index = $links.index($active);
|
||||
if ($index < 0) {
|
||||
$index = 0;
|
||||
}
|
||||
|
||||
$content = $($active[0].hash);
|
||||
$($content).show();
|
||||
|
||||
// append indicator then set indicator width to tab width
|
||||
$this.append('<div class="indicator"></div>');
|
||||
var $indicator = $this.find('.indicator');
|
||||
if ($this.is(":visible")) {
|
||||
$indicator.css({"right": $tabs_width - (($index + 1) * $tab_width)});
|
||||
$indicator.css({"left": $index * $tab_width});
|
||||
}
|
||||
$(window).resize(function () {
|
||||
$tabs_width = $this.width();
|
||||
$tab_width = $this.find('li').first().outerWidth();
|
||||
if ($index < 0) {
|
||||
$index = 0;
|
||||
}
|
||||
if ($tab_width !== 0 && $tabs_width !== 0) {
|
||||
$indicator.css({"right": $tabs_width - (($index + 1) * $tab_width)});
|
||||
$indicator.css({"left": $index * $tab_width});
|
||||
}
|
||||
});
|
||||
|
||||
// Hide the remaining content
|
||||
$links.not($active).each(function () {
|
||||
$(this.hash).hide();
|
||||
});
|
||||
|
||||
|
||||
// Bind the click event handler
|
||||
$this.on('click', 'a', function (e) {
|
||||
if ($(this).parent().hasClass('disabled')) {
|
||||
e.preventDefault();
|
||||
return;
|
||||
}
|
||||
|
||||
$tabs_width = $this.width();
|
||||
$tab_width = $this.find('li').first().outerWidth();
|
||||
|
||||
// Make the old tab inactive.
|
||||
$active.removeClass('active');
|
||||
$content.hide();
|
||||
|
||||
// Update the variables with the new link and content
|
||||
$active = $(this);
|
||||
$content = $(this.hash);
|
||||
$links = $this.find('li.tab a');
|
||||
|
||||
// Make the tab active.
|
||||
$active.addClass('active');
|
||||
var $prev_index = $index;
|
||||
$index = $links.index($(this));
|
||||
if ($index < 0) {
|
||||
$index = 0;
|
||||
}
|
||||
// Change url to current tab
|
||||
window.location.hash = $active.attr('href');
|
||||
|
||||
$content.show();
|
||||
// Update indicator
|
||||
if (($index - $prev_index) >= 0) {
|
||||
$indicator.velocity({"right": $tabs_width - (($index + 1) * $tab_width)}, {
|
||||
duration: 300,
|
||||
queue: false,
|
||||
easing: 'easeOutQuad'
|
||||
});
|
||||
$indicator.velocity({"left": $index * $tab_width}, {
|
||||
duration: 300,
|
||||
queue: false,
|
||||
easing: 'easeOutQuad',
|
||||
delay: 90
|
||||
});
|
||||
}
|
||||
else {
|
||||
$indicator.velocity({"left": $index * $tab_width}, {
|
||||
duration: 300,
|
||||
queue: false,
|
||||
easing: 'easeOutQuad'
|
||||
});
|
||||
$indicator.velocity({"right": $tabs_width - (($index + 1) * $tab_width)}, {
|
||||
duration: 300,
|
||||
queue: false,
|
||||
easing: 'easeOutQuad',
|
||||
delay: 90
|
||||
});
|
||||
}
|
||||
|
||||
// Prevent the anchor's default click action
|
||||
e.preventDefault();
|
||||
});
|
||||
});
|
||||
|
||||
},
|
||||
select_tab: function (id) {
|
||||
this.find('a[href="#' + id + '"]').trigger('click');
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.itabs = function (methodOrOptions) {
|
||||
if (methods[methodOrOptions]) {
|
||||
return methods[methodOrOptions].apply(this, Array.prototype.slice.call(arguments, 1));
|
||||
} else if (typeof methodOrOptions === 'object' || !methodOrOptions) {
|
||||
// Default to "init"
|
||||
var h = window.location.hash;
|
||||
if (h !== '') {
|
||||
if ($(h).hasClass('tab-content')) {
|
||||
var hs = $(h).closest('.ju-content-wrapper').attr('id');
|
||||
if (typeof hs !== "undefined") {
|
||||
$('.ju-content-wrapper').hide();
|
||||
$('.ju-menu-tabs .link-tab').removeClass('expanded active');
|
||||
$('.ju-menu-tabs .link-tab[data-href="' + h + '"]').click();
|
||||
$('.ju-menu-tabs .link-tab[href="#' + hs + '"]').addClass('expanded active');
|
||||
$('#' + hs).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
return methods.init.apply(this, arguments);
|
||||
} else {
|
||||
$.error('Method ' + methodOrOptions + ' does not exist on jQuery.tooltip');
|
||||
}
|
||||
};
|
||||
|
||||
$(document).ready(function () {
|
||||
$('ul.tabs').itabs();
|
||||
});
|
||||
}(jQuery));
|
||||
5
wp/wp-content/plugins/wp-media-folder/assets/wordpress-css-framework/js/velocity.min.js
vendored
Normal file
5
wp/wp-content/plugins/wp-media-folder/assets/wordpress-css-framework/js/velocity.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -0,0 +1,343 @@
|
||||
/*!
|
||||
* Waves v0.6.4
|
||||
* http://fian.my.id/Waves
|
||||
*
|
||||
* Copyright 2014 Alfiana E. Sibuea and other contributors
|
||||
* Released under the MIT license
|
||||
* https://github.com/fians/Waves/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
;(function(window) {
|
||||
'use strict';
|
||||
|
||||
var Waves = Waves || {};
|
||||
var $$ = document.querySelectorAll.bind(document);
|
||||
|
||||
// Find exact position of element
|
||||
function isWindow(obj) {
|
||||
return obj !== null && obj === obj.window;
|
||||
}
|
||||
|
||||
function getWindow(elem) {
|
||||
return isWindow(elem) ? elem : elem.nodeType === 9 && elem.defaultView;
|
||||
}
|
||||
|
||||
function offset(elem) {
|
||||
var docElem, win,
|
||||
box = {top: 0, left: 0},
|
||||
doc = elem && elem.ownerDocument;
|
||||
|
||||
docElem = doc.documentElement;
|
||||
|
||||
if (typeof elem.getBoundingClientRect !== typeof undefined) {
|
||||
box = elem.getBoundingClientRect();
|
||||
}
|
||||
win = getWindow(doc);
|
||||
return {
|
||||
top: box.top + win.pageYOffset - docElem.clientTop,
|
||||
left: box.left + win.pageXOffset - docElem.clientLeft
|
||||
};
|
||||
}
|
||||
|
||||
function convertStyle(obj) {
|
||||
var style = '';
|
||||
|
||||
for (var a in obj) {
|
||||
if (obj.hasOwnProperty(a)) {
|
||||
style += (a + ':' + obj[a] + ';');
|
||||
}
|
||||
}
|
||||
|
||||
return style;
|
||||
}
|
||||
|
||||
var Effect = {
|
||||
|
||||
// Effect delay
|
||||
duration: 750,
|
||||
|
||||
show: function(e, element) {
|
||||
|
||||
// Disable right click
|
||||
if (e.button === 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var el = element || this;
|
||||
|
||||
// Create ripple
|
||||
var ripple = document.createElement('div');
|
||||
ripple.className = 'waves-ripple';
|
||||
el.appendChild(ripple);
|
||||
|
||||
// Get click coordinate and element witdh
|
||||
var pos = offset(el);
|
||||
var relativeY = (e.pageY - pos.top);
|
||||
var relativeX = (e.pageX - pos.left);
|
||||
var scale = 'scale('+((el.clientWidth / 100) * 10)+')';
|
||||
|
||||
// Support for touch devices
|
||||
if ('touches' in e) {
|
||||
relativeY = (e.touches[0].pageY - pos.top);
|
||||
relativeX = (e.touches[0].pageX - pos.left);
|
||||
}
|
||||
|
||||
// Attach data to element
|
||||
ripple.setAttribute('data-hold', Date.now());
|
||||
ripple.setAttribute('data-scale', scale);
|
||||
ripple.setAttribute('data-x', relativeX);
|
||||
ripple.setAttribute('data-y', relativeY);
|
||||
|
||||
// Set ripple position
|
||||
var rippleStyle = {
|
||||
'top': relativeY+'px',
|
||||
'left': relativeX+'px'
|
||||
};
|
||||
|
||||
ripple.className = ripple.className + ' waves-notransition';
|
||||
ripple.setAttribute('style', convertStyle(rippleStyle));
|
||||
ripple.className = ripple.className.replace('waves-notransition', '');
|
||||
|
||||
// Scale the ripple
|
||||
rippleStyle['-webkit-transform'] = scale;
|
||||
rippleStyle['-moz-transform'] = scale;
|
||||
rippleStyle['-ms-transform'] = scale;
|
||||
rippleStyle['-o-transform'] = scale;
|
||||
rippleStyle.transform = scale;
|
||||
rippleStyle.opacity = '1';
|
||||
|
||||
rippleStyle['-webkit-transition-duration'] = Effect.duration + 'ms';
|
||||
rippleStyle['-moz-transition-duration'] = Effect.duration + 'ms';
|
||||
rippleStyle['-o-transition-duration'] = Effect.duration + 'ms';
|
||||
rippleStyle['transition-duration'] = Effect.duration + 'ms';
|
||||
|
||||
rippleStyle['-webkit-transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
|
||||
rippleStyle['-moz-transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
|
||||
rippleStyle['-o-transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
|
||||
rippleStyle['transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
|
||||
|
||||
ripple.setAttribute('style', convertStyle(rippleStyle));
|
||||
},
|
||||
|
||||
hide: function(e) {
|
||||
TouchHandler.touchup(e);
|
||||
|
||||
var el = this;
|
||||
var width = el.clientWidth * 1.4;
|
||||
|
||||
// Get first ripple
|
||||
var ripple = null;
|
||||
var ripples = el.getElementsByClassName('waves-ripple');
|
||||
if (ripples.length > 0) {
|
||||
ripple = ripples[ripples.length - 1];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
var relativeX = ripple.getAttribute('data-x');
|
||||
var relativeY = ripple.getAttribute('data-y');
|
||||
var scale = ripple.getAttribute('data-scale');
|
||||
|
||||
// Get delay beetween mousedown and mouse leave
|
||||
var diff = Date.now() - Number(ripple.getAttribute('data-hold'));
|
||||
var delay = 350 - diff;
|
||||
|
||||
if (delay < 0) {
|
||||
delay = 0;
|
||||
}
|
||||
|
||||
// Fade out ripple after delay
|
||||
setTimeout(function() {
|
||||
var style = {
|
||||
'top': relativeY+'px',
|
||||
'left': relativeX+'px',
|
||||
'opacity': '0',
|
||||
|
||||
// Duration
|
||||
'-webkit-transition-duration': Effect.duration + 'ms',
|
||||
'-moz-transition-duration': Effect.duration + 'ms',
|
||||
'-o-transition-duration': Effect.duration + 'ms',
|
||||
'transition-duration': Effect.duration + 'ms',
|
||||
'-webkit-transform': scale,
|
||||
'-moz-transform': scale,
|
||||
'-ms-transform': scale,
|
||||
'-o-transform': scale,
|
||||
'transform': scale,
|
||||
};
|
||||
|
||||
ripple.setAttribute('style', convertStyle(style));
|
||||
|
||||
setTimeout(function() {
|
||||
try {
|
||||
el.removeChild(ripple);
|
||||
} catch(e) {
|
||||
return false;
|
||||
}
|
||||
}, Effect.duration);
|
||||
}, delay);
|
||||
},
|
||||
|
||||
// Little hack to make <input> can perform waves effect
|
||||
wrapInput: function(elements) {
|
||||
for (var a = 0; a < elements.length; a++) {
|
||||
var el = elements[a];
|
||||
|
||||
if (el.tagName.toLowerCase() === 'input') {
|
||||
var parent = el.parentNode;
|
||||
|
||||
// If input already have parent just pass through
|
||||
if (parent.tagName.toLowerCase() === 'i' && parent.className.indexOf('waves-effect') !== -1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Put element class and style to the specified parent
|
||||
var wrapper = document.createElement('i');
|
||||
wrapper.className = el.className + ' waves-input-wrapper';
|
||||
|
||||
var elementStyle = el.getAttribute('style');
|
||||
|
||||
if (!elementStyle) {
|
||||
elementStyle = '';
|
||||
}
|
||||
|
||||
wrapper.setAttribute('style', elementStyle);
|
||||
|
||||
el.className = 'waves-button-input';
|
||||
el.removeAttribute('style');
|
||||
|
||||
// Put element as child
|
||||
parent.replaceChild(wrapper, el);
|
||||
wrapper.appendChild(el);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Disable mousedown event for 500ms during and after touch
|
||||
*/
|
||||
var TouchHandler = {
|
||||
/* uses an integer rather than bool so there's no issues with
|
||||
* needing to clear timeouts if another touch event occurred
|
||||
* within the 500ms. Cannot mouseup between touchstart and
|
||||
* touchend, nor in the 500ms after touchend. */
|
||||
touches: 0,
|
||||
allowEvent: function(e) {
|
||||
var allow = true;
|
||||
|
||||
if (e.type === 'touchstart') {
|
||||
TouchHandler.touches += 1; //push
|
||||
} else if (e.type === 'touchend' || e.type === 'touchcancel') {
|
||||
setTimeout(function() {
|
||||
if (TouchHandler.touches > 0) {
|
||||
TouchHandler.touches -= 1; //pop after 500ms
|
||||
}
|
||||
}, 500);
|
||||
} else if (e.type === 'mousedown' && TouchHandler.touches > 0) {
|
||||
allow = false;
|
||||
}
|
||||
|
||||
return allow;
|
||||
},
|
||||
touchup: function(e) {
|
||||
TouchHandler.allowEvent(e);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Delegated click handler for .waves-effect element.
|
||||
* returns null when .waves-effect element not in "click tree"
|
||||
*/
|
||||
function getWavesEffectElement(e) {
|
||||
if (TouchHandler.allowEvent(e) === false) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var element = null;
|
||||
var target = e.target || e.srcElement;
|
||||
|
||||
while (target.parentElement !== null) {
|
||||
if (!(target instanceof SVGElement) && target.className.indexOf('waves-effect') !== -1) {
|
||||
element = target;
|
||||
break;
|
||||
} else if (target.classList.contains('waves-effect')) {
|
||||
element = target;
|
||||
break;
|
||||
}
|
||||
target = target.parentElement;
|
||||
}
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bubble the click and show effect if .waves-effect elem was found
|
||||
*/
|
||||
function showEffect(e) {
|
||||
var element = getWavesEffectElement(e);
|
||||
|
||||
if (element !== null) {
|
||||
setTimeout(function () {
|
||||
Effect.show(e, element);
|
||||
},100);
|
||||
|
||||
|
||||
if ('ontouchstart' in window) {
|
||||
element.addEventListener('touchend', Effect.hide, false);
|
||||
element.addEventListener('touchcancel', Effect.hide, false);
|
||||
}
|
||||
|
||||
element.addEventListener('mouseup', Effect.hide, false);
|
||||
element.addEventListener('mouseleave', Effect.hide, false);
|
||||
}
|
||||
}
|
||||
|
||||
Waves.displayEffect = function(options) {
|
||||
options = options || {};
|
||||
|
||||
if ('duration' in options) {
|
||||
Effect.duration = options.duration;
|
||||
}
|
||||
|
||||
//Wrap input inside <i> tag
|
||||
Effect.wrapInput($$('.waves-effect'));
|
||||
|
||||
if ('ontouchstart' in window) {
|
||||
document.body.addEventListener('touchstart', showEffect, false);
|
||||
}
|
||||
|
||||
document.body.addEventListener('mousedown', showEffect, false);
|
||||
};
|
||||
|
||||
/**
|
||||
* Attach Waves to an input element (or any element which doesn't
|
||||
* bubble mouseup/mousedown events).
|
||||
* Intended to be used with dynamically loaded forms/inputs, or
|
||||
* where the user doesn't want a delegated click handler.
|
||||
*/
|
||||
Waves.attach = function(element) {
|
||||
//FUTURE: automatically add waves classes and allow users
|
||||
// to specify them with an options param? Eg. light/classic/button
|
||||
if (element.tagName.toLowerCase() === 'input') {
|
||||
Effect.wrapInput([element]);
|
||||
element = element.parentElement;
|
||||
}
|
||||
|
||||
if ('ontouchstart' in window) {
|
||||
element.addEventListener('touchstart', showEffect, false);
|
||||
}
|
||||
|
||||
element.addEventListener('mousedown', showEffect, false);
|
||||
};
|
||||
|
||||
if (typeof window.Waves === "undefined") {
|
||||
window.Waves = Waves;
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
Waves.displayEffect();
|
||||
}, false);
|
||||
}
|
||||
|
||||
})(window);
|
||||
Reference in New Issue
Block a user