diff --git a/cesareBrowse.html b/cesareBrowse.html index e587a06..e2e346d 100644 --- a/cesareBrowse.html +++ b/cesareBrowse.html @@ -5,12 +5,17 @@ browsing La Divina Commedia + + + + + @@ -18,11 +23,31 @@
-
@@ -35,35 +60,38 @@
-
- - - -
-
+
-
+
- -
+
+ + + +
+ + diff --git a/css/browsingldc.css b/css/browsingldc.css index 404be9b..8c1fdbb 100644 --- a/css/browsingldc.css +++ b/css/browsingldc.css @@ -89,7 +89,7 @@ p{ .blog-header { padding-top: 20px; - padding-bottom: 20px; + padding-bottom: 60px; } .blog-title { margin-top: 30px; @@ -108,8 +108,10 @@ p{ */ .blog-main { + padding: 15px; font-size: 18px; line-height: 1.5; + z-index: -1; } /* Sidebar modules for boxing content */ @@ -117,6 +119,7 @@ p{ padding: 15px; margin: 0 -15px 15px; position: fixed; + } .sidebar-module-inset { padding: 15px; @@ -130,6 +133,9 @@ p{ } + + + /* Pagination */ .pager { margin-bottom: 60px; @@ -221,7 +227,7 @@ p{ .minimap_container { position: fixed; top: 100px; - left: 900px; + left: 600px; min-width: 20px; z-index: 100; @@ -249,7 +255,8 @@ p{ z-index: 100; - border: 1px solid #0000009a; + /*border: 1px solid #0000009a; */ + border: 1px solid blue; } @@ -271,4 +278,20 @@ p{ border: 1px solid white; } +/* Autocomplete */ +#aco { + border: 1px dotted #ccc; + padding: 3px; +} +#aco ul { + list-style-type: none; + padding: 0; + margin: 0; +} +#aco ul li { + padding: 5px 0; +} +#aco ul li:hover { + background: #eee; +} diff --git a/js/cesareBrowse.js b/js/cesareBrowse.js index b185a39..b81df52 100644 --- a/js/cesareBrowse.js +++ b/js/cesareBrowse.js @@ -11,14 +11,16 @@ $(document).ready(function() { var secondaCanticaLoaded = false; var terzaCanticaLoaded = false; var listaVersi = new Set() + const ddmenus={"Inferno":"#dmc1", + "Purgatorio": "#dmc2", + "Paradiso": "#dmc3"} + var listarisultativersi=[]; + var currentMinimap='' + //caricamento prima cantica $('#cantica1').on('click', function() { - $('.canto').each(function() { - $(this).attr("style", 'display:none'); - }); - hideListaCanti() - $( ".minimap_container" ).remove(); + hideMinimap(); activateMenuItem('#cantica1') if (!(primaCanticaLoaded)) { @@ -34,16 +36,13 @@ $(document).ready(function() { } + }); //caricamento seconda cantica $('#cantica2').on('click', function() { - $('.canto').each(function() { - $(this).attr("style", 'display:none'); - }); - hideListaCanti() - $( ".minimap_container" ).remove(); + hideMinimap(); activateMenuItem('#cantica2') if (!(secondaCanticaLoaded)) { @@ -57,16 +56,13 @@ $(document).ready(function() { $("#CantiPurgatorio").attr('style', 'display:block') } + }); //caricamento terza cantica $('#cantica3').on('click', function() { - $('.canto').each(function() { - $(this).attr("style", 'display:none'); - }); - hideListaCanti() - $( ".minimap_container" ).remove(); + hideMinimap(); activateMenuItem('#cantica3') if (!(terzaCanticaLoaded)) { @@ -80,6 +76,7 @@ $(document).ready(function() { $("#CantiParadiso").attr('style', 'display:block') } + }); @@ -89,30 +86,53 @@ $(document).ready(function() { }); $("#" + $(this).attr('name').replace(" ", "_")).attr('style', 'display:block') showMinimap($(this).attr('name').replace(" ", "_")) + currentMinimap=$(this).attr('name').replace(" ", "_"); }); + //Query + + + //$('#searchcomm').on('click', function() { + jQuery(document).delegate('#searchcomm', 'click', function(e) { + + cleanSearchResult() + esprlogica=[] + + esprlogica.push('Clausola1') + condizioni={"EsprLogica": esprlogica} + clausola={} + clausola['typeGramm0']=$('#queryText').val() + + + + clausola['queryText']="" + condizioni['Clausola1']=clausola + jsonQuery=buildSQ(condizioni) + myquery =new sparqlGenerator().stringify(jsonQuery) + + executeQuerySearch(myquery) + if (currentMinimap!='') + showMinimap(currentMinimap) + + +}); + //Utility functions //activate navigation menu items function activateMenuItem(menuItem) { - $('.blog-nav-item').each(function() { - $(this).attr("class", $(this).attr("class").replace(' active', '')); - }); - $(menuItem).attr("class", $(menuItem).attr("class") + ' active'); + //$('.blog-nav-item').each(function() { + // $(this).attr("class", $(this).attr("class").replace(' active', '')); + //}); + //$(menuItem).attr("class", $(menuItem).attr("class") + ' active'); } - //hides liste canti + - function hideListaCanti() { - $("#CantiInferno").attr('style', 'display:none') - $("#CantiPurgatorio").attr('style', 'display:none') - $("#CantiParadiso").attr('style', 'display:none') - } - - // utils + function managePunctuation(stringa) { var tempstringa=stringa.replaceAll(" ,", ",") tempstringa=tempstringa.replaceAll(" .", ".") @@ -123,6 +143,16 @@ $(document).ready(function() { return tempstringa } + function cleanSearchResult(){ + + for (verso of listarisultativersi){ + idverso='#'+verso + console.log(idverso) + $(idverso).attr('class', $(idverso).attr('class').replace(" dark-blue ", "")) + } + if (currentMinimap!='') + showMinimap(currentMinimap) + } //minimap management let minimap = document.createElement('div'); @@ -185,6 +215,14 @@ $(document).ready(function() { function trackScroll(){ viewer.style.transform=`translateY(${window.scrollY * realScale}px)` } + + function hideMinimap(){ + $('.canto').each(function() { + $(this).attr("style", 'display:none'); + }); + $( ".minimap_container" ).remove(); + currentMinimap='' + } //end minimap management @@ -192,70 +230,125 @@ $(document).ready(function() { bindingsStream = await myEngine.queryBindings(query, { sources: [{ type: 'sparql', value: sparqlEndpoint },], }); alert(query) try { + var listaCanti = new Set() + listaVersi = new Set() let cantica = 0; bindingsStream.on('data', (binding) => { - //cantica - cantica = binding.get('Cantica').value; - //la lista dei canti - listaCanti.add(binding.get('Canto').value) - //la lista dei versi - var obj = new Object(); - obj.numverso = binding.get('NumeroVerso').value; - obj.verso = binding.get('Verso').value; - obj.canto = binding.get('Canto').value; - obj.from = binding.get('from').value; - obj.to = binding.get('to').value; - listaVersi.add(obj) + //cantica + cantica = binding.get('Cantica').value; + //la lista dei canti + listaCanti.add(binding.get('Canto').value) + //la lista dei versi + var obj = new Object(); + obj.numverso = binding.get('NumeroVerso').value; + obj.verso = binding.get('Verso').value; + obj.canto = binding.get('Canto').value; + obj.from = binding.get('from').value; + obj.to = binding.get('to').value; + obj.cantica = cantica; + listaVersi.add(obj) + }); bindingsStream.on('end', () => { + + - var orderedListaCanti = Array.from(listaCanti) - orderedListaCanti = orderedListaCanti.sort((a, b) => { - if (parseInt(a.split(" ")[1]) < parseInt(b.split(" ")[1])) { - return -1; + var orderedListaCanti = Array.from(listaCanti) + orderedListaCanti = orderedListaCanti.sort((a, b) => { + if (parseInt(a.split(" ")[1]) < parseInt(b.split(" ")[1])) { + return -1; + } + }); + + var orderedListaVersi = Array.from(listaVersi) + orderedListaVersi = orderedListaVersi.sort((a, b) => { + if (parseInt(a.numverso) < parseInt(b.numverso)) { + return -1; + } + }); + + var divListaCanti = $('
') + for (canto of orderedListaCanti) { + var licanto = $('