From ece11de942d7e93f52f00992fcaf5706b9d10820 Mon Sep 17 00:00:00 2001 From: hexeth <7627137+hexeth@users.noreply.github.com> Date: Fri, 4 Jan 2019 11:39:11 -0800 Subject: [PATCH 1/3] Fix publisher not formatting correct (#747) --- cps/static/js/caliBlur.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cps/static/js/caliBlur.js b/cps/static/js/caliBlur.js index fb4c930b..4cf54493 100644 --- a/cps/static/js/caliBlur.js +++ b/cps/static/js/caliBlur.js @@ -215,11 +215,15 @@ if ( $( 'body.book' ).length > 0 ) { .prepend( '
' ); // Fix-up book detail headings - publisher = $( '.publishers p span' ).text().split( ': ' ); +publisher = $( '.publishers p span' ).text().split( ':' ); $( '.publishers p span' ).remove(); $.each(publisher, function(i, val) { $( '.publishers' ).append( '' + publisher[i] + '' ); }); +$( '.publishers span:nth-child(2)' ).text(function() { +return $(this).text().replace(/^\s+/g, ""); +}); + published = $( '.book-meta p:contains("Publishing date")' ) .text().split(': '); $( '.book-meta p:contains("Publishing date")' ) From 29c9d55498a7b51e7706a2e7ba519c71f3eaac80 Mon Sep 17 00:00:00 2001 From: hexeth <7627137+hexeth@users.noreply.github.com> Date: Fri, 4 Jan 2019 12:49:01 -0800 Subject: [PATCH 2/3] Remove leading space in span (#749) Previous code was not targeting right element, additionally was only removing a single leading space. New regex will remove any leading spaces from span --- cps/static/js/caliBlur.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cps/static/js/caliBlur.js b/cps/static/js/caliBlur.js index 4cf54493..0d80860e 100644 --- a/cps/static/js/caliBlur.js +++ b/cps/static/js/caliBlur.js @@ -220,8 +220,8 @@ publisher = $( '.publishers p span' ).text().split( ':' ); $.each(publisher, function(i, val) { $( '.publishers' ).append( '' + publisher[i] + '' ); }); -$( '.publishers span:nth-child(2)' ).text(function() { -return $(this).text().replace(/^\s+/g, ""); +$( '.publishers span:nth-child(3)' ).text(function() { +return $(this).text().replace(/^\s+|^\t+|\t+|\s+$/g, ""); }); published = $( '.book-meta p:contains("Publishing date")' ) From 4927bd226fafd436edd0d40bd4816b4ce30fb28c Mon Sep 17 00:00:00 2001 From: manad777