diff --git a/js/bpopup/bpopup.css b/js/bpopup/bpopup.css new file mode 100644 index 0000000..c324f88 --- /dev/null +++ b/js/bpopup/bpopup.css @@ -0,0 +1,120 @@ + + .modalBox { + background: #fff; + padding: 10px; + border-radius: 10px; + -moz-border-radius: 10px; + -o-border-radius: 10px; + -webkit-border-radius: 10px; + } + + .modalBox .content { + overflow-y: auto; + display: block; + } + + .modalBox .close { + display: block; + position: absolute; + top: -16px; + right: -15px; + width: 12px; + height: 12px; + padding: 8px; + border: 2px solid #fff; + cursor: pointer; + background: #000; + text-align: center; + font-size: 12px; + line-height: 12px; + color: #fff; + text-decoration: none; + font-weight: bold; + + border-radius: 50%; + -moz-border-radius: 50%; + -o-border-radius: 50%; + -webkit-border-radius: 50%; + } + + .modalBox, + .modalBox .close { + box-shadow: 0 0 5px 1px #c1c1c1; + -moz-box-shadow: 0 0 5px 1px #c1c1c1; + -o-box-shadow: 0 0 5px 1px #c1c1c1; + -webkit-box-shadow: 0 0 5px 1px #c1c1c1; + } + + .modalBox .close:hover { + background: #606060; + } + + .modalBoxWindow { + display: none; + } + +/* + =============== + ==== ALERT ==== + =============== +*/ + + .alert { + min-width: 250px; + padding: 8px; + margin: 5px 0; + } + + .alert .info { + height: 130px; + padding: 0 10px; + } + + .alert > div { + display: table-cell; + vertical-align: middle; + } + + .alert .pic { + width: 128px; + height: 128px; + background-repeat: none; + background-position: center center; + background-repeat: no-repeat; + background-size: cover; + } + + .alert.success .pic { + background-image: url(./img/success.png); + } + + .alert.warning .pic { + background-image: url(./img/warning.png); + } + + .alert.error .pic { + background-image: url(./img/error.png); + } + + .alert.send .pic { + background-image: url(./img/send.png); + } + + .alert.huck .pic { + background-image: url(./img/huck.png); + } + + .alert.robot .pic { + background-image: url(./img/robot.png); + } + + .alert.wait .pic { + width: 113px; + height: 128px; + background-image: url(./img/wait.png); + } + + .alert.SomethingWrong .pic { + background-image: url(./img/something-wrong.jpg); + } + \ No newline at end of file diff --git a/js/bpopup/bpopup.min.css b/js/bpopup/bpopup.min.css new file mode 100644 index 0000000..5aed2a5 --- /dev/null +++ b/js/bpopup/bpopup.min.css @@ -0,0 +1,120 @@ + + .modalBox { + background: #fff; + padding: 10px; + border-radius: 10px; + -moz-border-radius: 10px; + -o-border-radius: 10px; + -webkit-border-radius: 10px; + } + + .modalBox .content { + overflow-y: auto; + display: table; + } + + .modalBox .close { + display: block; + position: absolute; + top: -16px; + right: -15px; + width: 12px; + height: 12px; + padding: 8px; + border: 2px solid #fff; + cursor: pointer; + background: #000; + text-align: center; + font-size: 12px; + line-height: 12px; + color: #fff; + text-decoration: none; + font-weight: bold; + + border-radius: 50%; + -moz-border-radius: 50%; + -o-border-radius: 50%; + -webkit-border-radius: 50%; + } + + .modalBox, + .modalBox .close { + box-shadow: 0 0 5px 1px #c1c1c1; + -moz-box-shadow: 0 0 5px 1px #c1c1c1; + -o-box-shadow: 0 0 5px 1px #c1c1c1; + -webkit-box-shadow: 0 0 5px 1px #c1c1c1; + } + + .modalBox .close:hover { + background: #606060; + } + + .modalBoxWindow { + display: none; + } + +/* + =============== + ==== ALERT ==== + =============== +*/ + + .alert { + min-width: 250px; + padding: 8px; + margin: 5px 0; + } + + .alert .info { + height: 130px; + padding: 0 10px; + } + + .alert > div { + display: table-cell; + vertical-align: middle; + } + + .alert .pic { + width: 128px; + height: 128px; + background-repeat: none; + background-position: center center; + background-repeat: no-repeat; + background-size: cover; + } + + .alert.success .pic { + background-image: url(./img/success.png); + } + + .alert.warning .pic { + background-image: url(./img/warning.png); + } + + .alert.error .pic { + background-image: url(./img/error.png); + } + + .alert.send .pic { + background-image: url(./img/send.png); + } + + .alert.huck .pic { + background-image: url(./img/huck.png); + } + + .alert.robot .pic { + background-image: url(./img/robot.png); + } + + .alert.wait .pic { + width: 113px; + height: 128px; + background-image: url(./img/wait.png); + } + + .alert.SomethingWrong .pic { + background-image: url(./img/something-wrong.jpg); + } + \ No newline at end of file diff --git a/js/bpopup/img/error.png b/js/bpopup/img/error.png new file mode 100644 index 0000000..8188e90 Binary files /dev/null and b/js/bpopup/img/error.png differ diff --git a/js/bpopup/img/success.png b/js/bpopup/img/success.png new file mode 100644 index 0000000..4578072 Binary files /dev/null and b/js/bpopup/img/success.png differ diff --git a/js/bpopup/jquery.bpopup.js b/js/bpopup/jquery.bpopup.js new file mode 100644 index 0000000..a4dbc7d --- /dev/null +++ b/js/bpopup/jquery.bpopup.js @@ -0,0 +1,323 @@ +/*=================================================================================================================== +* @name: bPopup +* @type: jQuery +* @author: (c) Bjoern Klinggaard - @bklinggaard +* @demo: http://dinbror.dk/bpopup +* @version: 0.10.0 +* @requires jQuery 1.4.3 +*==================================================================================================================*/ +;(function($) { +'use strict'; +$.fn.bPopup = function(options, callback) { +if ($.isFunction(options)) { +callback = options; +options = null; +} +// OPTIONS +var o = $.extend({}, $.fn.bPopup.defaults, options); +// HIDE SCROLLBAR? +if (!o.scrollBar) +$('html').css('overflow', 'hidden'); +// VARIABLES +var $popup = this +, d = $(document) +, w = window +, $w = $(w) +, wH = windowHeight() +, wW = windowWidth() +, prefix = '__b-popup' +, isIOS6X = (/OS 6(_\d)+/i).test(navigator.userAgent) // Used for a temporary fix for ios6 timer bug when using zoom/scroll +, buffer = 200 +, popups = 0 +, id +, inside +, fixedVPos +, fixedHPos +, fixedPosStyle +, vPos +, hPos +, height +, width +, debounce +, autoCloseTO +; +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// PUBLIC FUNCTION - call it: $(element).bPopup().close(); +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +$popup.close = function() { +close(); +}; +$popup.reposition = function(animateSpeed) { +reposition(animateSpeed); +}; +return $popup.each(function() { +if ($(this).data('bPopup')) return; //POPUP already exists? +init(); +}); +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// HELPER FUNCTIONS - PRIVATE +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +function init() { +triggerCall(o.onOpen); +popups = ($w.data('bPopup') || 0) + 1, id = prefix + popups + '__',fixedVPos = o.position[1] !== 'auto', fixedHPos = o.position[0] !== 'auto', fixedPosStyle = o.positionStyle === 'fixed', height = $popup.outerHeight(true), width = $popup.outerWidth(true); +o.loadUrl ? createContent() : open(); +}; +function createContent() { +o.contentContainer = $(o.contentContainer || $popup); +switch (o.content) { +case ('iframe'): +var iframe = $(''); +iframe.appendTo(o.contentContainer); +height = $popup.outerHeight(true); +width = $popup.outerWidth(true); +open(); +iframe.attr('src', o.loadUrl); // setting iframe src after open due IE9 bug +triggerCall(o.loadCallback); +break; +case ('image'): +open(); +$('') +.load(function() { +triggerCall(o.loadCallback); +recenter($(this)); +}).attr('src', o.loadUrl).hide().appendTo(o.contentContainer); +break; +default: +open(); +$('
') +.load(o.loadUrl, o.loadData, function(response, status, xhr) { +triggerCall(o.loadCallback, status); +recenter($(this)); +}).hide().appendTo(o.contentContainer); +break; +} +}; +function open(){ +// MODAL OVERLAY +if (o.modal) { +$('
') +.css({backgroundColor: o.modalColor, position: 'fixed', top: 0, right:0, bottom:0, left: 0, opacity: 0, zIndex: o.zIndex + popups}) +.appendTo(o.appendTo) +.fadeTo(o.speed, o.opacity); +} +// POPUP +calcPosition(); +$popup +.data('bPopup', o).data('id',id) +.css({ +'left': o.transition == 'slideIn' || o.transition == 'slideBack' ? (o.transition == 'slideBack' ? d.scrollLeft() + wW : (hPos + width) *-1) : getLeftPos(!(!o.follow[0] && fixedHPos || fixedPosStyle)) +, 'position': o.positionStyle || 'absolute' +, 'top': o.transition == 'slideDown' || o.transition == 'slideUp' ? (o.transition == 'slideUp' ? d.scrollTop() + wH : vPos + height * -1) : getTopPos(!(!o.follow[1] && fixedVPos || fixedPosStyle)) +, 'z-index': o.zIndex + popups + 1 +}).each(function() { +if(o.appending) { +$(this).appendTo(o.appendTo); +} +}); +doTransition(true); +}; +function close() { +if (o.modal) { +$('.b-modal.'+$popup.data('id')) +.fadeTo(o.speed, 0, function() { +$(this).remove(); +}); +} +// Clean up +unbindEvents(); +clearTimeout(autoCloseTO); +// Close trasition +doTransition(); +return false; // Prevent default +}; +function reposition(animateSpeed){ +wH = windowHeight(); +wW = windowWidth(); +inside = insideWindow(); +if(inside){ +clearTimeout(debounce); +debounce = setTimeout(function(){ +calcPosition(); +animateSpeed = animateSpeed || o.followSpeed; +$popup +.dequeue() +.each(function() { +if(fixedPosStyle) { +$(this).css({ 'left': hPos, 'top': vPos }); +} +else { +$(this).animate({ 'left': o.follow[0] ? getLeftPos(true) : 'auto', 'top': o.follow[1] ? getTopPos(true) : 'auto' }, animateSpeed, o.followEasing); +} +}); +}, 50); +} +}; +//Eksperimental +function recenter(content){ +var _width = content.width(), _height = content.height(), css = {}; +o.contentContainer.css({height:_height,width:_width}); +if (_height >= $popup.height()){ +css.height = $popup.height(); +} +if(_width >= $popup.width()){ +css.width = $popup.width(); +} +height = $popup.outerHeight(true) +, width = $popup.outerWidth(true); +calcPosition(); +o.contentContainer.css({height:'auto',width:'auto'}); +css.left = getLeftPos(!(!o.follow[0] && fixedHPos || fixedPosStyle)), +css.top = getTopPos(!(!o.follow[1] && fixedVPos || fixedPosStyle)); +$popup +.animate( +css +, 250 +, function() { +content.show(); +inside = insideWindow(); +} +); +}; +function bindEvents() { +$w.data('bPopup', popups); +$popup.delegate('.bClose, .' + o.closeClass, 'click.'+id, close); // legacy, still supporting the close class bClose +if (o.modalClose) { +$('.b-modal.'+id).css('cursor', 'pointer').bind('click', close); +} +// Temporary disabling scroll/resize events on devices with IOS6+ +// due to a bug where events are dropped after pinch to zoom +if (!isIOS6X && (o.follow[0] || o.follow[1])) { +$w.bind('scroll.'+id, function() { +if(inside){ +$popup +.dequeue() +.animate({ 'left': o.follow[0] ? getLeftPos(!fixedPosStyle) : 'auto', 'top': o.follow[1] ? getTopPos(!fixedPosStyle) : 'auto' }, o.followSpeed, o.followEasing); +} +}).bind('resize.'+id, function() { +reposition(); +}); +} +if (o.escClose) { +d.bind('keydown.'+id, function(e) { +if (e.which == 27) { //escape +close(); +} +}); +} +}; +function unbindEvents() { +if (!o.scrollBar) { +$('html').css('overflow', 'auto'); +} +$('.b-modal.'+id).unbind('click'); +d.unbind('keydown.'+id); +$w.unbind('.'+id).data('bPopup', ($w.data('bPopup')-1 > 0) ? $w.data('bPopup')-1 : null); +$popup.undelegate('.bClose, .' + o.closeClass, 'click.'+id, close).data('bPopup', null); +}; +function doTransition(open) { +switch (open ? o.transition : o.transitionClose || o.transition) { +case "slideIn": +animate({ +left: open ? getLeftPos(!(!o.follow[0] && fixedHPos || fixedPosStyle)) : d.scrollLeft() - (width || $popup.outerWidth(true)) - buffer +}); +break; +case "slideBack": +animate({ +left: open ? getLeftPos(!(!o.follow[0] && fixedHPos || fixedPosStyle)) : d.scrollLeft() + wW + buffer +}); +break; +case "slideDown": +animate({ +top: open ? getTopPos(!(!o.follow[1] && fixedVPos || fixedPosStyle)) : d.scrollTop() - (height || $popup.outerHeight(true)) - buffer +}); +break; +case "slideUp": +animate({ +top: open ? getTopPos(!(!o.follow[1] && fixedVPos || fixedPosStyle)) : d.scrollTop() + wH + buffer +}); +break; +default: +//Hardtyping 1 and 0 to ensure opacity 1 and not 0.9999998 +$popup.stop().fadeTo(o.speed, open ? 1 : 0, function(){onCompleteCallback(open);}); +} +function animate(css){ +$popup +.css({display: 'block',opacity: 1}) +.animate(css, o.speed, o.easing, function(){ onCompleteCallback(open); }); +}; +}; +function onCompleteCallback(open){ +if(open){ +bindEvents(); +triggerCall(callback); +if(o.autoClose){ +autoCloseTO = setTimeout(close, o.autoClose); +} +} else { +$popup.hide(); +triggerCall(o.onClose); +if (o.loadUrl) { +o.contentContainer.empty(); +$popup.css({height: 'auto', width: 'auto'}); +} +} +}; +function getLeftPos(includeScroll){ +return includeScroll ? hPos + d.scrollLeft() : hPos; +}; +function getTopPos(includeScroll){ +return includeScroll ? vPos + d.scrollTop() : vPos; +}; +function triggerCall(func, arg) { +$.isFunction(func) && func.call($popup, arg); +}; +function calcPosition(){ +vPos = fixedVPos ? o.position[1] : Math.max(0, ((wH- $popup.outerHeight(true)) / 2) - o.amsl) +, hPos = fixedHPos ? o.position[0] : (wW - $popup.outerWidth(true)) / 2 +, inside = insideWindow(); +}; +function insideWindow(){ +return wH > $popup.outerHeight(true) && wW > $popup.outerWidth(true); +}; +function windowHeight(){ +return w.innerHeight || $w.height(); +}; +function windowWidth(){ +return w.innerWidth || $w.width(); +}; +}; +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// DEFAULT VALUES +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +$.fn.bPopup.defaults = { +amsl: 50 +, appending: true +, appendTo: 'body' +, autoClose: false +, closeClass: 'b-close' +, content: 'ajax' // ajax, iframe or image +, contentContainer: false +, easing: 'swing' +, escClose: true +, follow: [true, true] // x, y +, followEasing: 'swing' +, followSpeed: 500 +, iframeAttr: 'scrolling="no" frameborder="0"' +, loadCallback: false +, loadData: false +, loadUrl: false +, modal: true +, modalClose: true +, modalColor: '#000' +, onClose: false +, onOpen: false +, opacity: 0.7 +, position: ['auto', 'auto'] // x, y, +, positionStyle: 'absolute'// absolute or fixed +, scrollBar: true +, speed: 250 // open & close speed +, transition: 'fadeIn' //transitions: fadeIn, slideDown, slideIn, slideBack +, transitionClose: false +, zIndex: 9997 // popup gets z-index 9999, modal overlay 9998 +}; +})(jQuery); \ No newline at end of file diff --git a/js/bpopup/jquery.bpopup.min.js b/js/bpopup/jquery.bpopup.min.js new file mode 100644 index 0000000..3e59be9 --- /dev/null +++ b/js/bpopup/jquery.bpopup.min.js @@ -0,0 +1,12 @@ +;(function($){'use strict';$.fn.bPopup=function(options,callback){if($.isFunction(options)){callback=options;options=null;} +var o=$.extend({},$.fn.bPopup.defaults,options);if(!o.scrollBar) +$('html').css('overflow','hidden');var $popup=this,d=$(document),w=window,$w=$(w),wH=windowHeight(),wW=windowWidth(),prefix='__b-popup',isIOS6X=(/OS 6(_\d)+/i).test(navigator.userAgent),buffer=200,popups=0,id,inside,fixedVPos,fixedHPos,fixedPosStyle,vPos,hPos,height,width,debounce,autoCloseTO;$popup.close=function(){close();};$popup.reposition=function(animateSpeed){reposition(animateSpeed);};return $popup.each(function(){if($(this).data('bPopup'))return;init();});function init(){triggerCall(o.onOpen);popups=($w.data('bPopup')||0)+1,id=prefix+popups+'__',fixedVPos=o.position[1]!=='auto',fixedHPos=o.position[0]!=='auto',fixedPosStyle=o.positionStyle==='fixed',height=$popup.outerHeight(true),width=$popup.outerWidth(true);o.loadUrl?createContent():open();};function createContent(){o.contentContainer=$(o.contentContainer||$popup);switch(o.content){case('iframe'):var iframe=$('');iframe.appendTo(o.contentContainer);height=$popup.outerHeight(true);width=$popup.outerWidth(true);open();iframe.attr('src',o.loadUrl);triggerCall(o.loadCallback);break;case('image'):open();$('').load(function(){triggerCall(o.loadCallback);recenter($(this));}).attr('src',o.loadUrl).hide().appendTo(o.contentContainer);break;default:open();$('
').load(o.loadUrl,o.loadData,function(response,status,xhr){triggerCall(o.loadCallback,status);recenter($(this));}).hide().appendTo(o.contentContainer);break;}};function open(){if(o.modal){$('
').css({backgroundColor:o.modalColor,position:'fixed',top:0,right:0,bottom:0,left:0,opacity:0,zIndex:o.zIndex+popups}).appendTo(o.appendTo).fadeTo(o.speed,o.opacity);} +calcPosition();$popup.data('bPopup',o).data('id',id).css({'left':o.transition=='slideIn'||o.transition=='slideBack'?(o.transition=='slideBack'?d.scrollLeft()+wW:(hPos+width)*-1):getLeftPos(!(!o.follow[0]&&fixedHPos||fixedPosStyle)),'position':o.positionStyle||'absolute','top':o.transition=='slideDown'||o.transition=='slideUp'?(o.transition=='slideUp'?d.scrollTop()+wH:vPos+height*-1):getTopPos(!(!o.follow[1]&&fixedVPos||fixedPosStyle)),'z-index':o.zIndex+popups+1}).each(function(){if(o.appending){$(this).appendTo(o.appendTo);}});doTransition(true);};function close(){if(o.modal){$('.b-modal.'+$popup.data('id')).fadeTo(o.speed,0,function(){$(this).remove();});} +unbindEvents();clearTimeout(autoCloseTO);doTransition();return false;};function reposition(animateSpeed){wH=windowHeight();wW=windowWidth();inside=insideWindow();if(inside){clearTimeout(debounce);debounce=setTimeout(function(){calcPosition();animateSpeed=animateSpeed||o.followSpeed;$popup.dequeue().each(function(){if(fixedPosStyle){$(this).css({'left':hPos,'top':vPos});} +else{$(this).animate({'left':o.follow[0]?getLeftPos(true):'auto','top':o.follow[1]?getTopPos(true):'auto'},animateSpeed,o.followEasing);}});},50);}};function recenter(content){var _width=content.width(),_height=content.height(),css={};o.contentContainer.css({height:_height,width:_width});if(_height>=$popup.height()){css.height=$popup.height();} +if(_width>=$popup.width()){css.width=$popup.width();} +height=$popup.outerHeight(true),width=$popup.outerWidth(true);calcPosition();o.contentContainer.css({height:'auto',width:'auto'});css.left=getLeftPos(!(!o.follow[0]&&fixedHPos||fixedPosStyle)),css.top=getTopPos(!(!o.follow[1]&&fixedVPos||fixedPosStyle));$popup.animate(css,250,function(){content.show();inside=insideWindow();});};function bindEvents(){$w.data('bPopup',popups);$popup.delegate('.bClose, .'+o.closeClass,'click.'+id,close);if(o.modalClose){$('.b-modal.'+id).css('cursor','pointer').bind('click',close);} +if(!isIOS6X&&(o.follow[0]||o.follow[1])){$w.bind('scroll.'+id,function(){if(inside){$popup.dequeue().animate({'left':o.follow[0]?getLeftPos(!fixedPosStyle):'auto','top':o.follow[1]?getTopPos(!fixedPosStyle):'auto'},o.followSpeed,o.followEasing);}}).bind('resize.'+id,function(){reposition();});} +if(o.escClose){d.bind('keydown.'+id,function(e){if(e.which==27){close();}});}};function unbindEvents(){if(!o.scrollBar){$('html').css('overflow','auto');} +$('.b-modal.'+id).unbind('click');d.unbind('keydown.'+id);$w.unbind('.'+id).data('bPopup',($w.data('bPopup')-1>0)?$w.data('bPopup')-1:null);$popup.undelegate('.bClose, .'+o.closeClass,'click.'+id,close).data('bPopup',null);};function doTransition(open){switch(open?o.transition:o.transitionClose||o.transition){case"slideIn":animate({left:open?getLeftPos(!(!o.follow[0]&&fixedHPos||fixedPosStyle)):d.scrollLeft()-(width||$popup.outerWidth(true))-buffer});break;case"slideBack":animate({left:open?getLeftPos(!(!o.follow[0]&&fixedHPos||fixedPosStyle)):d.scrollLeft()+wW+buffer});break;case"slideDown":animate({top:open?getTopPos(!(!o.follow[1]&&fixedVPos||fixedPosStyle)):d.scrollTop()-(height||$popup.outerHeight(true))-buffer});break;case"slideUp":animate({top:open?getTopPos(!(!o.follow[1]&&fixedVPos||fixedPosStyle)):d.scrollTop()+wH+buffer});break;default:$popup.stop().fadeTo(o.speed,open?1:0,function(){onCompleteCallback(open);});} +function animate(css){$popup.css({display:'block',opacity:1}).animate(css,o.speed,o.easing,function(){onCompleteCallback(open);});};};function onCompleteCallback(open){if(open){bindEvents();triggerCall(callback);if(o.autoClose){autoCloseTO=setTimeout(close,o.autoClose);}}else{$popup.hide();triggerCall(o.onClose);if(o.loadUrl){o.contentContainer.empty();$popup.css({height:'auto',width:'auto'});}}};function getLeftPos(includeScroll){return includeScroll?hPos+d.scrollLeft():hPos;};function getTopPos(includeScroll){return includeScroll?vPos+d.scrollTop():vPos;};function triggerCall(func,arg){$.isFunction(func)&&func.call($popup,arg);};function calcPosition(){vPos=fixedVPos?o.position[1]:Math.max(0,((wH-$popup.outerHeight(true))/2)-o.amsl),hPos=fixedHPos?o.position[0]:(wW-$popup.outerWidth(true))/2,inside=insideWindow();};function insideWindow(){return wH>$popup.outerHeight(true)&&wW>$popup.outerWidth(true);};function windowHeight(){return w.innerHeight||$w.height();};function windowWidth(){return w.innerWidth||$w.width();};};$.fn.bPopup.defaults={amsl:50,appending:true,appendTo:'body',autoClose:false,closeClass:'b-close',content:'ajax',contentContainer:false,easing:'swing',escClose:true,follow:[true,true],followEasing:'swing',followSpeed:500,iframeAttr:'scrolling="no" frameborder="0"',loadCallback:false,loadData:false,loadUrl:false,modal:true,modalClose:true,modalColor:'#000',onClose:false,onOpen:false,opacity:0.7,position:['auto','auto'],positionStyle:'absolute',scrollBar:true,speed:250,transition:'fadeIn',transitionClose:false,zIndex:9997};})(jQuery); \ No newline at end of file diff --git a/js/bpopup/jquery.easing.js b/js/bpopup/jquery.easing.js new file mode 100644 index 0000000..ef74321 --- /dev/null +++ b/js/bpopup/jquery.easing.js @@ -0,0 +1,205 @@ +/* + * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ + * + * Uses the built in easing capabilities added In jQuery 1.1 + * to offer multiple easing options + * + * TERMS OF USE - jQuery Easing + * + * Open source under the BSD License. + * + * Copyright © 2008 George McGinley Smith + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * Neither the name of the author nor the names of contributors may be used to endorse + * or promote products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * +*/ + +// t: current time, b: begInnIng value, c: change In value, d: duration +jQuery.easing['jswing'] = jQuery.easing['swing']; + +jQuery.extend( jQuery.easing, +{ + def: 'easeOutQuad', + swing: function (x, t, b, c, d) { + //alert(jQuery.easing.default); + return jQuery.easing[jQuery.easing.def](x, t, b, c, d); + }, + easeInQuad: function (x, t, b, c, d) { + return c*(t/=d)*t + b; + }, + easeOutQuad: function (x, t, b, c, d) { + return -c *(t/=d)*(t-2) + b; + }, + easeInOutQuad: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t + b; + return -c/2 * ((--t)*(t-2) - 1) + b; + }, + easeInCubic: function (x, t, b, c, d) { + return c*(t/=d)*t*t + b; + }, + easeOutCubic: function (x, t, b, c, d) { + return c*((t=t/d-1)*t*t + 1) + b; + }, + easeInOutCubic: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t*t + b; + return c/2*((t-=2)*t*t + 2) + b; + }, + easeInQuart: function (x, t, b, c, d) { + return c*(t/=d)*t*t*t + b; + }, + easeOutQuart: function (x, t, b, c, d) { + return -c * ((t=t/d-1)*t*t*t - 1) + b; + }, + easeInOutQuart: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t*t*t + b; + return -c/2 * ((t-=2)*t*t*t - 2) + b; + }, + easeInQuint: function (x, t, b, c, d) { + return c*(t/=d)*t*t*t*t + b; + }, + easeOutQuint: function (x, t, b, c, d) { + return c*((t=t/d-1)*t*t*t*t + 1) + b; + }, + easeInOutQuint: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; + return c/2*((t-=2)*t*t*t*t + 2) + b; + }, + easeInSine: function (x, t, b, c, d) { + return -c * Math.cos(t/d * (Math.PI/2)) + c + b; + }, + easeOutSine: function (x, t, b, c, d) { + return c * Math.sin(t/d * (Math.PI/2)) + b; + }, + easeInOutSine: function (x, t, b, c, d) { + return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; + }, + easeInExpo: function (x, t, b, c, d) { + return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; + }, + easeOutExpo: function (x, t, b, c, d) { + return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; + }, + easeInOutExpo: function (x, t, b, c, d) { + if (t==0) return b; + if (t==d) return b+c; + if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; + return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; + }, + easeInCirc: function (x, t, b, c, d) { + return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; + }, + easeOutCirc: function (x, t, b, c, d) { + return c * Math.sqrt(1 - (t=t/d-1)*t) + b; + }, + easeInOutCirc: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; + return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; + }, + easeInElastic: function (x, t, b, c, d) { + var s=1.70158;var p=0;var a=c; + if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; + if (a < Math.abs(c)) { a=c; var s=p/4; } + else var s = p/(2*Math.PI) * Math.asin (c/a); + return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; + }, + easeOutElastic: function (x, t, b, c, d) { + var s=1.70158;var p=0;var a=c; + if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; + if (a < Math.abs(c)) { a=c; var s=p/4; } + else var s = p/(2*Math.PI) * Math.asin (c/a); + return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; + }, + easeInOutElastic: function (x, t, b, c, d) { + var s=1.70158;var p=0;var a=c; + if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); + if (a < Math.abs(c)) { a=c; var s=p/4; } + else var s = p/(2*Math.PI) * Math.asin (c/a); + if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; + return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; + }, + easeInBack: function (x, t, b, c, d, s) { + if (s == undefined) s = 1.70158; + return c*(t/=d)*t*((s+1)*t - s) + b; + }, + easeOutBack: function (x, t, b, c, d, s) { + if (s == undefined) s = 1.70158; + return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; + }, + easeInOutBack: function (x, t, b, c, d, s) { + if (s == undefined) s = 1.70158; + if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; + return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; + }, + easeInBounce: function (x, t, b, c, d) { + return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b; + }, + easeOutBounce: function (x, t, b, c, d) { + if ((t/=d) < (1/2.75)) { + return c*(7.5625*t*t) + b; + } else if (t < (2/2.75)) { + return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; + } else if (t < (2.5/2.75)) { + return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; + } else { + return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; + } + }, + easeInOutBounce: function (x, t, b, c, d) { + if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; + return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; + } +}); + +/* + * + * TERMS OF USE - EASING EQUATIONS + * + * Open source under the BSD License. + * + * Copyright © 2001 Robert Penner + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * Neither the name of the author nor the names of contributors may be used to endorse + * or promote products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ \ No newline at end of file diff --git a/js/bpopup/jquery.easing.min.js b/js/bpopup/jquery.easing.min.js new file mode 100644 index 0000000..21305a5 --- /dev/null +++ b/js/bpopup/jquery.easing.min.js @@ -0,0 +1,4 @@ +;jQuery.easing['jswing']=jQuery.easing['swing'];jQuery.extend(jQuery.easing,{def:'easeOutQuad',swing:function(x,t,b,c,d){return jQuery.easing[jQuery.easing.def](x,t,b,c,d);},easeInQuad:function(x,t,b,c,d){return c*(t/=d)*t+b;},easeOutQuad:function(x,t,b,c,d){return-c*(t/=d)*(t-2)+b;},easeInOutQuad:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*((--t)*(t-2)-1)+b;},easeInCubic:function(x,t,b,c,d){return c*(t/=d)*t*t+b;},easeOutCubic:function(x,t,b,c,d){return c*((t=t/d-1)*t*t+1)+b;},easeInOutCubic:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t+b;return c/2*((t-=2)*t*t+2)+b;},easeInQuart:function(x,t,b,c,d){return c*(t/=d)*t*t*t+b;},easeOutQuart:function(x,t,b,c,d){return-c*((t=t/d-1)*t*t*t-1)+b;},easeInOutQuart:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t+b;return-c/2*((t-=2)*t*t*t-2)+b;},easeInQuint:function(x,t,b,c,d){return c*(t/=d)*t*t*t*t+b;},easeOutQuint:function(x,t,b,c,d){return c*((t=t/d-1)*t*t*t*t+1)+b;},easeInOutQuint:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t*t+b;return c/2*((t-=2)*t*t*t*t+2)+b;},easeInSine:function(x,t,b,c,d){return-c*Math.cos(t/d*(Math.PI/2))+c+b;},easeOutSine:function(x,t,b,c,d){return c*Math.sin(t/d*(Math.PI/2))+b;},easeInOutSine:function(x,t,b,c,d){return-c/2*(Math.cos(Math.PI*t/d)-1)+b;},easeInExpo:function(x,t,b,c,d){return(t==0)?b:c*Math.pow(2,10*(t/d-1))+b;},easeOutExpo:function(x,t,b,c,d){return(t==d)?b+c:c*(-Math.pow(2,-10*t/d)+1)+b;},easeInOutExpo:function(x,t,b,c,d){if(t==0)return b;if(t==d)return b+c;if((t/=d/2)<1)return c/2*Math.pow(2,10*(t-1))+b;return c/2*(-Math.pow(2,-10*--t)+2)+b;},easeInCirc:function(x,t,b,c,d){return-c*(Math.sqrt(1-(t/=d)*t)-1)+b;},easeOutCirc:function(x,t,b,c,d){return c*Math.sqrt(1-(t=t/d-1)*t)+b;},easeInOutCirc:function(x,t,b,c,d){if((t/=d/2)<1)return-c/2*(Math.sqrt(1-t*t)-1)+b;return c/2*(Math.sqrt(1-(t-=2)*t)+1)+b;},easeInElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(aX

' + d + '

Pop another up'). bPopup({ + closeClass: "close" + d, + position: [c, e], + follow: [!1, !1], + onClose: function() { + d--; + a(this).remove() + } + }) + ) : c.bPopup (j.data("bpopup") || {} ) + }) + }); + var b = function(a, b) { + return ~~ (Math.random() * (b - a + 1) + a) + } +})(jQuery); diff --git a/js/bpopup/scripting.min.js b/js/bpopup/scripting.min.js new file mode 100644 index 0000000..f33239d --- /dev/null +++ b/js/bpopup/scripting.min.js @@ -0,0 +1,3 @@ +;(function(a){var m=a("#popup"),n=a("#popup2"),d=0;a(function(){a(".small.special").on("open.bpopup",function(){alert("I'm special")});a("body").on("click",".small",function(){var c=a(this).hasClass("pop1")?m:n,h=a(".content"),j=a(this);if(a(this).hasClass("events")) +c.bPopup({onOpen:function(){alert("onOpen fired")},onClose:function(){alert("onClose fired")}},function(){alert("Callback fired")});else if(a(this).hasClass("random")){var e=b(0,a(window).width()-500),p=b(a(document).scrollTop(),a(document).scrollTop()+a(window).height()-300),k=3==b(0,4),l=b(0,2),f="fadeIn",g=350;1===l?(f="slideDown",g=600):2===l&&(f="slideIn",g=500);c.bPopup({follow:k?[!0,!0]:[!1,!1],position:!k?[e,p]:["auto","auto"],opacity:"0."+b(1,9),positionStyle:25==b(0,50)?"fixed":"absolute",modal:0==b(0,10)?!1:!0,modalClose:0==b(0,5)?!1:!0,modalColor:"hsl("+b(0,360)+",100%, 50%)",transition:f,speed:g})}else a(this).hasClass("x-content")?c.bPopup({onOpen:function(){h.html(j.data("bpopup")||{})},onClose:function(){h.empty()}}):a(this).hasClass("multi")?(d++,c=b(0,a(window).width()-500),e=b(a(document).scrollTop(),a(document).scrollTop()+ +a(window).height()-300),a('
X

'+d+'

Pop another up
').bPopup({closeClass:"close"+d,position:[c,e],follow:[!1,!1],onClose:function(){d--;a(this).remove()}})):c.bPopup(j.data("bpopup")||{})})});var b=function(a,b){return~~(Math.random()*(b-a+1)+a)}})(jQuery); \ No newline at end of file diff --git a/js/modalBox/modalBox.js b/js/modalBox/modalBox.js new file mode 100644 index 0000000..8ad2ec3 --- /dev/null +++ b/js/modalBox/modalBox.js @@ -0,0 +1,69 @@ + + // ============= + // ==== VAR ==== + // ============= + + var $modalBoxTotal = 0; + + // =============== + // ==== METOD ==== + // =============== + + function percentToPix ($value) + { + return $value == null ? 0 : parseInt (screen.width * $value / 100); + } + + function modalBoxLoad (content, $option) + { + var ID = $modalBoxTotal; + $width = 80; + $modalBoxId = 'modalBoxId-' + ID; + $style = 'style="max-width:' + percentToPix ($width) + 'px;"'; + + var $modal = + ''; + + var $default = { + 'id': ID, + 'transition': 'slideDown', +// 'closeClass': 'bClose-' + ID, + 'onOpen': function() { + $modalBoxTotal++; + $(this).html($modal) + }, + 'onClose': function() { + $modalBoxTotal--; + $('.' + $modalBoxId).remove(); + }, + 'width': $width + }; + + var $setting = $.extend({}, $default, $option); + + if ($('#duty').length == 0) + { + $('body').append('
').promise().done(function() + { + $('#duty').bPopup($setting).reposition(1); + }); + } + else + { + $('#duty').bPopup($setting).reposition(1); + } + } + + function modalBoxClose () + { + $('#duty').bPopup().close(); + } + + + function isModalBox () + { + return ($modalBoxTotal > 0) ? true : false; + } -- libgit2 0.21.4