diff --git a/.gitignore b/.gitignore index 1a846fe..1ec45e8 100644 --- a/.gitignore +++ b/.gitignore @@ -42,4 +42,8 @@ pythonscript/test.py.js tmp/ index.html test.py -test.py.js \ No newline at end of file +test.py.js + +# sass + +.sass-cache diff --git a/bindings/jquery.py b/bindings/jquery.py index e25e479..2dcbc7d 100644 --- a/bindings/jquery.py +++ b/bindings/jquery.py @@ -100,6 +100,11 @@ def delay(self, time, queue_name): o = JS('j.delay(time, queue_name)') return J(o) + def delegate(self, selector, eventName, handler): + j = self.j + o = JS('j.delegate(selector, eventName, adapt_arguments(handler))') + return J(o) + def dequeue(self, queue_name): j = self.j o = JS('j.dequeue(queue_name)') @@ -408,7 +413,10 @@ def mouseup(self, handler): o = JS('j.mouseup(adapt_arguments(handler))') return J(o) - + def removeClass(self, klass): + j = self.j + o = JS('j.removeClass(klass)') + return J(o) + def ajax(url, settings): return JS("jQuery.ajax(url, settings)") - diff --git a/bindings/jquery.py.js b/bindings/jquery.py.js index be18685..9150a32 100644 --- a/bindings/jquery.py.js +++ b/bindings/jquery.py.js @@ -307,20 +307,37 @@ return get_attribute(J, "__call__")(__args_17, __kwargs_17); } __J_attrs.delay = __J_delay; -var __J_dequeue = function(args, kwargs) { +var __J_delegate = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "queue_name")}; +signature = {"kwargs": {}, "args": create_array("self", "selector", "eventName", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; -var queue_name = arguments['queue_name']; +var selector = arguments['selector']; +var eventName = arguments['eventName']; +var handler = arguments['handler']; j = get_attribute(self, "j"); -o = j.dequeue(queue_name); +o = j.delegate(selector, eventName, adapt_arguments(handler)); var __args_18, __kwargs_18; __args_18 = create_array(o); __kwargs_18 = {}; return get_attribute(J, "__call__")(__args_18, __kwargs_18); } +__J_attrs.delegate = __J_delegate; +var __J_dequeue = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "queue_name")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var queue_name = arguments['queue_name']; +j = get_attribute(self, "j"); +o = j.dequeue(queue_name); +var __args_19, __kwargs_19; +__args_19 = create_array(o); +__kwargs_19 = {}; +return get_attribute(J, "__call__")(__args_19, __kwargs_19); +} + __J_attrs.dequeue = __J_dequeue; var __J_detach = function(args, kwargs) { var signature, arguments; @@ -330,10 +347,10 @@ var self = arguments['self']; var selector = arguments['selector']; j = get_attribute(self, "j"); o = j.detach(selector); -var __args_19, __kwargs_19; -__args_19 = create_array(o); -__kwargs_19 = {}; -return get_attribute(J, "__call__")(__args_19, __kwargs_19); +var __args_20, __kwargs_20; +__args_20 = create_array(o); +__kwargs_20 = {}; +return get_attribute(J, "__call__")(__args_20, __kwargs_20); } __J_attrs.detach = __J_detach; @@ -345,10 +362,10 @@ var self = arguments['self']; var handler = arguments['handler']; j = get_attribute(self, "j"); o = j.each(adapt_arguments(handler)); -var __args_20, __kwargs_20; -__args_20 = create_array(o); -__kwargs_20 = {}; -return get_attribute(J, "__call__")(__args_20, __kwargs_20); +var __args_21, __kwargs_21; +__args_21 = create_array(o); +__kwargs_21 = {}; +return get_attribute(J, "__call__")(__args_21, __kwargs_21); } __J_attrs.each = __J_each; @@ -360,10 +377,10 @@ var self = arguments['self']; var handler = arguments['handler']; j = get_attribute(self, "j"); o = j.end(handler); -var __args_21, __kwargs_21; -__args_21 = create_array(o); -__kwargs_21 = {}; -return get_attribute(J, "__call__")(__args_21, __kwargs_21); +var __args_22, __kwargs_22; +__args_22 = create_array(o); +__kwargs_22 = {}; +return get_attribute(J, "__call__")(__args_22, __kwargs_22); } __J_attrs.end = __J_end; @@ -375,10 +392,10 @@ var self = arguments['self']; var index = arguments['index']; j = get_attribute(self, "j"); o = j.eq(index); -var __args_22, __kwargs_22; -__args_22 = create_array(o); -__kwargs_22 = {}; -return get_attribute(J, "__call__")(__args_22, __kwargs_22); +var __args_23, __kwargs_23; +__args_23 = create_array(o); +__kwargs_23 = {}; +return get_attribute(J, "__call__")(__args_23, __kwargs_23); } __J_attrs.eq = __J_eq; @@ -390,10 +407,10 @@ var self = arguments['self']; var handler = arguments['handler']; j = get_attribute(self, "j"); o = j.error(adapt_arguments(handler)); -var __args_23, __kwargs_23; -__args_23 = create_array(o); -__kwargs_23 = {}; -return get_attribute(J, "__call__")(__args_23, __kwargs_23); +var __args_24, __kwargs_24; +__args_24 = create_array(o); +__kwargs_24 = {}; +return get_attribute(J, "__call__")(__args_24, __kwargs_24); } __J_attrs.error = __J_error; @@ -406,10 +423,10 @@ var duration = arguments['duration']; var complete = arguments['complete']; j = get_attribute(self, "j"); o = j.fadeIn(duration, complete); -var __args_24, __kwargs_24; -__args_24 = create_array(o); -__kwargs_24 = {}; -return get_attribute(J, "__call__")(__args_24, __kwargs_24); +var __args_25, __kwargs_25; +__args_25 = create_array(o); +__kwargs_25 = {}; +return get_attribute(J, "__call__")(__args_25, __kwargs_25); } __J_attrs.fade_in = __J_fade_in; @@ -422,10 +439,10 @@ var duration = arguments['duration']; var complete = arguments['complete']; j = get_attribute(self, "j"); o = j.fadeOut(duration, adapt_arguments(complete)); -var __args_25, __kwargs_25; -__args_25 = create_array(o); -__kwargs_25 = {}; -return get_attribute(J, "__call__")(__args_25, __kwargs_25); +var __args_26, __kwargs_26; +__args_26 = create_array(o); +__kwargs_26 = {}; +return get_attribute(J, "__call__")(__args_26, __kwargs_26); } __J_attrs.fade_out = __J_fade_out; @@ -439,10 +456,10 @@ var opacity = arguments['opacity']; var complete = arguments['complete']; j = get_attribute(self, "j"); o = j.fade_to(duration, opacity, adapt_arguments(complete)); -var __args_26, __kwargs_26; -__args_26 = create_array(o); -__kwargs_26 = {}; -return get_attribute(J, "__call__")(__args_26, __kwargs_26); +var __args_27, __kwargs_27; +__args_27 = create_array(o); +__kwargs_27 = {}; +return get_attribute(J, "__call__")(__args_27, __kwargs_27); } __J_attrs.fadeTo = __J_fadeTo; @@ -456,10 +473,10 @@ var easing = arguments['easing']; var complete = arguments['complete']; j = get_attribute(self, "j"); o = j.fade_toggle(duration, easing, complete); -var __args_27, __kwargs_27; -__args_27 = create_array(o); -__kwargs_27 = {}; -return get_attribute(J, "__call__")(__args_27, __kwargs_27); +var __args_28, __kwargs_28; +__args_28 = create_array(o); +__kwargs_28 = {}; +return get_attribute(J, "__call__")(__args_28, __kwargs_28); } __J_attrs.fade_toggle = __J_fade_toggle; @@ -471,10 +488,10 @@ var self = arguments['self']; var selector = arguments['selector']; j = get_attribute(self, "j"); o = j.filter(selector); -var __args_28, __kwargs_28; -__args_28 = create_array(o); -__kwargs_28 = {}; -return get_attribute(J, "__call__")(__args_28, __kwargs_28); +var __args_29, __kwargs_29; +__args_29 = create_array(o); +__kwargs_29 = {}; +return get_attribute(J, "__call__")(__args_29, __kwargs_29); } __J_attrs.filter = __J_filter; @@ -486,10 +503,10 @@ var self = arguments['self']; var queue = arguments['queue']; j = get_attribute(self, "j"); o = j.finish(queue); -var __args_29, __kwargs_29; -__args_29 = create_array(o); -__kwargs_29 = {}; -return get_attribute(J, "__call__")(__args_29, __kwargs_29); +var __args_30, __kwargs_30; +__args_30 = create_array(o); +__kwargs_30 = {}; +return get_attribute(J, "__call__")(__args_30, __kwargs_30); } __J_attrs.finish = __J_finish; @@ -502,10 +519,10 @@ var selector = arguments['selector']; var j, o; j = get_attribute(self, "j"); o = j.find(selector); -var __args_30, __kwargs_30; -__args_30 = create_array(o); -__kwargs_30 = {}; -return get_attribute(J, "__call__")(__args_30, __kwargs_30); +var __args_31, __kwargs_31; +__args_31 = create_array(o); +__kwargs_31 = {}; +return get_attribute(J, "__call__")(__args_31, __kwargs_31); } __J_attrs.find = __J_find; @@ -516,10 +533,10 @@ arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; j = get_attribute(self, "j"); o = j.first(); -var __args_31, __kwargs_31; -__args_31 = create_array(o); -__kwargs_31 = {}; -return get_attribute(J, "__call__")(__args_31, __kwargs_31); +var __args_32, __kwargs_32; +__args_32 = create_array(o); +__kwargs_32 = {}; +return get_attribute(J, "__call__")(__args_32, __kwargs_32); } __J_attrs.first = __J_first; @@ -531,10 +548,10 @@ var self = arguments['self']; var handler = arguments['handler']; j = get_attribute(self, "j"); o = j.focus(adapt_arguments(handler)); -var __args_32, __kwargs_32; -__args_32 = create_array(o); -__kwargs_32 = {}; -return get_attribute(J, "__call__")(__args_32, __kwargs_32); +var __args_33, __kwargs_33; +__args_33 = create_array(o); +__kwargs_33 = {}; +return get_attribute(J, "__call__")(__args_33, __kwargs_33); } __J_attrs.focus = __J_focus; @@ -546,10 +563,10 @@ var self = arguments['self']; var handler = arguments['handler']; j = get_attribute(self, "j"); o = j.focusIn(adapt_arguments(handler)); -var __args_33, __kwargs_33; -__args_33 = create_array(o); -__kwargs_33 = {}; -return get_attribute(J, "__call__")(__args_33, __kwargs_33); +var __args_34, __kwargs_34; +__args_34 = create_array(o); +__kwargs_34 = {}; +return get_attribute(J, "__call__")(__args_34, __kwargs_34); } __J_attrs.focus_in = __J_focus_in; @@ -561,10 +578,10 @@ var self = arguments['self']; var handler = arguments['handler']; j = get_attribute(self, "j"); o = j.focusOut(adapt_arguments(handler)); -var __args_34, __kwargs_34; -__args_34 = create_array(o); -__kwargs_34 = {}; -return get_attribute(J, "__call__")(__args_34, __kwargs_34); +var __args_35, __kwargs_35; +__args_35 = create_array(o); +__kwargs_35 = {}; +return get_attribute(J, "__call__")(__args_35, __kwargs_35); } __J_attrs.focus_out = __J_focus_out; @@ -576,10 +593,10 @@ var self = arguments['self']; var index = arguments['index']; j = get_attribute(self, "j"); o = j.get(index); -var __args_35, __kwargs_35; -__args_35 = create_array(o); -__kwargs_35 = {}; -return get_attribute(J, "__call__")(__args_35, __kwargs_35); +var __args_36, __kwargs_36; +__args_36 = create_array(o); +__kwargs_36 = {}; +return get_attribute(J, "__call__")(__args_36, __kwargs_36); } __J_attrs.get = __J_get; @@ -591,10 +608,10 @@ var self = arguments['self']; var name = arguments['name']; j = get_attribute(self, "j"); o = j.has_class(selector); -var __args_36, __kwargs_36; -__args_36 = create_array(o); -__kwargs_36 = {}; -return get_attribute(J, "__call__")(__args_36, __kwargs_36); +var __args_37, __kwargs_37; +__args_37 = create_array(o); +__kwargs_37 = {}; +return get_attribute(J, "__call__")(__args_37, __kwargs_37); } __J_attrs.has_class = __J_has_class; @@ -606,10 +623,10 @@ var self = arguments['self']; var value = arguments['value']; j = get_attribute(self, "j"); o = j.height(value); -var __args_37, __kwargs_37; -__args_37 = create_array(o); -__kwargs_37 = {}; -return get_attribute(J, "__call__")(__args_37, __kwargs_37); +var __args_38, __kwargs_38; +__args_38 = create_array(o); +__kwargs_38 = {}; +return get_attribute(J, "__call__")(__args_38, __kwargs_38); } __J_attrs.height = __J_height; @@ -622,10 +639,10 @@ var duration = arguments['duration']; var complete = arguments['complete']; j = get_attribute(self, "j"); o = j.hide(duration, complete); -var __args_38, __kwargs_38; -__args_38 = create_array(o); -__kwargs_38 = {}; -return get_attribute(J, "__call__")(__args_38, __kwargs_38); +var __args_39, __kwargs_39; +__args_39 = create_array(o); +__kwargs_39 = {}; +return get_attribute(J, "__call__")(__args_39, __kwargs_39); } __J_attrs.hide = __J_hide; @@ -637,10 +654,10 @@ var self = arguments['self']; var handler = arguments['handler']; j = get_attribute(self, "j"); o = j.hover(adapt_arguments(handler)); -var __args_39, __kwargs_39; -__args_39 = create_array(o); -__kwargs_39 = {}; -return get_attribute(J, "__call__")(__args_39, __kwargs_39); +var __args_40, __kwargs_40; +__args_40 = create_array(o); +__kwargs_40 = {}; +return get_attribute(J, "__call__")(__args_40, __kwargs_40); } __J_attrs.hover = __J_hover; @@ -670,10 +687,10 @@ var self = arguments['self']; var selector = arguments['selector']; j = get_attribute(self, "j"); o = j.index(selector); -var __args_40, __kwargs_40; -__args_40 = create_array(o); -__kwargs_40 = {}; -return get_attribute(J, "__call__")(__args_40, __kwargs_40); +var __args_41, __kwargs_41; +__args_41 = create_array(o); +__kwargs_41 = {}; +return get_attribute(J, "__call__")(__args_41, __kwargs_41); } __J_attrs.index = __J_index; @@ -684,10 +701,10 @@ arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; j = get_attribute(self, "j"); o = j.innerHeight(); -var __args_41, __kwargs_41; -__args_41 = create_array(o); -__kwargs_41 = {}; -return get_attribute(J, "__call__")(__args_41, __kwargs_41); +var __args_42, __kwargs_42; +__args_42 = create_array(o); +__kwargs_42 = {}; +return get_attribute(J, "__call__")(__args_42, __kwargs_42); } __J_attrs.inner_height = __J_inner_height; @@ -698,10 +715,10 @@ arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; j = get_attribute(self, "j"); o = j.innerWidth(); -var __args_42, __kwargs_42; -__args_42 = create_array(o); -__kwargs_42 = {}; -return get_attribute(J, "__call__")(__args_42, __kwargs_42); +var __args_43, __kwargs_43; +__args_43 = create_array(o); +__kwargs_43 = {}; +return get_attribute(J, "__call__")(__args_43, __kwargs_43); } __J_attrs.inner_width = __J_inner_width; @@ -713,10 +730,10 @@ var self = arguments['self']; var target = arguments['target']; j = get_attribute(self, "j"); o = j.insertAfter(target); -var __args_43, __kwargs_43; -__args_43 = create_array(o); -__kwargs_43 = {}; -return get_attribute(J, "__call__")(__args_43, __kwargs_43); +var __args_44, __kwargs_44; +__args_44 = create_array(o); +__kwargs_44 = {}; +return get_attribute(J, "__call__")(__args_44, __kwargs_44); } __J_attrs.insert_after = __J_insert_after; @@ -728,10 +745,10 @@ var self = arguments['self']; var target = arguments['target']; j = get_attribute(self, "j"); o = j.insertBefore(selector); -var __args_44, __kwargs_44; -__args_44 = create_array(o); -__kwargs_44 = {}; -return get_attribute(J, "__call__")(__args_44, __kwargs_44); +var __args_45, __kwargs_45; +__args_45 = create_array(o); +__kwargs_45 = {}; +return get_attribute(J, "__call__")(__args_45, __kwargs_45); } __J_attrs.insert_before = __J_insert_before; @@ -743,10 +760,10 @@ var self = arguments['self']; var name = arguments['name']; j = get_attribute(self, "j"); o = j.is(selector); -var __args_45, __kwargs_45; -__args_45 = create_array(o); -__kwargs_45 = {}; -return get_attribute(J, "__call__")(__args_45, __kwargs_45); +var __args_46, __kwargs_46; +__args_46 = create_array(o); +__kwargs_46 = {}; +return get_attribute(J, "__call__")(__args_46, __kwargs_46); } __J_attrs.is_ = __J_is_; @@ -758,10 +775,10 @@ var self = arguments['self']; var handler = arguments['handler']; j = get_attribute(self, "j"); o = j.keydown(adapt_arguments(handler)); -var __args_46, __kwargs_46; -__args_46 = create_array(o); -__kwargs_46 = {}; -return get_attribute(J, "__call__")(__args_46, __kwargs_46); +var __args_47, __kwargs_47; +__args_47 = create_array(o); +__kwargs_47 = {}; +return get_attribute(J, "__call__")(__args_47, __kwargs_47); } __J_attrs.keydown = __J_keydown; @@ -773,10 +790,10 @@ var self = arguments['self']; var handler = arguments['handler']; j = get_attribute(self, "j"); o = j.keypress(adapt_arguments(handler)); -var __args_47, __kwargs_47; -__args_47 = create_array(o); -__kwargs_47 = {}; -return get_attribute(J, "__call__")(__args_47, __kwargs_47); +var __args_48, __kwargs_48; +__args_48 = create_array(o); +__kwargs_48 = {}; +return get_attribute(J, "__call__")(__args_48, __kwargs_48); } __J_attrs.keypress = __J_keypress; @@ -788,10 +805,10 @@ var self = arguments['self']; var handler = arguments['handler']; j = get_attribute(self, "j"); o = j.keyup(adapt_arguments(handler)); -var __args_48, __kwargs_48; -__args_48 = create_array(o); -__kwargs_48 = {}; -return get_attribute(J, "__call__")(__args_48, __kwargs_48); +var __args_49, __kwargs_49; +__args_49 = create_array(o); +__kwargs_49 = {}; +return get_attribute(J, "__call__")(__args_49, __kwargs_49); } __J_attrs.keyup = __J_keyup; @@ -803,10 +820,10 @@ var self = arguments['self']; var handler = arguments['handler']; j = get_attribute(self, "j"); o = j.last(adapt_arguments(handler)); -var __args_49, __kwargs_49; -__args_49 = create_array(o); -__kwargs_49 = {}; -return get_attribute(J, "__call__")(__args_49, __kwargs_49); +var __args_50, __kwargs_50; +__args_50 = create_array(o); +__kwargs_50 = {}; +return get_attribute(J, "__call__")(__args_50, __kwargs_50); } __J_attrs.last = __J_last; @@ -819,10 +836,10 @@ var event = arguments['event']; var handler = arguments['handler']; j = get_attribute(self, "j"); o = j.on(event, adapt_arguments(handler)); -var __args_50, __kwargs_50; -__args_50 = create_array(o); -__kwargs_50 = {}; -return get_attribute(J, "__call__")(__args_50, __kwargs_50); +var __args_51, __kwargs_51; +__args_51 = create_array(o); +__kwargs_51 = {}; +return get_attribute(J, "__call__")(__args_51, __kwargs_51); } __J_attrs.on = __J_on; @@ -836,10 +853,10 @@ var data = arguments['data']; var complete = arguments['complete']; j = get_attribute(self, "j"); o = j.load(url, data, complete); -var __args_51, __kwargs_51; -__args_51 = create_array(o); -__kwargs_51 = {}; -return get_attribute(J, "__call__")(__args_51, __kwargs_51); +var __args_52, __kwargs_52; +__args_52 = create_array(o); +__kwargs_52 = {}; +return get_attribute(J, "__call__")(__args_52, __kwargs_52); } __J_attrs.load = __J_load; @@ -851,10 +868,10 @@ var self = arguments['self']; var handler = arguments['handler']; j = get_attribute(self, "j"); o = j.select(adapt_arguments(handler)); -var __args_52, __kwargs_52; -__args_52 = create_array(o); -__kwargs_52 = {}; -return get_attribute(J, "__call__")(__args_52, __kwargs_52); +var __args_53, __kwargs_53; +__args_53 = create_array(o); +__kwargs_53 = {}; +return get_attribute(J, "__call__")(__args_53, __kwargs_53); } __J_attrs.select = __J_select; @@ -867,10 +884,10 @@ var duration = arguments['duration']; var complete = arguments['complete']; j = get_attribute(self, "j"); o = j.show(duration, complete); -var __args_53, __kwargs_53; -__args_53 = create_array(o); -__kwargs_53 = {}; -return get_attribute(J, "__call__")(__args_53, __kwargs_53); +var __args_54, __kwargs_54; +__args_54 = create_array(o); +__kwargs_54 = {}; +return get_attribute(J, "__call__")(__args_54, __kwargs_54); } __J_attrs.show = __J_show; @@ -882,10 +899,10 @@ var self = arguments['self']; var selector = arguments['selector']; j = get_attribute(self, "j"); o = j.select(adapt_arguments(handler)); -var __args_54, __kwargs_54; -__args_54 = create_array(o); -__kwargs_54 = {}; -return get_attribute(J, "__call__")(__args_54, __kwargs_54); +var __args_55, __kwargs_55; +__args_55 = create_array(o); +__kwargs_55 = {}; +return get_attribute(J, "__call__")(__args_55, __kwargs_55); } __J_attrs.siblings = __J_siblings; @@ -896,10 +913,10 @@ arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; j = get_attribute(self, "j"); o = j.size(); -var __args_55, __kwargs_55; -__args_55 = create_array(o); -__kwargs_55 = {}; -return get_attribute(J, "__call__")(__args_55, __kwargs_55); +var __args_56, __kwargs_56; +__args_56 = create_array(o); +__kwargs_56 = {}; +return get_attribute(J, "__call__")(__args_56, __kwargs_56); } __J_attrs.size = __J_size; @@ -912,10 +929,10 @@ var start = arguments['start']; var end = arguments['end']; j = get_attribute(self, "j"); o = j.slice(start, end); -var __args_56, __kwargs_56; -__args_56 = create_array(o); -__kwargs_56 = {}; -return get_attribute(J, "__call__")(__args_56, __kwargs_56); +var __args_57, __kwargs_57; +__args_57 = create_array(o); +__kwargs_57 = {}; +return get_attribute(J, "__call__")(__args_57, __kwargs_57); } __J_attrs.slice = __J_slice; @@ -928,10 +945,10 @@ var duration = arguments['duration']; var complete = arguments['complete']; j = get_attribute(self, "j"); o = j.slideDown(duration, adapt_arguments(complete)); -var __args_57, __kwargs_57; -__args_57 = create_array(o); -__kwargs_57 = {}; -return get_attribute(J, "__call__")(__args_57, __kwargs_57); +var __args_58, __kwargs_58; +__args_58 = create_array(o); +__kwargs_58 = {}; +return get_attribute(J, "__call__")(__args_58, __kwargs_58); } __J_attrs.slide_down = __J_slide_down; @@ -944,10 +961,10 @@ var duration = arguments['duration']; var complete = arguments['complete']; j = get_attribute(self, "j"); o = j.slideToggle(duration, adapt_arguments(complete)); -var __args_58, __kwargs_58; -__args_58 = create_array(o); -__kwargs_58 = {}; -return get_attribute(J, "__call__")(__args_58, __kwargs_58); +var __args_59, __kwargs_59; +__args_59 = create_array(o); +__kwargs_59 = {}; +return get_attribute(J, "__call__")(__args_59, __kwargs_59); } __J_attrs.slide_toggle = __J_slide_toggle; @@ -960,10 +977,10 @@ var duration = arguments['duration']; var complete = arguments['complete']; j = get_attribute(self, "j"); o = j.slideUp(duration, adapt_arguments(complete)); -var __args_59, __kwargs_59; -__args_59 = create_array(o); -__kwargs_59 = {}; -return get_attribute(J, "__call__")(__args_59, __kwargs_59); +var __args_60, __kwargs_60; +__args_60 = create_array(o); +__kwargs_60 = {}; +return get_attribute(J, "__call__")(__args_60, __kwargs_60); } __J_attrs.slide_up = __J_slide_up; @@ -976,10 +993,10 @@ var clear_queue = arguments['clear_queue']; var jump_to_end = arguments['jump_to_end']; j = get_attribute(self, "j"); o = j.stop(clear_queue, jump_to_end); -var __args_60, __kwargs_60; -__args_60 = create_array(o); -__kwargs_60 = {}; -return get_attribute(J, "__call__")(__args_60, __kwargs_60); +var __args_61, __kwargs_61; +__args_61 = create_array(o); +__kwargs_61 = {}; +return get_attribute(J, "__call__")(__args_61, __kwargs_61); } __J_attrs.stop = __J_stop; @@ -992,10 +1009,10 @@ var clear_queue = arguments['clear_queue']; var jump_to_end = arguments['jump_to_end']; j = get_attribute(self, "j"); o = j.submit(clear_queue, jump_to_end); -var __args_61, __kwargs_61; -__args_61 = create_array(o); -__kwargs_61 = {}; -return get_attribute(J, "__call__")(__args_61, __kwargs_61); +var __args_62, __kwargs_62; +__args_62 = create_array(o); +__kwargs_62 = {}; +return get_attribute(J, "__call__")(__args_62, __kwargs_62); } __J_attrs.submit = __J_submit; @@ -1007,10 +1024,10 @@ var self = arguments['self']; var text = arguments['text']; j = get_attribute(self, "j"); o = j.text(text); -var __args_62, __kwargs_62; -__args_62 = create_array(o); -__kwargs_62 = {}; -return get_attribute(J, "__call__")(__args_62, __kwargs_62); +var __args_63, __kwargs_63; +__args_63 = create_array(o); +__kwargs_63 = {}; +return get_attribute(J, "__call__")(__args_63, __kwargs_63); } __J_attrs.text = __J_text; @@ -1023,10 +1040,10 @@ var duration = arguments['duration']; var complete = arguments['complete']; j = get_attribute(self, "j"); o = j.toggle(duration, complete); -var __args_63, __kwargs_63; -__args_63 = create_array(o); -__kwargs_63 = {}; -return get_attribute(J, "__call__")(__args_63, __kwargs_63); +var __args_64, __kwargs_64; +__args_64 = create_array(o); +__kwargs_64 = {}; +return get_attribute(J, "__call__")(__args_64, __kwargs_64); } __J_attrs.toggle = __J_toggle; @@ -1038,10 +1055,10 @@ var self = arguments['self']; var class_name = arguments['class_name']; j = get_attribute(self, "j"); o = j.toggleClass(class_name); -var __args_64, __kwargs_64; -__args_64 = create_array(o); -__kwargs_64 = {}; -return get_attribute(J, "__call__")(__args_64, __kwargs_64); +var __args_65, __kwargs_65; +__args_65 = create_array(o); +__kwargs_65 = {}; +return get_attribute(J, "__call__")(__args_65, __kwargs_65); } __J_attrs.toggle_class = __J_toggle_class; @@ -1053,10 +1070,10 @@ var self = arguments['self']; var event = arguments['event']; j = get_attribute(self, "j"); o = j.trigger(event); -var __args_65, __kwargs_65; -__args_65 = create_array(o); -__kwargs_65 = {}; -return get_attribute(J, "__call__")(__args_65, __kwargs_65); +var __args_66, __kwargs_66; +__args_66 = create_array(o); +__kwargs_66 = {}; +return get_attribute(J, "__call__")(__args_66, __kwargs_66); } __J_attrs.trigger = __J_trigger; @@ -1069,10 +1086,10 @@ var event = arguments['event']; var handler = arguments['handler']; j = get_attribute(self, "j"); o = j.unbind(event, adapt_arguments(handler)); -var __args_66, __kwargs_66; -__args_66 = create_array(o); -__kwargs_66 = {}; -return get_attribute(J, "__call__")(__args_66, __kwargs_66); +var __args_67, __kwargs_67; +__args_67 = create_array(o); +__kwargs_67 = {}; +return get_attribute(J, "__call__")(__args_67, __kwargs_67); } __J_attrs.unbind = __J_unbind; @@ -1084,10 +1101,10 @@ var self = arguments['self']; var value = arguments['value']; j = get_attribute(self, "j"); o = j.val(value); -var __args_67, __kwargs_67; -__args_67 = create_array(o); -__kwargs_67 = {}; -return get_attribute(J, "__call__")(__args_67, __kwargs_67); +var __args_68, __kwargs_68; +__args_68 = create_array(o); +__kwargs_68 = {}; +return get_attribute(J, "__call__")(__args_68, __kwargs_68); } __J_attrs.value = __J_value; @@ -1099,10 +1116,10 @@ var self = arguments['self']; var value = arguments['value']; j = get_attribute(self, "j"); o = j.width(value); -var __args_68, __kwargs_68; -__args_68 = create_array(o); -__kwargs_68 = {}; -return get_attribute(J, "__call__")(__args_68, __kwargs_68); +var __args_69, __kwargs_69; +__args_69 = create_array(o); +__kwargs_69 = {}; +return get_attribute(J, "__call__")(__args_69, __kwargs_69); } __J_attrs.width = __J_width; @@ -1124,10 +1141,10 @@ var self = arguments['self']; var func = arguments['func']; j = get_attribute(self, "j"); o = j.map(func); -var __args_69, __kwargs_69; -__args_69 = create_array(o); -__kwargs_69 = {}; -return get_attribute(J, "__call__")(__args_69, __kwargs_69); +var __args_70, __kwargs_70; +__args_70 = create_array(o); +__kwargs_70 = {}; +return get_attribute(J, "__call__")(__args_70, __kwargs_70); } __J_attrs.map = __J_map; @@ -1139,10 +1156,10 @@ var self = arguments['self']; var handler = arguments['handler']; j = get_attribute(self, "j"); o = j.mousedown(adapt_arguments(handler)); -var __args_70, __kwargs_70; -__args_70 = create_array(o); -__kwargs_70 = {}; -return get_attribute(J, "__call__")(__args_70, __kwargs_70); +var __args_71, __kwargs_71; +__args_71 = create_array(o); +__kwargs_71 = {}; +return get_attribute(J, "__call__")(__args_71, __kwargs_71); } __J_attrs.mousedown = __J_mousedown; @@ -1154,10 +1171,10 @@ var self = arguments['self']; var handler = arguments['handler']; j = get_attribute(self, "j"); o = j.mouseenter(adapt_arguments(handler)); -var __args_71, __kwargs_71; -__args_71 = create_array(o); -__kwargs_71 = {}; -return get_attribute(J, "__call__")(__args_71, __kwargs_71); +var __args_72, __kwargs_72; +__args_72 = create_array(o); +__kwargs_72 = {}; +return get_attribute(J, "__call__")(__args_72, __kwargs_72); } __J_attrs.mouseenter = __J_mouseenter; @@ -1169,10 +1186,10 @@ var self = arguments['self']; var handler = arguments['handler']; j = get_attribute(self, "j"); o = j.mouseleave(adapt_arguments(handler)); -var __args_72, __kwargs_72; -__args_72 = create_array(o); -__kwargs_72 = {}; -return get_attribute(J, "__call__")(__args_72, __kwargs_72); +var __args_73, __kwargs_73; +__args_73 = create_array(o); +__kwargs_73 = {}; +return get_attribute(J, "__call__")(__args_73, __kwargs_73); } __J_attrs.mouseleave = __J_mouseleave; @@ -1184,10 +1201,10 @@ var self = arguments['self']; var handler = arguments['handler']; j = get_attribute(self, "j"); o = j.mousemove(adapt_arguments(handler)); -var __args_73, __kwargs_73; -__args_73 = create_array(o); -__kwargs_73 = {}; -return get_attribute(J, "__call__")(__args_73, __kwargs_73); +var __args_74, __kwargs_74; +__args_74 = create_array(o); +__kwargs_74 = {}; +return get_attribute(J, "__call__")(__args_74, __kwargs_74); } __J_attrs.mousemove = __J_mousemove; @@ -1199,10 +1216,10 @@ var self = arguments['self']; var handler = arguments['handler']; j = get_attribute(self, "j"); o = j.mouseout(adapt_arguments(handler)); -var __args_74, __kwargs_74; -__args_74 = create_array(o); -__kwargs_74 = {}; -return get_attribute(J, "__call__")(__args_74, __kwargs_74); +var __args_75, __kwargs_75; +__args_75 = create_array(o); +__kwargs_75 = {}; +return get_attribute(J, "__call__")(__args_75, __kwargs_75); } __J_attrs.mouseout = __J_mouseout; @@ -1214,10 +1231,10 @@ var self = arguments['self']; var handler = arguments['handler']; j = get_attribute(self, "j"); o = j.mouseover(adapt_arguments(handler)); -var __args_75, __kwargs_75; -__args_75 = create_array(o); -__kwargs_75 = {}; -return get_attribute(J, "__call__")(__args_75, __kwargs_75); +var __args_76, __kwargs_76; +__args_76 = create_array(o); +__kwargs_76 = {}; +return get_attribute(J, "__call__")(__args_76, __kwargs_76); } __J_attrs.mouseover = __J_mouseover; @@ -1229,13 +1246,28 @@ var self = arguments['self']; var handler = arguments['handler']; j = get_attribute(self, "j"); o = j.mouseup(adapt_arguments(handler)); -var __args_76, __kwargs_76; -__args_76 = create_array(o); -__kwargs_76 = {}; -return get_attribute(J, "__call__")(__args_76, __kwargs_76); +var __args_77, __kwargs_77; +__args_77 = create_array(o); +__kwargs_77 = {}; +return get_attribute(J, "__call__")(__args_77, __kwargs_77); } __J_attrs.mouseup = __J_mouseup; +var __J_removeClass = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "klass")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var klass = arguments['klass']; +j = get_attribute(self, "j"); +o = j.removeClass(klass); +var __args_78, __kwargs_78; +__args_78 = create_array(o); +__kwargs_78 = {}; +return get_attribute(J, "__call__")(__args_78, __kwargs_78); +} + +__J_attrs.removeClass = __J_removeClass; J = create_class("J", __J_parents, __J_attrs); var ajax = function(args, kwargs) { var signature, arguments; diff --git a/demo/hakuintodo/Guardfile b/demo/hakuintodo/Guardfile new file mode 100644 index 0000000..e415b64 --- /dev/null +++ b/demo/hakuintodo/Guardfile @@ -0,0 +1,8 @@ +#!/usr/bin/env python + +from livereload.task import Task +from livereload.compiler import shell + +Task.add('sass/*.scss', shell('compass compile')) +Task.add('index.jade', shell('jade index.jade')) +Task.add('javascripts/app.py', shell('./mkapp.sh')) diff --git a/demo/hakuintodo/MIT-LICENSE.txt b/demo/hakuintodo/MIT-LICENSE.txt new file mode 100644 index 0000000..1fc5997 --- /dev/null +++ b/demo/hakuintodo/MIT-LICENSE.txt @@ -0,0 +1,20 @@ +Copyright (c) 2011 ZURB, http://www.zurb.com/ + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/demo/hakuintodo/config.rb b/demo/hakuintodo/config.rb new file mode 100644 index 0000000..d48a051 --- /dev/null +++ b/demo/hakuintodo/config.rb @@ -0,0 +1,26 @@ +require 'zurb-foundation' +# Require any additional compass plugins here. + + +# Set this to the root of your project when deployed: +http_path = "/" +css_dir = "stylesheets" +sass_dir = "sass" +images_dir = "images" +javascripts_dir = "javascripts" + +# You can select your preferred output style here (can be overridden via the command line): +# output_style = :expanded or :nested or :compact or :compressed + +# To enable relative paths to assets via compass helper functions. Uncomment: +# relative_assets = true + +# To disable debugging comments that display the original location of your selectors. Uncomment: +# line_comments = false + + +# If you prefer the indented syntax, you might want to regenerate this +# project again passing --syntax sass, or you can uncomment this: +# preferred_syntax = :sass +# and then run: +# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass diff --git a/demo/hakuintodo/humans.txt b/demo/hakuintodo/humans.txt new file mode 100644 index 0000000..b6f305b --- /dev/null +++ b/demo/hakuintodo/humans.txt @@ -0,0 +1,8 @@ +/* Foundation was made by ZURB, an interaction design and design strategy firm in Campbell, CA */ +/* zurb.com */ +/* humanstxt.org */ + +/* SITE */ + Standards: HTML5, CSS3 + Components: jQuery, Orbit, Reveal + Software: Coda, Textmate, Git \ No newline at end of file diff --git a/demo/hakuintodo/images/destroy.png b/demo/hakuintodo/images/destroy.png new file mode 100644 index 0000000..53d829c Binary files /dev/null and b/demo/hakuintodo/images/destroy.png differ diff --git a/demo/hakuintodo/index.jade b/demo/hakuintodo/index.jade new file mode 100644 index 0000000..192c111 --- /dev/null +++ b/demo/hakuintodo/index.jade @@ -0,0 +1,73 @@ +!!! 5 +html + head + meta(charset='utf-8') + meta(name='viewport', content='width=device-width') + title Hakuin Todo + link(rel='stylesheet', href='stylesheets/app.css') + script(src='javascripts/vendor/custom.modernizr.js') + body + .row + .large-12.columns + h2 Hakuin Todo + p Frontend Python MVC Framework + hr + .row + .large-8.columns + .row.collapse + .large-10.columns + input#taskinput(type="text", placeholder="What needs to be done?") + .large-2.columns + a#newtask.button.prefix(href="#") Add + #items + .large-4.columns + h4 Other Resources + p Once you've exhausted the fun in this document, you should check out: + ul.disc + li + a(href='http://apppyjs.appspot.com/') PythonScript + br + | PythonScript is a subset of Python. It is compiled to plain old Javascript. + li + a(href='http://foundation.zurb.com/docs') Foundation Documentation + br + | Everything you need to know about using the framework. + li + a(href='http://handlebarsjs.com/') handlebars + br + | ひげ + li + a(href='TodoMVC') TodoMVC + br + | Helping you select an MV* framework + li + a(href='http://en.wikipedia.org/wiki/Hakuin_Ekaku') Hakuin + br + | 駿河には過ぎたるものが二つあり、富士のお山に原の白隠 + li + a(href='http://www.hakuinmasamune.com/') 白隠正宗 + br + | Japanese sake! + script(src='javascripts/jquery.js') + script(src='javascripts/handlebars.js') + script(src='javascripts/pythonscript.js') + script(src='javascripts/jquery.py.js') + script(src='javascripts/hakuin.py.js') + script(src='javascripts/app.py.js') + script(src='javascripts/foundation/foundation.js') + // script(src='javascripts/foundation/foundation.joyride.js') + // script(src='javascripts/foundation/foundation.alerts.js') + // script(src='javascripts/foundation/foundation.forms.js') + // script(src='javascripts/foundation/foundation.cookie.js') + // script(src='javascripts/foundation/foundation.section.js') + // script(src='javascripts/foundation/foundation.magellan.js') + // script(src='javascripts/foundation/foundation.tooltips.js') + // script(src='javascripts/foundation/foundation.placeholder.js') + // script(src='javascripts/foundation/foundation.topbar.js') + // script(src='javascripts/foundation/foundation.reveal.js') + // script(src='javascripts/foundation/foundation.orbit.js') + // script(src='javascripts/foundation/foundation.clearing.js') + // script(src='javascripts/foundation/foundation.dropdown.js') + + script. + $(document).foundation(); diff --git a/demo/hakuintodo/javascripts/app.py b/demo/hakuintodo/javascripts/app.py new file mode 100644 index 0000000..bbdb273 --- /dev/null +++ b/demo/hakuintodo/javascripts/app.py @@ -0,0 +1,79 @@ +class TaskModel(Model): + def __init__(self, name): + Model.__init__(self) + self.name = name + self.done = false + + +class Task(Controller): + def __init__(self, model): + Controller.__init__(self, "div", None) + self.model = model + self.el.addClass("item") + self.el.delegate(".view", "dblclick", self.edit) + self.el.delegate(".close", "click", self.close) + self.el.delegate(".destroy", "click", self.remove) + + def html(self): + source = "
{{name}}
" + "
"\ + + "
ok
" + template = JS("Handlebars.compile(source)") + name = self.model.name + data = JS("template({name:name})") + return self.el.html(data) + + def edit(self): + self.el.addClass("editing") + print "double clicked: " + self.model.to_string() + + def close(self): + self.el.removeClass("editing") + j = self.el.find("input[type=text]").j + name = JS("j.val()") + self.model.updateAttribute("name", name) + + def remove(self): + print "clicked: " + self.model.to_string() + self.model.destroy() + self.release() + + +class TaskList(Collection): + def __init__(self): + Collection.__init__(self) + e.bind("remove", self.rsay) + + def rsay(self, model): + print "removed: " + model.pop().to_string() + for m in self.models: + print m.to_string() + + +class TaskApp(Controller): + def __init__(self, el, collection): + Controller.__init__(self, "div", el) + self.collection = collection + button = J("#newtask") + button.bind("click", false, self.create) + e.bind("add", self.render) + e.bind("update", self.render) + + def create(self): + j = J("#taskinput").j + name = JS("j.val()") + if name != "": + self.collection.add(TaskModel(name)) + j = J("#taskinput").j + empty_text = "" + JS('j.val(empty_text)') + + def render(self): + print "render tasklist" + j = self.el.j + JS('j.empty()') + for m in self.collection.models: + task = Task(m) + self.el.append(task.html()) + +print "application start" +TaskApp("#items", TaskList()) diff --git a/demo/hakuintodo/javascripts/app.py.js b/demo/hakuintodo/javascripts/app.py.js new file mode 100644 index 0000000..9763a30 --- /dev/null +++ b/demo/hakuintodo/javascripts/app.py.js @@ -0,0 +1,297 @@ +var TaskModel, __TaskModel_attrs, __TaskModel_parents; +__TaskModel_attrs = {}; +__TaskModel_parents = create_array(); +__TaskModel_parents.push(Model); +var __TaskModel___init__ = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "name")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var name = arguments['name']; +var __args_0, __kwargs_0; +__args_0 = create_array(self); +__kwargs_0 = {}; +get_attribute(get_attribute(Model, "__init__"), "__call__")(__args_0, __kwargs_0); +set_attribute(self, "name", name); +set_attribute(self, "done", false); +} + +__TaskModel_attrs.__init__ = __TaskModel___init__; +TaskModel = create_class("TaskModel", __TaskModel_parents, __TaskModel_attrs); +var Task, __Task_attrs, __Task_parents; +__Task_attrs = {}; +__Task_parents = create_array(); +__Task_parents.push(Controller); +var __Task___init__ = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "model")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var model = arguments['model']; +var __args_1, __kwargs_1; +__args_1 = create_array(self, "div", undefined); +__kwargs_1 = {}; +get_attribute(get_attribute(Controller, "__init__"), "__call__")(__args_1, __kwargs_1); +set_attribute(self, "model", model); +var __args_2, __kwargs_2; +__args_2 = create_array("item"); +__kwargs_2 = {}; +get_attribute(get_attribute(get_attribute(self, "el"), "addClass"), "__call__")(__args_2, __kwargs_2); +var __args_3, __kwargs_3; +__args_3 = create_array(".view", "dblclick", get_attribute(self, "edit")); +__kwargs_3 = {}; +get_attribute(get_attribute(get_attribute(self, "el"), "delegate"), "__call__")(__args_3, __kwargs_3); +var __args_4, __kwargs_4; +__args_4 = create_array(".close", "click", get_attribute(self, "close")); +__kwargs_4 = {}; +get_attribute(get_attribute(get_attribute(self, "el"), "delegate"), "__call__")(__args_4, __kwargs_4); +var __args_5, __kwargs_5; +__args_5 = create_array(".destroy", "click", get_attribute(self, "remove")); +__kwargs_5 = {}; +get_attribute(get_attribute(get_attribute(self, "el"), "delegate"), "__call__")(__args_5, __kwargs_5); +} + +__Task_attrs.__init__ = __Task___init__; +var __Task_html = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +source = "
{{name}}
" + "
" + "
ok
"; +template = Handlebars.compile(source); +name = get_attribute(get_attribute(self, "model"), "name"); +data = template({name:name}); +var __args_6, __kwargs_6; +__args_6 = create_array(data); +__kwargs_6 = {}; +return get_attribute(get_attribute(get_attribute(self, "el"), "html"), "__call__")(__args_6, __kwargs_6); +} + +__Task_attrs.html = __Task_html; +var __Task_edit = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var __args_7, __kwargs_7; +__args_7 = create_array("editing"); +__kwargs_7 = {}; +get_attribute(get_attribute(get_attribute(self, "el"), "addClass"), "__call__")(__args_7, __kwargs_7); +var __args_8, __kwargs_8; +__args_8 = create_array(); +__kwargs_8 = {}; +console.log("double clicked: " + get_attribute(get_attribute(get_attribute(self, "model"), "to_string"), "__call__")(__args_8, __kwargs_8)); +} + +__Task_attrs.edit = __Task_edit; +var __Task_close = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var __args_9, __kwargs_9; +__args_9 = create_array("editing"); +__kwargs_9 = {}; +get_attribute(get_attribute(get_attribute(self, "el"), "removeClass"), "__call__")(__args_9, __kwargs_9); +var __args_10, __kwargs_10; +__args_10 = create_array("input[type=text]"); +__kwargs_10 = {}; +j = get_attribute(get_attribute(get_attribute(get_attribute(self, "el"), "find"), "__call__")(__args_10, __kwargs_10), "j"); +name = j.val(); +var __args_11, __kwargs_11; +__args_11 = create_array("name", name); +__kwargs_11 = {}; +get_attribute(get_attribute(get_attribute(self, "model"), "updateAttribute"), "__call__")(__args_11, __kwargs_11); +} + +__Task_attrs.close = __Task_close; +var __Task_remove = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var __args_12, __kwargs_12; +__args_12 = create_array(); +__kwargs_12 = {}; +console.log("clicked: " + get_attribute(get_attribute(get_attribute(self, "model"), "to_string"), "__call__")(__args_12, __kwargs_12)); +var __args_13, __kwargs_13; +__args_13 = create_array(); +__kwargs_13 = {}; +get_attribute(get_attribute(get_attribute(self, "model"), "destroy"), "__call__")(__args_13, __kwargs_13); +var __args_14, __kwargs_14; +__args_14 = create_array(); +__kwargs_14 = {}; +get_attribute(get_attribute(self, "release"), "__call__")(__args_14, __kwargs_14); +} + +__Task_attrs.remove = __Task_remove; +Task = create_class("Task", __Task_parents, __Task_attrs); +var TaskList, __TaskList_attrs, __TaskList_parents; +__TaskList_attrs = {}; +__TaskList_parents = create_array(); +__TaskList_parents.push(Collection); +var __TaskList___init__ = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var __args_15, __kwargs_15; +__args_15 = create_array(self); +__kwargs_15 = {}; +get_attribute(get_attribute(Collection, "__init__"), "__call__")(__args_15, __kwargs_15); +var __args_16, __kwargs_16; +__args_16 = create_array("remove", get_attribute(self, "rsay")); +__kwargs_16 = {}; +get_attribute(get_attribute(e, "bind"), "__call__")(__args_16, __kwargs_16); +} + +__TaskList_attrs.__init__ = __TaskList___init__; +var __TaskList_rsay = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "model")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var model = arguments['model']; +var __args_17, __kwargs_17; +__args_17 = create_array(); +__kwargs_17 = {}; +var __args_18, __kwargs_18; +__args_18 = create_array(); +__kwargs_18 = {}; +console.log("removed: " + get_attribute(get_attribute(get_attribute(get_attribute(model, "pop"), "__call__")(__args_18, __kwargs_18), "to_string"), "__call__")(__args_17, __kwargs_17)); +var __iterator__, m; +__iterator__ = get_attribute(get_attribute(get_attribute(self, "models"), "__iter__"), "__call__")(create_array(), {}); +try { +m = get_attribute(__iterator__, "next")(create_array(), {}); +while(true) { +var __args_19, __kwargs_19; +__args_19 = create_array(); +__kwargs_19 = {}; +console.log(get_attribute(get_attribute(m, "to_string"), "__call__")(__args_19, __kwargs_19)); +undefined; +m = get_attribute(__iterator__, "next")(create_array(), {}); +} +} +catch(__exception__) { +if (__exception__ == StopIteration || isinstance([__exception__, StopIteration])) { + +} + +} + +} + +__TaskList_attrs.rsay = __TaskList_rsay; +TaskList = create_class("TaskList", __TaskList_parents, __TaskList_attrs); +var TaskApp, __TaskApp_attrs, __TaskApp_parents; +__TaskApp_attrs = {}; +__TaskApp_parents = create_array(); +__TaskApp_parents.push(Controller); +var __TaskApp___init__ = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "el", "collection")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var el = arguments['el']; +var collection = arguments['collection']; +var __args_20, __kwargs_20; +__args_20 = create_array(self, "div", el); +__kwargs_20 = {}; +get_attribute(get_attribute(Controller, "__init__"), "__call__")(__args_20, __kwargs_20); +set_attribute(self, "collection", collection); +var __args_21, __kwargs_21; +__args_21 = create_array("#newtask"); +__kwargs_21 = {}; +button = get_attribute(J, "__call__")(__args_21, __kwargs_21); +var __args_22, __kwargs_22; +__args_22 = create_array("click", false, get_attribute(self, "create")); +__kwargs_22 = {}; +get_attribute(get_attribute(button, "bind"), "__call__")(__args_22, __kwargs_22); +var __args_23, __kwargs_23; +__args_23 = create_array("add", get_attribute(self, "render")); +__kwargs_23 = {}; +get_attribute(get_attribute(e, "bind"), "__call__")(__args_23, __kwargs_23); +var __args_24, __kwargs_24; +__args_24 = create_array("update", get_attribute(self, "render")); +__kwargs_24 = {}; +get_attribute(get_attribute(e, "bind"), "__call__")(__args_24, __kwargs_24); +} + +__TaskApp_attrs.__init__ = __TaskApp___init__; +var __TaskApp_create = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var __args_25, __kwargs_25; +__args_25 = create_array("#taskinput"); +__kwargs_25 = {}; +j = get_attribute(get_attribute(J, "__call__")(__args_25, __kwargs_25), "j"); +name = j.val(); +if(name != "") { +var __args_26, __kwargs_26; +__args_26 = create_array(name); +__kwargs_26 = {}; +var __args_27, __kwargs_27; +__args_27 = create_array(get_attribute(TaskModel, "__call__")(__args_26, __kwargs_26)); +__kwargs_27 = {}; +get_attribute(get_attribute(get_attribute(self, "collection"), "add"), "__call__")(__args_27, __kwargs_27); +var __args_28, __kwargs_28; +__args_28 = create_array("#taskinput"); +__kwargs_28 = {}; +j = get_attribute(get_attribute(J, "__call__")(__args_28, __kwargs_28), "j"); +empty_text = ""; +j.val(empty_text); +} + +} + +__TaskApp_attrs.create = __TaskApp_create; +var __TaskApp_render = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +console.log("render tasklist"); +j = get_attribute(get_attribute(self, "el"), "j"); +j.empty(); +var __iterator__, m; +__iterator__ = get_attribute(get_attribute(get_attribute(get_attribute(self, "collection"), "models"), "__iter__"), "__call__")(create_array(), {}); +try { +m = get_attribute(__iterator__, "next")(create_array(), {}); +while(true) { +var __args_29, __kwargs_29; +__args_29 = create_array(m); +__kwargs_29 = {}; +task = get_attribute(Task, "__call__")(__args_29, __kwargs_29); +var __args_30, __kwargs_30; +__args_30 = create_array(); +__kwargs_30 = {}; +var __args_31, __kwargs_31; +__args_31 = create_array(get_attribute(get_attribute(task, "html"), "__call__")(__args_30, __kwargs_30)); +__kwargs_31 = {}; +get_attribute(get_attribute(get_attribute(self, "el"), "append"), "__call__")(__args_31, __kwargs_31); +undefined; +undefined; +m = get_attribute(__iterator__, "next")(create_array(), {}); +} +} +catch(__exception__) { +if (__exception__ == StopIteration || isinstance([__exception__, StopIteration])) { + +} + +} + +} + +__TaskApp_attrs.render = __TaskApp_render; +TaskApp = create_class("TaskApp", __TaskApp_parents, __TaskApp_attrs); +console.log("application start"); +var __args_32, __kwargs_32; +__args_32 = create_array(); +__kwargs_32 = {}; +var __args_33, __kwargs_33; +__args_33 = create_array("#items", get_attribute(TaskList, "__call__")(__args_32, __kwargs_32)); +__kwargs_33 = {}; +get_attribute(TaskApp, "__call__")(__args_33, __kwargs_33); diff --git a/demo/hakuintodo/javascripts/foundation/foundation.alerts.js b/demo/hakuintodo/javascripts/foundation/foundation.alerts.js new file mode 100644 index 0000000..62dc007 --- /dev/null +++ b/demo/hakuintodo/javascripts/foundation/foundation.alerts.js @@ -0,0 +1,50 @@ +/*jslint unparam: true, browser: true, indent: 2 */ + +;(function ($, window, document, undefined) { + 'use strict'; + + Foundation.libs.alerts = { + name : 'alerts', + + version : '4.0.0', + + settings : { + speed: 300, // fade out speed + callback: function (){} + }, + + init : function (scope, method, options) { + this.scope = scope || this.scope; + + if (typeof method === 'object') { + $.extend(true, this.settings, method); + } + + if (typeof method != 'string') { + if (!this.settings.init) this.events(); + + return this.settings.init; + } else { + return this[method].call(this, options); + } + }, + + events : function () { + var self = this; + + $(this.scope).on('click.fndtn.alerts', '[data-alert] a.close', function (e) { + e.preventDefault(); + $(this).closest("[data-alert]").fadeOut(self.speed, function () { + $(this).remove(); + self.settings.callback(); + }); + }); + + this.settings.init = true; + }, + + off : function () { + $(this.scope).off('.fndtn.alerts'); + } + }; +}(Foundation.zj, this, this.document)); \ No newline at end of file diff --git a/demo/hakuintodo/javascripts/foundation/foundation.clearing.js b/demo/hakuintodo/javascripts/foundation/foundation.clearing.js new file mode 100644 index 0000000..dfe9fce --- /dev/null +++ b/demo/hakuintodo/javascripts/foundation/foundation.clearing.js @@ -0,0 +1,516 @@ +/*jslint unparam: true, browser: true, indent: 2 */ + +;(function ($, window, document, undefined) { + 'use strict'; + + Foundation.libs.clearing = { + name : 'clearing', + + version : '4.1.3', + + settings : { + templates : { + viewing : '×' + + '' + }, + + // comma delimited list of selectors that, on click, will close clearing, + // add 'div.clearing-blackout, div.visible-img' to close on background click + close_selectors : '.clearing-close', + + // event initializers and locks + init : false, + locked : false + }, + + init : function (scope, method, options) { + var self = this; + Foundation.inherit(this, 'set_data get_data remove_data throttle data_options'); + + if (typeof method === 'object') { + options = $.extend(true, this.settings, method); + } + + if (typeof method != 'string') { + $(this.scope).find('ul[data-clearing]').each(function () { + var $el = $(this), + options = options || {}, + lis = $el.find('li'), + settings = self.get_data($el); + + if (!settings && lis.length > 0) { + options.$parent = $el.parent(); + + self.set_data($el, $.extend({}, self.settings, options, self.data_options($el))); + + self.assemble($el.find('li')); + + if (!self.settings.init) { + self.events().swipe_events(); + } + } + }); + + return this.settings.init; + } else { + // fire method + return this[method].call(this, options); + } + }, + + // event binding and initial setup + + events : function () { + var self = this; + + $(this.scope) + .on('click.fndtn.clearing', 'ul[data-clearing] li', + function (e, current, target) { + var current = current || $(this), + target = target || current, + next = current.next('li'), + settings = self.get_data(current.parent()), + image = $(e.target); + + e.preventDefault(); + if (!settings) self.init(); + + // if clearing is open and the current image is + // clicked, go to the next image in sequence + if (target.hasClass('visible') + && current[0] === target[0] + && next.length > 0 && self.is_open(current)) { + target = next; + image = target.find('img'); + } + + // set current and target to the clicked li if not otherwise defined. + self.open(image, current, target); + self.update_paddles(target); + }) + + .on('click.fndtn.clearing', '.clearing-main-next', + function (e) { this.nav(e, 'next') }.bind(this)) + .on('click.fndtn.clearing', '.clearing-main-prev', + function (e) { this.nav(e, 'prev') }.bind(this)) + .on('click.fndtn.clearing', this.settings.close_selectors, + function (e) { Foundation.libs.clearing.close(e, this) }) + .on('keydown.fndtn.clearing', + function (e) { this.keydown(e) }.bind(this)); + + $(window).on('resize.fndtn.clearing', + function () { this.resize() }.bind(this)); + + this.settings.init = true; + return this; + }, + + swipe_events : function () { + var self = this; + + $(this.scope) + .on('touchstart.fndtn.clearing', '.visible-img', function(e) { + if (!e.touches) { e = e.originalEvent; } + var data = { + start_page_x: e.touches[0].pageX, + start_page_y: e.touches[0].pageY, + start_time: (new Date()).getTime(), + delta_x: 0, + is_scrolling: undefined + }; + + $(this).data('swipe-transition', data); + e.stopPropagation(); + }) + .on('touchmove.fndtn.clearing', '.visible-img', function(e) { + if (!e.touches) { e = e.originalEvent; } + // Ignore pinch/zoom events + if(e.touches.length > 1 || e.scale && e.scale !== 1) return; + + var data = $(this).data('swipe-transition'); + + if (typeof data === 'undefined') { + data = {}; + } + + data.delta_x = e.touches[0].pageX - data.start_page_x; + + if ( typeof data.is_scrolling === 'undefined') { + data.is_scrolling = !!( data.is_scrolling || Math.abs(data.delta_x) < Math.abs(e.touches[0].pageY - data.start_page_y) ); + } + + if (!data.is_scrolling && !data.active) { + e.preventDefault(); + var direction = (data.delta_x < 0) ? 'next' : 'prev'; + data.active = true; + self.nav(e, direction); + } + }) + .on('touchend.fndtn.clearing', '.visible-img', function(e) { + $(this).data('swipe-transition', {}); + e.stopPropagation(); + }); + }, + + assemble : function ($li) { + var $el = $li.parent(); + $el.after('
'); + + var holder = $('#foundationClearingHolder'), + settings = this.get_data($el), + grid = $el.detach(), + data = { + grid: '', + viewing: settings.templates.viewing + }, + wrapper = '
' + data.viewing + + data.grid + '
'; + + return holder.after(wrapper).remove(); + }, + + // event callbacks + + open : function ($image, current, target) { + var root = target.closest('.clearing-assembled'), + container = root.find('div').first(), + visible_image = container.find('.visible-img'), + image = visible_image.find('img').not($image); + + if (!this.locked()) { + // set the image to the selected thumbnail + image + .attr('src', this.load($image)) + .css('visibility', 'hidden'); + + this.loaded(image, function () { + image.css('visibility', 'visible'); + // toggle the gallery + root.addClass('clearing-blackout'); + container.addClass('clearing-container'); + visible_image.show(); + this.fix_height(target) + .caption(visible_image.find('.clearing-caption'), $image) + .center(image) + .shift(current, target, function () { + target.siblings().removeClass('visible'); + target.addClass('visible'); + }); + }.bind(this)); + } + }, + + close : function (e, el) { + e.preventDefault(); + + var root = (function (target) { + if (/blackout/.test(target.selector)) { + return target; + } else { + return target.closest('.clearing-blackout'); + } + }($(el))), container, visible_image; + + if (el === e.target && root) { + container = root.find('div').first(); + visible_image = container.find('.visible-img'); + this.settings.prev_index = 0; + root.find('ul[data-clearing]') + .attr('style', '').closest('.clearing-blackout') + .removeClass('clearing-blackout'); + container.removeClass('clearing-container'); + visible_image.hide(); + } + + return false; + }, + + is_open : function (current) { + return current.parent().attr('style').length > 0; + }, + + keydown : function (e) { + var clearing = $('.clearing-blackout').find('ul[data-clearing]'); + + if (e.which === 39) this.go(clearing, 'next'); + if (e.which === 37) this.go(clearing, 'prev'); + if (e.which === 27) $('a.clearing-close').trigger('click'); + }, + + nav : function (e, direction) { + var clearing = $('.clearing-blackout').find('ul[data-clearing]'); + + e.preventDefault(); + this.go(clearing, direction); + }, + + resize : function () { + var image = $('.clearing-blackout .visible-img').find('img'); + + if (image.length) { + this.center(image); + } + }, + + // visual adjustments + fix_height : function (target) { + var lis = target.parent().children(), + self = this; + + lis.each(function () { + var li = $(this), + image = li.find('img'); + + if (li.height() > self.outerHeight(image)) { + li.addClass('fix-height'); + } + }) + .closest('ul') + .width(lis.length * 100 + '%'); + + return this; + }, + + update_paddles : function (target) { + var visible_image = target + .closest('.carousel') + .siblings('.visible-img'); + + if (target.next().length > 0) { + visible_image + .find('.clearing-main-next') + .removeClass('disabled'); + } else { + visible_image + .find('.clearing-main-next') + .addClass('disabled'); + } + + if (target.prev().length > 0) { + visible_image + .find('.clearing-main-prev') + .removeClass('disabled'); + } else { + visible_image + .find('.clearing-main-prev') + .addClass('disabled'); + } + }, + + center : function (target) { + if (!this.rtl) { + target.css({ + marginLeft : -(this.outerWidth(target) / 2), + marginTop : -(this.outerHeight(target) / 2) + }); + } else { + target.css({ + marginRight : -(this.outerWidth(target) / 2), + marginTop : -(this.outerHeight(target) / 2) + }); + } + return this; + }, + + // image loading and preloading + + load : function ($image) { + if ($image[0].nodeName === "A") { + var href = $image.attr('href'); + } else { + var href = $image.parent().attr('href'); + } + + this.preload($image); + + if (href) return href; + return $image.attr('src'); + }, + + preload : function ($image) { + this + .img($image.closest('li').next()) + .img($image.closest('li').prev()); + }, + + loaded : function (image, callback) { + // based on jquery.imageready.js + // @weblinc, @jsantell, (c) 2012 + + function loaded () { + callback(); + } + + function bindLoad () { + this.one('load', loaded); + + if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) { + var src = this.attr( 'src' ), + param = src.match( /\?/ ) ? '&' : '?'; + + param += 'random=' + (new Date()).getTime(); + this.attr('src', src + param); + } + } + + if (!image.attr('src')) { + loaded(); + return; + } + + if (image[0].complete || image[0].readyState === 4) { + loaded(); + } else { + bindLoad.call(image); + } + }, + + img : function (img) { + if (img.length) { + var new_img = new Image(), + new_a = img.find('a'); + + if (new_a.length) { + new_img.src = new_a.attr('href'); + } else { + new_img.src = img.find('img').attr('src'); + } + } + return this; + }, + + // image caption + + caption : function (container, $image) { + var caption = $image.data('caption'); + + if (caption) { + container + .text(caption) + .show(); + } else { + container + .text('') + .hide(); + } + return this; + }, + + // directional methods + + go : function ($ul, direction) { + var current = $ul.find('.visible'), + target = current[direction](); + + if (target.length) { + target + .find('img') + .trigger('click', [current, target]); + } + }, + + shift : function (current, target, callback) { + var clearing = target.parent(), + old_index = this.settings.prev_index || target.index(), + direction = this.direction(clearing, current, target), + left = parseInt(clearing.css('left'), 10), + width = this.outerWidth(target), + skip_shift; + + // we use jQuery animate instead of CSS transitions because we + // need a callback to unlock the next animation + if (target.index() !== old_index && !/skip/.test(direction)){ + if (/left/.test(direction)) { + this.lock(); + clearing.animate({left : left + width}, 300, this.unlock()); + } else if (/right/.test(direction)) { + this.lock(); + clearing.animate({left : left - width}, 300, this.unlock()); + } + } else if (/skip/.test(direction)) { + // the target image is not adjacent to the current image, so + // do we scroll right or not + skip_shift = target.index() - this.settings.up_count; + this.lock(); + + if (skip_shift > 0) { + clearing.animate({left : -(skip_shift * width)}, 300, this.unlock()); + } else { + clearing.animate({left : 0}, 300, this.unlock()); + } + } + + callback(); + }, + + direction : function ($el, current, target) { + var lis = $el.find('li'), + li_width = this.outerWidth(lis) + (this.outerWidth(lis) / 4), + up_count = Math.floor(this.outerWidth($('.clearing-container')) / li_width) - 1, + target_index = lis.index(target), + response; + + this.settings.up_count = up_count; + + if (this.adjacent(this.settings.prev_index, target_index)) { + if ((target_index > up_count) + && target_index > this.settings.prev_index) { + response = 'right'; + } else if ((target_index > up_count - 1) + && target_index <= this.settings.prev_index) { + response = 'left'; + } else { + response = false; + } + } else { + response = 'skip'; + } + + this.settings.prev_index = target_index; + + return response; + }, + + adjacent : function (current_index, target_index) { + for (var i = target_index + 1; i >= target_index - 1; i--) { + if (i === current_index) return true; + } + return false; + }, + + // lock management + + lock : function () { + this.settings.locked = true; + }, + + unlock : function () { + this.settings.locked = false; + }, + + locked : function () { + return this.settings.locked; + }, + + // plugin management/browser quirks + + outerHTML : function (el) { + // support FireFox < 11 + return el.outerHTML || new XMLSerializer().serializeToString(el); + }, + + off : function () { + $(this.scope).off('.fndtn.clearing'); + $(window).off('.fndtn.clearing'); + this.remove_data(); // empty settings cache + this.settings.init = false; + }, + + reflow : function () { + this.init(); + } + }; + +}(Foundation.zj, this, this.document)); diff --git a/demo/hakuintodo/javascripts/foundation/foundation.cookie.js b/demo/hakuintodo/javascripts/foundation/foundation.cookie.js new file mode 100644 index 0000000..b196e76 --- /dev/null +++ b/demo/hakuintodo/javascripts/foundation/foundation.cookie.js @@ -0,0 +1,74 @@ +/*! + * jQuery Cookie Plugin v1.3 + * https://github.com/carhartl/jquery-cookie + * + * Copyright 2011, Klaus Hartl + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://www.opensource.org/licenses/mit-license.php + * http://www.opensource.org/licenses/GPL-2.0 + * + * Modified to work with Zepto.js by ZURB + */ +(function ($, document, undefined) { + + var pluses = /\+/g; + + function raw(s) { + return s; + } + + function decoded(s) { + return decodeURIComponent(s.replace(pluses, ' ')); + } + + var config = $.cookie = function (key, value, options) { + + // write + if (value !== undefined) { + options = $.extend({}, config.defaults, options); + + if (value === null) { + options.expires = -1; + } + + if (typeof options.expires === 'number') { + var days = options.expires, t = options.expires = new Date(); + t.setDate(t.getDate() + days); + } + + value = config.json ? JSON.stringify(value) : String(value); + + return (document.cookie = [ + encodeURIComponent(key), '=', config.raw ? value : encodeURIComponent(value), + options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE + options.path ? '; path=' + options.path : '', + options.domain ? '; domain=' + options.domain : '', + options.secure ? '; secure' : '' + ].join('')); + } + + // read + var decode = config.raw ? raw : decoded; + var cookies = document.cookie.split('; '); + for (var i = 0, l = cookies.length; i < l; i++) { + var parts = cookies[i].split('='); + if (decode(parts.shift()) === key) { + var cookie = decode(parts.join('=')); + return config.json ? JSON.parse(cookie) : cookie; + } + } + + return null; + }; + + config.defaults = {}; + + $.removeCookie = function (key, options) { + if ($.cookie(key) !== null) { + $.cookie(key, null, options); + return true; + } + return false; + }; + +})(Foundation.zj, document); \ No newline at end of file diff --git a/demo/hakuintodo/javascripts/foundation/foundation.dropdown.js b/demo/hakuintodo/javascripts/foundation/foundation.dropdown.js new file mode 100644 index 0000000..1ccec66 --- /dev/null +++ b/demo/hakuintodo/javascripts/foundation/foundation.dropdown.js @@ -0,0 +1,159 @@ +/*jslint unparam: true, browser: true, indent: 2 */ + +;(function ($, window, document, undefined) { + 'use strict'; + + Foundation.libs.dropdown = { + name : 'dropdown', + + version : '4.1.3', + + settings : { + activeClass: 'open', + opened: function(){}, + closed: function(){} + }, + + init : function (scope, method, options) { + this.scope = scope || this.scope; + Foundation.inherit(this, 'throttle scrollLeft'); + + if (typeof method === 'object') { + $.extend(true, this.settings, method); + } + + if (typeof method != 'string') { + + if (!this.settings.init) { + this.events(); + } + + return this.settings.init; + } else { + return this[method].call(this, options); + } + }, + + events : function () { + var self = this; + + $(this.scope) + .on('click.fndtn.dropdown', '[data-dropdown]', function (e) { + e.preventDefault(); + self.toggle($(this)); + }) + .on('opened.fndtn.dropdown', '[data-dropdown-content]', this.settings.opened) + .on('closed.fndtn.dropdown', '[data-dropdown-content]', this.settings.closed); + + $('body').on('click.fndtn.dropdown', function (e) { + var parent = $(e.target).closest('[data-dropdown-content]'); + + if ($(e.target).data('dropdown')) { + return; + } + if (parent.length > 0 && ($(e.target).is('[data-dropdown-content]') || $.contains(parent.first()[0], e.target))) { + e.stopPropagation(); + return; + } + + self.close.call(self, $('[data-dropdown-content]')); + }); + + $(window).on('resize.fndtn.dropdown', self.throttle(function () { + self.resize.call(self); + }, 50)).trigger('resize'); + + this.settings.init = true; + }, + + close: function (dropdown) { + var self = this; + dropdown.each(function () { + if ($(this).hasClass(self.settings.activeClass)) { + $(this) + .css(Foundation.rtl ? 'right':'left', '-99999px') + .removeClass(self.settings.activeClass); + $(this).trigger('closed'); + } + }); + }, + + open: function (dropdown, target) { + this + .css(dropdown + .addClass(this.settings.activeClass), target); + dropdown.trigger('opened'); + }, + + toggle : function (target) { + var dropdown = $('#' + target.data('dropdown')); + + this.close.call(this, $('[data-dropdown-content]').not(dropdown)); + + if (dropdown.hasClass(this.settings.activeClass)) { + this.close.call(this, dropdown); + } else { + this.open.call(this, dropdown, target); + } + }, + + resize : function () { + var dropdown = $('[data-dropdown-content].open'), + target = $("[data-dropdown='" + dropdown.attr('id') + "']"); + + if (dropdown.length && target.length) { + this.css(dropdown, target); + } + }, + + css : function (dropdown, target) { + // temporary workaround until 4.2 + if (/body/i.test(dropdown.offsetParent()[0].nodeName)) { + var position = target.offset(); + position.top -= dropdown.offsetParent().offset().top; + position.left -= dropdown.offsetParent().offset().left; + } else { + var position = target.position(); + } + + if (this.small()) { + dropdown.css({ + position : 'absolute', + width: '95%', + left: '2.5%', + 'max-width': 'none', + top: position.top + this.outerHeight(target) + }); + } else { + if (!Foundation.rtl && $(window).width() > this.outerWidth(dropdown) + target.offset().left) { + var left = position.left; + } else { + if (!dropdown.hasClass('right')) { + dropdown.addClass('right'); + } + var left = position.left - (this.outerWidth(dropdown) - this.outerWidth(target)); + } + + dropdown.attr('style', '').css({ + position : 'absolute', + top: position.top + this.outerHeight(target), + left: left + }); + } + + return dropdown; + }, + + small : function () { + return $(window).width() < 768 || $('html').hasClass('lt-ie9'); + }, + + off: function () { + $(this.scope).off('.fndtn.dropdown'); + $('html, body').off('.fndtn.dropdown'); + $(window).off('.fndtn.dropdown'); + $('[data-dropdown-content]').off('.fndtn.dropdown'); + this.settings.init = false; + } + }; +}(Foundation.zj, this, this.document)); diff --git a/demo/hakuintodo/javascripts/foundation/foundation.forms.js b/demo/hakuintodo/javascripts/foundation/foundation.forms.js new file mode 100644 index 0000000..f12c490 --- /dev/null +++ b/demo/hakuintodo/javascripts/foundation/foundation.forms.js @@ -0,0 +1,513 @@ +(function ($, window, document, undefined) { + 'use strict'; + + Foundation.libs.forms = { + name: 'forms', + + version: '4.1.6', + + cache: {}, + + settings: { + disable_class: 'no-custom', + last_combo : null + }, + + init: function (scope, method, options) { + + if (typeof method === 'object') { + $.extend(true, this.settings, method); + } + + if (typeof method != 'string') { + if (!this.settings.init) { + this.events(); + } + + this.assemble(); + + return this.settings.init; + } else { + return this[method].call(this, options); + } + }, + + assemble: function () { + $('form.custom input[type="radio"]', $(this.scope)).not('[data-customforms="disabled"]') + .each(this.append_custom_markup); + $('form.custom input[type="checkbox"]', $(this.scope)).not('[data-customforms="disabled"]') + .each(this.append_custom_markup); + $('form.custom select', $(this.scope)) + .not('[data-customforms="disabled"]') + .not('[multiple=multiple]') + .each(this.append_custom_select); + }, + + events: function () { + var self = this; + + $(this.scope) + .on('click.fndtn.forms', 'form.custom span.custom.checkbox', function (e) { + e.preventDefault(); + e.stopPropagation(); + self.toggle_checkbox($(this)); + }) + .on('click.fndtn.forms', 'form.custom span.custom.radio', function (e) { + e.preventDefault(); + e.stopPropagation(); + self.toggle_radio($(this)); + }) + .on('change.fndtn.forms', 'form.custom select:not([data-customforms="disabled"])', function (e, force_refresh) { + self.refresh_custom_select($(this), force_refresh); + }) + .on('click.fndtn.forms', 'form.custom label', function (e) { + if ($(e.target).is('label')) { + var $associatedElement = $('#' + self.escape($(this).attr('for')) + ':not([data-customforms="disabled"])'), + $customCheckbox, + $customRadio; + + if ($associatedElement.length !== 0) { + if ($associatedElement.attr('type') === 'checkbox') { + e.preventDefault(); + $customCheckbox = $(this).find('span.custom.checkbox'); + //the checkbox might be outside after the label or inside of another element + if ($customCheckbox.length == 0) { + $customCheckbox = $associatedElement.add(this).siblings('span.custom.checkbox').first(); + } + self.toggle_checkbox($customCheckbox); + } else if ($associatedElement.attr('type') === 'radio') { + e.preventDefault(); + $customRadio = $(this).find('span.custom.radio'); + //the radio might be outside after the label or inside of another element + if ($customRadio.length == 0) { + $customRadio = $associatedElement.add(this).siblings('span.custom.radio').first(); + } + self.toggle_radio($customRadio); + } + } + } + }) + .on('click.fndtn.forms', 'form.custom div.custom.dropdown a.current, form.custom div.custom.dropdown a.selector', function (e) { + var $this = $(this), + $dropdown = $this.closest('div.custom.dropdown'), + $select = getFirstPrevSibling($dropdown, 'select'); + + // make sure other dropdowns close + if (!$dropdown.hasClass('open')) $(self.scope).trigger('click'); + + e.preventDefault(); + if (false === $select.is(':disabled')) { + $dropdown.toggleClass('open'); + + if ($dropdown.hasClass('open')) { + $(self.scope).on('click.fndtn.forms.customdropdown', function () { + $dropdown.removeClass('open'); + $(self.scope).off('.fndtn.forms.customdropdown'); + }); + } else { + $(self.scope).on('.fndtn.forms.customdropdown'); + } + return false; + } + }) + .on('click.fndtn.forms touchend.fndtn.forms', 'form.custom div.custom.dropdown li', function (e) { + var $this = $(this), + $customDropdown = $this.closest('div.custom.dropdown'), + $select = getFirstPrevSibling($customDropdown, 'select'), + selectedIndex = 0; + + e.preventDefault(); + e.stopPropagation(); + + if (!$(this).hasClass('disabled')) { + $('div.dropdown').not($customDropdown).removeClass('open'); + + var $oldThis = $this.closest('ul') + .find('li.selected'); + $oldThis.removeClass('selected'); + + $this.addClass('selected'); + + $customDropdown.removeClass('open') + .find('a.current') + .text($this.text()); + + $this.closest('ul').find('li').each(function (index) { + if ($this[0] == this) { + selectedIndex = index; + } + }); + $select[0].selectedIndex = selectedIndex; + + //store the old value in data + $select.data('prevalue', $oldThis.html()); + $select.trigger('change'); + } + }); + + $(window).on('keydown', function (e) { + var focus = document.activeElement, + self = Foundation.libs.forms, + dropdown = $('.custom.dropdown.open'); + + if (dropdown.length > 0) { + e.preventDefault(); + + if (e.which === 13) { + dropdown.find('li.selected').trigger('click'); + } + + if (e.which === 27) { + dropdown.removeClass('open'); + } + + if (e.which >= 65 && e.which <= 90) { + var next = self.go_to(dropdown, e.which), + current = dropdown.find('li.selected'); + + if (next) { + current.removeClass('selected'); + self.scrollTo(next.addClass('selected'), 300); + } + } + + if (e.which === 38) { + var current = dropdown.find('li.selected'), + prev = current.prev(':not(.disabled)'); + + if (prev.length > 0) { + prev.parent()[0].scrollTop = prev.parent().scrollTop() - self.outerHeight(prev); + current.removeClass('selected'); + prev.addClass('selected'); + } + } else if (e.which === 40) { + var current = dropdown.find('li.selected'), + next = current.next(':not(.disabled)'); + + if (next.length > 0) { + next.parent()[0].scrollTop = next.parent().scrollTop() + self.outerHeight(next); + current.removeClass('selected'); + next.addClass('selected'); + } + } + } + }); + + this.settings.init = true; + }, + + go_to: function (dropdown, char) { + var lis = dropdown.find('li'), + count = lis.length; + + if (count > 0) { + for (var i = 0; i < count; i++) { + var first_letter = lis.eq(i).text().charAt(0).toLowerCase(); + if (first_letter === String.fromCharCode(char).toLowerCase()) return lis.eq(i); + } + } + }, + + scrollTo: function (el, duration) { + if (duration < 0) return; + var parent = el.parent(); + var li_height = this.outerHeight(el); + var difference = (li_height * (el.index())) - parent.scrollTop(); + var perTick = difference / duration * 10; + + this.scrollToTimerCache = setTimeout(function () { + if (!isNaN(parseInt(perTick, 10))) { + parent[0].scrollTop = parent.scrollTop() + perTick; + this.scrollTo(el, duration - 10); + } + }.bind(this), 10); + }, + + append_custom_markup: function (idx, sel) { + var $this = $(sel), + type = $this.attr('type'), + $span = $this.next('span.custom.' + type); + + if (!$this.parent().hasClass('switch')) { + $this.addClass('hidden-field'); + } + + if ($span.length === 0) { + $span = $('').insertAfter($this); + } + + $span.toggleClass('checked', $this.is(':checked')); + $span.toggleClass('disabled', $this.is(':disabled')); + }, + + append_custom_select: function (idx, sel) { + var self = Foundation.libs.forms, + $this = $(sel), + $customSelect = $this.next('div.custom.dropdown'), + $customList = $customSelect.find('ul'), + $selectCurrent = $customSelect.find(".current"), + $selector = $customSelect.find(".selector"), + $options = $this.find('option'), + $selectedOption = $options.filter(':selected'), + copyClasses = $this.attr('class') ? $this.attr('class').split(' ') : [], + maxWidth = 0, + liHtml = '', + $listItems, + $currentSelect = false; + + if ($this.hasClass(self.settings.disable_class)) return; + + if ($customSelect.length === 0) { + var customSelectSize = $this.hasClass('small') ? 'small' : $this.hasClass('medium') ? 'medium' : $this.hasClass('large') ? 'large' : $this.hasClass('expand') ? 'expand' : ''; + + $customSelect = $('
'); + + $selector = $customSelect.find(".selector"); + $customList = $customSelect.find("ul"); + + liHtml = $options.map(function () { + return "
  • " + $(this).html() + "
  • "; + }).get().join(''); + + $customList.append(liHtml); + + $currentSelect = $customSelect + .prepend('' + $selectedOption.html() + '') + .find(".current"); + + $this.after($customSelect) + .addClass('hidden-field'); + } else { + liHtml = $options.map(function () { + return "
  • " + $(this).html() + "
  • "; + }) + .get().join(''); + + $customList.html('') + .append(liHtml); + + } // endif $customSelect.length === 0 + + self.assign_id($this, $customSelect); + $customSelect.toggleClass('disabled', $this.is(':disabled')); + $listItems = $customList.find('li'); + + // cache list length + self.cache[$customSelect.data('id')] = $listItems.length; + + $options.each(function (index) { + if (this.selected) { + $listItems.eq(index).addClass('selected'); + + if ($currentSelect) { + $currentSelect.html($(this).html()); + } + } + if ($(this).is(':disabled')) { + $listItems.eq(index).addClass('disabled'); + } + }); + + // + // If we're not specifying a predetermined form size. + // + if (!$customSelect.is('.small, .medium, .large, .expand')) { + + // ------------------------------------------------------------------------------------ + // This is a work-around for when elements are contained within hidden parents. + // For example, when custom-form elements are inside of a hidden reveal modal. + // + // We need to display the current custom list element as well as hidden parent elements + // in order to properly calculate the list item element's width property. + // ------------------------------------------------------------------------------------- + + $customSelect.addClass('open'); + // + // Quickly, display all parent elements. + // This should help us calcualate the width of the list item's within the drop down. + // + var self = Foundation.libs.forms; + self.hidden_fix.adjust($customList); + + maxWidth = (self.outerWidth($listItems) > maxWidth) ? self.outerWidth($listItems) : maxWidth; + + Foundation.libs.forms.hidden_fix.reset(); + + $customSelect.removeClass('open'); + + } // endif + + }, + + assign_id: function ($select, $customSelect) { + var id = [+new Date(), Foundation.random_str(5)].join('-'); + $select.attr('data-id', id); + $customSelect.attr('data-id', id); + }, + + refresh_custom_select: function ($select, force_refresh) { + var self = this; + var maxWidth = 0, + $customSelect = $select.next(), + $options = $select.find('option'), + $listItems = $customSelect.find('li'); + + if ($listItems.length != this.cache[$customSelect.data('id')] || force_refresh) { + $customSelect.find('ul').html(''); + + $options.each(function () { + var $li = $('
  • ' + $(this).html() + '
  • '); + $customSelect.find('ul').append($li); + }); + + // re-populate + $options.each(function (index) { + if (this.selected) { + $customSelect.find('li').eq(index).addClass('selected'); + $customSelect.find('.current').html($(this).html()); + } + if ($(this).is(':disabled')) { + $customSelect.find('li').eq(index).addClass('disabled'); + } + }); + + // fix width + $customSelect.removeAttr('style') + .find('ul').removeAttr('style'); + $customSelect.find('li').each(function () { + $customSelect.addClass('open'); + if (self.outerWidth($(this)) > maxWidth) { + maxWidth = self.outerWidth($(this)); + } + $customSelect.removeClass('open'); + }); + + $listItems = $customSelect.find('li'); + // cache list length + this.cache[$customSelect.data('id')] = $listItems.length; + } + }, + + toggle_checkbox: function ($element) { + var $input = $element.prev(), + input = $input[0]; + + if (false === $input.is(':disabled')) { + input.checked = ((input.checked) ? false : true); + $element.toggleClass('checked'); + + $input.trigger('change'); + } + }, + + toggle_radio: function ($element) { + var $input = $element.prev(), + $form = $input.closest('form.custom'), + input = $input[0]; + + if (false === $input.is(':disabled')) { + $form.find('input[type="radio"][name="' + this.escape($input.attr('name')) + '"]') + .next().not($element).removeClass('checked'); + + if (!$element.hasClass('checked')) { + $element.toggleClass('checked'); + } + + input.checked = $element.hasClass('checked'); + + $input.trigger('change'); + } + }, + + escape: function (text) { + return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); + }, + + hidden_fix: { + /** + * Sets all hidden parent elements and self to visibile. + * + * @method adjust + * @param {jQuery Object} $child + */ + + // We'll use this to temporarily store style properties. + tmp: [], + + // We'll use this to set hidden parent elements. + hidden: null, + + adjust: function ($child) { + // Internal reference. + var _self = this; + + // Set all hidden parent elements, including this element. + _self.hidden = $child.parents().andSelf().filter(":hidden"); + + // Loop through all hidden elements. + _self.hidden.each(function () { + + // Cache the element. + var $elem = $(this); + + // Store the style attribute. + // Undefined if element doesn't have a style attribute. + _self.tmp.push($elem.attr('style')); + + // Set the element's display property to block, + // but ensure it's visibility is hidden. + $elem.css({ + 'visibility': 'hidden', + 'display': 'block' + }); + }); + + }, // end adjust + + /** + * Resets the elements previous state. + * + * @method reset + */ + reset: function () { + // Internal reference. + var _self = this; + // Loop through our hidden element collection. + _self.hidden.each(function (i) { + // Cache this element. + var $elem = $(this), + _tmp = _self.tmp[i]; // Get the stored 'style' value for this element. + + // If the stored value is undefined. + if (_tmp === undefined) + // Remove the style attribute. + $elem.removeAttr('style'); + else + // Otherwise, reset the element style attribute. + $elem.attr('style', _tmp); + }); + // Reset the tmp array. + _self.tmp = []; + // Reset the hidden elements variable. + _self.hidden = null; + + } // end reset + }, + + off: function () { + $(this.scope).off('.fndtn.forms'); + } + }; + + var getFirstPrevSibling = function($el, selector) { + var $el = $el.prev(); + while ($el.length) { + if ($el.is(selector)) return $el; + $el = $el.prev(); + } + return $(); + }; +}(Foundation.zj, this, this.document)); \ No newline at end of file diff --git a/demo/hakuintodo/javascripts/foundation/foundation.joyride.js b/demo/hakuintodo/javascripts/foundation/foundation.joyride.js new file mode 100644 index 0000000..cbcaf99 --- /dev/null +++ b/demo/hakuintodo/javascripts/foundation/foundation.joyride.js @@ -0,0 +1,831 @@ +/*jslint unparam: true, browser: true, indent: 2 */ + +(function ($, window, document, undefined) { + 'use strict'; + + Foundation.libs.joyride = { + name: 'joyride', + + version : '4.1.2', + + defaults : { + expose : false, // turn on or off the expose feature + modal : false, // Whether to cover page with modal during the tour + tipLocation : 'bottom', // 'top' or 'bottom' in relation to parent + nubPosition : 'auto', // override on a per tooltip bases + scrollSpeed : 300, // Page scrolling speed in milliseconds, 0 = no scroll animation + timer : 0, // 0 = no timer , all other numbers = timer in milliseconds + startTimerOnClick : true, // true or false - true requires clicking the first button start the timer + startOffset : 0, // the index of the tooltip you want to start on (index of the li) + nextButton : true, // true or false to control whether a next button is used + tipAnimation : 'fade', // 'pop' or 'fade' in each tip + pauseAfter : [], // array of indexes where to pause the tour after + exposed : [], // array of expose elements + tipAnimationFadeSpeed: 300, // when tipAnimation = 'fade' this is speed in milliseconds for the transition + cookieMonster : false, // true or false to control whether cookies are used + cookieName : 'joyride', // Name the cookie you'll use + cookieDomain : false, // Will this cookie be attached to a domain, ie. '.notableapp.com' + cookieExpires : 365, // set when you would like the cookie to expire. + tipContainer : 'body', // Where will the tip be attached + postRideCallback : function (){}, // A method to call once the tour closes (canceled or complete) + postStepCallback : function (){}, // A method to call after each step + preStepCallback : function (){}, // A method to call before each step + preRideCallback : function (){}, // A method to call before the tour starts (passed index, tip, and cloned exposed element) + postExposeCallback : function (){}, // A method to call after an element has been exposed + template : { // HTML segments for tip layout + link : '×', + timer : '
    ', + tip : '
    ', + wrapper : '
    ', + button : '', + modal : '
    ', + expose : '
    ', + exposeCover: '
    ' + } + }, + + settings : {}, + + init : function (scope, method, options) { + this.scope = scope || this.scope; + Foundation.inherit(this, 'throttle data_options scrollTo scrollLeft delay'); + + if (typeof method === 'object') { + $.extend(true, this.settings, this.defaults, method); + } else { + $.extend(true, this.settings, this.defaults, options); + } + + if (typeof method != 'string') { + if (!this.settings.init) this.events(); + + return this.settings.init; + } else { + return this[method].call(this, options); + } + }, + + events : function () { + var self = this; + + $(this.scope) + .on('click.joyride', '.joyride-next-tip, .joyride-modal-bg', function (e) { + e.preventDefault(); + + if (this.settings.$li.next().length < 1) { + this.end(); + } else if (this.settings.timer > 0) { + clearTimeout(this.settings.automate); + this.hide(); + this.show(); + this.startTimer(); + } else { + this.hide(); + this.show(); + } + + }.bind(this)) + + .on('click.joyride', '.joyride-close-tip', function (e) { + e.preventDefault(); + this.end(); + }.bind(this)); + + $(window).on('resize.fndtn.joyride', self.throttle(function () { + if ($('[data-joyride]').length > 0 && self.settings.$next_tip) { + if (self.settings.exposed.length > 0) { + var $els = $(self.settings.exposed); + + $els.each(function () { + var $this = $(this); + self.un_expose($this); + self.expose($this); + }); + } + + if (self.is_phone()) { + self.pos_phone(); + } else { + self.pos_default(false, true); + } + } + }, 100)); + + this.settings.init = true; + }, + + start : function () { + var self = this, + $this = $(this.scope).find('[data-joyride]'), + integer_settings = ['timer', 'scrollSpeed', 'startOffset', 'tipAnimationFadeSpeed', 'cookieExpires'], + int_settings_count = integer_settings.length; + + if (!this.settings.init) this.init(); + + // non configureable settings + this.settings.$content_el = $this; + this.settings.$body = $(this.settings.tipContainer); + this.settings.body_offset = $(this.settings.tipContainer).position(); + this.settings.$tip_content = this.settings.$content_el.find('> li'); + this.settings.paused = false; + this.settings.attempts = 0; + + this.settings.tipLocationPatterns = { + top: ['bottom'], + bottom: [], // bottom should not need to be repositioned + left: ['right', 'top', 'bottom'], + right: ['left', 'top', 'bottom'] + }; + + // can we create cookies? + if (typeof $.cookie !== 'function') { + this.settings.cookieMonster = false; + } + + // generate the tips and insert into dom. + if (!this.settings.cookieMonster || this.settings.cookieMonster && $.cookie(this.settings.cookieName) === null) { + this.settings.$tip_content.each(function (index) { + var $this = $(this); + $.extend(true, self.settings, self.data_options($this)); + // Make sure that settings parsed from data_options are integers where necessary + for (var i = int_settings_count - 1; i >= 0; i--) { + self.settings[integer_settings[i]] = parseInt(self.settings[integer_settings[i]], 10); + } + self.create({$li : $this, index : index}); + }); + + // show first tip + if (!this.settings.startTimerOnClick && this.settings.timer > 0) { + this.show('init'); + this.startTimer(); + } else { + this.show('init'); + } + + } + }, + + resume : function () { + this.set_li(); + this.show(); + }, + + tip_template : function (opts) { + var $blank, content; + + opts.tip_class = opts.tip_class || ''; + + $blank = $(this.settings.template.tip).addClass(opts.tip_class); + content = $.trim($(opts.li).html()) + + this.button_text(opts.button_text) + + this.settings.template.link + + this.timer_instance(opts.index); + + $blank.append($(this.settings.template.wrapper)); + $blank.first().attr('data-index', opts.index); + $('.joyride-content-wrapper', $blank).append(content); + + return $blank[0]; + }, + + timer_instance : function (index) { + var txt; + + if ((index === 0 && this.settings.startTimerOnClick && this.settings.timer > 0) || this.settings.timer === 0) { + txt = ''; + } else { + txt = this.outerHTML($(this.settings.template.timer)[0]); + } + return txt; + }, + + button_text : function (txt) { + if (this.settings.nextButton) { + txt = $.trim(txt) || 'Next'; + txt = this.outerHTML($(this.settings.template.button).append(txt)[0]); + } else { + txt = ''; + } + return txt; + }, + + create : function (opts) { + var buttonText = opts.$li.attr('data-button') || opts.$li.attr('data-text'), + tipClass = opts.$li.attr('class'), + $tip_content = $(this.tip_template({ + tip_class : tipClass, + index : opts.index, + button_text : buttonText, + li : opts.$li + })); + + $(this.settings.tipContainer).append($tip_content); + }, + + show : function (init) { + var $timer = null; + + // are we paused? + if (this.settings.$li === undefined + || ($.inArray(this.settings.$li.index(), this.settings.pauseAfter) === -1)) { + + // don't go to the next li if the tour was paused + if (this.settings.paused) { + this.settings.paused = false; + } else { + this.set_li(init); + } + + this.settings.attempts = 0; + + if (this.settings.$li.length && this.settings.$target.length > 0) { + if (init) { //run when we first start + this.settings.preRideCallback(this.settings.$li.index(), this.settings.$next_tip); + if (this.settings.modal) { + this.show_modal(); + } + } + + this.settings.preStepCallback(this.settings.$li.index(), this.settings.$next_tip); + + if (this.settings.modal && this.settings.expose) { + this.expose(); + } + + this.settings.tipSettings = $.extend(this.settings, this.data_options(this.settings.$li)); + + this.settings.timer = parseInt(this.settings.timer, 10); + + this.settings.tipSettings.tipLocationPattern = this.settings.tipLocationPatterns[this.settings.tipSettings.tipLocation]; + + // scroll if not modal + if (!/body/i.test(this.settings.$target.selector)) { + this.scroll_to(); + } + + if (this.is_phone()) { + this.pos_phone(true); + } else { + this.pos_default(true); + } + + $timer = this.settings.$next_tip.find('.joyride-timer-indicator'); + + if (/pop/i.test(this.settings.tipAnimation)) { + + $timer.width(0); + + if (this.settings.timer > 0) { + + this.settings.$next_tip.show(); + + this.delay(function () { + $timer.animate({ + width: $timer.parent().width() + }, this.settings.timer, 'linear'); + }.bind(this), this.settings.tipAnimationFadeSpeed); + + } else { + this.settings.$next_tip.show(); + + } + + + } else if (/fade/i.test(this.settings.tipAnimation)) { + + $timer.width(0); + + if (this.settings.timer > 0) { + + this.settings.$next_tip + .fadeIn(this.settings.tipAnimationFadeSpeed) + .show(); + + this.delay(function () { + $timer.animate({ + width: $timer.parent().width() + }, this.settings.timer, 'linear'); + }.bind(this), this.settings.tipAnimationFadeSpeed); + + } else { + this.settings.$next_tip.fadeIn(this.settings.tipAnimationFadeSpeed); + + } + } + + this.settings.$current_tip = this.settings.$next_tip; + + // skip non-existant targets + } else if (this.settings.$li && this.settings.$target.length < 1) { + + this.show(); + + } else { + + this.end(); + + } + } else { + + this.settings.paused = true; + + } + + }, + + is_phone : function () { + if (Modernizr) { + return Modernizr.mq('only screen and (max-width: 767px)') || $('.lt-ie9').length > 0; + } + + return (this.settings.$window.width() < 767); + }, + + hide : function () { + if (this.settings.modal && this.settings.expose) { + this.un_expose(); + } + + if (!this.settings.modal) { + $('.joyride-modal-bg').hide(); + } + this.settings.$current_tip.hide(); + this.settings.postStepCallback(this.settings.$li.index(), + this.settings.$current_tip); + }, + + set_li : function (init) { + if (init) { + this.settings.$li = this.settings.$tip_content.eq(this.settings.startOffset); + this.set_next_tip(); + this.settings.$current_tip = this.settings.$next_tip; + } else { + this.settings.$li = this.settings.$li.next(); + this.set_next_tip(); + } + + this.set_target(); + }, + + set_next_tip : function () { + this.settings.$next_tip = $(".joyride-tip-guide[data-index='" + this.settings.$li.index() + "']"); + this.settings.$next_tip.data('closed', ''); + }, + + set_target : function () { + var cl = this.settings.$li.attr('data-class'), + id = this.settings.$li.attr('data-id'), + $sel = function () { + if (id) { + return $(document.getElementById(id)); + } else if (cl) { + return $('.' + cl).first(); + } else { + return $('body'); + } + }; + + this.settings.$target = $sel(); + }, + + scroll_to : function () { + var window_half, tipOffset; + + window_half = $(window).height() / 2; + tipOffset = Math.ceil(this.settings.$target.offset().top - window_half + this.outerHeight(this.settings.$next_tip)); + if (tipOffset > 0) { + this.scrollTo($('html, body'), tipOffset, this.settings.scrollSpeed); + } + }, + + paused : function () { + return ($.inArray((this.settings.$li.index() + 1), this.settings.pauseAfter) === -1); + }, + + restart : function () { + this.hide(); + this.settings.$li = undefined; + this.show('init'); + }, + + pos_default : function (init, resizing) { + var half_fold = Math.ceil($(window).height() / 2), + tip_position = this.settings.$next_tip.offset(), + $nub = this.settings.$next_tip.find('.joyride-nub'), + nub_width = Math.ceil(this.outerWidth($nub) / 2), + nub_height = Math.ceil(this.outerHeight($nub) / 2), + toggle = init || false; + + // tip must not be "display: none" to calculate position + if (toggle) { + this.settings.$next_tip.css('visibility', 'hidden'); + this.settings.$next_tip.show(); + } + + if (typeof resizing === 'undefined') { + resizing = false; + } + + if (!/body/i.test(this.settings.$target.selector)) { + + if (this.bottom()) { + var leftOffset = this.settings.$target.offset().left; + if (Foundation.rtl) { + leftOffset = this.settings.$target.offset().width - this.settings.$next_tip.width() + leftOffset; + } + this.settings.$next_tip.css({ + top: (this.settings.$target.offset().top + nub_height + this.outerHeight(this.settings.$target)), + left: leftOffset}); + + this.nub_position($nub, this.settings.tipSettings.nubPosition, 'top'); + + } else if (this.top()) { + var leftOffset = this.settings.$target.offset().left; + if (Foundation.rtl) { + leftOffset = this.settings.$target.offset().width - this.settings.$next_tip.width() + leftOffset; + } + this.settings.$next_tip.css({ + top: (this.settings.$target.offset().top - this.outerHeight(this.settings.$next_tip) - nub_height), + left: leftOffset}); + + this.nub_position($nub, this.settings.tipSettings.nubPosition, 'bottom'); + + } else if (this.right()) { + + this.settings.$next_tip.css({ + top: this.settings.$target.offset().top, + left: (this.outerWidth(this.settings.$target) + this.settings.$target.offset().left + nub_width)}); + + this.nub_position($nub, this.settings.tipSettings.nubPosition, 'left'); + + } else if (this.left()) { + + this.settings.$next_tip.css({ + top: this.settings.$target.offset().top, + left: (this.settings.$target.offset().left - this.outerWidth(this.settings.$next_tip) - nub_width)}); + + this.nub_position($nub, this.settings.tipSettings.nubPosition, 'right'); + + } + + if (!this.visible(this.corners(this.settings.$next_tip)) && this.settings.attempts < this.settings.tipSettings.tipLocationPattern.length) { + + $nub.removeClass('bottom') + .removeClass('top') + .removeClass('right') + .removeClass('left'); + + this.settings.tipSettings.tipLocation = this.settings.tipSettings.tipLocationPattern[this.settings.attempts]; + + this.settings.attempts++; + + this.pos_default(); + + } + + } else if (this.settings.$li.length) { + + this.pos_modal($nub); + + } + + if (toggle) { + this.settings.$next_tip.hide(); + this.settings.$next_tip.css('visibility', 'visible'); + } + + }, + + pos_phone : function (init) { + var tip_height = this.outerHeight(this.settings.$next_tip), + tip_offset = this.settings.$next_tip.offset(), + target_height = this.outerHeight(this.settings.$target), + $nub = $('.joyride-nub', this.settings.$next_tip), + nub_height = Math.ceil(this.outerHeight($nub) / 2), + toggle = init || false; + + $nub.removeClass('bottom') + .removeClass('top') + .removeClass('right') + .removeClass('left'); + + if (toggle) { + this.settings.$next_tip.css('visibility', 'hidden'); + this.settings.$next_tip.show(); + } + + if (!/body/i.test(this.settings.$target.selector)) { + + if (this.top()) { + + this.settings.$next_tip.offset({top: this.settings.$target.offset().top - tip_height - nub_height}); + $nub.addClass('bottom'); + + } else { + + this.settings.$next_tip.offset({top: this.settings.$target.offset().top + target_height + nub_height}); + $nub.addClass('top'); + + } + + } else if (this.settings.$li.length) { + this.pos_modal($nub); + } + + if (toggle) { + this.settings.$next_tip.hide(); + this.settings.$next_tip.css('visibility', 'visible'); + } + }, + + pos_modal : function ($nub) { + this.center(); + $nub.hide(); + + this.show_modal(); + }, + + show_modal : function () { + if (!this.settings.$next_tip.data('closed')) { + var joyridemodalbg = $('.joyride-modal-bg'); + if (joyridemodalbg.length < 1) { + $('body').append(this.settings.template.modal).show(); + } + + if (/pop/i.test(this.settings.tipAnimation)) { + joyridemodalbg.show(); + } else { + joyridemodalbg.fadeIn(this.settings.tipAnimationFadeSpeed); + } + } + }, + + expose : function () { + var expose, + exposeCover, + el, + origCSS, + randId = 'expose-'+Math.floor(Math.random()*10000); + + if (arguments.length > 0 && arguments[0] instanceof $) { + el = arguments[0]; + } else if(this.settings.$target && !/body/i.test(this.settings.$target.selector)){ + el = this.settings.$target; + } else { + return false; + } + + if(el.length < 1){ + if(window.console){ + console.error('element not valid', el); + } + return false; + } + + expose = $(this.settings.template.expose); + this.settings.$body.append(expose); + expose.css({ + top: el.offset().top, + left: el.offset().left, + width: this.outerWidth(el, true), + height: this.outerHeight(el, true) + }); + + exposeCover = $(this.settings.template.exposeCover); + + origCSS = { + zIndex: el.css('z-index'), + position: el.css('position') + }; + + el.css('z-index',parseInt(expose.css('z-index'))+1); + + if (origCSS.position == 'static') { + el.css('position','relative'); + } + + el.data('expose-css',origCSS); + + exposeCover.css({ + top: el.offset().top, + left: el.offset().left, + width: this.outerWidth(el, true), + height: this.outerHeight(el, true) + }); + + this.settings.$body.append(exposeCover); + expose.addClass(randId); + exposeCover.addClass(randId); + el.data('expose', randId); + this.settings.postExposeCallback(this.settings.$li.index(), this.settings.$next_tip, el); + this.add_exposed(el); + }, + + un_expose : function () { + var exposeId, + el, + expose , + origCSS, + clearAll = false; + + if (arguments.length > 0 && arguments[0] instanceof $) { + el = arguments[0]; + } else if(this.settings.$target && !/body/i.test(this.settings.$target.selector)){ + el = this.settings.$target; + } else { + return false; + } + + if(el.length < 1){ + if (window.console) { + console.error('element not valid', el); + } + return false; + } + + exposeId = el.data('expose'); + expose = $('.' + exposeId); + + if (arguments.length > 1) { + clearAll = arguments[1]; + } + + if (clearAll === true) { + $('.joyride-expose-wrapper,.joyride-expose-cover').remove(); + } else { + expose.remove(); + } + + origCSS = el.data('expose-css'); + + if (origCSS.zIndex == 'auto') { + el.css('z-index', ''); + } else { + el.css('z-index', origCSS.zIndex); + } + + if (origCSS.position != el.css('position')) { + if(origCSS.position == 'static') {// this is default, no need to set it. + el.css('position', ''); + } else { + el.css('position', origCSS.position); + } + } + + el.removeData('expose'); + el.removeData('expose-z-index'); + this.remove_exposed(el); + }, + + add_exposed: function(el){ + this.settings.exposed = this.settings.exposed || []; + if (el instanceof $ || typeof el === 'object') { + this.settings.exposed.push(el[0]); + } else if (typeof el == 'string') { + this.settings.exposed.push(el); + } + }, + + remove_exposed: function(el){ + var search, count; + if (el instanceof $) { + search = el[0] + } else if (typeof el == 'string'){ + search = el; + } + + this.settings.exposed = this.settings.exposed || []; + count = this.settings.exposed.length; + + for (var i=0; i < count; i++) { + if (this.settings.exposed[i] == search) { + this.settings.exposed.splice(i, 1); + return; + } + } + }, + + center : function () { + var $w = $(window); + + this.settings.$next_tip.css({ + top : ((($w.height() - this.outerHeight(this.settings.$next_tip)) / 2) + $w.scrollTop()), + left : ((($w.width() - this.outerWidth(this.settings.$next_tip)) / 2) + this.scrollLeft($w)) + }); + + return true; + }, + + bottom : function () { + return /bottom/i.test(this.settings.tipSettings.tipLocation); + }, + + top : function () { + return /top/i.test(this.settings.tipSettings.tipLocation); + }, + + right : function () { + return /right/i.test(this.settings.tipSettings.tipLocation); + }, + + left : function () { + return /left/i.test(this.settings.tipSettings.tipLocation); + }, + + corners : function (el) { + var w = $(window), + window_half = w.height() / 2, + //using this to calculate since scroll may not have finished yet. + tipOffset = Math.ceil(this.settings.$target.offset().top - window_half + this.settings.$next_tip.outerHeight()), + right = w.width() + this.scrollLeft(w), + offsetBottom = w.height() + tipOffset, + bottom = w.height() + w.scrollTop(), + top = w.scrollTop(); + + if (tipOffset < top) { + if (tipOffset < 0) { + top = 0; + } else { + top = tipOffset; + } + } + + if (offsetBottom > bottom) { + bottom = offsetBottom; + } + + return [ + el.offset().top < top, + right < el.offset().left + el.outerWidth(), + bottom < el.offset().top + el.outerHeight(), + this.scrollLeft(w) > el.offset().left + ]; + }, + + visible : function (hidden_corners) { + var i = hidden_corners.length; + + while (i--) { + if (hidden_corners[i]) return false; + } + + return true; + }, + + nub_position : function (nub, pos, def) { + if (pos === 'auto') { + nub.addClass(def); + } else { + nub.addClass(pos); + } + }, + + startTimer : function () { + if (this.settings.$li.length) { + this.settings.automate = setTimeout(function () { + this.hide(); + this.show(); + this.startTimer(); + }.bind(this), this.settings.timer); + } else { + clearTimeout(this.settings.automate); + } + }, + + end : function () { + if (this.settings.cookieMonster) { + $.cookie(this.settings.cookieName, 'ridden', { expires: this.settings.cookieExpires, domain: this.settings.cookieDomain }); + } + + if (this.settings.timer > 0) { + clearTimeout(this.settings.automate); + } + + if (this.settings.modal && this.settings.expose) { + this.un_expose(); + } + + this.settings.$next_tip.data('closed', true); + + $('.joyride-modal-bg').hide(); + this.settings.$current_tip.hide(); + this.settings.postStepCallback(this.settings.$li.index(), this.settings.$current_tip); + this.settings.postRideCallback(this.settings.$li.index(), this.settings.$current_tip); + $('.joyride-tip-guide').remove(); + }, + + outerHTML : function (el) { + // support FireFox < 11 + return el.outerHTML || new XMLSerializer().serializeToString(el); + }, + + off : function () { + $(this.scope).off('.joyride'); + $(window).off('.joyride'); + $('.joyride-close-tip, .joyride-next-tip, .joyride-modal-bg').off('.joyride'); + $('.joyride-tip-guide, .joyride-modal-bg').remove(); + clearTimeout(this.settings.automate); + this.settings = {}; + } + }; +}(Foundation.zj, this, this.document)); diff --git a/demo/hakuintodo/javascripts/foundation/foundation.js b/demo/hakuintodo/javascripts/foundation/foundation.js new file mode 100644 index 0000000..4a22157 --- /dev/null +++ b/demo/hakuintodo/javascripts/foundation/foundation.js @@ -0,0 +1,401 @@ +/* + * Foundation Responsive Library + * http://foundation.zurb.com + * Copyright 2013, ZURB + * Free to use under the MIT license. + * http://www.opensource.org/licenses/mit-license.php +*/ + +/*jslint unparam: true, browser: true, indent: 2 */ + +// Accommodate running jQuery or Zepto in noConflict() mode by +// using an anonymous function to redefine the $ shorthand name. +// See http://docs.jquery.com/Using_jQuery_with_Other_Libraries +// and http://zeptojs.com/ +var libFuncName = null; + +if (typeof jQuery === "undefined" && + typeof Zepto === "undefined" && + typeof $ === "function") { + libFuncName = $; +} else if (typeof jQuery === "function") { + libFuncName = jQuery; +} else if (typeof Zepto === "function") { + libFuncName = Zepto; +} else { + throw new TypeError(); +} + +(function ($, window, document, undefined) { + 'use strict'; + + // add dusty browser stuff + if (!Array.prototype.filter) { + Array.prototype.filter = function(fun /*, thisp */) { + "use strict"; + + if (this == null) { + throw new TypeError(); + } + + var t = Object(this), + len = t.length >>> 0; + if (typeof fun != "function") { + return; + } + + var res = [], + thisp = arguments[1]; + for (var i = 0; i < len; i++) { + if (i in t) { + var val = t[i]; // in case fun mutates this + if (fun && fun.call(thisp, val, i, t)) { + res.push(val); + } + } + } + + return res; + } + } + + if (!Function.prototype.bind) { + Function.prototype.bind = function (oThis) { + if (typeof this !== "function") { + // closest thing possible to the ECMAScript 5 internal IsCallable function + throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable"); + } + + var aArgs = Array.prototype.slice.call(arguments, 1), + fToBind = this, + fNOP = function () {}, + fBound = function () { + return fToBind.apply(this instanceof fNOP && oThis + ? this + : oThis, + aArgs.concat(Array.prototype.slice.call(arguments))); + }; + + fNOP.prototype = this.prototype; + fBound.prototype = new fNOP(); + + return fBound; + }; + } + + if (!Array.prototype.indexOf) { + Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) { + "use strict"; + if (this == null) { + throw new TypeError(); + } + var t = Object(this); + var len = t.length >>> 0; + if (len === 0) { + return -1; + } + var n = 0; + if (arguments.length > 1) { + n = Number(arguments[1]); + if (n != n) { // shortcut for verifying if it's NaN + n = 0; + } else if (n != 0 && n != Infinity && n != -Infinity) { + n = (n > 0 || -1) * Math.floor(Math.abs(n)); + } + } + if (n >= len) { + return -1; + } + var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0); + for (; k < len; k++) { + if (k in t && t[k] === searchElement) { + return k; + } + } + return -1; + } + } + + // fake stop() for zepto. + $.fn.stop = $.fn.stop || function() { + return this; + }; + + window.Foundation = { + name : 'Foundation', + + version : '4.1.5', + + // global Foundation cache object + cache : {}, + + init : function (scope, libraries, method, options, response, /* internal */ nc) { + var library_arr, + args = [scope, method, options, response], + responses = [], + nc = nc || false; + + // disable library error catching, + // used for development only + if (nc) this.nc = nc; + + // check RTL + this.rtl = /rtl/i.test($('html').attr('dir')); + + // set foundation global scope + this.scope = scope || this.scope; + + if (libraries && typeof libraries === 'string') { + if (/off/i.test(libraries)) return this.off(); + + library_arr = libraries.split(' '); + + if (library_arr.length > 0) { + for (var i = library_arr.length - 1; i >= 0; i--) { + responses.push(this.init_lib(library_arr[i], args)); + } + } + } else { + for (var lib in this.libs) { + responses.push(this.init_lib(lib, args)); + } + } + + // if first argument is callback, add to args + if (typeof libraries === 'function') { + args.unshift(libraries); + } + + return this.response_obj(responses, args); + }, + + response_obj : function (response_arr, args) { + for (var i = 0, len = args.length; i < len; i++) { + if (typeof args[i] === 'function') { + return args[i]({ + errors: response_arr.filter(function (s) { + if (typeof s === 'string') return s; + }) + }); + } + } + + return response_arr; + }, + + init_lib : function (lib, args) { + return this.trap(function () { + if (this.libs.hasOwnProperty(lib)) { + this.patch(this.libs[lib]); + return this.libs[lib].init.apply(this.libs[lib], args); + } + }.bind(this), lib); + }, + + trap : function (fun, lib) { + if (!this.nc) { + try { + return fun(); + } catch (e) { + return this.error({name: lib, message: 'could not be initialized', more: e.name + ' ' + e.message}); + } + } + + return fun(); + }, + + patch : function (lib) { + this.fix_outer(lib); + lib.scope = this.scope; + lib.rtl = this.rtl; + }, + + inherit : function (scope, methods) { + var methods_arr = methods.split(' '); + + for (var i = methods_arr.length - 1; i >= 0; i--) { + if (this.lib_methods.hasOwnProperty(methods_arr[i])) { + this.libs[scope.name][methods_arr[i]] = this.lib_methods[methods_arr[i]]; + } + } + }, + + random_str : function (length) { + var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz'.split(''); + + if (!length) { + length = Math.floor(Math.random() * chars.length); + } + + var str = ''; + for (var i = 0; i < length; i++) { + str += chars[Math.floor(Math.random() * chars.length)]; + } + return str; + }, + + libs : {}, + + // methods that can be inherited in libraries + lib_methods : { + set_data : function (node, data) { + // this.name references the name of the library calling this method + var id = [this.name,+new Date(),Foundation.random_str(5)].join('-'); + + Foundation.cache[id] = data; + node.attr('data-' + this.name + '-id', id); + return data; + }, + + get_data : function (node) { + return Foundation.cache[node.attr('data-' + this.name + '-id')]; + }, + + remove_data : function (node) { + if (node) { + delete Foundation.cache[node.attr('data-' + this.name + '-id')]; + node.attr('data-' + this.name + '-id', ''); + } else { + $('[data-' + this.name + '-id]').each(function () { + delete Foundation.cache[$(this).attr('data-' + this.name + '-id')]; + $(this).attr('data-' + this.name + '-id', ''); + }); + } + }, + + throttle : function(fun, delay) { + var timer = null; + return function () { + var context = this, args = arguments; + clearTimeout(timer); + timer = setTimeout(function () { + fun.apply(context, args); + }, delay); + }; + }, + + // parses data-options attribute on nodes and turns + // them into an object + data_options : function (el) { + var opts = {}, ii, p, + opts_arr = (el.attr('data-options') || ':').split(';'), + opts_len = opts_arr.length; + + function isNumber (o) { + return ! isNaN (o-0) && o !== null && o !== "" && o !== false && o !== true; + } + + function trim(str) { + if (typeof str === 'string') return $.trim(str); + return str; + } + + // parse options + for (ii = opts_len - 1; ii >= 0; ii--) { + p = opts_arr[ii].split(':'); + + if (/true/i.test(p[1])) p[1] = true; + if (/false/i.test(p[1])) p[1] = false; + if (isNumber(p[1])) p[1] = parseInt(p[1], 10); + + if (p.length === 2 && p[0].length > 0) { + opts[trim(p[0])] = trim(p[1]); + } + } + + return opts; + }, + + delay : function (fun, delay) { + return setTimeout(fun, delay); + }, + + // animated scrolling + scrollTo : function (el, to, duration) { + if (duration < 0) return; + var difference = to - $(window).scrollTop(); + var perTick = difference / duration * 10; + + this.scrollToTimerCache = setTimeout(function() { + if (!isNaN(parseInt(perTick, 10))) { + window.scrollTo(0, $(window).scrollTop() + perTick); + this.scrollTo(el, to, duration - 10); + } + }.bind(this), 10); + }, + + // not supported in core Zepto + scrollLeft : function (el) { + if (!el.length) return; + return ('scrollLeft' in el[0]) ? el[0].scrollLeft : el[0].pageXOffset; + }, + + // test for empty object or array + empty : function (obj) { + if (obj.length && obj.length > 0) return false; + if (obj.length && obj.length === 0) return true; + + for (var key in obj) { + if (hasOwnProperty.call(obj, key)) return false; + } + + return true; + } + }, + + fix_outer : function (lib) { + lib.outerHeight = function (el, bool) { + if (typeof Zepto === 'function') { + return el.height(); + } + + if (typeof bool !== 'undefined') { + return el.outerHeight(bool); + } + + return el.outerHeight(); + }; + + lib.outerWidth = function (el) { + if (typeof Zepto === 'function') { + return el.width(); + } + + if (typeof bool !== 'undefined') { + return el.outerWidth(bool); + } + + return el.outerWidth(); + }; + }, + + error : function (error) { + return error.name + ' ' + error.message + '; ' + error.more; + }, + + // remove all foundation events. + off: function () { + $(this.scope).off('.fndtn'); + $(window).off('.fndtn'); + return true; + }, + + zj : function () { + try { + return Zepto; + } catch (e) { + return jQuery; + } + }() + }; + + $.fn.foundation = function () { + var args = Array.prototype.slice.call(arguments, 0); + + return this.each(function () { + Foundation.init.apply(Foundation, [this].concat(args)); + return this; + }); + }; + +}(libFuncName, this, this.document)); diff --git a/demo/hakuintodo/javascripts/foundation/foundation.magellan.js b/demo/hakuintodo/javascripts/foundation/foundation.magellan.js new file mode 100644 index 0000000..60e2d09 --- /dev/null +++ b/demo/hakuintodo/javascripts/foundation/foundation.magellan.js @@ -0,0 +1,130 @@ +/*jslint unparam: true, browser: true, indent: 2 */ + +;(function ($, window, document, undefined) { + 'use strict'; + + Foundation.libs.magellan = { + name : 'magellan', + + version : '4.0.0', + + settings : { + activeClass: 'active' + }, + + init : function (scope, method, options) { + this.scope = scope || this.scope; + Foundation.inherit(this, 'data_options'); + + if (typeof method === 'object') { + $.extend(true, this.settings, method); + } + + if (typeof method != 'string') { + if (!this.settings.init) { + this.fixed_magellan = $("[data-magellan-expedition]"); + this.set_threshold(); + this.last_destination = $('[data-magellan-destination]').last(); + this.events(); + } + + return this.settings.init; + } else { + return this[method].call(this, options); + } + }, + + events : function () { + var self = this; + $(this.scope).on('arrival.fndtn.magellan', '[data-magellan-arrival]', function (e) { + var $destination = $(this), + $expedition = $destination.closest('[data-magellan-expedition]'), + activeClass = $expedition.attr('data-magellan-active-class') + || self.settings.activeClass; + + $destination + .closest('[data-magellan-expedition]') + .find('[data-magellan-arrival]') + .not($destination) + .removeClass(activeClass); + $destination.addClass(activeClass); + }); + + this.fixed_magellan + .on('update-position.fndtn.magellan', function(){ + var $el = $(this); + // $el.data("magellan-fixed-position",""); + //$el.data("magellan-top-offset", ""); + }) + .trigger('update-position'); + + $(window) + .on('resize.fndtn.magellan', function() { + this.fixed_magellan.trigger('update-position'); + }.bind(this)) + + .on('scroll.fndtn.magellan', function() { + var windowScrollTop = $(window).scrollTop(); + self.fixed_magellan.each(function() { + var $expedition = $(this); + if (typeof $expedition.data('magellan-top-offset') === 'undefined') { + $expedition.data('magellan-top-offset', $expedition.offset().top); + } + if (typeof $expedition.data('magellan-fixed-position') === 'undefined') { + $expedition.data('magellan-fixed-position', false) + } + var fixed_position = (windowScrollTop + self.settings.threshold) > $expedition.data("magellan-top-offset"); + var attr = $expedition.attr('data-magellan-top-offset'); + + if ($expedition.data("magellan-fixed-position") != fixed_position) { + $expedition.data("magellan-fixed-position", fixed_position); + if (fixed_position) { + $expedition.css({position:"fixed", top:0}); + } else { + $expedition.css({position:"", top:""}); + } + if (fixed_position && typeof attr != 'undefined' && attr != false) { + $expedition.css({position:"fixed", top:attr + "px"}); + } + } + }); + }); + + + if (this.last_destination.length > 0) { + $(window).on('scroll.fndtn.magellan', function (e) { + var windowScrollTop = $(window).scrollTop(), + scrolltopPlusHeight = windowScrollTop + $(window).height(), + lastDestinationTop = Math.ceil(self.last_destination.offset().top); + + $('[data-magellan-destination]').each(function () { + var $destination = $(this), + destination_name = $destination.attr('data-magellan-destination'), + topOffset = $destination.offset().top - windowScrollTop; + + if (topOffset <= self.settings.threshold) { + $("[data-magellan-arrival='" + destination_name + "']").trigger('arrival'); + } + // In large screens we may hit the bottom of the page and dont reach the top of the last magellan-destination, so lets force it + if (scrolltopPlusHeight >= $(self.scope).height() && lastDestinationTop > windowScrollTop && lastDestinationTop < scrolltopPlusHeight) { + $('[data-magellan-arrival]').last().trigger('arrival'); + } + }); + }); + } + + this.settings.init = true; + }, + + set_threshold : function () { + if (!this.settings.threshold) { + this.settings.threshold = (this.fixed_magellan.length > 0) ? + this.outerHeight(this.fixed_magellan, true) : 0; + } + }, + + off : function () { + $(this.scope).off('.fndtn.magellan'); + } + }; +}(Foundation.zj, this, this.document)); \ No newline at end of file diff --git a/demo/hakuintodo/javascripts/foundation/foundation.orbit.js b/demo/hakuintodo/javascripts/foundation/foundation.orbit.js new file mode 100644 index 0000000..8c805e3 --- /dev/null +++ b/demo/hakuintodo/javascripts/foundation/foundation.orbit.js @@ -0,0 +1,373 @@ +;(function ($, window, document, undefined) { + 'use strict'; + + Foundation.libs = Foundation.libs || {}; + + Foundation.libs.orbit = { + name: 'orbit', + + version: '4.1.0', + + settings: { + timer_speed: 10000, + animation_speed: 500, + bullets: true, + stack_on_small: true, + navigation_arrows: true, + slide_number: true, + container_class: 'orbit-container', + stack_on_small_class: 'orbit-stack-on-small', + next_class: 'orbit-next', + prev_class: 'orbit-prev', + timer_container_class: 'orbit-timer', + timer_paused_class: 'paused', + timer_progress_class: 'orbit-progress', + slides_container_class: 'orbit-slides-container', + bullets_container_class: 'orbit-bullets', + bullets_active_class: 'active', + slide_number_class: 'orbit-slide-number', + caption_class: 'orbit-caption', + active_slide_class: 'active', + orbit_transition_class: 'orbit-transitioning' + }, + + init: function (scope, method, options) { + var self = this; + Foundation.inherit(self, 'data_options'); + + if (typeof method === 'object') { + $.extend(true, self.settings, method); + } + + $('[data-orbit]', scope).each(function(idx, el) { + var scoped_self = $.extend(true, {}, self); + scoped_self._init(idx, el); + }); + }, + + _container_html: function() { + var self = this; + return '
    '; + }, + + _bullets_container_html: function($slides) { + var self = this, + $list = $('
      '); + $slides.each(function(idx, slide) { + var $item = $('
    1. '); + if (idx === 0) { + $item.addClass(self.settings.bullets_active_class); + } + $list.append($item); + }); + return $list; + }, + + _slide_number_html: function(slide_number, total_slides) { + var self = this, + $container = $('
      '); + $container.append('' + slide_number + ' of ' + total_slides + ''); + return $container; + }, + + _timer_html: function() { + var self = this; + if (typeof self.settings.timer_speed === 'number' && self.settings.timer_speed > 0) { + return '
      '; + } else { + return ''; + } + }, + + _next_html: function() { + var self = this; + return 'Next '; + }, + + _prev_html: function() { + var self = this; + return 'Prev '; + }, + + _init: function (idx, slider) { + var self = this, + $slides_container = $(slider), + $container = $slides_container.wrap(self._container_html()).parent(), + $slides = $slides_container.children(); + + $.extend(true, self.settings, self.data_options($slides_container)); + + if (self.settings.navigation_arrows) { + $container.append(self._prev_html()); + $container.append(self._next_html()); + } + $slides_container.addClass(self.settings.slides_container_class); + if (self.settings.stack_on_small) { + $container.addClass(self.settings.stack_on_small_class); + } + if (self.settings.slide_number) { + $container.append(self._slide_number_html(1, $slides.length)); + } + $container.append(self._timer_html()); + if (self.settings.bullets) { + $container.after(self._bullets_container_html($slides)); + } + // To better support the "sliding" effect it's easier + // if we just clone the first and last slides + $slides_container.append($slides.first().clone().attr('data-orbit-slide','')); + $slides_container.prepend($slides.last().clone().attr('data-orbit-slide','')); + // Make the first "real" slide active + $slides_container.css('marginLeft', '-100%'); + $slides.first().addClass(self.settings.active_slide_class); + + self._init_events($slides_container); + self._init_dimensions($slides_container); + self._start_timer($slides_container); + }, + + _init_events: function ($slides_container) { + var self = this, + $container = $slides_container.parent(); + + $(window) + .on('load.fndtn.orbit', function() { + $slides_container.height(''); + $slides_container.height($slides_container.height($container.height())); + $slides_container.trigger('orbit:ready'); + }) + .on('resize.fndtn.orbit', function() { + $slides_container.height(''); + $slides_container.height($slides_container.height($container.height())); + }); + + $(document).on('click.fndtn.orbit', '[data-orbit-link]', function(e) { + e.preventDefault(); + var id = $(e.currentTarget).attr('data-orbit-link'), + $slide = $slides_container.find('[data-orbit-slide=' + id + ']').first(); + + if ($slide.length === 1) { + self._reset_timer($slides_container, true); + self._goto($slides_container, $slide.index(), function() {}); + } + }); + + $container.siblings('.' + self.settings.bullets_container_class) + .on('click.fndtn.orbit', '[data-orbit-slide-number]', function(e) { + e.preventDefault(); + self._reset_timer($slides_container, true); + self._goto($slides_container, $(e.currentTarget).data('orbit-slide-number'),function() {}); + }); + + $container + .on('orbit:after-slide-change.fndtn.orbit', function(e, orbit) { + var $slide_number = $container.find('.' + self.settings.slide_number_class); + + if ($slide_number.length === 1) { + $slide_number.replaceWith(self._slide_number_html(orbit.slide_number, orbit.total_slides)); + } + }) + .on('orbit:next-slide.fndtn.orbit click.fndtn.orbit', '.' + self.settings.next_class, function(e) { + e.preventDefault(); + self._reset_timer($slides_container, true); + self._goto($slides_container, 'next', function() {}); + }) + .on('orbit:prev-slide.fndtn.orbit click.fndtn.orbit', '.' + self.settings.prev_class, function(e) { + e.preventDefault(); + self._reset_timer($slides_container, true); + self._goto($slides_container, 'prev', function() {}); + }) + .on('orbit:toggle-play-pause.fndtn.orbit click.fndtn.orbit touchstart.fndtn.orbit', '.' + self.settings.timer_container_class, function(e) { + e.preventDefault(); + var $timer = $(e.currentTarget).toggleClass(self.settings.timer_paused_class), + $slides_container = $timer.closest('.' + self.settings.container_class) + .find('.' + self.settings.slides_container_class); + + if ($timer.hasClass(self.settings.timer_paused_class)) { + self._stop_timer($slides_container); + } else { + self._start_timer($slides_container); + } + }) + .on('touchstart.fndtn.orbit', function(e) { + if (!e.touches) { e = e.originalEvent; } + var data = { + start_page_x: e.touches[0].pageX, + start_page_y: e.touches[0].pageY, + start_time: (new Date()).getTime(), + delta_x: 0, + is_scrolling: undefined + }; + $container.data('swipe-transition', data); + e.stopPropagation(); + }) + .on('touchmove.fndtn.orbit', function(e) { + if (!e.touches) { e = e.originalEvent; } + // Ignore pinch/zoom events + if(e.touches.length > 1 || e.scale && e.scale !== 1) return; + + var data = $container.data('swipe-transition'); + if (typeof data === 'undefined') { + data = {}; + } + + data.delta_x = e.touches[0].pageX - data.start_page_x; + + if ( typeof data.is_scrolling === 'undefined') { + data.is_scrolling = !!( data.is_scrolling || Math.abs(data.delta_x) < Math.abs(e.touches[0].pageY - data.start_page_y) ); + } + + if (!data.is_scrolling && !data.active) { + e.preventDefault(); + self._stop_timer($slides_container); + var direction = (data.delta_x < 0) ? 'next' : 'prev'; + data.active = true; + self._goto($slides_container, direction, function() {}); + } + }) + .on('touchend.fndtn.orbit', function(e) { + $container.data('swipe-transition', {}); + e.stopPropagation(); + }); + }, + + _init_dimensions: function ($slides_container) { + var $container = $slides_container.parent(), + $slides = $slides_container.children(); + + $slides_container.css('width', $slides.length * 100 + '%'); + $slides.css('width', 100 / $slides.length + '%'); + $slides_container.height($container.height()); + $slides_container.css('width', $slides.length * 100 + '%'); + }, + + _start_timer: function ($slides_container) { + var self = this, + $container = $slides_container.parent(); + + var callback = function() { + self._reset_timer($slides_container, false); + self._goto($slides_container, 'next', function() { + self._start_timer($slides_container); + }); + }; + + var $timer = $container.find('.' + self.settings.timer_container_class), + $progress = $timer.find('.' + self.settings.timer_progress_class), + progress_pct = ($progress.width() / $timer.width()), + delay = self.settings.timer_speed - (progress_pct * self.settings.timer_speed); + + $progress.animate({'width': '100%'}, delay, 'linear', callback); + $slides_container.trigger('orbit:timer-started'); + }, + + _stop_timer: function ($slides_container) { + var self = this, + $container = $slides_container.parent(), + $timer = $container.find('.' + self.settings.timer_container_class), + $progress = $timer.find('.' + self.settings.timer_progress_class), + progress_pct = $progress.width() / $timer.width(); + self._rebuild_timer($container, progress_pct * 100 + '%'); + // $progress.stop(); + $slides_container.trigger('orbit:timer-stopped'); + $timer = $container.find('.' + self.settings.timer_container_class); + $timer.addClass(self.settings.timer_paused_class); + }, + + _reset_timer: function($slides_container, is_paused) { + var self = this, + $container = $slides_container.parent(); + self._rebuild_timer($container, '0%'); + if (typeof is_paused === 'boolean' && is_paused) { + var $timer = $container.find('.' + self.settings.timer_container_class); + $timer.addClass(self.settings.timer_paused_class); + } + }, + + _rebuild_timer: function ($container, width_pct) { + // Zepto is unable to stop animations since they + // are css-based. This is a workaround for that + // limitation, which rebuilds the dom element + // thus stopping the animation + var self = this, + $timer = $container.find('.' + self.settings.timer_container_class), + $new_timer = $(self._timer_html()), + $new_timer_progress = $new_timer.find('.' + self.settings.timer_progress_class); + + if (typeof Zepto === 'function') { + $timer.remove(); + $container.append($new_timer); + $new_timer_progress.css('width', width_pct); + } else if (typeof jQuery === 'function') { + var $progress = $timer.find('.' + self.settings.timer_progress_class); + $progress.css('width', width_pct); + $progress.stop(); + } + }, + + _goto: function($slides_container, index_or_direction, callback) { + var self = this, + $container = $slides_container.parent(), + $slides = $slides_container.children(), + $active_slide = $slides_container.find('.' + self.settings.active_slide_class), + active_index = $active_slide.index(), + margin_position = Foundation.rtl ? 'marginRight' : 'marginLeft'; + + if ($container.hasClass(self.settings.orbit_transition_class)) { + return false; + } + + if (index_or_direction === 'prev') { + if (active_index === 0) { + active_index = $slides.length - 1; + } + else { + active_index--; + } + } + else if (index_or_direction === 'next') { + active_index = (active_index+1) % $slides.length; + } + else if (typeof index_or_direction === 'number') { + active_index = (index_or_direction % $slides.length); + } + if (active_index === ($slides.length - 1) && index_or_direction === 'next') { + $slides_container.css(margin_position, '0%'); + active_index = 1; + } + else if (active_index === 0 && index_or_direction === 'prev') { + $slides_container.css(margin_position, '-' + ($slides.length - 1) * 100 + '%'); + active_index = $slides.length - 2; + } + // Start transition, make next slide active + $container.addClass(self.settings.orbit_transition_class); + $active_slide.removeClass(self.settings.active_slide_class); + $($slides[active_index]).addClass(self.settings.active_slide_class); + // Make next bullet active + var $bullets = $container.siblings('.' + self.settings.bullets_container_class); + if ($bullets.length === 1) { + $bullets.children().removeClass(self.settings.bullets_active_class); + $($bullets.children()[active_index-1]).addClass(self.settings.bullets_active_class); + } + var new_margin_left = '-' + (active_index * 100) + '%'; + // Check to see if animation will occur, otherwise perform + // callbacks manually + $slides_container.trigger('orbit:before-slide-change'); + if ($slides_container.css(margin_position) === new_margin_left) { + $container.removeClass(self.settings.orbit_transition_class); + $slides_container.trigger('orbit:after-slide-change', [{slide_number: active_index, total_slides: $slides_container.children().length - 2}]); + callback(); + } else { + var properties = {}; + properties[margin_position] = new_margin_left; + + $slides_container.animate(properties, self.settings.animation_speed, 'linear', function() { + $container.removeClass(self.settings.orbit_transition_class); + $slides_container.trigger('orbit:after-slide-change', [{slide_number: active_index, total_slides: $slides_container.children().length - 2}]); + callback(); + }); + } + } + }; +}(Foundation.zj, this, this.document)); diff --git a/demo/hakuintodo/javascripts/foundation/foundation.placeholder.js b/demo/hakuintodo/javascripts/foundation/foundation.placeholder.js new file mode 100644 index 0000000..2de28a8 --- /dev/null +++ b/demo/hakuintodo/javascripts/foundation/foundation.placeholder.js @@ -0,0 +1,159 @@ +/*! http://mths.be/placeholder v2.0.7 by @mathias + Modified to work with Zepto.js by ZURB +*/ +;(function(window, document, $) { + + var isInputSupported = 'placeholder' in document.createElement('input'), + isTextareaSupported = 'placeholder' in document.createElement('textarea'), + prototype = $.fn, + valHooks = $.valHooks, + hooks, + placeholder; + + if (isInputSupported && isTextareaSupported) { + + placeholder = prototype.placeholder = function() { + return this; + }; + + placeholder.input = placeholder.textarea = true; + + } else { + + placeholder = prototype.placeholder = function() { + var $this = this; + $this + .filter((isInputSupported ? 'textarea' : ':input') + '[placeholder]') + .not('.placeholder') + .bind({ + 'focus.placeholder': clearPlaceholder, + 'blur.placeholder': setPlaceholder + }) + .data('placeholder-enabled', true) + .trigger('blur.placeholder'); + return $this; + }; + + placeholder.input = isInputSupported; + placeholder.textarea = isTextareaSupported; + + hooks = { + 'get': function(element) { + var $element = $(element); + return $element.data('placeholder-enabled') && $element.hasClass('placeholder') ? '' : element.value; + }, + 'set': function(element, value) { + var $element = $(element); + if (!$element.data('placeholder-enabled')) { + return element.value = value; + } + if (value == '') { + element.value = value; + // Issue #56: Setting the placeholder causes problems if the element continues to have focus. + if (element != document.activeElement) { + // We can't use `triggerHandler` here because of dummy text/password inputs :( + setPlaceholder.call(element); + } + } else if ($element.hasClass('placeholder')) { + clearPlaceholder.call(element, true, value) || (element.value = value); + } else { + element.value = value; + } + // `set` can not return `undefined`; see http://jsapi.info/jquery/1.7.1/val#L2363 + return $element; + } + }; + + isInputSupported || (valHooks.input = hooks); + isTextareaSupported || (valHooks.textarea = hooks); + + $(function() { + // Look for forms + $(document).delegate('form', 'submit.placeholder', function() { + // Clear the placeholder values so they don't get submitted + var $inputs = $('.placeholder', this).each(clearPlaceholder); + setTimeout(function() { + $inputs.each(setPlaceholder); + }, 10); + }); + }); + + // Clear placeholder values upon page reload + $(window).bind('beforeunload.placeholder', function() { + $('.placeholder').each(function() { + this.value = ''; + }); + }); + + } + + function args(elem) { + // Return an object of element attributes + var newAttrs = {}, + rinlinejQuery = /^jQuery\d+$/; + $.each(elem.attributes, function(i, attr) { + if (attr.specified && !rinlinejQuery.test(attr.name)) { + newAttrs[attr.name] = attr.value; + } + }); + return newAttrs; + } + + function clearPlaceholder(event, value) { + var input = this, + $input = $(input); + if (input.value == $input.attr('placeholder') && $input.hasClass('placeholder')) { + if ($input.data('placeholder-password')) { + $input = $input.hide().next().show().attr('id', $input.removeAttr('id').data('placeholder-id')); + // If `clearPlaceholder` was called from `$.valHooks.input.set` + if (event === true) { + return $input[0].value = value; + } + $input.focus(); + } else { + input.value = ''; + $input.removeClass('placeholder'); + input == document.activeElement && input.select(); + } + } + } + + function setPlaceholder() { + var $replacement, + input = this, + $input = $(input), + $origInput = $input, + id = this.id; + if (input.value == '') { + if (input.type == 'password') { + if (!$input.data('placeholder-textinput')) { + try { + $replacement = $input.clone().attr({ 'type': 'text' }); + } catch(e) { + $replacement = $('').attr($.extend(args(this), { 'type': 'text' })); + } + $replacement + .removeAttr('name') + .data({ + 'placeholder-password': true, + 'placeholder-id': id + }) + .bind('focus.placeholder', clearPlaceholder); + $input + .data({ + 'placeholder-textinput': $replacement, + 'placeholder-id': id + }) + .before($replacement); + } + $input = $input.removeAttr('id').hide().prev().attr('id', id).show(); + // Note: `$input[0] != input` now! + } + $input.addClass('placeholder'); + $input[0].value = $input.attr('placeholder'); + } else { + $input.removeClass('placeholder'); + } + } + +}(this, document, Foundation.zj)); \ No newline at end of file diff --git a/demo/hakuintodo/javascripts/foundation/foundation.reveal.js b/demo/hakuintodo/javascripts/foundation/foundation.reveal.js new file mode 100644 index 0000000..56f7d28 --- /dev/null +++ b/demo/hakuintodo/javascripts/foundation/foundation.reveal.js @@ -0,0 +1,277 @@ +/*jslint unparam: true, browser: true, indent: 2 */ + +;(function ($, window, document, undefined) { + 'use strict'; + + Foundation.libs.reveal = { + name: 'reveal', + + version : '4.1.3', + + locked : false, + + settings : { + animation: 'fadeAndPop', + animationSpeed: 250, + closeOnBackgroundClick: true, + dismissModalClass: 'close-reveal-modal', + bgClass: 'reveal-modal-bg', + open: function(){}, + opened: function(){}, + close: function(){}, + closed: function(){}, + bg : $('.reveal-modal-bg'), + css : { + open : { + 'opacity': 0, + 'visibility': 'visible', + 'display' : 'block' + }, + close : { + 'opacity': 1, + 'visibility': 'hidden', + 'display': 'none' + } + } + }, + + init : function (scope, method, options) { + this.scope = scope || this.scope; + Foundation.inherit(this, 'data_options delay'); + + if (typeof method === 'object') { + $.extend(true, this.settings, method); + } else if (typeof options !== 'undefined') { + $.extend(true, this.settings, options); + } + + if (typeof method != 'string') { + this.events(); + + return this.settings.init; + } else { + return this[method].call(this, options); + } + }, + + events : function () { + var self = this; + + $(this.scope) + .off('.fndtn.reveal') + .on('click.fndtn.reveal', '[data-reveal-id]', function (e) { + e.preventDefault(); + if (!self.locked) { + self.locked = true; + self.open.call(self, $(this)); + } + }) + .on('click.fndtn.reveal touchend.click.fndtn.reveal', this.close_targets(), function (e) { + e.preventDefault(); + if (!self.locked) { + var settings = $.extend({}, self.settings, self.data_options($('.reveal-modal.open'))); + if ($(e.target)[0] === $('.' + settings.bgClass)[0] && !settings.closeOnBackgroundClick) { + return; + } + + self.locked = true; + self.close.call(self, $(this).closest('.reveal-modal')); + } + }) + .on('open.fndtn.reveal', '.reveal-modal', this.settings.open) + .on('opened.fndtn.reveal', '.reveal-modal', this.settings.opened) + .on('opened.fndtn.reveal', '.reveal-modal', this.open_video) + .on('close.fndtn.reveal', '.reveal-modal', this.settings.close) + .on('closed.fndtn.reveal', '.reveal-modal', this.settings.closed) + .on('closed.fndtn.reveal', '.reveal-modal', this.close_video); + + return true; + }, + + open : function (target) { + if (target) { + var modal = $('#' + target.data('reveal-id')); + } else { + var modal = $(this.scope); + } + + if (!modal.hasClass('open')) { + var open_modal = $('.reveal-modal.open'); + + if (typeof modal.data('css-top') === 'undefined') { + modal.data('css-top', parseInt(modal.css('top'), 10)) + .data('offset', this.cache_offset(modal)); + } + + modal.trigger('open'); + + if (open_modal.length < 1) { + this.toggle_bg(modal); + } + this.hide(open_modal, this.settings.css.close); + this.show(modal, this.settings.css.open); + } + }, + + close : function (modal) { + + var modal = modal || $(this.scope), + open_modals = $('.reveal-modal.open'); + + if (open_modals.length > 0) { + this.locked = true; + modal.trigger('close'); + this.toggle_bg(modal); + this.hide(open_modals, this.settings.css.close); + } + }, + + close_targets : function () { + var base = '.' + this.settings.dismissModalClass; + + if (this.settings.closeOnBackgroundClick) { + return base + ', .' + this.settings.bgClass; + } + + return base; + }, + + toggle_bg : function (modal) { + if ($('.reveal-modal-bg').length === 0) { + this.settings.bg = $('
      ', {'class': this.settings.bgClass}) + .appendTo('body'); + } + + if (this.settings.bg.filter(':visible').length > 0) { + this.hide(this.settings.bg); + } else { + this.show(this.settings.bg); + } + }, + + show : function (el, css) { + // is modal + if (css) { + if (/pop/i.test(this.settings.animation)) { + css.top = $(window).scrollTop() - el.data('offset') + 'px'; + var end_css = { + top: $(window).scrollTop() + el.data('css-top') + 'px', + opacity: 1 + }; + + return this.delay(function () { + return el + .css(css) + .animate(end_css, this.settings.animationSpeed, 'linear', function () { + this.locked = false; + el.trigger('opened'); + }.bind(this)) + .addClass('open'); + }.bind(this), this.settings.animationSpeed / 2); + } + + if (/fade/i.test(this.settings.animation)) { + var end_css = {opacity: 1}; + + return this.delay(function () { + return el + .css(css) + .animate(end_css, this.settings.animationSpeed, 'linear', function () { + this.locked = false; + el.trigger('opened'); + }.bind(this)) + .addClass('open'); + }.bind(this), this.settings.animationSpeed / 2); + } + + return el.css(css).show().css({opacity: 1}).addClass('open').trigger('opened'); + } + + // should we animate the background? + if (/fade/i.test(this.settings.animation)) { + return el.fadeIn(this.settings.animationSpeed / 2); + } + + return el.show(); + }, + + hide : function (el, css) { + // is modal + if (css) { + if (/pop/i.test(this.settings.animation)) { + var end_css = { + top: - $(window).scrollTop() - el.data('offset') + 'px', + opacity: 0 + }; + + return this.delay(function () { + return el + .animate(end_css, this.settings.animationSpeed, 'linear', function () { + this.locked = false; + el.css(css).trigger('closed'); + }.bind(this)) + .removeClass('open'); + }.bind(this), this.settings.animationSpeed / 2); + } + + if (/fade/i.test(this.settings.animation)) { + var end_css = {opacity: 0}; + + return this.delay(function () { + return el + .animate(end_css, this.settings.animationSpeed, 'linear', function () { + this.locked = false; + el.css(css).trigger('closed'); + }.bind(this)) + .removeClass('open'); + }.bind(this), this.settings.animationSpeed / 2); + } + + return el.hide().css(css).removeClass('open').trigger('closed'); + } + + // should we animate the background? + if (/fade/i.test(this.settings.animation)) { + return el.fadeOut(this.settings.animationSpeed / 2); + } + + return el.hide(); + }, + + close_video : function (e) { + var video = $(this).find('.flex-video'), + iframe = video.find('iframe'); + + if (iframe.length > 0) { + iframe.attr('data-src', iframe[0].src); + iframe.attr('src', 'about:blank'); + video.fadeOut(100).hide(); + } + }, + + open_video : function (e) { + var video = $(this).find('.flex-video'), + iframe = video.find('iframe'); + + if (iframe.length > 0) { + var data_src = iframe.attr('data-src'); + if (typeof data_src === 'string') { + iframe[0].src = iframe.attr('data-src'); + } + video.show().fadeIn(100); + } + }, + + cache_offset : function (modal) { + var offset = modal.show().height() + parseInt(modal.css('top'), 10); + + modal.hide(); + + return offset; + }, + + off : function () { + $(this.scope).off('.fndtn.reveal'); + } + }; +}(Foundation.zj, this, this.document)); \ No newline at end of file diff --git a/demo/hakuintodo/javascripts/foundation/foundation.section.js b/demo/hakuintodo/javascripts/foundation/foundation.section.js new file mode 100644 index 0000000..49baa30 --- /dev/null +++ b/demo/hakuintodo/javascripts/foundation/foundation.section.js @@ -0,0 +1,407 @@ +/*jslint unparam: true, browser: true, indent: 2 */ + +;(function ($, window, document, undefined) { + 'use strict'; + + Foundation.libs.section = { + name: 'section', + + version : '4.1.3', + + settings : { + deep_linking: false, + one_up: true, + section_selector : '[data-section]', + region_selector : 'section, .section, [data-section-region]', + title_selector : '.title, [data-section-title]', + active_region_selector : 'section.active, .section.active, .active[data-section-region]', + content_selector : '.content, [data-section-content]', + nav_selector : '[data-section="vertical-nav"], [data-section="horizontal-nav"]', + callback: function (){} + }, + + init : function (scope, method, options) { + var self = this; + Foundation.inherit(this, 'throttle data_options position_right offset_right'); + + if (typeof method === 'object') { + $.extend(true, self.settings, method); + } + + if (typeof method != 'string') { + this.set_active_from_hash(); + this.events(); + + return true; + } else { + return this[method].call(this, options); + } + }, + + events : function () { + var self = this; + + $(this.scope) + .on('click.fndtn.section', '[data-section] .title, [data-section] [data-section-title]', function (e) { + var $this = $(this), + section = $this.closest(self.settings.section_selector); + + self.toggle_active.call(this, e, self); + self.reflow(); + }); + + $(window) + .on('resize.fndtn.section', self.throttle(function () { + self.resize.call(this); + }, 30)) + .on('hashchange', function () { + if (!self.settings.toggled){ + self.set_active_from_hash(); + $(this).trigger('resize'); + } + }).trigger('resize'); + + $(document) + .on('click.fndtn.section', function (e) { + if ($(e.target).closest(self.settings.title_selector).length < 1) { + $(self.settings.nav_selector) + .children(self.settings.region_selector) + .removeClass('active') + .attr('style', ''); + } + }); + + }, + + toggle_active : function (e, self) { + var $this = $(this), + self = Foundation.libs.section, + region = $this.closest(self.settings.region_selector), + content = $this.siblings(self.settings.content_selector), + parent = region.parent(), + settings = $.extend({}, self.settings, self.data_options(parent)), + prev_active_section = parent + .children(self.settings.active_region_selector); + + self.settings.toggled = true; + + if (!settings.deep_linking && content.length > 0) { + e.preventDefault(); + } + + if (region.hasClass('active')) { + // this is causing the style flash. + if (self.small(parent) + || self.is_vertical_nav(parent) + || self.is_horizontal_nav(parent) + || self.is_accordion(parent)) { + if (prev_active_section[0] !== region[0] + || (prev_active_section[0] === region[0] && !settings.one_up)) { + region + .removeClass('active') + .attr('style', ''); + } + } + } else { + var prev_active_section = parent + .children(self.settings.active_region_selector), + title_height = self.outerHeight(region + .children(self.settings.title_selector)); + + if (self.small(parent) || settings.one_up) { + + if (self.small(parent)) { + prev_active_section.attr('style', ''); + } else { + prev_active_section.attr('style', + 'visibility: hidden; padding-top: '+title_height+'px;'); + } + } + + if (self.small(parent)) { + region.attr('style', ''); + } else { + region.css('padding-top', title_height); + } + + region.addClass('active'); + + if (prev_active_section.length > 0) { + prev_active_section + .removeClass('active') + .attr('style', ''); + } + + // Toggle the content display attribute. This is done to + // ensure accurate outerWidth measurements that account for + // the scrollbar. + if (self.is_vertical_tabs(parent)) { + content.css('display', 'block'); + + if (prev_active_section !== null) { + prev_active_section + .children(self.settings.content_selector) + .css('display', 'none'); + } + } + } + + setTimeout(function () { + self.settings.toggled = false; + }, 300); + + settings.callback(); + }, + + resize : function () { + var self = Foundation.libs.section, + sections = $(self.settings.section_selector); + + sections.each(function() { + var $this = $(this), + active_section = $this + .children(self.settings.active_region_selector), + settings = $.extend({}, self.settings, self.data_options($this)); + + if (active_section.length > 1) { + active_section + .not(':first') + .removeClass('active') + .attr('style', ''); + } else if (active_section.length < 1 + && !self.is_vertical_nav($this) + && !self.is_horizontal_nav($this) + && !self.is_accordion($this)) { + + var first = $this.children(self.settings.region_selector).first(); + + if (settings.one_up || !self.small($this)) { + first.addClass('active'); + } + + if (self.small($this)) { + first.attr('style', ''); + } else { + first.css('padding-top', self.outerHeight(first + .children(self.settings.title_selector))); + } + } + + if (self.small($this)) { + active_section.attr('style', ''); + } else { + active_section.css('padding-top', self.outerHeight(active_section + .children(self.settings.title_selector))); + } + + self.position_titles($this); + + if ( (self.is_horizontal_nav($this) && !self.small($this)) + || self.is_vertical_tabs($this)) { + self.position_content($this); + } else { + self.position_content($this, false); + } + }); + }, + + is_vertical_nav : function (el) { + return /vertical-nav/i.test(el.data('section')); + }, + + is_horizontal_nav : function (el) { + return /horizontal-nav/i.test(el.data('section')); + }, + + is_accordion : function (el) { + return /accordion/i.test(el.data('section')); + }, + + is_horizontal_tabs : function (el) { + return /^tabs$/i.test(el.data('section')); + }, + + is_vertical_tabs : function (el) { + return /vertical-tabs/i.test(el.data('section')); + }, + + set_active_from_hash : function () { + var hash = window.location.hash.substring(1), + sections = $('[data-section]'), + self = this; + + sections.each(function () { + var section = $(this), + settings = $.extend({}, self.settings, self.data_options(section)); + + if (hash.length > 0 && settings.deep_linking) { + var regions = section + .children(self.settings.region_selector) + .attr('style', '') + .removeClass('active'); + regions + .map(function () { + return $(this).children('.content[data-slug="' + hash + '"], [data-section-content][data-slug="' + hash + '"]'); + }) + .parent() + .addClass('active'); + } + }); + }, + + position_titles : function (section, off) { + var self = this, + titles = section + .children(this.settings.region_selector) + .map(function () { + return $(this).children(self.settings.title_selector); + }), + previous_width = 0, + previous_height = 0, + self = this; + + if (typeof off === 'boolean') { + titles.attr('style', ''); + + } else { + titles.each(function () { + if (self.is_vertical_tabs(section)) { + $(this).css('top', previous_height); + previous_height += self.outerHeight($(this)); + } else { + if (!self.rtl) { + $(this).css('left', previous_width); + } else { + $(this).css('right', previous_width); + } + previous_width += self.outerWidth($(this)); + } + }); + } + }, + + position_content : function (section, off) { + var self = this, + regions = section.children(self.settings.region_selector), + titles = regions + .map(function () { + return $(this).children(self.settings.title_selector); + }), + content = regions + .map(function () { + return $(this).children(self.settings.content_selector); + }); + + if (typeof off === 'boolean') { + content.attr('style', ''); + section.attr('style', ''); + } else { + if (self.is_vertical_tabs(section) + && !self.small(section)) { + var content_min_height = 0, + content_min_width = Number.MAX_VALUE, + title_width = null; + + regions.each(function () { + var region = $(this), + title = region.children(self.settings.title_selector), + content = region.children(self.settings.content_selector), + content_width = 0; + + title_width = self.outerWidth(title); + content_width = self.outerWidth(section) - title_width; + if (content_width < content_min_width) { + content_min_width = content_width; + } + + // Increment the minimum height of the content region + // to align with the height of the titles. + content_min_height += self.outerHeight(title); + + // Set all of the inactive tabs to 'display: none' + // The CSS sets all of the tabs as 'display: block' + // in order to account for scrollbars when measuring the width + // of the content regions. + if (!$(this).hasClass('active')) { + content.css('display', 'none'); + } + }); + + regions.each(function () { + var content = $(this).children(self.settings.content_selector); + content.css('minHeight', content_min_height); + + // Remove 2 pixels to account for the right-shift in the CSS + content.css('maxWidth', content_min_width - 2); + }); + + // Adjust the outer section container width to match + // the width of the title and content + section.css('maxWidth', title_width + content_min_width); + } else { + regions.each(function () { + var region = $(this), + title = region.children(self.settings.title_selector), + content = region.children(self.settings.content_selector); + if (!self.rtl) { + content + .css({left: title.position().left - 1, + top: self.outerHeight(title) - 2}); + } else { + content + .css({right: self.position_right(title) + 1, + top: self.outerHeight(title) - 2}); + } + }); + + // temporary work around for Zepto outerheight calculation issues. + if (typeof Zepto === 'function') { + section.height(this.outerHeight(titles.first())); + } else { + section.height(this.outerHeight(titles.first()) - 2); + } + } + } + }, + + position_right : function (el) { + var self = this, + section = el.closest(this.settings.section_selector), + regions = section.children(this.settings.region_selector), + section_width = el.closest(this.settings.section_selector).width(), + offset = regions + .map(function () { + return $(this).children(self.settings.title_selector); + }).length; + return (section_width - el.position().left - el.width() * (el.index() + 1) - offset); + }, + + reflow : function (scope) { + var scope = scope || document; + $(this.settings.section_selector, scope).trigger('resize'); + }, + + small : function (el) { + var settings = $.extend({}, this.settings, this.data_options(el)); + if (this.is_horizontal_tabs(el)) { + return false; + } + if (el && this.is_accordion(el)) { + return true; + } + if ($('html').hasClass('lt-ie9')) { + return true; + } + if ($('html').hasClass('ie8compat')) { + return true; + } + return $(this.scope).width() < 768; + }, + + off : function () { + $(this.scope).off('.fndtn.section'); + $(window).off('.fndtn.section'); + $(document).off('.fndtn.section') + } + }; +}(Foundation.zj, this, this.document)); diff --git a/demo/hakuintodo/javascripts/foundation/foundation.tooltips.js b/demo/hakuintodo/javascripts/foundation/foundation.tooltips.js new file mode 100644 index 0000000..1db73c1 --- /dev/null +++ b/demo/hakuintodo/javascripts/foundation/foundation.tooltips.js @@ -0,0 +1,200 @@ +/*jslint unparam: true, browser: true, indent: 2 */ + +;(function ($, window, document, undefined) { + 'use strict'; + + Foundation.libs.tooltips = { + name: 'tooltips', + + version : '4.1.3', + + settings : { + selector : '.has-tip', + additionalInheritableClasses : [], + tooltipClass : '.tooltip', + appendTo: 'body', + tipTemplate : function (selector, content) { + return '' + content + ''; + } + }, + + cache : {}, + + init : function (scope, method, options) { + var self = this; + this.scope = scope || this.scope; + + if (typeof method === 'object') { + $.extend(true, this.settings, method); + } + + if (typeof method != 'string') { + if (Modernizr.touch) { + $(this.scope) + .on('click.fndtn.tooltip touchstart.fndtn.tooltip touchend.fndtn.tooltip', + '[data-tooltip]', function (e) { + e.preventDefault(); + $(self.settings.tooltipClass).hide(); + self.showOrCreateTip($(this)); + }) + .on('click.fndtn.tooltip touchstart.fndtn.tooltip touchend.fndtn.tooltip', + this.settings.tooltipClass, function (e) { + e.preventDefault(); + $(this).fadeOut(150); + }); + } else { + $(this.scope) + .on('mouseenter.fndtn.tooltip mouseleave.fndtn.tooltip', + '[data-tooltip]', function (e) { + var $this = $(this); + + if (e.type === 'mouseover' || e.type === 'mouseenter') { + self.showOrCreateTip($this); + } else if (e.type === 'mouseout' || e.type === 'mouseleave') { + self.hide($this); + } + }); + } + + // $(this.scope).data('fndtn-tooltips', true); + } else { + return this[method].call(this, options); + } + + }, + + showOrCreateTip : function ($target) { + var $tip = this.getTip($target); + + if ($tip && $tip.length > 0) { + return this.show($target); + } + + return this.create($target); + }, + + getTip : function ($target) { + var selector = this.selector($target), + tip = null; + + if (selector) { + tip = $('span[data-selector=' + selector + ']' + this.settings.tooltipClass); + } + + return (typeof tip === 'object') ? tip : false; + }, + + selector : function ($target) { + var id = $target.attr('id'), + dataSelector = $target.attr('data-tooltip') || $target.attr('data-selector'); + + if ((id && id.length < 1 || !id) && typeof dataSelector != 'string') { + dataSelector = 'tooltip' + Math.random().toString(36).substring(7); + $target.attr('data-selector', dataSelector); + } + + return (id && id.length > 0) ? id : dataSelector; + }, + + create : function ($target) { + var $tip = $(this.settings.tipTemplate(this.selector($target), $('
      ').html($target.attr('title')).html())), + classes = this.inheritable_classes($target); + + $tip.addClass(classes).appendTo(this.settings.appendTo); + if (Modernizr.touch) { + $tip.append('tap to close '); + } + $target.removeAttr('title').attr('title',''); + this.show($target); + }, + + reposition : function (target, tip, classes) { + var width, nub, nubHeight, nubWidth, column, objPos; + + tip.css('visibility', 'hidden').show(); + + width = target.data('width'); + nub = tip.children('.nub'); + nubHeight = this.outerHeight(nub); + nubWidth = this.outerHeight(nub); + + objPos = function (obj, top, right, bottom, left, width) { + return obj.css({ + 'top' : (top) ? top : 'auto', + 'bottom' : (bottom) ? bottom : 'auto', + 'left' : (left) ? left : 'auto', + 'right' : (right) ? right : 'auto', + 'width' : (width) ? width : 'auto' + }).end(); + }; + + objPos(tip, (target.offset().top + this.outerHeight(target) + 10), 'auto', 'auto', target.offset().left, width); + + if ($(window).width() < 767) { + objPos(tip, (target.offset().top + this.outerHeight(target) + 10), 'auto', 'auto', 12.5, $(this.scope).width()); + tip.addClass('tip-override'); + objPos(nub, -nubHeight, 'auto', 'auto', target.offset().left); + } else { + var left = target.offset().left; + if (Foundation.rtl) { + left = target.offset().left + target.offset().width - this.outerWidth(tip); + } + objPos(tip, (target.offset().top + this.outerHeight(target) + 10), 'auto', 'auto', left, width); + tip.removeClass('tip-override'); + if (classes && classes.indexOf('tip-top') > -1) { + objPos(tip, (target.offset().top - this.outerHeight(tip)), 'auto', 'auto', left, width) + .removeClass('tip-override'); + } else if (classes && classes.indexOf('tip-left') > -1) { + objPos(tip, (target.offset().top + (this.outerHeight(target) / 2) - nubHeight*2.5), 'auto', 'auto', (target.offset().left - this.outerWidth(tip) - nubHeight), width) + .removeClass('tip-override'); + } else if (classes && classes.indexOf('tip-right') > -1) { + objPos(tip, (target.offset().top + (this.outerHeight(target) / 2) - nubHeight*2.5), 'auto', 'auto', (target.offset().left + this.outerWidth(target) + nubHeight), width) + .removeClass('tip-override'); + } + } + + tip.css('visibility', 'visible').hide(); + }, + + inheritable_classes : function (target) { + var inheritables = ['tip-top', 'tip-left', 'tip-bottom', 'tip-right', 'noradius'].concat(this.settings.additionalInheritableClasses), + classes = target.attr('class'), + filtered = classes ? $.map(classes.split(' '), function (el, i) { + if ($.inArray(el, inheritables) !== -1) { + return el; + } + }).join(' ') : ''; + + return $.trim(filtered); + }, + + show : function ($target) { + var $tip = this.getTip($target); + + this.reposition($target, $tip, $target.attr('class')); + $tip.fadeIn(150); + }, + + hide : function ($target) { + var $tip = this.getTip($target); + + $tip.fadeOut(150); + }, + + // deprecate reload + reload : function () { + var $self = $(this); + + return ($self.data('fndtn-tooltips')) ? $self.foundationTooltips('destroy').foundationTooltips('init') : $self.foundationTooltips('init'); + }, + + off : function () { + $(this.scope).off('.fndtn.tooltip'); + $(this.settings.tooltipClass).each(function (i) { + $('[data-tooltip]').get(i).attr('title', $(this).text()); + }).remove(); + } + }; +}(Foundation.zj, this, this.document)); diff --git a/demo/hakuintodo/javascripts/foundation/foundation.topbar.js b/demo/hakuintodo/javascripts/foundation/foundation.topbar.js new file mode 100644 index 0000000..3b98cbc --- /dev/null +++ b/demo/hakuintodo/javascripts/foundation/foundation.topbar.js @@ -0,0 +1,245 @@ +/*jslint unparam: true, browser: true, indent: 2 */ + +;(function ($, window, document, undefined) { + 'use strict'; + + Foundation.libs.topbar = { + name : 'topbar', + + version : '4.1.2', + + settings : { + index : 0, + stickyClass : 'sticky', + custom_back_text: true, + back_text: 'Back', + init : false + }, + + init : function (section, method, options) { + var self = this; + + if (typeof method === 'object') { + $.extend(true, this.settings, method); + } + + if (typeof method != 'string') { + + $('.top-bar').each(function () { + self.settings.$w = $(window); + self.settings.$topbar = $(this); + self.settings.$section = self.settings.$topbar.find('section'); + self.settings.$titlebar = self.settings.$topbar.children('ul').first(); + + + self.settings.$topbar.data('index', 0); + + var breakpoint = $("
      ").insertAfter(self.settings.$topbar); + self.settings.breakPoint = breakpoint.width(); + breakpoint.remove(); + + self.assemble(); + + if (self.settings.$topbar.parent().hasClass('fixed')) { + $('body').css('padding-top', self.outerHeight(self.settings.$topbar)); + } + }); + + if (!self.settings.init) { + this.events(); + } + + return this.settings.init; + } else { + // fire method + return this[method].call(this, options); + } + }, + + events : function () { + var self = this; + var offst = this.outerHeight($('.top-bar')); + $(this.scope) + .on('click.fndtn.topbar', '.top-bar .toggle-topbar', function (e) { + var topbar = $(this).closest('.top-bar'), + section = topbar.find('section, .section'), + titlebar = topbar.children('ul').first(); + + if (!topbar.data('height')) self.largestUL(); + + e.preventDefault(); + + if (self.breakpoint()) { + topbar + .toggleClass('expanded') + .css('min-height', ''); + } + + if (!topbar.hasClass('expanded')) { + if (!self.rtl) { + section.css({left: '0%'}); + section.find('>.name').css({left: '100%'}); + } else { + section.css({right: '0%'}); + section.find('>.name').css({right: '100%'}); + } + section.find('li.moved').removeClass('moved'); + topbar.data('index', 0); + + if (topbar.hasClass('fixed')) { + topbar.parent().addClass('fixed'); + topbar.removeClass('fixed'); + $('body').css('padding-top',offst); + } + } else if (topbar.parent().hasClass('fixed')) { + topbar.parent().removeClass('fixed'); + topbar.addClass('fixed'); + $('body').css('padding-top','0'); + window.scrollTo(0,0); + } + }) + + .on('click.fndtn.topbar', '.top-bar .has-dropdown>a', function (e) { + var topbar = $(this).closest('.top-bar'), + section = topbar.find('section, .section'), + titlebar = topbar.children('ul').first(), + dropdownHeight = $(this).next('.dropdown').outerHeight(); + + if (Modernizr.touch || self.breakpoint()) { + e.preventDefault(); + } + + if (self.breakpoint()) { + var $this = $(this), + $selectedLi = $this.closest('li'); + + topbar.data('index', topbar.data('index') + 1); + $selectedLi.addClass('moved'); + if (!self.rtl) { + section.css({left: -(100 * topbar.data('index')) + '%'}); + section.find('>.name').css({left: 100 * topbar.data('index') + '%'}); + } else { + section.css({right: -(100 * topbar.data('index')) + '%'}); + section.find('>.name').css({right: 100 * topbar.data('index') + '%'}); + } + + $('.top-bar').css('min-height', dropdownHeight); + + $this.siblings('ul') + .height(topbar.data('height') + self.outerHeight(titlebar, true)); + topbar + .css('min-height', topbar.data('height') + self.outerHeight(titlebar, true) * 2) + } + }); + + $(window).on('resize.fndtn.topbar', function () { + if (!self.breakpoint()) { + $('.top-bar') + .css('min-height', '') + .removeClass('expanded'); + } + }.bind(this)); + + // Go up a level on Click + $(this.scope).on('click.fndtn', '.top-bar .has-dropdown .back', function (e) { + e.preventDefault(); + + var $this = $(this), + topbar = $this.closest('.top-bar'), + section = topbar.find('section, .section'), + $movedLi = $this.closest('li.moved'), + $previousLevelUl = $movedLi.parent(); + + topbar.data('index', topbar.data('index') - 1); + if (!self.rtl) { + section.css({left: -(100 * topbar.data('index')) + '%'}); + section.find('>.name').css({left: 100 * topbar.data('index') + '%'}); + } else { + section.css({right: -(100 * topbar.data('index')) + '%'}); + section.find('>.name').css({right: 100 * topbar.data('index') + '%'}); + } + + if (topbar.data('index') === 0) { + topbar.css('min-height', 0); + } + + setTimeout(function () { + $movedLi.removeClass('moved'); + }, 300); + }); + }, + + breakpoint : function () { + return $(window).width() <= this.settings.breakPoint || $('html').hasClass('lt-ie9'); + }, + + assemble : function () { + var self = this; + // Pull element out of the DOM for manipulation + this.settings.$section.detach(); + + this.settings.$section.find('.has-dropdown>a').each(function () { + var $link = $(this), + $dropdown = $link.siblings('.dropdown'), + $titleLi = $('
    2. '); + + // Copy link to subnav + if (self.settings.custom_back_text == true) { + $titleLi.find('h5>a').html('« ' + self.settings.back_text); + } else { + $titleLi.find('h5>a').html('« ' + $link.html()); + } + $dropdown.prepend($titleLi); + }); + + // Put element back in the DOM + this.settings.$section.appendTo(this.settings.$topbar); + + // check for sticky + this.sticky(); + }, + + largestUL : function () { + var uls = this.settings.$topbar.find('section ul ul'), + largest = uls.first(), + total = 0, + self = this; + + uls.each(function () { + if ($(this).children('li').length > largest.children('li').length) { + largest = $(this); + } + }); + + largest.children('li').each(function () { total += self.outerHeight($(this), true); }); + + this.settings.$topbar.data('height', total); + }, + + sticky : function () { + var klass = '.' + this.settings.stickyClass; + if ($(klass).length > 0) { + var distance = $(klass).length ? $(klass).offset().top: 0, + $window = $(window); + var offst = this.outerHeight($('.top-bar')); + + $window.scroll(function() { + if ($window.scrollTop() >= (distance)) { + $(klass).addClass("fixed"); + $('body').css('padding-top',offst); + } + + else if ($window.scrollTop() < distance) { + $(klass).removeClass("fixed"); + $('body').css('padding-top','0'); + } + }); + } + }, + + off : function () { + $(this.scope).off('.fndtn.topbar'); + $(window).off('.fndtn.topbar'); + } + }; +}(Foundation.zj, this, this.document)); diff --git a/demo/hakuintodo/javascripts/hakuin.py b/demo/hakuintodo/javascripts/hakuin.py new file mode 100644 index 0000000..e8261bb --- /dev/null +++ b/demo/hakuintodo/javascripts/hakuin.py @@ -0,0 +1,104 @@ +class Events(): + def __init__(self): + self.events = dict() + + def bind(self, event, callback): + var(evs, ev, lst) + evs = list() + evs.js_object = JS('event.split(" ")') + for ev in evs: + lst = self.events.get(ev, list()) + lst.append(callback) + self.events.set(ev, lst) + + def trigger(self, ev, args): + var(lst, cb, args) + print ev + lst = self.events.get(ev) + if lst: + for cb in lst: + if args: + cb(args) + else: + cb() + +e = Events() +_counter = 0 + + +class Model(): + def __init__(self): + self.id = "c-" + _counter + _counter = _counter + 1 + + def to_string(self): + return "<" + self.__class__.__name__ + "(" + self.id + ")>" + + def toJSON(self): + pass + + def change(self, callback): + if callback: + e.bind("change", callback) + else: + e.trigger("change") + + def fetch(self, callback): + if callback: + e.bind("fetch", callback) + else: + e.trigger("fetch") + + def destroy(self): + e.trigger("destroy", self) + + def updateAttribute(self, name, value): + setattr(self, name, value) + e.trigger("update") + + +class Collection(): + def __init__(self): + self.ids = dict() + self.models = list() + e.bind("destroy", self.remove_one) + + def add_one(self, model): + self.ids.set(model.id, model) + self.models.append(model) + e.trigger("add", model) + + def add(self, models): + self.add_one(models) + + def remove(self, models): + self.remove_one(models) + + def remove_one(self, model): + if model.__class__.__name__ == 'list': + model = model.pop() + new_ids = dict() + new_models = list() + ks = self.ids.keys() + for k in ks: + if k != model.id: + m = self.ids.get(k) + new_ids.set(k, m) + self.ids = new_ids + + for m in self.models: + if m.id != model.id: + new_models.append(m) + self.models = new_models + e.trigger("remove", model) + + +class Controller(): + def __init__(self, tag, el): + if el == None: + el = '
      ' + self.el = J(el) + + def release(self): + j = self.el.j + JS('j.remove()') diff --git a/demo/hakuintodo/javascripts/hakuin.py.js b/demo/hakuintodo/javascripts/hakuin.py.js new file mode 100644 index 0000000..c9b8c68 --- /dev/null +++ b/demo/hakuintodo/javascripts/hakuin.py.js @@ -0,0 +1,411 @@ +var Events, __Events_attrs, __Events_parents; +__Events_attrs = {}; +__Events_parents = create_array(); +var __Events___init__ = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var __args_0, __kwargs_0; +__args_0 = create_array(); +__kwargs_0 = {}; +set_attribute(self, "events", get_attribute(dict, "__call__")(__args_0, __kwargs_0)); +} + +__Events_attrs.__init__ = __Events___init__; +var __Events_bind = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "event", "callback")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var event = arguments['event']; +var callback = arguments['callback']; +var evs, ev, lst; +var __args_1, __kwargs_1; +__args_1 = create_array(); +__kwargs_1 = {}; +evs = get_attribute(list, "__call__")(__args_1, __kwargs_1); +set_attribute(evs, "js_object", event.split()); +var __iterator__, ev; +__iterator__ = get_attribute(get_attribute(evs, "__iter__"), "__call__")(create_array(), {}); +try { +ev = get_attribute(__iterator__, "next")(create_array(), {}); +while(true) { +var __args_2, __kwargs_2; +__args_2 = create_array(); +__kwargs_2 = {}; +var __args_3, __kwargs_3; +__args_3 = create_array(ev, get_attribute(list, "__call__")(__args_2, __kwargs_2)); +__kwargs_3 = {}; +lst = get_attribute(get_attribute(get_attribute(self, "events"), "get"), "__call__")(__args_3, __kwargs_3); +var __args_4, __kwargs_4; +__args_4 = create_array(callback); +__kwargs_4 = {}; +get_attribute(get_attribute(lst, "append"), "__call__")(__args_4, __kwargs_4); +var __args_5, __kwargs_5; +__args_5 = create_array(ev, lst); +__kwargs_5 = {}; +get_attribute(get_attribute(get_attribute(self, "events"), "set"), "__call__")(__args_5, __kwargs_5); +undefined; +undefined; +undefined; +ev = get_attribute(__iterator__, "next")(create_array(), {}); +} +} +catch(__exception__) { +if (__exception__ == StopIteration || isinstance([__exception__, StopIteration])) { + +} + +} + +} + +__Events_attrs.bind = __Events_bind; +var __Events_trigger = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "ev", "args")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var ev = arguments['ev']; +var args = arguments['args']; +var lst, cb, args; +console.log(ev); +var __args_6, __kwargs_6; +__args_6 = create_array(ev); +__kwargs_6 = {}; +lst = get_attribute(get_attribute(get_attribute(self, "events"), "get"), "__call__")(__args_6, __kwargs_6); +if(lst) { +var __iterator__, cb; +__iterator__ = get_attribute(get_attribute(lst, "__iter__"), "__call__")(create_array(), {}); +try { +cb = get_attribute(__iterator__, "next")(create_array(), {}); +while(true) { +if(args) { +var __args_7, __kwargs_7; +__args_7 = create_array(args); +__kwargs_7 = {}; +get_attribute(cb, "__call__")(__args_7, __kwargs_7); +} +else { +var __args_8, __kwargs_8; +__args_8 = create_array(); +__kwargs_8 = {}; +get_attribute(cb, "__call__")(__args_8, __kwargs_8); +} + +undefined; +cb = get_attribute(__iterator__, "next")(create_array(), {}); +} +} +catch(__exception__) { +if (__exception__ == StopIteration || isinstance([__exception__, StopIteration])) { + +} + +} + +} + +} + +__Events_attrs.trigger = __Events_trigger; +Events = create_class("Events", __Events_parents, __Events_attrs); +var __args_9, __kwargs_9; +__args_9 = create_array(); +__kwargs_9 = {}; +e = get_attribute(Events, "__call__")(__args_9, __kwargs_9); +_counter = 0; +var Model, __Model_attrs, __Model_parents; +__Model_attrs = {}; +__Model_parents = create_array(); +var __Model___init__ = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +set_attribute(self, "id", "c-" + _counter); +_counter = _counter + 1; +} + +__Model_attrs.__init__ = __Model___init__; +var __Model_to_string = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +return "<" + get_attribute(get_attribute(self, "__class__"), "__name__") + "(" + get_attribute(self, "id") + ")>"; +} + +__Model_attrs.to_string = __Model_to_string; +var __Model_toJSON = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; + +} + +__Model_attrs.toJSON = __Model_toJSON; +var __Model_change = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "callback")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var callback = arguments['callback']; +if(callback) { +var __args_10, __kwargs_10; +__args_10 = create_array("change", callback); +__kwargs_10 = {}; +get_attribute(get_attribute(e, "bind"), "__call__")(__args_10, __kwargs_10); +} +else { +var __args_11, __kwargs_11; +__args_11 = create_array("change"); +__kwargs_11 = {}; +get_attribute(get_attribute(e, "trigger"), "__call__")(__args_11, __kwargs_11); +} + +} + +__Model_attrs.change = __Model_change; +var __Model_fetch = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "callback")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var callback = arguments['callback']; +if(callback) { +var __args_12, __kwargs_12; +__args_12 = create_array("fetch", callback); +__kwargs_12 = {}; +get_attribute(get_attribute(e, "bind"), "__call__")(__args_12, __kwargs_12); +} +else { +var __args_13, __kwargs_13; +__args_13 = create_array("fetch"); +__kwargs_13 = {}; +get_attribute(get_attribute(e, "trigger"), "__call__")(__args_13, __kwargs_13); +} + +} + +__Model_attrs.fetch = __Model_fetch; +var __Model_destroy = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var __args_14, __kwargs_14; +__args_14 = create_array("destroy", self); +__kwargs_14 = {}; +get_attribute(get_attribute(e, "trigger"), "__call__")(__args_14, __kwargs_14); +} + +__Model_attrs.destroy = __Model_destroy; +var __Model_updateAttribute = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "name", "value")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var name = arguments['name']; +var value = arguments['value']; +var __args_15, __kwargs_15; +__args_15 = create_array(self, name, value); +__kwargs_15 = {}; +get_attribute(setattr, "__call__")(__args_15, __kwargs_15); +var __args_16, __kwargs_16; +__args_16 = create_array("update"); +__kwargs_16 = {}; +get_attribute(get_attribute(e, "trigger"), "__call__")(__args_16, __kwargs_16); +} + +__Model_attrs.updateAttribute = __Model_updateAttribute; +Model = create_class("Model", __Model_parents, __Model_attrs); +var Collection, __Collection_attrs, __Collection_parents; +__Collection_attrs = {}; +__Collection_parents = create_array(); +var __Collection___init__ = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var __args_17, __kwargs_17; +__args_17 = create_array(); +__kwargs_17 = {}; +set_attribute(self, "ids", get_attribute(dict, "__call__")(__args_17, __kwargs_17)); +var __args_18, __kwargs_18; +__args_18 = create_array(); +__kwargs_18 = {}; +set_attribute(self, "models", get_attribute(list, "__call__")(__args_18, __kwargs_18)); +var __args_19, __kwargs_19; +__args_19 = create_array("destroy", get_attribute(self, "remove_one")); +__kwargs_19 = {}; +get_attribute(get_attribute(e, "bind"), "__call__")(__args_19, __kwargs_19); +} + +__Collection_attrs.__init__ = __Collection___init__; +var __Collection_add_one = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "model")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var model = arguments['model']; +var __args_20, __kwargs_20; +__args_20 = create_array(get_attribute(model, "id"), model); +__kwargs_20 = {}; +get_attribute(get_attribute(get_attribute(self, "ids"), "set"), "__call__")(__args_20, __kwargs_20); +var __args_21, __kwargs_21; +__args_21 = create_array(model); +__kwargs_21 = {}; +get_attribute(get_attribute(get_attribute(self, "models"), "append"), "__call__")(__args_21, __kwargs_21); +var __args_22, __kwargs_22; +__args_22 = create_array("add", model); +__kwargs_22 = {}; +get_attribute(get_attribute(e, "trigger"), "__call__")(__args_22, __kwargs_22); +} + +__Collection_attrs.add_one = __Collection_add_one; +var __Collection_add = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "models")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var models = arguments['models']; +var __args_23, __kwargs_23; +__args_23 = create_array(models); +__kwargs_23 = {}; +get_attribute(get_attribute(self, "add_one"), "__call__")(__args_23, __kwargs_23); +} + +__Collection_attrs.add = __Collection_add; +var __Collection_remove = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "models")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var models = arguments['models']; +var __args_24, __kwargs_24; +__args_24 = create_array(models); +__kwargs_24 = {}; +get_attribute(get_attribute(self, "remove_one"), "__call__")(__args_24, __kwargs_24); +} + +__Collection_attrs.remove = __Collection_remove; +var __Collection_remove_one = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "model")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var model = arguments['model']; +if(get_attribute(get_attribute(model, "__class__"), "__name__") == "list") { +var __args_25, __kwargs_25; +__args_25 = create_array(); +__kwargs_25 = {}; +model = get_attribute(get_attribute(model, "pop"), "__call__")(__args_25, __kwargs_25); +} + +var __args_26, __kwargs_26; +__args_26 = create_array(); +__kwargs_26 = {}; +new_ids = get_attribute(dict, "__call__")(__args_26, __kwargs_26); +var __args_27, __kwargs_27; +__args_27 = create_array(); +__kwargs_27 = {}; +new_models = get_attribute(list, "__call__")(__args_27, __kwargs_27); +var __args_28, __kwargs_28; +__args_28 = create_array(); +__kwargs_28 = {}; +ks = get_attribute(get_attribute(get_attribute(self, "ids"), "keys"), "__call__")(__args_28, __kwargs_28); +var __iterator__, k; +__iterator__ = get_attribute(get_attribute(ks, "__iter__"), "__call__")(create_array(), {}); +try { +k = get_attribute(__iterator__, "next")(create_array(), {}); +while(true) { +if(k != get_attribute(model, "id")) { +var __args_29, __kwargs_29; +__args_29 = create_array(k); +__kwargs_29 = {}; +m = get_attribute(get_attribute(get_attribute(self, "ids"), "get"), "__call__")(__args_29, __kwargs_29); +var __args_30, __kwargs_30; +__args_30 = create_array(k, m); +__kwargs_30 = {}; +get_attribute(get_attribute(new_ids, "set"), "__call__")(__args_30, __kwargs_30); +} + +undefined; +k = get_attribute(__iterator__, "next")(create_array(), {}); +} +} +catch(__exception__) { +if (__exception__ == StopIteration || isinstance([__exception__, StopIteration])) { + +} + +} + +set_attribute(self, "ids", new_ids); +var __iterator__, m; +__iterator__ = get_attribute(get_attribute(get_attribute(self, "models"), "__iter__"), "__call__")(create_array(), {}); +try { +m = get_attribute(__iterator__, "next")(create_array(), {}); +while(true) { +if(get_attribute(m, "id") != get_attribute(model, "id")) { +var __args_31, __kwargs_31; +__args_31 = create_array(m); +__kwargs_31 = {}; +get_attribute(get_attribute(new_models, "append"), "__call__")(__args_31, __kwargs_31); +} + +undefined; +m = get_attribute(__iterator__, "next")(create_array(), {}); +} +} +catch(__exception__) { +if (__exception__ == StopIteration || isinstance([__exception__, StopIteration])) { + +} + +} + +set_attribute(self, "models", new_models); +var __args_32, __kwargs_32; +__args_32 = create_array("remove", model); +__kwargs_32 = {}; +get_attribute(get_attribute(e, "trigger"), "__call__")(__args_32, __kwargs_32); +} + +__Collection_attrs.remove_one = __Collection_remove_one; +Collection = create_class("Collection", __Collection_parents, __Collection_attrs); +var Controller, __Controller_attrs, __Controller_parents; +__Controller_attrs = {}; +__Controller_parents = create_array(); +var __Controller___init__ = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "tag", "el")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var tag = arguments['tag']; +var el = arguments['el']; +if(el == undefined) { +el = "
      "; +} + +var __args_33, __kwargs_33; +__args_33 = create_array(el); +__kwargs_33 = {}; +set_attribute(self, "el", get_attribute(J, "__call__")(__args_33, __kwargs_33)); +} + +__Controller_attrs.__init__ = __Controller___init__; +var __Controller_release = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +j = get_attribute(get_attribute(self, "el"), "j"); +j.remove(); +} + +__Controller_attrs.release = __Controller_release; +Controller = create_class("Controller", __Controller_parents, __Controller_attrs); diff --git a/demo/hakuintodo/javascripts/handlebars.js b/demo/hakuintodo/javascripts/handlebars.js new file mode 100644 index 0000000..96d86ea --- /dev/null +++ b/demo/hakuintodo/javascripts/handlebars.js @@ -0,0 +1,2239 @@ +/* + +Copyright (C) 2011 by Yehuda Katz + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +*/ + +// lib/handlebars/browser-prefix.js +var Handlebars = {}; + +(function(Handlebars, undefined) { +; +// lib/handlebars/base.js + +Handlebars.VERSION = "1.0.0-rc.4"; +Handlebars.COMPILER_REVISION = 3; + +Handlebars.REVISION_CHANGES = { + 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it + 2: '== 1.0.0-rc.3', + 3: '>= 1.0.0-rc.4' +}; + +Handlebars.helpers = {}; +Handlebars.partials = {}; + +var toString = Object.prototype.toString, + functionType = '[object Function]', + objectType = '[object Object]'; + +Handlebars.registerHelper = function(name, fn, inverse) { + if (toString.call(name) === objectType) { + if (inverse || fn) { throw new Handlebars.Exception('Arg not supported with multiple helpers'); } + Handlebars.Utils.extend(this.helpers, name); + } else { + if (inverse) { fn.not = inverse; } + this.helpers[name] = fn; + } +}; + +Handlebars.registerPartial = function(name, str) { + if (toString.call(name) === objectType) { + Handlebars.Utils.extend(this.partials, name); + } else { + this.partials[name] = str; + } +}; + +Handlebars.registerHelper('helperMissing', function(arg) { + if(arguments.length === 2) { + return undefined; + } else { + throw new Error("Could not find property '" + arg + "'"); + } +}); + +Handlebars.registerHelper('blockHelperMissing', function(context, options) { + var inverse = options.inverse || function() {}, fn = options.fn; + + var type = toString.call(context); + + if(type === functionType) { context = context.call(this); } + + if(context === true) { + return fn(this); + } else if(context === false || context == null) { + return inverse(this); + } else if(type === "[object Array]") { + if(context.length > 0) { + return Handlebars.helpers.each(context, options); + } else { + return inverse(this); + } + } else { + return fn(context); + } +}); + +Handlebars.K = function() {}; + +Handlebars.createFrame = Object.create || function(object) { + Handlebars.K.prototype = object; + var obj = new Handlebars.K(); + Handlebars.K.prototype = null; + return obj; +}; + +Handlebars.logger = { + DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3, level: 3, + + methodMap: {0: 'debug', 1: 'info', 2: 'warn', 3: 'error'}, + + // can be overridden in the host environment + log: function(level, obj) { + if (Handlebars.logger.level <= level) { + var method = Handlebars.logger.methodMap[level]; + if (typeof console !== 'undefined' && console[method]) { + console[method].call(console, obj); + } + } + } +}; + +Handlebars.log = function(level, obj) { Handlebars.logger.log(level, obj); }; + +Handlebars.registerHelper('each', function(context, options) { + var fn = options.fn, inverse = options.inverse; + var i = 0, ret = "", data; + + if (options.data) { + data = Handlebars.createFrame(options.data); + } + + if(context && typeof context === 'object') { + if(context instanceof Array){ + for(var j = context.length; i 2) { + expected.push("'" + this.terminals_[p] + "'"); + } + if (this.lexer.showPosition) { + errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1?"end of input":"'" + (this.terminals_[symbol] || symbol) + "'"); + } + this.parseError(errStr, {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected}); + } + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(this.lexer.yytext); + lstack.push(this.lexer.yylloc); + stack.push(action[1]); + symbol = null; + if (!preErrorSymbol) { + yyleng = this.lexer.yyleng; + yytext = this.lexer.yytext; + yylineno = this.lexer.yylineno; + yyloc = this.lexer.yylloc; + if (recovering > 0) + recovering--; + } else { + symbol = preErrorSymbol; + preErrorSymbol = null; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = {first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column}; + if (ranges) { + yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; + } + r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); + if (typeof r !== "undefined") { + return r; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState); + break; + case 3: + return true; + } + } + return true; +} +}; +/* Jison generated lexer */ +var lexer = (function(){ +var lexer = ({EOF:1, +parseError:function parseError(str, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str, hash); + } else { + throw new Error(str); + } + }, +setInput:function (input) { + this._input = input; + this._more = this._less = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ''; + this.conditionStack = ['INITIAL']; + this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0}; + if (this.options.ranges) this.yylloc.range = [0,0]; + this.offset = 0; + return this; + }, +input:function () { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) this.yylloc.range[1]++; + + this._input = this._input.slice(1); + return ch; + }, +unput:function (ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length-len-1); + //this.yyleng -= len; + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length-1); + this.matched = this.matched.substr(0, this.matched.length-1); + + if (lines.length-1) this.yylineno -= lines.length-1; + var r = this.yylloc.range; + + this.yylloc = {first_line: this.yylloc.first_line, + last_line: this.yylineno+1, + first_column: this.yylloc.first_column, + last_column: lines ? + (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length: + this.yylloc.first_column - len + }; + + if (this.options.ranges) { + this.yylloc.range = [r[0], r[0] + this.yyleng - len]; + } + return this; + }, +more:function () { + this._more = true; + return this; + }, +less:function (n) { + this.unput(this.match.slice(n)); + }, +pastInput:function () { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); + }, +upcomingInput:function () { + var next = this.match; + if (next.length < 20) { + next += this._input.substr(0, 20-next.length); + } + return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, ""); + }, +showPosition:function () { + var pre = this.pastInput(); + var c = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c+"^"; + }, +next:function () { + if (this.done) { + return this.EOF; + } + if (!this._input) this.done = true; + + var token, + match, + tempMatch, + index, + col, + lines; + if (!this._more) { + this.yytext = ''; + this.match = ''; + } + var rules = this._currentRules(); + for (var i=0;i < rules.length; i++) { + tempMatch = this._input.match(this.rules[rules[i]]); + if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { + match = tempMatch; + index = i; + if (!this.options.flex) break; + } + } + if (match) { + lines = match[0].match(/(?:\r\n?|\n).*/g); + if (lines) this.yylineno += lines.length; + this.yylloc = {first_line: this.yylloc.last_line, + last_line: this.yylineno+1, + first_column: this.yylloc.last_column, + last_column: lines ? lines[lines.length-1].length-lines[lines.length-1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length}; + this.yytext += match[0]; + this.match += match[0]; + this.matches = match; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._input = this._input.slice(match[0].length); + this.matched += match[0]; + token = this.performAction.call(this, this.yy, this, rules[index],this.conditionStack[this.conditionStack.length-1]); + if (this.done && this._input) this.done = false; + if (token) return token; + else return; + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(), + {text: "", token: null, line: this.yylineno}); + } + }, +lex:function lex() { + var r = this.next(); + if (typeof r !== 'undefined') { + return r; + } else { + return this.lex(); + } + }, +begin:function begin(condition) { + this.conditionStack.push(condition); + }, +popState:function popState() { + return this.conditionStack.pop(); + }, +_currentRules:function _currentRules() { + return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules; + }, +topState:function () { + return this.conditionStack[this.conditionStack.length-2]; + }, +pushState:function begin(condition) { + this.begin(condition); + }}); +lexer.options = {}; +lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { + +var YYSTATE=YY_START +switch($avoiding_name_collisions) { +case 0: yy_.yytext = "\\"; return 14; +break; +case 1: + if(yy_.yytext.slice(-1) !== "\\") this.begin("mu"); + if(yy_.yytext.slice(-1) === "\\") yy_.yytext = yy_.yytext.substr(0,yy_.yyleng-1), this.begin("emu"); + if(yy_.yytext) return 14; + +break; +case 2: return 14; +break; +case 3: + if(yy_.yytext.slice(-1) !== "\\") this.popState(); + if(yy_.yytext.slice(-1) === "\\") yy_.yytext = yy_.yytext.substr(0,yy_.yyleng-1); + return 14; + +break; +case 4: yy_.yytext = yy_.yytext.substr(0, yy_.yyleng-4); this.popState(); return 15; +break; +case 5: this.begin("par"); return 24; +break; +case 6: return 16; +break; +case 7: return 20; +break; +case 8: return 19; +break; +case 9: return 19; +break; +case 10: return 23; +break; +case 11: return 23; +break; +case 12: this.popState(); this.begin('com'); +break; +case 13: yy_.yytext = yy_.yytext.substr(3,yy_.yyleng-5); this.popState(); return 15; +break; +case 14: return 22; +break; +case 15: return 36; +break; +case 16: return 35; +break; +case 17: return 35; +break; +case 18: return 39; +break; +case 19: /*ignore whitespace*/ +break; +case 20: this.popState(); return 18; +break; +case 21: this.popState(); return 18; +break; +case 22: yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2).replace(/\\"/g,'"'); return 30; +break; +case 23: yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2).replace(/\\'/g,"'"); return 30; +break; +case 24: yy_.yytext = yy_.yytext.substr(1); return 28; +break; +case 25: return 32; +break; +case 26: return 32; +break; +case 27: return 31; +break; +case 28: return 35; +break; +case 29: yy_.yytext = yy_.yytext.substr(1, yy_.yyleng-2); return 35; +break; +case 30: return 'INVALID'; +break; +case 31: /*ignore whitespace*/ +break; +case 32: this.popState(); return 37; +break; +case 33: return 5; +break; +} +}; +lexer.rules = [/^(?:\\\\(?=(\{\{)))/,/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|$)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\{\{>)/,/^(?:\{\{#)/,/^(?:\{\{\/)/,/^(?:\{\{\^)/,/^(?:\{\{\s*else\b)/,/^(?:\{\{\{)/,/^(?:\{\{&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{)/,/^(?:=)/,/^(?:\.(?=[}/ ]))/,/^(?:\.\.)/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}\}\})/,/^(?:\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@[a-zA-Z]+)/,/^(?:true(?=[}\s]))/,/^(?:false(?=[}\s]))/,/^(?:-?[0-9]+(?=[}\s]))/,/^(?:[a-zA-Z0-9_$:\-]+(?=[=}\s\/.]))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:\s+)/,/^(?:[a-zA-Z0-9_$\-\/]+)/,/^(?:$)/]; +lexer.conditions = {"mu":{"rules":[5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,33],"inclusive":false},"emu":{"rules":[3],"inclusive":false},"com":{"rules":[4],"inclusive":false},"par":{"rules":[31,32],"inclusive":false},"INITIAL":{"rules":[0,1,2,33],"inclusive":true}}; +return lexer;})() +parser.lexer = lexer; +function Parser () { this.yy = {}; }Parser.prototype = parser;parser.Parser = Parser; +return new Parser; +})();; +// lib/handlebars/compiler/base.js + +Handlebars.Parser = handlebars; + +Handlebars.parse = function(input) { + + // Just return if an already-compile AST was passed in. + if(input.constructor === Handlebars.AST.ProgramNode) { return input; } + + Handlebars.Parser.yy = Handlebars.AST; + return Handlebars.Parser.parse(input); +}; +; +// lib/handlebars/compiler/ast.js +Handlebars.AST = {}; + +Handlebars.AST.ProgramNode = function(statements, inverse) { + this.type = "program"; + this.statements = statements; + if(inverse) { this.inverse = new Handlebars.AST.ProgramNode(inverse); } +}; + +Handlebars.AST.MustacheNode = function(rawParams, hash, unescaped) { + this.type = "mustache"; + this.escaped = !unescaped; + this.hash = hash; + + var id = this.id = rawParams[0]; + var params = this.params = rawParams.slice(1); + + // a mustache is an eligible helper if: + // * its id is simple (a single part, not `this` or `..`) + var eligibleHelper = this.eligibleHelper = id.isSimple; + + // a mustache is definitely a helper if: + // * it is an eligible helper, and + // * it has at least one parameter or hash segment + this.isHelper = eligibleHelper && (params.length || hash); + + // if a mustache is an eligible helper but not a definite + // helper, it is ambiguous, and will be resolved in a later + // pass or at runtime. +}; + +Handlebars.AST.PartialNode = function(partialName, context) { + this.type = "partial"; + this.partialName = partialName; + this.context = context; +}; + +Handlebars.AST.BlockNode = function(mustache, program, inverse, close) { + var verifyMatch = function(open, close) { + if(open.original !== close.original) { + throw new Handlebars.Exception(open.original + " doesn't match " + close.original); + } + }; + + verifyMatch(mustache.id, close); + this.type = "block"; + this.mustache = mustache; + this.program = program; + this.inverse = inverse; + + if (this.inverse && !this.program) { + this.isInverse = true; + } +}; + +Handlebars.AST.ContentNode = function(string) { + this.type = "content"; + this.string = string; +}; + +Handlebars.AST.HashNode = function(pairs) { + this.type = "hash"; + this.pairs = pairs; +}; + +Handlebars.AST.IdNode = function(parts) { + this.type = "ID"; + this.original = parts.join("."); + + var dig = [], depth = 0; + + for(var i=0,l=parts.length; i 0) { throw new Handlebars.Exception("Invalid path: " + this.original); } + else if (part === "..") { depth++; } + else { this.isScoped = true; } + } + else { dig.push(part); } + } + + this.parts = dig; + this.string = dig.join('.'); + this.depth = depth; + + // an ID is simple if it only has one part, and that part is not + // `..` or `this`. + this.isSimple = parts.length === 1 && !this.isScoped && depth === 0; + + this.stringModeValue = this.string; +}; + +Handlebars.AST.PartialNameNode = function(name) { + this.type = "PARTIAL_NAME"; + this.name = name; +}; + +Handlebars.AST.DataNode = function(id) { + this.type = "DATA"; + this.id = id; +}; + +Handlebars.AST.StringNode = function(string) { + this.type = "STRING"; + this.string = string; + this.stringModeValue = string; +}; + +Handlebars.AST.IntegerNode = function(integer) { + this.type = "INTEGER"; + this.integer = integer; + this.stringModeValue = Number(integer); +}; + +Handlebars.AST.BooleanNode = function(bool) { + this.type = "BOOLEAN"; + this.bool = bool; + this.stringModeValue = bool === "true"; +}; + +Handlebars.AST.CommentNode = function(comment) { + this.type = "comment"; + this.comment = comment; +}; +; +// lib/handlebars/utils.js + +var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; + +Handlebars.Exception = function(message) { + var tmp = Error.prototype.constructor.apply(this, arguments); + + // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. + for (var idx = 0; idx < errorProps.length; idx++) { + this[errorProps[idx]] = tmp[errorProps[idx]]; + } +}; +Handlebars.Exception.prototype = new Error(); + +// Build out our basic SafeString type +Handlebars.SafeString = function(string) { + this.string = string; +}; +Handlebars.SafeString.prototype.toString = function() { + return this.string.toString(); +}; + +var escape = { + "&": "&", + "<": "<", + ">": ">", + '"': """, + "'": "'", + "`": "`" +}; + +var badChars = /[&<>"'`]/g; +var possible = /[&<>"'`]/; + +var escapeChar = function(chr) { + return escape[chr] || "&"; +}; + +Handlebars.Utils = { + extend: function(obj, value) { + for(var key in value) { + if(value.hasOwnProperty(key)) { + obj[key] = value[key]; + } + } + }, + + escapeExpression: function(string) { + // don't escape SafeStrings, since they're already safe + if (string instanceof Handlebars.SafeString) { + return string.toString(); + } else if (string == null || string === false) { + return ""; + } + + // Force a string conversion as this will be done by the append regardless and + // the regex test will do this transparently behind the scenes, causing issues if + // an object's to string has escaped characters in it. + string = string.toString(); + + if(!possible.test(string)) { return string; } + return string.replace(badChars, escapeChar); + }, + + isEmpty: function(value) { + if (!value && value !== 0) { + return true; + } else if(toString.call(value) === "[object Array]" && value.length === 0) { + return true; + } else { + return false; + } + } +}; +; +// lib/handlebars/compiler/compiler.js + +/*jshint eqnull:true*/ +var Compiler = Handlebars.Compiler = function() {}; +var JavaScriptCompiler = Handlebars.JavaScriptCompiler = function() {}; + +// the foundHelper register will disambiguate helper lookup from finding a +// function in a context. This is necessary for mustache compatibility, which +// requires that context functions in blocks are evaluated by blockHelperMissing, +// and then proceed as if the resulting value was provided to blockHelperMissing. + +Compiler.prototype = { + compiler: Compiler, + + disassemble: function() { + var opcodes = this.opcodes, opcode, out = [], params, param; + + for (var i=0, l=opcodes.length; i 0) { + this.source[1] = this.source[1] + ", " + locals.join(", "); + } + + // Generate minimizer alias mappings + if (!this.isChild) { + for (var alias in this.context.aliases) { + this.source[1] = this.source[1] + ', ' + alias + '=' + this.context.aliases[alias]; + } + } + + if (this.source[1]) { + this.source[1] = "var " + this.source[1].substring(2) + ";"; + } + + // Merge children + if (!this.isChild) { + this.source[1] += '\n' + this.context.programs.join('\n') + '\n'; + } + + if (!this.environment.isSimple) { + this.source.push("return buffer;"); + } + + var params = this.isChild ? ["depth0", "data"] : ["Handlebars", "depth0", "helpers", "partials", "data"]; + + for(var i=0, l=this.environment.depths.list.length; i this.stackVars.length) { this.stackVars.push("stack" + this.stackSlot); } + return this.topStackName(); + }, + topStackName: function() { + return "stack" + this.stackSlot; + }, + flushInline: function() { + var inlineStack = this.inlineStack; + if (inlineStack.length) { + this.inlineStack = []; + for (var i = 0, len = inlineStack.length; i < len; i++) { + var entry = inlineStack[i]; + if (entry instanceof Literal) { + this.compileStack.push(entry); + } else { + this.pushStack(entry); + } + } + } + }, + isInline: function() { + return this.inlineStack.length; + }, + + popStack: function(wrapped) { + var inline = this.isInline(), + item = (inline ? this.inlineStack : this.compileStack).pop(); + + if (!wrapped && (item instanceof Literal)) { + return item.value; + } else { + if (!inline) { + this.stackSlot--; + } + return item; + } + }, + + topStack: function(wrapped) { + var stack = (this.isInline() ? this.inlineStack : this.compileStack), + item = stack[stack.length - 1]; + + if (!wrapped && (item instanceof Literal)) { + return item.value; + } else { + return item; + } + }, + + quotedString: function(str) { + return '"' + str + .replace(/\\/g, '\\\\') + .replace(/"/g, '\\"') + .replace(/\n/g, '\\n') + .replace(/\r/g, '\\r') + .replace(/\u2028/g, '\\u2028') // Per Ecma-262 7.3 + 7.8.4 + .replace(/\u2029/g, '\\u2029') + '"'; + }, + + setupHelper: function(paramSize, name, missingParams) { + var params = []; + this.setupParams(paramSize, params, missingParams); + var foundHelper = this.nameLookup('helpers', name, 'helper'); + + return { + params: params, + name: foundHelper, + callParams: ["depth0"].concat(params).join(", "), + helperMissingParams: missingParams && ["depth0", this.quotedString(name)].concat(params).join(", ") + }; + }, + + // the params and contexts arguments are passed in arrays + // to fill in + setupParams: function(paramSize, params, useRegister) { + var options = [], contexts = [], types = [], param, inverse, program; + + options.push("hash:" + this.popStack()); + + inverse = this.popStack(); + program = this.popStack(); + + // Avoid setting fn and inverse if neither are set. This allows + // helpers to do a check for `if (options.fn)` + if (program || inverse) { + if (!program) { + this.context.aliases.self = "this"; + program = "self.noop"; + } + + if (!inverse) { + this.context.aliases.self = "this"; + inverse = "self.noop"; + } + + options.push("inverse:" + inverse); + options.push("fn:" + program); + } + + for(var i=0; i)[^>]*|#([\w-]*))$/,C=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,k=/^[\],:{}\s]*$/,E=/(?:^|:|,)(?:\s*\[)+/g,S=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,A=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,j=/^-ms-/,D=/-([\da-z])/gi,L=function(e,t){return t.toUpperCase()},H=function(e){(o.addEventListener||"load"===e.type||"complete"===o.readyState)&&(q(),b.ready())},q=function(){o.addEventListener?(o.removeEventListener("DOMContentLoaded",H,!1),e.removeEventListener("load",H,!1)):(o.detachEvent("onreadystatechange",H),e.detachEvent("onload",H))};b.fn=b.prototype={jquery:p,constructor:b,init:function(e,n,r){var i,a;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof b?n[0]:n,b.merge(this,b.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:o,!0)),C.test(i[1])&&b.isPlainObject(n))for(i in n)b.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(a=o.getElementById(i[2]),a&&a.parentNode){if(a.id!==i[2])return r.find(e);this.length=1,this[0]=a}return this.context=o,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):b.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),b.makeArray(e,this))},selector:"",length:0,size:function(){return this.length},toArray:function(){return h.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=b.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return b.each(this,e,t)},ready:function(e){return b.ready.promise().done(e),this},slice:function(){return this.pushStack(h.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(b.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:d,sort:[].sort,splice:[].splice},b.fn.init.prototype=b.fn,b.extend=b.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},u=1,l=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},u=2),"object"==typeof s||b.isFunction(s)||(s={}),l===u&&(s=this,--u);l>u;u++)if(null!=(o=arguments[u]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(b.isPlainObject(r)||(n=b.isArray(r)))?(n?(n=!1,a=e&&b.isArray(e)?e:[]):a=e&&b.isPlainObject(e)?e:{},s[i]=b.extend(c,a,r)):r!==t&&(s[i]=r));return s},b.extend({noConflict:function(t){return e.$===b&&(e.$=u),t&&e.jQuery===b&&(e.jQuery=s),b},isReady:!1,readyWait:1,holdReady:function(e){e?b.readyWait++:b.ready(!0)},ready:function(e){if(e===!0?!--b.readyWait:!b.isReady){if(!o.body)return setTimeout(b.ready);b.isReady=!0,e!==!0&&--b.readyWait>0||(n.resolveWith(o,[b]),b.fn.trigger&&b(o).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===b.type(e)},isArray:Array.isArray||function(e){return"array"===b.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[m.call(e)]||"object":typeof e},isPlainObject:function(e){if(!e||"object"!==b.type(e)||e.nodeType||b.isWindow(e))return!1;try{if(e.constructor&&!y.call(e,"constructor")&&!y.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||y.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||o;var r=C.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=b.buildFragment([e],t,i),i&&b(i).remove(),b.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=b.trim(n),n&&k.test(n.replace(S,"@").replace(A,"]").replace(E,"")))?Function("return "+n)():(b.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||b.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&b.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(j,"ms-").replace(D,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:v&&!v.call("\ufeff\u00a0")?function(e){return null==e?"":v.call(e)}:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?b.merge(n,"string"==typeof e?[e]:e):d.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(g)return g.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return f.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),b.isFunction(e)?(r=h.call(arguments,2),i=function(){return e.apply(n||this,r.concat(h.call(arguments)))},i.guid=e.guid=e.guid||b.guid++,i):t},access:function(e,n,r,i,o,a,s){var u=0,l=e.length,c=null==r;if("object"===b.type(r)){o=!0;for(u in r)b.access(e,n,u,r[u],!0,a,s)}else if(i!==t&&(o=!0,b.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(b(e),n)})),n))for(;l>u;u++)n(e[u],r,s?i:i.call(e[u],u,n(e[u],r)));return o?e:c?n.call(e):l?n(e[0],r):a},now:function(){return(new Date).getTime()}}),b.ready.promise=function(t){if(!n)if(n=b.Deferred(),"complete"===o.readyState)setTimeout(b.ready);else if(o.addEventListener)o.addEventListener("DOMContentLoaded",H,!1),e.addEventListener("load",H,!1);else{o.attachEvent("onreadystatechange",H),e.attachEvent("onload",H);var r=!1;try{r=null==e.frameElement&&o.documentElement}catch(i){}r&&r.doScroll&&function a(){if(!b.isReady){try{r.doScroll("left")}catch(e){return setTimeout(a,50)}q(),b.ready()}}()}return n.promise(t)},b.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=b.type(e);return b.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=b(o);var _={};function F(e){var t=_[e]={};return b.each(e.match(w)||[],function(e,n){t[n]=!0}),t}b.Callbacks=function(e){e="string"==typeof e?_[e]||F(e):b.extend({},e);var n,r,i,o,a,s,u=[],l=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=u.length,n=!0;u&&o>a;a++)if(u[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,u&&(l?l.length&&c(l.shift()):r?u=[]:p.disable())},p={add:function(){if(u){var t=u.length;(function i(t){b.each(t,function(t,n){var r=b.type(n);"function"===r?e.unique&&p.has(n)||u.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=u.length:r&&(s=t,c(r))}return this},remove:function(){return u&&b.each(arguments,function(e,t){var r;while((r=b.inArray(t,u,r))>-1)u.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?b.inArray(e,u)>-1:!(!u||!u.length)},empty:function(){return u=[],this},disable:function(){return u=l=r=t,this},disabled:function(){return!u},lock:function(){return l=t,r||p.disable(),this},locked:function(){return!l},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],!u||i&&!l||(n?l.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},b.extend({Deferred:function(e){var t=[["resolve","done",b.Callbacks("once memory"),"resolved"],["reject","fail",b.Callbacks("once memory"),"rejected"],["notify","progress",b.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return b.Deferred(function(n){b.each(t,function(t,o){var a=o[0],s=b.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&b.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?b.extend(e,r):r}},i={};return r.pipe=r.then,b.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=h.call(arguments),r=n.length,i=1!==r||e&&b.isFunction(e.promise)?r:0,o=1===i?e:b.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?h.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,u,l;if(r>1)for(s=Array(r),u=Array(r),l=Array(r);r>t;t++)n[t]&&b.isFunction(n[t].promise)?n[t].promise().done(a(t,l,n)).fail(o.reject).progress(a(t,u,s)):--i;return i||o.resolveWith(l,n),o.promise()}}),b.support=function(){var t,n,r,a,s,u,l,c,p,f,d=o.createElement("div");if(d.setAttribute("className","t"),d.innerHTML="
      a",n=d.getElementsByTagName("*"),r=d.getElementsByTagName("a")[0],!n||!r||!n.length)return{};s=o.createElement("select"),l=s.appendChild(o.createElement("option")),a=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={getSetAttribute:"t"!==d.className,leadingWhitespace:3===d.firstChild.nodeType,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:"/a"===r.getAttribute("href"),opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:!!a.value,optSelected:l.selected,enctype:!!o.createElement("form").enctype,html5Clone:"<:nav>"!==o.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===o.compatMode,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},a.checked=!0,t.noCloneChecked=a.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!l.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}a=o.createElement("input"),a.setAttribute("value",""),t.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),t.radioValue="t"===a.value,a.setAttribute("checked","t"),a.setAttribute("name","t"),u=o.createDocumentFragment(),u.appendChild(a),t.appendChecked=a.checked,t.checkClone=u.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;return d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip,b(function(){var n,r,a,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",u=o.getElementsByTagName("body")[0];u&&(n=o.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",u.appendChild(n).appendChild(d),d.innerHTML="
      t
      ",a=d.getElementsByTagName("td"),a[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===a[0].offsetHeight,a[0].style.display="",a[1].style.display="none",t.reliableHiddenOffsets=p&&0===a[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=4===d.offsetWidth,t.doesNotIncludeMarginInBodyOffset=1!==u.offsetTop,e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(o.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="
      ",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(u.style.zoom=1)),u.removeChild(n),n=d=a=r=null)}),n=s=u=l=r=a=null,t}();var O=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,B=/([A-Z])/g;function P(e,n,r,i){if(b.acceptData(e)){var o,a,s=b.expando,u="string"==typeof n,l=e.nodeType,p=l?b.cache:e,f=l?e[s]:e[s]&&s;if(f&&p[f]&&(i||p[f].data)||!u||r!==t)return f||(l?e[s]=f=c.pop()||b.guid++:f=s),p[f]||(p[f]={},l||(p[f].toJSON=b.noop)),("object"==typeof n||"function"==typeof n)&&(i?p[f]=b.extend(p[f],n):p[f].data=b.extend(p[f].data,n)),o=p[f],i||(o.data||(o.data={}),o=o.data),r!==t&&(o[b.camelCase(n)]=r),u?(a=o[n],null==a&&(a=o[b.camelCase(n)])):a=o,a}}function R(e,t,n){if(b.acceptData(e)){var r,i,o,a=e.nodeType,s=a?b.cache:e,u=a?e[b.expando]:b.expando;if(s[u]){if(t&&(o=n?s[u]:s[u].data)){b.isArray(t)?t=t.concat(b.map(t,b.camelCase)):t in o?t=[t]:(t=b.camelCase(t),t=t in o?[t]:t.split(" "));for(r=0,i=t.length;i>r;r++)delete o[t[r]];if(!(n?$:b.isEmptyObject)(o))return}(n||(delete s[u].data,$(s[u])))&&(a?b.cleanData([e],!0):b.support.deleteExpando||s!=s.window?delete s[u]:s[u]=null)}}}b.extend({cache:{},expando:"jQuery"+(p+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?b.cache[e[b.expando]]:e[b.expando],!!e&&!$(e)},data:function(e,t,n){return P(e,t,n)},removeData:function(e,t){return R(e,t)},_data:function(e,t,n){return P(e,t,n,!0)},_removeData:function(e,t){return R(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&b.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),b.fn.extend({data:function(e,n){var r,i,o=this[0],a=0,s=null;if(e===t){if(this.length&&(s=b.data(o),1===o.nodeType&&!b._data(o,"parsedAttrs"))){for(r=o.attributes;r.length>a;a++)i=r[a].name,i.indexOf("data-")||(i=b.camelCase(i.slice(5)),W(o,i,s[i]));b._data(o,"parsedAttrs",!0)}return s}return"object"==typeof e?this.each(function(){b.data(this,e)}):b.access(this,function(n){return n===t?o?W(o,e,b.data(o,e)):null:(this.each(function(){b.data(this,e,n)}),t)},null,n,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){b.removeData(this,e)})}});function W(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(B,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:O.test(r)?b.parseJSON(r):r}catch(o){}b.data(e,n,r)}else r=t}return r}function $(e){var t;for(t in e)if(("data"!==t||!b.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}b.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=b._data(e,n),r&&(!i||b.isArray(r)?i=b._data(e,n,b.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=b.queue(e,t),r=n.length,i=n.shift(),o=b._queueHooks(e,t),a=function(){b.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),o.cur=i,i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return b._data(e,n)||b._data(e,n,{empty:b.Callbacks("once memory").add(function(){b._removeData(e,t+"queue"),b._removeData(e,n)})})}}),b.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?b.queue(this[0],e):n===t?this:this.each(function(){var t=b.queue(this,e,n);b._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&b.dequeue(this,e)})},dequeue:function(e){return this.each(function(){b.dequeue(this,e)})},delay:function(e,t){return e=b.fx?b.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=b.Deferred(),a=this,s=this.length,u=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=b._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(u));return u(),o.promise(n)}});var I,z,X=/[\t\r\n]/g,U=/\r/g,V=/^(?:input|select|textarea|button|object)$/i,Y=/^(?:a|area)$/i,J=/^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,G=/^(?:checked|selected)$/i,Q=b.support.getSetAttribute,K=b.support.input;b.fn.extend({attr:function(e,t){return b.access(this,b.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){b.removeAttr(this,e)})},prop:function(e,t){return b.access(this,b.prop,e,t,arguments.length>1)},removeProp:function(e){return e=b.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,u="string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).addClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=b.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,u=0===arguments.length||"string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).removeClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?b.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e,r="boolean"==typeof t;return b.isFunction(e)?this.each(function(n){b(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var o,a=0,s=b(this),u=t,l=e.match(w)||[];while(o=l[a++])u=r?u:!s.hasClass(o),s[u?"addClass":"removeClass"](o)}else(n===i||"boolean"===n)&&(this.className&&b._data(this,"__className__",this.className),this.className=this.className||e===!1?"":b._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(X," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=b.isFunction(e),this.each(function(n){var o,a=b(this);1===this.nodeType&&(o=i?e.call(this,n,a.val()):e,null==o?o="":"number"==typeof o?o+="":b.isArray(o)&&(o=b.map(o,function(e){return null==e?"":e+""})),r=b.valHooks[this.type]||b.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=b.valHooks[o.type]||b.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(U,""):null==n?"":n)}}}),b.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,u=0>i?s:o?i:0;for(;s>u;u++)if(n=r[u],!(!n.selected&&u!==i||(b.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&b.nodeName(n.parentNode,"optgroup"))){if(t=b(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n=b.makeArray(t);return b(e).find("option").each(function(){this.selected=b.inArray(b(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attr:function(e,n,r){var o,a,s,u=e.nodeType;if(e&&3!==u&&8!==u&&2!==u)return typeof e.getAttribute===i?b.prop(e,n,r):(a=1!==u||!b.isXMLDoc(e),a&&(n=n.toLowerCase(),o=b.attrHooks[n]||(J.test(n)?z:I)),r===t?o&&a&&"get"in o&&null!==(s=o.get(e,n))?s:(typeof e.getAttribute!==i&&(s=e.getAttribute(n)),null==s?t:s):null!==r?o&&a&&"set"in o&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r):(b.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(w);if(o&&1===e.nodeType)while(n=o[i++])r=b.propFix[n]||n,J.test(n)?!Q&&G.test(n)?e[b.camelCase("default-"+n)]=e[r]=!1:e[r]=!1:b.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!b.support.radioValue&&"radio"===t&&b.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!b.isXMLDoc(e),a&&(n=b.propFix[n]||n,o=b.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):V.test(e.nodeName)||Y.test(e.nodeName)&&e.href?0:t}}}}),z={get:function(e,n){var r=b.prop(e,n),i="boolean"==typeof r&&e.getAttribute(n),o="boolean"==typeof r?K&&Q?null!=i:G.test(n)?e[b.camelCase("default-"+n)]:!!i:e.getAttributeNode(n);return o&&o.value!==!1?n.toLowerCase():t},set:function(e,t,n){return t===!1?b.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&b.propFix[n]||n,n):e[b.camelCase("default-"+n)]=e[n]=!0,n}},K&&Q||(b.attrHooks.value={get:function(e,n){var r=e.getAttributeNode(n);return b.nodeName(e,"input")?e.defaultValue:r&&r.specified?r.value:t},set:function(e,n,r){return b.nodeName(e,"input")?(e.defaultValue=n,t):I&&I.set(e,n,r)}}),Q||(I=b.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&("id"===n||"name"===n||"coords"===n?""!==r.value:r.specified)?r.value:t},set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},b.attrHooks.contenteditable={get:I.get,set:function(e,t,n){I.set(e,""===t?!1:t,n)}},b.each(["width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}})})),b.support.hrefNormalized||(b.each(["href","src","width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return null==r?t:r}})}),b.each(["href","src"],function(e,t){b.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}})),b.support.style||(b.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),b.support.optSelected||(b.propHooks.selected=b.extend(b.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),b.support.enctype||(b.propFix.enctype="encoding"),b.support.checkOn||b.each(["radio","checkbox"],function(){b.valHooks[this]={get:function(e){return null===e.getAttribute("value")?"on":e.value}}}),b.each(["radio","checkbox"],function(){b.valHooks[this]=b.extend(b.valHooks[this],{set:function(e,n){return b.isArray(n)?e.checked=b.inArray(b(e).val(),n)>=0:t}})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}b.event={global:{},add:function(e,n,r,o,a){var s,u,l,c,p,f,d,h,g,m,y,v=b._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=b.guid++),(u=v.events)||(u=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof b===i||e&&b.event.triggered===e.type?t:b.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(w)||[""],l=n.length;while(l--)s=rt.exec(n[l])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),p=b.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=b.event.special[g]||{},d=b.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&b.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=u[g])||(h=u[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),b.event.global[g]=!0;e=null}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,p,f,d,h,g,m=b.hasData(e)&&b._data(e);if(m&&(c=m.events)){t=(t||"").match(w)||[""],l=t.length;while(l--)if(s=rt.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=b.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),u=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a));u&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||b.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)b.event.remove(e,d+t[l],n,r,!0);b.isEmptyObject(c)&&(delete m.handle,b._removeData(e,"events"))}},trigger:function(n,r,i,a){var s,u,l,c,p,f,d,h=[i||o],g=y.call(n,"type")?n.type:n,m=y.call(n,"namespace")?n.namespace.split("."):[];if(l=f=i=i||o,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+b.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),u=0>g.indexOf(":")&&"on"+g,n=n[b.expando]?n:new b.Event(g,"object"==typeof n&&n),n.isTrigger=!0,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:b.makeArray(r,[n]),p=b.event.special[g]||{},a||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!a&&!p.noBubble&&!b.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(l=l.parentNode);l;l=l.parentNode)h.push(l),f=l;f===(i.ownerDocument||o)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((l=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(b._data(l,"events")||{})[n.type]&&b._data(l,"handle"),s&&s.apply(l,r),s=u&&l[u],s&&b.acceptData(l)&&s.apply&&s.apply(l,r)===!1&&n.preventDefault();if(n.type=g,!(a||n.isDefaultPrevented()||p._default&&p._default.apply(i.ownerDocument,r)!==!1||"click"===g&&b.nodeName(i,"a")||!b.acceptData(i)||!u||!i[g]||b.isWindow(i))){f=i[u],f&&(i[u]=null),b.event.triggered=g;try{i[g]()}catch(v){}b.event.triggered=t,f&&(i[u]=f)}return n.result}},dispatch:function(e){e=b.event.fix(e);var n,r,i,o,a,s=[],u=h.call(arguments),l=(b._data(this,"events")||{})[e.type]||[],c=b.event.special[e.type]||{};if(u[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=b.event.handlers.call(this,e,l),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((b.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,u),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],u=n.delegateCount,l=e.target;if(u&&l.nodeType&&(!e.button||"click"!==e.type))for(;l!=this;l=l.parentNode||this)if(1===l.nodeType&&(l.disabled!==!0||"click"!==e.type)){for(o=[],a=0;u>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?b(r,this).index(l)>=0:b.find(r,this,null,[l]).length),o[r]&&o.push(i);o.length&&s.push({elem:l,handlers:o})}return n.length>u&&s.push({elem:this,handlers:n.slice(u)}),s},fix:function(e){if(e[b.expando])return e;var t,n,r,i=e.type,a=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new b.Event(a),t=r.length;while(t--)n=r[t],e[n]=a[n];return e.target||(e.target=a.srcElement||o),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,a):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,a,s=n.button,u=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||o,a=i.documentElement,r=i.body,e.pageX=n.clientX+(a&&a.scrollLeft||r&&r.scrollLeft||0)-(a&&a.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(a&&a.scrollTop||r&&r.scrollTop||0)-(a&&a.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&u&&(e.relatedTarget=u===e.target?n.toElement:u),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},click:{trigger:function(){return b.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t}},focus:{trigger:function(){if(this!==o.activeElement&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===o.activeElement&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=b.extend(new b.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?b.event.trigger(i,null,t):b.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},b.removeEvent=o.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},b.Event=function(e,n){return this instanceof b.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&b.extend(this,n),this.timeStamp=e&&e.timeStamp||b.now(),this[b.expando]=!0,t):new b.Event(e,n)},b.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},b.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){b.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj; +return(!i||i!==r&&!b.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),b.support.submitBubbles||(b.event.special.submit={setup:function(){return b.nodeName(this,"form")?!1:(b.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=b.nodeName(n,"input")||b.nodeName(n,"button")?n.form:t;r&&!b._data(r,"submitBubbles")&&(b.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),b._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&b.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return b.nodeName(this,"form")?!1:(b.event.remove(this,"._submit"),t)}}),b.support.changeBubbles||(b.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(b.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),b.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),b.event.simulate("change",this,e,!0)})),!1):(b.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!b._data(t,"changeBubbles")&&(b.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||b.event.simulate("change",this.parentNode,e,!0)}),b._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return b.event.remove(this,"._change"),!Z.test(this.nodeName)}}),b.support.focusinBubbles||b.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){b.event.simulate(t,e.target,b.event.fix(e),!0)};b.event.special[t]={setup:function(){0===n++&&o.addEventListener(e,r,!0)},teardown:function(){0===--n&&o.removeEventListener(e,r,!0)}}}),b.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return b().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=b.guid++)),this.each(function(){b.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,b(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){b.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){b.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?b.event.trigger(e,n,r,!0):t}}),function(e,t){var n,r,i,o,a,s,u,l,c,p,f,d,h,g,m,y,v,x="sizzle"+-new Date,w=e.document,T={},N=0,C=0,k=it(),E=it(),S=it(),A=typeof t,j=1<<31,D=[],L=D.pop,H=D.push,q=D.slice,M=D.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},_="[\\x20\\t\\r\\n\\f]",F="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=F.replace("w","w#"),B="([*^$|!~]?=)",P="\\["+_+"*("+F+")"+_+"*(?:"+B+_+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+O+")|)|)"+_+"*\\]",R=":("+F+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+P.replace(3,8)+")*)|.*)\\)|)",W=RegExp("^"+_+"+|((?:^|[^\\\\])(?:\\\\.)*)"+_+"+$","g"),$=RegExp("^"+_+"*,"+_+"*"),I=RegExp("^"+_+"*([\\x20\\t\\r\\n\\f>+~])"+_+"*"),z=RegExp(R),X=RegExp("^"+O+"$"),U={ID:RegExp("^#("+F+")"),CLASS:RegExp("^\\.("+F+")"),NAME:RegExp("^\\[name=['\"]?("+F+")['\"]?\\]"),TAG:RegExp("^("+F.replace("w","w*")+")"),ATTR:RegExp("^"+P),PSEUDO:RegExp("^"+R),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+_+"*(even|odd|(([+-]|)(\\d*)n|)"+_+"*(?:([+-]|)"+_+"*(\\d+)|))"+_+"*\\)|)","i"),needsContext:RegExp("^"+_+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+_+"*((?:-\\d)?\\d*)"+_+"*\\)|)(?=[^-]|$)","i")},V=/[\x20\t\r\n\f]*[+~]/,Y=/^[^{]+\{\s*\[native code/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,G=/^(?:input|select|textarea|button)$/i,Q=/^h\d$/i,K=/'|\\/g,Z=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,et=/\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,tt=function(e,t){var n="0x"+t-65536;return n!==n?t:0>n?String.fromCharCode(n+65536):String.fromCharCode(55296|n>>10,56320|1023&n)};try{q.call(w.documentElement.childNodes,0)[0].nodeType}catch(nt){q=function(e){var t,n=[];while(t=this[e++])n.push(t);return n}}function rt(e){return Y.test(e+"")}function it(){var e,t=[];return e=function(n,r){return t.push(n+=" ")>i.cacheLength&&delete e[t.shift()],e[n]=r}}function ot(e){return e[x]=!0,e}function at(e){var t=p.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}}function st(e,t,n,r){var i,o,a,s,u,l,f,g,m,v;if((t?t.ownerDocument||t:w)!==p&&c(t),t=t||p,n=n||[],!e||"string"!=typeof e)return n;if(1!==(s=t.nodeType)&&9!==s)return[];if(!d&&!r){if(i=J.exec(e))if(a=i[1]){if(9===s){if(o=t.getElementById(a),!o||!o.parentNode)return n;if(o.id===a)return n.push(o),n}else if(t.ownerDocument&&(o=t.ownerDocument.getElementById(a))&&y(t,o)&&o.id===a)return n.push(o),n}else{if(i[2])return H.apply(n,q.call(t.getElementsByTagName(e),0)),n;if((a=i[3])&&T.getByClassName&&t.getElementsByClassName)return H.apply(n,q.call(t.getElementsByClassName(a),0)),n}if(T.qsa&&!h.test(e)){if(f=!0,g=x,m=t,v=9===s&&e,1===s&&"object"!==t.nodeName.toLowerCase()){l=ft(e),(f=t.getAttribute("id"))?g=f.replace(K,"\\$&"):t.setAttribute("id",g),g="[id='"+g+"'] ",u=l.length;while(u--)l[u]=g+dt(l[u]);m=V.test(e)&&t.parentNode||t,v=l.join(",")}if(v)try{return H.apply(n,q.call(m.querySelectorAll(v),0)),n}catch(b){}finally{f||t.removeAttribute("id")}}}return wt(e.replace(W,"$1"),t,n,r)}a=st.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},c=st.setDocument=function(e){var n=e?e.ownerDocument||e:w;return n!==p&&9===n.nodeType&&n.documentElement?(p=n,f=n.documentElement,d=a(n),T.tagNameNoComments=at(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),T.attributes=at(function(e){e.innerHTML="";var t=typeof e.lastChild.getAttribute("multiple");return"boolean"!==t&&"string"!==t}),T.getByClassName=at(function(e){return e.innerHTML="",e.getElementsByClassName&&e.getElementsByClassName("e").length?(e.lastChild.className="e",2===e.getElementsByClassName("e").length):!1}),T.getByName=at(function(e){e.id=x+0,e.innerHTML="
      ",f.insertBefore(e,f.firstChild);var t=n.getElementsByName&&n.getElementsByName(x).length===2+n.getElementsByName(x+0).length;return T.getIdNotName=!n.getElementById(x),f.removeChild(e),t}),i.attrHandle=at(function(e){return e.innerHTML="",e.firstChild&&typeof e.firstChild.getAttribute!==A&&"#"===e.firstChild.getAttribute("href")})?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},T.getIdNotName?(i.find.ID=function(e,t){if(typeof t.getElementById!==A&&!d){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){return e.getAttribute("id")===t}}):(i.find.ID=function(e,n){if(typeof n.getElementById!==A&&!d){var r=n.getElementById(e);return r?r.id===e||typeof r.getAttributeNode!==A&&r.getAttributeNode("id").value===e?[r]:t:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){var n=typeof e.getAttributeNode!==A&&e.getAttributeNode("id");return n&&n.value===t}}),i.find.TAG=T.tagNameNoComments?function(e,n){return typeof n.getElementsByTagName!==A?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},i.find.NAME=T.getByName&&function(e,n){return typeof n.getElementsByName!==A?n.getElementsByName(name):t},i.find.CLASS=T.getByClassName&&function(e,n){return typeof n.getElementsByClassName===A||d?t:n.getElementsByClassName(e)},g=[],h=[":focus"],(T.qsa=rt(n.querySelectorAll))&&(at(function(e){e.innerHTML="",e.querySelectorAll("[selected]").length||h.push("\\["+_+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||h.push(":checked")}),at(function(e){e.innerHTML="",e.querySelectorAll("[i^='']").length&&h.push("[*^$]="+_+"*(?:\"\"|'')"),e.querySelectorAll(":enabled").length||h.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),h.push(",.*:")})),(T.matchesSelector=rt(m=f.matchesSelector||f.mozMatchesSelector||f.webkitMatchesSelector||f.oMatchesSelector||f.msMatchesSelector))&&at(function(e){T.disconnectedMatch=m.call(e,"div"),m.call(e,"[s!='']:x"),g.push("!=",R)}),h=RegExp(h.join("|")),g=RegExp(g.join("|")),y=rt(f.contains)||f.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},v=f.compareDocumentPosition?function(e,t){var r;return e===t?(u=!0,0):(r=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t))?1&r||e.parentNode&&11===e.parentNode.nodeType?e===n||y(w,e)?-1:t===n||y(w,t)?1:0:4&r?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return u=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:0;if(o===a)return ut(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?ut(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},u=!1,[0,0].sort(v),T.detectDuplicates=u,p):p},st.matches=function(e,t){return st(e,null,null,t)},st.matchesSelector=function(e,t){if((e.ownerDocument||e)!==p&&c(e),t=t.replace(Z,"='$1']"),!(!T.matchesSelector||d||g&&g.test(t)||h.test(t)))try{var n=m.call(e,t);if(n||T.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(r){}return st(t,p,null,[e]).length>0},st.contains=function(e,t){return(e.ownerDocument||e)!==p&&c(e),y(e,t)},st.attr=function(e,t){var n;return(e.ownerDocument||e)!==p&&c(e),d||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):d||T.attributes?e.getAttribute(t):((n=e.getAttributeNode(t))||e.getAttribute(t))&&e[t]===!0?t:n&&n.specified?n.value:null},st.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},st.uniqueSort=function(e){var t,n=[],r=1,i=0;if(u=!T.detectDuplicates,e.sort(v),u){for(;t=e[r];r++)t===e[r-1]&&(i=n.push(r));while(i--)e.splice(n[i],1)}return e};function ut(e,t){var n=t&&e,r=n&&(~t.sourceIndex||j)-(~e.sourceIndex||j);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function lt(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function ct(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function pt(e){return ot(function(t){return t=+t,ot(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}o=st.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=o(t);return n},i=st.selectors={cacheLength:50,createPseudo:ot,match:U,find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(et,tt),e[3]=(e[4]||e[5]||"").replace(et,tt),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||st.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&st.error(e[0]),e},PSEUDO:function(e){var t,n=!e[5]&&e[2];return U.CHILD.test(e[0])?null:(e[4]?e[2]=e[4]:n&&z.test(n)&&(t=ft(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){return"*"===e?function(){return!0}:(e=e.replace(et,tt).toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[e+" "];return t||(t=RegExp("(^|"+_+")"+e+"("+_+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==A&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=st.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!u&&!s;if(m){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[x]||(m[x]={}),l=c[e]||[],d=l[0]===N&&l[1],f=l[0]===N&&l[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[N,d,f];break}}else if(v&&(l=(t[x]||(t[x]={}))[e])&&l[0]===N)f=l[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[x]||(p[x]={}))[e]=[N,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||st.error("unsupported pseudo: "+e);return r[x]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?ot(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=M.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:ot(function(e){var t=[],n=[],r=s(e.replace(W,"$1"));return r[x]?ot(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:ot(function(e){return function(t){return st(e,t).length>0}}),contains:ot(function(e){return function(t){return(t.textContent||t.innerText||o(t)).indexOf(e)>-1}}),lang:ot(function(e){return X.test(e||"")||st.error("unsupported lang: "+e),e=e.replace(et,tt).toLowerCase(),function(t){var n;do if(n=d?t.getAttribute("xml:lang")||t.getAttribute("lang"):t.lang)return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===f},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!i.pseudos.empty(e)},header:function(e){return Q.test(e.nodeName)},input:function(e){return G.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:pt(function(){return[0]}),last:pt(function(e,t){return[t-1]}),eq:pt(function(e,t,n){return[0>n?n+t:n]}),even:pt(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:pt(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:pt(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:pt(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}};for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})i.pseudos[n]=lt(n);for(n in{submit:!0,reset:!0})i.pseudos[n]=ct(n);function ft(e,t){var n,r,o,a,s,u,l,c=E[e+" "];if(c)return t?0:c.slice(0);s=e,u=[],l=i.preFilter;while(s){(!n||(r=$.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),u.push(o=[])),n=!1,(r=I.exec(s))&&(n=r.shift(),o.push({value:n,type:r[0].replace(W," ")}),s=s.slice(n.length));for(a in i.filter)!(r=U[a].exec(s))||l[a]&&!(r=l[a](r))||(n=r.shift(),o.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?st.error(e):E(e,u).slice(0)}function dt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function ht(e,t,n){var i=t.dir,o=n&&"parentNode"===i,a=C++;return t.first?function(t,n,r){while(t=t[i])if(1===t.nodeType||o)return e(t,n,r)}:function(t,n,s){var u,l,c,p=N+" "+a;if(s){while(t=t[i])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[i])if(1===t.nodeType||o)if(c=t[x]||(t[x]={}),(l=c[i])&&l[0]===p){if((u=l[1])===!0||u===r)return u===!0}else if(l=c[i]=[p],l[1]=e(t,n,s)||r,l[1]===!0)return!0}}function gt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function mt(e,t,n,r,i){var o,a=[],s=0,u=e.length,l=null!=t;for(;u>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),l&&t.push(s));return a}function yt(e,t,n,r,i,o){return r&&!r[x]&&(r=yt(r)),i&&!i[x]&&(i=yt(i,o)),ot(function(o,a,s,u){var l,c,p,f=[],d=[],h=a.length,g=o||xt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:mt(g,f,e,s,u),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,u),r){l=mt(y,d),r(l,[],s,u),c=l.length;while(c--)(p=l[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){l=[],c=y.length;while(c--)(p=y[c])&&l.push(m[c]=p);i(null,y=[],l,u)}c=y.length;while(c--)(p=y[c])&&(l=i?M.call(o,p):f[c])>-1&&(o[l]=!(a[l]=p))}}else y=mt(y===a?y.splice(h,y.length):y),i?i(null,a,y,u):H.apply(a,y)})}function vt(e){var t,n,r,o=e.length,a=i.relative[e[0].type],s=a||i.relative[" "],u=a?1:0,c=ht(function(e){return e===t},s,!0),p=ht(function(e){return M.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;o>u;u++)if(n=i.relative[e[u].type])f=[ht(gt(f),n)];else{if(n=i.filter[e[u].type].apply(null,e[u].matches),n[x]){for(r=++u;o>r;r++)if(i.relative[e[r].type])break;return yt(u>1&>(f),u>1&&dt(e.slice(0,u-1)).replace(W,"$1"),n,r>u&&vt(e.slice(u,r)),o>r&&vt(e=e.slice(r)),o>r&&dt(e))}f.push(n)}return gt(f)}function bt(e,t){var n=0,o=t.length>0,a=e.length>0,s=function(s,u,c,f,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,T=l,C=s||a&&i.find.TAG("*",d&&u.parentNode||u),k=N+=null==T?1:Math.random()||.1;for(w&&(l=u!==p&&u,r=n);null!=(h=C[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,u,c)){f.push(h);break}w&&(N=k,r=++n)}o&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,o&&b!==v){g=0;while(m=t[g++])m(x,y,u,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=L.call(f));y=mt(y)}H.apply(f,y),w&&!s&&y.length>0&&v+t.length>1&&st.uniqueSort(f)}return w&&(N=k,l=T),x};return o?ot(s):s}s=st.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=ft(e)),n=t.length;while(n--)o=vt(t[n]),o[x]?r.push(o):i.push(o);o=S(e,bt(i,r))}return o};function xt(e,t,n){var r=0,i=t.length;for(;i>r;r++)st(e,t[r],n);return n}function wt(e,t,n,r){var o,a,u,l,c,p=ft(e);if(!r&&1===p.length){if(a=p[0]=p[0].slice(0),a.length>2&&"ID"===(u=a[0]).type&&9===t.nodeType&&!d&&i.relative[a[1].type]){if(t=i.find.ID(u.matches[0].replace(et,tt),t)[0],!t)return n;e=e.slice(a.shift().value.length)}o=U.needsContext.test(e)?0:a.length;while(o--){if(u=a[o],i.relative[l=u.type])break;if((c=i.find[l])&&(r=c(u.matches[0].replace(et,tt),V.test(a[0].type)&&t.parentNode||t))){if(a.splice(o,1),e=r.length&&dt(a),!e)return H.apply(n,q.call(r,0)),n;break}}}return s(e,p)(r,t,d,n,V.test(e)),n}i.pseudos.nth=i.pseudos.eq;function Tt(){}i.filters=Tt.prototype=i.pseudos,i.setFilters=new Tt,c(),st.attr=b.attr,b.find=st,b.expr=st.selectors,b.expr[":"]=b.expr.pseudos,b.unique=st.uniqueSort,b.text=st.getText,b.isXMLDoc=st.isXML,b.contains=st.contains}(e);var at=/Until$/,st=/^(?:parents|prev(?:Until|All))/,ut=/^.[^:#\[\.,]*$/,lt=b.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};b.fn.extend({find:function(e){var t,n,r,i=this.length;if("string"!=typeof e)return r=this,this.pushStack(b(e).filter(function(){for(t=0;i>t;t++)if(b.contains(r[t],this))return!0}));for(n=[],t=0;i>t;t++)b.find(e,this[t],n);return n=this.pushStack(i>1?b.unique(n):n),n.selector=(this.selector?this.selector+" ":"")+e,n},has:function(e){var t,n=b(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(b.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e,!1))},filter:function(e){return this.pushStack(ft(this,e,!0))},is:function(e){return!!e&&("string"==typeof e?lt.test(e)?b(e,this.context).index(this[0])>=0:b.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,o=[],a=lt.test(e)||"string"!=typeof e?b(e,t||this.context):0;for(;i>r;r++){n=this[r];while(n&&n.ownerDocument&&n!==t&&11!==n.nodeType){if(a?a.index(n)>-1:b.find.matchesSelector(n,e)){o.push(n);break}n=n.parentNode}}return this.pushStack(o.length>1?b.unique(o):o)},index:function(e){return e?"string"==typeof e?b.inArray(this[0],b(e)):b.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?b(e,t):b.makeArray(e&&e.nodeType?[e]:e),r=b.merge(this.get(),n);return this.pushStack(b.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),b.fn.andSelf=b.fn.addBack;function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}b.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(e,t,n){return b.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(e,t,n){return b.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return b.dir(e,"previousSibling",n)},siblings:function(e){return b.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return b.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:b.merge([],e.childNodes)}},function(e,t){b.fn[e]=function(n,r){var i=b.map(this,t,n);return at.test(e)||(r=n),r&&"string"==typeof r&&(i=b.filter(r,i)),i=this.length>1&&!ct[e]?b.unique(i):i,this.length>1&&st.test(e)&&(i=i.reverse()),this.pushStack(i)}}),b.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),1===t.length?b.find.matchesSelector(t[0],e)?[t[0]]:[]:b.find.matches(e,t)},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!b(o).is(r)))1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function ft(e,t,n){if(t=t||0,b.isFunction(t))return b.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return b.grep(e,function(e){return e===t===n});if("string"==typeof t){var r=b.grep(e,function(e){return 1===e.nodeType});if(ut.test(t))return b.filter(t,r,!n);t=b.filter(t,r)}return b.grep(e,function(e){return b.inArray(e,t)>=0===n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/\s*$/g,At={option:[1,""],legend:[1,"
      ","
      "],area:[1,"",""],param:[1,"",""],thead:[1,"","
      "],tr:[2,"","
      "],col:[2,"","
      "],td:[3,"","
      "],_default:b.support.htmlSerialize?[0,"",""]:[1,"X
      ","
      "]},jt=dt(o),Dt=jt.appendChild(o.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,b.fn.extend({text:function(e){return b.access(this,function(e){return e===t?b.text(this):this.empty().append((this[0]&&this[0].ownerDocument||o).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(b.isFunction(e))return this.each(function(t){b(this).wrapAll(e.call(this,t))});if(this[0]){var t=b(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return b.isFunction(e)?this.each(function(t){b(this).wrapInner(e.call(this,t))}):this.each(function(){var t=b(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=b.isFunction(e);return this.each(function(n){b(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){b.nodeName(this,"body")||b(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.insertBefore(e,this.firstChild)})},before:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=0;for(;null!=(n=this[r]);r++)(!e||b.filter(e,[n]).length>0)&&(t||1!==n.nodeType||b.cleanData(Ot(n)),n.parentNode&&(t&&b.contains(n.ownerDocument,n)&&Mt(Ot(n,"script")),n.parentNode.removeChild(n)));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&b.cleanData(Ot(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&b.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return b.clone(this,e,t)})},html:function(e){return b.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!b.support.htmlSerialize&&mt.test(e)||!b.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(b.cleanData(Ot(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){var t=b.isFunction(e);return t||"string"==typeof e||(e=b(e).not(this).detach()),this.domManip([e],!0,function(e){var t=this.nextSibling,n=this.parentNode;n&&(b(this).remove(),n.insertBefore(e,t))})},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=f.apply([],e);var i,o,a,s,u,l,c=0,p=this.length,d=this,h=p-1,g=e[0],m=b.isFunction(g);if(m||!(1>=p||"string"!=typeof g||b.support.checkClone)&&Ct.test(g))return this.each(function(i){var o=d.eq(i);m&&(e[0]=g.call(this,i,n?o.html():t)),o.domManip(e,n,r)});if(p&&(l=b.buildFragment(e,this[0].ownerDocument,!1,this),i=l.firstChild,1===l.childNodes.length&&(l=i),i)){for(n=n&&b.nodeName(i,"tr"),s=b.map(Ot(l,"script"),Ht),a=s.length;p>c;c++)o=l,c!==h&&(o=b.clone(o,!0,!0),a&&b.merge(s,Ot(o,"script"))),r.call(n&&b.nodeName(this[c],"table")?Lt(this[c],"tbody"):this[c],o,c);if(a)for(u=s[s.length-1].ownerDocument,b.map(s,qt),c=0;a>c;c++)o=s[c],kt.test(o.type||"")&&!b._data(o,"globalEval")&&b.contains(u,o)&&(o.src?b.ajax({url:o.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):b.globalEval((o.text||o.textContent||o.innerHTML||"").replace(St,"")));l=i=null}return this}});function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function Ht(e){var t=e.getAttributeNode("type");return e.type=(t&&t.specified)+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function Mt(e,t){var n,r=0;for(;null!=(n=e[r]);r++)b._data(n,"globalEval",!t||b._data(t[r],"globalEval"))}function _t(e,t){if(1===t.nodeType&&b.hasData(e)){var n,r,i,o=b._data(e),a=b._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)b.event.add(t,n,s[n][r])}a.data&&(a.data=b.extend({},a.data))}}function Ft(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!b.support.noCloneEvent&&t[b.expando]){i=b._data(t);for(r in i.events)b.removeEvent(t,r,i.handle);t.removeAttribute(b.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),b.support.html5Clone&&e.innerHTML&&!b.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Nt.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){b.fn[e]=function(e){var n,r=0,i=[],o=b(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),b(o[r])[t](n),d.apply(i,n.get());return this.pushStack(i)}});function Ot(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||b.nodeName(o,n)?s.push(o):b.merge(s,Ot(o,n));return n===t||n&&b.nodeName(e,n)?b.merge([e],s):s}function Bt(e){Nt.test(e.type)&&(e.defaultChecked=e.checked)}b.extend({clone:function(e,t,n){var r,i,o,a,s,u=b.contains(e.ownerDocument,e);if(b.support.html5Clone||b.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(b.support.noCloneEvent&&b.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||b.isXMLDoc(e)))for(r=Ot(o),s=Ot(e),a=0;null!=(i=s[a]);++a)r[a]&&Ft(i,r[a]);if(t)if(n)for(s=s||Ot(e),r=r||Ot(o),a=0;null!=(i=s[a]);a++)_t(i,r[a]);else _t(e,o);return r=Ot(o,"script"),r.length>0&&Mt(r,!u&&Ot(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,u,l,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===b.type(o))b.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),u=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[u]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!b.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!b.support.tbody){o="table"!==u||xt.test(o)?""!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)b.nodeName(l=o.childNodes[i],"tbody")&&!l.childNodes.length&&o.removeChild(l) +}b.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),b.support.appendChecked||b.grep(Ot(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===b.inArray(o,r))&&(a=b.contains(o.ownerDocument,o),s=Ot(f.appendChild(o),"script"),a&&Mt(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,u=b.expando,l=b.cache,p=b.support.deleteExpando,f=b.event.special;for(;null!=(n=e[s]);s++)if((t||b.acceptData(n))&&(o=n[u],a=o&&l[o])){if(a.events)for(r in a.events)f[r]?b.event.remove(n,r):b.removeEvent(n,r,a.handle);l[o]&&(delete l[o],p?delete n[u]:typeof n.removeAttribute!==i?n.removeAttribute(u):n[u]=null,c.push(o))}}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+x+")(.*)$","i"),Yt=RegExp("^("+x+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+x+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--)if(t=en[i]+n,t in e)return t;return r}function nn(e,t){return e=t||e,"none"===b.css(e,"display")||!b.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=b._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=b._data(r,"olddisplay",un(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&b._data(r,"olddisplay",i?n:b.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}b.fn.extend({css:function(e,n){return b.access(this,function(e,n,r){var i,o,a={},s=0;if(b.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=b.css(e,n[s],!1,o);return a}return r!==t?b.style(e,n,r):b.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){var t="boolean"==typeof e;return this.each(function(){(t?e:nn(this))?b(this).show():b(this).hide()})}}),b.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":b.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,u=b.camelCase(n),l=e.style;if(n=b.cssProps[u]||(b.cssProps[u]=tn(l,u)),s=b.cssHooks[n]||b.cssHooks[u],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:l[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(b.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||b.cssNumber[u]||(r+="px"),b.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(l[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{l[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,u=b.camelCase(n);return n=b.cssProps[u]||(b.cssProps[u]=tn(e.style,u)),s=b.cssHooks[n]||b.cssHooks[u],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||b.isNumeric(o)?o||0:a):a},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s.getPropertyValue(n)||s[n]:t,l=e.style;return s&&(""!==u||b.contains(e.ownerDocument,e)||(u=b.style(e,n)),Yt.test(u)&&Ut.test(n)&&(i=l.width,o=l.minWidth,a=l.maxWidth,l.minWidth=l.maxWidth=l.width=u,u=s.width,l.width=i,l.minWidth=o,l.maxWidth=a)),u}):o.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s[n]:t,l=e.style;return null==u&&l&&l[n]&&(u=l[n]),Yt.test(u)&&!zt.test(n)&&(i=l.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),l.left="fontSize"===n?"1em":u,u=l.pixelLeft+"px",l.left=i,a&&(o.left=a)),""===u?"auto":u});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&(a+=b.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=b.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=b.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=b.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=b.css(e,"border"+Zt[o]+"Width",!0,i)));return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i))return i;r=a&&(b.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function un(e){var t=o,n=Gt[e];return n||(n=ln(e,t),"none"!==n&&n||(Pt=(Pt||b("