diff --git a/.htaccess b/.htaccess index 8b18a9f..353e8cd 100644 --- a/.htaccess +++ b/.htaccess @@ -13,25 +13,25 @@ Options -Indexes +FollowSymLinks php_value default_charset utf-8 - #Отлючаем вывод ошибок + #Отлючаем вывод ошибок #php_value error_reporting E_NONE - # Этот параметр устанавливает максимальное время в секундах, позволяющее скрипту запускаться прежде, чем он завершается синтаксическим анализатором. + # Этот параметр устанавливает максимальное время в секундах, позволяющее скрипту запускаться прежде, чем он завершается синтаксическим анализатором. #php_value max_execution_time 300 - # Максимальное время загрузки данных для скрипта, в том числе и файлов из формы + # Максимальное время загрузки данных для скрипта, в том числе и файлов из формы #php_value max_input_time 300 - # Ограничивает максимальный объем данных, получаемых от пользователя методом POST + # Ограничивает максимальный объем данных, получаемых от пользователя методом POST #php_value post_max_size 512M - # Устанавливает максимальный размер файла, который может быть получен методом POST (меньше, чем post_max_size) + # Устанавливает максимальный размер файла, который может быть получен методом POST (меньше, чем post_max_size) #php_value upload_max_filesize 128M - # Максимальное кол-во загружаемых файлов + # Максимальное кол-во загружаемых файлов #php_value max_file_uploads 50 - # Включаем у PHP короткие - + Order allow,deny + + Header set Cache-Control "max-age=2592000, must-revalidate" + + SecFilterScanPOST Off @@ -249,6 +261,21 @@ AddDefaultCharset utf-8 +# ------------------------------------------------------------------------------ +# | mod_gzip.c | +# ------------------------------------------------------------------------------ + + + mod_gzip_on Yes + mod_gzip_dechunk Yes + mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$ + mod_gzip_item_include mime ^application/x-javascript.* + mod_gzip_item_include mime ^text/.* + mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.* + mod_gzip_item_exclude mime ^image/.* + mod_gzip_item_include handler ^cgi-script$ + + # ------------------------------------------------------------------------------ # | Rewrite engine | # ------------------------------------------------------------------------------ @@ -278,7 +305,7 @@ AddDefaultCharset utf-8 # RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR] # RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2}) - RewriteCond %{REQUEST_URI} !^/(backup|cache|class|fields|functions|inc|modules|lib|session|templates)/ + RewriteCond %{REQUEST_URI} !^/(class|config|fields|functions|inc|modules|lib|templates|tmp)/ # Файл robots.txt RewriteCond %{REQUEST_URI} !^/robots\.txt$ [NC] diff --git a/admin/templates/css/main.css b/admin/templates/css/main.css index 798ac12..4459bef 100644 --- a/admin/templates/css/main.css +++ b/admin/templates/css/main.css @@ -1426,6 +1426,10 @@ li.plupload_droptext { background: transparent; text-align: center; vertical-ali margin: 5px; } +.jq-selectbox__search { + margin: 5px; +} + .jq-selectbox__search input { box-sizing: border-box; width: 100%; @@ -1437,4 +1441,66 @@ li.plupload_droptext { background: transparent; text-align: center; vertical-ali background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAYAAABiDJ37AAAAGXRFW…V6u2aoSqBZD/lDrNWRJynLK2qpBn4rc6K2XB9/Nb8EGABtf1thzY6X2AAAAABJRU5ErkJggg==) no-repeat 100% 50%; box-shadow: inset 1px 1px #F1F1F1; color: #333; +} + +.jq-selectbox, +.jq-select-multiple { + position: relative; + display: inline-block; +} +.jq-selectbox select, +.jq-select-multiple select { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + margin: 0; + padding: 0; + opacity: 0; +} +.jq-selectbox li, +.jq-select-multiple li { + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + white-space: nowrap; +} +.jq-selectbox { + z-index: 10; +} +.jq-selectbox__select { + position: relative; +} +.jq-selectbox__select-text { + overflow: hidden; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + white-space: nowrap; + text-overflow: ellipsis; +} +.jq-selectbox__dropdown { + position: absolute; +} +.jq-selectbox__search input { + -webkit-appearance: textfield; +} +.jq-selectbox__search input::-webkit-search-cancel-button, +.jq-selectbox__search input::-webkit-search-decoration { + -webkit-appearance: none; +} +.jq-selectbox__dropdown ul { + position: relative; + overflow: auto; + overflow-x: hidden; + list-style: none; + -webkit-overflow-scrolling: touch; +} +.jq-select-multiple ul { + position: relative; + overflow-x: hidden; + -webkit-overflow-scrolling: touch; } \ No newline at end of file diff --git a/fields/youtube/field.php b/fields/youtube/field.php index afec825..1860728 100644 --- a/fields/youtube/field.php +++ b/fields/youtube/field.php @@ -162,11 +162,11 @@ if ($source == 'embed') { - return 'http://www.youtube.com/v/'.$vid; + return 'https://www.youtube.com/v/'.$vid; } else { - return 'http://www.youtube.com/embed/'.$vid; + return 'https://www.youtube.com/embed/'.$vid; } } @@ -185,11 +185,11 @@ if ($source == 'embed') { - return 'http://www.youtube.com/v/'.$vid; + return 'https://www.youtube.com/v/'.$vid; } else { - return 'http://www.youtube.com/embed/'.$vid; + return 'https://www.youtube.com/embed/'.$vid; } } else diff --git a/functions/func.common.php b/functions/func.common.php index add81fb..1326cad 100755 --- a/functions/func.common.php +++ b/functions/func.common.php @@ -1280,6 +1280,7 @@ return strtr(base64_encode($input), '+/=', '-_,'); } + /** * _base64_decode() * @@ -1290,4 +1291,41 @@ { return base64_decode(strtr($input, '-_,', '+/=')); } + + + /** + * Функция принимает строку, и возвращает + * адрес первого изображения, которую найдет + * + * @param $data + * + * @return string + */ + function getImgSrc($data) + { + $_req_exp = '/()/u'; + + preg_match_all($_req_exp, $data, $images); + + $host = $images[2][0]; + + if (preg_match("/(src=)('|\")(.+?)('|\")/u", $host, $matches) == 1) + $host = $matches[3]; + + preg_match('@/index\.php\?.*thumb=(.*?)\&@i', $host, $matches); + + if (isset($matches[1])) + { + return $matches[1]; + } + else + { + preg_match('/(.+)' . THUMBNAIL_DIR . '\/(.+)-.\d+x\d+(\..+)/u', $host, $matches); + + if (isset($matches[1])) + return $matches[1] . $matches[2] . $matches[3]; + else + return $host; + } + } ?> \ No newline at end of file diff --git a/functions/func.documents.php b/functions/func.documents.php index 19367aa..d69bb59 100644 --- a/functions/func.documents.php +++ b/functions/func.documents.php @@ -18,7 +18,7 @@ * @param string $text текст многострочной части документа * @return string */ - function document_pagination($text) + function document_pagination ($text) { global $AVE_Core; @@ -67,7 +67,7 @@ * * @return int идентификатор родительского документа */ - function get_parent_document_id() + function get_parent_document_id () { global $AVE_DB; return $AVE_DB->Query("SELECT document_parent FROM " . PREFIX . "_documents WHERE Id = '".get_current_document_id()."' ")->GetCell(); @@ -83,14 +83,12 @@ */ function get_document ($doc_id , $key ='') { - global $AVE_DB; - $doc_id = (int)$doc_id; if ($doc_id < 1) - return array(); + return []; - static $get_documents_data = array(); + static $get_documents_data = []; if (! isset ($get_documents_data[$doc_id])) { diff --git a/functions/func.parserequest.php b/functions/func.parserequest.php index 9a9d441..6aa4640 100755 --- a/functions/func.parserequest.php +++ b/functions/func.parserequest.php @@ -58,8 +58,8 @@ global $AVE_DB, $AVE_Core; $id = (int)$id; - $from = array(); - $where = array(); + $from = []; + $where = []; $sql_ak = $AVE_DB->Query(" SELECT * @@ -108,14 +108,18 @@ { // id поля рубрики $fid = $row_ak->condition_field_id; + // значение для условия $val = trim($row_ak->condition_value); + // если это поле используется для выпадающего списка или пустое значение для условия, пропускаем if (isset($_POST['req_' . $id]) && isset($_POST['req_' . $id][$fid]) || $val === '') continue; + // И / ИЛИ if (! isset($join) && $row_ak->condition_join) $join = $row_ak->condition_join; + // тип сравнения $type = $row_ak->condition_compare; @@ -142,7 +146,7 @@ // формируем выбор таблицы // первый раз евалом проходим значение и запоминаем это в переменной $v[$i] // как только таблица выбрана, фиксируем это в $t[$fid], чтобы не выбирать по несколько раз одни и те же таблицы - $from[] = "$val'' && !isset(\$t[$fid])) {echo \"%%PREFIX%%_document_fields AS t$fid,\"; \$t[$fid]=1;} ?>"; + $from[] = "$val'' && !isset(\$t[$fid])) {echo \"%%PREFIX%%_document_fields AS t$fid,\"; \$t[$fid]=1;} ?>"; // обрабатываем условия switch ($type) @@ -180,7 +184,7 @@ $i++; } - $retval = array(); + $retval = []; if (! empty($where) || ! empty($where_dd)) { @@ -189,14 +193,14 @@ $from = (isset($from_dd) ? array_merge($from, $from_dd) : $from); $from = implode(' ', $from); $where_dd = (isset($where_dd) ? ' AND ' : '') . implode(' AND ', $where_dd); - $where = implode(' ', $where) . " "; - $retval = array('from' => $from, 'where' => $where . $where_dd); + $where = implode(' ', $where) . " "; + $retval = ['from' => $from, 'where' => $where . $where_dd]; } else { $from = implode(' ', $from); - $where = implode(' ', $where) . " "; - $retval = array('from' => $from, 'where' => $where); + $where = implode(' ', $where) . " "; + $retval = ['from' => $from, 'where' => $where]; } } @@ -219,43 +223,6 @@ } - /** - * Функция принимает строку, и возвращает - * адрес первого изображения, которую найдет - * - * @param $data - * - * @return string - */ - function getImgSrc($data) - { - $_req_exp = '/()/u'; - - preg_match_all($_req_exp, $data, $images); - - $host = $images[2][0]; - - if (preg_match("/(src=)('|\")(.+?)('|\")/u", $host, $matches) == 1) - $host = $matches[3]; - - preg_match('@/index\.php\?.*thumb=(.*?)\&@i', $host, $matches); - - if (isset($matches[1])) - { - return $matches[1]; - } - else - { - preg_match('/(.+)' . THUMBNAIL_DIR . '\/(.+)-.\d+x\d+(\..+)/u', $host, $matches); - - if (isset($matches[1])) - return $matches[1] . $matches[2] . $matches[3]; - else - return $host; - } - } - - /** * Функция обработки тэгов полей с использованием шаблонов * в соответствии с типом поля @@ -267,7 +234,7 @@ * * @return string */ - function request_get_document_field($field_id, $document_id, $maxlength = null, $rubric_id = 0) + function request_get_document_field ($field_id, $document_id, $maxlength = null, $rubric_id = 0) { if (! is_numeric($document_id) || $document_id < 1) return ''; @@ -354,6 +321,7 @@ return $item; } + // Функция получения уникальных параметров для каждого тизера function f_params_of_teaser($id_param_array,$num) { @@ -361,6 +329,7 @@ return $params_of_teaser[$id_param_array][$num]; } + // Функция получения элемента запроса function showrequestelement($mixed, $template = '', $tparams = '') { @@ -392,7 +361,7 @@ if ($tparams != '') { $tparams_id = $row->Id . md5($tparams); // Создаем уникальный id для каждого набора параметров - $params_of_teaser[$tparams_id] = array(); // Для отмены лишних ворнингов + $params_of_teaser[$tparams_id] = []; // Для отмены лишних ворнингов $tparams = trim($tparams,'[]:'); // Удаляем: слева ':[', справа ']' $params_of_teaser[$tparams_id] = explode('|',$tparams); // Заносим параметры в массив уникального id } @@ -629,7 +598,7 @@ * * @return string */ - function request_parse($id, $params = array()) + function request_parse($id, $params = []) { global $AVE_Core, $AVE_DB, $request_documents; @@ -637,9 +606,9 @@ if (is_array($id)) $id = $id[1]; - $t = array(); - $a = array(); - $v = array(); + $t = []; + $a = []; + $v = []; // Получаем информацию о запросе $request = request_get_settings($id); @@ -648,15 +617,15 @@ Debug::startTime('request_' . $id); // Массив для полей SELECT - $request_select = array(); + $request_select = []; // Массив для присоединения таблиц JOIN - $request_join = array(); + $request_join = []; // Массив для добавления условий WHERE - $request_where = array(); + $request_where = []; // Массив для сортировки результатов ORDER BY - $request_order = array(); + $request_order = []; // Массив для сортировки результатов ORDER BY - $request_order_fields = array(); + $request_order_fields = []; $request_order_str = ''; $request_select_str = ''; @@ -667,7 +636,7 @@ // Разрешаем перебор полей для сортировки через ";" $sort = explode(';', $_REQUEST['requestsort_' . $id]); - foreach($sort as $v) + foreach($sort AS $v) { $v1 = explode('=', $v); @@ -1029,10 +998,10 @@ } // Элементы запроса - $rows = array(); + $rows = []; // id найденных документов - $request_documents = array(); + $request_documents = []; while ($row = $sql->FetchRow()) { diff --git a/lib/scripts/jquery.formstyler.min.js b/lib/scripts/jquery.formstyler.min.js index b59536d..52fc7f7 100644 --- a/lib/scripts/jquery.formstyler.min.js +++ b/lib/scripts/jquery.formstyler.min.js @@ -1,29 +1,2 @@ -/* jQuery Form Styler v1.5.3.3 | (c) Dimox | https://github.com/Dimox/jQueryFormStyler */ -(function(c){c.fn.styler=function(D){var e=c.extend({wrapper:"form",idSuffix:"-styler",filePlaceholder:"\u0424\u0430\u0439\u043b \u043d\u0435 \u0432\u044b\u0431\u0440\u0430\u043d",fileBrowse:"\u041e\u0431\u0437\u043e\u0440...",selectSearch:!0,selectSearchLimit:10,selectSearchNotFound:"\u0421\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0439 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043e",selectSearchPlaceholder:"\u041f\u043e\u0438\u0441\u043a...",selectVisibleOptions:0,singleSelectzIndex:"100", -selectSmartPositioning:!0,onSelectOpened:function(){},onSelectClosed:function(){},onFormStyled:function(){}},D);return this.each(function(){function w(){var c="",m="",b="",u="";void 0!==a.attr("id")&&""!==a.attr("id")&&(c=' id="'+a.attr("id")+e.idSuffix+'"');void 0!==a.attr("title")&&""!==a.attr("title")&&(m=' title="'+a.attr("title")+'"');void 0!==a.attr("class")&&""!==a.attr("class")&&(b=" "+a.attr("class"));for(var t=a.data(),f=0;fa.parent("div.jq-checkbox").length){var e=function(){var e=new w,b=c("
');a.css({position:"absolute",zIndex:"-1",opacity:0,margin:0,padding:0}).after(b).prependTo(b);b.attr("unselectable","on").css({"-webkit-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","-o-user-select":"none","user-select":"none", -display:"inline-block",position:"relative",overflow:"hidden"});a.is(":checked")&&b.addClass("checked");a.is(":disabled")&&b.addClass("disabled");b.on("click.styler",function(){b.is(".disabled")||(a.is(":checked")?(a.prop("checked",!1),b.removeClass("checked")):(a.prop("checked",!0),b.addClass("checked")),a.change());return!1});a.closest("label").add('label[for="'+a.attr("id")+'"]').click(function(a){b.click();a.preventDefault()});a.on("change.styler",function(){a.is(":checked")?b.addClass("checked"): -b.removeClass("checked")}).on("keydown.styler",function(a){32==a.which&&b.click()}).on("focus.styler",function(){b.is(".disabled")||b.addClass("focused")}).on("blur.styler",function(){b.removeClass("focused")})};e();a.on("refresh",function(){a.off(".styler").parent().before(a).remove();e()})}});else if(a.is(":radio"))a.each(function(){if(1>a.parent("div.jq-radio").length){var g=function(){var m=new w,b=c("
'); -a.css({position:"absolute",zIndex:"-1",opacity:0,margin:0,padding:0}).after(b).prependTo(b);b.attr("unselectable","on").css({"-webkit-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","-o-user-select":"none","user-select":"none",display:"inline-block",position:"relative"});a.is(":checked")&&b.addClass("checked");a.is(":disabled")&&b.addClass("disabled");b.on("click.styler",function(){b.is(".disabled")||(b.closest(e.wrapper).find('input[name="'+a.attr("name")+'"]').prop("checked", -!1).parent().removeClass("checked"),a.prop("checked",!0).parent().addClass("checked"),a.change());return!1});a.closest("label").add('label[for="'+a.attr("id")+'"]').click(function(a){b.click();a.preventDefault()});a.on("change.styler",function(){a.parent().addClass("checked")}).on("focus.styler",function(){b.is(".disabled")||b.addClass("focused")}).on("blur.styler",function(){b.removeClass("focused")})};g();a.on("refresh",function(){a.off(".styler").parent().before(a).remove();g()})}});else if(a.is(":file"))a.css({position:"absolute", -top:0,right:0,width:"100%",height:"100%",opacity:0,margin:0,padding:0}).each(function(){if(1>a.parent("div.jq-file").length){var g=function(){var m=new w,b=c("'),g=c('
'+e.filePlaceholder+"
").appendTo(b);c('
'+e.fileBrowse+"
").appendTo(b);a.after(b);b.append(a);a.is(":disabled")&&b.addClass("disabled");a.on("change.styler", -function(){var c=a.val();if(a.is("[multiple]"))for(var c="",f=a[0].files,m=0;m -a.parent("div.jqselect").length){var g=function(){function m(a){a.off("mousewheel DOMMouseScroll").on("mousewheel DOMMouseScroll",function(a){var b=null;"mousewheel"==a.type?b=-1*a.originalEvent.wheelDelta:"DOMMouseScroll"==a.type&&(b=40*a.originalEvent.detail);b&&(a.stopPropagation(),a.preventDefault(),c(this).scrollTop(b+c(this).scrollTop()))})}function b(){i=0;for(len=f.length;i'+f.eq(i).text()+"";f.eq(i).parent().is("optgroup")&&(void 0!==f.eq(i).parent().attr("class")&&(e=" "+f.eq(i).parent().attr("class")),a="'+f.eq(i).text()+"",f.eq(i).is(":first-child")&& -(a='
  • '+f.eq(i).parent().attr("label")+"
  • "+a));x+=a}}function g(){var s=new w,d=c("
    ');a.css({margin:0,padding:0}).after(d).prependTo(d); -var s=c("div.jq-selectbox__select",d),q=c("div.jq-selectbox__select-text",d),n=f.filter(":selected");n.length?q.html(n.text()):q.html(f.first().text());b();var p="";e.selectSearch&&(p='
    '+e.selectSearchNotFound+"
    ");var h=c('
    '+p+'
      '+ -x+"
    ");d.append(h);var l=c("ul",h),k=c("li",h),r=c("input",h),y=c("div.jq-selectbox__not-found",h).hide();k.lengthv&&(v=a.innerWidth(),B=a.width());a.css({display:"block"})});var p=d.clone().appendTo("body").width("auto"),t=p.width();p.remove();t==d.width()&&(q.width(B),v+=d.find("div.jq-selectbox__trigger").width());v>d.width()&&h.width(v); -a.css({position:"absolute",left:0,top:0,width:"100%",height:"100%",opacity:0});var u=d.outerHeight(),A=r.outerHeight(),z=l.css("max-height"),p=k.filter(".selected");1>p.length&&k.first().addClass("selected sel");void 0===k.data("li-height")&&k.data("li-height",k.outerHeight());var C=h.css("top");"auto"==h.css("left")&&h.css({left:0});"auto"==h.css("top")&&h.css({top:u});h.hide();p.length&&(f.first().text()!=n.text()&&d.addClass("changed"),d.data("jqfs-class",p.data("jqfs-class")),d.addClass(p.data("jqfs-class"))); -if(a.is(":disabled"))return d.addClass("disabled"),!1;s.click(function(){a.focus();c("div.jq-selectbox").filter(".opened").length&&e.onSelectClosed.call(c("div.jq-selectbox").filter(".opened"));if(!navigator.userAgent.match(/(iPad|iPhone|iPod)/g)){var b=k.data("li-height");if(e.selectSmartPositioning){var f=c(window),q=d.offset().top,n=f.height()-u-(q-f.scrollTop()),g=e.selectVisibleOptions,s=5*b,p=b*g;0g&&(s=p);0===g&&(p="auto");n>s+A+20?(h.height("auto").css({bottom:"auto",top:C}),g=function(){l.css("max-height", -Math.floor((n-20-A)/b)*b)},g(),l.css("max-height",p),"none"!=z&&l.css("max-height",z),nk.filter(":visible").length? -y.show():y.hide()}));m(l);return!1}});k.hover(function(){c(this).siblings().removeClass("selected")});k.filter(".selected").text();k.filter(".selected").text();k.filter(":not(.disabled):not(.optgroup)").click(function(){a.focus();var b=c(this),l=b.text();if(!b.is(".selected")){var k=b.index(),k=k-b.prevAll(".optgroup").length;b.addClass("selected sel").siblings().removeClass("selected sel");f.prop("selected",!1).eq(k).prop("selected",!0);q.html(l);d.data("jqfs-class")&&d.removeClass(d.data("jqfs-class")); -d.data("jqfs-class",b.data("jqfs-class"));d.addClass(b.data("jqfs-class"));a.change()}r.length&&(r.val("").keyup(),y.hide());h.hide();d.removeClass("opened");e.onSelectClosed.call(d)});h.mouseout(function(){c("li.sel",h).addClass("selected")});a.on("change.styler",function(){q.html(f.filter(":selected").text());k.removeClass("selected sel").not(".optgroup").eq(a[0].selectedIndex).addClass("selected sel");f.first().text()!=k.filter(".selected").text()?d.addClass("changed"):d.removeClass("changed")}).on("focus.styler", -function(){d.addClass("focused");c("div.jqselect").removeClass("opened")}).on("blur.styler",function(){d.removeClass("focused")}).on("keydown.styler keyup.styler",function(b){var c=k.data("li-height");q.html(f.filter(":selected").text());k.removeClass("selected sel").not(".optgroup").eq(a[0].selectedIndex).addClass("selected sel");38!=b.which&&37!=b.which&&33!=b.which&&36!=b.which||l.scrollTop(l.scrollTop()+k.filter(".selected").position().top);40!=b.which&&39!=b.which&&34!=b.which&&35!=b.which|| -l.scrollTop(l.scrollTop()+k.filter(".selected").position().top-l.innerHeight()+c);32==b.which&&b.preventDefault();13==b.which&&(b.preventDefault(),h.hide())});c(document).on("click",function(a){c(a.target).parents().hasClass("jq-selectbox")||"OPTION"==a.target.nodeName||(c("div.jq-selectbox").filter(".opened").length&&e.onSelectClosed.call(c("div.jq-selectbox").filter(".opened")),r.length&&r.val("").keyup(),h.hide().find("li.sel").addClass("selected"),d.removeClass("focused opened"))})}function t(){var e= -new w,d=c("');a.css({margin:0,padding:0}).after(d);b();d.append("
      "+x+"
    ");var g=c("ul",d).css({position:"relative","overflow-x":"hidden","-webkit-overflow-scrolling":"touch"}),n=c("li",d).attr("unselectable","on").css({"-webkit-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","-o-user-select":"none","user-select":"none","white-space":"nowrap"}), -e=a.attr("size"),p=g.outerHeight(),h=n.outerHeight();void 0!==e&&0d.height()&&(g.css("overflowY","scroll"),m(g),n.filter(".selected").length&&g.scrollTop(g.scrollTop()+n.filter(".selected").position().top));a.prependTo(d).css({position:"absolute",left:0,top:0,width:"100%",height:"100%",opacity:0});if(a.is(":disabled"))d.addClass("disabled"),f.each(function(){c(this).is(":selected")&&n.eq(c(this).index()).addClass("selected")});else if(n.filter(":not(.disabled):not(.optgroup)").click(function(b){a.trigger("focus.styler"); -var d=c(this);b.ctrlKey||b.metaKey||d.addClass("selected");b.shiftKey||d.addClass("first");b.ctrlKey||(b.metaKey||b.shiftKey)||d.siblings().removeClass("selected first");if(b.ctrlKey||b.metaKey)d.is(".selected")?d.removeClass("selected first"):d.addClass("selected first"),d.siblings().removeClass("first");if(b.shiftKey){var e=!1,g=!1;d.siblings().removeClass("selected").siblings(".first").addClass("selected");d.prevAll().each(function(){c(this).is(".first")&&(e=!0)});d.nextAll().each(function(){c(this).is(".first")&& -(g=!0)});e&&d.prevAll().each(function(){if(c(this).is(".selected"))return!1;c(this).not(".disabled, .optgroup").addClass("selected")});g&&d.nextAll().each(function(){if(c(this).is(".selected"))return!1;c(this).not(".disabled, .optgroup").addClass("selected")});1==n.filter(".selected").length&&d.addClass("first")}f.prop("selected",!1);n.filter(".selected").each(function(){var a=c(this),b=a.index();a.is(".option")&&(b-=a.prevAll(".optgroup").length);f.eq(b).prop("selected",!0)});a.trigger("change.styler")}), -f.each(function(a){c(this).data("optionIndex",a)}),a.on("change.styler",function(){n.removeClass("selected");var a=[];f.filter(":selected").each(function(){a.push(c(this).data("optionIndex"))});n.not(".optgroup").filter(function(b){return-1d.height())a.on("keydown.styler",function(a){38!=a.which&&37!=a.which&&33!=a.which||g.scrollTop(g.scrollTop()+ -n.filter(".selected").position().top-h);40!=a.which&&39!=a.which&&34!=a.which||g.scrollTop(g.scrollTop()+n.filter(".selected:last").position().top-g.innerHeight()+2*h)})}var f=c("option",a),x="";a.is("[multiple]")?t():g()};g();a.on("refresh",function(){a.off(".styler").parent().before(a).remove();g()})}});else if(a.is(":reset"))a.on("click",function(){setTimeout(function(){a.closest(e.wrapper).find("input, select").trigger("refresh")},1)})}).promise().done(function(){e.onFormStyled.call()})}})(jQuery); \ No newline at end of file +/* jQuery Form Styler v2.0.2 | (c) Dimox | https://github.com/Dimox/jQueryFormStyler */ +!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e($||require("jquery")):e(jQuery)}(function(e){"use strict";function t(t,s){this.element=t,this.options=e.extend({},l,s);var i=this.options.locale;void 0!==this.options.locales[i]&&e.extend(this.options,this.options.locales[i]),this.init()}function s(t){if(!e(t.target).parents().hasClass("jq-selectbox")&&"OPTION"!=t.target.nodeName&&e("div.jq-selectbox.opened").length){var s=e("div.jq-selectbox.opened"),l=e("div.jq-selectbox__search input",s),o=e("div.jq-selectbox__dropdown",s);s.find("select").data("_"+i).options.onSelectClosed.call(s),l.length&&l.val("").keyup(),o.hide().find("li.sel").addClass("selected"),s.removeClass("focused opened dropup dropdown")}}var i="styler",l={idSuffix:"-styler",filePlaceholder:"Файл не выбран",fileBrowse:"Обзор...",fileNumber:"Выбрано файлов: %s",selectPlaceholder:"Выберите...",selectSearch:!1,selectSearchLimit:10,selectSearchNotFound:"Совпадений не найдено",selectSearchPlaceholder:"Поиск...",selectVisibleOptions:0,selectSmartPositioning:!0,locale:"ru",locales:{en:{filePlaceholder:"No file selected",fileBrowse:"Browse...",fileNumber:"Selected files: %s",selectPlaceholder:"Select...",selectSearchNotFound:"No matches found",selectSearchPlaceholder:"Search..."}},onSelectOpened:function(){},onSelectClosed:function(){},onFormStyled:function(){}};t.prototype={init:function(){function t(){void 0!==i.attr("id")&&""!==i.attr("id")&&(this.id=i.attr("id")+l.idSuffix),this.title=i.attr("title"),this.classes=i.attr("class"),this.data=i.data()}var i=e(this.element),l=this.options,o=!(!navigator.userAgent.match(/(iPad|iPhone|iPod)/i)||navigator.userAgent.match(/(Windows\sPhone)/i)),a=!(!navigator.userAgent.match(/Android/i)||navigator.userAgent.match(/(Windows\sPhone)/i));if(i.is(":checkbox")){var d=function(){var s=new t,l=e('
    ').attr({id:s.id,title:s.title}).addClass(s.classes).data(s.data);i.after(l).prependTo(l),i.is(":checked")&&l.addClass("checked"),i.is(":disabled")&&l.addClass("disabled"),l.click(function(e){e.preventDefault(),i.triggerHandler("click"),l.is(".disabled")||(i.is(":checked")?(i.prop("checked",!1),l.removeClass("checked")):(i.prop("checked",!0),l.addClass("checked")),i.focus().change())}),i.closest("label").add('label[for="'+i.attr("id")+'"]').on("click.styler",function(t){e(t.target).is("a")||e(t.target).closest(l).length||(l.triggerHandler("click"),t.preventDefault())}),i.on("change.styler",function(){i.is(":checked")?l.addClass("checked"):l.removeClass("checked")}).on("keydown.styler",function(e){32==e.which&&l.click()}).on("focus.styler",function(){l.is(".disabled")||l.addClass("focused")}).on("blur.styler",function(){l.removeClass("focused")})};d(),i.on("refresh",function(){i.closest("label").add('label[for="'+i.attr("id")+'"]').off(".styler"),i.off(".styler").parent().before(i).remove(),d()})}else if(i.is(":radio")){var r=function(){var s=new t,l=e('
    ').attr({id:s.id,title:s.title}).addClass(s.classes).data(s.data);i.after(l).prependTo(l),i.is(":checked")&&l.addClass("checked"),i.is(":disabled")&&l.addClass("disabled"),e.fn.commonParents=function(){var t=this;return t.first().parents().filter(function(){return e(this).find(t).length===t.length})},e.fn.commonParent=function(){return e(this).commonParents().first()},l.click(function(t){if(t.preventDefault(),i.triggerHandler("click"),!l.is(".disabled")){var s=e('input[name="'+i.attr("name")+'"]');s.commonParent().find(s).prop("checked",!1).parent().removeClass("checked"),i.prop("checked",!0).parent().addClass("checked"),i.focus().change()}}),i.closest("label").add('label[for="'+i.attr("id")+'"]').on("click.styler",function(t){e(t.target).is("a")||e(t.target).closest(l).length||(l.triggerHandler("click"),t.preventDefault())}),i.on("change.styler",function(){i.parent().addClass("checked")}).on("focus.styler",function(){l.is(".disabled")||l.addClass("focused")}).on("blur.styler",function(){l.removeClass("focused")})};r(),i.on("refresh",function(){i.closest("label").add('label[for="'+i.attr("id")+'"]').off(".styler"),i.off(".styler").parent().before(i).remove(),r()})}else if(i.is(":file")){var c=function(){var s=new t,o=i.data("placeholder");void 0===o&&(o=l.filePlaceholder);var a=i.data("browse");void 0!==a&&""!==a||(a=l.fileBrowse);var d=e('
    '+o+'
    '+a+"
    ").attr({id:s.id,title:s.title}).addClass(s.classes).data(s.data);i.after(d).appendTo(d),i.is(":disabled")&&d.addClass("disabled");var r=i.val(),c=e("div.jq-file__name",d);r&&c.text(r.replace(/.+[\\\/]/,"")),i.on("change.styler",function(){var e=i.val();if(i.is("[multiple]")){e="";var t=i[0].files.length;if(t>0){var s=i.data("number");void 0===s&&(s=l.fileNumber),s=s.replace("%s",t),e=s}}c.text(e.replace(/.+[\\\/]/,"")),""===e?(c.text(o),d.removeClass("changed")):d.addClass("changed")}).on("focus.styler",function(){d.addClass("focused")}).on("blur.styler",function(){d.removeClass("focused")}).on("click.styler",function(){d.removeClass("focused")})};c(),i.on("refresh",function(){i.off(".styler").parent().before(i).remove(),c()})}else if(i.is('input[type="number"]')){var n=function(){var s=new t,l=e('
    ').attr({id:s.id,title:s.title}).addClass(s.classes).data(s.data);i.after(l).prependTo(l).wrap('
    '),i.is(":disabled")&&l.addClass("disabled");var o,a,d,r=null,c=null;void 0!==i.attr("min")&&(o=i.attr("min")),void 0!==i.attr("max")&&(a=i.attr("max")),d=void 0!==i.attr("step")&&e.isNumeric(i.attr("step"))?Number(i.attr("step")):Number(1);var n=function(t){var s,l=i.val();e.isNumeric(l)||(l=0,i.val("0")),t.is(".minus")?s=Number(l)-d:t.is(".plus")&&(s=Number(l)+d);var r=(d.toString().split(".")[1]||[]).length;if(r>0){for(var c="1";c.length<=r;)c+="0";s=Math.round(s*c)/c}e.isNumeric(o)&&e.isNumeric(a)?s>=o&&s<=a&&i.val(s):e.isNumeric(o)&&!e.isNumeric(a)?s>=o&&i.val(s):!e.isNumeric(o)&&e.isNumeric(a)?s<=a&&i.val(s):i.val(s)};l.is(".disabled")||(l.on("mousedown","div.jq-number__spin",function(){var t=e(this);n(t),r=setTimeout(function(){c=setInterval(function(){n(t)},40)},350)}).on("mouseup mouseout","div.jq-number__spin",function(){clearTimeout(r),clearInterval(c)}).on("mouseup","div.jq-number__spin",function(){i.change().trigger("input")}),i.on("focus.styler",function(){l.addClass("focused")}).on("blur.styler",function(){l.removeClass("focused")}))};n(),i.on("refresh",function(){i.off(".styler").closest(".jq-number").before(i).remove(),n()})}else if(i.is("select")){var f=function(){function d(e){var t=e.prop("scrollHeight")-e.outerHeight(),s=null,i=null;e.off("mousewheel DOMMouseScroll").on("mousewheel DOMMouseScroll",function(l){s=l.originalEvent.detail<0||l.originalEvent.wheelDelta>0?1:-1,((i=e.scrollTop())>=t&&s<0||i<=0&&s>0)&&(l.stopPropagation(),l.preventDefault())})}function r(){for(var e=0;e"+t.html()+"",t.parent().is("optgroup")&&(void 0!==t.parent().attr("class")&&(h=" "+t.parent().attr("class")),s=""+t.html()+"",t.is(":first-child")&&(s='
  • '+t.parent().attr("label")+"
  • "+s)),n+=s}}var c=e("option",i),n="";if(i.is("[multiple]")){if(a||o)return;!function(){var s=new t,l=e('
    ').attr({id:s.id,title:s.title}).addClass(s.classes).data(s.data);i.after(l),r(),l.append("
      "+n+"
    ");var o=e("ul",l),a=e("li",l),f=i.attr("size"),h=o.outerHeight(),u=a.outerHeight();void 0!==f&&f>0?o.css({height:u*f}):o.css({height:4*u}),h>l.height()&&(o.css("overflowY","scroll"),d(o),a.filter(".selected").length&&o.scrollTop(o.scrollTop()+a.filter(".selected").position().top)),i.prependTo(l),i.is(":disabled")?(l.addClass("disabled"),c.each(function(){e(this).is(":selected")&&a.eq(e(this).index()).addClass("selected")})):(a.filter(":not(.disabled):not(.optgroup)").click(function(t){i.focus();var s=e(this);if(t.ctrlKey||t.metaKey||s.addClass("selected"),t.shiftKey||s.addClass("first"),t.ctrlKey||t.metaKey||t.shiftKey||s.siblings().removeClass("selected first"),(t.ctrlKey||t.metaKey)&&(s.is(".selected")?s.removeClass("selected first"):s.addClass("selected first"),s.siblings().removeClass("first")),t.shiftKey){var l=!1,o=!1;s.siblings().removeClass("selected").siblings(".first").addClass("selected"),s.prevAll().each(function(){e(this).is(".first")&&(l=!0)}),s.nextAll().each(function(){e(this).is(".first")&&(o=!0)}),l&&s.prevAll().each(function(){if(e(this).is(".selected"))return!1;e(this).not(".disabled, .optgroup").addClass("selected")}),o&&s.nextAll().each(function(){if(e(this).is(".selected"))return!1;e(this).not(".disabled, .optgroup").addClass("selected")}),1==a.filter(".selected").length&&s.addClass("first")}c.prop("selected",!1),a.filter(".selected").each(function(){var t=e(this),s=t.index();t.is(".option")&&(s-=t.prevAll(".optgroup").length),c.eq(s).prop("selected",!0)}),i.change()}),c.each(function(t){e(this).data("optionIndex",t)}),i.on("change.styler",function(){a.removeClass("selected");var t=[];c.filter(":selected").each(function(){t.push(e(this).data("optionIndex"))}),a.not(".optgroup").filter(function(s){return e.inArray(s,t)>-1}).addClass("selected")}).on("focus.styler",function(){l.addClass("focused")}).on("blur.styler",function(){l.removeClass("focused")}),h>l.height()&&i.on("keydown.styler",function(e){38!=e.which&&37!=e.which&&33!=e.which||o.scrollTop(o.scrollTop()+a.filter(".selected").position().top-u),40!=e.which&&39!=e.which&&34!=e.which||o.scrollTop(o.scrollTop()+a.filter(".selected:last").position().top-o.innerHeight()+2*u)}))}()}else!function(){var a=new t,f="",h=i.data("placeholder"),u=i.data("search"),p=i.data("search-limit"),v=i.data("search-not-found"),m=i.data("search-placeholder"),g=i.data("smart-positioning");void 0===h&&(h=l.selectPlaceholder),void 0!==u&&""!==u||(u=l.selectSearch),void 0!==p&&""!==p||(p=l.selectSearchLimit),void 0!==v&&""!==v||(v=l.selectSearchNotFound),void 0===m&&(m=l.selectSearchPlaceholder),void 0!==g&&""!==g||(g=l.selectSmartPositioning);var b=e('
    ').attr({id:a.id,title:a.title}).addClass(a.classes).data(a.data);i.after(b).prependTo(b);var C=b.css("z-index");C=C>0?C:1;var x=e("div.jq-selectbox__select",b),y=e("div.jq-selectbox__select-text",b),w=c.filter(":selected");r(),u&&(f='
    '+v+"
    ");var q=e('
    '+f+"
      "+n+"
    ");b.append(q);var _=e("ul",q),j=e("li",q),k=e("input",q),S=e("div.jq-selectbox__not-found",q).hide();j.lengthT&&(T=t.innerWidth(),N=t.width())}),j.css({display:""}),y.is(".placeholder")&&y.width()>T)y.width(y.width());else{var P=b.clone().appendTo("body").width("auto"),H=P.outerWidth();P.remove(),H==b.outerWidth()&&y.width(N)}T>b.width()&&q.width(T),""===c.first().text()&&""!==i.data("placeholder")&&j.first().hide();var A=b.outerHeight(!0),D=k.parent().outerHeight(!0)||0,I=_.css("max-height"),K=j.filter(".selected");if(K.length<1&&j.first().addClass("selected sel"),void 0===j.data("li-height")){var O=j.outerHeight();!1!==h&&(O=j.eq(1).outerHeight()),j.data("li-height",O)}var M=q.css("top");if("auto"==q.css("left")&&q.css({left:0}),"auto"==q.css("top")&&(q.css({top:A}),M=A),q.hide(),K.length&&(c.first().text()!=w.text()&&b.addClass("changed"),b.data("jqfs-class",K.data("jqfs-class")),b.addClass(K.data("jqfs-class"))),i.is(":disabled"))return b.addClass("disabled"),!1;x.click(function(){if(e("div.jq-selectbox").filter(".opened").length&&l.onSelectClosed.call(e("div.jq-selectbox").filter(".opened")),i.focus(),!o){var t=e(window),s=j.data("li-height"),a=b.offset().top,r=t.height()-A-(a-t.scrollTop()),n=i.data("visible-options");void 0!==n&&""!==n||(n=l.selectVisibleOptions);var f=5*s,h=s*n;n>0&&n<6&&(f=h),0===n&&(h="auto");var u=function(){q.height("auto").css({bottom:"auto",top:M});var e=function(){_.css("max-height",Math.floor((r-20-D)/s)*s)};e(),_.css("max-height",h),"none"!=I&&_.css("max-height",I),rf+D+20?(u(),b.removeClass("dropup").addClass("dropdown")):(function(){q.height("auto").css({top:"auto",bottom:M});var e=function(){_.css("max-height",Math.floor((a-t.scrollTop()-20-D)/s)*s)};e(),_.css("max-height",h),"none"!=I&&_.css("max-height",I),a-t.scrollTop()-20f+D+20&&(u(),b.removeClass("dropup").addClass("dropdown")):(q.height("auto").css({bottom:"auto",top:M}),_.css("max-height",h),"none"!=I&&_.css("max-height",I)),b.offset().left+q.outerWidth()>t.width()&&q.css({left:"auto",right:0}),e("div.jqselect").css({zIndex:C-1}).removeClass("opened"),b.css({zIndex:C}),q.is(":hidden")?(e("div.jq-selectbox__dropdown:visible").hide(),q.show(),b.addClass("opened focused"),l.onSelectOpened.call(b)):(q.hide(),b.removeClass("opened dropup dropdown"),e("div.jq-selectbox").filter(".opened").length&&l.onSelectClosed.call(b)),k.length&&(k.val("").keyup(),S.hide(),k.keyup(function(){var t=e(this).val();j.each(function(){e(this).html().match(new RegExp(".*?"+t+".*?","i"))?e(this).show():e(this).hide()}),""===c.first().text()&&""!==i.data("placeholder")&&j.first().hide(),j.filter(":visible").length<1?S.show():S.hide()})),j.filter(".selected").length&&(""===i.val()?_.scrollTop(0):(_.innerHeight()/s%2!=0&&(s/=2),_.scrollTop(_.scrollTop()+j.filter(".selected").position().top-_.innerHeight()/2+s))),d(_)}}),j.hover(function(){e(this).siblings().removeClass("selected")});var W=j.filter(".selected").text();j.filter(":not(.disabled):not(.optgroup)").click(function(){i.focus();var t=e(this),s=t.text();if(!t.is(".selected")){var o=t.index();o-=t.prevAll(".optgroup").length,t.addClass("selected sel").siblings().removeClass("selected sel"),c.prop("selected",!1).eq(o).prop("selected",!0),W=s,y.text(s),b.data("jqfs-class")&&b.removeClass(b.data("jqfs-class")),b.data("jqfs-class",t.data("jqfs-class")),b.addClass(t.data("jqfs-class")),i.change()}q.hide(),b.removeClass("opened dropup dropdown"),l.onSelectClosed.call(b)}),q.mouseout(function(){e("li.sel",q).addClass("selected")}),i.on("change.styler",function(){y.text(c.filter(":selected").text()).removeClass("placeholder"),j.removeClass("selected sel").not(".optgroup").eq(i[0].selectedIndex).addClass("selected sel"),c.first().text()!=j.filter(".selected").text()?b.addClass("changed"):b.removeClass("changed")}).on("focus.styler",function(){b.addClass("focused"),e("div.jqselect").not(".focused").removeClass("opened dropup dropdown").find("div.jq-selectbox__dropdown").hide()}).on("blur.styler",function(){b.removeClass("focused")}).on("keydown.styler keyup.styler",function(e){var t=j.data("li-height");""===i.val()?y.text(h).addClass("placeholder"):y.text(c.filter(":selected").text()),j.removeClass("selected sel").not(".optgroup").eq(i[0].selectedIndex).addClass("selected sel"),38!=e.which&&37!=e.which&&33!=e.which&&36!=e.which||(""===i.val()?_.scrollTop(0):_.scrollTop(_.scrollTop()+j.filter(".selected").position().top)),40!=e.which&&39!=e.which&&34!=e.which&&35!=e.which||_.scrollTop(_.scrollTop()+j.filter(".selected").position().top-_.innerHeight()+t),13==e.which&&(e.preventDefault(),q.hide(),b.removeClass("opened dropup dropdown"),l.onSelectClosed.call(b))}).on("keydown.styler",function(e){32==e.which&&(e.preventDefault(),x.click())}),s.registered||(e(document).on("click",s),s.registered=!0)}()};f(),i.on("refresh",function(){i.off(".styler").parent().before(i).remove(),f()})}else i.is(":reset")&&i.on("click",function(){setTimeout(function(){i.closest("form").find("input, select").trigger("refresh")},1)})},destroy:function(){var t=e(this.element);t.is(":checkbox")||t.is(":radio")?(t.removeData("_"+i).off(".styler refresh").removeAttr("style").parent().before(t).remove(),t.closest("label").add('label[for="'+t.attr("id")+'"]').off(".styler")):t.is('input[type="number"]')?t.removeData("_"+i).off(".styler refresh").closest(".jq-number").before(t).remove():(t.is(":file")||t.is("select"))&&t.removeData("_"+i).off(".styler refresh").removeAttr("style").parent().before(t).remove()}},e.fn[i]=function(s){var l=arguments;if(void 0===s||"object"==typeof s)return this.each(function(){e.data(this,"_"+i)||e.data(this,"_"+i,new t(this,s))}).promise().done(function(){var t=e(this[0]).data("_"+i);t&&t.options.onFormStyled.call()}),this;if("string"==typeof s&&"_"!==s[0]&&"init"!==s){var o;return this.each(function(){var a=e.data(this,"_"+i);a instanceof t&&"function"==typeof a[s]&&(o=a[s].apply(a,Array.prototype.slice.call(l,1)))}),void 0!==o?o:this}},s.registered=!1}); \ No newline at end of file