From b4b2b2d2556ce063f8e3fe3bf60f5ebf73b5bd82 Mon Sep 17 00:00:00 2001 From: cesare Date: Tue, 4 Oct 2022 10:51:37 +0200 Subject: [PATCH 1/3] modificata return list query --- js/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/utils.js b/js/utils.js index e63a4cd..2be724e 100644 --- a/js/utils.js +++ b/js/utils.js @@ -9,7 +9,7 @@ PREFIX ontolex: PREFIX olires: -SELECT (?form as ?IRIForma) (?Rappresentazione as ?Forma) (?lm as ?Lemma) (?textver as ?Verso) ?NumVerso +SELECT (?form as ?IRIForma) (?Rappresentazione as ?Forma) (?lm as ?Lemma) (?textver as ?Verso) (?NumVerso as ?NumeroVerso) (?t_canto as ?Canto) (?t_cantica as ?Cantica) From 250c3be1795646c875fd4afdbb38204cad4d6a05 Mon Sep 17 00:00:00 2001 From: Luca Trupiano Date: Tue, 4 Oct 2022 12:41:58 +0200 Subject: [PATCH 2/3] corretto table header e aggiunto jquery touch --- css/custom.css | 1 - js/jquery.ui.touch-punch.js | 244 ++++++++++++++++++++++++++++++++++++ js/script_Luk_Q.js | 8 +- 3 files changed, 248 insertions(+), 5 deletions(-) create mode 100644 js/jquery.ui.touch-punch.js diff --git a/css/custom.css b/css/custom.css index 3ff0c46..8b7b7f6 100644 --- a/css/custom.css +++ b/css/custom.css @@ -1141,7 +1141,6 @@ a.text-lidaBG1:hover, a.text-lidaBG1:focus { - spinner-indicator ------------------------------------*/ -th{ color: white; } .modal-busy { position: fixed; z-index: 999; diff --git a/js/jquery.ui.touch-punch.js b/js/jquery.ui.touch-punch.js new file mode 100644 index 0000000..b6ce1e0 --- /dev/null +++ b/js/jquery.ui.touch-punch.js @@ -0,0 +1,244 @@ +/*! + * jQuery UI Touch Punch 1.0.8 as modified by RWAP Software + * based on original touchpunch v0.2.3 which has not been updated since 2014 + * + * Updates by RWAP Software to take account of various suggested changes on the original code issues + * + * Original: https://github.com/furf/jquery-ui-touch-punch + * Copyright 2011–2014, Dave Furfero + * Dual licensed under the MIT or GPL Version 2 licenses. + * + * Fork: https://github.com/RWAP/jquery-ui-touch-punch + * + * Depends: + * jquery.ui.widget.js + * jquery.ui.mouse.js + */ + +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + + // AMD. Register as an anonymous module. + define([ "jquery", "jquery-ui" ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function ($) { + + // Detect touch support - Windows Surface devices and other touch devices + $.support.mspointer = window.navigator.msPointerEnabled; + $.support.touch = ( 'ontouchstart' in document + || 'ontouchstart' in window + || window.TouchEvent + || (window.DocumentTouch && document instanceof DocumentTouch) + || navigator.maxTouchPoints > 0 + || navigator.msMaxTouchPoints > 0 + ); + + // Ignore browsers without touch or mouse support + if ((!$.support.touch && !$.support.mspointer) || !$.ui.mouse) { + return; + } + + var mouseProto = $.ui.mouse.prototype, + _mouseInit = mouseProto._mouseInit, + _mouseDestroy = mouseProto._mouseDestroy, + touchHandled; + + /** + * Get the x,y position of a touch event + * @param {Object} event A touch event + */ + function getTouchCoords (event) { + return { + x: event.originalEvent.changedTouches[0].pageX, + y: event.originalEvent.changedTouches[0].pageY + }; + } + + /** + * Simulate a mouse event based on a corresponding touch event + * @param {Object} event A touch event + * @param {String} simulatedType The corresponding mouse event + */ + function simulateMouseEvent (event, simulatedType) { + + // Ignore multi-touch events + if (event.originalEvent.touches.length > 1) { + return; + } + + // Prevent "Ignored attempt to cancel a touchmove event with cancelable=false" errors + if (event.cancelable) { + event.preventDefault(); + } + + var touch = event.originalEvent.changedTouches[0], + simulatedEvent = document.createEvent('MouseEvents'); + + // Initialize the simulated mouse event using the touch event's coordinates + simulatedEvent.initMouseEvent( + simulatedType, // type + true, // bubbles + true, // cancelable + window, // view + 1, // detail + touch.screenX, // screenX + touch.screenY, // screenY + touch.clientX, // clientX + touch.clientY, // clientY + false, // ctrlKey + false, // altKey + false, // shiftKey + false, // metaKey + 0, // button + null // relatedTarget + ); + + // Dispatch the simulated event to the target element + event.target.dispatchEvent(simulatedEvent); + } + + /** + * Handle the jQuery UI widget's touchstart events + * @param {Object} event The widget element's touchstart event + */ + mouseProto._touchStart = function (event) { + + var self = this; + + // Interaction time + this._startedMove = event.timeStamp; + + // Track movement to determine if interaction was a click + self._startPos = getTouchCoords(event); + + // Ignore the event if another widget is already being handled + if (touchHandled || !self._mouseCapture(event.originalEvent.changedTouches[0])) { + return; + } + + // Set the flag to prevent other widgets from inheriting the touch event + touchHandled = true; + + // Track movement to determine if interaction was a click + self._touchMoved = false; + + // Simulate the mouseover event + simulateMouseEvent(event, 'mouseover'); + + // Simulate the mousemove event + simulateMouseEvent(event, 'mousemove'); + + // Simulate the mousedown event + simulateMouseEvent(event, 'mousedown'); + }; + + /** + * Handle the jQuery UI widget's touchmove events + * @param {Object} event The document's touchmove event + */ + mouseProto._touchMove = function (event) { + + // Ignore event if not handled + if (!touchHandled) { + return; + } + + // Interaction was moved + this._touchMoved = true; + + // Simulate the mousemove event + simulateMouseEvent(event, 'mousemove'); + }; + + /** + * Handle the jQuery UI widget's touchend events + * @param {Object} event The document's touchend event + */ + mouseProto._touchEnd = function (event) { + + // Ignore event if not handled + if (!touchHandled) { + return; + } + + // Simulate the mouseup event + simulateMouseEvent(event, 'mouseup'); + + // Simulate the mouseout event + simulateMouseEvent(event, 'mouseout'); + + // If the touch interaction did not move, it should trigger a click + // Check for this in two ways - length of time of simulation and distance moved + // Allow for Apple Stylus to be used also + var timeMoving = event.timeStamp - this._startedMove; + if (!this._touchMoved || timeMoving < 500) { + // Simulate the click event + simulateMouseEvent(event, 'click'); + } else { + var endPos = getTouchCoords(event); + if ((Math.abs(endPos.x - this._startPos.x) < 10) && (Math.abs(endPos.y - this._startPos.y) < 10)) { + + // If the touch interaction did not move, it should trigger a click + if (!this._touchMoved || event.originalEvent.changedTouches[0].touchType === 'stylus') { + // Simulate the click event + simulateMouseEvent(event, 'click'); + } + } + } + + // Unset the flag to determine the touch movement stopped + this._touchMoved = false; + + // Unset the flag to allow other widgets to inherit the touch event + touchHandled = false; + }; + + /** + * A duck punch of the $.ui.mouse _mouseInit method to support touch events. + * This method extends the widget with bound touch event handlers that + * translate touch events to mouse events and pass them to the widget's + * original mouse event handling methods. + */ + mouseProto._mouseInit = function () { + + var self = this; + + // Microsoft Surface Support = remove original touch Action + if ($.support.mspointer) { + self.element[0].style.msTouchAction = 'none'; + } + + // Delegate the touch handlers to the widget's element + self.element.on({ + touchstart: $.proxy(self, '_touchStart'), + touchmove: $.proxy(self, '_touchMove'), + touchend: $.proxy(self, '_touchEnd') + }); + + // Call the original $.ui.mouse init method + _mouseInit.call(self); + }; + + /** + * Remove the touch event handlers + */ + mouseProto._mouseDestroy = function () { + + var self = this; + + // Delegate the touch handlers to the widget's element + self.element.off({ + touchstart: $.proxy(self, '_touchStart'), + touchmove: $.proxy(self, '_touchMove'), + touchend: $.proxy(self, '_touchEnd') + }); + + // Call the original $.ui.mouse destroy method + _mouseDestroy.call(self); + }; + +})); diff --git a/js/script_Luk_Q.js b/js/script_Luk_Q.js index b4334a9..af24cae 100644 --- a/js/script_Luk_Q.js +++ b/js/script_Luk_Q.js @@ -372,11 +372,11 @@ $(document).ready(function() { jsonQuery = buildSQ(queryJson); queryFields = []; for (var i in jsonQuery.variables) { - if (jsonQuery.variables[i].value) { - queryFields.push(jsonQuery.variables[i].value); - } else { + //if (jsonQuery.variables[i].value) { + //queryFields.push(jsonQuery.variables[i].value); + //} else { queryFields.push(jsonQuery.variables[i].variable.value); - } + //} } execQuery = new sparqlGenerator().stringify(jsonQuery); executeQuery(); From dceda0ee9be6f7a0c8c420a0c1fa5a8e72a5ed4b Mon Sep 17 00:00:00 2001 From: cesare Date: Tue, 4 Oct 2022 13:31:05 +0200 Subject: [PATCH 3/3] mapping filtri in query sparql, in progress --- index_work_Nik.html | 100 ++++++++++++++++++++++---------------------- js/utils.js | 67 +++++++++++++++++++++++++++-- 2 files changed, 114 insertions(+), 53 deletions(-) diff --git a/index_work_Nik.html b/index_work_Nik.html index 1976be7..eba9462 100644 --- a/index_work_Nik.html +++ b/index_work_Nik.html @@ -961,12 +961,12 @@
- +
- +
@@ -975,17 +975,17 @@
-
+
@@ -997,13 +997,13 @@
@@ -1014,8 +1014,8 @@
-
@@ -1029,12 +1029,12 @@
@@ -1054,12 +1054,12 @@
- +
- +
@@ -1074,12 +1074,12 @@
@@ -1091,12 +1091,12 @@
- +
- +
@@ -1104,12 +1104,12 @@
- +
- +
@@ -1118,12 +1118,12 @@
@@ -1136,13 +1136,13 @@ @@ -1150,7 +1150,7 @@
- - - - - - + + + + + +
diff --git a/js/utils.js b/js/utils.js index 2be724e..caad267 100644 --- a/js/utils.js +++ b/js/utils.js @@ -107,6 +107,8 @@ function buildSQ(stquery) { //Nick if (ftxt==null){ ftxt = document.getElementById("searchValue"); + myquery=buildClauseNick(stquery, parsedquery); + return (myquery) } @@ -137,6 +139,48 @@ function buildSQ(stquery) { return (parsedquery) } +//Nick +function buildClauseNick(clause, parsedquery){ + clause=clause['filtro-1'];//da modificare + + if (clause['query'] != null && clause['query'].trim() != "") { + if (clause['query'].trim().slice(-1) !=='*') + strval="^" +clause['query'].trim()+ "$"; + else + strval=clause['query'].trim().slice(0, -1) + + parsedquery.where[1].expression.args[1].value = strval; + if (clause['lemma_forma'] != null && clause['lemma_forma'] == 'lemma') + parsedquery.where[1].expression.args[0].value = "lm"; + } + else{ + parsedquery.where.splice(1, 1) + } + if (clause['categoria'] !=null && clause['categoria'] != "all") + parsedquery.where[0].triples.push(JSON.parse(data21)[clause['categoria']]); + + + if (clause['tipoClausola'] !=null && Object.keys(sottoCategorie).includes(clause['categoria'].trim())){ + //sctmp=JSON.parse(sottoCategorieSostantivi) + sctmp=sottoCategorie[clause['categoria'].trim()] + sctk=Object.keys(sctmp) + for (ke in sctk){ + + keval=clause[encodeURI(sctk[ke])] + if (keval!=null && keval!=''){ + sttmts=sctmp[sctk[ke]] + + subcatstat= buildsubcategoryClause(sttmts[keval]) + parsedquery.where[0].triples.push(subcatstat); + } + } + } + + return parsedquery + + +} + function buildClause(clause, parsedquery){ @@ -198,6 +242,17 @@ function buildsubcategoryClause(sttmnt){ } +/* +{ + "b": "VerboVolgareFunzioneAvverbio", + "l": "VerboVolgareFunzioneLocuzione" #CONTROLLARE +} + + +"Persona" : ["Qualsiasi persona", "1ª persona singolare", "2ª persona singolare", "3ª persona singolare", "1ª persona plurale", "2ª persona plurale", "3ª persona plurale"], + + +*/ var sottoCategorie = { "verbovolgare": {"Diatesi": {"Attivo": "TipoDiatesiVerboVolgare:VerboVolgareAttivo", "Passivo": "TipoDiatesiVerboVolgare:VerboVolgarePassivo"}, @@ -220,7 +275,14 @@ var sottoCategorie = { "Imperativo presente": "TipoTempoVerboVolgare:PresenteImperativoVerboVolgare", "Infinito presente": "TipoTempoVerboVolgare:PresenteInfinitoVerboVolgare", "Infinito passato": "TipoTempoVerboVolgare:PassatoInfinitoVerboVolgare", "Participio presente": "TipoTempoVerboVolgare:PresenteParticipioVerboVolgare", "Participio passato": "TipoTempoVerboVolgare:PassatoParticipioVerboVolgare", "Gerundio presente": "TipoTempoVerboVolgare:PresenteGerundioVerboVolgare", - "Gerundio passato": "TipoTempoVerboVolgare:PassatoGerundioVerboVolgare"} + "Gerundio passato": "TipoTempoVerboVolgare:PassatoGerundioVerboVolgare"}, + "Funzione": {"Aggettivo":"TipoFunzioneVerboVolgare:VerboVolgareFunzioneAggettivo", "Sostantivo maschile":"TipoFunzioneVerboVolgare:VerboVolgareFunzioneSostantivoMaschile", + "Sostantivo femminile":"TipoFunzioneVerboVolgare:VerboVolgareFunzioneSostantivoFemminile"}, + "Declinazione": {"Prima declinazione":"TipoDeclinazioneVerboVolgare:PrimaDeclinazioneVerboVolgare", "Seconda declinazione":"TipoDeclinazioneVerboVolgare:SecondaDeclinazioneVerboVolgare", + "Terza declinazione":"TipoDeclinazioneVerboVolgare:TerzaDeclinazioneVerboVolgare"}, + "Persona": {"1ª persona singolare": "TipoPersonaVerboVolgare:PrimaPersonaSingolareVerboVolgare", "2ª persona singolare": "TipoPersonaVerboVolgare:SecondaPersonaSingolareVerboVolgare", + "3ª persona singolare": "TipoPersonaVerboVolgare:TerzaPersonaSingolareVerboVolgare", "1ª persona plurale": "TipoPersonaVerboVolgare:PrimaPersonaPluraleVerboVolgare", + "2ª persona plurale": "TipoPersonaVerboVolgare:SecondaPersonaPluraleVerboVolgare", "3ª persona plurale": "TipoPersonaVerboVolgare:TerzaPersonaPluraleVerboVolgare"} }, @@ -239,8 +301,7 @@ var sottoCategorie = { "avverbiovolgare": "filtriavverbio", "preposizionevolgare": "filtripreposizione", "congiunzionevolgare": "filtricongiunzione", - "onomasticavolgare": { - "Tipo" :{"Nome proprio":"TipoDellOnomasticaVolgare:NomeProprio", "Nome proprio separato":"TipoDellOnomasticaVolgare:NomeProprioSeparato", + "onomasticavolgare": {"Tipo" :{"Nome proprio":"TipoDellOnomasticaVolgare:NomeProprio", "Nome proprio separato":"TipoDellOnomasticaVolgare:NomeProprioSeparato", "Titolo": "TipoDellOnomasticaVolgare:Titolo"} },