');
}
// total counter right or after
if (drawSettings['counter'] && drawSettings['total_counter_pos'] != 'hidden') {
if (drawSettings['total_counter_pos'] == 'right') {
output.push('
Total:1.2K
');
}
if (drawSettings['total_counter_pos'] == 'rightbig') {
output.push('
1.2KSHARES
');
}
if (drawSettings['total_counter_pos'] == 'rightbigicon') {
output.push('
1.2KSHARES
');
}
if (drawSettings['total_counter_pos'] == 'after') {
output.push('
1.2K Shares
');
}
}
output.push('
');
output.push('
');
if ($('#'+id).length)
$('#'+id).html(output.join(''));
},
generateButtonCounterCode: function(position) {
var min = 80, max = 600;
var counterValue = Math.floor(Math.random() * (max - min + 1)) + min;
return ''+counterValue+'';
}
}
essbPreviewButtons.init();
// Example popup call
//var popup = new essbAdminPopup();
//popup.show('#essb-testpopup', true);
/*var popup = new essbAdminPopup();
popup.init('#essb-templateselect', '', {'noCommandButtons': true});
popup.show();
*/
//essbSettingsHelper.chooseSocialNetworks({'facebook':'true', 'twitter':'true', 'whatsapp': 'true'});
// popup.init('#essb-networkselect', essbSettingsHelper.generateNetworkSelection(activeNetworks), { 'noCommandButtons': true});
// Assign specific events
$('.essb-popup-select').each(function(){
$(this).click(function(e) {
e.preventDefault();
var updateValueID = 'essb_field_' + $(this).attr('data-field') || '',
updateTextID = $(this).attr('data-field-text') || '',
callbackWindow = $(this).attr('data-field-window') || '',
userSelectedValue = $('#' + updateValueID).val();
var popup = new essbAdminPopup();
popup.init(callbackWindow, '', {'noCommandButtons': true});
popup.show();
if ($(callbackWindow).find('.essb-component-clickholder').length) {
$(callbackWindow).find('.essb-component-clickholder').attr('data-field', updateValueID);
$(callbackWindow).find('.essb-component-clickholder').attr('data-field-text', updateTextID);
$(callbackWindow).find('.essb-component-clickselect').each(function() {
if ($(this).hasClass('active'))
$(this).removeClass('active');
var currentElementValue = $(this).attr('data-value') || '';
if (currentElementValue == userSelectedValue)
$(this).addClass('active');
});
}
});
})
if ($('#essb-button-confirm-select').length) {
$('#essb-button-confirm-select').click(function(e){
e.preventDefault();
var selected = essbSettingsHelper.getSelectedSocialNetworks();
var classHolderId = $(this).attr('data-close') || '';
if (classHolderId != '' && essbAdminPopupHolder[classHolderId])
essbAdminPopupHolder[classHolderId].close();
var redrawKey = $(this).attr('data-redraw') || '';
var namesCache = essbSettingsHelper.getCache('cache-'+redrawKey);
if (!namesCache || typeof(namesCache) == 'undefined') namesCache = {};
var positionKey = '';
if ($('.essb-componentkey-'+redrawKey).length)
positionKey = $('.essb-componentkey-'+redrawKey).attr('data-position') || '';
var output = [];
for (var i=0;i < selected.length;i++) {
var network = selected[i],
networkDetails = essbAdminSettings.networks[network] || {},
name = networkDetails['name'] || '',
cachedName = typeof(namesCache[network]) != 'undefined' ? namesCache[network] : positionKey != '' ? '' : name;
output.push( '
');
if (positionKey != '')
output.push( '');
else
output.push( '');
output.push( '');
output.push( '');
output.push( ''+name+'');
output.push( '');
if (positionKey != '')
output.push( 'Personalize text on button:'+' ');
else
output.push( 'Personalize text on button:'+' ');
output.push( '');
output.push( '
');
}
network = 'add';
output.push( '
');
output.push( '');
output.push( 'Add more networks');
output.push( '
');
if ($('.essb-componentkey-'+redrawKey).length) {
$('.essb-componentkey-'+redrawKey).html(output.join(''));
if ($('.essb-componentkey-'+redrawKey).hasClass('essb-sortable')) {
var element = $('.essb-componentkey-'+redrawKey).attr("id");
jQuery('#'+element).sortable2();
}
}
});
}
$('.essb-component-clickselect').each(function(){
$(this).click(function(e){
e.preventDefault();
$(this).parent().find('.essb-component-clickselect').each(function(){
if ($(this).hasClass('active'))
$(this).removeClass('active');
});
$(this).addClass('active');
var selectedValue = $(this).attr('data-value') || '',
selectedText = $(this).attr('data-text') || '',
valueId = $(this).parent().attr('data-field') || '',
valueTextId = $(this).parent().attr('data-field-text') || '';
var classHolderId = '#' + $(this).parent().parent().parent().attr('id') || '';
if (classHolderId != '' && essbAdminPopupHolder[classHolderId])
essbAdminPopupHolder[classHolderId].close();
if ($('#'+valueId).length) {
$('#'+valueId).val(selectedValue);
$('#'+valueId).trigger('change');
}
if ($('#'+valueTextId).length)
$('#'+valueTextId).html(selectedText);
});
});
$('.essb-component-toggleselect .toggleselect-item').each(function() {
$(this).click(function(e) {
e.preventDefault();
$(this).parent().find('.toggleselect-item').each(function(){
if ($(this).hasClass('active'))
$(this).removeClass('active');
});
$(this).addClass('active');
var selectedValue = $(this).attr('data-value') || '';
$(this).parent().find('.toggleselect-holder').val(selectedValue);
$(this).parent().find('.toggleselect-holder').trigger('change');
});
});
$('.essb-component-groupselect .toggleselect-item').each(function() {
$(this).click(function(e) {
e.preventDefault();
if ($(this).hasClass('active')) {
$(this).removeClass('active');
$(this).find('.toggleselect-holder').attr('checked', false);
$(this).find('.toggleselect-holder').trigger('change');
}
else {
$(this).addClass('active');
$(this).find('.toggleselect-holder').attr('checked', true);
$(this).find('.toggleselect-holder').trigger('change');
}
});
});
$('.essb-component-toggleselect .toggleselect-holder').each(function(){
var id = $(this).attr('id') || '';
if (id.indexOf('_button_width') > -1) {
$(this).change(function(e){
var value = $(this).val(),
id = $(this).attr('id') || '';
id = id.replace('essb_options_', '');
var idParts = id.split('_'), location = idParts[0];
$('#'+location+'-essb-fixed-width').hide();
$('#'+location+'-essb-full-width').hide();
$('#'+location+'-essb-column-width').hide();
if (value == 'fixed')
$('#'+location+'-essb-fixed-width').show();
if (value == 'full')
$('#'+location+'-essb-full-width').show();
if (value == 'column')
$('#'+location+'-essb-column-width').show();
});
$(this).trigger('change');
}
});
$('.essb-single-position-select .essb-single').each(function(){
$(this).click(function(e) {
e.preventDefault();
$(this).parent().find('.essb-single').each(function(){
if ($(this).hasClass('active'))
$(this).removeClass('active');
});
$(this).addClass('active');
var selectedValue = $(this).attr('data-value') || '';
$(this).parent().find('.value-holder').val(selectedValue);
$(this).parent().find('.value-holder').trigger('change');
});
});
$('.essb-multi-position-select .essb-single').each(function(){
$(this).click(function(e) {
e.preventDefault();
var state = false;
if ($(this).hasClass('active')) {
$(this).removeClass('active');
state = false;
}
else {
$(this).addClass('active');
state = true;
}
var selectedValue = $(this).attr('data-value') || '';
$(this).find('.value-holder').attr('checked', state);
$(this).find('.value-holder').trigger('change');
});
});
$('.essb-position-select .essb-single .customize').each(function() {
$(this).click(function(e) {
e.preventDefault();
e.stopPropagation();
var menuElement = $(this).attr('data-menu') || '',
subMenuElement = $(this).attr('data-sub-menu') || '';
if (menuElement != '' && $('#'+menuElement).length)
$('#'+menuElement).trigger('click');
if (subMenuElement != '' && $('#'+subMenuElement).length)
$('#'+subMenuElement).trigger('click');
});
});
$('#essb_options_button_width').change(function(e){
var value = $(this).val();
$('#essb-fixed-width').hide();
$('#essb-full-width').hide();
$('#essb-column-width').hide();
if (value == 'fixed')
$('#essb-fixed-width').show();
if (value == 'full')
$('#essb-full-width').show();
if (value == 'column')
$('#essb-column-width').show();
});
$('#essb_options_shorturl_type').change(function(e){
var value = $(this).val();
$('#essb-short-bitly').hide();
$('#essb-short-googl').hide();
$('#essb-short-rebrandly').hide();
$('#essb-short-post').hide();
if (value == 'goo.gl')
$('#essb-short-googl').show();
if (value == 'bit.ly')
$('#essb-short-bitly').show();
if (value == 'rebrand.ly')
$('#essb-short-rebrandly').show();
if (value == 'po.st')
$('#essb-short-post').show();
});
$('#essb_options_subscribe_function').change(function(e){
var value = $(this).val();
$('#essb-subscribe-link').hide();
$('#essb-subscribe-content').hide();
$('#essb-subscribe-form').hide();
if (value == 'form')
$('#essb-subscribe-content').show();
if (value == 'link')
$('#essb-subscribe-link').show();
if (value == 'mailchimp')
$('#essb-subscribe-form').show();
});
//essb_options_subscribe_connector
$('#essb_options_subscribe_connector').change(function(e){
var value = $(this).val();
$('.essb-options-container').find('.essb-subscribe-connector').each(function(){
$(this).hide();
});
if ($('#essb-subscribe-connector-'+value).length)
$('#essb-subscribe-connector-'+value).show();
});
$('#essb_options_counter_mode').change(function(e){
var value = $(this).val();
if (value == '')
$('#essb-tabs-counter-tabs-3').show();
else
$('#essb-tabs-counter-tabs-3').hide();
});
$('#essb_options_functions_mode').change(function(e){
var clearAllOptions = function() {
$('#essb_field_deactivate_module_aftershare').attr('checked', false);
$('#essb_field_deactivate_module_analytics').attr('checked', false);
$('#essb_field_deactivate_module_affiliate').attr('checked', false);
$('#essb_field_deactivate_module_customshare').attr('checked', false);
$('#essb_field_deactivate_module_message').attr('checked', false);
$('#essb_field_deactivate_module_metrics').attr('checked', false);
$('#essb_field_deactivate_module_translate').attr('checked', false);
$('#essb_field_deactivate_module_conversions').attr('checked', false);
$('#essb_field_deactivate_module_followers').attr('checked', false);
$('#essb_field_deactivate_module_profiles').attr('checked', false);
$('#essb_field_deactivate_module_natives').attr('checked', false);
$('#essb_field_deactivate_module_subscribe').attr('checked', false);
$('#essb_field_deactivate_method_float').attr('checked', false);
$('#essb_field_deactivate_method_postfloat').attr('checked', false);
$('#essb_field_deactivate_method_sidebar').attr('checked', false);
$('#essb_field_deactivate_method_topbar').attr('checked', false);
$('#essb_field_deactivate_method_bottombar').attr('checked', false);
$('#essb_field_deactivate_method_popup').attr('checked', false);
$('#essb_field_deactivate_method_flyin').attr('checked', false);
$('#essb_field_deactivate_method_postbar').attr('checked', false);
$('#essb_field_deactivate_method_point').attr('checked', false);
$('#essb_field_deactivate_method_image').attr('checked', false);
$('#essb_field_deactivate_method_native').attr('checked', false);
$('#essb_field_deactivate_method_heroshare').attr('checked', false);
$('#essb_field_deactivate_method_integrations').attr('checked', false);
//$('#essb_field_activate_fake').attr('checked', false);
//$('#essb_field_activate_hooks').attr('checked', false);
}
var value = $(this).val();
if (value == '')
$('#essb-functions-holder').show();
else
$('#essb-functions-holder').hide();
if (value == '') {
}
if (value == 'light') {
clearAllOptions();
$('#essb_field_deactivate_module_aftershare').attr('checked', true);
$('#essb_field_deactivate_module_analytics').attr('checked', true);
$('#essb_field_deactivate_module_affiliate').attr('checked', true);
$('#essb_field_deactivate_module_customshare').attr('checked', true);
$('#essb_field_deactivate_module_message').attr('checked', true);
$('#essb_field_deactivate_module_metrics').attr('checked', true);
$('#essb_field_deactivate_module_translate').attr('checked', true);
$('#essb_field_deactivate_module_conversions').attr('checked', true);
$('#essb_field_deactivate_module_followers').attr('checked', true);
$('#essb_field_deactivate_module_profiles').attr('checked', true);
$('#essb_field_deactivate_module_natives').attr('checked', true);
$('#essb_field_deactivate_module_subscribe').attr('checked', true);
$('#essb_field_deactivate_method_float').attr('checked', true);
$('#essb_field_deactivate_method_postfloat').attr('checked', true);
$('#essb_field_deactivate_method_topbar').attr('checked', true);
$('#essb_field_deactivate_method_bottombar').attr('checked', true);
$('#essb_field_deactivate_method_popup').attr('checked', true);
$('#essb_field_deactivate_method_flyin').attr('checked', true);
$('#essb_field_deactivate_method_postbar').attr('checked', true);
$('#essb_field_deactivate_method_point').attr('checked', true);
$('#essb_field_deactivate_method_native').attr('checked', true);
$('#essb_field_deactivate_method_heroshare').attr('checked', true);
$('#essb_field_deactivate_method_integrations').attr('checked', true);
$('.essb-component-functions_mode_mobile').find('[data-value="auto"]').trigger('click');
}
if (value == 'medium') {
clearAllOptions();
$('#essb_field_deactivate_module_affiliate').attr('checked', true);
$('#essb_field_deactivate_module_customshare').attr('checked', true);
$('#essb_field_deactivate_module_message').attr('checked', true);
$('#essb_field_deactivate_module_metrics').attr('checked', true);
$('#essb_field_deactivate_module_translate').attr('checked', true);
$('#essb_field_deactivate_module_conversions').attr('checked', true);
$('#essb_field_deactivate_module_followers').attr('checked', true);
$('#essb_field_deactivate_module_profiles').attr('checked', true);
$('#essb_field_deactivate_module_natives').attr('checked', true);
$('#essb_field_deactivate_method_postfloat').attr('checked', true);
$('#essb_field_deactivate_method_topbar').attr('checked', true);
$('#essb_field_deactivate_method_bottombar').attr('checked', true);
$('#essb_field_deactivate_method_popup').attr('checked', true);
$('#essb_field_deactivate_method_point').attr('checked', true);
$('#essb_field_deactivate_method_native').attr('checked', true);
$('#essb_field_deactivate_method_heroshare').attr('checked', true);
$('#essb_field_deactivate_method_integrations').attr('checked', true);
}
if (value == 'advanced') {
clearAllOptions();
$('#essb_field_deactivate_module_customshare').attr('checked', true);
$('#essb_field_deactivate_module_followers').attr('checked', true);
$('#essb_field_deactivate_module_profiles').attr('checked', true);
$('#essb_field_deactivate_module_natives').attr('checked', true);
$('#essb_field_deactivate_method_native').attr('checked', true);
$('#essb_field_deactivate_method_heroshare').attr('checked', true);
}
if (value == 'sharefollow') {
clearAllOptions();
$('#essb_field_deactivate_module_customshare').attr('checked', true);
$('#essb_field_deactivate_module_natives').attr('checked', true);
$('#essb_field_deactivate_method_native').attr('checked', true);
$('#essb_field_deactivate_method_heroshare').attr('checked', true);
}
if (value == 'full') {
clearAllOptions();
$('.essb-component-functions_mode_mobile').find('[data-value=""]').trigger('click');
}
});
$('#essb_options_optimization_level').change(function(e){
var value = $(this).val();
console.log('valye ' + value);
if (value == '') {
$('#optimizations-css').show();
$('#optimizations-css-builder').show();
$('#optimizations-other').show();
}
else {
$('#optimizations-css').hide();
$('#optimizations-css-builder').hide();
$('#optimizations-other').hide();
$('#essb_field_use_minified_css').attr('checked', false);
$('#essb_field_load_css_footer').attr('checked', false);
$('#essb_field_use_minified_js').attr('checked', false);
$('#essb_field_scripts_in_head').attr('checked', false);
$('#essb_field_load_js_async').attr('checked', false);
$('#essb_field_load_js_defer').attr('checked', false);
$('#essb_field_remove_ver_resource').attr('checked', false);
$('#essb_field_precompiled_resources').attr('checked', false);
$('#essb_options_precompiled_mode').val('');
$('#essb_field_essb_cache_runtime').attr('checked', false);
$('#essb_field_essb_cache').attr('checked', false);
$('#essb_field_essb_cache_static').attr('checked', false);
$('#essb_field_essb_cache_static_js').attr('checked', false);
$('#essb_field_use_stylebuilder').attr('checked', true);
$('#essb_field_use_stylebuilder').trigger('click');
if (value == 'level1') {
$('#essb_field_use_minified_css').attr('checked', true);
$('#essb_field_use_minified_js').attr('checked', true);
$('#essb_field_load_js_async').attr('checked', true);
}
if (value == 'level2') {
$('#essb_field_use_minified_css').attr('checked', true);
$('#essb_field_use_minified_js').attr('checked', true);
$('#essb_field_load_js_async').attr('checked', true);
$('#essb_field_remove_ver_resource').attr('checked', true);
$('#essb_field_precompiled_resources').attr('checked', true);
}
if (value == 'level3') {
$('#essb_field_use_minified_css').attr('checked', true);
$('#essb_field_use_minified_js').attr('checked', true);
$('#essb_field_load_js_async').attr('checked', true);
$('#essb_field_remove_ver_resource').attr('checked', true);
$('#essb_options_precompiled_mode').val('js');
$('#essb_field_precompiled_resources').attr('checked', true);
$('#optimizations-css-builder').show();
$('#essb_field_use_stylebuilder').attr('checked', false);
$('#essb_field_use_stylebuilder').trigger('click');
}
}
});
$('#essb_options_functions_mode_mobile').change(function(e){
var value = $(this).val();
if (value == 'deactivate') {
$('#essb_field_deactivate_mobile_share').attr('checked', true);
}
else {
$('#essb_field_deactivate_mobile_share').attr('checked', false);
}
});
$('#essb_component_button_position_mobile_sharebar').change(function(e) {
if ($(this).is(':checked'))
$('#essb-panel-sharebar').show();
else
$('#essb-panel-sharebar').hide();
});
$('#essb_component_button_position_mobile_sharebottom').change(function(e) {
if ($(this).is(':checked'))
$('#essb-panel-sharebuttons').show();
else
$('#essb-panel-sharebuttons').hide();
});
$('.essb-sortable').each(function() {
var element = $(this).attr("id");
jQuery('#'+element).sortable2();
});
$('#essb-sortable-essb3fans_networks input[type="checkbox"]').each(function(){
$(this).click(function(e){
var network = $(this).val();
if ($(this).is(':checked')) {
if ($('.essb-followers-' + network).length)
$('.essb-followers-' + network).show();
if ($('.settings-panel-essb3fans_layout_cols_' + network).length)
$('.settings-panel-essb3fans_layout_cols_' + network).show();
}
else {
if ($('.essb-followers-' + network).length)
$('.essb-followers-' + network).hide();
if ($('.settings-panel-essb3fans_layout_cols_' + network).length)
$('.settings-panel-essb3fans_layout_cols_' + network).hide();
}
});
});
// automatic open portlets which are closed but contain active options
$('.essb-auto-open').each(function(){
var hasOneValue = false;
$(this).find('.essb-portlet-content').find('input').each(function(){
var id = $(this).attr('id') || '',
type = $(this).attr('type') || '';
if (type == 'checkbox' || type == 'radio') {
if ($(this).is(':checked'))
hasOneValue = true;
}
if (type == 'text') {
if ($(this).val() != '')
hasOneValue = true;
}
});
$(this).find('.essb-portlet-content').find('select').each(function(){
if ($(this).val() != '')
hasOneValue = true;
});
if (hasOneValue)
$(this).find('.essb-portlet-heading').trigger('click');
});
// trigger specific events
if ($('#essb_options_button_width').length)
$('#essb_options_button_width').trigger('change');
if ($('#essb_options_shorturl_type').length)
$('#essb_options_shorturl_type').trigger('change');
if ($('#essb_options_subscribe_function').length)
$('#essb_options_subscribe_function').trigger('change');
if ($('#essb_options_subscribe_connector').length)
$('#essb_options_subscribe_connector').trigger('change');
if ($('#essb_options_counter_mode').length)
$('#essb_options_counter_mode').trigger('change');
if ($('#essb_options_functions_mode').length)
$('#essb_options_functions_mode').trigger('change');
if ($('#essb_component_button_position_mobile_sharebar').length)
$('#essb_component_button_position_mobile_sharebar').trigger('change');
if ($('#essb_component_button_position_mobile_sharebottom').length)
$('#essb_component_button_position_mobile_sharebottom').trigger('change');
if ($('#essb_options_optimization_level').length)
$('#essb_options_optimization_level').trigger('change');
$('#essb-sortable-essb3fans_networks input[type="checkbox"]').each(function(){
var network = $(this).val();
if ($(this).is(':checked')) {
if ($('.essb-followers-' + network).length)
$('.essb-followers-' + network).show();
if ($('.settings-panel-essb3fans_layout_cols_' + network).length)
$('.settings-panel-essb3fans_layout_cols_' + network).show();
}
else {
if ($('.essb-followers-' + network).length)
$('.essb-followers-' + network).hide();
if ($('.settings-panel-essb3fans_layout_cols_' + network).length)
$('.settings-panel-essb3fans_layout_cols_' + network).hide();
}
});
});
/*!
* jQuery scrollintoview() plugin and :scrollable selector filter
*
* Version 1.8 (14 Jul 2011)
* Requires jQuery 1.4 or newer
*
* Copyright (c) 2011 Robert Koritnik
* Licensed under the terms of the MIT license
* http://www.opensource.org/licenses/mit-license.php
*/
(function ($) {
var converter = {
vertical: { x: false, y: true },
horizontal: { x: true, y: false },
both: { x: true, y: true },
x: { x: true, y: false },
y: { x: false, y: true }
};
var settings = {
duration: "fast",
direction: "both"
};
var rootrx = /^(?:html)$/i;
// gets border dimensions
var borders = function (domElement, styles) {
styles = styles || (document.defaultView && document.defaultView.getComputedStyle ? document.defaultView.getComputedStyle(domElement, null) : domElement.currentStyle);
var px = document.defaultView && document.defaultView.getComputedStyle ? true : false;
var b = {
top: (parseFloat(px ? styles.borderTopWidth : $.css(domElement, "borderTopWidth")) || 0),
left: (parseFloat(px ? styles.borderLeftWidth : $.css(domElement, "borderLeftWidth")) || 0),
bottom: (parseFloat(px ? styles.borderBottomWidth : $.css(domElement, "borderBottomWidth")) || 0),
right: (parseFloat(px ? styles.borderRightWidth : $.css(domElement, "borderRightWidth")) || 0)
};
return {
top: b.top,
left: b.left,
bottom: b.bottom,
right: b.right,
vertical: b.top + b.bottom,
horizontal: b.left + b.right
};
};
var dimensions = function ($element) {
var win = $(window);
var isRoot = rootrx.test($element[0].nodeName);
return {
border: isRoot ? { top: 0, left: 0, bottom: 0, right: 0} : borders($element[0]),
scroll: {
top: (isRoot ? win : $element).scrollTop(),
left: (isRoot ? win : $element).scrollLeft()
},
scrollbar: {
right: isRoot ? 0 : $element.innerWidth() - $element[0].clientWidth,
bottom: isRoot ? 0 : $element.innerHeight() - $element[0].clientHeight
},
rect: (function () {
var r = $element[0].getBoundingClientRect();
return {
top: isRoot ? 0 : r.top,
left: isRoot ? 0 : r.left,
bottom: isRoot ? $element[0].clientHeight : r.bottom,
right: isRoot ? $element[0].clientWidth : r.right
};
})()
};
};
$.fn.extend({
scrollintoview: function (options) {
/// Scrolls the first element in the set into view by scrolling its closest scrollable parent.
/// Additional options that can configure scrolling:
/// duration (default: "fast") - jQuery animation speed (can be a duration string or number of milliseconds)
/// direction (default: "both") - select possible scrollings ("vertical" or "y", "horizontal" or "x", "both")
/// complete (default: none) - a function to call when scrolling completes (called in context of the DOM element being scrolled)
///
/// Returns the same jQuery set that this function was run on.
options = $.extend({}, settings, options);
options.direction = converter[typeof (options.direction) === "string" && options.direction.toLowerCase()] || converter.both;
var dirStr = "";
if (options.direction.x === true) dirStr = "horizontal";
if (options.direction.y === true) dirStr = dirStr ? "both" : "vertical";
var el = this.eq(0);
var scroller = el.closest(":scrollable(" + dirStr + ")");
// check if there's anything to scroll in the first place
if (scroller.length > 0)
{
scroller = scroller.eq(0);
var dim = {
e: dimensions(el),
s: dimensions(scroller)
};
var rel = {
top: dim.e.rect.top - (dim.s.rect.top + dim.s.border.top),
bottom: dim.s.rect.bottom - dim.s.border.bottom - dim.s.scrollbar.bottom - dim.e.rect.bottom,
left: dim.e.rect.left - (dim.s.rect.left + dim.s.border.left),
right: dim.s.rect.right - dim.s.border.right - dim.s.scrollbar.right - dim.e.rect.right
};
var animOptions = {};
// vertical scroll
if (options.direction.y === true)
{
if (rel.top < 0)
{
animOptions.scrollTop = dim.s.scroll.top + rel.top - 40;
}
else if (rel.top > 0 && rel.bottom < 0)
{
animOptions.scrollTop = dim.s.scroll.top + Math.min(rel.top, -rel.bottom) - 40;
}
}
// horizontal scroll
if (options.direction.x === true)
{
if (rel.left < 0)
{
animOptions.scrollLeft = dim.s.scroll.left + rel.left;
}
else if (rel.left > 0 && rel.right < 0)
{
animOptions.scrollLeft = dim.s.scroll.left + Math.min(rel.left, -rel.right);
}
}
// scroll if needed
if (!$.isEmptyObject(animOptions))
{
if (rootrx.test(scroller[0].nodeName))
{
scroller = $("html,body");
}
scroller
.animate(animOptions, options.duration)
.eq(0) // we want function to be called just once (ref. "html,body")
.queue(function (next) {
$.isFunction(options.complete) && options.complete.call(scroller[0]);
next();
});
}
else
{
// when there's nothing to scroll, just call the "complete" function
$.isFunction(options.complete) && options.complete.call(scroller[0]);
}
}
// return set back
return this;
}
});
var scrollValue = {
auto: true,
scroll: true,
visible: false,
hidden: false
};
$.extend($.expr[":"], {
scrollable: function (element, index, meta, stack) {
var direction = converter[typeof (meta[3]) === "string" && meta[3].toLowerCase()] || converter.both;
var styles = (document.defaultView && document.defaultView.getComputedStyle ? document.defaultView.getComputedStyle(element, null) : element.currentStyle);
var overflow = {
x: scrollValue[styles.overflowX.toLowerCase()] || false,
y: scrollValue[styles.overflowY.toLowerCase()] || false,
isRoot: rootrx.test(element.nodeName)
};
// check if completely unscrollable (exclude HTML element because it's special)
if (!overflow.x && !overflow.y && !overflow.isRoot)
{
return false;
}
var size = {
height: {
scroll: element.scrollHeight,
client: element.clientHeight
},
width: {
scroll: element.scrollWidth,
client: element.clientWidth
},
// check overflow.x/y because iPad (and possibly other tablets) don't dislay scrollbars
scrollableX: function () {
return (overflow.x || overflow.isRoot) && this.width.scroll > this.width.client;
},
scrollableY: function () {
return (overflow.y || overflow.isRoot) && this.height.scroll > this.height.client;
}
};
return direction.y && size.scrollableY() || direction.x && size.scrollableX();
}
});
})(jQuery);
/*!
* jQuery lockfixed plugin
* http://www.directlyrics.com/code/lockfixed/
*
* Copyright 2012 Yvo Schaap
* Released under the MIT license
* http://www.directlyrics.com/code/lockfixed/license.txt
*
* Date: Sun Feb 9 2014 12:00:01 GMT
*/
(function($, undefined){
$.extend({
/**
* Lockfixed initiated
* @param {Element} el - a jquery element, DOM node or selector string
* @param {Object} config - offset - forcemargin
*/
"lockfixed": function(el, config){
if (config && config.offset) {
config.offset.bottom = parseInt(config.offset.bottom,10);
config.offset.top = parseInt(config.offset.top,10);
}else{
config.offset = {bottom: 100, top: 0};
}
var el = $(el);
if(el && el.offset()){
var el_position = el.css("position"),
el_margin_top = parseInt(el.css("marginTop"),10),
el_position_top = el.css("top"),
el_top = el.offset().top,
pos_not_fixed = false;
/*
* We prefer feature testing, too much hassle for the upside
* while prettier to use position: fixed (less jitter when scrolling)
* iOS 5+ + Android has fixed support, but issue with toggeling between fixed and not and zoomed view
*/
if (config.forcemargin === true || navigator.userAgent.match(/\bMSIE (4|5|6)\./) || navigator.userAgent.match(/\bOS ([0-9])_/) || navigator.userAgent.match(/\bAndroid ([0-9])\./i)){
pos_not_fixed = true;
}
/*
// adds throttle to position calc; modern browsers should handle resize event fine
$(window).bind('scroll resize orientationchange load lockfixed:pageupdate',el,function(e){
window.setTimeout(function(){
$(document).trigger('lockfixed:pageupdate:async');
});
});
*/
$(window).bind('scroll resize orientationchange load lockfixed:pageupdate',el,function(e){
// if we have a input focus don't change this (for smaller screens)
if(pos_not_fixed && document.activeElement && document.activeElement.nodeName === "INPUT"){
return;
}
var top = 0,
el_height = el.outerHeight(),
el_width = el.outerWidth(),
max_height = $(document).height() - config.offset.bottom,
scroll_top = $(window).scrollTop();
// if element is not currently fixed position, reset measurements ( this handles DOM changes in dynamic pages )
if (el.css("position") !== "fixed" && !pos_not_fixed) {
el_top = el.offset().top;
el_position_top = el.css("top");
}
if (scroll_top >= (el_top-(el_margin_top ? el_margin_top : 0)-config.offset.top)){
if(max_height < (scroll_top + el_height + el_margin_top + config.offset.top)){
top = (scroll_top + el_height + el_margin_top + config.offset.top) - max_height;
}else{
top = 0;
}
if (pos_not_fixed){
el.css({'marginTop': (parseInt(scroll_top - el_top - top,10) + (2 * config.offset.top))+'px'});
}else{
el.css({'position': 'fixed','top':(config.offset.top-top)+'px','width':el_width +"px"});
}
}else{
el.css({'position': el_position,'top': el_position_top, 'width':el_width +"px", 'marginTop': (el_margin_top && !pos_not_fixed ? el_margin_top : 0)+"px"});
}
});
}
}
});
})(jQuery);
///---
/*
* ScrollToFixed
* https://github.com/bigspotteddog/ScrollToFixed
*
* Copyright (c) 2011 Joseph Cava-Lynch
* MIT license
*/
(function($) {
$.isScrollToFixed = function(el) {
return !!$(el).data('ScrollToFixed');
};
$.ScrollToFixed = function(el, options) {
// To avoid scope issues, use 'base' instead of 'this' to reference this
// class from internal events and functions.
var base = this;
// Access to jQuery and DOM versions of element.
base.$el = $(el);
base.el = el;
// Add a reverse reference to the DOM object.
base.$el.data('ScrollToFixed', base);
// A flag so we know if the scroll has been reset.
var isReset = false;
// The element that was given to us to fix if scrolled above the top of
// the page.
var target = base.$el;
var position;
var originalPosition;
var originalOffsetTop;
var originalZIndex;
// The offset top of the element when resetScroll was called. This is
// used to determine if we have scrolled past the top of the element.
var offsetTop = 0;
// The offset left of the element when resetScroll was called. This is
// used to move the element left or right relative to the horizontal
// scroll.
var offsetLeft = 0;
var originalOffsetLeft = -1;
// This last offset used to move the element horizontally. This is used
// to determine if we need to move the element because we would not want
// to do that for no reason.
var lastOffsetLeft = -1;
// This is the element used to fill the void left by the target element
// when it goes fixed; otherwise, everything below it moves up the page.
var spacer = null;
var spacerClass;
var className;
// Capture the original offsets for the target element. This needs to be
// called whenever the page size changes or when the page is first
// scrolled. For some reason, calling this before the page is first
// scrolled causes the element to become fixed too late.
function resetScroll() {
// Set the element to it original positioning.
target.trigger('preUnfixed.ScrollToFixed');
setUnfixed();
target.trigger('unfixed.ScrollToFixed');
// Reset the last offset used to determine if the page has moved
// horizontally.
lastOffsetLeft = -1;
// Capture the offset top of the target element.
offsetTop = target.offset().top;
// Capture the offset left of the target element.
offsetLeft = target.offset().left;
// If the offsets option is on, alter the left offset.
if (base.options.offsets) {
offsetLeft += (target.offset().left - target.position().left);
}
if (originalOffsetLeft == -1) {
originalOffsetLeft = offsetLeft;
}
position = target.css('position');
// Set that this has been called at least once.
isReset = true;
if (base.options.bottom != -1) {
target.trigger('preFixed.ScrollToFixed');
setFixed();
target.trigger('fixed.ScrollToFixed');
}
}
function getLimit() {
var limit = base.options.limit;
if (!limit) return 0;
if (typeof(limit) === 'function') {
return limit.apply(target);
}
return limit;
}
// Returns whether the target element is fixed or not.
function isFixed() {
return position === 'fixed';
}
// Returns whether the target element is absolute or not.
function isAbsolute() {
return position === 'absolute';
}
function isUnfixed() {
return !(isFixed() || isAbsolute());
}
// Sets the target element to fixed. Also, sets the spacer to fill the
// void left by the target element.
function setFixed() {
// Only fix the target element and the spacer if we need to.
if (!isFixed()) {
// Set the spacer to fill the height and width of the target
// element, then display it.
spacer.css({
'display' : target.css('display'),
'width' : target.outerWidth(true),
'height' : target.outerHeight(true),
'float' : target.css('float')
});
// Set the target element to fixed and set its width so it does
// not fill the rest of the page horizontally. Also, set its top
// to the margin top specified in the options.
cssOptions={
'z-index' : base.options.zIndex,
'position' : 'fixed',
'top' : base.options.bottom == -1?getMarginTop():'',
'bottom' : base.options.bottom == -1?'':base.options.bottom,
'margin-left' : '0px'
}
if (!base.options.dontSetWidth){ cssOptions['width']=target.width(); };
target.css(cssOptions);
target.addClass(base.options.baseClassName);
if (base.options.className) {
target.addClass(base.options.className);
}
position = 'fixed';
}
}
function setAbsolute() {
var top = getLimit();
var left = offsetLeft;
if (base.options.removeOffsets) {
left = '';
top = top - offsetTop;
}
cssOptions={
'position' : 'absolute',
'top' : top,
'left' : left,
'margin-left' : '0px',
'bottom' : ''
}
if (!base.options.dontSetWidth){ cssOptions['width']=target.width(); };
target.css(cssOptions);
position = 'absolute';
}
// Sets the target element back to unfixed. Also, hides the spacer.
function setUnfixed() {
// Only unfix the target element and the spacer if we need to.
if (!isUnfixed()) {
lastOffsetLeft = -1;
// Hide the spacer now that the target element will fill the
// space.
spacer.css('display', 'none');
// Remove the style attributes that were added to the target.
// This will reverse the target back to the its original style.
target.css({
'z-index' : originalZIndex,
'width' : '',
'position' : originalPosition,
'left' : '',
'top' : originalOffsetTop,
'margin-left' : ''
});
target.removeClass('scroll-to-fixed-fixed');
if (base.options.className) {
target.removeClass(base.options.className);
}
position = null;
}
}
// Moves the target element left or right relative to the horizontal
// scroll position.
function setLeft(x) {
// Only if the scroll is not what it was last time we did this.
if (x != lastOffsetLeft) {
// Move the target element horizontally relative to its original
// horizontal position.
target.css('left', offsetLeft - x);
// Hold the last horizontal position set.
lastOffsetLeft = x;
}
}
function getMarginTop() {
var marginTop = base.options.marginTop;
if (!marginTop) return 0;
if (typeof(marginTop) === 'function') {
return marginTop.apply(target);
}
return marginTop;
}
// Checks to see if we need to do something based on new scroll position
// of the page.
function checkScroll() {
if (!$.isScrollToFixed(target)) return;
var wasReset = isReset;
// If resetScroll has not yet been called, call it. This only
// happens once.
if (!isReset) {
resetScroll();
} else if (isUnfixed()) {
// if the offset has changed since the last scroll,
// we need to get it again.
// Capture the offset top of the target element.
offsetTop = target.offset().top;
// Capture the offset left of the target element.
offsetLeft = target.offset().left;
}
// Grab the current horizontal scroll position.
var x = $(window).scrollLeft();
// Grab the current vertical scroll position.
var y = $(window).scrollTop();
// Get the limit, if there is one.
var limit = getLimit();
// If the vertical scroll position, plus the optional margin, would
// put the target element at the specified limit, set the target
// element to absolute.
if (base.options.minWidth && $(window).width() < base.options.minWidth) {
if (!isUnfixed() || !wasReset) {
postPosition();
target.trigger('preUnfixed.ScrollToFixed');
setUnfixed();
target.trigger('unfixed.ScrollToFixed');
}
} else if (base.options.maxWidth && $(window).width() > base.options.maxWidth) {
if (!isUnfixed() || !wasReset) {
postPosition();
target.trigger('preUnfixed.ScrollToFixed');
setUnfixed();
target.trigger('unfixed.ScrollToFixed');
}
} else if (base.options.bottom == -1) {
// If the vertical scroll position, plus the optional margin, would
// put the target element at the specified limit, set the target
// element to absolute.
if (limit > 0 && y >= limit - getMarginTop()) {
if (!isAbsolute() || !wasReset) {
postPosition();
target.trigger('preAbsolute.ScrollToFixed');
setAbsolute();
target.trigger('unfixed.ScrollToFixed');
}
// If the vertical scroll position, plus the optional margin, would
// put the target element above the top of the page, set the target
// element to fixed.
} else if (y >= offsetTop - getMarginTop()) {
if (!isFixed() || !wasReset) {
postPosition();
target.trigger('preFixed.ScrollToFixed');
// Set the target element to fixed.
setFixed();
// Reset the last offset left because we just went fixed.
lastOffsetLeft = -1;
target.trigger('fixed.ScrollToFixed');
}
// If the page has been scrolled horizontally as well, move the
// target element accordingly.
setLeft(x);
} else {
// Set the target element to unfixed, placing it where it was
// before.
if (!isUnfixed() || !wasReset) {
postPosition();
target.trigger('preUnfixed.ScrollToFixed');
setUnfixed();
target.trigger('unfixed.ScrollToFixed');
}
}
} else {
if (limit > 0) {
if (y + $(window).height() - target.outerHeight(true) >= limit - (getMarginTop() || -getBottom())) {
if (isFixed()) {
postPosition();
target.trigger('preUnfixed.ScrollToFixed');
if (originalPosition === 'absolute') {
setAbsolute();
} else {
setUnfixed();
}
target.trigger('unfixed.ScrollToFixed');
}
} else {
if (!isFixed()) {
postPosition();
target.trigger('preFixed.ScrollToFixed');
setFixed();
}
setLeft(x);
target.trigger('fixed.ScrollToFixed');
}
} else {
setLeft(x);
}
}
}
function getBottom() {
if (!base.options.bottom) return 0;
return base.options.bottom;
}
function postPosition() {
var position = target.css('position');
if (position == 'absolute') {
target.trigger('postAbsolute.ScrollToFixed');
} else if (position == 'fixed') {
target.trigger('postFixed.ScrollToFixed');
} else {
target.trigger('postUnfixed.ScrollToFixed');
}
}
var windowResize = function(event) {
// Check if the element is visible before updating it's position, which
// improves behavior with responsive designs where this element is hidden.
if(target.is(':visible')) {
isReset = false;
checkScroll();
}
}
var windowScroll = function(event) {
(!!window.requestAnimationFrame) ? requestAnimationFrame(checkScroll) : checkScroll();
}
// From: http://kangax.github.com/cft/#IS_POSITION_FIXED_SUPPORTED
var isPositionFixedSupported = function() {
var container = document.body;
if (document.createElement && container && container.appendChild && container.removeChild) {
var el = document.createElement('div');
if (!el.getBoundingClientRect) return null;
el.innerHTML = 'x';
el.style.cssText = 'position:fixed;top:100px;';
container.appendChild(el);
var originalHeight = container.style.height,
originalScrollTop = container.scrollTop;
container.style.height = '3000px';
container.scrollTop = 500;
var elementTop = el.getBoundingClientRect().top;
container.style.height = originalHeight;
var isSupported = (elementTop === 100);
container.removeChild(el);
container.scrollTop = originalScrollTop;
return isSupported;
}
return null;
}
var preventDefault = function(e) {
e = e || window.event;
if (e.preventDefault) {
e.preventDefault();
}
e.returnValue = false;
}
// Initializes this plugin. Captures the options passed in, turns this
// off for devices that do not support fixed position, adds the spacer,
// and binds to the window scroll and resize events.
base.init = function() {
// Capture the options for this plugin.
base.options = $.extend({}, $.ScrollToFixed.defaultOptions, options);
originalZIndex = target.css('z-index')
// Turn off this functionality for devices that do not support it.
// if (!(base.options && base.options.dontCheckForPositionFixedSupport)) {
// var fixedSupported = isPositionFixedSupported();
// if (!fixedSupported) return;
// }
// Put the target element on top of everything that could be below
// it. This reduces flicker when the target element is transitioning
// to fixed.
base.$el.css('z-index', base.options.zIndex);
// Create a spacer element to fill the void left by the target
// element when it goes fixed.
spacer = $('');
position = target.css('position');
originalPosition = target.css('position');
originalOffsetTop = target.css('top');
// Place the spacer right after the target element.
if (isUnfixed()) base.$el.after(spacer);
// Reset the target element offsets when the window is resized, then
// check to see if we need to fix or unfix the target element.
$(window).bind('resize.ScrollToFixed', windowResize);
// When the window scrolls, check to see if we need to fix or unfix
// the target element.
$(window).bind('scroll.ScrollToFixed', windowScroll);
// For touch devices, call checkScroll directlly rather than
// rAF wrapped windowScroll to animate the element
if ('ontouchmove' in window) {
$(window).bind('touchmove.ScrollToFixed', checkScroll);
}
if (base.options.preFixed) {
target.bind('preFixed.ScrollToFixed', base.options.preFixed);
}
if (base.options.postFixed) {
target.bind('postFixed.ScrollToFixed', base.options.postFixed);
}
if (base.options.preUnfixed) {
target.bind('preUnfixed.ScrollToFixed', base.options.preUnfixed);
}
if (base.options.postUnfixed) {
target.bind('postUnfixed.ScrollToFixed', base.options.postUnfixed);
}
if (base.options.preAbsolute) {
target.bind('preAbsolute.ScrollToFixed', base.options.preAbsolute);
}
if (base.options.postAbsolute) {
target.bind('postAbsolute.ScrollToFixed', base.options.postAbsolute);
}
if (base.options.fixed) {
target.bind('fixed.ScrollToFixed', base.options.fixed);
}
if (base.options.unfixed) {
target.bind('unfixed.ScrollToFixed', base.options.unfixed);
}
if (base.options.spacerClass) {
spacer.addClass(base.options.spacerClass);
}
target.bind('resize.ScrollToFixed', function() {
spacer.height(target.height());
});
target.bind('scroll.ScrollToFixed', function() {
target.trigger('preUnfixed.ScrollToFixed');
setUnfixed();
target.trigger('unfixed.ScrollToFixed');
checkScroll();
});
target.bind('detach.ScrollToFixed', function(ev) {
preventDefault(ev);
target.trigger('preUnfixed.ScrollToFixed');
setUnfixed();
target.trigger('unfixed.ScrollToFixed');
$(window).unbind('resize.ScrollToFixed', windowResize);
$(window).unbind('scroll.ScrollToFixed', windowScroll);
target.unbind('.ScrollToFixed');
//remove spacer from dom
spacer.remove();
base.$el.removeData('ScrollToFixed');
});
// Reset everything.
windowResize();
};
// Initialize the plugin.
base.init();
};
// Sets the option defaults.
$.ScrollToFixed.defaultOptions = {
marginTop : 0,
limit : 0,
bottom : -1,
zIndex : 1000,
baseClassName: 'scroll-to-fixed-fixed'
};
// Returns enhanced elements that will fix to the top of the page when the
// page is scrolled.
$.fn.scrollToFixed = function(options) {
return this.each(function() {
(new $.ScrollToFixed(this, options));
});
};
})(jQuery);
/*
* HTML5 Sortable jQuery Plugin
* http://farhadi.ir/projects/html5sortable
*
* Copyright 2012, Ali Farhadi
* Released under the MIT license.
*/
(function($) {
var dragging, placeholders = $();
$.fn.sortable2 = function(options) {
var method = String(options);
options = $.extend({
connectWith: false
}, options);
return this.each(function() {
if (/^(enable|disable|destroy)$/.test(method)) {
var items = $(this).children($(this).data('items')).attr('draggable', method == 'enable');
if (method == 'destroy') {
items.add(this).removeData('connectWith items')
.off('dragstart.h5s dragend.h5s selectstart.h5s dragover.h5s dragenter.h5s drop.h5s');
}
return;
}
var isHandle, index, items = $(this).children(options.items);
var placeholder = $('<' + (/^(ul|ol)$/i.test(this.tagName) ? 'li' : 'div') + ' class="sortable-placeholder">');
items.find(options.handle).mousedown(function() {
isHandle = true;
}).mouseup(function() {
isHandle = false;
});
$(this).data('items', options.items)
placeholders = placeholders.add(placeholder);
if (options.connectWith) {
$(options.connectWith).add(this).data('connectWith', options.connectWith);
}
items.attr('draggable', 'true').on('dragstart.h5s', function(e) {
if (options.handle && !isHandle) {
return false;
}
isHandle = false;
var dt = e.originalEvent.dataTransfer;
dt.effectAllowed = 'move';
dt.setData('Text', 'dummy');
index = (dragging = $(this)).addClass('sortable-dragging').index();
}).on('dragend.h5s', function() {
if (!dragging) {
return;
}
dragging.removeClass('sortable-dragging').show();
placeholders.detach();
if (index != dragging.index()) {
dragging.parent().trigger('sortupdate', {item: dragging});
}
dragging = null;
}).not('a[href], img').on('selectstart.h5s', function() {
this.dragDrop && this.dragDrop();
return false;
}).end().add([this, placeholder]).on('dragover.h5s dragenter.h5s drop.h5s', function(e) {
if (!items.is(dragging) && options.connectWith !== $(dragging).parent().data('connectWith')) {
return true;
}
if (e.type == 'drop') {
e.stopPropagation();
placeholders.filter(':visible').after(dragging);
dragging.trigger('dragend.h5s');
return false;
}
e.preventDefault();
e.originalEvent.dataTransfer.dropEffect = 'move';
if (items.is(this)) {
if (options.forcePlaceholderSize) {
placeholder.height(dragging.outerHeight());
}
dragging.hide();
$(this)[placeholder.index() < $(this).index() ? 'after' : 'before'](placeholder);
placeholders.not(placeholder).detach();
} else if (!placeholders.is(this) && !$(this).children(options.items).length) {
placeholders.detach();
$(this).append(placeholder);
}
return false;
});
});
};
})(jQuery);
/*! Copyright 2012, Ben Lin (http://dreamerslab.com/)
* Licensed under the MIT License (LICENSE.txt).
*
* Version: 1.0.19
*
* Requires: jQuery >= 1.2.3
*/
;( function ( factory ) {
if ( typeof define === 'function' && define.amd ) {
// AMD. Register module depending on jQuery using requirejs define.
define( ['jquery'], factory );
} else {
// No AMD.
factory( jQuery );
}
}( function ( $ ){
$.fn.addBack = $.fn.addBack || $.fn.andSelf;
$.fn.extend({
actual : function ( method, options ){
// check if the jQuery method exist
if( !this[ method ]){
throw '$.actual => The jQuery method "' + method + '" you called does not exist';
}
var defaults = {
absolute : false,
clone : false,
includeMargin : false,
display : 'block'
};
var configs = $.extend( defaults, options );
var $target = this.eq( 0 );
var fix, restore;
if( configs.clone === true ){
fix = function (){
var style = 'position: absolute !important; top: -1000 !important; ';
// this is useful with css3pie
$target = $target.
clone().
attr( 'style', style ).
appendTo( 'body' );
};
restore = function (){
// remove DOM element after getting the width
$target.remove();
};
}else{
var tmp = [];
var style = '';
var $hidden;
fix = function (){
// get all hidden parents
$hidden = $target.parents().addBack().filter( ':hidden' );
style += 'visibility: hidden !important; display: ' + configs.display + ' !important; ';
if( configs.absolute === true ) style += 'position: absolute !important; ';
// save the origin style props
// set the hidden el css to be got the actual value later
$hidden.each( function (){
// Save original style. If no style was set, attr() returns undefined
var $this = $( this );
var thisStyle = $this.attr( 'style' );
tmp.push( thisStyle );
// Retain as much of the original style as possible, if there is one
$this.attr( 'style', thisStyle ? thisStyle + ';' + style : style );
});
};
restore = function (){
// restore origin style values
$hidden.each( function ( i ){
var $this = $( this );
var _tmp = tmp[ i ];
if( _tmp === undefined ){
$this.removeAttr( 'style' );
}else{
$this.attr( 'style', _tmp );
}
});
};
}
fix();
// get the actual value with user specific methed
// it can be 'width', 'height', 'outerWidth', 'innerWidth'... etc
// configs.includeMargin only works for 'outerWidth' and 'outerHeight'
var actual = /(outer)/.test( method ) ?
$target[ method ]( configs.includeMargin ) :
$target[ method ]();
restore();
// IMPORTANT, this plugin only return the value of the first element
return actual;
}
});
}));