/*! flypanels - v0.12.1 - 2015-06-17 * https://github.com/subzane/flypanels * copyright (c) 2015 andreas norman; licensed mit */ !function(a){function b(b,d){function e(){f(),c=a(".flypanels-left").css("width"),y(),d.search.init&&t(),d.treemenu.init&&g(),a(document).ready(function(){e.removeclass("preload")}),b("oninit")}function f(){a(".flypanels-left").css("height",f),a(".flypanels-right").css("height",f),a(".flypanels-overlay").css("height",f)}function g(){(kitutils.isandroid()||kitutils.isios())&&a(".flypanels-treemenu").addclass("touch"),a(".flypanels-treemenu li.haschildren "+d.treemenu.expandhandler).click(function(b){a(this).parent().parent().toggleclass("expanded"),b.preventdefault()})}function h(){r(),p(),n()}function i(){a("body").removeclass("flypanels-open"),a("html").removeclass("flypanels-open"),b("oncloseleft")}function j(){a("body").removeclass("flypanels-open"),a("html").removeclass("flypanels-open"),b("oncloseright")}function k(){a("body").addclass("flypanels-open"),a("html").addclass("flypanels-open"),b("onopenleft")}function l(){a("body").addclass("flypanels-open"),a("html").addclass("flypanels-open"),b("onopenright")}function m(){a(".flypanels-content").append('
'),a(".flypanels-content").on("click touchmove touchend touchleave touchcancel",function(a){h(),a.preventdefault()}),b("onopen")}function n(){a(".flypanels-content #flypanels-overlay").remove(),a(".flypanels-content").off("click touchmove touchend touchleave touchcancel"),b("onclose")}function o(b){e.addclass("openright"),settimeout(function(){a(".flypanels-right").find('[data-panel="'+b+'"]').show(),l(),m()},200)}function p(){e.removeclass("openright"),settimeout(function(){a(".offcanvas .panelcontent").hide(),j(),n()},200)}function q(b){e.addclass("openleft"),settimeout(function(){a(".flypanels-left").find('[data-panel="'+b+'"]').show(),k(),m()},200)}function r(){e.removeclass("openleft"),settimeout(function(){a(".offcanvas .panelcontent").hide(),i(),n()},200)}function s(){f=window.innerheight,f()}function t(){(kitutils.isandroid()||kitutils.isios())&&a(".flypanels-searchresult").addclass("touch"),d.search.searchpanel.find(".searchbutton").on("click",function(a){a.preventdefault(),v("show"),w(d.search.searchpanel.find(".searchbox input").val())}),d.search.searchpanel.find(".searchbox input").keydown(function(b){13===b.which&&(v("show"),w(a(this).val()),a(this).blur())}),j.has("searchquery")===!0&&d.search.savequerycookie===!0&&w(j.get("searchquery"))}function u(a){"hide"===a?d.search.searchpanel.find(".errormsg").hide():d.search.searchpanel.find(".errormsg").show()}function v(a){"hide"===a?d.search.searchpanel.find(".loading").hide():d.search.searchpanel.find(".loading").show()}function w(b){u("hide"),$jsonurl=d.search.searchpanel.find(".searchbox").data("searchurl"),$ajaxcall=a.ajax({url:$jsonurl+"&q="+b,datatype:"json"}),$ajaxcall.done(function(a){var c;$foundresults=a.items.length,$foundresults>0?(d.search.savequerycookie===!0&&j.set("searchquery",b,null,"/"),c=x(a.items)):(d.search.savequerycookie===!0&&j.remove("searchquery","/"),u("show")),d.search.searchpanel.find(".resultinfo .query").html(b),d.search.searchpanel.find(".resultinfo .num").html($foundresults),d.search.searchpanel.find(".flypanels-searchresult").html(c),v("hide"),d.search.searchpanel.find(".resultinfo").show(),d.search.searchpanel.find(".flypanels-searchresult").show()}),$ajaxcall.fail(function(){u("show")})}function x(a){output="",output}function y(){if(a(".panelcontent").on("touchmove",function(b){a(this).prop("scrollheight")<=parseint(f,10)&&b.preventdefault()}),a(".offcanvas").on("touchmove",function(a){a.preventdefault()}).on("touchmove",".panelcontent",function(a){a.stoppropagation()}),a(".flypanels-button-left").on("click",function(){var b=a(this).data("panel");a(".flypanels-container").hasclass("openleft")?r():q(b)}),a(".flypanels-button-right").on("click",function(){var b=a(this).data("panel");a(".flypanels-container").hasclass("openright")?p():o(b)}),g===!0){var b;a(window).resize(function(){cleartimeout(b),b=settimeout(s,100)})}a(window).bind("orientationchange",function(){f()}),b("onload")}function z(a,b){return b?void(d[a]=b):d[a]}function a(){e.each(function(){var b=a(this);b("ondestroy"),b.removedata("plugin_"+c)})}function b(a){void 0!==d[a]&&d[a].call(d)}var c,d=b,e=a(b),f=window.innerheight,g=!0,h=(parseint(a(".flypanels-topbar").css("height"),10),{init:!1,expandhandler:"a.expand"});d.treemenu=a.extend({},h,d.treemenu);var i={init:!1,savequerycookie:!1,searchpanel:a(".offcanvas").find('[data-panel="search"]')};d.search=a.extend({},i,d.search),d=a.extend({},a.fn[c].defaults,d);var j={get:function(a){return a?decodeuricomponent(document.cookie.replace(new regexp("(?:(?:^|.*;)\\s*"+encodeuricomponent(a).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1"))||null:null},set:function(a,b,c,d,e,f){if(!a||/^(?:expires|max\-age|path|domain|secure)$/i.test(a))return!1;var g="";if(c)switch(c.constructor){case number:g=1/0===c?"; expires=fri, 31 dec 9999 23:59:59 gmt":"; max-age="+c;break;case string:g="; expires="+c;break;case date:g="; expires="+c.toutcstring()}return document.cookie=encodeuricomponent(a)+"="+encodeuricomponent(b)+g+(e?"; domain="+e:"")+(d?"; path="+d:"")+(f?"; secure":""),!0},remove:function(a,b,c){return this.hasitem(a)?(document.cookie=encodeuricomponent(a)+"=; expires=thu, 01 jan 1970 00:00:00 gmt"+(c?"; domain="+c:"")+(b?"; path="+b:""),!0):!1},has:function(a){return a?new regexp("(?:^|;\\s*)"+encodeuricomponent(a).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(document.cookie):!1},keys:function(){for(var a=document.cookie.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g,"").split(/\s*(?:\=[^;]*)?;\s*/),b=a.length,c=0;b>c;c++)a[c]=decodeuricomponent(a[c]);return a}};return e(),{option:z,destroy:a}}var c="flypanels";a.fn[c]=function(d){if("string"==typeof arguments[0]){var e,f=arguments[0],g=array.prototype.slice.call(arguments,1);return this.each(function(){if(!a.data(this,"plugin_"+c)||"function"!=typeof a.data(this,"plugin_"+c)[f])throw new error("method "+f+" does not exist on jquery."+c);e=a.data(this,"plugin_"+c)[f].apply(this,g)}),void 0!==e?e:this}return"object"!=typeof d&&d?void 0:this.each(function(){a.data(this,"plugin_"+c)||a.data(this,"plugin_"+c,new b(this,d))})},a.fn[c].defaults={oninit:function(){},onload:function(){},onopenleft:function(){},onopenright:function(){},oncloseleft:function(){},oncloseright:function(){},ondestroy:function(){}}}(jquery);