1import layout from './layout.js'; 2import device from './device.js'; 3import cycle from '../plugins/jquery.cycle2.min.js'; 4 5var artist_list_preview = { 6 7 init: function() { 8 if (h.element_exists('#list_preview_slideshow') && !$('#list_preview_slideshow').hasClass('no-slideshow')) { 9 10 var selector = $("#list_preview_slideshow >").not('.cycle-sentinel'); 11 var random_slide_index = Math.floor(Math.random() * selector.length); 12 13 14 15 if ($('#list_preview_slideshow').hasClass('content_follow')) { 16 window.galleries.layout.content_follower('#list_preview_slideshow', '#sidebar'); 17 } 18 19 var params = { 20 fx: 'fade', 21 speed: 400, 22 timeout: 4500, 23 pause: 0, 24 before: function(cSlide, nSlide, options) { 25 26 }, 27 after: function(cSlide, nSlide, options) { 28 29 }, 30 slides: '>', 31 startingSlide: parseInt(random_slide_index), 32 autoHeight: 'calc' 33 }; 34 35 // Accessibility - initiate slideshow in a paused state. Enabled by disable_artist_list_slideshow_autoplay gallery setting 36 if ($('#list_preview_slideshow').length && $('#list_preview_slideshow').hasClass('start_paused')) { 37 params.paused = true 38 } 39 40 //if($.browser.safari){ 41 // params["loader"] = "wait"; 42 //} 43 44 $('#list_preview_slideshow').cycle(params); 45 46 $("#list_preview_slideshow .image[data-index='" + (parseInt(random_slide_index) + 1) + "']").each(function () { 47 $(this).find("a").css({ display: "block" }); 48 }) 49 50 if (!window.galleries.device.handheld()) { 51 $('#list_preview_navigation a').mouseover(function () { 52 53 $("#list_preview_slideshow .image[data-index='" + $(this).data("index") + "']").each(function () { 54 $(this).find("a").css({ display: "block" }); 55 }); 56 57 if ($('#list_preview_slideshow').is(':visible')) { 58 $('#list_preview_slideshow').cycle('pause'); 59 $('#list_preview_slideshow').cycle(parseInt($(this).attr('data-index')) - 1); 60 return false; 61 } 62 }); 63 } 64 65 window.galleries.artist_list_preview.sidebar_height(); 66 67 $(window).resize(function(){ 68 window.galleries.artist_list_preview.sidebar_height(); 69 }); 70 71 if ($('.subsection-artist-list-preview.list-preview-fullbleed, .subsection-artist-list-preview.list-preview-random-position').length) { 72 73 window.galleries.artist_list_preview.vertically_centre_artist_list.init(); 74 75 if ($('.subsection-artist-list-preview.list-preview-fullbleed').length) { 76 $('body').addClass('type-fullscreen'); 77 } 78 $('#list_preview_slideshow').each(function() { 79 $('.image', this).each(function() { 80 81 var image_src = $(this).find('img').attr('data-src') || $(this).find('img').attr('src'); 82 if (image_src && typeof image_src != 'undefined') { 83 //DC - not sure, but this breaks the list sometimes, and seems to not be needed. 84 // if ($('.subsection-artist-list-preview.list-preview-random-position').length) { 85 // //window.theme.list_preview_slideshow.shuffle_position(this); 86 // } 87 $('a', this).css({ 88 'background-image': 'url(' + image_src + ')' 89 }); 90 } 91 92 }); 93 94 if ($('.subsection-artist-list-preview.list-preview-random-position').length) { 95 $('#list_preview_slideshow').on('cycle-before', function(event, optionHash, outgoingSlideEl, incomingSlideEl, forwardFlag) { 96 $(incomingSlideEl).each(function() { 97 window.galleries.artist_list_preview.shuffle_position(this); 98 }); 99 }); 100 } 101 }); 102 $(window).resize(function() { 103 window.galleries.layout.push_to_fullheight('.subsection-artists-list', 'min-height', 0, 0); 104 }); 105 106 } 107 108 } 109 }, 110 111 sidebar_height: function(){ 112 var img_height = 0; 113 $( window ).on('load', function() { 114 img_height = $("#sidebar .cycle-sentinel").height(); 115 $('#sidebar').height(img_height); 116 }); 117 }, 118 119 shuffle_position: function(instance) { 120 121 if (instance) { 122 $(instance).each(function() { 123 var pos_x = Math.floor(Math.random() * 100) + 1; 124 var pos_y = Math.floor(Math.random() * 100) + 1; 125 var offset_top_y = Math.floor(Math.random() * 100) + 1; 126 var offset_bottom_y = Math.floor(Math.random() * 100) + 1; 127 $('a', this).css({ 128 'background-position': pos_x + '% ' + pos_y + '%', 129 'top': offset_top_y + 'px', 130 'bottom': offset_bottom_y + 'px' 131 }); 132 }); 133 } 134 }, 135 136 vertically_centre_artist_list: { 137 138 init: function() { 139 if ($('.x-subsection-artist-list-preview, .subsection-artist-list-standard').length) { 140 $('body').addClass('list-type-vertical-align'); 141 $('.subsection-artist-list-preview, .subsection-artist-list-standard').each(function() { 142 $(this).closest('#content').addClass('vertical-align-middle'); 143 window.galleries.artist_list_preview.vertically_centre_artist_list.push_to_fullheight(); 144 $(window).resize(function() { 145 window.galleries.artist_list_preview.vertically_centre_artist_list.push_to_fullheight(); 146 }); 147 }); 148 } 149 }, 150 push_to_fullheight: function() { 151 var content_module_offset = $('#content').offset().top; 152 $('#content').css({'min-height':'calc(100vh - '+content_module_offset+'px)'}); 153 } 154 }, 155 156} 157 158window.galleries = window.galleries || {}; 159window.galleries.artist_list_preview = artist_list_preview; 160export default artist_list_preview;
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.