Initial Commit N° : 001 - V.4.3.3
This commit is contained in:
Vendored
+1
@@ -0,0 +1 @@
|
||||
(function(f,e){var a='<a tabindex="0" class="wp-color-result" />',c='<div class="wp-picker-holder" />',b='<div class="wp-picker-container" />',g='<input type="button" class="button button-small hidden" />';var d={options:{defaultColor:false,change:false,clear:false,hide:true,palettes:true},_create:function(){if(f.browser.msie&&parseInt(f.browser.version,10)<8){return}var h=this;var i=h.element;f.extend(h.options,i.data());h.initialValue=i.val();i.addClass("wp-color-picker").hide().wrap(b);h.wrap=i.parent();h.toggler=f(a).insertBefore(i).css({backgroundColor:h.initialValue}).attr("title",wpColorPickerL10n.pick).attr("data-current",wpColorPickerL10n.current);h.pickerContainer=f(c).insertAfter(i);h.button=f(g);if(h.options.defaultColor){h.button.addClass("wp-picker-default").val(wpColorPickerL10n.defaultString)}else{h.button.addClass("wp-picker-clear").val(wpColorPickerL10n.clear)}i.wrap('<span class="wp-picker-input-wrap" />').after(h.button);i.iris({target:h.pickerContainer,hide:true,width:255,mode:"hsv",palettes:h.options.palettes,change:function(j,k){h.toggler.css({backgroundColor:k.color.toString()});if(f.isFunction(h.options.change)){h.options.change.call(this,j,k)}}});i.val(h.initialValue);h._addListeners();if(!h.options.hide){h.toggler.click()}},_addListeners:function(){var h=this;h.toggler.click(function(i){i.stopPropagation();h.element.toggle().iris("toggle");h.button.toggleClass("hidden");h.toggler.toggleClass("wp-picker-open");if(h.toggler.hasClass("wp-picker-open")){f("body").on("click",{wrap:h.wrap,toggler:h.toggler},h._bodyListener)}else{f("body").off("click",h._bodyListener)}});h.element.change(function(j){var i=f(this),k=i.val();if(k===""||k==="#"){h.toggler.css("backgroundColor","");if(f.isFunction(h.options.clear)){h.options.clear.call(this,j)}}});h.toggler.on("keyup",function(i){if(i.keyCode===13||i.keyCode===32){i.preventDefault();h.toggler.trigger("click").next().focus()}});h.button.click(function(j){var i=f(this);if(i.hasClass("wp-picker-clear")){h.element.val("");h.toggler.css("backgroundColor","");if(f.isFunction(h.options.clear)){h.options.clear.call(this,j)}}else{if(i.hasClass("wp-picker-default")){h.element.val(h.options.defaultColor).change()}}})},_bodyListener:function(h){if(!h.data.wrap.find(h.target).length){h.data.toggler.click()}},color:function(h){if(h===e){return this.element.iris("option","color")}this.element.iris("option","color",h)},defaultColor:function(h){if(h===e){return this.options.defaultColor}this.options.defaultColor=h}};f.widget("wp.wpColorPicker",d)}(jQuery));
|
||||
@@ -0,0 +1 @@
|
||||
jQuery.cookie=function(key,value,options){if(arguments.length>1&&String(value)!=="[object Object]"){options=jQuery.extend({},options);if(value===null||value===undefined){options.expires=-1}if(typeof options.expires==='number'){var days=options.expires,t=options.expires=new Date();t.setDate(t.getDate()+days)}value=String(value);return(document.cookie=[encodeURIComponent(key),'=',options.raw?value:encodeURIComponent(value),options.expires?'; expires='+options.expires.toUTCString():'',options.path?'; path='+options.path:'',options.domain?'; domain='+options.domain:'',options.secure?'; secure':''].join(''))}options=value||{};var result,decode=options.raw?function(s){return s}:decodeURIComponent;return(result=new RegExp('(?:^|; )'+encodeURIComponent(key)+'=([^;]*)').exec(document.cookie))?decode(result[1]):null};
|
||||
Vendored
+4
File diff suppressed because one or more lines are too long
@@ -0,0 +1,252 @@
|
||||
/// <reference path="../../../lib/jquery-1.2.6.js" />
|
||||
/*
|
||||
Masked Input plugin for jQuery
|
||||
Copyright (c) 2007-2009 Josh Bush (digitalbush.com)
|
||||
Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license)
|
||||
Version: 1.2.2 (03/09/2009 22:39:06)
|
||||
*/
|
||||
(function($) {
|
||||
var pasteEventName = "input.mask";
|
||||
var iPhone = (window.orientation != undefined);
|
||||
|
||||
$.mask = {
|
||||
//Predefined character definitions
|
||||
definitions: {
|
||||
'9': "[0-9]",
|
||||
'a': "[A-Za-z]",
|
||||
'*': "[A-Za-z0-9]"
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.extend({
|
||||
//Helper Function for Caret positioning
|
||||
caret: function(begin, end) {
|
||||
if (this.length == 0) return;
|
||||
if (typeof begin == 'number') {
|
||||
end = (typeof end == 'number') ? end : begin;
|
||||
return this.each(function() {
|
||||
if (this.setSelectionRange) {
|
||||
this.focus();
|
||||
this.setSelectionRange(begin, end);
|
||||
} else if (this.createTextRange) {
|
||||
var range = this.createTextRange();
|
||||
range.collapse(true);
|
||||
range.moveEnd('character', end);
|
||||
range.moveStart('character', begin);
|
||||
range.select();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (this[0].setSelectionRange) {
|
||||
begin = this[0].selectionStart;
|
||||
end = this[0].selectionEnd;
|
||||
} else if (document.selection && document.selection.createRange) {
|
||||
var range = document.selection.createRange();
|
||||
begin = 0 - range.duplicate().moveStart('character', -100000);
|
||||
end = begin + range.text.length;
|
||||
}
|
||||
return { begin: begin, end: end };
|
||||
}
|
||||
},
|
||||
unmask: function() { return this.trigger("unmask"); },
|
||||
mask: function(mask, settings) {
|
||||
if (!mask && this.length > 0) {
|
||||
var input = $(this[0]);
|
||||
var tests = input.data("tests");
|
||||
return $.map(input.data("buffer"), function(c, i) {
|
||||
return tests[i] ? c : null;
|
||||
}).join('');
|
||||
}
|
||||
settings = $.extend({
|
||||
placeholder: "_",
|
||||
completed: null
|
||||
}, settings);
|
||||
|
||||
var defs = $.mask.definitions;
|
||||
var tests = [];
|
||||
var partialPosition = mask.length;
|
||||
var firstNonMaskPos = null;
|
||||
var len = mask.length;
|
||||
|
||||
$.each(mask.split(""), function(i, c) {
|
||||
if (c == '?') {
|
||||
len--;
|
||||
partialPosition = i;
|
||||
} else if (defs[c]) {
|
||||
tests.push(new RegExp(defs[c]));
|
||||
if(firstNonMaskPos==null)
|
||||
firstNonMaskPos = tests.length - 1;
|
||||
} else {
|
||||
tests.push(null);
|
||||
}
|
||||
});
|
||||
|
||||
return this.each(function() {
|
||||
var input = $(this);
|
||||
var buffer = $.map(mask.split(""), function(c, i) { if (c != '?') return defs[c] ? settings.placeholder : c });
|
||||
var ignore = false; //Variable for ignoring control keys
|
||||
var focusText = input.val();
|
||||
|
||||
input.data("buffer", buffer).data("tests", tests);
|
||||
|
||||
function seekNext(pos) {
|
||||
while (++pos <= len && !tests[pos]);
|
||||
return pos;
|
||||
};
|
||||
|
||||
function shiftL(pos) {
|
||||
while (!tests[pos] && --pos >= 0);
|
||||
for (var i = pos; i < len; i++) {
|
||||
if (tests[i]) {
|
||||
buffer[i] = settings.placeholder;
|
||||
var j = seekNext(i);
|
||||
if (j < len && tests[i].test(buffer[j])) {
|
||||
buffer[i] = buffer[j];
|
||||
} else
|
||||
break;
|
||||
}
|
||||
}
|
||||
writeBuffer();
|
||||
input.caret(Math.max(firstNonMaskPos, pos));
|
||||
};
|
||||
|
||||
function shiftR(pos) {
|
||||
for (var i = pos, c = settings.placeholder; i < len; i++) {
|
||||
if (tests[i]) {
|
||||
var j = seekNext(i);
|
||||
var t = buffer[i];
|
||||
buffer[i] = c;
|
||||
if (j < len && tests[j].test(t))
|
||||
c = t;
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function keydownEvent(e) {
|
||||
var pos = $(this).caret();
|
||||
var k = e.keyCode;
|
||||
ignore = (k < 16 || (k > 16 && k < 32) || (k > 32 && k < 41));
|
||||
|
||||
//delete selection before proceeding
|
||||
if ((pos.begin - pos.end) != 0 && (!ignore || k == 8 || k == 46))
|
||||
clearBuffer(pos.begin, pos.end);
|
||||
|
||||
//backspace, delete, and escape get special treatment
|
||||
if (k == 8 || k == 46 || (iPhone && k == 127)) {//backspace/delete
|
||||
shiftL(pos.begin + (k == 46 ? 0 : -1));
|
||||
return false;
|
||||
} else if (k == 27) {//escape
|
||||
input.val(focusText);
|
||||
input.caret(0, checkVal());
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
function keypressEvent(e) {
|
||||
if (ignore) {
|
||||
ignore = false;
|
||||
//Fixes Mac FF bug on backspace
|
||||
return (e.keyCode == 8) ? false : null;
|
||||
}
|
||||
e = e || window.event;
|
||||
var k = e.charCode || e.keyCode || e.which;
|
||||
var pos = $(this).caret();
|
||||
|
||||
if (e.ctrlKey || e.altKey || e.metaKey) {//Ignore
|
||||
return true;
|
||||
} else if ((k >= 32 && k <= 125) || k > 186) {//typeable characters
|
||||
var p = seekNext(pos.begin - 1);
|
||||
if (p < len) {
|
||||
var c = String.fromCharCode(k);
|
||||
if (tests[p].test(c)) {
|
||||
shiftR(p);
|
||||
buffer[p] = c;
|
||||
writeBuffer();
|
||||
var next = seekNext(p);
|
||||
$(this).caret(next);
|
||||
if (settings.completed && next == len)
|
||||
settings.completed.call(input);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
function clearBuffer(start, end) {
|
||||
for (var i = start; i < end && i < len; i++) {
|
||||
if (tests[i])
|
||||
buffer[i] = settings.placeholder;
|
||||
}
|
||||
};
|
||||
|
||||
function writeBuffer() { return input.val(buffer.join('')).val(); };
|
||||
|
||||
function checkVal(allow) {
|
||||
//try to place characters where they belong
|
||||
var test = input.val();
|
||||
var lastMatch = -1;
|
||||
for (var i = 0, pos = 0; i < len; i++) {
|
||||
if (tests[i]) {
|
||||
buffer[i] = settings.placeholder;
|
||||
while (pos++ < test.length) {
|
||||
var c = test.charAt(pos - 1);
|
||||
if (tests[i].test(c)) {
|
||||
buffer[i] = c;
|
||||
lastMatch = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (pos > test.length)
|
||||
break;
|
||||
} else if (buffer[i] == test[pos] && i!=partialPosition) {
|
||||
pos++;
|
||||
lastMatch = i;
|
||||
}
|
||||
}
|
||||
if (!allow && lastMatch + 1 < partialPosition) {
|
||||
input.val("");
|
||||
clearBuffer(0, len);
|
||||
} else if (allow || lastMatch + 1 >= partialPosition) {
|
||||
writeBuffer();
|
||||
if (!allow) input.val(input.val().substring(0, lastMatch + 1));
|
||||
}
|
||||
return (partialPosition ? i : firstNonMaskPos);
|
||||
};
|
||||
|
||||
if (!input.attr("readonly"))
|
||||
input
|
||||
.one("unmask", function() {
|
||||
input
|
||||
.unbind(".mask")
|
||||
.removeData("buffer")
|
||||
.removeData("tests");
|
||||
})
|
||||
.bind("focus.mask", function() {
|
||||
focusText = input.val();
|
||||
var pos = checkVal();
|
||||
writeBuffer();
|
||||
setTimeout(function() {
|
||||
if (pos == mask.length)
|
||||
input.caret(0, pos);
|
||||
else
|
||||
input.caret(pos);
|
||||
}, 0);
|
||||
})
|
||||
.bind("blur.mask", function() {
|
||||
checkVal();
|
||||
if (input.val() != focusText)
|
||||
input.change();
|
||||
})
|
||||
.bind("keydown.mask", keydownEvent)
|
||||
.bind("keypress.mask", keypressEvent)
|
||||
.bind(pasteEventName, function() {
|
||||
setTimeout(function() { input.caret(checkVal(true)); }, 0);
|
||||
});
|
||||
|
||||
checkVal(); //Perform initial check for existing values
|
||||
});
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,241 @@
|
||||
// tipsy, facebook style tooltips for jquery
|
||||
// version 1.0.0a
|
||||
// (c) 2008-2010 jason frame [jason@onehackoranother.com]
|
||||
// released under the MIT license
|
||||
|
||||
(function($) {
|
||||
|
||||
function maybeCall(thing, ctx) {
|
||||
return (typeof thing == 'function') ? (thing.call(ctx)) : thing;
|
||||
};
|
||||
|
||||
function Tipsy(element, options) {
|
||||
this.$element = $(element);
|
||||
this.options = options;
|
||||
this.enabled = true;
|
||||
this.fixTitle();
|
||||
};
|
||||
|
||||
Tipsy.prototype = {
|
||||
show: function() {
|
||||
var title = this.getTitle();
|
||||
if (title && this.enabled) {
|
||||
var $tip = this.tip();
|
||||
|
||||
$tip.find('.tipsy-inner')[this.options.html ? 'html' : 'text'](title);
|
||||
$tip[0].className = 'tipsy'; // reset classname in case of dynamic gravity
|
||||
$tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).prependTo(document.body);
|
||||
|
||||
var pos = $.extend({}, this.$element.offset(), {
|
||||
width: this.$element[0].offsetWidth,
|
||||
height: this.$element[0].offsetHeight
|
||||
});
|
||||
|
||||
var actualWidth = $tip[0].offsetWidth,
|
||||
actualHeight = $tip[0].offsetHeight,
|
||||
gravity = maybeCall(this.options.gravity, this.$element[0]);
|
||||
|
||||
var tp;
|
||||
switch (gravity.charAt(0)) {
|
||||
case 'n':
|
||||
tp = {top: pos.top + pos.height + this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
|
||||
break;
|
||||
case 's':
|
||||
tp = {top: pos.top - actualHeight - this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
|
||||
break;
|
||||
case 'e':
|
||||
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset};
|
||||
break;
|
||||
case 'w':
|
||||
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset};
|
||||
break;
|
||||
}
|
||||
|
||||
if (gravity.length == 2) {
|
||||
if (gravity.charAt(1) == 'w') {
|
||||
tp.left = pos.left + pos.width / 2 - 15;
|
||||
} else {
|
||||
tp.left = pos.left + pos.width / 2 - actualWidth + 15;
|
||||
}
|
||||
}
|
||||
|
||||
$tip.css(tp).addClass('tipsy-' + gravity);
|
||||
$tip.find('.tipsy-arrow')[0].className = 'tipsy-arrow tipsy-arrow-' + gravity.charAt(0);
|
||||
if (this.options.className) {
|
||||
$tip.addClass(maybeCall(this.options.className, this.$element[0]));
|
||||
}
|
||||
|
||||
if (this.options.fade) {
|
||||
$tip.stop().css({opacity: 0, display: 'block', visibility: 'visible'}).animate({opacity: this.options.opacity});
|
||||
} else {
|
||||
$tip.css({visibility: 'visible', opacity: this.options.opacity});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
if (this.options.fade) {
|
||||
this.tip().stop().fadeOut(function() { $(this).remove(); });
|
||||
} else {
|
||||
this.tip().remove();
|
||||
}
|
||||
},
|
||||
|
||||
fixTitle: function() {
|
||||
var $e = this.$element;
|
||||
if ($e.attr('title') || typeof($e.attr('original-title')) != 'string') {
|
||||
$e.attr('original-title', $e.attr('title') || '').removeAttr('title');
|
||||
}
|
||||
},
|
||||
|
||||
getTitle: function() {
|
||||
var title, $e = this.$element, o = this.options;
|
||||
this.fixTitle();
|
||||
var title, o = this.options;
|
||||
if (typeof o.title == 'string') {
|
||||
title = $e.attr(o.title == 'title' ? 'original-title' : o.title);
|
||||
} else if (typeof o.title == 'function') {
|
||||
title = o.title.call($e[0]);
|
||||
}
|
||||
title = ('' + title).replace(/(^\s*|\s*$)/, "");
|
||||
return title || o.fallback;
|
||||
},
|
||||
|
||||
tip: function() {
|
||||
if (!this.$tip) {
|
||||
this.$tip = $('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>');
|
||||
}
|
||||
return this.$tip;
|
||||
},
|
||||
|
||||
validate: function() {
|
||||
if (!this.$element[0].parentNode) {
|
||||
this.hide();
|
||||
this.$element = null;
|
||||
this.options = null;
|
||||
}
|
||||
},
|
||||
|
||||
enable: function() { this.enabled = true; },
|
||||
disable: function() { this.enabled = false; },
|
||||
toggleEnabled: function() { this.enabled = !this.enabled; }
|
||||
};
|
||||
|
||||
$.fn.tipsy = function(options) {
|
||||
|
||||
if (options === true) {
|
||||
return this.data('tipsy');
|
||||
} else if (typeof options == 'string') {
|
||||
var tipsy = this.data('tipsy');
|
||||
if (tipsy) tipsy[options]();
|
||||
return this;
|
||||
}
|
||||
|
||||
options = $.extend({}, $.fn.tipsy.defaults, options);
|
||||
|
||||
function get(ele) {
|
||||
var tipsy = $.data(ele, 'tipsy');
|
||||
if (!tipsy) {
|
||||
tipsy = new Tipsy(ele, $.fn.tipsy.elementOptions(ele, options));
|
||||
$.data(ele, 'tipsy', tipsy);
|
||||
}
|
||||
return tipsy;
|
||||
}
|
||||
|
||||
function enter() {
|
||||
var tipsy = get(this);
|
||||
tipsy.hoverState = 'in';
|
||||
if (options.delayIn == 0) {
|
||||
tipsy.show();
|
||||
} else {
|
||||
tipsy.fixTitle();
|
||||
setTimeout(function() { if (tipsy.hoverState == 'in') tipsy.show(); }, options.delayIn);
|
||||
}
|
||||
};
|
||||
|
||||
function leave() {
|
||||
var tipsy = get(this);
|
||||
tipsy.hoverState = 'out';
|
||||
if (options.delayOut == 0) {
|
||||
tipsy.hide();
|
||||
} else {
|
||||
setTimeout(function() { if (tipsy.hoverState == 'out') tipsy.hide(); }, options.delayOut);
|
||||
}
|
||||
};
|
||||
|
||||
if (!options.live) this.each(function() { get(this); });
|
||||
|
||||
if (options.trigger != 'manual') {
|
||||
var binder = options.live ? 'live' : 'bind',
|
||||
eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus',
|
||||
eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur';
|
||||
this[binder](eventIn, enter)[binder](eventOut, leave);
|
||||
}
|
||||
|
||||
return this;
|
||||
|
||||
};
|
||||
|
||||
$.fn.tipsy.defaults = {
|
||||
className: null,
|
||||
delayIn: 0,
|
||||
delayOut: 0,
|
||||
fade: false,
|
||||
fallback: '',
|
||||
gravity: 'n',
|
||||
html: false,
|
||||
live: false,
|
||||
offset: 0,
|
||||
opacity: 0.8,
|
||||
title: 'title',
|
||||
trigger: 'hover'
|
||||
};
|
||||
|
||||
// Overwrite this method to provide options on a per-element basis.
|
||||
// For example, you could store the gravity in a 'tipsy-gravity' attribute:
|
||||
// return $.extend({}, options, {gravity: $(ele).attr('tipsy-gravity') || 'n' });
|
||||
// (remember - do not modify 'options' in place!)
|
||||
$.fn.tipsy.elementOptions = function(ele, options) {
|
||||
return $.metadata ? $.extend({}, options, $(ele).metadata()) : options;
|
||||
};
|
||||
|
||||
$.fn.tipsy.autoNS = function() {
|
||||
return $(this).offset().top > ($(document).scrollTop() + $(window).height() / 2) ? 's' : 'n';
|
||||
};
|
||||
|
||||
$.fn.tipsy.autoWE = function() {
|
||||
return $(this).offset().left > ($(document).scrollLeft() + $(window).width() / 2) ? 'e' : 'w';
|
||||
};
|
||||
|
||||
/**
|
||||
* yields a closure of the supplied parameters, producing a function that takes
|
||||
* no arguments and is suitable for use as an autogravity function like so:
|
||||
*
|
||||
* @param margin (int) - distance from the viewable region edge that an
|
||||
* element should be before setting its tooltip's gravity to be away
|
||||
* from that edge.
|
||||
* @param prefer (string, e.g. 'n', 'sw', 'w') - the direction to prefer
|
||||
* if there are no viewable region edges effecting the tooltip's
|
||||
* gravity. It will try to vary from this minimally, for example,
|
||||
* if 'sw' is preferred and an element is near the right viewable
|
||||
* region edge, but not the top edge, it will set the gravity for
|
||||
* that element's tooltip to be 'se', preserving the southern
|
||||
* component.
|
||||
*/
|
||||
$.fn.tipsy.autoBounds = function(margin, prefer) {
|
||||
return function() {
|
||||
var dir = {ns: prefer[0], ew: (prefer.length > 1 ? prefer[1] : false)},
|
||||
boundTop = $(document).scrollTop() + margin,
|
||||
boundLeft = $(document).scrollLeft() + margin,
|
||||
$this = $(this);
|
||||
|
||||
if ($this.offset().top < boundTop) dir.ns = 'n';
|
||||
if ($this.offset().left < boundLeft) dir.ew = 'w';
|
||||
if ($(window).width() + $(document).scrollLeft() - $this.offset().left < margin) dir.ew = 'e';
|
||||
if ($(window).height() + $(document).scrollTop() - $this.offset().top < margin) dir.ns = 's';
|
||||
|
||||
return dir.ns + (dir.ew ? dir.ew : '');
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
jQuery.cookie=function(e,n,o){if(arguments.length>1&&"[object Object]"!==String(n)){if(o=jQuery.extend({},o),(null===n||void 0===n)&&(o.expires=-1),"number"==typeof o.expires){var t=o.expires,r=o.expires=new Date;r.setDate(r.getDate()+t)}return n=String(n),document.cookie=[encodeURIComponent(e),"=",o.raw?n:encodeURIComponent(n),o.expires?"; expires="+o.expires.toUTCString():"",o.path?"; path="+o.path:"",o.domain?"; domain="+o.domain:"",o.secure?"; secure":""].join("")}o=n||{};var i,c=o.raw?function(e){return e}:decodeURIComponent;return(i=new RegExp("(?:^|; )"+encodeURIComponent(e)+"=([^;]*)").exec(document.cookie))?c(i[1]):null};
|
||||
@@ -0,0 +1 @@
|
||||
!function(e){var t=(e.browser.msie?"paste":"input")+".mask",n=void 0!=window.orientation;e.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"}},e.fn.extend({caret:function(e,t){if(0!=this.length){if("number"==typeof e)return t="number"==typeof t?t:e,this.each(function(){if(this.setSelectionRange)this.focus(),this.setSelectionRange(e,t);else if(this.createTextRange){var n=this.createTextRange();n.collapse(!0),n.moveEnd("character",t),n.moveStart("character",e),n.select()}});if(this[0].setSelectionRange)e=this[0].selectionStart,t=this[0].selectionEnd;else if(document.selection&&document.selection.createRange){var n=document.selection.createRange();e=0-n.duplicate().moveStart("character",-1e5),t=e+n.text.length}return{begin:e,end:t}}},unmask:function(){return this.trigger("unmask")},mask:function(a,r){if(!a&&this.length>0){var i=e(this[0]),o=i.data("tests");return e.map(i.data("buffer"),function(e,t){return o[t]?e:null}).join("")}r=e.extend({placeholder:"_",completed:null},r);var c=e.mask.definitions,o=[],s=a.length,l=null,u=a.length;return e.each(a.split(""),function(e,t){"?"==t?(u--,s=e):c[t]?(o.push(new RegExp(c[t])),null==l&&(l=o.length-1)):o.push(null)}),this.each(function(){function i(e){for(;++e<=u&&!o[e];);return e}function f(e){for(;!o[e]&&--e>=0;);for(var t=e;u>t;t++)if(o[t]){k[t]=r.placeholder;var n=i(t);if(!(u>n&&o[t].test(k[n])))break;k[t]=k[n]}g(),p.caret(Math.max(l,e))}function h(e){for(var t=e,n=r.placeholder;u>t;t++)if(o[t]){var a=i(t),c=k[t];if(k[t]=n,!(u>a&&o[a].test(c)))break;n=c}}function d(t){var a=e(this).caret(),r=t.keyCode;return y=16>r||r>16&&32>r||r>32&&41>r,a.begin-a.end==0||y&&8!=r&&46!=r||m(a.begin,a.end),8==r||46==r||n&&127==r?(f(a.begin+(46==r?0:-1)),!1):27==r?(p.val(w),p.caret(0,b()),!1):void 0}function v(t){if(y)return y=!1,8==t.keyCode?!1:null;t=t||window.event;var n=t.charCode||t.keyCode||t.which,a=e(this).caret();if(t.ctrlKey||t.altKey||t.metaKey)return!0;if(n>=32&&125>=n||n>186){var c=i(a.begin-1);if(u>c){var s=String.fromCharCode(n);if(o[c].test(s)){h(c),k[c]=s,g();var l=i(c);e(this).caret(l),r.completed&&l==u&&r.completed.call(p)}}}return!1}function m(e,t){for(var n=e;t>n&&u>n;n++)o[n]&&(k[n]=r.placeholder)}function g(){return p.val(k.join("")).val()}function b(e){for(var t=p.val(),n=-1,a=0,i=0;u>a;a++)if(o[a]){for(k[a]=r.placeholder;i++<t.length;){var c=t.charAt(i-1);if(o[a].test(c)){k[a]=c,n=a;break}}if(i>t.length)break}else k[a]==t[i]&&a!=s&&(i++,n=a);return!e&&s>n+1?(p.val(""),m(0,u)):(e||n+1>=s)&&(g(),e||p.val(p.val().substring(0,n+1))),s?a:l}var p=e(this),k=e.map(a.split(""),function(e){return"?"!=e?c[e]?r.placeholder:e:void 0}),y=!1,w=p.val();p.data("buffer",k).data("tests",o),p.attr("readonly")||p.one("unmask",function(){p.unbind(".mask").removeData("buffer").removeData("tests")}).bind("focus.mask",function(){w=p.val();var e=b();g(),setTimeout(function(){e==a.length?p.caret(0,e):p.caret(e)},0)}).bind("blur.mask",function(){b(),p.val()!=w&&p.change()}).bind("keydown.mask",d).bind("keypress.mask",v).bind(t,function(){setTimeout(function(){p.caret(b(!0))},0)}),b()})}})}(jQuery);
|
||||
+1
@@ -0,0 +1 @@
|
||||
!function(t){function i(t,i){return"function"==typeof t?t.call(i):t}function e(i,e){this.$element=t(i),this.options=e,this.enabled=!0,this.fixTitle()}e.prototype={show:function(){var e=this.getTitle();if(e&&this.enabled){var s=this.tip();s.find(".tipsy-inner")[this.options.html?"html":"text"](e),s[0].className="tipsy",s.remove().css({top:0,left:0,visibility:"hidden",display:"block"}).prependTo(document.body);var n,o=t.extend({},this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight}),l=s[0].offsetWidth,a=s[0].offsetHeight,f=i(this.options.gravity,this.$element[0]);switch(f.charAt(0)){case"n":n={top:o.top+o.height+this.options.offset,left:o.left+o.width/2-l/2};break;case"s":n={top:o.top-a-this.options.offset,left:o.left+o.width/2-l/2};break;case"e":n={top:o.top+o.height/2-a/2,left:o.left-l-this.options.offset};break;case"w":n={top:o.top+o.height/2-a/2,left:o.left+o.width+this.options.offset}}2==f.length&&(n.left="w"==f.charAt(1)?o.left+o.width/2-15:o.left+o.width/2-l+15),s.css(n).addClass("tipsy-"+f),s.find(".tipsy-arrow")[0].className="tipsy-arrow tipsy-arrow-"+f.charAt(0),this.options.className&&s.addClass(i(this.options.className,this.$element[0])),this.options.fade?s.stop().css({opacity:0,display:"block",visibility:"visible"}).animate({opacity:this.options.opacity}):s.css({visibility:"visible",opacity:this.options.opacity})}},hide:function(){this.options.fade?this.tip().stop().fadeOut(function(){t(this).remove()}):this.tip().remove()},fixTitle:function(){var t=this.$element;(t.attr("title")||"string"!=typeof t.attr("original-title"))&&t.attr("original-title",t.attr("title")||"").removeAttr("title")},getTitle:function(){var t,i=this.$element,e=this.options;this.fixTitle();var t,e=this.options;return"string"==typeof e.title?t=i.attr("title"==e.title?"original-title":e.title):"function"==typeof e.title&&(t=e.title.call(i[0])),t=(""+t).replace(/(^\s*|\s*$)/,""),t||e.fallback},tip:function(){return this.$tip||(this.$tip=t('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>')),this.$tip},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled}},t.fn.tipsy=function(i){function s(s){var n=t.data(s,"tipsy");return n||(n=new e(s,t.fn.tipsy.elementOptions(s,i)),t.data(s,"tipsy",n)),n}function n(){var t=s(this);t.hoverState="in",0==i.delayIn?t.show():(t.fixTitle(),setTimeout(function(){"in"==t.hoverState&&t.show()},i.delayIn))}function o(){var t=s(this);t.hoverState="out",0==i.delayOut?t.hide():setTimeout(function(){"out"==t.hoverState&&t.hide()},i.delayOut)}if(i===!0)return this.data("tipsy");if("string"==typeof i){var l=this.data("tipsy");return l&&l[i](),this}if(i=t.extend({},t.fn.tipsy.defaults,i),i.live||this.each(function(){s(this)}),"manual"!=i.trigger){var a=i.live?"live":"bind",f="hover"==i.trigger?"mouseenter":"focus",h="hover"==i.trigger?"mouseleave":"blur";this[a](f,n)[a](h,o)}return this},t.fn.tipsy.defaults={className:null,delayIn:0,delayOut:0,fade:!1,fallback:"",gravity:"n",html:!1,live:!1,offset:0,opacity:.8,title:"title",trigger:"hover"},t.fn.tipsy.elementOptions=function(i,e){return t.metadata?t.extend({},e,t(i).metadata()):e},t.fn.tipsy.autoNS=function(){return t(this).offset().top>t(document).scrollTop()+t(window).height()/2?"s":"n"},t.fn.tipsy.autoWE=function(){return t(this).offset().left>t(document).scrollLeft()+t(window).width()/2?"e":"w"},t.fn.tipsy.autoBounds=function(i,e){return function(){var s={ns:e[0],ew:e.length>1?e[1]:!1},n=t(document).scrollTop()+i,o=t(document).scrollLeft()+i,l=t(this);return l.offset().top<n&&(s.ns="n"),l.offset().left<o&&(s.ew="w"),t(window).width()+t(document).scrollLeft()-l.offset().left<i&&(s.ew="e"),t(window).height()+t(document).scrollTop()-l.offset().top<i&&(s.ns="s"),s.ns+(s.ew?s.ew:"")}}}(jQuery);
|
||||
Vendored
+1
File diff suppressed because one or more lines are too long
@@ -0,0 +1,4 @@
|
||||
/* Modernizr 2.6.2 (Custom Build) | MIT & BSD
|
||||
* Build: http://modernizr.com/download/#-opacity-cssanimations-shiv-testprop-testallprops-prefixes-domprefixes
|
||||
*/
|
||||
;window.Modernizr=function(a,b,c){function x(a){i.cssText=a}function y(a,b){return x(l.join(a+";")+(b||""))}function z(a,b){return typeof a===b}function A(a,b){return!!~(""+a).indexOf(b)}function B(a,b){for(var d in a){var e=a[d];if(!A(e,"-")&&i[e]!==c)return b=="pfx"?e:!0}return!1}function C(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:z(f,"function")?f.bind(d||b):f}return!1}function D(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+n.join(d+" ")+d).split(" ");return z(b,"string")||z(b,"undefined")?B(e,b):(e=(a+" "+o.join(d+" ")+d).split(" "),C(e,b,c))}var d="2.6.2",e={},f=b.documentElement,g="modernizr",h=b.createElement(g),i=h.style,j,k={}.toString,l=" -webkit- -moz- -o- -ms- ".split(" "),m="Webkit Moz O ms",n=m.split(" "),o=m.toLowerCase().split(" "),p={},q={},r={},s=[],t=s.slice,u,v={}.hasOwnProperty,w;!z(v,"undefined")&&!z(v.call,"undefined")?w=function(a,b){return v.call(a,b)}:w=function(a,b){return b in a&&z(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=t.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(t.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(t.call(arguments)))};return e}),p.opacity=function(){return y("opacity:.55"),/^0.55$/.test(i.opacity)},p.cssanimations=function(){return D("animationName")};for(var E in p)w(p,E)&&(u=E.toLowerCase(),e[u]=p[E](),s.push((e[u]?"":"no-")+u));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)w(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof enableClasses!="undefined"&&enableClasses&&(f.className+=" "+(b?"":"no-")+a),e[a]=b}return e},x(""),h=j=null,function(a,b){function k(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function l(){var a=r.elements;return typeof a=="string"?a.split(" "):a}function m(a){var b=i[a[g]];return b||(b={},h++,a[g]=h,i[h]=b),b}function n(a,c,f){c||(c=b);if(j)return c.createElement(a);f||(f=m(c));var g;return f.cache[a]?g=f.cache[a].cloneNode():e.test(a)?g=(f.cache[a]=f.createElem(a)).cloneNode():g=f.createElem(a),g.canHaveChildren&&!d.test(a)?f.frag.appendChild(g):g}function o(a,c){a||(a=b);if(j)return a.createDocumentFragment();c=c||m(a);var d=c.frag.cloneNode(),e=0,f=l(),g=f.length;for(;e<g;e++)d.createElement(f[e]);return d}function p(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return r.shivMethods?n(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+l().join().replace(/\w+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(r,b.frag)}function q(a){a||(a=b);var c=m(a);return r.shivCSS&&!f&&!c.hasCSS&&(c.hasCSS=!!k(a,"article,aside,figcaption,figure,footer,header,hgroup,nav,section{display:block}mark{background:#FF0;color:#000}")),j||p(a,c),a}var c=a.html5||{},d=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,e=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,f,g="_html5shiv",h=0,i={},j;(function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",f="hidden"in a,j=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){f=!0,j=!0}})();var r={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,supportsUnknownElements:j,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:q,createElement:n,createDocumentFragment:o};a.html5=r,q(b)}(this,b),e._version=d,e._prefixes=l,e._domPrefixes=o,e._cssomPrefixes=n,e.testProp=function(a){return B([a])},e.testAllProps=D,e}(this,this.document);
|
||||
@@ -0,0 +1,860 @@
|
||||
/**
|
||||
* Total XML files
|
||||
* @type Number
|
||||
*/
|
||||
var _total = 25;
|
||||
var _act = 1;
|
||||
var _run = false;
|
||||
var _time_out;
|
||||
var _clear_time_out;
|
||||
var _installing = false;
|
||||
|
||||
var _processing = false;
|
||||
var _clicking = false;
|
||||
|
||||
var _elm_ext = false;
|
||||
|
||||
var current_wpb = false;
|
||||
var current_elm = false;
|
||||
|
||||
var _home_wpb = [];
|
||||
var _home_elm = [];
|
||||
|
||||
var _imported_home = 0;
|
||||
var _count_home = 0;
|
||||
|
||||
/**
|
||||
* Document Ready
|
||||
*
|
||||
* @type type
|
||||
*/
|
||||
jQuery(document).ready(function ($) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* INIT Tab WPB - ELM
|
||||
*
|
||||
* @returns {undefined}
|
||||
*/
|
||||
setTimeout(function() {
|
||||
if ($('.nasa-tabs-heading').find('.nasa-tab-heading').length) {
|
||||
var _clicked = false;
|
||||
|
||||
$('.nasa-tabs-heading li').each(function() {
|
||||
if (!_clicked) {
|
||||
if (!$(this).hasClass('disabled')) {
|
||||
$(this).find('.nasa-tab-heading').trigger('click');
|
||||
_clicked = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if ($('.recommend-plugins').length <= 0) {
|
||||
$('.main-demo-data').show();
|
||||
}
|
||||
|
||||
if ($('.builder-plugin').length <= 0) {
|
||||
$('.confirm-selected-plugins').removeClass('nasa-disabled');
|
||||
} else {
|
||||
if ($('.builder-plugin').length === 2 && $('.builder-plugin.selected').length <= 0) {
|
||||
if (!$('.confirm-selected-plugins').hasClass('nasa-disabled')) {
|
||||
$('.confirm-selected-plugins').addClass('nasa-disabled');
|
||||
}
|
||||
} else {
|
||||
$('.confirm-selected-plugins').removeClass('nasa-disabled');
|
||||
}
|
||||
}
|
||||
}, 100);
|
||||
|
||||
/**
|
||||
* Search Homes
|
||||
*/
|
||||
$('body').on('keyup', '#ns-homes-search-input', function() {
|
||||
var _textsearch = $.trim($(this).val());
|
||||
_textsearch = _textsearch.replace(/ /g, "-");
|
||||
|
||||
if (_textsearch === '') {
|
||||
$('.demo-homepage-item-wrap').removeClass('ns-hide');
|
||||
} else {
|
||||
var patt = new RegExp(_textsearch);
|
||||
$('.demo-homepage-item-wrap').each(function() {
|
||||
var _sstext = $(this).find('.demo-homepage-item').attr('data-home');
|
||||
if (patt.test(_sstext)) {
|
||||
$(this).removeClass('ns-hide');
|
||||
} else {
|
||||
if (!$(this).hasClass('ns-hide')) {
|
||||
$(this).addClass('ns-hide');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Select Home to import
|
||||
*/
|
||||
$('body').on('click', '.main-demo-data .demo-homepage-item', function() {
|
||||
$(this).toggleClass('selected');
|
||||
setTimeout(function() {
|
||||
if ($('.main-demo-data .demo-homepage-item.selected').length) {
|
||||
if (!$('.main-demo-data .nasa-start-import').hasClass('selected')) {
|
||||
$('.main-demo-data .nasa-start-import').addClass('selected');
|
||||
}
|
||||
} else {
|
||||
$('.main-demo-data .nasa-start-import').removeClass('selected');
|
||||
}
|
||||
}, 10);
|
||||
});
|
||||
|
||||
/**
|
||||
* Recommend Plugins
|
||||
*/
|
||||
$('body').on('click', '.recommend-plugin', function() {
|
||||
var _this = $(this);
|
||||
|
||||
if (!$(_this).hasClass('required-plugin') && !$(_this).hasClass('child-plugin')) {
|
||||
if (!$(_this).hasClass('builder-plugin')) {
|
||||
$(_this).toggleClass('selected');
|
||||
} else {
|
||||
var _slug = $(_this).attr('data-slug');
|
||||
$('.builder-plugin:not(.plg-' + _slug + ')').removeClass('selected');
|
||||
$(_this).toggleClass('selected');
|
||||
}
|
||||
}
|
||||
|
||||
if ($('.child-plugin').length) {
|
||||
$('.recommend-plugin:not(.child-plugin)').each(function() {
|
||||
var _root = $(this);
|
||||
var _slug_root = $(_root).attr('data-slug');
|
||||
|
||||
if ($('.child-plugin.parent-plg-' + _slug_root).length) {
|
||||
if ($(_root).hasClass('selected')) {
|
||||
if (!$('.child-plugin.parent-plg-' + _slug_root).hasClass('selected')) {
|
||||
$('.child-plugin.parent-plg-' + _slug_root).addClass('selected');
|
||||
}
|
||||
} else {
|
||||
$('.child-plugin.parent-plg-' + _slug_root).removeClass('selected');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if ($('.builder-plugin').length <= 0) {
|
||||
$('.confirm-selected-plugins').removeClass('nasa-disabled');
|
||||
} else {
|
||||
if ($('.builder-plugin').length === 2 && $('.builder-plugin.selected').length <= 0) {
|
||||
if (!$('.confirm-selected-plugins').hasClass('nasa-disabled')) {
|
||||
$('.confirm-selected-plugins').addClass('nasa-disabled');
|
||||
}
|
||||
} else {
|
||||
$('.confirm-selected-plugins').removeClass('nasa-disabled');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Confirm plugins selected
|
||||
*/
|
||||
$('body').on('click', '.confirm-selected-plugins', function() {
|
||||
var _this = $(this);
|
||||
if (!$(_this).hasClass('nasa-disabled')) {
|
||||
$('.recommend-plugins').hide();
|
||||
|
||||
if ($('.builder-plugin').length) {
|
||||
$('.builder-plugin').each(function() {
|
||||
var _slug = $(this).attr('data-slug');
|
||||
var _selected = $(this).hasClass('selected') ? true : false;
|
||||
|
||||
if (!_selected) {
|
||||
if (!$('.tab-heading-' + _slug).hasClass('disabled')) {
|
||||
$('.tab-heading-' + _slug).addClass('disabled');
|
||||
}
|
||||
|
||||
if (!$('.tab-content-' + _slug).hasClass('disabled')) {
|
||||
$('.tab-content-' + _slug).addClass('disabled');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('.main-demo-data').show();
|
||||
|
||||
var _clicked = false;
|
||||
$('.nasa-tabs-heading li').each(function() {
|
||||
if (!_clicked) {
|
||||
if (!$(this).hasClass('disabled')) {
|
||||
$(this).find('.nasa-tab-heading').trigger('click');
|
||||
_clicked = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Tabs WPB - ELM
|
||||
*/
|
||||
$('body').on('click', '.nasa-tab-heading', function() {
|
||||
var _this = $(this);
|
||||
|
||||
if (!_clicking && !$(_this).hasClass('selected')) {
|
||||
_clicking = true;
|
||||
var _target = $(_this).attr('data-target');
|
||||
$('.nasa-tabs-heading').find('.nasa-tab-heading').removeClass('selected');
|
||||
$('.nasa-tabs-panel').find('.demo-homepage-item-wrap').removeClass('nasa-active');
|
||||
|
||||
$('.nasa-tabs-panel .nasa-tab-content').removeClass('nasa-show');
|
||||
if ($('.nasa-tabs-panel').find(_target).length) {
|
||||
$('.nasa-tabs-panel').find(_target).addClass('nasa-show');
|
||||
$(_this).addClass('selected');
|
||||
|
||||
setTimeout(function() {
|
||||
$('.nasa-tabs-panel').find(_target + ' .demo-homepage-item-wrap').addClass('nasa-active');
|
||||
_clicking = false;
|
||||
}, 300);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Confirm unload window when process runing.
|
||||
*/
|
||||
$(window).on('beforeunload', function(){
|
||||
if (_processing) {
|
||||
return 'Are you sure you want to leave?';
|
||||
}
|
||||
});
|
||||
|
||||
$('body').on('click', '.nasa-back-step', function() {
|
||||
$('.recommend-plugins').show();
|
||||
$('.main-demo-data').hide();
|
||||
|
||||
$('.nasa-tabs-heading li').removeClass('disabled');
|
||||
$('.nasa-tab-content').removeClass('disabled');
|
||||
|
||||
$('.nasa-tab-content .demo-homepage-item, .nasa-start-import').removeClass('selected');
|
||||
});
|
||||
|
||||
$('body').on('click', '.nasa-select-all', function() {
|
||||
$('.demo-homepages-wrap').each(function() {
|
||||
var _wrap = $(this);
|
||||
if (!$(_wrap).hasClass('disabled')) {
|
||||
$(_wrap).find('.demo-homepage-item').each(function() {
|
||||
var _home = $(this);
|
||||
if (!$(_home).hasClass('selected')) {
|
||||
$(_home).addClass('selected');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if (!$('.nasa-start-import').hasClass('selected')) {
|
||||
$('.nasa-start-import').addClass('selected');
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Click Demo Data
|
||||
*/
|
||||
$('body').on('click', '.nasa-start-import.selected', function() {
|
||||
if (!$(this).hasClass('processing')) {
|
||||
_processing = true;
|
||||
|
||||
$(this).addClass('processing');
|
||||
$('.runing-hide').hide();
|
||||
$('.nasa-select-homepage').hide();
|
||||
$('.nasa-start-import').hide();
|
||||
$('.nasa-back-step').hide();
|
||||
$('.nasa-select-all').hide();
|
||||
$('.main-demo-data-notice').hide();
|
||||
$('.ns-homes-search').hide();
|
||||
$('.processing-demo-data').show();
|
||||
$('.processing-demo-data').show();
|
||||
$('.processing-steps li.step-first').addClass('runing');
|
||||
|
||||
if ($('.process-bar-loading').length) {
|
||||
$('.process-bar-loading').addClass('loading');
|
||||
}
|
||||
|
||||
if ($('.recommend-plugin.selected').length) {
|
||||
$('.recommend-plugin.selected').each(function() {
|
||||
var _this = $(this);
|
||||
var _text = '<span class="plg-lbl">' + $(_this).attr('data-name') + '</span>';
|
||||
var _slug = $(_this).attr('data-slug');
|
||||
$('.plugins-installed').append('<li class="nasa-label-plg nasa-wait plg-' + _slug + '">' + _text + '</li>');
|
||||
});
|
||||
}
|
||||
|
||||
if ($('.demo-homepages-wpb .demo-homepage-item.selected').length) {
|
||||
$('.demo-homepages-wpb .demo-homepage-item.selected').each(function() {
|
||||
var _slug = $(this).attr('data-home');
|
||||
_home_wpb.push(_slug);
|
||||
});
|
||||
}
|
||||
|
||||
if ($('.demo-homepages-elm .demo-homepage-item.selected').length) {
|
||||
$('.demo-homepages-elm .demo-homepage-item.selected').each(function() {
|
||||
var _slug = $(this).attr('data-home');
|
||||
_home_elm.push(_slug);
|
||||
});
|
||||
}
|
||||
|
||||
_count_home = _home_wpb.length + _home_elm.length;
|
||||
|
||||
$('.statistic-homes').html(_imported_home + '/' + _count_home);
|
||||
|
||||
// nasa_import_homes($);
|
||||
|
||||
_time_out = setInterval(function () {
|
||||
if (!_run) {
|
||||
nasa_import_demo_data($);
|
||||
|
||||
_run = true;
|
||||
|
||||
if ($('.process-bar-finished').length) {
|
||||
var _total_steps = $('.processing-steps li.step').length;
|
||||
var _finished = $('.processing-steps li.step.finished').length;
|
||||
|
||||
var text_per = Math.round(_finished / _total_steps * 100);
|
||||
|
||||
$('.process-bar-finished').css({width: text_per + '%'});
|
||||
$('.process-bar-finished').html(text_per + '%');
|
||||
}
|
||||
}
|
||||
}, 500);
|
||||
|
||||
_clear_time_out = setInterval(function () {
|
||||
if ($('.processing-steps li.step-end.step.finished').length || $('.processing-steps li.step.step-end.fail').length) {
|
||||
clearInterval(_time_out);
|
||||
clearInterval(_clear_time_out);
|
||||
$('.processing-notice-first').hide();
|
||||
$('.processing-notice-last').show();
|
||||
|
||||
_processing = false;
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
});
|
||||
|
||||
$('body').on('mouseover', '.addition-demo-data .demo-homepage-item', function() {
|
||||
var _this = $(this);
|
||||
|
||||
if ($(_this).find('.ns-import-btn').length <= 0) {
|
||||
var _btn = $('#ns-import-btn-tmp').html();
|
||||
$(_this).append(_btn);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Addition Homepage
|
||||
*/
|
||||
$('body').on('click', '.addition-demo-data .demo-homepage-item:not(.selected)', function() {
|
||||
if (confirm('Are you sure you want to add this homepage as the homepage of your website?')) {
|
||||
var _this = $(this);
|
||||
var _parents = $(_this).parents('.addition-demo-data');
|
||||
|
||||
if (!$(_parents).hasClass('adding')) {
|
||||
$(_parents).addClass('adding');
|
||||
|
||||
var _home = $(_this).attr('data-home');
|
||||
var _home_type = $(_this).parents('.demo-homepages-elm').length ? 'elm' : 'wpb';
|
||||
|
||||
$.ajax({
|
||||
url: ajax_admin_demo_data,
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
cache: false,
|
||||
data: {
|
||||
'action': 'nasa_adddition_home',
|
||||
'home_type': _home_type,
|
||||
'home': _home
|
||||
},
|
||||
beforeSend: function() {
|
||||
$(_this).addClass('importing');
|
||||
},
|
||||
success: function (res) {
|
||||
if (res.success === '1') {
|
||||
$(_this).removeClass('importing');
|
||||
$(_this).addClass('selected');
|
||||
}
|
||||
|
||||
$(_parents).removeClass('adding');
|
||||
},
|
||||
error: function() {
|
||||
$(_parents).removeClass('adding');
|
||||
$(_this).removeClass('importing');
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Step 1
|
||||
* Install Child Theme
|
||||
*
|
||||
* @param {type} $
|
||||
* @returns {undefined}
|
||||
*/
|
||||
function nasa_install_child_theme($) {
|
||||
$.ajax({
|
||||
url: ajax_admin_demo_data,
|
||||
type: 'post',
|
||||
timeout: 600000,
|
||||
data: {
|
||||
action: 'nasa_install_child_theme'
|
||||
},
|
||||
success: function (res) {
|
||||
if (res === '1') {
|
||||
$('.processing-steps li[data-step="1"]').removeClass('runing');
|
||||
$('.processing-steps li[data-step="1"]').addClass('finished');
|
||||
$('.processing-steps li[data-step="2"]').addClass('runing');
|
||||
} else {
|
||||
$('.processing-steps li[data-step="1"]').removeClass('runing');
|
||||
$('.processing-steps li[data-step="1"]').addClass('fail');
|
||||
$('.processing-steps li[data-step="2"]').addClass('runing');
|
||||
}
|
||||
|
||||
_run = false;
|
||||
},
|
||||
error: function() {
|
||||
$('.processing-steps li[data-step="1"]').removeClass('runing');
|
||||
$('.processing-steps li[data-step="1"]').addClass('fail');
|
||||
$('.processing-steps li[data-step="2"]').addClass('runing');
|
||||
|
||||
_run = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 2
|
||||
* Install Plugins
|
||||
*
|
||||
* @param {type} $
|
||||
* @returns {undefined}
|
||||
*/
|
||||
function nasa_install_plugins($) {
|
||||
if (!_installing) {
|
||||
_installing = true;
|
||||
var _this = $('.recommend-plugin.selected').first();
|
||||
var _slug = $(_this).attr('data-slug');
|
||||
if ($('.plugins-installed').find('.plg-' + _slug).length) {
|
||||
$('.plugins-installed').find('.plg-' + _slug).removeClass('nasa-wait');
|
||||
$('.plugins-installed').find('.plg-' + _slug).addClass('loading');
|
||||
}
|
||||
$.ajax({
|
||||
url: ajax_admin_demo_data,
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
timeout: 300000,
|
||||
data: {
|
||||
action: 'nasa_install_plugin',
|
||||
plg: _slug
|
||||
},
|
||||
success: function (res) {
|
||||
$(_this).remove();
|
||||
|
||||
if (typeof res.status !== 'undefined' && res.status === '1') {
|
||||
if ($('.plugins-installed').find('.plg-' + _slug).length) {
|
||||
$('.plugins-installed').find('.plg-' + _slug).removeClass('loading');
|
||||
$('.plugins-installed').find('.plg-' + _slug).addClass('ins-sccess');
|
||||
}
|
||||
} else {
|
||||
if ($('.plugins-installed').find('.plg-' + _slug).length) {
|
||||
$('.plugins-installed').find('.plg-' + _slug).removeClass('loading');
|
||||
$('.plugins-installed').find('.plg-' + _slug).addClass('ins-error');
|
||||
}
|
||||
}
|
||||
|
||||
_installing = false;
|
||||
_run = false;
|
||||
},
|
||||
error: function() {
|
||||
_installing = false;
|
||||
_run = false;
|
||||
}
|
||||
});
|
||||
|
||||
if ($('.recommend-plugin.selected').length <= 0) {
|
||||
$('.processing-steps li[data-step="2"]').removeClass('runing');
|
||||
$('.processing-steps li[data-step="2"]').addClass('finished');
|
||||
$('.processing-steps li[data-step="3"]').addClass('runing');
|
||||
_installing = false;
|
||||
_run = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 3
|
||||
* Import Demo data
|
||||
*
|
||||
* @param {type} $
|
||||
* @returns {undefined}
|
||||
*/
|
||||
function nasa_import_data($) {
|
||||
var _file = 'data' + (_act.toString());
|
||||
|
||||
$.ajax({
|
||||
url: ajax_admin_demo_data,
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
timeout: 300000,
|
||||
data: {
|
||||
'action': 'nasa_import_contents',
|
||||
'file': _file
|
||||
},
|
||||
success: function (res) {
|
||||
if (_act >= _total) {
|
||||
$('.processing-steps li[data-step="3"]').removeClass('runing');
|
||||
$('.processing-steps li[data-step="3"]').addClass('finished');
|
||||
$('.processing-steps li[data-step="4"]').addClass('runing');
|
||||
}
|
||||
|
||||
if (_act <= _total) {
|
||||
$('.statistic-data').html(_act.toString() + '/' + _total.toString());
|
||||
}
|
||||
|
||||
_act += 1;
|
||||
_run = false;
|
||||
},
|
||||
error: function () {
|
||||
_act += 1;
|
||||
_run = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 4
|
||||
* Import Widgets Sidebar
|
||||
*
|
||||
* @param {type} $
|
||||
* @returns {undefined}
|
||||
*/
|
||||
function nasa_import_widgets_sidebar($) {
|
||||
$.ajax({
|
||||
url: ajax_admin_demo_data,
|
||||
type: 'post',
|
||||
timeout: 300000,
|
||||
data: {
|
||||
action: 'nasa_import_widgets_sidebar'
|
||||
},
|
||||
success: function (res) {
|
||||
if (res === '1') {
|
||||
$('.processing-steps li[data-step="4"]').removeClass('runing');
|
||||
$('.processing-steps li[data-step="4"]').addClass('finished');
|
||||
$('.processing-steps li[data-step="5"]').addClass('runing');
|
||||
} else {
|
||||
$('.processing-steps li[data-step="4"]').removeClass('runing');
|
||||
$('.processing-steps li[data-step="4"]').addClass('fail');
|
||||
$('.processing-steps li[data-step="5"]').addClass('runing');
|
||||
}
|
||||
|
||||
_run = false;
|
||||
},
|
||||
error: function() {
|
||||
$('.processing-steps li[data-step="4"]').removeClass('runing');
|
||||
$('.processing-steps li[data-step="4"]').addClass('fail');
|
||||
$('.processing-steps li[data-step="5"]').addClass('runing');
|
||||
|
||||
_run = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 5
|
||||
* Import HOME
|
||||
*
|
||||
* @param {type} $
|
||||
* @returns {undefined}
|
||||
*/
|
||||
function nasa_import_homes($) {
|
||||
if (!_elm_ext) {
|
||||
$.ajax({
|
||||
url: ajax_admin_demo_data,
|
||||
type: 'post',
|
||||
timeout: 300000,
|
||||
data: {
|
||||
action: 'nasa_import_elm_ext'
|
||||
},
|
||||
success: function (res) {
|
||||
_elm_ext = true;
|
||||
_run = false;
|
||||
},
|
||||
error: function() {
|
||||
_elm_ext = true;
|
||||
_run = false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (_home_wpb.length > 0) {
|
||||
current_wpb = _home_wpb[0];
|
||||
current_elm = false;
|
||||
_home_wpb.shift();
|
||||
} else if(_home_elm.length > 0) {
|
||||
current_elm = _home_elm[0];
|
||||
current_wpb = false;
|
||||
_home_elm.shift();
|
||||
} else {
|
||||
current_wpb = current_elm = false;
|
||||
}
|
||||
|
||||
if (current_wpb || current_elm) {
|
||||
$.ajax({
|
||||
url: ajax_admin_demo_data,
|
||||
type: 'post',
|
||||
timeout: 300000,
|
||||
data: {
|
||||
action: 'nasa_import_home',
|
||||
wpb: (current_wpb ? current_wpb : ''),
|
||||
elm: (current_elm ? current_elm : '')
|
||||
},
|
||||
success: function (res) {
|
||||
if (res === '1') {
|
||||
_imported_home += 1;
|
||||
$('.statistic-homes').html(_imported_home + '/' + _count_home);
|
||||
}
|
||||
|
||||
if (_imported_home >= _count_home) {
|
||||
$('.processing-steps li[data-step="5"]').removeClass('runing');
|
||||
$('.processing-steps li[data-step="5"]').addClass('finished');
|
||||
$('.processing-steps li[data-step="6"]').addClass('runing');
|
||||
}
|
||||
|
||||
_run = false;
|
||||
},
|
||||
error: function() {
|
||||
$('.processing-steps li[data-step="5"]').removeClass('runing');
|
||||
$('.processing-steps li[data-step="5"]').addClass('fail');
|
||||
$('.processing-steps li[data-step="6"]').addClass('runing');
|
||||
|
||||
_run = false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$('.processing-steps li[data-step="5"]').removeClass('runing');
|
||||
$('.processing-steps li[data-step="5"]').addClass('finished');
|
||||
$('.processing-steps li[data-step="6"]').addClass('runing');
|
||||
|
||||
_run = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 6
|
||||
* Import RevSlider
|
||||
*
|
||||
* @param {type} $
|
||||
* @returns {undefined}
|
||||
*/
|
||||
function nasa_import_revslider($) {
|
||||
var _li = $("li.nasa-item-rev:not(.item-loaded)").first();
|
||||
|
||||
/**
|
||||
* Next step
|
||||
*/
|
||||
if ($(_li).length <= 0) {
|
||||
$('.processing-steps li[data-step="6"]').removeClass('runing');
|
||||
$('.processing-steps li[data-step="6"]').addClass('finished');
|
||||
$('.processing-steps li[data-step="7"]').addClass('runing');
|
||||
|
||||
setTimeout(function() {
|
||||
_run = false;
|
||||
}, 500);
|
||||
} else {
|
||||
/**
|
||||
* Next item to import
|
||||
*/
|
||||
var _revslider = $(_li).attr('data-file');
|
||||
|
||||
$(_li).addClass('loading');
|
||||
|
||||
$.ajax({
|
||||
url: ajax_admin_demo_data,
|
||||
type: 'post',
|
||||
timeout: 300000,
|
||||
data: {
|
||||
action: 'nasa_import_revslider',
|
||||
'revslider': _revslider
|
||||
},
|
||||
success: function (res) {
|
||||
if (res === '1') {
|
||||
$(_li).removeClass('loading');
|
||||
$(_li).addClass('item-loaded');
|
||||
$(_li).addClass('finished');
|
||||
} else {
|
||||
$(_li).removeClass('loading');
|
||||
$(_li).addClass('item-loaded');
|
||||
$(_li).addClass('fail');
|
||||
}
|
||||
|
||||
_run = false;
|
||||
},
|
||||
error: function() {
|
||||
$(_li).removeClass('loading');
|
||||
$(_li).addClass('item-loaded');
|
||||
$(_li).addClass('fail');
|
||||
|
||||
_run = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/* function nasa_import_revsliders($) {
|
||||
$.ajax({
|
||||
url: ajax_admin_demo_data,
|
||||
type: 'post',
|
||||
timeout: 300000,
|
||||
data: {
|
||||
action: 'nasa_import_revsliders'
|
||||
},
|
||||
success: function (res) {
|
||||
if (res === '1') {
|
||||
$('.processing-steps li[data-step="6"]').removeClass('runing');
|
||||
$('.processing-steps li[data-step="6"]').addClass('finished');
|
||||
$('.processing-steps li[data-step="7"]').addClass('runing');
|
||||
} else {
|
||||
$('.processing-steps li[data-step="6"]').removeClass('runing');
|
||||
$('.processing-steps li[data-step="6"]').addClass('fail');
|
||||
$('.processing-steps li[data-step="7"]').addClass('runing');
|
||||
}
|
||||
|
||||
_run = false;
|
||||
},
|
||||
error: function() {
|
||||
$('.processing-steps li[data-step="6"]').removeClass('runing');
|
||||
$('.processing-steps li[data-step="6"]').addClass('fail');
|
||||
$('.processing-steps li[data-step="7"]').addClass('runing');
|
||||
|
||||
_run = false;
|
||||
}
|
||||
});
|
||||
} */
|
||||
|
||||
/**
|
||||
* Step 7
|
||||
* Global Options
|
||||
*
|
||||
* @param {type} $
|
||||
* @returns {undefined}
|
||||
*/
|
||||
function nasa_global_options($) {
|
||||
$.ajax({
|
||||
url: ajax_admin_demo_data,
|
||||
type: 'post',
|
||||
timeout: 300000,
|
||||
data: {
|
||||
action: 'nasa_global_options'
|
||||
},
|
||||
success: function (res) {
|
||||
if (res === '1') {
|
||||
var permalink_url = $('.nasa-start-import.selected').attr('data-permalink-option');
|
||||
$.ajax({
|
||||
url: permalink_url,
|
||||
type: 'get',
|
||||
cache: false,
|
||||
data: {},
|
||||
success: function(res) {
|
||||
var $html = $.parseHTML(res);
|
||||
var _back_menu = $('#adminmenu', $html);
|
||||
|
||||
if ($('#adminmenu').length) {
|
||||
$('#adminmenu').replaceWith(_back_menu);
|
||||
|
||||
if ($('#menu-settings').length) {
|
||||
$('#menu-settings').removeClass('wp-menu-open');
|
||||
$('#menu-settings').removeClass('wp-has-current-submenu');
|
||||
$('#menu-settings').addClass('wp-not-current-submenu');
|
||||
$('#menu-settings').find('a.menu-top').removeClass('wp-has-current-submenu').addClass('wp-not-current-submenu');
|
||||
}
|
||||
|
||||
if ($('#menu-appearance').length){
|
||||
$('#menu-appearance').removeClass('wp-not-current-submenu');
|
||||
$('#menu-appearance').addClass('wp-has-current-submenu');
|
||||
$('#menu-appearance').addClass('wp-menu-open');
|
||||
$('#menu-appearance').find('a.menu-top').removeClass('wp-not-current-submenu').addClass('wp-has-current-submenu');
|
||||
}
|
||||
}
|
||||
|
||||
$('.processing-steps li[data-step="7"]').removeClass('runing');
|
||||
$('.processing-steps li[data-step="7"]').addClass('finished');
|
||||
|
||||
_run = false;
|
||||
},
|
||||
error: function() {
|
||||
$('.processing-steps li[data-step="7"]').removeClass('runing');
|
||||
$('.processing-steps li[data-step="7"]').addClass('finished');
|
||||
|
||||
_run = false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$('.processing-steps li[data-step="7"]').removeClass('runing');
|
||||
$('.processing-steps li[data-step="7"]').addClass('fail');
|
||||
|
||||
_run = false;
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
$('.processing-steps li[data-step="7"]').removeClass('runing');
|
||||
$('.processing-steps li[data-step="7"]').addClass('fail');
|
||||
|
||||
_run = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* All Steps
|
||||
* Step Install Demo Data
|
||||
*
|
||||
* @param {type} $
|
||||
* @returns {undefined}
|
||||
*/
|
||||
function nasa_import_demo_data($) {
|
||||
var _step = $('.processing-steps li.runing').attr('data-step');
|
||||
if (_step) {
|
||||
switch (_step) {
|
||||
case '1':
|
||||
nasa_install_child_theme($);
|
||||
break;
|
||||
|
||||
case '2':
|
||||
nasa_install_plugins($);
|
||||
break;
|
||||
|
||||
case '3':
|
||||
nasa_import_data($);
|
||||
break;
|
||||
|
||||
case '4':
|
||||
nasa_import_widgets_sidebar($);
|
||||
break;
|
||||
|
||||
case '5':
|
||||
nasa_import_homes($);
|
||||
break;
|
||||
|
||||
case '6':
|
||||
nasa_import_revslider($);
|
||||
break;
|
||||
|
||||
case '7':
|
||||
nasa_global_options($);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,910 @@
|
||||
var top_bar_left_df = '';
|
||||
var content_custom_df = '';
|
||||
var time_delay = 200;
|
||||
var time_out_input = null;
|
||||
var mediaUploader;
|
||||
|
||||
jQuery(document).ready(function($) {
|
||||
"use strict";
|
||||
|
||||
// loadListIcons($);
|
||||
|
||||
var text_now = $('textarea#topbar_left').val();
|
||||
$('body').on('click', '.reset_topbar_left', function() {
|
||||
if ($('textarea#topbar_left').val() !== top_bar_left_df) {
|
||||
var _confirm = confirm('Are you sure to reset top bar left ?');
|
||||
|
||||
if (_confirm) {
|
||||
$('textarea#topbar_left').val(top_bar_left_df);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$('body').on('click', '.restore_topbar_left', function() {
|
||||
if (text_now !== $('textarea#topbar_left').val()) {
|
||||
var _confirm = confirm('Are you sure to restore top bar left ?');
|
||||
|
||||
if (_confirm) {
|
||||
$('textarea#topbar_left').val(text_now);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
var text_content_now = $('textarea#content_custom').val();
|
||||
$('body').on('click', '.reset_content_custom', function() {
|
||||
if ($('textarea#content_custom').val() !== content_custom_df) {
|
||||
var _confirm = confirm('Are you sure to reset your content custom ?');
|
||||
|
||||
if (_confirm) {
|
||||
$('textarea#content_custom').val(content_custom_df);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$('body').on('click', '.restore_content_custom', function() {
|
||||
if (text_content_now !== $('textarea#content_custom').val()) {
|
||||
var _confirm = confirm('Are you sure to restore your content custom ?');
|
||||
|
||||
if (_confirm) {
|
||||
$('textarea#content_custom').val(text_content_now);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$('body').on('click', '.toggle-choose-icon-btn', function() {
|
||||
$(this).parents('.widget-content').find('.toggle-choose-icon').toggleClass('hidden-tag');
|
||||
});
|
||||
|
||||
$('body').on('click', '.nasa-chosen-icon', function() {
|
||||
var _fill = $(this).attr('data-fill');
|
||||
if (_fill) {
|
||||
if ($('.nasa-list-icons-select').length < 1) {
|
||||
$.ajax({
|
||||
url: ajaxurl,
|
||||
type: 'get',
|
||||
dataType: 'html',
|
||||
data: {
|
||||
action: 'nasa_list_fonts_admin',
|
||||
fill: _fill
|
||||
},
|
||||
success: function(res) {
|
||||
$('body').append(res);
|
||||
$('body').append('<div class="nasa-tranparent" />');
|
||||
$('.nasa-list-icons-select').animate({right: 0}, 300);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$('body').append('<div class="nasa-tranparent" />');
|
||||
$('.nasa-list-icons-select').attr('data-fill', _fill);
|
||||
$('.nasa-list-icons-select').animate({right: 0}, 300);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$('body').on('click', '.nasa-tranparent', function() {
|
||||
if ($('.nasa-list-icons-select').length) {
|
||||
$('.nasa-list-icons-select').animate({right: '-500px'}, 300);
|
||||
}
|
||||
$(this).remove();
|
||||
});
|
||||
|
||||
// Search icons
|
||||
$('body').on('keyup', '.nasa-input-search-icon', function() {
|
||||
searchIcons($);
|
||||
});
|
||||
|
||||
$('body').on('click', '.nasa-fill-icon', function() {
|
||||
var _val = $(this).attr('data-val');
|
||||
var _fill = $(this).parent().attr('data-fill');
|
||||
|
||||
if ($('#'+_fill).length) {
|
||||
$('#'+_fill).val(_val);
|
||||
}
|
||||
|
||||
if ($('input[name="'+_fill+'"]').length) {
|
||||
$('input[name="'+_fill+'"]').val(_val);
|
||||
}
|
||||
|
||||
if ($('#ico-'+_fill).length) {
|
||||
$('#ico-'+_fill).html('<i class="' + _val + '"></i><a href="javascript:void(0);" class="nasa-remove-icon" data-id="' + _fill + '"><i class="fa fa-remove"></i></a>');
|
||||
}
|
||||
|
||||
$('.nasa-tranparent').click();
|
||||
});
|
||||
|
||||
$('body').on('click', '.nasa-remove-icon', function() {
|
||||
var _fill = $(this).attr('data-id');
|
||||
|
||||
if ($('#'+_fill).length) {
|
||||
$('#'+_fill).val('');
|
||||
}
|
||||
|
||||
if ($('input[name="'+_fill+'"]').length) {
|
||||
$('input[name="'+_fill+'"]').val('');
|
||||
}
|
||||
|
||||
if ($('#ico-'+_fill).length) {
|
||||
$('#ico-'+_fill).html('');
|
||||
}
|
||||
});
|
||||
|
||||
loadColorPicker($);
|
||||
$('.widget-control-save').ajaxComplete(function() {
|
||||
loadColorPicker($);
|
||||
});
|
||||
|
||||
$(document).ajaxComplete(function() {
|
||||
if ($('input[name="section_nasa_icon"]').length) {
|
||||
$('input[name="section_nasa_icon"]').attr('readonly', true);
|
||||
}
|
||||
|
||||
if ($('.vc_ui-panel-window select[name="i_type"]').length) {
|
||||
var _change = false;
|
||||
$('.vc_ui-panel-window select[name="i_type"] option').each(function() {
|
||||
if ('fontawesome' !== $(this).attr('value')) {
|
||||
$(this).remove();
|
||||
|
||||
_change = true;
|
||||
}
|
||||
});
|
||||
|
||||
if (_change) {
|
||||
$('.vc_ui-panel-window select[name="i_type"]').val('fontawesome').trigger('change');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('body').on('change', '.nasa-select-attr', function() {
|
||||
var _warp = $(this).parents('.widget-content');
|
||||
if ($(_warp).find('.nasa-vari-type').val() === '1') {
|
||||
var taxonomy = $(this).val(),
|
||||
num = $(this).attr('data-num'),
|
||||
instance = $(_warp).find('.nasa-widget-instance').attr('data-instance');
|
||||
loadColorDefault($, _warp, taxonomy, num, instance, false);
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
$('body').on('change', '.nasa-vari-type', function() {
|
||||
var _warp = $(this).parents('.widget-content'),
|
||||
taxonomy = $(_warp).find('.nasa-select-attr').val(),
|
||||
num = $(_warp).find('.nasa-select-attr').attr('data-num'),
|
||||
instance = $(_warp).find('.nasa-widget-instance').attr('data-instance');
|
||||
if ($(this).val() === '1') {
|
||||
loadColorDefault($, _warp, taxonomy, num, instance, true);
|
||||
} else {
|
||||
unloadColor($, _warp);
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
// Option Breadcrumb
|
||||
if ($('.nasa-breadcrumb-flag-option input[type="checkbox"]').is(':checked')) {
|
||||
$('.nasa-breadcrumb-type-option').show();
|
||||
$('.nasa-breadcrumb-align-option').show();
|
||||
if ($('.nasa-breadcrumb-type-option').find('select').val() === 'has-background') {
|
||||
$('.nasa-breadcrumb-bg-option').show();
|
||||
// $('.nasa-breadcrumb-bg-lax').show();
|
||||
loadImgOpBreadcrumb($);
|
||||
}
|
||||
}
|
||||
|
||||
$('body').on('change', '.nasa-breadcrumb-flag-option input[type="checkbox"]', function() {
|
||||
if ($(this).is(':checked')) {
|
||||
$('.nasa-breadcrumb-type-option').fadeIn(200);
|
||||
$('.nasa-breadcrumb-align-option').fadeIn(200);
|
||||
if ($('.nasa-breadcrumb-type-option').find('select').val() === 'has-background') {
|
||||
$('.nasa-breadcrumb-bg-option').fadeIn(200);
|
||||
// $('.nasa-breadcrumb-bg-lax').fadeIn(200);
|
||||
loadImgOpBreadcrumb($);
|
||||
}
|
||||
} else {
|
||||
$('.nasa-breadcrumb-type-option').fadeOut(200);
|
||||
$('.nasa-breadcrumb-bg-option').fadeOut(200);
|
||||
// $('.nasa-breadcrumb-bg-lax').fadeOut(200);
|
||||
$('.nasa-breadcrumb-align-option').fadeOut(200);
|
||||
}
|
||||
});
|
||||
|
||||
$('body').on('change', '.nasa-breadcrumb-type-option select', function() {
|
||||
if ($(this).val() === 'has-background') {
|
||||
$('.nasa-breadcrumb-bg-option').fadeIn(200);
|
||||
$('.nasa-breadcrumb-color-option').fadeIn(200);
|
||||
// $('.nasa-breadcrumb-bg-lax').fadeIn(200);
|
||||
$('.nasa-breadcrumb-height-option').fadeIn(200);
|
||||
$('.nasa-breadcrumb-text-option').fadeIn(200);
|
||||
loadImgOpBreadcrumb($);
|
||||
} else {
|
||||
$('.nasa-breadcrumb-bg-option').fadeOut(200);
|
||||
$('.nasa-breadcrumb-color-option').fadeOut(200);
|
||||
// $('.nasa-breadcrumb-bg-lax').fadeOut(200);
|
||||
$('.nasa-breadcrumb-height-option').fadeOut(200);
|
||||
$('.nasa-breadcrumb-text-option').fadeOut(200);
|
||||
}
|
||||
});
|
||||
|
||||
/* if ($('.type_promotion select').length) {
|
||||
var val_promotion = $('.type_promotion select').val();
|
||||
if (val_promotion === 'custom') {
|
||||
$('.nasa-custom_content').show();
|
||||
} else if (val_promotion === 'list-posts') {
|
||||
$('.nasa-list_post').show();
|
||||
}
|
||||
$('body').on('change', '.type_promotion select', function() {
|
||||
var val_promotion = $(this).val();
|
||||
if (val_promotion === 'custom') {
|
||||
$('.nasa-custom_content').fadeIn(200);
|
||||
$('.nasa-list_post').fadeOut(200);
|
||||
} else if (val_promotion === 'list-posts') {
|
||||
$('.nasa-custom_content').fadeOut(200);
|
||||
$('.nasa-list_post').fadeIn(200);
|
||||
}
|
||||
});
|
||||
} */
|
||||
|
||||
/* if ($('.nasa-header-type-select input[type="radio"][name="header-type"]').length > 0) {
|
||||
var _val_header = $('.nasa-header-type-select input[type="radio"][name="header-type"]:checked').val();
|
||||
$('.nasa-header-type-select-' + _val_header).slideDown(200);
|
||||
|
||||
$('body').on('click', '.nasa-header-type-select img.of-radio-img-img', function() {
|
||||
var _val_header = $('.nasa-header-type-select input[type="radio"][name="header-type"]:checked').val();
|
||||
$('.nasa-header-type-select-' + _val_header).slideDown(200);
|
||||
$('.nasa-header-type-child').each(function() {
|
||||
if (!$(this).hasClass('nasa-header-type-select-' + _val_header)) {
|
||||
$(this).slideUp(200);
|
||||
}
|
||||
});
|
||||
});
|
||||
} */
|
||||
|
||||
/* if ($('.nasa-type-font select').length) {
|
||||
var _val_font = $('.nasa-type-font select').val();
|
||||
$('.nasa-type-font-' + _val_font).slideDown(200);
|
||||
|
||||
$('body').on('change', '.nasa-type-font select', function() {
|
||||
var _val_font = $(this).val();
|
||||
$('.nasa-type-font-glb').slideUp(200);
|
||||
$('.nasa-type-font-' + _val_font).slideDown(200);
|
||||
});
|
||||
} */
|
||||
|
||||
$('.nasa-theme-option-parent select').each(function() {
|
||||
var _val = $(this).val();
|
||||
var _id = $(this).attr('id');
|
||||
$('.nasa-' + _id + '.nasa-theme-option-child').hide();
|
||||
$('.nasa-' + _id + '-' + _val + '.nasa-theme-option-child').show();
|
||||
});
|
||||
|
||||
$('body').on('change', '.nasa-theme-option-parent select', function() {
|
||||
var _val = $(this).val();
|
||||
var _id = $(this).attr('id');
|
||||
|
||||
$('.nasa-' + _id + '.nasa-theme-option-child').slideUp(200);
|
||||
$('.nasa-' + _id + '-' + _val + '.nasa-theme-option-child').slideDown(200);
|
||||
});
|
||||
|
||||
if ($('.nasa-theme-option-parent input[type="radio"]:checked').length) {
|
||||
$('.nasa-theme-option-parent input[type="radio"]:checked').each(function() {
|
||||
var _this = $(this);
|
||||
var _val = $(_this).val();
|
||||
var _id = $(_this).attr('name');
|
||||
|
||||
$('.nasa-' + _id + '.nasa-theme-option-child').hide();
|
||||
$('.nasa-' + _id + '-' + _val + '.nasa-theme-option-child').show();
|
||||
});
|
||||
}
|
||||
|
||||
$('body').on('click', '.nasa-theme-option-parent img.of-radio-img-img', function() {
|
||||
var _this = $(this);
|
||||
var _parents = $(_this).parents('.nasa-theme-option-parent');
|
||||
var _val = $(_parents).find('input[type="radio"]:checked').val();
|
||||
var _id = $(_parents).find('input[type="radio"]:checked').attr('name');
|
||||
|
||||
$('.nasa-' + _id + '.nasa-theme-option-child').slideUp(200);
|
||||
$('.nasa-' + _id + '-' + _val + '.nasa-theme-option-child').slideDown(200);
|
||||
});
|
||||
|
||||
if ($('.nasa-topbar_toggle input[type="checkbox"]').is(':checked')) {
|
||||
$('.nasa-topbar_df-show').show();
|
||||
}
|
||||
|
||||
$('body').on('change', '.nasa-topbar_toggle input[type="checkbox"]', function() {
|
||||
if ($(this).is(':checked')) {
|
||||
$('.nasa-topbar_df-show').slideDown(200);
|
||||
} else {
|
||||
$('.nasa-topbar_df-show').slideUp(200);
|
||||
}
|
||||
});
|
||||
|
||||
$('body').on('ns_main_child', function () {
|
||||
if ($('[data-child_of]').length) {
|
||||
$('[data-child_of]').each(function() {
|
||||
var _this = $(this);
|
||||
var _main = $(_this).attr('data-child_of');
|
||||
|
||||
if (_main && $('#section-' + _main).length) {
|
||||
var _vals_str = $(_this).attr('data-target');
|
||||
var _vals = _vals_str ? _vals_str.split(',') : [];
|
||||
|
||||
var _main_val = '';
|
||||
|
||||
/**
|
||||
* For Checkbox
|
||||
*/
|
||||
if ($('#section-' + _main).find('input[type="checkbox"]').length) {
|
||||
if ($('#section-' + _main).find('input[type="checkbox"]').is(':checked')) {
|
||||
_main_val = $('#section-' + _main).find('input[type="checkbox"]').val();
|
||||
} else {
|
||||
_main_val = $('#section-' + _main).find('input[type="hidden"]').val();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* For Radio
|
||||
*/
|
||||
if ($('#section-' + _main).find('input[type="radio"]').length) {
|
||||
$('#section-' + _main).find('input[type="radio"]').each(function () {
|
||||
if ($(this).is(':checked')) {
|
||||
_main_val = $(this).val();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* For Select
|
||||
*/
|
||||
if ($('#section-' + _main).find('select').length) {
|
||||
_main_val = $('#section-' + _main).find('select').val();
|
||||
}
|
||||
|
||||
if (_vals.indexOf(_main_val) !== -1) {
|
||||
$(_this).removeClass('ns-child-hide');
|
||||
} else {
|
||||
if (!$(_this).hasClass('ns-child-hide')) {
|
||||
$(_this).addClass('ns-child-hide');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}).trigger('ns_main_child');
|
||||
|
||||
$('body').on('change', '.section-switch .checkbox, .section-images .checkbox, .section-select select', function() {
|
||||
$('body').trigger('ns_main_child');
|
||||
});
|
||||
|
||||
/**
|
||||
* Ajax field
|
||||
*
|
||||
* @param {type} $
|
||||
* @returns {undefined}
|
||||
*/
|
||||
$('body').on('click', '.nasa-init-ajax', function() {
|
||||
var _wrap = $(this).parents('.nasa-opt-ajax-wrap');
|
||||
$(_wrap).find('.nasa-info-ajax').hide();
|
||||
$(_wrap).find('.nasa-do-ajax').show();
|
||||
});
|
||||
|
||||
$('body').on('click', '.nasa-cancel-ajax', function() {
|
||||
var _wrap = $(this).parents('.nasa-opt-ajax-wrap');
|
||||
$(_wrap).find('.nasa-info-ajax').show();
|
||||
$(_wrap).find('.nasa-do-ajax').hide();
|
||||
});
|
||||
|
||||
$('body').on('click', '.nasa-apply-ajax', function() {
|
||||
if (!_disable_save) {
|
||||
_disable_save = true;
|
||||
|
||||
var _this = $(this);
|
||||
var _wrap = $(_this).parents('.nasa-opt-ajax-wrap');
|
||||
var _action = $(_this).attr('data-action');
|
||||
var _old_val = $(_wrap).find('input.nasa-org-input').val();
|
||||
var _value = $(_wrap).find('input.nasa-do-ajax-input').val();
|
||||
|
||||
if (_value && _value !== _old_val) {
|
||||
$.ajax({
|
||||
url: ajaxurl,
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
cache: false,
|
||||
data: {
|
||||
action: _action,
|
||||
data_value: _value
|
||||
},
|
||||
beforeSend: function() {
|
||||
$(_wrap).addClass('nasa-loading');
|
||||
},
|
||||
success: function(res) {
|
||||
if (res.success === 'ok') {
|
||||
$(_wrap).find('.value-show').html(res.result);
|
||||
|
||||
$(_wrap).find('input.nasa-do-ajax-input').val(res.result).trigger('change');
|
||||
$(_wrap).find('input.nasa-org-input').val(res.result).trigger('change');
|
||||
|
||||
$(_wrap).find('.nasa-ajax-mess').html(res.mess);
|
||||
$(_wrap).find('.nasa-ajax-mess').show();
|
||||
|
||||
$(_wrap).removeClass('nasa-loading');
|
||||
|
||||
$(_wrap).find('.nasa-cancel-ajax').trigger('click');
|
||||
|
||||
setTimeout(function() {
|
||||
_disable_save = false;
|
||||
}, 100);
|
||||
|
||||
setTimeout(function() {
|
||||
$(_wrap).find('.nasa-ajax-mess').fadeOut(300);
|
||||
}, 3000);
|
||||
} else {
|
||||
$(_wrap).find('.nasa-ajax-mess').html(res.mess);
|
||||
$(_wrap).find('.nasa-ajax-mess').show();
|
||||
|
||||
$(_wrap).removeClass('nasa-loading');
|
||||
|
||||
setTimeout(function() {
|
||||
_disable_save = false;
|
||||
}, 100);
|
||||
|
||||
setTimeout(function() {
|
||||
$(_wrap).find('.nasa-ajax-mess').fadeOut(300);
|
||||
}, 3000);
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
$(_wrap).removeClass('nasa-loading');
|
||||
|
||||
setTimeout(function() {
|
||||
_disable_save = false;
|
||||
}, 100);
|
||||
|
||||
setTimeout(function() {
|
||||
$(_wrap).find('.nasa-ajax-mess').fadeOut(300);
|
||||
}, 3000);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
_disable_save = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('body').on('change', '#white_lbl', function() {
|
||||
if ($(this).is(':checked')) {
|
||||
$('.nasa-online-doc').hide();
|
||||
} else {
|
||||
$('.nasa-online-doc').show();
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
*
|
||||
* Toggle Section
|
||||
*/
|
||||
$('body').on('click', '.ns-toggle-section', function() {
|
||||
var _wrap = $(this).parents('.section');
|
||||
$(this).toggleClass('ns-hide');
|
||||
$(_wrap).toggleClass('ns-hide');
|
||||
});
|
||||
|
||||
/**
|
||||
*
|
||||
* Toggle Sections
|
||||
*/
|
||||
$('body').on('click', '.ns-toggle-sections', function() {
|
||||
var _this = $(this);
|
||||
var _wrap = $(_this).parents('.section-info');
|
||||
var _show = $(_this).hasClass('ns-hide') ? true : false;
|
||||
if (_show) {
|
||||
$(_this).removeClass('ns-hide');
|
||||
}
|
||||
else {
|
||||
$(_this).addClass('ns-hide');
|
||||
}
|
||||
|
||||
var _next = $(_wrap).next();
|
||||
ns_toggle_sections($, _next, _show);
|
||||
});
|
||||
|
||||
/* $('body').on('ns_check_ct_categories', function() {
|
||||
if ($('#enable_nasa_custom_categories').length) {
|
||||
if ($('#enable_nasa_custom_categories').is(':checked')) {
|
||||
$('#section-nasa_custom_categories_slug').fadeIn(200);
|
||||
$('#section-archive_product_nasa_custom_categories').fadeIn(200);
|
||||
$('#section-max_level_nasa_custom_categories').fadeIn(200);
|
||||
}
|
||||
else {
|
||||
$('#section-nasa_custom_categories_slug').fadeOut(200);
|
||||
$('#section-archive_product_nasa_custom_categories').fadeOut(200);
|
||||
$('#section-max_level_nasa_custom_categories').fadeOut(200);
|
||||
}
|
||||
}
|
||||
}).trigger('ns_check_ct_categories');
|
||||
|
||||
$('body').on('change', '#enable_nasa_custom_categories', function() {
|
||||
$('body').trigger('ns_check_ct_categories');
|
||||
}); */
|
||||
|
||||
$('body').on('click', '.ns-show-less', function() {
|
||||
var _wrap = $(this).parents('.ns-show-less-wrap');
|
||||
if ($(_wrap).length) {
|
||||
$(_wrap).toggleClass('show-less');
|
||||
}
|
||||
});
|
||||
|
||||
if ($('#wpwrap').length && $('.ns-need-update-core-notice').length) {
|
||||
var _padding = $('.ns-need-update-core-notice').outerHeight();
|
||||
$('#wpwrap').css({'padding-bottom': _padding});
|
||||
}
|
||||
|
||||
$('body').on('keyup', '#search_otp', function(e) {
|
||||
var _str = $(this).val();
|
||||
var _expand_opts = $('body').find('#expand_options');
|
||||
var _section_info = null;
|
||||
|
||||
if (typeof time_out_input !== 'undefined' && time_out_input) {
|
||||
clearTimeout(time_out_input);
|
||||
}
|
||||
|
||||
time_out_input = setTimeout(function() {
|
||||
|
||||
$('body').trigger('clear-search-otp');
|
||||
|
||||
if (_str.trim().length >= 3) {
|
||||
if ($(_expand_opts).hasClass('expand')) {
|
||||
$(_expand_opts).trigger('click');
|
||||
}
|
||||
|
||||
$("#content .section").each(function() {
|
||||
var _this = $(this);
|
||||
var _pa = $(_this).parents('.group');
|
||||
var _str2 = $(_this).find('h3.heading').text();
|
||||
|
||||
$('#content').addClass('opt-searching');
|
||||
|
||||
if ($(_this).hasClass('section-info')) {
|
||||
_section_info = _this;
|
||||
} else {
|
||||
if (_str2.toUpperCase().includes(_str.toUpperCase().trim()) && !$(_this).hasClass('ns-child-hide')) {
|
||||
|
||||
$(_this).addClass('ns-opt-found');
|
||||
|
||||
if (!$(_pa).hasClass('ns-gr-found')) {
|
||||
$(_pa).addClass('ns-gr-found');
|
||||
}
|
||||
|
||||
if (!$(_section_info).hasClass('section-info-found') && $(_section_info).parents('.group').length) {
|
||||
$(_section_info).addClass('section-info-found');
|
||||
_section_info = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$('#content').removeClass('opt-searching');
|
||||
|
||||
if ($(_expand_opts).hasClass('close')) {
|
||||
$(_expand_opts).trigger('click');
|
||||
}
|
||||
}
|
||||
},time_delay);
|
||||
});
|
||||
|
||||
$('body').on('clear-search-otp', function() {
|
||||
$("#content .section").each(function() {
|
||||
var _this = $(this);
|
||||
var _pa = $(_this).parents('.group');
|
||||
|
||||
if ($(_pa).hasClass('ns-gr-found')) {
|
||||
$(_pa).removeClass('ns-gr-found');
|
||||
}
|
||||
|
||||
if ($(_this).hasClass('ns-opt-found')) {
|
||||
$(_this).removeClass('ns-opt-found');
|
||||
}
|
||||
|
||||
if ($(_this).hasClass('section-info-found')) {
|
||||
$(_this).removeClass('section-info-found');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Actived theme options menu
|
||||
*/
|
||||
$('body').on('ns_check_theme_menu_current', function() {
|
||||
if ($('.toplevel_page_nasa-theme-options.wp-not-current-submenu .wp-submenu .current').length) {
|
||||
$('.toplevel_page_nasa-theme-options.wp-not-current-submenu').removeClass('wp-not-current-submenu').addClass('wp-has-current-submenu');
|
||||
}
|
||||
}).trigger('ns_check_theme_menu_current');
|
||||
|
||||
$('body').on('ns_init_ns_hfe_type_edit', function() {
|
||||
if ($('.ns-hfe-type select').length) {
|
||||
$('.ns-hfe-type select').each(function() {
|
||||
var _this = $(this);
|
||||
var _wrap = $(_this).parents('.ns-hfe-type');
|
||||
var _href = $(_wrap).find('.nshfe-edit').length ? $(_wrap).find('.nshfe-edit').attr('data-href') : null;
|
||||
|
||||
if (_href) {
|
||||
var _id = $(_this).val();
|
||||
|
||||
if (_id && _id !== '0') {
|
||||
_href = _href.replace(/ns_hfe_id/g, _id);
|
||||
$(_wrap).find('.nshfe-edit').attr('href', _href);
|
||||
$(_wrap).find('.nshfe-edit').attr('target', '_blank');
|
||||
$(_wrap).find('.nshfe-edit').show();
|
||||
} else {
|
||||
$(_wrap).find('.nshfe-edit').removeAttr('target');
|
||||
$(_wrap).find('.nshfe-edit').attr('href', '#');
|
||||
$(_wrap).find('.nshfe-edit').hide();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}).trigger('ns_init_ns_hfe_type_edit');
|
||||
|
||||
$('body').on('change', '.ns-hfe-type select', function() {
|
||||
$('body').trigger('ns_init_ns_hfe_type_edit');
|
||||
});
|
||||
|
||||
$('body').on('ns_init_ns_wpb_type_edit', function() {
|
||||
if ($('.ns-wpb-type select').length) {
|
||||
$('.ns-wpb-type select').each(function() {
|
||||
var _this = $(this);
|
||||
var _wrap = $(_this).parents('.ns-wpb-type');
|
||||
var _href = $(_wrap).find('.nswpb-edit').length ? $(_wrap).find('.nswpb-edit').attr('data-href') : null;
|
||||
|
||||
if (_href) {
|
||||
var _id = $(_this).find('option:selected').attr('data-id');
|
||||
|
||||
if (_id && _id !== '0') {
|
||||
_href = _href.replace(/ns_wpb_id/g, _id);
|
||||
$(_wrap).find('.nswpb-edit').attr('href', _href);
|
||||
$(_wrap).find('.nswpb-edit').attr('target', '_blank');
|
||||
$(_wrap).find('.nswpb-edit').show();
|
||||
} else {
|
||||
$(_wrap).find('.nswpb-edit').removeAttr('target');
|
||||
$(_wrap).find('.nswpb-edit').attr('href', '#');
|
||||
$(_wrap).find('.nswpb-edit').hide();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}).trigger('ns_init_ns_wpb_type_edit');
|
||||
|
||||
$('body').on('change', '.ns-wpb-type select', function() {
|
||||
$('body').trigger('ns_init_ns_wpb_type_edit');
|
||||
});
|
||||
|
||||
$('body').on('ns_init_ns_blk_type_edit', function() {
|
||||
if ($('.ns-block-type select').length) {
|
||||
$('.ns-block-type select').each(function() {
|
||||
var _this = $(this);
|
||||
var _wrap = $(_this).parents('.ns-block-type');
|
||||
|
||||
var _href_stb = $(_wrap).find('.nsblk-edit').length ? $(_wrap).find('.nsblk-edit').attr('data-stb-href') : null;
|
||||
var _href_ctb = $(_wrap).find('.nsblk-edit').length ? $(_wrap).find('.nsblk-edit').attr('data-ctb-href') : null;
|
||||
|
||||
if (_href_stb && _href_ctb) {
|
||||
var _id = $(_this).find('option:selected').attr('data-id');
|
||||
var _type = $(_this).find('option:selected').attr('data-type');
|
||||
|
||||
if (_id && _id !== '0') {
|
||||
var _href = _type === 'nshfe' ? _href_ctb : _href_stb;
|
||||
_href = _href.replace(/ns_blk_id/g, _id);
|
||||
|
||||
$(_wrap).find('.nsblk-edit').attr('href', _href);
|
||||
$(_wrap).find('.nsblk-edit').attr('target', '_blank');
|
||||
$(_wrap).find('.nsblk-edit').show();
|
||||
} else {
|
||||
$(_wrap).find('.nsblk-edit').removeAttr('target');
|
||||
$(_wrap).find('.nsblk-edit').attr('href', '#');
|
||||
$(_wrap).find('.nsblk-edit').hide();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}).trigger('ns_init_ns_blk_type_edit');
|
||||
|
||||
$('body').on('change', '.ns-block-type select', function() {
|
||||
$('body').trigger('ns_init_ns_blk_type_edit');
|
||||
});
|
||||
|
||||
$('body').on('ns_init_ns_wpcf7_type_edit', function() {
|
||||
if ($('.ns-wpcf7-type select').length) {
|
||||
$('.ns-wpcf7-type select').each(function() {
|
||||
var _this = $(this);
|
||||
var _wrap = $(_this).parents('.ns-wpcf7-type');
|
||||
var _href = $(_wrap).find('.nswpcf7-edit').length ? $(_wrap).find('.nswpcf7-edit').attr('data-href') : null;
|
||||
|
||||
if (_href) {
|
||||
var _id = parseInt($(_this).val());
|
||||
|
||||
if (_id) {
|
||||
_href = _href.replace(/ns_wpcf7_id/g, _id);
|
||||
$(_wrap).find('.nswpcf7-edit').attr('href', _href);
|
||||
$(_wrap).find('.nswpcf7-edit').attr('target', '_blank');
|
||||
$(_wrap).find('.nswpcf7-edit').show();
|
||||
} else {
|
||||
$(_wrap).find('.nswpcf7-edit').removeAttr('target');
|
||||
$(_wrap).find('.nswpcf7-edit').attr('href', '#');
|
||||
$(_wrap).find('.nswpcf7-edit').hide();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}).trigger('ns_init_ns_wpcf7_type_edit');
|
||||
|
||||
$('body').on('change', '.ns-wpcf7-type select', function() {
|
||||
$('body').trigger('ns_init_ns_wpcf7_type_edit');
|
||||
});
|
||||
|
||||
$('body').on('click', '.nasa-item-review-thumb .item-review-thumb-remove', function() {
|
||||
var _this = $(this),
|
||||
_pa = $(_this).parent('.nasa-item-review-thumb'),
|
||||
_input_id = $('.nasa-wrap-review-thumb').find('input[name="data-medias-id"]'),
|
||||
id_remove = $(_this).attr('data-id_media'),
|
||||
_ids = JSON.parse($(_input_id).val());
|
||||
|
||||
_ids = _ids.filter(function(id) {
|
||||
return id != id_remove;
|
||||
});
|
||||
|
||||
$(_input_id).val(JSON.stringify(_ids));
|
||||
|
||||
$(_pa).remove();
|
||||
});
|
||||
|
||||
$('body').on('click', '.nasa-wrap-review-thumb .media_upload_button', function(e) {
|
||||
e.preventDefault();
|
||||
var _input_id = $('.nasa-wrap-review-thumb').find('input[name="data-medias-id"]'),
|
||||
_ids = $(_input_id).val() ? JSON.parse($(_input_id).val()) : [];
|
||||
|
||||
if (mediaUploader) {
|
||||
mediaUploader.open();
|
||||
return;
|
||||
}
|
||||
|
||||
mediaUploader = wp.media.frames.file_frame = wp.media({
|
||||
multiple: true
|
||||
});
|
||||
|
||||
mediaUploader.on('select', function() {
|
||||
var selection = mediaUploader.state().get('selection');
|
||||
var urls = [];
|
||||
|
||||
selection.map(function(attachment) {
|
||||
var media = '';
|
||||
attachment = attachment.toJSON();
|
||||
_ids.push(attachment.id);
|
||||
|
||||
if (attachment.mime.startsWith('video/')) {
|
||||
media = '<video controls autoplay loop><source src="' + attachment.url + '" type="' + attachment.mime + '"></video>';
|
||||
} else {
|
||||
media = '<img src="' + attachment.url + '"/>';
|
||||
}
|
||||
|
||||
$('.nasa-wrap-review-thumb').find('.media_upload_button').before('<div class="nasa-item-review-thumb">' + media + '<a href="javascript:void(0);" data-id_media="' + attachment.id + '" class="item-review-thumb-remove button-primary"><svg class="ns-df-cart-svg" width="25" height="25" stroke-width="2" viewBox="0 0 24 24" fill="currentColor"><path d="M12 6V18" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6 12H18" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></svg></a></div>');
|
||||
});
|
||||
|
||||
$(_input_id).val(JSON.stringify(_ids));
|
||||
});
|
||||
|
||||
// Mở media uploader
|
||||
mediaUploader.open();
|
||||
});
|
||||
|
||||
/* =============== End document ready !!! ================== */
|
||||
});
|
||||
|
||||
function loadImgOpBreadcrumb($) {
|
||||
if ($('.nasa-breadcrumb-bg-option .screenshot').length && $('.nasa-breadcrumb-bg-option #breadcrumb_bg_upload').val() !== '') {
|
||||
if ($('.nasa-breadcrumb-bg-option .screenshot').html() === '') {
|
||||
$('.nasa-breadcrumb-bg-option .screenshot').html('<img class="of-option-image" src="' + $('.nasa-breadcrumb-bg-option #breadcrumb_bg_upload').val() + '" />');
|
||||
$('.upload_button_div .remove-image').removeClass('hide').show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function loadColorDefault($, _warp, _taxonomy, _num, _instance, _check) {
|
||||
if (_check && $(_warp).find('.nasa_p_color').length) {
|
||||
var _this = $(_warp).find('.nasa_p_color');
|
||||
$(_this).find('input').prop('disabled', false);
|
||||
$(_this).show();
|
||||
}else{
|
||||
_instance = _instance.toLocaleString();
|
||||
$.ajax({
|
||||
url: ajaxurl,
|
||||
type: 'post',
|
||||
dataType: 'html',
|
||||
data: {
|
||||
action: 'nasa_list_colors_admin',
|
||||
taxonomy: _taxonomy,
|
||||
num: _num,
|
||||
instance: _instance
|
||||
},
|
||||
success: function(res) {
|
||||
$(_warp).find('.nasa_p_color').remove();
|
||||
$(_warp).append(res);
|
||||
loadColorPicker($);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function unloadColor($, _warp) {
|
||||
var _this = $(_warp).find('.nasa_p_color');
|
||||
$(_this).find('input').prop('disabled', true);
|
||||
$(_this).hide();
|
||||
}
|
||||
|
||||
function loadColorPicker($) {
|
||||
$('.nasa-color-field').each(function() {
|
||||
if ($(this).parents('.wp-picker-container').length < 1) {
|
||||
$(this).wpColorPicker();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function loadListIcons($) {
|
||||
if ($('.nasa-list-icons-select').length < 1) {
|
||||
$.ajax({
|
||||
url: ajaxurl,
|
||||
type: 'get',
|
||||
dataType: 'html',
|
||||
data: {
|
||||
action: 'nasa_list_fonts_admin',
|
||||
fill: ''
|
||||
},
|
||||
success: function(res) {
|
||||
$('body').append(res);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function searchIcons($) {
|
||||
var _textsearch = $.trim($('.nasa-input-search-icon').val());
|
||||
if (_textsearch === '') {
|
||||
$('.nasa-font-icons').fadeIn(200);
|
||||
} else {
|
||||
var patt = new RegExp(_textsearch);
|
||||
$('.nasa-font-icons').each(function() {
|
||||
var _sstext = $(this).attr('data-text');
|
||||
if (patt.test(_sstext)) {
|
||||
$(this).fadeIn(200);
|
||||
} else {
|
||||
$(this).fadeOut(200);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function ns_toggle_sections($, _tag, _show) {
|
||||
if ($(_tag).length && !$(_tag).hasClass('section-info')) {
|
||||
if (_show) {
|
||||
$(_tag).slideDown(200);
|
||||
} else {
|
||||
$(_tag).slideUp(200);
|
||||
}
|
||||
|
||||
var _next = $(_tag).next();
|
||||
|
||||
ns_toggle_sections($, _next, _show);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
jQuery(document).ready(function($){
|
||||
"use strict";
|
||||
|
||||
$('body').on('nasa_admin_init_select2', function() {
|
||||
if ($('select.nasa-ad-select2:not(.nasa-inited)').length) {
|
||||
$('select.nasa-ad-select2:not(.nasa-inited)').each(function() {
|
||||
$(this).addClass('nasa-inited');
|
||||
$(this).select2();
|
||||
});
|
||||
}
|
||||
}).trigger('nasa_admin_init_select2');
|
||||
|
||||
/* =============== End document ready !!! ================== */
|
||||
});
|
||||
+6436
File diff suppressed because it is too large
Load Diff
+16
File diff suppressed because one or more lines are too long
Vendored
+5725
File diff suppressed because it is too large
Load Diff
+8
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
+16
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
+8
File diff suppressed because one or more lines are too long
@@ -0,0 +1,746 @@
|
||||
/**
|
||||
* SMOF js
|
||||
*
|
||||
* contains the core functionalities to be used
|
||||
* inside SMOF
|
||||
*/
|
||||
jQuery.noConflict();
|
||||
|
||||
_msie = false;
|
||||
_msie_version = 0;
|
||||
if (typeof navigator.userAgentData === 'undefined' && navigator.userAgent.match(/MSIE ([0-9]+)\./)) {
|
||||
_msie = true;
|
||||
_msie_version = RegExp.$1;
|
||||
}
|
||||
|
||||
var _disable_save = false;
|
||||
|
||||
/** Fire up jQuery - let's dance!
|
||||
*/
|
||||
jQuery(document).ready(function($) {
|
||||
|
||||
//(un)fold options in a checkbox-group
|
||||
$('.fld').on('click', function () {
|
||||
var $fold = '.f_' + this.id;
|
||||
$($fold).slideToggle('normal', "swing");
|
||||
});
|
||||
|
||||
//Color picker
|
||||
$('.of-color').wpColorPicker();
|
||||
|
||||
//hides warning if js is enabled
|
||||
$('#js-warning').hide();
|
||||
|
||||
//Tabify Options
|
||||
$('.group').hide();
|
||||
|
||||
// Get the URL parameter for tab
|
||||
function getURLParameter(name) {
|
||||
return decodeURI((RegExp(name + '=' + '(.+?)(&|$)').exec(location.search) || [, ''])[1]);
|
||||
}
|
||||
|
||||
// If the $_GET param of tab is set, use that for the tab that should be open
|
||||
if (getURLParameter('tab') != "") {
|
||||
$.cookie('of_current_opt', '#' + getURLParameter('tab'), {expires: 7, path: '/'});
|
||||
}
|
||||
|
||||
// Display last current tab
|
||||
if ($.cookie("of_current_opt") === null) {
|
||||
$('.group:first-child').fadeIn(200);
|
||||
$('#of-nav li:first-child').addClass('current');
|
||||
} else {
|
||||
var hooks = $('#hooks').html();
|
||||
hooks = JSON.parse(hooks);
|
||||
|
||||
$.each(hooks, function (key, value) {
|
||||
if ($.cookie("of_current_opt") == '#of-option-' + value) {
|
||||
$('.group#of-option-' + value).fadeIn(200);
|
||||
$('#of-nav li.' + value).addClass('current');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//Current Menu Class
|
||||
$('#of-nav li a').on('click', function (evt) {
|
||||
evt.preventDefault();
|
||||
|
||||
$('#of-nav li').removeClass('current');
|
||||
$(this).parent().addClass('current');
|
||||
var clicked_group = $(this).attr('href');
|
||||
$.cookie('of_current_opt', clicked_group, {expires: 7, path: '/'});
|
||||
$('.group').hide();
|
||||
$(clicked_group).fadeIn(200);
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
//Expand Options
|
||||
var flip = 0;
|
||||
|
||||
$('#expand_options').on('click', function () {
|
||||
if (flip == 0) {
|
||||
flip = 1;
|
||||
$('#of_container #of-nav').hide();
|
||||
$('#of_container #content').width('100%');
|
||||
$('#of_container .group').add('#of_container .group h2').show();
|
||||
|
||||
$(this).removeClass('expand');
|
||||
$(this).addClass('close');
|
||||
$(this).text('Close');
|
||||
} else {
|
||||
flip = 0;
|
||||
$('#of_container #of-nav').show();
|
||||
$('#of_container #content').width('75%');
|
||||
$('#of_container .group').add('#of_container .group h2').hide();
|
||||
$('#of_container .group:first-child').show();
|
||||
$('#of_container #of-nav li').removeClass('current');
|
||||
$('#of_container #of-nav li:first-child').addClass('current');
|
||||
|
||||
$(this).removeClass('close');
|
||||
$(this).addClass('expand');
|
||||
$(this).text('Expand');
|
||||
$('#content').removeClass('opt-searching');
|
||||
$('body').trigger('clear-search-otp');
|
||||
}
|
||||
});
|
||||
|
||||
//Update Message popup
|
||||
$.fn.center = function () {
|
||||
this.animate({"top": ($(window).height() - this.height() - 200) / 2 + $(window).scrollTop() + "px"}, 100);
|
||||
this.css("left", ($('#of_container').length && $('#of_container').width() > 270) ? (($('#of_container').width() - 270) / 2) : 250);
|
||||
return this;
|
||||
};
|
||||
|
||||
// $('#of-popup-save').center();
|
||||
// $('#of-popup-reset').center();
|
||||
// $('#of-popup-fail').center();
|
||||
|
||||
// $(window).on('scroll', function () {
|
||||
// $('#of-popup-save').center();
|
||||
// $('#of-popup-reset').center();
|
||||
// $('#of-popup-fail').center();
|
||||
// });
|
||||
|
||||
//Masked Inputs (images as radio buttons)
|
||||
/* $('.of-radio-img-img').on('click', function () {
|
||||
$(this).parent().parent().find('.of-radio-img-img').removeClass('of-radio-img-selected');
|
||||
$(this).addClass('of-radio-img-selected');
|
||||
}); */
|
||||
|
||||
$('body').on('click', '.ns-radio-img-a', function() {
|
||||
var _this = $(this);
|
||||
var _wrap = $(_this).parents('.of-radio-img-wrap');
|
||||
var _wrap_all = $(_this).parents('.controls');
|
||||
$(_wrap_all).find('.ns-radio-img-a').removeClass('ns-radio-img-selected');
|
||||
$(_wrap_all).find('input[type="radio"]').prop('checked', false);
|
||||
|
||||
if (!$(_this).hasClass('ns-radio-img-selected')) {
|
||||
$(_this).addClass('ns-radio-img-selected');
|
||||
}
|
||||
|
||||
$(_wrap).find('input[type="radio"]').prop('checked', true).trigger('change');
|
||||
|
||||
if ($(_wrap).find('input[type="radio"]').val() == 'new-3') {
|
||||
var _target_wrap = $('input[value="accordion"]').parents('.of-radio-img-wrap');
|
||||
$(_target_wrap).find('.ns-radio-img-a').trigger('click');
|
||||
}
|
||||
});
|
||||
|
||||
$('.of-radio-img-label').hide();
|
||||
$('.of-radio-img-img').show();
|
||||
$('.of-radio-img-radio').hide();
|
||||
|
||||
//Masked Inputs (background images as radio buttons)
|
||||
$('.of-radio-tile-img').on('click', function () {
|
||||
$(this).parent().parent().find('.of-radio-tile-img').removeClass('of-radio-tile-selected');
|
||||
$(this).addClass('of-radio-tile-selected');
|
||||
});
|
||||
|
||||
$('.of-radio-tile-label').hide();
|
||||
$('.of-radio-tile-img').show();
|
||||
$('.of-radio-tile-radio').hide();
|
||||
|
||||
// Style Select
|
||||
(function ($) {
|
||||
styleSelect = {
|
||||
init: function () {
|
||||
$('.select_wrapper').each(function () {
|
||||
$(this).prepend('<span>' + $(this).find('.select option:selected').text() + '</span>');
|
||||
});
|
||||
$('body').on('change', '.select', function () {
|
||||
$(this).prev('span').replaceWith('<span>' + $(this).find('option:selected').text() + '</span>');
|
||||
});
|
||||
$('.select').on('change', function (event) {
|
||||
$(this).prev('span').replaceWith('<span>' + $(this).find('option:selected').text() + '</span>');
|
||||
});
|
||||
}
|
||||
};
|
||||
$(document).ready(function () {
|
||||
styleSelect.init();
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
/** Aquagraphite Slider MOD */
|
||||
|
||||
//Hide (Collapse) the toggle containers on load
|
||||
$(".slide_body").hide();
|
||||
|
||||
//Switch the "Open" and "Close" state per click then slide up/down (depending on open/close state)
|
||||
$('body').on('click', ".slide_edit_button", function () {
|
||||
/*
|
||||
//display as an collapses
|
||||
$(".slide_header").removeClass("active");
|
||||
$(".slide_body").slideUp("fast");
|
||||
*/
|
||||
//toggle for each
|
||||
$(this).parent().toggleClass("active").next().slideToggle("fast");
|
||||
|
||||
return false; //Prevent the browser jump to the link anchor
|
||||
});
|
||||
|
||||
// Update slide title upon typing
|
||||
function update_slider_title(e) {
|
||||
var element = e;
|
||||
if (this.timer) {
|
||||
clearTimeout(element.timer);
|
||||
}
|
||||
this.timer = setTimeout(function () {
|
||||
$(element).parent().prev().find('strong').text(element.value);
|
||||
}, 100);
|
||||
return true;
|
||||
}
|
||||
|
||||
$('body').on('keyup', '.of-slider-title', function () {
|
||||
update_slider_title(this);
|
||||
});
|
||||
|
||||
//Remove individual slide
|
||||
$('body').on('click', '.slide_delete_button', function () {
|
||||
// event.preventDefault();
|
||||
var agree = confirm("Are you sure you wish to delete this slide?");
|
||||
if (agree) {
|
||||
var $trash = $(this).parents('li');
|
||||
//$trash.slideUp('slow', function(){ $trash.remove(); }); //chrome + confirm bug made slideUp not working...
|
||||
$trash.animate({
|
||||
opacity: 0.25,
|
||||
height: 0
|
||||
}, 500, function () {
|
||||
$(this).remove();
|
||||
});
|
||||
return false; //Prevent the browser jump to the link anchor
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
//Add new slide
|
||||
$('body').on('click', ".slide_add_button", function () {
|
||||
var slidesContainer = $(this).prev();
|
||||
var sliderId = slidesContainer.attr('id');
|
||||
|
||||
var numArr = $('#' + sliderId + ' li').find('.order').map(function () {
|
||||
var str = this.id;
|
||||
str = str.replace(/\D/g, '');
|
||||
str = parseFloat(str);
|
||||
return str;
|
||||
}).get();
|
||||
|
||||
var maxNum = Math.max.apply(Math, numArr);
|
||||
if (maxNum < 1) {
|
||||
maxNum = 0;
|
||||
}
|
||||
var newNum = maxNum + 1;
|
||||
|
||||
var newSlide = '<li class="temphide"><div class="slide_header"><strong>Slide ' + newNum + '</strong><input type="hidden" class="slide of-input order" name="' + sliderId + '[' + newNum + '][order]" id="' + sliderId + '_slide_order-' + newNum + '" value="' + newNum + '"><a class="slide_edit_button" href="#">Edit</a></div><div class="slide_body" style="display: none; "><label>Title</label><input class="slide of-input of-slider-title" name="' + sliderId + '[' + newNum + '][title]" id="' + sliderId + '_' + newNum + '_slide_title" value=""><label>Image URL</label><input class="upload slide of-input" name="' + sliderId + '[' + newNum + '][url]" id="' + sliderId + '_' + newNum + '_slide_url" value=""><div class="upload_button_div"><span class="button media_upload_button" id="' + sliderId + '_' + newNum + '">Upload</span><span class="button remove-image hide" id="reset_' + sliderId + '_' + newNum + '" title="' + sliderId + '_' + newNum + '">Remove</span></div><div class="screenshot"></div><label>Link URL (optional)</label><input class="slide of-input" name="' + sliderId + '[' + newNum + '][link]" id="' + sliderId + '_' + newNum + '_slide_link" value=""><label>Description (optional)</label><textarea class="slide of-input" name="' + sliderId + '[' + newNum + '][description]" id="' + sliderId + '_' + newNum + '_slide_description" cols="8" rows="8"></textarea><a class="slide_delete_button" href="#">Delete</a><div class="clear"></div></div></li>';
|
||||
|
||||
slidesContainer.append(newSlide);
|
||||
var nSlide = slidesContainer.find('.temphide');
|
||||
nSlide.fadeIn('fast', function () {
|
||||
$(this).removeClass('temphide');
|
||||
});
|
||||
|
||||
optionsframework_file_bindings(); // re-initialise upload image..
|
||||
|
||||
return false; //prevent jumps, as always..
|
||||
});
|
||||
|
||||
//Sort slides
|
||||
$('.slider').find('ul').each(function () {
|
||||
var id = $(this).attr('id');
|
||||
$('#' + id).sortable({
|
||||
placeholder: "placeholder",
|
||||
opacity: 0.6,
|
||||
handle: ".slide_header",
|
||||
cancel: "a"
|
||||
});
|
||||
});
|
||||
|
||||
/** Sorter (Layout Manager) */
|
||||
$('.sorter').each(function () {
|
||||
var id = $(this).attr('id');
|
||||
$('#' + id).find('ul').sortable({
|
||||
items: 'li',
|
||||
placeholder: "placeholder",
|
||||
connectWith: '.sortlist_' + id,
|
||||
opacity: 0.6,
|
||||
update: function () {
|
||||
$(this).find('.position').each(function () {
|
||||
var listID = $(this).parent().attr('id');
|
||||
var parentID = $(this).parent().parent().attr('id');
|
||||
parentID = parentID.replace(id + '_', '');
|
||||
var optionID = $(this).parent().parent().parent().attr('id');
|
||||
$(this).prop("name", optionID + '[' + parentID + '][' + listID + ']');
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/** Ajax Backup & Restore MOD */
|
||||
//backup button
|
||||
$('body').on('click', '#of_backup_button', function () {
|
||||
var answer = confirm("Click OK to backup your current saved options.")
|
||||
|
||||
if (answer) {
|
||||
var clickedObject = $(this);
|
||||
var clickedID = $(this).attr('id');
|
||||
|
||||
var nonce = $('#security').val();
|
||||
|
||||
var data = {
|
||||
action: 'of_ajax_post_action',
|
||||
type: 'backup_options',
|
||||
security: nonce
|
||||
};
|
||||
|
||||
$.post(ajaxurl, data, function (response) {
|
||||
//check nonce
|
||||
if (response == -1) { //failed
|
||||
var fail_popup = $('#of-popup-fail');
|
||||
fail_popup.addClass('active');
|
||||
window.setTimeout(function () {
|
||||
fail_popup.removeClass('active');
|
||||
}, 2000);
|
||||
} else {
|
||||
var success_popup = $('#of-popup-save');
|
||||
success_popup.addClass('active');
|
||||
window.setTimeout(function () {
|
||||
location.reload();
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
//restore button
|
||||
$('body').on('click', '#of_restore_button', function () {
|
||||
var answer = confirm("'Warning: All of your current options will be replaced with the data from your last backup! Proceed?");
|
||||
if (answer) {
|
||||
|
||||
var clickedObject = $(this);
|
||||
var clickedID = $(this).attr('id');
|
||||
|
||||
var nonce = $('#security').val();
|
||||
|
||||
var data = {
|
||||
action: 'of_ajax_post_action',
|
||||
type: 'restore_options',
|
||||
security: nonce
|
||||
};
|
||||
|
||||
$.post(ajaxurl, data, function (response) {
|
||||
//check nonce
|
||||
if (response == -1) { //failed
|
||||
var fail_popup = $('#of-popup-fail');
|
||||
fail_popup.addClass('active');
|
||||
window.setTimeout(function () {
|
||||
fail_popup.removeClass('active');
|
||||
}, 2000);
|
||||
} else {
|
||||
var success_popup = $('#of-popup-save');
|
||||
success_popup.addClass('active');
|
||||
window.setTimeout(function () {
|
||||
location.reload();
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
/** Ajax Transfer (Import/Export) Option */
|
||||
$('body').on('click', '#of_import_button', function () {
|
||||
var answer = confirm("Click OK to import options.");
|
||||
|
||||
if (answer) {
|
||||
var clickedObject = $(this);
|
||||
var clickedID = $(this).attr('id');
|
||||
|
||||
var nonce = $('#security').val();
|
||||
|
||||
var import_data = $('#export_data').val();
|
||||
|
||||
var data = {
|
||||
action: 'of_ajax_post_action',
|
||||
type: 'import_options',
|
||||
security: nonce,
|
||||
data: import_data
|
||||
};
|
||||
|
||||
$.post(ajaxurl, data, function (response) {
|
||||
var fail_popup = $('#of-popup-fail');
|
||||
var success_popup = $('#of-popup-save');
|
||||
|
||||
//check nonce
|
||||
if (response == -1) { //failed
|
||||
fail_popup.addClass('active');
|
||||
window.setTimeout(function () {
|
||||
fail_popup.removeClass('active');
|
||||
}, 2000);
|
||||
} else {
|
||||
success_popup.addClass('active');
|
||||
window.setTimeout(function () {
|
||||
location.reload();
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
/** AJAX Save Options */
|
||||
$('body').on('click', '.nasa-of_save', function () {
|
||||
if (!_disable_save) {
|
||||
_disable_save = true;
|
||||
|
||||
var nonce = $('#security').val();
|
||||
|
||||
$('.ajax-loading-img').fadeIn();
|
||||
|
||||
//get serialized data from all our option fields
|
||||
var serializedReturn = $('#of_form :input[name][name!="security"][name!="of_reset"]').serialize();
|
||||
|
||||
$('#of_form :input[type=checkbox]').each(function () {
|
||||
if (!this.checked) {
|
||||
serializedReturn += '&' + this.name + '=0';
|
||||
}
|
||||
});
|
||||
|
||||
var data = {
|
||||
type: 'save',
|
||||
action: 'of_ajax_post_action',
|
||||
security: nonce,
|
||||
data: serializedReturn
|
||||
};
|
||||
|
||||
$.post(ajaxurl, data, function (response) {
|
||||
var success = $('#of-popup-save');
|
||||
var fail = $('#of-popup-fail');
|
||||
var loading = $('.ajax-loading-img');
|
||||
loading.fadeOut();
|
||||
|
||||
if (response == 1) {
|
||||
success.addClass('active');
|
||||
|
||||
_disable_save = false;
|
||||
} else {
|
||||
fail.addClass('active');
|
||||
|
||||
_disable_save = false;
|
||||
}
|
||||
|
||||
window.setTimeout(function () {
|
||||
success.removeClass('active');
|
||||
fail.removeClass('active');
|
||||
}, 2000);
|
||||
});
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
/* AJAX Options Reset */
|
||||
$('#of_reset').on('click', function () {
|
||||
if (!_disable_save) {
|
||||
_disable_save = true;
|
||||
|
||||
//confirm reset
|
||||
var answer = confirm("Click OK to reset. All settings will be lost and replaced with default settings!");
|
||||
|
||||
//ajax reset
|
||||
if (answer) {
|
||||
var nonce = $('#security').val();
|
||||
|
||||
$('.ajax-reset-loading-img').fadeIn();
|
||||
|
||||
var data = {
|
||||
type: 'reset',
|
||||
action: 'of_ajax_post_action',
|
||||
security: nonce
|
||||
};
|
||||
|
||||
$.post(ajaxurl, data, function (response) {
|
||||
var success = $('#of-popup-reset');
|
||||
var fail = $('#of-popup-fail');
|
||||
var loading = $('.ajax-reset-loading-img');
|
||||
loading.fadeOut();
|
||||
|
||||
if (response == 1) {
|
||||
success.addClass('active');
|
||||
window.setTimeout(function () {
|
||||
location.reload();
|
||||
}, 1000);
|
||||
} else {
|
||||
fail.addClass('active');
|
||||
window.setTimeout(function () {
|
||||
fail.removeClass('active');
|
||||
}, 2000);
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
_disable_save = false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
/** Tipsy @since v1.3 */
|
||||
/* if ($().tipsy) {
|
||||
$('.tooltip, .typography-size, .typography-height, .typography-face, .typography-style, .of-typography-color').tipsy({
|
||||
fade: true,
|
||||
gravity: 's',
|
||||
opacity: 0.7
|
||||
});
|
||||
} */
|
||||
|
||||
/**
|
||||
* JQuery UI Slider function
|
||||
* Dependencies : jquery, jquery-ui-slider
|
||||
* Feature added by : Smartik - http://smartik.ws/
|
||||
* Date : 03.17.2013
|
||||
*/
|
||||
$('.smof_sliderui').each(function () {
|
||||
var obj = $(this);
|
||||
var sId = "#" + obj.data('id');
|
||||
var val = parseInt(obj.data('val'));
|
||||
var min = parseInt(obj.data('min'));
|
||||
var max = parseInt(obj.data('max'));
|
||||
var step = parseInt(obj.data('step'));
|
||||
|
||||
//slider init
|
||||
obj.slider({
|
||||
value: val,
|
||||
min: min,
|
||||
max: max,
|
||||
step: step,
|
||||
range: "min",
|
||||
slide: function (event, ui) {
|
||||
$(sId).val(ui.value);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Switch
|
||||
* Dependencies : jquery
|
||||
* Feature added by : Smartik - http://smartik.ws/
|
||||
* Date : 03.17.2013
|
||||
*/
|
||||
$(".cb-enable").on('click', function () {
|
||||
var parent = $(this).parents('.switch-options');
|
||||
$('.cb-disable', parent).removeClass('selected');
|
||||
$(this).addClass('selected');
|
||||
$('.main_checkbox', parent).attr('checked', true);
|
||||
|
||||
//fold/unfold related options
|
||||
var obj = $(this);
|
||||
var $fold = '.f_' + obj.data('id');
|
||||
$($fold).slideDown('normal', "swing");
|
||||
|
||||
$('.main_checkbox', parent).trigger('change');
|
||||
});
|
||||
|
||||
$(".cb-disable").on('click', function () {
|
||||
var parent = $(this).parents('.switch-options');
|
||||
$('.cb-enable', parent).removeClass('selected');
|
||||
$(this).addClass('selected');
|
||||
$('.main_checkbox', parent).attr('checked', false);
|
||||
|
||||
//fold/unfold related options
|
||||
var obj = $(this);
|
||||
var $fold = '.f_' + obj.data('id');
|
||||
$($fold).slideUp('normal', "swing");
|
||||
|
||||
$('.main_checkbox', parent).trigger('change');
|
||||
});
|
||||
|
||||
$('body').on('change', '#section-f_buildin .main_checkbox', function() {
|
||||
var is_check = $(this).is(':checked');
|
||||
|
||||
if (!is_check) {
|
||||
var _current = $('#section-footer_mode #footer_mode').val();
|
||||
$('#section-footer_mode #footer_mode option[value="build-in"]').attr('disabled', true);
|
||||
|
||||
if (_current === 'build-in') {
|
||||
if ($('#section-footer_mode #footer_mode option[value="builder"]').length) {
|
||||
$('#section-footer_mode #footer_mode').val('builder').trigger('change');
|
||||
} else {
|
||||
if ($('#section-footer_mode #footer_mode option[value="builder-e"]').length) {
|
||||
$('#section-footer_mode #footer_mode').val('builder-e').trigger('change');
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$('#section-footer_mode #footer_mode option[value="build-in"]').attr('disabled', false);
|
||||
}
|
||||
});
|
||||
|
||||
if ($('#section-f_buildin .main_checkbox').length) {
|
||||
$('#section-f_buildin .main_checkbox').trigger('change');
|
||||
}
|
||||
|
||||
$('body').on('click', '.of-uploaded-image', function() {
|
||||
var _wrap = $(this).parents('.controls');
|
||||
if ($(_wrap).length && $(_wrap).find('.media_upload_button').length) {
|
||||
$(_wrap).find('.media_upload_button').trigger('click');
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Google Fonts
|
||||
* Dependencies : google.com, jquery
|
||||
* Feature added by : Smartik - http://smartik.ws/
|
||||
* Date : 03.17.2013
|
||||
*/
|
||||
function google_font_select(slctr, mainID) {
|
||||
var _selected = $(slctr).val(); //get current value - selected and saved
|
||||
var _linkclass = 'style_link_' + mainID;
|
||||
var _previewer = mainID + '_ggf_previewer';
|
||||
|
||||
if (_selected) { //if var exists and isset
|
||||
|
||||
$('.' + _previewer).fadeIn();
|
||||
|
||||
//Check if selected is not equal with "Select a font" and execute the script.
|
||||
if (_selected !== 'none' && _selected !== 'Select a font') {
|
||||
|
||||
//remove other elements crested in <head>
|
||||
$('.' + _linkclass).remove();
|
||||
|
||||
//replace spaces with "+" sign
|
||||
var the_font = _selected.replace(/\s+/g, '+'),
|
||||
font_not = ['Arial', 'Trebuchet', 'Times', 'Tahoma', 'Helvetica'];
|
||||
|
||||
if(font_not.indexOf(the_font) === -1) {
|
||||
//add reference to google font family
|
||||
$('head').append('<link href="https://fonts.googleapis.com/css?family=' + the_font + '" rel="stylesheet" type="text/css" class="' + _linkclass + '" />');
|
||||
}
|
||||
|
||||
//show in the preview box the font
|
||||
$('.' + _previewer).css('font-family', _selected + ', sans-serif');
|
||||
} else {
|
||||
//if selected is not a font remove style "font-family" at preview box
|
||||
$('.' + _previewer).css('font-family', '');
|
||||
$('.' + _previewer).fadeOut();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//init for each element
|
||||
$('.google_font_select').each(function () {
|
||||
var mainID = $(this).attr('id');
|
||||
google_font_select(this, mainID);
|
||||
});
|
||||
|
||||
//init when value is changed
|
||||
$('.google_font_select').change(function () {
|
||||
var mainID = $(this).attr('id');
|
||||
google_font_select(this, mainID);
|
||||
});
|
||||
|
||||
/**
|
||||
* Media Uploader
|
||||
* Dependencies : jquery, wp media uploader
|
||||
* Feature added by : Smartik - http://smartik.ws/
|
||||
* Date : 05.28.2013
|
||||
*/
|
||||
function optionsframework_add_file(event, selector) {
|
||||
var upload = $(".uploaded-file"), frame;
|
||||
var $el = $(this);
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
// If the media frame already exists, reopen it.
|
||||
if (frame) {
|
||||
frame.open();
|
||||
return;
|
||||
}
|
||||
|
||||
// Create the media frame.
|
||||
frame = wp.media({
|
||||
// Set the title of the modal.
|
||||
title: $el.data('choose'),
|
||||
|
||||
// Customize the submit button.
|
||||
button: {
|
||||
// Set the text of the button.
|
||||
text: $el.data('update'),
|
||||
// Tell the button not to close the modal, since we're
|
||||
// going to refresh the page when the image is selected.
|
||||
close: false
|
||||
}
|
||||
});
|
||||
|
||||
// When an image is selected, run a callback.
|
||||
frame.on('select', function () {
|
||||
// Grab the selected attachment.
|
||||
var attachment = frame.state().get('selection').first();
|
||||
frame.close();
|
||||
// selector.find('.upload').val(attachment.attributes.id);
|
||||
selector.find('.upload').val(attachment.attributes.url);
|
||||
if (attachment.attributes.type == 'image') {
|
||||
selector.find('.screenshot').empty().hide().append('<img class="of-option-image" src="' + attachment.attributes.url + '" />').slideDown('fast');
|
||||
}
|
||||
selector.find('.media_upload_button').trigger('off');
|
||||
selector.find('.remove-image').show().removeClass('hide');//show "Remove" button
|
||||
selector.find('.of-background-properties').slideDown();
|
||||
optionsframework_file_bindings();
|
||||
});
|
||||
|
||||
// Finally, open the modal.
|
||||
frame.open();
|
||||
}
|
||||
|
||||
function optionsframework_remove_file(selector) {
|
||||
selector.find('.remove-image').hide().addClass('hide');//hide "Remove" button
|
||||
selector.find('.upload').val('');
|
||||
selector.find('.of-background-properties').hide();
|
||||
selector.find('.screenshot').slideUp();
|
||||
selector.find('.remove-file').trigger('off');
|
||||
// We don't display the upload button if .upload-notice is present
|
||||
// This means the user doesn't have the WordPress 3.5 Media Library Support
|
||||
if ($('.section-upload .upload-notice').length > 0) {
|
||||
$('.media_upload_button').remove();
|
||||
}
|
||||
optionsframework_file_bindings();
|
||||
}
|
||||
|
||||
function optionsframework_file_bindings() {
|
||||
$('.remove-image, .remove-file').on('click', function () {
|
||||
optionsframework_remove_file($(this).parents('.section-upload, .section-media, .slide_body'));
|
||||
});
|
||||
|
||||
$('.media_upload_button').off('click').on('click', function (event) {
|
||||
optionsframework_add_file(event, $(this).parents('.section-upload, .section-media, .slide_body'));
|
||||
});
|
||||
}
|
||||
|
||||
optionsframework_file_bindings();
|
||||
|
||||
}); //end doc ready
|
||||
@@ -0,0 +1,180 @@
|
||||
/*!
|
||||
* jQuery UI Touch Punch 0.2.3
|
||||
*
|
||||
* Copyright 2011–2014, Dave Furfero
|
||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
*
|
||||
* Depends:
|
||||
* jquery.ui.widget.js
|
||||
* jquery.ui.mouse.js
|
||||
*/
|
||||
(function ($) {
|
||||
|
||||
// Detect touch support
|
||||
$.support.touch = 'ontouchend' in document;
|
||||
|
||||
// Ignore browsers without touch support
|
||||
if (!$.support.touch) {
|
||||
return;
|
||||
}
|
||||
|
||||
var mouseProto = $.ui.mouse.prototype,
|
||||
_mouseInit = mouseProto._mouseInit,
|
||||
_mouseDestroy = mouseProto._mouseDestroy,
|
||||
touchHandled;
|
||||
|
||||
/**
|
||||
* Simulate a mouse event based on a corresponding touch event
|
||||
* @param {Object} event A touch event
|
||||
* @param {String} simulatedType The corresponding mouse event
|
||||
*/
|
||||
function simulateMouseEvent (event, simulatedType) {
|
||||
|
||||
// Ignore multi-touch events
|
||||
if (event.originalEvent.touches.length > 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
var touch = event.originalEvent.changedTouches[0],
|
||||
simulatedEvent = document.createEvent('MouseEvents');
|
||||
|
||||
// Initialize the simulated mouse event using the touch event's coordinates
|
||||
simulatedEvent.initMouseEvent(
|
||||
simulatedType, // type
|
||||
true, // bubbles
|
||||
true, // cancelable
|
||||
window, // view
|
||||
1, // detail
|
||||
touch.screenX, // screenX
|
||||
touch.screenY, // screenY
|
||||
touch.clientX, // clientX
|
||||
touch.clientY, // clientY
|
||||
false, // ctrlKey
|
||||
false, // altKey
|
||||
false, // shiftKey
|
||||
false, // metaKey
|
||||
0, // button
|
||||
null // relatedTarget
|
||||
);
|
||||
|
||||
// Dispatch the simulated event to the target element
|
||||
event.target.dispatchEvent(simulatedEvent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the jQuery UI widget's touchstart events
|
||||
* @param {Object} event The widget element's touchstart event
|
||||
*/
|
||||
mouseProto._touchStart = function (event) {
|
||||
|
||||
var self = this;
|
||||
|
||||
// Ignore the event if another widget is already being handled
|
||||
if (touchHandled || !self._mouseCapture(event.originalEvent.changedTouches[0])) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Set the flag to prevent other widgets from inheriting the touch event
|
||||
touchHandled = true;
|
||||
|
||||
// Track movement to determine if interaction was a click
|
||||
self._touchMoved = false;
|
||||
|
||||
// Simulate the mouseover event
|
||||
simulateMouseEvent(event, 'mouseover');
|
||||
|
||||
// Simulate the mousemove event
|
||||
simulateMouseEvent(event, 'mousemove');
|
||||
|
||||
// Simulate the mousedown event
|
||||
simulateMouseEvent(event, 'mousedown');
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle the jQuery UI widget's touchmove events
|
||||
* @param {Object} event The document's touchmove event
|
||||
*/
|
||||
mouseProto._touchMove = function (event) {
|
||||
|
||||
// Ignore event if not handled
|
||||
if (!touchHandled) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Interaction was not a click
|
||||
this._touchMoved = true;
|
||||
|
||||
// Simulate the mousemove event
|
||||
simulateMouseEvent(event, 'mousemove');
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle the jQuery UI widget's touchend events
|
||||
* @param {Object} event The document's touchend event
|
||||
*/
|
||||
mouseProto._touchEnd = function (event) {
|
||||
|
||||
// Ignore event if not handled
|
||||
if (!touchHandled) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Simulate the mouseup event
|
||||
simulateMouseEvent(event, 'mouseup');
|
||||
|
||||
// Simulate the mouseout event
|
||||
simulateMouseEvent(event, 'mouseout');
|
||||
|
||||
// If the touch interaction did not move, it should trigger a click
|
||||
if (!this._touchMoved) {
|
||||
|
||||
// Simulate the click event
|
||||
simulateMouseEvent(event, 'click');
|
||||
}
|
||||
|
||||
// Unset the flag to allow other widgets to inherit the touch event
|
||||
touchHandled = false;
|
||||
};
|
||||
|
||||
/**
|
||||
* A duck punch of the $.ui.mouse _mouseInit method to support touch events.
|
||||
* This method extends the widget with bound touch event handlers that
|
||||
* translate touch events to mouse events and pass them to the widget's
|
||||
* original mouse event handling methods.
|
||||
*/
|
||||
mouseProto._mouseInit = function () {
|
||||
|
||||
var self = this;
|
||||
|
||||
// Delegate the touch handlers to the widget's element
|
||||
self.element.bind({
|
||||
touchstart: $.proxy(self, '_touchStart'),
|
||||
touchmove: $.proxy(self, '_touchMove'),
|
||||
touchend: $.proxy(self, '_touchEnd')
|
||||
});
|
||||
|
||||
// Call the original $.ui.mouse init method
|
||||
_mouseInit.call(self);
|
||||
};
|
||||
|
||||
/**
|
||||
* Remove the touch event handlers
|
||||
*/
|
||||
mouseProto._mouseDestroy = function () {
|
||||
|
||||
var self = this;
|
||||
|
||||
// Delegate the touch handlers to the widget's element
|
||||
self.element.unbind({
|
||||
touchstart: $.proxy(self, '_touchStart'),
|
||||
touchmove: $.proxy(self, '_touchMove'),
|
||||
touchend: $.proxy(self, '_touchEnd')
|
||||
});
|
||||
|
||||
// Call the original $.ui.mouse destroy method
|
||||
_mouseDestroy.call(self);
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,11 @@
|
||||
/*!
|
||||
* jQuery UI Touch Punch 0.2.3
|
||||
*
|
||||
* Copyright 2011–2014, Dave Furfero
|
||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
*
|
||||
* Depends:
|
||||
* jquery.ui.widget.js
|
||||
* jquery.ui.mouse.js
|
||||
*/
|
||||
!function(a){function b(a,b){if(!(a.originalEvent.touches.length>1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var c,d=a.ui.mouse.prototype,e=d._mouseInit,f=d._mouseDestroy;d._touchStart=function(a){var d=this;!c&&d._mouseCapture(a.originalEvent.changedTouches[0])&&(c=!0,d._touchMoved=!1,b(a,"mouseover"),b(a,"mousemove"),b(a,"mousedown"))},d._touchMove=function(a){c&&(this._touchMoved=!0,b(a,"mousemove"))},d._touchEnd=function(a){c&&(b(a,"mouseup"),b(a,"mouseout"),this._touchMoved||b(a,"click"),c=!1)},d._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),e.call(b)},d._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),f.call(b)}}}(jQuery);
|
||||
@@ -0,0 +1,64 @@
|
||||
/* global woocommerce_price_slider_params */
|
||||
jQuery(function($) {
|
||||
|
||||
// woocommerce_price_slider_params is required to continue, ensure the object exists
|
||||
if (typeof woocommerce_price_slider_params === 'undefined') {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get markup ready for slider
|
||||
$('input#min_price, input#max_price').hide();
|
||||
$('.price_slider, .price_label').show();
|
||||
|
||||
// Price slider uses jquery ui
|
||||
var min_price = $('.price_slider_amount #min_price').data('min'),
|
||||
max_price = $('.price_slider_amount #max_price').data('max'),
|
||||
current_min_price = parseInt(min_price, 10),
|
||||
current_max_price = parseInt(max_price, 10);
|
||||
|
||||
if (woocommerce_price_slider_params.min_price) {
|
||||
current_min_price = parseInt(woocommerce_price_slider_params.min_price, 10);
|
||||
}
|
||||
if (woocommerce_price_slider_params.max_price) {
|
||||
current_max_price = parseInt(woocommerce_price_slider_params.max_price, 10);
|
||||
}
|
||||
|
||||
$(document.body).bind('price_slider_create price_slider_slide', function(event, min, max) {
|
||||
if (woocommerce_price_slider_params.currency_pos === 'left') {
|
||||
$('.price_slider_amount span.from').html(woocommerce_price_slider_params.currency_symbol + min);
|
||||
$('.price_slider_amount span.to').html(woocommerce_price_slider_params.currency_symbol + max);
|
||||
} else if (woocommerce_price_slider_params.currency_pos === 'left_space') {
|
||||
$('.price_slider_amount span.from').html(woocommerce_price_slider_params.currency_symbol + ' ' + min);
|
||||
$('.price_slider_amount span.to').html(woocommerce_price_slider_params.currency_symbol + ' ' + max);
|
||||
} else if (woocommerce_price_slider_params.currency_pos === 'right') {
|
||||
$('.price_slider_amount span.from').html(min + woocommerce_price_slider_params.currency_symbol);
|
||||
$('.price_slider_amount span.to').html(max + woocommerce_price_slider_params.currency_symbol);
|
||||
} else if (woocommerce_price_slider_params.currency_pos === 'right_space') {
|
||||
$('.price_slider_amount span.from').html(min + ' ' + woocommerce_price_slider_params.currency_symbol);
|
||||
$('.price_slider_amount span.to').html(max + ' ' + woocommerce_price_slider_params.currency_symbol);
|
||||
}
|
||||
|
||||
$(document.body).trigger('price_slider_updated', [min, max]);
|
||||
});
|
||||
|
||||
$('.price_slider').slider({
|
||||
range: true,
|
||||
animate: true,
|
||||
min: min_price,
|
||||
max: max_price,
|
||||
values: [current_min_price, current_max_price],
|
||||
create: function() {
|
||||
$('.price_slider_amount #min_price').val(current_min_price);
|
||||
$('.price_slider_amount #max_price').val(current_max_price);
|
||||
$(document.body).trigger('price_slider_create', [current_min_price, current_max_price]);
|
||||
},
|
||||
slide: function(event, ui) {
|
||||
$('input#min_price').val(ui.values[0]);
|
||||
$('input#max_price').val(ui.values[1]);
|
||||
$(document.body).trigger('price_slider_slide', [ui.values[0], ui.values[1]]);
|
||||
},
|
||||
change: function(event, ui) {
|
||||
$(document.body).trigger('price_slider_change', [ui.values[0], ui.values[1]]);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
jQuery(function(a){if("undefined"==typeof woocommerce_price_slider_params)return!1;a("input#min_price, input#max_price").hide(),a(".price_slider, .price_label").show();var b=a(".price_slider_amount #min_price").data("min"),c=a(".price_slider_amount #max_price").data("max"),d=parseInt(b,10),e=parseInt(c,10);woocommerce_price_slider_params.min_price&&(d=parseInt(woocommerce_price_slider_params.min_price,10)),woocommerce_price_slider_params.max_price&&(e=parseInt(woocommerce_price_slider_params.max_price,10)),a(document.body).bind("price_slider_create price_slider_slide",function(b,c,d){"left"===woocommerce_price_slider_params.currency_pos?(a(".price_slider_amount span.from").html(woocommerce_price_slider_params.currency_symbol+c),a(".price_slider_amount span.to").html(woocommerce_price_slider_params.currency_symbol+d)):"left_space"===woocommerce_price_slider_params.currency_pos?(a(".price_slider_amount span.from").html(woocommerce_price_slider_params.currency_symbol+" "+c),a(".price_slider_amount span.to").html(woocommerce_price_slider_params.currency_symbol+" "+d)):"right"===woocommerce_price_slider_params.currency_pos?(a(".price_slider_amount span.from").html(c+woocommerce_price_slider_params.currency_symbol),a(".price_slider_amount span.to").html(d+woocommerce_price_slider_params.currency_symbol)):"right_space"===woocommerce_price_slider_params.currency_pos&&(a(".price_slider_amount span.from").html(c+" "+woocommerce_price_slider_params.currency_symbol),a(".price_slider_amount span.to").html(d+" "+woocommerce_price_slider_params.currency_symbol)),a(document.body).trigger("price_slider_updated",[c,d])}),a(".price_slider").slider({range:!0,animate:!0,min:b,max:c,values:[d,e],create:function(){a(".price_slider_amount #min_price").val(d),a(".price_slider_amount #max_price").val(e),a(document.body).trigger("price_slider_create",[d,e])},slide:function(b,c){a("input#min_price").val(c.values[0]),a("input#max_price").val(c.values[1]),a(document.body).trigger("price_slider_slide",[c.values[0],c.values[1]])},change:function(b,c){a(document.body).trigger("price_slider_change",[c.values[0],c.values[1]])}})});
|
||||
Reference in New Issue
Block a user