вопрос
Не пойму в чем проблема , на версиях Dle 10/x Dle 11/x работает , скрин
на Dle 12 выше , ползунки исчезают, кнопки, кроме Подобрать, не работают, тестил на разных шаблонах, Скрин
Вот filter.js
Вот filter/jquery.ui.slider.min.js
Вот полный архив с хаком
smart-xfields-search-engine.zip [15.46 Kb] (cкачиваний: 39)
на Dle 12 выше , ползунки исчезают, кнопки, кроме Подобрать, не работают, тестил на разных шаблонах, Скрин
Вот filter.js
/*! Smart Xfields Search Engine
* Подготовил для вас: DomiTori
* http://dle.press
* Заходите в мой блог о DLE, там выложены полезные мелочи */
function move_Fvalue(e,ui0,ui1){
$(e+' .val1').stop().animate({left:$(e+' .ui-slider-handle').eq(0).css('left')},200).html( ui0?ui0:(e=='#xf_kinopoisk'?$( e ).slider( "values", 0 ).toFixed(1):$( e ).slider( "values", 0 )) );
$(e+' .val2').stop().animate({left:$(e+' .ui-slider-handle').eq(1).css('left')},200).html( ui1?ui1:(e=='#xf_kinopoisk'?$( e ).slider( "values", 1 ).toFixed(1):$( e ).slider( "values", 1 )) );
}
$(document).ready(function() {
$( "#xf_year" ).slider({
range: true,
min: 1970,
max: 2017,
step: 1,
values: [ 2000, 2015 ],
slide: function( event, ui ) {
move_Fvalue('#xf_year',ui.values[ 0 ],ui.values[ 1 ]);
},
stop: function( event, ui ) {
move_Fvalue('#xf_year',ui.values[ 0 ],ui.values[ 1 ]);
$('#xf_year .ui-slider-handle').each(function(i){
i++;
if($(this).hasClass('ui-state-focus')) {
$('#xf_year .filter-value').css({'z-index':0});
$('#xf_year .val'+i).css({'z-index':1});
}
});
}
})
.append('<div class="steps"><span class="s1">'+1970+'</span><span class="s2">'+1982+'</span><span class="s3">'+1993+'</span><span class="s4">'+2005+'</span><span class="s5">'+2016+'</span></div>');
move_Fvalue('#xf_year');
/*! $( "#xf_kinopoisk" ).slider({
range: true,
min: 1,
max: 10,
step: 0.1,
values: [ 5.5, 9.2 ],
slide: function( event, ui ) {
move_Fvalue('#xf_kinopoisk',ui.values[ 0 ].toFixed(1),ui.values[ 1 ].toFixed(1));
},
stop: function( event, ui ) {
move_Fvalue('#xf_kinopoisk',ui.values[ 0 ].toFixed(1),ui.values[ 1 ].toFixed(1));
$('#xf_kinopoisk .ui-slider-handle').each(function(i){
i++;
if($(this).hasClass('ui-state-focus')) {
$('#xf_kinopoisk .filter-value').css({'z-index':0});
$('#xf_kinopoisk .val'+i).css({'z-index':1});
}
});
}
})
.append('<div class="steps"><span class="s1">'+1.1+'</span><span class="s2">'+3.3+'</span><span class="s3">'+5.5+'</span><span class="s4">'+7.8+'</span><span class="s5">'+9.9+'</span></div>');
move_Fvalue('#xf_kinopoisk'); */
$('.filter-buttons .masha_index').remove();
$('.filter-buttons .cbtn').click(function(){
$(this).toggleClass('active');
})
.mouseleave(function(){
$(this).blur();
});
$('.filter-buttons .butt > span').click(function(){
list=$(this).parent().children('.list');
if( list.css('display')=='none' ) {
$('.filter-buttons .list').hide();
$('.filter-buttons .butt > span').removeClass('active');
$('.filter-buttons .butt .fa').removeClass('fa-rotate-180');
$(this).addClass('active').children('.fa').addClass('fa-rotate-180');
list.show();
} else {
$('.filter-buttons .list').hide();
$('.filter-buttons .butt > span').removeClass('active');
$('.filter-buttons .butt .fa').removeClass('fa-rotate-180');
}
});
$('.filter-buttons .offin #one-genre, .filter-buttons .offin #all-genres').click(function(){
$('.filter-buttons .offin span').removeClass('active');
$(this).addClass('active');
});
})
.click(function(e){
if($('.filter-buttons .butt .active').length==0)
return;
e=e||window.event;
var target=e.target||e.srcElement;
while(target)
{
if(target==$('.filter-buttons').get(0))
return;
target=target.parentNode;
}
$('.filter-buttons .list').hide();
$('.filter-buttons .butt > span').removeClass('active');
$('.filter-buttons .butt .fa').removeClass('fa-rotate-180');
})
.on('click', '.filter-buttons .butt.red, #filter-next', function() {
var genre = [],
xf_country = [],
cstart = $(this).data('cstart');
if($('#filter-next').length==0) $('#content').prepend('<div class="navigation-button"><a id="filter-next"></a></div>');
nextBtn = $('#filter-next');
i = 0;
$('#genre-id .cbtn').each(function(){
if( $(this).hasClass('active') ) {
genre[i] = $(this).data('id');
i++;
}
});
i = 0;
$('#xf_country .cbtn').each(function(){
if( $(this).hasClass('active') ) {
xf_country[i] = $(this).html();
i++;
}
});
if( !cstart ) cstart = 0;
xf_year_start = $('#xf_year .val1').html();
xf_year_end = $('#xf_year .val2').html();
xf_kinopoisk_start = $('#xf_kinopoisk .val1').html();
xf_kinopoisk_end = $('#xf_kinopoisk .val2').html();
gf = $('.filter-buttons .offin .active').index();
nextBtn.css({'text-indent':'-9999px','position':'relative','margin':'4px 0 -10px',backgroundColor:'#eee'}).animate({height:3,border:0,width:'100%'},'fast',function(){
$(this).append('<span></span>').children('span').animate({width:'50%'},'slow');
$.get("/engine/ajax/filter.php", {genre:genre,genre_filter:gf,xf_country:xf_country,xf_year_start:xf_year_start,xf_year_end:xf_year_end,xf_kinopoisk_start:xf_kinopoisk_start,xf_kinopoisk_end:xf_kinopoisk_end,cstart:cstart},
function(data){
nextBtn.children('span').animate({width:'100%'},'slow',function(){
if( cstart > 0 ) $('#content').append(data);
else $('#content').html(data);
$(this).parents('.navigation-button').fadeOut(200,function(){$(this).remove()});
});
}
);
});
return false;
});
$(window).resize(function(){
move_Fvalue('#xf_year');
move_Fvalue('#xf_kinopoisk');
});
Вот filter/jquery.ui.slider.min.js
/*! jQuery UI - v1.9.2 - 2016-01-24
* http://jqueryui.com
* Copyright jQuery Foundation and other contributors; Licensed MIT */
(function(e){var t=5;e.widget("ui.slider",e.ui.mouse,{version:"1.9.2",widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null},_create:function(){var i,s,n=this.options,a=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),o="<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",r=[];for(this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"+(n.disabled?" ui-slider-disabled ui-disabled":"")),this.range=e([]),n.range&&(n.range===!0&&(n.values||(n.values=[this._valueMin(),this._valueMin()]),n.values.length&&2!==n.values.length&&(n.values=[n.values[0],n.values[0]])),this.range=e("<div></div>").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+("min"===n.range||"max"===n.range?" ui-slider-range-"+n.range:""))),s=n.values&&n.values.length||1,i=a.length;s>i;i++)r.push(o);this.handles=a.add(e(r.join("")).appendTo(this.element)),this.handle=this.handles.eq(0),this.handles.add(this.range).filter("a").click(function(e){e.preventDefault()}).mouseenter(function(){n.disabled||e(this).addClass("ui-state-hover")}).mouseleave(function(){e(this).removeClass("ui-state-hover")}).focus(function(){n.disabled?e(this).blur():(e(".ui-slider .ui-state-focus").removeClass("ui-state-focus"),e(this).addClass("ui-state-focus"))}).blur(function(){e(this).removeClass("ui-state-focus")}),this.handles.each(function(t){e(this).data("ui-slider-handle-index",t)}),this._on(this.handles,{keydown:function(i){var s,n,a,o,r=e(i.target).data("ui-slider-handle-index");switch(i.keyCode){case e.ui.keyCode.HOME:case e.ui.keyCode.END:case e.ui.keyCode.PAGE_UP:case e.ui.keyCode.PAGE_DOWN:case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(i.preventDefault(),!this._keySliding&&(this._keySliding=!0,e(i.target).addClass("ui-state-active"),s=this._start(i,r),s===!1))return}switch(o=this.options.step,n=a=this.options.values&&this.options.values.length?this.values(r):this.value(),i.keyCode){case e.ui.keyCode.HOME:a=this._valueMin();break;case e.ui.keyCode.END:a=this._valueMax();break;case e.ui.keyCode.PAGE_UP:a=this._trimAlignValue(n+(this._valueMax()-this._valueMin())/t);break;case e.ui.keyCode.PAGE_DOWN:a=this._trimAlignValue(n-(this._valueMax()-this._valueMin())/t);break;case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:if(n===this._valueMax())return;a=this._trimAlignValue(n+o);break;case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(n===this._valueMin())return;a=this._trimAlignValue(n-o)}this._slide(i,r,a)},keyup:function(t){var i=e(t.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(t,i),this._change(t,i),e(t.target).removeClass("ui-state-active"))}}),this._refreshValue(),this._animateOff=!1},_destroy:function(){this.handles.remove(),this.range.remove(),this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all"),this._mouseDestroy()},_mouseCapture:function(t){var i,s,n,a,o,r,h,l,u=this,c=this.options;return c.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),i={x:t.pageX,y:t.pageY},s=this._normValueFromMouse(i),n=this._valueMax()-this._valueMin()+1,this.handles.each(function(t){var i=Math.abs(s-u.values(t));n>i&&(n=i,a=e(this),o=t)}),c.range===!0&&this.values(1)===c.min&&(o+=1,a=e(this.handles[o])),r=this._start(t,o),r===!1?!1:(this._mouseSliding=!0,this._handleIndex=o,a.addClass("ui-state-active").focus(),h=a.offset(),l=!e(t.target).parents().andSelf().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:t.pageX-h.left-a.width()/2,top:t.pageY-h.top-a.height()/2-(parseInt(a.css("borderTopWidth"),10)||0)-(parseInt(a.css("borderBottomWidth"),10)||0)+(parseInt(a.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(t,o,s),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(e){var t={x:e.pageX,y:e.pageY},i=this._normValueFromMouse(t);return this._slide(e,this._handleIndex,i),!1},_mouseStop:function(e){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(e,this._handleIndex),this._change(e,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(e){var t,i,s,n,a;return"horizontal"===this.orientation?(t=this.elementSize.width,i=e.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(t=this.elementSize.height,i=e.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),s=i/t,s>1&&(s=1),0>s&&(s=0),"vertical"===this.orientation&&(s=1-s),n=this._valueMax()-this._valueMin(),a=this._valueMin()+s*n,this._trimAlignValue(a)},_start:function(e,t){var i={handle:this.handles[t],value:this.value()};return this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._trigger("start",e,i)},_slide:function(e,t,i){var s,n,a;this.options.values&&this.options.values.length?(s=this.values(t?0:1),2===this.options.values.length&&this.options.range===!0&&(0===t&&i>s||1===t&&s>i)&&(i=s),i!==this.values(t)&&(n=this.values(),n[t]=i,a=this._trigger("slide",e,{handle:this.handles[t],value:i,values:n}),s=this.values(t?0:1),a!==!1&&this.values(t,i,!0))):i!==this.value()&&(a=this._trigger("slide",e,{handle:this.handles[t],value:i}),a!==!1&&this.value(i))},_stop:function(e,t){var i={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._trigger("stop",e,i)},_change:function(e,t){if(!this._keySliding&&!this._mouseSliding){var i={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._trigger("change",e,i)}},value:function(e){return arguments.length?(this.options.value=this._trimAlignValue(e),this._refreshValue(),this._change(null,0),undefined):this._value()},values:function(t,i){var s,n,a;if(arguments.length>1)return this.options.values[t]=this._trimAlignValue(i),this._refreshValue(),this._change(null,t),undefined;if(!arguments.length)return this._values();if(!e.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(t):this.value();for(s=this.options.values,n=arguments[0],a=0;s.length>a;a+=1)s[a]=this._trimAlignValue(n[a]),this._change(null,a);this._refreshValue()},_setOption:function(t,i){var s,n=0;switch(e.isArray(this.options.values)&&(n=this.options.values.length),e.Widget.prototype._setOption.apply(this,arguments),t){case"disabled":i?(this.handles.filter(".ui-state-focus").blur(),this.handles.removeClass("ui-state-hover"),this.handles.prop("disabled",!0),this.element.addClass("ui-disabled")):(this.handles.prop("disabled",!1),this.element.removeClass("ui-disabled"));break;case"orientation":this._detectOrientation(),this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation),this._refreshValue();break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),s=0;n>s;s+=1)this._change(null,s);this._animateOff=!1;break;case"min":case"max":this._animateOff=!0,this._refreshValue(),this._animateOff=!1}},_value:function(){var e=this.options.value;return e=this._trimAlignValue(e)},_values:function(e){var t,i,s;if(arguments.length)return t=this.options.values[e],t=this._trimAlignValue(t);for(i=this.options.values.slice(),s=0;i.length>s;s+=1)i[s]=this._trimAlignValue(i[s]);return i},_trimAlignValue:function(e){if(this._valueMin()>=e)return this._valueMin();if(e>=this._valueMax())return this._valueMax();var t=this.options.step>0?this.options.step:1,i=(e-this._valueMin())%t,s=e-i;return 2*Math.abs(i)>=t&&(s+=i>0?t:-t),parseFloat(s.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var t,i,s,n,a,o=this.options.range,r=this.options,h=this,l=this._animateOff?!1:r.animate,u={};this.options.values&&this.options.values.length?this.handles.each(function(s){i=100*((h.values(s)-h._valueMin())/(h._valueMax()-h._valueMin())),u["horizontal"===h.orientation?"left":"bottom"]=i+"%",e(this).stop(1,1)[l?"animate":"css"](u,r.animate),h.options.range===!0&&("horizontal"===h.orientation?(0===s&&h.range.stop(1,1)[l?"animate":"css"]({left:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({width:i-t+"%"},{queue:!1,duration:r.animate})):(0===s&&h.range.stop(1,1)[l?"animate":"css"]({bottom:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({height:i-t+"%"},{queue:!1,duration:r.animate}))),t=i}):(s=this.value(),n=this._valueMin(),a=this._valueMax(),i=a!==n?100*((s-n)/(a-n)):0,u["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[l?"animate":"css"](u,r.animate),"min"===o&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:i+"%"},r.animate),"max"===o&&"horizontal"===this.orientation&&this.range[l?"animate":"css"]({width:100-i+"%"},{queue:!1,duration:r.animate}),"min"===o&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:i+"%"},r.animate),"max"===o&&"vertical"===this.orientation&&this.range[l?"animate":"css"]({height:100-i+"%"},{queue:!1,duration:r.animate}))}})})(jQuery);
Вот полный архив с хаком
smart-xfields-search-engine.zip [15.46 Kb] (cкачиваний: 39)