(function($){
"use strict";
$(document).on('ready', function (){
$('.multi_durations').each(function (){
var $table=jQuery(this);
var duration=$table.find('input.duration');
var durationPlus=$table.find('.duration_plus');
var durationMinus=$table.find('.duration_minus');
$(durationPlus).on('click', function(e){
e.preventDefault();
if(duration.val() < 10){
duration.val(parseInt(duration.val()) + 1);
duration.trigger('change');
}});
$(durationMinus).on('click', function(e){
e.preventDefault();
if(duration.val() > 1){
duration.val(parseInt(duration.val()) - 1);
duration.trigger('change');
}});
duration.on('change', function (){
var currDur=$(this).val();
$table.find('.whmp_price').each(function (){
var currPrice=$(this).data('price' + currDur);
$(this).find('.whmp_actual_price').html(currPrice);
});
$table.find('.whmp_no_years').each(function (){
$(this).text(' (' + currDur + ') ');
})
});
$table.find('.whmp_domain_type_toggle').each(function (){
$(this).on('click', function (){
var curType=$(this).data('tld-type');
$table.find('.whmp_domain_matrix_row').each(function (){
$(this).css('display', 'none');
var curTypes=$(this).data('tld-types');
if(curType==="all"){
$(this).css('display', 'table-row');
}
else if(curTypes.indexOf(curType) >=0){
$(this).css('display', 'table-row');
}});
});
});
$table.find('.whmp_domain_special_toggle').each(function (){
$(this).on('click', function (){
var curType=$(this).data('tld-special');
$table.find('.whmp_domain_matrix_row').each(function (){
$(this).css('display', 'none');
var curTypes=$(this).data('tld-specials');
if(curType==="all"){
$(this).css('display', 'table-row');
}
else if(curTypes.indexOf(curType) >=0){
$(this).css('display', 'table-row');
}});
});
});
});
$('.whmp_dropdown_outer').each(function (){
var container=$(this);
container.on('click', function(e){
e.stopPropagation();
});
container.find('.whmp_dropdown_toggle').on('click', function(e){
e.preventDefault();
$(this).parent('.whmp_dropdown_outer').toggleClass('active');
});
$(document).on('click', function (){
container.removeClass('active');
});
});
});
$(document).on('submit', '.whmpress_domain_search_ajax_extended_search_form', function(e){
var $form=$(this);
if(($form.data('result_div_id'))===undefined){
e.preventDefault();
var parent_container=$form.closest('.whmpress_domain_search_ajax_extended_container');
var results_div=parent_container.find('.whmpress_domain_search_ajax_extended_search_results');
var title_div=parent_container.find('.whmpress_domain_search_ajax_extended_search_result_title');
var title_placeholder=parent_container.find('.whmpress_domain_search_ajax_extended_search_result_title_placeholder');
var load_more_div=parent_container.find('.whmpress_domain_search_ajax_extended_search_results_load_more');
var sld=$form.find('input[name="sld"]').val();
var tld=$form.find('select[name="tld"]').val();
title_div.empty().hide().removeClass('results_loaded');
results_div.empty().hide();
whmpress_added_tlds=[];
title_placeholder.find('.sld_placeholder').text(sld);
title_placeholder.find('.tld_placeholder').text(tld);
title_div.show().html(title_placeholder.html());
whmpress_added_tlds.push(tld);
load_more_div.show().find('button.whmpress_domain_search_ajax_extended_search_load_more_button').trigger('click');
}});
$(document).on('click', '.whmpress_domain_search_ajax_extended_search_load_more_button', function(e){
e.preventDefault();
var parent_container=$(this).closest('.whmpress_domain_search_ajax_extended_container');
var $form=parent_container.find('form.whmpress_domain_search_ajax_extended_search_form');
var results_div=parent_container.find('.whmpress_domain_search_ajax_extended_search_results');
var placeholders_div=parent_container.find('.whmpress_domain_search_ajax_extended_search_results_placeholders');
var submit_field=$form.find('[type="submit"]');
var submit_val=submit_field.html();
var data=$form.serializeArray();
var page_size=$form.find('input[name=page_size]').val();
var sld=$form.find('input[name="sld"]').val();
page_size=parseInt(page_size)||10;
var counter=0;
results_div.show();
$.each(whmpress_all_tlds, function(i){
if(whmpress_added_tlds.indexOf(i) > - 1){
return true;
}
if(counter===page_size){
return false;
}
placeholders_div.find('.sld_placeholder').text(sld);
placeholders_div.find('.tld_placeholder').text(i);
placeholders_div.find('input[name=tld]').val(i);
var tempHTML=placeholders_div.html();
results_div.append(tempHTML);
whmpress_added_tlds.push(i);
counter ++;
});
$(parent_container).find('.whmpress_domain_search_ajax_extended_search_result_title:not(.results_loaded)').each(function (){
var result_div=$(this);
jQuery.ajax({
url: WHMPAjax.ajaxurl,
type: 'post',
data: data,
success: function(response){
var res=JSON.parse(response);
submit_field.html(submit_val);
if(res.status==="OK"){
result_div.prop('outerHTML', res.response_html).addClass('results_loaded');
}else{
}}
});
});
$(results_div).find('.whmpress_domain_search_ajax_extended_search_result:not(.results_loaded)').each(function (){
var result_div=$(this);
var tld=result_div.find('input[name="tld"]').val();
$.each(data, function(key, data){
if(this.name==="is_title"){
this.value='';
}
else if(this.name==="tld"){
this.value=tld;
}});
jQuery.ajax({
url: WHMPAjax.ajaxurl,
type: 'post',
data: data,
success: function(response){
var res=JSON.parse(response);
submit_field.html(submit_val);
if(res.status==="OK"){
result_div.prop('outerHTML', res.response_html).addClass('results_loaded');
}else{
}}
});
});
});
$(document).on('change', '.domain_duration_select', function (){
var select=$(this);
var duration=select.val();
$(this).closest('.domain_duration').siblings('.domain_price').find('.domain_price_text').hide().siblings('.duration' + duration).show();
});
jQuery(document).ready(function (){
jQuery('input:radio[name="extention_selection"]').change(function (){
if(jQuery(this).val()==='0'){ jQuery('.extentions').css('display', 'none'); }else{ jQuery('.extentions').css('display', 'block'); }});
});
jQuery(document).on('click', '.whmpress_price_matrix_domain .whmpress_price_matrix_header .whmp_domain_type_toggle_container span.whmp_domain_type_toggle, .whmpress_price_matrix_domain .whmpress_price_matrix_header span.whmp_domain_special_toggle', function (){
jQuery(this).siblings().removeClass('whmpress_tld_active');
jQuery(this).addClass('whmpress_tld_active');
});
jQuery(document).ready(function (){
jQuery(document).find('.whmpress_price_matrix_domain .whmpress_price_matrix_header .whmp_domain_type_toggle_container span.whmp_domain_type_toggle:nth-child(2), .whmpress_price_matrix_domain .whmpress_price_matrix_header span.whmp_domain_special_toggle:nth-child(2)').addClass('whmpress_tld_active')
});
}(jQuery));
(function ($, window, document, undefined){
$.fn.quicksearch=function (target, opt){
var timeout, cache, rowcache, jq_results, val='', e=this, options=$.extend({
delay: 100,
selector: null,
stripeRows: null,
loader: null,
noResults: '',
matchedResultsCount: 0,
bind: 'keyup',
onBefore: function (){
return;
},
onAfter: function (){
return;
},
show: function (){
this.style.display="";
},
hide: function (){
this.style.display="none";
},
prepareQuery: function (val){
return val.toLowerCase().split(' ');
},
testQuery: function (query, txt, _row){
for (var i=0; i < query.length; i +=1){
if(txt.indexOf(query[i])===-1){
return false;
}}
return true;
}}, opt);
this.go=function (){
var i=0,
numMatchedRows=0,
noresults=true,
query=options.prepareQuery(val),
val_empty=(val.replace(' ', '').length===0);
for (var i=0, len=rowcache.length; i < len; i++){
if(val_empty||options.testQuery(query, cache[i], rowcache[i])){
options.show.apply(rowcache[i]);
noresults=false;
numMatchedRows++;
}else{
options.hide.apply(rowcache[i]);
}}
if(noresults){
this.results(false);
}else{
this.results(true);
this.stripe();
}
this.matchedResultsCount=numMatchedRows;
this.loader(false);
options.onAfter();
return this;
};
this.search=function (submittedVal){
val=submittedVal;
e.trigger();
};
this.currentMatchedResults=function (){
return this.matchedResultsCount;
};
this.stripe=function (){
if(typeof options.stripeRows==="object"&&options.stripeRows!==null){
var joined=options.stripeRows.join(' ');
var stripeRows_length=options.stripeRows.length;
jq_results.not(':hidden').each(function (i){
$(this).removeClass(joined).addClass(options.stripeRows[i % stripeRows_length]);
});
}
return this;
};
this.strip_html=function (input){
var output=input.replace(new RegExp('<[^<]+\>', 'g'), "");
output=$.trim(output.toLowerCase());
return output;
};
this.results=function (bool){
if(typeof options.noResults==="string"&&options.noResults!==""){
if(bool){
$(options.noResults).hide();
}else{
$(options.noResults).show();
}}
return this;
};
this.loader=function (bool){
if(typeof options.loader==="string"&&options.loader!==""){
(bool) ? $(options.loader).show():$(options.loader).hide();
}
return this;
};
this.cache=function (){
jq_results=$(target);
if(typeof options.noResults==="string"&&options.noResults!==""){
jq_results=jq_results.not(options.noResults);
}
var t=(typeof options.selector==="string") ? jq_results.find(options.selector):$(target).not(options.noResults);
cache=t.map(function (){
return e.strip_html(this.innerHTML);
});
rowcache=jq_results.map(function (){
return this;
});
val=val||this.val()||"";
return this.go();
};
this.trigger=function (){
this.loader(true);
options.onBefore();
window.clearTimeout(timeout);
timeout=window.setTimeout(function (){
e.go();
}, options.delay);
return this;
};
this.cache();
this.results(true);
this.stripe();
this.loader(false);
return this.each(function (){
$(this).on(options.bind, function (){
val=$(this).val();
e.trigger();
});
});
};}(jQuery, this, document));
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Clipboard=t()}}(function(){var t,e,n;return function t(e,n,o){function i(a,c){if(!n[a]){if(!e[a]){var l="function"==typeof require&&require;if(!c&&l)return l(a,!0);if(r)return r(a,!0);var s=new Error("Cannot find module '"+a+"'");throw s.code="MODULE_NOT_FOUND",s}var u=n[a]={exports:{}};e[a][0].call(u.exports,function(t){var n=e[a][1][t];return i(n||t)},u,u.exports,t,e,n,o)}return n[a].exports}for(var r="function"==typeof require&&require,a=0;a<o.length;a++)i(o[a]);return i}({1:[function(t,e,n){function o(t,e){for(;t&&t.nodeType!==i;){if("function"==typeof t.matches&&t.matches(e))return t;t=t.parentNode}}var i=9;if("undefined"!=typeof Element&&!Element.prototype.matches){var r=Element.prototype;r.matches=r.matchesSelector||r.mozMatchesSelector||r.msMatchesSelector||r.oMatchesSelector||r.webkitMatchesSelector}e.exports=o},{}],2:[function(t,e,n){function o(t,e,n,o,r){var a=i.apply(this,arguments);return t.addEventListener(n,a,r),{destroy:function(){t.removeEventListener(n,a,r)}}}function i(t,e,n,o){return function(n){n.delegateTarget=r(n.target,e),n.delegateTarget&&o.call(t,n)}}var r=t("./closest");e.exports=o},{"./closest":1}],3:[function(t,e,n){n.node=function(t){return void 0!==t&&t instanceof HTMLElement&&1===t.nodeType},n.nodeList=function(t){var e=Object.prototype.toString.call(t);return void 0!==t&&("[object NodeList]"===e||"[object HTMLCollection]"===e)&&"length"in t&&(0===t.length||n.node(t[0]))},n.string=function(t){return"string"==typeof t||t instanceof String},n.fn=function(t){return"[object Function]"===Object.prototype.toString.call(t)}},{}],4:[function(t,e,n){function o(t,e,n){if(!t&&!e&&!n)throw new Error("Missing required arguments");if(!c.string(e))throw new TypeError("Second argument must be a String");if(!c.fn(n))throw new TypeError("Third argument must be a Function");if(c.node(t))return i(t,e,n);if(c.nodeList(t))return r(t,e,n);if(c.string(t))return a(t,e,n);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function i(t,e,n){return t.addEventListener(e,n),{destroy:function(){t.removeEventListener(e,n)}}}function r(t,e,n){return Array.prototype.forEach.call(t,function(t){t.addEventListener(e,n)}),{destroy:function(){Array.prototype.forEach.call(t,function(t){t.removeEventListener(e,n)})}}}function a(t,e,n){return l(document.body,t,e,n)}var c=t("./is"),l=t("delegate");e.exports=o},{"./is":3,delegate:2}],5:[function(t,e,n){function o(t){var e;if("SELECT"===t.nodeName)t.focus(),e=t.value;else if("INPUT"===t.nodeName||"TEXTAREA"===t.nodeName){var n=t.hasAttribute("readonly");n||t.setAttribute("readonly",""),t.select(),t.setSelectionRange(0,t.value.length),n||t.removeAttribute("readonly"),e=t.value}else{t.hasAttribute("contenteditable")&&t.focus();var o=window.getSelection(),i=document.createRange();i.selectNodeContents(t),o.removeAllRanges(),o.addRange(i),e=o.toString()}return e}e.exports=o},{}],6:[function(t,e,n){function o(){}o.prototype={on:function(t,e,n){var o=this.e||(this.e={});return(o[t]||(o[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){function o(){i.off(t,o),e.apply(n,arguments)}var i=this;return o._=e,this.on(t,o,n)},emit:function(t){var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),o=0,i=n.length;for(o;o<i;o++)n[o].fn.apply(n[o].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),o=n[t],i=[];if(o&&e)for(var r=0,a=o.length;r<a;r++)o[r].fn!==e&&o[r].fn._!==e&&i.push(o[r]);return i.length?n[t]=i:delete n[t],this}},e.exports=o},{}],7:[function(e,n,o){!function(i,r){if("function"==typeof t&&t.amd)t(["module","select"],r);else if(void 0!==o)r(n,e("select"));else{var a={exports:{}};r(a,i.select),i.clipboardAction=a.exports}}(this,function(t,e){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=n(e),r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),c=function(){function t(e){o(this,t),this.resolveOptions(e),this.initSelection()}return a(t,[{key:"resolveOptions",value:function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.action=e.action,this.container=e.container,this.emitter=e.emitter,this.target=e.target,this.text=e.text,this.trigger=e.trigger,this.selectedText=""}},{key:"initSelection",value:function t(){this.text?this.selectFake():this.target&&this.selectTarget()}},{key:"selectFake",value:function t(){var e=this,n="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandlerCallback=function(){return e.removeFake()},this.fakeHandler=this.container.addEventListener("click",this.fakeHandlerCallback)||!0,this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[n?"right":"left"]="-9999px";var o=window.pageYOffset||document.documentElement.scrollTop;this.fakeElem.style.top=o+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,this.container.appendChild(this.fakeElem),this.selectedText=(0,i.default)(this.fakeElem),this.copyText()}},{key:"removeFake",value:function t(){this.fakeHandler&&(this.container.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(this.container.removeChild(this.fakeElem),this.fakeElem=null)}},{key:"selectTarget",value:function t(){this.selectedText=(0,i.default)(this.target),this.copyText()}},{key:"copyText",value:function t(){var e=void 0;try{e=document.execCommand (this.action)}catch(t){e=!1}this.handleResult(e)}},{key:"handleResult",value:function t(e){this.emitter.emit(e?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}},{key:"clearSelection",value:function t(){this.trigger&&this.trigger.focus(),window.getSelection().removeAllRanges()}},{key:"destroy",value:function t(){this.removeFake()}},{key:"action",set:function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"copy";if(this._action=e,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function t(){return this._action}},{key:"target",set:function t(e){if(void 0!==e){if(!e||"object"!==(void 0===e?"undefined":r(e))||1!==e.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&e.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(e.hasAttribute("readonly")||e.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=e}},get:function t(){return this._target}}]),t}();t.exports=c})},{select:5}],8:[function(e,n,o){!function(i,r){if("function"==typeof t&&t.amd)t(["module","./clipboard-action","tiny-emitter","good-listener"],r);else if(void 0!==o)r(n,e("./clipboard-action"),e("tiny-emitter"),e("good-listener"));else{var a={exports:{}};r(a,i.clipboardAction,i.tinyEmitter,i.goodListener),i.clipboard=a.exports}}(this,function(t,e,n,o){"use strict";function i(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function c(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function l(t,e){var n="data-clipboard-"+t;if(e.hasAttribute(n))return e.getAttribute(n)}var s=i(e),u=i(n),f=i(o),d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},h=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),p=function(t){function e(t,n){r(this,e);var o=a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return o.resolveOptions(n),o.listenClick(t),o}return c(e,t),h(e,[{key:"resolveOptions",value:function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof e.action?e.action:this.defaultAction,this.target="function"==typeof e.target?e.target:this.defaultTarget,this.text="function"==typeof e.text?e.text:this.defaultText,this.container="object"===d(e.container)?e.container:document.body}},{key:"listenClick",value:function t(e){var n=this;this.listener=(0,f.default)(e,"click",function(t){return n.onClick(t)})}},{key:"onClick",value:function t(e){var n=e.delegateTarget||e.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new s.default({action:this.action(n),target:this.target(n),text:this.text(n),container:this.container,trigger:n,emitter:this})}},{key:"defaultAction",value:function t(e){return l("action",e)}},{key:"defaultTarget",value:function t(e){var n=l("target",e);if(n)return document.querySelector(n)}},{key:"defaultText",value:function t(e){return l("text",e)}},{key:"destroy",value:function t(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}],[{key:"isSupported",value:function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["copy","cut"],n="string"==typeof e?[e]:e,o=!!document.queryCommandSupported;return n.forEach(function(t){o=o&&!!document.queryCommandSupported(t)}),o}}]),e}(u.default);t.exports=p})},{"./clipboard-action":7,"good-listener":4,"tiny-emitter":6}]},{},[8])(8)});
jQuery(document).ready(function(){
new Clipboard('.btn');
});