1//Button Trigger 2(function( $ ){ 3 var $this = new Object(); 4 var methods = { 5 init : function( options ) { 6 $this = $.extend({}, this, methods); 7 $this.searching = false; 8 $this.o = new Object(); 9 10 var defaultOptions = { 11 overlaySelector: '.md-overlay', 12 closeSelector: '.md-close', 13 classAddAfterOpen: 'md-show', 14 modalAttr: 'data-modal', 15 perspectiveClass: 'md-perspective', 16 perspectiveSetClass: 'md-setperspective', 17 afterOpen: function(button, modal) { 18 //do your stuff 19 }, 20 afterClose: function(button, modal) { 21 //do your suff 22 } 23 }; 24 25 $this.o = $.extend({}, defaultOptions, options); 26 $this.n = new Object(); 27 28 29 var overlay = $($this.o.overlaySelector); 30 $(this).click(function() { 31 var modal = $('#' + $(this).attr($this.o.modalAttr)), 32 close = $($this.o.closeSelector, modal); 33 var el = $(this); 34 $(modal).addClass($this.o.classAddAfterOpen); 35 /* overlay.removeEventListener( 'click', removeModalHandler ); 36 overlay.addEventListener( 'click', removeModalHandler ); */ 37 $(overlay).on('click', function () { 38 removeModalHandler(); 39 $this.afterClose(el, modal); 40 $(overlay).off('click'); 41 }); 42 if( $(el).hasClass($this.o.perspectiveSetClass) ) { 43 setTimeout( function() { 44 $(document.documentElement).addClass($this.o.perspectiveClass); 45 }, 25 ); 46 } 47 48 $this.afterOpen(el, modal); 49 setTimeout( function() { 50 modal.css({'perspective':'none'}); 51 52 //3D Blur Bug Fix 53 if(modal.height() % 2 != 0){modal.css({'height':modal.height() + 1});} 54 55 }, 500 ); 56 57 function removeModal( hasPerspective ) { 58 $(modal).removeClass($this.o.classAddAfterOpen); 59 modal.css({'perspective':'1300px'}); 60 if( hasPerspective ) { 61 $(document.documentElement).removeClass($this.o.perspectiveClass); 62 } 63 } 64 65 function removeModalHandler() { 66 removeModal($(el).hasClass($this.o.perspectiveSetClass)); 67 } 68 69 $(close).on( 'click', function( ev ) { 70 ev.stopPropagation(); 71 removeModalHandler(); 72 $this.afterClose(el, modal); 73 }); 74 75 }); 76 77 }, 78 afterOpen: function (button, modal) { 79 $this.o.afterOpen(button, modal); 80 }, 81 afterClose: function (button, modal) { 82 $this.o.afterClose(button, modal); 83 } 84 }; 85 86 $.fn.modalEffects = function( method ) { 87 if ( methods[method] ) { 88 return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 )); 89 } else if ( typeof method === 'object' || ! method ) { 90 return methods.init.apply( this, arguments ); 91 } else { 92 $.error( 'Method ' + method + ' does not exist on jQuery.modalEffects' ); 93 } 94 95 }; 96 function is_touch_device(){ 97 return !!("ontouchstart" in window) ? 1 : 0; 98 } 99})( jQuery ); 100 101//Nifty Modal 102;(function($) { 103 104 $.fn.niftyModal = function(method) { 105 106 var defaults = { 107 overlaySelector: '.md-overlay', 108 closeSelector: '.md-close', 109 classAddAfterOpen: 'md-show', 110 modalAttr: 'data-modal', 111 perspectiveClass: 'md-perspective', 112 perspectiveSetClass: 'md-setperspective', 113 afterOpen: function(modal) { 114 //do your stuff 115 }, 116 afterClose: function(modal) { 117 //do your suff 118 } 119 } 120 121 var config = {} 122 123 var methods = { 124 125 init : function(options) { 126 return this.each(function() { 127 config = $.extend({}, defaults, options); 128 var modal = $(this); 129 130 //Show modal 131 helpers.showModal(modal); 132 133 }); 134 }, 135 136 toggle: function(options) { 137 return this.each(function() { 138 config = $.extend({}, defaults, options); 139 var modal = $(this); 140 if(modal.hasClass(config.classAddAfterOpen)){ 141 helpers.removeModal(modal); 142 }else{ 143 helpers.showModal(modal); 144 } 145 }); 146 }, 147 148 show: function(options) { 149 config = $.extend({}, defaults, options); 150 return this.each(function() { 151 helpers.showModal($(this)); 152 }); 153 }, 154 155 hide: function(options) { 156 config = $.extend({}, defaults, options); 157 return this.each(function() { 158 helpers.removeModal($(this)); 159 }); 160 } 161 } 162 163 var helpers = { 164 165 removeModal: function(mod) { 166 mod.removeClass(config.classAddAfterOpen); 167 mod.css({'perspective':'1300px'}); 168 mod.trigger('hide'); 169 }, 170 171 showModal: function(mod){
172 var overlay = $(config.overlaySelector); 173 var close = $(config.closeSelector, mod); 174 mod.addClass(config.classAddAfterOpen); 175 176 //Overlay Click Event 177 overlay.on('click', function (e) { 178 var after = config.afterClose(mod, e); 179 if( after === undefined || after != false){ 180 helpers.removeModal(mod); 181 overlay.off('click'); 182 } 183 }); 184 185 //Fire after open event 186 config.afterOpen(mod); 187 setTimeout( function() { 188 mod.css({'perspective':'none'}); 189 190 //3D Blur Bug Fix 191 if(mod.height() % 2 != 0){mod.css({'height':mod.height() + 1});} 192 193 }, 500 ); 194 195 //Close Event 196 close.on( 'click', function( ev ) { 197 var after = config.afterClose(mod, ev); 198 if( after === undefined || after != false){ 199 helpers.removeModal(mod); 200 overlay.off('click'); 201 } 202 ev.stopPropagation(); 203 }); 204 205 mod.trigger('show'); 206 } 207 208 } 209 210 if (methods[method]) { 211 return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); 212 } else if (typeof method === 'object' || !method) { 213 return methods.init.apply(this, arguments); 214 } else { 215 $.error( 'Method "' + method + '" does not exist in niftyModal plugin!'); 216 } 217 218 } 219 220})(jQuery); 221 222$(document).ready(function(){ 223 $(".md-trigger").modalEffects(); 224});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.