1function jump_to_top() { window.scroll(0,0); } 2//================ 3function array_remove(arr,val) { 4//================ 5 for(var i=0; i<arr.length;i++ ) { 6 if(arr[i]==val) { 7 arr.splice(i,1); 8 } 9 } 10} 11// ======================= 12function is_string(input){ 13// ======================= 14 return typeof(input)=='string'; 15} 16// ======================= 17function in_array (needle, haystack) { 18// ======================= 19 var key = ''; 20 for (key in haystack) { 21 if (haystack[key] == needle) { 22 return true; 23 } 24 } 25 return false; 26} 27// ======================= 28function pop_error(msg, duration) { 29// ======================= 30 if (typeof(duration)=='undefined') { duration=8000; } 31 pop_message('Oops', msg, duration); 32} 33// ======================= 34function pop_message(title, msg, duration) { 35// ======================= 36 if (typeof(duration)=='undefined') { duration=8000; } 37 $('div#errorbox').html(msg); 38 $('div#errorbox_outer span.boxheader span').html(title); 39 $('div#errorbox_outer').fadeIn('slow').delay(duration).fadeOut('slow'); 40} 41// ======================= 42function close_error() { 43// ======================= 44 $('div#errorbox_outer').clearQueue().fadeOut('slow'); 45} 46// ======================= 47function hasOpenInteractivityBoxes() { 48// ======================= 49 var bool = false;
50 jQuery('.interactivity_box').each(function(index, Element) { 51 if (jQuery(this).css('display') == 'block') { 52 bool = true; 53 } 54 }); 55 return bool; 56} 57 58 59// ======================= 60function clear_container(handle) { 61// ======================= 62 if (handle) { 63 while (handle.childNodes.length >0) { 64 handle.removeChild(handle.firstChild); 65 } 66 } 67} 68function forward_location(loc) { location.href=loc; } 69//============= 70function input_get_value(id) { 71//============= 72 if (document.getElementById(id).type == 'select-one') { 73 return $("#"+id+" option:selected").val(); 74 } else { 75 return $("#"+id).val(); 76 } 77} 78// ======================= 79function dezRound(num,pos) { 80// ======================= 81 if(pos<0) { 82 pos=Math.pow(10,Math.abs(pos)); 83 return Math.round(num/pos)*pos; 84 } else if(pos>0) { 85 pos=Math.pow(10,pos); 86 return Math.round(num*pos)/pos; 87 } else { 88 return Math.round(num); 89 } 90} 91 92// ======================= 93function get_isValidEmail(email) { 94// ======================= 95 96 var regEx = /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/ig; 97 return regEx.test(email); 98} 99 100// 101//---------- xmlHttpRequest 102// ======================= 103function interpret_query_string_return(f) { 104// ======================= 105 return f.replace("%+%","&"); 106} 107// ======================= 108function interpret_query_string(query_string, key) 109// ======================= 110{ 111 var pos = query_string.indexOf(key); 112 if (pos == -1) 113 return false; 114 115 if (key.charAt(key.length-1) != '=') // this is what makes it the var name -- if the = isn't already included, we append it 116 key += '='; 117 118 var str = query_string.substring(pos+key.length); 119 var pos_next_var = str.indexOf("&"); // where does the next var begin 120 if (pos_next_var == -1) // it's the last variable in the string 121 return interpret_query_string_return(str); // then, that's all we need 122 123 return interpret_query_string_return(str.substring(0, pos_next_var)); 124} 125 126var xmlHttpRequest = null; 127 128function createRequest() 129{ 130 try { xmlHttpRequest = new XMLHttpRequest(); } // This line tries to create a new request-object (by its type) 131 catch (trymicrosoft) { 132 try { xmlHttpRequest = ActiveXObject("MSXML2.XMLHTTP.3.0"); } // Here we try to create instance for IE 133 catch (othermicrosoft) { 134 try { xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP"); } // Here we try to create instance for IE 135 catch (failed) { xmlHttpRequest = null; } // totally doomed 136 } 137 } 138 return xmlHttpRequest != null; 139} 140 141function send_xmlHttpRequest(send_data, url, isAsync, func_call) { 142 if (createRequest()) { 143 xmlHttpRequest.open("POST", url, isAsync); 144 xmlHttpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 145 if (isAsync && func_call != '') xmlHttpRequest.onreadystatechange = new Function('fx', func_call); 146 xmlHttpRequest.send(send_data); 147 } 148 else alert('Please upgrade to a newer browser (use Firefox) in order to run this program'); 149} 150//function send_xmlHttpRequest(a,b,c,d){if(typeof c=="undefined"){c=false}if(typeof d=="undefined"){d=""}if(createRequest()){xmlHttpRequest.open("POST",b,c);xmlHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");if(c&&d!="")xmlHttpRequest.onreadystatechange=new Function("fx",d);xmlHttpRequest.send(a)}else alert("Please upgrade to a newer browser (use Firefox) in order to run this program")}function createRequest(){try{xmlHttpRequest=new XMLHttpRequest}catch(a){try{xmlHttpRequest=new ActiveXObject("Msxml2.XMLHTTP")}catch(b){try{xmlHttpRequest=new ActiveXObject("Microsoft.XMLHTTP")}catch(c){xmlHttpRequest=null}}}return xmlHttpRequest!=null}var xmlHttpRequest=null 151 152 153 154// ***=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=*= 155// 156// MAGAZINE 157function magazine_init() { 158 159 magazine_goto_page(1, false); 160 161 $(window) 162 .resize(center_homebanner) 163 .trigger('resize'); 164 165 $("a.home_circle_nav").click(function() { 166 var index_clicked = $(this).index() + 1; 167 if (index_clicked != iMagCurrentPage) { 168 magazine_goto_page(index_clicked, true); 169 } 170 171 return false;
172 }); 173} 174 175function magazine_reset_buttons() { 176 $("a.home_circle_nav").css('opacity', '0.3'); 177} 178 179var iMagCurrentPage = -1; 180var bMagHasClicked = false; 181function magazine_goto_page(page, isManualClick, isScheduled) { 182 if (isManualClick) { 183 bMagHasClicked = true; 184 } 185 186 send_xmlHttpRequest("id="+magazine_index_to_id[page], "api/homebanner_view.php"); 187 188 if (isScheduled && bMagHasClicked) { return; } // if the user clicked, we don't want to execute the next scheduled click 189 190 var iMagBorderWidth = 0; 191 var iMagHorizMargin = 50; 192 var iMagWidth = 1000; 193 194 var iScroll = (page-1) * ( (2*iMagBorderWidth) + iMagHorizMargin + iMagWidth ); 195 196 //$('#magazine_page_container').scrollLeft(iScroll); 197 $('#magazine_page_container').animate({'scrollLeft': iScroll}, 500, 'swing', function() { 198 if (!bMagHasClicked) { 199 var next_page = page+1; 200 if (next_page > iMagNumPages) { 201 next_page = 1; 202 } 203 204 setTimeout("magazine_goto_page("+next_page+", false, true);", 3500); 205 } 206 }); 207 208 var j = page-1; 209 var target = page+1; 210 var src; 211 while (j<=target) { 212 src = homebanner_path + homebanner_src[j]; 213 $("#homebanner_large_"+j).attr('src', src); 214 j++; 215 } 216 217 //$('#magazine_page_container a').filter(':nth-child('+page+')').css('font-style', 'italic'); 218 219 magazine_reset_buttons(); 220 $("a.home_circle_nav").filter(':nth-child('+page+')').css('opacity', '1'); 221 222 iMagCurrentPage = page; 223 224 setTimeout("magazine_track();", 100); 225} 226 227function magazine_close() { 228 hide_background_cover(); 229 $('div#magazine_container').fadeOut(); 230} 231 232function magazine_page_click() { 233 // if the index of the clicked banner matches the current banner, we want to allow the href to get followed. 234 // otherwise, we want to scroll to that banner. 235 var index_clicked = $(this).index() + 1; 236 237 if (index_clicked != iMagCurrentPage) { // only when we click the centered banner do we actually allow a clickthrough. Otherwise we just scroll over 238 magazine_goto_page(index_clicked, true); 239 return false; 240 } 241 242 send_xmlHttpRequest("id="+magazine_index_to_id[index_clicked], "api/homebanner_clickthrough.php"); 243 244 if ($(this).attr('href') == '#' || $(this).attr('href') =='') { // this is for the banners that don't have a link 245 return false; 246 } 247 248 magazine_close(); 249} 250 251function magazine_track() { 252 //send_xmlHttpRequest("page="+iMagCurrentPage, "api/magazine_track.php", true); 253} 254 255function homebanner_track_click(id) { 256 send_xmlHttpRequest("id="+id, "api/homebanner_clickthrough.php"); 257} 258 259 260 261 262function center_homebanner(event) { 263 var viewport_width = $(window).width(); 264 $("#magazine_page_container").css("width", viewport_width); 265 $("img#homebanner_large_1").css("margin-left", (Math.round(((viewport_width-1000)/2)))+"px" ); 266 267 $("#home_banner_large_nav_container span").css({ 268 'float' : 'left', 269 'margin-left' : Math.round(((1000 - $("#home_banner_large_nav_container span").width())/2))+"px" 270 }); 271} 272 273 274 275var hs_id_to_current_index = new Array(0, 0, 0, 0); 276var hs_id_to_type = new Array('', 'artists', 'inventory', 'prints'); 277function hs_init(id) { 278 var type = hs_id_to_type[id]; 279 var current_index = hs_id_to_current_index[id]; 280 $('div.home_slideshow_'+type).eq(current_index).fadeIn(700).delay(6000).fadeOut(700, function() { hs_inc_index(id); hs_init(id); }); 281 282} 283 284function hs_inc_index(id) { 285 var type = hs_id_to_type[id]; 286 var max_index = $('div.home_slideshow_'+type).length; 287 var current_index = hs_id_to_current_index[id]; 288 var next_index = current_index + 1; 289 if (next_index == max_index) { 290 next_index = 0; 291 } 292 293 hs_id_to_current_index[id] = next_index; 294 return next_index; 295} 296 297// 298// 299// ***=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=*= 300 301 302 303 304 305// ======================= 306function grid_enable_quicklook() { 307// ======================= 308 $("div.grid_item_container").hover( 309 function() { 310 var offset = $(this).offset(); 311 $("a#grid_quicklook") 312 .css({ 313 "top": (offset.top + 150) + "px", 314 "left": (offset.left + 35) + "px" 315 }) 316 .show(); 317 318 quicklook_style_code = $(this).attr('style_code'); 319 quicklook_color = $(this).attr('color'); 320 }, 321 function() { 322 $("a#grid_quicklook").hide(); 323 } 324 ); 325} 326 327// ======================= 328function grid_quicklook_init() { 329// ======================= 330 $("a#grid_quicklook") 331 .hover( 332 function() { $(this).show(); }, 333 function() { $(this).hide(); } 334 ) 335 .click(function() { 336 popup_open_item_detail(quicklook_style_code, quicklook_color); 337 return false;
338 }); 339} 340 341 342 343 344 345// ======================= 346function item_detail_replace_large_image(large_image_src) { 347// ======================= 348 $("img#item_detail_large_image").hide(); 349 var new_img = new Image(); 350 new_img.src = large_image_src; 351 new_img.onload = function() { 352 $("img#item_detail_large_image").attr('src', large_image_src).show(); 353 } 354} 355 356//====================== 357function standard_close_item(category_link) { 358//====================== 359 if (referrer.indexOf('/our-work/') != -1) { 360 history.back(); 361 } else { 362 location.href = category_link; 363 } 364} 365 366 367//====================== 368function detail_add_to_favorites(size_id) { 369//====================== 370 send_xmlHttpRequest("process=new&size_id="+size_id, "api/favorite.php"); 371 if (interpret_query_string(xmlHttpRequest.responseText, "error_id") == "0") { 372 var num_items = interpret_query_string(xmlHttpRequest.responseText, "num_items"); 373 top_nav_update_counter('favorites', num_items); 374 $('#btn_arrow_med_addto_favs').hide().delay(5000).fadeIn(); 375 $('#btn_arrow_med_addto_favs_confirm').fadeIn('normal').delay(3000).fadeOut('fast'); 376 } else { 377 pop_error(interpret_query_string(xmlHttpRequest.responseText, "error_msg")); 378 } 379} 380 381//====================== 382function event_favorites_remove(event) { 383//====================== 384 var tmp = $(event.target).attr('id'); 385 var favorite_id = parseInt(tmp.replace(/[^\d]/g, "")); 386 send_xmlHttpRequest("process=delete&id="+favorite_id, "api/favorite.php"); 387 388 //favorites_init_grid(0); // reload the grid 389 window.location.reload(); 390 return false; 391} 392 393//============ 394function top_nav_update_counter(type, count) { 395//============ 396 var trgt_el = document.getElementById('top_'+type+'_counter'); 397 trgt_el.style.display = count > 0 ? "inline" : "none"; 398 trgt_el.innerHTML = ""+count+""; 399} 400 401 402 403//jQuery(document).ready(function() { grid_nav_position(); setTimeout("grid_nav_position();", 1000); }); 404 405 406function signup_focus(ipt, isAuto) { 407 if (isAuto && ipt.value == signup_default) { 408 return; 409 } 410 411 if (ipt.value == signup_default) { 412 ipt.value = ""; 413 } 414 415 ipt.style.color = "white"; 416 ipt.style.textAlign = "left"; 417} 418function signup_blur(ipt) { 419 if (ipt.value == "") { 420 ipt.value = signup_default; 421 signup_style_reset(ipt); 422 } 423} 424 425function signup_style_reset(ipt) { 426 ipt.style.color = "#CCCCCC"; 427} 428function signup_submit(origin) { 429 if (typeof(origin)=='undefined') { origin = 'footer'; } 430 431 var ipt = document.getElementById('signup_input_home'+(origin=='popup'?'_popup':'')); 432 var email = ipt.value; 433 434 send_xmlHttpRequest("email="+encodeURIComponent(email), "api/email_signup.php"); 435 if (interpret_query_string(xmlHttpRequest.responseText, "error_id") == "0") { 436 signup_confirm(ipt); 437 } else { 438 signup_fail(ipt); 439 } 440} 441function signup_confirm(ipt) { 442 signup_style_reset(ipt); 443 ipt.value = "thanks for signing up!" 444 cookie_write("signup_has_joined", "true"); 445 setTimeout("signup_confirm_reset('"+ipt.id+"');", 2000); 446} 447function signup_confirm_reset(id) { 448 var ipt = document.getElementById(id); 449 ipt.value = ''; 450 signup_blur(ipt); 451} 452function signup_fail(ipt) { 453 var tmp = ipt.value; 454 signup_focus(ipt, true); 455 ipt.value = "Invalid entry, please retry!" 456 setTimeout("signup_fail_reset(\""+tmp+"\",'"+ipt.id+"');", 2000); 457} 458function signup_fail_reset(value, id) { 459 document.getElementById(id).value = value; 460} 461 462var inside_subnav = ''; 463var subNavHideTO = null; 464
465function shows_nav_mouseOver(event) { 466 if( subNavHideTO ) 467 clearTimeout( subNavHideTO ); 468 $("div#subnav_shows").show(); 469 $("a#main_menu_shows").addClass('hovering'); 470 //$("a#main_menu_shows").css('background-position', '-314px -212px'); 471} 472function shows_nav_mouseOut(event) { 473 subNavHideTO = setTimeout("shows_subnav_hide_timed();", 200); 474 $("a#main_menu_shows").removeClass('hovering'); 475 //$("a#main_menu_shows").css('background-position', '-314px -83px'); 476} 477function shows_subnav_mouseOver(event) { 478 inside_subnav = 'shows'; 479 $("div#subnav_shows").show(); 480 $("a#main_menu_shows").addClass('hovering'); 481 //$("a#main_menu_shows").css('background-position', '-314px -212px'); 482 483} 484function shows_subnav_mouseOut(event) { 485 inside_subnav = ''; 486 $("div#subnav_shows").hide(); 487 $("a#main_menu_shows").removeClass('hovering'); 488 //$("a#main_menu_shows").css('background-position', '-314px -83px'); 489} 490function shows_subnav_hide_timed() { 491 if (inside_subnav != 'shows') { 492 $("div#subnav_shows").hide(); 493 } 494} 495 496 497//==================================================================================================== 498 function grid_nav_position() { 499 var grid_nav_top = get_grid_nav_top(); 500 var grid_nav_height = get_grid_nav_height(grid_nav_top); 501 502 jQuery('.grid_nav_outer') 503 .css({ 504 "top": grid_nav_top+"px", 505 "height": grid_nav_height+"px", 506 "overflow": "hidden" 507 }); 508 } 509 function get_grid_nav_top() { 510 var scroll_pos = jQuery(window).scrollTop(); 511 512 var top_pos = Math.max(10, (content_margin_top - scroll_pos)); 513 514 return top_pos; 515 } 516 function get_grid_nav_height(top_pos) { 517 var viewport_height = jQuery(window).height(); 518 var footer_offset = $('div#site_footer').offset(); 519 var footer_from_bottom = viewport_height - footer_offset.top; 520 var footer_height = 83; 521 var footer_var = Math.max(footer_from_bottom, footer_height); // which is greater? the height of the footer or the distance from the bootom 522 var total_height = jQuery(document).height(); 523 var top_height = jQuery(window).scrollTop(); 524 var bottom_remaining = total_height - viewport_height - top_height - footer_var; 525 526 527 var result = viewport_height - top_pos - 10; // 179 is distance from top, 10 is extra spacing from the bottom 528 issafari = ( jQuery.browser.safari && /chrome/.test(navigator.userAgent.toLowerCase()) ) ? false : true; 529 if (jQuery.browser.msie || issafari) { result -= 10; } // on IE and Safari, the footer is somehow taller 530 531 if (bottom_remaining < 0) { result += bottom_remaining; } // we don't want the sidebar to span over top of the footer 532 533 return result; 534 } 535 536 $(document).ready(function() { 537 grid_nav_position(); 538 jQuery('.grid_nav_outer') 539 .css("overflow", "hidden") 540 .hover(function() {//OVER 541 jQuery(this).css('overflow-y', 'auto'); 542 isInGridSidenav = true; 543 }, function() {//OUT 544 jQuery(this).css('overflow', 'hidden'); 545 isInGridSidenav = true; 546 }); 547/* 548 jQuery(window).bind('resize', function() { 549 grid_nav_position(); 550 }); 551 jQuery(window).bind('scroll', function() { 552 grid_nav_position(); 553 }); 554 555 jQuery('#grid_container') 556 .mouseover(function() { 557 jQuery('.grid_nav_outer').css('overflow-y', 'hidden'); 558 }); 559*/ 560 //Block dragging on all images and anchors 561 $('img,a') 562 .on('dragstart', function(event) { 563 event.preventDefault(); 564 }); 565
566 $("a#main_menu_shows").hover(shows_nav_mouseOver, shows_nav_mouseOut); 567 $("a#main_menu_shows_active").hover(shows_nav_mouseOver, shows_nav_mouseOut); 568 $("div#subnav_shows").hover(shows_subnav_mouseOver, shows_subnav_mouseOut); 569 }); 570 571//==================================================================================================== 572 573 574 575 576// ***=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=*= 577// LAZY LOADING 578var iGridRowHeight = 258; 579var iGridBannerHeight = 0; 580var iGridTop = 145; 581var iGridNumItemsInRow = 4; 582function grid_get_row_coordinates(row) { 583 return new Array( 584 (iGridTop + iGridBannerHeight + ((row-1)*iGridRowHeight)), 585 (iGridTop + iGridBannerHeight + ((row+1)*iGridRowHeight)) 586 ); 587} 588function get_is_in_between(int, low, hi) { 589 return int >= low && int <=hi; 590} 591function grid_get_rows_in_view(viewport_top, viewport_bottom) { 592 var row=1; 593 var rows_in_view = new Array(); 594 var isMatch; 595 var hasHadMatch = false; 596 var hasMovedPastView = false; 597 var row_coords; 598 var limit = 1000; 599 while (!hasMovedPastView) { 600 row_coords = grid_get_row_coordinates(row); 601 isMatch = get_is_in_between(row_coords[0], viewport_top, viewport_bottom) || get_is_in_between(row_coords[1], viewport_top, viewport_bottom); 602 if (isMatch) { 603 hasHadMatch = true; 604 rows_in_view.push(row); 605 } else { 606 if (hasHadMatch) { hasMovedPastView = false; } 607 } 608 609 row++; 610 if (row > limit) { break; } 611 } 612 613 return rows_in_view; 614} 615function grid_get_indexes(rows_in_view) { 616 var i, j, row, start, end; 617 var indexes = new Array(); 618 for (i=0; i<rows_in_view.length; i++) { 619 row = rows_in_view[i]; 620 start = (row-1) * iGridNumItemsInRow; 621 end = start + iGridNumItemsInRow - 1; 622 for (j=start; j<=end; j++) { indexes.push(j); } 623 } 624 625 return indexes; 626} 627 628var grid_hasLoadedThumbs = new Array(); 629function grid_display_images_in_view(viewport_top, viewport_bottom) { 630 var rows_in_view = grid_get_rows_in_view(viewport_top, viewport_bottom); 631 var indexes = grid_get_indexes(rows_in_view); 632 var i, cont, id, src; 633 for (i=0; i<indexes.length; i++) { 634 index = indexes[i]; 635 id = aImageIds[index]; 636 if (in_array(id, grid_hasLoadedThumbs)) { continue; } 637 if (!document.getElementById('itemthumb_'+id)) { continue; } 638 img = document.getElementById('itemthumb_'+id); 639 src = image_path+aImages[index]; 640 img.style.display = 'block'; 641 img.src = src; 642 //img.onload = function() { } 643 grid_hasLoadedThumbs.push(id); 644 } 645} 646 647 648var grid_scroll_y_pos = 0; 649function grid_scroll_event_handler() { 650 if (typeof(aImageIds) == 'undefined') { 651 return; // the grid hasn't finished loading yet! 652 } 653 654 grid_scroll_y_pos = getScrollY(); 655 grid_display_images_in_view(grid_scroll_y_pos, (grid_scroll_y_pos+getInnerHeight()+200)); 656 //setTimeout("grid_scroll_event_handler_timed("+grid_scroll_y_pos+");", 500); 657 658} 659function grid_scroll_event_handler_timed(scroll_pos_at_trigger) { 660 var tmp_Y = getScrollY(); 661 if (tmp_Y == scroll_pos_at_trigger) { // we don't want to start loading images while we're still scrolling! 662 grid_display_images_in_view(grid_scroll_y_pos, (grid_scroll_y_pos+getInnerHeight())); 663 } else { 664 //alert(tmp_Y+"\n"+grid_scroll_y_pos); 665 } 666} 667 668function getScrollY() { 669 var scrOfY = 0; 670 if( typeof( window.pageYOffset ) == 'number' ) { 671 //Netscape compliant 672 scrOfY = window.pageYOffset; 673 } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) { 674 //DOM compliant 675 scrOfY = document.body.scrollTop; 676 } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) { 677 //IE6 standards compliant mode 678 scrOfY = document.documentElement.scrollTop; 679 } 680 return scrOfY; 681} 682 683function getInnerHeight() { 684 var myHeight = 0; 685 if( typeof( window.innerWidth ) == 'number' ) { 686 //Non-IE 687 myHeight = window.innerHeight; 688 } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { 689 //IE 6+ in 'standards compliant mode' 690 myHeight = document.documentElement.clientHeight; 691 } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { 692 //IE 4 compatible 693 myHeight = document.body.clientHeight; 694 } 695 return myHeight; 696} 697// ***=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=*= 698// 699// 700// 701function fix_background(event) { 702 /* 703 var defaulttop = 110; 704 var scrolltop = $(window).scrollTop();
705 var postop = Math.max((defaulttop-scrolltop), 0); 706 $('body').css({backgroundPosition: 'center '+postop+'px'}); 707 */ 708} 709 710$.getDocHeight = function(){ 711 return Math.max( 712 $(document).height(), 713 $(window).height(), 714 /* For opera: */ 715 document.documentElement.clientHeight 716 ); 717}; 718 719 720// ***=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=**=*= 721// 722// 723// 724 725function addTextAreaCallback(textArea, callback, delay) { 726 $(textArea).bind('input propertychange', function() { 727 callback(); 728 }); 729} 730function searchOnKeyUp() { 731 if ($('input#input_header_search').val() == "") { 732 $('div#search_results').show(); 733 $('div#search_results_loading').hide(); 734 $('div#search_results_inner').html('<center>Sorry, but your search has no results.<br>Please enter an artists name or use the navigation to browse.</center>').show(); 735 } else if ($('input#input_header_search').val() != $('input#input_header_search').attr('placeholder')) { 736 $('div#search_results').show(); 737 $.get( 738 "api/search_ajax.php", 739 { 740 search: encodeURIComponent($('input#input_header_search').val()), 741 }, 742 searchDisplayResult 743 ); 744 } 745} 746function searchDisplayResult(data) { 747 $('div#search_results_loading').hide(); 748 $('div#search_results_inner').html(data).show(); 749} 750var isOutsideSearch = false; 751function search_hide_scheduled() { 752 if (isOutsideSearch) { 753 $('div#search_results').hide(); 754 } 755} 756$(document).ready(function() { 757 addTextAreaCallback(document.getElementById('input_header_search'), searchOnKeyUp, 500); 758 $('div#search_results').hover(function(){ isOutsideSearch = false; }, function() { isOutsideSearch = true; setTimeout("search_hide_scheduled();", 700); }); 759 $('input#input_header_search').focus(function(){ 760 if ($('div#search_results_inner').html() != "") { 761 $('div#search_results').show(); 762 } 763 }); 764 $('a#search_submit').click(function() { 765 if ($('div#search_results_inner').html() != "") { 766 $('div#search_results').show(); 767 } 768 }); 769 $("body").keydown(function(e) { 770 if(e.keyCode == 37) { // left 771 $("div.stylePrev").triggerHandler('click'); 772 } 773 else if(e.keyCode == 39) { // right 774 $("div.styleNext").triggerHandler('click'); 775 } 776 }); 777 if( $('.artistName').length == 1 ){ 778 $('a.show_sidenav_artist:contains("'+$('.artistName').text()+'")').addClass('active'); 779 } 780}); 781 782$(window).scroll(function() { 783 784 var scroll_pos = jQuery(window).scrollTop(); 785 //var viewport_height = jQuery(window).height(); 786 if (scroll_pos > 10) { 787 $('a#back_to_top').fadeIn(); 788 } else { 789 $('a#back_to_top').fadeOut(); 790 } 791 792 if($(window).scrollTop() + $(window).height() > $(document).height() - 20) { set_footer(); } 793 794 fix_background(); 795}).trigger('scroll'); 796 797$( window ).load(function() { 798 set_footer(); 799}); 800 801function set_footer() { 802 var content_offset = $("#site_content").offset().top; 803 var content_height = $("#site_content").outerHeight(); 804 var footer_offset = $("div#site_footer").offset().top; 805 $("div#site_footer_bg") 806 .css({ 807 "height": ( Math.max( $(window).height(), content_height+content_offset )- footer_offset ) + "px", 808 "top": footer_offset+"px", 809 "display": "block" 810 }); 811} 812 813function trackScroll(){ 814 $("textarea.lazySection:first").convertLazySection(); 815 set_footer(); 816} 817 818$(function(){ 819 jQuery(window).bind('resize', function() { trackScroll(); }); 820 jQuery(window).bind('scroll', function() { trackScroll(); }); 821 trackScroll(); 822}); 823 824var lazySectionY = -1; 825 826$.fn.convertLazySection = function() { 827 828 var offset = $(this).offset(); 829 var winTop = $(window).scrollTop(); 830 831 if( offset && winTop + $(window).height() > offset.top ){ 832 833 var attrs = {}; 834 835 $.each(this[0].attributes, function(idx, attr) { 836 attrs[attr.nodeName] = attr.nodeValue; 837 }); 838 839 this.replaceWith(function() { 840 return $("<div/>", attrs).html($(this).text()); 841 }); 842 843 trackScroll(); 844 } 845} 846 847function show_email(){ 848 $('#northJoinBox').addClass('visible'); 849} 850 851function hide_email(){ 852 $('#northJoinBox').removeClass('visible'); 853} 854 855function navigateInventory( dir ){ 856 var newUrl = false; 857 $('.sidenav img').each(function() { 858 if( $(this).css('opacity') < '0.5' ){ 859 var nextOrPrev = dir > 0 ? $(this).parent().next('a') : $(this).parent().prev('a'); 860 if( nextOrPrev.length ){ 861 newUrl = nextOrPrev.attr('href'); 862 } else if( dir > 0 ){ 863 nextOrPrev = $('.sidenav img:first').parent(); 864 newUrl = nextOrPrev.attr('href'); 865 } else { 866 nextOrPrev = $('.sidenav img:last').parent(); 867 newUrl = nextOrPrev.attr('href'); 868 } 869 } 870 }); 871 if( newUrl ){ 872 window.location = newUrl; 873 } 874} 875 876function signup_email( email ){ 877 grecaptcha.ready(function() { 878 grecaptcha.execute('6LetrN4sAAAAAHsLY-so1IppDIvw2Mjj76de8AIT', {action: 'email_signup'}).then(function(token) { 879 $.post( 880 '/api/email_signup.php', 881 { 882 email : email.val(), 883 recaptcha_token: token 884 885 }, 886 function(data){ 887 if (interpret_query_string(data, "error_id") == "0" || interpret_query_string(data, "error_id") == "1062") { 888 email.val('Thanks for signing up!'); 889 } else { 890 email.val('Invalid entry, please retry!'); 891 } 892 } 893 ); 894 }); 895 }); 896/* 897 send_xmlHttpRequest("email="+encodeURIComponent(email), "api/email_signup.php"); 898 if (interpret_query_string(xmlHttpRequest.responseText, "error_id") == "0") { 899 footer_signup_confirm(ipt); 900 } else { 901 footer_signup_fail(ipt); 902 } 903*/ 904} 905 906function loadGridResults(){ 907 $.post( 908 window.location.pathname, 909 { 910 startAt : $('.lazySection.inventory.item_grid_container').length 911 }, 912 function(data){ 913 $('.loadmore').replaceWith(data); 914 $(window).trigger('scroll'); 915 } 916 ); 917} 918 919$.fn.enterKey = function (fnc) { 920 return this.each(function () { 921 $(this).keypress(function (ev) { 922 var keycode = (ev.keyCode ? ev.keyCode : ev.which); 923 if (keycode == '13') { 924 fnc.call(this, ev); 925 } 926 }) 927 }) 928}
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.