Import legacy nurinda.co.id website
This commit is contained in:
1 parent
3f59bb9038
commit
6e21646ac4
13389 files changed
+3246690
No files matched your search
@@ -0,0 +1,117 @@
|
||||
!function($) {
|
||||
$(document).ready(function(){
|
||||
if(typeof vc === 'undefined'|| typeof window.VcColumnView==='undefined')
|
||||
return false;
|
||||
window.ULTHotspotSingleView = vc.shortcode_view.extend({
|
||||
editElement: function(e) {
|
||||
_.isObject(e) && e.preventDefault(), window.ULTHotspotSingleView.__super__.editElement.call(this, e), this.model.get("params");
|
||||
var single_element = this.$el;
|
||||
var img_id = single_element.parent().attr("data-hotspot-image");
|
||||
|
||||
if (single_element.attr("data-latest-img") == void 0 || single_element.attr("data-latest-img").length === 0)
|
||||
var new_img_id = img_id;
|
||||
else
|
||||
var new_img_id = single_element.attr("data-latest-img");
|
||||
if (single_element.attr("data-hotspot-image", img_id), void 0 == single_element.parent().attr("data-hotspot-link") || 0 == single_element.parent().attr("data-hotspot-link").length || new_img_id != img_id)
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: window.ajaxurl,
|
||||
data: {
|
||||
action: "wpb_single_image_src",
|
||||
content: img_id,
|
||||
size: "full",
|
||||
_vcnonce: window.vcAdminNonce // due to vc 4.7.4 update
|
||||
},
|
||||
dataType: "html",
|
||||
success: function(response_img_link){
|
||||
ULT_H_img_ID = img_id;
|
||||
ULT_H_img_link = response_img_link;
|
||||
single_element.attr("data-hotspot-link", response_img_link);
|
||||
single_element.attr("data-latest-img", img_id);
|
||||
}
|
||||
});
|
||||
else {
|
||||
var img_link = single_element.parent().attr("data-hotspot-link");
|
||||
ULT_H_img_link = img_link;
|
||||
ULT_H_img_ID = single_element.parent().attr("data-hotspot-image");
|
||||
}
|
||||
ULT_H_Size = single_element.parent().attr("data-hotspot-size");
|
||||
ULT_H_custom_size = single_element.parent().attr("data-hotspot-custom");
|
||||
//vc.edit_element_block_view.render(this.model);
|
||||
}
|
||||
});
|
||||
var vc_shortcodes = vc.shortcodes;
|
||||
window.ULTHotspotContainerView = window.VcColumnView.extend({
|
||||
buildDesignHelpers: function() {
|
||||
var container_element_params = this.model.get("params");
|
||||
var container_element = this.$el;
|
||||
var n = container_element.attr("data-model-id");
|
||||
var hotspot_image = container_element_params.main_img;
|
||||
var hotspot_size = container_element_params.main_img_size;
|
||||
var hotspot_custom_size = container_element_params.main_img_width;
|
||||
|
||||
var t = hotspot_image.split('|');
|
||||
var id = '';
|
||||
var url = '';
|
||||
if( t != 'undefined' && t != null ) {
|
||||
jQuery.each( t , function(index, val) {
|
||||
|
||||
// Start with 'id:' or 'id^'
|
||||
if ( val.startsWith("id:") ) {
|
||||
id = val.split("id:").pop();
|
||||
}
|
||||
if ( val.startsWith("id^") ) {
|
||||
id = val.split("id^").pop();
|
||||
}
|
||||
// Start with 'url:' or 'url^'
|
||||
if ( val.startsWith("url:") ) {
|
||||
url = val.split("url:").pop();
|
||||
}
|
||||
if ( val.startsWith("url^") ) {
|
||||
url = val.split("url^").pop();
|
||||
}
|
||||
});
|
||||
}
|
||||
if( id != null && id != 'undefined' && url != null && url != 'undefined' ) {
|
||||
hotspot_image = id + '|' + url;
|
||||
}
|
||||
|
||||
if(typeof container_element_params.main_img_width != 'undefined')
|
||||
hotspot_custom_size = container_element_params.main_img_width;
|
||||
|
||||
vc_shortcodes.where({
|
||||
parent_id: this.model.id
|
||||
});
|
||||
|
||||
_.isEmpty(hotspot_image) || ( container_element.find("> .wpb_element_wrapper .wpb_column_container").attr("data-hotspot-image", hotspot_image), container_element.find("> .wpb_element_wrapper .wpb_column_container").attr("data-hotspot-size", hotspot_size), container_element.find("> .wpb_element_wrapper .wpb_column_container").attr("data-hotspot-custom", hotspot_custom_size), container_element.attr("data-hotspot-image", hotspot_image), container_element.attr("data-hotspot-size", hotspot_size), container_element.attr("data-hotspot-custom", hotspot_custom_size), $.ajax({
|
||||
type: "POST",
|
||||
url: window.ajaxurl,
|
||||
data: {
|
||||
action: "wpb_single_image_src",
|
||||
content: hotspot_image,
|
||||
size: "full",
|
||||
_vcnonce: window.vcAdminNonce // due to vc 4.7.4 update
|
||||
},
|
||||
dataType: "html",
|
||||
success: function(img_link){
|
||||
container_element.find("> .wpb_element_wrapper .wpb_column_container").attr("data-hotspot-link", img_link);
|
||||
container_element.attr("data-hotspot-link", img_link);
|
||||
}
|
||||
}));
|
||||
},
|
||||
addElement: function(e) {
|
||||
_.isObject(e) && e.preventDefault();
|
||||
var img_id = this.$el.attr("data-hotspot-image");
|
||||
var img_link = this.$el.attr("data-hotspot-link");
|
||||
var img_size = this.$el.attr("data-hotspot-size");
|
||||
var img_custom_size = this.$el.attr("data-hotspot-custom");
|
||||
|
||||
ULT_H_img_ID = img_id;
|
||||
ULT_H_img_link = img_link;
|
||||
ULT_H_Size = img_size;
|
||||
ULT_H_custom_size = img_custom_size;
|
||||
window.ULTHotspotContainerView.__super__.addElement.call(this, e);
|
||||
}
|
||||
});
|
||||
});
|
||||
}(jQuery);
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,93 @@
|
||||
(function ($) {
|
||||
/* js view for singleTab Element*/
|
||||
|
||||
//console && console.log('UltimateSubTabView.js is loaded');
|
||||
// Come from vc_map -> 'js_view' => 'UltimateSubTabView'
|
||||
if(typeof vc === 'undefined' || typeof window.VcColumnView==='undefined')
|
||||
return false;
|
||||
var Shortcodes = vc.shortcodes;
|
||||
|
||||
window.UltimateSubTabView = window.VcColumnView.extend({
|
||||
events:{
|
||||
'click > .vc_controls .vc_control-btn-delete':'deleteShortcode',
|
||||
'click > .vc_controls .vc_control-btn-prepend':'addElement',
|
||||
'click > .vc_controls .vc_control-btn-edit':'editElement',
|
||||
'click > .vc_controls .vc_control-btn-clone':'clone',
|
||||
'click > .wpb_element_wrapper > .vc_empty-container':'addToEmpty'
|
||||
},
|
||||
|
||||
// Render method called after element is added( cloned ), and on first initialisation
|
||||
render:function () {
|
||||
var params = this.model.get('params');
|
||||
// console && console.log('UltimateSubTabView.params:'+params);
|
||||
window.UltimateSubTabView.__super__.render.call(this);
|
||||
// console && console.log('UltimateSubTabView.render() is loaded');
|
||||
if(!params.tab_id) {
|
||||
params.tab_id = (+new Date() + '-' + Math.floor(Math.random() * 11));
|
||||
this.model.save('params', params);
|
||||
}
|
||||
this.id = 'tab-' + params.tab_id;
|
||||
this.$el.attr('id', this.id);
|
||||
//console && console.log('UltimateSubTabView.render() end');
|
||||
return this;
|
||||
},
|
||||
ready:function (e) {
|
||||
|
||||
window.UltimateSubTabView.__super__.ready.call(this, e);
|
||||
this.$tabs = this.$el.closest('.wpb_tabs_holder');
|
||||
var params = this.model.get('params');
|
||||
//console && console.log('UltimateSubTabView.ready() loading');
|
||||
return this;
|
||||
},
|
||||
changeShortcodeParams:function (model) {
|
||||
var params = model.get('params');
|
||||
window.UltimateSubTabView.__super__.changeShortcodeParams.call(this, model);
|
||||
//var params = model.get('params');
|
||||
if (_.isObject(params) && _.isString(params.title) && _.isString(params.tab_id)) {
|
||||
$('.ui-tabs-nav [href="#tab-' + params.tab_id + '"]').text(params.title);
|
||||
}
|
||||
//console && console.log('UltimateSubTabView changeShortcodeParams loading');
|
||||
},
|
||||
deleteShortcode:function (e) {
|
||||
_.isObject(e) && e.preventDefault();
|
||||
var answer = confirm(window.i18nLocale.press_ok_to_delete_section),
|
||||
parent_id = this.model.get('parent_id');
|
||||
if (answer !== true) return false;
|
||||
this.model.destroy();
|
||||
if(!vc.shortcodes.where({parent_id: parent_id}).length) {
|
||||
vc.shortcodes.get(parent_id).destroy();
|
||||
return false;
|
||||
}
|
||||
var params = this.model.get('params'),
|
||||
current_tab_index = $('[href=#tab-' + params.tab_id + ']', this.$tabs).parent().index();
|
||||
$('[href=#tab-' + params.tab_id + ']').parent().remove();
|
||||
var tab_length = this.$tabs.find('.ui-tabs-nav li:not(.add_tab_block)').length;
|
||||
if(tab_length > 0) {
|
||||
this.$tabs.tabs('refresh');
|
||||
}
|
||||
if (current_tab_index < tab_length) {
|
||||
this.$tabs.tabs("option", "active", current_tab_index);
|
||||
} else if (tab_length > 0) {
|
||||
this.$tabs.tabs("option", "active", tab_length - 1);
|
||||
}
|
||||
// console && console.log('UltimateSubTabView.deleteShortcode loading');
|
||||
},
|
||||
cloneModel:function (model, parent_id, save_order) {
|
||||
var shortcodes_to_resort = [],
|
||||
new_order = _.isBoolean(save_order) && save_order === true ? model.get('order') : parseFloat(model.get('order')) + vc.clone_index,
|
||||
new_params = _.extend({}, model.get('params'));
|
||||
if (model.get('shortcode') === 'single_tab') _.extend(new_params, {tab_id:+new Date() + '-' + this.$tabs.find('[data-element_type=single_tab]').length + '-' + Math.floor(Math.random() * 11)});
|
||||
var model_clone = Shortcodes.create({shortcode:model.get('shortcode'), parent_id:parent_id, order:new_order, cloned:true, cloned_from:model.toJSON(), params:new_params});
|
||||
_.each(Shortcodes.where({parent_id:model.id}), function (shortcode) {
|
||||
this.cloneModel(shortcode, model_clone.id, true);
|
||||
}, this);
|
||||
//console && console.log('UltimateSubTabView.cloneModel loading');
|
||||
return model_clone;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Come from vc_map -> 'js_view' => 'UltimateSubTabView'
|
||||
|
||||
|
||||
})(window.jQuery);
|
||||
@@ -0,0 +1,134 @@
|
||||
(function ($) {
|
||||
//alert('test');
|
||||
//console && console.log('admin_enqueue_js.js is loaded');
|
||||
// Come from vc_map -> 'js_view' => 'UltimateTabView'
|
||||
if(typeof vc === 'undefined' || typeof vc.shortcode_view === 'undefined')
|
||||
return false;
|
||||
var Shortcodes = vc.shortcodes;
|
||||
window.UltimateTabView = vc.shortcode_view.extend({
|
||||
new_tab_adding:false,
|
||||
events:{
|
||||
'click .add_tab':'addTab',
|
||||
'click > .vc_controls .vc_control-btn-delete':'deleteShortcode',
|
||||
'click > .vc_controls .vc_control-btn-edit':'editElement',
|
||||
'click > .vc_controls .vc_control-btn-clone':'clone'
|
||||
},
|
||||
initialize:function (params) {
|
||||
window.UltimateTabView.__super__.initialize.call(this, params);
|
||||
_.bindAll(this, 'stopSorting');
|
||||
//console && console.log('UltimateTabView: initialize method called.');
|
||||
},
|
||||
// Render method called after element is added( cloned ), and on first initialisation
|
||||
render: function () {
|
||||
//console && console.log('UltimateTabView: render method called.');
|
||||
window.UltimateTabView.__super__.render.call(this); //make sure to call __super__. To execute logic fron inherited view. That way you can extend original logic. Otherwise, you will fully rewrite what VC will do at this event
|
||||
this.$tabs = this.$el.find('.wpb_tabs_holder');
|
||||
this.createAddTabButton();
|
||||
//console && console.log('UltimateTabView '+this.$tabs);
|
||||
return this;
|
||||
},
|
||||
ready: function (e) {
|
||||
//console && console.log('UltimateTabView: ready method called.');
|
||||
window.UltimateTabView.__super__.ready.call(this, e);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
createAddTabButton:function(){
|
||||
var new_tab_button_id = (+new Date() + '-' + Math.floor(Math.random() * 11));
|
||||
this.$tabs.append('<div id="new-tab-' + new_tab_button_id + '" class="new_element_button"></div>');
|
||||
this.$add_button = $('<li class="add_tab_block"><a href="#new-tab-' + new_tab_button_id + '" class="add_tab" title="' + window.i18nLocale.add_tab + '"></a></li>').appendTo(this.$tabs.find(".tabs_controls"));
|
||||
//console && console.log(' UltimateTabView : createAddTabButton');
|
||||
},
|
||||
addTab:function (e) {
|
||||
//console && console.log('addTab');
|
||||
e.preventDefault();
|
||||
this.new_tab_adding = true;
|
||||
var tab_title = window.i18nLocale.tab,
|
||||
tabs_count = this.$tabs.find('[data-element_type=single_tab]').length,
|
||||
tab_id = (+new Date() + '-' + tabs_count + '-' + Math.floor(Math.random() * 11));
|
||||
vc.shortcodes.create({shortcode:'single_tab', params:{title:tab_title, tab_id:tab_id}, parent_id:this.model.id});
|
||||
//console && console.log(' UltimateTabView : addTab');
|
||||
return false;
|
||||
},
|
||||
stopSorting:function (event, ui) {
|
||||
var shortcode;
|
||||
//console && console.log(' UltimateTabView : stopSorting loading');
|
||||
this.$tabs.find('ul.tabs_controls li:not(.add_tab_block)').each(function (index) {
|
||||
var href = $(this).find('a').attr('href').replace("#", "");
|
||||
// $('#' + href).appendTo(this.$tabs);
|
||||
shortcode = vc.shortcodes.get($('[id=' + $(this).attr('aria-controls') + ']').data('model-id'));
|
||||
vc.storage.lock();
|
||||
shortcode.save({'order':$(this).index()}); // Optimize
|
||||
});
|
||||
//console && console.log(' UltimateTabView : shortcode save');
|
||||
shortcode.save();
|
||||
},
|
||||
changedContent:function (view) {
|
||||
var params = view.model.get('params');
|
||||
if (!this.$tabs.hasClass('ui-tabs')) {
|
||||
this.$tabs.tabs({
|
||||
select:function (event, ui) {
|
||||
if ($(ui.tab).hasClass('add_tab')) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
this.$tabs.find(".ui-tabs-nav").prependTo(this.$tabs);
|
||||
this.$tabs.find(".ui-tabs-nav").sortable({
|
||||
axis:(this.$tabs.closest('[data-element_type]').data('element_type') == 'test_element' ? 'y' : 'x'),
|
||||
update:this.stopSorting,
|
||||
items:"> li:not(.add_tab_block)"
|
||||
});
|
||||
}
|
||||
if (view.model.get('cloned') === true) {
|
||||
var cloned_from = view.model.get('cloned_from'),
|
||||
$tab_controls = $('.tabs_controls > .add_tab_block', this.$content),
|
||||
$new_tab = $("<li><a href='#tab-" + params.tab_id + "'>" + params.title + "</a></li>").insertBefore($tab_controls);
|
||||
this.$tabs.tabs('refresh');
|
||||
this.$tabs.tabs("option", 'active', $new_tab.index());
|
||||
} else {
|
||||
$("<li><a href='#tab-" + params.tab_id + "'>" + params.title + "</a></li>")
|
||||
.insertBefore(this.$add_button);
|
||||
this.$tabs.tabs('refresh');
|
||||
this.$tabs.tabs("option", "active", this.new_tab_adding ? $('.ui-tabs-nav li', this.$content).length - 2 : 0);
|
||||
|
||||
}
|
||||
this.new_tab_adding = false;
|
||||
//console && console.log(' UltimateTabView : changedContent save');
|
||||
},
|
||||
cloneModel:function (model, parent_id, save_order) {
|
||||
var shortcodes_to_resort = [],
|
||||
new_order = _.isBoolean(save_order) && save_order === true ? model.get('order') : parseFloat(model.get('order')) + vc.clone_index,
|
||||
model_clone,
|
||||
new_params = _.extend({}, model.get('params'));
|
||||
if (model.get('shortcode') === 'single_tab') _.extend(new_params, {tab_id:+new Date() + '-' + this.$tabs.find('[data-element-type=single_tab]').length + '-' + Math.floor(Math.random() * 11)});
|
||||
model_clone = Shortcodes.create({shortcode:model.get('shortcode'), id:vc_guid(), parent_id:parent_id, order:new_order, cloned:(model.get('shortcode') === 'single_tab' ? false : true), cloned_from:model.toJSON(), params:new_params});
|
||||
_.each(Shortcodes.where({parent_id:model.id}), function (shortcode) {
|
||||
this.cloneModel(shortcode, model_clone.get('id'), true);
|
||||
}, this);
|
||||
return model_clone;
|
||||
//console && console.log(' js : cloneModel save');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Come from vc_map -> 'js_view' => 'UltimateTabView'
|
||||
|
||||
|
||||
})(window.jQuery);
|
||||
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("body").on("change", ".disp_icon", function() {
|
||||
var op = jQuery(this).data("option");
|
||||
if(op=="Disables"){
|
||||
jQuery(this).parent().parent().parent().find('.ult_tabicon_notice').css({display: "none"});
|
||||
|
||||
}
|
||||
else{
|
||||
jQuery(this).parent().parent().parent().find('.ult_tabicon_notice').css({display: "block"});
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,318 @@
|
||||
/* Transparent - Color Picker */
|
||||
!function(r,a,e,o){"use strict";typeof Color.fn.toString!==o&&(Color.fn.toString=function(){if(this._alpha<1)return this.toCSS("rgba",this._alpha).replace(/\s+/g,"");var r=parseInt(this._color,10).toString(16);if(this.error)return"";if(r.length<6)for(var a=6-r.length-1;a>=0;a--)r="0"+r;return"#"+r}),r.cs_ParseColorValue=function(r){var a=r.replace(/\s+/g,""),e=-1!==a.indexOf("rgba")?parseFloat(100*a.replace(/^.*,(.+)\)/,"$1")):100,o=100>e?!0:!1;return{value:a,alpha:e,rgba:o}},r.fn.cs_wpColorPicker=function(){return this.each(function(){var a=r(this);if(a.data("rgba")!==!1){var e=r.cs_ParseColorValue(a.val());a.wpColorPicker({clear:function(){a.trigger("keyup")},change:function(r,e){var o=e.color.toString();a.closest(".wp-picker-container").find(".cs-alpha-slider-offset").css("background-color",o),a.val(o).trigger("change")},create:function(){var o=a.data("a8cIris"),c=a.closest(".wp-picker-container"),l=r('<div class="cs-alpha-wrap"><div class="cs-alpha-slider"></div><div class="cs-alpha-slider-offset"></div><div class="cs-alpha-text"></div></div>').appendTo(c.find(".wp-picker-holder")),i=l.find(".cs-alpha-slider"),t=l.find(".cs-alpha-text"),n=l.find(".cs-alpha-slider-offset");i.slider({slide:function(r,e){var c=parseFloat(e.value/100);o._color._alpha=c,a.wpColorPicker("color",o._color.toString()),t.text(1>c?c:"")},create:function(){var s=parseFloat(e.alpha/100),p=1>s?s:"";t.text(p),n.css("background-color",e.value),c.on("click",".wp-picker-clear",function(){o._color._alpha=1,t.text(""),i.slider("option","value",100).trigger("slide")}),c.on("click",".wp-picker-default",function(){var e=r.cs_ParseColorValue(a.data("default-color")),c=parseFloat(e.alpha/100),l=1>c?c:"";o._color._alpha=c,t.text(l),i.slider("option","value",e.alpha).trigger("slide")}),c.on("click",".wp-color-result",function(){l.toggle()}),r("body").on("click.wpcolorpicker",function(){l.hide()})},value:e.alpha,step:1,min:1,max:100})}})}else a.wpColorPicker({clear:function(){a.trigger("keyup")},change:function(r,e){a.val(e.color.toString()).trigger("change")}})})},r(e).ready(function(){r(".cs-wp-color-picker").cs_wpColorPicker()})}(jQuery,window,document);
|
||||
|
||||
/* Get alpha values */
|
||||
;(function ( $, window, undefined ) {
|
||||
$.cs_ParseColorValue = function( val ) {
|
||||
var value = val.replace(/\s+/g, ''),
|
||||
alpha = ( value.indexOf('rgba') !== -1 ) ? parseFloat( value.replace(/^.*,(.+)\)/, '$1') * 100 ) : 100,
|
||||
rgba = ( alpha < 100 ) ? true : false;
|
||||
return { value: value, alpha: alpha, rgba: rgba };
|
||||
};
|
||||
}(jQuery, window));
|
||||
|
||||
/* Ultimate Border - Param */
|
||||
;(function ( $, window, undefined ) {
|
||||
|
||||
function update_visibility(t) {
|
||||
var status = t.find(".ultimate-border-style-selector option:selected").val() || 'none'; // set data status
|
||||
if( status === 'none' ) {
|
||||
t.find('.ultimate-four-input-section, .ultimate-border-radius-block, .ultimate-colorpicker-section').hide();
|
||||
} else {
|
||||
t.find('.ultimate-four-input-section, .ultimate-border-radius-block, .ultimate-colorpicker-section').show();
|
||||
}
|
||||
}
|
||||
|
||||
// Enable chosen
|
||||
if(typeof $.fn.chosen !== 'undefined') {
|
||||
$('.ultimate-border-style-selector').chosen({
|
||||
allow_single_deselect: true,
|
||||
width: "100%"
|
||||
});
|
||||
}
|
||||
|
||||
$(".ultimate-border").each(function(index, element) {
|
||||
var t = $(element);
|
||||
init(t);
|
||||
get_hidden_with_border_style(t);
|
||||
//set_hidden_with_border_style(t);
|
||||
});
|
||||
function init(t) {
|
||||
// Hide {all}
|
||||
t.find('.ultb-width-all, .ultb-radius-all').attr('data-status', 'hide-all');
|
||||
t.find('.ultb-width-single, .ultb-radius-single').hide();
|
||||
t.find('.ultb-width-section .ult-expand, .ultb-radius-section .ult-expand').addClass('ult-collapse');
|
||||
|
||||
// border-width
|
||||
t.find('.ultb-width-section .ult-expand').click(function(event) {
|
||||
t.find('.ultb-width-all, .ultb-width-single').toggle();
|
||||
|
||||
// UPDATE STATUS
|
||||
var status = t.find('.ultb-width-all').attr('data-status') || 'hide-me';
|
||||
if( status === 'hide-me' ) {
|
||||
t.find('.ultb-width-section .ult-expand').addClass('ult-collapse');
|
||||
t.find('.ultb-width-all').attr('data-status', 'hide-all');
|
||||
} else {
|
||||
t.find('.ultb-width-section .ult-expand').removeClass('ult-collapse');
|
||||
t.find('.ultb-width-all').attr('data-status', 'hide-me');
|
||||
}
|
||||
set_hidden_with_border_style(t);
|
||||
});
|
||||
|
||||
|
||||
// border-radius
|
||||
t.find('.ultb-radius-section .ult-expand').click(function(event) {
|
||||
t.find('.ultb-radius-all, .ultb-radius-single').toggle();
|
||||
|
||||
// UPDATE STATUS
|
||||
var status = t.find('.ultb-radius-all').attr('data-status') || 'hide-me';
|
||||
if( status === 'hide-me' ) {
|
||||
t.find('.ultb-radius-section .ult-expand').addClass('ult-collapse');
|
||||
t.find('.ultb-radius-all').attr('data-status', 'hide-all');
|
||||
} else {
|
||||
t.find('.ultb-radius-section .ult-expand').removeClass('ult-collapse');
|
||||
t.find('.ultb-radius-all').attr('data-status', 'hide-me');
|
||||
}
|
||||
set_hidden_with_border_style(t);
|
||||
});
|
||||
|
||||
// unit change
|
||||
t.find('.ult-unit-border-width, .ult-unit-border-radius').change(function(event) {
|
||||
set_hidden_with_border_style(t);
|
||||
});
|
||||
|
||||
// Clear the color
|
||||
t.find('.wp-picker-clear').click(function(event) {
|
||||
var hxcolor = 'transparent';
|
||||
set_hidden_with_border_style(t, hxcolor);
|
||||
});
|
||||
|
||||
/* = Color Picker
|
||||
----------------------------------------*/
|
||||
t.find(".ultimate-colorpicker").wpColorPicker();
|
||||
}
|
||||
|
||||
function get_hidden_with_border_style(t) {
|
||||
var l = t.find(".ultimate-border-style-selector").length;
|
||||
var mv = t.find(".ultimate-border-value").val();
|
||||
|
||||
if (mv != "") {
|
||||
if(l) {
|
||||
var vals = mv.split("|");
|
||||
// set border style
|
||||
var splitval = vals[0].split(":");
|
||||
var bstyle = splitval[1].split(";");
|
||||
t.find(".ultimate-border-style-selector").val(bstyle[0]);
|
||||
t.find(".ultimate-border-style-selector").trigger("chosen:updated");
|
||||
|
||||
// Disable inputs if border-style - {none}
|
||||
if(typeof bstyle[0] != 'undefined' && bstyle[0] != null) {
|
||||
if(bstyle[0]==='none') {
|
||||
update_visibility(t);
|
||||
}
|
||||
}
|
||||
|
||||
// set border widths
|
||||
var bw = vals[1].split(";");
|
||||
}
|
||||
|
||||
$.each(bw, function(i, vl) {
|
||||
if (vl != "") {
|
||||
t.find(".ultimate-border-inputs").each(function(input_index, elem) {
|
||||
var splitval = vl.split(":");
|
||||
var dataid = $(elem).attr("data-id");
|
||||
|
||||
if( typeof splitval[0] != 'undefined' && splitval[0] != null ) {
|
||||
|
||||
// Collapse / Expand - {border width}
|
||||
/*if( splitval[0] === 'border-width') {
|
||||
}*/
|
||||
|
||||
// Collapse / Expand - {border radius}
|
||||
/*if( splitval[0] === 'border-radius') {
|
||||
}*/
|
||||
|
||||
switch(splitval[0]) {
|
||||
case 'border-width':
|
||||
t.find('.ultb-width-all').show();
|
||||
t.find('.ultb-width-all').attr('data-status', 'hide-all');
|
||||
t.find('.ultb-width-single').hide();
|
||||
t.find('.ultb-width-section .ult-expand').addClass('ult-collapse');
|
||||
break;
|
||||
|
||||
case 'border-top-width':
|
||||
case 'border-right-width':
|
||||
case 'border-bottom-width':
|
||||
case 'border-left-width':
|
||||
t.find('.ultb-width-all').hide();
|
||||
t.find('.ultb-width-all').attr('data-status', 'hide-me');
|
||||
t.find('.ultb-width-single').show();
|
||||
t.find('.ultb-width-section .ult-expand').removeClass('ult-collapse');
|
||||
break;
|
||||
|
||||
case 'border-radius':
|
||||
t.find('.ultb-radius-all').show();
|
||||
t.find('.ultb-radius-all').attr('data-status', 'hide-all');
|
||||
t.find('.ultb-radius-single').hide();
|
||||
t.find('.ultb-radius-section .ult-expand').addClass('ult-collapse');
|
||||
break;
|
||||
case 'border-top-left-radius':
|
||||
case 'border-top-right-radius':
|
||||
case 'border-bottom-right-radius':
|
||||
case 'border-bottom-left-radius':
|
||||
t.find('.ultb-radius-all').hide();
|
||||
t.find('.ultb-radius-all').attr('data-status', 'hide-me');
|
||||
t.find('.ultb-radius-single').show();
|
||||
t.find('.ultb-radius-section .ult-expand').removeClass('ult-collapse');
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
switch(splitval[0]) {
|
||||
case 'border-width':
|
||||
case 'border-top-width':
|
||||
case 'border-right-width':
|
||||
case 'border-bottom-width':
|
||||
case 'border-left-width':
|
||||
var val = splitval[1].match(/\d+/);
|
||||
var b = splitval[1].split(val);
|
||||
var unit = 'px';
|
||||
if(typeof b[1] != 'undefined' && b[1] != null) {
|
||||
unit = b[1];
|
||||
}
|
||||
t.find(".ult-unit-border-width").val(unit); // set border select unit
|
||||
if( dataid==splitval[0] ) {
|
||||
mval = splitval[1].split(unit);
|
||||
$(elem).val(mval[0]);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'border-radius':
|
||||
case 'border-top-left-radius':
|
||||
case 'border-top-right-radius':
|
||||
case 'border-bottom-right-radius':
|
||||
case 'border-bottom-left-radius':
|
||||
var val = splitval[1].match(/\d+/);
|
||||
var b = splitval[1].split(val);
|
||||
var unit = 'px';
|
||||
if(typeof b[1] != 'undefined' && b[1] != null) {
|
||||
unit = b[1];
|
||||
}
|
||||
t.find(".ult-unit-border-radius").val(unit); // set border select unit
|
||||
if( dataid==splitval[0] ) {
|
||||
mval = splitval[1].split(unit);
|
||||
$(elem).val(mval[0]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// set color
|
||||
var splitcols = mv.split("|");
|
||||
if(typeof splitcols[2] != 'undefined' || splitcols[2] != null){
|
||||
var sp = splitcols[2].split(":");
|
||||
var nd = sp[1].split(";");
|
||||
var did = t.find(".ultimate-colorpicker").attr("data-id");
|
||||
if(sp[0]==did) {
|
||||
if( nd[0] !== 'transparent') {
|
||||
t.find(".ultimate-colorpicker").val(nd[0]).trigger('change');
|
||||
//t.find("a.wp-color-result").css({"background-color": nd[0]});
|
||||
// set alpha value
|
||||
var picker = $.cs_ParseColorValue( nd[0] );
|
||||
var sl_value = parseFloat( picker.alpha / 100 );
|
||||
var alpha_val = sl_value < 1 ? sl_value : '';
|
||||
t.find('.cs-alpha-text').text( alpha_val );
|
||||
// drag position
|
||||
if(alpha_val == '') {
|
||||
t.find('.cs-alpha-slider .ui-slider-handle').css('left', '100%');
|
||||
} else {
|
||||
alpha_val = parseFloat(alpha_val * 100);
|
||||
t.find('.cs-alpha-slider .ui-slider-handle').css('left', alpha_val+'%');
|
||||
}
|
||||
t.find('.wp-picker-container').find('.cs-alpha-slider-offset').css('background-color', nd[0]);
|
||||
t.find('.iris-strip').css('background-image', '-webkit-linear-gradient(top, '+nd[0]+', rgb(197, 197, 197))');
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
update_visibility(t);
|
||||
t.find(".ultimate-border-inputs").each(function(input_index, elem) {
|
||||
var d = $(elem).attr("data-default");
|
||||
$(elem).val(d);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// [2] On change - input / select
|
||||
$(".ultimate-border-input, .ultimate-border-style-selector, .ultimate-colorpicker").on('change', function(e){
|
||||
var t = $(this).closest('.ultimate-border');
|
||||
var v = t.find('.ultimate-border-value').val();
|
||||
|
||||
update_visibility(t);
|
||||
set_hidden_with_border_style(t);
|
||||
});
|
||||
|
||||
function set_hidden_with_border_style(t, hxcolor) {
|
||||
var nval = "";
|
||||
var l = t.find(".ultimate-border-style-selector").length;
|
||||
// check border style is avai. then add border style
|
||||
if(l) {
|
||||
var sv = t.find(".ultimate-border-style-selector option:selected").val();
|
||||
t.find(".ultimate-border-value").val(nval);
|
||||
var nval = "border-style:" +sv+ ";|";
|
||||
}
|
||||
|
||||
// border
|
||||
var wd = t.find('.ultb-width-all').attr('data-status') || 'hide-all';
|
||||
var border = '';
|
||||
if( wd === 'hide-all' ) {
|
||||
border = 'ultb-width-all'; }
|
||||
else {
|
||||
border = 'ultb-width-single';
|
||||
}
|
||||
t.find('.'+border+' .ultimate-border-input').each(function(index, elm) {
|
||||
var unit = t.find(".ult-unit-border-width option:selected").val() || t.find(".ultimate-border-value").attr("data-unit");
|
||||
var ival = $(elm).val();
|
||||
if ($.isNumeric(ival)) {
|
||||
if (ival.match(/^[0-9]+$/))
|
||||
var item = $(elm).attr("data-id") + ":" + $(elm).val() + unit + ";";
|
||||
nval += item;
|
||||
}
|
||||
});
|
||||
|
||||
// radius
|
||||
var rd = t.find('.ultb-radius-all').attr('data-status') || 'hide-all';
|
||||
var radius = '';
|
||||
if( rd === 'hide-all' ) {
|
||||
radius = 'ultb-radius-all'; }
|
||||
else {
|
||||
radius = 'ultb-radius-single';
|
||||
}
|
||||
t.find('.'+radius+' .ultimate-border-input').each(function(index, elm) {
|
||||
var unit = t.find(".ult-unit-border-radius option:selected").val() || t.find(".ultimate-border-value").attr("data-unit");
|
||||
var ival = $(elm).val();
|
||||
if ($.isNumeric(ival)) {
|
||||
if (ival.match(/^[0-9]+$/))
|
||||
var item = $(elm).attr("data-id") + ":" + $(elm).val() + unit + ";";
|
||||
nval += item;
|
||||
}
|
||||
});
|
||||
|
||||
// colors
|
||||
if(typeof hxcolor != "undefined" || hxcolor != null) {
|
||||
var nval = nval + "|border-color:" +hxcolor+ ";";
|
||||
} else {
|
||||
var va = t.find(".ultimate-colorpicker").val();
|
||||
if(va!='') {
|
||||
var nval = nval + "|border-color:" +va+ ";";
|
||||
}
|
||||
}
|
||||
t.find(".ultimate-border-value").val(nval);
|
||||
}
|
||||
|
||||
}(jQuery, window));
|
||||
@@ -0,0 +1,236 @@
|
||||
|
||||
/**
|
||||
* Callback function for the 'click' event of the 'Set Footer Image'
|
||||
* anchor in its meta box.
|
||||
*
|
||||
* Displays the media uploader for selecting an image.
|
||||
*
|
||||
* @since 0.1.0
|
||||
*/
|
||||
|
||||
;(function ( $, window, undefined ) {
|
||||
|
||||
/* = Image Up loader
|
||||
*-------------------------------------------------*/
|
||||
var pn = 'ULT_Image_Single',
|
||||
document = window.document,
|
||||
defaults = {
|
||||
add: ".ult_add_image",
|
||||
remove: "#remove-thumbnail",
|
||||
};
|
||||
|
||||
function ult( element, options ) {
|
||||
this.element = element;
|
||||
this.options = $.extend( {}, defaults, options) ;
|
||||
this._defaults = defaults;
|
||||
this._name = pn;
|
||||
this.init();
|
||||
}
|
||||
|
||||
ult.prototype.save_and_show_image = function(id, url, caption, alt, title, description) {
|
||||
var $t = $(this.element);
|
||||
|
||||
$t.find( '.ult_selected_image_list .inner' )
|
||||
.children( 'img' )
|
||||
.attr( 'src', url )
|
||||
.attr( 'alt', caption )
|
||||
.show()
|
||||
.parent()
|
||||
.removeClass( 'hidden' );
|
||||
var string = '';
|
||||
string += (id != '') ? 'id^'+id+'|' : '';
|
||||
string += (url != '') ? 'url^'+url+'|' : '';
|
||||
string += (caption != '') ? 'caption^'+caption+'|' : '';
|
||||
string += (alt != '') ? 'alt^'+alt+'|' : '';
|
||||
string += (title != '') ? 'title^'+title+'|' : '';
|
||||
string += (description != '') ? 'description^'+description+'|' : '';
|
||||
|
||||
if(string.substr(-1) === '|') {
|
||||
string = string.substr(0, string.length - 1);
|
||||
}
|
||||
|
||||
$t.find('.ult-image_single-value').val(string);
|
||||
// show image
|
||||
$t.find( '.ult_selected_image' ).show();
|
||||
};
|
||||
|
||||
/* = {start} wp media uploader
|
||||
*------------------------------------------------------------------------*/
|
||||
ult.prototype.renderMediaUploader = function() {
|
||||
'use strict';
|
||||
|
||||
var fn, image_data, json;
|
||||
var self = this;
|
||||
if ( undefined !== fn ) {
|
||||
fn.open();
|
||||
return;
|
||||
}
|
||||
|
||||
fn = wp.media({
|
||||
title: 'Select or Upload Image',
|
||||
button: {
|
||||
text: 'Use this image'
|
||||
},
|
||||
library: { type : 'image' },
|
||||
multiple: false // Set to true to allow multiple files to be selected
|
||||
});
|
||||
|
||||
// Insert from {SELECT}
|
||||
fn.on( 'select', function() {
|
||||
|
||||
// console.log(wp.media.string);
|
||||
|
||||
// Read the JSON data returned from the Media Uploader
|
||||
json = fn.state().get( 'selection' ).first().toJSON();
|
||||
|
||||
if ( 0 > $.trim( json.url.length ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// {save} image - id & src - for {SELECT}
|
||||
var id = json.id || null;
|
||||
var url = json.url || null;
|
||||
var caption = json.caption || null;
|
||||
var alt = json.alt || null;
|
||||
var title = json.title || null;
|
||||
var description = json.description || null;
|
||||
self.save_and_show_image(id, url, caption, alt, title, description);
|
||||
});
|
||||
|
||||
// Insert from {URL}
|
||||
fn.state('embed').on( 'select', function() {
|
||||
var state = fn.state(),
|
||||
type = state.get('type'),
|
||||
embed = state.props.toJSON();
|
||||
|
||||
// {save} image - id & src - for {INSERT FROM URL}
|
||||
var id = null;
|
||||
var caption = embed.caption || null;
|
||||
var url = embed.url || null;
|
||||
var alt = embed.alt || null;
|
||||
var title = embed.title || null;
|
||||
var description = embed.description || null;
|
||||
self.save_and_show_image(id, url, caption, alt, title, description);
|
||||
});
|
||||
|
||||
// Now display the actual fn
|
||||
fn.open();
|
||||
};
|
||||
|
||||
ult.prototype.resetUploadForm = function () {
|
||||
var $t = $(this.element);
|
||||
$t.find( '.ult_selected_image' ).hide();
|
||||
// {Remove} image - ID & SRC
|
||||
$t.find('.ult-image_single-value').val('');
|
||||
//$t.find('.ult-image_single-value').val('null|null');
|
||||
};
|
||||
|
||||
ult.prototype.renderFeaturedImage = function ( ) {
|
||||
var $t = $(this.element);
|
||||
|
||||
var v = $t.find( '.ult-image_single-value' ).val();
|
||||
if ( '' !== $.trim ( v ) ) {
|
||||
|
||||
var tm = v.split('|');
|
||||
|
||||
var id, url, title, alt, description, caption, old_id, old_url;
|
||||
old_id = tm[0];
|
||||
old_url = tm[1];
|
||||
|
||||
jQuery.each(tm, function(i,tmv){
|
||||
if(stripos(tmv, '^') !== false) {
|
||||
var tmva = tmv.split('|');
|
||||
if( Object.prototype.toString.call( tmva ) == '[object Array]' ) {
|
||||
jQuery.each(tmva, function(j,tmvav){
|
||||
var tmvav_array = tmvav.split('^');
|
||||
eval(tmvav_array[0]+' = "'+tmvav_array[1]+'"');
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
id = old_id;
|
||||
url = old_url;
|
||||
}
|
||||
});
|
||||
|
||||
// var url = url.split('|');
|
||||
if(typeof url != 'undefined' ) {
|
||||
if( url.indexOf('url:') != -1 ) {
|
||||
url = url.split("url:").pop();
|
||||
}
|
||||
if( url.indexOf('url^') != -1 ) {
|
||||
url = url.split("url^").pop();
|
||||
}
|
||||
}
|
||||
|
||||
// Saved Image - ID
|
||||
if( typeof id != 'undefined' && id != 'null' ) {
|
||||
|
||||
if( !url ) {
|
||||
// set process
|
||||
$t.find( '.spinner.ult_img_single_spinner').css('visibility', 'visible');
|
||||
var data = {
|
||||
action : 'ult_get_attachment_url',
|
||||
attach_id : parseInt(id),
|
||||
security: uavc.ult_get_attachment_url
|
||||
}
|
||||
$.post(ajaxurl, data, function(img_url) {
|
||||
$t.find( '.spinner.ult_img_single_spinner').css('visibility', 'hidden');
|
||||
$t.find( '.ult_selected_image_list .inner' ).children( 'img' ).attr('src', img_url );
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Saved Image - SRC
|
||||
if( typeof url != 'undefined' && url != 'null' ) {
|
||||
$t.find( '.ult_selected_image_list .inner' ).children( 'img' ).attr('src', url );
|
||||
$t.find( '.ult_selected_image' ).show();
|
||||
} else {
|
||||
$t.find( '.ult_selected_image' ).hide();
|
||||
}
|
||||
} else {
|
||||
|
||||
$t.find( '.ult_selected_image' ).hide();
|
||||
// {Default} image - ID & SRC
|
||||
$t.find('.ult-image_single-value').val('');
|
||||
//$t.find('.ult-image_single-value').val('null|null');
|
||||
}
|
||||
};
|
||||
/* = {end} wp media uploader
|
||||
*------------------------------------------------------------------------*/
|
||||
|
||||
ult.prototype.init = function () {
|
||||
var self = this;
|
||||
var i = self._defaults;
|
||||
var $t = $(self.element);
|
||||
|
||||
self.renderFeaturedImage( );
|
||||
// add image
|
||||
$t.find(i.add).click(function(event) {
|
||||
// Stop the anchor's default behavior
|
||||
event.preventDefault();
|
||||
self.renderMediaUploader();
|
||||
});
|
||||
|
||||
// remove image
|
||||
$t.find(i.remove).click(function(event) {
|
||||
event.preventDefault();
|
||||
self.resetUploadForm( );
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
$.fn[pn] = function ( options ) {
|
||||
return this.each(function () {
|
||||
if (!$.data(this, 'plugin_' + pn)) {
|
||||
$.data(this, 'plugin_' + pn, new ult( this, options ));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// initial call
|
||||
$(document).ready(function() {
|
||||
$('.ult-image_single').ULT_Image_Single();
|
||||
});
|
||||
|
||||
}(jQuery, window));
|
||||
@@ -0,0 +1,110 @@
|
||||
// JavaScript Document
|
||||
$ult = jQuery.noConflict();
|
||||
|
||||
$ult(".ultimate-responsive-wrapper").each(function(index, element) {
|
||||
var t = $ult(element);
|
||||
get_responsive_values_in_input(t);
|
||||
set_responsive_values_in_hidden(t);
|
||||
});
|
||||
|
||||
/*
|
||||
* Get hidden field values
|
||||
*---------------------------------------------------*/
|
||||
function get_responsive_values_in_input(t) {
|
||||
var mv = t.find(".ultimate-responsive-value").val();
|
||||
|
||||
/* TOGGLE */
|
||||
var toggleMedia = new Object();
|
||||
|
||||
if (mv != "") {
|
||||
var vals = mv.split(";");
|
||||
$ult.each(vals, function(i, vl) {
|
||||
if (vl != "") {
|
||||
t.find(".ult-responsive-input").each(function(input_index, elem) {
|
||||
var splitval = vl.split(":");
|
||||
var dataid = $ult(elem).attr("data-id");
|
||||
|
||||
if( dataid==splitval[0] ) {
|
||||
var unit = $ult(elem).attr("data-unit");
|
||||
mval = splitval[1].split(unit);
|
||||
$ult(elem).val(mval[0]);
|
||||
|
||||
/* TOGGLE */
|
||||
toggleMedia[dataid] = mval[0];
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
/* TOGGLE */
|
||||
Object.size = function(obj) {
|
||||
var size = 0, key;
|
||||
for (key in obj) {
|
||||
if (obj.hasOwnProperty(key)) size++;
|
||||
}
|
||||
return size;
|
||||
};
|
||||
var size = Object.size(toggleMedia);
|
||||
if(size>=2) { // set toggle data attributes
|
||||
t.find('.simplify').attr('ult-toggle', 'expand');
|
||||
t.find('.ult-responsive-item.optional, .ultimate-unit-section').show();
|
||||
} else {
|
||||
t.find('.simplify').attr('ult-toggle', 'collapse');
|
||||
t.find('.ult-responsive-item.optional, .ultimate-unit-section').hide();
|
||||
}
|
||||
} else {
|
||||
var i=0; // set default - Values
|
||||
t.find(".ult-responsive-input").each(function(input_index, elem) {
|
||||
var d = $ult(elem).attr("data-default");
|
||||
if(d!='') { $ult(elem).val(d); i=i+1; }
|
||||
});
|
||||
if(i<=1) { // set default - Collapse
|
||||
t.find('.simplify').attr('ult-toggle', 'collapse');
|
||||
t.find('.ult-responsive-item.optional, .ultimate-unit-section').hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* TOGGLE CLICK */
|
||||
$ult(".simplify").on('click', function(e){
|
||||
var t = $ult(this).closest('.ultimate-responsive-wrapper'),
|
||||
status = $ult(this).attr('ult-toggle');
|
||||
switch(status) {
|
||||
case 'expand': t.find('.simplify').attr('ult-toggle', 'collapse');
|
||||
t.find('.ult-responsive-item.optional, .ultimate-unit-section').hide();
|
||||
break;
|
||||
case 'collapse': t.find('.simplify').attr('ult-toggle', 'expand');
|
||||
t.find('.ult-responsive-item.optional, .ultimate-unit-section').show();
|
||||
break;
|
||||
default: t.find('.simplify').attr('ult-toggle', 'collapse');
|
||||
t.find('.ult-responsive-item.optional, .ultimate-unit-section').hide();
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
* Set hidden field values
|
||||
*---------------------------------------------------*/
|
||||
// On change - input / select
|
||||
$ult(".ult-responsive-input").on('change', function(e){
|
||||
var t = $ult(this).closest('.ultimate-responsive-wrapper');
|
||||
//alert(t.attr("id"));
|
||||
set_responsive_values_in_hidden(t);
|
||||
});
|
||||
|
||||
function set_responsive_values_in_hidden(t) {
|
||||
var nval = "";
|
||||
|
||||
// add all spacing widths, margins, paddings
|
||||
t.find(".ult-responsive-input").each(function(index, elm) {
|
||||
var unit = $ult(elm).attr("data-unit");
|
||||
|
||||
var ival = $ult(elm).val();
|
||||
if ($ult.isNumeric(ival)) {
|
||||
if (ival.match(/^[0-9]+$/))
|
||||
var item = $ult(elm).attr("data-id") + ":" + $ult(elm).val() + unit + ";";
|
||||
nval += item;
|
||||
}
|
||||
});
|
||||
t.find(".ultimate-responsive-value").val(nval);
|
||||
}
|
||||
@@ -0,0 +1,198 @@
|
||||
;(function ( $, window, undefined ) {
|
||||
|
||||
function update_inputs(t) {
|
||||
var status = t.find('.ult-spacing-all').attr('data-status');
|
||||
var unit = t.find(".ult-unit-spacing option:selected").val();
|
||||
|
||||
if( status === 'hide-me') {
|
||||
// Add {single} input values
|
||||
var vals = '';
|
||||
t.find('.ult-spacing-single .ultimate-spacing-input').each(function(index, el) {
|
||||
var spacing_type = $(el).attr('data-id') || '';
|
||||
var val = $(el).val() || '';
|
||||
if ($.isNumeric(val)) {
|
||||
vals += spacing_type+':'+val+unit+';';
|
||||
}
|
||||
});
|
||||
t.find(".ultimate-spacing-value").val(vals);
|
||||
|
||||
} else {
|
||||
|
||||
// Add {all} spacing values
|
||||
var vals = '';
|
||||
var alls = t.find('.ult-spacing-all .ultimate-spacing-input');
|
||||
var spacing_type = alls.attr('data-id') || '';
|
||||
|
||||
var val = alls.val() || '';
|
||||
if ($.isNumeric(val)) {
|
||||
vals += spacing_type+':'+val+unit+';';
|
||||
}
|
||||
t.find(".ultimate-spacing-value").val(vals);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* Toggle inputs */
|
||||
function toggle_update_inputs(t) {
|
||||
t.find('.ult-spacing-expand').toggleClass('ult-spacing-expand-section');
|
||||
|
||||
var status = t.find('.ult-spacing-all').attr('data-status');
|
||||
var unit = t.find(".ult-unit-spacing option:selected").val();
|
||||
|
||||
if( status === 'hide-all') {
|
||||
t.find('.ult-spacing-all').hide();
|
||||
t.find('.ult-spacing-single').show();
|
||||
t.find('.ult-spacing-all').attr('data-status', 'hide-me');
|
||||
|
||||
// Add {single} input values
|
||||
var vals = '';
|
||||
t.find('.ult-spacing-single .ultimate-spacing-input').each(function(index, el) {
|
||||
var spacing_type = $(el).attr('data-id') || '';
|
||||
var val = $(el).val() || '';
|
||||
if ($.isNumeric(val)) {
|
||||
vals += spacing_type+':'+val+unit+';';
|
||||
}
|
||||
});
|
||||
t.find(".ultimate-spacing-value").val(vals);
|
||||
} else {
|
||||
t.find('.ult-spacing-all').show();
|
||||
t.find('.ult-spacing-single').hide();
|
||||
t.find('.ult-spacing-all').attr('data-status', 'hide-all');
|
||||
|
||||
// Add {all} spacing values
|
||||
var vals = '';
|
||||
var alls = t.find('.ult-spacing-all .ultimate-spacing-input');
|
||||
var spacing_type = alls.attr('data-id') || '';
|
||||
|
||||
var val = alls.val() || '';
|
||||
if ($.isNumeric(val)) {
|
||||
vals += spacing_type+':'+val+unit+';';
|
||||
}
|
||||
t.find(".ultimate-spacing-value").val(vals);
|
||||
}
|
||||
}
|
||||
|
||||
$(".ultimate-spacing").each(function(index, element) {
|
||||
var t = $(element);
|
||||
get_values_from_hidden_field(t);
|
||||
set_values_from_hidden_field(t);
|
||||
});
|
||||
|
||||
function get_values_from_hidden_field(t) {
|
||||
var mv = t.find(".ultimate-spacing-value").val() || null;
|
||||
|
||||
if( typeof mv != 'undefined' && mv != null ) {
|
||||
var vals = mv.split(";");
|
||||
$.each(vals, function(i, vl) {
|
||||
if (vl != "") {
|
||||
t.find(".ultimate-spacing-inputs").each(function(input_index, elem) {
|
||||
var splitval = vl.split(":");
|
||||
var dataid = $(elem).attr("data-id");
|
||||
if( dataid==splitval[0] ) {
|
||||
|
||||
var tmp = splitval[1].match(/\d+/);
|
||||
var b = splitval[1].split(tmp);
|
||||
var unit = 'px';
|
||||
if(typeof b[1] != 'undefined' && b[1] != null) {
|
||||
unit = b[1];
|
||||
}
|
||||
t.find(".ult-unit-spacing").val(unit); // set border select unit
|
||||
|
||||
//var unit = $(elem).attr("data-unit");
|
||||
mval = splitval[1].split(unit);
|
||||
$(elem).val(mval[0]);
|
||||
}
|
||||
|
||||
// Toggle Inputs
|
||||
if( splitval[0] === 'margin' || splitval[0] === 'padding' ) {
|
||||
t.find('.ult-spacing-all').show();
|
||||
t.find('.ult-spacing-single').hide();
|
||||
t.find('.ult-spacing-all').attr('data-status', 'hide-all');
|
||||
t.find('.ult-spacing-expand').toggleClass('ult-spacing-expand-section');
|
||||
} else {
|
||||
t.find('.ult-spacing-all').hide();
|
||||
t.find('.ult-spacing-single').show();
|
||||
t.find('.ult-spacing-all').attr('data-status', 'hide-me');
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
//// Here, Doen't have any save values. So,
|
||||
//// Hide all
|
||||
t.find('.ult-spacing-single').hide();
|
||||
|
||||
t.find('.ult-spacing-expand').toggleClass('ult-spacing-expand-section');
|
||||
|
||||
//// Add defaults to input
|
||||
t.find(".ultimate-spacing-inputs").each(function(input_index, elem) {
|
||||
var d = $(elem).attr("data-default");
|
||||
$(elem).val(d);
|
||||
});
|
||||
|
||||
// Add to hidden
|
||||
var unit = t.find(".ultimate-spacing-value").attr('data-unit') || 'px';
|
||||
t.find(".ult-unit-spacing").val(unit);
|
||||
var nval = '';
|
||||
//var unit = t.find(".ult-unit-spacing option:selected").val();
|
||||
t.find('.ult-spacing-single .ultimate-spacing-input').each(function(index, elm) {
|
||||
var ival = $(elm).val();
|
||||
if ($.isNumeric(ival)) {
|
||||
var item = $(elm).attr("data-id") + ":" + $(elm).val() + unit + ";";
|
||||
nval += item;
|
||||
}
|
||||
});
|
||||
t.find(".ultimate-spacing-value").val(nval);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function set_values_from_hidden_field(t) {
|
||||
|
||||
// 1. Expand / Collapse
|
||||
t.find('.ult-spacing-expand').click(function(event) {
|
||||
toggle_update_inputs(t);
|
||||
});
|
||||
|
||||
// 2. Unit change
|
||||
t.find('.ult-unit-spacing').change(function() {
|
||||
update_inputs(t);
|
||||
});
|
||||
|
||||
|
||||
|
||||
// Single
|
||||
t.find('.ult-spacing-single .ultimate-spacing-input').on('change', function(e){
|
||||
var nval = "";
|
||||
// add all spacing widths, margins, paddings
|
||||
t.find('.ult-spacing-single .ultimate-spacing-input').each(function(index, elm) {
|
||||
var ival = $(elm).val();
|
||||
var unit = t.find(".ult-unit-spacing option:selected").val();
|
||||
if ($.isNumeric(ival)) {
|
||||
var item = $(elm).attr("data-id") + ":" + $(elm).val() + unit + ";";
|
||||
nval += item;
|
||||
}
|
||||
});
|
||||
t.find(".ultimate-spacing-value").val(nval);
|
||||
});
|
||||
|
||||
// All
|
||||
t.find('.ult-spacing-all .ultimate-spacing-input').on('change', function(e){
|
||||
var nval = "";
|
||||
// add all spacing widths, margins, paddings
|
||||
t.find('.ult-spacing-all .ultimate-spacing-input').each(function(index, elm) {
|
||||
var ival = $(elm).val();
|
||||
var unit = t.find(".ult-unit-spacing option:selected").val();
|
||||
if ($.isNumeric(ival)) {
|
||||
var item = $(elm).attr("data-id") + ":" + $(elm).val() + unit + ";";
|
||||
nval += item;
|
||||
}
|
||||
});
|
||||
t.find(".ultimate-spacing-value").val(nval);
|
||||
});
|
||||
}
|
||||
|
||||
}(jQuery, window));
|
||||
@@ -0,0 +1,185 @@
|
||||
/* Transparent - Color Picker */
|
||||
!function(r,a,e,o){"use strict";typeof Color.fn.toString!==o&&(Color.fn.toString=function(){if(this._alpha<1)return this.toCSS("rgba",this._alpha).replace(/\s+/g,"");var r=parseInt(this._color,10).toString(16);if(this.error)return"";if(r.length<6)for(var a=6-r.length-1;a>=0;a--)r="0"+r;return"#"+r}),r.cs_ParseColorValue=function(r){var a=r.replace(/\s+/g,""),e=-1!==a.indexOf("rgba")?parseFloat(100*a.replace(/^.*,(.+)\)/,"$1")):100,o=100>e?!0:!1;return{value:a,alpha:e,rgba:o}},r.fn.cs_wpColorPicker=function(){return this.each(function(){var a=r(this);if(a.data("rgba")!==!1){var e=r.cs_ParseColorValue(a.val());a.wpColorPicker({clear:function(){a.trigger("keyup")},change:function(r,e){var o=e.color.toString();a.closest(".wp-picker-container").find(".cs-alpha-slider-offset").css("background-color",o),a.val(o).trigger("change")},create:function(){var o=a.data("a8cIris"),c=a.closest(".wp-picker-container"),l=r('<div class="cs-alpha-wrap"><div class="cs-alpha-slider"></div><div class="cs-alpha-slider-offset"></div><div class="cs-alpha-text"></div></div>').appendTo(c.find(".wp-picker-holder")),i=l.find(".cs-alpha-slider"),t=l.find(".cs-alpha-text"),n=l.find(".cs-alpha-slider-offset");i.slider({slide:function(r,e){var c=parseFloat(e.value/100);o._color._alpha=c,a.wpColorPicker("color",o._color.toString()),t.text(1>c?c:"")},create:function(){var s=parseFloat(e.alpha/100),p=1>s?s:"";t.text(p),n.css("background-color",e.value),c.on("click",".wp-picker-clear",function(){o._color._alpha=1,t.text(""),i.slider("option","value",100).trigger("slide")}),c.on("click",".wp-picker-default",function(){var e=r.cs_ParseColorValue(a.data("default-color")),c=parseFloat(e.alpha/100),l=1>c?c:"";o._color._alpha=c,t.text(l),i.slider("option","value",e.alpha).trigger("slide")}),c.on("click",".wp-color-result",function(){l.toggle()}),r("body").on("click.wpcolorpicker",function(){l.hide()})},value:e.alpha,step:1,min:1,max:100})}})}else a.wpColorPicker({clear:function(){a.trigger("keyup")},change:function(r,e){a.val(e.color.toString()).trigger("change")}})})},r(e).ready(function(){r(".cs-wp-color-picker").cs_wpColorPicker()})}(jQuery,window,document);
|
||||
|
||||
/* Get alpha values */
|
||||
;(function ( $, window, undefined ) {
|
||||
$.cs_ParseColorValue = function( val ) {
|
||||
var value = val.replace(/\s+/g, ''),
|
||||
alpha = ( value.indexOf('rgba') !== -1 ) ? parseFloat( value.replace(/^.*,(.+)\)/, '$1') * 100 ) : 100,
|
||||
rgba = ( alpha < 100 ) ? true : false;
|
||||
return { value: value, alpha: alpha, rgba: rgba };
|
||||
};
|
||||
}(jQuery, window));
|
||||
|
||||
/*
|
||||
* Project: Box Shadow
|
||||
* Description: Ultimate Box Shadow for WPBakery Page Builder
|
||||
* Author: BrainStorm Force
|
||||
* License:
|
||||
*/
|
||||
;(function ( $, window, undefined ) {
|
||||
|
||||
function get_values_from_hidden_field(t) {
|
||||
var mv = t.find(".ultbs-result-value").val() || null;
|
||||
if (mv != null) {
|
||||
var vals = mv.split("|");
|
||||
$.each(vals, function(i, vl) {
|
||||
if (vl != '') {
|
||||
var splitval = vl.split(":");
|
||||
|
||||
switch(splitval[0]) {
|
||||
case 'color': if(splitval[1]!='transparent') {
|
||||
t.find('.ultbs-colorpicker').val(splitval[1]).trigger('change');
|
||||
// set alpha value
|
||||
var picker = $.cs_ParseColorValue( splitval[1] );
|
||||
var sl_value = parseFloat( picker.alpha / 100 );
|
||||
var alpha_val = sl_value < 1 ? sl_value : '';
|
||||
t.find('.cs-alpha-text').text( alpha_val );
|
||||
// drag position
|
||||
if(alpha_val == '') {
|
||||
t.find('.cs-alpha-slider .ui-slider-handle').css('left', '100%');
|
||||
} else {
|
||||
alpha_val = parseFloat(alpha_val * 100);
|
||||
t.find('.cs-alpha-slider .ui-slider-handle').css('left', alpha_val+'%');
|
||||
}
|
||||
t.find('.wp-picker-container').find('.cs-alpha-slider-offset').css('background-color', splitval[1]);
|
||||
t.find('.iris-strip').css('background-image', '-webkit-linear-gradient(top, '+splitval[1]+', rgb(197, 197, 197))');
|
||||
}
|
||||
break;
|
||||
case 'style': t.find(".ultbs-select").find("option[value=" + splitval[1] + "]").attr("selected", true);
|
||||
if(splitval[1]==='none' || splitval[1]==='inherit' ) {
|
||||
t.find('.ultbs-input-block, .ultbs-colorpicker-block').hide();
|
||||
// Remove box shadow color - required color - param name "box_shadow_color"
|
||||
/*var c = t.closest('.vc_shortcode-param').attr('data-param_name') || null;
|
||||
if( typeof c != 'undefined' && c != null ) {
|
||||
$('.'+c+'
|
||||
').hide();
|
||||
}*/
|
||||
}
|
||||
break;
|
||||
default:
|
||||
t.find('.ultbs-input').each(function(input_index, elem) {
|
||||
var dataid = $(elem).attr("data-id");
|
||||
if( dataid==splitval[0] ) {
|
||||
var unit = $(elem).attr("data-unit");
|
||||
mval = splitval[1].split(unit);
|
||||
$(elem).val(mval[0]);
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
var s = t.find('.ultbs-select option:selected').val();
|
||||
if( s==='none' || s==='inherit' ) {
|
||||
t.find('.ultbs-input-block, .ultbs-colorpicker-block').hide();
|
||||
// Remove box shadow color - required color - param name "box_shadow_color"
|
||||
/*var c = t.closest('.vc_shortcode-param').attr('data-param_name') || null;
|
||||
if( typeof c != 'undefined' && c != null ) {
|
||||
$('.'+c+'_ultimate_box_shadow_color').hide();
|
||||
}*/
|
||||
}
|
||||
/*t.find(".ultimate-spacing-inputs").each(function(input_index, elem) {
|
||||
var d = $(elem).attr("data-default");
|
||||
$(elem).val(d);
|
||||
});*/
|
||||
}
|
||||
}
|
||||
function set_values_from_hidden_field(t, hxcolor) {
|
||||
var nval = "";
|
||||
// Set Inputs
|
||||
t.find(".ultbs-input").each(function(index, elm) {
|
||||
var unit = t.find(".ultbs-result-value").attr("data-unit");
|
||||
var ival = $(elm).val();
|
||||
//if ($.isNumeric(ival)) {
|
||||
//if (ival.match(/^[0-9]+$/))
|
||||
var item = $(elm).attr("data-id") + ":" + $(elm).val() + unit + "|";
|
||||
nval += item;
|
||||
//}
|
||||
});
|
||||
|
||||
// Set Color
|
||||
if(typeof hxcolor != 'undefined' || hxcolor != null) {
|
||||
var nval = nval + 'color:' +hxcolor+ '|';
|
||||
} else {
|
||||
var va = t.find('.ultbs-colorpicker').val() || t.find('a.wp-color-result').css('background-color') || '';
|
||||
if(va!='') {
|
||||
var nval = nval + "color:" +va+ "|";
|
||||
}
|
||||
}
|
||||
|
||||
// Selected Shadow Type - inset, initial, inherit
|
||||
var sv = t.find(".ultbs-select option:selected").val() || '';
|
||||
if(typeof sv != 'undefined' && sv != '') {
|
||||
var nval = nval + "style:" +sv+ "|";
|
||||
}
|
||||
t.find(".ultbs-result-value").val(nval);
|
||||
}
|
||||
$(document).ready(function($) {
|
||||
$(".ultimate-boxshadow").each(function(index, element) {
|
||||
var t = $(element);
|
||||
|
||||
// Add dependency for none box shadow'
|
||||
t.find('.ultbs-select').change(function(event) {
|
||||
var s = $(this).val();
|
||||
|
||||
if(typeof s != 'undefined' && s != null) {
|
||||
if( s==='none' || s==='inherit' ) {
|
||||
|
||||
t.find('.ultbs-input-block, .ultbs-colorpicker-block').hide();
|
||||
// Remove box shadow color - required color - param name "box_shadow_color"
|
||||
/*var c = t.closest('.vc_shortcode-param').attr('data-param_name') || null;
|
||||
if( typeof c != 'undefined' && c != null ) {
|
||||
$('.'+c+'_ultimate_box_shadow_color').hide();
|
||||
}*/
|
||||
} else {
|
||||
t.find('.ultbs-input-block').show();
|
||||
t.find('.ultbs-colorpicker-block').show();
|
||||
// Remove box shadow color - required color - param name "box_shadow_color"
|
||||
/*var c = t.closest('.vc_shortcode-param').attr('data-param_name') || null;
|
||||
if( typeof c != 'undefined' && c != null ) {
|
||||
$('.'+c+'_ultimate_box_shadow_color').show();
|
||||
}*/
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
get_values_from_hidden_field(t);
|
||||
set_values_from_hidden_field(t);
|
||||
|
||||
// On change - input / select
|
||||
t.find(".ultbs-input, .ultbs-select, .ultbs-colorpicker").on('change', function(e){
|
||||
set_values_from_hidden_field(t);
|
||||
});
|
||||
|
||||
// Color
|
||||
var options = {
|
||||
change: function(event, ui){
|
||||
var hxcolor = $( this ).wpColorPicker( 'color' );
|
||||
// set alpha value
|
||||
var picker = $.cs_ParseColorValue( hxcolor );
|
||||
var sl_value = parseFloat( picker.alpha / 100 );
|
||||
var alpha_val = sl_value < 1 ? sl_value : '';
|
||||
t.find('.cs-alpha-text').text( alpha_val );
|
||||
// drag position
|
||||
if(alpha_val == '') {
|
||||
t.find('.cs-alpha-slider .ui-slider-handle').css('left', '100%');
|
||||
} else {
|
||||
alpha_val = parseFloat(alpha_val * 100);
|
||||
t.find('.cs-alpha-slider .ui-slider-handle').css('left', alpha_val+'%');
|
||||
}
|
||||
t.find('.wp-picker-container').find('.cs-alpha-slider-offset').css('background-color', hxcolor);
|
||||
t.find('.iris-strip').css('background-image', '-webkit-linear-gradient(top, '+hxcolor+', rgb(197, 197, 197))');
|
||||
set_values_from_hidden_field(t, hxcolor);
|
||||
},
|
||||
clear: function (event, ui) {
|
||||
var hxcolor = 'transparent';
|
||||
set_values_from_hidden_field(t, hxcolor);
|
||||
},
|
||||
};
|
||||
t.find(".ultbs-colorpicker").wpColorPicker(options);
|
||||
|
||||
});
|
||||
});
|
||||
}(jQuery, window));
|
||||
@@ -0,0 +1,136 @@
|
||||
!function($) {
|
||||
$('.ultimate_google_font_param_block > select').each(function(index, element) {
|
||||
$select = $(this);
|
||||
var random_num = Math.floor((Math.random() * 10000000) + index);
|
||||
process_vc_gfont_fields($select, random_num, change = 'false');
|
||||
});
|
||||
$('.ultimate_google_font_param_block > select').change(function(e){
|
||||
e.preventDefault();
|
||||
var random_num = Math.floor((Math.random() * 10000000) + 1);
|
||||
process_vc_gfont_fields($(this), random_num , change = 'true');
|
||||
});
|
||||
$('body').on('click', '.ugfont-input', function () {
|
||||
var font_style = '';
|
||||
var temp_chk = 0;
|
||||
$fstyle = $(this).parent('.ultimate_fstyle').parent();
|
||||
var tmp_array = new Array();
|
||||
$fstyle.find('.ugfont-input').each(function (index, checkbox) {
|
||||
if ($(this).is(':checked')) {
|
||||
var val = $(this).val();
|
||||
tmp_array.push(val);
|
||||
}
|
||||
});
|
||||
var font_style = '';
|
||||
$.each(tmp_array,function (index, value) {
|
||||
if (index != 0) {
|
||||
font_style += ',';
|
||||
}
|
||||
font_style += value;
|
||||
});
|
||||
$fstyle.find('.ugfont-style-value').val(font_style);
|
||||
});
|
||||
$('body').on('click', '.style_by_google', function(){
|
||||
var variant = $(this).attr('data-variant');
|
||||
if($(this).is(':checked'))
|
||||
{
|
||||
var wpb_el_type_ultimate_google_fonts_style = $(this).parents('.wpb_el_type_ultimate_google_fonts_style');
|
||||
var wpb_el_type_ultimate_google_fonts = wpb_el_type_ultimate_google_fonts_style.prev();
|
||||
var vc_ultimate_google_font = wpb_el_type_ultimate_google_fonts.find('.vc-ultimate-google-font').val();
|
||||
var split_font = vc_ultimate_google_font.split('|'); //font_family=xyz|font_call=xyz:100,200
|
||||
var font_family = split_font[0]; //font_family=xyz
|
||||
var font_call = split_font[1]; //font_call=xyz
|
||||
var new_font = font_family+'|'+font_call+'|variant:'+variant;
|
||||
wpb_el_type_ultimate_google_fonts.find('.vc-ultimate-google-font').val(new_font);
|
||||
}
|
||||
});
|
||||
}(window.jQuery);
|
||||
var temp_count = 0;
|
||||
function process_vc_gfont_fields($select, random_num, is_font_change)
|
||||
{
|
||||
var ultimate_vc_gfonts_field = $select.parents('.wpb_el_type_ultimate_google_fonts');
|
||||
var vc_ultimate_google_font = ultimate_vc_gfonts_field.find('.vc-ultimate-google-font');
|
||||
var vc_ultimate_google_font_val = vc_ultimate_google_font.val();
|
||||
var val = '';
|
||||
if(is_font_change == 'false')
|
||||
{
|
||||
if(vc_ultimate_google_font_val != '')
|
||||
{
|
||||
var gfont_name_attr = vc_ultimate_google_font_val.split('|');
|
||||
var gfont_name = gfont_name_attr[0].split(':');
|
||||
val = gfont_name[1];
|
||||
if(val == '')
|
||||
val = 'default';
|
||||
}
|
||||
else
|
||||
val = 'default';
|
||||
|
||||
$select.find('option').each(function(index, option) {
|
||||
if(jQuery(option).val() == val)
|
||||
jQuery(option).attr('selected',true);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
var val = $select.find('option:selected').val();
|
||||
var new_font_call = val.replace(/\s+/g,'+');
|
||||
var new_font = 'font_family:'+val+'|font_call:'+new_font_call;
|
||||
vc_ultimate_google_font.val(new_font);
|
||||
}
|
||||
var $next_fstyler = ultimate_vc_gfonts_field.next('.wpb_el_type_ultimate_google_fonts_style').find('.ultimate_fstyle');
|
||||
if(typeof $next_fstyler != "undefined")
|
||||
{
|
||||
$next_fstyler.html('<span class="spinner" style="display:inline-block; float:left;margin:0;visibility:visible"></span>');
|
||||
var data = {
|
||||
action : 'get_font_variants',
|
||||
font_name : val,
|
||||
security: uavc.get_font_variants
|
||||
}
|
||||
jQuery.post(ajaxurl, data, function(response) {
|
||||
var current_style = '';
|
||||
if($next_fstyler.parent().find('.ugfont-style-value'))
|
||||
current_style = $next_fstyler.parent().find('.ugfont-style-value').val();
|
||||
var temp_array = new Array();
|
||||
var is_array = false;
|
||||
if (temp_array = split(',',current_style)) {
|
||||
is_array = true;
|
||||
}
|
||||
else {
|
||||
if(current_style != '')
|
||||
temp_array.push(current_style);
|
||||
}
|
||||
var html = temp_last_fgroup = '';
|
||||
var font_variant = jQuery.parseJSON(response);
|
||||
jQuery.each(font_variant, function (index, variant) {
|
||||
var flabel = variant.label;
|
||||
var fstyle = variant.style;
|
||||
var ftype = variant.type;
|
||||
var fgroup = variant.group+'-'+temp_count;
|
||||
var fclass = variant.class;
|
||||
var checked = '';
|
||||
if(temp_array.length != 0)
|
||||
{
|
||||
jQuery.each(temp_array, function (i,v) {
|
||||
if (v == fstyle && is_font_change == 'false')
|
||||
checked = 'checked';
|
||||
});
|
||||
}
|
||||
var label_style = 'font-family:\''+val+'\';'+fstyle;
|
||||
if (fgroup != temp_last_fgroup && temp_last_fgroup != '')
|
||||
{
|
||||
html += '<div style="height:6px"> </div>';
|
||||
if(ftype == 'radio')
|
||||
html += '<input type="radio" name="'+fgroup+'" data-variant="regular" style="width:auto; margin-left: 5px; margin-right: 2px;" id="uvc-default-font-'+fgroup+'" class="ugfont-input '+fclass+'" checked value="font-weight:normal;font-style:normal;" /> <label for="uvc-default-font-'+fgroup+'" style="font-family:\''+val+'\';font-style: normal;">Default</label> ';
|
||||
}
|
||||
var vl = val.replace(/\s+/g, '-').toLowerCase();
|
||||
var uid = vl +'-'+ random_num;
|
||||
uid += '-'+flabel+'-'+index;
|
||||
if(jQuery('#'+uid).length != 0)
|
||||
uid += '-'+$('#'+uid).length;
|
||||
html += '<input type="'+ftype+'" data-variant="'+flabel+'" name="'+fgroup+'" style="width:auto; margin-left: 5px; margin-right: 2px;" '+checked+' id="'+uid+'-'+fgroup+'" class="'+fclass+' '+flabel+' ugfont-input" value="'+fstyle+'" /> <label for="'+uid+'-'+fgroup+'" style="'+label_style+'">'+flabel+'</label> ';
|
||||
temp_last_fgroup = fgroup;
|
||||
});
|
||||
$next_fstyler.html(html);
|
||||
});
|
||||
temp_count++;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
// JavaScript Document
|
||||
$jvh = jQuery.noConflict();
|
||||
$jvh('.ultimate-margin-inputs').on('change', function(e){
|
||||
$umargin = $jvh(this).parent();
|
||||
var temp = '';
|
||||
$umargin.find('.ultimate-margin-inputs').each(function(input_index, input){
|
||||
var margin_parameter = $jvh(input).attr('data-hmargin');
|
||||
var input_value = $jvh(input).val();
|
||||
if(input_value != '')
|
||||
{
|
||||
if(input_value.match(/^[0-9]+$/))
|
||||
input_value += 'px';
|
||||
temp += 'margin-'+margin_parameter+':'+input_value+';';
|
||||
}
|
||||
});
|
||||
$umargin.find('.ultimate-margin-value').val(temp);
|
||||
});
|
||||
$jvh('.ultimate-margins').each(function(index, element){
|
||||
$umargin = $jvh(this);
|
||||
var ultimate_margin_value = $umargin.find('.ultimate-margin-value').val();
|
||||
if(ultimate_margin_value != '')
|
||||
{
|
||||
var vals = ultimate_margin_value.split(';');
|
||||
$jvh.each(vals, function(i,vl){
|
||||
if(vl != '')
|
||||
{
|
||||
var splitval = vl.split(':');
|
||||
var margin_value = splitval[1];
|
||||
var param = splitval[0].split('-');
|
||||
var margin_parameter = param[1];
|
||||
$umargin.find('.ultimate-margin-inputs').each(function(input_index, input){
|
||||
var input_margin_parameter = $jvh(input).attr('data-hmargin');
|
||||
if(margin_parameter == input_margin_parameter)
|
||||
$jvh(input).val(margin_value);
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,35 @@
|
||||
!function($) {
|
||||
$(document).ready(function(){
|
||||
$('.wpb_el_type_ultimate_hotspot_param').each(function(i,p){
|
||||
var hlink = ULT_H_img_link;
|
||||
$img = $(p).find('.ult-hotspot-image');
|
||||
$img.attr('src', hlink);
|
||||
if(ULT_H_Size == 'main_img_custom')
|
||||
{
|
||||
$img.css({'width':ULT_H_custom_size+'px'});
|
||||
}
|
||||
});
|
||||
if(typeof $.fn.draggable !== 'undefined') {
|
||||
$(".ult-hotspot-draggable").draggable({
|
||||
containment: "parent",
|
||||
create: function( event, ui ) {
|
||||
var current_position = $(this).next('.ult-hotspot-positions').val();
|
||||
var positions = current_position.split(",");
|
||||
$(this).css({'top':positions[0]+'%'});
|
||||
if(typeof positions[1] != 'undefined')
|
||||
$(this).css({'left':positions[1]+'%'});
|
||||
},
|
||||
stop: function( event, ui ) {
|
||||
var current_position = '';
|
||||
var $img = $(this).prev('.ult-hotspot-image');
|
||||
var img_width = $img.width();
|
||||
var img_height = $img.height();
|
||||
var top = (ui.position.top/img_height)*100;
|
||||
var left = (ui.position.left/img_width)*100;
|
||||
current_position = top+','+left;
|
||||
$(this).next('.ult-hotspot-positions').val(current_position);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}(jQuery)
|
||||
Reference in new issue
Block a user