diff --git a/static/css/notie.css b/static/css/notie.css new file mode 100644 index 0000000..1c9292d --- /dev/null +++ b/static/css/notie.css @@ -0,0 +1,149 @@ +.notie-container { + font-size: 1.6rem; + height: auto; + left: 0; + position: fixed; + text-align: center; + width: 100%; + z-index: 999999; + box-sizing: border-box; + -o-box-shadow: 0 0 5px 0 rgba(0, 0, 0, .5); + -ms-box-shadow: 0 0 5px 0 rgba(0, 0, 0, .5); + box-shadow: 0 0 5px 0 rgba(0, 0, 0, .5); + transition-timing-function: cubic-bezier(0.25, 1, 0.5, 1); + font-weight: 500; +} + +@media screen and (max-width:900px) { + .notie-container { + font-size: 1.4rem + } +} + +@media screen and (max-width:750px) { + .notie-container { + font-size: 1.2rem + } +} + +@media screen and (max-width:400px) { + .notie-container { + font-size: 1rem + } +} + +.notie-background-success { + background-color: rgba(37, 228, 123, 0.89); + box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1); + backdrop-filter: blur(6.9px); +} + +.notie-background-warning { + background-color: #d6a14d +} + +.notie-background-error { + background: rgba(255, 21, 71, 0.795); + box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1); + backdrop-filter: blur(6.9px); + /*background-color: #e1715b*/ +} + +.notie-background-info { + background: rgba(0, 85, 255, 0.438); + box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1); + backdrop-filter: blur(6.9px); +} + +.notie-background-neutral { + background-color: #a0a0a0 +} + +.notie-background-overlay { + background-color: rgb(0, 0, 0) +} + +.notie-textbox { + color: #fff; + padding: 20px +} + +.notie-textbox-inner { + margin: 0 auto; + max-width: 900px +} + +.notie-overlay { + height: 100%; + left: 0; + opacity: 0; + position: fixed; + top: 0; + width: 100%; + z-index: 999998; +} + +.notie-button { + cursor: pointer +} + +.notie-button, +.notie-element { + color: #fff; + padding: 10px +} + +.notie-element-half { + width: 50% +} + +.notie-element-half, +.notie-element-third { + display: inline-block; + box-sizing: border-box +} + +.notie-element-third { + width: 33.3333% +} + +.notie-alert { + cursor: pointer +} + +.notie-input-field { + background-color: #fff; + border: 0; + font-family: inherit; + font-size: inherit; + outline: 0; + padding: 10px; + text-align: center; + width: 100%; + box-sizing: border-box +} + +.notie-select-choice-repeated { + border-bottom: 1px solid hsla(0, 0%, 100%, .2); + box-sizing: border-box +} + +.notie-date-selector-inner { + margin: 0 auto; + max-width: 900px; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + -o-user-select: none; + user-select: none +} + +.notie-date-selector-inner [contenteditable], +.notie-date-selector-inner [contenteditable]:focus { + outline: 0 solid transparent +} + +.notie-date-selector-up { + transform: rotate(180deg); + transition: transform 300ms cubic-bezier(0.25, 1, 0.5, 1); +} \ No newline at end of file diff --git a/static/js/core_lk.js b/static/js/core_lk.js new file mode 100644 index 0000000..d3720de --- /dev/null +++ b/static/js/core_lk.js @@ -0,0 +1,579 @@ +var gal_cid = -1; +var new_vehicle_idx = 0; +var modified = false; + + +$(document).ready(function() +{ + $.ajaxSetup({cache: false}); + $('.progress-button').progressInitialize(); + + + // Выбор города + + + + // События всплывающего списка результатов поиска + $('#vlist').on('mouseenter mouseleave', '.found_vehicle', function() + { + var state = parseInt($(this).data('state')); + $(this).toggleClass('s' + state + ' s' + (state+10)); + }) + .on('click', '.found_vehicle a', function(e) + { + e.stopPropagation(); + }) + .on('click', '.found_vehicle', function() + { + var nid = $(this).data('nid'); + var vid = $(this).data('vid'); + + if ($('#conn_veh tbody[data-vid="' + vid + '"]').length > 0) + { + alert(_text['UP_V_LINKED'] + '.'); + return; + } + + var cid = $(this).data('cid'); + var cname = $('.cname', this).html(); + + var type = $(this).data('type'); + + var html = '\n'; + + html += '\n'; + html += '' + $('.num', this).html() + '\n'; + html += '' + $('.mname', this).html() + '\n'; + html += '' + _text['UP_ROUTE'] + ':\n'; + html += ', \n'; + html += '×\n'; + html += '\n'; + + html += '\n'; + html += '' + cname + '\n'; + html += '' + _text['VIEW'] + ':\n'; + html += '' + views[0] + '\n'; + html += '\n'; + + html += '\n'; + html += '\n'; + html += '' + _text['UP_BIND'] + ':\n'; + html += '' + binds[0].label + '\n'; + html += '\n'; + + html += '\n'; + + var row = $(html); + $('#conn_veh').append(row).show().tablesort('recountRows'); + $('.pri-label', row).selector2(binds); + + $('.no-links').hide(); + + if (cid != $('#search_cid').val()) + { + $('#search_cid').val(cid); + $('#cname').val(cname); + } + + $('#search_type').val(type).trigger('change'); + + cnames[cid] = cname; + + showDefaultCity(); + modify(); + + setTimeout(function() { $('#conn_veh tbody[data-nid="' + nid + '"] .view_link').click(); }, 100); + }); + + + // Строка добавления нового ТС + $('#vlist').on('mouseenter mouseleave', '#add_new_vehicle', function() + { + var state = parseInt($(this).data('state')); + $(this).toggleClass('s' + state + ' s' + (state+10)); + }) + .on('click', '#add_new_vehicle', function() + { + new_vehicle_idx++; + + var nid = -new_vehicle_idx; + + var cid = $('#search_cid').val(); + var num = $('#search_num').val(); + var gos = $('#search_gos').val(); + var type = $('#search_type').val(); + var cname = $('#cname').val(); + var by_gos = ($(this).attr('bygos') == 1); + + var html = '\n'; + + html += '\n'; + html += '' + (by_gos ? gos : num) + '\n'; + html += '' + $('#search_type option:selected').html() + '\n'; + html += '' + _text['UP_ROUTE'] + ':\n'; + html += ', \n'; + html += '×\n'; + html += '\n'; + + html += '\n'; + html += '' + cname + '\n'; + html += '' + _text['VIEW'] + ':\n'; + html += '' + views[0] + '\n'; + html += '\n'; + + html += '\n'; + html += '\n'; + html += '' + _text['UP_BIND'] + ':\n'; + html += '' + binds[0].label + '\n'; + html += '\n'; + + html += '\n'; + html += '' + _text['UP_LOADING'] + '\n'; + html += '\n'; + + html += '\n'; + + var row = $(html); + $('#conn_veh').append(row).show().tablesort('recountRows'); + $('.pri-label', row).selector2(binds); + + $('.no-links').hide(); + + cnames[cid] = cname; + + + var form = $('.new_vehicle_template').clone(true).removeClass('new_vehicle_template').show(); + + $('select[name="nv_service[]"]', form).change(); + $('select[name="nv_state[]"]', form).change(); + + $('input[name="nv_cid[]"]', form).val(cid); + $('input[name="nv_type[]"]', form).val(type); + $('input[name="nv_num[]"]', form).val(num); + $('input[name="nv_gos[]"]', form).val(gos); + + if (by_gos) + $('.tbody_nv_num', form).css('display', ''); + else $('.tbody_nv_gos', form).css('display', ''); + + $.get('/api.php', { action: 'get-depot-list', cid: cid }, function(data) + { + $('.did', form).html(data); + $('.tbody_nv_did', form).css('display', (data != '') ? '' : 'none'); + + $('#new_vehicle_' + new_vehicle_idx).empty().append(form); + + $('input[name="nv_mid[]"]', form).attr('id', 'mid_' + new_vehicle_idx); + $('input[name="nv_chid[]"]', form).attr('id', 'chid_' + new_vehicle_idx); + + var nv_type = $('input[name="nv_type[]"]', form); + + $('.mname', form).autocompleteSelector('mid_' + new_vehicle_idx, '/api.php?action=get-models', { + minLength: 1, + paramsCallback: function(params) { params.type = nv_type.val(); }, + selectCallback: function(item) { form.closest('tbody').data('twoside', item.twoside); } + }); + + $('.chname', form).autocompleteSelector('chid_' + new_vehicle_idx, '/api.php?action=get-chassis', { + minLength: 1, + paramsCallback: function(params) { params.type = nv_type.val(); } + }); + + $('.did', form).select2(); + + showDefaultCity(); + }) + .fail(function(jx) { alert(jx.responseText); }); + + modify(); + }); + + + + + + + $('#image').click(function() + { + $('#dateLoaded, #dateAbsent').hide(); + $('#map_frame').removeClass('s12').css('background-color', '#ccc'); + + $('#statusbox').html(''); + $('#errorsbox').hide(); + }) + .change(function(e) + { + $('#filename').html(this.files[0].name); + + checkImageForUpload(e.target, true, no_exif ? null : function(input) + { + EXIF.getData(input.files[0], function() + { + var dt = EXIF.getTag(this, "DateTimeOriginal"); + if (dt) + { + dt = dt.split(' ')[0].split(':'); + setDate(parseInt(dt[2]), parseInt(dt[1]), parseInt(dt[0])); + $('#dateLoaded').fadeIn('slow'); + } + else $('#dateAbsent').fadeIn('slow'); + + var lt = EXIF.getTag(this, 'GPSLatitude'); + var ln = EXIF.getTag(this, 'GPSLongitude'); + if (lt && ln) + { + lt = parseCoord(lt, EXIF.getTag(this, 'GPSLatitudeRef')); + ln = parseCoord(ln, EXIF.getTag(this, 'GPSLongitudeRef')); + + $('#lat').val(lt); + $('#lng').val(ln); + + if (map) + { + var pos = [lt, ln]; + marker.setLatLng(pos); + map.setView(pos); + } + + $('#map_frame').css('background-color', '').attr('class', 's12'); + } + }); + }); + }); + + + + + $('#day, #month, #year').on('change', function() { $('#dateAbsent').hide(); }); + + + $('#search_type').on('change', function() { changeColor(this); }).change(); + + + // Комментарий + $('#up-comment-link').on('click', function() { $('#up-comment-row').toggle(); }); + + + + + // Опции прямой публикации + /*$('input[name="pub"]').on('click', function() + { + $('#temp_pub').css('display', $('#pub0').is(':checked') ? 'none' : 'block') + });*/ + + + // Хак для IE + $('label.button').on('click', function() + { + $(this).css('position', 'static'); + setTimeout(function() { $('label.button').css('position', 'relative'); }, 50); + }); + + + // Опции даты + $('.approx-aprx').css('font-weight', 'normal'); + + + // Временная публикация + $('#cond').on('click', function() { if ($(this).is(':checked')) $('#tech').prop('checked', false); }); + $('#tech').on('click', function() { if ($(this).is(':checked')) $('#cond').prop('checked', false); }); + + + + + // Закрытие селектора ракурса по Esc или Backspace + $(document).on('keydown', function(e) + { + if ((e.which == 27 || e.which == 8) && $('#views-selector').is(':visible')) + { + e.preventDefault(); + $('#views-selector').hide(); + } + }); + + + // Модификация формы (но не только здесь) + $('#image, #day, #month, #year, #pdate_approx, #main-cid, #place, #notes, #naa, #nomap, #license, #comment, #notes_mod, #px').on('change', modify); + $('#conn_veh').on('change', 'input:checkbox, input:text', modify); + + + // Предотвращение случайного закрытия формы + window.onbeforeunload = function() { if (modified) return false; } +}); + + + +function modify() +{ + modified = true; +} + + + + + +function parseCoord(val, ref) +{ + var coord = parseFloat(val[0] + (val[1] / 60.0) + (val[2] / 3600.0)); + if (ref == 'W' || ref == 'S') coord = -coord; + return coord; +} + + + +function searchVehicles(by_gos) +{ + $('#search_cid, #search_type, #search_num, #search_gos').prop('disabled', true); + $('#vlist').html('
' + _text['UP_SEARCHING'] + '
').show(); + + var data = { cid: $('#search_cid').val(), type: $('#search_type').val(), pub_pid: pub_pid }; + if (!by_gos) + data.num = $('#search_num').val().trim(); + else data.gos = $('#search_gos').val().trim(); + + $.get('/api.php?action=upload-search-vehicles', data, function (r) + { + $('#vlist').html(r); + $('#search_cid, #search_type, #search_num, #search_gos').prop('disabled', false); + }); + return false; +} + + + + +function artClick() +{ + var art = $('input[name="art"]:checked').val(); + if (art == 0) + { + $('.lnk-vehicle').show(); + $('.lnk-gallery').hide(); + } + else + { + $('.lnk-vehicle').hide(); + $('.lnk-gallery').show(); + + loadGalleries(art == 2 ? 0 : $('#search_cid').val()); + } + + $('#lnk_cid_tr')[art == 2 ? 'hide' : 'show'](); +} + + + +function loadGalleries(cid) +{ + if (cid == gal_cid) return; + gal_cid = cid; + + var sel = $('#search_gid').prop('disabled', true).empty().append(''); + $.get('/api.php', { action: 'get-galleries', cid: gal_cid }, function(data) { sel.html(data).prop('disabled', false); }, 'html'); +} + + + +function showDefaultCity() +{ + var cids = $('#links input[name="cids[]"]'); + if (cids.length == 0) + { + cnames.length = 0; + return; + } + + var i, cid, new_cnames = {}; + for (i = 0; i < cids.length; i++) + { + cid = cids.eq(i).val(); + if (cid) new_cnames[cid] = cnames[cid]; + } + + var keys = Object.keys(new_cnames); + if (keys.length) + { + cnames = new_cnames; + + cid = $('#main-cid').val(); + if (cnames[cid] == undefined) + { + keys = Object.keys(cnames); + $('#main-cid').val(keys[0]); + $('#main-cname').val(cnames[keys[0]]); + selectCity(keys[0]); + } + } +} + + + +function checkForm() +{ + var i, err = ''; + + function addError(txt) { err += '
  • ' + txt + '.
     '; } + + var image = $('#image'); + if (!pid && image.val() == '') + { + $('#step1')[0].scrollIntoView(); + image.focus(); + alert(_text['UP_NOFILE'] + '.'); + return false; + } + + // Проверяем наличие привязок вообще + if ($('#links input').length == 0) + { + $('#step2')[0].scrollIntoView(); + alert(_text['UP_NOLINKS'] + '.'); + return false; + } + + if ($('#conn_veh .pri-value[value="1"]').length == 0 && + $('#conn_veh .pri-value[value="2"]').length == 0 && + $('#conn_gid tr').length == 0) + { + $('#step2')[0].scrollIntoView(); + alert(_text['UP_NO_PRI']); + return false; + } + + + // Проверим, указаны ли ракурсы + if ($('.view[value="0"]').length > 0) + { + $('#step2')[0].scrollIntoView(); + alert(_text['UP_NOVIEW']); + return false; + } + + + // Проверим корректность привязки творческой фотографии + if ($('#creative').val() == 1 && ($('#conn_veh input[name="nids[]"]').length || $('#conn_gid input[name="gids[]"]').length > 1)) + { + $('#step2')[0].scrollIntoView(); + alert(_text['UP_CREATIVE']); + return false; + } + + + // Проверяем наличие даты + if ($('#year').val() == 0 && !confirm(_text['UP_NODATE'] + '.')) + { + $('#step1')[0].scrollIntoView(); + return false; + } + + + // Проверяем разрешение на публикацию + if ($('#naa_hint').is(':visible') && $('#naa_allow').val().trim() == '') + { + alert(_text['UP_NAA_ALLOW_NO']); + $('#step1')[3].scrollIntoView(); + return false; + } + + + // Уточняем, правильно ли, что выбрано "города нет в списке" + var cid = $('#main-cid').val(); + if (pid == 0 && cid == 0 && !confirm(_text['UP_NOCITY'])) return false; + + // Уточняем, если город не соответствует привязкам + if (cid != 0 && cnames[cid] == undefined && !confirm(_text['UP_OTHERCITY'])) return false; + + + // Проверяем наличие МС + if ($('.view[value="9"], .view[value="10"], .view[value="11"], .view[value="12"]').length == 0 && $('#place').val().trim() == '' && !confirm(_text['UP_NOPLACE'] + '.')) + { + $('#step3')[0].scrollIntoView(); + return false; + } + + + // Проверяем правильность указания координат + if (!$('#nomap').prop('checked')) + { + if ($('#lat').val() == 0.0 || $('#lng').val() == 0.0) + { + $('#step4')[0].scrollIntoView(); + alert(_text['UP_NOCOORDS']); + return false; + } + + if ($('#directions input:checked').length == 0) + { + $('#step4')[0].scrollIntoView(); + alert(_text['UP_NODIR']); + return false; + } + } + + return true; +} + + + +function setDate(d, m, y) +{ + $('#day').val(d); + $('#month').val(m); + $('#year').val(y); + $('#pdate_approx').val(0); +} + + + + +document.onclick = function(e) +{ + e = e || window.event; + E = e.target || e.srcElement; + if (E.id != 'phint' && E.parentNode.id != 'phint' && E != _getID('mform').place) $('#phint').slideUp(); + + if (E.className != 'searchVehiclesBtn' && E.id != 'vlist_table' && E.className != 'num' && $('#vlist').css('display') == 'block') $('#vlist').hide().html(''); + + if ($(E).closest('#views-selector').length == 0) $('#views-selector').hide(); +}; + + + +function showHint(id) { $('#'+id+'_hint').fadeIn() } +function hideHint(id) { $('#'+id+'_hint').fadeOut() } + +function changeColor(sel) { sel.className = sel.options[sel.selectedIndex].className } + + + +function toggleNAA(wl) +{ + if ($('#naa').prop('checked')) + { + $('#naa_hint').show(); + + if (!wl) + { + $('#pub1_label').hide(); + $('#pub0').prop('checked', true); + } + } + else + { + $('#naa_hint').hide(); + $('#pub1_label').show(); + } +} + + + +function checkSpecialViews() +{ + var fields = $('.route, .notes'); + if (!moderator) fields.add('#place'); + + if ($('.view[value="9"], .view[value="10"], .view[value="11"], .view[value="12"]').length > 0) + fields.prop('disabled', true).val(''); + else fields.prop('disabled', false); +} \ No newline at end of file diff --git a/static/js/jquery.form.min.js b/static/js/jquery.form.min.js new file mode 100644 index 0000000..88edc99 --- /dev/null +++ b/static/js/jquery.form.min.js @@ -0,0 +1,7 @@ +/* +* jQuery Form Plugin; v20131017 +* http://jquery.malsup.com/form/ +* Copyright (c) 2013 M. Alsup; Dual licensed: MIT/GPL +* https://github.com/malsup/form#copyright-and-license +*/ +;(function(e){"use strict";function t(t){var r=t.data;t.isDefaultPrevented()||(t.preventDefault(),e(t.target).ajaxSubmit(r))}function r(t){var r=t.target,a=e(r);if(!a.is("[type=submit],[type=image]")){var n=a.closest("[type=submit]");if(0===n.length)return;r=n[0]}var i=this;if(i.clk=r,"image"==r.type)if(void 0!==t.offsetX)i.clk_x=t.offsetX,i.clk_y=t.offsetY;else if("function"==typeof e.fn.offset){var o=a.offset();i.clk_x=t.pageX-o.left,i.clk_y=t.pageY-o.top}else i.clk_x=t.pageX-r.offsetLeft,i.clk_y=t.pageY-r.offsetTop;setTimeout(function(){i.clk=i.clk_x=i.clk_y=null},100)}function a(){if(e.fn.ajaxSubmit.debug){var t="[jquery.form] "+Array.prototype.join.call(arguments,"");window.console&&window.console.log?window.console.log(t):window.opera&&window.opera.postError&&window.opera.postError(t)}}var n={};n.fileapi=void 0!==e("").get(0).files,n.formdata=void 0!==window.FormData;var i=!!e.fn.prop;e.fn.attr2=function(){if(!i)return this.attr.apply(this,arguments);var e=this.prop.apply(this,arguments);return e&&e.jquery||"string"==typeof e?e:this.attr.apply(this,arguments)},e.fn.ajaxSubmit=function(t){function r(r){var a,n,i=e.param(r,t.traditional).split("&"),o=i.length,s=[];for(a=0;o>a;a++)i[a]=i[a].replace(/\+/g," "),n=i[a].split("="),s.push([decodeURIComponent(n[0]),decodeURIComponent(n[1])]);return s}function o(a){for(var n=new FormData,i=0;a.length>i;i++)n.append(a[i].name,a[i].value);if(t.extraData){var o=r(t.extraData);for(i=0;o.length>i;i++)o[i]&&n.append(o[i][0],o[i][1])}t.data=null;var s=e.extend(!0,{},e.ajaxSettings,t,{contentType:!1,processData:!1,cache:!1,type:u||"POST"});t.uploadProgress&&(s.xhr=function(){var r=e.ajaxSettings.xhr();return r.upload&&r.upload.addEventListener("progress",function(e){var r=0,a=e.loaded||e.position,n=e.total;e.lengthComputable&&(r=Math.ceil(100*(a/n))),t.uploadProgress(e,a,n,r)},!1),r}),s.data=null;var l=s.beforeSend;return s.beforeSend=function(e,r){r.data=t.formData?t.formData:n,l&&l.call(this,e,r)},e.ajax(s)}function s(r){function n(e){var t=null;try{e.contentWindow&&(t=e.contentWindow.document)}catch(r){a("cannot get iframe.contentWindow document: "+r)}if(t)return t;try{t=e.contentDocument?e.contentDocument:e.document}catch(r){a("cannot get iframe.contentDocument: "+r),t=e.document}return t}function o(){function t(){try{var e=n(g).readyState;a("state = "+e),e&&"uninitialized"==e.toLowerCase()&&setTimeout(t,50)}catch(r){a("Server abort: ",r," (",r.name,")"),s(k),j&&clearTimeout(j),j=void 0}}var r=f.attr2("target"),i=f.attr2("action");w.setAttribute("target",d),(!u||/post/i.test(u))&&w.setAttribute("method","POST"),i!=m.url&&w.setAttribute("action",m.url),m.skipEncodingOverride||u&&!/post/i.test(u)||f.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"}),m.timeout&&(j=setTimeout(function(){T=!0,s(D)},m.timeout));var o=[];try{if(m.extraData)for(var l in m.extraData)m.extraData.hasOwnProperty(l)&&(e.isPlainObject(m.extraData[l])&&m.extraData[l].hasOwnProperty("name")&&m.extraData[l].hasOwnProperty("value")?o.push(e('').val(m.extraData[l].value).appendTo(w)[0]):o.push(e('').val(m.extraData[l]).appendTo(w)[0]));m.iframeTarget||v.appendTo("body"),g.attachEvent?g.attachEvent("onload",s):g.addEventListener("load",s,!1),setTimeout(t,15);try{w.submit()}catch(c){var p=document.createElement("form").submit;p.apply(w)}}finally{w.setAttribute("action",i),r?w.setAttribute("target",r):f.removeAttr("target"),e(o).remove()}}function s(t){if(!x.aborted&&!F){if(M=n(g),M||(a("cannot access response document"),t=k),t===D&&x)return x.abort("timeout"),S.reject(x,"timeout"),void 0;if(t==k&&x)return x.abort("server abort"),S.reject(x,"error","server abort"),void 0;if(M&&M.location.href!=m.iframeSrc||T){g.detachEvent?g.detachEvent("onload",s):g.removeEventListener("load",s,!1);var r,i="success";try{if(T)throw"timeout";var o="xml"==m.dataType||M.XMLDocument||e.isXMLDoc(M);if(a("isXml="+o),!o&&window.opera&&(null===M.body||!M.body.innerHTML)&&--O)return a("requeing onLoad callback, DOM not available"),setTimeout(s,250),void 0;var u=M.body?M.body:M.documentElement;x.responseText=u?u.innerHTML:null,x.responseXML=M.XMLDocument?M.XMLDocument:M,o&&(m.dataType="xml"),x.getResponseHeader=function(e){var t={"content-type":m.dataType};return t[e.toLowerCase()]},u&&(x.status=Number(u.getAttribute("status"))||x.status,x.statusText=u.getAttribute("statusText")||x.statusText);var l=(m.dataType||"").toLowerCase(),c=/(json|script|text)/.test(l);if(c||m.textarea){var f=M.getElementsByTagName("textarea")[0];if(f)x.responseText=f.value,x.status=Number(f.getAttribute("status"))||x.status,x.statusText=f.getAttribute("statusText")||x.statusText;else if(c){var d=M.getElementsByTagName("pre")[0],h=M.getElementsByTagName("body")[0];d?x.responseText=d.textContent?d.textContent:d.innerText:h&&(x.responseText=h.textContent?h.textContent:h.innerText)}}else"xml"==l&&!x.responseXML&&x.responseText&&(x.responseXML=X(x.responseText));try{E=_(x,l,m)}catch(b){i="parsererror",x.error=r=b||i}}catch(b){a("error caught: ",b),i="error",x.error=r=b||i}x.aborted&&(a("upload aborted"),i=null),x.status&&(i=x.status>=200&&300>x.status||304===x.status?"success":"error"),"success"===i?(m.success&&m.success.call(m.context,E,"success",x),S.resolve(x.responseText,"success",x),p&&e.event.trigger("ajaxSuccess",[x,m])):i&&(void 0===r&&(r=x.statusText),m.error&&m.error.call(m.context,x,i,r),S.reject(x,"error",r),p&&e.event.trigger("ajaxError",[x,m,r])),p&&e.event.trigger("ajaxComplete",[x,m]),p&&!--e.active&&e.event.trigger("ajaxStop"),m.complete&&m.complete.call(m.context,x,i),F=!0,m.timeout&&clearTimeout(j),setTimeout(function(){m.iframeTarget?v.attr("src",m.iframeSrc):v.remove(),x.responseXML=null},100)}}}var l,c,m,p,d,v,g,x,b,y,T,j,w=f[0],S=e.Deferred();if(S.abort=function(e){x.abort(e)},r)for(c=0;h.length>c;c++)l=e(h[c]),i?l.prop("disabled",!1):l.removeAttr("disabled");if(m=e.extend(!0,{},e.ajaxSettings,t),m.context=m.context||m,d="jqFormIO"+(new Date).getTime(),m.iframeTarget?(v=e(m.iframeTarget),y=v.attr2("name"),y?d=y:v.attr2("name",d)):(v=e('