PageSourceSearch

https://cdn.disco.re/static/common/js/disco/disco_scroll_view.4a17acc599e3.js

js disco.re collected 2026-10-01 14:07:39 UTC 10,438 bytes, 1 lines download raw bytes

1function DiscoScrollView(t){null!=t.curr_base?this._target=t.curr_base:this._target=$("#"+t.id),this._target.css("overflow","scroll"),this._target.css("-webkit-overflow-scrolling","touch"),this._params=t,this.is_active=!0,this._target.parent().append(this.getContent()),this._scrollview=this._target.parent().find("#"+t.id+"_sv"),this._btnEvents(),this._scrollview.css("display","none");var o=this;this._target.unbind("mouseover").mouseover((function(t){o._btnMouseOver(t)})),this._target.unbind("mouseout").mouseout((function(t){o._btnMouseOut(t)})),this._touchEvents(),$(window).resize((function(){null!=o._params&&o._touchEvents()}))}function DiscoScrollViewParams(){}function DiscoScrollViewNew(t){this._params=t,this.init()}function DiscoScrollViewNewParams(){this.base=null,this.btnYPos=0,this.zIndex=0,this.moveCount=1}$(document).ready((function(){})),DiscoScrollView.prototype.getContent=function(){var t="";return t+='<div style="position: absolute;top: '+this._params.btnYPos+"rem;width: 100%;pointer-events: none;text-align:center;"+(null!=this._params.zIndex?"z-index :"+this._params.zIndex:"")+'" id="'+this._params.id+'_sv">',t+='    <div class="dsv-box-div" style="text-align:left;">',t+='        <div class="dsv-btn-div" id="dsv_left_btn"><img src="https://cdn.disco.re/static/common/img/new/ico_left_1_4x.35b346798177.png" style="width:1rem;"></div>',t+="    </div>",t+='    <div class="dsv-box-div">',t+="    </div>",t+='    <div class="dsv-box-div" style="text-align:right;">',t+='        <div class="dsv-btn-div" id="dsv_right_btn"><img src="https://cdn.disco.re/static/common/img/new/ico_right_1_4x.39c849489b81.png" style="width:1rem;"></div>',t+="    </div>",t+="</div>"},DiscoScrollView.prototype._btnEvents=function(){var t=this;this._scrollview.find("#dsv_left_btn").unbind("mouseover").mouseover((function(o){clearTimeout(t._rollOutTimer)})),this._scrollview.find("#dsv_left_btn").unbind("mouseout").mouseout((function(o){t._rollOutTimer=setTimeout((function(){t._rollOutTimer=null,t._scrollview.css("display","none")}),100)})),this._scrollview.find("#dsv_left_btn").unbind("click").click((function(o){t._scrollMove("-")})),this._scrollview.find("#dsv_right_btn").unbind("mouseover").mouseover((function(o){clearTimeout(t._rollOutTimer)})),this._scrollview.find("#dsv_right_btn").unbind("mouseout").mouseout((function(o){t._rollOutTimer=setTimeout((function(){t._rollOutTimer=null,t._scrollview.css("display","none")}),100)})),this._scrollview.find("#dsv_right_btn").unbind("click").click((function(o){t._scrollMove("+")}))},DiscoScrollView.prototype._btnMouseOver=function(t){this.is_active&&(this._scrollview.css("display",""),clearTimeout(this._rollOutTimer))},DiscoScrollView.prototype._btnMouseOut=function(t){var o=this;clearTimeout(o._rollOutTimer),this._rollOutTimer=setTimeout((function(){o._rollOutTimer=null,o._scrollview.css("display","none")}),100)},DiscoScrollView.prototype._scrollMove=function(t){var o=this._target.scrollLeft()+parseInt(this._target.css("padding-left").replace(/[^-\d\.]/g,"")),e=parseInt(this._target.children(":first").css("width").replace(/[^-\d\.]/g,""))+parseInt(this._target.children(":first").css("margin-right").replace(/[^-\d\.]/g,"")),i=parseInt(o/e),s=this._params.leftMargin||parseInt(this._target.css("padding-left").replace(/[^-\d\.]/g,"")),r=!1;i!=this._params._offset&&(r=!0,this._params._offset=i);if("rem"==this._params.std){var l=$("html").css("font-size").split("px")[0];log(l),this._params.moveValue*parseInt(l)}else this._params.moveValue;if("+"==t){if((n=parseInt(this._params._offset+this._params.moveCount))<this._target.children().length){var c=this._target.scrollLeft()+this._target.children().eq(n).position().left;this._params._offset=n,this._target.stop().animate({scrollLeft:c-s},500)}}else{var n=parseInt(this._params._offset-this._params.moveCount);if(1==r&&(n+=1),n<0&&(n=0),n>=0&&n<this._target.children().length){c=this._target.scrollLeft()+this._target.children().eq(n).position().left;this._params._offset=n,this._target.stop().animate({scrollLeft:c-s},500)}}},DiscoScrollView.prototype.base_x_scroll=null,DiscoScrollView.prototype.is_touch=!1,DiscoScrollView.prototype.moveCheck=!1,DiscoScrollView.prototype.moveDirect="x",DiscoScrollView.prototype.from_y=null,DiscoScrollView.prototype.to_y=null,DiscoScrollView.prototype.from_x=null,DiscoScrollView.prototype.to_x=null,DiscoScrollView.prototype._touchEvents=function(){var t=this,o=null;this._target.unbind("touchstart").bind("touchstart",(function(e){if(null!=t.timer_scroll&&(clearTimeout(t.timer_scroll),t.timer_scroll=null),0==t.is_touch){o=e.timeStamp,t.base_x_scroll=t._target.scrollLeft();var i=e.originalEvent.touches[0];t.from_x=i.pageX,t.from_y=i.pageY,t.moveCheck=!1,t.is_touch=!0}})),this._target.unbind("touchmove").bind("touchmove",(function(o){var e=o.originalEvent.touches[0];1==t.is_touch&&(null!=t.timer_scroll&&(clearTimeout(t.timer_scroll),t.timer_scroll=null),t.moveCheck||(Math.abs(t.from_x-e.pageX)+5>Math.abs(t.from_y-e.pageY)?(t.moveCheck=!0,t.moveDirect="x"):(t.moveDirect="y",t.moveCheck=!0)),t.is_touch&&"x"==t.moveDirect&&(t.to_x=e.pageX))})),this._target.unbind("touchend").bind("touchend",(function(e){1==t.is_touch&&("x"==t.moveDirect&&t._scrollDetectByTouch(t.from_x-t.to_x,e.timeStamp-o),t.is_touch=!1)}))},DiscoScrollView.prototype._scrollPassiveMoveByTouch=function(t){if(0!=this.is_touch){var o="+";t<0&&(o="-",t*=-1);var e=this.base_x_scroll;"+"==o?e+=t:e-=t,this._target.scrollLeft(e)}},DiscoScrollView.prototype.timer_scroll=null,DiscoScrollView.prototype.isMoveByDetect=!1,DiscoScrollView.prototype._scrollDetectByTouch=function(t,o){var e=this;t<0&&(t*=-1),e.isMoveByDetect=!0,null!=e.timer_scroll&&(clearTimeout(e.timer_scroll),e.timer_scroll=null);var i=100,s=null,r=null;this._target.off("scroll").on("scroll",(function(t){if(null==s)s=t.timeStamp,r=$(this).scrollLeft();else{var o=$(this).scrollLeft(),l=t.timeStamp;i=l-s,s=l,Math.abs(o-r),r=o}e.isMoveByDetect&&e._scrollMoveByTouch(i+30),null!=e._params.scrollEvent&&e._params.scrollEvent()}))},DiscoScrollView.prototype._scrollMoveByTouch=function(t){var o=this,e=o._target.scrollLeft(),i=o._params.moveValue;e%i!=0&&(e%i>i/2?e+=i-e%i:e-=e%i);var s=o._target[0].scrollWidth-o._target[0].clientWidth;s<e?e=s-s%i:e<0&&(e=0),clearTimeout(o.timer_scroll),o.timer_scroll=null,o.timer_scroll=setTimeout((function(){null!=o.timer_scroll&&(o._target.scrollLeft(e),clearTimeout(o.timer_scroll),o.timer_scroll=null,o.isMoveByDetect=!1)}),t)},DiscoScrollView.prototype.setActive=function(t){this.is_active=t},DiscoScrollViewParams.prototype.id="",DiscoScrollViewParams.prototype.btnYPos=6.25,DiscoScrollViewParams.prototype.moveValue=50,DiscoScrollViewParams.prototype.moveCount=1,DiscoScrollViewParams.prototype._offset=0,DiscoScrollViewParams.prototype.std="rem",DiscoScrollViewParams.prototype.curr_base=null,DiscoScrollViewParams.prototype.scrollEvent=null,DiscoScrollViewParams.prototype.zIndex=null,DiscoScrollViewParams.prototype.leftMargin=null,DiscoScrollViewNew.prototype.init=function(){this._parent=this._params.base.parent(),this._parent.append(this.getContent()),this._parent.addClass("dsc-scroll-view-hover-event"),this._curr_base=this._parent.find(".dsc-scroll-btns-area");var t=this;this._params.base.unbind("scroll.arrow").bind("scroll.arrow",(function(){t.setScrollButton()})),this._curr_base.find(".dsc-scroll-btns-left").unbind("click").bind("click",(function(o){o.stopPropagation(),t.moveTo("left")})),this._curr_base.find(".dsc-scroll-btns-right").unbind("click").bind("click",(function(o){o.stopPropagation(),t.moveTo("right")})),this.setScrollButton()},DiscoScrollViewNew.prototype.getContent=function(){var t="";t+="background-image: url(&quot;
1"+this._params.leftBtnImage+"&quot;);",t+="transform: rotate("+this._params.leftBtnRotate+"deg);",t+="left:"+this._params.leftBtnOffset+";",t+="width:"+this._params.btnWidth+";height:"+this._params.btnWidth+";";var o="";return o+="background-image: url(&quot;"+this._params.rightBtnImage+"&quot;);",o+="transform: rotate("+this._params.rightBtnRotate+"deg);",o+="right:"+this._params.rightBtnOffset+";",o+="width:"+this._params.btnWidth+";height:"+this._params.btnWidth+";",'<div class="dsc-scroll-btns-area" style="top:'+this._params.btnYPos+';"><div class="dsc-scroll-btns-icon dsc-scroll-btns-left" style="'+t+'"></div><div class="dsc-scroll-btns-icon dsc-scroll-btns-right" style="'+o+'"></div></div>'},DiscoScrollViewNew.prototype.setScrollButton=function(){var t=this._params.base,o=t.prop("scrollWidth"),e=t.scrollLeft(),i=t.scrollLeft()+t.width(),s=this._curr_base.find(".dsc-scroll-btns-left"),r=this._curr_base.find(".dsc-scroll-btns-right");e>14?s.css("display",""):s.css("display","none"),i<o-14?r.css("display",""):r.css("display","none")},DiscoScrollViewNew.prototype.moveTo=function(t){var o=this._params.base.children(this._params.itemSelector),e=this._params.base,i=-1,s=this._params.moveCount;if("left"==t){for(var r=e.scrollLeft(),l=0;l<o.length;l++){if((c=this._getBtnsPosition_($(o[l]))).left>=r){i=l;break}}(i-=s)<0&&(i=0);var c=this._getBtnsPosition_($(o[i]));e.animate({scrollLeft:c.left},this._params.animateDuration)}else if("right"==t){var n=e.scrollLeft()+e.width();for(l=0;l<o.length;l++){if((c=this._getBtnsPosition_($(o[l]))).right>=n){i=l;break}}-1==i&&(i=o.length-1),(i+=s)>o.length-1&&(i=o.length-1);var a=(c=this._getBtnsPosition_($(o[i]))).right-e.width();e.animate({scrollLeft:a},this._params.animateDuration)}},DiscoScrollViewNew.prototype._getBtnsPosition_=function(t){var o=this._params.base.scrollLeft();return{left:t.position().left+o,right:t.position().left+t.width()+o}},DiscoScrollViewNewParams.prototype.base=null,DiscoScrollViewNewParams.prototype.btnYPos=0,DiscoScrollViewNewParams.prototype.zIndex=0,DiscoScrollViewNewParams.prototype.moveCount=1,DiscoScrollViewNewParams.prototype.btnWidth="30px",DiscoScrollViewNewParams.prototype.leftBtnImage="https://cdn.disco.re/static/common/img/new/[email protected]",DiscoScrollViewNewParams.prototype.leftBtnRotate="0",DiscoScrollViewNewParams.prototype.leftBtnOffset="0",DiscoScrollViewNewParams.prototype.rightBtnImage="https://cdn.disco.re/static/common/img/new/[email protected]",DiscoScrollViewNewParams.prototype.rightBtnRotate="0",DiscoScrollViewNewParams.prototype.rightBtnOffset="0",DiscoScrollViewNewParams.prototype.itemSelector="div",DiscoScrollViewNewParams.prototype.animateDuration=300;

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.