Last active
October 8, 2017 21:31
-
-
Save aldolat/10597951 to your computer and use it in GitHub Desktop.
Removing title attribute and links shortening
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function(){ | |
// Remove the title attribute from all links with "pis-thumbnail-link" class. | |
jQuery('a.pis-thumbnail-link').removeAttr("title"); | |
// Shorten all links with "pis-title-link" class to 9 characters if they are longer than 10 characters. | |
jQuery('a.pis-title-link').each(function(){ | |
var str = jQuery(this).text(); | |
str = str.trim(str); | |
if (str.length > 10) { | |
jQuery(this).text(str.substr(0, 9)); | |
jQuery(this).append('…'); | |
} | |
}); | |
// Change all the HTML arrows into a raquo. | |
jQuery('.pis-arrow').text('»'); | |
// Change the HTML arrows of titles only into a raquo. | |
jQuery('.pis-title-link .pis-arrow').text('»'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment