UNPKG

jquery.mb.vimeo_player

Version:

This plugin let you play any public Vimeo video as background of your page. It can also be used as a customized player in page.

27 lines (26 loc) 5.76 kB
/*___________________________________________________________________________________________________________________________________________________ _ jquery.mb.components _ _ _ _ file: jquery.mb.simpleSlider.min.js _ _ last modified: 09/05/17 19.31 _ _ _ _ Open Lab s.r.l., Florence - Italy _ _ _ _ email: matteo@open-lab.com _ _ site: http://pupunzi.com _ _ http://open-lab.com _ _ blog: http://pupunzi.open-lab.com _ _ Q&A: http://jquery.pupunzi.com _ _ _ _ Licences: MIT, GPL _ _ http://www.opensource.org/licenses/mit-license.php _ _ http://www.gnu.org/licenses/gpl.html _ _ _ _ Copyright (c) 2001-2017. Matteo Bicocchi (Pupunzi); _ ___________________________________________________________________________________________________________________________________________________*/ (function(b){b.simpleSlider={defaults:{initialval:0,maxVal:100,orientation:"h",readonly:!1,callback:!1},events:{start:b.browser.mobile?"touchstart":"mousedown",end:b.browser.mobile?"touchend":"mouseup",move:b.browser.mobile?"touchmove":"mousemove"},init:function(d){return this.each(function(){var a=this,c=b(a);c.addClass("simpleSlider");a.opt={};b.extend(a.opt,b.simpleSlider.defaults,d);b.extend(a.opt,c.data());var f="h"==a.opt.orientation?"horizontal":"vertical";f=b("<div/>").addClass("level").addClass(f); c.prepend(f);a.level=f;c.css({cursor:"default"});"auto"==a.opt.maxVal&&(a.opt.maxVal=b(a).outerWidth());c.updateSliderVal();a.opt.readonly||(c.on(b.simpleSlider.events.start,function(e){b.browser.mobile&&(e=e.changedTouches[0]);a.canSlide=!0;c.updateSliderVal(e);"h"==a.opt.orientation?c.css({cursor:"col-resize"}):c.css({cursor:"row-resize"});a.lastVal=a.val;b.browser.mobile||(e.preventDefault(),e.stopPropagation())}),b(document).on(b.simpleSlider.events.move,function(e){b.browser.mobile&&(e=e.changedTouches[0]); a.canSlide&&(b(document).css({cursor:"default"}),c.updateSliderVal(e),b.browser.mobile||(e.preventDefault(),e.stopPropagation()))}).on(b.simpleSlider.events.end,function(){b(document).css({cursor:"auto"});a.canSlide=!1;c.css({cursor:"auto"})}))})},updateSliderVal:function(d){var a=this.get(0);if(a.opt){a.opt.initialval="number"==typeof a.opt.initialval?a.opt.initialval:a.opt.initialval(a);var c=b(a).outerWidth(),f=b(a).outerHeight();a.x="object"==typeof d?d.clientX+document.body.scrollLeft-this.offset().left: "number"==typeof d?d*c/a.opt.maxVal:a.opt.initialval*c/a.opt.maxVal;a.y="object"==typeof d?d.clientY+document.body.scrollTop-this.offset().top:"number"==typeof d?(a.opt.maxVal-a.opt.initialval-d)*f/a.opt.maxVal:a.opt.initialval*f/a.opt.maxVal;a.y=this.outerHeight()-a.y;a.scaleX=a.x*a.opt.maxVal/c;a.scaleY=a.y*a.opt.maxVal/f;a.outOfRangeX=a.scaleX>a.opt.maxVal?a.scaleX-a.opt.maxVal:0>a.scaleX?a.scaleX:0;a.outOfRangeY=a.scaleY>a.opt.maxVal?a.scaleY-a.opt.maxVal:0>a.scaleY?a.scaleY:0;a.outOfRange="h"== a.opt.orientation?a.outOfRangeX:a.outOfRangeY;a.value="undefined"!=typeof d?"h"==a.opt.orientation?a.x>=this.outerWidth()?a.opt.maxVal:0>=a.x?0:a.scaleX:a.y>=this.outerHeight()?a.opt.maxVal:0>=a.y?0:a.scaleY:"h"==a.opt.orientation?a.scaleX:a.scaleY;"h"==a.opt.orientation?a.level.width(Math.floor(100*a.x/c)+"%"):a.level.height(Math.floor(100*a.y/f));a.lastVal===a.value&&("h"===a.opt.orientation&&(a.x>=this.outerWidth()||0>=a.x)||"h"!==a.opt.orientation&&(a.y>=this.outerHeight()||0>=a.y))||(console.debug(a.value), "function"===typeof a.opt.callback&&a.opt.callback(a),a.lastVal=a.value)}}};b.fn.simpleSlider=b.simpleSlider.init;b.fn.updateSliderVal=b.simpleSlider.updateSliderVal})(jQuery);