// SYSTEM PANEL //
[ROOT]
/
home
/
salvufkx
/
public_html
/
wp-contentmmm
/
themes
/
vega
/
js
[ PARENT ]
EDIT :: custom_plugins.js
(function($) { "use strict"; $.fn.imagefit = function(options) { var fit = { all : function(imgs){ imgs.each(function(){ fit.one(this); }) }, one : function(img){ $(img) .width('100%').each(function() { $(this).height(Math.round( $(this).attr('startheight')*($(this).width()/$(this).attr('startwidth'))) ); }) } }; this.each(function(){ var container = this; // store list of contained images (excluding those in tables) var imgs = $('img', container).not($("table img")); // store initial dimensions on each image imgs.each(function(){ $(this).attr('startwidth', $(this).width()) .attr('startheight', $(this).height()) .css('max-width', $(this).attr('startwidth')+"px"); fit.one(this); }); // Re-adjust when window width is changed $(window).bind('resize', function(){ fit.all(imgs); }); }); return this; }; })(jQuery); (function($) { "use strict"; $.fn.placeholder = function() { if(typeof document.createElement("input").placeholder == 'undefined') { $('[placeholder]').focus(function() { var input = $(this); if (input.val() == input.attr('placeholder')) { input.val(''); input.removeClass('placeholder'); } }).blur(function() { var input = $(this); if (input.val() == '' || input.val() == input.attr('placeholder')) { input.addClass('placeholder'); input.val(input.attr('placeholder')); } }).blur().parents('form').submit(function() { $(this).find('[placeholder]').each(function() { var input = $(this); if (input.val() == input.attr('placeholder')) { input.val(''); } }) }); } } })(jQuery); jQuery.fn.getIndex = function(){ "use strict"; var jQueryp=jQuery(this).parent().children(); return jQueryp.index(this); } jQuery.fn.extend({ slideRight: function() { return this.each(function() { jQuery(this).show(); }); }, slideLeft: function() { return this.each(function() { jQuery(this).hide(); }); }, slideToggleWidth: function() { return this.each(function() { var el = jQuery(this); if (el.css('display') == 'none') { el.slideRight(); } else { el.slideLeft(); } }); } }); jQuery.fn.animateAuto = function(prop, speed, callback){ var elem, height, width; return this.each(function(i, el){ el = jQuery(el), elem = el.clone().css({"height":"auto"}).appendTo("body"); if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) { height = elem.height(); height = elem.css("auto"), width = elem.css("width"); } else { height = elem.height(); height = height, width = elem.css("width"); } elem.remove(); if(prop === "height") el.animate({"height":height}, speed, callback); else if(prop === "width") el.animate({"width":width}, speed, callback); else if(prop === "both") el.animate({"width":width,"height":height}, speed, callback); }); } jQuery.fn.verticalAlign = function (){ "use strict"; var verticalMarginTop = (jQuery(this).parent().height() - jQuery(this).height())/2; return this.css("margin-top",verticalMarginTop + 'px' ); }; jQuery.fn.verticalAlignMenu = function (){ "use strict"; var verticalMarginTop = jQuery(this).parent().height(); if(verticalMarginTop > 0) { if(jQuery('#pp_menu_layout').val()==1 || jQuery('#pp_menu_layout').val()=='') { this.css("margin-top",-verticalMarginTop + 'px' ); } else if(jQuery('#pp_menu_layout').val()==2) { this.css("margin-top", '0px' ); } this.addClass('visible'); } }; function is_touch_device() { return 'ontouchstart' in window // works on most browsers || 'onmsgesturechange' in window; // works on ie10 };
SAVE
CANCEL