1(function($){ 2/** 3 * Toggle the visibility of the scroll to top link. 4 */ 5 6Drupal.behaviors.scroll_to_top = { 7 attach: function (context, settings) { 8 // append back to top link top body if it is not 9 var exist= jQuery('#back-top').length; // exist = 0 if element doesn't exist 10 if(exist == 0){ // this test is for fixing the ajax bug 11 $("body").append("<p id='back-top'><a href='#top'><span id='button'></span><span id='link'>" + settings.scroll_to_top.label + "</span></a></p>"); 12 } 13 // Preview function 14 $("input").change(function () { 15 // building the style for preview 16 var style="<style>#scroll-to-top-prev-container #back-top-prev span#button-prev{ background-color:"+$("#edit-scroll-to-top-bg-color-out").val()+";} #scroll-to-top-prev-container #back-top-prev span#button-prev:hover{ background-color:"+$("#edit-scroll-to-top-bg-color-hover").val()+" }</style>" 17 // building the html content of preview 18 var html="<p id='back-top-prev' style='position:relative;'><a href='#top'><span id='button-prev'></span><span id='link'>"; 19 // if label enabled display it 20 if($("#edit-scroll-to-top-display-text").attr('checked')){ 21 html+=$("#edit-scroll-to-top-label").val(); 22 } 23 html+="</span></a></p>"; 24 // update the preview 25 $("#scroll-to-top-prev-container").html(style+html); 26 }); 27 $("#back-top").hide(); 28 $(function () { 29 $(window).scroll(function () { 30 // Adding IE8 support 31 var scrollTop = 0; 32 if (document.documentElement && document.documentElement.scrollTop) { 33 scrollTop = document.documentElement.scrollTop; 34 } 35 if ($(this).scrollTop() > 100 || scrollTop > 100) { 36 $('#back-top').fadeIn(); 37 } else { 38 $('#back-top').fadeOut(); 39 } 40 }); 41 42 // scroll body to 0px on click 43 $('#back-top a').click(function () { 44 $('body,html').animate({ 45 scrollTop: 0 46 }, 800); 47 return false; 48 }); 49 }); 50 } 51}; 52})(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.