1/* Collapse-Magic */ 2 3(function($) { 4 5 if ($('.claps-toggle-text').length > 0) { 6 //apply the tags and icons to create the toggle 7 $('.claps-toggle-text').each(function() { 8 //Set some default values in case any data is missing in the transferred div tags 9 var expand_title = (typeof $(this).data('title') !== 'undefined')? 10 $(this).data('title'): "Expand To Read More"; 11 var collapse_title = (typeof $(this).data('swaptitle') !== 'undefined')? 12 $(this).data('swaptitle'): "Collapse To Read Less"; 13 var expand_icon = (typeof $(this).data('icon') !== 'undefined')? 14 $(this).data('icon'): "▼"; 15 var collapse_icon = (typeof $(this).data('swapicon') !== 'undefined')? 16 $(this).data('swapicon'): "▲"; 17 var collapse_ht = (typeof $(this).data('ht') !== 'undefined')? 18 $(this).data('ht'): "100px"; 19 var collapse_hf = (typeof $(this).data('hf') !== 'undefined')? 20 $(this).data('hf'): "20px"; 21 var toggle_above = (typeof $(this).data('above') !== 'undefined')? 22 $(this).data('above'): 1; 23 if (toggle_above==1){ 24 $(this).prepend('<div class= "claps-text-expand-button"><span class= "claps-text-collapse-button">' + 25 '<span class= "claps-text-toggle-icon">' + expand_icon + '</span> ' + expand_title + '</span></div>'); 26 } else { 27 $(this).append('<div class= "claps-text-expand-button"><span class= "claps-text-collapse-button">' + 28 '<span class= "claps-text-toggle-icon">' + expand_icon + '</span> ' + expand_title + '</span></div>'); 29 } 30 console.log('Above?', toggle_above); 31 console.log('HF - Fade', collapse_hf); 32 console.log('HF - Fade', collapse_hf); 33 $('.claps-toggle-text .claps-text-toggle-collapsed').css('height', collapse_ht); 34 $(this).find(".claps-text-collapse-button").on("click", function() { 35 $(this).parent().siblings(".claps-text-inner").toggleClass("claps-text-toggle-expanded"); 36 $(this).parent().siblings(".claps-text-inner").toggleClass("claps-text-toggle-collapsed"); 37 if ($(this).parent().siblings("div.claps-text-inner").hasClass("claps-text-toggle-expanded")) { 38 $(this).html("<span class= 'claps-text-toggle-icon'>" + collapse_icon + "</span> " + collapse_title); 39 $('.claps-toggle-text .claps-text-toggle-expanded').css('height', 'auto'); 40 // console.log('EXPANDED'); 41 } else { 42 $(this).html("<span class= 'claps-text-toggle-icon'>" + expand_icon + "</span> " + expand_title); 43 $('.claps-toggle-text .claps-text-toggle-collapsed').css('height', collapse_ht); 44 // console.log('COLLAPSED'); 45 if (toggle_above!=1){ 46 $('html, body').animate({ 47 scrollTop: $(this).closest('.claps-toggle-text').offset().top - 150 48 }, 800); // Adjust the duration as needed 49 } 50 } 51 }); 52 $('.claps-toggle-text .claps-text-toggle-collapsed:after').css('height', collapse_hf); 53 }); 54 } 55 56})(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.