$(document).on("click",".fileRemove",function() {
var _CSL = $( this ).data( "plugin" );
var _ROUTE = $( this ).data( "route" );
var _FILE = $( this ).data( "file" );
var _FIELD = $( this ).data( "field" );
var _ID = $( ".manage-button" ).data( "id" );
//POST FUNCTION
$.post('https://ngconsulate.info/system/post/users.plugins.php', { mode:'fileRemove', _CSL:_CSL, _FILE:_FILE, _ID:_ID, _ROUTE:_ROUTE, _FIELD:_FIELD },
function(data) {
_info = jQuery.parseJSON( data );
var _code = _info.code;
var _message = _info.message;
var _type = _info.type;
});
//END POST FUNCTION
});
function htmlEntities(str) {
return String(str).replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"');
}
function rtrim (str, charlist) {
charlist = !charlist ? ' \\s\u00A0' : (charlist + '').replace(/([\[\]\(\)\.\?\/\*\{\}\+\$\^\:])/g, '\\$1');
var re = new RegExp('[' + charlist + ']+$', 'g');
return (str + '').replace(re, '');
};
function isUrl(value) {
return /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);
};
function strip_tags (input, allowed) {
allowed = (((allowed || "") + "").toLowerCase().match(/<[a-z][a-z0-9]*>/g) || []).join('');
var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi,
commentsAndPhpTags = /|<\?(?:php)?[\s\S]*?\?>/gi;
return input.replace(commentsAndPhpTags, '').replace(tags, function ($0, $1) {
return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : '';
});
};
function cgEmail(emailAddress) {
var pattern = new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i);
return pattern.test(emailAddress);
};
$(document).on("click",".missionRemove",function() {
var _ID = $( this ).data( "id" );
var _ROUTE = $( this ).data( "route" );
var _CLS = $( this ).data( "class" );
var _COUNT = $( this ).data( "counter" );
$("." + _CLS + "_" + _ID + "_container").hide();
$("." + _CLS + "_" + _ID + "_helper").html(" Yes, remove Cancel");
});
$(document).on("click",".missionRemoveCancel",function() {
var _ID = $( this ).data( "id" );
var _CLS = $( this ).data( "class" );
$("." + _CLS + "_" + _ID + "_container").show();
$("." + _CLS + "_" + _ID + "_helper").html("");
});
$(document).on("click",".missionRemoveYes",function() {
var _ID = $( this ).data( "id" );
var _ROUTE = $( this ).data( "route" );
var _CLS = $( this ).data( "class" );
var _COUNT = $( this ).data( "counter" );
$("." + _CLS + "_" + _ID + "_helper").html('
');
//POST FUNCTION
$.post('https://ngconsulate.info/plugins/_MISSION/functions/_MISSION.user.post.php', { mode:'dataRemove', _CLS:_CLS, _ID:_ID, _ROUTE:_ROUTE },
function(data) {
_info = jQuery.parseJSON( data );
var _code = _info.code;
var _message = _info.message;
var _type = _info.type;
if ( _code == 1 ) {
location.reload();
}
if ( _code == 2 ) {
$("." + _CLS + "_" + _ID + "_helper").html("
"+_message+"
");
}
});
//END POST FUNCTION
});
function _MISSIONgenerateMap( ) {
$("#map-details").gmap3({
marker:{
latLng: LD_LAT_LNG,
options:{
draggable:false
},
events:{
dragend: function(marker){
$(this).gmap3({
getaddress:{
latLng:marker.getPosition(),
callback:function(results){
var map = $(this).gmap3("get"),
infowindow = $(this).gmap3({get:"infowindow"}),
content = results && results[1] ? results && results[1].formatted_address : "no address";
if (infowindow){
infowindow.open(map, marker);
infowindow.setContent(content);
} else {
$(this).gmap3({
infowindow:{
anchor:marker,
options:{content: content}
}});}}}});}}},
map:{
options:{
mapTypeId: google.maps.MapTypeId.ROADMAP,
zoom: LD_ZOOM,
center: LD_LAT_LNG,
}}
});}
$(document).on('keyup', "._mission_search", function (e) {
if(e.which == 13) {
$( ".mission-search" ).trigger( "click" );
}
});
$(document).on("click",".mission-search",function() {
var string = $("#_mission_search").val();
if ( string ) {
var string = string.replace(/ /g,"+").replace(/\?/g,"").replace(/\//g,"");
}
if ( $("#_MISSION_search_city").val() == undefined ) {
var country = '';
var city = '';
} else {
var city = $("#_MISSION_search_city").val();
var selected = $(':selected',"#_MISSION_search_city");
var country = selected.closest('optgroup').attr('url');
}
if ( $("#_MISSION_search_category").val() == undefined ) {
var category = '';
} else {
var category = $("#_MISSION_search_category").val();
}
if ( !country ) { country = '+';}
if ( !city ) { city = '+';}
if ( !category ) { category = '+';}
if ( !string ) {
$(".mission-search-form").addClass('has-error'); } else {$(".mission-search-form").removeClass('has-error');
$(".mission-search .fa" ).attr('disabled', true);
$(".mission-search_loader").html('
');
$(location).attr('href','https://ngconsulate.info/mission/search/'+country+'/'+city+'/'+category+'/'+string);
}
});
function _MISSION_star(nr){
var rate = (nr * 20);
$("#_MISSION_rate-now").css("width",rate+"%");
$("#_MISSION_stars-now").val(nr);
}
$(document).on("click","#_MISSION_ADD_REVIEW",function() {
var t = 0;$(".loader").html('');
var rating = $("#_MISSION_stars-now").val();
var _MISSION_review = $("#_MISSION_review").val();
var _MISSION_ID = $( this ).data("id");
if ( ( _MISSION_review.replace(/ /g,'').length < 20 ) && ( !$('#_MISSION_review').is(':disabled') ) ) {$("._MISSION_review").addClass('has-error');t++;} else {$("._MISSION_review").removeClass('has-error');}
$("#_MISSION_ADD_REVIEW" ).attr('disabled', true);
if ( t == 0 ) {
$(".loader").html('
');
//POST FUNCTION
$.post('https://ngconsulate.info/system/post/users.plugins.php', { mode:'dataManage', '_PLUGIN':'_MISSION','_ROUTE':'_USER_ADD_REVIEW', rating:rating, _MISSION_review:_MISSION_review, _MISSION_ID:_MISSION_ID },
function(data) {
_info = jQuery.parseJSON( data );
var _code = _info.code;
var _message = _info.message;
var _type = _info.type;
if ( _code == 1 ) {
$(".loader").html(""+_message+"
");
$("#_MISSION_review").val("");
}
if ( _code == 2 ) {
$(".loader").html(""+_message+"
");
}
if ( _code == 3 ) {
$(".loader").html(""+_message+"
");
$("#_MISSION_review").val("");
}
if ( _code == 4 ) {
$(".loader").html(""+_message+"
");
window.location = 'https://ngconsulate.info/' + _info.redirect;
}
if ( data ) {
$("#_MISSION_ADD_REVIEW").removeAttr('disabled');
}
});
//END POST FUNCTION
} else {
$(".loader").html('Complete all mandatory fields
');
$("#_MISSION_ADD_REVIEW").removeAttr('disabled');
}
});
//IMAGES
$( function() {
$(function(){var t=function(){$('').appendTo("body")},o=function(){$("#imagelightbox-loading").remove()},n=function(){$('').appendTo("body")},i=function(){$("#imagelightbox-overlay").remove()},a=function(t){$('').appendTo("body").on("click touchend",function(){return $(this).remove(),t.quitImageLightbox(),!1})},e=function(){$("#imagelightbox-close").remove()},g=function(){var t=$('a[href="'+$("#imagelightbox").attr("src")+'"] img').attr("alt");t.length>0&&$(''+t+"
").appendTo("body")},d=function(){$("#imagelightbox-caption").remove()},c=function(t,o){var n=$(o);if(n.length){for(var i=$(''),a=0;a');i.appendTo("body"),i.on("click touchend",function(){return!1});var e=i.find("button");e.on("click touchend",function(){var o=$(this);return n.eq(o.index()).attr("href")!=$("#imagelightbox").attr("src")&&t.switchImageLightbox(o.index()),e.removeClass("active"),e.eq(o.index()).addClass("active"),!1}).on("touchend",function(){return!1})}},r=function(t){var o=$("#imagelightbox-nav button");o.removeClass("active"),o.eq($(t).filter('[href="'+$("#imagelightbox").attr("src")+'"]').index(t)).addClass("active")},u=function(){$("#imagelightbox-nav").remove()},l=function(t,o){var n=$('');n.appendTo("body"),n.on("click touchend",function(n){n.preventDefault();var i=$(this),a=$(o+'[href="'+$("#imagelightbox").attr("src")+'"]'),e=a.index(o);return i.hasClass("imagelightbox-arrow-left")?(e-=1,$(o).eq(e).length||(e=$(o).length)):(e+=1,$(o).eq(e).length||(e=0)),t.switchImageLightbox(e),!1})},b=function(){$(".imagelightbox-arrow").remove()};$('a[data-imagelightbox="a"]').imageLightbox({onLoadStart:function(){t()},onLoadEnd:function(){o()},onEnd:function(){o()}}),$('a[data-imagelightbox="b"]').imageLightbox({onStart:function(){n()},onEnd:function(){i(),o()},onLoadStart:function(){t()},onLoadEnd:function(){o()}});var h=$('a[data-imagelightbox="c"]').imageLightbox({quitOnDocClick:!1,onStart:function(){a(h)},onEnd:function(){e(),o()},onLoadStart:function(){t()},onLoadEnd:function(){o()}});$('a[data-imagelightbox="d"]').imageLightbox({onLoadStart:function(){d(),t()},onLoadEnd:function(){g(),o()},onEnd:function(){d(),o()}});var f='a[data-imagelightbox="g"]',m=$(f).imageLightbox({onStart:function(){l(m,f)},onEnd:function(){b(),o()},onLoadStart:function(){t()},onLoadEnd:function(){$(".imagelightbox-arrow").css("display","block"),o()}}),x='a[data-imagelightbox="e"]',v=$(x).imageLightbox({onStart:function(){c(v,x)},onEnd:function(){u(),o()},onLoadStart:function(){t()},onLoadEnd:function(){r(x),o()}}),s='a[data-imagelightbox="f"]',L=$(s).imageLightbox({onStart:function(){n(),a(L),l(L,s)},onEnd:function(){i(),d(),e(),b(),o()},onLoadStart:function(){d(),t()},onLoadEnd:function(){g(),o(),$(".imagelightbox-arrow").css("display","block")}})});
});
$(function(){var t=function(){$('').appendTo("body")},o=function(){$("#imagelightbox-loading").remove()},n=function(){$('').appendTo("body")},i=function(){$("#imagelightbox-overlay").remove()},a=function(t){$('').appendTo("body").on("click touchend",function(){return $(this).remove(),t.quitImageLightbox(),!1})},e=function(){$("#imagelightbox-close").remove()},g=function(){var t=$('a[href="'+$("#imagelightbox").attr("src")+'"] img').attr("alt");t.length>0&&$(''+t+"
").appendTo("body")},d=function(){$("#imagelightbox-caption").remove()},c=function(t,o){var n=$(o);if(n.length){for(var i=$(''),a=0;a');i.appendTo("body"),i.on("click touchend",function(){return!1});var e=i.find("button");e.on("click touchend",function(){var o=$(this);return n.eq(o.index()).attr("href")!=$("#imagelightbox").attr("src")&&t.switchImageLightbox(o.index()),e.removeClass("active"),e.eq(o.index()).addClass("active"),!1}).on("touchend",function(){return!1})}},r=function(t){var o=$("#imagelightbox-nav button");o.removeClass("active"),o.eq($(t).filter('[href="'+$("#imagelightbox").attr("src")+'"]').index(t)).addClass("active")},u=function(){$("#imagelightbox-nav").remove()},l=function(t,o){var n=$('');n.appendTo("body"),n.on("click touchend",function(n){n.preventDefault();var i=$(this),a=$(o+'[href="'+$("#imagelightbox").attr("src")+'"]'),e=a.index(o);return i.hasClass("imagelightbox-arrow-left")?(e-=1,$(o).eq(e).length||(e=$(o).length)):(e+=1,$(o).eq(e).length||(e=0)),t.switchImageLightbox(e),!1})},b=function(){$(".imagelightbox-arrow").remove()};$('a[data-imagelightbox="a"]').imageLightbox({onLoadStart:function(){t()},onLoadEnd:function(){o()},onEnd:function(){o()}}),$('a[data-imagelightbox="b"]').imageLightbox({onStart:function(){n()},onEnd:function(){i(),o()},onLoadStart:function(){t()},onLoadEnd:function(){o()}});var h=$('a[data-imagelightbox="c"]').imageLightbox({quitOnDocClick:!1,onStart:function(){a(h)},onEnd:function(){e(),o()},onLoadStart:function(){t()},onLoadEnd:function(){o()}});$('a[data-imagelightbox="d"]').imageLightbox({onLoadStart:function(){d(),t()},onLoadEnd:function(){g(),o()},onEnd:function(){d(),o()}});var f='a[data-imagelightbox="g"]',m=$(f).imageLightbox({onStart:function(){l(m,f)},onEnd:function(){b(),o()},onLoadStart:function(){t()},onLoadEnd:function(){$(".imagelightbox-arrow").css("display","block"),o()}}),x='a[data-imagelightbox="e"]',v=$(x).imageLightbox({onStart:function(){c(v,x)},onEnd:function(){u(),o()},onLoadStart:function(){t()},onLoadEnd:function(){r(x),o()}}),s='a[data-imagelightbox="galleryImage"]',L=$(s).imageLightbox({onStart:function(){n(),a(L),l(L,s)},onEnd:function(){i(),d(),e(),b(),o()},onLoadStart:function(){d(),t()},onLoadEnd:function(){g(),o(),$(".imagelightbox-arrow").css("display","block")}})});