uawdijnntqw1x1x1
IP : 216.73.216.110
Hostname : 6.87.74.97.host.secureserver.net
Kernel : Linux 6.87.74.97.host.secureserver.net 4.18.0-553.83.1.el8_10.x86_64 #1 SMP Mon Nov 10 04:22:44 EST 2025 x86_64
Disable Function : None :)
OS : Linux
PATH:
/
home
/
emeraadmin
/
.cpanel
/
..
/
public_html
/
logs
/
..
/
node_modules
/
..
/
4d695
/
bootstrap-slider.tar
/
/
tpl/index.tpl000064400000112016151676726750007222 0ustar00<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content="Examples for bootstrap-slider plugin"> <meta name="author" content=""> <title>Slider for Bootstrap Examples Page</title> <!-- core CSS --> <link href="<%= css.bootstrap %>" rel="stylesheet"> <link href="<%= css.slider %>" rel="stylesheet"> <!-- Hightlight.js Theme Styles --> <link href="<%= css.highlightjs %>" rel="stylesheet"> <!-- Custom styles for this template --> <style type='text/css'> /* Space out content a bit */ body { padding-top: 20px; padding-bottom: 20px; } h1 small { font-size: 51%; } /* Everything but the jumbotron gets side spacing for mobile first views */ .header, .marketing, .footer { padding-left: 15px; padding-right: 15px; } /* Custom page header */ .header { border-bottom: 1px solid #e5e5e5; } /* Make the masthead heading the same height as the navigation */ .header h3 { margin-top: 0; margin-bottom: 0; line-height: 40px; padding-bottom: 19px; } /* Custom page footer */ .footer { padding-top: 19px; color: #777; border-top: 1px solid #e5e5e5; } /* Customize container */ .container { min-width: 640px; } @media (min-width: 768px) { .container { max-width: 1000px; } } .container-narrow > hr { margin: 30px 0; } /* Main marketing message and sign up button */ .title { text-align: center; border-bottom: 1px solid #e5e5e5; } /* Responsive: Portrait tablets and up */ @media screen and (min-width: 768px) { /* Remove the padding we set earlier */ .header, .footer { padding-left: 0; padding-right: 0; } /* Space out the masthead */ .header { margin-bottom: 30px; } /* Remove the bottom border on the jumbotron for visual effect */ .title { border-bottom: 0; } } .well { background-color: #E0E0E0; } .slider-example { padding-top: 10px; padding-bottom: 55px; margin: 35px 0; } #destroyEx5Slider, #ex6CurrentSliderValLabel, #ex7-enabled { margin-left: 45px; } #ex6SliderVal { color: green; } #slider12a .slider-track-high, #slider12c .slider-track-high { background: green; } #slider12b .slider-track-low, #slider12c .slider-track-low { background: red; } #slider12c .slider-selection { background: yellow; } #slider22 .slider-selection { background: #2196f3; } #slider22 .slider-rangeHighlight { background: #f70616; } #slider22 .slider-rangeHighlight.category1 { background: #FF9900; } #slider22 .slider-rangeHighlight.category2 { background: #99CC00; } </style> <style type='text/css'> /* Example 1 custom styles */ #ex1Slider .slider-selection { background: #BABABA; } /* Example 3 custom styles */ #RGB { height: 20px; background: rgb(128, 128, 128); } #RC .slider-selection { background: #FF8282; } #RC .slider-handle { background: red; } #GC .slider-selection { background: #428041; } #GC .slider-handle { background: green; } #BC .slider-selection { background: #8283FF; } #BC .slider-handle { border-bottom-color: blue; } #R, #G, #B { width: 300px; } </style> <script type='text/javascript' src="<%= js.modernizr %>"></script> <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries --> <!--[if lt IE 9]> <script src="../../assets/js/html5shiv.js"></script> <script src="../../assets/js/respond.min.js"></script> <![endif]--> <!-- Highlight.js Styles --> </head> <body> <div class="container"> <div class="jumbotron"> <h1>Slider for Bootstrap <small>bootstrap-slider.js</small></h1> <p class="lead">Examples for the <a target="_blank" href="https://github.com/seiyria/bootstrap-slider">bootstrap-slider</a> component.<p> </div> <div class="examples"> <div id="example-1" class='slider-example'> <h3>Example 1:</h3> <p>Basic example with custom formatter and colored selected region via CSS.</p> <div class="well"> <input id="ex1" data-slider-id='ex1Slider' type="text" data-slider-min="0" data-slider-max="20" data-slider-step="1" data-slider-value="14"/> </div> <h5>HTML</h5> <pre><code class="html"> <input id="ex1" data-slider-id='ex1Slider' type="text" data-slider-min="0" data-slider-max="20" data-slider-step="1" data-slider-value="14"/> </code></pre> <h5>JavaScript</h5> <pre><code class="js"> // With JQuery $('#ex1').slider({ formatter: function(value) { return 'Current value: ' + value; } }); // Without JQuery var slider = new Slider('#ex1', { formatter: function(value) { return 'Current value: ' + value; } }); </code></pre> <h5>CSS</h5> <pre><code class="css"> #ex1Slider .slider-selection { background: #BABABA; } </code></pre> </div> <div id="example-2" class='slider-example'> <h3>Example 2:</h3> <p>Range selector, options specified via data attribute.</p> <div class="well"> Filter by price interval: <b>€ 10</b> <input id="ex2" type="text" class="span2" value="" data-slider-min="10" data-slider-max="1000" data-slider-step="5" data-slider-value="[250,450]"/> <b>€ 1000</b> </div> <h5>HTML</h5> <pre><code class="html"> Filter by price interval: <b>€ 10</b> <input id="ex2" type="text" class="span2" value="" data-slider-min="10" data-slider-max="1000" data-slider-step="5" data-slider-value="[250,450]"/> <b>€ 1000</b> </code></pre> <h5>JavaScript</h5> <pre><code class="js"> // With JQuery $("#ex2").slider({}); // Without JQuery var slider = new Slider('#ex2', {}); </code></pre> </div> <div id="example-3" class='slider-example'> <h3>Example 3:</h3> <p>Using events to work with the values and style the selection and handles via CSS. The tooltip is disabled and diferent shapes for the handles.</p> <div class="well"> <p> <b>R</b> <input type="text" class="span2" value="" data-slider-min="0" data-slider-max="255" data-slider-step="1" data-slider-value="128" data-slider-id="RC" id="R" data-slider-tooltip="hide" data-slider-handle="square" /> </p> <p> <b>G</b> <input type="text" class="span2" value="" data-slider-min="0" data-slider-max="255" data-slider-step="1" data-slider-value="128" data-slider-id="GC" id="G" data-slider-tooltip="hide" data-slider-handle="round" /> </p> <p> <b>B</b> <input type="text" class="span2" value="" data-slider-min="0" data-slider-max="255" data-slider-step="1" data-slider-value="128" data-slider-id="BC" id="B" data-slider-tooltip="hide" data-slider-handle="triangle" /> </p> <div id="RGB"></div> </div> <h5>HTML</h5> <pre><code class="html"> <p> <b>R</b> <input type="text" class="span2" value="" data-slider-min="0" data-slider-max="255" data-slider-step="1" data-slider-value="128" data-slider-id="RC" id="R" data-slider-tooltip="hide" data-slider-handle="square" /> </p> <p> <b>G</b> <input type="text" class="span2" value="" data-slider-min="0" data-slider-max="255" data-slider-step="1" data-slider-value="128" data-slider-id="GC" id="G" data-slider-tooltip="hide" data-slider-handle="round" /> </p> <p> <b>B</b> <input type="text" class="span2" value="" data-slider-min="0" data-slider-max="255" data-slider-step="1" data-slider-value="128" data-slider-id="BC" id="B" data-slider-tooltip="hide" data-slider-handle="triangle" /> </p> <div id="RGB"></div> </code></pre> <h5>JavaScript</h5> <pre><code class="js"> var RGBChange = function() { $('#RGB').css('background', 'rgb('+r.getValue()+','+g.getValue()+','+b.getValue()+')') }; var r = $('#R').slider() .on('slide', RGBChange) .data('slider'); var g = $('#G').slider() .on('slide', RGBChange) .data('slider'); var b = $('#B').slider() .on('slide', RGBChange) .data('slider'); </code></pre> <h5>CSS</h5> <pre><code class="css"> #RGB { height: 20px; background: rgb(128, 128, 128); } #RC .slider-selection { background: #FF8282; } #RC .slider-handle { background: red; } #GC .slider-selection { background: #428041; } #GC .slider-handle { background: green; } #BC .slider-selection { background: #8283FF; } #BC .slider-handle { border-bottom-color: blue; } #R, #G, #B { width: 300px; } </code></pre> </div> <div id="example-4" class='slider-example'> <h3>Example 4:</h3> <p>Vertical Slider with reversed values (largest to smallest).</p> <div class="well"> <input id="ex4" type="text" data-slider-min="-5" data-slider-max="20" data-slider-step="1" data-slider-value="-3" data-slider-orientation="vertical"/> </div> <h5>HTML</h5> <pre><code class="html"> <input id="ex4" type="text" data-slider-min="-5" data-slider-max="20" data-slider-step="1" data-slider-value="-3" data-slider-orientation="vertical"/> </code></pre> <h5>JavaScript</h5> <pre><code class="js"> // With JQuery $("#ex4").slider({ reversed : true }); // Without JQuery var slider = new Slider("#ex4", { reversed : true }); </code></pre> </div> <div id="example-5" class='slider-example'> <h3>Example 5:</h3> <p>Destroy instance of slider by calling destroy() method on slider instance via JavaScript. <div class="well"> <input id="ex5" type="text" data-slider-min="-5" data-slider-max="20" data-slider-step="1" data-slider-value="0"/> <button id="destroyEx5Slider" class='btn btn-danger'>Click to Destroy</button> </div> <h5>HTML</h5> <pre><code class="html"> <input id="ex5" type="text" data-slider-min="-5" data-slider-max="20" data-slider-step="1" data-slider-value="0"/> <button id="destroyEx5Slider" class='btn btn-danger'>Click to Destroy</button> </code></pre> <h5>JavaScript</h5> <pre><code class="js"> // With JQuery $("#ex5").slider(); // Without JQuery var slider = new Slider('#ex5'); $("#destroyEx5Slider").click(function() { // With JQuery $("#ex5").slider('destroy'); // Without JQuery slider.destroy(); }); </code></pre> </div> <div id="example-6" class='slider-example'> <h3>Example 6:</h3> <p>Able to bind to 'slide' JQuery event on slider, which is triggered whenever the slider is used.</p> <div class="well"> <input id="ex6" type="text" data-slider-min="-5" data-slider-max="20" data-slider-step="1" data-slider-value="3"/> <span id="ex6CurrentSliderValLabel">Current Slider Value: <span id="ex6SliderVal">3</span></span> </div> <h5>HTML</h5> <pre><code class="html"> <input id="ex6" type="text" data-slider-min="-5" data-slider-max="20" data-slider-step="1" data-slider-value="3"/> <span id="ex6CurrentSliderValLabel">Current Slider Value: <span id="ex6SliderVal">3</span></span> </code></pre> <h5>JavaScript</h5> <pre><code class="js"> // With JQuery $("#ex6").slider(); $("#ex6").on("slide", function(slideEvt) { $("#ex6SliderVal").text(slideEvt.value); }); // Without JQuery var slider = new Slider("#ex6"); slider.on("slide", function(sliderValue) { document.getElementById("ex6SliderVal").textContent = sliderValue; }); </code></pre> </code></pre> </div> <div id="example-7" class='slider-example'> <h3>Example 7:</h3> <p>Sliders can be enabled and disabled.</p> <div class="well"> <input id="ex7" type="text" data-slider-min="0" data-slider-max="20" data-slider-step="1" data-slider-value="5" data-slider-enabled="false"/> <input id="ex7-enabled" type="checkbox"/> Enabled </div> <h5>HTML</h5> <pre><code class="html"> <input id="ex7" type="text" data-slider-min="0" data-slider-max="20" data-slider-step="1" data-slider-value="5" data-slider-enabled="false"/> <input id="ex7-enabled" type="checkbox"/> Enabled </code></pre> <h5>JavaScript</h5> <pre><code class="js"> // With JQuery $("#ex7").slider(); // Without JQuery var slider = new Slider("#ex7"); $("#ex7-enabled").click(function() { if(this.checked) { // With JQuery $("#ex7").slider("enable"); // Without JQuery slider.enable(); } else { // With JQuery $("#ex7").slider("disable"); // Without JQuery slider.disable(); } }); </code></pre> </div> <div id="example-8" class='slider-example'> <h3>Example 8:</h3> <p>Tooltip can always be displayed.</p> <div class="well"> <input id="ex8" data-slider-id='ex1Slider' type="text" data-slider-min="0" data-slider-max="20" data-slider-step="1" data-slider-value="14"/> </div> <h5>HTML</h5> <pre><code class="html"> <input id="ex8" data-slider-id='ex1Slider' type="text" data-slider-min="0" data-slider-max="20" data-slider-step="1" data-slider-value="14"/> </code></pre> <h5>JavaScript</h5> <pre><code class="js"> // With JQuery $("#ex8").slider({ tooltip: 'always' }); // Without JQuery var slider = new Slider("#ex8", { tooltip: 'always' }); </code></pre> </div> <div id="example-9" class='slider-example'> <h3>Example 9:</h3> <p>Precision (number of places after the decimal) can be specified.</p> <div class="well"> <input id="ex9" type="text"/> </div> <h5>HTML</h5> <pre><code class="html"> <input id="ex9" type="text"/> </code></pre> <h5>JavaScript</h5> <pre><code class="js"> // With JQuery $("#ex9").slider({ precision: 2, value: 8.115 // Slider will instantiate showing 8.12 due to specified precision }); // Without JQuery var slider = new Slider("#ex9", { precision: 2, value: 8.115 // Slider will instantiate showing 8.12 due to specified precision }); </code></pre> </div> <div id="example-10" class='slider-example'> <h3>Example 10:</h3> <p>Setting custom handlers.</p> <div class="well"> <input id="ex10" type="text" data-slider-handle="custom"/> </div> <h5>HTML</h5> <pre><code class="html"> <input id="ex10" type="text" data-slider-handle="custom"/> </code></pre> <h5>JavaScript</h5> <pre><code class="js"> // With JQuery $("#ex10").slider({}); // Without JQuery var slider = new Slider("#ex10", {}); </code></pre> <h5>CSS</h5> <pre><code class="css"> .slider-handle.custom { background: transparent none; /* You can customize the handle and set a background image */ } /* Or display content like unicode characters or fontawesome icons */ .slider-handle.custom::before { line-height: 20px; font-size: 20px; content: '\2605'; /*unicode star character*/ color: #726204; } </code></pre> </div> <div id="example-11" class='slider-example'> <h3>Example 11:</h3> <p>Using a custom step interval.</p> <div class="well"> <input id="ex11" type="text" data-slider-handle="custom"/> </div> <h5>HTML</h5> <pre><code class="html"> <input id="ex11" type="text" data-slider-handle="custom"/> </code></pre> <h5>JavaScript</h5> <pre><code class="js"> // With JQuery $("#ex11").slider({step: 20000, min: 0, max: 200000}); // Without JQuery var slider = new Slider("#ex11", { step: 20000, min: 0, max: 200000 }); </code></pre> </div> <div id="example-12" class='slider-example'> <h3>Example 12:</h3> <p>Coloring the low and high track segments.</p> <div class="well"> Single-value slider, high track:<br/> <input id="ex12a" type="text"/><br/> Note that there is no low track on the single-value slider. The area lesser than the value of the handle is the selection. <br/><br/> Range slider, low track:<br/> <input id="ex12b" type="text"/> <br/><br/> Range slider, low and high tracks, and selection:<br/> <input id="ex12c" type="text"/> </div> <h5>HTML</h5> <pre><code class="html"> <!-- Single-value slider, high track: --> <input id="ex12a" type="text"/><br/> Note that there is no low track on the single-value slider. The area to lesser than the value of the handle is the selection. <!-- Range slider, low track: --> <input id="ex12b" type="text"/><br/> <!-- Range slider, low and high tracks, and selection: --> <input id="ex12c" type="text"/><br/> </code></pre> <h5>JavaScript</h5> <pre><code class="js"> // With JQuery $("#ex12a").slider({ id: "slider12a", min: 0, max: 10, value: 5 }); $("#ex12b").slider({ id: "slider12b", min: 0, max: 10, range: true, value: [3, 7] }); $("#ex12c").slider({ id: "slider12c", min: 0, max: 10, range: true, value: [3, 7] }); // Without JQuery var sliderA = new Slider("#ex12a", { id: "slider12a", min: 0, max: 10, value: 5 }); var sliderB = new Slider("#ex12b", { id: "slider12b", min: 0, max: 10, range: true, value: [3, 7] }); var sliderC = new Slider("#ex12c", { id: "slider12c", min: 0, max: 10, range: true, value: [3, 7] }); </code></pre> <h5>CSS</h5> <pre><code class="css"> #slider12a .slider-track-high, #slider12c .slider-track-high { background: green; } #slider12b .slider-track-low, #slider12c .slider-track-low { background: red; } #slider12c .slider-selection { background: yellow; } </code></pre> </div> <div id="example-13" class='slider-example'> <h3>Example 13:</h3> <p>Using tick marks and labels.</p> <div class="well"> <input id="ex13" type="text"/> </div> <h5>HTML</h5> <pre><code class="html"> <input id="ex13" type="text" data-slider-ticks="[0, 100, 200, 300, 400]" data-slider-ticks-snap-bounds="30" data-slider-ticks-labels='["$0", "$100", "$200", "$300", "$400"]'/> </code></pre> <h5>JavaScript</h5> <pre><code class="js"> // With JQuery $("#ex13").slider({ ticks: [0, 100, 200, 300, 400], ticks_labels: ['$0', '$100', '$200', '$300', '$400'], ticks_snap_bounds: 30 }); // Without JQuery var slider = new Slider("#ex13", { ticks: [0, 100, 200, 300, 400], ticks_labels: ['$0', '$100', '$200', '$300', '$400'], ticks_snap_bounds: 30 }); </code></pre> </div> <div id="example-14" class='slider-example'> <h3>Example 14:</h3> <p>Using tick marks at specific positions..</p> <div class="well"> <input id="ex14" type="text"/> </div> <h5>HTML</h5> <pre><code class="html"> <input id="ex14" type="text" data-slider-ticks="[0, 100, 200, 300, 400]" data-slider-ticks-snap-bounds="30" data-slider-ticks-labels='["$0", "$100", "$200", "$300", "$400"]' data-slider-ticks-positions="[0, 30, 70, 90, 100]" /> </code></pre> <h5>JavaScript</h5> <pre><code class="js"> // With JQuery $("#ex14").slider({ ticks: [0, 100, 200, 300, 400], ticks_positions: [0, 30, 70, 90, 100], ticks_labels: ['$0', '$100', '$200', '$300', '$400'], ticks_snap_bounds: 30 }); // Without JQuery var slider = new Slider("#ex14", { ticks: [0, 100, 200, 300, 400], ticks_positions: [0, 30, 70, 90, 100], ticks_labels: ['$0', '$100', '$200', '$300', '$400'], ticks_snap_bounds: 30 }); </code></pre> </div> <div id="example-15" class='slider-example'> <h3>Example 15:</h3> <p>With a logarithmic scale.</p> <div class="well"> <input id="ex15" type="text" data-slider-min="1000" data-slider-max="10000000" data-slider-step="5" /> </div> <h5>HTML</h5> <pre><code class="html"> <input id="ex15" type="text" data-slider-min="1000" data-slider-max="10000000" data-slider-step="5" /> </code></pre> <h5>JavaScript</h5> <pre><code class="js"> // With JQuery $("#ex15").slider({ min: 1000, max: 10000000, scale: 'logarithmic', step: 10 }); // Without JQuery var slider = new Slider('#ex15', { min: 1000, max: 10000000, scale: 'logarithmic', step: 10 }); </code></pre> </div> <div id="example-16" class="slider-example"> <h3>Example 16:</h3> <p>Focus the slider handle after a value change.</p> <div class="well"> Single-value slider:<br/> <input id="ex16a" type="text"/><br/> <br/><br/> Range slider:<br/> <input id="ex16b" type="text"/> </div> <h5>HTML</h5> <pre><code class="html"> <!-- Single-value slider: --> <input id="ex16a" type="text"/><br/> <!-- Range slider: --> <input id="ex16b" type="text"/><br/> Note that the slider handle that caused the value change is focused. </code></pre> <h5>JavaScript</h5> <pre><code class="js"> // With JQuery $("#ex16a").slider({ min: 0, max: 10, value: 0, focus: true }); $("#ex16b").slider({ min: 0, max: 10, value: [0, 10], focus: true }); // Without JQuery var sliderA = new Slider("#ex16a", { min: 0, max: 10, value: 0, focus: true }); var sliderB = new Slider("#ex16b", { min: 0, max: 10, value: [0, 10], focus: true }); </code></pre> </div> <div id="example-17" class="slider-example"> <h3>Example 17:</h3> <p>Unusual tooltip positions</p> <div class="well"> Horizontal slider with tooltip on the bottom<br/><br/> <input id="ex17a" type="text"/><br/><br/><br/> Vertical slider with tooltip on the left<br/><br/> <input id="ex17b" type="text"/> </div> <h5>HTML</h5> <pre><code class="html"> <input id="ex17a" type="text"/> <input id="ex17b" type="text"/> </code></pre> <h5>JS</h5> <pre><code class="js"> // With JQuery $("#ex17a").slider({ min: 0, max: 10, value: 0, tooltip_position:'bottom' }); $("#ex17b").slider({ min: 0, max: 10, value: 0, orientation: 'vertical', tooltip_position:'left' }); // Without JQuery var sliderA = new Slider("#ex17a", { min: 0, max: 10, value: 0, tooltip_position:'bottom' }); var sliderB = new Slider("#ex17b", { min: 0, max: 10, value: 0, orientation: 'vertical', tooltip_position:'left' }); </code></pre> </div> <div id="example-18" class="slider-example"> <h3>Example 18:</h3> <p>Accessibility with ARIA labels</p> <div class="well"> Slider with single value and label:<br/><br/> <span id="ex18-label-1" class="hidden"> Example slider label </span> <input id="ex18a" type="text" /><br/><br/><br/> Range slider with multiple labels:<br/><br/> <span id="ex18-label-2a" class="hidden"> Example low value </span> <span id="ex18-label-2b" class="hidden"> Example high value </span> <input id="ex18b" type="text" /> </div> <h5>HTML</h5> <pre><code class="html"> <span id="ex18-label-1" class="hidden">Example slider label</span> <input id="ex18a" type="text"/> <span id="ex18-label-2a" class="hidden">Example low value</span> <span id="ex18-label-2b" class="hidden">Example high value</span> <input id="ex18b" type="text"/> </pre></code> <h5>JavaScript</h5> <pre><code class="js"> // With JQuery $("#ex18a").slider({ min: 0, max: 10, value: 5, labelledby: 'ex18-label-1' }); $("#ex18b").slider({ min: 0, max: 10, value: [3, 6], labelledby: ['ex18-label-2a', 'ex18-label-2b'] }); // Without JQuery var sliderA = new Slider("#ex18a", { min: 0, max: 10, value: 5, labelledby: 'ex18-label-1' }); var sliderB = new Slider("#ex18b", { min: 0, max: 10, value: [3, 6], labelledby: ['ex18-label-2a', 'ex18-label-2b'] }); </pre></code> </div> <div id="example-19" class="slider-example"> <h3>Example 19:</h3> <p>Auto-Register data-provide="slider" Elements</p> <div class="well"> Slider-Element not accompanied by any custom Javascript:<br/><br/> <span id="ex18-label-1" class="hidden"> Example slider label </span> <input id="ex19" type="text" data-provide="slider" data-slider-ticks="[1, 2, 3]" data-slider-ticks-labels='["short", "medium", "long"]' data-slider-min="1" data-slider-max="3" data-slider-step="1" data-slider-value="3" data-slider-tooltip="hide" /> </div> <h5>HTML</h5> <pre><code class="html"> <span id="ex18-label-1" class="hidden">Example slider label</span> <input id="ex19" type="text" data-provide="slider" data-slider-ticks="[1, 2, 3]" data-slider-ticks-labels='["short", "medium", "long"]' data-slider-min="1" data-slider-max="3" data-slider-step="1" data-slider-value="3" data-slider-tooltip="hide" /> </pre></code> </div> <div id="example-20" class="slider-example"> <h3>Example 20:</h3> <p>Slider-Elements initially hidden</p> <a class="btn btn-primary" href="" id="ex20a">Show</a> <br><br> <div class="well" style="display: none"> Slider-Element initially hidden, revealed by Javascript:<br/><br/> <span id="ex18-label-1" class="hidden"> Example slider label </span> <input id="ex20" type="text" data-provide="slider" data-slider-ticks="[1, 2, 3]" data-slider-ticks-labels='["short", "medium", "long"]' data-slider-min="1" data-slider-max="3" data-slider-step="1" data-slider-value="3" data-slider-tooltip="hide" /> </div> <h5>HTML</h5> <pre><code class="html"> <a class="btn btn-primary" href="" id="ex20a">Show</a> <div class="well" style="display: none"> <span id="ex18-label-1" class="hidden">Example slider label</span> <input id="ex19" type="text" data-provide="slider" data-slider-ticks="[1, 2, 3]" data-slider-ticks-labels='["short", "medium", "long"]' data-slider-min="1" data-slider-max="3" data-slider-step="1" data-slider-value="3" data-slider-tooltip="hide" /> </div> </pre></code> <h5>JavaScript</h5> <pre><code class="js"> $('#ex20a').on('click', function(e) { $('#ex20a') .parent() .find(' >.well') .toggle() .find('input') .slider('relayout'); e.preventDefault(); }); </pre></code> </div> <div id="example-21" class="slider-example"> <h3>Example 21:</h3> <p>Create an input element with the <strong>data-provide="slider"</strong> attribute automatically turns it into a slider. Options can be supplied via <strong>data-slider-</strong> attributes.</p> <div class="well"> <input id="ex21" type="text" data-provide="slider" data-slider-ticks="[1, 2, 3]" data-slider-ticks-labels='["short", "medium", "long"]' data-slider-min="1" data-slider-max="3" data-slider-step="1" data-slider-value="3" data-slider-tooltip="hide" /> </div> <h5>HTML</h5> <pre><code class="html"> <input id="ex21" type="text" data-provide="slider" data-slider-ticks="[1, 2, 3]" data-slider-ticks-labels='["short", "medium", "long"]' data-slider-min="1" data-slider-max="3" data-slider-step="1" data-slider-value="3" data-slider-tooltip="hide" /> </pre></code> </div> <div id="example-22" class="slider-example"> <h3>Example 22:</h3> <p>Highlight ranges on slider with <strong>rangeHighlights</strong> attribute</p> <div class="well"> <input id="ex22" type="text" data-slider-id="slider22" data-slider-min="0" data-slider-max="20" data-slider-step="1" data-slider-value="14" data-slider-rangeHighlights='[{ "start": 2, "end": 5, "class": "category1" }, { "start": 7, "end": 8, "class": "category2" }, { "start": 17, "end": 19 }, { "start": 17, "end": 24 }, { "start": -3, "end": 19 }]'/> </div> <h5>HTML</h5> <pre><code class="html"> <input id="ex22" type="text" data-slider-id="slider22" data-slider-min="0" data-slider-max="20" data-slider-step="1" data-slider-value="14" data-slider-rangeHighlights='[{ "start": 2, "end": 5, "class": "category1" }, { "start": 7, "end": 8, "class": "category2" }, { "start": 17, "end": 19 }, { "start": 17, "end": 24 }, //not visible - out of slider range { "start": -3, "end": 19 }]' /> </pre></code> <h5>JavaScript</h5> <pre><code class="js"> // With JQuery $('#ex22').slider({ id: 'slider22', min: 0, max: 20, step: 1, value: 14, rangeHighlights: [{ "start": 2, "end": 5, "class": "category1" }, { "start": 7, "end": 8, "class": "category2" }, { "start": 17, "end": 19 }, { "start": 17, "end": 24 }, { "start": -3, "end": 19 }]}); // Without JQuery var slider = new Slider("#ex22", { id: 'slider22', min: 0, max: 20, step: 1, value: 14, rangeHighlights: [{ "start": 2, "end": 5, "class": "category1" }, { "start": 7, "end": 8, "class": "category2" }, { "start": 17, "end": 19 }, { "start": 17, "end": 24 }, { "start": -3, "end": 19 }]}); </pre></code> <h5>CSS</h5> <pre><code class="css"> #slider22 .slider-selection { background: #81bfde; } #slider22 .slider-rangeHighlight { background: #f70616; } #slider22 .slider-rangeHighlight.category1 { background: #FF9900; } #slider22 .slider-rangeHighlight.category2 { background: #99CC00; } </pre></code> </div> <div id="example-23" class='slider-example'> <h3>Example 23:</h3> <p>Using tick marks at specific positions..</p> <div class="well"> <input id="ex23" type="text"/> </div> <h5>HTML</h5> <pre><code class="html"> <input id="ex23" type="text" data-slider-ticks="[0, 1, 2, 3, 4]" data-slider-step="0.01" data-slider-ticks-snap-bounds="200" data-slider-ticks-tooltip="true" ticks_positions="[0, 30, 60, 70, 90, 100]" /> </pre></code> <h5>JavaScript</h5> <pre><code class="js"> // With JQuery $("#ex23").slider({ ticks: [0, 1, 2, 3, 4], ticks_positions: [0, 30, 60, 70, 90, 100], ticks_snap_bounds: 200, formatter: function(value) { return 'Current value: ' + value; }, ticks_tooltip: true, step: 0.01 }); // Without JQuery var slider = new Slider("#ex23", { ticks: [0, 1, 2, 3, 4], ticks_positions: [0, 30, 70, 90, 100], ticks_snap_bounds: 200, formatter: function(value) { return 'Current value: ' + value; }, ticks_tooltip: true, step: 0.01 }); </pre></code> </div> <div id="example-24" class='slider-example'> <h3>Example 24:</h3> <p>rtl mode (auto)</p> <div class='well' dir ="rtl"> <span>-5</span> <input id="ex24" type="text" data-slider-min="-5" data-slider-max="20" data-slider-step="1" data-slider-value="14"/> <span>20</span> </div> <h5>HTML</h5> <pre><code class="html"> <div class='well' dir ="rtl"> <span>-5</span> <input id="ex24" type="text" data-slider-min="-5" data-slider-max="20" data-slider-step="1" data-slider-value="14"/> <span>20</span> </div> </pre></code> <h5>JavaScript</h5> <pre><code class="js"> // With JQuery $("#ex24").slider({}); </pre></code> </div> </div> <!-- /examples --> </div> <!-- /container --> <!-- core JavaScript ================================================== --> <script type='text/javascript' src="<%= js.jquery %>"></script> <script type='text/javascript' src="<%= js.slider %>"></script> <script type='text/javascript' src="<%= js.highlightjs %>"></script> <script>hljs.initHighlightingOnLoad();</script> <script type='text/javascript'> $(document).ready(function() { /* Example 1 */ $('#ex1').slider({ formatter: function(value) { return 'Current value: ' + value; } }); /* Example 2 */ $("#ex2").slider({}); /* Example 3 */ var RGBChange = function() { $('#RGB').css('background', 'rgb('+r.getValue()+','+g.getValue()+','+b.getValue()+')') }; var r = $('#R').slider() .on('slide', RGBChange) .data('slider'); var g = $('#G').slider() .on('slide', RGBChange) .data('slider'); var b = $('#B').slider() .on('slide', RGBChange) .data('slider'); /* Example 4 */ $("#ex4").slider({ reversed : true }); /* Example 5 */ $("#ex5").slider(); $("#destroyEx5Slider").click(function() { $("#ex5").slider('destroy'); }); /* Example 6 */ $("#ex6").slider(); $("#ex6").on('slide', function(slideEvt) { $("#ex6SliderVal").text(slideEvt.value); }); /* Example 7 */ $("#ex7").slider(); $("#ex7-enabled").click(function() { if(this.checked) { $("#ex7").slider("enable"); } else { $("#ex7").slider("disable"); } }); /* Example 8 */ $("#ex8").slider({ tooltip: 'always' }); /* Example 9 */ $("#ex9").slider({ precision: 2, value: 8.115 }); /* Example 10 */ $("#ex10").slider({}); /* Example 11 */ $("#ex11").slider({ step: 20000, min: 0, max: 200000 }); /* Example 12 */ $("#ex12a").slider({ id: "slider12a", min: 0, max: 10, value: 5 }); $("#ex12b").slider({ id: "slider12b", min: 0, max: 10, range: true, value: [ 3, 7 ] }); $("#ex12c").slider({ id: "slider12c", min: 0, max: 10, range: true, value: [ 3, 7 ] }); /* Example 13 */ $("#ex13").slider({ ticks: [0, 100, 200, 300, 400], ticks_labels: ['$0', '$100', '$200', '$300', '$400'], ticks_snap_bounds: 30, value: 200 }); /* Example 14 */ $("#ex14").slider({ ticks: [0, 100, 200, 300, 400], ticks_labels: ['$0', '$100', '$200', '$300', '$400'], ticks_positions: [0, 30, 70, 90, 100], ticks_snap_bounds: 20, value: 200, }); /* Example 15 */ $("#ex15").slider({ min: 10, max: 1000, scale: 'logarithmic', step: 10 }); /* Example 16 */ $("#ex16a").slider({ min : 0, max : 10, value: 0, focus: true }); $("#ex16b").slider({ min : 0, max : 10, value: [ 0, 10 ], focus: true }); /* Example 17 */ $("#ex17a").slider({ min : 0, max : 10, value: 0, tooltip_position:'bottom' }); $("#ex17b").slider({ min : 0, max : 10, value: 0, orientation: 'vertical', tooltip_position:'left' }); /* Example 18 */ $('#ex18a').slider({ min : 0, max : 10, value: 5, labelledby: 'ex18-label-1' }); $('#ex18b').slider({ min : 0, max : 10, value: [3, 6], labelledby: ['ex18-label-2a', 'ex18-label-2b'] }); $('#ex20a').on('click', function(e) { $('#ex20a') .parent() .find(' >.well') .toggle() .find('input') .slider('relayout'); e.preventDefault(); }); /* Example 22 */ $('#ex22').slider({}); /* Example 23 */ $('#ex23').slider({ ticks: [0, 1, 2, 3, 4], ticks_positions: [0, 30, 70, 90, 100], formatter: function(value) { return 'Current value: ' + value; }, step: 0.01, ticks_tooltip: true }); }); /* example 24 */ $('#ex24').slider({}); </script> <!-- Placed at the end of the document so the pages load faster --> </body> </html> tpl/SpecRunner.tpl000064400000007516151676726750010207 0ustar00<!doctype html> <html> <head> <meta charset="utf-8"> <title>Jasmine Spec Runner</title> <% css.forEach(function(style){ %> <link rel="stylesheet" type="text/css" href="<%= style %>"> <% }) %> <style type="text/css"> #low-high-slider-styled .slider-track-low { background: rgb(0, 255, 0); } #low-high-slider-styled .slider-track-high { background: rgb(255, 0, 0); } #scrollable-div { overflow-y: scroll; width: 300px; height: 150px; position: relative; } #low-div { padding: 2000px 0 500px 0; } </style> </head> <body> <div style=" margin-left: 2000px; "> <input id="offRightEdgeSliderInput" type="text"/> </div> <input id="testSliderGeneric" type="text"/> <!-- Slider used for PublicMethodsSpec and EventsSpec --> <input id="testSlider1" type="text"/> <input id="testSlider2" type="text"/> <input id="testSlider3" type="text"/> <input id="testSlider4" type="text"/> <!-- Note: Two input elements with class 'makeSlider' are required for tests to run properly --> <input class="makeSlider" type="text"/> <input class="makeSlider" type="text"/> <!-- Sliders used for ElementDataSttributesSpec --> <input id="minSlider" type="text" data-slider-min="5"/> <input id="maxSlider" type="text" data-slider-max="5"/> <input id="orientationSlider" type="text" data-slider-orientation="vertical"/> <input id="stepSlider" type="text" data-slider-step="5"/> <input id="precisionSlider" type="text" data-slider-precision="2"/> <input id="valueSlider" type="text" data-slider-value="5"/> <input id="sliderWithTickMarksAndLabels" type="text" data-slider-ticks="[0, 100, 200, 300, 400]" data-slider-ticks-labels='["$0", "$100", "$200", "$300", "$400"]'/> <input id="selectionSlider" type="text" data-slider-selection="after"/> <input id="tooltipSlider" type="text" data-slider-tooltip="hide"/> <input id="handleSlider" type="text" data-slider-handle="triangle"/> <input id="customHandleSlider" type="text" data-slider-handle="custom"/> <input id="reversedSlider" type="text" data-slider-reversed="true"/> <input id="disabledSlider" type="text" data-slider-enabled="false"/> <input id="changeOrientationSlider" type="text"/> <input id="makeRangeSlider" type="text"/> <div id="autoregisterSliderContainer"> <input id="autoregisterSlider" data-provide="slider" data-slider-value="1"/> </div> <div id="relayoutSliderContainer" style="display: none"> <input id="relayoutSliderInput" type="text"/> </div> <div id="relayoutSliderContainerTickLabels" style="display: none"> <input id="relayoutSliderInputTickLabels" type="text"/> </div> <div id="scrollable-div"> <p>just a row</p> <p>just a row</p> <input id="ex1" data-slider-id='ex1Slider' type="text"/> </div> <div id="low-div"> <input id="veryLowPositionedSlider" type="text"/> </div> <!-- Sliders used by resize --> <input id="resizeSlider" type="text"/> <input id="resizeSliderVertical" data-slider-orientation="vertical" type="text"/> <!-- Sliders used for AccessibilitySpec --> <div> <span id="accessibilitySliderLabelA">Label A</span> <span id="accessibilitySliderLabelB">Label B</span> <input id="accessibilitySliderA" type="text" data-slider-labelledby="accessibilitySliderLabelA" /> <input id="accessibilitySliderB" type="text" data-slider-labelledby='["accessibilitySliderLabelA", "accessibilitySliderLabelB"]' /> <input id="accessibilitySliderC" type="text" /> </div> <!-- Sliders used for rtl --> <div dir="rtl"> <input id="rtlSlider" type="text" /> </div> <% with (scripts) { %> <% [].concat(polyfills, jasmine, boot, vendor, helpers, src, specs,reporters).forEach(function(script){ %> <script src="<%= script %>"></script> <% }) %> <% }; %> </body> </html> src/js/bootstrap-slider.js000064400000202171151676726750011633 0ustar00/*! ========================================================= * bootstrap-slider.js * * Maintainers: * Kyle Kemp * - Twitter: @seiyria * - Github: seiyria * Rohit Kalkur * - Twitter: @Rovolutionary * - Github: rovolution * * ========================================================= * * bootstrap-slider is released under the MIT License * Copyright (c) 2017 Kyle Kemp, Rohit Kalkur, and contributors * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * ========================================================= */ /** * Bridget makes jQuery widgets * v1.0.1 * MIT license */ const windowIsDefined = (typeof window === "object"); (function(factory) { if(typeof define === "function" && define.amd) { define(["jquery"], factory); } else if(typeof module === "object" && module.exports) { var jQuery; try { jQuery = require("jquery"); } catch (err) { jQuery = null; } module.exports = factory(jQuery); } else if(window) { window.Slider = factory(window.jQuery); } }(function($) { // Constants const NAMESPACE_MAIN = 'slider'; const NAMESPACE_ALTERNATE = 'bootstrapSlider'; // Polyfill console methods if (windowIsDefined && !window.console) { window.console = {}; } if (windowIsDefined && !window.console.log) { window.console.log = function () { }; } if (windowIsDefined && !window.console.warn) { window.console.warn = function () { }; } // Reference to Slider constructor var Slider; (function( $ ) { 'use strict'; // -------------------------- utils -------------------------- // var slice = Array.prototype.slice; function noop() {} // -------------------------- definition -------------------------- // function defineBridget( $ ) { // bail if no jQuery if ( !$ ) { return; } // -------------------------- addOptionMethod -------------------------- // /** * adds option method -> $().plugin('option', {...}) * @param {Function} PluginClass - constructor class */ function addOptionMethod( PluginClass ) { // don't overwrite original option method if ( PluginClass.prototype.option ) { return; } // option setter PluginClass.prototype.option = function( opts ) { // bail out if not an object if ( !$.isPlainObject( opts ) ){ return; } this.options = $.extend( true, this.options, opts ); }; } // -------------------------- plugin bridge -------------------------- // // helper function for logging errors // $.error breaks jQuery chaining var logError = typeof console === 'undefined' ? noop : function( message ) { console.error( message ); }; /** * jQuery plugin bridge, access methods like $elem.plugin('method') * @param {String} namespace - plugin name * @param {Function} PluginClass - constructor class */ function bridge( namespace, PluginClass ) { // add to jQuery fn namespace $.fn[ namespace ] = function( options ) { if ( typeof options === 'string' ) { // call plugin method when first argument is a string // get arguments for method var args = slice.call( arguments, 1 ); for ( var i=0, len = this.length; i < len; i++ ) { var elem = this[i]; var instance = $.data( elem, namespace ); if ( !instance ) { logError( "cannot call methods on " + namespace + " prior to initialization; " + "attempted to call '" + options + "'" ); continue; } if ( !$.isFunction( instance[options] ) || options.charAt(0) === '_' ) { logError( "no such method '" + options + "' for " + namespace + " instance" ); continue; } // trigger method with arguments var returnValue = instance[ options ].apply( instance, args); // break look and return first value if provided if ( returnValue !== undefined && returnValue !== instance) { return returnValue; } } // return this if no return value return this; } else { var objects = this.map( function() { var instance = $.data( this, namespace ); if ( instance ) { // apply options & init instance.option( options ); instance._init(); } else { // initialize new instance instance = new PluginClass( this, options ); $.data( this, namespace, instance ); } return $(this); }); if(!objects || objects.length > 1) { return objects; } else { return objects[0]; } } }; } // -------------------------- bridget -------------------------- // /** * converts a Prototypical class into a proper jQuery plugin * the class must have a ._init method * @param {String} namespace - plugin name, used in $().pluginName * @param {Function} PluginClass - constructor class */ $.bridget = function( namespace, PluginClass ) { addOptionMethod( PluginClass ); bridge( namespace, PluginClass ); }; return $.bridget; } // get jquery from browser global defineBridget( $ ); })( $ ); /************************************************* BOOTSTRAP-SLIDER SOURCE CODE **************************************************/ (function($) { var ErrorMsgs = { formatInvalidInputErrorMsg : function(input) { return "Invalid input value '" + input + "' passed in"; }, callingContextNotSliderInstance : "Calling context element does not have instance of Slider bound to it. Check your code to make sure the JQuery object returned from the call to the slider() initializer is calling the method" }; var SliderScale = { linear: { toValue: function(percentage) { var rawValue = percentage/100 * (this.options.max - this.options.min); var shouldAdjustWithBase = true; if (this.options.ticks_positions.length > 0) { var minv, maxv, minp, maxp = 0; for (var i = 1; i < this.options.ticks_positions.length; i++) { if (percentage <= this.options.ticks_positions[i]) { minv = this.options.ticks[i-1]; minp = this.options.ticks_positions[i-1]; maxv = this.options.ticks[i]; maxp = this.options.ticks_positions[i]; break; } } var partialPercentage = (percentage - minp) / (maxp - minp); rawValue = minv + partialPercentage * (maxv - minv); shouldAdjustWithBase = false; } var adjustment = shouldAdjustWithBase ? this.options.min : 0; var value = adjustment + Math.round(rawValue / this.options.step) * this.options.step; if (value < this.options.min) { return this.options.min; } else if (value > this.options.max) { return this.options.max; } else { return value; } }, toPercentage: function(value) { if (this.options.max === this.options.min) { return 0; } if (this.options.ticks_positions.length > 0) { var minv, maxv, minp, maxp = 0; for (var i = 0; i < this.options.ticks.length; i++) { if (value <= this.options.ticks[i]) { minv = (i > 0) ? this.options.ticks[i-1] : 0; minp = (i > 0) ? this.options.ticks_positions[i-1] : 0; maxv = this.options.ticks[i]; maxp = this.options.ticks_positions[i]; break; } } if (i > 0) { var partialPercentage = (value - minv) / (maxv - minv); return minp + partialPercentage * (maxp - minp); } } return 100 * (value - this.options.min) / (this.options.max - this.options.min); } }, logarithmic: { /* Based on http://stackoverflow.com/questions/846221/logarithmic-slider */ toValue: function(percentage) { var offset = 1 - this.options.min; var min = Math.log(this.options.min + offset); var max = Math.log(this.options.max + offset); var value = Math.exp(min + (max - min) * percentage / 100) - offset; if(Math.round(value) === max) { return max; } value = this.options.min + Math.round((value - this.options.min) / this.options.step) * this.options.step; /* Rounding to the nearest step could exceed the min or * max, so clip to those values. */ if (value < this.options.min) { return this.options.min; } else if (value > this.options.max) { return this.options.max; } else { return value; } }, toPercentage: function(value) { if (this.options.max === this.options.min) { return 0; } else { var offset = 1 - this.options.min; var max = Math.log(this.options.max + offset); var min = Math.log(this.options.min + offset); var v = Math.log(value + offset); return 100 * (v - min) / (max - min); } } } }; /************************************************* CONSTRUCTOR **************************************************/ Slider = function(element, options) { createNewSlider.call(this, element, options); return this; }; function createNewSlider(element, options) { /* The internal state object is used to store data about the current 'state' of slider. This includes values such as the `value`, `enabled`, etc... */ this._state = { value: null, enabled: null, offset: null, size: null, percentage: null, inDrag: false, over: false }; // The objects used to store the reference to the tick methods if ticks_tooltip is on this.ticksCallbackMap = {}; this.handleCallbackMap = {}; if(typeof element === "string") { this.element = document.querySelector(element); } else if(element instanceof HTMLElement) { this.element = element; } /************************************************* Process Options **************************************************/ options = options ? options : {}; var optionTypes = Object.keys(this.defaultOptions); for(var i = 0; i < optionTypes.length; i++) { var optName = optionTypes[i]; // First check if an option was passed in via the constructor var val = options[optName]; // If no data attrib, then check data atrributes val = (typeof val !== 'undefined') ? val : getDataAttrib(this.element, optName); // Finally, if nothing was specified, use the defaults val = (val !== null) ? val : this.defaultOptions[optName]; // Set all options on the instance of the Slider if(!this.options) { this.options = {}; } this.options[optName] = val; } // Check options.rtl if(this.options.rtl==='auto'){ var computedStyle = window.getComputedStyle(this.element); if (computedStyle != null) { this.options.rtl = computedStyle.direction === 'rtl'; } else { // Fix for Firefox bug in versions less than 62: // https://bugzilla.mozilla.org/show_bug.cgi?id=548397 // https://bugzilla.mozilla.org/show_bug.cgi?id=1467722 this.options.rtl = this.element.style.direction === 'rtl'; } } /* Validate `tooltip_position` against 'orientation` - if `tooltip_position` is incompatible with orientation, swith it to a default compatible with specified `orientation` -- default for "vertical" -> "right", "left" if rtl -- default for "horizontal" -> "top" */ if(this.options.orientation === "vertical" && (this.options.tooltip_position === "top" || this.options.tooltip_position === "bottom")) { if(this.options.rtl) { this.options.tooltip_position = "left"; }else{ this.options.tooltip_position = "right"; } } else if(this.options.orientation === "horizontal" && (this.options.tooltip_position === "left" || this.options.tooltip_position === "right")) { this.options.tooltip_position = "top"; } function getDataAttrib(element, optName) { var dataName = "data-slider-" + optName.replace(/_/g, '-'); var dataValString = element.getAttribute(dataName); try { return JSON.parse(dataValString); } catch(err) { return dataValString; } } /************************************************* Create Markup **************************************************/ var origWidth = this.element.style.width; var updateSlider = false; var parent = this.element.parentNode; var sliderTrackSelection; var sliderTrackLow, sliderTrackHigh; var sliderMinHandle; var sliderMaxHandle; if (this.sliderElem) { updateSlider = true; } else { /* Create elements needed for slider */ this.sliderElem = document.createElement("div"); this.sliderElem.className = "slider"; /* Create slider track elements */ var sliderTrack = document.createElement("div"); sliderTrack.className = "slider-track"; sliderTrackLow = document.createElement("div"); sliderTrackLow.className = "slider-track-low"; sliderTrackSelection = document.createElement("div"); sliderTrackSelection.className = "slider-selection"; sliderTrackHigh = document.createElement("div"); sliderTrackHigh.className = "slider-track-high"; sliderMinHandle = document.createElement("div"); sliderMinHandle.className = "slider-handle min-slider-handle"; sliderMinHandle.setAttribute('role', 'slider'); sliderMinHandle.setAttribute('aria-valuemin', this.options.min); sliderMinHandle.setAttribute('aria-valuemax', this.options.max); sliderMaxHandle = document.createElement("div"); sliderMaxHandle.className = "slider-handle max-slider-handle"; sliderMaxHandle.setAttribute('role', 'slider'); sliderMaxHandle.setAttribute('aria-valuemin', this.options.min); sliderMaxHandle.setAttribute('aria-valuemax', this.options.max); sliderTrack.appendChild(sliderTrackLow); sliderTrack.appendChild(sliderTrackSelection); sliderTrack.appendChild(sliderTrackHigh); /* Create highlight range elements */ this.rangeHighlightElements = []; const rangeHighlightsOpts = this.options.rangeHighlights; if (Array.isArray(rangeHighlightsOpts) && rangeHighlightsOpts.length > 0) { for (let j = 0; j < rangeHighlightsOpts.length; j++) { var rangeHighlightElement = document.createElement("div"); const customClassString = rangeHighlightsOpts[j].class || ""; rangeHighlightElement.className = `slider-rangeHighlight slider-selection ${customClassString}`; this.rangeHighlightElements.push(rangeHighlightElement); sliderTrack.appendChild(rangeHighlightElement); } } /* Add aria-labelledby to handle's */ var isLabelledbyArray = Array.isArray(this.options.labelledby); if (isLabelledbyArray && this.options.labelledby[0]) { sliderMinHandle.setAttribute('aria-labelledby', this.options.labelledby[0]); } if (isLabelledbyArray && this.options.labelledby[1]) { sliderMaxHandle.setAttribute('aria-labelledby', this.options.labelledby[1]); } if (!isLabelledbyArray && this.options.labelledby) { sliderMinHandle.setAttribute('aria-labelledby', this.options.labelledby); sliderMaxHandle.setAttribute('aria-labelledby', this.options.labelledby); } /* Create ticks */ this.ticks = []; if (Array.isArray(this.options.ticks) && this.options.ticks.length > 0) { this.ticksContainer = document.createElement('div'); this.ticksContainer.className = 'slider-tick-container'; for (i = 0; i < this.options.ticks.length; i++) { var tick = document.createElement('div'); tick.className = 'slider-tick'; if (this.options.ticks_tooltip) { var tickListenerReference = this._addTickListener(); var enterCallback = tickListenerReference.addMouseEnter(this, tick, i); var leaveCallback = tickListenerReference.addMouseLeave(this, tick); this.ticksCallbackMap[i] = { mouseEnter: enterCallback, mouseLeave: leaveCallback }; } this.ticks.push(tick); this.ticksContainer.appendChild(tick); } sliderTrackSelection.className += " tick-slider-selection"; } this.tickLabels = []; if (Array.isArray(this.options.ticks_labels) && this.options.ticks_labels.length > 0) { this.tickLabelContainer = document.createElement('div'); this.tickLabelContainer.className = 'slider-tick-label-container'; for (i = 0; i < this.options.ticks_labels.length; i++) { var label = document.createElement('div'); var noTickPositionsSpecified = this.options.ticks_positions.length === 0; var tickLabelsIndex = (this.options.reversed && noTickPositionsSpecified) ? (this.options.ticks_labels.length - (i + 1)) : i; label.className = 'slider-tick-label'; label.innerHTML = this.options.ticks_labels[tickLabelsIndex]; this.tickLabels.push(label); this.tickLabelContainer.appendChild(label); } } const createAndAppendTooltipSubElements = function(tooltipElem) { var arrow = document.createElement("div"); arrow.className = "tooltip-arrow"; var inner = document.createElement("div"); inner.className = "tooltip-inner"; tooltipElem.appendChild(arrow); tooltipElem.appendChild(inner); }; /* Create tooltip elements */ const sliderTooltip = document.createElement("div"); sliderTooltip.className = "tooltip tooltip-main"; sliderTooltip.setAttribute('role', 'presentation'); createAndAppendTooltipSubElements(sliderTooltip); const sliderTooltipMin = document.createElement("div"); sliderTooltipMin.className = "tooltip tooltip-min"; sliderTooltipMin.setAttribute('role', 'presentation'); createAndAppendTooltipSubElements(sliderTooltipMin); const sliderTooltipMax = document.createElement("div"); sliderTooltipMax.className = "tooltip tooltip-max"; sliderTooltipMax.setAttribute('role', 'presentation'); createAndAppendTooltipSubElements(sliderTooltipMax); /* Append components to sliderElem */ this.sliderElem.appendChild(sliderTrack); this.sliderElem.appendChild(sliderTooltip); this.sliderElem.appendChild(sliderTooltipMin); this.sliderElem.appendChild(sliderTooltipMax); if (this.tickLabelContainer) { this.sliderElem.appendChild(this.tickLabelContainer); } if (this.ticksContainer) { this.sliderElem.appendChild(this.ticksContainer); } this.sliderElem.appendChild(sliderMinHandle); this.sliderElem.appendChild(sliderMaxHandle); /* Append slider element to parent container, right before the original <input> element */ parent.insertBefore(this.sliderElem, this.element); /* Hide original <input> element */ this.element.style.display = "none"; } /* If JQuery exists, cache JQ references */ if($) { this.$element = $(this.element); this.$sliderElem = $(this.sliderElem); } /************************************************* Setup **************************************************/ this.eventToCallbackMap = {}; this.sliderElem.id = this.options.id; this.touchCapable = 'ontouchstart' in window || (window.DocumentTouch && document instanceof window.DocumentTouch); this.touchX = 0; this.touchY = 0; this.tooltip = this.sliderElem.querySelector('.tooltip-main'); this.tooltipInner = this.tooltip.querySelector('.tooltip-inner'); this.tooltip_min = this.sliderElem.querySelector('.tooltip-min'); this.tooltipInner_min = this.tooltip_min.querySelector('.tooltip-inner'); this.tooltip_max = this.sliderElem.querySelector('.tooltip-max'); this.tooltipInner_max= this.tooltip_max.querySelector('.tooltip-inner'); if (SliderScale[this.options.scale]) { this.options.scale = SliderScale[this.options.scale]; } if (updateSlider === true) { // Reset classes this._removeClass(this.sliderElem, 'slider-horizontal'); this._removeClass(this.sliderElem, 'slider-vertical'); this._removeClass(this.sliderElem, 'slider-rtl'); this._removeClass(this.tooltip, 'hide'); this._removeClass(this.tooltip_min, 'hide'); this._removeClass(this.tooltip_max, 'hide'); // Undo existing inline styles for track ["left", "right", "top", "width", "height"].forEach(function(prop) { this._removeProperty(this.trackLow, prop); this._removeProperty(this.trackSelection, prop); this._removeProperty(this.trackHigh, prop); }, this); // Undo inline styles on handles [this.handle1, this.handle2].forEach(function(handle) { this._removeProperty(handle, 'left'); this._removeProperty(handle, 'right'); this._removeProperty(handle, 'top'); }, this); // Undo inline styles and classes on tooltips [this.tooltip, this.tooltip_min, this.tooltip_max].forEach(function(tooltip) { this._removeProperty(tooltip, 'left'); this._removeProperty(tooltip, 'right'); this._removeProperty(tooltip, 'top'); this._removeClass(tooltip, 'right'); this._removeClass(tooltip, 'left'); this._removeClass(tooltip, 'top'); }, this); } if(this.options.orientation === 'vertical') { this._addClass(this.sliderElem,'slider-vertical'); this.stylePos = 'top'; this.mousePos = 'pageY'; this.sizePos = 'offsetHeight'; } else { this._addClass(this.sliderElem, 'slider-horizontal'); this.sliderElem.style.width = origWidth; this.options.orientation = 'horizontal'; if(this.options.rtl) { this.stylePos = 'right'; } else { this.stylePos = 'left'; } this.mousePos = 'clientX'; this.sizePos = 'offsetWidth'; } // specific rtl class if (this.options.rtl) { this._addClass(this.sliderElem, 'slider-rtl'); } this._setTooltipPosition(); /* In case ticks are specified, overwrite the min and max bounds */ if (Array.isArray(this.options.ticks) && this.options.ticks.length > 0) { this.options.max = Math.max.apply(Math, this.options.ticks); this.options.min = Math.min.apply(Math, this.options.ticks); } if (Array.isArray(this.options.value)) { this.options.range = true; this._state.value = this.options.value; } else if (this.options.range) { // User wants a range, but value is not an array this._state.value = [this.options.value, this.options.max]; } else { this._state.value = this.options.value; } this.trackLow = sliderTrackLow || this.trackLow; this.trackSelection = sliderTrackSelection || this.trackSelection; this.trackHigh = sliderTrackHigh || this.trackHigh; if (this.options.selection === 'none') { this._addClass(this.trackLow, 'hide'); this._addClass(this.trackSelection, 'hide'); this._addClass(this.trackHigh, 'hide'); } else if (this.options.selection === 'after' || this.options.selection === 'before') { this._removeClass(this.trackLow, 'hide'); this._removeClass(this.trackSelection, 'hide'); this._removeClass(this.trackHigh, 'hide'); } this.handle1 = sliderMinHandle || this.handle1; this.handle2 = sliderMaxHandle || this.handle2; if (updateSlider === true) { // Reset classes this._removeClass(this.handle1, 'round triangle'); this._removeClass(this.handle2, 'round triangle hide'); for (i = 0; i < this.ticks.length; i++) { this._removeClass(this.ticks[i], 'round triangle hide'); } } var availableHandleModifiers = ['round', 'triangle', 'custom']; var isValidHandleType = availableHandleModifiers.indexOf(this.options.handle) !== -1; if (isValidHandleType) { this._addClass(this.handle1, this.options.handle); this._addClass(this.handle2, this.options.handle); for (i = 0; i < this.ticks.length; i++) { this._addClass(this.ticks[i], this.options.handle); } } this._state.offset = this._offset(this.sliderElem); this._state.size = this.sliderElem[this.sizePos]; this.setValue(this._state.value); /****************************************** Bind Event Listeners ******************************************/ // Bind keyboard handlers this.handle1Keydown = this._keydown.bind(this, 0); this.handle1.addEventListener("keydown", this.handle1Keydown, false); this.handle2Keydown = this._keydown.bind(this, 1); this.handle2.addEventListener("keydown", this.handle2Keydown, false); this.mousedown = this._mousedown.bind(this); this.touchstart = this._touchstart.bind(this); this.touchmove = this._touchmove.bind(this); if (this.touchCapable) { // Test for passive event support let supportsPassive = false; try { let opts = Object.defineProperty({}, 'passive', { get: function() { supportsPassive = true; } }); window.addEventListener("test", null, opts); } catch (e) {} // Use our detect's results. passive applied if supported, capture will be false either way. let eventOptions = supportsPassive ? { passive: true } : false; // Bind touch handlers this.sliderElem.addEventListener("touchstart", this.touchstart, eventOptions); this.sliderElem.addEventListener("touchmove", this.touchmove, eventOptions); } this.sliderElem.addEventListener("mousedown", this.mousedown, false); // Bind window handlers this.resize = this._resize.bind(this); window.addEventListener("resize", this.resize, false); // Bind tooltip-related handlers if(this.options.tooltip === 'hide') { this._addClass(this.tooltip, 'hide'); this._addClass(this.tooltip_min, 'hide'); this._addClass(this.tooltip_max, 'hide'); } else if(this.options.tooltip === 'always') { this._showTooltip(); this._alwaysShowTooltip = true; } else { this.showTooltip = this._showTooltip.bind(this); this.hideTooltip = this._hideTooltip.bind(this); if (this.options.ticks_tooltip) { var callbackHandle = this._addTickListener(); //create handle1 listeners and store references in map var mouseEnter = callbackHandle.addMouseEnter(this, this.handle1); var mouseLeave = callbackHandle.addMouseLeave(this, this.handle1); this.handleCallbackMap.handle1 = { mouseEnter: mouseEnter, mouseLeave: mouseLeave }; //create handle2 listeners and store references in map mouseEnter = callbackHandle.addMouseEnter(this, this.handle2); mouseLeave = callbackHandle.addMouseLeave(this, this.handle2); this.handleCallbackMap.handle2 = { mouseEnter: mouseEnter, mouseLeave: mouseLeave }; } else { this.sliderElem.addEventListener("mouseenter", this.showTooltip, false); this.sliderElem.addEventListener("mouseleave", this.hideTooltip, false); } this.handle1.addEventListener("focus", this.showTooltip, false); this.handle1.addEventListener("blur", this.hideTooltip, false); this.handle2.addEventListener("focus", this.showTooltip, false); this.handle2.addEventListener("blur", this.hideTooltip, false); } if(this.options.enabled) { this.enable(); } else { this.disable(); } } /************************************************* INSTANCE PROPERTIES/METHODS - Any methods bound to the prototype are considered part of the plugin's `public` interface **************************************************/ Slider.prototype = { _init: function() {}, // NOTE: Must exist to support bridget constructor: Slider, defaultOptions: { id: "", min: 0, max: 10, step: 1, precision: 0, orientation: 'horizontal', value: 5, range: false, selection: 'before', tooltip: 'show', tooltip_split: false, handle: 'round', reversed: false, rtl: 'auto', enabled: true, formatter: function(val) { if (Array.isArray(val)) { return val[0] + " : " + val[1]; } else { return val; } }, natural_arrow_keys: false, ticks: [], ticks_positions: [], ticks_labels: [], ticks_snap_bounds: 0, ticks_tooltip: false, scale: 'linear', focus: false, tooltip_position: null, labelledby: null, rangeHighlights: [] }, getElement: function() { return this.sliderElem; }, getValue: function() { if (this.options.range) { return this._state.value; } else { return this._state.value[0]; } }, setValue: function(val, triggerSlideEvent, triggerChangeEvent) { if (!val) { val = 0; } var oldValue = this.getValue(); this._state.value = this._validateInputValue(val); var applyPrecision = this._applyPrecision.bind(this); if (this.options.range) { this._state.value[0] = applyPrecision(this._state.value[0]); this._state.value[1] = applyPrecision(this._state.value[1]); this._state.value[0] = Math.max(this.options.min, Math.min(this.options.max, this._state.value[0])); this._state.value[1] = Math.max(this.options.min, Math.min(this.options.max, this._state.value[1])); } else { this._state.value = applyPrecision(this._state.value); this._state.value = [ Math.max(this.options.min, Math.min(this.options.max, this._state.value))]; this._addClass(this.handle2, 'hide'); if (this.options.selection === 'after') { this._state.value[1] = this.options.max; } else { this._state.value[1] = this.options.min; } } if (this.options.max > this.options.min) { this._state.percentage = [ this._toPercentage(this._state.value[0]), this._toPercentage(this._state.value[1]), this.options.step * 100 / (this.options.max - this.options.min) ]; } else { this._state.percentage = [0, 0, 100]; } this._layout(); var newValue = this.options.range ? this._state.value : this._state.value[0]; this._setDataVal(newValue); if(triggerSlideEvent === true) { this._trigger('slide', newValue); } if( (oldValue !== newValue) && (triggerChangeEvent === true) ) { this._trigger('change', { oldValue: oldValue, newValue: newValue }); } return this; }, destroy: function(){ // Remove event handlers on slider elements this._removeSliderEventHandlers(); // Remove the slider from the DOM this.sliderElem.parentNode.removeChild(this.sliderElem); /* Show original <input> element */ this.element.style.display = ""; // Clear out custom event bindings this._cleanUpEventCallbacksMap(); // Remove data values this.element.removeAttribute("data"); // Remove JQuery handlers/data if($) { this._unbindJQueryEventHandlers(); this.$element.removeData('slider'); } }, disable: function() { this._state.enabled = false; this.handle1.removeAttribute("tabindex"); this.handle2.removeAttribute("tabindex"); this._addClass(this.sliderElem, 'slider-disabled'); this._trigger('slideDisabled'); return this; }, enable: function() { this._state.enabled = true; this.handle1.setAttribute("tabindex", 0); this.handle2.setAttribute("tabindex", 0); this._removeClass(this.sliderElem, 'slider-disabled'); this._trigger('slideEnabled'); return this; }, toggle: function() { if(this._state.enabled) { this.disable(); } else { this.enable(); } return this; }, isEnabled: function() { return this._state.enabled; }, on: function(evt, callback) { this._bindNonQueryEventHandler(evt, callback); return this; }, off: function(evt, callback) { if($) { this.$element.off(evt, callback); this.$sliderElem.off(evt, callback); } else { this._unbindNonQueryEventHandler(evt, callback); } }, getAttribute: function(attribute) { if(attribute) { return this.options[attribute]; } else { return this.options; } }, setAttribute: function(attribute, value) { this.options[attribute] = value; return this; }, refresh: function() { this._removeSliderEventHandlers(); createNewSlider.call(this, this.element, this.options); if($) { // Bind new instance of slider to the element $.data(this.element, 'slider', this); } return this; }, relayout: function() { this._resize(); return this; }, /******************************+ HELPERS - Any method that is not part of the public interface. - Place it underneath this comment block and write its signature like so: _fnName : function() {...} ********************************/ _removeSliderEventHandlers: function() { // Remove keydown event listeners this.handle1.removeEventListener("keydown", this.handle1Keydown, false); this.handle2.removeEventListener("keydown", this.handle2Keydown, false); //remove the listeners from the ticks and handles if they had their own listeners if (this.options.ticks_tooltip) { var ticks = this.ticksContainer.getElementsByClassName('slider-tick'); for(var i = 0; i < ticks.length; i++ ){ ticks[i].removeEventListener('mouseenter', this.ticksCallbackMap[i].mouseEnter, false); ticks[i].removeEventListener('mouseleave', this.ticksCallbackMap[i].mouseLeave, false); } this.handle1.removeEventListener('mouseenter', this.handleCallbackMap.handle1.mouseEnter, false); this.handle2.removeEventListener('mouseenter', this.handleCallbackMap.handle2.mouseEnter, false); this.handle1.removeEventListener('mouseleave', this.handleCallbackMap.handle1.mouseLeave, false); this.handle2.removeEventListener('mouseleave', this.handleCallbackMap.handle2.mouseLeave, false); } this.handleCallbackMap = null; this.ticksCallbackMap = null; if (this.showTooltip) { this.handle1.removeEventListener("focus", this.showTooltip, false); this.handle2.removeEventListener("focus", this.showTooltip, false); } if (this.hideTooltip) { this.handle1.removeEventListener("blur", this.hideTooltip, false); this.handle2.removeEventListener("blur", this.hideTooltip, false); } // Remove event listeners from sliderElem if (this.showTooltip) { this.sliderElem.removeEventListener("mouseenter", this.showTooltip, false); } if (this.hideTooltip) { this.sliderElem.removeEventListener("mouseleave", this.hideTooltip, false); } this.sliderElem.removeEventListener("touchstart", this.touchstart, false); this.sliderElem.removeEventListener("touchmove", this.touchmove, false); this.sliderElem.removeEventListener("mousedown", this.mousedown, false); // Remove window event listener window.removeEventListener("resize", this.resize, false); }, _bindNonQueryEventHandler: function(evt, callback) { if(this.eventToCallbackMap[evt] === undefined) { this.eventToCallbackMap[evt] = []; } this.eventToCallbackMap[evt].push(callback); }, _unbindNonQueryEventHandler: function(evt, callback) { var callbacks = this.eventToCallbackMap[evt]; if(callbacks !== undefined) { for (var i = 0; i < callbacks.length; i++) { if (callbacks[i] === callback) { callbacks.splice(i, 1); break; } } } }, _cleanUpEventCallbacksMap: function() { var eventNames = Object.keys(this.eventToCallbackMap); for(var i = 0; i < eventNames.length; i++) { var eventName = eventNames[i]; delete this.eventToCallbackMap[eventName]; } }, _showTooltip: function() { if (this.options.tooltip_split === false ){ this._addClass(this.tooltip, 'in'); this.tooltip_min.style.display = 'none'; this.tooltip_max.style.display = 'none'; } else { this._addClass(this.tooltip_min, 'in'); this._addClass(this.tooltip_max, 'in'); this.tooltip.style.display = 'none'; } this._state.over = true; }, _hideTooltip: function() { if (this._state.inDrag === false && this.alwaysShowTooltip !== true) { this._removeClass(this.tooltip, 'in'); this._removeClass(this.tooltip_min, 'in'); this._removeClass(this.tooltip_max, 'in'); } this._state.over = false; }, _setToolTipOnMouseOver: function _setToolTipOnMouseOver(tempState){ var formattedTooltipVal = this.options.formatter(!tempState ? this._state.value[0]: tempState.value[0]); var positionPercentages = !tempState ? getPositionPercentages(this._state, this.options.reversed) : getPositionPercentages(tempState, this.options.reversed); this._setText(this.tooltipInner, formattedTooltipVal); this.tooltip.style[this.stylePos] = `${positionPercentages[0]}%`; function getPositionPercentages(state, reversed){ if (reversed) { return [100 - state.percentage[0], this.options.range ? 100 - state.percentage[1] : state.percentage[1]]; } return [state.percentage[0], state.percentage[1]]; } }, _addTickListener: function _addTickListener() { return { addMouseEnter: function(reference, tick, index){ var enter = function(){ var tempState = reference._state; var idString = index >= 0 ? index : this.attributes['aria-valuenow'].value; var hoverIndex = parseInt(idString, 10); tempState.value[0] = hoverIndex; tempState.percentage[0] = reference.options.ticks_positions[hoverIndex]; reference._setToolTipOnMouseOver(tempState); reference._showTooltip(); }; tick.addEventListener("mouseenter", enter, false); return enter; }, addMouseLeave: function(reference, tick){ var leave = function(){ reference._hideTooltip(); }; tick.addEventListener("mouseleave", leave, false); return leave; } }; }, _layout: function() { var positionPercentages; if(this.options.reversed) { positionPercentages = [ 100 - this._state.percentage[0], this.options.range ? 100 - this._state.percentage[1] : this._state.percentage[1]]; } else { positionPercentages = [ this._state.percentage[0], this._state.percentage[1] ]; } this.handle1.style[this.stylePos] = `${positionPercentages[0]}%`; this.handle1.setAttribute('aria-valuenow', this._state.value[0]); if (isNaN(this.options.formatter(this._state.value[0])) ) { this.handle1.setAttribute('aria-valuetext', this.options.formatter(this._state.value[0])); } this.handle2.style[this.stylePos] =`${positionPercentages[1]}%`; this.handle2.setAttribute('aria-valuenow', this._state.value[1]); if (isNaN(this.options.formatter(this._state.value[1])) ) { this.handle2.setAttribute('aria-valuetext', this.options.formatter(this._state.value[1])); } /* Position highlight range elements */ if (this.rangeHighlightElements.length > 0 && Array.isArray(this.options.rangeHighlights) && this.options.rangeHighlights.length > 0) { for (let i = 0; i < this.options.rangeHighlights.length; i++) { var startPercent = this._toPercentage(this.options.rangeHighlights[i].start); var endPercent = this._toPercentage(this.options.rangeHighlights[i].end); if (this.options.reversed) { var sp = 100-endPercent; endPercent = 100-startPercent; startPercent = sp; } var currentRange = this._createHighlightRange(startPercent, endPercent); if (currentRange) { if (this.options.orientation === 'vertical') { this.rangeHighlightElements[i].style.top = `${currentRange.start}%`; this.rangeHighlightElements[i].style.height = `${currentRange.size}%`; } else { if(this.options.rtl){ this.rangeHighlightElements[i].style.right = `${currentRange.start}%`; } else { this.rangeHighlightElements[i].style.left = `${currentRange.start}%`; } this.rangeHighlightElements[i].style.width = `${currentRange.size}%`; } } else { this.rangeHighlightElements[i].style.display = "none"; } } } /* Position ticks and labels */ if (Array.isArray(this.options.ticks) && this.options.ticks.length > 0) { var styleSize = this.options.orientation === 'vertical' ? 'height' : 'width'; var styleMargin; if( this.options.orientation === 'vertical' ){ styleMargin='marginTop'; }else { if( this.options.rtl ){ styleMargin='marginRight'; } else { styleMargin='marginLeft'; } } var labelSize = this._state.size / (this.options.ticks.length - 1); if (this.tickLabelContainer) { var extraMargin = 0; if (this.options.ticks_positions.length === 0) { if (this.options.orientation !== 'vertical') { this.tickLabelContainer.style[styleMargin] = `${ -labelSize/2 }px`; } extraMargin = this.tickLabelContainer.offsetHeight; } else { /* Chidren are position absolute, calculate height by finding the max offsetHeight of a child */ for (i = 0 ; i < this.tickLabelContainer.childNodes.length; i++) { if (this.tickLabelContainer.childNodes[i].offsetHeight > extraMargin) { extraMargin = this.tickLabelContainer.childNodes[i].offsetHeight; } } } if (this.options.orientation === 'horizontal') { this.sliderElem.style.marginBottom = `${ extraMargin }px`; } } for (var i = 0; i < this.options.ticks.length; i++) { var percentage = this.options.ticks_positions[i] || this._toPercentage(this.options.ticks[i]); if (this.options.reversed) { percentage = 100 - percentage; } this.ticks[i].style[this.stylePos] = `${ percentage }%`; /* Set class labels to denote whether ticks are in the selection */ this._removeClass(this.ticks[i], 'in-selection'); if (!this.options.range) { if (this.options.selection === 'after' && percentage >= positionPercentages[0]){ this._addClass(this.ticks[i], 'in-selection'); } else if (this.options.selection === 'before' && percentage <= positionPercentages[0]) { this._addClass(this.ticks[i], 'in-selection'); } } else if (percentage >= positionPercentages[0] && percentage <= positionPercentages[1]) { this._addClass(this.ticks[i], 'in-selection'); } if (this.tickLabels[i]) { this.tickLabels[i].style[styleSize] = `${labelSize}px`; if (this.options.orientation !== 'vertical' && this.options.ticks_positions[i] !== undefined) { this.tickLabels[i].style.position = 'absolute'; this.tickLabels[i].style[this.stylePos] = `${percentage}%`; this.tickLabels[i].style[styleMargin] = -labelSize/2 + 'px'; } else if (this.options.orientation === 'vertical') { if(this.options.rtl){ this.tickLabels[i].style['marginRight'] = `${this.sliderElem.offsetWidth }px`; }else{ this.tickLabels[i].style['marginLeft'] = `${this.sliderElem.offsetWidth }px`; } this.tickLabelContainer.style[styleMargin] = this.sliderElem.offsetWidth / 2 * -1 + 'px'; } /* Set class labels to indicate tick labels are in the selection or selected */ this._removeClass(this.tickLabels[i], 'label-in-selection label-is-selection'); if (!this.options.range) { if (this.options.selection === 'after' && percentage >= positionPercentages[0]) { this._addClass(this.tickLabels[i], 'label-in-selection'); } else if (this.options.selection === 'before' && percentage <= positionPercentages[0]) { this._addClass(this.tickLabels[i], 'label-in-selection'); } if (percentage === positionPercentages[0]) { this._addClass(this.tickLabels[i], 'label-is-selection'); } } else if (percentage >= positionPercentages[0] && percentage <= positionPercentages[1]) { this._addClass(this.tickLabels[i], 'label-in-selection'); if (percentage === positionPercentages[0] || positionPercentages[1]) { this._addClass(this.tickLabels[i], 'label-is-selection'); } } } } } var formattedTooltipVal; if (this.options.range) { formattedTooltipVal = this.options.formatter(this._state.value); this._setText(this.tooltipInner, formattedTooltipVal); this.tooltip.style[this.stylePos] = `${ (positionPercentages[1] + positionPercentages[0])/2 }%`; var innerTooltipMinText = this.options.formatter(this._state.value[0]); this._setText(this.tooltipInner_min, innerTooltipMinText); var innerTooltipMaxText = this.options.formatter(this._state.value[1]); this._setText(this.tooltipInner_max, innerTooltipMaxText); this.tooltip_min.style[this.stylePos] = `${ positionPercentages[0] }%`; this.tooltip_max.style[this.stylePos] = `${ positionPercentages[1] }%`; } else { formattedTooltipVal = this.options.formatter(this._state.value[0]); this._setText(this.tooltipInner, formattedTooltipVal); this.tooltip.style[this.stylePos] = `${ positionPercentages[0] }%`; } if (this.options.orientation === 'vertical') { this.trackLow.style.top = '0'; this.trackLow.style.height = Math.min(positionPercentages[0], positionPercentages[1]) +'%'; this.trackSelection.style.top = Math.min(positionPercentages[0], positionPercentages[1]) +'%'; this.trackSelection.style.height = Math.abs(positionPercentages[0] - positionPercentages[1]) +'%'; this.trackHigh.style.bottom = '0'; this.trackHigh.style.height = (100 - Math.min(positionPercentages[0], positionPercentages[1]) - Math.abs(positionPercentages[0] - positionPercentages[1])) +'%'; } else { if(this.stylePos==='right') { this.trackLow.style.right = '0'; } else { this.trackLow.style.left = '0'; } this.trackLow.style.width = Math.min(positionPercentages[0], positionPercentages[1]) +'%'; if(this.stylePos==='right') { this.trackSelection.style.right = Math.min(positionPercentages[0], positionPercentages[1]) + '%'; } else { this.trackSelection.style.left = Math.min(positionPercentages[0], positionPercentages[1]) + '%'; } this.trackSelection.style.width = Math.abs(positionPercentages[0] - positionPercentages[1]) +'%'; if(this.stylePos==='right') { this.trackHigh.style.left = '0'; } else { this.trackHigh.style.right = '0'; } this.trackHigh.style.width = (100 - Math.min(positionPercentages[0], positionPercentages[1]) - Math.abs(positionPercentages[0] - positionPercentages[1])) +'%'; var offset_min = this.tooltip_min.getBoundingClientRect(); var offset_max = this.tooltip_max.getBoundingClientRect(); if (this.options.tooltip_position === 'bottom') { if (offset_min.right > offset_max.left) { this._removeClass(this.tooltip_max, 'bottom'); this._addClass(this.tooltip_max, 'top'); this.tooltip_max.style.top = ''; this.tooltip_max.style.bottom = 22 + 'px'; } else { this._removeClass(this.tooltip_max, 'top'); this._addClass(this.tooltip_max, 'bottom'); this.tooltip_max.style.top = this.tooltip_min.style.top; this.tooltip_max.style.bottom = ''; } } else { if (offset_min.right > offset_max.left) { this._removeClass(this.tooltip_max, 'top'); this._addClass(this.tooltip_max, 'bottom'); this.tooltip_max.style.top = 18 + 'px'; } else { this._removeClass(this.tooltip_max, 'bottom'); this._addClass(this.tooltip_max, 'top'); this.tooltip_max.style.top = this.tooltip_min.style.top; } } } }, _createHighlightRange: function (start, end) { if (this._isHighlightRange(start, end)) { if (start > end) { return {'start': end, 'size': start - end}; } return {'start': start, 'size': end - start}; } return null; }, _isHighlightRange: function (start, end) { if (0 <= start && start <= 100 && 0 <= end && end <= 100) { return true; } else { return false; } }, _resize: function (ev) { /*jshint unused:false*/ this._state.offset = this._offset(this.sliderElem); this._state.size = this.sliderElem[this.sizePos]; this._layout(); }, _removeProperty: function(element, prop) { if (element.style.removeProperty) { element.style.removeProperty(prop); } else { element.style.removeAttribute(prop); } }, _mousedown: function(ev) { if(!this._state.enabled) { return false; } if (ev.preventDefault){ ev.preventDefault(); } this._state.offset = this._offset(this.sliderElem); this._state.size = this.sliderElem[this.sizePos]; var percentage = this._getPercentage(ev); if (this.options.range) { var diff1 = Math.abs(this._state.percentage[0] - percentage); var diff2 = Math.abs(this._state.percentage[1] - percentage); this._state.dragged = (diff1 < diff2) ? 0 : 1; this._adjustPercentageForRangeSliders(percentage); } else { this._state.dragged = 0; } this._state.percentage[this._state.dragged] = percentage; this._layout(); if (this.touchCapable) { document.removeEventListener("touchmove", this.mousemove, false); document.removeEventListener("touchend", this.mouseup, false); } if(this.mousemove){ document.removeEventListener("mousemove", this.mousemove, false); } if(this.mouseup){ document.removeEventListener("mouseup", this.mouseup, false); } this.mousemove = this._mousemove.bind(this); this.mouseup = this._mouseup.bind(this); if (this.touchCapable) { // Touch: Bind touch events: document.addEventListener("touchmove", this.mousemove, false); document.addEventListener("touchend", this.mouseup, false); } // Bind mouse events: document.addEventListener("mousemove", this.mousemove, false); document.addEventListener("mouseup", this.mouseup, false); this._state.inDrag = true; var newValue = this._calculateValue(); this._trigger('slideStart', newValue); this._setDataVal(newValue); this.setValue(newValue, false, true); ev.returnValue = false; if (this.options.focus) { this._triggerFocusOnHandle(this._state.dragged); } return true; }, _touchstart: function(ev) { if (ev.changedTouches === undefined) { this._mousedown(ev); return; } var touch = ev.changedTouches[0]; this.touchX = touch.pageX; this.touchY = touch.pageY; }, _triggerFocusOnHandle: function(handleIdx) { if(handleIdx === 0) { this.handle1.focus(); } if(handleIdx === 1) { this.handle2.focus(); } }, _keydown: function(handleIdx, ev) { if(!this._state.enabled) { return false; } var dir; switch (ev.keyCode) { case 37: // left case 40: // down dir = -1; break; case 39: // right case 38: // up dir = 1; break; } if (!dir) { return; } // use natural arrow keys instead of from min to max if (this.options.natural_arrow_keys) { var ifVerticalAndNotReversed = (this.options.orientation === 'vertical' && !this.options.reversed); var ifHorizontalAndReversed = (this.options.orientation === 'horizontal' && this.options.reversed); // @todo control with rtl if (ifVerticalAndNotReversed || ifHorizontalAndReversed) { dir = -dir; } } var val = this._state.value[handleIdx] + dir * this.options.step; const percentage = (val / this.options.max) * 100; this._state.keyCtrl = handleIdx; if (this.options.range) { this._adjustPercentageForRangeSliders(percentage); const val1 = (!this._state.keyCtrl) ? val : this._state.value[0]; const val2 = (this._state.keyCtrl) ? val : this._state.value[1]; val = [ val1, val2]; } this._trigger('slideStart', val); this._setDataVal(val); this.setValue(val, true, true); this._setDataVal(val); this._trigger('slideStop', val); this._layout(); this._pauseEvent(ev); delete this._state.keyCtrl; return false; }, _pauseEvent: function(ev) { if(ev.stopPropagation) { ev.stopPropagation(); } if(ev.preventDefault) { ev.preventDefault(); } ev.cancelBubble=true; ev.returnValue=false; }, _mousemove: function(ev) { if(!this._state.enabled) { return false; } var percentage = this._getPercentage(ev); this._adjustPercentageForRangeSliders(percentage); this._state.percentage[this._state.dragged] = percentage; this._layout(); var val = this._calculateValue(true); this.setValue(val, true, true); return false; }, _touchmove: function(ev) { if (ev.changedTouches === undefined) { return; } var touch = ev.changedTouches[0]; var xDiff = touch.pageX - this.touchX; var yDiff = touch.pageY - this.touchY; if (!this._state.inDrag) { // Vertical Slider if (this.options.orientation === 'vertical' && (xDiff <= 5 && xDiff >= -5) && (yDiff >=15 || yDiff <= -15)) { this._mousedown(ev); } // Horizontal slider. else if ((yDiff <= 5 && yDiff >= -5) && (xDiff >= 15 || xDiff <= -15)) { this._mousedown(ev); } } }, _adjustPercentageForRangeSliders: function(percentage) { if (this.options.range) { var precision = this._getNumDigitsAfterDecimalPlace(percentage); precision = precision ? precision - 1 : 0; var percentageWithAdjustedPrecision = this._applyToFixedAndParseFloat(percentage, precision); if (this._state.dragged === 0 && this._applyToFixedAndParseFloat(this._state.percentage[1], precision) < percentageWithAdjustedPrecision) { this._state.percentage[0] = this._state.percentage[1]; this._state.dragged = 1; } else if (this._state.dragged === 1 && this._applyToFixedAndParseFloat(this._state.percentage[0], precision) > percentageWithAdjustedPrecision) { this._state.percentage[1] = this._state.percentage[0]; this._state.dragged = 0; } else if (this._state.keyCtrl === 0 && (((this._state.value[1] / this.options.max) * 100) < percentage)) { this._state.percentage[0] = this._state.percentage[1]; this._state.keyCtrl = 1; this.handle2.focus(); } else if (this._state.keyCtrl === 1 && (((this._state.value[0] / this.options.max) * 100) > percentage)) { this._state.percentage[1] = this._state.percentage[0]; this._state.keyCtrl = 0; this.handle1.focus(); } } }, _mouseup: function() { if(!this._state.enabled) { return false; } if (this.touchCapable) { // Touch: Unbind touch event handlers: document.removeEventListener("touchmove", this.mousemove, false); document.removeEventListener("touchend", this.mouseup, false); } // Unbind mouse event handlers: document.removeEventListener("mousemove", this.mousemove, false); document.removeEventListener("mouseup", this.mouseup, false); this._state.inDrag = false; if (this._state.over === false) { this._hideTooltip(); } var val = this._calculateValue(true); this._layout(); this._setDataVal(val); this._trigger('slideStop', val); // No longer need 'dragged' after mouse up this._state.dragged = null; return false; }, _calculateValue: function(snapToClosestTick) { var val; if (this.options.range) { val = [this.options.min,this.options.max]; if (this._state.percentage[0] !== 0){ val[0] = this._toValue(this._state.percentage[0]); val[0] = this._applyPrecision(val[0]); } if (this._state.percentage[1] !== 100){ val[1] = this._toValue(this._state.percentage[1]); val[1] = this._applyPrecision(val[1]); } if (snapToClosestTick) { val[0] = this._snapToClosestTick(val[0]); val[1] = this._snapToClosestTick(val[1]); } } else { val = this._toValue(this._state.percentage[0]); val = parseFloat(val); val = this._applyPrecision(val); if (snapToClosestTick) { val = this._snapToClosestTick(val); } } return val; }, _snapToClosestTick(val){ var min = [val, Infinity]; for (var i = 0; i < this.options.ticks.length; i++) { var diff = Math.abs(this.options.ticks[i] - val); if (diff <= min[1]) { min = [this.options.ticks[i], diff]; } } if (min[1] <= this.options.ticks_snap_bounds) { return min[0]; } return val; }, _applyPrecision: function(val) { var precision = this.options.precision || this._getNumDigitsAfterDecimalPlace(this.options.step); return this._applyToFixedAndParseFloat(val, precision); }, _getNumDigitsAfterDecimalPlace: function(num) { var match = (''+num).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/); if (!match) { return 0; } return Math.max(0, (match[1] ? match[1].length : 0) - (match[2] ? +match[2] : 0)); }, _applyToFixedAndParseFloat: function(num, toFixedInput) { var truncatedNum = num.toFixed(toFixedInput); return parseFloat(truncatedNum); }, /* Credits to Mike Samuel for the following method! Source: http://stackoverflow.com/questions/10454518/javascript-how-to-retrieve-the-number-of-decimals-of-a-string-number */ _getPercentage: function(ev) { if (this.touchCapable && (ev.type === 'touchstart' || ev.type === 'touchmove')) { ev = ev.touches[0]; } var eventPosition = ev[this.mousePos]; var sliderOffset = this._state.offset[this.stylePos]; var distanceToSlide = eventPosition - sliderOffset; if(this.stylePos==='right') { distanceToSlide = -distanceToSlide; } // Calculate what percent of the length the slider handle has slid var percentage = (distanceToSlide / this._state.size) * 100; percentage = Math.round(percentage / this._state.percentage[2]) * this._state.percentage[2]; if (this.options.reversed) { percentage = 100 - percentage; } // Make sure the percent is within the bounds of the slider. // 0% corresponds to the 'min' value of the slide // 100% corresponds to the 'max' value of the slide return Math.max(0, Math.min(100, percentage)); }, _validateInputValue: function(val) { if (!isNaN(+val)) { return +val; } else if (Array.isArray(val)) { this._validateArray(val); return val; } else { throw new Error(ErrorMsgs.formatInvalidInputErrorMsg(val)); } }, _validateArray: function(val) { for(var i = 0; i < val.length; i++) { var input = val[i]; if (typeof input !== 'number') { throw new Error( ErrorMsgs.formatInvalidInputErrorMsg(input) ); } } }, _setDataVal: function(val) { this.element.setAttribute('data-value', val); this.element.setAttribute('value', val); this.element.value = val; }, _trigger: function(evt, val) { val = (val || val === 0) ? val : undefined; var callbackFnArray = this.eventToCallbackMap[evt]; if(callbackFnArray && callbackFnArray.length) { for(var i = 0; i < callbackFnArray.length; i++) { var callbackFn = callbackFnArray[i]; callbackFn(val); } } /* If JQuery exists, trigger JQuery events */ if($) { this._triggerJQueryEvent(evt, val); } }, _triggerJQueryEvent: function(evt, val) { var eventData = { type: evt, value: val }; this.$element.trigger(eventData); this.$sliderElem.trigger(eventData); }, _unbindJQueryEventHandlers: function() { this.$element.off(); this.$sliderElem.off(); }, _setText: function(element, text) { if(typeof element.textContent !== "undefined") { element.textContent = text; } else if(typeof element.innerText !== "undefined") { element.innerText = text; } }, _removeClass: function(element, classString) { var classes = classString.split(" "); var newClasses = element.className; for(var i = 0; i < classes.length; i++) { var classTag = classes[i]; var regex = new RegExp("(?:\\s|^)" + classTag + "(?:\\s|$)"); newClasses = newClasses.replace(regex, " "); } element.className = newClasses.trim(); }, _addClass: function(element, classString) { var classes = classString.split(" "); var newClasses = element.className; for(var i = 0; i < classes.length; i++) { var classTag = classes[i]; var regex = new RegExp("(?:\\s|^)" + classTag + "(?:\\s|$)"); var ifClassExists = regex.test(newClasses); if(!ifClassExists) { newClasses += " " + classTag; } } element.className = newClasses.trim(); }, _offsetLeft: function(obj){ return obj.getBoundingClientRect().left; }, _offsetRight: function(obj){ return obj.getBoundingClientRect().right; }, _offsetTop: function(obj){ var offsetTop = obj.offsetTop; while((obj = obj.offsetParent) && !isNaN(obj.offsetTop)){ offsetTop += obj.offsetTop; if( obj.tagName !== 'BODY') { offsetTop -= obj.scrollTop; } } return offsetTop; }, _offset: function (obj) { return { left: this._offsetLeft(obj), right: this._offsetRight(obj), top: this._offsetTop(obj) }; }, _css: function(elementRef, styleName, value) { if ($) { $.style(elementRef, styleName, value); } else { var style = styleName.replace(/^-ms-/, "ms-").replace(/-([\da-z])/gi, function (all, letter) { return letter.toUpperCase(); }); elementRef.style[style] = value; } }, _toValue: function(percentage) { return this.options.scale.toValue.apply(this, [percentage]); }, _toPercentage: function(value) { return this.options.scale.toPercentage.apply(this, [value]); }, _setTooltipPosition: function(){ var tooltips = [this.tooltip, this.tooltip_min, this.tooltip_max]; if (this.options.orientation === 'vertical'){ var tooltipPos; if(this.options.tooltip_position) { tooltipPos = this.options.tooltip_position; } else { if(this.options.rtl) { tooltipPos = 'left'; } else { tooltipPos = 'right'; } } var oppositeSide = (tooltipPos === 'left') ? 'right' : 'left'; tooltips.forEach(function(tooltip){ this._addClass(tooltip, tooltipPos); tooltip.style[oppositeSide] = '100%'; }.bind(this)); } else if(this.options.tooltip_position === 'bottom') { tooltips.forEach(function(tooltip){ this._addClass(tooltip, 'bottom'); tooltip.style.top = 22 + 'px'; }.bind(this)); } else { tooltips.forEach(function(tooltip){ this._addClass(tooltip, 'top'); tooltip.style.top = -this.tooltip.outerHeight - 14 + 'px'; }.bind(this)); } } }; /********************************* Attach to global namespace *********************************/ if($ && $.fn) { let autoRegisterNamespace; if (!$.fn.slider) { $.bridget(NAMESPACE_MAIN, Slider); autoRegisterNamespace = NAMESPACE_MAIN; } else { if (windowIsDefined) { window.console.warn("bootstrap-slider.js - WARNING: $.fn.slider namespace is already bound. Use the $.fn.bootstrapSlider namespace instead."); } autoRegisterNamespace = NAMESPACE_ALTERNATE; } $.bridget(NAMESPACE_ALTERNATE, Slider); // Auto-Register data-provide="slider" Elements $(function() { $("input[data-provide=slider]")[autoRegisterNamespace](); }); } })( $ ); return Slider; })); src/sass/_variables.scss000064400000001675151676726750011347 0ustar00$slider-line-height: 20px !default; $slider-border-radius: 4px !default; $slider-horizontal-width: 210px !default; $slider-vertical-height: 210px !default; // Primary colors $slider-primary: null !default; @if variable-exists(brand-primary) { $slider-primary: $brand-primary !default; } @else { $slider-primary: #0480BE !default; } $slider-primary-top: $slider-primary !default; $slider-primary-bottom: darken($slider-primary, 5%) !default; $slider-secondary-top: saturate(lighten($slider-primary, 28%), 20%) !default; $slider-secondary-bottom: saturate(lighten($slider-primary, 23%), 2%) !default; // grays for slider channel and disabled states $slider-gray-1: #BEBEBE !default; $slider-gray-2: #DFDFDF !default; $slider-gray-3: #E5E5E5 !default; $slider-gray-4: #E9E9E9 !default; $slider-gray-5: #F5F5F5 !default; $slider-gray-6: #F9F9F9 !default; // unicode color for demo page $slider-unicode-color: #726204 !default;src/sass/_mixins.scss000064400000002041151676726750010672 0ustar00@mixin slider_background-image ($colorstart:#F5F5F5, $colorend:#F9F9F9, $backcolor: #F7F7F7) { background-color: $backcolor; background-image: -moz-linear-gradient(top, $colorstart, $colorend); background-image: -webkit-gradient(linear, 0 0, 0 100%, from($colorstart), to($colorend)); background-image: -webkit-linear-gradient(top, $colorstart, $colorend); background-image: -o-linear-gradient(top, $colorstart, $colorend); background-image: linear-gradient(to bottom, $colorstart, $colorend); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{$colorstart}', endColorstr='#{$colorend}',GradientType=0); } @mixin slider_box-sizing ($value) { -webkit-box-sizing: $value; -moz-box-sizing: $value; box-sizing: $value; } @mixin slider_box-shadow ($value...) { -webkit-box-shadow: $value; -moz-box-shadow: $value; box-shadow: $value; } @mixin slider_border-radius ($value) { -webkit-border-radius: $value; -moz-border-radius: $value; border-radius: $value; }src/sass/_rules.scss000064400000014506151676726750010526 0ustar00.slider { display: inline-block; vertical-align: middle; position: relative; &.slider-horizontal { width: $slider-horizontal-width; height: $slider-line-height; .slider-track { height: $slider-line-height/2; width: 100%; margin-top: -$slider-line-height/4; top: 50%; left: 0; } .slider-selection, .slider-track-low, .slider-track-high { height: 100%; top: 0; bottom: 0; } .slider-tick, .slider-handle { margin-left: -$slider-line-height/2; &.triangle { position: relative; top: 50%; transform: translateY(-50%); border-width: 0 $slider-line-height/2 $slider-line-height/2 $slider-line-height/2; width: 0; height: 0; border-bottom-color: $slider-primary-bottom; margin-top: 0; } } .slider-tick-container { white-space: nowrap; position: absolute; top: 0; left: 0; width: 100%; } .slider-tick-label-container { white-space: nowrap; margin-top: $slider-line-height; .slider-tick-label { display: inline-block; padding-top: $slider-line-height * 1.2; text-align: center; } } &.slider-rtl { .slider-track { left: initial; right: 0; } .slider-tick, .slider-handle { margin-left: initial; margin-right: -$slider-line-height/2; } .slider-tick-container { left: initial; right: 0; } } } &.slider-vertical { height: $slider-vertical-height; width: $slider-line-height; .slider-track { width: $slider-line-height/2; height: 100%; left: 25%; top: 0; } .slider-selection { width: 100%; left: 0; top: 0; bottom: 0; } .slider-track-low, .slider-track-high { width: 100%; left: 0; right: 0; } .slider-tick, .slider-handle { margin-top: -$slider-line-height/2; &.triangle { border-width: $slider-line-height/2 0 $slider-line-height/2 $slider-line-height/2; width: 1px; height: 1px; border-left-color: $slider-primary-bottom; margin-left: 0; } } .slider-tick-label-container { white-space: nowrap; .slider-tick-label { padding-left: $slider-line-height * .2; } } &.slider-rtl { .slider-track { left: initial; right: 25%; } .slider-selection { left: initial; right: 0; } .slider-tick, .slider-handle { &.triangle { border-width: $slider-line-height/2 $slider-line-height/2 $slider-line-height/2 0; } } .slider-tick-label-container { .slider-tick-label { padding-left: initial; padding-right: $slider-line-height * .2; } } } } &.slider-disabled { .slider-handle { @include slider_background-image($slider-gray-2, $slider-gray-1, mix($slider-gray-2, $slider-gray-1)); } .slider-track { @include slider_background-image($slider-gray-3, $slider-gray-4, mix($slider-gray-3, $slider-gray-4)); cursor: not-allowed; } } input { display: none; } .tooltip-inner { white-space: nowrap; max-width: none; } .tooltip { pointer-events: none; &.top { margin-top: -36px; } } .tooltip-inner { white-space: nowrap; max-width: none; } .hide { display: none; } } .slider-track { @include slider_background-image($slider-gray-5, $slider-gray-6, mix($slider-gray-5, $slider-gray-6)); @include slider_box-shadow(inset 0 1px 2px rgba(0,0,0,0.1)); @include slider_border-radius($slider-border-radius); position: absolute; cursor: pointer; } .slider-selection { @include slider_background-image($slider-gray-6, $slider-gray-5, mix($slider-gray-6, $slider-gray-5)); @include slider_box-shadow(inset 0 -1px 0 rgba(0,0,0,0.15)); @include slider_box-sizing(border-box); @include slider_border-radius($slider-border-radius); position: absolute; } .slider-selection.tick-slider-selection { @include slider_background-image($slider-secondary-top, $slider-secondary-bottom, mix($slider-secondary-top, $slider-secondary-bottom)); } .slider-track-low, .slider-track-high { @include slider_box-sizing(border-box); @include slider_border-radius($slider-border-radius); position: absolute; background: transparent; } .slider-handle { @include slider_background-image($slider-primary-top, $slider-primary-bottom, mix($slider-primary-top, $slider-primary-bottom)); @include slider_box-shadow(inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05)); position: absolute; top: 0; width: $slider-line-height; height: $slider-line-height; background-color: $slider-primary; border: 0px solid transparent; &:hover { cursor: pointer; } &.round { @include slider_border-radius($slider-line-height); } &.triangle { background: transparent none; } &.custom { background: transparent none; &::before{ line-height: $slider-line-height; font-size: 20px; content: '\2605'; //unicode star character color: $slider-unicode-color; } } } .slider-tick { @include slider_background-image($slider-gray-5, $slider-gray-6, mix($slider-gray-5, $slider-gray-6)); @include slider_box-shadow(inset 0 -1px 0 rgba(0,0,0,0.15)); @include slider_box-sizing(border-box); position: absolute; cursor: pointer; width: $slider-line-height; height: $slider-line-height; filter: none; opacity: 0.8; border: 0px solid transparent; &.round { border-radius: 50%; } &.triangle { background: transparent none; } &.custom { background: transparent none; &::before { line-height: $slider-line-height; font-size: 20px; content: '\2605'; //unicode star character color: $slider-unicode-color; } } &.in-selection { @include slider_background-image($slider-secondary-top, $slider-secondary-bottom, mix($slider-secondary-top, $slider-secondary-bottom)); opacity: 1; } } src/sass/bootstrap-slider.scss000064400000003216151676726750012526 0ustar00/*! ========================================================= * bootstrap-slider.js * * Maintainers: * Kyle Kemp * - Twitter: @seiyria * - Github: seiyria * Rohit Kalkur * - Twitter: @Rovolutionary * - Github: rovolution * * ========================================================= * * bootstrap-slider is released under the MIT License * Copyright (c) 2017 Kyle Kemp, Rohit Kalkur, and contributors * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * ========================================================= */ @import "variables"; @import "mixins"; @import "rules";src/less/rules.less000064400000013033151676726750010351 0ustar00.slider { display: inline-block; vertical-align: middle; position: relative; &.slider-horizontal { width: @slider-horizontal-width; height: @slider-line-height; .slider-track { height: (@slider-line-height/2); width: 100%; margin-top: (-@slider-line-height/4); top: 50%; left: 0; } .slider-selection, .slider-track-low, .slider-track-high { height: 100%; top: 0; bottom: 0; } .slider-tick, .slider-handle { margin-left: (-@slider-line-height/2); &.triangle { position: relative; top: 50%; -ms-transform: translateY(-50%); transform: translateY(-50%); border-width: 0 (@slider-line-height/2) (@slider-line-height/2) (@slider-line-height/2); width: 0; height: 0; border-bottom-color: @slider-primary-bottom; margin-top: 0; } } .slider-tick-container { white-space: nowrap; position: absolute; top: 0; left: 0; width: 100%; } .slider-tick-label-container { white-space: nowrap; margin-top: @slider-line-height; .slider-tick-label { padding-top: @slider-line-height * .2; display: inline-block; text-align: center; } } .tooltip { -ms-transform: translateX(-50%); transform: translateX(-50%); } &.slider-rtl { .slider-track { left: initial; right: 0; } .slider-tick, .slider-handle { margin-left: initial; margin-right: (-@slider-line-height/2); } .slider-tick-container { left: initial; right: 0; } .tooltip { -ms-transform: translateX(+50%); transform: translateX(+50%); } } } &.slider-vertical { height: @slider-vertical-height; width: @slider-line-height; .slider-track { width: (@slider-line-height/2); height: 100%; left: 25%; top: 0; } .slider-selection { width: 100%; left: 0; top: 0; bottom: 0; } .slider-track-low, .slider-track-high { width: 100%; left: 0; right: 0; } .slider-tick, .slider-handle { margin-top: (-@slider-line-height/2); &.triangle { border-width: (@slider-line-height/2) 0 (@slider-line-height/2) (@slider-line-height/2); width: 1px; height: 1px; border-left-color: @slider-primary-bottom; border-right-color: @slider-primary-bottom; margin-left: 0; margin-right: 0; } } .slider-tick-label-container { white-space: nowrap; .slider-tick-label { padding-left: @slider-line-height * .2; } } .tooltip { -ms-transform: translateY(-50%); transform: translateY(-50%); } &.slider-rtl { .slider-track { left: initial; right: 25%; } .slider-selection { left: initial; right: 0; } .slider-tick, .slider-handle { &.triangle { border-width: (@slider-line-height/2) (@slider-line-height/2) (@slider-line-height/2) 0; } } .slider-tick-label-container { .slider-tick-label { padding-left: initial; padding-right: @slider-line-height * .2; } } } } &.slider-disabled { .slider-handle { #gradient > .vertical(@slider-gray-2, @slider-gray-1); } .slider-track { #gradient > .vertical(@slider-gray-3, @slider-gray-4); cursor: not-allowed; } } input { display: none; } .tooltip { pointer-events: none; &.top { margin-top: -36px; } } .tooltip-inner { white-space: nowrap; max-width: none; } .hide { display: none; } } .slider-track { position: absolute; cursor: pointer; #gradient > .vertical(@slider-gray-5, @slider-gray-6); .box-shadow(inset 0 1px 2px rgba(0,0,0,.1)); border-radius: @border-radius-base; } .slider-selection { position: absolute; #gradient > .vertical(@slider-gray-6, @slider-gray-5); .box-shadow(inset 0 -1px 0 rgba(0,0,0,.15)); .box-sizing(border-box); border-radius: @border-radius-base; } .slider-selection.tick-slider-selection { #gradient > .vertical(@slider-secondary-top, @slider-secondary-bottom); } .slider-track-low, .slider-track-high { position: absolute; background: transparent; .box-sizing(border-box); border-radius: @border-radius-base; } .slider-handle { position: absolute; top: 0; width: @slider-line-height; height: @slider-line-height; background-color: @slider-primary; #gradient > .vertical(@slider-primary-top, @slider-primary-bottom); filter: none; .box-shadow(~"inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05)"); border: 0px solid transparent; &:hover { cursor: pointer; } &.round { border-radius: 50%; } &.triangle { background: transparent none; } &.custom { background: transparent none; &::before{ line-height: @slider-line-height; font-size: 20px; content: '\2605'; //unicode star character color: @slider-unicode-color; } } } .slider-tick { position: absolute; cursor: pointer; width: @slider-line-height; height: @slider-line-height; #gradient.vertical(@slider-gray-6, @slider-gray-5); .box-shadow(inset 0 -1px 0 rgba(0,0,0,.15)); .box-sizing(border-box); filter: none; opacity: 0.8; border: 0px solid transparent; &.round { border-radius: 50%; } &.triangle { background: transparent none; } &.custom { background: transparent none; &::before{ line-height: @slider-line-height; font-size: 20px; content: '\2605'; //unicode star character color: @slider-unicode-color; } } &.in-selection { #gradient > .vertical(@slider-secondary-top, @slider-secondary-bottom); opacity: 1; } } src/less/bootstrap-slider.less000064400000003543151676726750012521 0ustar00/*! ========================================================= * bootstrap-slider.js * * Maintainers: * Kyle Kemp * - Twitter: @seiyria * - Github: seiyria * Rohit Kalkur * - Twitter: @Rovolutionary * - Github: rovolution * * ========================================================= * * bootstrap-slider is released under the MIT License * Copyright (c) 2017 Kyle Kemp, Rohit Kalkur, and contributors * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * ========================================================= */ @import '../../node_modules/bootstrap/less/variables.less'; // Bootstrap variables @import '../../node_modules/bootstrap/less/mixins.less'; // Bootstrap mixins @import 'variables.less'; // slider-specific variables @import 'rules.less'; // slider-specific rulessrc/less/variables.less000064400000001411151676726750011164 0ustar00@slider-line-height: @line-height-computed; @slider-horizontal-width: 210px; @slider-vertical-height: 210px; // Primary colors // @brand-primary is set in ../../node_modules/bootstrap/less/variables.less and evaluates to #337ab7 @slider-primary: @brand-primary; @slider-primary-top: @slider-primary; @slider-primary-bottom: darken(@slider-primary, 5%); @slider-secondary-top: saturate(lighten(@slider-primary, 28%), 20%); @slider-secondary-bottom: saturate(lighten(@slider-primary, 23%), 2%); // grays for slider channel and disabled states @slider-gray-1: #BEBEBE; @slider-gray-2: #DFDFDF; @slider-gray-3: #E5E5E5; @slider-gray-4: #E9E9E9; @slider-gray-5: #F5F5F5; @slider-gray-6: #F9F9F9; // unicode color for demo page @slider-unicode-color: #726204;package.json000064400000007170151676726750007065 0ustar00{ "_args": [ [ "bootstrap-slider@10.3.2", "C:\\Users\\Ovi-PC\\Downloads\\themekit-master\\themekit" ] ], "_from": "bootstrap-slider@10.3.2", "_id": "bootstrap-slider@10.3.2", "_inBundle": false, "_integrity": "sha512-81SOegSEW+0lPng/jsaUeFbQ8IcuGNSdkaOXOpu+hGp02A0XyfAAjg3dTAZ++Im4Ik8V2R04KOYuihG0S1t5TA==", "_location": "/bootstrap-slider", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, "raw": "bootstrap-slider@10.3.2", "name": "bootstrap-slider", "escapedName": "bootstrap-slider", "rawSpec": "10.3.2", "saveSpec": null, "fetchSpec": "10.3.2" }, "_requiredBy": [ "/" ], "_resolved": "https://registry.npmjs.org/bootstrap-slider/-/bootstrap-slider-10.3.2.tgz", "_spec": "10.3.2", "_where": "C:\\Users\\Ovi-PC\\Downloads\\themekit-master\\themekit", "author": { "name": "bootstrap-slider" }, "bugs": { "url": "http://github.com/seiyria/bootstrap-slider/issues" }, "contributors": [ { "name": "Kyle Kemp" }, { "name": "Rohit Kalkur" } ], "dependencies": {}, "description": "Slider view component for Twitter Bootstrap.", "devDependencies": { "babel-preset-es2015": "6.3.13", "bootstrap": "^3.3.6", "grunt": "^0.4.5", "grunt-babel": "6.0.0", "grunt-bump": "0.0.16", "grunt-contrib-clean": "0.6.0", "grunt-contrib-connect": "0.5.0", "grunt-contrib-jasmine": "1.0.3", "grunt-contrib-jshint": "0.11.3", "grunt-contrib-less": "0.7.0", "grunt-contrib-uglify": "0.2.4", "grunt-contrib-watch": "0.5.3", "grunt-header": "1.0.0", "grunt-lesslint": "^3.2.0", "grunt-open": "0.2.2", "grunt-sass-lint": "^0.2.2", "grunt-template": "0.2.0" }, "engine": {}, "gitHead": "67eb8fe3c26205efc94ae95b3ef37a469eef0b81", "gruntConfig": { "devPort": 9000, "js": { "highlightjs": "dependencies/js/highlight.min.js", "modernizr": "dependencies/js/modernizr.js", "jquery": "dependencies/js/jquery.min.js", "bindPolyfill": "test/phantom_bind_polyfill.js", "slider": "src/js/bootstrap-slider.js" }, "less": { "slider": "src/less/bootstrap-slider.less", "rules": "src/less/rules.less", "variables": "src/less/variables.less" }, "css": { "bootstrap": "node_modules/bootstrap/dist/css/bootstrap.min.css", "highlightjs": "dependencies/css/highlightjs-github-theme.css" }, "tpl": { "SpecRunner": "tpl/SpecRunner.tpl", "index": "tpl/index.tpl" }, "temp": { "js": "temp/bootstrap-slider.js", "jsMin": "temp/bootstrap-slider.min.js", "css": "temp/bootstrap-slider.css", "cssMin": "temp/bootstrap-slider.min.css" }, "dist": { "js": "dist/bootstrap-slider.js", "jsMin": "dist/bootstrap-slider.min.js", "css": "dist/css/bootstrap-slider.css", "cssMin": "dist/css/bootstrap-slider.min.css" }, "spec": "test/specs/**/*.js" }, "homepage": "http://github.com/seiyria/bootstrap-slider", "keywords": [ "slider", "bootstrap", "twitter", "slide" ], "license": "MIT", "main": "dist/bootstrap-slider.js", "name": "bootstrap-slider", "repository": { "type": "git", "url": "git://github.com/seiyria/bootstrap-slider.git" }, "scripts": { "pretest": "grunt lint", "release": "sh ./scripts/release.sh", "test": "grunt test", "update-gh-pages": "sh ./scripts/update-gh-pages.sh" }, "style": "dist/css/bootstrap-slider.css", "version": "10.3.2" } composer.json000064400000002077151676726750007322 0ustar00{ "name": "seiyria/bootstrap-slider", "type": "library", "version": "10.3.2", "description": "A less buggy fork of the original bootstrap slider found on http://www.eyecon.ro/ by Stefan Petre. It was forked so we could update the slider since the original wasn't under version control.", "keywords": ["slider", "css", "bootstrap", "javascript"], "homepage": "https://github.com/seiyria/bootstrap-slider", "require": {}, "license": "MIT", "authors": [ { "name": "Kyle Kemp", "email": "kyle@seiyria.com", "homepage": "http://seiyria.com", "role": "Developer" }, { "name": "Rohit Kalkur", "email": "rohit.kalkur@gmail.com", "homepage": "http://www.rovolutionary.com", "role": "Developer" }, { "name": "Lucas Zardo", "email": "lucas@deliverymuch.com.br", "homepage": "https://deliverymuch.com.br", "role": "Packagist Editor" } ] }.travis.yml000064400000000161151676726750006701 0ustar00language: node_js node_js: - "5.1.1" before_install: - npm install -g grunt-cli bower - npm install test/specs/LogarithmicScaleSpec.js000064400000004466151676726750013263 0ustar00 /* ************************* Logarithmic Scale Tests ************************* */ describe("Slider with logarithmic scale tests", function() { var testSlider; describe("Should properly position the slider", function() { function testSliderPosition(min, max, value){ testSlider = $("#testSlider1").slider({ min: min, max: max, scale: 'logarithmic', value: value // This should be at 50% }); var expectedPostition = 210 / 2 + 'px'; var handle = $("#testSlider1").siblings('div.slider').find('.min-slider-handle'); expect(handle.css('left')).toBe(expectedPostition); } it("with positive values", function() { testSliderPosition(1, 10000, 100); }); it("with zero", function() { testSliderPosition(0, 63, 7); }); it("with a negative value", function() { testSliderPosition(-7, 56, 0); }); }); it("Should properly position the tick marks", function() { testSlider = $("#testSlider1").slider({ min: 1, max: 100, scale: 'logarithmic', ticks: [1,10,20,50,100] }); // Position expected for the '10' tick var expectedTickOnePosition = 210 / 2 + 'px'; //should be at 50% var handle = $("#testSlider1").siblings('div.slider').find(".slider-tick").eq(1); expect(handle.css('left')).toBe(expectedTickOnePosition); }); it("Should use step size when navigating the keyboard", function() { testSlider = $("#testSlider1").slider({ min: 1, max: 10000, scale: 'logarithmic', value: 100, step: 5 }); // Focus on handle1 var handle1 = $("#testSlider1").siblings('div.slider:first').find('.slider-handle'); handle1.focus(); // Create keyboard event var keyboardEvent = document.createEvent("Events"); keyboardEvent.initEvent("keydown", true, true); var keyPresses = 0; handle1.on("keydown", function() { keyPresses++; var value = $("#testSlider1").slider('getValue'); expect(value).toBe(100 + keyPresses*5); }); keyboardEvent.keyCode = keyboardEvent.which = 39; // RIGHT for (var i = 0; i < 5; i++) { handle1[0].dispatchEvent(keyboardEvent); } }); afterEach(function() { if(testSlider) { testSlider.slider('destroy'); testSlider = null; } }); }); test/specs/AriaValueTextFormatterSpec.js000064400000004671151676726750014451 0ustar00describe("Aria-valuetext Tests", function() { it("Sets the aria-valuetext to 'formatter' value", function() { var textValArrayA = new Array('Monday','Wednesday','Friday'); var tooltipFormatterA = function(value) { var arrActiveValueA = value; return textValArrayA[arrActiveValueA-1]; }; //Formatter is used var testSliderA = $("#accessibilitySliderA").slider({ formatter : tooltipFormatterA }); testSliderA.slider('setValue', 2); var tooltipMessageA = $("#accessibilitySliderA").prev(".slider").children(".min-slider-handle").attr("aria-valuetext"); var expectedMessageA = tooltipFormatterA(2); expect(tooltipMessageA).toBe(expectedMessageA); }); it("Does not use aria-valuetext if 'formatter' is not used", function() { //Formatter is not used var testSliderB = $("#accessibilitySliderB").slider({}); testSliderB.slider('setValue', 1); var ariaValueTextB = $("#accessibilitySliderB").prev(".slider").children(".min-slider-handle").attr("aria-valuetext"); expect(ariaValueTextB).not.toBeDefined(); }); it("aria-valuetext if 'formatter' is used and has min & max value", function() { var textValArrayC = new Array('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'); var tooltipFormatterC = function(value) { if(value[1]){ var arrActiveValueC0 = value[0]; var arrActiveValueC1 = value[1]; return [ textValArrayC[arrActiveValueC0-1], textValArrayC[arrActiveValueC1-1] ]; } else { var arrActiveValueC = value; return textValArrayC[arrActiveValueC-1]; } }; //Formatter is used for ranges var testSliderC = $("#accessibilitySliderC").slider({ range: true, formatter : tooltipFormatterC }); var valuesToSet = [2,4]; testSliderC.slider('setValue', valuesToSet); var expectedMessageC = tooltipFormatterC([2,4]); var ttminMessage = $("#accessibilitySliderC").prev(".slider").children(".min-slider-handle").attr("aria-valuetext"); var ttmaxMessage = $("#accessibilitySliderC").prev(".slider").children(".max-slider-handle").attr("aria-valuetext"); expect(ttminMessage).toBe(expectedMessageC[0]); expect(ttmaxMessage).toBe(expectedMessageC[1]); }); }); test/specs/AccessibilitySpec.js000064400000006665151676726750012643 0ustar00describe("Accessibility Tests", function() { var sliderA; var sliderB; it("Should have the slider role", function() { sliderA = $('#accessibilitySliderA').slider(); sliderB = $('#accessibilitySliderB').slider(); var $sliderElementA = $(sliderA.slider('getElement')); var $sliderElementB = $(sliderB.slider('getElement')); expect($sliderElementA.find('.min-slider-handle').attr('role')).toBe('slider'); expect($sliderElementB.find('.min-slider-handle').attr('role')).toBe('slider'); expect($sliderElementB.find('.max-slider-handle').attr('role')).toBe('slider'); expect($sliderElementA.find('.tooltip-main').attr('role')).toBe('presentation'); expect($sliderElementA.find('.tooltip-min').attr('role')).toBe('presentation'); expect($sliderElementA.find('.tooltip-max').attr('role')).toBe('presentation'); }); it('Should have an aria-labelledby attribute', function() { sliderA = $('#accessibilitySliderA').slider(); sliderB = $('#accessibilitySliderB').slider(); expect($(sliderA.slider('getElement')).find('.min-slider-handle').attr('aria-labelledby')).toBe('accessibilitySliderLabelA'); expect($(sliderB.slider('getElement')).find('.min-slider-handle').attr('aria-labelledby')).toBe('accessibilitySliderLabelA'); expect($(sliderB.slider('getElement')).find('.max-slider-handle').attr('aria-labelledby')).toBe('accessibilitySliderLabelB'); }); it('Should have an aria-valuemax and aria-valuemin value', function() { sliderA = $('#accessibilitySliderA').slider({ min: 5, max: 10 }); sliderB = $('#accessibilitySliderB').slider({ min: 5, max: 10 }); var $sliderElementA = $(sliderA.slider('getElement')); var $sliderElementB = $(sliderB.slider('getElement')); expect($sliderElementA.find('.min-slider-handle').attr('aria-valuemin')).toBe('5'); expect($sliderElementA.find('.min-slider-handle').attr('aria-valuemax')).toBe('10'); expect($sliderElementB.find('.min-slider-handle').attr('aria-valuemin')).toBe('5'); expect($sliderElementB.find('.min-slider-handle').attr('aria-valuemax')).toBe('10'); expect($sliderElementB.find('.max-slider-handle').attr('aria-valuemin')).toBe('5'); expect($sliderElementB.find('.max-slider-handle').attr('aria-valuemax')).toBe('10'); }); it('Should have an aria-valuenow with the current value', function() { sliderA = $('#accessibilitySliderA').slider({ min: 5, value: 7 }); sliderB = $('#accessibilitySliderB').slider({ min: 5, value: [2, 8] }); var $sliderElementA = $(sliderA.slider('getElement')); var $sliderElementB = $(sliderB.slider('getElement')); expect($sliderElementA.find('.min-slider-handle').attr('aria-valuenow')).toBe('7'); expect($sliderElementB.find('.min-slider-handle').attr('aria-valuenow')).toBe('5'); expect($sliderElementB.find('.max-slider-handle').attr('aria-valuenow')).toBe('8'); // Change the value and check if aria-valuenow is still the same sliderA.slider('setValue', 1); sliderB.slider('setValue', [4, 9]); expect($sliderElementA.find('.min-slider-handle').attr('aria-valuenow')).toBe('5'); expect($sliderElementB.find('.min-slider-handle').attr('aria-valuenow')).toBe('5'); expect($sliderElementB.find('.max-slider-handle').attr('aria-valuenow')).toBe('9'); }); afterEach(function() { if(sliderA) { sliderA.slider('destroy'); } if(sliderB) { sliderB.slider('destroy'); } }); }); test/specs/FocusOptionSpec.js000064400000003077151676726750012316 0ustar00/* ****************** Focus Option Tests ****************** This spec has tests for checking proper behavior of the focus option. */ describe("Focus Option Tests", function() { var testSlider; var simulateMousedown = function(target, pos) { var myEvent = document.createEvent("MouseEvents"); myEvent.initEvent("mousedown", true, true); myEvent.pageX = pos; myEvent.pageY = pos; target.dispatchEvent(myEvent); }; it("handle should not be focused after value change when 'focus' is false", function() { testSlider = $("#testSlider1").slider({ min : 0, max : 10, value: 0, focus: false, id : "testSlider" }); var hasFocus; $("#testSlider").find(".min-slider-handle").focus(function() { hasFocus = true; }); simulateMousedown($("#testSlider").find(".slider-track-high").get(0), 1000); expect(hasFocus).toBe(undefined); }); it("handle should be focused after value change when 'focus' is true", function() { testSlider = $("#testSlider1").slider({ min : 0, max : 10, value: 0, focus: true, id : "testSlider" }); var hasFocus; $("#testSlider").find(".min-slider-handle").focus(function() { hasFocus = true; }); simulateMousedown($("#testSlider").find(".slider-track-high").get(0), 1000); expect(hasFocus).toBe(true); }); afterEach(function() { if (testSlider) { testSlider.slider("destroy"); testSlider = null; } }); }); test/specs/KeyboardSupportSpec.js000064400000036722151676726750013206 0ustar00describe("Keyboard Support Tests", function() { var testSlider, handle1, handle2, keyboardEvent, initialMinVal = 0, initialMaxVal = 10, initialStepVal = 1, initialSliderVal = 5; /* Before/After setup */ beforeEach(function() { // Create keyboard event keyboardEvent = document.createEvent("Events"); keyboardEvent.initEvent("keydown", true, true); }); afterEach(function() { if(testSlider) { testSlider.slider('destroy'); } keyboardEvent = null; keyboardEvent = null; }); /* Begin Tests */ describe("Clicking on slider handle automatically gives it focus", function() { beforeEach(function() { testSlider = $("#testSlider1").slider({ id: 'testSlider' }); handle1 = $("#testSlider").find(".slider-handle:first"); }); it("clicking on handle1 gives focus to handle1", function(done) { handle1.focus(function() { expect(true).toBeTruthy(); done(); }); handle1.focus(); }); }); describe("When slider handle has TAB focus", function() { it("should display it's tooltip if 'tooltip' option is set to 'show'", function() { testSlider = $("#testSlider1").slider({ id: 'testSlider', tooltip: 'show' }); handle1 = $("#testSlider").find(".slider-handle:first"); // Check for no tooltip before focus var tooltipIsShown = $("#testSlider").find("div.tooltip").hasClass("in"); expect(tooltipIsShown).toBeFalsy(); handle1.focus(); // Tooltip should be present after focus tooltipIsShown = $("#testSlider").find("div.tooltip").hasClass("in"); expect(tooltipIsShown).toBeTruthy(); }); it("should not display it's tooltip if 'tooltip' option is set to 'hide'", function() { testSlider = $("#testSlider1").slider({ id: 'testSlider', tooltip: 'hide' }); handle1 = $("#testSlider").find(".slider-handle:first"); // Check for hidden tooltip before focus var tooltipIsHidden = $("#testSlider").children("div.tooltip").hasClass("hide"); expect(tooltipIsHidden).toBeTruthy(); handle1.focus(); // Tooltip should remain hidden after focus tooltipIsHidden = $("#testSlider").children("div.tooltip").hasClass("hide"); expect(tooltipIsHidden).toBeTruthy(); }); it("should not affect the tooltip display if 'tooltip' option is set to 'always'", function() { testSlider = $("#testSlider1").slider({ id: 'testSlider', tooltip: 'always' }); handle1 = $("#testSlider").find(".slider-handle:first"); var $tooltip = $("#testSlider").children("div.tooltip"); // Check for shown tooltip before focus var tooltipIsShown = $tooltip.hasClass("in"); expect(tooltipIsShown).toBeTruthy(); handle1.focus(); // Tooltip should remain present after focus tooltipIsShown = $tooltip.hasClass("in"); expect(tooltipIsShown).toBeTruthy(); }); }); describe("For horizontal sliders where its handle has focus", function() { beforeEach(function() { // Initialize the slider testSlider = $("#testSlider1").slider({ id: 'testSlider', orientation: 'horizontal', min: initialMinVal, max: initialMaxVal, step: initialStepVal, value: initialSliderVal }); // Focus on handle1 handle1 = $("#testSlider .min-slider-handle"); handle1.focus(); }); it("moves to the left by the 'step' value when the LEFT arrow key is pressed", function(done) { handle1.on("keydown", function() { var sliderValue = $("#testSlider1").slider('getValue'); var expectedSliderValue = initialSliderVal - initialStepVal; expect(sliderValue).toBe(expectedSliderValue); done(); }); keyboardEvent.keyCode = keyboardEvent.which = 37; handle1[0].dispatchEvent(keyboardEvent); }); it("moves to the right by the 'step' value when the RIGHT arrow key is pressed", function(done) { handle1.on("keydown", function() { var sliderValue = $("#testSlider1").slider('getValue'); var expectedSliderValue = initialSliderVal + initialStepVal; expect(sliderValue).toBe(expectedSliderValue); done(); }); keyboardEvent.keyCode = keyboardEvent.which = 39; handle1[0].dispatchEvent(keyboardEvent); }); it("moves to the left by the 'step' value when the DOWN arrow key is pressed", function(done) { handle1.on("keydown", function() { var sliderValue = testSlider.slider('getValue'); var expectedSliderValue = initialSliderVal - initialStepVal; expect(sliderValue).toBe(expectedSliderValue); done(); }); keyboardEvent.keyCode = keyboardEvent.which = 40; handle1[0].dispatchEvent(keyboardEvent); }); it("moves to the right by the 'step' value when the UP arrow key is pressed", function(done) { handle1.on("keydown", function() { var sliderValue = testSlider.slider('getValue'); var expectedSliderValue = initialSliderVal + initialStepVal; expect(sliderValue).toBe(expectedSliderValue); done(); }); keyboardEvent.keyCode = keyboardEvent.which = 38; handle1[0].dispatchEvent(keyboardEvent); }); }); describe("For vertical sliders where its handle has focus", function() { beforeEach(function() { // Initialize the slider testSlider = $("#testSlider1").slider({ id: 'testSlider', orientation: 'vertical', min: initialMinVal, max: initialMaxVal, step: initialStepVal, value: initialSliderVal }); // Focus on handle1 handle1 = $("#testSlider").find(".slider-handle:first"); handle1.focus(); }); it("moves down by the 'step' value when the LEFT arrow key is pressed", function(done) { handle1.on("keydown", function() { var sliderValue = testSlider.slider('getValue'); var expectedSliderValue = initialSliderVal - initialStepVal; expect(sliderValue).toBe(expectedSliderValue); done(); }); keyboardEvent.keyCode = keyboardEvent.which = 37; handle1[0].dispatchEvent(keyboardEvent); }); it("moves up by the 'step' value when the RIGHT arrow key is pressed", function(done) { handle1.on("keydown", function() { var sliderValue = testSlider.slider('getValue'); var expectedSliderValue = initialSliderVal + initialStepVal; expect(sliderValue).toBe(expectedSliderValue); done(); }); keyboardEvent.keyCode = keyboardEvent.which = 39; handle1[0].dispatchEvent(keyboardEvent); }); it("moves down by the 'step' value when the DOWN arrow key is pressed", function(done) { handle1.on("keydown", function() { var sliderValue = testSlider.slider('getValue'); var expectedSliderValue = initialSliderVal - initialStepVal; expect(sliderValue).toBe(expectedSliderValue); done(); }); keyboardEvent.keyCode = keyboardEvent.which = 40; handle1[0].dispatchEvent(keyboardEvent); }); it("moves up by the 'step' value when the UP arrow key is pressed", function(done) { handle1.on("keydown", function() { var sliderValue = testSlider.slider('getValue'); var expectedSliderValue = initialSliderVal + initialStepVal; expect(sliderValue).toBe(expectedSliderValue); done(); }); keyboardEvent.keyCode = keyboardEvent.which = 38; handle1[0].dispatchEvent(keyboardEvent); }); }); describe("For a reversed slider (regardless of 'orientation')", function() { beforeEach(function() { // Initialize the slider testSlider = $("#testSlider1").slider({ id: 'testSlider', reversed: true, min: initialMinVal, max: initialMaxVal, step: initialStepVal, value: initialSliderVal }); // Focus on handle1 handle1 = $("#testSlider").find(".slider-handle:first"); handle1.focus(); }); it("moves to the left by the 'step' value when the LEFT arrow key is pressed", function(done) { handle1.on("keydown", function() { var sliderValue = testSlider.slider('getValue'); var expectedSliderValue = initialSliderVal - initialStepVal; expect(sliderValue).toBe(expectedSliderValue); done(); }); keyboardEvent.keyCode = keyboardEvent.which = 37; handle1[0].dispatchEvent(keyboardEvent); }); it("moves to the right by the 'step' value when the RIGHT arrow key is pressed", function(done) { handle1.on("keydown", function() { var sliderValue = testSlider.slider('getValue'); var expectedSliderValue = initialSliderVal + initialStepVal; expect(sliderValue).toBe(expectedSliderValue); done(); }); keyboardEvent.keyCode = keyboardEvent.which = 39; handle1[0].dispatchEvent(keyboardEvent); }); it("moves to the left by the 'step' value when the DOWN arrow key is pressed", function(done) { handle1.on("keydown", function() { var sliderValue = testSlider.slider('getValue'); var expectedSliderValue = initialSliderVal - initialStepVal; expect(sliderValue).toBe(expectedSliderValue); done(); }); keyboardEvent.keyCode = keyboardEvent.which = 40; handle1[0].dispatchEvent(keyboardEvent); }); it("moves to the right by the 'step' value when the UP arrow key is pressed", function(done) { handle1.on("keydown", function() { var sliderValue = testSlider.slider('getValue'); var expectedSliderValue = initialSliderVal + initialStepVal; expect(sliderValue).toBe(expectedSliderValue); done(); }); keyboardEvent.keyCode = keyboardEvent.which = 38; handle1[0].dispatchEvent(keyboardEvent); }); }); describe("For a range slider (regardless of 'orientation')", function() { beforeEach(function() { // Initialize the slider testSlider = $("#testSlider1").slider({ id: 'testSlider', min: initialMinVal, max: initialMaxVal, step: initialStepVal, value: [initialSliderVal, initialSliderVal] }); }); describe("when handle1 tries to overtake handle2 from the left", function() { beforeEach(function() { handle1 = $("#testSlider").find(".slider-handle:first"); handle1.focus(); }); it("handle2 moves to the right by the step value", function(done) { handle1.on("keydown", function() { var sliderValue = testSlider.slider('getValue'); var expectedSliderValue = initialSliderVal + initialStepVal; expect(sliderValue[1]).toBe(expectedSliderValue); done(); }); keyboardEvent.keyCode = keyboardEvent.which = 39; handle1[0].dispatchEvent(keyboardEvent); }); it("handle1's value remains unchanged", function(done) { var sliderValue = testSlider.slider('getValue'); handle1.on("keydown", function() { expect(sliderValue[0]).toBe(initialSliderVal); done(); }); keyboardEvent.keyCode = keyboardEvent.which = 39; handle1[0].dispatchEvent(keyboardEvent); }); }); describe("when handle2 tries to overtake handle1 from the right", function() { beforeEach(function() { handle2 = $("#testSlider").find(".slider-handle:last"); handle2.focus(); }); it("handle1 moves to the left by the step value", function(done) { handle2.on("keydown", function() { var sliderValue = testSlider.slider('getValue'); var expectedSliderValue = initialSliderVal - initialStepVal; expect(sliderValue[0]).toBe(expectedSliderValue); done(); }); keyboardEvent.keyCode = keyboardEvent.which = 37; handle2[0].dispatchEvent(keyboardEvent); }); it("handle2's value remains unchanged", function(done) { var sliderValue = testSlider.slider('getValue'); handle2.on("keydown", function() { expect(sliderValue[1]).toBe(initialSliderVal); done(); }); keyboardEvent.keyCode = keyboardEvent.which = 37; handle2[0].dispatchEvent(keyboardEvent); }); }); }); describe("For the natural arrow keys", function() { var testCases = [{ reversed: false, keyEvent: 37, expectedSliderValue: initialSliderVal - initialStepVal, orientation: 'horizontal', key: 'left' }, { reversed: true, keyEvent: 37, expectedSliderValue: initialSliderVal + initialStepVal, orientation: 'horizontal', key: 'left' }, { reversed: false, keyEvent: 39, expectedSliderValue: initialSliderVal + initialStepVal, orientation: 'horizontal', key: 'right' }, { reversed: true, keyEvent: 39, expectedSliderValue: initialSliderVal - initialStepVal, orientation: 'horizontal', key: 'right' }, { reversed: false, keyEvent: 38, expectedSliderValue: initialSliderVal - initialStepVal, orientation: 'vertical', key: 'up' }, { reversed: true, keyEvent: 38, expectedSliderValue: initialSliderVal + initialStepVal, orientation: 'vertical', key: 'up' }, { reversed: false, keyEvent: 40, expectedSliderValue: initialSliderVal + initialStepVal, orientation: 'vertical', key: 'down' }, { reversed: true, keyEvent: 40, expectedSliderValue: initialSliderVal - initialStepVal, orientation: 'vertical', key: 'down' }]; testCases.forEach(function(testCase) { describe("A"+((testCase.reversed)? " reversed" : "")+testCase.orientation+" slider is used for the arrow keys", function() { beforeEach(function() { // Initialize the slider testSlider = $("#testSlider1").slider({ id: 'testSlider', min: initialMinVal, max: initialMaxVal, step: initialStepVal, value: initialSliderVal, natural_arrow_keys: true, reversed: testCase.reversed, orientation: testCase.orientation }); handle1 = $("#testSlider").find(".slider-handle:first"); handle1.focus(); }); it("moves to the "+testCase.key+" by the 'step' value when the "+testCase.key+" arrow key is pressed", function(done) { handle1.on("keydown", function() { var sliderValue = testSlider.slider('getValue'); var expectedSliderValue = testCase.expectedSliderValue; expect(sliderValue).toBe(expectedSliderValue); done(); }); keyboardEvent.keyCode = keyboardEvent.which = testCase.keyEvent; handle1[0].dispatchEvent(keyboardEvent); }); }); }); }); });test/specs/offMethodSpec.js000064400000001635151676726750011757 0ustar00//-------------------------------------------------- //-------------------------------------------------- //-- Removes attached function from slider event -- //-------------------------------------------------- //-------------------------------------------------- describe("'off()' test", function() { var testSlider, eventHandlerTriggered, mouse; var onStart = function(){ eventHandlerTriggered = true; }; beforeEach(function() { eventHandlerTriggered = false; mouse = document.createEvent('MouseEvents'); }); it("should properly unbind an event listener", function() { testSlider = $("#testSlider1").slider(); testSlider.on('slideStart', onStart); testSlider.off('slideStart', onStart); testSlider.data('slider')._mousedown(mouse); expect(eventHandlerTriggered).not.toBeTruthy(); }); });test/specs/RefreshMethodSpec.js000064400000001604151676726750012577 0ustar00describe("refresh() Method Tests", function() { var testSlider; afterEach(function() { if(testSlider) { testSlider.destroy(); } }); it("does not convert a non-range slider into a range slider when invoked", function() { // Initialize non-range slider testSlider = new Slider("#testSlider1", { min: 0, max: 10, value: 5 }); // Assert that slider is non-range slider var initialValue = testSlider.getValue(); var sliderIsRangeValue = initialValue instanceof Array; expect(sliderIsRangeValue).toBeFalsy(); // Invoke refresh() method testSlider.refresh(); // Assert that slider remains a non-range slider var afterRefreshValue = testSlider.getValue(); sliderIsRangeValue = afterRefreshValue instanceof Array; expect(sliderIsRangeValue).toBeFalsy(); }); }); // End of spectest/specs/AutoRegisterDataProvideSpec.js000064400000001250151676726750014575 0ustar00describe("Auto register data-provide Tests", function() { it("checks that the autoregister Slider was automatically registerd", function() { var $el = $("#autoregisterSlider"); var sliderInstancesExists = $el.siblings().is(".slider"); expect(sliderInstancesExists).toBeTruthy(); var sliderInstancesCount = $el.siblings(".slider").length; expect(sliderInstancesCount).toEqual(1); }); it("checks that the autoregistered Slider can be accessed", function() { var $el = $("#autoregisterSlider"); expect($el.slider('getValue')).toBe(1); $el.slider('setValue', 2); expect($el.slider('getValue')).toBe(2); }); });test/specs/EventsSpec.js000064400000024433151676726750011311 0ustar00describe("Event Tests", function() { var testSlider, flag, mouse; beforeEach(function() { flag = false; mouse = document.createEvent('MouseEvents'); }); describe("JQuery version", function() { beforeEach(function() { testSlider = $("#testSlider2").slider({ value: 1 }); }); afterEach(function() { if(testSlider) { testSlider.slider('destroy'); testSlider = null; } }); describe("Mouse Events", function() { it("'slideStart' event is triggered properly and can be binded to", function() { testSlider.on('slideStart', function() { flag = true; }); testSlider.data('slider')._mousedown(mouse); expect(flag).toBeTruthy(); }); it("'slide' event is triggered properly and can be binded to", function() { testSlider.on('slide', function() { flag = true; }); testSlider.data('slider')._mousemove(mouse); expect(flag).toBeTruthy(); }); it("'slide' event sets the right value on the input", function() { testSlider.on('slide', function() { flag = true; expect(isNaN(testSlider.val())).not.toBeTruthy(); }); testSlider.data('slider')._mousemove(mouse); expect(flag).toBeTruthy(); }); it("'slide' event value and input value properties are synchronous", function() { testSlider.on('slide', function(e) { flag = true; expect(e.value.toString()).toEqual(this.value); }); testSlider.slider("setValue", 3, true, false); expect(flag).toBeTruthy(); }); it("'change' event value and input value properties are synchronous", function() { testSlider.on('change', function(e) { flag = true; expect(e.value.newValue.toString()).toEqual(testSlider.val()); }); testSlider.slider("setValue", 3, false, true); expect(flag).toBeTruthy(); }); it("'slideStop' event is triggered properly and can be binded to", function() { testSlider.on('slideStop', function() { flag = true; }); testSlider.data('slider')._mouseup(mouse); expect(flag).toBeTruthy(); }); it("slider should not have duplicate events after calling 'refresh'", function() { flag = 0; testSlider.on('slideStop', function() { flag += 1; }); testSlider.slider('refresh'); testSlider.data('slider')._mouseup(); expect(flag).toEqual(1); }); describe("Disabled Slider Event Tests", function() { beforeEach(function() { testSlider.slider('disable'); }); it("should not trigger 'slideStart' event when disabled", function() { testSlider.on('slideStart', function() { flag = true; }); testSlider.data('slider')._mousedown(mouse); expect(flag).not.toBeTruthy(); }); it("should not trigger 'slide' event when disabled", function() { testSlider.on('slide', function() { flag = true; }); testSlider.data('slider')._mousemove(mouse); expect(flag).not.toBeTruthy(); }); it("should not trigger 'slideStop' event when disabled", function() { testSlider.on('slideStop', function() { flag = true; }); testSlider.data('slider')._mouseup(); expect(flag).not.toBeTruthy(); }); }); }); describe("Touch Events", function() { var touch; beforeEach(function() { touch = document.createEvent('Event'); var dummyTouchEvent = document.createEvent('MouseEvents'); touch.touches = [dummyTouchEvent]; window.ontouchstart = true; }); afterEach(function() { window.ontouchstart = null; }); it("'slideStart' event is triggered properly and can be binded to", function() { touch.initEvent("touchstart"); testSlider.on('slideStart', function() { flag = true; }); testSlider.data('slider')._mousedown(touch); expect(flag).toBeTruthy(); }); it("'slide' event is triggered properly and can be binded to", function() { touch.initEvent("touchmove"); testSlider.on('slide', function() { flag = true; }); testSlider.data('slider')._mousemove(touch); expect(flag).toBeTruthy(); }); it("'slide' event sets the right value on the input", function() { touch.initEvent("touchmove"); testSlider.on('slide', function() { flag = true; expect(isNaN(testSlider.val())).not.toBeTruthy(); }); testSlider.data('slider')._mousemove(touch); expect(flag).toBeTruthy(); }); it("'slide' event value and input value properties are synchronous", function() { touch.initEvent("touchmove"); testSlider.on('slide', function(e) { flag = true; expect(e.value.toString()).toEqual(testSlider.val()); }); testSlider.slider("setValue", 3, true, false); expect(flag).toBeTruthy(); }); it("'change' event value and input value properties are synchronous", function() { touch.initEvent("touchmove"); testSlider.on('change', function(e) { flag = true; expect(e.value.newValue.toString()).toEqual(testSlider.val()); }); testSlider.slider("setValue", 3, false, true); expect(flag).toBeTruthy(); }); it("'slideStop' event is triggered properly and can be binded to", function() { touch.initEvent("touchstop"); testSlider.on('slideStop', function() { flag = true; }); testSlider.data('slider')._mouseup(); expect(flag).toBeTruthy(); }); it("slider should not have duplicate events after calling 'refresh'", function() { touch.initEvent("touchstop"); flag = 0; testSlider.on('slideStop', function() { flag += 1; }); testSlider.slider('refresh'); testSlider.data('slider')._mouseup(); expect(flag).toEqual(1); }); it("slider should not bind multiple touchstart events after calling 'refresh'", function() { touch.initEvent("touchstart", true, true); flag = 0; testSlider.on('slideStart', function() { flag += 1; }); testSlider.slider('refresh'); $('.slider .slider-handle').get(0).dispatchEvent(touch); expect(flag).toEqual(1); }); describe("Disabled Slider Event Tests", function() { beforeEach(function() { testSlider.slider('disable'); }); it("should not trigger 'slideStart' event when disabled", function() { touch.initEvent("touchstart"); testSlider.on('slideStart', function() { flag = true; }); testSlider.data('slider')._mousedown(touch); expect(flag).not.toBeTruthy(); }); it("should not trigger 'slide' event when disabled", function() { touch.initEvent("touchmove"); testSlider.on('slide', function() { flag = true; }); testSlider.data('slider')._mousemove(touch); expect(flag).not.toBeTruthy(); }); it("should not trigger 'slideStop' event when disabled", function() { touch.initEvent("touchend"); testSlider.on('slideStop', function() { flag = true; }); testSlider.data('slider')._mouseup(); expect(flag).not.toBeTruthy(); }); }); }); describe("Enabled/Disabled tests", function() { it("'slideDisabled' event is triggered properly and can be binded to", function() { testSlider.on('slideDisabled', function() { flag = true; }); testSlider.slider('disable'); expect(flag).toBeTruthy(); }); it("'slideDisabled' event is triggered properly and can be binded to", function() { testSlider.on('slideEnabled', function() { flag = true; }); testSlider.slider('disable'); testSlider.slider('enable'); expect(flag).toBeTruthy(); }); it("'change' event is triggered properly and can be binded to", function() { testSlider.on('change', function() { flag = true; }); testSlider.slider("setValue", 3, false, true); expect(flag).toBeTruthy(); }); }); }); // End of JQuery version tests describe("CommonJS version", function() { describe("Event repetition tests", function() { var testSlider, numTimesFired; beforeEach(function() { testSlider = new Slider("#testSlider2"); numTimesFired = 0; }); afterEach(function() { testSlider.destroy(); }); it("'slide' event is triggered only once per slide action", function() { testSlider.on('slide', function() { numTimesFired++; }); testSlider._mousemove(mouse); expect(numTimesFired).toEqual(1); }); it("'slideStart' event is triggered only once per slide action", function() { testSlider.on('slideStart', function() { numTimesFired++; }); testSlider._mousedown(mouse); expect(numTimesFired).toEqual(1); }); it("'slideStop' event is triggered only once per slide action", function() { testSlider.on('slideStop', function() { numTimesFired++; }); testSlider._mouseup(mouse); expect(numTimesFired).toEqual(1); }); it("'change' event is triggered only once per value change action", function() { testSlider.on('change', function() { numTimesFired++; }); testSlider.setValue(3, false, true); expect(numTimesFired).toEqual(1); }); }); }); // End of common JS tests }); // End of spec test/specs/PublicMethodsSpec.js000064400000056170151676726750012612 0ustar00describe("Public Method Tests", function() { var testSlider; describe("slider constructor", function() { it("reads and sets the 'id' attribute of the slider instance that is created", function() { var sliderId = "mySlider"; testSlider = $("#testSlider1").slider({ id : sliderId }); var sliderInstanceHasExpectedId = $("#testSlider1").siblings("div.slider").is("#" + sliderId); expect(sliderInstanceHasExpectedId).toBeTruthy(); }); it("generates multiple slider instances from selector", function() { $(".makeSlider").slider(); var sliderInstancesExists = $(".makeSlider").siblings().is(".slider"); expect(sliderInstancesExists).toBeTruthy(); var sliderInstancesCount = $(".makeSlider").siblings(".slider").length; expect(sliderInstancesCount).toEqual(2); }); it("reads and sets the 'min' option properly", function() { var minVal = -5; testSlider = $("#testSlider1").slider({ min : minVal }); testSlider.slider('setValue', minVal); var sliderValue = testSlider.slider('getValue'); expect(sliderValue).toBe(minVal); }); it("reads and sets the 'max' option properly", function() { var maxVal = 15; testSlider = $("#testSlider1").slider({ max : maxVal }); testSlider.slider('setValue', maxVal); var sliderValue = testSlider.slider('getValue'); expect(sliderValue).toBe(maxVal); }); it("reads and sets the 'precision' option properly", function() { testSlider = $("#testSlider1").slider({ precision: 2 }); testSlider.slider('setValue', 8.115); var sliderValue = testSlider.slider('getValue'); expect(sliderValue).toBe(8.12); }); it("reads and sets the 'orientation' option properly", function() { var orientationVal = "vertical"; testSlider = $("#testSlider1").slider({ orientation : orientationVal }); var orientationClassApplied = $("#testSlider1").siblings("div.slider").hasClass("slider-vertical"); expect(orientationClassApplied).toBeTruthy(); }); it("reads and sets the 'value' option properly", function() { var val = 8; testSlider = $("#testSlider1").slider({ value : val }); testSlider.slider('setValue', val); var sliderValue = testSlider.slider('getValue'); expect(sliderValue).toBe(val); }); it("reads and sets the 'selection' option properly", function() { var selectionVal = "after", maxSliderVal = 10; testSlider = $("#testSlider1").slider({ selection : selectionVal }); testSlider.slider('setValue', maxSliderVal); var sliderSelectionWidthAtMaxValue = $("#testSlider1").siblings(".slider").children("div.slider-track").children("div.slider-selection").width(); expect(sliderSelectionWidthAtMaxValue).toBe(0); }); it("updates the 'selection' option properly", function() { var selectionVal = "none", maxSliderVal = 10; testSlider = $("#testSlider1").slider({ selection : selectionVal }); testSlider.slider('setValue', maxSliderVal); testSlider.slider('refresh'); var sliderSelectionHasHideClass_A = $("#testSlider1").siblings(".slider").children("div.slider-track").children("div.slider-track-low").hasClass('hide'); expect(sliderSelectionHasHideClass_A).toBe(true); var sliderSelectionHasHideClass_B = $("#testSlider1").siblings(".slider").children("div.slider-track").children("div.slider-selection").hasClass('hide'); expect(sliderSelectionHasHideClass_B).toBe(true); var sliderSelectionHasHideClass_C = $("#testSlider1").siblings(".slider").children("div.slider-track").children("div.slider-track-high").hasClass('hide'); expect(sliderSelectionHasHideClass_C).toBe(true); var newSelectionVal = 'after'; testSlider.slider('setAttribute', 'selection', newSelectionVal); testSlider.slider('refresh'); var sliderSelectionHasHideClass_D = $("#testSlider1").siblings(".slider").children("div.slider-track").children("div.slider-track-low").hasClass('hide'); expect(sliderSelectionHasHideClass_D).toBe(false); var sliderSelectionHasHideClass_E = $("#testSlider1").siblings(".slider").children("div.slider-track").children("div.slider-selection").hasClass('hide'); expect(sliderSelectionHasHideClass_E).toBe(false); var sliderSelectionHasHideClass_F = $("#testSlider1").siblings(".slider").children("div.slider-track").children("div.slider-track-high").hasClass('hide'); expect(sliderSelectionHasHideClass_F).toBe(false); }); it("reads and sets the 'handle' option properly", function() { var handleVal = "triangle"; testSlider = $("#testSlider1").slider({ handle : handleVal }); var handleIsSetToTriangle = $("#testSlider1").siblings(".slider").children("div.slider-handle").hasClass("triangle"); expect(handleIsSetToTriangle).toBeTruthy(); }); it("reads and sets the 'reversed' option properly", function() { var reversedVal = true, maxSliderVal = 10; testSlider = $("#testSlider1").slider({ reversed : reversedVal }); testSlider.slider('setValue', maxSliderVal); var sliderSelectionHeightAtMaxValue = $("#testSlider1").siblings(".slider").children("div.slider-track").children("div.slider-selection").width(); expect(sliderSelectionHeightAtMaxValue).toBe(0); }); /* TODO: Fix this test! It keeps throwing a weird bug where is says '955' instead of '9' for the value */ // it("reads and sets the 'formatter' option properly", function() { // var tooltipFormatter = function(value) { // return 'Current value: ' + value; // }; // testSlider = $("#testSlider1").slider({ // formatter : tooltipFormatter // }); // testSlider.slider('setValue', 9); // var tooltipMessage = $("#testSlider1").siblings(".slider").find("div.tooltip").children("div.tooltip-inner").text(); // var expectedMessage = tooltipFormatter(9); // expect(tooltipMessage).toBe(expectedMessage); // }); it("reads and sets the 'enabled' option properly", function() { testSlider = $("#testSlider1").slider({ enabled: false }); var isEnabled = testSlider.slider('isEnabled'); expect(isEnabled).not.toBeTruthy(); }); describe("reads and sets the 'tooltip' option properly", function() { it("tooltip is not shown if set to 'hide'", function() { testSlider = $("#testSlider1").slider({ tooltip : "hide" }); var tooltipIsHidden = testSlider.siblings(".slider").children("div.tooltip").hasClass("hide"); expect(tooltipIsHidden).toBeTruthy(); }); it("tooltip is shown during sliding if set to 'show'", function() { testSlider = $("#testSlider1").slider({ tooltip : "show" }); var tooltipIsHidden = !($("#testSlider1").siblings(".slider").children("div.tooltip").hasClass("in")); expect(tooltipIsHidden).toBeTruthy(); // Trigger hover var mouseenterEvent = document.createEvent("Events"); mouseenterEvent.initEvent("mouseenter", true, true); testSlider.data('slider').sliderElem.dispatchEvent(mouseenterEvent); var tooltipIsShownAfterSlide = $("#testSlider1").siblings(".slider").children("div.tooltip").hasClass("in"); expect(tooltipIsShownAfterSlide).toBeTruthy(); }); it("tooltip is shown on mouse over and hides correctly after mouse leave", function() { testSlider = $("#testSlider1").slider({ tooltip : "show" }); var tooltipIsHidden = !($("#testSlider1").siblings(".slider").children("div.tooltip").hasClass("in")); expect(tooltipIsHidden).toBeTruthy(); // Trigger hover var mouseenterEvent = document.createEvent("Events"); mouseenterEvent.initEvent("mouseenter", true, true); testSlider.data('slider').sliderElem.dispatchEvent(mouseenterEvent); var tooltipIsShownAfterSlide = $("#testSlider1").siblings(".slider").children("div.tooltip").hasClass("in"); expect(tooltipIsShownAfterSlide).toBeTruthy(); // Trigger leave var mouseleaveEvent = document.createEvent("Events"); mouseleaveEvent.initEvent("mouseleave", true, true); testSlider.data('slider').sliderElem.dispatchEvent(mouseleaveEvent); var tooltipIsAgainHidden = !($("#testSlider1").siblings(".slider").children("div.tooltip").hasClass("in")); expect(tooltipIsAgainHidden).toBeTruthy(); }); it("tooltip is always shown if set to 'always'", function() { testSlider = $("#testSlider1").slider({ tooltip : "always" }); var tooltipIsShown = $("#testSlider1").siblings(".slider").children("div.tooltip").hasClass("in"); expect(tooltipIsShown).toBeTruthy(); }); it("defaults to 'show' option if invalid value is passed", function() { testSlider = $("#testSlider1").slider({ tooltip : "invalid option value" }); var tooltipIsHidden = !($("#testSlider1").siblings(".slider").children("div.tooltip").hasClass("in")); expect(tooltipIsHidden).toBeTruthy(); // Trigger hover var mouseenterEvent = document.createEvent("Events"); mouseenterEvent.initEvent("mouseenter", true, true); testSlider.data('slider').sliderElem.dispatchEvent(mouseenterEvent); var tooltipIsShownOnHover = $("#testSlider1").siblings(".slider").children("div.tooltip").hasClass("in"); expect(tooltipIsShownOnHover).toBeTruthy(); }); }); }); describe("'setValue()' tests", function() { var formatInvalidInputMsg = function(invalidValue) { return "Invalid input value '" + invalidValue + "' passed in"; }; describe("if slider is a single value slider", function() { beforeEach(function() { testSlider = $("#testSlider1").slider(); }); it("properly sets the value of the slider when given a numeric value", function() { var valueToSet = 5; testSlider.slider('setValue', valueToSet); var sliderValue = testSlider.slider('getValue'); expect(sliderValue).toBe(valueToSet); }); it("properly sets the value of the slider when given a string value", function(){ var valueToSet = "5"; testSlider.slider('setValue', valueToSet); var sliderValue = testSlider.slider('getValue'); expect(sliderValue).toBe(5); }); it("if a value passed in is greater than the max (10), the slider only goes to the max", function() { var maxValue = 10, higherThanSliderMaxVal = maxValue + 5; testSlider.slider('setValue', higherThanSliderMaxVal); var sliderValue = testSlider.slider('getValue'); expect(sliderValue).toBe(maxValue); }); it("if a value passed in is less than the min (0), the slider only goes to the min", function() { var minValue = 0, lowerThanSliderMaxVal = minValue - 5; testSlider.slider('setValue', lowerThanSliderMaxVal); var sliderValue = testSlider.slider('getValue'); expect(sliderValue).toBe(minValue); }); it("sets the 'value' property of the slider <input> element", function() { var value = 9; testSlider.slider('setValue', value); var currentValue = document.querySelector("#testSlider1").value; currentValue = parseFloat(currentValue); expect(currentValue).toBe(value); }); it("sets the 'value' attribute of the slider <input> element", function() { var value = 9; testSlider.slider('setValue', value); var currentValue = document.querySelector("#testSlider1").getAttribute("value"); currentValue = parseFloat(currentValue); expect(currentValue).toBe(value); }); describe("when an invalid value type is passed in", function() { var invalidValue; beforeEach(function() { invalidValue = "a"; }); it("throws an error and does not alter the slider value", function() { var originalSliderValue = testSlider.slider('getValue'); var settingValue = function() { testSlider.slider('setValue', invalidValue); }; expect(settingValue).toThrow(new Error( formatInvalidInputMsg(invalidValue) )); var sliderValue = testSlider.slider('getValue'); expect(sliderValue).toBe(originalSliderValue); }); }); }); describe("if slider is a range slider", function() { beforeEach(function() { testSlider = $("#testSlider1").slider({ value : [3, 8] }); }); it("properly sets the values if both within the max and min", function() { var valuesToSet = [5, 7]; testSlider.slider('setValue', valuesToSet); var sliderValues = testSlider.slider('getValue'); expect(sliderValues[0]).toBe(valuesToSet[0]); expect(sliderValues[1]).toBe(valuesToSet[1]); }); describe("caps values to the min if they are set to be less than the min", function() { var minValue = -5, otherValue = 7; it("first value is capped to min", function() { testSlider.slider('setValue', [minValue, otherValue]); var sliderValues = testSlider.slider('getValue'); expect(sliderValues[0]).toBe(0); }); it("second value is capped to min", function() { testSlider.slider('setValue', [otherValue, minValue]); var sliderValues = testSlider.slider('getValue'); expect(sliderValues[1]).toBe(0); }); }); describe("caps values to the max if they are set to be higher than the max", function() { var maxValue = 15, otherValue = 7; it("first value is capped to max", function() { testSlider.slider('setValue', [maxValue, otherValue]); var sliderValues = testSlider.slider('getValue'); expect(sliderValues[0]).toBe(10); }); it("second value is capped to max", function() { testSlider.slider('setValue', [otherValue, maxValue]); var sliderValues = testSlider.slider('getValue'); expect(sliderValues[1]).toBe(10); }); }); describe("if either value is of invalid type", function() { var invalidValue = "a", otherValue = 7; it("first value is of invalid type", function() { var setSliderValueFn = function() { testSlider.slider('setValue', [invalidValue, otherValue]); }; expect(setSliderValueFn).toThrow(new Error( formatInvalidInputMsg(invalidValue) )); }); it("second value is of invalid type", function() { var setSliderValueFn = function() { testSlider.slider('setValue', [otherValue, invalidValue]); }; expect(setSliderValueFn).toThrow(new Error( formatInvalidInputMsg(invalidValue) )); }); }); }); describe("triggerSlideEvent argument", function() { it("if triggerSlideEvent argument is true, the 'slide' event is triggered", function() { var testSlider = $("#testSlider1").slider({ value : 3 }); var newSliderVal = 5; testSlider.on('slide', function(evt) { expect(newSliderVal).toEqual(evt.value); }); testSlider.slider('setValue', newSliderVal, true); }); it("if triggerSlideEvent argument is false, the 'slide' event is not triggered", function() { var newSliderVal = 5; var slideEventTriggered = false; var testSlider = $("#testSlider1").slider({ value : 3 }); testSlider.on('slide', function() { slideEventTriggered = true; }); testSlider.slider('setValue', newSliderVal, false); expect(slideEventTriggered).toEqual(false); }); }); describe("triggerChangeEvent argument", function() { it("if triggerChangeEvent argument is true, the 'change' event is triggered", function() { var testSlider = $("#testSlider1").slider({ value : 3 }); var newSliderVal = 5; testSlider.on('change', function(evt) { expect(newSliderVal).toEqual(evt.value.newValue); }); testSlider.slider('setValue', newSliderVal, true); }); it("if triggerChangeEvent argument is false, the 'change' event is not triggered", function() { var changeEventTriggered = false; var testSlider = $("#testSlider1").slider({ value : 3 }); testSlider.on('change', function() { changeEventTriggered = true; }); testSlider.slider('setValue', 5, false); expect(changeEventTriggered).toEqual(false); }); }); }); describe("'getValue()' tests", function() { it("returns the current value of the slider", function() { testSlider = $("#testSlider1").slider(); var valueToSet = 5; testSlider.slider('setValue', valueToSet); var sliderValue = testSlider.slider('getValue'); expect(sliderValue).toBe(valueToSet); }); }); describe("'enable()' tests", function() { it("correctly enables a slider", function() { testSlider = $("#testSlider1").slider({ enabled: false }); testSlider.slider("enable"); var isEnabled = testSlider.slider("isEnabled"); expect(isEnabled).toBeTruthy(); }); }); describe("'disable()' tests", function() { it("correctly disable a slider", function() { testSlider = $("#testSlider1").slider(); testSlider.slider("disable"); var isEnabled = testSlider.slider("isEnabled"); expect(isEnabled).not.toBeTruthy(); }); }); describe("'toggle()' tests", function() { it("correctly enables a disabled slider", function() { testSlider = $("#testSlider1").slider({ enabled: false }); testSlider.slider("toggle"); var isEnabled = testSlider.slider("isEnabled"); expect(isEnabled).toBeTruthy(); }); it("correctly disables an enabled slider", function() { testSlider = $("#testSlider1").slider(); testSlider.slider("toggle"); var isEnabled = testSlider.slider("isEnabled"); expect(isEnabled).not.toBeTruthy(); }); }); describe("'isEnabled()' tests", function() { it("returns true for an enabled slider", function() { testSlider = $("#testSlider1").slider({ id: "enabled", enabled: true }); var isEnabled = testSlider.slider("isEnabled"); var $slider = testSlider.siblings("#enabled"); var hasDisabledClass = $slider.hasClass("slider") && $slider.hasClass("#enabled"); expect(isEnabled).toBeTruthy(); expect(hasDisabledClass).not.toBeTruthy(); }); it("returns false for a disabled slider", function() { testSlider = $("#testSlider1").slider({ id: "disabled", enabled: false }); var isEnabled = testSlider.slider("isEnabled"); var $slider = testSlider.siblings("#disabled"); var hasDisabledClass = $slider.hasClass("slider") && $slider.hasClass("slider-disabled"); expect(isEnabled).not.toBeTruthy(); expect(hasDisabledClass).toBeTruthy(); }); }); it("get attribute", function() { testSlider = $("#testSlider1").slider(); var sliderMaxValue = testSlider.slider('getAttribute', 'max'); expect(sliderMaxValue).toBe(10); }); it("changes slider from basic to range", function() { testSlider = $("#makeRangeSlider").slider(); testSlider.slider('setAttribute', 'range', true).slider('refresh'); var isRangeSlider = $("#changeOrientationSlider").parent("div.slider").find('.slider-handle').last().hasClass('hide'); expect(isRangeSlider).toBeFalsy(); }); it("setAttribute: changes the 'data-slider-orientation' property from horizontal to vertical", function() { testSlider = $("#changeOrientationSlider").slider({ id: "changeOrientationSliderElem" }); testSlider.slider('setAttribute', 'orientation', 'vertical').slider('refresh'); var $slider = $("#changeOrientationSliderElem"); var orientationClassApplied = $slider.hasClass("slider-vertical"); expect(orientationClassApplied).toBeTruthy(); }); it("relayout: if slider is not displayed on initialization and then displayed later on, relayout() will not adjust the margin-left of the tooltip", function() { // Setup testSlider = new Slider("#relayoutSliderInput", { id: "relayoutSlider", min: 0, max: 10, value: 5 }); var mainTooltipDOMRef = document.querySelector("#relayoutSlider .tooltip-main"); var relayoutSliderContainerDOMRef = document.querySelector("#relayoutSliderContainer"); var tooltipMarginLeft; // Main tooltip margin-left offset should not be set on slider intialization tooltipMarginLeft = parseFloat(mainTooltipDOMRef.style.marginLeft); expect(tooltipMarginLeft).toBeNaN(); // Show slider and call relayout() relayoutSliderContainerDOMRef.style.display = "block"; testSlider.relayout(); // Main tooltip margin-left offset should not be set after relayout() is called. tooltipMarginLeft = Math.abs( parseFloat(mainTooltipDOMRef.style.marginLeft) ); expect(tooltipMarginLeft).toBeNaN(); }); it("relayout: if slider is not displayed on initialization and then displayed later on, relayout() will re-adjust the tick label width", function() { // Setup testSlider = new Slider("#relayoutSliderInputTickLabels", { id: "relayoutSliderTickLabels", min: 0, max: 10, ticks: [0, 5, 10], ticks_labels: ['low', 'mid', 'high'], value: 5 }); var $ticks = $('#relayoutSliderTickLabels').find('.slider-tick-label'); // Tick-Width should be 0 on slider intialization var i, $tick; for (i = 0; i < $ticks.length; i++) { $tick = $($ticks[i]); expect( parseInt($tick.css('width')) ).toBe(0); } // Show slider and call relayout() $('#relayoutSliderContainerTickLabels').css('display', 'block'); testSlider.relayout(); $('#relayoutSliderContainerTickLabels').css('display', 'none'); // Tick-Width should re-adjust to be > 0 for (i = 0; i < $ticks.length; i++) { $tick = $($ticks[i]); expect( parseInt($tick.css('width')) ).toBeGreaterThan(0); } }); afterEach(function() { if(testSlider) { if(testSlider instanceof jQuery) { testSlider.slider('destroy'); } if(testSlider instanceof Slider) { testSlider.destroy(); } testSlider = null; } }); }); test/specs/TooltipMouseOverOptionSpec.js000064400000004454151676726750014536 0ustar00describe("'ticks_tooltip' Option tests", function() { var testSlider; describe("ticks_tooltip states", function() { it("should have the tooltip above the last hovered over element", function() { testSlider = new Slider(document.getElementById("testSlider1"), { ticks: [0, 1, 2, 3, 4, 5, 6], ticks_positions: [0, 19, 29, 39, 49, 95, 100], step: 1, value: 4, ticks_tooltip: true, orientation: 'horizontal' }); var mouseEventArguments = [ 'mousemove', // type true, // canBubble true, // cancelable document, // view, 0, // detail 0, // screenX 0, // screenY undefined, // clientX testSlider.sliderElem.offsetTop, // clientY, false, // ctrlKey false, // altKey false, // shiftKey false, // metaKey, 0, // button null // relatedTarget ]; var mouse49 = document.createEvent('MouseEvents'); mouseEventArguments[7] = testSlider.ticks[4].offsetLeft + testSlider.sliderElem.offsetLeft; // clientX mouse49.initMouseEvent.apply(mouse49, mouseEventArguments); var mouse95 = document.createEvent('MouseEvents'); mouseEventArguments[7] = testSlider.ticks[5].offsetLeft + testSlider.sliderElem.offsetLeft; // clientX mouse95.initMouseEvent.apply(mouse95, mouseEventArguments); var mouse100 = document.createEvent('MouseEvents'); mouseEventArguments[7] = testSlider.ticks[6].offsetLeft + testSlider.sliderElem.offsetLeft; // clientX mouse100.initMouseEvent.apply(mouse100, mouseEventArguments); var mouseStart = document.createEvent('MouseEvents'); mouseEventArguments[7] = testSlider.ticks[0].offsetLeft + testSlider.sliderElem.offsetLeft; // clientX mouseStart.initMouseEvent.apply(mouseStart, mouseEventArguments); //Simulate random movements testSlider.mousedown(mouse49); testSlider.mousemove(mouse95); testSlider.mouseup(); testSlider.mousedown(mouse49); testSlider.mousemove(mouse100); testSlider.mousemove(mouse95); testSlider.mousemove(mouse95); testSlider.mousemove(mouseStart); expect(testSlider.tooltip.style.left).toBe("0%"); }); }); afterEach(function() { if(testSlider) { if(testSlider instanceof Slider) { testSlider.destroy(); } testSlider = null; } }); });test/specs/DraggingHandlesSpec.js000064400000017022151676726750013062 0ustar00describe("Dragging handles tests", function() { var testSlider; var mouseEventArguments; var tickOffsets; beforeEach(function() { // Create slider testSlider = new Slider(document.getElementById("testSlider1"), { ticks: [0, 1, 2, 3, 4, 5, 6], value: [4, 5], step: 1, range: true, }); // Set up default set of mouse event arguments mouseEventArguments = [ 'mousemove', // type true, // canBubble true, // cancelable document, // view, 0, // detail 0, // screenX 0, // screenY undefined, // clientX testSlider.sliderElem.offsetTop, // clientY, false, // ctrlKey false, // altKey false, // shiftKey false, // metaKey, 0, // button null // relatedTarget ]; // Calculate and store the 'clientX' for each tick in the slider tickOffsets = testSlider.ticks.map(function (tick) { return tick.offsetLeft + testSlider.sliderElem.offsetLeft; }); }); afterEach(function() { if(testSlider) { if(testSlider instanceof Slider) { testSlider.destroy(); } testSlider = null; } }); describe("Dragging handles over each other", function() { it("should swap reliably given imprecision", function() { // Create mouse event with position to the left of problem tick var mouseLeft = document.createEvent('MouseEvents'); mouseEventArguments[7] = tickOffsets[4]; // clientX mouseLeft.initMouseEvent.apply(mouseLeft, mouseEventArguments); // Create mouse event with position on problem tick var mouseOverlap = document.createEvent('MouseEvents'); mouseEventArguments[7] = tickOffsets[5]; // clientX mouseOverlap.initMouseEvent.apply(mouseOverlap, mouseEventArguments); // Create mouse event with position to the right of problem tick var mouseRight = document.createEvent('MouseEvents'); mouseEventArguments[7] = tickOffsets[6]; // clientX mouseRight.initMouseEvent.apply(mouseRight, mouseEventArguments); // Simulate drag without swapping testSlider.mousedown(mouseLeft); expect(testSlider._state.dragged).toBe(0); expect(testSlider.getValue()).toEqual([4, 5]); // Simulate handle overlap testSlider.mousemove(mouseOverlap); expect(testSlider._state.dragged).toBe(0); expect(testSlider.getValue()).toEqual([5, 5]); // Simulate left over right drag with imprecision in reported percentage testSlider.mousemove(mouseRight); expect(testSlider._state.dragged).toBe(1); expect(testSlider.getValue()).toEqual([5, 6]); // Simulate handle overlap testSlider.mousemove(mouseOverlap); expect(testSlider._state.dragged).toBe(1); expect(testSlider.getValue()).toEqual([5, 5]); // Simulator handle overlap with click testSlider.mousemove(mouseOverlap); testSlider.mousedown(mouseLeft); expect(testSlider._state.dragged).toBe(0); expect(testSlider.getValue()).toEqual([4, 5]); // Simulate right over left drag with imprecision in reported percentage testSlider.mousemove(mouseLeft); expect(testSlider._state.dragged).toBe(0); expect(testSlider.getValue()).toEqual([4, 5]); // End with mouse up testSlider.mouseup(); expect(testSlider._state.dragged).toBeNull(); expect(testSlider.getValue()).toEqual([4, 5]); }); }); describe("Drag handles over each other and use keyboard to move handles over each other", function() { var keyboardEvent; function createMouseEvent(type, tickIdx) { var mouseEvent = document.createEvent('MouseEvent'); mouseEventArguments[0] = type; mouseEventArguments[7] = tickOffsets[tickIdx]; mouseEvent.initMouseEvent.apply(mouseEvent, mouseEventArguments); return mouseEvent; } beforeEach(function() { // Create keyboard event keyboardEvent = document.createEvent('Event'); keyboardEvent.initEvent('keydown', true, true); }); afterEach(function() { keyboardEvent = null; }); it("should drag and keydown handles properly to the right then back to the left", function() { // Simulate drag without swapping testSlider.mousedown(createMouseEvent('mousedown', 4)); expect(testSlider._state.dragged).toBe(0); expect(testSlider.getValue()).toEqual([4, 5]); // Simulate handle overlap testSlider.mousemove(createMouseEvent('mousemove', 5)); expect(testSlider._state.dragged).toBe(0); expect(testSlider.getValue()).toEqual([5, 5]); // Simulate left over right drag testSlider.mousemove(createMouseEvent('mousemove', 6)); expect(testSlider._state.dragged).toBe(1); expect(testSlider.getValue()).toEqual([5, 6]); // End with mouse up testSlider.mouseup(); expect(testSlider._state.dragged).toBeNull(); expect(testSlider.getValue()).toEqual([5, 6]); // Now move the handles past each other with the Left arrow key keyboardEvent.keyCode = keyboardEvent.which = 37; // Move handle2 to the left with keyboard testSlider.handle2Keydown(keyboardEvent); expect(testSlider._state.keyCtrl).toBeUndefined(); expect(testSlider.getValue()).toEqual([5, 5]); // Move handle2 to the left again testSlider.handle2Keydown(keyboardEvent); expect(testSlider._state.keyCtrl).toBeUndefined(); expect(testSlider.getValue()).toEqual([4, 5]); }); it("should drag and keydown handles properly to the left then back to the right", function() { // Simulate drag without swapping testSlider.mousedown(createMouseEvent('mousedown', 5)); expect(testSlider._state.dragged).toBe(1); expect(testSlider.getValue()).toEqual([4, 5]); // Simulate handle overlap testSlider.mousemove(createMouseEvent('mousemove', 4)); expect(testSlider._state.dragged).toBe(1); expect(testSlider.getValue()).toEqual([4, 4]); // Simulate left over right drag testSlider.mousemove(createMouseEvent('mousemove', 3)); expect(testSlider._state.dragged).toBe(0); expect(testSlider.getValue()).toEqual([3, 4]); // End with mouse up testSlider.mouseup(); expect(testSlider._state.dragged).toBeNull(); expect(testSlider.getValue()).toEqual([3, 4]); // Now move the handles past each other with the Right arrow key keyboardEvent.keyCode = keyboardEvent.which = 39; // Move handle1 to the right with keyboard testSlider.handle1Keydown(keyboardEvent); expect(testSlider._state.keyCtrl).toBeUndefined(); expect(testSlider.getValue()).toEqual([4, 4]); // Move handle1 to the right again testSlider.handle1Keydown(keyboardEvent); expect(testSlider._state.keyCtrl).toBeUndefined(); expect(testSlider.getValue()).toEqual([4, 5]); }); }); it("Should snap to a tick within tick bounds when using the mouse navigation", function() { testSlider.setAttribute('range', true); testSlider.setAttribute('ticks_snap_bounds', 0.45); testSlider.setAttribute('step', 0.1); testSlider.refresh(); // Create mouse events var mouseDown = document.createEvent("MouseEvents"); mouseEventArguments[7] = tickOffsets[1]; mouseDown.initMouseEvent.apply(mouseDown, mouseEventArguments); var mouseRight = document.createEvent("MouseEvents"); mouseEventArguments[7] = tickOffsets[2] - 2; mouseRight.initMouseEvent.apply(mouseRight, mouseEventArguments); testSlider.mousedown(mouseDown); expect(testSlider.getValue()).toEqual([0.7, 5]); testSlider.mousemove(mouseRight); expect(testSlider.getValue()).toEqual([2, 5]); // End with mouse up testSlider.mouseup(); expect(testSlider.getValue()).toEqual([2, 5]); }); }); test/specs/ScrollableContainerSpec.js000064400000006142151676726750013767 0ustar00describe("Scrollable test", function() { var testSlider; var sliderHandleTopPos; var sliderHandleLeftPos; var scrollableContainer; describe("Vertical inside scrollable container", function() { beforeEach(function() { testSlider = new Slider("#ex1", { id: "ex1Slider", orientation: "vertical", min: 0, max: 20, value: 10, step: 1 }); scrollableContainer = document.querySelector('#scrollable-div'); scrollableContainer.scrollTop = 145; var sliderHandleEl = document.querySelector("#ex1Slider .slider-handle"); var sliderHandleBoundingBoxInfo = sliderHandleEl.getBoundingClientRect(); sliderHandleTopPos = sliderHandleBoundingBoxInfo.top; sliderHandleLeftPos = sliderHandleBoundingBoxInfo.left; }); afterEach(function() { if(testSlider) { testSlider.destroy(); } }); // The difference between sliderHandleTopPos and mousemoveY is equal to 50 in both cases, // but difference between initial and final slider value is not equal (6 and 4). // It happens because we don't 'hit' the center of handle but the top left corner. it("slides up when handle moves upwards inside scrollable element after scrolling", function() { var mousemove = document.createEvent('MouseEvents'); var mousemoveX = sliderHandleLeftPos; var mousemoveY = sliderHandleTopPos - 50; var newSliderValue; mousemove.initMouseEvent( "mousedown", true /* bubble */, true /* cancelable */, window, null, 0, 0, mousemoveX, mousemoveY, /* coordinates */ false, false, false, false, /* modifier keys */ 0 /*left*/, null ); testSlider.sliderElem.dispatchEvent(mousemove); newSliderValue = testSlider.getValue(); expect(newSliderValue).toEqual(4); }); it("slides down when handle moves downwards inside scrollable element after scrolling", function() { var mousemove = document.createEvent('MouseEvents'); var mousemoveX = sliderHandleLeftPos; var mousemoveY = sliderHandleTopPos + 50; var newSliderValue; mousemove.initMouseEvent( "mousedown", true /* bubble */, true /* cancelable */, window, null, 0, 0, mousemoveX, mousemoveY, /* coordinates */ false, false, false, false, /* modifier keys */ 0 /*left*/, null ); testSlider.sliderElem.dispatchEvent(mousemove); newSliderValue = testSlider.getValue(); expect(newSliderValue).toEqual(14); }); }); }); // End of spec test/specs/StepReachMaxValueSpec.js000064400000003251151676726750013361 0ustar00describe("TickMaxValueNotATickBehavior", function() { var SLIDER_ID = "testSlider1"; var slider; var options; describe('max value should be reached', function() { beforeEach(function() { options = { min: 40, max: 1310, step: 5, scale: "logarithmic", value: 44 }; slider = new Slider(document.getElementById(SLIDER_ID), options); }); it("Value should contain max value when slider is moved to outer right position", function() { var sliderLeft = slider.sliderElem.offsetLeft; var offsetY = slider.sliderElem.offsetTop; // I think the + 10 work because it is half of the handle size; var offsetX = sliderLeft + slider.sliderElem.clientWidth + 10; var expectedValue = slider.options.max; var mouseEvent = getMouseDownEvent(offsetX, offsetY); slider.mousedown(mouseEvent); slider.mouseup(); expect(slider.getValue()).toBe(expectedValue); }); }); afterEach(function() { slider.destroy(); }); // helper functions function getMouseDownEvent(offsetXToClick, offsetYToClick) { var args = [ 'mousedown', // type true, // canBubble true, // cancelable document, // view, 0, // detail 0, // screenX 0, // screenY offsetXToClick, // clientX offsetYToClick, // clientY, false, // ctrlKey false, // altKey false, // shiftKey false, // metaKey, 0, // button null // relatedTarget ]; var event = document.createEvent('MouseEvents'); event.initMouseEvent.apply(event, args); return event; } }); test/specs/DestroyMethodTests.js000064400000030413151676726750013042 0ustar00describe("'destroy()' Method tests", function() { var testSlider; function createSliderFn() { testSlider = new Slider("#testSlider1", { id: "destroyMethodTestSlider" }); } it("removes the extra DOM elements associated with a slider", function() { createSliderFn(); testSlider.destroy(); var sliderParentElement = $("#testSlider1").parent('div.slider').length; var sliderChildrenElements = $("#testSlider1").siblings('div.slider-track, div.tooltip').length; expect(sliderParentElement).toBe(0); expect(sliderChildrenElements).toBe(0); }); describe("unbinds all slider events", function() { var flag, evtName; beforeEach(function() { createSliderFn(); flag = false; }); it("unbinds from 'slideStart' event", function() { evtName = 'slideStart'; $("#destroyMethodTestSlider").on(evtName, function() { flag = true; }); testSlider.destroy(); $("#destroyMethodTestSlider").trigger(evtName); expect(flag).toBeFalsy(); }); it("unbinds from 'slide' event", function() { evtName = 'slide'; $("#destroyMethodTestSlider").on(evtName, function() { flag = true; }); testSlider.destroy(); $("#destroyMethodTestSlider").trigger(evtName); expect(flag).toBeFalsy(); }); it("unbinds from 'slideStop' event", function() { evtName = 'slideStop'; $("#destroyMethodTestSlider").on(evtName, function() { flag = true; }); testSlider.destroy(); $("#destroyMethodTestSlider").trigger(evtName); expect(flag).toBeFalsy(); }); it("unbinds from 'slideChange' event", function() { evtName = 'slideChange'; $("#destroyMethodTestSlider").on(evtName, function() { flag = true; }); testSlider.destroy(); $("#destroyMethodTestSlider").trigger(evtName); expect(flag).toBeFalsy(); }); it("unbinds all slider events and allows you to re-create the slider without runtime error", function() { // Setup var createSliderAndBindEvent = function () { $("#testSlider1").bootstrapSlider({ min: 0, max: 1000 * 1000, step: 1000 }); testSlider = $("#testSlider1").data("bootstrapSlider"); testSlider.on("slideStop", function() {}); }; // Destroy existing slider from default bootstrap step testSlider.destroy(); // Create new Slider createSliderAndBindEvent(); // Destroy slider testSlider.destroy(); // Re-create Slider and try to re-bind event var throwsRuntimeError = false; try { createSliderAndBindEvent(); } catch (e) { throwsRuntimeError = true; } // reCreateSliderAndBindEvent(): Assert error is not thrown expect(throwsRuntimeError).toBeFalsy(); }); }); describe("DOM event listener removal tests", function() { describe("When tooltips are always hidden for single value sliders", function() { beforeEach(function() { // Create slider testSlider = new Slider("#testSlider1", { id: "destroyMethodTestSlider", tooltip: "hide" }); }); it("does not try to remove 'focus' event listener from handle1", function() { // Set up spy on 'removeEventListener' spyOn(testSlider.handle1, "removeEventListener"); // Destroy slider testSlider.destroy(); // Assert expect(testSlider.handle1.removeEventListener).not.toHaveBeenCalledWith("focus", undefined, false); }); it("does not try to remove 'blur' event listener from handle1", function() { // Set up spy on 'removeEventListener' spyOn(testSlider.handle1, "removeEventListener"); // Destroy slider testSlider.destroy(); // Assert expect(testSlider.handle1.removeEventListener).not.toHaveBeenCalledWith("blur", undefined, false); }); it("does not try to remove 'mouseenter' event listener from slider", function() { // Set up spy on 'removeEventListener' spyOn(testSlider.sliderElem, "removeEventListener"); // Destroy slider testSlider.destroy(); // Assert expect(testSlider.sliderElem.removeEventListener).not.toHaveBeenCalledWith("mouseenter", undefined, false); }); it("does not try to remove 'mouseleave' event listener from slider", function() { // Set up spy on 'removeEventListener' spyOn(testSlider.sliderElem, "removeEventListener"); // Destroy slider testSlider.destroy(); // Assert expect(testSlider.sliderElem.removeEventListener).not.toHaveBeenCalledWith("mouseleave", undefined, false); }); }); describe("When tooltips are always shown for single value sliders", function() { beforeEach(function() { // Create slider testSlider = new Slider("#testSlider1", { id: "destroyMethodTestSlider", tooltip: "always" }); }); it("does not try to remove 'focus' event listener from handle1 when tooltip is always shown for single handle sliders", function() { // Set up spy on 'removeEventListener' spyOn(testSlider.handle1, "removeEventListener"); // Destroy slider testSlider.destroy(); // Assert expect(testSlider.handle1.removeEventListener).not.toHaveBeenCalledWith("focus", undefined, false); }); it("does not try to remove 'blur' event listener from handle1 when tooltip is always shown for single handle sliders", function() { // Set up spy on 'removeEventListener' spyOn(testSlider.handle1, "removeEventListener"); // Destroy slider testSlider.destroy(); // Assert expect(testSlider.handle1.removeEventListener).not.toHaveBeenCalledWith("blur", undefined, false); }); it("does not try to remove 'mouseenter' event listener from slider is always shown for single handle slider", function() { // Set up spy on 'removeEventListener' spyOn(testSlider.handle1, "removeEventListener"); // Destroy slider testSlider.destroy(); // Assert expect(testSlider.handle1.removeEventListener).not.toHaveBeenCalledWith("mouseenter", undefined, false); }); it("does not try to remove 'mouseleave' event listener from slider is always shown for single handle slider", function() { // Set up spy on 'removeEventListener' spyOn(testSlider.sliderElem, "removeEventListener"); // Destroy slider testSlider.destroy(); // Assert expect(testSlider.sliderElem.removeEventListener).not.toHaveBeenCalledWith("mouseleave", undefined, false); }); }); describe("When tooltips are always hidden for range sliders", function() { beforeEach(function() { // Create slider testSlider = new Slider("#testSlider1", { id: "destroyMethodTestSlider", tooltip: "always", value: [2,5] }); }); it("does not try to remove 'focus' event listener from handle1", function() { // Set up spy on 'removeEventListener' spyOn(testSlider.handle1, "removeEventListener"); // Destroy slider testSlider.destroy(); // Assert expect(testSlider.handle1.removeEventListener).not.toHaveBeenCalledWith("focus", undefined, false); }); it("does not try to remove 'focus' event listener from handle2", function() { // Set up spy on 'removeEventListener' spyOn(testSlider.handle2, "removeEventListener"); // Destroy slider testSlider.destroy(); // Assert expect(testSlider.handle2.removeEventListener).not.toHaveBeenCalledWith("focus", undefined, false); }); it("does not try to remove 'blur' event listener from handle1", function() { // Set up spy on 'removeEventListener' spyOn(testSlider.handle1, "removeEventListener"); // Destroy slider testSlider.destroy(); // Assert expect(testSlider.handle1.removeEventListener).not.toHaveBeenCalledWith("blur", undefined, false); }); it("does not try to remove 'blur' event listener from handle2", function() { // Set up spy on 'removeEventListener' spyOn(testSlider.handle2, "removeEventListener"); // Destroy slider testSlider.destroy(); // Assert expect(testSlider.handle2.removeEventListener).not.toHaveBeenCalledWith("blur", undefined, false); }); it("does not try to remove 'mouseenter' event listener from slider", function() { // Set up spy on 'removeEventListener' spyOn(testSlider.sliderElem, "removeEventListener"); // Destroy slider testSlider.destroy(); // Assert expect(testSlider.sliderElem.removeEventListener).not.toHaveBeenCalledWith("mouseenter", undefined, false); }); it("does not try to remove 'mouseleave' event listener from slider", function() { // Set up spy on 'removeEventListener' spyOn(testSlider.sliderElem, "removeEventListener"); // Destroy slider testSlider.destroy(); // Assert expect(testSlider.sliderElem.removeEventListener).not.toHaveBeenCalledWith("mouseleave", undefined, false); }); }); describe("When tooltips are always shown for range sliders", function() { beforeEach(function() { // Create slider testSlider = new Slider("#testSlider1", { id: "destroyMethodTestSlider", tooltip: "always", value: [2,5] }); }); it("does not try to remove 'focus' event listener from handle1", function() { // Set up spy on 'removeEventListener' spyOn(testSlider.handle1, "removeEventListener"); // Destroy slider testSlider.destroy(); // Assert expect(testSlider.handle1.removeEventListener).not.toHaveBeenCalledWith("focus", undefined, false); }); it("does not try to remove 'focus' event listener from handle2", function() { // Set up spy on 'removeEventListener' spyOn(testSlider.handle2, "removeEventListener"); // Destroy slider testSlider.destroy(); // Assert expect(testSlider.handle2.removeEventListener).not.toHaveBeenCalledWith("focus", undefined, false); }); it("does not try to remove 'blur' event listener from handle1", function() { // Set up spy on 'removeEventListener' spyOn(testSlider.handle1, "removeEventListener"); // Destroy slider testSlider.destroy(); // Assert expect(testSlider.handle1.removeEventListener).not.toHaveBeenCalledWith("blur", undefined, false); }); it("does not try to remove 'blur' event listener from handle1 and handle2", function() { // Set up spy on 'removeEventListener' spyOn(testSlider.handle2, "removeEventListener"); // Destroy slider testSlider.destroy(); // Assert expect(testSlider.handle2.removeEventListener).not.toHaveBeenCalledWith("blur", undefined, false); }); it("does not try to remove 'mouseenter' event listener from slider", function() { // Set up spy on 'removeEventListener' spyOn(testSlider.sliderElem, "removeEventListener"); // Destroy slider testSlider.destroy(); // Assert expect(testSlider.sliderElem.removeEventListener).not.toHaveBeenCalledWith("mouseenter", undefined, false); }); it("does not try to remove 'mouseleave' event listener from slider", function() { // Set up spy on 'removeEventListener' spyOn(testSlider.sliderElem, "removeEventListener"); // Destroy slider testSlider.destroy(); // Assert expect(testSlider.sliderElem.removeEventListener).not.toHaveBeenCalledWith("mouseleave", undefined, false); }); }); }); });test/specs/RtlOptionsSpec.js000064400000005021151676726750012152 0ustar00describe("RTL Tests", function() { var testSlider; afterEach(function() { if(testSlider) { testSlider.destroy(); testSlider = null; } }); describe("rtl slider tests", function() { it("should be rtl by default inside an rtl wrapper", function() { testSlider = new Slider("#rtlSlider"); var dirIsRtl = $("#rtlSlider").siblings().is(".slider-rtl"); expect(dirIsRtl).toBeTruthy(); }); it("rtl to false inside an rtl wrapper", function() { testSlider = new Slider("#rtlSlider", { rtl: false }); var dirIsRtl = $("#rtlSlider").siblings().is(".slider-rtl"); expect(dirIsRtl).not.toBeTruthy(); }); it("rtl to true inside an ltr wrapper", function() { testSlider = new Slider("#testSlider1", { rtl: true }); var dirIsRtl = $("#testSlider1").siblings().is(".slider-rtl"); expect(dirIsRtl).toBeTruthy(); }); it("slider use inversed left and right inline style", function() { testSlider = new Slider("#rtlSlider", { min: 0, max: 10, value: 5 }); var sliderTrackLowRight=$("#rtlSlider").siblings(".slider-rtl").children("div.slider-track").children("div.slider-track-low").css("right"); var sliderSelectionRight=$("#rtlSlider").siblings(".slider-rtl").children("div.slider-track").children("div.slider-selection").css("right"); var sliderTrackHighLeft=$("#rtlSlider").siblings(".slider-rtl").children("div.slider-track").children("div.slider-track-high").css("left"); expect(sliderTrackLowRight).toBe("0px"); expect(sliderSelectionRight).toBe("0%"); expect(sliderTrackHighLeft).toBe("0px"); }); it("tooltip position must be inversed in vertical", function() { testSlider = new Slider("#rtlSlider", { orientation: "vertical", }); var mainTooltipHasClassLeft = testSlider.tooltip.classList.contains("left"); expect(mainTooltipHasClassLeft).toBeTruthy(); expect(testSlider.tooltip.style.right).toBe("100%"); }); it("tooltip position can be forced in vertical", function() { testSlider = new Slider("#rtlSlider", { orientation: "vertical", tooltip_position: "right", }); var mainTooltipHasClassRight = testSlider.tooltip.classList.contains("right"); expect(mainTooltipHasClassRight).toBeTruthy(); expect(testSlider.tooltip.style.left).toBe("100%"); }); }); }); // End of spec test/specs/LowAndHighTrackSpec.js000064400000013150151676726750013010 0ustar00/* ********************** Left/Right Track Tests ********************** This spec has tests for checking that the widths of the left and right segments are the correct widths and colors, based on their CSS. */ describe("Low/High Track Tests", function() { var unstyledID = "low-high-slider"; var styledID = "low-high-slider-styled"; var testSlider; describe("Single-value sliders, no styling", function() { var id = unstyledID; beforeEach(function() { testSlider = $("#testSlider1").slider({ id: id, min: 0, max: 10, value: 5 }); }); it("low track width is zero", function() { var leftTrack = $("#" + id + " .slider-track-low"); expect($(leftTrack).css("width")).toBe("0px"); }); it("high track width is 50%", function() { var rightTrack = $("#" + id + " .slider-track-high"); var trackWidth = rightTrack.parent().width(); expect($(rightTrack).css("width")).toBe((trackWidth / 2) + "px"); }); it("high track is transparent", function() { var rightTrack = $("#" + id + " .slider-track-high"); var rightColor = rightTrack.css("background-color"); var isTransparent = rightColor.match(/rgba\([0-9]{1,3}, [0-9]{1,3}, [0-9]{1,3}, 0\)/); expect(isTransparent).toBeTruthy(); }); afterEach(function() { if(testSlider) { testSlider.slider('destroy'); testSlider = null; } }); }); describe("Single-value sliders, with styling", function() { var id = styledID; beforeEach(function() { testSlider = $("#testSlider1").slider({ id: id, min: 0, max: 10, value: 5 }); }); it("low track width is zero", function() { var leftTrack = $("#" + id + " .slider-track-low"); expect($(leftTrack).css("width")).toBe("0px"); }); it("high track width is 50%", function() { var rightTrack = $("#" + id + " .slider-track-high"); var trackWidth = rightTrack.parent().width(); expect($(rightTrack).css("width")).toBe((trackWidth / 2) + "px"); }); it("high track is red", function() { var rightTrack = $("#" + id + " .slider-track-high"); var rightColor = rightTrack.css("background-color"); expect(rightColor).toBe("rgb(255, 0, 0)"); }); afterEach(function() { if(testSlider) { testSlider.slider('destroy'); testSlider = null; } }); }); describe("Range sliders, no styling", function() { var id = unstyledID; var values = { min: 0, max: 10, values: [ 4, 6 ] }; beforeEach(function() { testSlider = $("#testSlider1").slider({ id: id, min: values.min, max: values.max, range: true, value: values.values }); }); it("low track width is correct", function() { var leftTrack = $("#" + id + " .slider-track-low"); var trackWidth = leftTrack.parent().width(); var expectedWidth = ((values.values[0] - values.min) / (values.max - values.min)) * trackWidth; expect($(leftTrack).css("width")).toBe(expectedWidth + "px"); }); it("high track width is correct", function() { var rightTrack = $("#" + id + " .slider-track-high"); var trackWidth = rightTrack.parent().width(); var expectedWidth = ((values.max - values.values[1]) / (values.max - values.min)) * trackWidth; expect($(rightTrack).css("width")).toBe(expectedWidth + "px"); }); it("low track is transparent", function() { var leftTrack = $("#" + id + " .slider-track-low"); var leftColor = leftTrack.css("background-color"); var isTransparent = leftColor.match(/rgba\([0-9]{1,3}, [0-9]{1,3}, [0-9]{1,3}, 0\)/); expect(isTransparent).toBeTruthy(); }); it("high track is transparent", function() { var rightTrack = $("#" + id + " .slider-track-high"); var rightColor = rightTrack.css("background-color"); var isTransparent = rightColor.match(/rgba\([0-9]{1,3}, [0-9]{1,3}, [0-9]{1,3}, 0\)/); expect(isTransparent).toBeTruthy(); }); afterEach(function() { if(testSlider) { testSlider.slider('destroy'); testSlider = null; } }); }); describe("Range sliders, with styling", function() { var id = styledID; var values = { min: 0, max: 10, values: [ 4, 6 ] }; beforeEach(function() { testSlider = $("#testSlider1").slider({ id: id, min: values.min, max: values.max, range: true, value: values.values }); }); it("low track width is correct", function() { var leftTrack = $("#" + id + " .slider-track-low"); var trackWidth = leftTrack.parent().width(); var expectedWidth = ((values.values[0] - values.min) / (values.max - values.min)) * trackWidth; expect($(leftTrack).css("width")).toBe(expectedWidth + "px"); }); it("high track width is correct", function() { var rightTrack = $("#" + id + " .slider-track-high"); var trackWidth = rightTrack.parent().width(); var expectedWidth = ((values.max - values.values[1]) / (values.max - values.min)) * trackWidth; expect($(rightTrack).css("width")).toBe(expectedWidth + "px"); }); it("low track is green", function() { var leftTrack = $("#" + id + " .slider-track-low"); var leftColor = leftTrack.css("background-color"); expect(leftColor).toBe("rgb(0, 255, 0)"); }); it("high track is red", function() { var rightTrack = $("#" + id + " .slider-track-high"); var rightColor = rightTrack.css("background-color"); expect(rightColor).toBe("rgb(255, 0, 0)"); }); afterEach(function() { if(testSlider) { testSlider.slider('destroy'); testSlider = null; } }); }); });test/specs/TickClickingBehaviorSpec.js000064400000005324151676726750014061 0ustar00describe("TickClickingBehavior", function() { var SLIDER_ID = "testSlider1"; var slider; var options; describe('ticks start with 0', function() { beforeEach(function() { options = { ticks: [0, 1, 2, 3, 4], ticks_positions: [0, 25, 50, 75, 100], step: 1, value: 4 }; slider = new Slider(document.getElementById(SLIDER_ID), options); }); it("Should set slider to corresponding value when ticks are clicked", function() { for (var i = 0; i < options.ticks.length; i++) { clickTickAtIndexAndVerify(slider, i); } }); }); describe('ticks start with positive value', function() { beforeEach(function() { options = { ticks: [1, 2, 3, 4, 5], ticks_positions: [0, 25, 50, 75, 100], step: 1, value: 5 }; slider = new Slider(document.getElementById(SLIDER_ID), options); }); it("Should set slider to corresponding value when ticks are clicked", function() { for (var i = 0; i < options.ticks.length; i++) { clickTickAtIndexAndVerify(slider, i); } }); }); describe('ticks start with negative value', function() { beforeEach(function() { options = { ticks: [-5, -4, -3, -2, -1], ticks_positions: [0, 25, 50, 75, 100], step: 1, value: -1 }; slider = new Slider(document.getElementById(SLIDER_ID), options); }); it("Should set slider to corresponding value when ticks are clicked", function() { for (var i = 0; i < options.ticks.length; i++) { clickTickAtIndexAndVerify(slider, i); } }); }); afterEach(function() { slider.destroy(); }); // helper functions function clickTickAtIndexAndVerify(slider, tickIndex) { var sliderLeft = slider.sliderElem.offsetLeft; var tickLeft = slider.ticks[tickIndex].offsetLeft; var handleHalfWidth = $('.slider-handle.round').width() / 2; var offsetX = sliderLeft + tickLeft + handleHalfWidth; var offsetY = slider.sliderElem.offsetTop; var mouseEvent = getMouseDownEvent(offsetX, offsetY); slider.mousedown(mouseEvent); slider.mouseup(); var expectedValue = slider.options.ticks[tickIndex]; expect(slider.getValue()).toBe(expectedValue); } function getMouseDownEvent(offsetXToClick, offsetYToClick) { var args = [ 'mousedown', // type true, // canBubble true, // cancelable document, // view, 0, // detail 0, // screenX 0, // screenY offsetXToClick, // clientX offsetYToClick, // clientY, false, // ctrlKey false, // altKey false, // shiftKey false, // metaKey, 0, // button null // relatedTarget ]; var event = document.createEvent('MouseEvents'); event.initMouseEvent.apply(event, args); return event; } }); test/specs/ScrollableBodySpec.js000064400000012517151676726760012746 0ustar00describe("Scrollable body test", function() { var testSlider; var sliderHandleTopPos; var sliderHandleLeftPos; describe("Vertical scrolled body", function() { beforeEach(function() { testSlider = new Slider("#veryLowPositionedSlider", { id: "scrollTestSliderId", orientation: "vertical", min: 0, max: 20, value: 10, step: 1 }); document.body.scrollTop = 2000; var sliderHandleEl = document.querySelector("#scrollTestSliderId .slider-handle"); var sliderHandleBoundingBoxInfo = sliderHandleEl.getBoundingClientRect(); sliderHandleTopPos = sliderHandleBoundingBoxInfo.top; sliderHandleLeftPos = sliderHandleBoundingBoxInfo.left; }); afterEach(function() { if(testSlider) { testSlider.destroy(); } document.body.scrollTop = 0; }); // The difference between sliderHandleTopPos and mousemoveY is equal to 50 in both cases, // but difference between initial and final slider value is not equal (6 and 4). // It happens because we don't 'hit' the center of handle but the top left corner. it("slides up when handle moves upwards after scroll page down", function() { var mousemove = document.createEvent('MouseEvents'); var mousemoveX = sliderHandleLeftPos; var mousemoveY = sliderHandleTopPos - 50; var newSliderValue; mousemove.initMouseEvent( "mousedown", true /* bubble */, true /* cancelable */, window, null, 0, 0, mousemoveX, mousemoveY, /* coordinates */ false, false, false, false, /* modifier keys */ 0 /*left*/, null ); testSlider.sliderElem.dispatchEvent(mousemove); newSliderValue = testSlider.getValue(); expect(newSliderValue).toEqual(4); }); it("slides down when handle moves downwards after scroll page down", function() { var mousemove = document.createEvent('MouseEvents'); var mousemoveX = sliderHandleLeftPos; var mousemoveY = sliderHandleTopPos + 50; var newSliderValue; mousemove.initMouseEvent( "mousedown", true /* bubble */, true /* cancelable */, window, null, 0, 0, mousemoveX, mousemoveY, /* coordinates */ false, false, false, false, /* modifier keys */ 0 /*left*/, null ); testSlider.sliderElem.dispatchEvent(mousemove); newSliderValue = testSlider.getValue(); expect(newSliderValue).toEqual(14); }); }); describe('Horizontal scrolled body', function() { beforeEach(function() { testSlider = new Slider('#offRightEdgeSliderInput', { id: 'offRightEdgeSlider', orientation: 'horizontal', min: 0, max: 20, value: 10, step: 1, }); testSlider.sliderElem.scrollIntoView(); var handle = document.querySelector('#offRightEdgeSlider .slider-handle'); var handleRect = handle.getBoundingClientRect(); sliderHandleTopPos = handleRect.top; sliderHandleLeftPos = handleRect.left; }); afterEach(function() { if (testSlider) { testSlider.destroy(); } window.scrollTo(0, 0); }); it('slides left when clicked on the left of the handle', function() { var x = sliderHandleLeftPos - 50; var y = sliderHandleTopPos; var mousedown, newSliderValue; mousedown = createMouseDownEvent(x, y); testSlider.sliderElem.dispatchEvent(mousedown); newSliderValue = testSlider.getValue(); expect(newSliderValue).toEqual(4); }); it('slides right when clicked on the left of the handle', function() { var x = sliderHandleLeftPos + 50; var y = sliderHandleTopPos; var mousedown, newSliderValue; mousedown = createMouseDownEvent(x, y); testSlider.sliderElem.dispatchEvent(mousedown); newSliderValue = testSlider.getValue(); expect(newSliderValue).toEqual(14); }); function createMouseDownEvent(x, y) { var mousedown = document.createEvent('MouseEvents'); mousedown.initMouseEvent( 'mousedown', false /* bubble */, true /* cancelable */, window, /* view */ null, /* detail */ 0, 0, x, y, /* coordinates */ false, false, false, false, /* modifier keys */ 0, /* button: left */ null /* relatedTarget */ ); return mousedown; } }); }); test/specs/TooltipSplitOptionSpec.js000064400000005172151676726760013704 0ustar00/* ************************* tooltip_split Option Test ************************* This spec tests if tooltip_main, tooltip_min and tooltip_max behave correctly when tooltip_split option is set to true or false. */ describe("'tooltip_split' Option tests", function() { var testSlider, sliderId = "tooltipedSlider", $slider, $tooltipMain, $tooltipMin, $tooltipMax, sliderOptions = {id: sliderId, value: [0, 10], tooltip: "always"}; // for the sake of testing, always display the tooltip describe("When 'tooltip_split' is false", function() { beforeEach(function() { testSlider = $("#testSlider1").slider($.extend(sliderOptions, {tooltip_split: false})); $slider = $("#"+sliderId); $tooltipMain = $slider.find(".tooltip-main"); $tooltipMin = $slider.find(".tooltip-min"); $tooltipMax = $slider.find(".tooltip-max"); }); it("should have `tooltip-main` displayed with `in` class", function() { expect($tooltipMain.css("display")).not.toBe("none"); expect($tooltipMain.hasClass("in")).toBeTruthy(); }); it("should have `tooltip-min, tooltip-max` not displayed", function() { expect($tooltipMin.css("display")).toBe("none"); expect($tooltipMin.hasClass("in")).toBeFalsy(); expect($tooltipMax.css("display")).toBe("none"); expect($tooltipMax.hasClass("in")).toBeFalsy(); }); }); describe("When 'tooltip_split' is true", function() { beforeEach(function() { testSlider = $("#testSlider1").slider($.extend(sliderOptions, {tooltip_split: true})); $slider = $("#"+sliderId); $tooltipMain = $slider.find(".tooltip-main"); $tooltipMin = $slider.find(".tooltip-min"); $tooltipMax = $slider.find(".tooltip-max"); }); it("should have `tooltip-min, tooltip-max` displayed with `in` class", function() { expect($tooltipMin.css("display")).not.toBe("none"); expect($tooltipMin.hasClass("in")).toBeTruthy(); expect($tooltipMax.css("display")).not.toBe("none"); expect($tooltipMax.hasClass("in")).toBeTruthy(); }); it("should have `tooltip-main` not displayed", function() { expect($tooltipMain.css("display")).toBe("none"); expect($tooltipMain.hasClass("in")).toBeFalsy(); }); it("should be aligned above the handle on init if set to 'top'", function() { expect($tooltipMin.hasClass("top")).toBeTruthy(); expect($tooltipMax.hasClass("top")).toBeTruthy(); }); }); afterEach(function() { if(testSlider) { testSlider.slider('destroy'); testSlider = null; } }); }); test/specs/OrientationSpec.js000064400000004326151676726760012340 0ustar00describe("Orientation Tests", function() { var testSlider; var sliderHandleTopPos; var sliderHandleLeftPos; describe("Vertical", function() { beforeEach(function() { testSlider = new Slider("#orientationSlider", { id: "orientationSliderId", orientation: "vertical", min: 0, max: 10, value: 5 }); var sliderHandleEl = document.querySelector("#orientationSliderId .slider-handle"); var sliderHandleBoundingBoxInfo = sliderHandleEl.getBoundingClientRect(); sliderHandleTopPos = sliderHandleBoundingBoxInfo.top; sliderHandleLeftPos = sliderHandleBoundingBoxInfo.left; }); afterEach(function() { if(testSlider) { testSlider.destroy(); } }); it("slides up when handle moves upwards", function() { var mousemove = document.createEvent('MouseEvents'); var mousemoveX = sliderHandleLeftPos; var mousemoveY = sliderHandleTopPos - 100; var newSliderValue; mousemove.initMouseEvent( "mousedown", true /* bubble */, true /* cancelable */, window, null, 0, 0, mousemoveX, mousemoveY, /* coordinates */ false, false, false, false, /* modifier keys */ 0 /*left*/, null ); testSlider.sliderElem.dispatchEvent(mousemove); newSliderValue = testSlider.getValue(); expect(newSliderValue).toBeLessThan(5); }); it("slides down when handle moves downwards", function() { var mousemove = document.createEvent('MouseEvents'); var mousemoveX = sliderHandleLeftPos; var mousemoveY = sliderHandleTopPos + 100; var newSliderValue; mousemove.initMouseEvent( "mousedown", true /* bubble */, true /* cancelable */, window, null, 0, 0, mousemoveX, mousemoveY, /* coordinates */ false, false, false, false, /* modifier keys */ 0 /*left*/, null ); testSlider.sliderElem.dispatchEvent(mousemove); newSliderValue = testSlider.getValue(); expect(newSliderValue).toBeGreaterThan(5); }); }); }); // End of spectest/specs/TickLabelSpec.js000064400000017523151676726760011702 0ustar00/* Tick label Render Tests - Tests that labels render in correct positions in both horizontal and vertical orientation */ describe("Tick Label Render Tests", function() { var testSliderH; var testSliderV; //setup beforeEach(function() { testSliderH = $('#testSlider1').slider({ id: 'slider1', ticks: [0, 1, 2], ticks_labels:['x', 'y', 'z'], orientation:'horizontal' }); testSliderV = $('#testSlider2').slider({ id: 'slider2', ticks: [0, 1, 2], ticks_labels:['x', 'y', 'z'], orientation:'vertical' }); }); //cleanup afterEach(function() { testSliderH.slider('destroy'); testSliderH = null; testSliderV.slider('destroy'); testSliderV = null; }); //e.g. testOrientation('horizontal', 2) will test the horizontal //code path using control with the id testSlider2 function testOrientation(orientation) { var sliderIndex = orientation.toLowerCase() === 'horizontal' ? 1 : 2; var isVertical = orientation.toLowerCase() === 'horizontal' ? false : true; var sliderId = '#slider' + sliderIndex; //check elements exist it("Tick labels are rendered - " + orientation, function() { expect($(sliderId).length).toBe(1); var length = $(sliderId + ' .slider-tick-label').length; expect(length).toBe(3); }); //check elements exist within the bounds of the slider it("Tick labels render inside the slider's bounds" + orientation, function() { expect($(sliderId).length).toBe(1); var sliderRect = $(sliderId)[0].getBoundingClientRect(); var tickLabels = $(sliderId + ' .slider-tick-label'); for (var i = 0; i < tickLabels.length; i++) { var labelRect = tickLabels[i].getBoundingClientRect(); if (isVertical) { expect(labelRect.left).toBeGreaterThan(sliderRect.left); expect(labelRect.top + 10 >= sliderRect.top).toBeTruthy(); } else { expect(labelRect.top + 10 >= sliderRect.top).toBeTruthy(); expect(labelRect.width / 2 + labelRect.left >= sliderRect.left).toBeTruthy(); } } }); } //test both horizontal and vertical orientations testOrientation('horizontal'); testOrientation('vertical'); }); describe("Tick Labels 'is-selection' and 'in-selection' Tests", function() { var $inputSlider; var options; var keyboardEvent; var $slider; var $handle1; var $handle2; var $tickLabels; var tickLabelCount; // Setup beforeEach(function() { options = { id: 'slider1', ticks: [0, 1, 2, 3, 4], value: 2, ticks_labels:['$0', '$1', '$2', '$3', '$4'], }; tickLabelCount = options.ticks_labels.length; // Create keyboard event keyboardEvent = document.createEvent('Event'); keyboardEvent.initEvent('keydown', true, true); }); // Cleanup afterEach(function() { $inputSlider.slider('destroy'); $inputSlider = null; }); describe("Tick Labels 'is-selection' Tests", function() { describe("'options.selection = 'before'", function() { beforeEach(function() { options.selection = 'before'; $inputSlider = $('#testSlider1').slider(options); $slider = $('#slider1'); $tickLabels = $slider.find('.slider-tick-label-container div.slider-tick-label'); }); it("Should show the correct tick labels as 'is-selection'", function() { // There should only be one tick label with the 'label-is-selection' class expect($slider.find('.label-is-selection').length).toBe(1); // Only the third tick label should have the 'label-is-selection' class expect($tickLabels.eq(2).hasClass('label-is-selection')).toBe(true); }); it("Should show the correct tick labels as 'is-selection' when keying to the left", function(done) { $handle1 = $('#slider1').find('.slider-handle:first'); expect($slider.find('.label-is-selection').length).toBe(1); expect($tickLabels.eq(2).hasClass('label-is-selection')).toBe(true); $handle1.on('keydown', function() { expect($slider.find('.label-is-selection').length).toBe(1); expect($tickLabels.eq(1).hasClass('label-is-selection')).toBe(true); done(); }); // Move handle1 to the left with keyboard $handle1.focus(); keyboardEvent.keyCode = keyboardEvent.which = 37; $handle1[0].dispatchEvent(keyboardEvent); }); }); describe("'options.selection = 'after'", function() { beforeEach(function() { options.selection = 'after'; $inputSlider = $('#testSlider1').slider(options); $slider = $('#slider1'); $tickLabels = $slider.find('.slider-tick-label-container div.slider-tick-label'); }); it("Should show the correct tick labels as 'is-selection'" , function() { expect($slider.find('.label-is-selection').length).toBe(1); expect($tickLabels.eq(2).hasClass('label-is-selection')).toBe(true); }); it("Should show the correct tick labels as 'is-selection' when keying to the right" , function(done) { $handle1 = $('#slider1').find('.slider-handle:first'); expect($slider.find('.label-is-selection').length).toBe(1); expect($tickLabels.eq(2).hasClass('label-is-selection')).toBe(true); $handle1.on('keydown', function() { expect($slider.find('.label-is-selection').length).toBe(1); expect($tickLabels.eq(3).hasClass('label-is-selection')).toBe(true); done(); }); // Move handle1 to the right with keyboard $handle1.focus(); keyboardEvent.keyCode = keyboardEvent.which = 39; $handle1[0].dispatchEvent(keyboardEvent); }); }); }); describe("Tick Labels 'in-selection' Tests", function() { function checkTickLabels($labels, expectedLabels) { var next = 0; // There are only 5 tick labels. expect($labels.length).toBe(tickLabelCount); for (var i = 0; i < tickLabelCount; i++) { if (i === expectedLabels[next]) { expect($labels.eq(i).hasClass('label-in-selection')).toBe(true); next++; } else { expect($labels.eq(i).hasClass('label-in-selection')).toBe(false); } } } // Setup beforeEach(function() { options.value = [1, 3]; $inputSlider = $('#testSlider1').slider(options); $slider = $('#slider1'); $tickLabels = $slider.find('.slider-tick-label-container div.slider-tick-label'); }); it("Should show the correct tick labels as 'in-selection'", function() { expect($slider.find('.label-is-selection').length).toBe(3); checkTickLabels($tickLabels, [1, 2, 3]); }); it("Should show the correct tick labels as 'in-selection' when keying to the left", function(done) { $handle1 = $('#slider1').find('.slider-handle:first'); // There should be 3 tick labels with the 'label-in-selection' class expect($slider.find('.label-in-selection').length).toBe(3); // Check that the correct tick labels have the 'label-in-selection' class checkTickLabels($tickLabels, [1, 2, 3]); $handle1.on('keydown', function() { expect($slider.find('.label-in-selection').length).toBe(4); // Check the labels again checkTickLabels($tickLabels, [0, 1, 2, 3]); done(); }); // Move handle1 to the left with keyboard $handle1.focus(); keyboardEvent.keyCode = keyboardEvent.which = 37; $handle1[0].dispatchEvent(keyboardEvent); }); it("Should show the correct tick labels as 'in-selection' when keying to the right" , function(done) { $handle2 = $('#slider1').find('.slider-handle:last'); expect($slider.find('.label-in-selection').length).toBe(3); checkTickLabels($tickLabels, [1, 2, 3]); $handle2.on('keydown', function() { expect($slider.find('.label-in-selection').length).toBe(4); checkTickLabels($tickLabels, [1, 2, 3, 4]); done(); }); // Move handle2 to the right with keyboard $handle2.focus(); keyboardEvent.keyCode = keyboardEvent.which = 39; $handle2[0].dispatchEvent(keyboardEvent); }); }); });test/specs/ResizeSpec.js000064400000004221151676726760011300 0ustar00describe("Resize Tests", function() { var testSlider, dataSlider; afterEach(function() { if(testSlider) { testSlider.slider('destroy'); testSlider = null; dataSlider = null; } }); describe("Tick Labels", function() { var $el, options; beforeEach(function() { var tick = [0, 100, 200, 300, 400]; options = { ticks: tick, ticks_labels: ['$0', '$100', '$200', '$300', '$400'] }; }); it("should resize the tick labels when horizontal", function() { $el = $("#resizeSlider"); testSlider = $el.slider(options); dataSlider = testSlider.data('slider'); $('.slider').width(210); dataSlider._resize(); expect($el.siblings('div.slider').find('.slider-tick-label:eq(0)').width()).toBe(53); $('.slider').width(120); dataSlider._resize(); expect($el.siblings('div.slider').find('.slider-tick-label:eq(0)').width()).toBe(30); $('.slider').width(900); dataSlider._resize(); expect($el.siblings('div.slider').find('.slider-tick-label:eq(1)').width()).toBe(225); $('.slider').width(210); dataSlider._resize(); expect($el.siblings('div.slider').find('.slider-tick-label:eq(0)').width()).toBe(53); }); it('should resize the tick labels when vertical', function() { var $el = $("#resizeSliderVertical"); testSlider = $el.slider(options); dataSlider = testSlider.data('slider'); $('.slider').height(210); dataSlider._resize(); expect($el.siblings('div.slider').find('.slider-tick-label:eq(0)').height()).toBe(53); $('.slider').height(120); dataSlider._resize(); expect($el.siblings('div.slider').find('.slider-tick-label:eq(0)').height()).toBe(30); $('.slider').height(900); dataSlider._resize(); expect($el.siblings('div.slider').find('.slider-tick-label:eq(1)').height()).toBe(225); $('.slider').height(210); dataSlider._resize(); expect($el.siblings('div.slider').find('.slider-tick-label:eq(0)').height()).toBe(53); }); }); }); // End of spec test/specs/TickMarksSpec.js000064400000013501151676726760011730 0ustar00/* ************************* Tick Marks Tests ************************* Verify that the number of tick marks matches what you set Verify the tick marks are at the correct intervals */ describe("Slider with ticks tests", function() { var testSlider; it("Should have the number of tick marks you specify", function() { testSlider = $("#testSlider1").slider({ ticks: [100, 200, 300, 400, 500] }); var numTicks = $("#testSlider1").siblings('div.slider').find('.slider-tick').length; expect(numTicks).toBe(5); }); it("Should be at the default positions", function() { testSlider = $("#testSlider1").slider({ ticks: [100, 200, 300, 400, 500] }); $("#testSlider1").siblings('div.slider').find('.slider-tick').each(function(i) { expect(this.style.left).toBe(100 * i / 4.0 + '%'); }); }); it("Should be at the positions you specify", function() { var tickPositions = [0, 10, 20, 30, 100]; testSlider = $("#testSlider1").slider({ ticks: [100, 200, 300, 400, 500], ticks_positions: tickPositions }); $("#testSlider1").siblings('div.slider').find('.slider-tick').each(function(i) { expect(this.style.left).toBe(tickPositions[i] + '%'); }); }); it("Should have the tick labels you specify", function() { var tickLabels = ['$0', '$100', '$200', '$300', '$400']; testSlider = $("#testSlider1").slider({ ticks: [100, 200, 300, 400, 500], ticks_labels: tickLabels }); var tickLabelElements = $("#testSlider1").siblings('div.slider').find('.slider-tick-label'); expect(tickLabelElements.length).toBe(tickLabels.length); tickLabelElements.each(function(i) { expect(this.innerHTML).toBe(tickLabels[i]); }); }); it("Should overwrite the min/max values", function() { testSlider = $("#testSlider1").slider({ ticks: [100, 200, 300, 400, 500], min: 15000, max: 25000 }); expect(testSlider.slider('getAttribute','min')).toBe(100); expect(testSlider.slider('getAttribute','max')).toBe(500); }); it("Should not snap to a tick within tick bounds when using the keyboard navigation", function() { testSlider = $("#testSlider1").slider({ ticks: [100, 200, 300, 400, 500], ticks_snap_bounds: 30 }); // Focus on handle1 var handle1 = $("#testSlider1").siblings('div.slider:first').find('.slider-handle'); handle1.focus(); // Create keyboard event var keyboardEvent = document.createEvent("Events"); keyboardEvent.initEvent("keydown", true, true); var keyPresses = 0; handle1.on("keydown", function() { keyPresses++; var value = $("#testSlider1").slider('getValue'); expect(value).toBe(100 + keyPresses); }); keyboardEvent.keyCode = keyboardEvent.which = 39; // RIGHT for (var i = 0; i < 5; i++) { handle1[0].dispatchEvent(keyboardEvent); } }); it("Should show the correct tick marks as 'in-selection', according to the `selection` property", function() { var options = { ticks: [100, 200, 300, 400, 500], value: 250, selection: 'after' }, $el = $("#testSlider1"); testSlider = $el.slider(options); expect($el.siblings('div.slider').find('.in-selection').length).toBe(3); testSlider.slider('destroy'); options.selection = 'before'; testSlider = $el.slider(options); expect($el.siblings('div.slider').find('.in-selection').length).toBe(2); }); it("Should reverse the tick labels if `reversed` option is set to true", function() { var ticks = [100, 200, 300, 400, 500]; var ticksLabels = ["$100", "$200", "$300", "$400", "$500"]; // Create reversed slider testSlider = $("#testSlider1").slider({ id: "testSlider1Ref", ticks: ticks, ticks_labels: ticksLabels, ticks_snap_bounds: 30, reversed: true }); // Assert that tick marks are reversed var tickLabelsFromDOM = $("#testSlider1Ref .slider-tick-label-container") .children(".slider-tick-label") .map(function() { return $(this).text(); }) .toArray(); var reversedTickLabels = ticksLabels.reverse(); expect(tickLabelsFromDOM).toEqual(reversedTickLabels); }); it("Should reverse the tick labels if `reversed` option is set to true and `ticks_positions` is specified", function() { var ticks = [0, 100, 200, 300, 400]; var ticksLabels = ["$0", "$100", "$200", "$300", "$400"]; // Create reversed slider testSlider = $("#testSlider1").slider({ id: "testSlider1Ref", ticks: ticks, ticks_labels: ticksLabels, ticks_positions: [0, 30, 70, 90, 100], ticks_snap_bounds: 20, value: 200, reversed: true }); // Assert that tick marks are reversed var tickLabelsFromDOM = $("#testSlider1Ref .slider-tick-label-container .slider-tick-label") .sort(function(tickLabelElemA, tickLabelElemB) { var leftOffsetA = $(tickLabelElemA).position().left; var leftOffsetB = $(tickLabelElemB).position().left; return leftOffsetA - leftOffsetB; }) .map(function() { return $(this).text(); }) .toArray(); var reversedTickLabels = ticksLabels.reverse(); expect(tickLabelsFromDOM).toEqual(reversedTickLabels); }); it("should wrap all of the ticks within a div with classname '.slider-tick-container'", function() { // Create the slider with ticks var ticks = [0, 100, 200, 300, 400, 600]; var $sliderDOMRef = $("#testSlider1"); // Create reversed slider testSlider = $sliderDOMRef.slider({ id: "testSlider1Ref", ticks: ticks, ticks_positions: [0, 30, 70, 90, 100, 130] }); // Assert that the ticks are children of the container element var numTicks = $sliderDOMRef.siblings('div.slider').find('.slider-tick-container > .slider-tick').length; expect(numTicks).toBe(ticks.length); }); afterEach(function() { if(testSlider) { testSlider.slider('destroy'); testSlider = null; } }); }); test/specs/TooltipPositionOptionSpec.js000064400000013132151676726760014410 0ustar00/* ************************* tooltip_position Option Test ************************* */ describe("'tooltip_position' Option tests", function() { var testSlider; afterEach(function() { if(testSlider) { testSlider.destroy(); testSlider = null; } }); describe("vertical slider tests", function() { it("should be aligned to the left of the handle if set to 'left'", function() { // Create slider testSlider = new Slider("#testSlider1", { min: 0, max: 10, value: 5, tooltip_position: "left", orientation: "vertical" }); // Extract needed references/values var mainTooltipHasClassLeft = testSlider.tooltip.classList.contains("left"); // Assert expect(mainTooltipHasClassLeft).toBeTruthy(); expect(testSlider.tooltip.style.right).toBe("100%"); }); it("should be aligned to the right of the handle if set to 'right'", function() { // Create slider testSlider = new Slider("#testSlider1", { min: 0, max: 10, value: 5, tooltip_position: "right", orientation: "vertical" }); // Extract needed references/values var mainTooltipHasClassRight = testSlider.tooltip.classList.contains("right"); // Assert expect(mainTooltipHasClassRight).toBeTruthy(); expect(testSlider.tooltip.style.left).toBe("100%"); }); it("should default to 'right' if tooltip_position set to 'top'", function() { // Create slider testSlider = new Slider("#testSlider1", { min: 0, max: 10, value: 5, tooltip_position: "top", orientation: "vertical" }); // Extract needed references/values var mainTooltipHasClassRight = testSlider.tooltip.classList.contains("right"); // Assert expect(mainTooltipHasClassRight).toBeTruthy(); expect(testSlider.tooltip.style.left).toBe("100%"); }); it("should default to 'right' if tooltip_position set to 'bottom'", function() { // Create slider testSlider = new Slider("#testSlider1", { min: 0, max: 10, value: 5, tooltip_position: "bottom", orientation: "vertical" }); // Extract needed references/values var mainTooltipHasClassRight = testSlider.tooltip.classList.contains("right"); // Assert expect(mainTooltipHasClassRight).toBeTruthy(); expect(testSlider.tooltip.style.left).toBe("100%"); }); }); describe("horizontal slider tests", function() { it("should be aligned above the handle if set to 'top'", function() { // Create slider testSlider = new Slider("#testSlider1", { min: 0, max: 10, value: 5, tooltip_position: "top", orientation: "horizontal" }); // Extract needed references/values var mainTooltipHasClassTop = testSlider.tooltip.classList.contains("top"); // Assert expect(mainTooltipHasClassTop).toBeTruthy(); expect(testSlider.tooltip.style.top).toBe(""); }); it("should be aligned below the handle if set to 'bottom'", function() { // Create slider testSlider = new Slider("#testSlider1", { min: 0, max: 10, value: 5, tooltip_position: "bottom", orientation: "horizontal" }); // Extract needed references/values var mainTooltipHasClassTop = testSlider.tooltip.classList.contains("bottom"); // Assert expect(mainTooltipHasClassTop).toBeTruthy(); expect(testSlider.tooltip.style.top).toBe("22px"); }); it("should be aligned below the handle if set to 'bottom' for range", function() { // Create slider testSlider = new Slider("#testSlider1", { min: 0, max: 20, value: [0, 10], range: true, tooltip_position: "bottom", orientation: "horizontal" }); // Extract needed references/values var mainTooltipHasClassTopMin = testSlider.tooltip_min.classList.contains("bottom"); var mainTooltipHasClassTopMax = testSlider.tooltip_max.classList.contains("bottom"); // Assert expect(mainTooltipHasClassTopMin).toBeTruthy(); expect(mainTooltipHasClassTopMax).toBeTruthy(); expect(testSlider.tooltip_min.style.top).toBe("22px"); expect(testSlider.tooltip_max.style.top).toBe("22px"); }); it("should default to 'top' if tooltip_position set to 'left'", function() { // Create slider testSlider = new Slider("#testSlider1", { min: 0, max: 10, value: 5, tooltip_position: "left", orientation: "horizontal" }); // Extract needed references/values var mainTooltipHasClassTop = testSlider.tooltip.classList.contains("top"); // Assert expect(mainTooltipHasClassTop).toBeTruthy(); expect(testSlider.tooltip.style.top).toBe(""); }); it("should default to 'top' if tooltip_position set to 'right'", function() { // Create slider testSlider = new Slider("#testSlider1", { min: 0, max: 10, value: 5, tooltip_position: "right", orientation: "horizontal" }); // Extract needed references/values var mainTooltipHasClassTop = testSlider.tooltip.classList.contains("top"); // Assert expect(mainTooltipHasClassTop).toBeTruthy(); expect(testSlider.tooltip.style.top).toBe(""); }); }); });test/specs/ElementDataAttributesSpec.js000064400000012060151676726760014271 0ustar00describe("Element Data Attributes Tests", function() { var slider; it("reads the 'data-slider-min' property and sets it on slider", function() { slider = $("#minSlider").slider(); slider.slider('setValue', 1); var sliderValue = slider.slider('getValue'); expect(sliderValue).toBe(5); }); it("reads the 'data-slider-max' property and sets it on slider", function() { slider = $("#maxSlider").slider(); slider.slider('setValue', 10); var sliderValue = slider.slider('getValue'); expect(sliderValue).toBe(5); }); it("reads the 'data-slider-step' property and sets it on slider", function() { slider = $("#stepSlider").slider(); //TODO How do you test this? Maybe manually trigger a slideChange event? expect(true).toBeTruthy(); }); it("reads the 'data-slider-precision' property (which is set to 2) and sets it on slider", function() { slider = $("#precisionSlider").slider(); slider.slider('setValue', 8.115); var sliderValue = slider.slider('getValue'); expect(sliderValue).toBe(8.12); }); it("reads the 'data-slider-orientation' property and sets it on slider", function() { slider = $("#orientationSlider").slider(); var orientationIsVertical = $("#orientationSlider").data('slider').options.orientation === 'vertical'; expect(orientationIsVertical).toBeTruthy(); }); it("reads the 'data-slider-value' property and sets it on slider", function() { slider = $("#valueSlider").slider(); var sliderValue = slider.slider('getValue'); expect(sliderValue).toBe(5); }); it("reads the 'data-slider-ticks-labels' property and sets it on slider", function() { slider = $("#sliderWithTickMarksAndLabels").slider(); var ticksLabelsAreCorrect = arraysEqual($("#sliderWithTickMarksAndLabels").data('slider').options.ticks_labels, ['$0', '$100', '$200', '$300', '$400']); expect(ticksLabelsAreCorrect).toBeTruthy(); function arraysEqual(a, b) { if (a === b) {return true;} if (a == null || b == null){return false;} if (a.length !== b.length) {return false;} for (var i = 0; i < a.length; ++i) { if (a[i] !== b[i]) {return false;} } return true; } }); it("reads the 'data-slider-selection' property and sets it on slider", function() { slider = $("#selectionSlider").slider({ id: "selectionSliderId" }); slider.slider('setValue', 0); var newSliderValue = slider.slider('getValue'); expect(newSliderValue).toBe(0); }); it("reads the 'data-slider-tooltip' property and sets it on slider", function() { slider = $("#tooltipSlider").slider({ id: "tooltipSliderElem" }); var tooltipIsHidden = $("#tooltipSliderElem").children("div.tooltip").hasClass("hide"); expect(tooltipIsHidden).toBeTruthy(); }); describe("reads the 'data-slider-handle' property and sets it on slider", function() { it("applies 'triangle' class tag to handle", function() { slider = $("#handleSlider").slider({ id: "handleSliderElem" }); var handleIsSetToTriangle = $("#handleSliderElem div.slider-handle").hasClass("triangle"); expect(handleIsSetToTriangle).toBeTruthy(); }); it("applies 'custom' class tag to handle", function() { slider = $("#customHandleSlider").slider({ id: "customHandleSliderElem" }); var handleIsSetToCustom = $("#customHandleSliderElem div.slider-handle").hasClass("custom"); expect(handleIsSetToCustom).toBeTruthy(); }); }); it("reads the 'data-slider-reversed' property and sets it on slider", function() { slider = $("#reversedSlider").slider({ id: "reversedSliderElem" }); slider.slider('setValue', 10); var sliderSelectionHeightAtMaxValue = $("#reversedSliderElem div.slider-track").children("div.slider-selection").width(); expect(sliderSelectionHeightAtMaxValue).toBe(0); }); it("reads the 'data-slider-enabled' property and sets it on slider", function() { slider = $("#disabledSlider").slider(); var isEnabled = slider.slider('isEnabled'); expect(isEnabled).not.toBeTruthy(); }); it("always sets the 'value' attribute of the original <input> element to be the current slider value", function() { var $slider = $("#testSliderGeneric"); var val = 7; slider = $slider.slider({ value: val }); var sliderValueAttrib = $slider.val(); var valAsString = val.toString(); expect(sliderValueAttrib).toBe(valAsString); }); it("always sets the 'data-value' attribute of the original <input> element to be the current slider value", function() { // Setup var sliderInputElem = document.getElementById("testSliderGeneric"); var val = 7; slider = new Slider(sliderInputElem, { value: val }); // Assert expect(sliderInputElem.dataset.value).toBe( val.toString() ); // Cleanup slider.destroy(); slider = null; }); afterEach(function() { if(slider) { slider.slider('destroy'); } }); });test/specs/NamespaceSpec.js000064400000002435151676726760011740 0ustar00describe("Namespace Tests", function() { var sourceJS = "temp/bootstrap-slider.js"; it("should always set the plugin namespace to 'bootstrapSlider'", function(done) { $.getScript(sourceJS, function() { expect($.fn.bootstrapSlider).toBeDefined(); done(); }); }); it("should set the plugin namespace to 'slider' if the namespace is available", function(done) { $.getScript(sourceJS, function() { expect($.fn.slider).toBeDefined(); done(); }); }); it("should print a console warning if the 'slider' namespace is already bound", function(done) { $.fn.slider = function() {}; spyOn(window.console, "warn"); $.getScript(sourceJS, function() { var expectedWarningMessage = "bootstrap-slider.js - WARNING: $.fn.slider namespace is already bound. Use the $.fn.bootstrapSlider namespace instead."; expect(window.console.warn).toHaveBeenCalledWith(expectedWarningMessage); done(); }); }); afterEach(function(done) { /* Set the namespaces back to undefined and reload slider So that namespace is returned to $.fn.slider */ $.fn.bootstrapSlider = undefined; $.fn.slider = undefined; $.getScript(sourceJS, function() { done(); }); }); });test/specs/ConflictingOptionsSpec.js000064400000003746151676726760013665 0ustar00/* ************************* Conflicting Options Tests ************************* This spec has tests for checking if two or more options do not conflict with one another As option conflicts are reported and resolved, write tests for them here. This will help ensure that they are accounted for and do not arise again. */ describe("Conflicting Options Tests", function() { var testSlider; it("Should have the value zero when it is slided to zero", function() { testSlider = $("#testSlider1").slider({ value: 0, step: 1 }); var flag = false; var mouse = document.createEvent('MouseEvents'); testSlider.on('slide', function(slideEvt) { expect(slideEvt.value).toBe(0); flag = true; }); testSlider.data('slider')._mousemove(mouse); expect(flag).toBeTruthy(); }); it("should set the `precision` to be the number of digits after the decimal of the `step` (assuming no `precision` is specified)", function() { // Create Slider testSlider = $("#testSlider1").slider({ value: 8.115, step: 0.01 }); // Retrieve slider value var value = testSlider.slider("getValue"); // Run tests expect(value).toBe(8.12); }); it("should properly allow for a slider that has `range` set to true and `reversed` set to true", function() { // Create Slider testSlider = new Slider("#testSlider1", { reversed: true, range: true, min: -5, max: 20 }); // Set Value testSlider.setValue([-5, 20]); // Assert that selection slider section is 100% of slider width var selectedSectionWidth = testSlider.sliderElem.querySelector(".slider-selection").style.width; expect(selectedSectionWidth).toBe("100%"); // Cleanup testSlider.destroy(); testSlider = null; }); afterEach(function() { if(testSlider) { testSlider.slider('destroy'); testSlider = null; } }); }); test/specs/RangeHighlightsSpec.js000064400000015022151676726760013107 0ustar00/* RangeHighlights Render Tests */ describe("RangeHighlights Render Tests", function() { var testSlider1; var testSlider2; var testSlider3; var testSlider4; //setup beforeEach(function() { var rangeHighlightsOpts1 = [ { "start": 2, "end": 5, "class": "category1" }, // left: 10%; width: 15% { "start": 7, "end": 8, "class": "category2" }, // left: 35%; width: 5% { "start": 17, "end": 19 }, // left: 85%; width: 10% { "start": 17, "end": 24 }, //out of range - not visible { "start": -3, "end": 19 } //out of range - not visible ]; var rangeHighlightsOpts2 = [ { "start": 2, "end": 5, "class": "category1" }, // top: 10%; height: 15% { "start": 7, "end": 8, "class": "category2" }, // top: 35%; height: 5% { "start": 17, "end": 19 }, // top: 85%; height: 10% { "start": 7, "end": -4 }, //out of range - not visible { "start": 23, "end": 15 } //out of range - not visible ]; testSlider1 = $('#testSlider1').slider({ id: 'slider1', min: 0, max: 20, step: 1, value: 14, rangeHighlights: rangeHighlightsOpts1 }); testSlider2 = $('#testSlider2').slider({ id: 'slider2', min: 0, max: 20, step: 1, value: 14, orientation: 'vertical', rangeHighlights: rangeHighlightsOpts2 }); testSlider3 = $('#testSlider3').slider({ id: 'slider3', min: 0, max: 20, step: 1, value: 14, reversed: true, rangeHighlights: rangeHighlightsOpts1 }); testSlider4 = $('#testSlider4').slider({ id: 'slider4', min: 0, max: 20, step: 1, value: 14, reversed: true, orientation: 'vertical', rangeHighlights: rangeHighlightsOpts2 }); }); //cleanup afterEach(function() { testSlider1.slider('destroy'); testSlider1 = null; testSlider2.slider('destroy'); testSlider2 = null; testSlider3.slider('destroy'); testSlider3 = null; testSlider4.slider('destroy'); testSlider4 = null; }); //test the visibility of ranges e.g. : { "start": 23, "end": 15 } - out of range - not visible function testHighlightedElements(sliderId, isHorizontal, expections) { //check elements exist it("Highlighted ranges are rendered - " + sliderId, function() { expect($(sliderId).length).toBe(1); expect($(sliderId + ' .slider-rangeHighlight').length).toBe(5); expect($(sliderId + ' .slider-rangeHighlight.category1').length).toBe(1); expect($(sliderId + ' .slider-rangeHighlight.category2').length).toBe(1); }); //check elements exist within proper display value it("Highlighted ranges render inside the slider's bounds " + sliderId, function() { expect($(sliderId).length).toBe(1); var ranges = $(sliderId + ' .slider-rangeHighlight'); expect(ranges.length).toBe(5); for (var i = 0; i < ranges.length; i++) { expect($(ranges[i]).is(":visible")).toBe(expections[i].isVisible); if (expections[i].isVisible) { if(isHorizontal) { expect(_getLeftPercent($(ranges[i]))).toBe(expections[i].start); expect(_getWidthPercent($(ranges[i]))).toBe(expections[i].size); } else { expect(_getTopPercent($(ranges[i]))).toBe(expections[i].start); expect(_getHeightPercent($(ranges[i]))).toBe(expections[i].size); } } } }); } function _getLeftPercent(element) { return Math.round(100 * element.position().left / element.parent().width()) + '%'; } function _getWidthPercent(element) { var width = element.width(); var parentWidth = element.offsetParent().width(); return Math.round(100 * width / parentWidth) + '%'; } function _getTopPercent(element) { return Math.round(100 * element.position().top / element.parent().height()) + '%'; } function _getHeightPercent(element) { var height = element.height(); var parentHeight = element.offsetParent().height(); return Math.round(100 * height / parentHeight) + '%'; } //test both testSlider testHighlightedElements('#slider1', true, [{ isVisible: true, start: '10%', size: '15%' }, { isVisible: true, start: '35%', size: '5%' }, { isVisible: true, start: '85%', size: '10%' }, { isVisible: false, start: '85%', size: '10%' }, { isVisible: false, start: '85%', size: '10%' }]); testHighlightedElements('#slider2', false, [{ isVisible: true, start: '10%', size: '15%' }, { isVisible: true, start: '35%', size: '5%' }, { isVisible: true, start: '85%', size: '10%' }, { isVisible: false, start: '85%', size: '10%' }, { isVisible: false, start: '85%', size: '10%' }]); testHighlightedElements('#slider3', true, [{ isVisible: true, start: '75%', size: '15%' }, { isVisible: true, start: '60%', size: '5%' }, { isVisible: true, start: '5%', size: '10%' }, { isVisible: false, start: '5%', size: '10%' }, { isVisible: false, start: '5%', size: '10%' }]); testHighlightedElements('#slider4', false, [{ isVisible: true, start: '75%', size: '15%' }, { isVisible: true, start: '60%', size: '5%' }, { isVisible: true, start: '5%', size: '10%' }, { isVisible: false, start: '5%', size: '10%' }, { isVisible: false, start: '5%', size: '10%' }]); }); test/phantom_bind_polyfill.js000064400000002222151676726760012462 0ustar00///////////////////////////////////// // Taken from ariya/phantomjs#10522 // Function.prototype.bind = function bind(that) { // .length is 1 var target = this; if (typeof target != "function") { throw new TypeError("Function.prototype.bind called on incompatible " + target); } var args = Array.prototype.slice.call(arguments, 1); // for normal call var bound = function () { if (this instanceof bound) { var result = target.apply( this, args.concat(Array.prototype.slice.call(arguments)) ); if (Object(result) === result) { return result; } return this; } else { return target.apply( that, args.concat(Array.prototype.slice.call(arguments)) ); } }; function Empty() {}; if(target.prototype) { Empty.prototype = target.prototype; bound.prototype = new Empty(); Empty.prototype = null; } return bound; };.sass-lint.yml000064400000001460151676726760007312 0ustar00######################### ## Sass Lint File ######################### # Linter Options options: # Don't merge default rules merge-default-rules: false # Raise an error if more than 50 warnings are generated max-warnings: 50 # File Options files: include: 'src/sass/**/*.s+(a|c)ss' # Rule Configuration rules: extends-before-mixins: 2 extends-before-declarations: 2 placeholder-in-extend: 2 mixins-before-declarations: - 2 - exclude: - breakpoint - mq no-warn: 1 no-debug: 1 no-ids: 2 no-important: 2 hex-notation: - 2 - style: uppercase indentation: - 2 - size: 2 property-sort-order: - 1 - order: - display - margin ignore-custom-properties: trueGruntfile.js000064400000021251151676726760007071 0ustar00/*global module:false*/ module.exports = function(grunt) { var packageJSON = grunt.file.readJSON('package.json'); var bumpFiles = ["package.json", "bower.json", "composer.json"]; var commitFiles = bumpFiles.concat(["./dist/*"]); // Project configuration. grunt.initConfig({ // Metadata pkg: packageJSON, // Task configuration. header: { dist: { options: { text: "/*! =======================================================\n VERSION <%= pkg.version %> \n========================================================= */" }, files: { '<%= pkg.gruntConfig.dist.js %>': '<%= pkg.gruntConfig.temp.js %>', '<%= pkg.gruntConfig.dist.jsMin %>': '<%= pkg.gruntConfig.temp.jsMin %>', '<%= pkg.gruntConfig.dist.css %>': '<%= pkg.gruntConfig.temp.css %>', '<%= pkg.gruntConfig.dist.cssMin %>': '<%= pkg.gruntConfig.temp.cssMin %>' } } }, uglify: { options: { preserveComments: 'some' }, dist: { src: '<%= pkg.gruntConfig.temp.js %>', dest: '<%= pkg.gruntConfig.temp.jsMin %>' } }, babel: { options: { presets: ['es2015'] }, dist: { src: '<%= pkg.gruntConfig.js.slider %>', dest: '<%= pkg.gruntConfig.temp.js %>' } }, jshint: { ignore_warning: { options: { '-W099': true }, src: '<%= pkg.gruntConfig.js.slider %>' }, options: { esnext: true, curly: true, eqeqeq: true, immed: true, latedef: false, newcap: true, noarg: true, sub: true, undef: true, unused: true, boss: true, eqnull: true, browser: true, globals: { $ : true, Modernizr : true, console: true, define: true, module: true, require: true }, "-W099": true }, gruntfile: { src: 'Gruntfile.js' }, js: { src: '<%= pkg.gruntConfig.js.slider %>' }, spec : { src: '<%= pkg.gruntConfig.spec %>', options : { globals : { document: true, console: false, Slider: false, $: false, jQuery: false, _: false, _V_: false, afterEach: false, beforeEach: false, confirm: false, context: false, describe: false, expect: false, it: false, jasmine: false, JSHINT: false, mostRecentAjaxRequest: false, qq: false, runs: false, spyOn: false, spyOnEvent: false, waitsFor: false, xdescribe: false } } } }, sasslint: { options: { configFile: './.sass-lint.yml', }, target: ['./src/sass/**/*.scss'] }, lesslint: { src: ['./src/less/bootstrap-slider.less'] }, jasmine : { src : '<%= pkg.gruntConfig.temp.js %>', options : { specs : '<%= pkg.gruntConfig.spec %>', vendor : ['<%= pkg.gruntConfig.js.jquery %>', '<%= pkg.gruntConfig.js.bindPolyfill %>'], styles : ['<%= pkg.gruntConfig.css.bootstrap %>', '<%= pkg.gruntConfig.temp.css %>'], template : '<%= pkg.gruntConfig.tpl.SpecRunner %>' } }, template : { 'generate-index-page' : { options : { data : { js : { highlightjs: '<%= pkg.gruntConfig.js.highlightjs %>', modernizr : '<%= pkg.gruntConfig.js.modernizr %>', jquery : '<%= pkg.gruntConfig.js.jquery %>', slider : '<%= pkg.gruntConfig.temp.js %>' }, css : { highlightjs: '<%= pkg.gruntConfig.css.highlightjs %>', bootstrap : '<%= pkg.gruntConfig.css.bootstrap %>', slider : '<%= pkg.gruntConfig.temp.css %>' } } }, files : { 'index.html' : ['<%= pkg.gruntConfig.tpl.index %>'] } }, 'generate-gh-pages' : { options : { data : { js : { highlightjs: '<%= pkg.gruntConfig.js.highlightjs %>', modernizr : '<%= pkg.gruntConfig.js.modernizr %>', jquery : '<%= pkg.gruntConfig.js.jquery %>', slider : 'js/bootstrap-slider.js' }, css : { highlightjs: '<%= pkg.gruntConfig.css.highlightjs %>', bootstrap : 'css/bootstrap.min.css', slider : 'css/bootstrap-slider.css' } } }, files : { 'index.html' : ['<%= pkg.gruntConfig.tpl.index %>'] } } }, watch: { options: { livereload: true }, js: { files: '<%= pkg.gruntConfig.js.slider %>', tasks: ['jshint:js', 'babel', 'jasmine'] }, gruntfile: { files: '<%= jshint.gruntfile %>', tasks: ['jshint:gruntfile'] }, spec: { files: '<%= pkg.gruntConfig.spec %>', tasks: ['jshint:spec', 'jasmine:src'] }, css: { files: [ '<%= pkg.gruntConfig.less.slider %>', '<%= pkg.gruntConfig.less.rules %>', '<%= pkg.gruntConfig.less.variables %>' ], tasks: ['less:development'] }, index: { files: '<%= pkg.gruntConfig.tpl.index %>', tasks: ['template:generate-index-page'] } }, connect: { server: { options: { port: "<%= pkg.gruntConfig.devPort %>" } } }, open : { development : { path: 'http://localhost:<%= connect.server.options.port %>' } }, less: { options: { paths: ["bower_components/bootstrap/less"] }, development: { files: { '<%= pkg.gruntConfig.temp.css %>': '<%= pkg.gruntConfig.less.slider %>' } }, production: { files: { '<%= pkg.gruntConfig.temp.css %>': '<%= pkg.gruntConfig.less.slider %>', } }, "production-min": { options: { yuicompress: true }, files: { '<%= pkg.gruntConfig.temp.cssMin %>': '<%= pkg.gruntConfig.less.slider %>' } } }, clean: { dist: ["dist"], temp: ["temp"] }, bump: { options: { files: bumpFiles, updateConfigs: [], commit: true, commitMessage: 'Release v%VERSION%', commitFiles: commitFiles, createTag: true, tagName: 'v%VERSION%', tagMessage: 'Version %VERSION%', push: false, pushTo: 'origin' } } }); // These plugins provide necessary tasks. grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-jasmine'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-connect'); grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-less'); grunt.loadNpmTasks('grunt-open'); grunt.loadNpmTasks('grunt-template'); grunt.loadNpmTasks('grunt-header'); grunt.loadNpmTasks('grunt-bump'); grunt.loadNpmTasks('grunt-babel'); grunt.loadNpmTasks('grunt-sass-lint'); grunt.loadNpmTasks('grunt-lesslint'); // Create custom tasks grunt.registerTask('append-header', ['header', 'clean:temp']); grunt.registerTask('lint', [ 'jshint', 'lesslint', 'sasslint' ]); grunt.registerTask('test', [ 'babel', 'less:development', 'jasmine', 'clean:temp' ]); grunt.registerTask('build', [ 'less:development', 'test', 'template:generate-index-page' ]); grunt.registerTask('build-gh-pages', [ 'less:development', 'babel', 'template:generate-gh-pages' ]); grunt.registerTask('dist', [ 'clean:dist', 'less:production', 'less:production-min', 'babel', 'uglify', 'append-header' ]); grunt.registerTask('development', [ 'less:development', 'babel', 'template:generate-index-page', 'connect', 'open:development', 'watch' ]); grunt.registerTask('production', ['dist']); grunt.registerTask('dev', 'development'); grunt.registerTask('prod', 'production'); grunt.registerTask('default', ['build']); }; // End of module dist/css/bootstrap-slider.min.css000064400000022240151676726760013117 0ustar00/*! ======================================================= VERSION 10.3.2 ========================================================= */ /*! ========================================================= * bootstrap-slider.js * * Maintainers: * Kyle Kemp * - Twitter: @seiyria * - Github: seiyria * Rohit Kalkur * - Twitter: @Rovolutionary * - Github: rovolution * * ========================================================= * * bootstrap-slider is released under the MIT License * Copyright (c) 2017 Kyle Kemp, Rohit Kalkur, and contributors * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * ========================================================= */.slider{display:inline-block;vertical-align:middle;position:relative}.slider.slider-horizontal{width:210px;height:20px}.slider.slider-horizontal .slider-track{height:10px;width:100%;margin-top:-5px;top:50%;left:0}.slider.slider-horizontal .slider-selection,.slider.slider-horizontal .slider-track-low,.slider.slider-horizontal .slider-track-high{height:100%;top:0;bottom:0}.slider.slider-horizontal .slider-tick,.slider.slider-horizontal .slider-handle{margin-left:-10px}.slider.slider-horizontal .slider-tick.triangle,.slider.slider-horizontal .slider-handle.triangle{position:relative;top:50%;-ms-transform:translateY(-50%);transform:translateY(-50%);border-width:0 10px 10px 10px;width:0;height:0;border-bottom-color:#2e6da4;margin-top:0}.slider.slider-horizontal .slider-tick-container{white-space:nowrap;position:absolute;top:0;left:0;width:100%}.slider.slider-horizontal .slider-tick-label-container{white-space:nowrap;margin-top:20px}.slider.slider-horizontal .slider-tick-label-container .slider-tick-label{padding-top:4px;display:inline-block;text-align:center}.slider.slider-horizontal .tooltip{-ms-transform:translateX(-50%);transform:translateX(-50%)}.slider.slider-horizontal.slider-rtl .slider-track{left:initial;right:0}.slider.slider-horizontal.slider-rtl .slider-tick,.slider.slider-horizontal.slider-rtl .slider-handle{margin-left:initial;margin-right:-10px}.slider.slider-horizontal.slider-rtl .slider-tick-container{left:initial;right:0}.slider.slider-horizontal.slider-rtl .tooltip{-ms-transform:translateX(50%);transform:translateX(50%)}.slider.slider-vertical{height:210px;width:20px}.slider.slider-vertical .slider-track{width:10px;height:100%;left:25%;top:0}.slider.slider-vertical .slider-selection{width:100%;left:0;top:0;bottom:0}.slider.slider-vertical .slider-track-low,.slider.slider-vertical .slider-track-high{width:100%;left:0;right:0}.slider.slider-vertical .slider-tick,.slider.slider-vertical .slider-handle{margin-top:-10px}.slider.slider-vertical .slider-tick.triangle,.slider.slider-vertical .slider-handle.triangle{border-width:10px 0 10px 10px;width:1px;height:1px;border-left-color:#2e6da4;border-right-color:#2e6da4;margin-left:0;margin-right:0}.slider.slider-vertical .slider-tick-label-container{white-space:nowrap}.slider.slider-vertical .slider-tick-label-container .slider-tick-label{padding-left:4px}.slider.slider-vertical .tooltip{-ms-transform:translateY(-50%);transform:translateY(-50%)}.slider.slider-vertical.slider-rtl .slider-track{left:initial;right:25%}.slider.slider-vertical.slider-rtl .slider-selection{left:initial;right:0}.slider.slider-vertical.slider-rtl .slider-tick.triangle,.slider.slider-vertical.slider-rtl .slider-handle.triangle{border-width:10px 10px 10px 0}.slider.slider-vertical.slider-rtl .slider-tick-label-container .slider-tick-label{padding-left:initial;padding-right:4px}.slider.slider-disabled .slider-handle{background-image:-webkit-linear-gradient(top,#dfdfdf 0,#bebebe 100%);background-image:-o-linear-gradient(top,#dfdfdf 0,#bebebe 100%);background-image:linear-gradient(to bottom,#dfdfdf 0,#bebebe 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdfdfdf',endColorstr='#ffbebebe',GradientType=0)}.slider.slider-disabled .slider-track{background-image:-webkit-linear-gradient(top,#e5e5e5 0,#e9e9e9 100%);background-image:-o-linear-gradient(top,#e5e5e5 0,#e9e9e9 100%);background-image:linear-gradient(to bottom,#e5e5e5 0,#e9e9e9 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe5e5e5',endColorstr='#ffe9e9e9',GradientType=0);cursor:not-allowed}.slider input{display:none}.slider .tooltip{pointer-events:none}.slider .tooltip.top{margin-top:-36px}.slider .tooltip-inner{white-space:nowrap;max-width:none}.slider .hide{display:none}.slider-track{position:absolute;cursor:pointer;background-image:-webkit-linear-gradient(top,#f5f5f5 0,#f9f9f9 100%);background-image:-o-linear-gradient(top,#f5f5f5 0,#f9f9f9 100%);background-image:linear-gradient(to bottom,#f5f5f5 0,#f9f9f9 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5',endColorstr='#fff9f9f9',GradientType=0);-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);border-radius:4px}.slider-selection{position:absolute;background-image:-webkit-linear-gradient(top,#f9f9f9 0,#f5f5f5 100%);background-image:-o-linear-gradient(top,#f9f9f9 0,#f5f5f5 100%);background-image:linear-gradient(to bottom,#f9f9f9 0,#f5f5f5 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff9f9f9',endColorstr='#fff5f5f5',GradientType=0);-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;border-radius:4px}.slider-selection.tick-slider-selection{background-image:-webkit-linear-gradient(top,#8ac1ef 0,#82b3de 100%);background-image:-o-linear-gradient(top,#8ac1ef 0,#82b3de 100%);background-image:linear-gradient(to bottom,#8ac1ef 0,#82b3de 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff8ac1ef',endColorstr='#ff82b3de',GradientType=0)}.slider-track-low,.slider-track-high{position:absolute;background:transparent;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;border-radius:4px}.slider-handle{position:absolute;top:0;width:20px;height:20px;background-color:#337ab7;background-image:-webkit-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:linear-gradient(to bottom,#337ab7 0,#2e6da4 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7',endColorstr='#ff2e6da4',GradientType=0);filter:none;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);border:0 solid transparent}.slider-handle:hover{cursor:pointer}.slider-handle.round{border-radius:50%}.slider-handle.triangle{background:transparent none}.slider-handle.custom{background:transparent none}.slider-handle.custom::before{line-height:20px;font-size:20px;content:'\2605';color:#726204}.slider-tick{position:absolute;cursor:pointer;width:20px;height:20px;background-image:-webkit-linear-gradient(top,#f9f9f9 0,#f5f5f5 100%);background-image:-o-linear-gradient(top,#f9f9f9 0,#f5f5f5 100%);background-image:linear-gradient(to bottom,#f9f9f9 0,#f5f5f5 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff9f9f9',endColorstr='#fff5f5f5',GradientType=0);-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;filter:none;opacity:.8;border:0 solid transparent}.slider-tick.round{border-radius:50%}.slider-tick.triangle{background:transparent none}.slider-tick.custom{background:transparent none}.slider-tick.custom::before{line-height:20px;font-size:20px;content:'\2605';color:#726204}.slider-tick.in-selection{background-image:-webkit-linear-gradient(top,#8ac1ef 0,#82b3de 100%);background-image:-o-linear-gradient(top,#8ac1ef 0,#82b3de 100%);background-image:linear-gradient(to bottom,#8ac1ef 0,#82b3de 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff8ac1ef',endColorstr='#ff82b3de',GradientType=0);opacity:1}dist/css/bootstrap-slider.css000064400000024710151676726760012341 0ustar00/*! ======================================================= VERSION 10.3.2 ========================================================= */ /*! ========================================================= * bootstrap-slider.js * * Maintainers: * Kyle Kemp * - Twitter: @seiyria * - Github: seiyria * Rohit Kalkur * - Twitter: @Rovolutionary * - Github: rovolution * * ========================================================= * * bootstrap-slider is released under the MIT License * Copyright (c) 2017 Kyle Kemp, Rohit Kalkur, and contributors * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * ========================================================= */ .slider { display: inline-block; vertical-align: middle; position: relative; } .slider.slider-horizontal { width: 210px; height: 20px; } .slider.slider-horizontal .slider-track { height: 10px; width: 100%; margin-top: -5px; top: 50%; left: 0; } .slider.slider-horizontal .slider-selection, .slider.slider-horizontal .slider-track-low, .slider.slider-horizontal .slider-track-high { height: 100%; top: 0; bottom: 0; } .slider.slider-horizontal .slider-tick, .slider.slider-horizontal .slider-handle { margin-left: -10px; } .slider.slider-horizontal .slider-tick.triangle, .slider.slider-horizontal .slider-handle.triangle { position: relative; top: 50%; -ms-transform: translateY(-50%); transform: translateY(-50%); border-width: 0 10px 10px 10px; width: 0; height: 0; border-bottom-color: #2e6da4; margin-top: 0; } .slider.slider-horizontal .slider-tick-container { white-space: nowrap; position: absolute; top: 0; left: 0; width: 100%; } .slider.slider-horizontal .slider-tick-label-container { white-space: nowrap; margin-top: 20px; } .slider.slider-horizontal .slider-tick-label-container .slider-tick-label { padding-top: 4px; display: inline-block; text-align: center; } .slider.slider-horizontal .tooltip { -ms-transform: translateX(-50%); transform: translateX(-50%); } .slider.slider-horizontal.slider-rtl .slider-track { left: initial; right: 0; } .slider.slider-horizontal.slider-rtl .slider-tick, .slider.slider-horizontal.slider-rtl .slider-handle { margin-left: initial; margin-right: -10px; } .slider.slider-horizontal.slider-rtl .slider-tick-container { left: initial; right: 0; } .slider.slider-horizontal.slider-rtl .tooltip { -ms-transform: translateX(50%); transform: translateX(50%); } .slider.slider-vertical { height: 210px; width: 20px; } .slider.slider-vertical .slider-track { width: 10px; height: 100%; left: 25%; top: 0; } .slider.slider-vertical .slider-selection { width: 100%; left: 0; top: 0; bottom: 0; } .slider.slider-vertical .slider-track-low, .slider.slider-vertical .slider-track-high { width: 100%; left: 0; right: 0; } .slider.slider-vertical .slider-tick, .slider.slider-vertical .slider-handle { margin-top: -10px; } .slider.slider-vertical .slider-tick.triangle, .slider.slider-vertical .slider-handle.triangle { border-width: 10px 0 10px 10px; width: 1px; height: 1px; border-left-color: #2e6da4; border-right-color: #2e6da4; margin-left: 0; margin-right: 0; } .slider.slider-vertical .slider-tick-label-container { white-space: nowrap; } .slider.slider-vertical .slider-tick-label-container .slider-tick-label { padding-left: 4px; } .slider.slider-vertical .tooltip { -ms-transform: translateY(-50%); transform: translateY(-50%); } .slider.slider-vertical.slider-rtl .slider-track { left: initial; right: 25%; } .slider.slider-vertical.slider-rtl .slider-selection { left: initial; right: 0; } .slider.slider-vertical.slider-rtl .slider-tick.triangle, .slider.slider-vertical.slider-rtl .slider-handle.triangle { border-width: 10px 10px 10px 0; } .slider.slider-vertical.slider-rtl .slider-tick-label-container .slider-tick-label { padding-left: initial; padding-right: 4px; } .slider.slider-disabled .slider-handle { background-image: -webkit-linear-gradient(top, #dfdfdf 0%, #bebebe 100%); background-image: -o-linear-gradient(top, #dfdfdf 0%, #bebebe 100%); background-image: linear-gradient(to bottom, #dfdfdf 0%, #bebebe 100%); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdfdfdf', endColorstr='#ffbebebe', GradientType=0); } .slider.slider-disabled .slider-track { background-image: -webkit-linear-gradient(top, #e5e5e5 0%, #e9e9e9 100%); background-image: -o-linear-gradient(top, #e5e5e5 0%, #e9e9e9 100%); background-image: linear-gradient(to bottom, #e5e5e5 0%, #e9e9e9 100%); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe5e5e5', endColorstr='#ffe9e9e9', GradientType=0); cursor: not-allowed; } .slider input { display: none; } .slider .tooltip { pointer-events: none; } .slider .tooltip.top { margin-top: -36px; } .slider .tooltip-inner { white-space: nowrap; max-width: none; } .slider .hide { display: none; } .slider-track { position: absolute; cursor: pointer; background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #f9f9f9 100%); background-image: -o-linear-gradient(top, #f5f5f5 0%, #f9f9f9 100%); background-image: linear-gradient(to bottom, #f5f5f5 0%, #f9f9f9 100%); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#fff9f9f9', GradientType=0); -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); border-radius: 4px; } .slider-selection { position: absolute; background-image: -webkit-linear-gradient(top, #f9f9f9 0%, #f5f5f5 100%); background-image: -o-linear-gradient(top, #f9f9f9 0%, #f5f5f5 100%); background-image: linear-gradient(to bottom, #f9f9f9 0%, #f5f5f5 100%); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff9f9f9', endColorstr='#fff5f5f5', GradientType=0); -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; border-radius: 4px; } .slider-selection.tick-slider-selection { background-image: -webkit-linear-gradient(top, #8ac1ef 0%, #82b3de 100%); background-image: -o-linear-gradient(top, #8ac1ef 0%, #82b3de 100%); background-image: linear-gradient(to bottom, #8ac1ef 0%, #82b3de 100%); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff8ac1ef', endColorstr='#ff82b3de', GradientType=0); } .slider-track-low, .slider-track-high { position: absolute; background: transparent; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; border-radius: 4px; } .slider-handle { position: absolute; top: 0; width: 20px; height: 20px; background-color: #337ab7; background-image: -webkit-linear-gradient(top, #337ab7 0%, #2e6da4 100%); background-image: -o-linear-gradient(top, #337ab7 0%, #2e6da4 100%); background-image: linear-gradient(to bottom, #337ab7 0%, #2e6da4 100%); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0); filter: none; -webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); border: 0px solid transparent; } .slider-handle:hover { cursor: pointer; } .slider-handle.round { border-radius: 50%; } .slider-handle.triangle { background: transparent none; } .slider-handle.custom { background: transparent none; } .slider-handle.custom::before { line-height: 20px; font-size: 20px; content: '\2605'; color: #726204; } .slider-tick { position: absolute; cursor: pointer; width: 20px; height: 20px; background-image: -webkit-linear-gradient(top, #f9f9f9 0%, #f5f5f5 100%); background-image: -o-linear-gradient(top, #f9f9f9 0%, #f5f5f5 100%); background-image: linear-gradient(to bottom, #f9f9f9 0%, #f5f5f5 100%); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff9f9f9', endColorstr='#fff5f5f5', GradientType=0); -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; filter: none; opacity: 0.8; border: 0px solid transparent; } .slider-tick.round { border-radius: 50%; } .slider-tick.triangle { background: transparent none; } .slider-tick.custom { background: transparent none; } .slider-tick.custom::before { line-height: 20px; font-size: 20px; content: '\2605'; color: #726204; } .slider-tick.in-selection { background-image: -webkit-linear-gradient(top, #8ac1ef 0%, #82b3de 100%); background-image: -o-linear-gradient(top, #8ac1ef 0%, #82b3de 100%); background-image: linear-gradient(to bottom, #8ac1ef 0%, #82b3de 100%); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff8ac1ef', endColorstr='#ff82b3de', GradientType=0); opacity: 1; } dist/bootstrap-slider.min.js000064400000105302151676726760012154 0ustar00/*! ======================================================= VERSION 10.3.2 ========================================================= */ "use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},windowIsDefined="object"===("undefined"==typeof window?"undefined":_typeof(window));!function(a){if("function"==typeof define&&define.amd)define(["jquery"],a);else if("object"===("undefined"==typeof module?"undefined":_typeof(module))&&module.exports){var b;try{b=require("jquery")}catch(c){b=null}module.exports=a(b)}else window&&(window.Slider=a(window.jQuery))}(function(a){var b="slider",c="bootstrapSlider";windowIsDefined&&!window.console&&(window.console={}),windowIsDefined&&!window.console.log&&(window.console.log=function(){}),windowIsDefined&&!window.console.warn&&(window.console.warn=function(){});var d;return function(a){function b(){}function c(a){function c(b){b.prototype.option||(b.prototype.option=function(b){a.isPlainObject(b)&&(this.options=a.extend(!0,this.options,b))})}function e(b,c){a.fn[b]=function(e){if("string"==typeof e){for(var g=d.call(arguments,1),h=0,i=this.length;i>h;h++){var j=this[h],k=a.data(j,b);if(k)if(a.isFunction(k[e])&&"_"!==e.charAt(0)){var l=k[e].apply(k,g);if(void 0!==l&&l!==k)return l}else f("no such method '"+e+"' for "+b+" instance");else f("cannot call methods on "+b+" prior to initialization; attempted to call '"+e+"'")}return this}var m=this.map(function(){var d=a.data(this,b);return d?(d.option(e),d._init()):(d=new c(this,e),a.data(this,b,d)),a(this)});return!m||m.length>1?m:m[0]}}if(a){var f="undefined"==typeof console?b:function(a){console.error(a)};return a.bridget=function(a,b){c(b),e(a,b)},a.bridget}}var d=Array.prototype.slice;c(a)}(a),function(a){function e(b,c){function d(a,b){var c="data-slider-"+b.replace(/_/g,"-"),d=a.getAttribute(c);try{return JSON.parse(d)}catch(e){return d}}this._state={value:null,enabled:null,offset:null,size:null,percentage:null,inDrag:!1,over:!1},this.ticksCallbackMap={},this.handleCallbackMap={},"string"==typeof b?this.element=document.querySelector(b):b instanceof HTMLElement&&(this.element=b),c=c?c:{};for(var e=Object.keys(this.defaultOptions),f=0;f<e.length;f++){var h=e[f],i=c[h];i="undefined"!=typeof i?i:d(this.element,h),i=null!==i?i:this.defaultOptions[h],this.options||(this.options={}),this.options[h]=i}if("auto"===this.options.rtl){var j=window.getComputedStyle(this.element);null!=j?this.options.rtl="rtl"===j.direction:this.options.rtl="rtl"===this.element.style.direction}"vertical"!==this.options.orientation||"top"!==this.options.tooltip_position&&"bottom"!==this.options.tooltip_position?"horizontal"!==this.options.orientation||"left"!==this.options.tooltip_position&&"right"!==this.options.tooltip_position||(this.options.tooltip_position="top"):this.options.rtl?this.options.tooltip_position="left":this.options.tooltip_position="right";var k,l,m,n,o,p=this.element.style.width,q=!1,r=this.element.parentNode;if(this.sliderElem)q=!0;else{this.sliderElem=document.createElement("div"),this.sliderElem.className="slider";var s=document.createElement("div");s.className="slider-track",l=document.createElement("div"),l.className="slider-track-low",k=document.createElement("div"),k.className="slider-selection",m=document.createElement("div"),m.className="slider-track-high",n=document.createElement("div"),n.className="slider-handle min-slider-handle",n.setAttribute("role","slider"),n.setAttribute("aria-valuemin",this.options.min),n.setAttribute("aria-valuemax",this.options.max),o=document.createElement("div"),o.className="slider-handle max-slider-handle",o.setAttribute("role","slider"),o.setAttribute("aria-valuemin",this.options.min),o.setAttribute("aria-valuemax",this.options.max),s.appendChild(l),s.appendChild(k),s.appendChild(m),this.rangeHighlightElements=[];var t=this.options.rangeHighlights;if(Array.isArray(t)&&t.length>0)for(var u=0;u<t.length;u++){var v=document.createElement("div"),w=t[u]["class"]||"";v.className="slider-rangeHighlight slider-selection "+w,this.rangeHighlightElements.push(v),s.appendChild(v)}var x=Array.isArray(this.options.labelledby);if(x&&this.options.labelledby[0]&&n.setAttribute("aria-labelledby",this.options.labelledby[0]),x&&this.options.labelledby[1]&&o.setAttribute("aria-labelledby",this.options.labelledby[1]),!x&&this.options.labelledby&&(n.setAttribute("aria-labelledby",this.options.labelledby),o.setAttribute("aria-labelledby",this.options.labelledby)),this.ticks=[],Array.isArray(this.options.ticks)&&this.options.ticks.length>0){for(this.ticksContainer=document.createElement("div"),this.ticksContainer.className="slider-tick-container",f=0;f<this.options.ticks.length;f++){var y=document.createElement("div");if(y.className="slider-tick",this.options.ticks_tooltip){var z=this._addTickListener(),A=z.addMouseEnter(this,y,f),B=z.addMouseLeave(this,y);this.ticksCallbackMap[f]={mouseEnter:A,mouseLeave:B}}this.ticks.push(y),this.ticksContainer.appendChild(y)}k.className+=" tick-slider-selection"}if(this.tickLabels=[],Array.isArray(this.options.ticks_labels)&&this.options.ticks_labels.length>0)for(this.tickLabelContainer=document.createElement("div"),this.tickLabelContainer.className="slider-tick-label-container",f=0;f<this.options.ticks_labels.length;f++){var C=document.createElement("div"),D=0===this.options.ticks_positions.length,E=this.options.reversed&&D?this.options.ticks_labels.length-(f+1):f;C.className="slider-tick-label",C.innerHTML=this.options.ticks_labels[E],this.tickLabels.push(C),this.tickLabelContainer.appendChild(C)}var F=function(a){var b=document.createElement("div");b.className="tooltip-arrow";var c=document.createElement("div");c.className="tooltip-inner",a.appendChild(b),a.appendChild(c)},G=document.createElement("div");G.className="tooltip tooltip-main",G.setAttribute("role","presentation"),F(G);var H=document.createElement("div");H.className="tooltip tooltip-min",H.setAttribute("role","presentation"),F(H);var I=document.createElement("div");I.className="tooltip tooltip-max",I.setAttribute("role","presentation"),F(I),this.sliderElem.appendChild(s),this.sliderElem.appendChild(G),this.sliderElem.appendChild(H),this.sliderElem.appendChild(I),this.tickLabelContainer&&this.sliderElem.appendChild(this.tickLabelContainer),this.ticksContainer&&this.sliderElem.appendChild(this.ticksContainer),this.sliderElem.appendChild(n),this.sliderElem.appendChild(o),r.insertBefore(this.sliderElem,this.element),this.element.style.display="none"}if(a&&(this.$element=a(this.element),this.$sliderElem=a(this.sliderElem)),this.eventToCallbackMap={},this.sliderElem.id=this.options.id,this.touchCapable="ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch,this.touchX=0,this.touchY=0,this.tooltip=this.sliderElem.querySelector(".tooltip-main"),this.tooltipInner=this.tooltip.querySelector(".tooltip-inner"),this.tooltip_min=this.sliderElem.querySelector(".tooltip-min"),this.tooltipInner_min=this.tooltip_min.querySelector(".tooltip-inner"),this.tooltip_max=this.sliderElem.querySelector(".tooltip-max"),this.tooltipInner_max=this.tooltip_max.querySelector(".tooltip-inner"),g[this.options.scale]&&(this.options.scale=g[this.options.scale]),q===!0&&(this._removeClass(this.sliderElem,"slider-horizontal"),this._removeClass(this.sliderElem,"slider-vertical"),this._removeClass(this.sliderElem,"slider-rtl"),this._removeClass(this.tooltip,"hide"),this._removeClass(this.tooltip_min,"hide"),this._removeClass(this.tooltip_max,"hide"),["left","right","top","width","height"].forEach(function(a){this._removeProperty(this.trackLow,a),this._removeProperty(this.trackSelection,a),this._removeProperty(this.trackHigh,a)},this),[this.handle1,this.handle2].forEach(function(a){this._removeProperty(a,"left"),this._removeProperty(a,"right"),this._removeProperty(a,"top")},this),[this.tooltip,this.tooltip_min,this.tooltip_max].forEach(function(a){this._removeProperty(a,"left"),this._removeProperty(a,"right"),this._removeProperty(a,"top"),this._removeClass(a,"right"),this._removeClass(a,"left"),this._removeClass(a,"top")},this)),"vertical"===this.options.orientation?(this._addClass(this.sliderElem,"slider-vertical"),this.stylePos="top",this.mousePos="pageY",this.sizePos="offsetHeight"):(this._addClass(this.sliderElem,"slider-horizontal"),this.sliderElem.style.width=p,this.options.orientation="horizontal",this.options.rtl?this.stylePos="right":this.stylePos="left",this.mousePos="clientX",this.sizePos="offsetWidth"),this.options.rtl&&this._addClass(this.sliderElem,"slider-rtl"),this._setTooltipPosition(),Array.isArray(this.options.ticks)&&this.options.ticks.length>0&&(this.options.max=Math.max.apply(Math,this.options.ticks),this.options.min=Math.min.apply(Math,this.options.ticks)),Array.isArray(this.options.value)?(this.options.range=!0,this._state.value=this.options.value):this.options.range?this._state.value=[this.options.value,this.options.max]:this._state.value=this.options.value,this.trackLow=l||this.trackLow,this.trackSelection=k||this.trackSelection,this.trackHigh=m||this.trackHigh,"none"===this.options.selection?(this._addClass(this.trackLow,"hide"),this._addClass(this.trackSelection,"hide"),this._addClass(this.trackHigh,"hide")):("after"===this.options.selection||"before"===this.options.selection)&&(this._removeClass(this.trackLow,"hide"),this._removeClass(this.trackSelection,"hide"),this._removeClass(this.trackHigh,"hide")),this.handle1=n||this.handle1,this.handle2=o||this.handle2,q===!0)for(this._removeClass(this.handle1,"round triangle"),this._removeClass(this.handle2,"round triangle hide"),f=0;f<this.ticks.length;f++)this._removeClass(this.ticks[f],"round triangle hide");var J=["round","triangle","custom"],K=-1!==J.indexOf(this.options.handle);if(K)for(this._addClass(this.handle1,this.options.handle),this._addClass(this.handle2,this.options.handle),f=0;f<this.ticks.length;f++)this._addClass(this.ticks[f],this.options.handle);if(this._state.offset=this._offset(this.sliderElem),this._state.size=this.sliderElem[this.sizePos],this.setValue(this._state.value),this.handle1Keydown=this._keydown.bind(this,0),this.handle1.addEventListener("keydown",this.handle1Keydown,!1),this.handle2Keydown=this._keydown.bind(this,1),this.handle2.addEventListener("keydown",this.handle2Keydown,!1),this.mousedown=this._mousedown.bind(this),this.touchstart=this._touchstart.bind(this),this.touchmove=this._touchmove.bind(this),this.touchCapable){var L=!1;try{var M=Object.defineProperty({},"passive",{get:function(){L=!0}});window.addEventListener("test",null,M)}catch(N){}var O=L?{passive:!0}:!1;this.sliderElem.addEventListener("touchstart",this.touchstart,O),this.sliderElem.addEventListener("touchmove",this.touchmove,O)}if(this.sliderElem.addEventListener("mousedown",this.mousedown,!1),this.resize=this._resize.bind(this),window.addEventListener("resize",this.resize,!1),"hide"===this.options.tooltip)this._addClass(this.tooltip,"hide"),this._addClass(this.tooltip_min,"hide"),this._addClass(this.tooltip_max,"hide");else if("always"===this.options.tooltip)this._showTooltip(),this._alwaysShowTooltip=!0;else{if(this.showTooltip=this._showTooltip.bind(this),this.hideTooltip=this._hideTooltip.bind(this),this.options.ticks_tooltip){var P=this._addTickListener(),Q=P.addMouseEnter(this,this.handle1),R=P.addMouseLeave(this,this.handle1);this.handleCallbackMap.handle1={mouseEnter:Q,mouseLeave:R},Q=P.addMouseEnter(this,this.handle2),R=P.addMouseLeave(this,this.handle2),this.handleCallbackMap.handle2={mouseEnter:Q,mouseLeave:R}}else this.sliderElem.addEventListener("mouseenter",this.showTooltip,!1),this.sliderElem.addEventListener("mouseleave",this.hideTooltip,!1);this.handle1.addEventListener("focus",this.showTooltip,!1),this.handle1.addEventListener("blur",this.hideTooltip,!1),this.handle2.addEventListener("focus",this.showTooltip,!1),this.handle2.addEventListener("blur",this.hideTooltip,!1)}this.options.enabled?this.enable():this.disable()}var f={formatInvalidInputErrorMsg:function(a){return"Invalid input value '"+a+"' passed in"},callingContextNotSliderInstance:"Calling context element does not have instance of Slider bound to it. Check your code to make sure the JQuery object returned from the call to the slider() initializer is calling the method"},g={linear:{toValue:function(a){var b=a/100*(this.options.max-this.options.min),c=!0;if(this.options.ticks_positions.length>0){for(var d,e,f,g=0,h=1;h<this.options.ticks_positions.length;h++)if(a<=this.options.ticks_positions[h]){d=this.options.ticks[h-1],f=this.options.ticks_positions[h-1],e=this.options.ticks[h],g=this.options.ticks_positions[h];break}var i=(a-f)/(g-f);b=d+i*(e-d),c=!1}var j=c?this.options.min:0,k=j+Math.round(b/this.options.step)*this.options.step;return k<this.options.min?this.options.min:k>this.options.max?this.options.max:k},toPercentage:function(a){if(this.options.max===this.options.min)return 0;if(this.options.ticks_positions.length>0){for(var b,c,d,e=0,f=0;f<this.options.ticks.length;f++)if(a<=this.options.ticks[f]){b=f>0?this.options.ticks[f-1]:0,d=f>0?this.options.ticks_positions[f-1]:0,c=this.options.ticks[f],e=this.options.ticks_positions[f];break}if(f>0){var g=(a-b)/(c-b);return d+g*(e-d)}}return 100*(a-this.options.min)/(this.options.max-this.options.min)}},logarithmic:{toValue:function(a){var b=1-this.options.min,c=Math.log(this.options.min+b),d=Math.log(this.options.max+b),e=Math.exp(c+(d-c)*a/100)-b;return Math.round(e)===d?d:(e=this.options.min+Math.round((e-this.options.min)/this.options.step)*this.options.step,e<this.options.min?this.options.min:e>this.options.max?this.options.max:e)},toPercentage:function(a){if(this.options.max===this.options.min)return 0;var b=1-this.options.min,c=Math.log(this.options.max+b),d=Math.log(this.options.min+b),e=Math.log(a+b);return 100*(e-d)/(c-d)}}};if(d=function(a,b){return e.call(this,a,b),this},d.prototype={_init:function(){},constructor:d,defaultOptions:{id:"",min:0,max:10,step:1,precision:0,orientation:"horizontal",value:5,range:!1,selection:"before",tooltip:"show",tooltip_split:!1,handle:"round",reversed:!1,rtl:"auto",enabled:!0,formatter:function(a){return Array.isArray(a)?a[0]+" : "+a[1]:a},natural_arrow_keys:!1,ticks:[],ticks_positions:[],ticks_labels:[],ticks_snap_bounds:0,ticks_tooltip:!1,scale:"linear",focus:!1,tooltip_position:null,labelledby:null,rangeHighlights:[]},getElement:function(){return this.sliderElem},getValue:function(){return this.options.range?this._state.value:this._state.value[0]},setValue:function(a,b,c){a||(a=0);var d=this.getValue();this._state.value=this._validateInputValue(a);var e=this._applyPrecision.bind(this);this.options.range?(this._state.value[0]=e(this._state.value[0]),this._state.value[1]=e(this._state.value[1]),this._state.value[0]=Math.max(this.options.min,Math.min(this.options.max,this._state.value[0])),this._state.value[1]=Math.max(this.options.min,Math.min(this.options.max,this._state.value[1]))):(this._state.value=e(this._state.value),this._state.value=[Math.max(this.options.min,Math.min(this.options.max,this._state.value))],this._addClass(this.handle2,"hide"),"after"===this.options.selection?this._state.value[1]=this.options.max:this._state.value[1]=this.options.min),this.options.max>this.options.min?this._state.percentage=[this._toPercentage(this._state.value[0]),this._toPercentage(this._state.value[1]),100*this.options.step/(this.options.max-this.options.min)]:this._state.percentage=[0,0,100],this._layout();var f=this.options.range?this._state.value:this._state.value[0];return this._setDataVal(f),b===!0&&this._trigger("slide",f),d!==f&&c===!0&&this._trigger("change",{oldValue:d,newValue:f}),this},destroy:function(){this._removeSliderEventHandlers(),this.sliderElem.parentNode.removeChild(this.sliderElem),this.element.style.display="",this._cleanUpEventCallbacksMap(),this.element.removeAttribute("data"),a&&(this._unbindJQueryEventHandlers(),this.$element.removeData("slider"))},disable:function(){return this._state.enabled=!1,this.handle1.removeAttribute("tabindex"),this.handle2.removeAttribute("tabindex"),this._addClass(this.sliderElem,"slider-disabled"),this._trigger("slideDisabled"),this},enable:function(){return this._state.enabled=!0,this.handle1.setAttribute("tabindex",0),this.handle2.setAttribute("tabindex",0),this._removeClass(this.sliderElem,"slider-disabled"),this._trigger("slideEnabled"),this},toggle:function(){return this._state.enabled?this.disable():this.enable(),this},isEnabled:function(){return this._state.enabled},on:function(a,b){return this._bindNonQueryEventHandler(a,b),this},off:function(b,c){a?(this.$element.off(b,c),this.$sliderElem.off(b,c)):this._unbindNonQueryEventHandler(b,c)},getAttribute:function(a){return a?this.options[a]:this.options},setAttribute:function(a,b){return this.options[a]=b,this},refresh:function(){return this._removeSliderEventHandlers(),e.call(this,this.element,this.options),a&&a.data(this.element,"slider",this),this},relayout:function(){return this._resize(),this},_removeSliderEventHandlers:function(){if(this.handle1.removeEventListener("keydown",this.handle1Keydown,!1),this.handle2.removeEventListener("keydown",this.handle2Keydown,!1),this.options.ticks_tooltip){for(var a=this.ticksContainer.getElementsByClassName("slider-tick"),b=0;b<a.length;b++)a[b].removeEventListener("mouseenter",this.ticksCallbackMap[b].mouseEnter,!1),a[b].removeEventListener("mouseleave",this.ticksCallbackMap[b].mouseLeave,!1);this.handle1.removeEventListener("mouseenter",this.handleCallbackMap.handle1.mouseEnter,!1),this.handle2.removeEventListener("mouseenter",this.handleCallbackMap.handle2.mouseEnter,!1),this.handle1.removeEventListener("mouseleave",this.handleCallbackMap.handle1.mouseLeave,!1),this.handle2.removeEventListener("mouseleave",this.handleCallbackMap.handle2.mouseLeave,!1)}this.handleCallbackMap=null,this.ticksCallbackMap=null,this.showTooltip&&(this.handle1.removeEventListener("focus",this.showTooltip,!1),this.handle2.removeEventListener("focus",this.showTooltip,!1)),this.hideTooltip&&(this.handle1.removeEventListener("blur",this.hideTooltip,!1),this.handle2.removeEventListener("blur",this.hideTooltip,!1)),this.showTooltip&&this.sliderElem.removeEventListener("mouseenter",this.showTooltip,!1),this.hideTooltip&&this.sliderElem.removeEventListener("mouseleave",this.hideTooltip,!1),this.sliderElem.removeEventListener("touchstart",this.touchstart,!1),this.sliderElem.removeEventListener("touchmove",this.touchmove,!1),this.sliderElem.removeEventListener("mousedown",this.mousedown,!1),window.removeEventListener("resize",this.resize,!1)},_bindNonQueryEventHandler:function(a,b){void 0===this.eventToCallbackMap[a]&&(this.eventToCallbackMap[a]=[]),this.eventToCallbackMap[a].push(b)},_unbindNonQueryEventHandler:function(a,b){var c=this.eventToCallbackMap[a];if(void 0!==c)for(var d=0;d<c.length;d++)if(c[d]===b){c.splice(d,1);break}},_cleanUpEventCallbacksMap:function(){for(var a=Object.keys(this.eventToCallbackMap),b=0;b<a.length;b++){var c=a[b];delete this.eventToCallbackMap[c]}},_showTooltip:function(){this.options.tooltip_split===!1?(this._addClass(this.tooltip,"in"),this.tooltip_min.style.display="none",this.tooltip_max.style.display="none"):(this._addClass(this.tooltip_min,"in"),this._addClass(this.tooltip_max,"in"),this.tooltip.style.display="none"),this._state.over=!0},_hideTooltip:function(){this._state.inDrag===!1&&this.alwaysShowTooltip!==!0&&(this._removeClass(this.tooltip,"in"),this._removeClass(this.tooltip_min,"in"),this._removeClass(this.tooltip_max,"in")),this._state.over=!1},_setToolTipOnMouseOver:function(a){function b(a,b){return b?[100-a.percentage[0],this.options.range?100-a.percentage[1]:a.percentage[1]]:[a.percentage[0],a.percentage[1]]}var c=this.options.formatter(a?a.value[0]:this._state.value[0]),d=a?b(a,this.options.reversed):b(this._state,this.options.reversed);this._setText(this.tooltipInner,c),this.tooltip.style[this.stylePos]=d[0]+"%"},_addTickListener:function(){return{addMouseEnter:function(a,b,c){var d=function(){var b=a._state,d=c>=0?c:this.attributes["aria-valuenow"].value,e=parseInt(d,10);b.value[0]=e,b.percentage[0]=a.options.ticks_positions[e],a._setToolTipOnMouseOver(b),a._showTooltip()};return b.addEventListener("mouseenter",d,!1),d},addMouseLeave:function(a,b){var c=function(){a._hideTooltip()};return b.addEventListener("mouseleave",c,!1),c}}},_layout:function(){var a;if(a=this.options.reversed?[100-this._state.percentage[0],this.options.range?100-this._state.percentage[1]:this._state.percentage[1]]:[this._state.percentage[0],this._state.percentage[1]],this.handle1.style[this.stylePos]=a[0]+"%",this.handle1.setAttribute("aria-valuenow",this._state.value[0]),isNaN(this.options.formatter(this._state.value[0]))&&this.handle1.setAttribute("aria-valuetext",this.options.formatter(this._state.value[0])),this.handle2.style[this.stylePos]=a[1]+"%",this.handle2.setAttribute("aria-valuenow",this._state.value[1]),isNaN(this.options.formatter(this._state.value[1]))&&this.handle2.setAttribute("aria-valuetext",this.options.formatter(this._state.value[1])),this.rangeHighlightElements.length>0&&Array.isArray(this.options.rangeHighlights)&&this.options.rangeHighlights.length>0)for(var b=0;b<this.options.rangeHighlights.length;b++){var c=this._toPercentage(this.options.rangeHighlights[b].start),d=this._toPercentage(this.options.rangeHighlights[b].end);if(this.options.reversed){var e=100-d;d=100-c,c=e}var f=this._createHighlightRange(c,d);f?"vertical"===this.options.orientation?(this.rangeHighlightElements[b].style.top=f.start+"%",this.rangeHighlightElements[b].style.height=f.size+"%"):(this.options.rtl?this.rangeHighlightElements[b].style.right=f.start+"%":this.rangeHighlightElements[b].style.left=f.start+"%",this.rangeHighlightElements[b].style.width=f.size+"%"):this.rangeHighlightElements[b].style.display="none"}if(Array.isArray(this.options.ticks)&&this.options.ticks.length>0){var g,h="vertical"===this.options.orientation?"height":"width";g="vertical"===this.options.orientation?"marginTop":this.options.rtl?"marginRight":"marginLeft";var i=this._state.size/(this.options.ticks.length-1);if(this.tickLabelContainer){var j=0;if(0===this.options.ticks_positions.length)"vertical"!==this.options.orientation&&(this.tickLabelContainer.style[g]=-i/2+"px"),j=this.tickLabelContainer.offsetHeight;else for(k=0;k<this.tickLabelContainer.childNodes.length;k++)this.tickLabelContainer.childNodes[k].offsetHeight>j&&(j=this.tickLabelContainer.childNodes[k].offsetHeight);"horizontal"===this.options.orientation&&(this.sliderElem.style.marginBottom=j+"px")}for(var k=0;k<this.options.ticks.length;k++){var l=this.options.ticks_positions[k]||this._toPercentage(this.options.ticks[k]);this.options.reversed&&(l=100-l),this.ticks[k].style[this.stylePos]=l+"%",this._removeClass(this.ticks[k],"in-selection"),this.options.range?l>=a[0]&&l<=a[1]&&this._addClass(this.ticks[k],"in-selection"):"after"===this.options.selection&&l>=a[0]?this._addClass(this.ticks[k],"in-selection"):"before"===this.options.selection&&l<=a[0]&&this._addClass(this.ticks[k],"in-selection"),this.tickLabels[k]&&(this.tickLabels[k].style[h]=i+"px","vertical"!==this.options.orientation&&void 0!==this.options.ticks_positions[k]?(this.tickLabels[k].style.position="absolute",this.tickLabels[k].style[this.stylePos]=l+"%",this.tickLabels[k].style[g]=-i/2+"px"):"vertical"===this.options.orientation&&(this.options.rtl?this.tickLabels[k].style.marginRight=this.sliderElem.offsetWidth+"px":this.tickLabels[k].style.marginLeft=this.sliderElem.offsetWidth+"px",this.tickLabelContainer.style[g]=this.sliderElem.offsetWidth/2*-1+"px"),this._removeClass(this.tickLabels[k],"label-in-selection label-is-selection"),this.options.range?l>=a[0]&&l<=a[1]&&(this._addClass(this.tickLabels[k],"label-in-selection"),(l===a[0]||a[1])&&this._addClass(this.tickLabels[k],"label-is-selection")):("after"===this.options.selection&&l>=a[0]?this._addClass(this.tickLabels[k],"label-in-selection"):"before"===this.options.selection&&l<=a[0]&&this._addClass(this.tickLabels[k],"label-in-selection"),l===a[0]&&this._addClass(this.tickLabels[k],"label-is-selection")))}}var m;if(this.options.range){m=this.options.formatter(this._state.value),this._setText(this.tooltipInner,m),this.tooltip.style[this.stylePos]=(a[1]+a[0])/2+"%";var n=this.options.formatter(this._state.value[0]);this._setText(this.tooltipInner_min,n);var o=this.options.formatter(this._state.value[1]);this._setText(this.tooltipInner_max,o),this.tooltip_min.style[this.stylePos]=a[0]+"%",this.tooltip_max.style[this.stylePos]=a[1]+"%"}else m=this.options.formatter(this._state.value[0]),this._setText(this.tooltipInner,m),this.tooltip.style[this.stylePos]=a[0]+"%";if("vertical"===this.options.orientation)this.trackLow.style.top="0",this.trackLow.style.height=Math.min(a[0],a[1])+"%",this.trackSelection.style.top=Math.min(a[0],a[1])+"%",this.trackSelection.style.height=Math.abs(a[0]-a[1])+"%",this.trackHigh.style.bottom="0",this.trackHigh.style.height=100-Math.min(a[0],a[1])-Math.abs(a[0]-a[1])+"%";else{"right"===this.stylePos?this.trackLow.style.right="0":this.trackLow.style.left="0",this.trackLow.style.width=Math.min(a[0],a[1])+"%","right"===this.stylePos?this.trackSelection.style.right=Math.min(a[0],a[1])+"%":this.trackSelection.style.left=Math.min(a[0],a[1])+"%",this.trackSelection.style.width=Math.abs(a[0]-a[1])+"%","right"===this.stylePos?this.trackHigh.style.left="0":this.trackHigh.style.right="0",this.trackHigh.style.width=100-Math.min(a[0],a[1])-Math.abs(a[0]-a[1])+"%";var p=this.tooltip_min.getBoundingClientRect(),q=this.tooltip_max.getBoundingClientRect();"bottom"===this.options.tooltip_position?p.right>q.left?(this._removeClass(this.tooltip_max,"bottom"),this._addClass(this.tooltip_max,"top"),this.tooltip_max.style.top="",this.tooltip_max.style.bottom="22px"):(this._removeClass(this.tooltip_max,"top"),this._addClass(this.tooltip_max,"bottom"),this.tooltip_max.style.top=this.tooltip_min.style.top,this.tooltip_max.style.bottom=""):p.right>q.left?(this._removeClass(this.tooltip_max,"top"),this._addClass(this.tooltip_max,"bottom"),this.tooltip_max.style.top="18px"):(this._removeClass(this.tooltip_max,"bottom"),this._addClass(this.tooltip_max,"top"),this.tooltip_max.style.top=this.tooltip_min.style.top)}},_createHighlightRange:function(a,b){return this._isHighlightRange(a,b)?a>b?{start:b,size:a-b}:{start:a,size:b-a}:null},_isHighlightRange:function(a,b){return a>=0&&100>=a&&b>=0&&100>=b?!0:!1},_resize:function(a){this._state.offset=this._offset(this.sliderElem),this._state.size=this.sliderElem[this.sizePos],this._layout()},_removeProperty:function(a,b){a.style.removeProperty?a.style.removeProperty(b):a.style.removeAttribute(b)},_mousedown:function(a){if(!this._state.enabled)return!1;a.preventDefault&&a.preventDefault(),this._state.offset=this._offset(this.sliderElem),this._state.size=this.sliderElem[this.sizePos];var b=this._getPercentage(a);if(this.options.range){var c=Math.abs(this._state.percentage[0]-b),d=Math.abs(this._state.percentage[1]-b);this._state.dragged=d>c?0:1,this._adjustPercentageForRangeSliders(b)}else this._state.dragged=0;this._state.percentage[this._state.dragged]=b,this._layout(),this.touchCapable&&(document.removeEventListener("touchmove",this.mousemove,!1),document.removeEventListener("touchend",this.mouseup,!1)),this.mousemove&&document.removeEventListener("mousemove",this.mousemove,!1),this.mouseup&&document.removeEventListener("mouseup",this.mouseup,!1),this.mousemove=this._mousemove.bind(this),this.mouseup=this._mouseup.bind(this),this.touchCapable&&(document.addEventListener("touchmove",this.mousemove,!1),document.addEventListener("touchend",this.mouseup,!1)),document.addEventListener("mousemove",this.mousemove,!1),document.addEventListener("mouseup",this.mouseup,!1),this._state.inDrag=!0;var e=this._calculateValue();return this._trigger("slideStart",e),this._setDataVal(e),this.setValue(e,!1,!0),a.returnValue=!1,this.options.focus&&this._triggerFocusOnHandle(this._state.dragged),!0},_touchstart:function(a){if(void 0===a.changedTouches)return void this._mousedown(a);var b=a.changedTouches[0];this.touchX=b.pageX,this.touchY=b.pageY},_triggerFocusOnHandle:function(a){0===a&&this.handle1.focus(),1===a&&this.handle2.focus()},_keydown:function(a,b){if(!this._state.enabled)return!1;var c;switch(b.keyCode){case 37:case 40:c=-1;break;case 39:case 38:c=1}if(c){if(this.options.natural_arrow_keys){var d="vertical"===this.options.orientation&&!this.options.reversed,e="horizontal"===this.options.orientation&&this.options.reversed;(d||e)&&(c=-c)}var f=this._state.value[a]+c*this.options.step,g=f/this.options.max*100;if(this._state.keyCtrl=a,this.options.range){this._adjustPercentageForRangeSliders(g);var h=this._state.keyCtrl?this._state.value[0]:f,i=this._state.keyCtrl?f:this._state.value[1];f=[h,i]}return this._trigger("slideStart",f),this._setDataVal(f),this.setValue(f,!0,!0),this._setDataVal(f),this._trigger("slideStop",f),this._layout(),this._pauseEvent(b),delete this._state.keyCtrl,!1}},_pauseEvent:function(a){a.stopPropagation&&a.stopPropagation(),a.preventDefault&&a.preventDefault(),a.cancelBubble=!0,a.returnValue=!1},_mousemove:function(a){if(!this._state.enabled)return!1;var b=this._getPercentage(a);this._adjustPercentageForRangeSliders(b),this._state.percentage[this._state.dragged]=b,this._layout();var c=this._calculateValue(!0);return this.setValue(c,!0,!0),!1},_touchmove:function(a){if(void 0!==a.changedTouches){var b=a.changedTouches[0],c=b.pageX-this.touchX,d=b.pageY-this.touchY;this._state.inDrag||("vertical"===this.options.orientation&&5>=c&&c>=-5&&(d>=15||-15>=d)?this._mousedown(a):5>=d&&d>=-5&&(c>=15||-15>=c)&&this._mousedown(a))}},_adjustPercentageForRangeSliders:function(a){if(this.options.range){var b=this._getNumDigitsAfterDecimalPlace(a);b=b?b-1:0;var c=this._applyToFixedAndParseFloat(a,b);0===this._state.dragged&&this._applyToFixedAndParseFloat(this._state.percentage[1],b)<c?(this._state.percentage[0]=this._state.percentage[1],this._state.dragged=1):1===this._state.dragged&&this._applyToFixedAndParseFloat(this._state.percentage[0],b)>c?(this._state.percentage[1]=this._state.percentage[0],this._state.dragged=0):0===this._state.keyCtrl&&this._state.value[1]/this.options.max*100<a?(this._state.percentage[0]=this._state.percentage[1],this._state.keyCtrl=1,this.handle2.focus()):1===this._state.keyCtrl&&this._state.value[0]/this.options.max*100>a&&(this._state.percentage[1]=this._state.percentage[0],this._state.keyCtrl=0,this.handle1.focus())}},_mouseup:function(){if(!this._state.enabled)return!1;this.touchCapable&&(document.removeEventListener("touchmove",this.mousemove,!1),document.removeEventListener("touchend",this.mouseup,!1)),document.removeEventListener("mousemove",this.mousemove,!1),document.removeEventListener("mouseup",this.mouseup,!1),this._state.inDrag=!1,this._state.over===!1&&this._hideTooltip();var a=this._calculateValue(!0);return this._layout(),this._setDataVal(a),this._trigger("slideStop",a),this._state.dragged=null,!1},_calculateValue:function(a){var b;return this.options.range?(b=[this.options.min,this.options.max],0!==this._state.percentage[0]&&(b[0]=this._toValue(this._state.percentage[0]),b[0]=this._applyPrecision(b[0])),100!==this._state.percentage[1]&&(b[1]=this._toValue(this._state.percentage[1]),b[1]=this._applyPrecision(b[1])),a&&(b[0]=this._snapToClosestTick(b[0]),b[1]=this._snapToClosestTick(b[1]))):(b=this._toValue(this._state.percentage[0]),b=parseFloat(b),b=this._applyPrecision(b),a&&(b=this._snapToClosestTick(b))),b},_snapToClosestTick:function(a){for(var b=[a,1/0],c=0;c<this.options.ticks.length;c++){var d=Math.abs(this.options.ticks[c]-a);d<=b[1]&&(b=[this.options.ticks[c],d])}return b[1]<=this.options.ticks_snap_bounds?b[0]:a},_applyPrecision:function(a){var b=this.options.precision||this._getNumDigitsAfterDecimalPlace(this.options.step);return this._applyToFixedAndParseFloat(a,b)},_getNumDigitsAfterDecimalPlace:function(a){var b=(""+a).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/); return b?Math.max(0,(b[1]?b[1].length:0)-(b[2]?+b[2]:0)):0},_applyToFixedAndParseFloat:function(a,b){var c=a.toFixed(b);return parseFloat(c)},_getPercentage:function(a){!this.touchCapable||"touchstart"!==a.type&&"touchmove"!==a.type||(a=a.touches[0]);var b=a[this.mousePos],c=this._state.offset[this.stylePos],d=b-c;"right"===this.stylePos&&(d=-d);var e=d/this._state.size*100;return e=Math.round(e/this._state.percentage[2])*this._state.percentage[2],this.options.reversed&&(e=100-e),Math.max(0,Math.min(100,e))},_validateInputValue:function(a){if(isNaN(+a)){if(Array.isArray(a))return this._validateArray(a),a;throw new Error(f.formatInvalidInputErrorMsg(a))}return+a},_validateArray:function(a){for(var b=0;b<a.length;b++){var c=a[b];if("number"!=typeof c)throw new Error(f.formatInvalidInputErrorMsg(c))}},_setDataVal:function(a){this.element.setAttribute("data-value",a),this.element.setAttribute("value",a),this.element.value=a},_trigger:function(b,c){c=c||0===c?c:void 0;var d=this.eventToCallbackMap[b];if(d&&d.length)for(var e=0;e<d.length;e++){var f=d[e];f(c)}a&&this._triggerJQueryEvent(b,c)},_triggerJQueryEvent:function(a,b){var c={type:a,value:b};this.$element.trigger(c),this.$sliderElem.trigger(c)},_unbindJQueryEventHandlers:function(){this.$element.off(),this.$sliderElem.off()},_setText:function(a,b){"undefined"!=typeof a.textContent?a.textContent=b:"undefined"!=typeof a.innerText&&(a.innerText=b)},_removeClass:function(a,b){for(var c=b.split(" "),d=a.className,e=0;e<c.length;e++){var f=c[e],g=new RegExp("(?:\\s|^)"+f+"(?:\\s|$)");d=d.replace(g," ")}a.className=d.trim()},_addClass:function(a,b){for(var c=b.split(" "),d=a.className,e=0;e<c.length;e++){var f=c[e],g=new RegExp("(?:\\s|^)"+f+"(?:\\s|$)"),h=g.test(d);h||(d+=" "+f)}a.className=d.trim()},_offsetLeft:function(a){return a.getBoundingClientRect().left},_offsetRight:function(a){return a.getBoundingClientRect().right},_offsetTop:function(a){for(var b=a.offsetTop;(a=a.offsetParent)&&!isNaN(a.offsetTop);)b+=a.offsetTop,"BODY"!==a.tagName&&(b-=a.scrollTop);return b},_offset:function(a){return{left:this._offsetLeft(a),right:this._offsetRight(a),top:this._offsetTop(a)}},_css:function(b,c,d){if(a)a.style(b,c,d);else{var e=c.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,function(a,b){return b.toUpperCase()});b.style[e]=d}},_toValue:function(a){return this.options.scale.toValue.apply(this,[a])},_toPercentage:function(a){return this.options.scale.toPercentage.apply(this,[a])},_setTooltipPosition:function(){var a=[this.tooltip,this.tooltip_min,this.tooltip_max];if("vertical"===this.options.orientation){var b;b=this.options.tooltip_position?this.options.tooltip_position:this.options.rtl?"left":"right";var c="left"===b?"right":"left";a.forEach(function(a){this._addClass(a,b),a.style[c]="100%"}.bind(this))}else"bottom"===this.options.tooltip_position?a.forEach(function(a){this._addClass(a,"bottom"),a.style.top="22px"}.bind(this)):a.forEach(function(a){this._addClass(a,"top"),a.style.top=-this.tooltip.outerHeight-14+"px"}.bind(this))}},a&&a.fn){var h=void 0;a.fn.slider?(windowIsDefined&&window.console.warn("bootstrap-slider.js - WARNING: $.fn.slider namespace is already bound. Use the $.fn.bootstrapSlider namespace instead."),h=c):(a.bridget(b,d),h=b),a.bridget(c,d),a(function(){a("input[data-provide=slider]")[h]()})}}(a),d});dist/bootstrap-slider.js000064400000204555151676726760011404 0ustar00/*! ======================================================= VERSION 10.3.2 ========================================================= */ "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /*! ========================================================= * bootstrap-slider.js * * Maintainers: * Kyle Kemp * - Twitter: @seiyria * - Github: seiyria * Rohit Kalkur * - Twitter: @Rovolutionary * - Github: rovolution * * ========================================================= * * bootstrap-slider is released under the MIT License * Copyright (c) 2017 Kyle Kemp, Rohit Kalkur, and contributors * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * ========================================================= */ /** * Bridget makes jQuery widgets * v1.0.1 * MIT license */ var windowIsDefined = (typeof window === "undefined" ? "undefined" : _typeof(window)) === "object"; (function (factory) { if (typeof define === "function" && define.amd) { define(["jquery"], factory); } else if ((typeof module === "undefined" ? "undefined" : _typeof(module)) === "object" && module.exports) { var jQuery; try { jQuery = require("jquery"); } catch (err) { jQuery = null; } module.exports = factory(jQuery); } else if (window) { window.Slider = factory(window.jQuery); } })(function ($) { // Constants var NAMESPACE_MAIN = 'slider'; var NAMESPACE_ALTERNATE = 'bootstrapSlider'; // Polyfill console methods if (windowIsDefined && !window.console) { window.console = {}; } if (windowIsDefined && !window.console.log) { window.console.log = function () {}; } if (windowIsDefined && !window.console.warn) { window.console.warn = function () {}; } // Reference to Slider constructor var Slider; (function ($) { 'use strict'; // -------------------------- utils -------------------------- // var slice = Array.prototype.slice; function noop() {} // -------------------------- definition -------------------------- // function defineBridget($) { // bail if no jQuery if (!$) { return; } // -------------------------- addOptionMethod -------------------------- // /** * adds option method -> $().plugin('option', {...}) * @param {Function} PluginClass - constructor class */ function addOptionMethod(PluginClass) { // don't overwrite original option method if (PluginClass.prototype.option) { return; } // option setter PluginClass.prototype.option = function (opts) { // bail out if not an object if (!$.isPlainObject(opts)) { return; } this.options = $.extend(true, this.options, opts); }; } // -------------------------- plugin bridge -------------------------- // // helper function for logging errors // $.error breaks jQuery chaining var logError = typeof console === 'undefined' ? noop : function (message) { console.error(message); }; /** * jQuery plugin bridge, access methods like $elem.plugin('method') * @param {String} namespace - plugin name * @param {Function} PluginClass - constructor class */ function bridge(namespace, PluginClass) { // add to jQuery fn namespace $.fn[namespace] = function (options) { if (typeof options === 'string') { // call plugin method when first argument is a string // get arguments for method var args = slice.call(arguments, 1); for (var i = 0, len = this.length; i < len; i++) { var elem = this[i]; var instance = $.data(elem, namespace); if (!instance) { logError("cannot call methods on " + namespace + " prior to initialization; " + "attempted to call '" + options + "'"); continue; } if (!$.isFunction(instance[options]) || options.charAt(0) === '_') { logError("no such method '" + options + "' for " + namespace + " instance"); continue; } // trigger method with arguments var returnValue = instance[options].apply(instance, args); // break look and return first value if provided if (returnValue !== undefined && returnValue !== instance) { return returnValue; } } // return this if no return value return this; } else { var objects = this.map(function () { var instance = $.data(this, namespace); if (instance) { // apply options & init instance.option(options); instance._init(); } else { // initialize new instance instance = new PluginClass(this, options); $.data(this, namespace, instance); } return $(this); }); if (!objects || objects.length > 1) { return objects; } else { return objects[0]; } } }; } // -------------------------- bridget -------------------------- // /** * converts a Prototypical class into a proper jQuery plugin * the class must have a ._init method * @param {String} namespace - plugin name, used in $().pluginName * @param {Function} PluginClass - constructor class */ $.bridget = function (namespace, PluginClass) { addOptionMethod(PluginClass); bridge(namespace, PluginClass); }; return $.bridget; } // get jquery from browser global defineBridget($); })($); /************************************************* BOOTSTRAP-SLIDER SOURCE CODE **************************************************/ (function ($) { var ErrorMsgs = { formatInvalidInputErrorMsg: function formatInvalidInputErrorMsg(input) { return "Invalid input value '" + input + "' passed in"; }, callingContextNotSliderInstance: "Calling context element does not have instance of Slider bound to it. Check your code to make sure the JQuery object returned from the call to the slider() initializer is calling the method" }; var SliderScale = { linear: { toValue: function toValue(percentage) { var rawValue = percentage / 100 * (this.options.max - this.options.min); var shouldAdjustWithBase = true; if (this.options.ticks_positions.length > 0) { var minv, maxv, minp, maxp = 0; for (var i = 1; i < this.options.ticks_positions.length; i++) { if (percentage <= this.options.ticks_positions[i]) { minv = this.options.ticks[i - 1]; minp = this.options.ticks_positions[i - 1]; maxv = this.options.ticks[i]; maxp = this.options.ticks_positions[i]; break; } } var partialPercentage = (percentage - minp) / (maxp - minp); rawValue = minv + partialPercentage * (maxv - minv); shouldAdjustWithBase = false; } var adjustment = shouldAdjustWithBase ? this.options.min : 0; var value = adjustment + Math.round(rawValue / this.options.step) * this.options.step; if (value < this.options.min) { return this.options.min; } else if (value > this.options.max) { return this.options.max; } else { return value; } }, toPercentage: function toPercentage(value) { if (this.options.max === this.options.min) { return 0; } if (this.options.ticks_positions.length > 0) { var minv, maxv, minp, maxp = 0; for (var i = 0; i < this.options.ticks.length; i++) { if (value <= this.options.ticks[i]) { minv = i > 0 ? this.options.ticks[i - 1] : 0; minp = i > 0 ? this.options.ticks_positions[i - 1] : 0; maxv = this.options.ticks[i]; maxp = this.options.ticks_positions[i]; break; } } if (i > 0) { var partialPercentage = (value - minv) / (maxv - minv); return minp + partialPercentage * (maxp - minp); } } return 100 * (value - this.options.min) / (this.options.max - this.options.min); } }, logarithmic: { /* Based on http://stackoverflow.com/questions/846221/logarithmic-slider */ toValue: function toValue(percentage) { var offset = 1 - this.options.min; var min = Math.log(this.options.min + offset); var max = Math.log(this.options.max + offset); var value = Math.exp(min + (max - min) * percentage / 100) - offset; if (Math.round(value) === max) { return max; } value = this.options.min + Math.round((value - this.options.min) / this.options.step) * this.options.step; /* Rounding to the nearest step could exceed the min or * max, so clip to those values. */ if (value < this.options.min) { return this.options.min; } else if (value > this.options.max) { return this.options.max; } else { return value; } }, toPercentage: function toPercentage(value) { if (this.options.max === this.options.min) { return 0; } else { var offset = 1 - this.options.min; var max = Math.log(this.options.max + offset); var min = Math.log(this.options.min + offset); var v = Math.log(value + offset); return 100 * (v - min) / (max - min); } } } }; /************************************************* CONSTRUCTOR **************************************************/ Slider = function Slider(element, options) { createNewSlider.call(this, element, options); return this; }; function createNewSlider(element, options) { /* The internal state object is used to store data about the current 'state' of slider. This includes values such as the `value`, `enabled`, etc... */ this._state = { value: null, enabled: null, offset: null, size: null, percentage: null, inDrag: false, over: false }; // The objects used to store the reference to the tick methods if ticks_tooltip is on this.ticksCallbackMap = {}; this.handleCallbackMap = {}; if (typeof element === "string") { this.element = document.querySelector(element); } else if (element instanceof HTMLElement) { this.element = element; } /************************************************* Process Options **************************************************/ options = options ? options : {}; var optionTypes = Object.keys(this.defaultOptions); for (var i = 0; i < optionTypes.length; i++) { var optName = optionTypes[i]; // First check if an option was passed in via the constructor var val = options[optName]; // If no data attrib, then check data atrributes val = typeof val !== 'undefined' ? val : getDataAttrib(this.element, optName); // Finally, if nothing was specified, use the defaults val = val !== null ? val : this.defaultOptions[optName]; // Set all options on the instance of the Slider if (!this.options) { this.options = {}; } this.options[optName] = val; } // Check options.rtl if (this.options.rtl === 'auto') { var computedStyle = window.getComputedStyle(this.element); if (computedStyle != null) { this.options.rtl = computedStyle.direction === 'rtl'; } else { // Fix for Firefox bug in versions less than 62: // https://bugzilla.mozilla.org/show_bug.cgi?id=548397 // https://bugzilla.mozilla.org/show_bug.cgi?id=1467722 this.options.rtl = this.element.style.direction === 'rtl'; } } /* Validate `tooltip_position` against 'orientation` - if `tooltip_position` is incompatible with orientation, swith it to a default compatible with specified `orientation` -- default for "vertical" -> "right", "left" if rtl -- default for "horizontal" -> "top" */ if (this.options.orientation === "vertical" && (this.options.tooltip_position === "top" || this.options.tooltip_position === "bottom")) { if (this.options.rtl) { this.options.tooltip_position = "left"; } else { this.options.tooltip_position = "right"; } } else if (this.options.orientation === "horizontal" && (this.options.tooltip_position === "left" || this.options.tooltip_position === "right")) { this.options.tooltip_position = "top"; } function getDataAttrib(element, optName) { var dataName = "data-slider-" + optName.replace(/_/g, '-'); var dataValString = element.getAttribute(dataName); try { return JSON.parse(dataValString); } catch (err) { return dataValString; } } /************************************************* Create Markup **************************************************/ var origWidth = this.element.style.width; var updateSlider = false; var parent = this.element.parentNode; var sliderTrackSelection; var sliderTrackLow, sliderTrackHigh; var sliderMinHandle; var sliderMaxHandle; if (this.sliderElem) { updateSlider = true; } else { /* Create elements needed for slider */ this.sliderElem = document.createElement("div"); this.sliderElem.className = "slider"; /* Create slider track elements */ var sliderTrack = document.createElement("div"); sliderTrack.className = "slider-track"; sliderTrackLow = document.createElement("div"); sliderTrackLow.className = "slider-track-low"; sliderTrackSelection = document.createElement("div"); sliderTrackSelection.className = "slider-selection"; sliderTrackHigh = document.createElement("div"); sliderTrackHigh.className = "slider-track-high"; sliderMinHandle = document.createElement("div"); sliderMinHandle.className = "slider-handle min-slider-handle"; sliderMinHandle.setAttribute('role', 'slider'); sliderMinHandle.setAttribute('aria-valuemin', this.options.min); sliderMinHandle.setAttribute('aria-valuemax', this.options.max); sliderMaxHandle = document.createElement("div"); sliderMaxHandle.className = "slider-handle max-slider-handle"; sliderMaxHandle.setAttribute('role', 'slider'); sliderMaxHandle.setAttribute('aria-valuemin', this.options.min); sliderMaxHandle.setAttribute('aria-valuemax', this.options.max); sliderTrack.appendChild(sliderTrackLow); sliderTrack.appendChild(sliderTrackSelection); sliderTrack.appendChild(sliderTrackHigh); /* Create highlight range elements */ this.rangeHighlightElements = []; var rangeHighlightsOpts = this.options.rangeHighlights; if (Array.isArray(rangeHighlightsOpts) && rangeHighlightsOpts.length > 0) { for (var j = 0; j < rangeHighlightsOpts.length; j++) { var rangeHighlightElement = document.createElement("div"); var customClassString = rangeHighlightsOpts[j].class || ""; rangeHighlightElement.className = "slider-rangeHighlight slider-selection " + customClassString; this.rangeHighlightElements.push(rangeHighlightElement); sliderTrack.appendChild(rangeHighlightElement); } } /* Add aria-labelledby to handle's */ var isLabelledbyArray = Array.isArray(this.options.labelledby); if (isLabelledbyArray && this.options.labelledby[0]) { sliderMinHandle.setAttribute('aria-labelledby', this.options.labelledby[0]); } if (isLabelledbyArray && this.options.labelledby[1]) { sliderMaxHandle.setAttribute('aria-labelledby', this.options.labelledby[1]); } if (!isLabelledbyArray && this.options.labelledby) { sliderMinHandle.setAttribute('aria-labelledby', this.options.labelledby); sliderMaxHandle.setAttribute('aria-labelledby', this.options.labelledby); } /* Create ticks */ this.ticks = []; if (Array.isArray(this.options.ticks) && this.options.ticks.length > 0) { this.ticksContainer = document.createElement('div'); this.ticksContainer.className = 'slider-tick-container'; for (i = 0; i < this.options.ticks.length; i++) { var tick = document.createElement('div'); tick.className = 'slider-tick'; if (this.options.ticks_tooltip) { var tickListenerReference = this._addTickListener(); var enterCallback = tickListenerReference.addMouseEnter(this, tick, i); var leaveCallback = tickListenerReference.addMouseLeave(this, tick); this.ticksCallbackMap[i] = { mouseEnter: enterCallback, mouseLeave: leaveCallback }; } this.ticks.push(tick); this.ticksContainer.appendChild(tick); } sliderTrackSelection.className += " tick-slider-selection"; } this.tickLabels = []; if (Array.isArray(this.options.ticks_labels) && this.options.ticks_labels.length > 0) { this.tickLabelContainer = document.createElement('div'); this.tickLabelContainer.className = 'slider-tick-label-container'; for (i = 0; i < this.options.ticks_labels.length; i++) { var label = document.createElement('div'); var noTickPositionsSpecified = this.options.ticks_positions.length === 0; var tickLabelsIndex = this.options.reversed && noTickPositionsSpecified ? this.options.ticks_labels.length - (i + 1) : i; label.className = 'slider-tick-label'; label.innerHTML = this.options.ticks_labels[tickLabelsIndex]; this.tickLabels.push(label); this.tickLabelContainer.appendChild(label); } } var createAndAppendTooltipSubElements = function createAndAppendTooltipSubElements(tooltipElem) { var arrow = document.createElement("div"); arrow.className = "tooltip-arrow"; var inner = document.createElement("div"); inner.className = "tooltip-inner"; tooltipElem.appendChild(arrow); tooltipElem.appendChild(inner); }; /* Create tooltip elements */ var sliderTooltip = document.createElement("div"); sliderTooltip.className = "tooltip tooltip-main"; sliderTooltip.setAttribute('role', 'presentation'); createAndAppendTooltipSubElements(sliderTooltip); var sliderTooltipMin = document.createElement("div"); sliderTooltipMin.className = "tooltip tooltip-min"; sliderTooltipMin.setAttribute('role', 'presentation'); createAndAppendTooltipSubElements(sliderTooltipMin); var sliderTooltipMax = document.createElement("div"); sliderTooltipMax.className = "tooltip tooltip-max"; sliderTooltipMax.setAttribute('role', 'presentation'); createAndAppendTooltipSubElements(sliderTooltipMax); /* Append components to sliderElem */ this.sliderElem.appendChild(sliderTrack); this.sliderElem.appendChild(sliderTooltip); this.sliderElem.appendChild(sliderTooltipMin); this.sliderElem.appendChild(sliderTooltipMax); if (this.tickLabelContainer) { this.sliderElem.appendChild(this.tickLabelContainer); } if (this.ticksContainer) { this.sliderElem.appendChild(this.ticksContainer); } this.sliderElem.appendChild(sliderMinHandle); this.sliderElem.appendChild(sliderMaxHandle); /* Append slider element to parent container, right before the original <input> element */ parent.insertBefore(this.sliderElem, this.element); /* Hide original <input> element */ this.element.style.display = "none"; } /* If JQuery exists, cache JQ references */ if ($) { this.$element = $(this.element); this.$sliderElem = $(this.sliderElem); } /************************************************* Setup **************************************************/ this.eventToCallbackMap = {}; this.sliderElem.id = this.options.id; this.touchCapable = 'ontouchstart' in window || window.DocumentTouch && document instanceof window.DocumentTouch; this.touchX = 0; this.touchY = 0; this.tooltip = this.sliderElem.querySelector('.tooltip-main'); this.tooltipInner = this.tooltip.querySelector('.tooltip-inner'); this.tooltip_min = this.sliderElem.querySelector('.tooltip-min'); this.tooltipInner_min = this.tooltip_min.querySelector('.tooltip-inner'); this.tooltip_max = this.sliderElem.querySelector('.tooltip-max'); this.tooltipInner_max = this.tooltip_max.querySelector('.tooltip-inner'); if (SliderScale[this.options.scale]) { this.options.scale = SliderScale[this.options.scale]; } if (updateSlider === true) { // Reset classes this._removeClass(this.sliderElem, 'slider-horizontal'); this._removeClass(this.sliderElem, 'slider-vertical'); this._removeClass(this.sliderElem, 'slider-rtl'); this._removeClass(this.tooltip, 'hide'); this._removeClass(this.tooltip_min, 'hide'); this._removeClass(this.tooltip_max, 'hide'); // Undo existing inline styles for track ["left", "right", "top", "width", "height"].forEach(function (prop) { this._removeProperty(this.trackLow, prop); this._removeProperty(this.trackSelection, prop); this._removeProperty(this.trackHigh, prop); }, this); // Undo inline styles on handles [this.handle1, this.handle2].forEach(function (handle) { this._removeProperty(handle, 'left'); this._removeProperty(handle, 'right'); this._removeProperty(handle, 'top'); }, this); // Undo inline styles and classes on tooltips [this.tooltip, this.tooltip_min, this.tooltip_max].forEach(function (tooltip) { this._removeProperty(tooltip, 'left'); this._removeProperty(tooltip, 'right'); this._removeProperty(tooltip, 'top'); this._removeClass(tooltip, 'right'); this._removeClass(tooltip, 'left'); this._removeClass(tooltip, 'top'); }, this); } if (this.options.orientation === 'vertical') { this._addClass(this.sliderElem, 'slider-vertical'); this.stylePos = 'top'; this.mousePos = 'pageY'; this.sizePos = 'offsetHeight'; } else { this._addClass(this.sliderElem, 'slider-horizontal'); this.sliderElem.style.width = origWidth; this.options.orientation = 'horizontal'; if (this.options.rtl) { this.stylePos = 'right'; } else { this.stylePos = 'left'; } this.mousePos = 'clientX'; this.sizePos = 'offsetWidth'; } // specific rtl class if (this.options.rtl) { this._addClass(this.sliderElem, 'slider-rtl'); } this._setTooltipPosition(); /* In case ticks are specified, overwrite the min and max bounds */ if (Array.isArray(this.options.ticks) && this.options.ticks.length > 0) { this.options.max = Math.max.apply(Math, this.options.ticks); this.options.min = Math.min.apply(Math, this.options.ticks); } if (Array.isArray(this.options.value)) { this.options.range = true; this._state.value = this.options.value; } else if (this.options.range) { // User wants a range, but value is not an array this._state.value = [this.options.value, this.options.max]; } else { this._state.value = this.options.value; } this.trackLow = sliderTrackLow || this.trackLow; this.trackSelection = sliderTrackSelection || this.trackSelection; this.trackHigh = sliderTrackHigh || this.trackHigh; if (this.options.selection === 'none') { this._addClass(this.trackLow, 'hide'); this._addClass(this.trackSelection, 'hide'); this._addClass(this.trackHigh, 'hide'); } else if (this.options.selection === 'after' || this.options.selection === 'before') { this._removeClass(this.trackLow, 'hide'); this._removeClass(this.trackSelection, 'hide'); this._removeClass(this.trackHigh, 'hide'); } this.handle1 = sliderMinHandle || this.handle1; this.handle2 = sliderMaxHandle || this.handle2; if (updateSlider === true) { // Reset classes this._removeClass(this.handle1, 'round triangle'); this._removeClass(this.handle2, 'round triangle hide'); for (i = 0; i < this.ticks.length; i++) { this._removeClass(this.ticks[i], 'round triangle hide'); } } var availableHandleModifiers = ['round', 'triangle', 'custom']; var isValidHandleType = availableHandleModifiers.indexOf(this.options.handle) !== -1; if (isValidHandleType) { this._addClass(this.handle1, this.options.handle); this._addClass(this.handle2, this.options.handle); for (i = 0; i < this.ticks.length; i++) { this._addClass(this.ticks[i], this.options.handle); } } this._state.offset = this._offset(this.sliderElem); this._state.size = this.sliderElem[this.sizePos]; this.setValue(this._state.value); /****************************************** Bind Event Listeners ******************************************/ // Bind keyboard handlers this.handle1Keydown = this._keydown.bind(this, 0); this.handle1.addEventListener("keydown", this.handle1Keydown, false); this.handle2Keydown = this._keydown.bind(this, 1); this.handle2.addEventListener("keydown", this.handle2Keydown, false); this.mousedown = this._mousedown.bind(this); this.touchstart = this._touchstart.bind(this); this.touchmove = this._touchmove.bind(this); if (this.touchCapable) { // Test for passive event support var supportsPassive = false; try { var opts = Object.defineProperty({}, 'passive', { get: function get() { supportsPassive = true; } }); window.addEventListener("test", null, opts); } catch (e) {} // Use our detect's results. passive applied if supported, capture will be false either way. var eventOptions = supportsPassive ? { passive: true } : false; // Bind touch handlers this.sliderElem.addEventListener("touchstart", this.touchstart, eventOptions); this.sliderElem.addEventListener("touchmove", this.touchmove, eventOptions); } this.sliderElem.addEventListener("mousedown", this.mousedown, false); // Bind window handlers this.resize = this._resize.bind(this); window.addEventListener("resize", this.resize, false); // Bind tooltip-related handlers if (this.options.tooltip === 'hide') { this._addClass(this.tooltip, 'hide'); this._addClass(this.tooltip_min, 'hide'); this._addClass(this.tooltip_max, 'hide'); } else if (this.options.tooltip === 'always') { this._showTooltip(); this._alwaysShowTooltip = true; } else { this.showTooltip = this._showTooltip.bind(this); this.hideTooltip = this._hideTooltip.bind(this); if (this.options.ticks_tooltip) { var callbackHandle = this._addTickListener(); //create handle1 listeners and store references in map var mouseEnter = callbackHandle.addMouseEnter(this, this.handle1); var mouseLeave = callbackHandle.addMouseLeave(this, this.handle1); this.handleCallbackMap.handle1 = { mouseEnter: mouseEnter, mouseLeave: mouseLeave }; //create handle2 listeners and store references in map mouseEnter = callbackHandle.addMouseEnter(this, this.handle2); mouseLeave = callbackHandle.addMouseLeave(this, this.handle2); this.handleCallbackMap.handle2 = { mouseEnter: mouseEnter, mouseLeave: mouseLeave }; } else { this.sliderElem.addEventListener("mouseenter", this.showTooltip, false); this.sliderElem.addEventListener("mouseleave", this.hideTooltip, false); } this.handle1.addEventListener("focus", this.showTooltip, false); this.handle1.addEventListener("blur", this.hideTooltip, false); this.handle2.addEventListener("focus", this.showTooltip, false); this.handle2.addEventListener("blur", this.hideTooltip, false); } if (this.options.enabled) { this.enable(); } else { this.disable(); } } /************************************************* INSTANCE PROPERTIES/METHODS - Any methods bound to the prototype are considered part of the plugin's `public` interface **************************************************/ Slider.prototype = { _init: function _init() {}, // NOTE: Must exist to support bridget constructor: Slider, defaultOptions: { id: "", min: 0, max: 10, step: 1, precision: 0, orientation: 'horizontal', value: 5, range: false, selection: 'before', tooltip: 'show', tooltip_split: false, handle: 'round', reversed: false, rtl: 'auto', enabled: true, formatter: function formatter(val) { if (Array.isArray(val)) { return val[0] + " : " + val[1]; } else { return val; } }, natural_arrow_keys: false, ticks: [], ticks_positions: [], ticks_labels: [], ticks_snap_bounds: 0, ticks_tooltip: false, scale: 'linear', focus: false, tooltip_position: null, labelledby: null, rangeHighlights: [] }, getElement: function getElement() { return this.sliderElem; }, getValue: function getValue() { if (this.options.range) { return this._state.value; } else { return this._state.value[0]; } }, setValue: function setValue(val, triggerSlideEvent, triggerChangeEvent) { if (!val) { val = 0; } var oldValue = this.getValue(); this._state.value = this._validateInputValue(val); var applyPrecision = this._applyPrecision.bind(this); if (this.options.range) { this._state.value[0] = applyPrecision(this._state.value[0]); this._state.value[1] = applyPrecision(this._state.value[1]); this._state.value[0] = Math.max(this.options.min, Math.min(this.options.max, this._state.value[0])); this._state.value[1] = Math.max(this.options.min, Math.min(this.options.max, this._state.value[1])); } else { this._state.value = applyPrecision(this._state.value); this._state.value = [Math.max(this.options.min, Math.min(this.options.max, this._state.value))]; this._addClass(this.handle2, 'hide'); if (this.options.selection === 'after') { this._state.value[1] = this.options.max; } else { this._state.value[1] = this.options.min; } } if (this.options.max > this.options.min) { this._state.percentage = [this._toPercentage(this._state.value[0]), this._toPercentage(this._state.value[1]), this.options.step * 100 / (this.options.max - this.options.min)]; } else { this._state.percentage = [0, 0, 100]; } this._layout(); var newValue = this.options.range ? this._state.value : this._state.value[0]; this._setDataVal(newValue); if (triggerSlideEvent === true) { this._trigger('slide', newValue); } if (oldValue !== newValue && triggerChangeEvent === true) { this._trigger('change', { oldValue: oldValue, newValue: newValue }); } return this; }, destroy: function destroy() { // Remove event handlers on slider elements this._removeSliderEventHandlers(); // Remove the slider from the DOM this.sliderElem.parentNode.removeChild(this.sliderElem); /* Show original <input> element */ this.element.style.display = ""; // Clear out custom event bindings this._cleanUpEventCallbacksMap(); // Remove data values this.element.removeAttribute("data"); // Remove JQuery handlers/data if ($) { this._unbindJQueryEventHandlers(); this.$element.removeData('slider'); } }, disable: function disable() { this._state.enabled = false; this.handle1.removeAttribute("tabindex"); this.handle2.removeAttribute("tabindex"); this._addClass(this.sliderElem, 'slider-disabled'); this._trigger('slideDisabled'); return this; }, enable: function enable() { this._state.enabled = true; this.handle1.setAttribute("tabindex", 0); this.handle2.setAttribute("tabindex", 0); this._removeClass(this.sliderElem, 'slider-disabled'); this._trigger('slideEnabled'); return this; }, toggle: function toggle() { if (this._state.enabled) { this.disable(); } else { this.enable(); } return this; }, isEnabled: function isEnabled() { return this._state.enabled; }, on: function on(evt, callback) { this._bindNonQueryEventHandler(evt, callback); return this; }, off: function off(evt, callback) { if ($) { this.$element.off(evt, callback); this.$sliderElem.off(evt, callback); } else { this._unbindNonQueryEventHandler(evt, callback); } }, getAttribute: function getAttribute(attribute) { if (attribute) { return this.options[attribute]; } else { return this.options; } }, setAttribute: function setAttribute(attribute, value) { this.options[attribute] = value; return this; }, refresh: function refresh() { this._removeSliderEventHandlers(); createNewSlider.call(this, this.element, this.options); if ($) { // Bind new instance of slider to the element $.data(this.element, 'slider', this); } return this; }, relayout: function relayout() { this._resize(); return this; }, /******************************+ HELPERS - Any method that is not part of the public interface. - Place it underneath this comment block and write its signature like so: _fnName : function() {...} ********************************/ _removeSliderEventHandlers: function _removeSliderEventHandlers() { // Remove keydown event listeners this.handle1.removeEventListener("keydown", this.handle1Keydown, false); this.handle2.removeEventListener("keydown", this.handle2Keydown, false); //remove the listeners from the ticks and handles if they had their own listeners if (this.options.ticks_tooltip) { var ticks = this.ticksContainer.getElementsByClassName('slider-tick'); for (var i = 0; i < ticks.length; i++) { ticks[i].removeEventListener('mouseenter', this.ticksCallbackMap[i].mouseEnter, false); ticks[i].removeEventListener('mouseleave', this.ticksCallbackMap[i].mouseLeave, false); } this.handle1.removeEventListener('mouseenter', this.handleCallbackMap.handle1.mouseEnter, false); this.handle2.removeEventListener('mouseenter', this.handleCallbackMap.handle2.mouseEnter, false); this.handle1.removeEventListener('mouseleave', this.handleCallbackMap.handle1.mouseLeave, false); this.handle2.removeEventListener('mouseleave', this.handleCallbackMap.handle2.mouseLeave, false); } this.handleCallbackMap = null; this.ticksCallbackMap = null; if (this.showTooltip) { this.handle1.removeEventListener("focus", this.showTooltip, false); this.handle2.removeEventListener("focus", this.showTooltip, false); } if (this.hideTooltip) { this.handle1.removeEventListener("blur", this.hideTooltip, false); this.handle2.removeEventListener("blur", this.hideTooltip, false); } // Remove event listeners from sliderElem if (this.showTooltip) { this.sliderElem.removeEventListener("mouseenter", this.showTooltip, false); } if (this.hideTooltip) { this.sliderElem.removeEventListener("mouseleave", this.hideTooltip, false); } this.sliderElem.removeEventListener("touchstart", this.touchstart, false); this.sliderElem.removeEventListener("touchmove", this.touchmove, false); this.sliderElem.removeEventListener("mousedown", this.mousedown, false); // Remove window event listener window.removeEventListener("resize", this.resize, false); }, _bindNonQueryEventHandler: function _bindNonQueryEventHandler(evt, callback) { if (this.eventToCallbackMap[evt] === undefined) { this.eventToCallbackMap[evt] = []; } this.eventToCallbackMap[evt].push(callback); }, _unbindNonQueryEventHandler: function _unbindNonQueryEventHandler(evt, callback) { var callbacks = this.eventToCallbackMap[evt]; if (callbacks !== undefined) { for (var i = 0; i < callbacks.length; i++) { if (callbacks[i] === callback) { callbacks.splice(i, 1); break; } } } }, _cleanUpEventCallbacksMap: function _cleanUpEventCallbacksMap() { var eventNames = Object.keys(this.eventToCallbackMap); for (var i = 0; i < eventNames.length; i++) { var eventName = eventNames[i]; delete this.eventToCallbackMap[eventName]; } }, _showTooltip: function _showTooltip() { if (this.options.tooltip_split === false) { this._addClass(this.tooltip, 'in'); this.tooltip_min.style.display = 'none'; this.tooltip_max.style.display = 'none'; } else { this._addClass(this.tooltip_min, 'in'); this._addClass(this.tooltip_max, 'in'); this.tooltip.style.display = 'none'; } this._state.over = true; }, _hideTooltip: function _hideTooltip() { if (this._state.inDrag === false && this.alwaysShowTooltip !== true) { this._removeClass(this.tooltip, 'in'); this._removeClass(this.tooltip_min, 'in'); this._removeClass(this.tooltip_max, 'in'); } this._state.over = false; }, _setToolTipOnMouseOver: function _setToolTipOnMouseOver(tempState) { var formattedTooltipVal = this.options.formatter(!tempState ? this._state.value[0] : tempState.value[0]); var positionPercentages = !tempState ? getPositionPercentages(this._state, this.options.reversed) : getPositionPercentages(tempState, this.options.reversed); this._setText(this.tooltipInner, formattedTooltipVal); this.tooltip.style[this.stylePos] = positionPercentages[0] + "%"; function getPositionPercentages(state, reversed) { if (reversed) { return [100 - state.percentage[0], this.options.range ? 100 - state.percentage[1] : state.percentage[1]]; } return [state.percentage[0], state.percentage[1]]; } }, _addTickListener: function _addTickListener() { return { addMouseEnter: function addMouseEnter(reference, tick, index) { var enter = function enter() { var tempState = reference._state; var idString = index >= 0 ? index : this.attributes['aria-valuenow'].value; var hoverIndex = parseInt(idString, 10); tempState.value[0] = hoverIndex; tempState.percentage[0] = reference.options.ticks_positions[hoverIndex]; reference._setToolTipOnMouseOver(tempState); reference._showTooltip(); }; tick.addEventListener("mouseenter", enter, false); return enter; }, addMouseLeave: function addMouseLeave(reference, tick) { var leave = function leave() { reference._hideTooltip(); }; tick.addEventListener("mouseleave", leave, false); return leave; } }; }, _layout: function _layout() { var positionPercentages; if (this.options.reversed) { positionPercentages = [100 - this._state.percentage[0], this.options.range ? 100 - this._state.percentage[1] : this._state.percentage[1]]; } else { positionPercentages = [this._state.percentage[0], this._state.percentage[1]]; } this.handle1.style[this.stylePos] = positionPercentages[0] + "%"; this.handle1.setAttribute('aria-valuenow', this._state.value[0]); if (isNaN(this.options.formatter(this._state.value[0]))) { this.handle1.setAttribute('aria-valuetext', this.options.formatter(this._state.value[0])); } this.handle2.style[this.stylePos] = positionPercentages[1] + "%"; this.handle2.setAttribute('aria-valuenow', this._state.value[1]); if (isNaN(this.options.formatter(this._state.value[1]))) { this.handle2.setAttribute('aria-valuetext', this.options.formatter(this._state.value[1])); } /* Position highlight range elements */ if (this.rangeHighlightElements.length > 0 && Array.isArray(this.options.rangeHighlights) && this.options.rangeHighlights.length > 0) { for (var _i = 0; _i < this.options.rangeHighlights.length; _i++) { var startPercent = this._toPercentage(this.options.rangeHighlights[_i].start); var endPercent = this._toPercentage(this.options.rangeHighlights[_i].end); if (this.options.reversed) { var sp = 100 - endPercent; endPercent = 100 - startPercent; startPercent = sp; } var currentRange = this._createHighlightRange(startPercent, endPercent); if (currentRange) { if (this.options.orientation === 'vertical') { this.rangeHighlightElements[_i].style.top = currentRange.start + "%"; this.rangeHighlightElements[_i].style.height = currentRange.size + "%"; } else { if (this.options.rtl) { this.rangeHighlightElements[_i].style.right = currentRange.start + "%"; } else { this.rangeHighlightElements[_i].style.left = currentRange.start + "%"; } this.rangeHighlightElements[_i].style.width = currentRange.size + "%"; } } else { this.rangeHighlightElements[_i].style.display = "none"; } } } /* Position ticks and labels */ if (Array.isArray(this.options.ticks) && this.options.ticks.length > 0) { var styleSize = this.options.orientation === 'vertical' ? 'height' : 'width'; var styleMargin; if (this.options.orientation === 'vertical') { styleMargin = 'marginTop'; } else { if (this.options.rtl) { styleMargin = 'marginRight'; } else { styleMargin = 'marginLeft'; } } var labelSize = this._state.size / (this.options.ticks.length - 1); if (this.tickLabelContainer) { var extraMargin = 0; if (this.options.ticks_positions.length === 0) { if (this.options.orientation !== 'vertical') { this.tickLabelContainer.style[styleMargin] = -labelSize / 2 + "px"; } extraMargin = this.tickLabelContainer.offsetHeight; } else { /* Chidren are position absolute, calculate height by finding the max offsetHeight of a child */ for (i = 0; i < this.tickLabelContainer.childNodes.length; i++) { if (this.tickLabelContainer.childNodes[i].offsetHeight > extraMargin) { extraMargin = this.tickLabelContainer.childNodes[i].offsetHeight; } } } if (this.options.orientation === 'horizontal') { this.sliderElem.style.marginBottom = extraMargin + "px"; } } for (var i = 0; i < this.options.ticks.length; i++) { var percentage = this.options.ticks_positions[i] || this._toPercentage(this.options.ticks[i]); if (this.options.reversed) { percentage = 100 - percentage; } this.ticks[i].style[this.stylePos] = percentage + "%"; /* Set class labels to denote whether ticks are in the selection */ this._removeClass(this.ticks[i], 'in-selection'); if (!this.options.range) { if (this.options.selection === 'after' && percentage >= positionPercentages[0]) { this._addClass(this.ticks[i], 'in-selection'); } else if (this.options.selection === 'before' && percentage <= positionPercentages[0]) { this._addClass(this.ticks[i], 'in-selection'); } } else if (percentage >= positionPercentages[0] && percentage <= positionPercentages[1]) { this._addClass(this.ticks[i], 'in-selection'); } if (this.tickLabels[i]) { this.tickLabels[i].style[styleSize] = labelSize + "px"; if (this.options.orientation !== 'vertical' && this.options.ticks_positions[i] !== undefined) { this.tickLabels[i].style.position = 'absolute'; this.tickLabels[i].style[this.stylePos] = percentage + "%"; this.tickLabels[i].style[styleMargin] = -labelSize / 2 + 'px'; } else if (this.options.orientation === 'vertical') { if (this.options.rtl) { this.tickLabels[i].style['marginRight'] = this.sliderElem.offsetWidth + "px"; } else { this.tickLabels[i].style['marginLeft'] = this.sliderElem.offsetWidth + "px"; } this.tickLabelContainer.style[styleMargin] = this.sliderElem.offsetWidth / 2 * -1 + 'px'; } /* Set class labels to indicate tick labels are in the selection or selected */ this._removeClass(this.tickLabels[i], 'label-in-selection label-is-selection'); if (!this.options.range) { if (this.options.selection === 'after' && percentage >= positionPercentages[0]) { this._addClass(this.tickLabels[i], 'label-in-selection'); } else if (this.options.selection === 'before' && percentage <= positionPercentages[0]) { this._addClass(this.tickLabels[i], 'label-in-selection'); } if (percentage === positionPercentages[0]) { this._addClass(this.tickLabels[i], 'label-is-selection'); } } else if (percentage >= positionPercentages[0] && percentage <= positionPercentages[1]) { this._addClass(this.tickLabels[i], 'label-in-selection'); if (percentage === positionPercentages[0] || positionPercentages[1]) { this._addClass(this.tickLabels[i], 'label-is-selection'); } } } } } var formattedTooltipVal; if (this.options.range) { formattedTooltipVal = this.options.formatter(this._state.value); this._setText(this.tooltipInner, formattedTooltipVal); this.tooltip.style[this.stylePos] = (positionPercentages[1] + positionPercentages[0]) / 2 + "%"; var innerTooltipMinText = this.options.formatter(this._state.value[0]); this._setText(this.tooltipInner_min, innerTooltipMinText); var innerTooltipMaxText = this.options.formatter(this._state.value[1]); this._setText(this.tooltipInner_max, innerTooltipMaxText); this.tooltip_min.style[this.stylePos] = positionPercentages[0] + "%"; this.tooltip_max.style[this.stylePos] = positionPercentages[1] + "%"; } else { formattedTooltipVal = this.options.formatter(this._state.value[0]); this._setText(this.tooltipInner, formattedTooltipVal); this.tooltip.style[this.stylePos] = positionPercentages[0] + "%"; } if (this.options.orientation === 'vertical') { this.trackLow.style.top = '0'; this.trackLow.style.height = Math.min(positionPercentages[0], positionPercentages[1]) + '%'; this.trackSelection.style.top = Math.min(positionPercentages[0], positionPercentages[1]) + '%'; this.trackSelection.style.height = Math.abs(positionPercentages[0] - positionPercentages[1]) + '%'; this.trackHigh.style.bottom = '0'; this.trackHigh.style.height = 100 - Math.min(positionPercentages[0], positionPercentages[1]) - Math.abs(positionPercentages[0] - positionPercentages[1]) + '%'; } else { if (this.stylePos === 'right') { this.trackLow.style.right = '0'; } else { this.trackLow.style.left = '0'; } this.trackLow.style.width = Math.min(positionPercentages[0], positionPercentages[1]) + '%'; if (this.stylePos === 'right') { this.trackSelection.style.right = Math.min(positionPercentages[0], positionPercentages[1]) + '%'; } else { this.trackSelection.style.left = Math.min(positionPercentages[0], positionPercentages[1]) + '%'; } this.trackSelection.style.width = Math.abs(positionPercentages[0] - positionPercentages[1]) + '%'; if (this.stylePos === 'right') { this.trackHigh.style.left = '0'; } else { this.trackHigh.style.right = '0'; } this.trackHigh.style.width = 100 - Math.min(positionPercentages[0], positionPercentages[1]) - Math.abs(positionPercentages[0] - positionPercentages[1]) + '%'; var offset_min = this.tooltip_min.getBoundingClientRect(); var offset_max = this.tooltip_max.getBoundingClientRect(); if (this.options.tooltip_position === 'bottom') { if (offset_min.right > offset_max.left) { this._removeClass(this.tooltip_max, 'bottom'); this._addClass(this.tooltip_max, 'top'); this.tooltip_max.style.top = ''; this.tooltip_max.style.bottom = 22 + 'px'; } else { this._removeClass(this.tooltip_max, 'top'); this._addClass(this.tooltip_max, 'bottom'); this.tooltip_max.style.top = this.tooltip_min.style.top; this.tooltip_max.style.bottom = ''; } } else { if (offset_min.right > offset_max.left) { this._removeClass(this.tooltip_max, 'top'); this._addClass(this.tooltip_max, 'bottom'); this.tooltip_max.style.top = 18 + 'px'; } else { this._removeClass(this.tooltip_max, 'bottom'); this._addClass(this.tooltip_max, 'top'); this.tooltip_max.style.top = this.tooltip_min.style.top; } } } }, _createHighlightRange: function _createHighlightRange(start, end) { if (this._isHighlightRange(start, end)) { if (start > end) { return { 'start': end, 'size': start - end }; } return { 'start': start, 'size': end - start }; } return null; }, _isHighlightRange: function _isHighlightRange(start, end) { if (0 <= start && start <= 100 && 0 <= end && end <= 100) { return true; } else { return false; } }, _resize: function _resize(ev) { /*jshint unused:false*/ this._state.offset = this._offset(this.sliderElem); this._state.size = this.sliderElem[this.sizePos]; this._layout(); }, _removeProperty: function _removeProperty(element, prop) { if (element.style.removeProperty) { element.style.removeProperty(prop); } else { element.style.removeAttribute(prop); } }, _mousedown: function _mousedown(ev) { if (!this._state.enabled) { return false; } if (ev.preventDefault) { ev.preventDefault(); } this._state.offset = this._offset(this.sliderElem); this._state.size = this.sliderElem[this.sizePos]; var percentage = this._getPercentage(ev); if (this.options.range) { var diff1 = Math.abs(this._state.percentage[0] - percentage); var diff2 = Math.abs(this._state.percentage[1] - percentage); this._state.dragged = diff1 < diff2 ? 0 : 1; this._adjustPercentageForRangeSliders(percentage); } else { this._state.dragged = 0; } this._state.percentage[this._state.dragged] = percentage; this._layout(); if (this.touchCapable) { document.removeEventListener("touchmove", this.mousemove, false); document.removeEventListener("touchend", this.mouseup, false); } if (this.mousemove) { document.removeEventListener("mousemove", this.mousemove, false); } if (this.mouseup) { document.removeEventListener("mouseup", this.mouseup, false); } this.mousemove = this._mousemove.bind(this); this.mouseup = this._mouseup.bind(this); if (this.touchCapable) { // Touch: Bind touch events: document.addEventListener("touchmove", this.mousemove, false); document.addEventListener("touchend", this.mouseup, false); } // Bind mouse events: document.addEventListener("mousemove", this.mousemove, false); document.addEventListener("mouseup", this.mouseup, false); this._state.inDrag = true; var newValue = this._calculateValue(); this._trigger('slideStart', newValue); this._setDataVal(newValue); this.setValue(newValue, false, true); ev.returnValue = false; if (this.options.focus) { this._triggerFocusOnHandle(this._state.dragged); } return true; }, _touchstart: function _touchstart(ev) { if (ev.changedTouches === undefined) { this._mousedown(ev); return; } var touch = ev.changedTouches[0]; this.touchX = touch.pageX; this.touchY = touch.pageY; }, _triggerFocusOnHandle: function _triggerFocusOnHandle(handleIdx) { if (handleIdx === 0) { this.handle1.focus(); } if (handleIdx === 1) { this.handle2.focus(); } }, _keydown: function _keydown(handleIdx, ev) { if (!this._state.enabled) { return false; } var dir; switch (ev.keyCode) { case 37: // left case 40: // down dir = -1; break; case 39: // right case 38: // up dir = 1; break; } if (!dir) { return; } // use natural arrow keys instead of from min to max if (this.options.natural_arrow_keys) { var ifVerticalAndNotReversed = this.options.orientation === 'vertical' && !this.options.reversed; var ifHorizontalAndReversed = this.options.orientation === 'horizontal' && this.options.reversed; // @todo control with rtl if (ifVerticalAndNotReversed || ifHorizontalAndReversed) { dir = -dir; } } var val = this._state.value[handleIdx] + dir * this.options.step; var percentage = val / this.options.max * 100; this._state.keyCtrl = handleIdx; if (this.options.range) { this._adjustPercentageForRangeSliders(percentage); var val1 = !this._state.keyCtrl ? val : this._state.value[0]; var val2 = this._state.keyCtrl ? val : this._state.value[1]; val = [val1, val2]; } this._trigger('slideStart', val); this._setDataVal(val); this.setValue(val, true, true); this._setDataVal(val); this._trigger('slideStop', val); this._layout(); this._pauseEvent(ev); delete this._state.keyCtrl; return false; }, _pauseEvent: function _pauseEvent(ev) { if (ev.stopPropagation) { ev.stopPropagation(); } if (ev.preventDefault) { ev.preventDefault(); } ev.cancelBubble = true; ev.returnValue = false; }, _mousemove: function _mousemove(ev) { if (!this._state.enabled) { return false; } var percentage = this._getPercentage(ev); this._adjustPercentageForRangeSliders(percentage); this._state.percentage[this._state.dragged] = percentage; this._layout(); var val = this._calculateValue(true); this.setValue(val, true, true); return false; }, _touchmove: function _touchmove(ev) { if (ev.changedTouches === undefined) { return; } var touch = ev.changedTouches[0]; var xDiff = touch.pageX - this.touchX; var yDiff = touch.pageY - this.touchY; if (!this._state.inDrag) { // Vertical Slider if (this.options.orientation === 'vertical' && xDiff <= 5 && xDiff >= -5 && (yDiff >= 15 || yDiff <= -15)) { this._mousedown(ev); } // Horizontal slider. else if (yDiff <= 5 && yDiff >= -5 && (xDiff >= 15 || xDiff <= -15)) { this._mousedown(ev); } } }, _adjustPercentageForRangeSliders: function _adjustPercentageForRangeSliders(percentage) { if (this.options.range) { var precision = this._getNumDigitsAfterDecimalPlace(percentage); precision = precision ? precision - 1 : 0; var percentageWithAdjustedPrecision = this._applyToFixedAndParseFloat(percentage, precision); if (this._state.dragged === 0 && this._applyToFixedAndParseFloat(this._state.percentage[1], precision) < percentageWithAdjustedPrecision) { this._state.percentage[0] = this._state.percentage[1]; this._state.dragged = 1; } else if (this._state.dragged === 1 && this._applyToFixedAndParseFloat(this._state.percentage[0], precision) > percentageWithAdjustedPrecision) { this._state.percentage[1] = this._state.percentage[0]; this._state.dragged = 0; } else if (this._state.keyCtrl === 0 && this._state.value[1] / this.options.max * 100 < percentage) { this._state.percentage[0] = this._state.percentage[1]; this._state.keyCtrl = 1; this.handle2.focus(); } else if (this._state.keyCtrl === 1 && this._state.value[0] / this.options.max * 100 > percentage) { this._state.percentage[1] = this._state.percentage[0]; this._state.keyCtrl = 0; this.handle1.focus(); } } }, _mouseup: function _mouseup() { if (!this._state.enabled) { return false; } if (this.touchCapable) { // Touch: Unbind touch event handlers: document.removeEventListener("touchmove", this.mousemove, false); document.removeEventListener("touchend", this.mouseup, false); } // Unbind mouse event handlers: document.removeEventListener("mousemove", this.mousemove, false); document.removeEventListener("mouseup", this.mouseup, false); this._state.inDrag = false; if (this._state.over === false) { this._hideTooltip(); } var val = this._calculateValue(true); this._layout(); this._setDataVal(val); this._trigger('slideStop', val); // No longer need 'dragged' after mouse up this._state.dragged = null; return false; }, _calculateValue: function _calculateValue(snapToClosestTick) { var val; if (this.options.range) { val = [this.options.min, this.options.max]; if (this._state.percentage[0] !== 0) { val[0] = this._toValue(this._state.percentage[0]); val[0] = this._applyPrecision(val[0]); } if (this._state.percentage[1] !== 100) { val[1] = this._toValue(this._state.percentage[1]); val[1] = this._applyPrecision(val[1]); } if (snapToClosestTick) { val[0] = this._snapToClosestTick(val[0]); val[1] = this._snapToClosestTick(val[1]); } } else { val = this._toValue(this._state.percentage[0]); val = parseFloat(val); val = this._applyPrecision(val); if (snapToClosestTick) { val = this._snapToClosestTick(val); } } return val; }, _snapToClosestTick: function _snapToClosestTick(val) { var min = [val, Infinity]; for (var i = 0; i < this.options.ticks.length; i++) { var diff = Math.abs(this.options.ticks[i] - val); if (diff <= min[1]) { min = [this.options.ticks[i], diff]; } } if (min[1] <= this.options.ticks_snap_bounds) { return min[0]; } return val; }, _applyPrecision: function _applyPrecision(val) { var precision = this.options.precision || this._getNumDigitsAfterDecimalPlace(this.options.step); return this._applyToFixedAndParseFloat(val, precision); }, _getNumDigitsAfterDecimalPlace: function _getNumDigitsAfterDecimalPlace(num) { var match = ('' + num).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/); if (!match) { return 0; } return Math.max(0, (match[1] ? match[1].length : 0) - (match[2] ? +match[2] : 0)); }, _applyToFixedAndParseFloat: function _applyToFixedAndParseFloat(num, toFixedInput) { var truncatedNum = num.toFixed(toFixedInput); return parseFloat(truncatedNum); }, /* Credits to Mike Samuel for the following method! Source: http://stackoverflow.com/questions/10454518/javascript-how-to-retrieve-the-number-of-decimals-of-a-string-number */ _getPercentage: function _getPercentage(ev) { if (this.touchCapable && (ev.type === 'touchstart' || ev.type === 'touchmove')) { ev = ev.touches[0]; } var eventPosition = ev[this.mousePos]; var sliderOffset = this._state.offset[this.stylePos]; var distanceToSlide = eventPosition - sliderOffset; if (this.stylePos === 'right') { distanceToSlide = -distanceToSlide; } // Calculate what percent of the length the slider handle has slid var percentage = distanceToSlide / this._state.size * 100; percentage = Math.round(percentage / this._state.percentage[2]) * this._state.percentage[2]; if (this.options.reversed) { percentage = 100 - percentage; } // Make sure the percent is within the bounds of the slider. // 0% corresponds to the 'min' value of the slide // 100% corresponds to the 'max' value of the slide return Math.max(0, Math.min(100, percentage)); }, _validateInputValue: function _validateInputValue(val) { if (!isNaN(+val)) { return +val; } else if (Array.isArray(val)) { this._validateArray(val); return val; } else { throw new Error(ErrorMsgs.formatInvalidInputErrorMsg(val)); } }, _validateArray: function _validateArray(val) { for (var i = 0; i < val.length; i++) { var input = val[i]; if (typeof input !== 'number') { throw new Error(ErrorMsgs.formatInvalidInputErrorMsg(input)); } } }, _setDataVal: function _setDataVal(val) { this.element.setAttribute('data-value', val); this.element.setAttribute('value', val); this.element.value = val; }, _trigger: function _trigger(evt, val) { val = val || val === 0 ? val : undefined; var callbackFnArray = this.eventToCallbackMap[evt]; if (callbackFnArray && callbackFnArray.length) { for (var i = 0; i < callbackFnArray.length; i++) { var callbackFn = callbackFnArray[i]; callbackFn(val); } } /* If JQuery exists, trigger JQuery events */ if ($) { this._triggerJQueryEvent(evt, val); } }, _triggerJQueryEvent: function _triggerJQueryEvent(evt, val) { var eventData = { type: evt, value: val }; this.$element.trigger(eventData); this.$sliderElem.trigger(eventData); }, _unbindJQueryEventHandlers: function _unbindJQueryEventHandlers() { this.$element.off(); this.$sliderElem.off(); }, _setText: function _setText(element, text) { if (typeof element.textContent !== "undefined") { element.textContent = text; } else if (typeof element.innerText !== "undefined") { element.innerText = text; } }, _removeClass: function _removeClass(element, classString) { var classes = classString.split(" "); var newClasses = element.className; for (var i = 0; i < classes.length; i++) { var classTag = classes[i]; var regex = new RegExp("(?:\\s|^)" + classTag + "(?:\\s|$)"); newClasses = newClasses.replace(regex, " "); } element.className = newClasses.trim(); }, _addClass: function _addClass(element, classString) { var classes = classString.split(" "); var newClasses = element.className; for (var i = 0; i < classes.length; i++) { var classTag = classes[i]; var regex = new RegExp("(?:\\s|^)" + classTag + "(?:\\s|$)"); var ifClassExists = regex.test(newClasses); if (!ifClassExists) { newClasses += " " + classTag; } } element.className = newClasses.trim(); }, _offsetLeft: function _offsetLeft(obj) { return obj.getBoundingClientRect().left; }, _offsetRight: function _offsetRight(obj) { return obj.getBoundingClientRect().right; }, _offsetTop: function _offsetTop(obj) { var offsetTop = obj.offsetTop; while ((obj = obj.offsetParent) && !isNaN(obj.offsetTop)) { offsetTop += obj.offsetTop; if (obj.tagName !== 'BODY') { offsetTop -= obj.scrollTop; } } return offsetTop; }, _offset: function _offset(obj) { return { left: this._offsetLeft(obj), right: this._offsetRight(obj), top: this._offsetTop(obj) }; }, _css: function _css(elementRef, styleName, value) { if ($) { $.style(elementRef, styleName, value); } else { var style = styleName.replace(/^-ms-/, "ms-").replace(/-([\da-z])/gi, function (all, letter) { return letter.toUpperCase(); }); elementRef.style[style] = value; } }, _toValue: function _toValue(percentage) { return this.options.scale.toValue.apply(this, [percentage]); }, _toPercentage: function _toPercentage(value) { return this.options.scale.toPercentage.apply(this, [value]); }, _setTooltipPosition: function _setTooltipPosition() { var tooltips = [this.tooltip, this.tooltip_min, this.tooltip_max]; if (this.options.orientation === 'vertical') { var tooltipPos; if (this.options.tooltip_position) { tooltipPos = this.options.tooltip_position; } else { if (this.options.rtl) { tooltipPos = 'left'; } else { tooltipPos = 'right'; } } var oppositeSide = tooltipPos === 'left' ? 'right' : 'left'; tooltips.forEach(function (tooltip) { this._addClass(tooltip, tooltipPos); tooltip.style[oppositeSide] = '100%'; }.bind(this)); } else if (this.options.tooltip_position === 'bottom') { tooltips.forEach(function (tooltip) { this._addClass(tooltip, 'bottom'); tooltip.style.top = 22 + 'px'; }.bind(this)); } else { tooltips.forEach(function (tooltip) { this._addClass(tooltip, 'top'); tooltip.style.top = -this.tooltip.outerHeight - 14 + 'px'; }.bind(this)); } } }; /********************************* Attach to global namespace *********************************/ if ($ && $.fn) { var autoRegisterNamespace = void 0; if (!$.fn.slider) { $.bridget(NAMESPACE_MAIN, Slider); autoRegisterNamespace = NAMESPACE_MAIN; } else { if (windowIsDefined) { window.console.warn("bootstrap-slider.js - WARNING: $.fn.slider namespace is already bound. Use the $.fn.bootstrapSlider namespace instead."); } autoRegisterNamespace = NAMESPACE_ALTERNATE; } $.bridget(NAMESPACE_ALTERNATE, Slider); // Auto-Register data-provide="slider" Elements $(function () { $("input[data-provide=slider]")[autoRegisterNamespace](); }); } })($); return Slider; }); dependencies/js/jquery.min.js000064400000244474151676726760012313 0ustar00/*! jQuery v2.1.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */ !function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l=a.document,m="2.1.1",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return!n.isArray(a)&&a-parseFloat(a)>=0},isPlainObject:function(a){return"object"!==n.type(a)||a.nodeType||n.isWindow(a)?!1:a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=l.createElement("script"),b.text=a,l.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:k}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+-new Date,v=a.document,w=0,x=0,y=gb(),z=gb(),A=gb(),B=function(a,b){return a===b&&(l=!0),0},C="undefined",D=1<<31,E={}.hasOwnProperty,F=[],G=F.pop,H=F.push,I=F.push,J=F.slice,K=F.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},L="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",N="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=N.replace("w","w#"),P="\\["+M+"*("+N+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+O+"))|)"+M+"*\\]",Q=":("+N+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+P+")*)|.*)\\)|)",R=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),S=new RegExp("^"+M+"*,"+M+"*"),T=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),V=new RegExp(Q),W=new RegExp("^"+O+"$"),X={ID:new RegExp("^#("+N+")"),CLASS:new RegExp("^\\.("+N+")"),TAG:new RegExp("^("+N.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+Q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{I.apply(F=J.call(v.childNodes),v.childNodes),F[v.childNodes.length].nodeType}catch(eb){I={apply:F.length?function(a,b){H.apply(a,J.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],!a||"string"!=typeof a)return d;if(1!==(k=b.nodeType)&&9!==k)return[];if(p&&!e){if(f=_.exec(a))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return I.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return I.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=9===k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+qb(o[l]);w=ab.test(a)&&ob(b.parentNode)||b,x=o.join(",")}if(x)try{return I.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function gb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function hb(a){return a[u]=!0,a}function ib(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function jb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function kb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||D)-(~a.sourceIndex||D);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function nb(a){return hb(function(b){return b=+b,hb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function ob(a){return a&&typeof a.getElementsByTagName!==C&&a}c=fb.support={},f=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fb.setDocument=function(a){var b,e=a?a.ownerDocument||a:v,g=e.defaultView;return e!==n&&9===e.nodeType&&e.documentElement?(n=e,o=e.documentElement,p=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){m()},!1):g.attachEvent&&g.attachEvent("onunload",function(){m()})),c.attributes=ib(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ib(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(e.getElementsByClassName)&&ib(function(a){return a.innerHTML="<div class='a'></div><div class='a i'></div>",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=ib(function(a){return o.appendChild(a).id=u,!e.getElementsByName||!e.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==C&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c=typeof a.getAttributeNode!==C&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==C?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==C&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(e.querySelectorAll))&&(ib(function(a){a.innerHTML="<select msallowclip=''><option selected=''></option></select>",a.querySelectorAll("[msallowclip^='']").length&&q.push("[*^$]="+M+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+M+"*(?:value|"+L+")"),a.querySelectorAll(":checked").length||q.push(":checked")}),ib(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+M+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ib(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",Q)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===v&&t(v,a)?-1:b===e||b.ownerDocument===v&&t(v,b)?1:k?K.call(k,a)-K.call(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],i=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:k?K.call(k,a)-K.call(k,b):0;if(f===g)return kb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?kb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},e):n},fb.matches=function(a,b){return fb(a,null,null,b)},fb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fb(b,n,null,[a]).length>0},fb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&E.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fb.selectors={cacheLength:50,createPseudo:hb,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+M+")"+a+"("+M+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==C&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?hb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=K.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:hb(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?hb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:hb(function(a){return function(b){return fb(a,b).length>0}}),contains:hb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:hb(function(a){return W.test(a||"")||fb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:nb(function(){return[0]}),last:nb(function(a,b){return[b-1]}),eq:nb(function(a,b,c){return[0>c?c+b:c]}),even:nb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:nb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:nb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:nb(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=lb(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=mb(b);function pb(){}pb.prototype=d.filters=d.pseudos,d.setFilters=new pb,g=fb.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?fb.error(a):z(a,i).slice(0)};function qb(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function rb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function sb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function tb(a,b,c){for(var d=0,e=b.length;e>d;d++)fb(a,b[d],c);return c}function ub(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function vb(a,b,c,d,e,f){return d&&!d[u]&&(d=vb(d)),e&&!e[u]&&(e=vb(e,f)),hb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||tb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ub(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ub(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?K.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ub(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):I.apply(g,r)})}function wb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=rb(function(a){return a===b},h,!0),l=rb(function(a){return K.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>i;i++)if(c=d.relative[a[i].type])m=[rb(sb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return vb(i>1&&sb(m),i>1&&qb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&wb(a.slice(i,e)),f>e&&wb(a=a.slice(e)),f>e&&qb(a))}m.push(c)}return sb(m)}function xb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=G.call(i));s=ub(s)}I.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&fb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?hb(f):f}return h=fb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xb(e,d)),f.selector=a}return f},i=fb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&ob(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qb(j),!a)return I.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&ob(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ib(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ib(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||jb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ib(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||jb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ib(function(a){return null==a.getAttribute("disabled")})||jb(L,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fb}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return g.call(b,a)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:l,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=l.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=l,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};A.prototype=n.fn,y=n(l);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?g.call(n(a),this[0]):g.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(C[a]||n.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return n.each(a.match(E)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&n.each(arguments,function(a,b){var c;while((c=n.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],f=0,this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(H.resolveWith(l,[n]),n.fn.triggerHandler&&(n(l).triggerHandler("ready"),n(l).off("ready"))))}});function I(){l.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),n.ready()}n.ready.promise=function(b){return H||(H=n.Deferred(),"complete"===l.readyState?setTimeout(n.ready):(l.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},n.ready.promise();var J=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f};n.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=n.expando+Math.random()}K.uid=1,K.accepts=n.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,n.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(n.isEmptyObject(f))n.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!n.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(O,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}M.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){return M.access(a,b,c)},removeData:function(a,b){M.remove(a,b) },_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=M.get(f),1===f.nodeType&&!L.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d=n.camelCase(a);if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||n.isArray(c)?d=L.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return L.get(a,c)||L.access(a,c,{empty:n.Callbacks("once memory").add(function(){L.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?n.queue(this[0],a):void 0===b?this:this.each(function(){var c=n.queue(this,a,b);n._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&n.dequeue(this,a)})},dequeue:function(a){return this.each(function(){n.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=n.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=L.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var Q=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,R=["Top","Right","Bottom","Left"],S=function(a,b){return a=b||a,"none"===n.css(a,"display")||!n.contains(a.ownerDocument,a)},T=/^(?:checkbox|radio)$/i;!function(){var a=l.createDocumentFragment(),b=a.appendChild(l.createElement("div")),c=l.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U="undefined";k.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|pointer|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return l.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return typeof n!==U&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(E)||[""],j=b.length;while(j--)h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.hasData(a)&&L.get(a);if(r&&(i=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&(delete r.handle,L.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,m,o,p=[d||l],q=j.call(b,"type")?b.type:b,r=j.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||l,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+n.event.triggered)&&(q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),k=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=r.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},e||!o.trigger||o.trigger.apply(d,c)!==!1)){if(!e&&!o.noBubble&&!n.isWindow(d)){for(i=o.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||l)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:o.bindType||q,m=(L.get(g,"events")||{})[b.type]&&L.get(g,"handle"),m&&m.apply(g,c),m=k&&g[k],m&&m.apply&&n.acceptData(g)&&(b.result=m.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!n.acceptData(d)||k&&n.isFunction(d[q])&&!n.isWindow(d)&&(h=d[k],h&&(d[k]=null),n.event.triggered=q,d[q](),n.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(a.result=e)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>=0:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button;return null==a.pageX&&null!=b.clientX&&(c=a.target.ownerDocument||l,d=c.documentElement,e=c.body,a.pageX=b.clientX+(d&&d.scrollLeft||e&&e.scrollLeft||0)-(d&&d.clientLeft||e&&e.clientLeft||0),a.pageY=b.clientY+(d&&d.scrollTop||e&&e.scrollTop||0)-(d&&d.clientTop||e&&e.clientTop||0)),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},fix:function(a){if(a[n.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=W.test(e)?this.mouseHooks:V.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new n.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=l),3===a.target.nodeType&&(a.target=a.target.parentNode),g.filter?g.filter(a,f):a},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==_()&&this.focus?(this.focus(),!1):void 0},delegateType:"focusin"},blur:{trigger:function(){return this===_()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&n.nodeName(this,"input")?(this.click(),!1):void 0},_default:function(a){return n.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=n.extend(new n.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?n.event.trigger(e,null,b):n.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},n.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)},n.Event=function(a,b){return this instanceof n.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?Z:$):this.type=a,b&&n.extend(this,b),this.timeStamp=a&&a.timeStamp||n.now(),void(this[n.expando]=!0)):new n.Event(a,b)},n.Event.prototype={isDefaultPrevented:$,isPropagationStopped:$,isImmediatePropagationStopped:$,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=Z,a&&a.preventDefault&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=Z,a&&a.stopPropagation&&a.stopPropagation()},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=Z,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},n.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){n.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!n.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),k.focusinBubbles||n.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){n.event.simulate(b,a.target,n.event.fix(a),!0)};n.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=L.access(d,b);e||d.addEventListener(a,c,!0),L.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=L.access(d,b)-1;e?L.access(d,b,e):(d.removeEventListener(a,c,!0),L.remove(d,b))}}}),n.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(g in a)this.on(g,b,c,a[g],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=$;else if(!d)return this;return 1===e&&(f=d,d=function(a){return n().off(a),f.apply(this,arguments)},d.guid=f.guid||(f.guid=n.guid++)),this.each(function(){n.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,n(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=$),this.each(function(){n.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){n.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?n.event.trigger(a,b,c,!0):void 0}});var ab=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bb=/<([\w:]+)/,cb=/<|&#?\w+;/,db=/<(?:script|style|link)/i,eb=/checked\s*(?:[^=]|=\s*.checked.)/i,fb=/^$|\/(?:java|ecma)script/i,gb=/^true\/(.*)/,hb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ib={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ib.optgroup=ib.option,ib.tbody=ib.tfoot=ib.colgroup=ib.caption=ib.thead,ib.th=ib.td;function jb(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function kb(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function lb(a){var b=gb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function mb(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function nb(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=n.extend({},h),M.set(b,i))}}function ob(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function pb(a,b){var c=b.nodeName.toLowerCase();"input"===c&&T.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}n.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=ob(h),f=ob(a),d=0,e=f.length;e>d;d++)pb(f[d],g[d]);if(b)if(c)for(f=f||ob(a),g=g||ob(h),d=0,e=f.length;e>d;d++)nb(f[d],g[d]);else nb(a,h);return g=ob(h,"script"),g.length>0&&mb(g,!i&&ob(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,o=a.length;o>m;m++)if(e=a[m],e||0===e)if("object"===n.type(e))n.merge(l,e.nodeType?[e]:e);else if(cb.test(e)){f=f||k.appendChild(b.createElement("div")),g=(bb.exec(e)||["",""])[1].toLowerCase(),h=ib[g]||ib._default,f.innerHTML=h[1]+e.replace(ab,"<$1></$2>")+h[2],j=h[0];while(j--)f=f.lastChild;n.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===n.inArray(e,d))&&(i=n.contains(e.ownerDocument,e),f=ob(k.appendChild(e),"script"),i&&mb(f),c)){j=0;while(e=f[j++])fb.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f=n.event.special,g=0;void 0!==(c=a[g]);g++){if(n.acceptData(c)&&(e=c[L.expando],e&&(b=L.cache[e]))){if(b.events)for(d in b.events)f[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);L.cache[e]&&delete L.cache[e]}delete M.cache[c[M.expando]]}}}),n.fn.extend({text:function(a){return J(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(ob(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&mb(ob(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(ob(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return J(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!db.test(a)&&!ib[(bb.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(ab,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(ob(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(ob(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,m=this,o=l-1,p=a[0],q=n.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&eb.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(c=n.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=n.map(ob(c,"script"),kb),g=f.length;l>j;j++)h=c,j!==o&&(h=n.clone(h,!0,!0),g&&n.merge(f,ob(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,n.map(f,lb),j=0;g>j;j++)h=f[j],fb.test(h.type||"")&&!L.access(h,"globalEval")&&n.contains(i,h)&&(h.src?n._evalUrl&&n._evalUrl(h.src):n.globalEval(h.textContent.replace(hb,"")))}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),n(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qb,rb={};function sb(b,c){var d,e=n(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:n.css(e[0],"display");return e.detach(),f}function tb(a){var b=l,c=rb[a];return c||(c=sb(a,b),"none"!==c&&c||(qb=(qb||n("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=qb[0].contentDocument,b.write(),b.close(),c=sb(a,b),qb.detach()),rb[a]=c),c}var ub=/^margin/,vb=new RegExp("^("+Q+")(?!px)[a-z%]+$","i"),wb=function(a){return a.ownerDocument.defaultView.getComputedStyle(a,null)};function xb(a,b,c){var d,e,f,g,h=a.style;return c=c||wb(a),c&&(g=c.getPropertyValue(b)||c[b]),c&&(""!==g||n.contains(a.ownerDocument,a)||(g=n.style(a,b)),vb.test(g)&&ub.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0!==g?g+"":g}function yb(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d=l.documentElement,e=l.createElement("div"),f=l.createElement("div");if(f.style){f.style.backgroundClip="content-box",f.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===f.style.backgroundClip,e.style.cssText="border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;position:absolute",e.appendChild(f);function g(){f.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",f.innerHTML="",d.appendChild(e);var g=a.getComputedStyle(f,null);b="1%"!==g.top,c="4px"===g.width,d.removeChild(e)}a.getComputedStyle&&n.extend(k,{pixelPosition:function(){return g(),b},boxSizingReliable:function(){return null==c&&g(),c},reliableMarginRight:function(){var b,c=f.appendChild(l.createElement("div"));return c.style.cssText=f.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",c.style.marginRight=c.style.width="0",f.style.width="1px",d.appendChild(e),b=!parseFloat(a.getComputedStyle(c,null).marginRight),d.removeChild(e),b}})}}(),n.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var zb=/^(none|table(?!-c[ea]).+)/,Ab=new RegExp("^("+Q+")(.*)$","i"),Bb=new RegExp("^([+-])=("+Q+")","i"),Cb={position:"absolute",visibility:"hidden",display:"block"},Db={letterSpacing:"0",fontWeight:"400"},Eb=["Webkit","O","Moz","ms"];function Fb(a,b){if(b in a)return b;var c=b[0].toUpperCase()+b.slice(1),d=b,e=Eb.length;while(e--)if(b=Eb[e]+c,b in a)return b;return d}function Gb(a,b,c){var d=Ab.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Hb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=n.css(a,c+R[f],!0,e)),d?("content"===c&&(g-=n.css(a,"padding"+R[f],!0,e)),"margin"!==c&&(g-=n.css(a,"border"+R[f]+"Width",!0,e))):(g+=n.css(a,"padding"+R[f],!0,e),"padding"!==c&&(g+=n.css(a,"border"+R[f]+"Width",!0,e)));return g}function Ib(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=wb(a),g="border-box"===n.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=xb(a,b,f),(0>e||null==e)&&(e=a.style[b]),vb.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Hb(a,b,c||(g?"border":"content"),d,f)+"px"}function Jb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=L.get(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&S(d)&&(f[g]=L.access(d,"olddisplay",tb(d.nodeName)))):(e=S(d),"none"===c&&e||L.set(d,"olddisplay",e?c:n.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}n.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=xb(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=n.camelCase(b),i=a.style;return b=n.cssProps[h]||(n.cssProps[h]=Fb(i,h)),g=n.cssHooks[b]||n.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,"string"===f&&(e=Bb.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(n.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||n.cssNumber[h]||(c+="px"),k.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=n.camelCase(b);return b=n.cssProps[h]||(n.cssProps[h]=Fb(a.style,h)),g=n.cssHooks[b]||n.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=xb(a,b,d)),"normal"===e&&b in Db&&(e=Db[b]),""===c||c?(f=parseFloat(e),c===!0||n.isNumeric(f)?f||0:e):e}}),n.each(["height","width"],function(a,b){n.cssHooks[b]={get:function(a,c,d){return c?zb.test(n.css(a,"display"))&&0===a.offsetWidth?n.swap(a,Cb,function(){return Ib(a,b,d)}):Ib(a,b,d):void 0},set:function(a,c,d){var e=d&&wb(a);return Gb(a,c,d?Hb(a,b,d,"border-box"===n.css(a,"boxSizing",!1,e),e):0)}}}),n.cssHooks.marginRight=yb(k.reliableMarginRight,function(a,b){return b?n.swap(a,{display:"inline-block"},xb,[a,"marginRight"]):void 0}),n.each({margin:"",padding:"",border:"Width"},function(a,b){n.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+R[d]+b]=f[d]||f[d-2]||f[0];return e}},ub.test(a)||(n.cssHooks[a+b].set=Gb)}),n.fn.extend({css:function(a,b){return J(this,function(a,b,c){var d,e,f={},g=0;if(n.isArray(b)){for(d=wb(a),e=b.length;e>g;g++)f[b[g]]=n.css(a,b[g],!1,d);return f}return void 0!==c?n.style(a,b,c):n.css(a,b)},a,b,arguments.length>1)},show:function(){return Jb(this,!0)},hide:function(){return Jb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){S(this)?n(this).show():n(this).hide()})}});function Kb(a,b,c,d,e){return new Kb.prototype.init(a,b,c,d,e)}n.Tween=Kb,Kb.prototype={constructor:Kb,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var a=Kb.propHooks[this.prop];return a&&a.get?a.get(this):Kb.propHooks._default.get(this)},run:function(a){var b,c=Kb.propHooks[this.prop];return this.pos=b=this.options.duration?n.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Kb.propHooks._default.set(this),this}},Kb.prototype.init.prototype=Kb.prototype,Kb.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[n.cssProps[a.prop]]||n.cssHooks[a.prop])?n.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Kb.propHooks.scrollTop=Kb.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},n.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},n.fx=Kb.prototype.init,n.fx.step={};var Lb,Mb,Nb=/^(?:toggle|show|hide)$/,Ob=new RegExp("^(?:([+-])=|)("+Q+")([a-z%]*)$","i"),Pb=/queueHooks$/,Qb=[Vb],Rb={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=Ob.exec(b),f=e&&e[3]||(n.cssNumber[a]?"":"px"),g=(n.cssNumber[a]||"px"!==f&&+d)&&Ob.exec(n.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,n.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function Sb(){return setTimeout(function(){Lb=void 0}),Lb=n.now()}function Tb(a,b){var c,d=0,e={height:a};for(b=b?1:0;4>d;d+=2-b)c=R[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function Ub(a,b,c){for(var d,e=(Rb[b]||[]).concat(Rb["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function Vb(a,b,c){var d,e,f,g,h,i,j,k,l=this,m={},o=a.style,p=a.nodeType&&S(a),q=L.get(a,"fxshow");c.queue||(h=n._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,l.always(function(){l.always(function(){h.unqueued--,n.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[o.overflow,o.overflowX,o.overflowY],j=n.css(a,"display"),k="none"===j?L.get(a,"olddisplay")||tb(a.nodeName):j,"inline"===k&&"none"===n.css(a,"float")&&(o.display="inline-block")),c.overflow&&(o.overflow="hidden",l.always(function(){o.overflow=c.overflow[0],o.overflowX=c.overflow[1],o.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],Nb.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(p?"hide":"show")){if("show"!==e||!q||void 0===q[d])continue;p=!0}m[d]=q&&q[d]||n.style(a,d)}else j=void 0;if(n.isEmptyObject(m))"inline"===("none"===j?tb(a.nodeName):j)&&(o.display=j);else{q?"hidden"in q&&(p=q.hidden):q=L.access(a,"fxshow",{}),f&&(q.hidden=!p),p?n(a).show():l.done(function(){n(a).hide()}),l.done(function(){var b;L.remove(a,"fxshow");for(b in m)n.style(a,b,m[b])});for(d in m)g=Ub(p?q[d]:0,d,l),d in q||(q[d]=g.start,p&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function Wb(a,b){var c,d,e,f,g;for(c in a)if(d=n.camelCase(c),e=b[d],f=a[c],n.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=n.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function Xb(a,b,c){var d,e,f=0,g=Qb.length,h=n.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=Lb||Sb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:n.extend({},b),opts:n.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:Lb||Sb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=n.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(Wb(k,j.opts.specialEasing);g>f;f++)if(d=Qb[f].call(j,a,k,j.opts))return d;return n.map(k,Ub,j),n.isFunction(j.opts.start)&&j.opts.start.call(a,j),n.fx.timer(n.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}n.Animation=n.extend(Xb,{tweener:function(a,b){n.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],Rb[c]=Rb[c]||[],Rb[c].unshift(b)},prefilter:function(a,b){b?Qb.unshift(a):Qb.push(a)}}),n.speed=function(a,b,c){var d=a&&"object"==typeof a?n.extend({},a):{complete:c||!c&&b||n.isFunction(a)&&a,duration:a,easing:c&&b||b&&!n.isFunction(b)&&b};return d.duration=n.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in n.fx.speeds?n.fx.speeds[d.duration]:n.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){n.isFunction(d.old)&&d.old.call(this),d.queue&&n.dequeue(this,d.queue)},d},n.fn.extend({fadeTo:function(a,b,c,d){return this.filter(S).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=n.isEmptyObject(a),f=n.speed(b,c,d),g=function(){var b=Xb(this,n.extend({},a),f);(e||L.get(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=n.timers,g=L.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&Pb.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&n.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=L.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=n.timers,g=d?d.length:0;for(c.finish=!0,n.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),n.each(["toggle","show","hide"],function(a,b){var c=n.fn[b];n.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(Tb(b,!0),a,d,e)}}),n.each({slideDown:Tb("show"),slideUp:Tb("hide"),slideToggle:Tb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){n.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),n.timers=[],n.fx.tick=function(){var a,b=0,c=n.timers;for(Lb=n.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||n.fx.stop(),Lb=void 0},n.fx.timer=function(a){n.timers.push(a),a()?n.fx.start():n.timers.pop()},n.fx.interval=13,n.fx.start=function(){Mb||(Mb=setInterval(n.fx.tick,n.fx.interval))},n.fx.stop=function(){clearInterval(Mb),Mb=null},n.fx.speeds={slow:600,fast:200,_default:400},n.fn.delay=function(a,b){return a=n.fx?n.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a=l.createElement("input"),b=l.createElement("select"),c=b.appendChild(l.createElement("option"));a.type="checkbox",k.checkOn=""!==a.value,k.optSelected=c.selected,b.disabled=!0,k.optDisabled=!c.disabled,a=l.createElement("input"),a.value="t",a.type="radio",k.radioValue="t"===a.value}();var Yb,Zb,$b=n.expr.attrHandle;n.fn.extend({attr:function(a,b){return J(this,n.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){n.removeAttr(this,a)})}}),n.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===U?n.prop(a,b,c):(1===f&&n.isXMLDoc(a)||(b=b.toLowerCase(),d=n.attrHooks[b]||(n.expr.match.bool.test(b)?Zb:Yb)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=n.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void n.removeAttr(a,b)) },removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=n.propFix[c]||c,n.expr.match.bool.test(c)&&(a[d]=!1),a.removeAttribute(c)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&n.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),Zb={set:function(a,b,c){return b===!1?n.removeAttr(a,c):a.setAttribute(c,c),c}},n.each(n.expr.match.bool.source.match(/\w+/g),function(a,b){var c=$b[b]||n.find.attr;$b[b]=function(a,b,d){var e,f;return d||(f=$b[b],$b[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,$b[b]=f),e}});var _b=/^(?:input|select|textarea|button)$/i;n.fn.extend({prop:function(a,b){return J(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[n.propFix[a]||a]})}}),n.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!n.isXMLDoc(a),f&&(b=n.propFix[b]||b,e=n.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){return a.hasAttribute("tabindex")||_b.test(a.nodeName)||a.href?a.tabIndex:-1}}}}),k.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this});var ac=/[\t\r\n\f]/g;n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h="string"==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(this).addClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ac," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=n.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0===arguments.length||"string"==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(this).removeClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ac," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?n.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(n.isFunction(a)?function(c){n(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=n(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===U||"boolean"===c)&&(this.className&&L.set(this,"__className__",this.className),this.className=this.className||a===!1?"":L.get(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(ac," ").indexOf(b)>=0)return!0;return!1}});var bc=/\r/g;n.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=n.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,n(this).val()):a,null==e?e="":"number"==typeof e?e+="":n.isArray(e)&&(e=n.map(e,function(a){return null==a?"":a+""})),b=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=n.valHooks[e.type]||n.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(bc,""):null==c?"":c)}}}),n.extend({valHooks:{option:{get:function(a){var b=n.find.attr(a,"value");return null!=b?b:n.trim(n.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&n.nodeName(c.parentNode,"optgroup"))){if(b=n(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=n.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=n.inArray(d.value,f)>=0)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(a,b){return n.isArray(b)?a.checked=n.inArray(n(a).val(),b)>=0:void 0}},k.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})}),n.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){n.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),n.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var cc=n.now(),dc=/\?/;n.parseJSON=function(a){return JSON.parse(a+"")},n.parseXML=function(a){var b,c;if(!a||"string"!=typeof a)return null;try{c=new DOMParser,b=c.parseFromString(a,"text/xml")}catch(d){b=void 0}return(!b||b.getElementsByTagName("parsererror").length)&&n.error("Invalid XML: "+a),b};var ec,fc,gc=/#.*$/,hc=/([?&])_=[^&]*/,ic=/^(.*?):[ \t]*([^\r\n]*)$/gm,jc=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,kc=/^(?:GET|HEAD)$/,lc=/^\/\//,mc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,nc={},oc={},pc="*/".concat("*");try{fc=location.href}catch(qc){fc=l.createElement("a"),fc.href="",fc=fc.href}ec=mc.exec(fc.toLowerCase())||[];function rc(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(n.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function sc(a,b,c,d){var e={},f=a===oc;function g(h){var i;return e[h]=!0,n.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function tc(a,b){var c,d,e=n.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&n.extend(!0,a,d),a}function uc(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function vc(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:fc,type:"GET",isLocal:jc.test(ec[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":pc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?tc(tc(a,n.ajaxSettings),b):tc(n.ajaxSettings,a)},ajaxPrefilter:rc(nc),ajaxTransport:rc(oc),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=n.ajaxSetup({},b),l=k.context||k,m=k.context&&(l.nodeType||l.jquery)?n(l):n.event,o=n.Deferred(),p=n.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!f){f={};while(b=ic.exec(e))f[b[1].toLowerCase()]=b[2]}b=f[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?e:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return c&&c.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||fc)+"").replace(gc,"").replace(lc,ec[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=n.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(h=mc.exec(k.url.toLowerCase()),k.crossDomain=!(!h||h[1]===ec[1]&&h[2]===ec[2]&&(h[3]||("http:"===h[1]?"80":"443"))===(ec[3]||("http:"===ec[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=n.param(k.data,k.traditional)),sc(nc,k,b,v),2===t)return v;i=k.global,i&&0===n.active++&&n.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!kc.test(k.type),d=k.url,k.hasContent||(k.data&&(d=k.url+=(dc.test(d)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=hc.test(d)?d.replace(hc,"$1_="+cc++):d+(dc.test(d)?"&":"?")+"_="+cc++)),k.ifModified&&(n.lastModified[d]&&v.setRequestHeader("If-Modified-Since",n.lastModified[d]),n.etag[d]&&v.setRequestHeader("If-None-Match",n.etag[d])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+pc+"; q=0.01":""):k.accepts["*"]);for(j in k.headers)v.setRequestHeader(j,k.headers[j]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(j in{success:1,error:1,complete:1})v[j](k[j]);if(c=sc(oc,k,b,v)){v.readyState=1,i&&m.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,c.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,f,h){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),c=void 0,e=h||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,f&&(u=uc(k,v,f)),u=vc(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(n.lastModified[d]=w),w=v.getResponseHeader("etag"),w&&(n.etag[d]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,i&&m.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),i&&(m.trigger("ajaxComplete",[v,k]),--n.active||n.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return n.get(a,b,c,"json")},getScript:function(a,b){return n.get(a,void 0,b,"script")}}),n.each(["get","post"],function(a,b){n[b]=function(a,c,d,e){return n.isFunction(c)&&(e=e||d,d=c,c=void 0),n.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),n.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){n.fn[b]=function(a){return this.on(b,a)}}),n._evalUrl=function(a){return n.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},n.fn.extend({wrapAll:function(a){var b;return n.isFunction(a)?this.each(function(b){n(this).wrapAll(a.call(this,b))}):(this[0]&&(b=n(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this)},wrapInner:function(a){return this.each(n.isFunction(a)?function(b){n(this).wrapInner(a.call(this,b))}:function(){var b=n(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=n.isFunction(a);return this.each(function(c){n(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){n.nodeName(this,"body")||n(this).replaceWith(this.childNodes)}).end()}}),n.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0},n.expr.filters.visible=function(a){return!n.expr.filters.hidden(a)};var wc=/%20/g,xc=/\[\]$/,yc=/\r?\n/g,zc=/^(?:submit|button|image|reset|file)$/i,Ac=/^(?:input|select|textarea|keygen)/i;function Bc(a,b,c,d){var e;if(n.isArray(b))n.each(b,function(b,e){c||xc.test(a)?d(a,e):Bc(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==n.type(b))d(a,b);else for(e in b)Bc(a+"["+e+"]",b[e],c,d)}n.param=function(a,b){var c,d=[],e=function(a,b){b=n.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(a)||a.jquery&&!n.isPlainObject(a))n.each(a,function(){e(this.name,this.value)});else for(c in a)Bc(c,a[c],b,e);return d.join("&").replace(wc,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=n.prop(this,"elements");return a?n.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!n(this).is(":disabled")&&Ac.test(this.nodeName)&&!zc.test(a)&&(this.checked||!T.test(a))}).map(function(a,b){var c=n(this).val();return null==c?null:n.isArray(c)?n.map(c,function(a){return{name:b.name,value:a.replace(yc,"\r\n")}}):{name:b.name,value:c.replace(yc,"\r\n")}}).get()}}),n.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(a){}};var Cc=0,Dc={},Ec={0:200,1223:204},Fc=n.ajaxSettings.xhr();a.ActiveXObject&&n(a).on("unload",function(){for(var a in Dc)Dc[a]()}),k.cors=!!Fc&&"withCredentials"in Fc,k.ajax=Fc=!!Fc,n.ajaxTransport(function(a){var b;return k.cors||Fc&&!a.crossDomain?{send:function(c,d){var e,f=a.xhr(),g=++Cc;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)f.setRequestHeader(e,c[e]);b=function(a){return function(){b&&(delete Dc[g],b=f.onload=f.onerror=null,"abort"===a?f.abort():"error"===a?d(f.status,f.statusText):d(Ec[f.status]||f.status,f.statusText,"string"==typeof f.responseText?{text:f.responseText}:void 0,f.getAllResponseHeaders()))}},f.onload=b(),f.onerror=b("error"),b=Dc[g]=b("abort");try{f.send(a.hasContent&&a.data||null)}catch(h){if(b)throw h}},abort:function(){b&&b()}}:void 0}),n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return n.globalEval(a),a}}}),n.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),n.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(d,e){b=n("<script>").prop({async:!0,charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&&e("error"===a.type?404:200,a.type)}),l.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Gc=[],Hc=/(=)\?(?=&|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Gc.pop()||n.expando+"_"+cc++;return this[a]=!0,a}}),n.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Hc.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Hc.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=n.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Hc,"$1"+e):b.jsonp!==!1&&(b.url+=(dc.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||n.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Gc.push(e)),g&&n.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),n.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||l;var d=v.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=n.buildFragment([a],b,e),e&&e.length&&n(e).remove(),n.merge([],d.childNodes))};var Ic=n.fn.load;n.fn.load=function(a,b,c){if("string"!=typeof a&&Ic)return Ic.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=n.trim(a.slice(h)),a=a.slice(0,h)),n.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&n.ajax({url:a,type:e,dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?n("<div>").append(n.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,f||[a.responseText,b,a])}),this},n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};var Jc=a.document.documentElement;function Kc(a){return n.isWindow(a)?a:9===a.nodeType&&a.defaultView}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),n.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.offset.setOffset(this,a,b)});var b,c,d=this[0],e={top:0,left:0},f=d&&d.ownerDocument;if(f)return b=f.documentElement,n.contains(b,d)?(typeof d.getBoundingClientRect!==U&&(e=d.getBoundingClientRect()),c=Kc(f),{top:e.top+c.pageYOffset-b.clientTop,left:e.left+c.pageXOffset-b.clientLeft}):e},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===n.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(d=a.offset()),d.top+=n.css(a[0],"borderTopWidth",!0),d.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-d.top-n.css(c,"marginTop",!0),left:b.left-d.left-n.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||Jc;while(a&&!n.nodeName(a,"html")&&"static"===n.css(a,"position"))a=a.offsetParent;return a||Jc})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(b,c){var d="pageYOffset"===c;n.fn[b]=function(e){return J(this,function(b,e,f){var g=Kc(b);return void 0===f?g?g[c]:b[e]:void(g?g.scrollTo(d?a.pageXOffset:f,d?f:a.pageYOffset):b[e]=f)},b,e,arguments.length,null)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=yb(k.pixelPosition,function(a,c){return c?(c=xb(a,b),vb.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return J(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.size=function(){return this.length},n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var Lc=a.jQuery,Mc=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=Mc),b&&a.jQuery===n&&(a.jQuery=Lc),n},typeof b===U&&(a.jQuery=a.$=n),n}); //# sourceMappingURL=jquery.min.mapdependencies/js/highlight.min.js000064400000127373151676726760012741 0ustar00/*! highlight.js v9.9.0 | BSD3 License | git.io/hljslicense */ !function(e){var t="object"==typeof window&&window||"object"==typeof self&&self;"undefined"!=typeof exports?e(exports):t&&(t.hljs=e({}),"function"==typeof define&&define.amd&&define([],function(){return t.hljs}))}(function(e){function t(e){return e.replace(/[&<>]/gm,function(e){return L[e]})}function r(e){return e.nodeName.toLowerCase()}function a(e,t){var r=e&&e.exec(t);return r&&0===r.index}function n(e){return C.test(e)}function i(e){var t,r,a,i,s=e.className+" ";if(s+=e.parentNode?e.parentNode.className:"",r=E.exec(s))return y(r[1])?r[1]:"no-highlight";for(s=s.split(/\s+/),t=0,a=s.length;a>t;t++)if(i=s[t],n(i)||y(i))return i}function s(e,t){var r,a={};for(r in e)a[r]=e[r];if(t)for(r in t)a[r]=t[r];return a}function c(e){var t=[];return function a(e,n){for(var i=e.firstChild;i;i=i.nextSibling)3===i.nodeType?n+=i.nodeValue.length:1===i.nodeType&&(t.push({event:"start",offset:n,node:i}),n=a(i,n),r(i).match(/br|hr|img|input/)||t.push({event:"stop",offset:n,node:i}));return n}(e,0),t}function o(e,a,n){function i(){return e.length&&a.length?e[0].offset!==a[0].offset?e[0].offset<a[0].offset?e:a:"start"===a[0].event?e:a:e.length?e:a}function s(e){function a(e){return" "+e.nodeName+'="'+t(e.value)+'"'}u+="<"+r(e)+w.map.call(e.attributes,a).join("")+">"}function c(e){u+="</"+r(e)+">"}function o(e){("start"===e.event?s:c)(e.node)}for(var l=0,u="",d=[];e.length||a.length;){var b=i();if(u+=t(n.substring(l,b[0].offset)),l=b[0].offset,b===e){d.reverse().forEach(c);do o(b.splice(0,1)[0]),b=i();while(b===e&&b.length&&b[0].offset===l);d.reverse().forEach(s)}else"start"===b[0].event?d.push(b[0].node):d.pop(),o(b.splice(0,1)[0])}return u+t(n.substr(l))}function l(e){function t(e){return e&&e.source||e}function r(r,a){return new RegExp(t(r),"m"+(e.cI?"i":"")+(a?"g":""))}function a(n,i){if(!n.compiled){if(n.compiled=!0,n.k=n.k||n.bK,n.k){var c={},o=function(t,r){e.cI&&(r=r.toLowerCase()),r.split(" ").forEach(function(e){var r=e.split("|");c[r[0]]=[t,r[1]?Number(r[1]):1]})};"string"==typeof n.k?o("keyword",n.k):N(n.k).forEach(function(e){o(e,n.k[e])}),n.k=c}n.lR=r(n.l||/\w+/,!0),i&&(n.bK&&(n.b="\\b("+n.bK.split(" ").join("|")+")\\b"),n.b||(n.b=/\B|\b/),n.bR=r(n.b),n.e||n.eW||(n.e=/\B|\b/),n.e&&(n.eR=r(n.e)),n.tE=t(n.e)||"",n.eW&&i.tE&&(n.tE+=(n.e?"|":"")+i.tE)),n.i&&(n.iR=r(n.i)),null==n.r&&(n.r=1),n.c||(n.c=[]);var l=[];n.c.forEach(function(e){e.v?e.v.forEach(function(t){l.push(s(e,t))}):l.push("self"===e?n:e)}),n.c=l,n.c.forEach(function(e){a(e,n)}),n.starts&&a(n.starts,i);var u=n.c.map(function(e){return e.bK?"\\.?("+e.b+")\\.?":e.b}).concat([n.tE,n.i]).map(t).filter(Boolean);n.t=u.length?r(u.join("|"),!0):{exec:function(){return null}}}}a(e)}function u(e,r,n,i){function s(e,t){var r,n;for(r=0,n=t.c.length;n>r;r++)if(a(t.c[r].bR,e))return t.c[r]}function c(e,t){if(a(e.eR,t)){for(;e.endsParent&&e.parent;)e=e.parent;return e}return e.eW?c(e.parent,t):void 0}function o(e,t){return!n&&a(t.iR,e)}function b(e,t){var r=v.cI?t[0].toLowerCase():t[0];return e.k.hasOwnProperty(r)&&e.k[r]}function p(e,t,r,a){var n=a?"":S.classPrefix,i='<span class="'+n,s=r?"":B;return i+=e+'">',i+t+s}function m(){var e,r,a,n;if(!N.k)return t(E);for(n="",r=0,N.lR.lastIndex=0,a=N.lR.exec(E);a;)n+=t(E.substring(r,a.index)),e=b(N,a),e?(M+=e[1],n+=p(e[0],t(a[0]))):n+=t(a[0]),r=N.lR.lastIndex,a=N.lR.exec(E);return n+t(E.substr(r))}function f(){var e="string"==typeof N.sL;if(e&&!k[N.sL])return t(E);var r=e?u(N.sL,E,!0,x[N.sL]):d(E,N.sL.length?N.sL:void 0);return N.r>0&&(M+=r.r),e&&(x[N.sL]=r.top),p(r.language,r.value,!1,!0)}function g(){C+=null!=N.sL?f():m(),E=""}function _(e){C+=e.cN?p(e.cN,"",!0):"",N=Object.create(e,{parent:{value:N}})}function h(e,t){if(E+=e,null==t)return g(),0;var r=s(t,N);if(r)return r.skip?E+=t:(r.eB&&(E+=t),g(),r.rB||r.eB||(E=t)),_(r,t),r.rB?0:t.length;var a=c(N,t);if(a){var n=N;n.skip?E+=t:(n.rE||n.eE||(E+=t),g(),n.eE&&(E=t));do N.cN&&(C+=B),N.skip||(M+=N.r),N=N.parent;while(N!==a.parent);return a.starts&&_(a.starts,""),n.rE?0:t.length}if(o(t,N))throw new Error('Illegal lexeme "'+t+'" for mode "'+(N.cN||"<unnamed>")+'"');return E+=t,t.length||1}var v=y(e);if(!v)throw new Error('Unknown language: "'+e+'"');l(v);var w,N=i||v,x={},C="";for(w=N;w!==v;w=w.parent)w.cN&&(C=p(w.cN,"",!0)+C);var E="",M=0;try{for(var L,R,A=0;;){if(N.t.lastIndex=A,L=N.t.exec(r),!L)break;R=h(r.substring(A,L.index),L[0]),A=L.index+R}for(h(r.substr(A)),w=N;w.parent;w=w.parent)w.cN&&(C+=B);return{r:M,value:C,language:e,top:N}}catch($){if($.message&&-1!==$.message.indexOf("Illegal"))return{r:0,value:t(r)};throw $}}function d(e,r){r=r||S.languages||N(k);var a={r:0,value:t(e)},n=a;return r.filter(y).forEach(function(t){var r=u(t,e,!1);r.language=t,r.r>n.r&&(n=r),r.r>a.r&&(n=a,a=r)}),n.language&&(a.second_best=n),a}function b(e){return S.tabReplace||S.useBR?e.replace(M,function(e,t){return S.useBR&&"\n"===e?"<br>":S.tabReplace?t.replace(/\t/g,S.tabReplace):void 0}):e}function p(e,t,r){var a=t?x[t]:r,n=[e.trim()];return e.match(/\bhljs\b/)||n.push("hljs"),-1===e.indexOf(a)&&n.push(a),n.join(" ").trim()}function m(e){var t,r,a,s,l,m=i(e);n(m)||(S.useBR?(t=document.createElementNS("http://www.w3.org/1999/xhtml","div"),t.innerHTML=e.innerHTML.replace(/\n/g,"").replace(/<br[ \/]*>/g,"\n")):t=e,l=t.textContent,a=m?u(m,l,!0):d(l),r=c(t),r.length&&(s=document.createElementNS("http://www.w3.org/1999/xhtml","div"),s.innerHTML=a.value,a.value=o(r,c(s),l)),a.value=b(a.value),e.innerHTML=a.value,e.className=p(e.className,m,a.language),e.result={language:a.language,re:a.r},a.second_best&&(e.second_best={language:a.second_best.language,re:a.second_best.r}))}function f(e){S=s(S,e)}function g(){if(!g.called){g.called=!0;var e=document.querySelectorAll("pre code");w.forEach.call(e,m)}}function _(){addEventListener("DOMContentLoaded",g,!1),addEventListener("load",g,!1)}function h(t,r){var a=k[t]=r(e);a.aliases&&a.aliases.forEach(function(e){x[e]=t})}function v(){return N(k)}function y(e){return e=(e||"").toLowerCase(),k[e]||k[x[e]]}var w=[],N=Object.keys,k={},x={},C=/^(no-?highlight|plain|text)$/i,E=/\blang(?:uage)?-([\w-]+)\b/i,M=/((^(<[^>]+>|\t|)+|(?:\n)))/gm,B="</span>",S={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0},L={"&":"&","<":"<",">":">"};return e.highlight=u,e.highlightAuto=d,e.fixMarkup=b,e.highlightBlock=m,e.configure=f,e.initHighlighting=g,e.initHighlightingOnLoad=_,e.registerLanguage=h,e.listLanguages=v,e.getLanguage=y,e.inherit=s,e.IR="[a-zA-Z]\\w*",e.UIR="[a-zA-Z_]\\w*",e.NR="\\b\\d+(\\.\\d+)?",e.CNR="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",e.BNR="\\b(0b[01]+)",e.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",e.BE={b:"\\\\[\\s\\S]",r:0},e.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[e.BE]},e.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[e.BE]},e.PWM={b:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|like)\b/},e.C=function(t,r,a){var n=e.inherit({cN:"comment",b:t,e:r,c:[]},a||{});return n.c.push(e.PWM),n.c.push({cN:"doctag",b:"(?:TODO|FIXME|NOTE|BUG|XXX):",r:0}),n},e.CLCM=e.C("//","$"),e.CBCM=e.C("/\\*","\\*/"),e.HCM=e.C("#","$"),e.NM={cN:"number",b:e.NR,r:0},e.CNM={cN:"number",b:e.CNR,r:0},e.BNM={cN:"number",b:e.BNR,r:0},e.CSSNM={cN:"number",b:e.NR+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",r:0},e.RM={cN:"regexp",b:/\//,e:/\/[gimuy]*/,i:/\n/,c:[e.BE,{b:/\[/,e:/\]/,r:0,c:[e.BE]}]},e.TM={cN:"title",b:e.IR,r:0},e.UTM={cN:"title",b:e.UIR,r:0},e.METHOD_GUARD={b:"\\.\\s*"+e.UIR,r:0},e.registerLanguage("apache",function(e){var t={cN:"number",b:"[\\$%]\\d+"};return{aliases:["apacheconf"],cI:!0,c:[e.HCM,{cN:"section",b:"</?",e:">"},{cN:"attribute",b:/\w+/,r:0,k:{nomarkup:"order deny allow setenv rewriterule rewriteengine rewritecond documentroot sethandler errordocument loadmodule options header listen serverroot servername"},starts:{e:/$/,r:0,k:{literal:"on off all"},c:[{cN:"meta",b:"\\s\\[",e:"\\]$"},{cN:"variable",b:"[\\$%]\\{",e:"\\}",c:["self",t]},t,e.QSM]}}],i:/\S/}}),e.registerLanguage("bash",function(e){var t={cN:"variable",v:[{b:/\$[\w\d#@][\w\d_]*/},{b:/\$\{(.*?)}/}]},r={cN:"string",b:/"/,e:/"/,c:[e.BE,t,{cN:"variable",b:/\$\(/,e:/\)/,c:[e.BE]}]},a={cN:"string",b:/'/,e:/'/};return{aliases:["sh","zsh"],l:/-?[a-z\._]+/,k:{keyword:"if then else elif fi for while in do done case esac function",literal:"true false",built_in:"break cd continue eval exec exit export getopts hash pwd readonly return shift test times trap umask unset alias bind builtin caller command declare echo enable help let local logout mapfile printf read readarray source type typeset ulimit unalias set shopt autoload bg bindkey bye cap chdir clone comparguments compcall compctl compdescribe compfiles compgroups compquote comptags comptry compvalues dirs disable disown echotc echoti emulate fc fg float functions getcap getln history integer jobs kill limit log noglob popd print pushd pushln rehash sched setcap setopt stat suspend ttyctl unfunction unhash unlimit unsetopt vared wait whence where which zcompile zformat zftp zle zmodload zparseopts zprof zpty zregexparse zsocket zstyle ztcp",_:"-ne -eq -lt -gt -f -d -e -s -l -a"},c:[{cN:"meta",b:/^#![^\n]+sh\s*$/,r:10},{cN:"function",b:/\w[\w\d_]*\s*\(\s*\)\s*\{/,rB:!0,c:[e.inherit(e.TM,{b:/\w[\w\d_]*/})],r:0},e.HCM,r,a,t]}}),e.registerLanguage("coffeescript",function(e){var t={keyword:"in if for while finally new do return else break catch instanceof throw try this switch continue typeof delete debugger super yield import export from as default await then unless until loop of by when and or is isnt not",literal:"true false null undefined yes no on off",built_in:"npm require console print module global window document"},r="[A-Za-z$_][0-9A-Za-z$_]*",a={cN:"subst",b:/#\{/,e:/}/,k:t},n=[e.BNM,e.inherit(e.CNM,{starts:{e:"(\\s*/)?",r:0}}),{cN:"string",v:[{b:/'''/,e:/'''/,c:[e.BE]},{b:/'/,e:/'/,c:[e.BE]},{b:/"""/,e:/"""/,c:[e.BE,a]},{b:/"/,e:/"/,c:[e.BE,a]}]},{cN:"regexp",v:[{b:"///",e:"///",c:[a,e.HCM]},{b:"//[gim]*",r:0},{b:/\/(?![ *])(\\\/|.)*?\/[gim]*(?=\W|$)/}]},{b:"@"+r},{sL:"javascript",eB:!0,eE:!0,v:[{b:"```",e:"```"},{b:"`",e:"`"}]}];a.c=n;var i=e.inherit(e.TM,{b:r}),s="(\\(.*\\))?\\s*\\B[-=]>",c={cN:"params",b:"\\([^\\(]",rB:!0,c:[{b:/\(/,e:/\)/,k:t,c:["self"].concat(n)}]};return{aliases:["coffee","cson","iced"],k:t,i:/\/\*/,c:n.concat([e.C("###","###"),e.HCM,{cN:"function",b:"^\\s*"+r+"\\s*=\\s*"+s,e:"[-=]>",rB:!0,c:[i,c]},{b:/[:\(,=]\s*/,r:0,c:[{cN:"function",b:s,e:"[-=]>",rB:!0,c:[c]}]},{cN:"class",bK:"class",e:"$",i:/[:="\[\]]/,c:[{bK:"extends",eW:!0,i:/[:="\[\]]/,c:[i]},i]},{b:r+":",e:":",rB:!0,rE:!0,r:0}])}}),e.registerLanguage("cpp",function(e){var t={cN:"keyword",b:"\\b[a-z\\d_]*_t\\b"},r={cN:"string",v:[{b:'(u8?|U)?L?"',e:'"',i:"\\n",c:[e.BE]},{b:'(u8?|U)?R"',e:'"',c:[e.BE]},{b:"'\\\\?.",e:"'",i:"."}]},a={cN:"number",v:[{b:"\\b(0b[01']+)"},{b:"\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{b:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],r:0},n={cN:"meta",b:/#\s*[a-z]+\b/,e:/$/,k:{"meta-keyword":"if else elif endif define undef warning error line pragma ifdef ifndef include"},c:[{b:/\\\n/,r:0},e.inherit(r,{cN:"meta-string"}),{cN:"meta-string",b:"<",e:">",i:"\\n"},e.CLCM,e.CBCM]},i=e.IR+"\\s*\\(",s={keyword:"int float while private char catch import module export virtual operator sizeof dynamic_cast|10 typedef const_cast|10 const struct for static_cast|10 union namespace unsigned long volatile static protected bool template mutable if public friend do goto auto void enum else break extern using class asm case typeid short reinterpret_cast|10 default double register explicit signed typename try this switch continue inline delete alignof constexpr decltype noexcept static_assert thread_local restrict _Bool complex _Complex _Imaginary atomic_bool atomic_char atomic_schar atomic_uchar atomic_short atomic_ushort atomic_int atomic_uint atomic_long atomic_ulong atomic_llong atomic_ullong new throw return",built_in:"std string cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap array shared_ptr abort abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr",literal:"true false nullptr NULL"},c=[t,e.CLCM,e.CBCM,a,r];return{aliases:["c","cc","h","c++","h++","hpp"],k:s,i:"</",c:c.concat([n,{b:"\\b(deque|list|queue|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<",e:">",k:s,c:["self",t]},{b:e.IR+"::",k:s},{v:[{b:/=/,e:/;/},{b:/\(/,e:/\)/},{bK:"new throw return else",e:/;/}],k:s,c:c.concat([{b:/\(/,e:/\)/,k:s,c:c.concat(["self"]),r:0}]),r:0},{cN:"function",b:"("+e.IR+"[\\*&\\s]+)+"+i,rB:!0,e:/[{;=]/,eE:!0,k:s,i:/[^\w\s\*&]/,c:[{b:i,rB:!0,c:[e.TM],r:0},{cN:"params",b:/\(/,e:/\)/,k:s,r:0,c:[e.CLCM,e.CBCM,r,a,t]},e.CLCM,e.CBCM,n]}]),exports:{preprocessor:n,strings:r,k:s}}}),e.registerLanguage("cs",function(e){var t={keyword:"abstract as base bool break byte case catch char checked const continue decimal default delegate do double else enum event explicit extern finally fixed float for foreach goto if implicit in int interface internal is lock long object operator out override params private protected public readonly ref sbyte sealed short sizeof stackalloc static string struct switch this try typeof uint ulong unchecked unsafe ushort using virtual void volatile while nameof add alias ascending async await by descending dynamic equals from get global group into join let on orderby partial remove select set value var where yield",literal:"null false true"},r={cN:"string",b:'@"',e:'"',c:[{b:'""'}]},a=e.inherit(r,{i:/\n/}),n={cN:"subst",b:"{",e:"}",k:t},i=e.inherit(n,{i:/\n/}),s={cN:"string",b:/\$"/,e:'"',i:/\n/,c:[{b:"{{"},{b:"}}"},e.BE,i]},c={cN:"string",b:/\$@"/,e:'"',c:[{b:"{{"},{b:"}}"},{b:'""'},n]},o=e.inherit(c,{i:/\n/,c:[{b:"{{"},{b:"}}"},{b:'""'},i]});n.c=[c,s,r,e.ASM,e.QSM,e.CNM,e.CBCM],i.c=[o,s,a,e.ASM,e.QSM,e.CNM,e.inherit(e.CBCM,{i:/\n/})];var l={v:[c,s,r,e.ASM,e.QSM]},u=e.IR+"(<"+e.IR+"(\\s*,\\s*"+e.IR+")*>)?(\\[\\])?";return{aliases:["csharp"],k:t,i:/::/,c:[e.C("///","$",{rB:!0,c:[{cN:"doctag",v:[{b:"///",r:0},{b:"<!--|-->"},{b:"</?",e:">"}]}]}),e.CLCM,e.CBCM,{cN:"meta",b:"#",e:"$",k:{"meta-keyword":"if else elif endif define undef warning error line region endregion pragma checksum"}},l,e.CNM,{bK:"class interface",e:/[{;=]/,i:/[^\s:]/,c:[e.TM,e.CLCM,e.CBCM]},{bK:"namespace",e:/[{;=]/,i:/[^\s:]/,c:[e.inherit(e.TM,{b:"[a-zA-Z](\\.?\\w)*"}),e.CLCM,e.CBCM]},{bK:"new return throw await",r:0},{cN:"function",b:"("+u+"\\s+)+"+e.IR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:t,c:[{b:e.IR+"\\s*\\(",rB:!0,c:[e.TM],r:0},{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,k:t,r:0,c:[l,e.CNM,e.CBCM]},e.CLCM,e.CBCM]}]}}),e.registerLanguage("css",function(e){var t="[a-zA-Z-][a-zA-Z0-9_-]*",r={b:/[A-Z\_\.\-]+\s*:/,rB:!0,e:";",eW:!0,c:[{cN:"attribute",b:/\S/,e:":",eE:!0,starts:{eW:!0,eE:!0,c:[{b:/[\w-]+\(/,rB:!0,c:[{cN:"built_in",b:/[\w-]+/},{b:/\(/,e:/\)/,c:[e.ASM,e.QSM]}]},e.CSSNM,e.QSM,e.ASM,e.CBCM,{cN:"number",b:"#[0-9A-Fa-f]+"},{cN:"meta",b:"!important"}]}}]};return{cI:!0,i:/[=\/|'\$]/,c:[e.CBCM,{cN:"selector-id",b:/#[A-Za-z0-9_-]+/},{cN:"selector-class",b:/\.[A-Za-z0-9_-]+/},{cN:"selector-attr",b:/\[/,e:/\]/,i:"$"},{cN:"selector-pseudo",b:/:(:)?[a-zA-Z0-9\_\-\+\(\)"'.]+/},{b:"@(font-face|page)",l:"[a-z-]+",k:"font-face page"},{b:"@",e:"[{;]",i:/:/,c:[{cN:"keyword",b:/\w+/},{b:/\s/,eW:!0,eE:!0,r:0,c:[e.ASM,e.QSM,e.CSSNM]}]},{cN:"selector-tag",b:t,r:0},{b:"{",e:"}",i:/\S/,c:[e.CBCM,r]}]}}),e.registerLanguage("diff",function(e){return{aliases:["patch"],c:[{cN:"meta",r:10,v:[{b:/^@@ +\-\d+,\d+ +\+\d+,\d+ +@@$/},{b:/^\*\*\* +\d+,\d+ +\*\*\*\*$/},{b:/^\-\-\- +\d+,\d+ +\-\-\-\-$/}]},{cN:"comment",v:[{b:/Index: /,e:/$/},{b:/={3,}/,e:/$/},{b:/^\-{3}/,e:/$/},{b:/^\*{3} /,e:/$/},{b:/^\+{3}/,e:/$/},{b:/\*{5}/,e:/\*{5}$/}]},{cN:"addition",b:"^\\+",e:"$"},{cN:"deletion",b:"^\\-",e:"$"},{cN:"addition",b:"^\\!",e:"$"}]}}),e.registerLanguage("http",function(e){var t="HTTP/[0-9\\.]+";return{aliases:["https"],i:"\\S",c:[{b:"^"+t,e:"$",c:[{cN:"number",b:"\\b\\d{3}\\b"}]},{b:"^[A-Z]+ (.*?) "+t+"$",rB:!0,e:"$",c:[{cN:"string",b:" ",e:" ",eB:!0,eE:!0},{b:t},{cN:"keyword",b:"[A-Z]+"}]},{cN:"attribute",b:"^\\w",e:": ",eE:!0,i:"\\n|\\s|=",starts:{e:"$",r:0}},{b:"\\n\\n",starts:{sL:[],eW:!0}}]}}),e.registerLanguage("ini",function(e){var t={cN:"string",c:[e.BE],v:[{b:"'''",e:"'''",r:10},{b:'"""',e:'"""',r:10},{b:'"',e:'"'},{b:"'",e:"'"}]};return{aliases:["toml"],cI:!0,i:/\S/,c:[e.C(";","$"),e.HCM,{cN:"section",b:/^\s*\[+/,e:/\]+/},{b:/^[a-z0-9\[\]_-]+\s*=\s*/,e:"$",rB:!0,c:[{cN:"attr",b:/[a-z0-9\[\]_-]+/},{b:/=/,eW:!0,r:0,c:[{cN:"literal",b:/\bon|off|true|false|yes|no\b/},{cN:"variable",v:[{b:/\$[\w\d"][\w\d_]*/},{b:/\$\{(.*?)}/}]},t,{cN:"number",b:/([\+\-]+)?[\d]+_[\d_]+/},e.NM]}]}]}}),e.registerLanguage("java",function(e){var t="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=t+"(<"+t+"(\\s*,\\s*"+t+")*>)?",a="false synchronized int abstract float private char boolean static null if const for true while long strictfp finally protected import native final void enum else break transient catch instanceof byte super volatile case assert short package default double public try this switch continue throws protected public private module requires exports do",n="\\b(0[bB]([01]+[01_]+[01]+|[01]+)|0[xX]([a-fA-F0-9]+[a-fA-F0-9_]+[a-fA-F0-9]+|[a-fA-F0-9]+)|(([\\d]+[\\d_]+[\\d]+|[\\d]+)(\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))?|\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))([eE][-+]?\\d+)?)[lLfF]?",i={cN:"number",b:n,r:0};return{aliases:["jsp"],k:a,i:/<\/|#/,c:[e.C("/\\*\\*","\\*/",{r:0,c:[{b:/\w+@/,r:0},{cN:"doctag",b:"@[A-Za-z]+"}]}),e.CLCM,e.CBCM,e.ASM,e.QSM,{cN:"class",bK:"class interface",e:/[{;=]/,eE:!0,k:"class interface",i:/[:"\[\]]/,c:[{bK:"extends implements"},e.UTM]},{bK:"new throw return else",r:0},{cN:"function",b:"("+r+"\\s+)+"+e.UIR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:a,c:[{b:e.UIR+"\\s*\\(",rB:!0,r:0,c:[e.UTM]},{cN:"params",b:/\(/,e:/\)/,k:a,r:0,c:[e.ASM,e.QSM,e.CNM,e.CBCM]},e.CLCM,e.CBCM]},i,{cN:"meta",b:"@[A-Za-z]+"}]}}),e.registerLanguage("javascript",function(e){var t="[A-Za-z$_][0-9A-Za-z$_]*",r={keyword:"in of if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const export super debugger as async await static import from as",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect Promise"},a={cN:"number",v:[{b:"\\b(0[bB][01]+)"},{b:"\\b(0[oO][0-7]+)"},{b:e.CNR}],r:0},n={cN:"subst",b:"\\$\\{",e:"\\}",k:r,c:[]},i={cN:"string",b:"`",e:"`",c:[e.BE,n]};n.c=[e.ASM,e.QSM,i,a,e.RM];var s=n.c.concat([e.CBCM,e.CLCM]);return{aliases:["js","jsx"],k:r,c:[{cN:"meta",r:10,b:/^\s*['"]use (strict|asm)['"]/},{cN:"meta",b:/^#!/,e:/$/},e.ASM,e.QSM,i,e.CLCM,e.CBCM,a,{b:/[{,]\s*/,r:0,c:[{b:t+"\\s*:",rB:!0,r:0,c:[{cN:"attr",b:t,r:0}]}]},{b:"("+e.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[e.CLCM,e.CBCM,e.RM,{cN:"function",b:"(\\(.*?\\)|"+t+")\\s*=>",rB:!0,e:"\\s*=>",c:[{cN:"params",v:[{b:t},{b:/\(\s*\)/},{b:/\(/,e:/\)/,eB:!0,eE:!0,k:r,c:s}]}]},{b:/</,e:/(\/\w+|\w+\/)>/,sL:"xml",c:[{b:/<\w+\s*\/>/,skip:!0},{b:/<\w+/,e:/(\/\w+|\w+\/)>/,skip:!0,c:[{b:/<\w+\s*\/>/,skip:!0},"self"]}]}],r:0},{cN:"function",bK:"function",e:/\{/,eE:!0,c:[e.inherit(e.TM,{b:t}),{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,c:s}],i:/\[|%/},{b:/\$[(.]/},e.METHOD_GUARD,{cN:"class",bK:"class",e:/[{;=]/,eE:!0,i:/[:"\[\]]/,c:[{bK:"extends"},e.UTM]},{bK:"constructor",e:/\{/,eE:!0}],i:/#(?!!)/}}),e.registerLanguage("json",function(e){var t={literal:"true false null"},r=[e.QSM,e.CNM],a={e:",",eW:!0,eE:!0,c:r,k:t},n={b:"{",e:"}",c:[{cN:"attr",b:/"/,e:/"/,c:[e.BE],i:"\\n"},e.inherit(a,{b:/:/})],i:"\\S"},i={b:"\\[",e:"\\]",c:[e.inherit(a)],i:"\\S"};return r.splice(r.length,0,n,i),{c:r,k:t,i:"\\S"}}),e.registerLanguage("makefile",function(e){var t={cN:"variable",b:/\$\(/,e:/\)/,c:[e.BE]};return{aliases:["mk","mak"],c:[e.HCM,{b:/^\w+\s*\W*=/,rB:!0,r:0,starts:{e:/\s*\W*=/,eE:!0,starts:{e:/$/,r:0,c:[t]}}},{cN:"section",b:/^[\w]+:\s*$/},{cN:"meta",b:/^\.PHONY:/,e:/$/,k:{"meta-keyword":".PHONY"},l:/[\.\w]+/},{b:/^\t+/,e:/$/,r:0,c:[e.QSM,t]}]}}),e.registerLanguage("xml",function(e){var t="[A-Za-z0-9\\._:-]+",r={eW:!0,i:/</,r:0,c:[{cN:"attr",b:t,r:0},{b:/=\s*/,r:0,c:[{cN:"string",endsParent:!0,v:[{b:/"/,e:/"/},{b:/'/,e:/'/},{b:/[^\s"'=<>`]+/}]}]}]};return{aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist"],cI:!0,c:[{cN:"meta",b:"<!DOCTYPE",e:">",r:10,c:[{b:"\\[",e:"\\]"}]},e.C("<!--","-->",{r:10}),{b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{b:/<\?(php)?/,e:/\?>/,sL:"php",c:[{b:"/\\*",e:"\\*/",skip:!0}]},{cN:"tag",b:"<style(?=\\s|>|$)",e:">",k:{name:"style"},c:[r],starts:{e:"</style>",rE:!0,sL:["css","xml"]}},{cN:"tag",b:"<script(?=\\s|>|$)",e:">",k:{name:"script"},c:[r],starts:{e:"</script>",rE:!0,sL:["actionscript","javascript","handlebars","xml"]}},{cN:"meta",v:[{b:/<\?xml/,e:/\?>/,r:10},{b:/<\?\w+/,e:/\?>/}]},{cN:"tag",b:"</?",e:"/?>",c:[{cN:"name",b:/[^\/><\s]+/,r:0},r]}]}}),e.registerLanguage("markdown",function(e){return{aliases:["md","mkdown","mkd"],c:[{cN:"section",v:[{b:"^#{1,6}",e:"$"},{b:"^.+?\\n[=-]{2,}$"}]},{b:"<",e:">",sL:"xml",r:0},{cN:"bullet",b:"^([*+-]|(\\d+\\.))\\s+"},{cN:"strong",b:"[*_]{2}.+?[*_]{2}"},{cN:"emphasis",v:[{b:"\\*.+?\\*"},{b:"_.+?_",r:0}]},{cN:"quote",b:"^>\\s+",e:"$"},{cN:"code",v:[{b:"^```w*s*$",e:"^```s*$"},{b:"`.+?`"},{b:"^( {4}| )",e:"$",r:0}]},{b:"^[-\\*]{3,}",e:"$"},{b:"\\[.+?\\][\\(\\[].*?[\\)\\]]",rB:!0,c:[{cN:"string",b:"\\[",e:"\\]",eB:!0,rE:!0,r:0},{cN:"link",b:"\\]\\(",e:"\\)",eB:!0,eE:!0},{cN:"symbol",b:"\\]\\[",e:"\\]",eB:!0,eE:!0}],r:10},{b:/^\[[^\n]+\]:/,rB:!0,c:[{cN:"symbol",b:/\[/,e:/\]/,eB:!0,eE:!0},{cN:"link",b:/:\s*/,e:/$/,eB:!0}]}]}}),e.registerLanguage("nginx",function(e){var t={cN:"variable",v:[{b:/\$\d+/},{b:/\$\{/,e:/}/},{b:"[\\$\\@]"+e.UIR}]},r={eW:!0,l:"[a-z/_]+",k:{literal:"on off yes no true false none blocked debug info notice warn error crit select break last permanent redirect kqueue rtsig epoll poll /dev/poll"},r:0,i:"=>",c:[e.HCM,{cN:"string",c:[e.BE,t],v:[{b:/"/,e:/"/},{b:/'/,e:/'/}]},{b:"([a-z]+):/",e:"\\s",eW:!0,eE:!0,c:[t]},{cN:"regexp",c:[e.BE,t],v:[{b:"\\s\\^",e:"\\s|{|;",rE:!0},{b:"~\\*?\\s+",e:"\\s|{|;",rE:!0},{b:"\\*(\\.[a-z\\-]+)+"},{b:"([a-z\\-]+\\.)+\\*"}]},{cN:"number",b:"\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b"},{cN:"number",b:"\\b\\d+[kKmMgGdshdwy]*\\b",r:0},t]};return{aliases:["nginxconf"],c:[e.HCM,{b:e.UIR+"\\s+{",rB:!0,e:"{",c:[{cN:"section",b:e.UIR}],r:0},{b:e.UIR+"\\s",e:";|{",rB:!0,c:[{cN:"attribute",b:e.UIR,starts:r}],r:0}],i:"[^\\s\\}]"}}),e.registerLanguage("objectivec",function(e){var t={cN:"built_in",b:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},r={keyword:"int float while char export sizeof typedef const struct for union unsigned long volatile static bool mutable if do return goto void enum else break extern asm case short default double register explicit signed typename this switch continue wchar_t inline readonly assign readwrite self @synchronized id typeof nonatomic super unichar IBOutlet IBAction strong weak copy in out inout bycopy byref oneway __strong __weak __block __autoreleasing @private @protected @public @try @property @end @throw @catch @finally @autoreleasepool @synthesize @dynamic @selector @optional @required @encode @package @import @defs @compatibility_alias __bridge __bridge_transfer __bridge_retained __bridge_retain __covariant __contravariant __kindof _Nonnull _Nullable _Null_unspecified __FUNCTION__ __PRETTY_FUNCTION__ __attribute__ getter setter retain unsafe_unretained nonnull nullable null_unspecified null_resettable class instancetype NS_DESIGNATED_INITIALIZER NS_UNAVAILABLE NS_REQUIRES_SUPER NS_RETURNS_INNER_POINTER NS_INLINE NS_AVAILABLE NS_DEPRECATED NS_ENUM NS_OPTIONS NS_SWIFT_UNAVAILABLE NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_END NS_REFINED_FOR_SWIFT NS_SWIFT_NAME NS_SWIFT_NOTHROW NS_DURING NS_HANDLER NS_ENDHANDLER NS_VALUERETURN NS_VOIDRETURN",literal:"false true FALSE TRUE nil YES NO NULL",built_in:"BOOL dispatch_once_t dispatch_queue_t dispatch_sync dispatch_async dispatch_once"},a=/[a-zA-Z@][a-zA-Z0-9_]*/,n="@interface @class @protocol @implementation";return{aliases:["mm","objc","obj-c"],k:r,l:a,i:"</",c:[t,e.CLCM,e.CBCM,e.CNM,e.QSM,{cN:"string",v:[{b:'@"',e:'"',i:"\\n",c:[e.BE]},{b:"'",e:"[^\\\\]'",i:"[^\\\\][^']"}]},{cN:"meta",b:"#",e:"$",c:[{cN:"meta-string",v:[{b:'"',e:'"'},{b:"<",e:">"}]}]},{cN:"class",b:"("+n.split(" ").join("|")+")\\b",e:"({|$)",eE:!0,k:n,l:a,c:[e.UTM]},{b:"\\."+e.UIR,r:0}]}}),e.registerLanguage("perl",function(e){var t="getpwent getservent quotemeta msgrcv scalar kill dbmclose undef lc ma syswrite tr send umask sysopen shmwrite vec qx utime local oct semctl localtime readpipe do return format read sprintf dbmopen pop getpgrp not getpwnam rewinddir qqfileno qw endprotoent wait sethostent bless s|0 opendir continue each sleep endgrent shutdown dump chomp connect getsockname die socketpair close flock exists index shmgetsub for endpwent redo lstat msgctl setpgrp abs exit select print ref gethostbyaddr unshift fcntl syscall goto getnetbyaddr join gmtime symlink semget splice x|0 getpeername recv log setsockopt cos last reverse gethostbyname getgrnam study formline endhostent times chop length gethostent getnetent pack getprotoent getservbyname rand mkdir pos chmod y|0 substr endnetent printf next open msgsnd readdir use unlink getsockopt getpriority rindex wantarray hex system getservbyport endservent int chr untie rmdir prototype tell listen fork shmread ucfirst setprotoent else sysseek link getgrgid shmctl waitpid unpack getnetbyname reset chdir grep split require caller lcfirst until warn while values shift telldir getpwuid my getprotobynumber delete and sort uc defined srand accept package seekdir getprotobyname semop our rename seek if q|0 chroot sysread setpwent no crypt getc chown sqrt write setnetent setpriority foreach tie sin msgget map stat getlogin unless elsif truncate exec keys glob tied closedirioctl socket readlink eval xor readline binmode setservent eof ord bind alarm pipe atan2 getgrent exp time push setgrent gt lt or ne m|0 break given say state when",r={cN:"subst",b:"[$@]\\{",e:"\\}",k:t},a={b:"->{",e:"}"},n={v:[{b:/\$\d/},{b:/[\$%@](\^\w\b|#\w+(::\w+)*|{\w+}|\w+(::\w*)*)/},{b:/[\$%@][^\s\w{]/,r:0}]},i=[e.BE,r,n],s=[n,e.HCM,e.C("^\\=\\w","\\=cut",{eW:!0}),a,{cN:"string",c:i,v:[{b:"q[qwxr]?\\s*\\(",e:"\\)",r:5},{b:"q[qwxr]?\\s*\\[",e:"\\]",r:5},{b:"q[qwxr]?\\s*\\{",e:"\\}",r:5},{b:"q[qwxr]?\\s*\\|",e:"\\|",r:5},{b:"q[qwxr]?\\s*\\<",e:"\\>",r:5},{b:"qw\\s+q",e:"q",r:5},{b:"'",e:"'",c:[e.BE]},{b:'"',e:'"'},{b:"`",e:"`",c:[e.BE]},{b:"{\\w+}",c:[],r:0},{b:"-?\\w+\\s*\\=\\>",c:[],r:0}]},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{b:"(\\/\\/|"+e.RSR+"|\\b(split|return|print|reverse|grep)\\b)\\s*",k:"split return print reverse grep",r:0,c:[e.HCM,{cN:"regexp",b:"(s|tr|y)/(\\\\.|[^/])*/(\\\\.|[^/])*/[a-z]*",r:10},{cN:"regexp",b:"(m|qr)?/",e:"/[a-z]*",c:[e.BE],r:0}]},{cN:"function",bK:"sub",e:"(\\s*\\(.*?\\))?[;{]",eE:!0,r:5,c:[e.TM]},{b:"-\\w\\b",r:0},{b:"^__DATA__$",e:"^__END__$",sL:"mojolicious",c:[{b:"^@@.*",e:"$",cN:"comment"}]}];return r.c=s,a.c=s,{aliases:["pl","pm"],l:/[\w\.]+/,k:t,c:s}}),e.registerLanguage("php",function(e){var t={b:"\\$+[a-zA-Z_-ÿ][a-zA-Z0-9_-ÿ]*"},r={cN:"meta",b:/<\?(php)?|\?>/},a={cN:"string",c:[e.BE,r],v:[{b:'b"',e:'"'},{b:"b'",e:"'"},e.inherit(e.ASM,{i:null}),e.inherit(e.QSM,{i:null})]},n={v:[e.BNM,e.CNM]};return{aliases:["php3","php4","php5","php6"],cI:!0,k:"and include_once list abstract global private echo interface as static endswitch array null if endwhile or const for endforeach self var while isset public protected exit foreach throw elseif include __FILE__ empty require_once do xor return parent clone use __CLASS__ __LINE__ else break print eval new catch __METHOD__ case exception default die require __FUNCTION__ enddeclare final try switch continue endfor endif declare unset true false trait goto instanceof insteadof __DIR__ __NAMESPACE__ yield finally",c:[e.HCM,e.C("//","$",{c:[r]}),e.C("/\\*","\\*/",{c:[{cN:"doctag",b:"@[A-Za-z]+"}]}),e.C("__halt_compiler.+?;",!1,{eW:!0,k:"__halt_compiler",l:e.UIR}),{cN:"string",b:/<<<['"]?\w+['"]?$/,e:/^\w+;?$/,c:[e.BE,{cN:"subst",v:[{b:/\$\w+/},{b:/\{\$/,e:/\}/}]}]},r,{cN:"keyword",b:/\$this\b/},t,{b:/(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/},{cN:"function",bK:"function",e:/[;{]/,eE:!0,i:"\\$|\\[|%",c:[e.UTM,{cN:"params",b:"\\(",e:"\\)",c:["self",t,e.CBCM,a,n]}]},{cN:"class",bK:"class interface",e:"{",eE:!0,i:/[:\(\$"]/,c:[{bK:"extends implements"},e.UTM]},{bK:"namespace",e:";",i:/[\.']/,c:[e.UTM]},{bK:"use",e:";",c:[e.UTM]},{b:"=>"},a,n]}}),e.registerLanguage("python",function(e){var t={cN:"meta",b:/^(>>>|\.\.\.) /},r={cN:"string",c:[e.BE],v:[{b:/(u|b)?r?'''/,e:/'''/,c:[t],r:10},{b:/(u|b)?r?"""/,e:/"""/,c:[t],r:10},{b:/(u|r|ur)'/,e:/'/,r:10},{b:/(u|r|ur)"/,e:/"/,r:10},{b:/(b|br)'/,e:/'/},{b:/(b|br)"/,e:/"/},e.ASM,e.QSM]},a={cN:"number",r:0,v:[{b:e.BNR+"[lLjJ]?"},{b:"\\b(0o[0-7]+)[lLjJ]?"},{b:e.CNR+"[lLjJ]?"}]},n={cN:"params",b:/\(/,e:/\)/,c:["self",t,a,r]};return{aliases:["py","gyp"],k:{keyword:"and elif is global as in if from raise for except finally print import pass return exec else break not with class assert yield try while continue del or def lambda async await nonlocal|10 None True False",built_in:"Ellipsis NotImplemented"},i:/(<\/|->|\?)|=>/,c:[t,a,r,e.HCM,{v:[{cN:"function",bK:"def"},{cN:"class",bK:"class"}],e:/:/,i:/[${=;\n,]/,c:[e.UTM,n,{b:/->/,eW:!0,k:"None"}]},{cN:"meta",b:/^[\t ]*@/,e:/$/},{b:/\b(print|exec)\(/}]}}),e.registerLanguage("ruby",function(e){var t="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?",r={keyword:"and then defined module in return redo if BEGIN retry end for self when next until do begin unless END rescue else break undef not super class case require yield alias while ensure elsif or include attr_reader attr_writer attr_accessor",literal:"true false nil"},a={cN:"doctag",b:"@[A-Za-z]+"},n={b:"#<",e:">"},i=[e.C("#","$",{c:[a]}),e.C("^\\=begin","^\\=end",{c:[a],r:10}),e.C("^__END__","\\n$")],s={cN:"subst",b:"#\\{",e:"}",k:r},c={cN:"string",c:[e.BE,s],v:[{b:/'/,e:/'/},{b:/"/,e:/"/},{b:/`/,e:/`/},{b:"%[qQwWx]?\\(",e:"\\)"},{b:"%[qQwWx]?\\[",e:"\\]"},{b:"%[qQwWx]?{",e:"}"},{b:"%[qQwWx]?<",e:">"},{b:"%[qQwWx]?/",e:"/"},{b:"%[qQwWx]?%",e:"%"},{b:"%[qQwWx]?-",e:"-"},{b:"%[qQwWx]?\\|",e:"\\|"},{b:/\B\?(\\\d{1,3}|\\x[A-Fa-f0-9]{1,2}|\\u[A-Fa-f0-9]{4}|\\?\S)\b/},{b:/<<(-?)\w+$/,e:/^\s*\w+$/}]},o={cN:"params",b:"\\(",e:"\\)",endsParent:!0,k:r},l=[c,n,{cN:"class",bK:"class module",e:"$|;",i:/=/,c:[e.inherit(e.TM,{b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?" }),{b:"<\\s*",c:[{b:"("+e.IR+"::)?"+e.IR}]}].concat(i)},{cN:"function",bK:"def",e:"$|;",c:[e.inherit(e.TM,{b:t}),o].concat(i)},{b:e.IR+"::"},{cN:"symbol",b:e.UIR+"(\\!|\\?)?:",r:0},{cN:"symbol",b:":(?!\\s)",c:[c,{b:t}],r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},{cN:"params",b:/\|/,e:/\|/,k:r},{b:"("+e.RSR+"|unless)\\s*",c:[n,{cN:"regexp",c:[e.BE,s],i:/\n/,v:[{b:"/",e:"/[a-z]*"},{b:"%r{",e:"}[a-z]*"},{b:"%r\\(",e:"\\)[a-z]*"},{b:"%r!",e:"![a-z]*"},{b:"%r\\[",e:"\\][a-z]*"}]}].concat(i),r:0}].concat(i);s.c=l,o.c=l;var u="[>?]>",d="[\\w#]+\\(\\w+\\):\\d+:\\d+>",b="(\\w+-)?\\d+\\.\\d+\\.\\d(p\\d+)?[^>]+>",p=[{b:/^\s*=>/,starts:{e:"$",c:l}},{cN:"meta",b:"^("+u+"|"+d+"|"+b+")",starts:{e:"$",c:l}}];return{aliases:["rb","gemspec","podspec","thor","irb"],k:r,i:/\/\*/,c:i.concat(p).concat(l)}}),e.registerLanguage("sql",function(e){var t=e.C("--","$");return{cI:!0,i:/[<>{}*#]/,c:[{bK:"begin end start commit rollback savepoint lock alter create drop rename call delete do handler insert load replace select truncate update set show pragma grant merge describe use explain help declare prepare execute deallocate release unlock purge reset change stop analyze cache flush optimize repair kill install uninstall checksum restore check backup revoke comment",e:/;/,eW:!0,l:/[\w\.]+/,k:{keyword:"abort abs absolute acc acce accep accept access accessed accessible account acos action activate add addtime admin administer advanced advise aes_decrypt aes_encrypt after agent aggregate ali alia alias allocate allow alter always analyze ancillary and any anydata anydataset anyschema anytype apply archive archived archivelog are as asc ascii asin assembly assertion associate asynchronous at atan atn2 attr attri attrib attribu attribut attribute attributes audit authenticated authentication authid authors auto autoallocate autodblink autoextend automatic availability avg backup badfile basicfile before begin beginning benchmark between bfile bfile_base big bigfile bin binary_double binary_float binlog bit_and bit_count bit_length bit_or bit_xor bitmap blob_base block blocksize body both bound buffer_cache buffer_pool build bulk by byte byteordermark bytes cache caching call calling cancel capacity cascade cascaded case cast catalog category ceil ceiling chain change changed char_base char_length character_length characters characterset charindex charset charsetform charsetid check checksum checksum_agg child choose chr chunk class cleanup clear client clob clob_base clone close cluster_id cluster_probability cluster_set clustering coalesce coercibility col collate collation collect colu colum column column_value columns columns_updated comment commit compact compatibility compiled complete composite_limit compound compress compute concat concat_ws concurrent confirm conn connec connect connect_by_iscycle connect_by_isleaf connect_by_root connect_time connection consider consistent constant constraint constraints constructor container content contents context contributors controlfile conv convert convert_tz corr corr_k corr_s corresponding corruption cos cost count count_big counted covar_pop covar_samp cpu_per_call cpu_per_session crc32 create creation critical cross cube cume_dist curdate current current_date current_time current_timestamp current_user cursor curtime customdatum cycle data database databases datafile datafiles datalength date_add date_cache date_format date_sub dateadd datediff datefromparts datename datepart datetime2fromparts day day_to_second dayname dayofmonth dayofweek dayofyear days db_role_change dbtimezone ddl deallocate declare decode decompose decrement decrypt deduplicate def defa defau defaul default defaults deferred defi defin define degrees delayed delegate delete delete_all delimited demand dense_rank depth dequeue des_decrypt des_encrypt des_key_file desc descr descri describ describe descriptor deterministic diagnostics difference dimension direct_load directory disable disable_all disallow disassociate discardfile disconnect diskgroup distinct distinctrow distribute distributed div do document domain dotnet double downgrade drop dumpfile duplicate duration each edition editionable editions element ellipsis else elsif elt empty enable enable_all enclosed encode encoding encrypt end end-exec endian enforced engine engines enqueue enterprise entityescaping eomonth error errors escaped evalname evaluate event eventdata events except exception exceptions exchange exclude excluding execu execut execute exempt exists exit exp expire explain export export_set extended extent external external_1 external_2 externally extract failed failed_login_attempts failover failure far fast feature_set feature_value fetch field fields file file_name_convert filesystem_like_logging final finish first first_value fixed flash_cache flashback floor flush following follows for forall force form forma format found found_rows freelist freelists freepools fresh from from_base64 from_days ftp full function general generated get get_format get_lock getdate getutcdate global global_name globally go goto grant grants greatest group group_concat group_id grouping grouping_id groups gtid_subtract guarantee guard handler hash hashkeys having hea head headi headin heading heap help hex hierarchy high high_priority hosts hour http id ident_current ident_incr ident_seed identified identity idle_time if ifnull ignore iif ilike ilm immediate import in include including increment index indexes indexing indextype indicator indices inet6_aton inet6_ntoa inet_aton inet_ntoa infile initial initialized initially initrans inmemory inner innodb input insert install instance instantiable instr interface interleaved intersect into invalidate invisible is is_free_lock is_ipv4 is_ipv4_compat is_not is_not_null is_used_lock isdate isnull isolation iterate java join json json_exists keep keep_duplicates key keys kill language large last last_day last_insert_id last_value lax lcase lead leading least leaves left len lenght length less level levels library like like2 like4 likec limit lines link list listagg little ln load load_file lob lobs local localtime localtimestamp locate locator lock locked log log10 log2 logfile logfiles logging logical logical_reads_per_call logoff logon logs long loop low low_priority lower lpad lrtrim ltrim main make_set makedate maketime managed management manual map mapping mask master master_pos_wait match matched materialized max maxextents maximize maxinstances maxlen maxlogfiles maxloghistory maxlogmembers maxsize maxtrans md5 measures median medium member memcompress memory merge microsecond mid migration min minextents minimum mining minus minute minvalue missing mod mode model modification modify module monitoring month months mount move movement multiset mutex name name_const names nan national native natural nav nchar nclob nested never new newline next nextval no no_write_to_binlog noarchivelog noaudit nobadfile nocheck nocompress nocopy nocycle nodelay nodiscardfile noentityescaping noguarantee nokeep nologfile nomapping nomaxvalue nominimize nominvalue nomonitoring none noneditionable nonschema noorder nopr nopro noprom nopromp noprompt norely noresetlogs noreverse normal norowdependencies noschemacheck noswitch not nothing notice notrim novalidate now nowait nth_value nullif nulls num numb numbe nvarchar nvarchar2 object ocicoll ocidate ocidatetime ociduration ociinterval ociloblocator ocinumber ociref ocirefcursor ocirowid ocistring ocitype oct octet_length of off offline offset oid oidindex old on online only opaque open operations operator optimal optimize option optionally or oracle oracle_date oradata ord ordaudio orddicom orddoc order ordimage ordinality ordvideo organization orlany orlvary out outer outfile outline output over overflow overriding package pad parallel parallel_enable parameters parent parse partial partition partitions pascal passing password password_grace_time password_lock_time password_reuse_max password_reuse_time password_verify_function patch path patindex pctincrease pctthreshold pctused pctversion percent percent_rank percentile_cont percentile_disc performance period period_add period_diff permanent physical pi pipe pipelined pivot pluggable plugin policy position post_transaction pow power pragma prebuilt precedes preceding precision prediction prediction_cost prediction_details prediction_probability prediction_set prepare present preserve prior priority private private_sga privileges procedural procedure procedure_analyze processlist profiles project prompt protection public publishingservername purge quarter query quick quiesce quota quotename radians raise rand range rank raw read reads readsize rebuild record records recover recovery recursive recycle redo reduced ref reference referenced references referencing refresh regexp_like register regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy reject rekey relational relative relaylog release release_lock relies_on relocate rely rem remainder rename repair repeat replace replicate replication required reset resetlogs resize resource respect restore restricted result result_cache resumable resume retention return returning returns reuse reverse revoke right rlike role roles rollback rolling rollup round row row_count rowdependencies rowid rownum rows rtrim rules safe salt sample save savepoint sb1 sb2 sb4 scan schema schemacheck scn scope scroll sdo_georaster sdo_topo_geometry search sec_to_time second section securefile security seed segment select self sequence sequential serializable server servererror session session_user sessions_per_user set sets settings sha sha1 sha2 share shared shared_pool short show shrink shutdown si_averagecolor si_colorhistogram si_featurelist si_positionalcolor si_stillimage si_texture siblings sid sign sin size size_t sizes skip slave sleep smalldatetimefromparts smallfile snapshot some soname sort soundex source space sparse spfile split sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_small_result sql_variant_property sqlcode sqldata sqlerror sqlname sqlstate sqrt square standalone standby start starting startup statement static statistics stats_binomial_test stats_crosstab stats_ks_test stats_mode stats_mw_test stats_one_way_anova stats_t_test_ stats_t_test_indep stats_t_test_one stats_t_test_paired stats_wsr_test status std stddev stddev_pop stddev_samp stdev stop storage store stored str str_to_date straight_join strcmp strict string struct stuff style subdate subpartition subpartitions substitutable substr substring subtime subtring_index subtype success sum suspend switch switchoffset switchover sync synchronous synonym sys sys_xmlagg sysasm sysaux sysdate sysdatetimeoffset sysdba sysoper system system_user sysutcdatetime table tables tablespace tan tdo template temporary terminated tertiary_weights test than then thread through tier ties time time_format time_zone timediff timefromparts timeout timestamp timestampadd timestampdiff timezone_abbr timezone_minute timezone_region to to_base64 to_date to_days to_seconds todatetimeoffset trace tracking transaction transactional translate translation treat trigger trigger_nestlevel triggers trim truncate try_cast try_convert try_parse type ub1 ub2 ub4 ucase unarchived unbounded uncompress under undo unhex unicode uniform uninstall union unique unix_timestamp unknown unlimited unlock unpivot unrecoverable unsafe unsigned until untrusted unusable unused update updated upgrade upped upper upsert url urowid usable usage use use_stored_outlines user user_data user_resources users using utc_date utc_timestamp uuid uuid_short validate validate_password_strength validation valist value values var var_samp varcharc vari varia variab variabl variable variables variance varp varraw varrawc varray verify version versions view virtual visible void wait wallet warning warnings week weekday weekofyear wellformed when whene whenev wheneve whenever where while whitespace with within without work wrapped xdb xml xmlagg xmlattributes xmlcast xmlcolattval xmlelement xmlexists xmlforest xmlindex xmlnamespaces xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltype xor year year_to_month years yearweek",literal:"true false null",built_in:"array bigint binary bit blob boolean char character date dec decimal float int int8 integer interval number numeric real record serial serial8 smallint text varchar varying void"},c:[{cN:"string",b:"'",e:"'",c:[e.BE,{b:"''"}]},{cN:"string",b:'"',e:'"',c:[e.BE,{b:'""'}]},{cN:"string",b:"`",e:"`",c:[e.BE]},e.CNM,e.CBCM,t]},e.CBCM,t]}}),e});dependencies/js/modernizr.js000064400000147025151676726760012215 0ustar00/*! * Modernizr v2.8.3 * www.modernizr.com * * Copyright (c) Faruk Ates, Paul Irish, Alex Sexton * Available under the BSD and MIT licenses: www.modernizr.com/license/ */ /* * Modernizr tests which native CSS3 and HTML5 features are available in * the current UA and makes the results available to you in two ways: * as properties on a global Modernizr object, and as classes on the * <html> element. This information allows you to progressively enhance * your pages with a granular level of control over the experience. * * Modernizr has an optional (not included) conditional resource loader * called Modernizr.load(), based on Yepnope.js (yepnopejs.com). * To get a build that includes Modernizr.load(), as well as choosing * which tests to include, go to www.modernizr.com/download/ * * Authors Faruk Ates, Paul Irish, Alex Sexton * Contributors Ryan Seddon, Ben Alman */ window.Modernizr = (function( window, document, undefined ) { var version = '2.8.3', Modernizr = {}, /*>>cssclasses*/ // option for enabling the HTML classes to be added enableClasses = true, /*>>cssclasses*/ docElement = document.documentElement, /** * Create our "modernizr" element that we do most feature tests on. */ mod = 'modernizr', modElem = document.createElement(mod), mStyle = modElem.style, /** * Create the input element for various Web Forms feature tests. */ inputElem /*>>inputelem*/ = document.createElement('input') /*>>inputelem*/ , /*>>smile*/ smile = ':)', /*>>smile*/ toString = {}.toString, // TODO :: make the prefixes more granular /*>>prefixes*/ // List of property values to set for css tests. See ticket #21 prefixes = ' -webkit- -moz- -o- -ms- '.split(' '), /*>>prefixes*/ /*>>domprefixes*/ // Following spec is to expose vendor-specific style properties as: // elem.style.WebkitBorderRadius // and the following would be incorrect: // elem.style.webkitBorderRadius // Webkit ghosts their properties in lowercase but Opera & Moz do not. // Microsoft uses a lowercase `ms` instead of the correct `Ms` in IE8+ // erik.eae.net/archives/2008/03/10/21.48.10/ // More here: github.com/Modernizr/Modernizr/issues/issue/21 omPrefixes = 'Webkit Moz O ms', cssomPrefixes = omPrefixes.split(' '), domPrefixes = omPrefixes.toLowerCase().split(' '), /*>>domprefixes*/ /*>>ns*/ ns = {'svg': 'http://www.w3.org/2000/svg'}, /*>>ns*/ tests = {}, inputs = {}, attrs = {}, classes = [], slice = classes.slice, featureName, // used in testing loop /*>>teststyles*/ // Inject element with style element and some CSS rules injectElementWithStyles = function( rule, callback, nodes, testnames ) { var style, ret, node, docOverflow, div = document.createElement('div'), // After page load injecting a fake body doesn't work so check if body exists body = document.body, // IE6 and 7 won't return offsetWidth or offsetHeight unless it's in the body element, so we fake it. fakeBody = body || document.createElement('body'); if ( parseInt(nodes, 10) ) { // In order not to give false positives we create a node for each test // This also allows the method to scale for unspecified uses while ( nodes-- ) { node = document.createElement('div'); node.id = testnames ? testnames[nodes] : mod + (nodes + 1); div.appendChild(node); } } // <style> elements in IE6-9 are considered 'NoScope' elements and therefore will be removed // when injected with innerHTML. To get around this you need to prepend the 'NoScope' element // with a 'scoped' element, in our case the soft-hyphen entity as it won't mess with our measurements. // msdn.microsoft.com/en-us/library/ms533897%28VS.85%29.aspx // Documents served as xml will throw if using ­ so use xml friendly encoded version. See issue #277 style = ['­','<style id="s', mod, '">', rule, '</style>'].join(''); div.id = mod; // IE6 will false positive on some tests due to the style element inside the test div somehow interfering offsetHeight, so insert it into body or fakebody. // Opera will act all quirky when injecting elements in documentElement when page is served as xml, needs fakebody too. #270 (body ? div : fakeBody).innerHTML += style; fakeBody.appendChild(div); if ( !body ) { //avoid crashing IE8, if background image is used fakeBody.style.background = ''; //Safari 5.13/5.1.4 OSX stops loading if ::-webkit-scrollbar is used and scrollbars are visible fakeBody.style.overflow = 'hidden'; docOverflow = docElement.style.overflow; docElement.style.overflow = 'hidden'; docElement.appendChild(fakeBody); } ret = callback(div, rule); // If this is done after page load we don't want to remove the body so check if body exists if ( !body ) { fakeBody.parentNode.removeChild(fakeBody); docElement.style.overflow = docOverflow; } else { div.parentNode.removeChild(div); } return !!ret; }, /*>>teststyles*/ /*>>mq*/ // adapted from matchMedia polyfill // by Scott Jehl and Paul Irish // gist.github.com/786768 testMediaQuery = function( mq ) { var matchMedia = window.matchMedia || window.msMatchMedia; if ( matchMedia ) { return matchMedia(mq) && matchMedia(mq).matches || false; } var bool; injectElementWithStyles('@media ' + mq + ' { #' + mod + ' { position: absolute; } }', function( node ) { bool = (window.getComputedStyle ? getComputedStyle(node, null) : node.currentStyle)['position'] == 'absolute'; }); return bool; }, /*>>mq*/ /*>>hasevent*/ // // isEventSupported determines if a given element supports the given event // kangax.github.com/iseventsupported/ // // The following results are known incorrects: // Modernizr.hasEvent("webkitTransitionEnd", elem) // false negative // Modernizr.hasEvent("textInput") // in Webkit. github.com/Modernizr/Modernizr/issues/333 // ... isEventSupported = (function() { var TAGNAMES = { 'select': 'input', 'change': 'input', 'submit': 'form', 'reset': 'form', 'error': 'img', 'load': 'img', 'abort': 'img' }; function isEventSupported( eventName, element ) { element = element || document.createElement(TAGNAMES[eventName] || 'div'); eventName = 'on' + eventName; // When using `setAttribute`, IE skips "unload", WebKit skips "unload" and "resize", whereas `in` "catches" those var isSupported = eventName in element; if ( !isSupported ) { // If it has no `setAttribute` (i.e. doesn't implement Node interface), try generic element if ( !element.setAttribute ) { element = document.createElement('div'); } if ( element.setAttribute && element.removeAttribute ) { element.setAttribute(eventName, ''); isSupported = is(element[eventName], 'function'); // If property was created, "remove it" (by setting value to `undefined`) if ( !is(element[eventName], 'undefined') ) { element[eventName] = undefined; } element.removeAttribute(eventName); } } element = null; return isSupported; } return isEventSupported; })(), /*>>hasevent*/ // TODO :: Add flag for hasownprop ? didn't last time // hasOwnProperty shim by kangax needed for Safari 2.0 support _hasOwnProperty = ({}).hasOwnProperty, hasOwnProp; if ( !is(_hasOwnProperty, 'undefined') && !is(_hasOwnProperty.call, 'undefined') ) { hasOwnProp = function (object, property) { return _hasOwnProperty.call(object, property); }; } else { hasOwnProp = function (object, property) { /* yes, this can give false positives/negatives, but most of the time we don't care about those */ return ((property in object) && is(object.constructor.prototype[property], 'undefined')); }; } // Adapted from ES5-shim https://github.com/kriskowal/es5-shim/blob/master/es5-shim.js // es5.github.com/#x15.3.4.5 if (!Function.prototype.bind) { Function.prototype.bind = function bind(that) { var target = this; if (typeof target != "function") { throw new TypeError(); } var args = slice.call(arguments, 1), bound = function () { if (this instanceof bound) { var F = function(){}; F.prototype = target.prototype; var self = new F(); var result = target.apply( self, args.concat(slice.call(arguments)) ); if (Object(result) === result) { return result; } return self; } else { return target.apply( that, args.concat(slice.call(arguments)) ); } }; return bound; }; } /** * setCss applies given styles to the Modernizr DOM node. */ function setCss( str ) { mStyle.cssText = str; } /** * setCssAll extrapolates all vendor-specific css strings. */ function setCssAll( str1, str2 ) { return setCss(prefixes.join(str1 + ';') + ( str2 || '' )); } /** * is returns a boolean for if typeof obj is exactly type. */ function is( obj, type ) { return typeof obj === type; } /** * contains returns a boolean for if substr is found within str. */ function contains( str, substr ) { return !!~('' + str).indexOf(substr); } /*>>testprop*/ // testProps is a generic CSS / DOM property test. // In testing support for a given CSS property, it's legit to test: // `elem.style[styleName] !== undefined` // If the property is supported it will return an empty string, // if unsupported it will return undefined. // We'll take advantage of this quick test and skip setting a style // on our modernizr element, but instead just testing undefined vs // empty string. // Because the testing of the CSS property names (with "-", as // opposed to the camelCase DOM properties) is non-portable and // non-standard but works in WebKit and IE (but not Gecko or Opera), // we explicitly reject properties with dashes so that authors // developing in WebKit or IE first don't end up with // browser-specific content by accident. function testProps( props, prefixed ) { for ( var i in props ) { var prop = props[i]; if ( !contains(prop, "-") && mStyle[prop] !== undefined ) { return prefixed == 'pfx' ? prop : true; } } return false; } /*>>testprop*/ // TODO :: add testDOMProps /** * testDOMProps is a generic DOM property test; if a browser supports * a certain property, it won't return undefined for it. */ function testDOMProps( props, obj, elem ) { for ( var i in props ) { var item = obj[props[i]]; if ( item !== undefined) { // return the property name as a string if (elem === false) return props[i]; // let's bind a function if (is(item, 'function')){ // default to autobind unless override return item.bind(elem || obj); } // return the unbound function or obj or value return item; } } return false; } /*>>testallprops*/ /** * testPropsAll tests a list of DOM properties we want to check against. * We specify literally ALL possible (known and/or likely) properties on * the element including the non-vendor prefixed one, for forward- * compatibility. */ function testPropsAll( prop, prefixed, elem ) { var ucProp = prop.charAt(0).toUpperCase() + prop.slice(1), props = (prop + ' ' + cssomPrefixes.join(ucProp + ' ') + ucProp).split(' '); // did they call .prefixed('boxSizing') or are we just testing a prop? if(is(prefixed, "string") || is(prefixed, "undefined")) { return testProps(props, prefixed); // otherwise, they called .prefixed('requestAnimationFrame', window[, elem]) } else { props = (prop + ' ' + (domPrefixes).join(ucProp + ' ') + ucProp).split(' '); return testDOMProps(props, prefixed, elem); } } /*>>testallprops*/ /** * Tests * ----- */ // The *new* flexbox // dev.w3.org/csswg/css3-flexbox tests['flexbox'] = function() { return testPropsAll('flexWrap'); }; // The *old* flexbox // www.w3.org/TR/2009/WD-css3-flexbox-20090723/ tests['flexboxlegacy'] = function() { return testPropsAll('boxDirection'); }; // On the S60 and BB Storm, getContext exists, but always returns undefined // so we actually have to call getContext() to verify // github.com/Modernizr/Modernizr/issues/issue/97/ tests['canvas'] = function() { var elem = document.createElement('canvas'); return !!(elem.getContext && elem.getContext('2d')); }; tests['canvastext'] = function() { return !!(Modernizr['canvas'] && is(document.createElement('canvas').getContext('2d').fillText, 'function')); }; // webk.it/70117 is tracking a legit WebGL feature detect proposal // We do a soft detect which may false positive in order to avoid // an expensive context creation: bugzil.la/732441 tests['webgl'] = function() { return !!window.WebGLRenderingContext; }; /* * The Modernizr.touch test only indicates if the browser supports * touch events, which does not necessarily reflect a touchscreen * device, as evidenced by tablets running Windows 7 or, alas, * the Palm Pre / WebOS (touch) phones. * * Additionally, Chrome (desktop) used to lie about its support on this, * but that has since been rectified: crbug.com/36415 * * We also test for Firefox 4 Multitouch Support. * * For more info, see: modernizr.github.com/Modernizr/touch.html */ tests['touch'] = function() { var bool; if(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) { bool = true; } else { injectElementWithStyles(['@media (',prefixes.join('touch-enabled),('),mod,')','{#modernizr{top:9px;position:absolute}}'].join(''), function( node ) { bool = node.offsetTop === 9; }); } return bool; }; // geolocation is often considered a trivial feature detect... // Turns out, it's quite tricky to get right: // // Using !!navigator.geolocation does two things we don't want. It: // 1. Leaks memory in IE9: github.com/Modernizr/Modernizr/issues/513 // 2. Disables page caching in WebKit: webk.it/43956 // // Meanwhile, in Firefox < 8, an about:config setting could expose // a false positive that would throw an exception: bugzil.la/688158 tests['geolocation'] = function() { return 'geolocation' in navigator; }; tests['postmessage'] = function() { return !!window.postMessage; }; // Chrome incognito mode used to throw an exception when using openDatabase // It doesn't anymore. tests['websqldatabase'] = function() { return !!window.openDatabase; }; // Vendors had inconsistent prefixing with the experimental Indexed DB: // - Webkit's implementation is accessible through webkitIndexedDB // - Firefox shipped moz_indexedDB before FF4b9, but since then has been mozIndexedDB // For speed, we don't test the legacy (and beta-only) indexedDB tests['indexedDB'] = function() { return !!testPropsAll("indexedDB", window); }; // documentMode logic from YUI to filter out IE8 Compat Mode // which false positives. tests['hashchange'] = function() { return isEventSupported('hashchange', window) && (document.documentMode === undefined || document.documentMode > 7); }; // Per 1.6: // This used to be Modernizr.historymanagement but the longer // name has been deprecated in favor of a shorter and property-matching one. // The old API is still available in 1.6, but as of 2.0 will throw a warning, // and in the first release thereafter disappear entirely. tests['history'] = function() { return !!(window.history && history.pushState); }; tests['draganddrop'] = function() { var div = document.createElement('div'); return ('draggable' in div) || ('ondragstart' in div && 'ondrop' in div); }; // FF3.6 was EOL'ed on 4/24/12, but the ESR version of FF10 // will be supported until FF19 (2/12/13), at which time, ESR becomes FF17. // FF10 still uses prefixes, so check for it until then. // for more ESR info, see: mozilla.org/en-US/firefox/organizations/faq/ tests['websockets'] = function() { return 'WebSocket' in window || 'MozWebSocket' in window; }; // css-tricks.com/rgba-browser-support/ tests['rgba'] = function() { // Set an rgba() color and check the returned value setCss('background-color:rgba(150,255,150,.5)'); return contains(mStyle.backgroundColor, 'rgba'); }; tests['hsla'] = function() { // Same as rgba(), in fact, browsers re-map hsla() to rgba() internally, // except IE9 who retains it as hsla setCss('background-color:hsla(120,40%,100%,.5)'); return contains(mStyle.backgroundColor, 'rgba') || contains(mStyle.backgroundColor, 'hsla'); }; tests['multiplebgs'] = function() { // Setting multiple images AND a color on the background shorthand property // and then querying the style.background property value for the number of // occurrences of "url(" is a reliable method for detecting ACTUAL support for this! setCss('background:url(https://),url(https://),red url(https://)'); // If the UA supports multiple backgrounds, there should be three occurrences // of the string "url(" in the return value for elemStyle.background return (/(url\s*\(.*?){3}/).test(mStyle.background); }; // this will false positive in Opera Mini // github.com/Modernizr/Modernizr/issues/396 tests['backgroundsize'] = function() { return testPropsAll('backgroundSize'); }; tests['borderimage'] = function() { return testPropsAll('borderImage'); }; // Super comprehensive table about all the unique implementations of // border-radius: muddledramblings.com/table-of-css3-border-radius-compliance tests['borderradius'] = function() { return testPropsAll('borderRadius'); }; // WebOS unfortunately false positives on this test. tests['boxshadow'] = function() { return testPropsAll('boxShadow'); }; // FF3.0 will false positive on this test tests['textshadow'] = function() { return document.createElement('div').style.textShadow === ''; }; tests['opacity'] = function() { // Browsers that actually have CSS Opacity implemented have done so // according to spec, which means their return values are within the // range of [0.0,1.0] - including the leading zero. setCssAll('opacity:.55'); // The non-literal . in this regex is intentional: // German Chrome returns this value as 0,55 // github.com/Modernizr/Modernizr/issues/#issue/59/comment/516632 return (/^0.55$/).test(mStyle.opacity); }; // Note, Android < 4 will pass this test, but can only animate // a single property at a time // goo.gl/v3V4Gp tests['cssanimations'] = function() { return testPropsAll('animationName'); }; tests['csscolumns'] = function() { return testPropsAll('columnCount'); }; tests['cssgradients'] = function() { /** * For CSS Gradients syntax, please see: * webkit.org/blog/175/introducing-css-gradients/ * developer.mozilla.org/en/CSS/-moz-linear-gradient * developer.mozilla.org/en/CSS/-moz-radial-gradient * dev.w3.org/csswg/css3-images/#gradients- */ var str1 = 'background-image:', str2 = 'gradient(linear,left top,right bottom,from(#9f9),to(white));', str3 = 'linear-gradient(left top,#9f9, white);'; setCss( // legacy webkit syntax (FIXME: remove when syntax not in use anymore) (str1 + '-webkit- '.split(' ').join(str2 + str1) + // standard syntax // trailing 'background-image:' prefixes.join(str3 + str1)).slice(0, -str1.length) ); return contains(mStyle.backgroundImage, 'gradient'); }; tests['cssreflections'] = function() { return testPropsAll('boxReflect'); }; tests['csstransforms'] = function() { return !!testPropsAll('transform'); }; tests['csstransforms3d'] = function() { var ret = !!testPropsAll('perspective'); // Webkit's 3D transforms are passed off to the browser's own graphics renderer. // It works fine in Safari on Leopard and Snow Leopard, but not in Chrome in // some conditions. As a result, Webkit typically recognizes the syntax but // will sometimes throw a false positive, thus we must do a more thorough check: if ( ret && 'webkitPerspective' in docElement.style ) { // Webkit allows this media query to succeed only if the feature is enabled. // `@media (transform-3d),(-webkit-transform-3d){ ... }` injectElementWithStyles('@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}', function( node, rule ) { ret = node.offsetLeft === 9 && node.offsetHeight === 3; }); } return ret; }; tests['csstransitions'] = function() { return testPropsAll('transition'); }; /*>>fontface*/ // @font-face detection routine by Diego Perini // javascript.nwbox.com/CSSSupport/ // false positives: // WebOS github.com/Modernizr/Modernizr/issues/342 // WP7 github.com/Modernizr/Modernizr/issues/538 tests['fontface'] = function() { var bool; injectElementWithStyles('@font-face {font-family:"font";src:url("https://")}', function( node, rule ) { var style = document.getElementById('smodernizr'), sheet = style.sheet || style.styleSheet, cssText = sheet ? (sheet.cssRules && sheet.cssRules[0] ? sheet.cssRules[0].cssText : sheet.cssText || '') : ''; bool = /src/i.test(cssText) && cssText.indexOf(rule.split(' ')[0]) === 0; }); return bool; }; /*>>fontface*/ // CSS generated content detection tests['generatedcontent'] = function() { var bool; injectElementWithStyles(['#',mod,'{font:0/0 a}#',mod,':after{content:"',smile,'";visibility:hidden;font:3px/1 a}'].join(''), function( node ) { bool = node.offsetHeight >= 3; }); return bool; }; // These tests evaluate support of the video/audio elements, as well as // testing what types of content they support. // // We're using the Boolean constructor here, so that we can extend the value // e.g. Modernizr.video // true // Modernizr.video.ogg // 'probably' // // Codec values from : github.com/NielsLeenheer/html5test/blob/9106a8/index.html#L845 // thx to NielsLeenheer and zcorpan // Note: in some older browsers, "no" was a return value instead of empty string. // It was live in FF3.5.0 and 3.5.1, but fixed in 3.5.2 // It was also live in Safari 4.0.0 - 4.0.4, but fixed in 4.0.5 tests['video'] = function() { var elem = document.createElement('video'), bool = false; // IE9 Running on Windows Server SKU can cause an exception to be thrown, bug #224 try { if ( bool = !!elem.canPlayType ) { bool = new Boolean(bool); bool.ogg = elem.canPlayType('video/ogg; codecs="theora"') .replace(/^no$/,''); // Without QuickTime, this value will be `undefined`. github.com/Modernizr/Modernizr/issues/546 bool.h264 = elem.canPlayType('video/mp4; codecs="avc1.42E01E"') .replace(/^no$/,''); bool.webm = elem.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,''); } } catch(e) { } return bool; }; tests['audio'] = function() { var elem = document.createElement('audio'), bool = false; try { if ( bool = !!elem.canPlayType ) { bool = new Boolean(bool); bool.ogg = elem.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,''); bool.mp3 = elem.canPlayType('audio/mpeg;') .replace(/^no$/,''); // Mimetypes accepted: // developer.mozilla.org/En/Media_formats_supported_by_the_audio_and_video_elements // bit.ly/iphoneoscodecs bool.wav = elem.canPlayType('audio/wav; codecs="1"') .replace(/^no$/,''); bool.m4a = ( elem.canPlayType('audio/x-m4a;') || elem.canPlayType('audio/aac;')) .replace(/^no$/,''); } } catch(e) { } return bool; }; // In FF4, if disabled, window.localStorage should === null. // Normally, we could not test that directly and need to do a // `('localStorage' in window) && ` test first because otherwise Firefox will // throw bugzil.la/365772 if cookies are disabled // Also in iOS5 Private Browsing mode, attempting to use localStorage.setItem // will throw the exception: // QUOTA_EXCEEDED_ERRROR DOM Exception 22. // Peculiarly, getItem and removeItem calls do not throw. // Because we are forced to try/catch this, we'll go aggressive. // Just FWIW: IE8 Compat mode supports these features completely: // www.quirksmode.org/dom/html5.html // But IE8 doesn't support either with local files tests['localstorage'] = function() { try { localStorage.setItem(mod, mod); localStorage.removeItem(mod); return true; } catch(e) { return false; } }; tests['sessionstorage'] = function() { try { sessionStorage.setItem(mod, mod); sessionStorage.removeItem(mod); return true; } catch(e) { return false; } }; tests['webworkers'] = function() { return !!window.Worker; }; tests['applicationcache'] = function() { return !!window.applicationCache; }; // Thanks to Erik Dahlstrom tests['svg'] = function() { return !!document.createElementNS && !!document.createElementNS(ns.svg, 'svg').createSVGRect; }; // specifically for SVG inline in HTML, not within XHTML // test page: paulirish.com/demo/inline-svg tests['inlinesvg'] = function() { var div = document.createElement('div'); div.innerHTML = '<svg/>'; return (div.firstChild && div.firstChild.namespaceURI) == ns.svg; }; // SVG SMIL animation tests['smil'] = function() { return !!document.createElementNS && /SVGAnimate/.test(toString.call(document.createElementNS(ns.svg, 'animate'))); }; // This test is only for clip paths in SVG proper, not clip paths on HTML content // demo: srufaculty.sru.edu/david.dailey/svg/newstuff/clipPath4.svg // However read the comments to dig into applying SVG clippaths to HTML content here: // github.com/Modernizr/Modernizr/issues/213#issuecomment-1149491 tests['svgclippaths'] = function() { return !!document.createElementNS && /SVGClipPath/.test(toString.call(document.createElementNS(ns.svg, 'clipPath'))); }; /*>>webforms*/ // input features and input types go directly onto the ret object, bypassing the tests loop. // Hold this guy to execute in a moment. function webforms() { /*>>input*/ // Run through HTML5's new input attributes to see if the UA understands any. // We're using f which is the <input> element created early on // Mike Taylr has created a comprehensive resource for testing these attributes // when applied to all input types: // miketaylr.com/code/input-type-attr.html // spec: www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary // Only input placeholder is tested while textarea's placeholder is not. // Currently Safari 4 and Opera 11 have support only for the input placeholder // Both tests are available in feature-detects/forms-placeholder.js Modernizr['input'] = (function( props ) { for ( var i = 0, len = props.length; i < len; i++ ) { attrs[ props[i] ] = !!(props[i] in inputElem); } if (attrs.list){ // safari false positive's on datalist: webk.it/74252 // see also github.com/Modernizr/Modernizr/issues/146 attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement); } return attrs; })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' ')); /*>>input*/ /*>>inputtypes*/ // Run through HTML5's new input types to see if the UA understands any. // This is put behind the tests runloop because it doesn't return a // true/false like all the other tests; instead, it returns an object // containing each input type with its corresponding true/false value // Big thanks to @miketaylr for the html5 forms expertise. miketaylr.com/ Modernizr['inputtypes'] = (function(props) { for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) { inputElem.setAttribute('type', inputElemType = props[i]); bool = inputElem.type !== 'text'; // We first check to see if the type we give it sticks.. // If the type does, we feed it a textual value, which shouldn't be valid. // If the value doesn't stick, we know there's input sanitization which infers a custom UI if ( bool ) { inputElem.value = smile; inputElem.style.cssText = 'position:absolute;visibility:hidden;'; if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) { docElement.appendChild(inputElem); defaultView = document.defaultView; // Safari 2-4 allows the smiley as a value, despite making a slider bool = defaultView.getComputedStyle && defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' && // Mobile android web browser has false positive, so must // check the height to see if the widget is actually there. (inputElem.offsetHeight !== 0); docElement.removeChild(inputElem); } else if ( /^(search|tel)$/.test(inputElemType) ){ // Spec doesn't define any special parsing or detectable UI // behaviors so we pass these through as true // Interestingly, opera fails the earlier test, so it doesn't // even make it here. } else if ( /^(url|email)$/.test(inputElemType) ) { // Real url and email support comes with prebaked validation. bool = inputElem.checkValidity && inputElem.checkValidity() === false; } else { // If the upgraded input compontent rejects the :) text, we got a winner bool = inputElem.value != smile; } } inputs[ props[i] ] = !!bool; } return inputs; })('search tel url email datetime date month week time datetime-local number range color'.split(' ')); /*>>inputtypes*/ } /*>>webforms*/ // End of test definitions // ----------------------- // Run through all tests and detect their support in the current UA. // todo: hypothetically we could be doing an array of tests and use a basic loop here. for ( var feature in tests ) { if ( hasOwnProp(tests, feature) ) { // run the test, throw the return value into the Modernizr, // then based on that boolean, define an appropriate className // and push it into an array of classes we'll join later. featureName = feature.toLowerCase(); Modernizr[featureName] = tests[feature](); classes.push((Modernizr[featureName] ? '' : 'no-') + featureName); } } /*>>webforms*/ // input tests need to run. Modernizr.input || webforms(); /*>>webforms*/ /** * addTest allows the user to define their own feature tests * the result will be added onto the Modernizr object, * as well as an appropriate className set on the html element * * @param feature - String naming the feature * @param test - Function returning true if feature is supported, false if not */ Modernizr.addTest = function ( feature, test ) { if ( typeof feature == 'object' ) { for ( var key in feature ) { if ( hasOwnProp( feature, key ) ) { Modernizr.addTest( key, feature[ key ] ); } } } else { feature = feature.toLowerCase(); if ( Modernizr[feature] !== undefined ) { // we're going to quit if you're trying to overwrite an existing test // if we were to allow it, we'd do this: // var re = new RegExp("\\b(no-)?" + feature + "\\b"); // docElement.className = docElement.className.replace( re, '' ); // but, no rly, stuff 'em. return Modernizr; } test = typeof test == 'function' ? test() : test; if (typeof enableClasses !== "undefined" && enableClasses) { docElement.className += ' ' + (test ? '' : 'no-') + feature; } Modernizr[feature] = test; } return Modernizr; // allow chaining. }; // Reset modElem.cssText to nothing to reduce memory footprint. setCss(''); modElem = inputElem = null; /*>>shiv*/ /** * @preserve HTML5 Shiv prev3.7.1 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed */ ;(function(window, document) { /*jshint evil:true */ /** version */ var version = '3.7.0'; /** Preset options */ var options = window.html5 || {}; /** Used to skip problem elements */ var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i; /** Not all elements can be cloned in IE **/ var saveClones = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i; /** Detect whether the browser supports default html5 styles */ var supportsHtml5Styles; /** Name of the expando, to work with multiple documents or to re-shiv one document */ var expando = '_html5shiv'; /** The id for the the documents expando */ var expanID = 0; /** Cached data for each document */ var expandoData = {}; /** Detect whether the browser supports unknown elements */ var supportsUnknownElements; (function() { try { var a = document.createElement('a'); a.innerHTML = '<xyz></xyz>'; //if the hidden property is implemented we can assume, that the browser supports basic HTML5 Styles supportsHtml5Styles = ('hidden' in a); supportsUnknownElements = a.childNodes.length == 1 || (function() { // assign a false positive if unable to shiv (document.createElement)('a'); var frag = document.createDocumentFragment(); return ( typeof frag.cloneNode == 'undefined' || typeof frag.createDocumentFragment == 'undefined' || typeof frag.createElement == 'undefined' ); }()); } catch(e) { // assign a false positive if detection fails => unable to shiv supportsHtml5Styles = true; supportsUnknownElements = true; } }()); /*--------------------------------------------------------------------------*/ /** * Creates a style sheet with the given CSS text and adds it to the document. * @private * @param {Document} ownerDocument The document. * @param {String} cssText The CSS text. * @returns {StyleSheet} The style element. */ function addStyleSheet(ownerDocument, cssText) { var p = ownerDocument.createElement('p'), parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement; p.innerHTML = 'x<style>' + cssText + '</style>'; return parent.insertBefore(p.lastChild, parent.firstChild); } /** * Returns the value of `html5.elements` as an array. * @private * @returns {Array} An array of shived element node names. */ function getElements() { var elements = html5.elements; return typeof elements == 'string' ? elements.split(' ') : elements; } /** * Returns the data associated to the given document * @private * @param {Document} ownerDocument The document. * @returns {Object} An object of data. */ function getExpandoData(ownerDocument) { var data = expandoData[ownerDocument[expando]]; if (!data) { data = {}; expanID++; ownerDocument[expando] = expanID; expandoData[expanID] = data; } return data; } /** * returns a shived element for the given nodeName and document * @memberOf html5 * @param {String} nodeName name of the element * @param {Document} ownerDocument The context document. * @returns {Object} The shived element. */ function createElement(nodeName, ownerDocument, data){ if (!ownerDocument) { ownerDocument = document; } if(supportsUnknownElements){ return ownerDocument.createElement(nodeName); } if (!data) { data = getExpandoData(ownerDocument); } var node; if (data.cache[nodeName]) { node = data.cache[nodeName].cloneNode(); } else if (saveClones.test(nodeName)) { node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode(); } else { node = data.createElem(nodeName); } // Avoid adding some elements to fragments in IE < 9 because // * Attributes like `name` or `type` cannot be set/changed once an element // is inserted into a document/fragment // * Link elements with `src` attributes that are inaccessible, as with // a 403 response, will cause the tab/window to crash // * Script elements appended to fragments will execute when their `src` // or `text` property is set return node.canHaveChildren && !reSkip.test(nodeName) && !node.tagUrn ? data.frag.appendChild(node) : node; } /** * returns a shived DocumentFragment for the given document * @memberOf html5 * @param {Document} ownerDocument The context document. * @returns {Object} The shived DocumentFragment. */ function createDocumentFragment(ownerDocument, data){ if (!ownerDocument) { ownerDocument = document; } if(supportsUnknownElements){ return ownerDocument.createDocumentFragment(); } data = data || getExpandoData(ownerDocument); var clone = data.frag.cloneNode(), i = 0, elems = getElements(), l = elems.length; for(;i<l;i++){ clone.createElement(elems[i]); } return clone; } /** * Shivs the `createElement` and `createDocumentFragment` methods of the document. * @private * @param {Document|DocumentFragment} ownerDocument The document. * @param {Object} data of the document. */ function shivMethods(ownerDocument, data) { if (!data.cache) { data.cache = {}; data.createElem = ownerDocument.createElement; data.createFrag = ownerDocument.createDocumentFragment; data.frag = data.createFrag(); } ownerDocument.createElement = function(nodeName) { //abort shiv if (!html5.shivMethods) { return data.createElem(nodeName); } return createElement(nodeName, ownerDocument, data); }; ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' + 'var n=f.cloneNode(),c=n.createElement;' + 'h.shivMethods&&(' + // unroll the `createElement` calls getElements().join().replace(/[\w\-]+/g, function(nodeName) { data.createElem(nodeName); data.frag.createElement(nodeName); return 'c("' + nodeName + '")'; }) + ');return n}' )(html5, data.frag); } /*--------------------------------------------------------------------------*/ /** * Shivs the given document. * @memberOf html5 * @param {Document} ownerDocument The document to shiv. * @returns {Document} The shived document. */ function shivDocument(ownerDocument) { if (!ownerDocument) { ownerDocument = document; } var data = getExpandoData(ownerDocument); if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) { data.hasCSS = !!addStyleSheet(ownerDocument, // corrects block display not defined in IE6/7/8/9 'article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}' + // adds styling not present in IE6/7/8/9 'mark{background:#FF0;color:#000}' + // hides non-rendered elements 'template{display:none}' ); } if (!supportsUnknownElements) { shivMethods(ownerDocument, data); } return ownerDocument; } /*--------------------------------------------------------------------------*/ /** * The `html5` object is exposed so that more elements can be shived and * existing shiving can be detected on iframes. * @type Object * @example * * // options can be changed before the script is included * html5 = { 'elements': 'mark section', 'shivCSS': false, 'shivMethods': false }; */ var html5 = { /** * An array or space separated string of node names of the elements to shiv. * @memberOf html5 * @type Array|String */ 'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video', /** * current version of html5shiv */ 'version': version, /** * A flag to indicate that the HTML5 style sheet should be inserted. * @memberOf html5 * @type Boolean */ 'shivCSS': (options.shivCSS !== false), /** * Is equal to true if a browser supports creating unknown/HTML5 elements * @memberOf html5 * @type boolean */ 'supportsUnknownElements': supportsUnknownElements, /** * A flag to indicate that the document's `createElement` and `createDocumentFragment` * methods should be overwritten. * @memberOf html5 * @type Boolean */ 'shivMethods': (options.shivMethods !== false), /** * A string to describe the type of `html5` object ("default" or "default print"). * @memberOf html5 * @type String */ 'type': 'default', // shivs the document according to the specified `html5` object options 'shivDocument': shivDocument, //creates a shived element createElement: createElement, //creates a shived documentFragment createDocumentFragment: createDocumentFragment }; /*--------------------------------------------------------------------------*/ // expose html5 window.html5 = html5; // shiv the document shivDocument(document); }(this, document)); /*>>shiv*/ // Assign private properties to the return object with prefix Modernizr._version = version; // expose these for the plugin API. Look in the source for how to join() them against your input /*>>prefixes*/ Modernizr._prefixes = prefixes; /*>>prefixes*/ /*>>domprefixes*/ Modernizr._domPrefixes = domPrefixes; Modernizr._cssomPrefixes = cssomPrefixes; /*>>domprefixes*/ /*>>mq*/ // Modernizr.mq tests a given media query, live against the current state of the window // A few important notes: // * If a browser does not support media queries at all (eg. oldIE) the mq() will always return false // * A max-width or orientation query will be evaluated against the current state, which may change later. // * You must specify values. Eg. If you are testing support for the min-width media query use: // Modernizr.mq('(min-width:0)') // usage: // Modernizr.mq('only screen and (max-width:768)') Modernizr.mq = testMediaQuery; /*>>mq*/ /*>>hasevent*/ // Modernizr.hasEvent() detects support for a given event, with an optional element to test on // Modernizr.hasEvent('gesturestart', elem) Modernizr.hasEvent = isEventSupported; /*>>hasevent*/ /*>>testprop*/ // Modernizr.testProp() investigates whether a given style property is recognized // Note that the property names must be provided in the camelCase variant. // Modernizr.testProp('pointerEvents') Modernizr.testProp = function(prop){ return testProps([prop]); }; /*>>testprop*/ /*>>testallprops*/ // Modernizr.testAllProps() investigates whether a given style property, // or any of its vendor-prefixed variants, is recognized // Note that the property names must be provided in the camelCase variant. // Modernizr.testAllProps('boxSizing') Modernizr.testAllProps = testPropsAll; /*>>testallprops*/ /*>>teststyles*/ // Modernizr.testStyles() allows you to add custom styles to the document and test an element afterwards // Modernizr.testStyles('#modernizr { position:absolute }', function(elem, rule){ ... }) Modernizr.testStyles = injectElementWithStyles; /*>>teststyles*/ /*>>prefixed*/ // Modernizr.prefixed() returns the prefixed or nonprefixed property name variant of your input // Modernizr.prefixed('boxSizing') // 'MozBoxSizing' // Properties must be passed as dom-style camelcase, rather than `box-sizing` hypentated style. // Return values will also be the camelCase variant, if you need to translate that to hypenated style use: // // str.replace(/([A-Z])/g, function(str,m1){ return '-' + m1.toLowerCase(); }).replace(/^ms-/,'-ms-'); // If you're trying to ascertain which transition end event to bind to, you might do something like... // // var transEndEventNames = { // 'WebkitTransition' : 'webkitTransitionEnd', // 'MozTransition' : 'transitionend', // 'OTransition' : 'oTransitionEnd', // 'msTransition' : 'MSTransitionEnd', // 'transition' : 'transitionend' // }, // transEndEventName = transEndEventNames[ Modernizr.prefixed('transition') ]; Modernizr.prefixed = function(prop, obj, elem){ if(!obj) { return testPropsAll(prop, 'pfx'); } else { // Testing DOM property e.g. Modernizr.prefixed('requestAnimationFrame', window) // 'mozRequestAnimationFrame' return testPropsAll(prop, obj, elem); } }; /*>>prefixed*/ /*>>cssclasses*/ // Remove "no-js" class from <html> element, if it exists: docElement.className = docElement.className.replace(/(^|\s)no-js(\s|$)/, '$1$2') + // Add the new classes to the <html> element. (enableClasses ? ' js ' + classes.join(' ') : ''); /*>>cssclasses*/ return Modernizr; })(this, this.document); dependencies/css/highlightjs-github-theme.css000064400000001550151676726760015410 0ustar00.hljs{display:block;overflow-x:auto;padding:0.5em;color:#333;background:#f8f8f8}.hljs-comment,.hljs-quote{color:#998;font-style:italic}.hljs-keyword,.hljs-selector-tag,.hljs-subst{color:#333;font-weight:bold}.hljs-number,.hljs-literal,.hljs-variable,.hljs-template-variable,.hljs-tag .hljs-attr{color:#008080}.hljs-string,.hljs-doctag{color:#d14}.hljs-title,.hljs-section,.hljs-selector-id{color:#900;font-weight:bold}.hljs-subst{font-weight:normal}.hljs-type,.hljs-class .hljs-title{color:#458;font-weight:bold}.hljs-tag,.hljs-name,.hljs-attribute{color:#000080;font-weight:normal}.hljs-regexp,.hljs-link{color:#009926}.hljs-symbol,.hljs-bullet{color:#990073}.hljs-built_in,.hljs-builtin-name{color:#0086b3}.hljs-meta{color:#999;font-weight:bold}.hljs-deletion{background:#fdd}.hljs-addition{background:#dfd}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:bold}.nvmrc000064400000000007151676726760005716 0ustar005.1.1 README.md000064400000036137151676726760006064 0ustar00bootstrap-slider [](https://travis-ci.org/seiyria/bootstrap-slider) ================ Originally began as a loose "fork" of bootstrap-slider found on http://www.eyecon.ro/ by Stefan Petre. Over time, this project has diverged sigfinicantly from Stefan Petre's version and is now almost completely different. __Please ensure that you are using this library instead of the Petre version before creating issues in the repository issue tracker!!__ __Note also that Bootstrap 4 is not yet supported, see issue [#689](https://github.com/seiyria/bootstrap-slider/issues/689).__ Installation ============ Want to use bower? `bower install seiyria-bootstrap-slider` Want to use npm? `npm install bootstrap-slider` Want to get it from a CDN? https://cdnjs.com/libraries/bootstrap-slider Basic Setup ============ Grab the compiled JS/CSS (minified or non-minified versions) from the [/dist](https://github.com/seiyria/bootstrap-slider/tree/master/dist) directory, load them into your web page, and everything should work! Remember to load the plugin code after loading the Bootstrap CSS and JQuery. __JQuery is optional and the plugin can operate with or without it.__ Look below to see an example of how to interact with the non-JQuery interface. Supported Browsers ======== __We only support modern browsers!!! Basically, anything below IE9 is not compatible with this plugin!__ Examples ======== You can see all of our API examples [here](http://seiyria.github.io/bootstrap-slider/). Using bootstrap-slider (with JQuery) ====================== ### Using `.slider` namespace Create an input element and call .slider() on it: ```js // Instantiate a slider var mySlider = $("input.slider").slider(); // Call a method on the slider var value = mySlider.slider('getValue'); // For non-getter methods, you can chain together commands mySlider .slider('setValue', 5) .slider('setValue', 7); ``` ### Using `.bootstrapSlider` namespace Create an input element and call .bootstrapSlider() on it: ```js // Instantiate a slider var mySlider = $("input.slider").bootstrapSlider(); // Call a method on the slider var value = mySlider.bootstrapSlider('getValue'); // For non-getter methods, you can chain together commands mySlider .bootstrapSlider('setValue', 5) .bootstrapSlider('setValue', 7); ``` Using bootstrap-slider (via `data-provide`-API) ====================== Create an input element with the `data-provide="slider"` attribute automatically turns it into a slider. Options can be supplied via `data-slider-` attributes. ```html <input type="text" name="somename" data-provide="slider" data-slider-ticks="[1, 2, 3]" data-slider-ticks-labels='["short", "medium", "long"]' data-slider-min="1" data-slider-max="3" data-slider-step="1" data-slider-value="3" data-slider-tooltip="hide" > ``` What if there is already a _slider_ plugin bound to the JQuery namespace? ====================== If there is already a JQuery plugin named _slider_ bound to the JQuery namespace, then this plugin will provide an alternative namespace _bootstrapSlider_ and will emit a console warning telling you the _slider_ namespace has already been taken and will encourage you to use the alternate namespace instead. If the _slider_ namespace is available however, the _bootstrapSlider_ namespace will not exist. ```js // Instantiate a slider var mySlider = $("input.slider").bootstrapSlider(); // Call a method on the slider var value = mySlider.bootstrapSlider('getValue'); // For non-getter methods, you can chain together commands mySlider .bootstrapSlider('setValue', 5) .bootstrapSlider('setValue', 7); ``` Using bootstrap-slider (without JQuery) ====================== Create an input element in the DOM, and then create an instance of Slider, passing it a selector string referencing the input element. ```js // Instantiate a slider var mySlider = new Slider("input.slider", { // initial options object }); // Call a method on the slider var value = mySlider.getValue(); // For non-getter methods, you can chain together commands mySlider .setValue(5) .setValue(7); ``` Using as CommonJS module ======= bootstrap-slider can be loaded as a CommonJS module via [Browserify](https://github.com/substack/node-browserify), [Webpack](https://github.com/webpack/webpack), or some other build tool. ```js var Slider = require("bootstrap-slider"); var mySlider = new Slider(); ``` How do I exclude the optional JQuery dependency from my build? ======= ### Browserify __Note that the JQuery dependency is considered to be optional.__ For example, to exclude JQuery from being part of your Browserify build, you would call something like the following (assuming `main.js` is requiring bootstrap-slider as a dependency): ```BASH browserify --im -u jquery main.js > bundle.js ``` ### Webpack To exclude JQuery from your Webpack build, you will have to go into the Webpack config file for your specific project and add something like the following to your `resolve.alias` section: ```js resolve: { alias: { "jquery": path.join(__dirname, "./jquery-stub.js") } } ``` Then in your project, you will have to create a stub module for jquery that exports a `null` value. Whenever `require("jquery")` is mentioned in your project, it will load this stubbed module. ```js // Path: ./jquery-stub.js module.exports = null; ``` ### Other Please see the documentation for the specific module loader you are using to find out how to exclude dependencies. Options ======= Options can be passed either as a data (data-slider-foo) attribute, or as part of an object in the slider call. The only exception here is the formatter argument - that can not be passed as a data- attribute. | Name | Type | Default | Description | | ---- |:----:|:-------:|:----------- | | id | string | '' | set the id of the slider element when it's created | | min | float | 0 | minimum possible value | | max | float | 10 | maximum possible value | | step | float | 1 | increment step | | precision | float | number of digits after the decimal of _step_ value | The number of digits shown after the decimal. Defaults to the number of digits after the decimal of _step_ value. | | orientation | string | 'horizontal' | set the orientation. Accepts 'vertical' or 'horizontal' | | value | float,array | 5 | initial value. Use array to have a range slider. | | range | bool | false | make range slider. Optional if initial value is an array. If initial value is scalar, max will be used for second value. | | selection | string | 'before' | selection placement. Accepts: 'before', 'after' or 'none'. In case of a range slider, the selection will be placed between the handles | | tooltip | string | 'show' | whether to show the tooltip on drag, hide the tooltip, or always show the tooltip. Accepts: 'show', 'hide', or 'always' | | tooltip_split | bool | false | if false show one tootip if true show two tooltips one for each handler | | tooltip_position | string | null | Position of tooltip, relative to slider. Accepts 'top'/'bottom' for horizontal sliders and 'left'/'right' for vertically orientated sliders. Default positions are 'top' for horizontal and 'right' for vertical slider. | | handle | string | 'round' | handle shape. Accepts: 'round', 'square', 'triangle' or 'custom' | | reversed | bool | false | whether or not the slider should be reversed | | rtl | bool|string | 'auto' | whether or not the slider should be shown in rtl mode. Accepts true, false, 'auto'. Default 'auto' : use actual direction of HTML (`dir='rtl'`) | | enabled | bool | true | whether or not the slider is initially enabled | | formatter | function | returns the plain value | formatter callback. Return the value wanted to be displayed in the tooltip, useful for string values. If a string is returned it will be indicated in an `aria-valuetext` attribute. | | natural_arrow_keys | bool | false | The natural order is used for the arrow keys. Arrow up select the upper slider value for vertical sliders, arrow right the righter slider value for a horizontal slider - no matter if the slider was reversed or not. By default the arrow keys are oriented by arrow up/right to the higher slider value, arrow down/left to the lower slider value. | | ticks | array | [ ] | Used to define the values of ticks. Tick marks are indicators to denote special values in the range. This option overwrites min and max options. | | ticks_positions | array | [ ] | Defines the positions of the tick values in percentages. The first value should always be 0, the last value should always be 100 percent. | | ticks_labels | array | [ ] | Defines the labels below the tick marks. Accepts HTML input. | | ticks_snap_bounds | float | 0 | Used to define the snap bounds of a tick. Snaps to the tick if value is within these bounds. | | ticks_tooltip | bool | false | Used to allow for a user to hover over a given tick to see it's value. Useful if custom formatter passed in | | scale | string | 'linear' | Set to 'logarithmic' to use a logarithmic scale. Logarithmic scales will be calculated based on the difference between min to max; e.g. (0..10000) (-100..9900) both have a net range of 10001 and will slide in the same net increments. | | focus | bool | false | Focus the appropriate slider handle after a value change. | | labelledby | string,array | null | ARIA labels for the slider handle's, Use array for multiple values in a range slider. | | rangeHighlights | array | [] | Defines a range array that you want to highlight, for example: [{'start':val1, 'end': val2, 'class': 'optionalAdditionalClassName'}]. | Functions ========= __NOTE:__ Optional parameters are italicized. | Function | Parameters | Description | | -------- | ----------- | ----------- | | getValue | --- | Get the current value from the slider | | setValue | newValue, _triggerSlideEvent_, _triggerChangeEvent_ | Set a new value for the slider. If optional triggerSlideEvent parameter is _true_, 'slide' events will be triggered. If optional triggerChangeEvent parameter is _true_, 'change' events will be triggered. This function takes `newValue` as either a `Number`, `String`, `Array`. If the value is of type `String` it must be convertable to an integer or it will throw an error.| | getElement | --- | Get the div slider element | | destroy | --- | Properly clean up and remove the slider instance | | disable | ---| Disables the slider and prevents the user from changing the value | | enable | --- | Enables the slider | | toggle | --- | Toggles the slider between enabled and disabled | | isEnabled | --- |Returns true if enabled, false if disabled | | setAttribute | attribute, value | Updates the slider's [attributes](#options) | | getAttribute | attribute | Get the slider's [attributes](#options) | | refresh | --- | Refreshes the current slider | | on | eventType, callback | When the slider event _eventType_ is triggered, the callback function will be invoked | | off | eventType, callback | Removes the callback function from the slider event _eventType_ | | relayout | --- | Renders the tooltip again, after initialization. Useful in situations when the slider and tooltip are initially hidden. | Events ====== | Event | Description | Value | | ----- | ----------- | ----- | | slide | This event fires when the slider is dragged | The new slider value | | slideStart | This event fires when dragging starts | The new slider value | | slideStop | This event fires when the dragging stops or has been clicked on | The new slider value | | change | This event fires when the slider value has changed | An object with 2 properties: "oldValue" and "newValue" | | slideEnabled | This event fires when the slider is enabled | N/A | | slideDisabled | This event fires when the slider is disabled | N/A | How Do I Run This Locally? ====== - Clone the repository - Run `nvm use` in your Terminal to switch to the proper Node/NPM version - Once you are on specified Node version, run `npm install` - Install the Grunt CLI: `npm install grunt-cli -g` - Type `grunt dev` to launch browser window with Examples page Grunt Tasks ====== This plugin uses Grunt as its command-line task runner. To install the Grunt CLI, type `npm install grunt-cli -g`. To execute any of the commands, type `grunt <task-name>` in your terminal instance. The following is a list of the commonly-used command line tasks: * `grunt development`: Generates the `index.html`, compiles the LESS/JS to the `/temp` directory, and launches the index.html in your system's default browser. As changes are made to source code, the browser window will auto-refresh. * `grunt production`: Generates the `/dist` directory with minified and unminified assetts. * `grunt dev`: Alias for `grunt development` * `grunt prod`: Alias for `grunt production` * `grunt build`: Transpiles JavaScript source via Babel and compiles LESS source to CSS to `temp` directory. * `grunt lint`: Runs JSLint on the JavaScript source code files, SASS-Lint on the SASS source code files, and LESSLint on the LESS source code files. * `grunt test`: Runs unit tests contained in `/test` directory via Jasmine 2.x.x Version Bumping and Publishing (Maintainers Only) ======= To do the following release tasks: * bump the version * publish a new version to NPM * update the `gh-pages` branch * push a new `dist` bundle to the `master` branch on the remote `origin` * push new tags to the remote `origin` Type the following command: `npm run release <patch|minor|major>` If you do not specify a version bump type, the script will automatically defer to a patch bump. Updating Github.io Page =========================== The Github.io page can be automatically updated by running the following command: `npm run update-gh-pages` This command will handle generating the latest versions of the JS/CSS and index.html page, and push them to the `gh-pages` branch. Other Platforms & Libraries =========================== - [Ruby on Rails](https://github.com/YourCursus/bootstrap-slider-rails) - [knockout.js](https://github.com/cosminstefanxp/bootstrap-slider-knockout-binding) ([@cosminstefanxp](https://github.com/cosminstefanxp), [#81](https://github.com/seiyria/bootstrap-slider/issues/81)) - [AngularJS](https://github.com/seiyria/angular-bootstrap-slider) - [EmberJS](https://github.com/lifegadget/ui-slider) ([@ksnyde](https://github.com/ksnyde)) - [ReactJS](https://github.com/brownieboy/react-bootstrap-slider) - [NuGet](https://www.nuget.org/packages/bootstrap-slider/) ([@ChrisMissal](https://github.com/ChrisMissal)) - [MeteorJS](https://github.com/kidovate/meteor-bootstrap-slider) - [Maven](http://mvnrepository.com/artifact/org.webjars.bower/seiyria-bootstrap-slider) - [Vue.js](https://github.com/pimlie/vue-bootstrap-slider) ([@pimlie](https://github.com/pimlie)) Maintainers ============ - Kyle Kemp * Twitter: [@seiyria](https://twitter.com/seiyria) * Github: [seiyria](https://github.com/seiyria) - Rohit Kalkur * Twitter: [@Rovolutionary](https://twitter.com/Rovolutionary) * Github: [rovolution](https://github.com/rovolution) LICENSE.md000064400000002317151676726760006202 0ustar00---------------------------------------------------------------------- bootstrap-slider is released under the MIT License Copyright (c) 2017 Kyle Kemp, Rohit Kalkur, and contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. scripts/update-gh-pages.sh000064400000001757151676726760011603 0ustar00#!/bin/bash # log echo "..." echo "Updating Github.io page" echo "..." # Generate index.html and /temp assetts for GH Pages branch grunt build-gh-pages # Create temporary copy of index file cp index.html index-temp.html # Checkout to `gh-pages` branch git checkout -B gh-pages origin/gh-pages git pull -r origin gh-pages # Replace current files with temporary files mv index-temp.html index.html cp node_modules/bootstrap/dist/css/bootstrap.min.css css/bootstrap.min.css mv temp/bootstrap-slider.css css/bootstrap-slider.css mv temp/bootstrap-slider.js js/bootstrap-slider.js # Remove /temp directory rm -rf temp # Stage new files for commit git add index.html css/bootstrap-slider.css js/bootstrap-slider.js css/bootstrap.min.css # Create commit with new files git commit -m "updates" # Push new source code to gh-pages branch git push origin gh-pages:gh-pages -f # Switch back to master branch git checkout master # log echo "..." echo "Github.io page updated" echo "..." scripts/release.sh000064400000002534151676726760010242 0ustar00#!/bin/bash # Check if required CLI tools are available if ! [ -x "$(command -v grunt)" ]; then echo "Error: grunt-cli is not installed. Please type 'npm install grunt-cli -g' to install" >&2 exit 1 fi # Validate arguments versionBumpType=${1:-patch}; if [ "$versionBumpType" != "major" ] && [ "$versionBumpType" != "minor" ] && [ "$versionBumpType" != "patch" ]; then echo "Invalid version bump argument: ${versionBumpType}. Option must be one of the following: major, minor, patch" >&2 exit 1 else echo "Publishing and bumping with ${versionBumpType} version bump" fi echo "Running version bump + publish script..." echo "." echo "." echo "Generating /dist and push changes + tags to Github remote 'origin'" # Checkout master branch git checkout master # Version bump grunt bump-only:"$versionBumpType" # Generate new dist grunt prod # Generate new index.html page grunt template # Force add dist contents git add dist/* --force # Commit new release tag grunt bump-commit # Push commits/tags to master branch on remote 'origin' git push origin master:master && git push --tags ## Update Github.io page sh ./scripts/update-gh-pages.sh ## Publish to NPM echo "." echo "." echo "Publishing to NPM" echo "." echo "." npm publish # Notify script is complete echo "." echo "." echo "Script complete" echo ""bower.json000064400000001075151676726760006607 0ustar00{ "name": "seiyria-bootstrap-slider", "version": "10.3.2", "homepage": "https://github.com/seiyria/bootstrap-slider", "authors": [ "Kyle Kemp <kyle@seiyria.com>", "Rohit Kalkur <rohit.kalkur@gmail.com>" ], "description": "a slider element for bootstrap 2/3", "main": [ "dist/bootstrap-slider.js", "dist/css/bootstrap-slider.css" ], "keywords": [ "slider", "bootstrap2", "bootstrap3", "bootstrap" ], "license": "MIT", "ignore": [ "**/.*", "node_modules", "bower_components" ] } CHANGELOG.md000064400000042552151676726760006414 0ustar0010.3.2 / 2018-11-28 ================== * **Bug Fix:** Allow range slider to snap to ticks within bounds. [See here for further details](https://github.com/seiyria/bootstrap-slider/pull/873). Thanks to [Michael Kriese](https://github.com/ViceIce). 10.3.1 / 2018-11-24 ================== * **Bug Fix:** Check if `getComputedStyle()` returns `null`. Addresses issue with Firefox browsers running version < 62. [See here for further details](https://github.com/seiyria/bootstrap-slider/pull/869). Thanks to [Tyler Wilding](https://github.com/xTVaser). 10.3.0 / 2018-11-24 ================== * **New Feature:** Add selection CSS classes to tick labels. [See here for further details](https://github.com/seiyria/bootstrap-slider/pull/752). Thanks to [Doug Lee](https://github.com/duggi). 10.2.4 / 2018-11-24 ================== * **Bug Fix:** Remove duplicate call to `relayout()` in `_layout()` function. [See here for further details](https://github.com/seiyria/bootstrap-slider/pull/872). * **Documentation Fix:** Fix a typo in Example 14 on the API examples page. [See here for further details](https://github.com/seiyria/bootstrap-slider/pull/871). * **Documentation Fix:** Fix a typo in Example 1 on the API examples page. [See here for further details](https://github.com/seiyria/bootstrap-slider/pull/870). 10.2.3 / 2018-11-05 ================== * **Bug Fix** Fixes an issue where sliding a min handle over the max handle causes a strange skip in the values. [See here for further details](https://github.com/seiyria/bootstrap-slider/issues/854). Thanks [Jeffrey Espiritu](https://github.com/jespirit). 10.2.2 / 2018-10-25 ================== * **Documentation Fix** Fix a typo to show tick position example correctly [See here for further details](https://github.com/seiyria/bootstrap-slider/pull/866). Thanks [Jeffrey Espiritu](https://github.com/jespirit). 10.2.1 / 2018-09-25 ================== * **Bug Fix** Hovering next to slider does not show the tooltip. [See here for further details](https://github.com/seiyria/bootstrap-slider/pull/858). Thanks to [Alexa Schlegel](https://github.com/aschle). 10.2.0 / 2018-07-21 ================== * **New Feature** Show pointer cursor on slider ticks. [See here for further details](https://github.com/seiyria/bootstrap-slider/pull/849). Thanks to [Erik Demaine](https://github.com/edemaine). 10.1.0 / 2018-07-21 ================== * **Bug Fix** Allow any value on logarithmic scale. [See here for further details](https://github.com/seiyria/bootstrap-slider/pull/836). Fixes [this bug](https://github.com/seiyria/bootstrap-slider/issues/835). Thanks to [James Mason](https://github.com/bear454). * **Documentation Fix:** Adds note about lack of current Bootstrap 4 compatability. [See here for further details](https://github.com/seiyria/bootstrap-slider/issues/689). Thanks to [Anders Olsson](https://github.com/anderso). * **Documentation Fix:** Increases clarity around when alternate namespace is bound. [See here for further details](https://github.com/seiyria/bootstrap-slider/pull/838). Thanks to [putrefactio](https://github.com/putrefactio). * **New Feature** Show pointer cursor on slider handle. [See here for further details](https://github.com/seiyria/bootstrap-slider/pull/839). Thanks to [David Lesieur](https://github.com/davidlesieur). 10.0.2 / 2018-04-28 ================== * **Bug Fix** Fixes an issue when determining mouse coords when pageXOffset >= 0 . [See here for further details](https://github.com/seiyria/bootstrap-slider/pull/828). Fixes [this bug](https://github.com/seiyria/bootstrap-slider/issues/594). Thanks to [x-yuri](https://github.com/x-yuri). 10.0.1 / 2018-04-28 ================== * **Bug Fix** Fixing an issue where DOM elements were being selected on slide in FF and IE. [See here for further details](https://github.com/seiyria/bootstrap-slider/pull/829). Fixes [this bug](https://github.com/seiyria/bootstrap-slider/issues/746). Thanks to [Andreas Wulf](https://github.com/wulfsoft). 10.0.0 / 2017-11-09 ================== * **Bug Fix** Refactoring tooltip CSS to use `transform` for positioning. [See here for further details](https://github.com/seiyria/bootstrap-slider/pull/798). Fixes [this bug](https://github.com/seiyria/bootstrap-slider/issues/483). Thanks to [wismill](https://github.com/wismill). 9.10.0 / 2017-11-09 ================== * **Build pipeline change** Refactoring bootstrap files to come from `node_modules` instead of `dependencies` directory so latest changes are reflected. [See here for further details](https://github.com/seiyria/bootstrap-slider/pull/788). Thanks to [Sebastiaan ten Pas](https://github.com/patchman-sebastiaan). 9.9.1 / 2017-11-09 ================== * **Bug Fix** LESS/CSS: Bug fix for mixin. [See here for further details](https://github.com/seiyria/bootstrap-slider/pull/789). Thanks to [Arman Poghosyan](https://github.com/armpogart). 9.9.0 / 2017-09-23 ================== * **New Feature** LESS/CSS: refactor colors into variables file. [See here for further details](https://github.com/seiyria/bootstrap-slider/pull/779). Thanks to [Joseph Marikle](https://github.com/jmarikle). 9.8.1 / 2017-07-06 ================== * **Bug Fix** Addresses issue where the max value calculation was wrong due to the cutoff when the `max` option value was not a multiple of the `step` option value. [See here for further details](https://github.com/seiyria/bootstrap-slider/pull/759). Thanks to [Thomas Haitzer](https://github.com/thaitzer). 9.8.0 / 2017-04-24 ================== * **New Feature:** Ability to add a custom class to the ranges of a slider with the `rangeHightlights` option specified. [See the PR for further details.](https://github.com/seiyria/bootstrap-slider/pull/742). Thanks to [jccode](https://github.com/jccode). Tooling Update / 2017-04-09 ================== * Updates [grunt](https://github.com/gruntjs/grunt) dependency from version `0.4.4` to `^0.4.5`. 9.7.3 / 2017-04-09 ================== * **Bug Fix** Resolves PhantomJS error that was occurring while running the unit test suite. [See here for further details](https://github.com/seiyria/bootstrap-slider/issues/696). * **Tooling Update** Updates unit test suite to [Jasmine 2.x.x](https://jasmine.github.io/2.2/introduction) by updating the [grunt-contrib-jasmine](https://github.com/gruntjs/grunt-contrib-jasmine) dependency from version `0.5.2` to `1.0.3`. 9.7.2 / 2017-02-10 ================== * **Bug Fix** Resolves accesibility issue in range sliders. [See here for further details](https://github.com/seiyria/bootstrap-slider/issues/687). Thanks to [Jerry (jerrylow)](https://github.com/jerrylow). Tooling Update / 2017-02-02 ================== * Adds in [CodeClimate](https://codeclimate.com/) integration. Thanks to [Scott Larkin](https://github.com/larkinscott). Tooling Update / 2017-02-01 ================== * Examples Page: Fixes code snippet for Example 6. Thanks to [Sergey Mezentsev](https://github.com/TheBits). 9.7.1 / 2017-01-29 ================== * **Bug Fix** Resolves "'slider' of undefined" error. [See here for further details](https://github.com/seiyria/bootstrap-slider/issues/587). Thanks to [Guto Sanches](https://github.com/gutosanches). Tooling Update / 2017-01-06 ================== * Examples Page: Adds syntax highlighting to code snippets on Examples page * Examples Page: Adds anchor tags to each example. For example, navigating to http://seiyria.com/bootstrap-slider/#example-10 will now load the page at Example #10. * Examples Page: Fixed code snippet in Example #14 based on feedback from [this comment](https://github.com/seiyria/bootstrap-slider/issues/645#issuecomment-270751793). 9.7.0 / 2017-01-05 ================== * **Performance Enhancement** Use passive event listeners for touch-enabled devices. [See here for further details](https://github.com/seiyria/bootstrap-slider/pull/680). Thanks to [Chris Hallberg](https://github.com/crhallberg). Tooling Update / 2017-01-05 ================== * Add an explicit `grunt lint` command to run Lint check on all source files and execute it in the NPM `pretest` script. 9.6.2 / 2017-01-04 ================== * Updating current year references in license from 2016 -> 2017. Tooling Update / 2017-01-04 ================== * Adds in linting for SASS and LESS files in order to catch common syntax errors at CI step versus compile time. 9.6.1 / 2017-01-04 ================== * **Bug Fix:** Resolve issue with SASS file compilation. [See here for further details](https://github.com/seiyria/bootstrap-slider/issues/683). Thanks to [Schepotin](https://github.com/Schepotin) for reporting. 9.6.0 / 2017-01-03 ================== * **New Feature:** Adds ability to set direction (using HTML5 `dir` attribute). [See here for further details](https://github.com/seiyria/bootstrap-slider/pull/679). Thanks to [Denis Chenu](https://github.com/Shnoulle). 9.5.4 / 2016-12-18 ================== * **Bug Fix:** Fixes issue where dragging slider handle outside of modal and releasing cursor would close the modal. [See original issue for further details](https://github.com/seiyria/bootstrap-slider/issues/339). Thanks to [ZeVS777](https://github.com/ZeVS777). 9.5.3 / 2016-12-01 ================== * **Bug Fix:** Fixes typo from previous update to SCSS rules. Thanks to [Julien Bachmann](https://github.com/julienbachmann). 9.5.2 / 2016-11-30 ================== * **Bug Fix:** Fixes SCSS rules. [See original issue for further details](https://github.com/seiyria/bootstrap-slider/issues/662). Thanks to [Julien Bachmann](https://github.com/julienbachmann). 9.5.1 / 2016-11-23 ================== * **Bug Fix:** Removes `'none'` classes after selection change. [See here for further details](https://github.com/seiyria/bootstrap-slider/pull/659). Thanks to [John Clarke](https://github.com/john-clarke). 9.5.0 / 2016-11-21 ================== * **New Feature:** Adds `aria-valuetext` attribute to each slider handle element, which is set to be the current formatted value of the slider (based on the `formatter` option). [See here for further details](https://github.com/seiyria/bootstrap-slider/pull/646). Thanks to [mediaformat](https://github.com/mediaformat). 9.4.1 / 2016-11-04 ================== * **Documentation Fix:** Fixing an inconsistency with the licensing information in our source files. [See here for further details](https://github.com/seiyria/bootstrap-slider/pull/652). Thanks to [Tom Yue](https://github.com/yuethomas) for identifying this issue. 9.4.0 / 2016-10-31 ================== * **New Feature:** Adds the ability to set the slider value using stringified numbers. [See here for further details](https://github.com/seiyria/bootstrap-slider/pull/642). Thanks to [Ryan Bruns](https://github.com/snurby7) 9.3.2 / 2016-10-30 ================== * **Bug Fix:** Fixes reported bug where a slider was unable to be destroyed and re-created if there were event listeners bound to it. [See here for further details](https://github.com/seiyria/bootstrap-slider/issues/640). 9.3.0 / 2016-10-20 ================== * **New Feature:** Adds the ability to enable/disable tooltips when hovering over ticks via the `ticks_tooltip` option. [See here for further details](https://github.com/seiyria/bootstrap-slider/pull/638). Thanks to [Ryan Bruns](https://github.com/snurby7) 9.2.2 / 2016-10-18 ================== * **Bug Fix:** Resolves issue where range highlights were not being applied properly for reversed sliders. [See here for further details](https://github.com/seiyria/bootstrap-slider/pull/637). Thanks to [Bernard Gorman](https://github.com/gormanb) 9.2.0 / 2016-09-26 ================== * **New Feature:** Adding the ability to target certain ranges of the slider track via CSS in order to highlight them. [See here for further details](https://github.com/seiyria/bootstrap-slider/pull/619). Thanks to [lipoczkit](https://github.com/lipoczkit) 9.1.3 / 2016-08-06 ================== * **Bug Fix:** Checks for `window` object before attempting to attach `console` polyfills. [Resolves this issue](https://github.com/seiyria/bootstrap-slider/issues/607) 9.1.2 / 2016-08-06 ================== * Accidental publish 9.1.1 / 2016-07-15 ================== * **Bug Fix:** Adds `.npmignore` file to repository. [Resolves this issue](https://github.com/seiyria/bootstrap-slider/issues/601) 9.1.0 / 2016-07-14 ================== * **New Feature:** Always binding to the `$.fn.bootstrapSlider` namespace and printing a console warning when the `$.fn.slider` namespace is already bound. Idea came from discussion [in this issue](https://github.com/seiyria/bootstrap-slider/issues/575) 9.0.0 / 2016-07-13 ================== * **New Feature:** Wraps all of the ticks within a single container element with the class `.slider-tick-container` as opposed to being within the `.slider-track` element. This enables individual ticks to be more easily targeted with CSS selectors such as `nth-of-type(n)`. Idea came from discussion [in this issue](https://github.com/seiyria/bootstrap-slider/issues/500) 8.0.0 / 2016-07-13 ================== * **Revert:** Reverting bug fix made in `7.0.4 - 7.0.5` because it breaks UMD module definition and r.js build tool [as reported in this issue](https://github.com/seiyria/bootstrap-slider/issues/589#issuecomment-232429818). Updated README to address how to stub out optional JQuery dependency for Webpack builds. 7.1.0 - 7.1.1 / 2016-05-26 ================== * **New Feature:** Allow LESS/SASS variables to be overridden, but fall back to defaults if needed. [See here for further details](https://github.com/seiyria/bootstrap-slider/pull/579). Thanks to [Jonathan Rehm (jkrehm)](https://github.com/jkrehm) 7.0.4 - 7.0.5 / 2016-05-26 ================== * **Bug Fix:** Changes webpack AMD build error on define() for optional jQuery dependency to be a warning, which allows webpack builds to be completed. [See here for further details](https://github.com/seiyria/bootstrap-slider/issues/578). Thanks to [Tomi Saarinen (TomiS)](https://github.com/TomiS) 7.0.2 / 2016-04-05 ================== * **Bug Fix:** Fixes overlap issue with range slider. [See here for further details](https://github.com/seiyria/bootstrap-slider/issues/435). Thanks to [Jerry (jerrylow)](https://github.com/jerrylow) 7.0.0 / 2016-04-05 ================== * **Breaking Change:** Restructured and refactored SASS source files to eliminate compass dependency and be more organized. Thanks to [Jacob van Mourik (jcbvm)](https://github.com/jcbvm) 6.1.7 / 2016-04-03 ================== * **Bug Fix:** Fixes issue where slider accidently scrolls when user taps on mobile device. Thanks to [Jerry (jerrylow)](https://github.com/jerrylow) 6.1.5 / 2016-03-12 ================== * **Bug Fix:** Call resize() before layout() within relayout() method, which enables intially hidden sliders to be revealed and behave appropriately. Thanks to [Peter (MaZderMind)](https://github.com/MaZderMind) 6.1.3 / 2016-03-07 ================== * **Bug Fix:** Fixed horizontal centering issue with labels. Thanks to [Josh Guffey](https://github.com/jguffey) 6.1.0 / 2016-02-28 ================== * **New Feature:** Auto-registering/intializing slider via `data-provide="slider"` attribute. Thanks to [MaZderMind](https://github.com/MaZderMind) * Adding Github Templates for Issues, Pull Requests, and Contributions 6.0.16 / 2016-02-04 ================== * **Bug Fix:** Attempted Bug fix from 6.0.11 was refined to ensure so side effects. 6.0.15 / 2016-02-04 ================== * **Bug Fix:** _setText() defaults to `.textContent` vs `.innerHTML`. Thanks to [gio-js](https://github.com/gio-js) 6.0.13 / 2016-01-31 ================== * Reverted Bug fix from prior release 6.0.11 / 2016-01-31 ================== * **Bug fix:** Slider was not scrolling properly when nested inside of scrollable container. Thanks to [serbiant](https://github.com/serbiant) 6.0.9 / 2016-01-26 ================== * **Bug fix:** Race condition in `setValue()` where slider value was being set after `change` and `slide` events were being triggered. Thanks to [glaszig](https://github.com/glaszig) 6.0.7 / 2016-01-22 ================== * **Bug fix:** When `tooltip_position` option is set to `"bottom"` on a slider with multiple split handles, position both tooltips below the slider. Thanks to [Martin Hesslund](https://github.com/kesse) 6.0.5 / 2016-01-20 ================== * bower.json: changing "main" to reference /dist/bootstrap-slider.js 6.0.2 / 2015-12-31 ================== * package.json: changing "main" to point at proper file path 6.0.0 / 2015-12-30 ================== * Moving all source code to `/src` directory * Transpiling JS with [Babel](https://babeljs.io/) * Adding `Other Guidelines` section to CONTRIBUTING.MD * Updating README with Grunt CLI tasks * Update postpublish script to reference transpiled code * Freezing dependency versions (this allows us to ensure the module and grunt tasks always have consistent/repeatable behavior) * Adding an `.nvmrc` file for Node 5.x.x. This version of node comes with NPM 3.x.x, which creates a flat dependency tree for `node_modules`, which basically eliminates the need for bower as our client-side deps management solution 5.3.6 / 2015-12-27 ================== * Restoring bootstrap depedency to bower.json file (Fixes issue with `grunt prod` task) 5.3.4 / 2015-12-27 ================== * **Bug fix:** Ticks now reposition themselves during window resize - Thanks to [Zachary Siswick](https://github.com/zsiswick) .github/CONTRIBUTING.md000064400000001170151676726760010363 0ustar00Guidelines ============= * The application JavaScript source code is transpiled using [Babel](https://babeljs.io/) * We support both [SASS](http://sass-lang.com/) and [LESS](http://lesscss.org/). If you modify one in your PR, please modify both and make sure they both work. * Additionally, when you are ready to submit your PR, please rebase your commits against the latest master branch so they are easier to examine! * Please make sure you're not committing your re-built `dist` files, either. We'll do that! * Also, please note, your code will not be merged if it does not pass our CI test. Thanks for your contribution! .github/ISSUE_TEMPLATE.md000064400000001011151676726760010631 0ustar00Issues ============= **NOTE:** Before filing a new issue, please search through the open issues list and check to see if an existing issue already exists that describes your problem. If so, leave a comment within that issue with the checklist items described below. Please make sure you include the following in your issue report where appropriate: - [ ] JSFiddle (or an equivalent such as CodePen, Plunker, etc) with the an example demonstrating the bug - [ ] Instructions to replicate the bug in the Fiddle .github/PULL_REQUEST_TEMPLATE.md000064400000001365151676726760011741 0ustar00Pull Requests ============= Please accompany all pull requests with the following (where appropriate): - [ ] unit tests (we use [Jasmine 2.x.x](https://jasmine.github.io/2.2/introduction)) - [ ] JSFiddle (or an equivalent such as CodePen, Plunker, etc) or screenshot/GIF with new feature or bug-fix - [ ] Link to original Github issue (if this is a bug-fix) - [ ] documentation updates to README file - [ ] examples within [/tpl/index.tpl](https://github.com/seiyria/bootstrap-slider/blob/master/tpl/index.tpl) (for new options being added) - [ ] Passes CI-server checks (runs automated tests, JS source-code linting, etc..). To run these on your local machine, type `grunt test` in your Terminal within the bootstrap-slider repository directory
/home/emeraadmin/.cpanel/../public_html/logs/../node_modules/../4d695/bootstrap-slider.tar