aggiunti badges, aggiunta funzionalità cerca cat gramm in html Nick
This commit is contained in:
parent
f264bd78a4
commit
af3eea70f9
|
@ -898,7 +898,11 @@
|
||||||
name="search-circle"></ion-icon></label>
|
name="search-circle"></ion-icon></label>
|
||||||
<button type="submit"
|
<button type="submit"
|
||||||
class="btn bg-light-gray b--gray btn-outline-primary"
|
class="btn bg-light-gray b--gray btn-outline-primary"
|
||||||
id="BottoneCerca">Cerca</button>
|
id="BottoneCerca">Cerca</button> 
|
||||||
|
<button class="btn bg-light-gray b--gray btn-outline-primary" type="submit" id='searchcomm'>Cerca cat. gramm.</button>
|
||||||
|
<button class="btn btn-sm btn-outline-lida4 m-2 my-sm-0" type="submit" id='cleanresult' aria-expanded="false" aria-controls="collapseExample">
|
||||||
|
Reset
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -14,7 +14,7 @@ $(document).ready(function() {
|
||||||
const ddmenus={"Inferno":"#dmc1",
|
const ddmenus={"Inferno":"#dmc1",
|
||||||
"Purgatorio": "#dmc2",
|
"Purgatorio": "#dmc2",
|
||||||
"Paradiso": "#dmc3"}
|
"Paradiso": "#dmc3"}
|
||||||
var listarisultativersi=[];
|
|
||||||
var currentMinimap=''
|
var currentMinimap=''
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ $(document).ready(function() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.labelCantica span').html("Inferno");
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ $(document).ready(function() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.labelCantica span').html("Purgatorio");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//caricamento terza cantica
|
//caricamento terza cantica
|
||||||
|
@ -79,8 +79,6 @@ $(document).ready(function() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.labelCantica span').html("Paradiso");
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
var mmih=0
|
var mmih=0
|
||||||
|
@ -199,12 +197,13 @@ jQuery(document).delegate('#cleanresult', 'click', function(e) {
|
||||||
|
|
||||||
function cleanSearchResult(){
|
function cleanSearchResult(){
|
||||||
|
|
||||||
for (verso of listarisultativersi){
|
for (verso of listarisultati){
|
||||||
idverso='#'+verso
|
idverso='#'+verso
|
||||||
console.log(idverso)
|
//console.log(idverso)
|
||||||
//$(idverso).attr('class', $(idverso).attr('class').replace(" dark-blue", ""))
|
|
||||||
$(idverso).attr('class', 'f6 font-weight-lighter')
|
$(idverso).attr('class', 'f6 font-weight-lighter')
|
||||||
}
|
}
|
||||||
|
$( ".badge" ).remove();
|
||||||
|
listarisultati=[]
|
||||||
if (currentMinimap!='')
|
if (currentMinimap!='')
|
||||||
showMinimap(currentMinimap)
|
showMinimap(currentMinimap)
|
||||||
}
|
}
|
||||||
|
@ -378,7 +377,7 @@ jQuery(document).delegate('#cleanresult', 'click', function(e) {
|
||||||
|
|
||||||
console.log (minimapSize.style.paddingTop)
|
console.log (minimapSize.style.paddingTop)
|
||||||
|
|
||||||
viewer.style.paddingTop = `${(winRatio) * 100}%`;
|
viewer.style.paddingTop = `${(winRatio) * 53}%`;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -420,6 +419,8 @@ jQuery(document).delegate('#cleanresult', 'click', function(e) {
|
||||||
|
|
||||||
//end minimap management
|
//end minimap management
|
||||||
|
|
||||||
|
// Search functions
|
||||||
|
|
||||||
async function executeQueryVersi(query) {
|
async function executeQueryVersi(query) {
|
||||||
bindingsStream = await myEngine.queryBindings(query, { sources: [{ type: 'sparql', value: sparqlEndpoint },], });
|
bindingsStream = await myEngine.queryBindings(query, { sources: [{ type: 'sparql', value: sparqlEndpoint },], });
|
||||||
alert(query)
|
alert(query)
|
||||||
|
@ -532,6 +533,8 @@ jQuery(document).delegate('#cleanresult', 'click', function(e) {
|
||||||
var spanoccorrenza=$('<span />')
|
var spanoccorrenza=$('<span />')
|
||||||
var pos=parseInt(element.pos)
|
var pos=parseInt(element.pos)
|
||||||
spanoccorrenza.attr('id', element.cantica+"_"+ element.canto.replace(" ", "_")+"_"+element.numverso+"_"+pos)
|
spanoccorrenza.attr('id', element.cantica+"_"+ element.canto.replace(" ", "_")+"_"+element.numverso+"_"+pos)
|
||||||
|
if (listarisultati.includes(spanoccorrenza.attr('id')))
|
||||||
|
spanoccorrenza.attr('class', "f6 b dark-blue ")
|
||||||
spanoccorrenza.append(managePunctuation(element.form))
|
spanoccorrenza.append(managePunctuation(element.form))
|
||||||
elementoverso=$('#'+element.cantica+"_"+ element.canto.replace(" ", "_")+"_"+element.numverso)
|
elementoverso=$('#'+element.cantica+"_"+ element.canto.replace(" ", "_")+"_"+element.numverso)
|
||||||
spanoccorrenza.appendTo(elementoverso)
|
spanoccorrenza.appendTo(elementoverso)
|
||||||
|
@ -549,33 +552,70 @@ jQuery(document).delegate('#cleanresult', 'click', function(e) {
|
||||||
};
|
};
|
||||||
|
|
||||||
//execute query
|
//execute query
|
||||||
|
var listarisultati=[];
|
||||||
async function executeQuerySearch(query) {
|
async function executeQuerySearch(query) {
|
||||||
seachbBindingsStream = await myEngine.queryBindings(query, { sources: [{ type: 'sparql', value: sparqlEndpoint },], });
|
seachbBindingsStream = await myEngine.queryBindings(query, { sources: [{ type: 'sparql', value: sparqlEndpoint },], });
|
||||||
//console.log(query)
|
//console.log(query)
|
||||||
alert(query)
|
alert(query)
|
||||||
try {
|
try {
|
||||||
var resultVersi = new Set()
|
var result = new Set()
|
||||||
|
var resultsInCantica=[]
|
||||||
|
var resultsInCanto=[]
|
||||||
seachbBindingsStream.on('data', (binding) => {
|
seachbBindingsStream.on('data', (binding) => {
|
||||||
//cantica
|
//cantica
|
||||||
cantica = binding.get('Cantica').value;
|
cantica = binding.get('Cantica').value;
|
||||||
|
resultsInCantica.push(cantica);
|
||||||
//canto
|
//canto
|
||||||
canto=binding.get('Canto').value;
|
canto=binding.get('Canto').value;
|
||||||
|
resultsInCanto.push(cantica+canto)
|
||||||
//numero del verso
|
//numero del verso
|
||||||
numverso=binding.get('NumeroVerso').value;
|
numverso=binding.get('NumeroVerso').value;
|
||||||
//posizione delframmento
|
//posizione delframmento
|
||||||
pos=binding.get('pos').value;
|
pos=binding.get('pos').value;
|
||||||
resultVersi.add(cantica+"_"+canto.replace(" ", "_")+"_"+numverso+"_"+pos)
|
result.add(cantica+"_"+canto.replace(" ", "_")+"_"+numverso+"_"+pos)
|
||||||
|
|
||||||
});
|
});
|
||||||
seachbBindingsStream.on('end', () => {
|
seachbBindingsStream.on('end', () => {
|
||||||
listarisultativersi = Array.from(resultVersi)
|
listarisultati = Array.from(result)
|
||||||
for (verso of listarisultativersi){
|
cantiche=["Inferno", "Purgatorio", "Paradiso"]
|
||||||
idverso='#'+verso
|
|
||||||
//console.log(idverso)
|
//evidenzia risultati
|
||||||
$(idverso).attr('class', "f6 b dark-blue ")
|
for (ris of listarisultati){
|
||||||
|
idris='#'+ris
|
||||||
|
$(idris).attr('class', "f6 b dark-blue ")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//aggiunge badge con totale risultati accanto alle cantiche
|
||||||
|
i=0
|
||||||
|
for(cantica of cantiche){
|
||||||
|
i+=1
|
||||||
|
let count = resultsInCantica.reduce((n, x) => n + (x === cantica), 0);
|
||||||
|
//<span class="badge badge-primary badge-pill"></span>
|
||||||
|
var spanbadge=$('<span />');
|
||||||
|
spanbadge.attr('class', 'badge badge-primary badge-pill');
|
||||||
|
spanbadge.append(count)
|
||||||
|
spanbadge.insertAfter($('#cantica'+i))
|
||||||
|
}
|
||||||
|
//aggiunge badge con totale risultati accanto ai canti
|
||||||
|
|
||||||
|
for(cantica of cantiche){
|
||||||
|
for( k of Array(35).keys()){
|
||||||
|
if (k==0)
|
||||||
|
continue
|
||||||
|
let count = resultsInCanto.reduce((n, x) => n + (x === cantica+'Canto '+k), 0);
|
||||||
|
//<span class="badge badge-primary badge-pill"></span>
|
||||||
|
|
||||||
|
var spanbadge=$('<span />');
|
||||||
|
spanbadge.attr('class', 'badge badge-notification ');
|
||||||
|
spanbadge.append('('+count+')')
|
||||||
|
//$("[name='nameofobject']")
|
||||||
|
spanbadge.appendTo($('[name="'+cantica+'Canto '+k+'"]'))
|
||||||
|
//spanbadge.insertAfter($('[name="'+cantica+'Canto '+k+'"]'))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//aggiorna minimap
|
||||||
if (currentMinimap!=''){
|
if (currentMinimap!=''){
|
||||||
|
|
||||||
showMinimap(currentMinimap)
|
showMinimap(currentMinimap)
|
||||||
|
|
Loading…
Reference in New Issue