1jQuery(document).ready(function() { 2 3 jQuery('#cff .cff-item').each(function(){ 4 var $self = jQuery(this); 5 6 //Wpautop fix 7 if( $self.find('.cff-viewpost-facebook').parent('p').length ){ 8 $self.find('.cff-viewpost-facebook').unwrap('p'); 9 } 10 if( $self.find('.cff-author').parent('p').length ){ 11 $self.find('.cff-author').eq(1).unwrap('p'); 12 $self.find('.cff-author').eq(1).remove(); 13 } 14 if( $self.find('#cff .cff-link').parent('p').length ){ 15 $self.find('#cff .cff-link').unwrap('p'); 16 } 17 18 //Expand post 19 var expanded = false, 20 $post_text = $self.find('.cff-post-text .cff-text'), 21 text_limit = $self.closest('#cff').attr('data-char'); 22 if (typeof text_limit === 'undefined' || text_limit == '') text_limit = 99999; 23 24 //If the text is linked then use the text within the link 25 if ( $post_text.find('a.cff-post-text-link').length ) $post_text = $self.find('.cff-post-text .cff-text a'); 26 var full_text = $post_text.html(); 27 if(full_text == undefined) full_text = ''; 28 var short_text = full_text.substring(0,text_limit); 29 30 //Cut the text based on limits set 31 $post_text.html( short_text ); 32 //Show the 'See More' link if needed 33 if (full_text.length > text_limit) $self.find('.cff-expand').show(); 34 //Click function 35 $self.find('.cff-expand a').unbind('click').bind('click', function(e){ 36 e.preventDefault(); 37 var $expand = jQuery(this), 38 $more = $expand.find('.cff-more'), 39 $less = $expand.find('.cff-less'); 40 if (expanded == false){ 41 $post_text.html( full_text ); 42 expanded = true; 43 $more.hide(); 44 $less.show(); 45 } else { 46 $post_text.html( short_text ); 47 expanded = false; 48 $more.show(); 49 $less.hide(); 50 } 51 //Add target attr to post text links via JS so aren't included in char count 52 $self.find('.cff-text a').add( $self.find('.cff-post-desc a') ).attr({ 53 'target' : '_blank', 54 'rel' : 'nofollow' 55 }); 56 cffLinkHashtags(); 57 }); 58 59 //Hide the shared link box if it's empty 60 $sharedLink = $self.find('.cff-shared-link'); 61 if( $sharedLink.text() == '' ){ 62 $sharedLink.remove(); 63 } 64 65 function cffLinkHashtags(){ 66 //Link hashtags 67 var cffTextStr = $self.find('.cff-text').html(), 68 cffDescStr = $self.find('.cff-post-desc').html(), 69 regex = /(^|\s)#(\w*[a-z\u00E0-\u00FC]+\w*)/gi, 70 linkcolor = $self.find('.cff-text').attr('data-color'); 71 72 function replacer(hash){ 73 //Remove white space at beginning of hash 74 var replacementString = jQuery.trim(hash); 75 //If the hash is a hex code then don't replace it with a link as it's likely in the style attr, eg: "color: #ff0000" 76 if ( /^#[0-9A-F]{6}$/i.test( replacementString ) ){ 77 return replacementString; 78 } else { 79 return ' <a href="https://www.facebook.com/hashtag/'+ replacementString.substring(1) +'" target="_blank" rel="nofollow" style="color:#' + linkcolor + '">' + replacementString + '</a>'; 80 } 81 } 82 83 if(cfflinkhashtags == 'true'){ 84 //Replace hashtags in text 85 var $cffText = $self.find('.cff-text'); 86 if($cffText.length > 0){ 87 //Add a space after all <br> tags so that #hashtags immediately after them are also converted to hashtag links. Without the space they aren't captured by the regex. 88 cffTextStr = cffTextStr.replace(/<br>/g, "<br> "); 89 $cffText.html( cffTextStr.replace( regex , replacer ) ); 90 } 91 } 92 93 //Replace hashtags in desc 94 if( $self.find('.cff-post-desc').length > 0 ) $self.find('.cff-post-desc').html( cffDescStr.replace( regex , replacer ) ); 95 } 96 cffLinkHashtags(); 97 98 //Add target attr to post text links via JS so aren't included in char count 99 $self.find('.cff-text a').add( $self.find('.cff-post-desc a') ).attr({ 100 'target' : '_blank', 101 'rel' : 'nofollow' 102 }); 103 104 105 //Share toolip function 106 $self.find('.cff-share-link').unbind().bind('click', function(){ 107 $self.find('.cff-share-tooltip').toggle(); 108 }); 109 110 111 }); //End .cff-item each 112});
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.