1(function( $ ) { 2 3 var currentUri = new URI(); 4 var currentSearch = currentUri.search(true); 5 var contextModal = currentSearch['ctx_modal']; 6 var initialRolesSetting = currentSearch['role']; 7 var initialTopicSetting = currentSearch['topic']; 8 9 if (!initialRolesSetting) { 10 var currentPathName = currentUri.pathname(); 11 12 var newPathName = null; 13 14 if (currentPathName == '/contact-camps/') { 15 newPathName = '/contact/'; 16 } else if (currentPathName == '/contact-competitions/') { 17 newPathName = '/contact/'; 18 } else if (currentPathName == '/contact-fashion/') { 19 newPathName = '/contact/'; 20 } 21 if (newPathName) { 22 location.href = currentUri.pathname(newPathName).toString(); 23 return; 24 } 25 } 26 27 function getElementRoles(element) { 28 var elementValue = $(element).data('roles'); 29 if (!elementValue) { 30 elementValue = []; 31 } else { 32 elementValue = elementValue.split(','); 33 } 34 return elementValue; 35 } 36 37 function getElementTopics(element) { 38 var elementValue = $(element).data('topics'); 39 if (!elementValue) { 40 elementValue = []; 41 } else { 42 elementValue = elementValue.split(','); 43 } 44 return elementValue; 45 } 46 47 $("[data-roles], [data-topics]").each(function(){ 48 49 var elementRoles = getElementRoles(this); 50 var elementTopics = getElementTopics(this); 51 52 var expectedRole = initialRolesSetting || 'all'; 53 var expectedTopic = initialTopicSetting || 'all'; 54 55 var keep = false; 56 57 if (elementRoles.length > 0 && elementTopics.length > 0) { 58 keep = elementRoles.indexOf(expectedRole) >= 0 && elementTopics.indexOf(expectedTopic) >= 0; 59 } else if (elementRoles.length > 0) { 60 keep = elementRoles.indexOf(expectedRole) >= 0; 61 } else if (elementTopics.length > 0) { 62 keep = elementTopics.indexOf(expectedTopic) >= 0; 63 } 64 65 if (keep) { 66 $(this).removeClass('brand-contact-start-hidden'); 67 } else { 68 $(this).remove(); 69 } 70 }); 71 72 $(document).ready(function() { 73 var selectedRole = null; 74 var selectedTopic = null; 75 76 var pageMapping = { 77 'fashion' : { 78 'url': '/contact-fashion/', 79 'varientUrl': true 80 }, 81 'competitions': { 82 'url': '/contact-competitions/', 83 'varientUrl': true 84 }, 85 'camps': { 86 'url': '/contact-camps/', 87 'varientUrl': true 88 }, 89 'varsity-tv': { 90 'url': 'https://flosports.tv/contact', 91 'external': true 92 }, 93 'shop': { 94 'url': 'https://shop.varsity.com/pages/contact-us?utm_source=website&utm_medium=shop&utm_campaign=shop-24shop-24', 95 'external': true 96 }, 97 'special-events' : { 98 'url': '/contact/', 99 'varientUrl': true 100 }, 101 'performing-arts': { 102 'url': '/contact-performing-arts/' 103 }, 104 'media-contact': { 105 'url': '/media-contact/' 106 }, 107 'other': { 108 'url': '/contact/', 109 'varientUrl': true 110 } 111 }; 112 function youthRecCoachSelector(selectedRole,selectedTopic){ 113 if (selectedTopic=="fashion"){ 114 location.href = URI() 115 .pathname('/contact-fashion/') 116 .hash('') 117 .query({ 118 role: selectedRole, 119 topic: selectedTopic 120 }) 121 .toString(); 122 }else if (selectedTopic=="camps"){ 123 location.href = URI() 124 .pathname('/contact-camps/') 125 .hash('') 126 .query({ 127 role: selectedRole, 128 topic: selectedTopic 129 }) 130 .toString(); 131 }else if (selectedTopic=="performing-arts"){ 132 location.href = URI() 133 .pathname('/contact-performing-arts/') 134 .hash('') 135 .query({ 136 role: selectedRole, 137 topic: selectedTopic 138 }) 139 .toString(); 140 }else if (selectedTopic=="media-contact"){ 141 location.href = URI() 142 .pathname('/media-contact/') 143 .hash('') 144 .query({ 145 role: selectedRole, 146 topic: selectedTopic 147 }) 148 .toString(); 149 }else{ 150 location.href = URI() 151 .pathname('/contact-youth-rec-coach/') 152 .hash('') 153 .query({ 154 role: selectedRole, 155 topic: selectedTopic 156 }) 157 .toString(); 158 } 159 } 160 function navigateToForm() { 161 var page = pageMapping[selectedTopic]; 162 if (page) { 163 if (page.external) { 164 window.open(page.url, '_blank'); 165 $.modal.close(); 166 selectedRole = null; 167 selectedTopic = null; 168 } else if (page.varientUrl) { 169 if(selectedRole === 'recreation-coach') { 170 youthRecCoachSelector(selectedRole,selectedTopic); 171 172 }else{ 173 location.href = URI() 174 .pathname(page.url) 175 .hash('') 176 .query({ 177 role: selectedRole, 178 topic: selectedTopic 179 }) 180 .toString(); 181 } 182 } else { 183 if(selectedRole === 'recreation-coach') { 184 youthRecCoachSelector(selectedRole,selectedTopic); 185 }else { 186 location.href = URI() 187 .pathname(page.url) 188 .hash('') 189 .query({ 190 role: selectedRole, 191 topic: selectedTopic 192 }) 193 .toString(); 194 } 195 } 196 } 197 } 198 199 function openModal(id, fade) { 200 201 var args = { 202 showClose: false 203 }; 204 205 if (fade) { 206 args.fadeDuration = 250; 207 args.fadeDelay = 0.5; 208 } 209 210 $(id).modal(args); 211 if (fade) { 212 $(id).find('.go-back').hide(); 213 } else { 214 $(id).find('.go-back').show(); 215 } 216 } 217 218 function smartOpenModal(localRole, localTopic) { 219 selectedRole = localRole || selectedRole; 220 selectedTopic = localTopic || selectedTopic; 221 222 if (selectedRole && selectedTopic) { 223 navigateToForm(); 224 return; 225 } else if (selectedRole) { 226 openModal('#contact-modal-two', true); 227 return; 228 } 229 230 openModal('#contact-modal-one', true); 231 } 232 233 $('.modal-contact a').click(function(e) { 234 e.stopPropagation(); 235 e.preventDefault(); 236 237 smartOpenModal(null, null); 238 return false;
239 }); 240 241 $('a[data-modal="contact"]').click(function(e){ 242 e.stopPropagation(); 243 e.preventDefault(); 244 245 var localRole = $(this).data('contact-role'); 246 var localTopic = $(this).data('contact-topic'); 247 248 smartOpenModal(localRole, localTopic); 249 return false; 250 }); 251 252 253 $(".contact-role").click(function(e){ 254 e.stopPropagation(); 255 e.preventDefault(); 256 257 var localRole = $(this).data('role'); 258 smartOpenModal(localRole, null); 259 return false; 260 }); 261 262 $(".contact-topic").click(function(e){ 263 e.stopPropagation(); 264 e.preventDefault(); 265 266 var localTopic = $(this).data('topic'); 267 268 smartOpenModal(null, localTopic); 269 return false; 270 }); 271 272 $(".contact-modal .close-modal").click(function(){ 273 selectedRole = null; 274 selectedTopic = null; 275 }); 276 277 if (contextModal == 'contact') { 278 smartOpenModal(initialRolesSetting, initialTopicSetting); 279 } 280 }); 281}(jQuery));
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.