badge canto work in progress

This commit is contained in:
cesare 2022-11-18 12:48:53 +01:00
parent fbdb864f4f
commit eadd4e0288
3 changed files with 11 additions and 9 deletions

View File

@ -170,8 +170,8 @@ p{
margin-bottom: 60px; margin-bottom: 60px;
} }
.titolo-canto { .titolo-canto {
margin-bottom: 5px; margin-bottom: 8px;
font-size: 40px; font-size: 24px;
} }
.canto-meta { .canto-meta {
margin-bottom: 20px; margin-bottom: 20px;

View File

@ -99,7 +99,7 @@
<div id="collapseOne" class="collapse show" <div id="collapseOne" class="collapse show"
aria-labelledby="headingOne" data-parent="#accordion"> aria-labelledby="headingOne" data-parent="#accordion">
<div class="card-body"> <div class="card-body">
<span class="navig-canto small text-muted" name="InfernoCanto 1" href="#" style="line-height: 1.2em">1<span class="badge badge-outline-info badge-pill">14</span></span> <span class="navig-canto small text-muted" name="InfernoCanto 1" href="#" style="line-height: 1.2em">1</span>
<span class="navig-canto small text-muted" name="InfernoCanto 2" href="#" style="line-height: 1.2em">2</span> <span class="navig-canto small text-muted" name="InfernoCanto 2" href="#" style="line-height: 1.2em">2</span>
<span class="navig-canto small text-muted" name="InfernoCanto 3" href="#" style="line-height: 1.2em">3</span> <span class="navig-canto small text-muted" name="InfernoCanto 3" href="#" style="line-height: 1.2em">3</span>
<span class="navig-canto small text-muted" name="InfernoCanto 4" href="#" style="line-height: 1.2em">4</span> <span class="navig-canto small text-muted" name="InfernoCanto 4" href="#" style="line-height: 1.2em">4</span>

View File

@ -3,6 +3,7 @@
*/ */
$(document).ready(function() { $(document).ready(function() {
const cantobadgeclass='badge badge-outline-info badge-pill'
const sparqlGenerator = sparqljs.Generator; const sparqlGenerator = sparqljs.Generator;
const myEngine = new Comunica.QueryEngine(); const myEngine = new Comunica.QueryEngine();
@ -505,8 +506,8 @@ jQuery(document).delegate('#cleanresult', 'click', function(e) {
//licanto.appendTo('#listacanti') //licanto.appendTo('#listacanti')
licanto.appendTo(divListaCanti) licanto.appendTo(divListaCanti)
var divcanto = $('<div />') var divcanto = $('<div />')
var titolocanto = $('<h1 class="f3 font-weight-lighter titolo-canto" />') var titolocanto = $('<h1 class="f3 titolo-canto" />')
titolocanto.append(canto) titolocanto.append(cantica+", "+canto)
divcanto.attr('class', 'canto') divcanto.attr('class', 'canto')
divcanto.attr('style', 'display:none') divcanto.attr('style', 'display:none')
divcanto.attr('id', (cantica + canto).replace(" ", "_")) divcanto.attr('id', (cantica + canto).replace(" ", "_"))
@ -592,7 +593,8 @@ jQuery(document).delegate('#cleanresult', 'click', function(e) {
let count = resultsInCantica.reduce((n, x) => n + (x === cantica), 0); let count = resultsInCantica.reduce((n, x) => n + (x === cantica), 0);
//<span class="badge badge-primary badge-pill"></span> //<span class="badge badge-primary badge-pill"></span>
var spanbadgecantica=$('<span />'); var spanbadgecantica=$('<span />');
spanbadgecantica.attr('class', 'badge badge-primary badge-pill'); spanbadgecantica.attr('class', 'badge badge-primary badge-pill ml-1');
//spanbadgecantica.attr('class', 'position-absolute top-0 start-100 translate-middle badge rounded-pill badge-primary');
spanbadgecantica.append(count) spanbadgecantica.append(count)
//spanbadgecantica.insertAfter($('#cantica'+i)) //spanbadgecantica.insertAfter($('#cantica'+i))
spanbadgecantica.appendTo($('#cantica'+i)) spanbadgecantica.appendTo($('#cantica'+i))
@ -604,11 +606,11 @@ jQuery(document).delegate('#cleanresult', 'click', function(e) {
if (k==0) if (k==0)
continue continue
let count = resultsInCanto.reduce((n, x) => n + (x === cantica+'Canto '+k), 0); let count = resultsInCanto.reduce((n, x) => n + (x === cantica+'Canto '+k), 0);
//<span class="badge badge-primary badge-pill"></span> //<span class="badge badge-outline-info badge-pill">14</span>
var spanbadge=$('<span />'); var spanbadge=$('<span />');
spanbadge.attr('class', 'badge badge-notification '); spanbadge.attr('class', cantobadgeclass);
spanbadge.append('('+count+')') spanbadge.append(count)
//$("[name='nameofobject']") //$("[name='nameofobject']")
spanbadge.appendTo($('[name="'+cantica+'Canto '+k+'"]')) spanbadge.appendTo($('[name="'+cantica+'Canto '+k+'"]'))
//spanbadge.insertAfter($('[name="'+cantica+'Canto '+k+'"]')) //spanbadge.insertAfter($('[name="'+cantica+'Canto '+k+'"]'))