js.mutate.min.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of neo4j-doctools Show documentation
Show all versions of neo4j-doctools Show documentation
Neo4j Documentation Tools.
/**
* @license jQuery-mutate
* Licensed under the MIT license
* http://www.opensource.org/licenses/mit-license.php
* Date: 2014-02-04
*/
(function(a){mutate_event_stack=[{name:"width",handler:function(b){n={el:b};if(!a(n.el).data("mutate-width")){a(n.el).data("mutate-width",a(n.el).width())}if(a(n.el).data("mutate-width")&&a(n.el).width()!=a(n.el).data("mutate-width")){a(n.el).data("mutate-width",a(n.el).width());return true}return false}},{name:"height",handler:function(b){element=b;if(!a(element).data("mutate-height")){a(element).data("mutate-height",a(element).height())}if(a(element).data("mutate-height")&&a(element).height()!=a(element).data("mutate-height")){a(element).data("mutate-height",a(element).height());return true}}},{name:"top",handler:function(b){if(!a(b).data("mutate-top")){a(b).data("mutate-top",a(b).css("top"))}if(a(b).data("mutate-top")&&a(b).css("top")!=a(b).data("mutate-top")){a(b).data("mutate-top",a(b).css("top"));return true}}},{name:"bottom",handler:function(b){if(!a(b).data("mutate-bottom")){a(b).data("mutate-bottom",a(b).css("bottom"))}if(a(b).data("mutate-bottom")&&a(b).css("bottom")!=a(b).data("mutate-bottom")){a(b).data("mutate-bottom",a(b).css("bottom"));return true}}},{name:"right",handler:function(b){if(!a(b).data("mutate-right")){a(b).data("mutate-right",a(b).css("right"))}if(a(b).data("mutate-right")&&a(b).css("right")!=a(b).data("mutate-right")){a(b).data("mutate-right",a(b).css("right"));return true}}},{name:"left",handler:function(b){if(!a(b).data("mutate-left")){a(b).data("mutate-left",a(b).css("left"))}if(a(b).data("mutate-left")&&a(b).css("left")!=a(b).data("mutate-left")){a(b).data("mutate-left",a(b).css("left"));return true}}},{name:"hide",handler:function(b){if(a(b).is(":hidden")){return true}}},{name:"show",handler:function(b){if(a(b).is(":visible")){return true}}},{name:"scrollHeight",handler:function(b){if(!a(b).data("prev-scrollHeight")){a(b).data("prev-scrollHeight",a(b)[0].scrollHeight)}if(a(b).data("prev-scrollHeight")&&a(b)[0].scrollHeight!=a(b).data("prev-scrollHeight")){a(b).data("prev-scrollHeight",a(b)[0].scrollHeight);return true}}},{name:"scrollWidth",handler:function(b){if(!a(b).data("prev-scrollWidth")){a(b).data("prev-scrollWidth",a(b)[0].scrollWidth)}if(a(b).data("prev-scrollWidth")&&a(b)[0].scrollWidth!=a(b).data("prev-scrollWidth")){a(b).data("prev-scrollWidth",a(b)[0].scrollWidth);return true}}},{name:"scrollTop",handler:function(b){if(!a(b).data("prev-scrollTop")){a(b).data("prev-scrollTop",a(b)[0].scrollTop())}if(a(b).data("prev-scrollTop")&&a(b)[0].scrollTop()!=a(b).data("prev-scrollTop")){a(b).data("prev-scrollTop",a(b)[0].scrollTop());return true}}},{name:"scrollLeft",handler:function(b){if(!a(b).data("prev-scrollLeft")){a(b).data("prev-scrollLeft",a(b)[0].scrollLeft())}if(a(b).data("prev-scrollLeft")&&a(b)[0].scrollLeft()!=a(b).data("prev-scrollLeft")){a(b).data("prev-scrollLeft",a(b)[0].scrollLeft());return true}}}]})(jQuery);
;(function($){mutate={speed:1,event_stack:mutate_event_stack,stack:[],events:{},add_event:function(evt){mutate.events[evt.name]=evt.handler;},add:function(event_name,selector,callback,false_callback){mutate.stack[mutate.stack.length]={event_name:event_name,selector:selector,callback:callback,false_callback:false_callback}}};function reset(){var parent=mutate;if(parent.event_stack!='undefined'&&parent.event_stack.length){$.each(parent.event_stack,function(j,k){mutate.add_event(k);});}
parent.event_stack=[];$.each(parent.stack,function(i,n){$(n.selector).each(function(a,b){if(parent.events[n.event_name](b)===true){if(n['callback'])n.callback(b,n);}else{if(n['false_callback'])n.false_callback(b,n)}})})
setTimeout(reset,mutate.speed);}
reset();$.fn.extend({mutate:function(){var event_name=false,callback=arguments[1],selector=this,false_callback=arguments[2]?arguments[2]:function(){};if(arguments[0].toLowerCase()=='extend'){mutate.add_event(callback);return this;}
$.each($.trim(arguments[0]).split(' '),function(i,n){event_name=n;mutate.add(event_name,selector,callback,false_callback);});return this;}});})(jQuery);