1/** 2 * Yakety Yak 3 * ---------- 4 */ 5var YaketyYak = { 6 7 flashEnabled: null, 8 9 init: function() { 10 this.flashEnabled = false; 11 try { 12 var foo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash'); 13 if (foo) this.flashEnabled = true; 14 } catch(e) { 15 if (navigator.mimeTypes ["application/x-shockwave-flash"] != undefined) this.flashEnabled = true; 16 } 17 } 18}; 19YaketyYak.init(); 20 21/* HOME INDEX 22 * ---------- 23 */ 24var HomeIndex = { 25 26 $container: null, 27 28 // swf inclusion 29 attributes: null, 30 flashvars: null, 31 params: null, 32 swfPath: null, 33 34 init: function() { 35 36 // redirect to main listing 37 if ( ! YaketyYak.flashEnabled) { 38 // Flash lips splash screen replaced with static image. 39 // window.location.href = 'artists'; 40 } 41 42 // html 43 HomeIndex.$container = $('#index-container'); 44 45 // get settings for swf inclusion 46 HomeIndex.flashvars = {}; 47 HomeIndex.params = { wmode:"transparent" }; 48 HomeIndex.attributes = {}; 49 HomeIndex.swfPath = HomeIndex.$container.attr('data-swf'); 50 51 // load swf 52 swfobject.embedSWF(HomeIndex.swfPath, "index-container", "894", "423", "9.0.0", HomeIndex.swfPath, HomeIndex.flashvars, HomeIndex.params, HomeIndex.attributes); 53 } 54}; 55if ($('#index-container').length) { 56 HomeIndex.init(); 57} 58 59/* Main Menu 60 * --------- 61 * 62var MainMenu = { 63 64 $btnMainMenu: null, 65 $mainMenu: null, 66 67 init: function() { 68 MainMenu.$mainMenu = $('#main-menu'); 69 MainMenu.$bntMainMenu = $('.btn-mobile-menu'); 70 MainMenu.addListeners(); 71 }, 72 73 addListeners: function() { 74 MainMenu.$bntMainMenu.click(MainMenu.onMenuClicked); 75 MainMenu.$mainMenu.find('.has-sub').click(MainMenu.onMenuItemClicked); 76 }, 77 78 onMenuClicked: function(event) { 79 event.preventDefault(); 80 var $menu = MainMenu.$mainMenu.children('ul'); 81 if ($menu.css('display') === 'block') { 82 MainMenu.$mainMenu.children('ul').hide(); 83 } else { 84 MainMenu.$mainMenu.children('ul').show(); 85 } 86 }, 87 onMenuItemClicked: function(event) { 88 event.preventDefault(); 89 var $a = $(this); 90 91 console.log('here'); 92 93 // minimise 94 if ($a.closest('li').hasClass('active')) { 95 $a.closest('li').removeClass('active'); 96 } 97 // select other 98 else { 99 MainMenu.$mainMenu.find('.has-sub').closest('li').removeClass('active'); 100 $a.closest('li').addClass('active'); 101 } 102 103 // TODO: scrollTo active menu 104 } 105 106}; 107if ($('#main-menu').length > 0) { 108 MainMenu.init(); 109} 110*/ 111 112/** 113 * Mobile Menu 114 * ----------- 115 */ 116var MobileMenu = { 117 118 $btn: null, 119 $menu: null, 120 $menuContainer: null, 121 $siteContainer: null, 122 123 init: function() { 124 MobileMenu.$btn = $('.btn-mobile-menu'); 125 MobileMenu.$menu = $('#mobile-menu'); 126 MobileMenu.$menuContainer = $('#mobile-menu-container'); 127 MobileMenu.$siteContainer = $('#site-container'); 128 MobileMenu.enableListeners(); 129 }, 130 enableListeners: function() { 131 MobileMenu.$btn.unbind('click').click(MobileMenu.onMenuButtonClicked); 132 MobileMenu.$menu.find('.has-sub').click(MobileMenu.onItemClicked); 133 }, 134 onItemClicked: function(e) { 135 e.preventDefault(); 136 var $anchor = $(this); 137 var alreadyActive = $anchor.parents('li').hasClass('expand'); 138 MobileMenu.$menu.find('.expand').removeClass('expand'); 139 if ( ! alreadyActive) { 140 $anchor.parents('li').addClass('expand'); 141 $anchor.ScrollTo(); 142 } else { 143 MobileMenu.$menuContainer.ScrollTo(); 144 } 145 }, 146 onMenuButtonClicked: function(e) { 147 e.preventDefault(); 148 if (MobileMenu.$menuContainer.hasClass('active')) { 149 MobileMenu.$menuContainer.removeClass('active'); 150 MobileMenu.$siteContainer.removeClass('shift'); 151 } else { 152 MobileMenu.$menuContainer.addClass('active'); 153 MobileMenu.$siteContainer.addClass('shift'); 154 } 155 } 156 157} 158if ($('#mobile-menu').length > 0) { 159 MobileMenu.init(); 160} 161 162/* Artist Biography 163 * ---------------- 164 */ 165var ArtistBiography = { 166 167 // video listings 168 $moviesOverlay: null, 169 $moviesContainer: null, 170 $btnMoviesClose: null, 171 172 // video player 173 $videoContainer: null, 174 175 init: function() { 176 177 // listings 178 ArtistBiography.$moviesOverlay = $('#movies-backdrop'); 179 ArtistBiography.$moviesContainer = $('#movies-container'); 180 ArtistBiography.$btnMoviesClose = $('#btn-movies-close'); 181 182 // video player 183 ArtistBiography.$videoWindow = $('#video-window'); 184 ArtistBiography.$videoWindow.remove(); 185 186 // listeners 187 ArtistBiography.enableListeners(); 188 }, 189 enableListeners: function() { 190 // listings 191 ArtistBiography.$btnMovies.unbind('click').click(ArtistBiography.onMoviesOpenClicked); 192 ArtistBiography.$btnMoviesClose.unbind('click').click(ArtistBiography.onMoviesCloseClicked); 193 ArtistBiography.$moviesOverlay.unbind('click').click(ArtistBiography.onMoviesCloseClicked); 194 // video 195 ArtistBiography.$moviesContainer.find('.video-link').unbind('click').click(ArtistBiography.onVideoClicked); 196 }, 197 onMoviesCloseClicked: function(event) { 198 event.preventDefault(); 199 if (ArtistBiography.$moviesContainer.find('#video-window').length > 0) { 200 ArtistBiography.$moviesContainer.find('#video-window').fadeOut(function() { 201 ArtistBiography.$moviesContainer.find('#video-window').remove(); 202 ArtistBiography.$moviesOverlay.fadeOut(function() { 203 ArtistBiography.$moviesContainer.fadeOut(function() { 204 ArtistBiography.$moviesContainer.find('#movies-inner-container').show(); 205 }); 206 }); 207 }); 208 } else { 209 ArtistBiography.$moviesContainer.fadeOut(function() { 210 ArtistBiography.$moviesOverlay.fadeOut(); 211 }); 212 } 213 }, 214 215 onNextClicked: function(event) { 216 event.preventDefault(); 217 if (ArtistBiography.currentSlide + ArtistBiography.slidesInView < ArtistBiography.noOfSlides) { 218 ArtistBiography.$thumbsList.animate({ 219 left: '-=134' 220 }, ArtistBiography.slideSpeed); 221 ArtistBiography.currentSlide++; 222 223 ArtistBiography.$btnPrev.find('a').removeClass('inactive'); 224 if (ArtistBiography.currentSlide + ArtistBiography.slidesInView === ArtistBiography.noOfSlides) { 225 ArtistBiography.$btnNext.find('a').addClass('inactive'); 226 } 227 } 228 }, 229 onPrevClicked: function(event) { 230 event.preventDefault(); 231 if (ArtistBiography.currentSlide - 1 >= 0) { 232 ArtistBiography.$thumbsList.animate({ 233 left: '+=134' 234 }, ArtistBiography.slideSpeed); 235 ArtistBiography.currentSlide--; 236 237 ArtistBiography.$btnNext.find('a').removeClass('inactive'); 238 if (ArtistBiography.currentSlide === 0) { 239 ArtistBiography.$btnPrev.find('a').addClass('inactive'); 240 } 241 } 242 }, 243 244 onVideoClicked: function(event) { 245 event.preventDefault(); 246 var $newVideoWindow = ArtistBiography.$videoWindow.clone(); 247 ArtistBiography.setupVideo($newVideoWindow, $(this)); 248 ArtistBiography.$moviesContainer.append($newVideoWindow); 249 ArtistBiography.$moviesContainer.find('#movies-inner-container').fadeOut(function() { 250 $newVideoWindow.fadeIn(); 251 ArtistBiography.initMediaElement($newVideoWindow); 252 $newVideoWindow.find('#btn-close-video').unbind('click').click(ArtistBiography.onVideoCloseClicked); 253 }); 254 }, 255 onVideoCloseClicked: function(event) { 256 event.preventDefault(); 257 ArtistBiography.$moviesContainer.find('#video-window').fadeOut(function() { 258 ArtistBiography.$moviesContainer.find('#video-window').remove(); 259 ArtistBiography.$moviesContainer.find('#movies-inner-container').fadeIn(); 260 }); 261 }, 262 setupVideo: function($videoWindow, $videoLink) { 263 $videoWindow.find('.video-description').text($videoLink.find('img').attr('alt')); 264 $videoWindow.find('source[type="video/mp4"]').attr('src', $videoLink.attr('data-mp4')); 265 $videoWindow.find('source[type="video/ogg"]').attr('src', $videoLink.attr('data-ogv')); 266 $videoWindow.find('source[type="video/webm"]').attr('src', $videoLink.attr('data-webm')); 267 $videoWindow.find('param[name="flashvars"]').attr('value', 'controls=true&file=' + $videoLink.attr('data-mp4')); 268 }, 269 initMediaElement: function($videoWindow) { 270 $videoWindow.find('video').mediaelementplayer({ 271 plugins: ['flash', 'silverlight'], 272 // when this player starts, it will pause other players 273 pauseOtherPlayers: true, 274 success: function(mediaElement, domObject) { 275 mediaElement.play(); 276 }, 277 error: function() {} 278 }); 279 } 280}; 281if ($('#movies-container').length > 0) { 282 ArtistBiography.init(); 283} 284 285/* Audio Player 286 * ------------ 287 */ 288$('audio').mediaelementplayer({ 289 alwaysShowControls: false, 290 audioWidth: 150, 291 audioHeight: 20, 292 features: ['playpause','progress'], 293 pauseOtherPlayers: true 294}); 295 296/* Shortlist 297 * --------- 298 */ 299var Shortlist = { 300 301 init: function() { 302 Shortlist.enableListeners(); 303 }, 304 305 disableListeners: function() { 306 $('.shortlist a').unbind('click').click(function(event) { 307 event.preventDefault(); 308 }); 309 }, 310 enableListeners: function() { 311 $('.shortlist a').unbind('click').click(Shortlist.onShortlistClicked); 312 }, 313 314 onShortlistClicked: function(event) { 315 event.preventDefault(); 316 317 Shortlist.disableListeners(); 318 319 var $anchor = $(this); 320 var anchorText = $anchor.html(); 321 var shortlisted = (anchorText === 'shortlisted' || anchorText === 'remove'); 322 323 $.ajax({ 324 url: (shortlisted) ? rooturl + '/ajax/shortlist/remove' : rooturl + '/ajax/shortlist/add', 325 data: { 326 'id': $anchor.attr('data-sample-id'), 327 }, 328 dataType: 'json' 329 }) 330 .done(function(json) { 331 if (json.success) { 332 switch (anchorText) { 333 case 'remove': 334 $anchor.parents('li').remove(); 335 break; 336 case 'shortlist': 337 $anchor.html('shortlisted'); 338 break; 339 case 'shortlisted': 340 $anchor.html('shortlist'); 341 break; 342 } 343 } 344 Shortlist.enableListeners(); 345 }); 346 } 347 348}; 349if ($('.audio-samples').length > 0) {
350 Shortlist.init(); 351} 352 353/* Recent Work 354 * ----------- 355 */ 356var RecentWork = { 357 358 slideSpeed: 500, 359 360 $btnNext: null, 361 $btnPrev: null, 362 $thumbsList: null, 363 364 currentSlide: 0, 365 noOfSlides: null, 366 slidesInView: 4, 367 368 $lipsContainer: null, 369 $videoContainer: null, 370 371 init: function() { 372 RecentWork.$btnNext = $('.recent-work-controls .next'); 373 RecentWork.$btnPrev = $('.recent-work-controls .previous'); 374 RecentWork.$thumbsList = $('.recent-work-thumbs ul'); 375 RecentWork.noOfSlides = RecentWork.$thumbsList.find('li').length; 376 RecentWork.$lipsContainer = $('#lips-wrapper'); 377 RecentWork.$videoContainer = $('#video-window'); 378 console.log(RecentWork.$videoContainer); 379 RecentWork.$videoContainer.remove(); 380 RecentWork.enableListeners(); 381 }, 382 383 disableListeners: function() { 384 385 }, 386 enableListeners: function() { 387 RecentWork.$btnNext.click(RecentWork.onNextClicked); 388 RecentWork.$btnPrev.click(RecentWork.onPrevClicked); 389 RecentWork.$thumbsList.find('a').click(RecentWork.onVideoClicked); 390 }, 391 392 onNextClicked: function(event) { 393 event.preventDefault(); 394 if (RecentWork.currentSlide + RecentWork.slidesInView < RecentWork.noOfSlides) { 395 RecentWork.$thumbsList.animate({ 396 left: '-=134' 397 }, RecentWork.slideSpeed); 398 RecentWork.currentSlide++; 399 400 RecentWork.$btnPrev.find('a').removeClass('inactive'); 401 if (RecentWork.currentSlide + RecentWork.slidesInView === RecentWork.noOfSlides) { 402 RecentWork.$btnNext.find('a').addClass('inactive'); 403 } 404 } 405 }, 406 onPrevClicked: function(event) { 407 event.preventDefault(); 408 if (RecentWork.currentSlide - 1 >= 0) { 409 RecentWork.$thumbsList.animate({ 410 left: '+=134' 411 }, RecentWork.slideSpeed); 412 RecentWork.currentSlide--; 413 414 RecentWork.$btnNext.find('a').removeClass('inactive'); 415 if (RecentWork.currentSlide === 0) { 416 RecentWork.$btnPrev.find('a').addClass('inactive'); 417 } 418 } 419 }, 420 onVideoClicked: function(event) { 421 event.preventDefault(); 422 423 // get recent work data 424 var link = $(this).attr('data-link') 425 var description = $(this).attr('data-description'); 426 var img = $(this).attr('data-img'); 427 var mp4 = $(this).attr('data-mp4'); 428 var ogv = $(this).attr('data-ogv'); 429 var webm = $(this).attr('data-webm'); 430 431 // create a clone so that the media element doesn't keep showing the same video 432 var $newVideoContainer = RecentWork.$videoContainer.clone(); 433 434 // append recent work data to new video container 435 $newVideoContainer.find('.video-description').attr('href', link); 436 $newVideoContainer.find('.video-description').text(description); 437 $newVideoContainer.find('video').attr('poster', img); 438 $newVideoContainer.find('video object img').attr('src', img); 439 440 // setup video 441 $newVideoContainer.find('source[type="video/mp4"]').attr('src', mp4); 442 $newVideoContainer.find('source[type="video/webm"]').attr('src', webm); 443 $newVideoContainer.find('source[type="video/ogg"]').attr('src', ogv); 444 $newVideoContainer.find('param[name="flashvars"]').attr('value', 'controls=true&file=' + mp4); 445 446 // fade out lips 447 RecentWork.$lipsContainer.animate({ opacity: 0 }); 448 449 // bring up window 450 $.blockUI({ 451 css: { 452 border: 'none', 453 background: '#000', 454 color: '#fff', 455 cursor: 'default', 456 padding: '10px', 457 top: '20%', 458 left: $(window).width() / 2 - 320 + 'px', 459 }, 460 message: $newVideoContainer, 461 onUnblock: function() { 462 RecentWork.$lipsContainer.animate({ opacity: 1 }); 463 } 464 }); 465 $('.blockOverlay').css('cursor', 'default').click($.unblockUI); 466 $newVideoContainer.find('.btn-close-video').unbind('click').click(function() 467 { 468 $.unblockUI(); 469 return false;
470 }); 471 472 // enable media element 473 RecentWork.player = $('video').mediaelementplayer({ 474 plugins: ['flash', 'silverlight'], 475 // when this player starts, it will pause other players 476 pauseOtherPlayers: true, 477 success: function(mediaElement, domObject) { 478 mediaElement.play(); 479 }, 480 error: function() {} 481 }); 482 } 483 484}; 485if ($('.recent-work').length > 0) { 486 RecentWork.init(); 487} 488 489/* News List 490 * --------- 491 */ 492var NewsList = { 493 494 // listing 495 $container: null, 496 msnry: null, 497 498 // endless scroll 499 alreadyLoading: false, 500 nextPage: 2, 501 502 init: function() { 503 504 this.$container = $('#news-list'); 505 this.$container.masonry({ 506 // options 507 gutter: 12, 508 itemSelector: '#news-list > li' 509 }); 510 this.msnry = this.$container.data('masonry'); 511 //this.updateLayout(); 512 NewsList.$container.imagesLoaded( function() { 513 NewsList.msnry.layout(); 514 }); 515 516 // scroll listener 517 $(window).scroll(NewsList.handleScroll); 518 }, 519 520 handleScroll: function() { 521 if ($('body').height() <= ($(window).height() + $(window).scrollTop() + NewsList.$container.find('li:last-child article').height())) { 522 if (NewsList.alreadyLoading === false) { 523 NewsList.alreadyLoading = true; 524 525 // request next page 526 NewsList.showActivity(); 527 $.ajax(rooturl + '/ajax/news', { 528 data: { 529 page: NewsList.nextPage 530 }, 531 dataType: 'html', 532 success: function(html) { 533 var $html = $(html); 534 NewsList.$container.append($html).masonry('appended', $html, true); 535 NewsList.alreadyLoading = false; 536 NewsList.nextPage++; 537 NewsList.hideActivity(); 538 539 // request twitter (loads new buttons) 540 $.ajax({ url: 'http://platform.twitter.com/widgets.js', dataType: 'script', cache:true}); 541 FB.XFBML.parse(); 542 543 // call masonry again once images loaded 544 NewsList.$container.imagesLoaded( function() { 545 NewsList.msnry.layout(); 546 }); 547 } 548 }); 549 } 550 } 551 }, 552 hideActivity: function() { 553 $('.news-activity').activity(false).remove(); 554 }, 555 showActivity: function() { 556 $('.footer-wrapper').before('<span class="news-activity"></span>'); 557 $('.news-activity').activity(); 558 } 559 560}; 561if ($('#news-list').length > 0) { 562 NewsList.init(); 563} 564 565/* New Talent 566 * ---------- 567 */ 568var NewTalent = { 569 570 // listing 571 $container: null, 572 msnry: null, 573 574 init: function() { 575 576 this.$container = $('#new-talent'); 577 this.$container.masonry({ 578 // options 579 gutter: 12, 580 itemSelector: '#new-talent > li' 581 }); 582 this.msnry = this.$container.data('masonry'); 583 //this.updateLayout(); 584 NewTalent.$container.imagesLoaded( function() { 585 NewTalent.msnry.layout(); 586 }); 587 } 588}; 589if ($('#new-talent').length > 0) { 590 NewTalent.init(); 591}
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.