// source --> https://iparrotpost.com/wp-content/plugins/psychics-listing-frontpage-live/js/intlTelInput.js?ver=5.3.2
/*
International Telephone Input v7.1.1
https://github.com/Bluefieldscom/intl-tel-input.git
*/
// wrap in UMD - see https://github.com/umdjs/umd/blob/master/jqueryPluginCommonjs.js
(function(factory) {
if (typeof define === "function" && define.amd) {
define([ "jquery" ], function($) {
factory($, window, document);
});
} else if (typeof module === "object" && module.exports) {
module.exports = factory(require("jquery"), window, document);
} else {
factory(jQuery, window, document);
}
})(function($, window, document, undefined) {
"use strict";
// these vars persist through all instances of the plugin
var pluginName = "intlTelInput", id = 1, // give each instance it's own id for namespaced event handling
defaults = {
// typing digits after a valid number will be added to the extension part of the number
allowExtensions: false,
// automatically format the number according to the selected country
autoFormat: false,
// if there is just a dial code in the input: remove it on blur, and re-add it on focus
autoHideDialCode: true,
// add or remove input placeholder with an example number for the selected country
autoPlaceholder: true,
// append menu to a specific element
dropdownContainer: false,
// don't display these countries
excludeCountries: [],
// geoIp lookup function
geoIpLookup: null,
// initial country
initialCountry: "",
// don't insert international dial codes
nationalMode: true,
// number type to use for placeholders
numberType: "MOBILE",
// display only these countries
onlyCountries: [],
// the countries at the top of the list. defaults to united states and united kingdom
preferredCountries: [ "us", "gb" ],
// specify the path to the libphonenumber script to enable validation/formatting
utilsScript: ""
}, keys = {
UP: 38,
DOWN: 40,
ENTER: 13,
ESC: 27,
PLUS: 43,
A: 65,
Z: 90,
ZERO: 48,
NINE: 57,
SPACE: 32,
BSPACE: 8,
TAB: 9,
DEL: 46,
CTRL: 17,
CMD1: 91,
// Chrome
CMD2: 224
}, windowLoaded = false;
// keep track of if the window.load event has fired as impossible to check after the fact
$(window).load(function() {
windowLoaded = true;
});
function Plugin(element, options) {
this.element = element;
this.options = $.extend({}, defaults, options);
this._defaults = defaults;
// event namespace
this.ns = "." + pluginName + id++;
// Chrome, FF, Safari, IE9+
this.isGoodBrowser = Boolean(element.setSelectionRange);
this.hadInitialPlaceholder = Boolean($(element).attr("placeholder"));
this._name = pluginName;
}
Plugin.prototype = {
_init: function() {
// if in nationalMode, disable options relating to dial codes
if (this.options.nationalMode) {
this.options.autoHideDialCode = false;
}
// IE Mobile doesn't support the keypress event (see issue 68) which makes autoFormat impossible
if (navigator.userAgent.match(/IEMobile/i)) {
this.options.autoFormat = false;
}
// we cannot just test screen size as some smartphones/website meta tags will report desktop resolutions
// Note: for some reason jasmine fucks up if you put this in the main Plugin function with the rest of these declarations
// Note: to target Android Mobiles (and not Tablets), we must find "Android" and "Mobile"
this.isMobile = /Android.+Mobile|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
// we return these deferred objects from the _init() call so they can be watched, and then we resolve them when each specific request returns
// Note: again, jasmine had a spazz when I put these in the Plugin function
this.autoCountryDeferred = new $.Deferred();
this.utilsScriptDeferred = new $.Deferred();
// process all the data: onlyCountries, excludeCountries, preferredCountries etc
this._processCountryData();
// generate the markup
this._generateMarkup();
// set the initial state of the input value and the selected flag
this._setInitialState();
// start all of the event listeners: autoHideDialCode, input keydown, selectedFlag click
this._initListeners();
// utils script, and auto country
this._initRequests();
// return the deferreds
return [ this.autoCountryDeferred, this.utilsScriptDeferred ];
},
/********************
* PRIVATE METHODS
********************/
// prepare all of the country data, including onlyCountries, excludeCountries and preferredCountries options
_processCountryData: function() {
// process this instance's countries
this._processAllCountries();
// process the countryCodes map
this._processCountryCodes();
// process the preferredCountries
this._processPreferredCountries();
},
// add a country code to this.countryCodes
_addCountryCode: function(iso2, dialCode, priority) {
if (!(dialCode in this.countryCodes)) {
this.countryCodes[dialCode] = [];
}
var index = priority || 0;
this.countryCodes[dialCode][index] = iso2;
},
// filter the given countries using the process function
_filterCountries: function(countryArray, processFunc) {
var i;
// standardise case
for (i = 0; i < countryArray.length; i++) {
countryArray[i] = countryArray[i].toLowerCase();
}
// build instance country array
this.countries = [];
for (i = 0; i < allCountries.length; i++) {
if (processFunc($.inArray(allCountries[i].iso2, countryArray))) {
this.countries.push(allCountries[i]);
}
}
},
// process onlyCountries or excludeCountries array if present
_processAllCountries: function() {
// process onlyCountries option
if (this.options.onlyCountries.length) {
this._filterCountries(this.options.onlyCountries, function(inArray) {
// if country is in array
return inArray != -1;
});
} else if (this.options.excludeCountries.length) {
this._filterCountries(this.options.excludeCountries, function(inArray) {
// if country is not in array
return inArray == -1;
});
} else {
this.countries = allCountries;
}
},
// process the countryCodes map
_processCountryCodes: function() {
this.countryCodes = {};
for (var i = 0; i < this.countries.length; i++) {
var c = this.countries[i];
this._addCountryCode(c.iso2, c.dialCode, c.priority);
// area codes
if (c.areaCodes) {
for (var j = 0; j < c.areaCodes.length; j++) {
// full dial code is country code + dial code
this._addCountryCode(c.iso2, c.dialCode + c.areaCodes[j]);
}
}
}
},
// process preferred countries - iterate through the preferences, fetching the country data for each one
_processPreferredCountries: function() {
this.preferredCountries = [];
for (var i = 0; i < this.options.preferredCountries.length; i++) {
var countryCode = this.options.preferredCountries[i].toLowerCase(), countryData = this._getCountryData(countryCode, false, true);
if (countryData) {
this.preferredCountries.push(countryData);
}
}
},
// generate all of the markup for the plugin: the selected flag overlay, and the dropdown
_generateMarkup: function() {
// telephone input
this.telInput = $(this.element);
// prevent autocomplete as there's no safe, cross-browser event we can react to, so it can easily put the plugin in an inconsistent state e.g. the wrong flag selected for the autocompleted number, which on submit could mean the wrong number is saved (esp in nationalMode)
this.telInput.attr("autocomplete", "off");
// containers (mostly for positioning)
this.telInput.wrap($("
", {
"class": "intl-tel-input"
}));
this.flagsContainer = $("
", {
"class": "flag-container"
}).insertBefore(this.telInput);
// currently selected flag (displayed to left of input)
var selectedFlag = $("
", {
// make element focusable and tab naviagable
tabindex: "0",
"class": "selected-flag"
}).appendTo(this.flagsContainer);
this.selectedFlagInner = $("
", {
"class": "iti-flag"
}).appendTo(selectedFlag);
// CSS triangle
$("
", {
"class": "iti-arrow"
}).appendTo(selectedFlag);
// country list
// mobile is just a native select element
// desktop is a proper list containing: preferred countries, then divider, then all countries
if (this.isMobile) {
this.countryList = $("
", {
"class": "iti-mobile-select"
}).appendTo(this.flagsContainer);
} else {
this.countryList = $("", {
"class": "country-list hide"
});
if (this.preferredCountries.length && !this.isMobile) {
this._appendListItems(this.preferredCountries, "preferred");
$("", {
"class": "divider"
}).appendTo(this.countryList);
}
}
this._appendListItems(this.countries, "");
if (!this.isMobile) {
// this is useful in lots of places
this.countryListItems = this.countryList.children(".country");
// create dropdownContainer markup
if (this.options.dropdownContainer) {
this.dropdown = $("", {
"class": "intl-tel-input iti-container"
}).append(this.countryList);
} else {
this.countryList.appendTo(this.flagsContainer);
}
}
},
// add a country
to the countryList container
// UPDATE: if isMobile, add an to the countryList container
_appendListItems: function(countries, className) {
// we create so many DOM elements, it is faster to build a temp string
// and then add everything to the DOM in one go at the end
var tmp = "";
// for each country
for (var i = 0; i < countries.length; i++) {
var c = countries[i];
if (this.isMobile) {
tmp += "";
tmp += c.name + " +" + c.dialCode;
tmp += " ";
} else {
// open the list item
tmp += "";
// add the flag
tmp += "";
// and the country name and dial code
tmp += "" + c.name + " ";
tmp += "+" + c.dialCode + " ";
// close the list item
tmp += " ";
}
}
this.countryList.append(tmp);
},
// set the initial state of the input value and the selected flag by either extracting a dial code from the given number, or using initialCountry
_setInitialState: function() {
var val = this.telInput.val();
// if we already have a dial code we can go ahead and set the flag, else fall back to default
if (this._getDialCode(val)) {
this._updateFlagFromNumber(val);
} else if (this.options.initialCountry !== "auto") {
// see if we should select a flag
if (this.options.initialCountry) {
this._setFlag(this.options.initialCountry);
} else {
// no dial code and no initialCountry, so default to first in list
this.defaultCountry = this.preferredCountries.length ? this.preferredCountries[0].iso2 : this.countries[0].iso2;
if (!val) {
this._setFlag(this.defaultCountry);
}
}
// if empty, insert the default dial code (this function will check !nationalMode and !autoHideDialCode)
if (!val) {
var countryData = this._getCountryData(this.defaultCountry, false, false);
this._updateDialCode(countryData.dialCode, false);
}
}
// NOTE: if initialCountry is set to auto, that will be handled separately
// format
if (val) {
// this wont be run after _updateDialCode as that's only called if no val
this._updateVal(val, null, false, false, false);
}
},
// initialise the main event listeners: input keyup, and click selected flag
_initListeners: function() {
var that = this;
this._initKeyListeners();
// autoFormat prevents the change event from firing, so we need to check for changes between focus and blur in order to manually trigger it
if (this.options.autoHideDialCode || this.options.autoFormat) {
this._initFocusListeners();
}
if (this.isMobile) {
this.countryList.on("change" + this.ns, function(e) {
that._selectListItem($(this).find("option:selected"));
});
} else {
// hack for input nested inside label: clicking the selected-flag to open the dropdown would then automatically trigger a 2nd click on the input which would close it again
var label = this.telInput.closest("label");
if (label.length) {
label.on("click" + this.ns, function(e) {
// if the dropdown is closed, then focus the input, else ignore the click
if (that.countryList.hasClass("hide")) {
that.telInput.focus();
} else {
e.preventDefault();
}
});
}
// toggle country dropdown on click
var selectedFlag = this.selectedFlagInner.parent();
selectedFlag.on("click" + this.ns, function(e) {
// only intercept this event if we're opening the dropdown
// else let it bubble up to the top ("click-off-to-close" listener)
// we cannot just stopPropagation as it may be needed to close another instance
if (that.countryList.hasClass("hide") && !that.telInput.prop("disabled") && !that.telInput.prop("readonly")) {
that._showDropdown();
}
});
}
// open dropdown list if currently focused
this.flagsContainer.on("keydown" + that.ns, function(e) {
var isDropdownHidden = that.countryList.hasClass("hide");
if (isDropdownHidden && (e.which == keys.UP || e.which == keys.DOWN || e.which == keys.SPACE || e.which == keys.ENTER)) {
// prevent form from being submitted if "ENTER" was pressed
e.preventDefault();
// prevent event from being handled again by document
e.stopPropagation();
that._showDropdown();
}
// allow navigation from dropdown to input on TAB
if (e.which == keys.TAB) {
that._closeDropdown();
}
});
},
// init many requests: utils script / geo ip lookup
_initRequests: function() {
var that = this;
// if the user has specified the path to the utils script, fetch it on window.load, else resolve
if (this.options.utilsScript) {
// if the plugin is being initialised after the window.load event has already been fired
if (windowLoaded) {
$.fn[pluginName].loadUtils(this.options.utilsScript, this.utilsScriptDeferred);
} else {
// wait until the load event so we don't block any other requests e.g. the flags image
$(window).load(function() {
$.fn[pluginName].loadUtils(that.options.utilsScript, that.utilsScriptDeferred);
});
}
} else {
this.utilsScriptDeferred.resolve();
}
if (this.options.initialCountry === "auto") {
this._loadAutoCountry();
} else {
this.autoCountryDeferred.resolve();
}
},
// perform the geo ip lookup
_loadAutoCountry: function() {
var that = this;
// check for cookie
var cookieAutoCountry = window.Cookies ? Cookies.get("itiAutoCountry") : "";
if (cookieAutoCountry) {
$.fn[pluginName].autoCountry = cookieAutoCountry;
}
// 3 options:
// 1) already loaded (we're done)
// 2) not already started loading (start)
// 3) already started loading (do nothing - just wait for loading callback to fire)
if ($.fn[pluginName].autoCountry) {
this.handleAutoCountry();
} else if (!$.fn[pluginName].startedLoadingAutoCountry) {
// don't do this twice!
$.fn[pluginName].startedLoadingAutoCountry = true;
if (typeof this.options.geoIpLookup === "function") {
this.options.geoIpLookup(function(countryCode) {
$.fn[pluginName].autoCountry = countryCode.toLowerCase();
if (window.Cookies) {
Cookies.set("itiAutoCountry", $.fn[pluginName].autoCountry, {
path: "/"
});
}
// tell all instances the auto country is ready
// TODO: this should just be the current instances
// UPDATE: use setTimeout in case their geoIpLookup function calls this callback straight away (e.g. if they have already done the geo ip lookup somewhere else). Using setTimeout means that the current thread of execution will finish before executing this, which allows the plugin to finish initialising.
setTimeout(function() {
$(".intl-tel-input input").intlTelInput("handleAutoCountry");
});
});
}
}
},
// initialize any key listeners
_initKeyListeners: function() {
var that = this;
if (this.options.autoFormat) {
// format number and update flag on keypress
// use keypress event as we want to ignore all input except for a select few keys,
// but we dont want to ignore the navigation keys like the arrows etc.
// NOTE: no point in refactoring this to only bind these listeners on focus/blur because then you would need to have those 2 listeners running the whole time anyway...
this.telInput.on("keypress" + this.ns, function(e) {
// 32 is space, and after that it's all chars (not meta/nav keys)
// this fix is needed for Firefox, which triggers keypress event for some meta/nav keys
// Update: also ignore if this is a metaKey e.g. FF and Safari trigger keypress on the v of Ctrl+v
// Update: also ignore if ctrlKey (FF on Windows/Ubuntu)
// Update: also check that we have utils before we do any autoFormat stuff
if (e.which >= keys.SPACE && !e.ctrlKey && !e.metaKey && window.intlTelInputUtils && !that.telInput.prop("readonly")) {
e.preventDefault();
// allowed keys are just numeric keys and plus
// we must allow plus for the case where the user does select-all and then hits plus to start typing a new number. we could refine this logic to first check that the selection contains a plus, but that wont work in old browsers, and I think it's overkill anyway
var isAllowedKey = e.which >= keys.ZERO && e.which <= keys.NINE || e.which == keys.PLUS, input = that.telInput[0], noSelection = that.isGoodBrowser && input.selectionStart == input.selectionEnd, max = that.telInput.attr("maxlength"), val = that.telInput.val(), // assumes that if max exists, it is >0
isBelowMax = max ? val.length < max : true;
// first: ensure we dont go over maxlength. we must do this here to prevent adding digits in the middle of the number
// still reformat even if not an allowed key as they could by typing a formatting char, but ignore if there's a selection as doesn't make sense to replace selection with illegal char and then immediately remove it
if (isBelowMax && (isAllowedKey || noSelection)) {
var newChar = isAllowedKey ? String.fromCharCode(e.which) : null;
that._handleInputKey(newChar, true, isAllowedKey);
// if something has changed, trigger the input event (which was otherwised squashed by the preventDefault)
if (val != that.telInput.val()) {
that.telInput.trigger("input");
}
}
if (!isAllowedKey) {
that._handleInvalidKey();
}
}
});
}
// handle cut/paste event (now supported in all major browsers)
this.telInput.on("cut" + this.ns + " paste" + this.ns, function() {
// hack because "paste" event is fired before input is updated
setTimeout(function() {
if (that.options.autoFormat && window.intlTelInputUtils) {
var cursorAtEnd = that.isGoodBrowser && that.telInput[0].selectionStart == that.telInput.val().length;
that._handleInputKey(null, cursorAtEnd, true);
that._ensurePlus();
} else {
// if no autoFormat, just update flag
that._updateFlagFromNumber(that.telInput.val());
}
});
});
// handle keyup event
// if autoFormat enabled: we use keyup to catch delete events (after the fact)
// if no autoFormat, this is used to update the flag
this.telInput.on("keyup" + this.ns, function(e) {
// the "enter" key event from selecting a dropdown item is triggered here on the input, because the document.keydown handler that initially handles that event triggers a focus on the input, and so the keyup for that same key event gets triggered here. weird, but just make sure we dont bother doing any re-formatting in this case (we've already done preventDefault in the keydown handler, so it wont actually submit the form or anything).
// ALSO: ignore keyup if readonly
if (e.which == keys.ENTER || that.telInput.prop("readonly")) {} else if (that.options.autoFormat && window.intlTelInputUtils) {
// cursorAtEnd defaults to false for bad browsers else they would never get a reformat on delete
var cursorAtEnd = that.isGoodBrowser && that.telInput[0].selectionStart == that.telInput.val().length;
if (!that.telInput.val()) {
// if they just cleared the input, update the flag to the default
that._updateFlagFromNumber("");
} else if (e.which == keys.DEL && !cursorAtEnd || e.which == keys.BSPACE) {
// if delete in the middle: reformat with no suffix (no need to reformat if delete at end)
// if backspace: reformat with no suffix (need to reformat if at end to remove any lingering suffix - this is a feature)
// important to remember never to add suffix on any delete key as can fuck up in ie8 so you can never delete a formatting char at the end
that._handleInputKey(null, false, false);
}
that._ensurePlus();
} else {
// if no autoFormat, just update flag
that._updateFlagFromNumber(that.telInput.val());
}
});
},
// prevent deleting the plus (if not in nationalMode)
_ensurePlus: function() {
if (!this.options.nationalMode) {
var val = this.telInput.val(), input = this.telInput[0];
if (val.charAt(0) != "+") {
// newCursorPos is current pos + 1 to account for the plus we are about to add
var newCursorPos = this.isGoodBrowser ? input.selectionStart + 1 : 0;
this.telInput.val("+" + val);
if (this.isGoodBrowser) {
input.setSelectionRange(newCursorPos, newCursorPos);
}
}
}
},
// alert the user to an invalid key event
_handleInvalidKey: function() {
var that = this;
this.telInput.trigger("invalidkey").addClass("iti-invalid-key");
setTimeout(function() {
that.telInput.removeClass("iti-invalid-key");
}, 100);
},
// when autoFormat is enabled: handle various key events on the input:
// 1) adding a new number character, which will replace any selection, reformat, and preserve the cursor position
// 2) reformatting on backspace/delete
// 3) cut/paste event
_handleInputKey: function(newNumericChar, addSuffix, isAllowedKey) {
var val = this.telInput.val(), cleanBefore = this._getClean(val), originalLeftChars, // raw DOM element
input = this.telInput[0], digitsOnRight = 0;
if (this.isGoodBrowser) {
// cursor strategy: maintain the number of digits on the right. we use the right instead of the left so that A) we dont have to account for the new digit (or multiple digits if paste event), and B) we're always on the right side of formatting suffixes
digitsOnRight = this._getDigitsOnRight(val, input.selectionEnd);
// if handling a new number character: insert it in the right place
if (newNumericChar) {
// replace any selection they may have made with the new char
val = val.substr(0, input.selectionStart) + newNumericChar + val.substring(input.selectionEnd, val.length);
} else {
// here we're not handling a new char, we're just doing a re-format (e.g. on delete/backspace/paste, after the fact), but we still need to maintain the cursor position. so make note of the char on the left, and then after the re-format, we'll count in the same number of digits from the right, and then keep going through any formatting chars until we hit the same left char that we had before.
// UPDATE: now have to store 2 chars as extensions formatting contains 2 spaces so you need to be able to distinguish
originalLeftChars = val.substr(input.selectionStart - 2, 2);
}
} else if (newNumericChar) {
val += newNumericChar;
}
// update the number and flag
this.setNumber(val, null, addSuffix, true, isAllowedKey);
// update the cursor position
if (this.isGoodBrowser) {
var newCursor;
val = this.telInput.val();
// if it was at the end, keep it there
if (!digitsOnRight) {
newCursor = val.length;
} else {
// else count in the same number of digits from the right
newCursor = this._getCursorFromDigitsOnRight(val, digitsOnRight);
// but if delete/paste etc, keep going left until hit the same left char as before
if (!newNumericChar) {
newCursor = this._getCursorFromLeftChar(val, newCursor, originalLeftChars);
}
}
// set the new cursor
input.setSelectionRange(newCursor, newCursor);
}
},
// we start from the position in guessCursor, and work our way left until we hit the originalLeftChars or a number to make sure that after reformatting the cursor has the same char on the left in the case of a delete etc
_getCursorFromLeftChar: function(val, guessCursor, originalLeftChars) {
for (var i = guessCursor; i > 0; i--) {
var leftChar = val.charAt(i - 1);
// UPDATE: now have to store 2 chars as extensions formatting contains 2 spaces so you need to be able to distinguish
if ($.isNumeric(leftChar) || val.substr(i - 2, 2) == originalLeftChars) {
return i;
}
}
return 0;
},
// after a reformat we need to make sure there are still the same number of digits to the right of the cursor
_getCursorFromDigitsOnRight: function(val, digitsOnRight) {
for (var i = val.length - 1; i >= 0; i--) {
if ($.isNumeric(val.charAt(i)) && --digitsOnRight === 0) {
return i;
}
}
return 0;
},
// get the number of numeric digits to the right of the cursor so we can reposition the cursor correctly after the reformat has happened
_getDigitsOnRight: function(val, selectionEnd) {
var digitsOnRight = 0;
for (var i = selectionEnd; i < val.length; i++) {
if ($.isNumeric(val.charAt(i))) {
digitsOnRight++;
}
}
return digitsOnRight;
},
// listen for focus and blur
_initFocusListeners: function() {
var that = this;
if (this.options.autoHideDialCode) {
// mousedown decides where the cursor goes, so if we're focusing we must preventDefault as we'll be inserting the dial code, and we want the cursor to be at the end no matter where they click
this.telInput.on("mousedown" + this.ns, function(e) {
if (!that.telInput.is(":focus") && !that.telInput.val()) {
e.preventDefault();
// but this also cancels the focus, so we must trigger that manually
that.telInput.focus();
}
});
}
this.telInput.on("focus" + this.ns, function(e) {
var value = that.telInput.val();
// save this to compare on blur
that.telInput.data("focusVal", value);
// on focus: if empty, insert the dial code for the currently selected flag
if (that.options.autoHideDialCode && !value && !that.telInput.prop("readonly") && that.selectedCountryData.dialCode) {
that._updateVal("+" + that.selectedCountryData.dialCode, null, true, false, false);
// after auto-inserting a dial code, if the first key they hit is '+' then assume they are entering a new number, so remove the dial code. use keypress instead of keydown because keydown gets triggered for the shift key (required to hit the + key), and instead of keyup because that shows the new '+' before removing the old one
that.telInput.one("keypress.plus" + that.ns, function(e) {
if (e.which == keys.PLUS) {
// if autoFormat is enabled, this key event will have already have been handled by another keypress listener (hence we need to add the "+"). if disabled, it will be handled after this by a keyup listener (hence no need to add the "+").
var newVal = that.options.autoFormat && window.intlTelInputUtils ? "+" : "";
that.telInput.val(newVal);
}
});
// after tabbing in, make sure the cursor is at the end we must use setTimeout to get outside of the focus handler as it seems the selection happens after that
setTimeout(function() {
var input = that.telInput[0];
if (that.isGoodBrowser) {
var len = that.telInput.val().length;
input.setSelectionRange(len, len);
}
});
}
});
this.telInput.on("blur" + this.ns, function() {
if (that.options.autoHideDialCode) {
// on blur: if just a dial code then remove it
var value = that.telInput.val(), startsPlus = value.charAt(0) == "+";
if (startsPlus) {
var numeric = that._getNumeric(value);
// if just a plus, or if just a dial code
if (!numeric || that.selectedCountryData.dialCode == numeric) {
that.telInput.val("");
}
}
// remove the keypress listener we added on focus
that.telInput.off("keypress.plus" + that.ns);
}
// if autoFormat, we must manually trigger change event if value has changed
if (that.options.autoFormat && window.intlTelInputUtils && that.telInput.val() != that.telInput.data("focusVal")) {
that.telInput.trigger("change");
}
});
},
// extract the numeric digits from the given string
_getNumeric: function(s) {
return s.replace(/\D/g, "");
},
// extract the clean number (numeric with optionally plus)
_getClean: function(s) {
var prefix = s.charAt(0) == "+" ? "+" : "";
return prefix + this._getNumeric(s);
},
// show the dropdown
_showDropdown: function() {
this._setDropdownPosition();
// update highlighting and scroll to active list item
var activeListItem = this.countryList.children(".active");
if (activeListItem.length) {
this._highlightListItem(activeListItem);
this._scrollTo(activeListItem);
}
// bind all the dropdown-related listeners: mouseover, click, click-off, keydown
this._bindDropdownListeners();
// update the arrow
this.selectedFlagInner.children(".iti-arrow").addClass("up");
},
// decide where to position dropdown (depends on position within viewport, and scroll)
_setDropdownPosition: function() {
var that = this, showDropdownContainer = this.options.dropdownContainer && !this.isMobile;
if (showDropdownContainer) this.dropdown.appendTo(this.options.dropdownContainer);
// show the menu and grab the dropdown height
this.dropdownHeight = this.countryList.removeClass("hide").outerHeight();
var pos = this.telInput.offset(), inputTop = pos.top, windowTop = $(window).scrollTop(), // dropdownFitsBelow = (dropdownBottom < windowBottom)
dropdownFitsBelow = inputTop + this.telInput.outerHeight() + this.dropdownHeight < windowTop + $(window).height(), dropdownFitsAbove = inputTop - this.dropdownHeight > windowTop;
// by default, the dropdown will be below the input. If we want to position it above the input, we add the dropup class.
this.countryList.toggleClass("dropup", !dropdownFitsBelow && dropdownFitsAbove);
// if dropdownContainer is enabled, calculate postion
if (showDropdownContainer) {
// by default the dropdown will be directly over the input because it's not in the flow. If we want to position it below, we need to add some extra top value.
var extraTop = !dropdownFitsBelow && dropdownFitsAbove ? 0 : this.telInput.innerHeight();
// calculate placement
this.dropdown.css({
top: inputTop + extraTop,
left: pos.left
});
// close menu on window scroll
$(window).on("scroll" + this.ns, function() {
that._closeDropdown();
});
}
},
// we only bind dropdown listeners when the dropdown is open
_bindDropdownListeners: function() {
var that = this;
// when mouse over a list item, just highlight that one
// we add the class "highlight", so if they hit "enter" we know which one to select
this.countryList.on("mouseover" + this.ns, ".country", function(e) {
that._highlightListItem($(this));
});
// listen for country selection
this.countryList.on("click" + this.ns, ".country", function(e) {
that._selectListItem($(this));
});
// click off to close
// (except when this initial opening click is bubbling up)
// we cannot just stopPropagation as it may be needed to close another instance
var isOpening = true;
$("html").on("click" + this.ns, function(e) {
if (!isOpening) {
that._closeDropdown();
}
isOpening = false;
});
// listen for up/down scrolling, enter to select, or letters to jump to country name.
// use keydown as keypress doesn't fire for non-char keys and we want to catch if they
// just hit down and hold it to scroll down (no keyup event).
// listen on the document because that's where key events are triggered if no input has focus
var query = "", queryTimer = null;
$(document).on("keydown" + this.ns, function(e) {
// prevent down key from scrolling the whole page,
// and enter key from submitting a form etc
e.preventDefault();
if (e.which == keys.UP || e.which == keys.DOWN) {
// up and down to navigate
that._handleUpDownKey(e.which);
} else if (e.which == keys.ENTER) {
// enter to select
that._handleEnterKey();
} else if (e.which == keys.ESC) {
// esc to close
that._closeDropdown();
} else if (e.which >= keys.A && e.which <= keys.Z || e.which == keys.SPACE) {
// upper case letters (note: keyup/keydown only return upper case letters)
// jump to countries that start with the query string
if (queryTimer) {
clearTimeout(queryTimer);
}
query += String.fromCharCode(e.which);
that._searchForCountry(query);
// if the timer hits 1 second, reset the query
queryTimer = setTimeout(function() {
query = "";
}, 1e3);
}
});
},
// highlight the next/prev item in the list (and ensure it is visible)
_handleUpDownKey: function(key) {
var current = this.countryList.children(".highlight").first();
var next = key == keys.UP ? current.prev() : current.next();
if (next.length) {
// skip the divider
if (next.hasClass("divider")) {
next = key == keys.UP ? next.prev() : next.next();
}
this._highlightListItem(next);
this._scrollTo(next);
}
},
// select the currently highlighted item
_handleEnterKey: function() {
var currentCountry = this.countryList.children(".highlight").first();
if (currentCountry.length) {
this._selectListItem(currentCountry);
}
},
// find the first list item whose name starts with the query string
_searchForCountry: function(query) {
for (var i = 0; i < this.countries.length; i++) {
if (this._startsWith(this.countries[i].name, query)) {
var listItem = this.countryList.children("[data-country-code=" + this.countries[i].iso2 + "]").not(".preferred");
// update highlighting and scroll
this._highlightListItem(listItem);
this._scrollTo(listItem, true);
break;
}
}
},
// check if (uppercase) string a starts with string b
_startsWith: function(a, b) {
return a.substr(0, b.length).toUpperCase() == b;
},
// update the input's value to the given val
// if autoFormat=true, format it first according to the country-specific formatting rules
// Note: preventConversion will be false (i.e. we allow conversion) on init and when dev calls public method setNumber
_updateVal: function(val, format, addSuffix, preventConversion, isAllowedKey) {
var formatted;
if (this.options.autoFormat && window.intlTelInputUtils && this.selectedCountryData) {
if (typeof format == "number" && intlTelInputUtils.isValidNumber(val, this.selectedCountryData.iso2)) {
// if user specified a format, and it's a valid number, then format it accordingly
formatted = intlTelInputUtils.formatNumberByType(val, this.selectedCountryData.iso2, format);
} else if (!preventConversion && this.options.nationalMode && val.charAt(0) == "+" && intlTelInputUtils.isValidNumber(val, this.selectedCountryData.iso2)) {
// if nationalMode and we have a valid intl number, convert it to ntl
formatted = intlTelInputUtils.formatNumberByType(val, this.selectedCountryData.iso2, intlTelInputUtils.numberFormat.NATIONAL);
} else {
// else do the regular AsYouType formatting
formatted = intlTelInputUtils.formatNumber(val, this.selectedCountryData.iso2, addSuffix, this.options.allowExtensions, isAllowedKey);
}
// ensure we dont go over maxlength. we must do this here to truncate any formatting suffix, and also handle paste events
var max = this.telInput.attr("maxlength");
if (max && formatted.length > max) {
formatted = formatted.substr(0, max);
}
} else {
// no autoFormat, so just insert the original value
formatted = val;
}
this.telInput.val(formatted);
},
// check if need to select a new flag based on the given number
_updateFlagFromNumber: function(number) {
// if we're in nationalMode and we already have US/Canada selected, make sure the number starts with a +1 so _getDialCode will be able to extract the area code
// update: if we dont yet have selectedCountryData, but we're here (trying to update the flag from the number), that means we're initialising the plugin with a number that already has a dial code, so fine to ignore this bit
if (number && this.options.nationalMode && this.selectedCountryData && this.selectedCountryData.dialCode == "1" && number.charAt(0) != "+") {
if (number.charAt(0) != "1") {
number = "1" + number;
}
number = "+" + number;
}
// try and extract valid dial code from input
var dialCode = this._getDialCode(number), countryCode = null;
if (dialCode) {
// check if one of the matching countries is already selected
var countryCodes = this.countryCodes[this._getNumeric(dialCode)], alreadySelected = this.selectedCountryData && $.inArray(this.selectedCountryData.iso2, countryCodes) != -1;
// if a matching country is not already selected (or this is an unknown NANP area code): choose the first in the list
if (!alreadySelected || this._isUnknownNanp(number, dialCode)) {
// if using onlyCountries option, countryCodes[0] may be empty, so we must find the first non-empty index
for (var j = 0; j < countryCodes.length; j++) {
if (countryCodes[j]) {
countryCode = countryCodes[j];
break;
}
}
}
} else if (number.charAt(0) == "+" && this._getNumeric(number).length) {
// invalid dial code, so empty
// Note: use getNumeric here because the number has not been formatted yet, so could contain bad shit
countryCode = "";
} else if (!number || number == "+") {
// empty, or just a plus, so default
countryCode = this.defaultCountry;
}
if (countryCode !== null) {
this._setFlag(countryCode);
}
},
// check if the given number contains an unknown area code from the North American Numbering Plan i.e. the only dialCode that could be extracted was +1 (instead of say +1 702) and the actual number's length is >=4
_isUnknownNanp: function(number, dialCode) {
return dialCode == "+1" && this._getNumeric(number).length >= 4;
},
// remove highlighting from other list items and highlight the given item
_highlightListItem: function(listItem) {
this.countryListItems.removeClass("highlight");
listItem.addClass("highlight");
},
// find the country data for the given country code
// the ignoreOnlyCountriesOption is only used during init() while parsing the onlyCountries array
_getCountryData: function(countryCode, ignoreOnlyCountriesOption, allowFail) {
var countryList = ignoreOnlyCountriesOption ? allCountries : this.countries;
for (var i = 0; i < countryList.length; i++) {
if (countryList[i].iso2 == countryCode) {
return countryList[i];
}
}
if (allowFail) {
return null;
} else {
throw new Error("No country data for '" + countryCode + "'");
}
},
// select the given flag, update the placeholder and the active list item
_setFlag: function(countryCode) {
// do this first as it will throw an error and stop if countryCode is invalid
this.selectedCountryData = countryCode ? this._getCountryData(countryCode, false, false) : {};
// update the defaultCountry - we only need the iso2 from now on, so just store that
if (this.selectedCountryData.iso2) {
// can't just make this equal to selectedCountryData as would be a ref to that object
this.defaultCountry = this.selectedCountryData.iso2;
}
this.selectedFlagInner.attr("class", "iti-flag " + countryCode);
// update the selected country's title attribute
var title = countryCode ? this.selectedCountryData.name + ": +" + this.selectedCountryData.dialCode : "Unknown";
this.selectedFlagInner.parent().attr("title", title);
// and the input's placeholder
this._updatePlaceholder();
if (this.isMobile) {
this.countryList.val(countryCode);
} else {
// update the active list item
this.countryListItems.removeClass("active");
if (countryCode) {
this.countryListItems.find(".iti-flag." + countryCode).first().closest(".country").addClass("active");
}
}
},
// update the input placeholder to an example number from the currently selected country
_updatePlaceholder: function() {
if (window.intlTelInputUtils && !this.hadInitialPlaceholder && this.options.autoPlaceholder && this.selectedCountryData) {
var iso2 = this.selectedCountryData.iso2, numberType = intlTelInputUtils.numberType[this.options.numberType || "FIXED_LINE"], placeholder = iso2 ? intlTelInputUtils.getExampleNumber(iso2, this.options.nationalMode, numberType) : "";
if (typeof this.options.customPlaceholder === "function") {
placeholder = this.options.customPlaceholder(placeholder, this.selectedCountryData);
}
this.telInput.attr("placeholder", placeholder);
}
},
// called when the user selects a list item from the dropdown
_selectListItem: function(listItem) {
var countryCodeAttr = this.isMobile ? "value" : "data-country-code";
// update selected flag and active list item
this._setFlag(listItem.attr(countryCodeAttr));
if (!this.isMobile) {
this._closeDropdown();
}
this._updateDialCode(listItem.attr("data-dial-code"), true);
// trigger a custom event as even in nationalMode the state has changed
this.telInput.trigger("country-change");
// focus the input
this.telInput.focus();
// fix for FF and IE11 (with nationalMode=false i.e. auto inserting dial code), who try to put the cursor at the beginning the first time
if (this.isGoodBrowser) {
var len = this.telInput.val().length;
this.telInput[0].setSelectionRange(len, len);
}
},
// close the dropdown and unbind any listeners
_closeDropdown: function() {
this.countryList.addClass("hide");
// update the arrow
this.selectedFlagInner.children(".iti-arrow").removeClass("up");
// unbind key events
$(document).off(this.ns);
// unbind click-off-to-close
$("html").off(this.ns);
// unbind hover and click listeners
this.countryList.off(this.ns);
// remove menu from container
if (this.options.dropdownContainer && !this.isMobile) {
$(window).off("scroll" + this.ns);
this.dropdown.detach();
}
},
// check if an element is visible within it's container, else scroll until it is
_scrollTo: function(element, middle) {
var container = this.countryList, containerHeight = container.height(), containerTop = container.offset().top, containerBottom = containerTop + containerHeight, elementHeight = element.outerHeight(), elementTop = element.offset().top, elementBottom = elementTop + elementHeight, newScrollTop = elementTop - containerTop + container.scrollTop(), middleOffset = containerHeight / 2 - elementHeight / 2;
if (elementTop < containerTop) {
// scroll up
if (middle) {
newScrollTop -= middleOffset;
}
container.scrollTop(newScrollTop);
} else if (elementBottom > containerBottom) {
// scroll down
if (middle) {
newScrollTop += middleOffset;
}
var heightDifference = containerHeight - elementHeight;
container.scrollTop(newScrollTop - heightDifference);
}
},
// replace any existing dial code with the new one (if not in nationalMode)
// also we need to know if we're focusing for a couple of reasons e.g. if so, we want to add any formatting suffix, also if the input is empty and we're not in nationalMode, then we want to insert the dial code
_updateDialCode: function(newDialCode, focusing) {
var inputVal = this.telInput.val(), newNumber;
// save having to pass this every time
newDialCode = "+" + newDialCode;
if (this.options.nationalMode && inputVal.charAt(0) != "+") {
// if nationalMode, we just want to re-format
newNumber = inputVal;
} else if (inputVal) {
// if the previous number contained a valid dial code, replace it
// (if more than just a plus character)
var prevDialCode = this._getDialCode(inputVal);
if (prevDialCode.length > 1) {
newNumber = inputVal.replace(prevDialCode, newDialCode);
} else {
// if the previous number didn't contain a dial code, we should persist it
var existingNumber = inputVal.charAt(0) != "+" ? $.trim(inputVal) : "";
newNumber = newDialCode + existingNumber;
}
} else {
newNumber = !this.options.autoHideDialCode || focusing ? newDialCode : "";
}
this._updateVal(newNumber, null, focusing, false, false);
},
// try and extract a valid international dial code from a full telephone number
// Note: returns the raw string inc plus character and any whitespace/dots etc
_getDialCode: function(number) {
var dialCode = "";
// only interested in international numbers (starting with a plus)
if (number.charAt(0) == "+") {
var numericChars = "";
// iterate over chars
for (var i = 0; i < number.length; i++) {
var c = number.charAt(i);
// if char is number
if ($.isNumeric(c)) {
numericChars += c;
// if current numericChars make a valid dial code
if (this.countryCodes[numericChars]) {
// store the actual raw string (useful for matching later)
dialCode = number.substr(0, i + 1);
}
// longest dial code is 4 chars
if (numericChars.length == 4) {
break;
}
}
}
}
return dialCode;
},
/********************
* PUBLIC METHODS
********************/
// this is called when the geoip call returns
handleAutoCountry: function() {
if (this.options.initialCountry === "auto") {
// we must set this even if there is an initial val in the input: in case the initial val is invalid and they delete it - they should see their auto country
this.defaultCountry = $.fn[pluginName].autoCountry;
// if there's no initial value in the input, then update the flag
if (!this.telInput.val()) {
this.setCountry(this.defaultCountry);
}
this.autoCountryDeferred.resolve();
}
},
// remove plugin
destroy: function() {
if (!this.isMobile) {
// make sure the dropdown is closed (and unbind listeners)
this._closeDropdown();
}
// key events, and focus/blur events if autoHideDialCode=true
this.telInput.off(this.ns);
if (this.isMobile) {
// change event on select country
this.countryList.off(this.ns);
} else {
// click event to open dropdown
this.selectedFlagInner.parent().off(this.ns);
// label click hack
this.telInput.closest("label").off(this.ns);
}
// remove markup
var container = this.telInput.parent();
container.before(this.telInput).remove();
},
// extract the phone number extension if present
getExtension: function() {
return this.telInput.val().split(" ext. ")[1] || "";
},
// format the number to the given type
getNumber: function(type) {
if (window.intlTelInputUtils) {
return intlTelInputUtils.formatNumberByType(this.telInput.val(), this.selectedCountryData.iso2, type);
}
return "";
},
// get the type of the entered number e.g. landline/mobile
getNumberType: function() {
if (window.intlTelInputUtils) {
return intlTelInputUtils.getNumberType(this.telInput.val(), this.selectedCountryData.iso2);
}
return -99;
},
// get the country data for the currently selected flag
getSelectedCountryData: function() {
// if this is undefined, the plugin will return it's instance instead, so in that case an empty object makes more sense
return this.selectedCountryData || {};
},
// get the validation error
getValidationError: function() {
if (window.intlTelInputUtils) {
return intlTelInputUtils.getValidationError(this.telInput.val(), this.selectedCountryData.iso2);
}
return -99;
},
// validate the input val - assumes the global function isValidNumber (from utilsScript)
isValidNumber: function() {
var val = $.trim(this.telInput.val()), countryCode = this.options.nationalMode ? this.selectedCountryData.iso2 : "";
if (window.intlTelInputUtils) {
return intlTelInputUtils.isValidNumber(val, countryCode);
}
return false;
},
// update the selected flag, and update the input val accordingly ()
setCountry: function(countryCode) {
countryCode = countryCode.toLowerCase();
// check if already selected
if (!this.selectedFlagInner.hasClass(countryCode)) {
this._setFlag(countryCode);
this._updateDialCode(this.selectedCountryData.dialCode, false);
}
},
// set the input value and update the flag
// NOTE: format arg is for public method: to allow devs to format how they want
setNumber: function(number, format, addSuffix, preventConversion, isAllowedKey) {
// ensure starts with plus
if (!this.options.nationalMode && number.charAt(0) != "+") {
number = "+" + number;
}
// we must update the flag first, which updates this.selectedCountryData, which is used later for formatting the number before displaying it
this._updateFlagFromNumber(number);
this._updateVal(number, format, addSuffix, preventConversion, isAllowedKey);
},
// this is called when the utils request completes
handleUtils: function() {
// if the request was successful
if (window.intlTelInputUtils) {
// if autoFormat is enabled and there's an initial value in the input, then format it
if (this.options.autoFormat && this.telInput.val()) {
this._updateVal(this.telInput.val(), null, false, false, false);
}
this._updatePlaceholder();
}
this.utilsScriptDeferred.resolve();
}
};
// using https://github.com/jquery-boilerplate/jquery-boilerplate/wiki/Extending-jQuery-Boilerplate
// (adapted to allow public functions)
$.fn[pluginName] = function(options) {
var args = arguments;
// Is the first parameter an object (options), or was omitted,
// instantiate a new instance of the plugin.
if (options === undefined || typeof options === "object") {
var deferreds = [];
this.each(function() {
if (!$.data(this, "plugin_" + pluginName)) {
var instance = new Plugin(this, options);
var instanceDeferreds = instance._init();
// we now have 2 deffereds: 1 for auto country, 1 for utils script
deferreds.push(instanceDeferreds[0]);
deferreds.push(instanceDeferreds[1]);
$.data(this, "plugin_" + pluginName, instance);
}
});
// return the promise from the "master" deferred object that tracks all the others
return $.when.apply(null, deferreds);
} else if (typeof options === "string" && options[0] !== "_") {
// If the first parameter is a string and it doesn't start
// with an underscore or "contains" the `init`-function,
// treat this as a call to a public method.
// Cache the method call to make it possible to return a value
var returns;
this.each(function() {
var instance = $.data(this, "plugin_" + pluginName);
// Tests that there's already a plugin-instance
// and checks that the requested public method exists
if (instance instanceof Plugin && typeof instance[options] === "function") {
// Call the method of our plugin instance,
// and pass it the supplied arguments.
returns = instance[options].apply(instance, Array.prototype.slice.call(args, 1));
}
// Allow instances to be destroyed via the 'destroy' method
if (options === "destroy") {
$.data(this, "plugin_" + pluginName, null);
}
});
// If the earlier cached method gives a value back return the value,
// otherwise return this to preserve chainability.
return returns !== undefined ? returns : this;
}
};
/********************
* STATIC METHODS
********************/
// get the country data object
$.fn[pluginName].getCountryData = function() {
return allCountries;
};
// load the utils script
$.fn[pluginName].loadUtils = function(path, utilsScriptDeferred) {
if (!$.fn[pluginName].loadedUtilsScript) {
// don't do this twice! (dont just check if window.intlTelInputUtils exists as if init plugin multiple times in quick succession, it may not have finished loading yet)
$.fn[pluginName].loadedUtilsScript = true;
// dont use $.getScript as it prevents caching
$.ajax({
url: path,
complete: function() {
// tell all instances that the utils request is complete
$(".intl-tel-input input").intlTelInput("handleUtils");
},
dataType: "script",
cache: true
});
} else if (utilsScriptDeferred) {
utilsScriptDeferred.resolve();
}
};
// version
$.fn[pluginName].version = "7.1.1";
// Tell JSHint to ignore this warning: "character may get silently deleted by one or more browsers"
// jshint -W100
// Array of country objects for the flag dropdown.
// Each contains a name, country code (ISO 3166-1 alpha-2) and dial code.
// Originally from https://github.com/mledoze/countries
// then with a couple of manual re-arrangements to be alphabetical
// then changed Kazakhstan from +76 to +7
// and Vatican City from +379 to +39 (see issue 50)
// and Caribean Netherlands from +5997 to +599
// and Curacao from +5999 to +599
// Removed: Kosovo, Pitcairn Islands, South Georgia
// UPDATE Sept 12th 2015
// List of regions that have iso2 country codes, which I have chosen to omit:
// (based on this information: https://en.wikipedia.org/wiki/List_of_country_calling_codes)
// AQ - Antarctica - all different country codes depending on which "base"
// BV - Bouvet Island - no calling code
// GS - South Georgia and the South Sandwich Islands - "inhospitable collection of islands" - same flag and calling code as Falkland Islands
// HM - Heard Island and McDonald Islands - no calling code
// PN - Pitcairn - tiny population (56), same calling code as New Zealand
// TF - French Southern Territories - no calling code
// UM - United States Minor Outlying Islands - no calling code
// UPDATE the criteria of supported countries or territories (see issue 297)
// Have an iso2 code: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
// Have a country calling code: https://en.wikipedia.org/wiki/List_of_country_calling_codes
// Have a flag
// Must be supported by libphonenumber: https://github.com/googlei18n/libphonenumber
// Update: converted objects to arrays to save bytes!
// Update: added "priority" for countries with the same dialCode as others
// Update: added array of area codes for countries with the same dialCode as others
// So each country array has the following information:
// [
// Country name,
// iso2 code,
// International dial code,
// Order (if >1 country with same dial code),
// Area codes (if >1 country with same dial code)
// ]
var allCountries = [ [ "Afghanistan (افغانستان)", "af", "93" ], [ "Albania (Shqipëri)", "al", "355" ], [ "Algeria (الجزائر)", "dz", "213" ], [ "American Samoa", "as", "1684" ], [ "Andorra", "ad", "376" ], [ "Angola", "ao", "244" ], [ "Anguilla", "ai", "1264" ], [ "Antigua and Barbuda", "ag", "1268" ], [ "Argentina", "ar", "54" ], [ "Armenia (Հայաստան)", "am", "374" ], [ "Aruba", "aw", "297" ], [ "Australia", "au", "61", 0 ], [ "Austria (Österreich)", "at", "43" ], [ "Azerbaijan (Azərbaycan)", "az", "994" ], [ "Bahamas", "bs", "1242" ], [ "Bahrain (البحرين)", "bh", "973" ], [ "Bangladesh (বাংলাদেশ)", "bd", "880" ], [ "Barbados", "bb", "1246" ], [ "Belarus (Беларусь)", "by", "375" ], [ "Belgium (België)", "be", "32" ], [ "Belize", "bz", "501" ], [ "Benin (Bénin)", "bj", "229" ], [ "Bermuda", "bm", "1441" ], [ "Bhutan (འབྲུག)", "bt", "975" ], [ "Bolivia", "bo", "591" ], [ "Bosnia and Herzegovina (Босна и Херцеговина)", "ba", "387" ], [ "Botswana", "bw", "267" ], [ "Brazil (Brasil)", "br", "55" ], [ "British Indian Ocean Territory", "io", "246" ], [ "British Virgin Islands", "vg", "1284" ], [ "Brunei", "bn", "673" ], [ "Bulgaria (България)", "bg", "359" ], [ "Burkina Faso", "bf", "226" ], [ "Burundi (Uburundi)", "bi", "257" ], [ "Cambodia (កម្ពុជា)", "kh", "855" ], [ "Cameroon (Cameroun)", "cm", "237" ], [ "Canada", "ca", "1", 1, [ "204", "226", "236", "249", "250", "289", "306", "343", "365", "387", "403", "416", "418", "431", "437", "438", "450", "506", "514", "519", "548", "579", "581", "587", "604", "613", "639", "647", "672", "705", "709", "742", "778", "780", "782", "807", "819", "825", "867", "873", "902", "905" ] ], [ "Cape Verde (Kabu Verdi)", "cv", "238" ], [ "Caribbean Netherlands", "bq", "599", 1 ], [ "Cayman Islands", "ky", "1345" ], [ "Central African Republic (République centrafricaine)", "cf", "236" ], [ "Chad (Tchad)", "td", "235" ], [ "Chile", "cl", "56" ], [ "China (中国)", "cn", "86" ], [ "Christmas Island", "cx", "61", 2 ], [ "Cocos (Keeling) Islands", "cc", "61", 1 ], [ "Colombia", "co", "57" ], [ "Comoros (جزر القمر)", "km", "269" ], [ "Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)", "cd", "243" ], [ "Congo (Republic) (Congo-Brazzaville)", "cg", "242" ], [ "Cook Islands", "ck", "682" ], [ "Costa Rica", "cr", "506" ], [ "Côte d’Ivoire", "ci", "225" ], [ "Croatia (Hrvatska)", "hr", "385" ], [ "Cuba", "cu", "53" ], [ "Curaçao", "cw", "599", 0 ], [ "Cyprus (Κύπρος)", "cy", "357" ], [ "Czech Republic (Česká republika)", "cz", "420" ], [ "Denmark (Danmark)", "dk", "45" ], [ "Djibouti", "dj", "253" ], [ "Dominica", "dm", "1767" ], [ "Dominican Republic (República Dominicana)", "do", "1", 2, [ "809", "829", "849" ] ], [ "Ecuador", "ec", "593" ], [ "Egypt (مصر)", "eg", "20" ], [ "El Salvador", "sv", "503" ], [ "Equatorial Guinea (Guinea Ecuatorial)", "gq", "240" ], [ "Eritrea", "er", "291" ], [ "Estonia (Eesti)", "ee", "372" ], [ "Ethiopia", "et", "251" ], [ "Falkland Islands (Islas Malvinas)", "fk", "500" ], [ "Faroe Islands (Føroyar)", "fo", "298" ], [ "Fiji", "fj", "679" ], [ "Finland (Suomi)", "fi", "358", 0 ], [ "France", "fr", "33" ], [ "French Guiana (Guyane française)", "gf", "594" ], [ "French Polynesia (Polynésie française)", "pf", "689" ], [ "Gabon", "ga", "241" ], [ "Gambia", "gm", "220" ], [ "Georgia (საქართველო)", "ge", "995" ], [ "Germany (Deutschland)", "de", "49" ], [ "Ghana (Gaana)", "gh", "233" ], [ "Gibraltar", "gi", "350" ], [ "Greece (Ελλάδα)", "gr", "30" ], [ "Greenland (Kalaallit Nunaat)", "gl", "299" ], [ "Grenada", "gd", "1473" ], [ "Guadeloupe", "gp", "590", 0 ], [ "Guam", "gu", "1671" ], [ "Guatemala", "gt", "502" ], [ "Guernsey", "gg", "44", 1 ], [ "Guinea (Guinée)", "gn", "224" ], [ "Guinea-Bissau (Guiné Bissau)", "gw", "245" ], [ "Guyana", "gy", "592" ], [ "Haiti", "ht", "509" ], [ "Honduras", "hn", "504" ], [ "Hong Kong (香港)", "hk", "852" ], [ "Hungary (Magyarország)", "hu", "36" ], [ "Iceland (Ísland)", "is", "354" ], [ "India (भारत)", "in", "91" ], [ "Indonesia", "id", "62" ], [ "Iran (ایران)", "ir", "98" ], [ "Iraq (العراق)", "iq", "964" ], [ "Ireland", "ie", "353" ], [ "Isle of Man", "im", "44", 2 ], [ "Israel (ישראל)", "il", "972" ], [ "Italy (Italia)", "it", "39", 0 ], [ "Jamaica", "jm", "1876" ], [ "Japan (日本)", "jp", "81" ], [ "Jersey", "je", "44", 3 ], [ "Jordan (الأردن)", "jo", "962" ], [ "Kazakhstan (Казахстан)", "kz", "7", 1 ], [ "Kenya", "ke", "254" ], [ "Kiribati", "ki", "686" ], [ "Kuwait (الكويت)", "kw", "965" ], [ "Kyrgyzstan (Кыргызстан)", "kg", "996" ], [ "Laos (ລາວ)", "la", "856" ], [ "Latvia (Latvija)", "lv", "371" ], [ "Lebanon (لبنان)", "lb", "961" ], [ "Lesotho", "ls", "266" ], [ "Liberia", "lr", "231" ], [ "Libya (ليبيا)", "ly", "218" ], [ "Liechtenstein", "li", "423" ], [ "Lithuania (Lietuva)", "lt", "370" ], [ "Luxembourg", "lu", "352" ], [ "Macau (澳門)", "mo", "853" ], [ "Macedonia (FYROM) (Македонија)", "mk", "389" ], [ "Madagascar (Madagasikara)", "mg", "261" ], [ "Malawi", "mw", "265" ], [ "Malaysia", "my", "60" ], [ "Maldives", "mv", "960" ], [ "Mali", "ml", "223" ], [ "Malta", "mt", "356" ], [ "Marshall Islands", "mh", "692" ], [ "Martinique", "mq", "596" ], [ "Mauritania (موريتانيا)", "mr", "222" ], [ "Mauritius (Moris)", "mu", "230" ], [ "Mayotte", "yt", "262", 1 ], [ "Mexico (México)", "mx", "52" ], [ "Micronesia", "fm", "691" ], [ "Moldova (Republica Moldova)", "md", "373" ], [ "Monaco", "mc", "377" ], [ "Mongolia (Монгол)", "mn", "976" ], [ "Montenegro (Crna Gora)", "me", "382" ], [ "Montserrat", "ms", "1664" ], [ "Morocco (المغرب)", "ma", "212", 0 ], [ "Mozambique (Moçambique)", "mz", "258" ], [ "Myanmar (Burma) (မြန်မာ)", "mm", "95" ], [ "Namibia (Namibië)", "na", "264" ], [ "Nauru", "nr", "674" ], [ "Nepal (नेपाल)", "np", "977" ], [ "Netherlands (Nederland)", "nl", "31" ], [ "New Caledonia (Nouvelle-Calédonie)", "nc", "687" ], [ "New Zealand", "nz", "64" ], [ "Nicaragua", "ni", "505" ], [ "Niger (Nijar)", "ne", "227" ], [ "Nigeria", "ng", "234" ], [ "Niue", "nu", "683" ], [ "Norfolk Island", "nf", "672" ], [ "North Korea (조선 민주주의 인민 공화국)", "kp", "850" ], [ "Northern Mariana Islands", "mp", "1670" ], [ "Norway (Norge)", "no", "47", 0 ], [ "Oman (عُمان)", "om", "968" ], [ "Pakistan (پاکستان)", "pk", "92" ], [ "Palau", "pw", "680" ], [ "Palestine (فلسطين)", "ps", "970" ], [ "Panama (Panamá)", "pa", "507" ], [ "Papua New Guinea", "pg", "675" ], [ "Paraguay", "py", "595" ], [ "Peru (Perú)", "pe", "51" ], [ "Philippines", "ph", "63" ], [ "Poland (Polska)", "pl", "48" ], [ "Portugal", "pt", "351" ], [ "Puerto Rico", "pr", "1", 3, [ "787", "939" ] ], [ "Qatar (قطر)", "qa", "974" ], [ "Réunion (La Réunion)", "re", "262", 0 ], [ "Romania (România)", "ro", "40" ], [ "Russia (Россия)", "ru", "7", 0 ], [ "Rwanda", "rw", "250" ], [ "Saint Barthélemy (Saint-Barthélemy)", "bl", "590", 1 ], [ "Saint Helena", "sh", "290" ], [ "Saint Kitts and Nevis", "kn", "1869" ], [ "Saint Lucia", "lc", "1758" ], [ "Saint Martin (Saint-Martin (partie française))", "mf", "590", 2 ], [ "Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)", "pm", "508" ], [ "Saint Vincent and the Grenadines", "vc", "1784" ], [ "Samoa", "ws", "685" ], [ "San Marino", "sm", "378" ], [ "São Tomé and Príncipe (São Tomé e Príncipe)", "st", "239" ], [ "Saudi Arabia (المملكة العربية السعودية)", "sa", "966" ], [ "Senegal (Sénégal)", "sn", "221" ], [ "Serbia (Србија)", "rs", "381" ], [ "Seychelles", "sc", "248" ], [ "Sierra Leone", "sl", "232" ], [ "Singapore", "sg", "65" ], [ "Sint Maarten", "sx", "1721" ], [ "Slovakia (Slovensko)", "sk", "421" ], [ "Slovenia (Slovenija)", "si", "386" ], [ "Solomon Islands", "sb", "677" ], [ "Somalia (Soomaaliya)", "so", "252" ], [ "South Africa", "za", "27" ], [ "South Korea (대한민국)", "kr", "82" ], [ "South Sudan (جنوب السودان)", "ss", "211" ], [ "Spain (España)", "es", "34" ], [ "Sri Lanka (ශ්රී ලංකාව)", "lk", "94" ], [ "Sudan (السودان)", "sd", "249" ], [ "Suriname", "sr", "597" ], [ "Svalbard and Jan Mayen", "sj", "47", 1 ], [ "Swaziland", "sz", "268" ], [ "Sweden (Sverige)", "se", "46" ], [ "Switzerland (Schweiz)", "ch", "41" ], [ "Syria (سوريا)", "sy", "963" ], [ "Taiwan (台灣)", "tw", "886" ], [ "Tajikistan", "tj", "992" ], [ "Tanzania", "tz", "255" ], [ "Thailand (ไทย)", "th", "66" ], [ "Timor-Leste", "tl", "670" ], [ "Togo", "tg", "228" ], [ "Tokelau", "tk", "690" ], [ "Tonga", "to", "676" ], [ "Trinidad and Tobago", "tt", "1868" ], [ "Tunisia (تونس)", "tn", "216" ], [ "Turkey (Türkiye)", "tr", "90" ], [ "Turkmenistan", "tm", "993" ], [ "Turks and Caicos Islands", "tc", "1649" ], [ "Tuvalu", "tv", "688" ], [ "U.S. Virgin Islands", "vi", "1340" ], [ "Uganda", "ug", "256" ], [ "Ukraine (Україна)", "ua", "380" ], [ "United Arab Emirates (الإمارات العربية المتحدة)", "ae", "971" ], [ "United Kingdom", "gb", "44", 0 ], [ "United States", "us", "1", 0 ], [ "Uruguay", "uy", "598" ], [ "Uzbekistan (Oʻzbekiston)", "uz", "998" ], [ "Vanuatu", "vu", "678" ], [ "Vatican City (Città del Vaticano)", "va", "39", 1 ], [ "Venezuela", "ve", "58" ], [ "Vietnam (Việt Nam)", "vn", "84" ], [ "Wallis and Futuna", "wf", "681" ], [ "Western Sahara (الصحراء الغربية)", "eh", "212", 1 ], [ "Yemen (اليمن)", "ye", "967" ], [ "Zambia", "zm", "260" ], [ "Zimbabwe", "zw", "263" ], [ "Åland Islands", "ax", "358", 1 ] ];
// loop over all of the countries above
for (var i = 0; i < allCountries.length; i++) {
var c = allCountries[i];
allCountries[i] = {
name: c[0],
iso2: c[1],
dialCode: c[2],
priority: c[3] || 0,
areaCodes: c[4] || null
};
}
});
// source --> https://iparrotpost.com/wp-content/plugins/psychics-listing-frontpage-live/js/jquery-confirm.min.js?ver=5.3.2
/*!
* jquery-confirm v3.3.0 (http://craftpip.github.io/jquery-confirm/)
* Author: Boniface Pereira
* Website: www.craftpip.com
* Contact: hey@craftpip.com
*
* Copyright 2013-2017 jquery-confirm
* Licensed under MIT (https://github.com/craftpip/jquery-confirm/blob/master/LICENSE)
*/
if(typeof jQuery==="undefined"){throw new Error("jquery-confirm requires jQuery");}var jconfirm,Jconfirm;(function($,window){$.fn.confirm=function(options,option2){if(typeof options==="undefined"){options={};}if(typeof options==="string"){options={content:options,title:(option2)?option2:false};}$(this).each(function(){var $this=$(this);if($this.attr("jc-attached")){console.warn("jConfirm has already been attached to this element ",$this[0]);return;}$this.on("click",function(e){e.preventDefault();var jcOption=$.extend({},options);if($this.attr("data-title")){jcOption.title=$this.attr("data-title");}if($this.attr("data-content")){jcOption.content=$this.attr("data-content");}if(typeof jcOption.buttons=="undefined"){jcOption.buttons={};}jcOption["$target"]=$this;if($this.attr("href")&&Object.keys(jcOption.buttons).length==0){var buttons=$.extend(true,{},jconfirm.pluginDefaults.defaultButtons,(jconfirm.defaults||{}).defaultButtons||{});var firstBtn=Object.keys(buttons)[0];jcOption.buttons=buttons;jcOption.buttons[firstBtn].action=function(){location.href=$this.attr("href");};}jcOption.closeIcon=false;var instance=$.confirm(jcOption);});$this.attr("jc-attached",true);});return $(this);};$.confirm=function(options,option2){if(typeof options==="undefined"){options={};}if(typeof options==="string"){options={content:options,title:(option2)?option2:false};}if(typeof options.buttons!="object"){options.buttons={};}if(Object.keys(options.buttons).length==0){var buttons=$.extend(true,{},jconfirm.pluginDefaults.defaultButtons,(jconfirm.defaults||{}).defaultButtons||{});options.buttons=buttons;}return jconfirm(options);};$.alert=function(options,option2){if(typeof options==="undefined"){options={};}if(typeof options==="string"){options={content:options,title:(option2)?option2:false};}if(typeof options.buttons!="object"){options.buttons={};}if(Object.keys(options.buttons).length==0){var buttons=$.extend(true,{},jconfirm.pluginDefaults.defaultButtons,(jconfirm.defaults||{}).defaultButtons||{});var firstBtn=Object.keys(buttons)[0];options.buttons[firstBtn]=buttons[firstBtn];}return jconfirm(options);};$.dialog=function(options,option2){if(typeof options==="undefined"){options={};}if(typeof options==="string"){options={content:options,title:(option2)?option2:false,closeIcon:function(){}};}options.buttons={};if(typeof options.closeIcon=="undefined"){options.closeIcon=function(){};}options.confirmKeys=[13];return jconfirm(options);};jconfirm=function(options){if(typeof options==="undefined"){options={};}var pluginOptions=$.extend(true,{},jconfirm.pluginDefaults);if(jconfirm.defaults){pluginOptions=$.extend(true,pluginOptions,jconfirm.defaults);}pluginOptions=$.extend(true,{},pluginOptions,options);var instance=new Jconfirm(pluginOptions);jconfirm.instances.push(instance);return instance;};Jconfirm=function(options){$.extend(this,options);this._init();};Jconfirm.prototype={_init:function(){var that=this;if(!jconfirm.instances.length){jconfirm.lastFocused=$("body").find(":focus");}this._id=Math.round(Math.random()*99999);this.contentParsed=$(document.createElement("div"));if(!this.lazyOpen){setTimeout(function(){that.open();},0);}},_buildHTML:function(){var that=this;this._parseAnimation(this.animation,"o");this._parseAnimation(this.closeAnimation,"c");this._parseBgDismissAnimation(this.backgroundDismissAnimation);this._parseColumnClass(this.columnClass);this._parseTheme(this.theme);this._parseType(this.type);var template=$(this.template);template.find(".jconfirm-box").addClass(this.animationParsed).addClass(this.backgroundDismissAnimationParsed).addClass(this.typeParsed);if(this.typeAnimated){template.find(".jconfirm-box").addClass("jconfirm-type-animated");}if(this.useBootstrap){template.find(".jc-bs3-row").addClass(this.bootstrapClasses.row);template.find(".jc-bs3-row").addClass("justify-content-md-center justify-content-sm-center justify-content-xs-center justify-content-lg-center");template.find(".jconfirm-box-container").addClass(this.columnClassParsed);if(this.containerFluid){template.find(".jc-bs3-container").addClass(this.bootstrapClasses.containerFluid);}else{template.find(".jc-bs3-container").addClass(this.bootstrapClasses.container);}}else{template.find(".jconfirm-box").css("width",this.boxWidth);}if(this.titleClass){template.find(".jconfirm-title-c").addClass(this.titleClass);}template.addClass(this.themeParsed);var ariaLabel="jconfirm-box"+this._id;template.find(".jconfirm-box").attr("aria-labelledby",ariaLabel).attr("tabindex",-1);template.find(".jconfirm-content").attr("id",ariaLabel);if(this.bgOpacity!==null){template.find(".jconfirm-bg").css("opacity",this.bgOpacity);}if(this.rtl){template.addClass("jconfirm-rtl");}this.$el=template.appendTo(this.container);this.$jconfirmBoxContainer=this.$el.find(".jconfirm-box-container");this.$jconfirmBox=this.$body=this.$el.find(".jconfirm-box");this.$jconfirmBg=this.$el.find(".jconfirm-bg");this.$title=this.$el.find(".jconfirm-title");this.$titleContainer=this.$el.find(".jconfirm-title-c");this.$content=this.$el.find("div.jconfirm-content");this.$contentPane=this.$el.find(".jconfirm-content-pane");this.$icon=this.$el.find(".jconfirm-icon-c");this.$closeIcon=this.$el.find(".jconfirm-closeIcon");this.$holder=this.$el.find(".jconfirm-holder");this.$btnc=this.$el.find(".jconfirm-buttons");this.$scrollPane=this.$el.find(".jconfirm-scrollpane");that.setStartingPoint();this._contentReady=$.Deferred();this._modalReady=$.Deferred();this.$holder.css({"padding-top":this.offsetTop,"padding-bottom":this.offsetBottom,});this.setTitle();this.setIcon();this._setButtons();this._parseContent();this.initDraggable();if(this.isAjax){this.showLoading(false);}$.when(this._contentReady,this._modalReady).then(function(){if(that.isAjaxLoading){setTimeout(function(){that.isAjaxLoading=false;that.setContent();that.setTitle();that.setIcon();setTimeout(function(){that.hideLoading(false);that._updateContentMaxHeight();},100);if(typeof that.onContentReady==="function"){that.onContentReady();}},50);}else{that._updateContentMaxHeight();that.setTitle();that.setIcon();if(typeof that.onContentReady==="function"){that.onContentReady();}}if(that.autoClose){that._startCountDown();}});this._watchContent();if(this.animation==="none"){this.animationSpeed=1;this.animationBounce=1;}this.$body.css(this._getCSS(this.animationSpeed,this.animationBounce));this.$contentPane.css(this._getCSS(this.animationSpeed,1));this.$jconfirmBg.css(this._getCSS(this.animationSpeed,1));this.$jconfirmBoxContainer.css(this._getCSS(this.animationSpeed,1));},_typePrefix:"jconfirm-type-",typeParsed:"",_parseType:function(type){this.typeParsed=this._typePrefix+type;},setType:function(type){var oldClass=this.typeParsed;this._parseType(type);this.$jconfirmBox.removeClass(oldClass).addClass(this.typeParsed);},themeParsed:"",_themePrefix:"jconfirm-",setTheme:function(theme){var previous=this.theme;this.theme=theme||this.theme;this._parseTheme(this.theme);if(previous){this.$el.removeClass(previous);}this.$el.addClass(this.themeParsed);this.theme=theme;},_parseTheme:function(theme){var that=this;theme=theme.split(",");$.each(theme,function(k,a){if(a.indexOf(that._themePrefix)===-1){theme[k]=that._themePrefix+$.trim(a);}});this.themeParsed=theme.join(" ").toLowerCase();},backgroundDismissAnimationParsed:"",_bgDismissPrefix:"jconfirm-hilight-",_parseBgDismissAnimation:function(bgDismissAnimation){var animation=bgDismissAnimation.split(",");var that=this;$.each(animation,function(k,a){if(a.indexOf(that._bgDismissPrefix)===-1){animation[k]=that._bgDismissPrefix+$.trim(a);}});this.backgroundDismissAnimationParsed=animation.join(" ").toLowerCase();},animationParsed:"",closeAnimationParsed:"",_animationPrefix:"jconfirm-animation-",setAnimation:function(animation){this.animation=animation||this.animation;this._parseAnimation(this.animation,"o");},_parseAnimation:function(animation,which){which=which||"o";var animations=animation.split(",");var that=this;$.each(animations,function(k,a){if(a.indexOf(that._animationPrefix)===-1){animations[k]=that._animationPrefix+$.trim(a);}});var a_string=animations.join(" ").toLowerCase();if(which==="o"){this.animationParsed=a_string;}else{this.closeAnimationParsed=a_string;}return a_string;},setCloseAnimation:function(closeAnimation){this.closeAnimation=closeAnimation||this.closeAnimation;this._parseAnimation(this.closeAnimation,"c");},setAnimationSpeed:function(speed){this.animationSpeed=speed||this.animationSpeed;},columnClassParsed:"",setColumnClass:function(colClass){if(!this.useBootstrap){console.warn("cannot set columnClass, useBootstrap is set to false");return;}this.columnClass=colClass||this.columnClass;this._parseColumnClass(this.columnClass);this.$jconfirmBoxContainer.addClass(this.columnClassParsed);},_updateContentMaxHeight:function(){var height=$(window).height()-(this.$jconfirmBox.outerHeight()-this.$contentPane.outerHeight())-(this.offsetTop+this.offsetBottom);this.$contentPane.css({"max-height":height+"px"});},setBoxWidth:function(width){if(this.useBootstrap){console.warn("cannot set boxWidth, useBootstrap is set to true");return;}this.boxWidth=width;this.$jconfirmBox.css("width",width);},_parseColumnClass:function(colClass){colClass=colClass.toLowerCase();var p;switch(colClass){case"xl":case"xlarge":p="col-md-12";break;case"l":case"large":p="col-md-8 col-md-offset-2";break;case"m":case"medium":p="col-md-6 col-md-offset-3";break;case"s":case"small":p="col-md-4 col-md-offset-4";break;case"xs":case"xsmall":p="col-md-2 col-md-offset-5";break;default:p=colClass;}this.columnClassParsed=p;},initDraggable:function(){var that=this;var $t=this.$titleContainer;this.resetDrag();if(this.draggable){$t.on("mousedown",function(e){$t.addClass("jconfirm-hand");that.mouseX=e.clientX;that.mouseY=e.clientY;that.isDrag=true;});$(window).on("mousemove."+this._id,function(e){if(that.isDrag){that.movingX=e.clientX-that.mouseX+that.initialX;that.movingY=e.clientY-that.mouseY+that.initialY;that.setDrag();}});$(window).on("mouseup."+this._id,function(){$t.removeClass("jconfirm-hand");if(that.isDrag){that.isDrag=false;that.initialX=that.movingX;that.initialY=that.movingY;}});}},resetDrag:function(){this.isDrag=false;this.initialX=0;this.initialY=0;this.movingX=0;this.movingY=0;this.mouseX=0;this.mouseY=0;this.$jconfirmBoxContainer.css("transform","translate("+0+"px, "+0+"px)");},setDrag:function(){if(!this.draggable){return;}this.alignMiddle=false;var boxWidth=this.$jconfirmBox.outerWidth();var boxHeight=this.$jconfirmBox.outerHeight();var windowWidth=$(window).width();var windowHeight=$(window).height();var that=this;var dragUpdate=1;if(that.movingX%dragUpdate===0||that.movingY%dragUpdate===0){if(that.dragWindowBorder){var leftDistance=(windowWidth/2)-boxWidth/2;var topDistance=(windowHeight/2)-boxHeight/2;topDistance-=that.dragWindowGap;leftDistance-=that.dragWindowGap;if(leftDistance+that.movingX<0){that.movingX=-leftDistance;}else{if(leftDistance-that.movingX<0){that.movingX=leftDistance;}}if(topDistance+that.movingY<0){that.movingY=-topDistance;}else{if(topDistance-that.movingY<0){that.movingY=topDistance;}}}that.$jconfirmBoxContainer.css("transform","translate("+that.movingX+"px, "+that.movingY+"px)");}},_scrollTop:function(){if(typeof pageYOffset!=="undefined"){return pageYOffset;}else{var B=document.body;var D=document.documentElement;D=(D.clientHeight)?D:B;return D.scrollTop;}},_watchContent:function(){var that=this;if(this._timer){clearInterval(this._timer);}var prevContentHeight=0;this._timer=setInterval(function(){if(that.smoothContent){var contentHeight=that.$content.outerHeight()||0;if(contentHeight!==prevContentHeight){that.$contentPane.css({height:contentHeight}).scrollTop(0);prevContentHeight=contentHeight;}var wh=$(window).height();var total=that.offsetTop+that.offsetBottom+that.$jconfirmBox.height()-that.$contentPane.height()+that.$content.height();if(total').html(that.buttons[key].text).addClass(that.buttons[key].btnClass).prop("disabled",that.buttons[key].isDisabled).css("display",that.buttons[key].isHidden?"none":"").click(function(e){e.preventDefault();var res=that.buttons[key].action.apply(that,[that.buttons[key]]);that.onAction.apply(that,[key,that.buttons[key]]);that._stopCountDown();if(typeof res==="undefined"||res){that.close();}});that.buttons[key].el=button_element;that.buttons[key].setText=function(text){button_element.html(text);};that.buttons[key].addClass=function(className){button_element.addClass(className);};that.buttons[key].removeClass=function(className){button_element.removeClass(className);};that.buttons[key].disable=function(){that.buttons[key].isDisabled=true;button_element.prop("disabled",true);};that.buttons[key].enable=function(){that.buttons[key].isDisabled=false;button_element.prop("disabled",false);};that.buttons[key].show=function(){that.buttons[key].isHidden=false;button_element.css("display","");};that.buttons[key].hide=function(){that.buttons[key].isHidden=true;button_element.css("display","none");};that["$_"+key]=that["$$"+key]=button_element;that.$btnc.append(button_element);});if(total_buttons===0){this.$btnc.hide();}if(this.closeIcon===null&&total_buttons===0){this.closeIcon=true;}if(this.closeIcon){if(this.closeIconClass){var closeHtml=' ';this.$closeIcon.html(closeHtml);}this.$closeIcon.click(function(e){e.preventDefault();var buttonName=false;var shouldClose=false;var str;if(typeof that.closeIcon=="function"){str=that.closeIcon();}else{str=that.closeIcon;}if(typeof str=="string"&&typeof that.buttons[str]!="undefined"){buttonName=str;shouldClose=false;}else{if(typeof str=="undefined"||!!(str)==true){shouldClose=true;}else{shouldClose=false;}}if(buttonName){var btnResponse=that.buttons[buttonName].action.apply(that);shouldClose=(typeof btnResponse=="undefined")||!!(btnResponse);}if(shouldClose){that.close();}});this.$closeIcon.show();}else{this.$closeIcon.hide();}},setTitle:function(string,force){force=force||false;if(typeof string!=="undefined"){if(typeof string=="string"){this.title=string;}else{if(typeof string=="function"){if(typeof string.promise=="function"){console.error("Promise was returned from title function, this is not supported.");}var response=string();if(typeof response=="string"){this.title=response;}else{this.title=false;}}else{this.title=false;}}}if(this.isAjaxLoading&&!force){return;}this.$title.html(this.title||"");this.updateTitleContainer();},setIcon:function(iconClass,force){force=force||false;if(typeof iconClass!=="undefined"){if(typeof iconClass=="string"){this.icon=iconClass;}else{if(typeof iconClass==="function"){var response=iconClass();if(typeof response=="string"){this.icon=response;}else{this.icon=false;}}else{this.icon=false;}}}if(this.isAjaxLoading&&!force){return;}this.$icon.html(this.icon?' ':"");this.updateTitleContainer();},updateTitleContainer:function(){if(!this.title&&!this.icon){this.$titleContainer.hide();}else{this.$titleContainer.show();}},setContentPrepend:function(content,force){if(!content){return;}this.contentParsed.prepend(content);},setContentAppend:function(content){if(!content){return;}this.contentParsed.append(content);},setContent:function(content,force){force=!!force;var that=this;if(content){this.contentParsed.html("").append(content);}if(this.isAjaxLoading&&!force){return;}this.$content.html("");this.$content.append(this.contentParsed);setTimeout(function(){that.$body.find("input[autofocus]:visible:first").focus();},100);},loadingSpinner:false,showLoading:function(disableButtons){this.loadingSpinner=true;this.$jconfirmBox.addClass("loading");if(disableButtons){this.$btnc.find("button").prop("disabled",true);}},hideLoading:function(enableButtons){this.loadingSpinner=false;this.$jconfirmBox.removeClass("loading");if(enableButtons){this.$btnc.find("button").prop("disabled",false);}},ajaxResponse:false,contentParsed:"",isAjax:false,isAjaxLoading:false,_parseContent:function(){var that=this;var e=" ";if(typeof this.content=="function"){var res=this.content.apply(this);if(typeof res=="string"){this.content=res;}else{if(typeof res=="object"&&typeof res.always=="function"){this.isAjax=true;this.isAjaxLoading=true;res.always(function(data,status,xhr){that.ajaxResponse={data:data,status:status,xhr:xhr};that._contentReady.resolve(data,status,xhr);if(typeof that.contentLoaded=="function"){that.contentLoaded(data,status,xhr);}});this.content=e;}else{this.content=e;}}}if(typeof this.content=="string"&&this.content.substr(0,4).toLowerCase()==="url:"){this.isAjax=true;this.isAjaxLoading=true;var u=this.content.substring(4,this.content.length);$.get(u).done(function(html){that.contentParsed.html(html);}).always(function(data,status,xhr){that.ajaxResponse={data:data,status:status,xhr:xhr};that._contentReady.resolve(data,status,xhr);if(typeof that.contentLoaded=="function"){that.contentLoaded(data,status,xhr);}});}if(!this.content){this.content=e;}if(!this.isAjax){this.contentParsed.html(this.content);this.setContent();that._contentReady.resolve();}},_stopCountDown:function(){clearInterval(this.autoCloseInterval);if(this.$cd){this.$cd.remove();}},_startCountDown:function(){var that=this;var opt=this.autoClose.split("|");if(opt.length!==2){console.error("Invalid option for autoClose. example 'close|10000'");return false;}var button_key=opt[0];var time=parseInt(opt[1]);if(typeof this.buttons[button_key]==="undefined"){console.error("Invalid button key '"+button_key+"' for autoClose");return false;}var seconds=Math.ceil(time/1000);this.$cd=$(' ('+seconds+") ").appendTo(this["$_"+button_key]);this.autoCloseInterval=setInterval(function(){that.$cd.html(" ("+(seconds-=1)+") ");if(seconds<=0){that["$$"+button_key].trigger("click");that._stopCountDown();}},1000);},_getKey:function(key){switch(key){case 192:return"tilde";case 13:return"enter";case 16:return"shift";case 9:return"tab";case 20:return"capslock";case 17:return"ctrl";case 91:return"win";case 18:return"alt";case 27:return"esc";case 32:return"space";}var initial=String.fromCharCode(key);if(/^[A-z0-9]+$/.test(initial)){return initial.toLowerCase();}else{return false;}},reactOnKey:function(e){var that=this;var a=$(".jconfirm");if(a.eq(a.length-1)[0]!==this.$el[0]){return false;}var key=e.which;if(this.$content.find(":input").is(":focus")&&/13|32/.test(key)){return false;}var keyChar=this._getKey(key);if(keyChar==="esc"&&this.escapeKey){if(this.escapeKey===true){this.$scrollPane.trigger("click");}else{if(typeof this.escapeKey==="string"||typeof this.escapeKey==="function"){var buttonKey;if(typeof this.escapeKey==="function"){buttonKey=this.escapeKey();}else{buttonKey=this.escapeKey;}if(buttonKey){if(typeof this.buttons[buttonKey]==="undefined"){console.warn("Invalid escapeKey, no buttons found with key "+buttonKey);}else{this["$_"+buttonKey].trigger("click");}}}}}$.each(this.buttons,function(key,button){if(button.keys.indexOf(keyChar)!=-1){that["$_"+key].trigger("click");}});},setDialogCenter:function(){console.info("setDialogCenter is deprecated, dialogs are centered with CSS3 tables");},_unwatchContent:function(){clearInterval(this._timer);},close:function(){var that=this;if(typeof this.onClose==="function"){this.onClose();}this._unwatchContent();$(window).unbind("resize."+this._id);$(window).unbind("keyup."+this._id);$(window).unbind("jcKeyDown."+this._id);if(this.draggable){$(window).unbind("mousemove."+this._id);$(window).unbind("mouseup."+this._id);this.$titleContainer.unbind("mousedown");}that.$el.removeClass(that.loadedClass);$("body").removeClass("jconfirm-no-scroll-"+that._id);that.$jconfirmBoxContainer.removeClass("jconfirm-no-transition");setTimeout(function(){that.$body.addClass(that.closeAnimationParsed);that.$jconfirmBg.addClass("jconfirm-bg-h");var closeTimer=(that.closeAnimation==="none")?1:that.animationSpeed;setTimeout(function(){that.$el.remove();var l=jconfirm.instances;var i=jconfirm.instances.length-1;for(i;i>=0;i--){if(jconfirm.instances[i]._id===that._id){jconfirm.instances.splice(i,1);}}if(!jconfirm.instances.length){if(that.scrollToPreviousElement&&jconfirm.lastFocused&&jconfirm.lastFocused.length&&$.contains(document,jconfirm.lastFocused[0])){var $lf=jconfirm.lastFocused;if(that.scrollToPreviousElementAnimate){var st=$(window).scrollTop();var ot=jconfirm.lastFocused.offset().top;var wh=$(window).height();if(!(ot>st&&ot<(st+wh))){var scrollTo=(ot-Math.round((wh/3)));$("html, body").animate({scrollTop:scrollTo},that.animationSpeed,"swing",function(){$lf.focus();});}else{$lf.focus();}}else{$lf.focus();}jconfirm.lastFocused=false;}}if(typeof that.onDestroy==="function"){that.onDestroy();}},closeTimer*0.4);},50);return true;},open:function(){if(this.isOpen()){return false;}this._buildHTML();this._bindEvents();this._open();return true;},setStartingPoint:function(){var el=false;if(this.animateFromElement!==true&&this.animateFromElement){el=this.animateFromElement;jconfirm.lastClicked=false;}else{if(jconfirm.lastClicked&&this.animateFromElement===true){el=jconfirm.lastClicked;jconfirm.lastClicked=false;}else{return false;}}if(!el){return false;}var offset=el.offset();var iTop=el.outerHeight()/2;var iLeft=el.outerWidth()/2;iTop-=this.$jconfirmBox.outerHeight()/2;iLeft-=this.$jconfirmBox.outerWidth()/2;var sourceTop=offset.top+iTop;sourceTop=sourceTop-this._scrollTop();var sourceLeft=offset.left+iLeft;var wh=$(window).height()/2;var ww=$(window).width()/2;var targetH=wh-this.$jconfirmBox.outerHeight()/2;var targetW=ww-this.$jconfirmBox.outerWidth()/2;sourceTop-=targetH;sourceLeft-=targetW;if(Math.abs(sourceTop)>wh||Math.abs(sourceLeft)>ww){return false;}this.$jconfirmBoxContainer.css("transform","translate("+sourceLeft+"px, "+sourceTop+"px)");},_open:function(){var that=this;if(typeof that.onOpenBefore==="function"){that.onOpenBefore();}this.$body.removeClass(this.animationParsed);this.$jconfirmBg.removeClass("jconfirm-bg-h");this.$body.focus();that.$jconfirmBoxContainer.css("transform","translate("+0+"px, "+0+"px)");setTimeout(function(){that.$body.css(that._getCSS(that.animationSpeed,1));that.$body.css({"transition-property":that.$body.css("transition-property")+", margin"});that.$jconfirmBoxContainer.addClass("jconfirm-no-transition");that._modalReady.resolve();if(typeof that.onOpen==="function"){that.onOpen();}that.$el.addClass(that.loadedClass);},this.animationSpeed);},loadedClass:"jconfirm-open",isClosed:function(){return !this.$el||this.$el.css("display")==="";},isOpen:function(){return !this.isClosed();},toggle:function(){if(!this.isOpen()){this.open();}else{this.close();}}};jconfirm.instances=[];jconfirm.lastFocused=false;jconfirm.pluginDefaults={template:'',title:"Hello",titleClass:"",type:"default",typeAnimated:true,draggable:true,dragWindowGap:15,dragWindowBorder:true,animateFromElement:true,alignMiddle:true,smoothContent:true,content:"Are you sure to continue?",buttons:{},defaultButtons:{ok:{action:function(){}},close:{action:function(){}}},contentLoaded:function(){},icon:"",lazyOpen:false,bgOpacity:null,theme:"light",animation:"scale",closeAnimation:"scale",animationSpeed:400,animationBounce:1,escapeKey:true,rtl:false,container:"body",containerFluid:false,backgroundDismiss:false,backgroundDismissAnimation:"shake",autoClose:false,closeIcon:null,closeIconClass:false,watchInterval:100,columnClass:"col-md-4 col-md-offset-4 col-sm-6 col-sm-offset-3 col-xs-10 col-xs-offset-1",boxWidth:"50%",scrollToPreviousElement:true,scrollToPreviousElementAnimate:true,useBootstrap:true,offsetTop:40,offsetBottom:40,bootstrapClasses:{container:"container",containerFluid:"container-fluid",row:"row"},onContentReady:function(){},onOpenBefore:function(){},onOpen:function(){},onClose:function(){},onDestroy:function(){},onAction:function(){}};var keyDown=false;$(window).on("keydown",function(e){if(!keyDown){var $target=$(e.target);var pass=false;if($target.closest(".jconfirm-box").length){pass=true;}if(pass){$(window).trigger("jcKeyDown");}keyDown=true;}});$(window).on("keyup",function(){keyDown=false;});jconfirm.lastClicked=false;$(document).on("mousedown","button, a",function(){jconfirm.lastClicked=$(this);});})(jQuery,window);
// source --> https://iparrotpost.com/wp-content/plugins/psychics-listing-frontpage-live/js/psychic.js?ver=5.3.2
jQuery(document).ready(function(){
if(typeof img_path !== 'undefined') {
jQuery("#desk_load_img").attr("src", img_path+"loading_new.gif");
jQuery("#mob_load_img").attr("src",img_path+"please-wait.gif");
}
});
jQuery(document).ready(function(){
jQuery('div.review-rating').each(function () {
jQuery(this).raty({
half: true,
starHalf: img_path+'star-half.png',
cancelOff: img_path+'cancel-off.png',
cancelOn: img_path+'cancel-on.png',
starOff: img_path+'star-off.png',
starOn: img_path+'star-on.png',
score: jQuery(this).attr('data-rating'),
readOnly: true
});
});
});
function selectpsychic(id) {
buttonAction(id, "email");
}
function getavailability(id){
jQuery("#callModal"+id).modal('show');
}
function buttonAction(id, media) {
jQuery.ajax({
url: "https://psychicoz.com/onpsychicbuttonclickforword",
dataType: 'jsonp',
type: 'POST',
crossDomain: true,
data: {'psychicId': id, 'media' : media},
success: function (dat) {
console.log("success");
console.log(dat);
},
complete: function (dat) {
console.log("complete");
}
});
}
function jsonpcallback(data) {
if(data.login_status==0){
window.location.href = "https://psychicoz.com/introductory-offers";
}else{
if(data.media != "notify"){
if(data.isBlock == 1){
alert("Sorry, but this specific psychic have refused to provide services to you. Thank you for the understanding.");
return;
}
if(data.intro_status == "1" || data.cookie_intro_offer == "1" || data.ccnt >= 1 || data.ip_cnt >=1 || data.ip_cnt_cook >= 1)
{
if(data.media == "call")
window.location.href = "https://psychicoz.com/call/" + data.psychic_id;
else if(data.media == "chat")
window.location.href = "https://psychicoz.com/new-chat/" + data.psychic_id;
else if(data.media == "email")
window.location.href = "https://psychicoz.com/client_newemail/" + data.psychic_id;
}else
{
window.location.href = "https://psychicoz.com/introductory-offers";
}
}else{
jQuery.confirm({
title: 'Notify Me',
columnClass: 'small',
content: 'url:https://psychicoz.com/notify-me.php?id='+data.psychic_id+'&userId='+data.loggeduser,
onContentReady: function(){
jQuery('input.notify-mode').on('change', function(){
if(jQuery('input[name="isSms"]:checked').length == 0){
jQuery('.sms-section').hide();
}else{
jQuery('.sms-section').show();
jQuery('ul.country-list').css('width', '220px');
}
});
var default_c = jQuery("#smsNumber").data('default-country');
jQuery("#smsNumber").intlTelInput({
defaultCountry: default_c,
preferredCountries: ['us', 'ca', 'au', 'gb'],
dropdownContainer: 'body',
utilsScript: "https://psychicoz.com/lib/libphonenumber/build/utils.js"
});
},
onOpenBefore: function () {
jQuery('.jconfirm .jconfirm-box').css('background-color', '#9966ff');
jQuery('.jconfirm .jconfirm-box').css('color', '#ffffff');
},
buttons: {
formSubmit: {
text: 'Save',
btnClass: 'btn-warning btn-submit',
action: function () {
var ret = false;
if(jQuery('input.notify-mode:checked').length == 0){
jQuery.alert({
title: '',
columnClass: 'small',
content: 'Please choose at least 1 notification mode. ',
onOpenBefore: function () {
jQuery('.jconfirm .jconfirm-box').css('background-color', '#9966ff');
jQuery('.jconfirm .jconfirm-box').css('color', '#ffffff');
jQuery('.jconfirm .btn-warning').css('font-size', '15px');
jQuery('.jconfirm .btn-warning').css('padding', '3px 12px');
jQuery('.jconfirm:last .jconfirm-content').css('text-align', 'center');
jQuery('.jconfirm:last .jconfirm-content-pane').css('margin-bottom', '0px');
},
buttons: {
cancel: {
text: 'OK',
btnClass: 'btn-warning',
action: function () {
}
},
}
});
return false;
}else{
if(jQuery('input[name="isSms"]:checked').length == 1 && jQuery('#smsNumber').val().length < 12){
jQuery.alert({
title: '',
columnClass: 'small',
content: 'Phone number is required. ',
onOpenBefore: function () {
jQuery('.jconfirm .jconfirm-box').css('background-color', '#9966ff');
jQuery('.jconfirm .jconfirm-box').css('color', '#ffffff');
jQuery('.jconfirm .btn-warning').css('font-size', '15px');
jQuery('.jconfirm .btn-warning').css('padding', '3px 12px');
jQuery('.jconfirm:last .jconfirm-content').css('text-align', 'center');
jQuery('.jconfirm:last .jconfirm-content-pane').css('margin-bottom', '0px');
},
buttons: {
cancel: {
text: 'OK',
btnClass: 'btn-warning',
action: function () {
}
},
}
});
return false;
}
jQuery.ajax({
type: "POST",
async: false,
url: 'https://psychicoz.com/ajax/add-notify-me.php?userId='+data.loggeduser,
data: jQuery('#notify-me-form').serialize(),
success: function(data){
//jQuery('.jconfirm').remove();
var resp = jQuery.parseJSON(data);
jQuery.alert({
title: '',
columnClass: 'small',
content: '' + resp.message + ' ',
onOpenBefore: function () {
jQuery('.jconfirm .jconfirm-box').css('background-color', '#9966ff');
jQuery('.jconfirm .jconfirm-box').css('color', '#ffffff');
jQuery('.jconfirm .btn-warning').css('font-size', '15px');
jQuery('.jconfirm .btn-warning').css('padding', '3px 12px');
jQuery('.jconfirm:last .jconfirm-content').css('text-align', 'center');
jQuery('.jconfirm:last .jconfirm-content-pane').css('margin-bottom', '0px');
},
buttons: {
cancel: {
text: 'OK',
btnClass: 'btn-warning',
action: function () {
}
},
}
});
ret = true;
}
});
}
return ret;
}
},
cancel: {
text: 'Cancel',
btnClass: 'btn-warning btn-cancel',
action: function () {
}
},
},
});
}
}
}
function selectcalltopsychic(id) {
buttonAction(id, "call");
}
function selectchattopsychic(id) {
buttonAction(id, "chat");
}
function getMoreList(el){
var id = jQuery(el).attr('data-id');
var page = jQuery(el).attr('data-page');
var view = jQuery(el).attr('data-view');
if(view == "mob"){
jQuery("#LoadingImage").show();
}else{
jQuery("#LoadingforChat").show();
}
jQuery.ajax({
url: base_url+"wp-admin/admin-ajax.php",
//dataType: 'json',
type: 'POST',
data: {'action': "listMorePsychics", 'search_id' : id, 'page' : page, "view" : view},
success: function (dat) {
if(dat){
if(view == "mob"){
jQuery(".sm-container .show-more-psy").before(dat);
var num = jQuery(".sm-container .show-more-psy a").attr('data-page');
jQuery(".sm-container .show-more-psy a").attr('data-page',parseInt(num) + 1);
jQuery("#LoadingImage").hide();
}
if(view == "desk"){
jQuery(".lg-container .show-more-psy").before(dat);
var num = jQuery(".lg-container .show-more-psy a").attr('data-page');
jQuery(".lg-container .show-more-psy a").attr('data-page',parseInt(num) + 1);
jQuery("#LoadingforChat").hide();
}
jQuery('div.review-rating').each(function () {
jQuery(this).raty({
half: true,
starHalf: img_path+'star-half.png',
cancelOff: img_path+'cancel-off.png',
cancelOn: img_path+'cancel-on.png',
starOff: img_path+'star-off.png',
starOn: img_path+'star-on.png',
score: jQuery(this).attr('data-rating'),
readOnly: true
});
});
if(jQuery(".widget-wrap").width() < 320)
{
jQuery(".sm-container .profile-block").css("width","47px");
jQuery(".sm-container .details-block").css("width","46%");
jQuery(".sm-container .pricing-block").css("width","24%");
jQuery("body").css("font-size","15px");
jQuery(".content-row").css("height","auto");
jQuery(".details-block .psy-name").css({"font-size":"16px","margin-bottom":"8px","display":"block"});
jQuery(".review-stars img").css("width","11px");
jQuery(".details-block span.review-text").css("float","left");
jQuery(".details-block .pricing-email").css("font-size","12px");
jQuery(".sm-container").show();
jQuery(".lg-container").hide();
jQuery(".sm-container").css("padding","4.53% 0.15% 5.29% 5.29%");
jQuery(".review-text").css({"display":"inline-block","width":"100%","margin-left":"0"});
}
else if(jQuery(".widget-wrap").width() < 600)
{
jQuery(".lg-container .details-block").css("width","48%");
jQuery(".lg-container .pricing-block").css("width","30.98%");
jQuery(".sm-container .details-block").css("width","59%");
jQuery(".sm-container .pricing-block").css("width","24%");
jQuery("body").css("font-size","15px");
jQuery(".content-row").css("height","auto");
jQuery(".details-block .psy-name").css({"font-size":"16px","margin-bottom":"8px","display":"block"});
jQuery(".review-stars img").css("width","11px");
jQuery(".details-block span.review-text").css("float","left");
jQuery(".details-block .pricing-email").css("font-size","12px");
jQuery(".sm-container").show();
jQuery(".lg-container").hide();
}else if(jQuery(".widget-wrap").width() < 767)
{
jQuery(".lg-container .profile-block").css("width","18.75%");
jQuery(".lg-container .details-block").css("width","40.13%");
jQuery(".lg-container .pricing-block").css("width","39.98%");
jQuery("body").css("font-size","15px");
jQuery(".content-row").css("height","auto");
jQuery(".review-stars img").css("width","16px");
jQuery(".review-stars").css({"margin-bottom": "2.78%", "display": "inline-block"});
jQuery(".lg-container .review-stars").css({"margin-bottom": "5.78%", "display": "inline-block"});
jQuery(".details-block span.client-id").css("display","block");
jQuery(".sm-container").hide();
jQuery(".lg-container").show();
}
else
{
jQuery(".lg-container .profile-block").css("width","16.75%");
jQuery(".lg-container .details-block").css("width","40.13%");
jQuery(".lg-container .pricing-block").css("width","39.98%");
jQuery(".content-row").css("height","auto");
jQuery(".review-stars img").css("width","16px");
jQuery(".review-stars").css({"margin-bottom": "2.78%", "display": "inline-block"});
jQuery(".lg-container .review-stars").css({"margin-bottom": "5.78%", "display": "inline-block"});
jQuery(".details-block span.client-id").css("display","block");
jQuery(".sm-container").hide();
jQuery(".lg-container").show();
}
//jQuery(el).attr('data-page',page++);
}
jQuery("#LoadingImage").hide();
jQuery("#LoadingforChat").hide();
}
});
}
function notifypsychic(psychicId){
buttonAction(psychicId, "notify");
};
// source --> https://iparrotpost.com/wp-content/plugins/psychics-listing-frontpage-live/js/widget_psy.js?ver=5.3.2
jQuery(document).ready(function(){
jQuery('.modal').on('show.bs.modal', function (e) {
jQuery("body").css("padding-right","0 !important");
})
if(jQuery(".widget-wrap").width() < 320)
{
jQuery(".sm-container .profile-block").css("width","47px");
jQuery(".sm-container .details-block").css("width","46%");
jQuery(".sm-container .pricing-block").css("width","24%");
jQuery("body").css("font-size","15px");
jQuery(".content-row").css("height","auto");
jQuery(".details-block .psy-name").css({"font-size":"16px","margin-bottom":"8px","display":"block"});
jQuery(".review-stars img").css("width","11px");
jQuery(".review-stars").css({"margin-bottom": "2.78%", "display": "inline-block"});
jQuery(".lg-container .review-stars").css({"margin-bottom": "5.78%", "display": "inline-block"});
jQuery(".details-block span.review-text").css("float","left");
jQuery(".details-block .pricing-email").css("font-size","12px");
jQuery(".sm-container").show();
jQuery(".lg-container").hide();
jQuery(".sm-container").css("padding","4.53% 0.15% 5.29% 5.29%");
jQuery(".review-text").css({"display":"inline-block","width":"100%","margin-left":"0"});
}
else if(jQuery(".widget-wrap").width() < 600)
{
jQuery(".lg-container .details-block").css("width","unset");
jQuery(".lg-container .pricing-block").css("width","30.98%");
jQuery(".sm-container .details-block").css("width","59%");
jQuery(".sm-container .pricing-block").css("width","24%");
jQuery("body").css("font-size","15px");
jQuery(".content-row").css("height","auto");
jQuery(".details-block .psy-name").css({"font-size":"16px","margin-bottom":"8px","display":"block"});
jQuery(".review-stars img").css("width","11px");
jQuery(".review-stars").css({"margin-bottom": "2.78%", "display": "inline-block"});
jQuery(".lg-container .review-stars").css({"margin-bottom": "5.78%", "display": "inline-block"});
jQuery(".details-block span.review-text").css("float","left");
jQuery(".details-block .pricing-email").css("font-size","12px");
jQuery(".sm-container").show();
jQuery(".lg-container").hide();
}else if(jQuery(".widget-wrap").width() < 767)
{
jQuery(".lg-container .profile-block").css("width","18.75%");
jQuery(".lg-container .details-block").css("width","40.13%");
jQuery(".lg-container .pricing-block").css("width","39.98%");
jQuery("body").css("font-size","15px");
jQuery(".content-row").css("height","auto");
jQuery(".sm-container").hide();
jQuery(".lg-container").show();
}
});
jQuery( window ).on( "orientationchange", function( event ) {
if(window.orientation == 0 || window.orientation == 360){
jQuery(".lg-container .details-block").css("width","unset");
jQuery(".lg-container .pricing-block").css("width","30.98%");
jQuery("body").css("font-size","15px");
jQuery(".content-row").css("height","auto");
jQuery(".details-block .psy-name").css({"font-size":"16px","margin-bottom":"8px","display":"block"});
jQuery(".review-stars img").css("width","11px");
jQuery(".review-stars").css({"margin-bottom": "2.78%", "display": "inline-block"});
jQuery(".lg-container .review-stars").css({"margin-bottom": "5.78%", "display": "inline-block"});
jQuery(".details-block span.review-text").css("float","left");
jQuery(".details-block .pricing-email").css("font-size","12px");
}else if(window.orientation == 90 || window.orientation == 180){
jQuery(".lg-container .details-block").css("width","40.13%");
jQuery(".lg-container .pricing-block").css("width","39.98%");
jQuery("body").css("font-size","15px");
jQuery(".content-row").css("height","auto");
}
});
jQuery(window).on('resize', function(){
jQuery('.modal').on('show.bs.modal', function (e) {
jQuery("body").css("padding-right","0 !important");
})
if(jQuery(".widget-wrap").width() < 320)
{
jQuery(".sm-container .profile-block").css("width","47px");
jQuery(".sm-container .details-block").css("width","46%");
jQuery(".sm-container .pricing-block").css("width","24%");
jQuery("body").css("font-size","15px");
jQuery(".content-row").css("height","auto");
jQuery(".details-block .psy-name").css({"font-size":"16px","margin-bottom":"8px","display":"block"});
jQuery(".review-stars img").css("width","11px");
jQuery(".review-stars").css({"margin-bottom": "2.78%", "display": "inline-block"});
jQuery(".lg-container .review-stars").css({"margin-bottom": "5.78%", "display": "inline-block"});
jQuery(".details-block span.review-text").css("float","left");
jQuery(".details-block .pricing-email").css("font-size","12px");
jQuery(".sm-container").show();
jQuery(".lg-container").hide();
jQuery(".sm-container").css("padding","4.53% 0.15% 5.29% 5.29%");
jQuery(".review-text").css({"display":"inline-block","width":"100%","margin-left":"0"});
}
else if(jQuery(".widget-wrap").width() < 600)
{
jQuery(".lg-container .details-block").css("width","unset");
jQuery(".lg-container .pricing-block").css("width","30.98%");
jQuery(".sm-container .details-block").css("width","59%");
jQuery(".sm-container .pricing-block").css("width","24%");
jQuery("body").css("font-size","15px");
jQuery(".content-row").css("height","auto");
jQuery(".details-block .psy-name").css({"font-size":"16px","margin-bottom":"8px","display":"block"});
jQuery(".review-stars img").css("width","11px");
jQuery(".review-stars").css({"margin-bottom": "2.78%", "display": "inline-block"});
jQuery(".lg-container .review-stars").css({"margin-bottom": "5.78%", "display": "inline-block"});
jQuery(".details-block span.review-text").css("float","left");
jQuery(".details-block .pricing-email").css("font-size","12px");
jQuery(".sm-container").show();
jQuery(".lg-container").hide();
}else if(jQuery(".widget-wrap").width() < 767)
{
jQuery(".lg-container .profile-block").css("width","18.75%");
jQuery(".lg-container .details-block").css("width","40.13%");
jQuery(".lg-container .pricing-block").css("width","39.98%");
jQuery("body").css("font-size","15px");
jQuery(".content-row").css("height","auto");
jQuery(".sm-container").hide();
jQuery(".lg-container").show();
}
});
jQuery(window).click(function() {
jQuery('.modal').on('show.bs.modal', function (e) {
jQuery("body").css("padding-right","0 !important");
})
if(jQuery(".widget-wrap").width() < 320)
{
jQuery(".sm-container .profile-block").css("width","47px");
jQuery(".sm-container .details-block").css("width","46%");
jQuery(".sm-container .pricing-block").css("width","24%");
jQuery("body").css("font-size","15px");
jQuery(".content-row").css("height","auto");
jQuery(".details-block .psy-name").css({"font-size":"16px","margin-bottom":"8px","display":"block"});
jQuery(".review-stars img").css("width","11px");
jQuery(".review-stars").css({"margin-bottom": "2.78%", "display": "inline-block"});
jQuery(".lg-container .review-stars").css({"margin-bottom": "5.78%", "display": "inline-block"});
jQuery(".details-block span.review-text").css("float","left");
jQuery(".details-block .pricing-email").css("font-size","12px");
jQuery(".sm-container").show();
jQuery(".lg-container").hide();
jQuery(".sm-container").css("padding","4.53% 0.15% 5.29% 5.29%");
jQuery(".review-text").css({"display":"inline-block","width":"100%","margin-left":"0"});
}
else if(jQuery(".widget-wrap").width() < 600)
{
jQuery(".lg-container .details-block").css("width","unset");
jQuery(".lg-container .pricing-block").css("width","30.98%");
jQuery(".sm-container .details-block").css("width","59%");
jQuery(".sm-container .pricing-block").css("width","24%");
jQuery("body").css("font-size","15px");
jQuery(".content-row").css("height","auto");
jQuery(".details-block .psy-name").css({"font-size":"16px","margin-bottom":"8px","display":"block"});
jQuery(".review-stars img").css("width","11px");
jQuery(".review-stars").css({"margin-bottom": "2.78%", "display": "inline-block"});
jQuery(".lg-container .review-stars").css({"margin-bottom": "5.78%", "display": "inline-block"});
jQuery(".details-block span.review-text").css("float","left");
jQuery(".details-block .pricing-email").css("font-size","12px");
jQuery(".sm-container").show();
jQuery(".lg-container").hide();
}else if(jQuery(".widget-wrap").width() < 767)
{
jQuery(".lg-container .profile-block").css("width","18.75%");
jQuery(".lg-container .details-block").css("width","40.13%");
jQuery(".lg-container .pricing-block").css("width","39.98%");
jQuery("body").css("font-size","15px");
jQuery(".content-row").css("height","auto");
jQuery(".sm-container").hide();
jQuery(".lg-container").show();
}
});
// source --> https://iparrotpost.com/wp-content/plugins/psychics-listing-frontpage-live/js/raty.js?ver=5.3.2
/*!
* jQuery Raty - A Star Rating Plugin
*
* The MIT License
*
* @author : Washington Botelho
* @doc : http://wbotelhos.com/raty
* @version : 2.7.0
*
*/
;
(function($) {
'use strict';
var methods = {
init: function(options) {
return this.each(function() {
this.self = $(this);
methods.destroy.call(this.self);
this.opt = $.extend(true, {}, $.fn.raty.defaults, options);
methods._adjustCallback.call(this);
methods._adjustNumber.call(this);
methods._adjustHints.call(this);
this.opt.score = methods._adjustedScore.call(this, this.opt.score);
if (this.opt.starType !== 'img') {
methods._adjustStarType.call(this);
}
methods._adjustPath.call(this);
methods._createStars.call(this);
if (this.opt.cancel) {
methods._createCancel.call(this);
}
if (this.opt.precision) {
methods._adjustPrecision.call(this);
}
methods._createScore.call(this);
methods._apply.call(this, this.opt.score);
methods._setTitle.call(this, this.opt.score);
methods._target.call(this, this.opt.score);
if (this.opt.readOnly) {
methods._lock.call(this);
} else {
this.style.cursor = 'pointer';
methods._binds.call(this);
}
});
},
_adjustCallback: function() {
var options = ['number', 'readOnly', 'score', 'scoreName', 'target'];
for (var i = 0; i < options.length; i++) {
if (typeof this.opt[options[i]] === 'function') {
this.opt[options[i]] = this.opt[options[i]].call(this);
}
}
},
_adjustedScore: function(score) {
if (!score) {
return score;
}
return methods._between(score, 0, this.opt.number);
},
_adjustHints: function() {
if (!this.opt.hints) {
this.opt.hints = [];
}
if (!this.opt.halfShow && !this.opt.half) {
return;
}
var steps = this.opt.precision ? 10 : 2;
for (var i = 0; i < this.opt.number; i++) {
var group = this.opt.hints[i];
if (Object.prototype.toString.call(group) !== '[object Array]') {
group = [group];
}
this.opt.hints[i] = [];
for (var j = 0; j < steps; j++) {
var
hint = group[j],
last = group[group.length - 1];
if (last === undefined) {
last = null;
}
this.opt.hints[i][j] = hint === undefined ? last : hint;
}
}
},
_adjustNumber: function() {
this.opt.number = methods._between(this.opt.number, 1, this.opt.numberMax);
},
_adjustPath: function() {
this.opt.path = this.opt.path || '';
if (this.opt.path && this.opt.path.charAt(this.opt.path.length - 1) !== '/') {
this.opt.path += '/';
}
},
_adjustPrecision: function() {
this.opt.half = true;
},
_adjustStarType: function() {
var replaces = ['cancelOff', 'cancelOn', 'starHalf', 'starOff', 'starOn'];
this.opt.path = '';
for (var i = 0; i < replaces.length; i++) {
this.opt[replaces[i]] = this.opt[replaces[i]].replace('.', '-');
}
},
_apply: function(score) {
methods._fill.call(this, score);
if (score) {
if (score > 0) {
this.score.val(score);
}
methods._roundStars.call(this, score);
}
},
_between: function(value, min, max) {
return Math.min(Math.max(parseFloat(value), min), max);
},
_binds: function() {
if (this.cancel) {
methods._bindOverCancel.call(this);
methods._bindClickCancel.call(this);
methods._bindOutCancel.call(this);
}
methods._bindOver.call(this);
methods._bindClick.call(this);
methods._bindOut.call(this);
},
_bindClick: function() {
var that = this;
that.stars.on('click.raty', function(evt) {
var
execute = true,
score = (that.opt.half || that.opt.precision) ? that.self.data('score') : (this.alt || $(this).data('alt'));
if (that.opt.click) {
execute = that.opt.click.call(that, +score, evt);
}
if (execute || execute === undefined) {
if (that.opt.half && !that.opt.precision) {
score = methods._roundHalfScore.call(that, score);
}
methods._apply.call(that, score);
}
});
},
_bindClickCancel: function() {
var that = this;
that.cancel.on('click.raty', function(evt) {
that.score.removeAttr('value');
if (that.opt.click) {
that.opt.click.call(that, null, evt);
}
});
},
_bindOut: function() {
var that = this;
that.self.on('mouseleave.raty', function(evt) {
var score = +that.score.val() || undefined;
methods._apply.call(that, score);
methods._target.call(that, score, evt);
methods._resetTitle.call(that);
if (that.opt.mouseout) {
that.opt.mouseout.call(that, score, evt);
}
});
},
_bindOutCancel: function() {
var that = this;
that.cancel.on('mouseleave.raty', function(evt) {
var icon = that.opt.cancelOff;
if (that.opt.starType !== 'img') {
icon = that.opt.cancelClass + ' ' + icon;
}
methods._setIcon.call(that, this, icon);
if (that.opt.mouseout) {
var score = +that.score.val() || undefined;
that.opt.mouseout.call(that, score, evt);
}
});
},
_bindOver: function() {
var that = this,
action = that.opt.half ? 'mousemove.raty' : 'mouseover.raty';
that.stars.on(action, function(evt) {
var score = methods._getScoreByPosition.call(that, evt, this);
methods._fill.call(that, score);
if (that.opt.half) {
methods._roundStars.call(that, score, evt);
methods._setTitle.call(that, score, evt);
that.self.data('score', score);
}
methods._target.call(that, score, evt);
if (that.opt.mouseover) {
that.opt.mouseover.call(that, score, evt);
}
});
},
_bindOverCancel: function() {
var that = this;
that.cancel.on('mouseover.raty', function(evt) {
var
starOff = that.opt.path + that.opt.starOff,
icon = that.opt.cancelOn;
if (that.opt.starType === 'img') {
that.stars.attr('src', starOff);
} else {
icon = that.opt.cancelClass + ' ' + icon;
that.stars.attr('class', starOff);
}
methods._setIcon.call(that, this, icon);
methods._target.call(that, null, evt);
if (that.opt.mouseover) {
that.opt.mouseover.call(that, null);
}
});
},
_buildScoreField: function() {
return $(' ', { name: this.opt.scoreName, type: 'hidden' }).appendTo(this);
},
_createCancel: function() {
var icon = this.opt.path + this.opt.cancelOff,
cancel = $('<' + this.opt.starType + ' />', { title: this.opt.cancelHint, 'class': this.opt.cancelClass });
if (this.opt.starType === 'img') {
cancel.attr({ src: icon, alt: 'x' });
} else {
// TODO: use $.data
cancel.attr('data-alt', 'x').addClass(icon);
}
if (this.opt.cancelPlace === 'left') {
this.self.prepend(' ').prepend(cancel);
} else {
this.self.append(' ').append(cancel);
}
this.cancel = cancel;
},
_createScore: function() {
var score = $(this.opt.targetScore);
this.score = score.length ? score : methods._buildScoreField.call(this);
},
_createStars: function() {
for (var i = 1; i <= this.opt.number; i++) {
var
name = methods._nameForIndex.call(this, i),
attrs = { alt: i, src: this.opt.path + this.opt[name] };
if (this.opt.starType !== 'img') {
attrs = { 'data-alt': i, 'class': attrs.src }; // TODO: use $.data.
}
attrs.title = methods._getHint.call(this, i);
$('<' + this.opt.starType + ' />', attrs).appendTo(this);
if (this.opt.space) {
this.self.append(i < this.opt.number ? ' ' : '');
}
}
this.stars = this.self.children(this.opt.starType);
},
_error: function(message) {
$(this).text(message);
$.error(message);
},
_fill: function(score) {
var hash = 0;
for (var i = 1; i <= this.stars.length; i++) {
var
icon,
star = this.stars[i - 1],
turnOn = methods._turnOn.call(this, i, score);
if (this.opt.iconRange && this.opt.iconRange.length > hash) {
var irange = this.opt.iconRange[hash];
icon = methods._getRangeIcon.call(this, irange, turnOn);
if (i <= irange.range) {
methods._setIcon.call(this, star, icon);
}
if (i === irange.range) {
hash++;
}
} else {
icon = this.opt[turnOn ? 'starOn' : 'starOff'];
methods._setIcon.call(this, star, icon);
}
}
},
_getFirstDecimal: function(number) {
var
decimal = number.toString().split('.')[1],
result = 0;
if (decimal) {
result = parseInt(decimal.charAt(0), 10);
if (decimal.slice(1, 5) === '9999') {
result++;
}
}
return result;
},
_getRangeIcon: function(irange, turnOn) {
return turnOn ? irange.on || this.opt.starOn : irange.off || this.opt.starOff;
},
_getScoreByPosition: function(evt, icon) {
var score = parseInt(icon.alt || icon.getAttribute('data-alt'), 10);
if (this.opt.half) {
var
size = methods._getWidth.call(this),
percent = parseFloat((evt.pageX - $(icon).offset().left) / size);
score = score - 1 + percent;
}
return score;
},
_getHint: function(score, evt) {
if (score !== 0 && !score) {
return this.opt.noRatedMsg;
}
var
decimal = methods._getFirstDecimal.call(this, score),
integer = Math.ceil(score),
group = this.opt.hints[(integer || 1) - 1],
hint = group,
set = !evt || this.move;
if (this.opt.precision) {
if (set) {
decimal = decimal === 0 ? 9 : decimal - 1;
}
hint = group[decimal];
} else if (this.opt.halfShow || this.opt.half) {
decimal = set && decimal === 0 ? 1 : decimal > 5 ? 1 : 0;
hint = group[decimal];
}
return hint === '' ? '' : hint || score;
},
_getWidth: function() {
var width = this.stars[0].width || parseFloat(this.stars.eq(0).css('font-size'));
if (!width) {
methods._error.call(this, 'Could not get the icon width!');
}
return width;
},
_lock: function() {
var hint = methods._getHint.call(this, this.score.val());
this.style.cursor = '';
this.title = hint;
this.score.prop('readonly', true);
this.stars.prop('title', hint);
if (this.cancel) {
this.cancel.hide();
}
this.self.data('readonly', true);
},
_nameForIndex: function(i) {
return this.opt.score && this.opt.score >= i ? 'starOn' : 'starOff';
},
_resetTitle: function(star) {
for (var i = 0; i < this.opt.number; i++) {
this.stars[i].title = methods._getHint.call(this, i + 1);
}
},
_roundHalfScore: function(score) {
var integer = parseInt(score, 10),
decimal = methods._getFirstDecimal.call(this, score);
if (decimal !== 0) {
decimal = decimal > 5 ? 1 : 0.5;
}
return integer + decimal;
},
_roundStars: function(score, evt) {
var
decimal = (score % 1).toFixed(2),
name ;
if (evt || this.move) {
name = decimal > 0.5 ? 'starOn' : 'starHalf';
} else if (decimal > this.opt.round.down) { // Up: [x.76 .. x.99]
name = 'starOn';
if (this.opt.halfShow && decimal < this.opt.round.up) { // Half: [x.26 .. x.75]
name = 'starHalf';
} else if (decimal < this.opt.round.full) { // Down: [x.00 .. x.5]
name = 'starOff';
}
}
if (name) {
var
icon = this.opt[name],
star = this.stars[Math.ceil(score) - 1];
methods._setIcon.call(this, star, icon);
} // Full down: [x.00 .. x.25]
},
_setIcon: function(star, icon) {
star[this.opt.starType === 'img' ? 'src' : 'className'] = this.opt.path + icon;
},
_setTarget: function(target, score) {
if (score) {
score = this.opt.targetFormat.toString().replace('{score}', score);
}
if (target.is(':input')) {
target.val(score);
} else {
target.html(score);
}
},
_setTitle: function(score, evt) {
if (score) {
var
integer = parseInt(Math.ceil(score), 10),
star = this.stars[integer - 1];
star.title = methods._getHint.call(this, score, evt);
}
},
_target: function(score, evt) {
if (this.opt.target) {
var target = $(this.opt.target);
if (!target.length) {
methods._error.call(this, 'Target selector invalid or missing!');
}
var mouseover = evt && evt.type === 'mouseover';
if (score === undefined) {
score = this.opt.targetText;
} else if (score === null) {
score = mouseover ? this.opt.cancelHint : this.opt.targetText;
} else {
if (this.opt.targetType === 'hint') {
score = methods._getHint.call(this, score, evt);
} else if (this.opt.precision) {
score = parseFloat(score).toFixed(1);
}
var mousemove = evt && evt.type === 'mousemove';
if (!mouseover && !mousemove && !this.opt.targetKeep) {
score = this.opt.targetText;
}
}
methods._setTarget.call(this, target, score);
}
},
_turnOn: function(i, score) {
return this.opt.single ? (i === score) : (i <= score);
},
_unlock: function() {
this.style.cursor = 'pointer';
this.removeAttribute('title');
this.score.removeAttr('readonly');
this.self.data('readonly', false);
for (var i = 0; i < this.opt.number; i++) {
this.stars[i].title = methods._getHint.call(this, i + 1);
}
if (this.cancel) {
this.cancel.css('display', '');
}
},
cancel: function(click) {
return this.each(function() {
var self = $(this);
if (self.data('readonly') !== true) {
methods[click ? 'click' : 'score'].call(self, null);
this.score.removeAttr('value');
}
});
},
click: function(score) {
return this.each(function() {
if ($(this).data('readonly') !== true) {
score = methods._adjustedScore.call(this, score);
methods._apply.call(this, score);
if (this.opt.click) {
this.opt.click.call(this, score, $.Event('click'));
}
methods._target.call(this, score);
}
});
},
destroy: function() {
return this.each(function() {
var self = $(this),
raw = self.data('raw');
if (raw) {
self.off('.raty').empty().css({ cursor: raw.style.cursor }).removeData('readonly');
} else {
self.data('raw', self.clone()[0]);
}
});
},
getScore: function() {
var score = [],
value ;
this.each(function() {
value = this.score.val();
score.push(value ? +value : undefined);
});
return (score.length > 1) ? score : score[0];
},
move: function(score) {
return this.each(function() {
var
integer = parseInt(score, 10),
decimal = methods._getFirstDecimal.call(this, score);
if (integer >= this.opt.number) {
integer = this.opt.number - 1;
decimal = 10;
}
var
width = methods._getWidth.call(this),
steps = width / 10,
star = $(this.stars[integer]),
percent = star.offset().left + steps * decimal,
evt = $.Event('mousemove', { pageX: percent });
this.move = true;
star.trigger(evt);
this.move = false;
});
},
readOnly: function(readonly) {
return this.each(function() {
var self = $(this);
if (self.data('readonly') !== readonly) {
if (readonly) {
self.off('.raty').children('img').off('.raty');
methods._lock.call(this);
} else {
methods._binds.call(this);
methods._unlock.call(this);
}
self.data('readonly', readonly);
}
});
},
reload: function() {
return methods.set.call(this, {});
},
score: function() {
var self = $(this);
return arguments.length ? methods.setScore.apply(self, arguments) : methods.getScore.call(self);
},
set: function(options) {
return this.each(function() {
$(this).raty($.extend({}, this.opt, options));
});
},
setScore: function(score) {
return this.each(function() {
if ($(this).data('readonly') !== true) {
score = methods._adjustedScore.call(this, score);
methods._apply.call(this, score);
methods._target.call(this, score);
}
});
}
};
$.fn.raty = function(method) {
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || !method) {
return methods.init.apply(this, arguments);
} else {
$.error('Method ' + method + ' does not exist!');
}
};
$.fn.raty.defaults = {
cancel : false,
cancelClass : 'raty-cancel',
cancelHint : 'Cancel this rating!',
cancelOff : 'cancel-off.png',
cancelOn : 'cancel-on.png',
cancelPlace : 'left',
click : undefined,
half : false,
halfShow : true,
hints : ['bad', 'poor', 'regular', 'good', 'gorgeous'],
iconRange : undefined,
mouseout : undefined,
mouseover : undefined,
noRatedMsg : 'Not rated yet!',
number : 5,
numberMax : 20,
path : undefined,
precision : false,
readOnly : false,
round : { down: 0.25, full: 0.6, up: 0.76 },
score : undefined,
scoreName : 'score',
single : false,
space : true,
starHalf : 'star-half.png',
starOff : 'star-off.png',
starOn : 'star-on.png',
starType : 'img',
target : undefined,
targetFormat : '{score}',
targetKeep : false,
targetScore : undefined,
targetText : '',
targetType : 'hint'
};
})(jQuery);