Cargo home Twitter Devlog

Change text of navigation links

Last Updated: Apr 16, 2013 01:32PM PDT

If you have access to Custom HTML, you can easily change the text of the links that appear in your project header ( "Index", "Next", etc).

<script type="text/javascript">
//Change text of thumbnail pagination element
function changePaginationText() {
    $(".pagination .next_page").text("new next page");
    $(".pagination .prev_page").text("new prev page");
    $(".pagination span").each(function(){
        var paginationText = $(this).text();
        paginationText = paginationText.replace( "of", "new of text");
        $(this).text(paginationText);
    });
}

//Change text of project next/index element
function changeProjectNavText() {
    $(".project_next a").text("New next text");
    $(".project_index a").text("New index text");
    if( $(".project_footer").length == 1) {
        var footerTags = $(".project_footer").html();
    
    // Change "filed under" in project footer
        footerTags = footerTags.replace( "Filed under", "new filed under text");
        footerTags = footerTags.replace(/,/g , "new comma");
        $(".project_footer").html(footerTags);
    }
}

//Change "Filter" and "view all" in filter pages
$(document).ready(function() {
    if ( Cargo.Location.IsUserFilter() ){
        var filterText = $(".view_tag_info").html();
        filterText = filterText.replace( "Filter", "new filter text");

        $(".view_tag_info").html(filterText);
        $(".view_tag_info a").text("new view all text");
    };

// Change text of "index" link on /solo pages
// example: http://cargocollective.com/warhol/Andy-Warhol-13/solo
    if ( Cargo.Location.IsSoloLink() ) {
        $(".editlink a").last().text("new index text");
    };
    changePaginationText();
    changeProjectNavText();
});

$(document).bind("projectLoadComplete", function(e, pid){
    changeProjectNavText();
});

$(document).bind("pageChangeComplete", function(e, newpage) { 
    changePaginationText();
});
</script> 
This is especially useful if you want to present your content in a language other than English.
tickets@cargocollective.com
http://assets1.desk.com/
desk
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
Invalid characters found
/customer/en/portal/articles/autocomplete