1$(document).ready(function () { 2 initSwitchLang(); 3 initWebflowTab(); 4 initCalendar(); 5 initCalendarDay(); 6 initFilterCoach(); 7 initFilterEventYear(); 8 initFilterPressreleaseYear(); 9 initSubscription(); 10 initOnlineEnquiry(); 11}); 12 13function scrollToElemTop($elem, time) { 14 $('html, body').animate( 15 { 'scrollTop': $elem.offset().top } 16 , time || 1000 17 , $('html, body').stop().finish); 18} 19 20 21function initSwitchLang() { 22 var switchLang = function (s, t) { 23 window.location.href = window.location.href.replace("/" + s + "/", "/" + t + "/"); 24 }; 25 $(".switch-lang").click(function () { 26 switchLang($(this).data("from"), $(this).data("to")); 27 }); 28} 29 30function initWebflowTab() { 31 var refreshHash = function () { 32 var i = window.location.href.indexOf("#") + 1; 33 if (i) { 34 var $wtablink = $(".w-tab-link[data-w-tab='" + window.location.href.substr(i) + "']"); 35 $wtablink.click(); 36 scrollToElemTop($wtablink.closest(".w-tab-menu")); 37 } 38 }; 39 40 window.addEventListener("hashchange", refreshHash); 41 refreshHash(); 42 43 $(".w-tab-link").click(function () { 44 window.location.href = "#" + $(this).data("w-tab"); 45 }); 46} 47 48function initCalendar() { 49 50 return; 51 52 var $arror_left = $(".home_open_hour_calender_arrow.w-slider-arrow-left"); 53 var $arror_right = $(".home_open_hour_calender_arrow.w-slider-arrow-right"); 54 55 $arror_left.add($arror_right).click(function (e) { 56 if ($(this).hasClass("disabled")) { 57 e.preventDefault(); 58 } else { 59 setTimeout(function () { 60 if ($arror_left.css("display") == "none") { 61 $arror_left.addClass("disabled"); 62 $arror_left.show(); 63 } else { 64 $arror_left.removeClass("disabled"); 65 } 66 }, 0); 67 } 68 }); 69 70 71 var now = moment(); 72 var today = now.format("YYYY-M-D"); 73 74 var dw_list = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"]; 75 76 var i = 0; 77 $(".calendar_block").each(function () { 78 var $calendar_block = $(this); 79 var date = now.clone().startOf('month').add(i++, 'M'); 80 var month = date.format("M"); 81 var dw = date.format("E"); 82 83 var d = date.clone().add(dw != 7 ? -1 * dw : 0, 'D'); 84 var that_month = d.format("M") == month; 85 86 var $calendar_month = $calendar_block.find(".calendar_month"); 87 $calendar_month.find("div").html(date.format("MMM YYYY")); 88 89 var $calendar_block_inside = $calendar_block.find(".calendar_block_inside"); 90 do { 91 92 var $calendar_row = $("<div class='calendar_row'></div>"); 93 $calendar_block_inside.append($calendar_row); 94 95 dw_list.forEach(function (dw) { 96 var dtext = d.format("YYYY-M-D"); 97 98 var $div = $("<div class='calendar_day date'><div>" + d.format("D") + "</div></div>"); 99 $div.data("date", dtext); 100 $div.data("week", dw); 101 dtext == today && $div.addClass("today"); 102 !that_month && $div.addClass("not_that_month"); 103 $calendar_row.append($div); 104 105 d.add(1, "D"); 106 that_month = d.format("M") == month; 107 108 }); 109 } while (that_month); 110 111 }); 112} 113 114function initCalendarDay() { 115 $(".calendar_day.date:not(.not_that_month)").click(function () { 116 var $this = $(this); 117 $(".calendar_day.today").removeClass("today"); 118 $this.addClass("today"); 119 var date = $this.data("date"); 120 var week = $this.data("week"); 121 $(".home_open_hour_right").hide(); 122 var list = [date, "every_" + week]; 123 124 var $div = $(".home_open_hour_right[data-name='" + date + "']"); 125 if (!$div.length) $div = $(".home_open_hour_right[data-name='every_" + week + "']"); 126 $div.show(); 127 }); 128} 129 130function initFilterCoach() { 131 var filterCoach = function () { 132 var text = $(".school_2_search_input").val().toLowerCase(); 133 $(".school_3_coach_block").each(function () { 134 var $this = $(this); 135 if ($this.data("title").indexOf(text) !== -1) { 136 $this.show(); 137 } else { 138 $this.hide(); 139 } 140 }); 141 }; 142 $(".school_2_search_input").keypress(filterCoach); 143 $(".school_2_search_input").change(filterCoach); 144} 145 146function initFilterEventYear() { 147 var filterEventYear = function (year) { 148 149 $(".events_offers_block.event").each(function () { 150 var $this = $(this); 151 if (year === "all" || ($this.data("from") <= year && year <= $this.data("to"))) { 152 $this.show(); 153 } else { 154 $this.hide(); 155 } 156 }); 157 $(".events_offers_list_year_label").html(year === "all" ? $(".events_offers_list_year_label_all").html() : year); 158 }; 159 $(".events_offers_list_year_btn").click(function () { 160 filterEventYear($(this).data("year")); 161 });
162} 163 164function initFilterPressreleaseYear() { 165 var filterPressreleaseYear = function (year) { 166 $(".press_room_list_block").each(function () { 167 var $this = $(this); 168 if (year === "all" || !$this.data("year") || ($this.data("year") == year)) { 169 $this.show(); 170 } else { 171 $this.hide(); 172 } 173 }); 174 $(".pressrelease_list_year_label").html(year === "all" ? $(".pressrelease_list_year_label_all").html() : year); 175 }; 176 177 $(".events_offers_list_year_btn").click(function () { 178 filterPressreleaseYear($(this).data("year")); 179 }); 180} 181 182 183function initSubscription() { 184 $(".subscription_form a.subscription").click(function () { 185 $(".w-form-fail").hide(); 186 var $form = $(".subscription_form"); 187 $.ajax({ 188 type: "POST", 189 url: "act-subscription/", 190 data: $form.serialize(), 191 dataType: 'json', 192 success: function (data) { 193 if (data.success) { 194 $.ajax({
195 type: "POST", 196 url: "https://gmkt-zcglf.maillist-manage.com/weboptin.zc", 197 data: $form.serialize(), 198 success: function () { 199 $(".w-form-done div").html(data.msg); 200 $(".w-form-done").fadeIn(200).show(); 201 $form.fadeOut(200).hide(); 202 }, 203 error: function () { 204 $(".w-form-fail div").html("Unknown Error. Please try later."); 205 $(".w-form-fail").fadeIn(200).show(); 206 } 207 }); 208 } 209 else { 210 $(".w-form-fail div").html(data.msg); 211 $(".w-form-fail").fadeIn(200).show(); 212 } 213 }, 214 error: function () { 215 $(".w-form-fail div").html("Unknown Error. Please try later."); 216 $(".w-form-fail").fadeIn(200).show(); 217 } 218 }); 219 }); 220} 221 222function initOnlineEnquiry() { 223 $(".subscription_form a.online_enquiry").click(function () { 224 $(".w-form-fail").hide(); 225 var $form = $(".subscription_form"); 226 $.ajax({
227 type: "POST", 228 url: "act-online-enquiry/", 229 data: $form.serialize(), 230 dataType: 'json', 231 success: function (data) { 232 if (data.success) { 233 $(".w-form-done div").html(data.msg); 234 $(".w-form-done").fadeIn(200).show(); 235 $form.fadeOut(200).hide(); 236 $(".contact_us_container").fadeOut(200).hide(); 237 } 238 else { 239 $(".w-form-fail div").html(data.msg); 240 $(".w-form-fail").fadeIn(200).show(); 241 } 242 }, 243 error: function () { 244 $(".w-form-fail div").html("Unknown Error. Please try later."); 245 $(".w-form-fail").fadeIn(200).show(); 246 } 247 }); 248 }); 249} 250
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.