/* Cached on Thu, 31 Oct 2024 23:00:47 */ (function( $ ) { $.widget('ui.hh_combobox', { _create: function() { var inpt = this.element.hide(), selected = false, src = this.options.source, wrapper, input = $(''); inpt.change(function() { setPlaceHolderClass(!this.value.length); }) if (inpt.val().length) { setPlaceHolderClass(false); for (var i in src) if (src[i].value == inpt.val()) { input.val(src[i].label); break; } } else { setPlaceHolderClass(true); input.val(onLang.selectLabel); } function removeIfInvalid( element ) { var value = $( element ).val(), matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( value ) + "$", "i" ), valid = false; $(src).each(function(k,v) { if (v.label.match( matcher ) ) { valid = true; return false; } }); if ( !valid ) { // remove invalid value, as it didn't match anything //$( element ).val( "" ); input.val( onLang.selectLabel ); $(inpt).val('').change(); input.data( "ui-autocomplete" ).term = ""; } } function setPlaceHolderClass(state) { input.toggleClass('ui-placeholder-text',state); } this.wrapper = wrapper = $( "" ) .addClass( "ui-combobox" ) .insertAfter( inpt ); $(input) .appendTo( wrapper ) .attr('title', '') .addClass( "ui-state-default ui-combobox-input" ) .autocomplete({ delay: 0, minLength: 0, source: function( request, response ) { var matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term), "i" ); response( $(src).map(function(k, item) { var text = item.label; if ( this.value && ( !request.term || matcher.test(text) ) ) return { label: text.replace( new RegExp( "(?![^&;]+;)(?!<[^<>]*)(" + $.ui.autocomplete.escapeRegex(request.term) + ")(?![^<>]*>)(?![^&;]+;)", "gi" ), "$1" ), fakeVal: item.label, value: item.value }; }) ); }, select: function( event, ui ) { $(this) .val(ui.item.fakeVal) .blur(); $(inpt).val(ui.item.value).change(); return false; }, change: function( event, ui ) { if ( !ui.item ) { removeIfInvalid( this ); } } }) .addClass( "ui-widget ui-widget-content ui-corner-left ui-corner-right" ) .css( "border","none" ) .mousedown(function() { input.autocomplete( "search", "" ); }) .focus(function() { if (!inpt.val().length) input.val(''); setPlaceHolderClass(false); }) .blur(function() { if (!inpt.val().length) input.val(onLang.selectLabel); setPlaceHolderClass(!inpt.val().length); }) $(function() { input.blur(); }) input.data( "ui-autocomplete" )._renderItem = function( ul, item ) { return $( "
  • " ) .append( "" + item.label + "" ) .appendTo( ul ); }; $( "" ) .attr( "tabIndex", -1 ) .appendTo( wrapper ) .button({ icons: { primary: "ui-icon-triangle-1-s" }, text: false }) .removeClass( "ui-corner-all" ) .addClass( "ui-corner-right ui-combobox-toggle" ) .mousedown(function() { wasOpen = input.autocomplete( "widget" ).is( ":visible" ); }) .click(function() { input.focus(); // close if already visible if ( wasOpen ) { return; } // pass empty string as value to search for, displaying all results input.autocomplete( "search", "" ); }); }, _destroy: function() { this.wrapper.remove(); this.element.show(); } }) $.widget( "ui.combobox", { _create: function() { var input, that = this, wasOpen = false, select = this.element.hide(), selected = select.children( ":selected" ), value = selected.val() ? selected.text() : onLang.selectLabel, wrapper = this.wrapper = $( "" ) .addClass( "ui-combobox" ) .insertAfter( select ); $(select).change(function() { if (this.value != '') $(this).next().children(':first').val($(this).children(':selected').text()) else setPlaceHolderClass(true) }) function removeIfInvalid( element ) { var value = $( element ).val(), matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( value ) + "$", "i" ), valid = false; select.children( "option" ).each(function() { if ( $( this ).text().match( matcher ) ) { this.selected = valid = true; return false; } }); if ( !valid ) { // remove invalid value, as it didn't match anything $( element ) //.val( "" ); .val( onLang.selectLabel ); select.val( "" ); $( select ).change(); setTimeout(function() { input.tooltip( "close" ).attr( "title", "" ); }, 2500 ); input.data( "ui-autocomplete" ).term = ""; } } function setPlaceHolderClass(state) { input.toggleClass('ui-placeholder-text',state); } input = $( "" ) .appendTo( wrapper ) .val( value ) .attr( "title", "" ) .addClass( "ui-state-default ui-combobox-input" ) .autocomplete({ delay: 0, minLength: 0, source: function( request, response ) { var matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term), "i" ); response( select.children( "option" ).map(function() { var text = $( this ).text(); if ( this.value && ( !request.term || matcher.test(text) ) ) return { label: text.replace( new RegExp( "(?![^&;]+;)(?!<[^<>]*)(" + $.ui.autocomplete.escapeRegex(request.term) + ")(?![^<>]*>)(?![^&;]+;)", "gi" ), "$1" ), value: text, option: this }; }) ); }, select: function( event, ui ) { ui.item.option.selected = true; that._trigger( "selected", event, { item: ui.item.option }); $( select ).change(); }, change: function( event, ui ) { if ( !ui.item ) { removeIfInvalid( this ); $( select ).change(); } } }) .addClass( "ui-widget ui-widget-content ui-corner-left ui-corner-right" ) .css( "border","none" ) .mousedown(function() { input.autocomplete( "search", "" ); }) .focus(function() { if (!select.val()) input.val(''); setPlaceHolderClass(false); }) .blur(function() { if (!select.val()) input.val(onLang.selectLabel); setPlaceHolderClass(!select.val()); }) input.data( "ui-autocomplete" )._renderItem = function( ul, item ) { return $( "
  • " ) .append( "" + item.label + "" ) .appendTo( ul ); }; $( "" ) .attr( "tabIndex", -1 ) .appendTo( wrapper ) .button({ icons: { primary: "ui-icon-triangle-1-s" }, text: false }) .removeClass( "ui-corner-all" ) .addClass( "ui-corner-right ui-combobox-toggle" ) .mousedown(function() { wasOpen = input.autocomplete( "widget" ).is( ":visible" ); }) .click(function() { input.focus(); // close if already visible if ( wasOpen ) { return; } // pass empty string as value to search for, displaying all results input.autocomplete( "search", "" ); }); select.change(); }, _destroy: function() { this.wrapper.remove(); this.element.show(); } }); })( jQuery ); function combobox(elem) { $(elem).combobox(); } parser = { all: function(elem) { var salOut = this.salary(elem); var ageOut = this.age(elem); var expOut = this.exp(elem); var div = document.createElement('div'); div.id = 'pout'; div.style.display = 'none'; if (salOut != null) { for(prop in salOut) if (salOut.hasOwnProperty(prop)) { var input = document.createElement('input'); input.type = 'hidden'; input.name = 'ps_'+prop; input.value = salOut[prop]; $(div).append(input); } } if (ageOut != null) { for(prop in ageOut) if (ageOut.hasOwnProperty(prop)) { var input = document.createElement('input'); input.type = 'hidden'; input.name = 'pa_'+prop; input.value = ageOut[prop]; $(div).append(input); } } if (expOut != null) { for(prop in expOut) if (expOut.hasOwnProperty(prop)) { var input = document.createElement('input'); input.type = 'hidden'; input.name = 'pe_'+prop; input.value = expOut[prop]; $(div).append(input); } } if (div.children.length > 0) { $(elem).parents('form:first').find('#pout').remove(); $(elem).parents('form:first').append(div); } else { return null; } }, salary: function(elem) { var summ = '(\\d+(?:(?:\\s|\\.|,)\\d{3}\\b)*)'; var btw = '(?:(?:\\s?-\\s?)|(?:\\s[^\\d\\s]+\\s){1,2})'; var curr = '(?:' + ['lei','mdl','\\$','usd','dol','eur','лей','леев','евро(?:$|\\s|[.,!?])','дол','u\\.?\\s?e\\.?','у\\.?\\s?е\\.?'].join(')|(?:') + ')'; var expr = new RegExp(summ + '(?:' + btw + summ + ')?\\s?(' + curr + ')', 'i'); var salary = elem.value.match(expr); if (!salary) return null; var currency = ''; var curr = salary.pop().toLowerCase()/*.trimCustom('.,!?')*/; switch (curr.replace(/[.,!?\s]/g,'')) { case 'lei': case 'лей': case 'леев': case 'mdl': currency = 'MDL'; break; case 'usd': case 'dol': case 'ue': case 'дол': case '$': currency = 'USD'; break; case 'eur': case 'евро': currency = 'EUR'; break; } if (typeof(salary[2]) != 'undefined') return { min: salary[1].replace(/\D/g, ''), max: salary[2].replace(/\D/g, ''), currency: currency }; else return { max: salary[1].replace(/\D/g, ''), currency: currency }; }, salaryX: function(elem) { var salary = elem.value.match(/((\d+)((\s\d+)?)(\s?))((\$)|((lei)|(mdl)|(usd)|(dol)|(eur)|(лей))|(леев)|(евр)|(дол)|(u\.?\s?e.?)|(у\.?\s?е.?))/gi); if (salary == null) { return null; } var salary_2 = []; for (i = 0; i < salary.length; i++) { salary_2.push(salary[i].replace(/\s/g,'').match(/(\d+)/g)[0]); } var currency = ''; switch (salary[0].toLowerCase().replace(/[\.\s]/g,'').match(/(?![\d\s]+?)\D+/gi)[0]) { case 'lei': case 'лей': case 'леев': case 'mdl': currency = 'MDL'; break; case 'usd': case 'dol': case 'ue': case 'дол': case '$': currency = 'USD'; break; case 'eur': case 'евр': currency = 'EUR'; break; } var out = {}; salary_2 = salary_2.sort(function(a,b){return a-b}); if (salary_2.length > 1) { out = { min:salary_2[0], max:salary_2[salary_2.length-1], currency:currency } } else { out = { max:salary_2[0], currency:currency } } return out; }, age: function(elem) { var summ = '(\\d{2}\\b)'; var btw = '(?:(?:\\s?-\\s?)|(?:\\s[^\\d\\s]+\\s){1,2})'; var words = '(?:' + ['лет','ani','years'].join(')|(?:') + ')'; var expr = new RegExp('[\\D]' + summ + '(?:' + btw + summ + ')?\\s(?:'+words+')'); var list = findRowByExpr(elem.value, expr, true); if (!list) return null; var age = null; var expExpr = new RegExp(['опыт','exp','стаж','врем','tim','граф','ori'].join('|'),'i'); var tmpV = ''; $(list).each(function(k,v) { if (!v.match(expExpr)) { tmpV = v; age = v.match(expr); return false; } }) if (age) { if (!age[2]) { var to = ['до','până la','pînă la','pană la','pinâ la','pîna la','pina la','pâna la','to','max'].join('|'); if (tmpV.match(new RegExp(to,'i'))) var ret = {to: age[1].replace(' ', '')}; else var ret = {from: age[1].replace(' ', '')}; } else { var ret = {from: age[1].replace(' ', '')}; ret.to = age[2].replace(' ', ''); } return ret; } else return null; }, ageX: function(elem) { var out = {}; var eValue = elem.value.replace('exp.','exp,'); var to = ['-','до','până la','pînă la','pană la','pinâ la','pîna la','pina la','pâna la','to'].join('|'); var from = ['от','dela','de la','dup','from'].join('|'); var years = ['лет','ani','years'].join('|'); var eWord = ['опыт','exp(\\,)?'].join('|'); var exp = new RegExp('('+from+')?\\s?(\\d{2})(\\s?('+years+'))?\\s?('+to+')\\s?(\\d{2})(\\s)?('+years+')','gi'); var age = eValue.match(exp); if (age != null) { age = age[0].match(/(\d{2})/gi); out = { from: age[0], to:age[1] } return out; } var out = {}; var age_st = new RegExp('((\\.([^\\.\\n]+))|\\n([^\\.\\n]+))('+from+')\\s?(\\d{2})\\s?('+years+')','gi'); var age_st = eValue.match(age_st); if (age_st != null) { if (age_st[0].match(new RegExp(eWord,'gi')) == null) { out.from = age_st[0].match(/(\d{2})/gi)[0]; } } var age_sp = new RegExp('((\\.([^\\.\\n]+))|\\n([^\\.\\n]+))('+to+')\\s?(\\d{2})\\s?('+years+')','gi'); var age_sp = eValue.match(age_sp); if (age_sp != null) { if (age_sp[0].match(new RegExp(eWord,'gi')) == null) { out.to = age_sp[0].match(/(\d{2})/gi)[0]; } } if (out.from != undefined || out.to != undefined) { return out; } else { return null } }, exp: function(elem) { var row = findRowByExpr(elem.value,new RegExp('опыт|expir|experi|стаж','i'), true); if (!row) return null; var expr = new RegExp('(\\d{1,2}\\b)'); var exp = null; $(row).each(function(k,v) { var tmp = v.match(expr); if (tmp) { exp = tmp; return false; } }); return (exp)? {from: exp.pop()} : exp; }, expX: function(elem) { var out = {}; var eValue = elem.value.replace('exp.','exp,'); var eWord = ['опыт','exp(\\,)?'].join('|'); var to = ['-','до','până la','pînă la','pană la','pinâ la','pîna la','pina la','pâna la','to'].join('|'); var from = ['от','dela','de la','from'].join('|'); var years = ['лет','год','an','year'].join('|'); var out = {}; var expr = new RegExp('(('+eWord+')([^0-9]+))('+from+')\\s?(\\d{1,2}(?!\\d))','gi'); var exp_st = eValue.match(expr); if (exp_st != null) { out.from = exp_st[0].match(/(\d{1,2})/gi)[0]; } if (out.from != undefined) { return out; } else { return null } }, sex: function(elem) { var f = new RegExp('^(fem|doam|domni|wom|дев|жен)','gi'); var m = new RegExp('^(bai|domn|man|male|муж|пар)','gi'); if (f.test(elem.value)) return 'f'; if (m.test(elem.value)) return 'm'; return 'u'; }, edu: function(elem) { var edu = parseEdu(elem.value); return edu; } } function pH() { ph = { fName : 'Имя', lName : 'Фамилия', email : 'E-mail', tel : 'Телефон' }; $('*[ph]').focus(function() { pHv = $(this).attr('ph'); if (this.value == pHv) { this.value = ''; } }) $('*[ph]').blur(function() { pHv = $(this).attr('ph'); if (this.value == '') { this.value = pHv; } }) } function checkPH(elem) { $(elem).find('[ph]').each(function() { if (this.value == $(this).attr('ph')) { this.value = ''; } }) } $(function() { pH(); })