1/* <![CDATA[ */ 2(function($){ 3 4 "use strict"; 5 6 $(document).ready(function(){ 7 8 /* Helper Functions 9 ================================================== */ 10 function create_id() { 11 return '-' + Math.random().toString(36).substr(2, 9); 12 } 13 14 /* FitVid 15 ================================================== */ 16 $(".ut-video").fitVids(); 17 18 19 /* United Video Player 20 ================================================== */ 21 function ut_load_video_player(url, uniqueID, $parent, callback){ 22 23 if( !url ) { 24 return; 25 } 26 27 var ajaxURL = utShortcode.ajaxurl, 28 $video = $('<div id="ut-video'+uniqueID+'"></div>'), 29 $caption = $parent.find('.ut-video-caption-text'); 30 31 $.ajax({ 32 33 type: 'POST', 34 url: ajaxURL, 35 data: {"action": "ut_get_video_player", "video" : url }, 36 success: function(response) { 37 38 $video.html(response).fitVids(); 39 $parent.html( $video.append($caption) ); 40 41 return false; 42 43 }, 44 complete : function() { 45 46 if (callback && typeof(callback) === "function") { 47 callback(); 48 } 49 50 } 51 52 }); 53 54 } 55 56 57 /* Video Testimonials Player Call ( Lightbox ) 58 ================================================== */ 59 60 function ut_load_video_player_lightbox(url, uniqueID, callback){ 61 62 if( !url ) { 63 return; 64 } 65 66 var ajaxURL = utShortcode.ajaxurl; 67 68 $.ajax({
69 70 type: 'POST', 71 url: ajaxURL, 72 data: {"action": "ut_get_video_player", "video" : url }, 73 success: function(response) { 74 $('#ut-video-testimonial'+uniqueID).hide().html(response).fitVids().show("fast"); 75 return false; 76 }, 77 complete : function() { 78 79 if (callback && typeof(callback) === "function") { 80 callback(); 81 } 82 83 } 84 85 }); 86 87 } 88 89 function create_unique_prettyphoto(url,$testimonial) { 90 91 if( !url ) { 92 return; 93 } 94 95 var uniqueID = create_id(), 96 div = '<div id="ut-video-testimonial'+uniqueID+'"></div>'; 97 98 $testimonial.prettyPhoto({ 99 custom_markup: div, 100 allow_resize: true, 101 social_tools: '', 102 changepicturecallback: function(){ 103 ut_load_video_player_lightbox(url, uniqueID, function() { 104 105 }); 106 } 107 }); 108 109 } 110 111 $(document).on('click', '.ut-load-video', function(event) { 112 113 var url = $(this).data('video'), 114 uniqueID = create_id(), 115 $parent = $(this).parent('.ut-video-caption'), 116 $loader = $parent.next('.ut-video-loading'); 117 118 $loader.fadeIn(); 119 120 ut_load_video_player(url, uniqueID, $parent, function() { 121 $loader.fadeOut(); 122 }); 123 124 event.preventDefault(); 125 }); 126 127 $(".ut-load-vtestimonial").each(function(){ 128 129 var url = $(this).find('div').html(); 130 create_unique_prettyphoto(url,$(this)); 131 132 }); 133 134 /* Animated Skillbar 135 ================================================== */ 136 $(".ut-skill-active").each(function(i, el){ 137 138 var el = $(el), 139 bar_width = el.data('width'); 140 141 if ( el.visible(true) && !el.hasClass('ut-already-visible') ) { 142 143 el.stop(true, true).animate({width : bar_width+"%"} , 1000 ); 144 145 el.addClass('ut-already-visible'); 146 147 } 148 149 }); 150 151 /* Milestone Counter - animate when visible on load 152 ================================================== */ 153 $('.ut-counter').each(function(i, el){ 154 155 var counter = $(el).data('counter'); 156 157 if ( $(el).visible(true) && !$(el).hasClass('ut-already-counted') ) { 158 159 setTimeout ( function () { 160 161 $(el).addClass('ut-already-counted'); 162 163 $(el).find('.ut-count').countTo({ 164 from: 0, 165 to: counter, 166 speed: 2000, 167 refreshInterval: 100 168 }); 169 170 }, 1000 ); 171 172 } 173 174 }); 175 176 177 var win = $(window), 178 allMods = $(".ut-animate-image, .ut-counter, .ut-skill-active"); 179 180 /* element effects 181 ================================================== */ 182 $('.ut-animate-element').appear(function() { 183 184 var effect = $(this).data('effect'); 185 186 $(this).delay(200).queue( function() { 187 188 $(this).removeClass('ut-animate-element').addClass( effect ); 189 190 }); 191 192 193 }); 194 195 /* Image already visible when page is loaded 196 ================================================== */ 197 $(".ut-animate-image").each(function(i, el) { 198 199 if ($(el).visible(true)) { 200 201 var el = $(el), 202 effecttype = el.data('effecttype'); 203 204 if( effecttype === 'image' ) { 205 206 var effect = el.data('effect'); 207 208 if ( el.visible(true) ) { 209 210 el.addClass( effect ); 211 212 } else { 213 214 el.removeClass( effect + " ut-already-visible" ); 215 216 } 217 218 219 } 220 221 } 222 223 }); 224 225
226 /* Run Site Effect Animation 227 ================================================== */ 228 win.scroll( function(event) { 229 230 allMods.each(function(i, el) { 231 232 var el = $(el), 233 effecttype = el.data('effecttype'); 234 235 if( effecttype === 'image' ) { 236 237 var effect = el.data('effect'); 238 239 if ( el.visible(true) && !el.hasClass( effect ) ) { 240 241 el.addClass( effect ); 242 243 } else if( !el.visible(true) ) { 244 245 el.removeClass( effect ); 246 247 } 248 249 } 250 251 if( effecttype === 'skillbar' ) { 252 253 var bar_width = el.data('width'); 254 255 if ( el.visible(true) && !el.hasClass('ut-already-visible') ) { 256 257 el.addClass("ut-already-visible"); 258 el.stop(true, true).animate({width : bar_width+"%"} , 1000 ); 259 260 } else if( !el.visible(true) ) { 261 262 el.removeClass("ut-already-visible"); 263 el.css("width" , 0); 264 265 } 266 267 } 268 269 if( effecttype === 'counter') { 270 271 var counter = el.data('counter'); 272 273 if ( el.visible(true) && !$(el).hasClass('ut-already-counted') ) { 274 275 el.addClass('ut-already-counted'); 276 277 el.find('.ut-count').countTo({ 278 from: 0, 279 to: counter, 280 speed: 2000, 281 refreshInterval: 100 282 }); 283 284 } 285 286 } 287 288 }); 289 290 }); 291 292 }); 293 294 295 $.fn.countTo = function (options) { 296 options = options || {}; 297 298 return $(this).each(function () { 299 // set options for current element 300 var settings = $.extend({}, $.fn.countTo.defaults, { 301 from: $(this).data('from'), 302 to: $(this).data('to'), 303 speed: $(this).data('speed'), 304 refreshInterval: $(this).data('refresh-interval'), 305 decimals: $(this).data('decimals') 306 }, options); 307 308 // how many times to update the value, and how much to increment the value on each update 309 var loops = Math.ceil(settings.speed / settings.refreshInterval), 310 increment = (settings.to - settings.from) / loops; 311 312 // references & variables that will change with each update 313 var self = this, 314 $self = $(this), 315 loopCount = 0, 316 value = settings.from, 317 data = $self.data('countTo') || {}; 318 319 $self.data('countTo', data); 320 321 // if an existing interval can be found, clear it first 322 if (data.interval) { 323 clearInterval(data.interval); 324 } 325 data.interval = setInterval(updateTimer, settings.refreshInterval); 326 327 // initialize the element with the starting value 328 render(value); 329 330 function updateTimer() { 331 value += increment; 332 loopCount++; 333 334 render(value); 335
336 if (typeof(settings.onUpdate) == 'function') { 337 settings.onUpdate.call(self, value); 338 } 339 340 if (loopCount >= loops) { 341 // remove the interval 342 $self.removeData('countTo'); 343 clearInterval(data.interval); 344 value = settings.to; 345 346 if (typeof(settings.onComplete) == 'function') { 347 settings.onComplete.call(self, value); 348 } 349 } 350 } 351 352 function render(value) { 353 var formattedValue = settings.formatter.call(self, value, settings); 354 $self.html(formattedValue); 355 } 356 }); 357 }; 358 359 $.fn.countTo.defaults = { 360 from: 0, // the number the element should start at 361 to: 0, // the number the element should end at 362 speed: 1000, // how long it should take to count between the target numbers 363 refreshInterval: 100, // how often the element should be updated 364 decimals: 0, // the number of decimal places to show 365 formatter: formatter, // handler for formatting the value before rendering 366 onUpdate: null, // callback method for every time the element is updated 367 onComplete: null // callback method for when the element finishes updating 368 }; 369 370 function formatter(value, settings) { 371 return value.toFixed(settings.decimals); 372 } 373 374 375})(jQuery); 376 /* ]]> */
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.