diff --git a/squelettes/content/scrutarijs.html b/squelettes/content/scrutarijs.html index e8a8921..9de2c76 100644 --- a/squelettes/content/scrutarijs.html +++ b/squelettes/content/scrutarijs.html @@ -1,3 +1,21 @@ +[===============================================================(#REM) +Configuration du client Scrutari +] + + + + [===============================================================(#REM) Déclaration du bloc destiné à recevoir le client ] @@ -24,39 +42,42 @@ Structure du client
-
+
- +
-
- Option de recherche avancée -
+
+ Option de recherche avancée +

- - ? - + Relations :

- Priorité :

- + Période :

- Élargir : @@ -70,16 +91,16 @@ Structure du client

-

Votre recherche

+

Votre recherche :

-
+

Filtrer les résultats : - + () - + () - + ()

@@ -89,7 +110,7 @@ Structure du client
- +
@@ -103,8 +124,8 @@ Structure du client

-
-

Vos résultats

+
+

Vos résultats

@@ -117,6 +138,7 @@ Structure du client +
@@ -178,3 +200,18 @@ voir https://framagit.org/Scrutari/scrutarijs/-/wikis/adaptation#reformuler-un-%
{{/for}} + + +[===============================================================(#REM) +Fenêtres +] + + + diff --git a/squelettes/head_js/scrutarijs.html b/squelettes/head_js/scrutarijs.html index 0109bd8..6533781 100644 --- a/squelettes/head_js/scrutarijs.html +++ b/squelettes/head_js/scrutarijs.html @@ -1,5 +1,3 @@ -[(#REM) Version 2.4.2 de Lity (à supprimer à la migration vers Spip 4.1)] -[] [(#REM) Version 1.0.7 de JsRender] @@ -17,6 +15,6 @@ [(#REM) Structure et gabarits par défaut] [] -[] [] + [] diff --git a/squelettes/javascript/scrutarijs/Scrutari.Lav.js b/squelettes/javascript/scrutarijs/Scrutari.Lav.js index 6edb104..a047c86 100644 --- a/squelettes/javascript/scrutarijs/Scrutari.Lav.js +++ b/squelettes/javascript/scrutarijs/Scrutari.Lav.js @@ -48,7 +48,7 @@ Scrutari.Lav.init = function (client) { if (Scrutari.Lav.DEV) { //Code propre à la version de développement, en production la structure est en dur dans le squelette Spip $("#" + client.clientId).html(client.compileStructure("main")); $("#zone").html(client.compileStructure("main", { - noLoc: true, + noLoc: false, withIndent: true, withPath: true })); @@ -218,29 +218,25 @@ Scrutari.Lav.FUNCTIONS = { initFilterByQuery: null, newResultProcess: function (client, scrutariResult, searchOrigin) { return Scrutari.Lav.newResultProcess(client, scrutariResult, searchOrigin); - } + }, + startLoading: null, + endLoading: null }; -/** - * Initialisation du client - */ -$(function () { - var scrutariConfig = new Scrutari.Config("libreavous", Scrutari.Lav.SCRUTARI_URL, "fr", "site", { - paginationLength: Scrutari.Lav.PAGINATION_LENGTH, - limit: -1 - }); - Scrutari.Client.init(scrutariConfig, "scrutari_client", { +Scrutari.Lav.getConfigOptions = function () { + return { + paginationLength: Scrutari.Lav.PAGINATION_LENGTH, + limit: -1 + }; +}; + +Scrutari.Lav.getInitOptions = function () { + return { withCorpus: false, ficheTarget: "_blank", ficheBodyList: "fiche_mtitre,fiche_msoustitre,libreavous_start_ul,fiche_primaryattributearray,fiche_mcomplementarray,fiche_secondaryattributearray,fiche_motclearray,fiche_bythesaurusarray,libreavous_end_ul", //Ajout de libreavous_start_ul et libreavous_end_ul, retrait de fiche_year - initialQuery: "", - initialQId: "", ignoreList: "area-title,area-stats,modal-*", //Utilisé en mode développement - permalinkPattern: "https://www.libreavous.org/spip.php?page=scrutarijs&qid=$QID", hooks: Scrutari.Lav.HOOKS, functions: Scrutari.Lav.FUNCTIONS - - }, function (client) { - - }); -}); + }; +}; diff --git a/squelettes/javascript/scrutarijs/frameworks/_default.js b/squelettes/javascript/scrutarijs/frameworks/_default.js index b810dad..426df1c 100644 --- a/squelettes/javascript/scrutarijs/frameworks/_default.js +++ b/squelettes/javascript/scrutarijs/frameworks/_default.js @@ -8,10 +8,10 @@ structure:{ 'area-title':'

', 'main-form':' {{area-input}} {{area-parameters}} ', 'main':'{{area-title}} {{main-form}} {{area-stats}} {{area-result}} {{modal-*}}', -'modal-help_mode':'', -'modal-help_periode':'', -'modal-help_ponderation':'', -'modal-loading':'', +'modal-help_mode':'', +'modal-help_periode':'', +'modal-help_ponderation':'', +'modal-loading':'', 'panel-base':'

_ title_filter_base _ filter_off

', 'panel-category':'

_ title_filter_category _ filter_off

', 'panel-corpus':'

_ title_filter_corpus _ filter_off

', diff --git a/squelettes/javascript/scrutarijs/frameworks/none.css b/squelettes/javascript/scrutarijs/frameworks/none.css deleted file mode 100644 index f74ddaf..0000000 --- a/squelettes/javascript/scrutarijs/frameworks/none.css +++ /dev/null @@ -1,169 +0,0 @@ -/***************************************************** -* .none-input -******************************************************/ - -.none-input-Container { - margin-bottom: 5px; -} - -.none-input-Search { - display: inline-block; -} - -.none-input-Submit { - display: inline-block; -} - -@media (min-width: 768px) { - - .none-input-Container { - display: flex; - align-items: center; - } - - .none-input-Search { - display: block; - flex-grow: 9; - } - - .none-input-Search > input { - width: 100%; - } - - .none-input-Submit { - display: block; - flex-grow: 1; - padding-left: 10px; - padding-right: 10px; - } - - .none-input-Parameters { - flex-basis: 34%; - width: 34%; - } - - .none-input-Parameters > button { - width: 100%; - } -} - - -/***************************************************** -* .none-overlay -******************************************************/ - -.none-overlay-Blocker { - position: fixed; - top: 0; right: 0; bottom: 0; left: 0; - width: 100%; height: 100%; - overflow: hidden; - z-index: 10000; - box-sizing: border-box; - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - padding: 20px; -} - -.none-overlay-Close { - position: absolute; - top: -12.5px; - right: -12.5px; - display: block; - width: 30px; - height: 30px; - border-radius: 15px; - border: none; - font-size: 20px; -} - -.none-overlay-Content { - min-width: 20vw; - max-width: 90vw; - max-height: 70vh; - overflow: auto; - padding: 10px 20px; - font-size: 0.9rem; -} - -.none-overlay-Dialog { - position: relative; - box-sizing: border-box; - max-width: 700px; -} - -.none-overlay-Footer { - padding: 0 0 8px 0; -} - -.none-overlay-Header { - border-bottom-width: 1px; - border-bottom-style: solid; - padding: 20px 10px; -} - -.none-overlay-Waiting { - cursor: wait; -} - - -/***************************************************** -* .none-panel -******************************************************/ - -.none-panel-Columns { - display: flex; -} - -.none-panel-Columns > div { - width: 25%; -} - -.none-panel-Columns p { - margin: 0; -} - -.none-panel-Header { - padding-top : 5px; - padding-bottom: 5px; - border-bottom-width: 1px; - border-bottom-style: solid; -} - -.none-panel-ListBody { - padding-top : 3px; -} - -.none-panel-Section { - margin-bottom: 0; - border-width: 1px; - border-style: solid; -} - -.none-panel-Title { - margin: 0; - font-size: 1.0em; - line-height: 1.1; - cursor: pointer; - font-weight: normal; -} - - -/***************************************************** -* .none-result -******************************************************/ - -@media (min-width: 768px) { - .none-result-Container { - display: flex; - } - - .none-result-FicheDisplay { - width: 66%; - } - - .none-result-Sidebar { - width: 34%; - } -} diff --git a/squelettes/javascript/scrutarijs/frameworks/none.js b/squelettes/javascript/scrutarijs/frameworks/none.js deleted file mode 100644 index 2626cc1..0000000 --- a/squelettes/javascript/scrutarijs/frameworks/none.js +++ /dev/null @@ -1,279 +0,0 @@ -var SCRUTARI_HTML = { -_name:'none', -structure:{ -'area-input':'
', -'area-result':'
{{result-links}}
{{result-history}}
{{result-subsearch}}
{{result-poweredby}}
', -'panel-base':'

_ title_filter_base _ filter_off

', -'panel-category':'

_ title_filter_category _ filter_off

', -'panel-corpus':'

_ title_filter_corpus _ filter_off

', -'panel-lang':'

_ title_filter_lang _ filter_off

', -'panel-options':'

_ title_options

_ mode_title

_ ponderation_title

_ periode_title

', -'area-parameters':'
{{panel-options}} {{panel-corpus}} {{panel-base}} {{panel-lang}} {{panel-category}}
', -'area-stats':'
{{stats-table}}
', -'area-title':'

', -'main-form':'
{{area-input}} {{area-parameters}}
', -'main':'{{area-title}} {{main-form}} {{area-stats}} {{area-result}} {{modal-*}} ', -'modal-help_mode':'', -'modal-help_periode':'', -'modal-help_ponderation':'', -'modal-loading':'', -'result-history':'
', -'result-links':'

ods csv

atom

', -'result-poweredby':'', -'result-subsearch':'

_ title_subsearch

', -'stats-filter':' _ stats_filter_short ', -'stats-global':' _ stats_global_short ', -'stats-result':' _ stats_result_short ', -'stats-table':' {{stats-global}} {{stats-filter}} {{stats-result}}
' -}, -templates:{ -'base':'

', -'category':'

', -'categoryfichedisplay':'
{{for array}} {{>category.title}} ({{:fichestat}}) {{/for}}
{{for array}}
{{/for}}', -'corpus':'

', -'emptyfichedisplay':'

{{>~scrutari_loc("_ result_none")}}

{{if withFilter}}

{{>~scrutari_loc("_ result_fitlerwarning")}}

{{else scrutariResult.searchMeta.reportArray.length > 0}}

Analyse des termes de la recherche{{>~scrutari_loc("_ colon")}}

{{for scrutariResult.searchMeta.reportArray}}
{{> text}}
{{if canonicalArray.length > 0}}

Correspondances trouvées (entre parenthèses, le nombre d\'occurrences par langue):

    {{for canonicalArray}}
  • {{> canonical}} ({{for langreportArray}}{{if #index > 0}}, {{/if}}{{: lang}}={{: ficheCount}}{{/for}})
  • {{/for}}
{{/if}} {{if neighbourArray.length > 0}}

Pas de correspondances trouvées. Termes se rapprochant (entre parenthèses, le code des langues concernées) :

    {{for neighbourArray}}
  • {{> neighbour}} ({{for langArray}}{{if #index > 0}}, {{/if}}{{: #data}}{{/for}})
  • {{/for}}
{{/if}} {{if canonicalArray.length == 0 && neighbourArray.length == 0}}

Aucune correspondance ou terme voisin trouvé

{{/if}}
{{/for}}
{{/if}}', -'fiche':'
{{include tmpl="fiche_icon" /}}
{{for _bodyTemplateArray ~fiche=#data}} {{include ~fiche tmpl=~scrutari_client.getTemplate(#data) /}} {{/for}}
', -'fiche_attribute':'{{if type!=="block"}}

{{>title}}{{>~scrutari_loc("_ colon")}} {{for valueArray ~len=valueArray.length}} {{:~scrutari_mark(#data)}}{{if #index != (~len -1)}}, {{/if}} {{/for}}

{{else}}

{{>title}}{{>~scrutari_loc("_ colon")}}

{{for valueArray ~len=valueArray.length}}

{{:~scrutari_mark(#data)}}

{{/for}}
{{/if}}', -'fiche_bythesaurusarray':'{{if _bythesaurusArray}} {{for _bythesaurusArray}}

{{> thesaurus.title}}{{>~scrutari_loc("_ colon")}} {{for motcleArray ~len=motcleArray.length}} {{if mlabelArray}}{{for mlabelArray}}{{if #index > 0}}/{{/if}}{{:~scrutari_mark(mvalue)}}{{/for}}{{/if}}{{if #index != (~len -1)}}, {{/if}} {{/for}}

{{/for}} {{/if}} ', -'fiche_icon':'{{if _thumbnail}}
{{if _icon}} {{/if}}
{{else _icon}}
{{/if}} ', -'fiche_mcomplementarray':'{{if mcomplementArray}} {{for mcomplementArray}}

{{>title}}{{>~scrutari_loc("_ colon")}} {{:~scrutari_mark(mvalue)}}

{{/for}} {{/if}} ', -'fiche_motclearray':'{{if _motcleArray}}

{{if _motcleArray.length == 1}} {{>~scrutari_loc("_ fiche_motscles_one")}} {{else}} {{>~scrutari_loc("_ fiche_motscles_many")}} {{/if}} {{for _motcleArray ~len=_motcleArray.length}} {{if mlabelArray}}{{for mlabelArray}}{{if #index > 0}}/{{/if}}{{:~scrutari_mark(mvalue)}}{{/for}}{{/if}}{{if #index != (~len -1)}}, {{/if}} {{/for}}

{{/if}} ', -'fiche_msoustitre':'{{if msoustitre}}

{{:~scrutari_mark(msoustitre)}}

{{/if}} ', -'fiche_mtitre':'

{{if mtitre}} {{:~scrutari_mark(mtitre)}} {{else}} {{:href}} {{/if}}

', -'fiche_primaryattributearray':'{{if _primaryAttributeArray}} {{for _primaryAttributeArray tmpl="fiche_attribute" /}} {{/if}} ', -'fiche_secondaryattributearray':'{{if _secondaryAttributeArray}} {{for _secondaryAttributeArray tmpl="fiche_attribute" /}} {{/if}} ', -'fiche_year':'{{if year}}

{{:year}}

{{/if}} ', -'ficheloading':' {{>~scrutari_loc(\'_ loading_pagination\')}}', -'history':'
', -'lang':'

', -'tabs':'
{{for tabArray}} {{if state===\'active\'}} {{>title}} {{else state===\'disabled\'}} {{>title}} {{else}} {{>title}} {{/if}} {{/for}}
', -'uniquefichedisplay':'
' -} -}; - -/* global Scrutari */ - -function SCRUTARI_FRAMEWORKINIT (scrutariClient) { - - scrutariClient.functions.modalAction = function ($modal, action) { - switch(action) { - case 'show': - if (!$modal.data("overlayId")) { - var overlayId = Scrutari.Overlay.start({ - header: $modal.children("header").html(), - content: $modal.children("div").html(), - footer: $modal.children("footer").html(), - closeTooltip: scrutariClient.loc("_ button_close"), - afterEnd: function () { - $modal.data("overlayId", null); - } - }); - $modal.data("overlayId", overlayId); - } - break; - case 'hide': - Scrutari.Overlay.end($modal); - break; - } - - }; - -} - -Scrutari.Overlay = {}; - -Scrutari.Overlay.idNumber = 1; -Scrutari.Overlay.activeInfoArray = new Array(); - -$(document).on('keydown.overlay', function(event) { - if (event.which === 27) { - var length = Scrutari.Overlay.activeInfoArray.length; - if (length > 0) { - var overlayInfo = Scrutari.Overlay.activeInfoArray[length - 1]; - if (overlayInfo.escapeClose) { - Scrutari.Overlay.end(overlayInfo.overlayId); - } - } - } -}); - -Scrutari.Overlay.Info = function (overlayId, escapeClose) { - this.overlayId = overlayId; - this.escapeClose = escapeClose; -}; - -Scrutari.Overlay.start = function (settings) { - var closeTooltip = "Close"; - if (settings.closeTooltip) { - closeTooltip = settings.closeTooltip; - } - var overlayIdNumber = Scrutari.Overlay.idNumber; - Scrutari.Overlay.idNumber++; - var overlayId = "none-overlay_" + overlayIdNumber; - Scrutari.Overlay.activeInfoArray.push(new Scrutari.Overlay.Info(overlayId, _checkSetting("escapeClose"))); - var $overlayBlocker = $("
").attr("id", overlayId).attr("class", _getClass("Blocker")).attr("data-role", "overlay"); - var $overlayDialog = $("
").attr("class", _getClass("Dialog")).appendTo($overlayBlocker); - $overlayDialog.data("overlayId", overlayId); - $("body") - .append($overlayBlocker) - .css('overflow','hidden'); - var overlayBody = _getDiv("Header") + _getDiv("Content") + _getDiv("Footer"); - var includeForm = false; - if (settings.formAttrs || settings.ajaxForm || settings.formSubmit) { - includeForm = true; - var $form = $("
"); - if (settings.formAttrs) { - for(var prop in settings.formAttrs) { - $form.attr(prop, settings.formAttrs[prop]); - } - } - if (settings.ajaxForm) { - var initialBeforeSubmit = settings.ajaxForm.beforeSubmit; - settings.ajaxForm.beforeSubmit = function (arr, $form, options) { - if ((initialBeforeSubmit) && (initialBeforeSubmit(arr, $form, options) === false)) { - return false; - } - _startWaiting(); - }; - var initialSuccess = settings.ajaxForm.success; - settings.ajaxForm.success = function (data, textStatus, jqXHR, $form) { - _endWaiting(); - initialSuccess(data, textStatus, jqXHR, $form); - }; - $form.ajaxForm(settings.ajaxForm); - } else if (settings.formSubmit) { - $form.submit(function () { - return settings.formSubmit($(this)); - }); - } - $overlayDialog.append($form.html(overlayBody)); - $form.data("overlayId", overlayId); - } else { - $overlayDialog.html(overlayBody); - } - _setContent("Header", settings.header); - _setContent("Content", settings.content); - _setContent("Footer", settings.footer); - var clickClose = _checkSetting("clickClose"); - var showClose = _checkSetting("showClose"); - $overlayBlocker - .click(function() { - if (clickClose) { - Scrutari.Overlay.end(overlayId); - } - }) - .data("beforeEnd", settings.beforeEnd) - .data("afterEnd", settings.afterEnd) - .css("z-index", 10000 + overlayIdNumber); - if (showClose) { - $overlayDialog - .append("") - .on("click.overlay", "[data-role='close']", function () { - Scrutari.Overlay.end(overlayId); - }); - } - $overlayDialog - .click(function (event) { - event.stopPropagation(); - }); - if (settings.isWaiting) { - _startWaiting(); - } - $overlayBlocker.fadeIn(function () { - $overlayDialog.show(); - if (settings.afterStart) { - settings.afterStart($overlayDialog); - } else if (includeForm) { - $overlayDialog.find(":input").filter("[type!='hidden']").first().trigger("focus"); - } - }); - - return overlayId; - - function _checkSetting(propName) { - if (settings.hasOwnProperty(propName)) { - return settings[propName]; - } - return true; - } - - function _setContent (name, content) { - let $element = $("#" + _getId(name)); - if (!content) { - $element.empty(); - } else if (content.jquery) { - $element.empty().append(content); - } else { - $element.empty().html(content); - } - } - - function _startWaiting() { - $overlayBlocker.find("[type='submit']").prop("disabled", true); - $overlayBlocker.addClass(_getClass("Waiting")); - } - - function _endWaiting() { - $overlayBlocker.find("[type='submit']").prop("disabled", false); - $overlayBlocker.removeClass(_getClass("Waiting")); - } - - function _getDiv(name) { - return "
"; - } - - function _getId(name) { - return overlayId + "_" + name; - } - - function _getClass(suffix) { - let prefix = "none-overlay-"; - if (settings.classPrefix) { - prefix = settings.classPrefix; - } - return prefix + suffix; - } -}; - -Scrutari.Overlay.end = function (overlayId, callback) { - if (overlayId.jquery) { - overlayId = overlayId.data("overlayId"); - } - if (!overlayId) { - return; - } - var $overlayBlocker = $("#" + overlayId); - var beforeEnd = $overlayBlocker.data("beforeEnd"); - if (beforeEnd) { - var result = beforeEnd($overlayBlocker.children("div")); - if (result === false) { - return; - } - } - _pop(); - $overlayBlocker.empty(); - var afterEnd = $overlayBlocker.data("afterEnd"); - $overlayBlocker.fadeOut(function() { - $("#" + overlayId).remove(); - if ($("body").children("[data-role='overlay']").length === 0) { - $("body").css('overflow',''); - } - if (afterEnd) { - afterEnd(); - } - if (callback) { - callback(); - } - }); - - function _pop() { - for(var i = 0, len = Scrutari.Overlay.activeInfoArray.length; i < len; i++) { - var overlayInfo = Scrutari.Overlay.activeInfoArray[i]; - if (overlayInfo.overlayId === overlayId) { - Scrutari.Overlay.activeInfoArray.splice(i, 1); - break; - } - } - } -}; - diff --git a/squelettes/javascript/scrutarijs/perso.css b/squelettes/javascript/scrutarijs/perso.css index 19b03da..c6b2a8c 100644 --- a/squelettes/javascript/scrutarijs/perso.css +++ b/squelettes/javascript/scrutarijs/perso.css @@ -2,6 +2,18 @@ * pour Libre à vous */ +kbd { + background: #fff; + border-radius: 0; + border: 1px solid #BDDDFE; + box-shadow: inherit; + display: inline-block; + font-size: 14px; +} + + + + /***************************************************** * .scrutari- : Surcharge de classes Scrutari par défaut ******************************************************/ @@ -10,6 +22,16 @@ background-color: #ffe9e0; } + +/***************************************************** +* .scrutari-fiche : Surcharge de classes Scrutari par défaut +******************************************************/ + +.scrutari-fiche-Block { + border-bottom: solid 1px #eaeef3; + margin-top: 25px; +} + .scrutari-fiche-Link { border: 0; } @@ -25,16 +47,21 @@ width: inherit; } -.scrutari-history-Active { - background-color: #ffe9e0; + +/***************************************************** +* .scrutari-history : Surcharge de classes Scrutari par défaut +******************************************************/ + +.scrutari-history-Block, .scrutari-history-Block.scrutari-history-Active { + background-color: #e6ebf0; } .scrutari-history-Block { display: inline-block; } -.scrutari-history-Load { - background-color: #ffe9e0; +.scrutari-history-Load, .scrutari-history-Remove { + background-color: transparent; font-family: 'Lato',sans-serif; font-weight: 400; line-height: 1.6; @@ -42,11 +69,73 @@ text-rendering: geometricPrecision; } + +/***************************************************** +* .scrutari-input : Surcharge de classes Scrutari par défaut +******************************************************/ + .scrutari-input-Text { background-color: #edf1f5; color: #005184; } + +/***************************************************** +* .scrutari-overlay : Surcharge de classes Scrutari par défaut +******************************************************/ + +.scrutari-overlay-Component_header { + border: none; + background-color: rgb(0, 81, 132); + color: #fff; + padding: 1rem 2rem; + font-size: 18px; +} + +.scrutari-overlay-Component_content { + padding: 2rem 3rem; +} + +.scrutari-overlay-Component_content p { + font-size: 16px; +} + +.scrutari-overlay-Component_dialog { + max-width: 800px; +} + +.scrutari-overlay-button-Close { + margin-right: 1.5rem; + margin-top: 1.5rem; + border-radius: 00; + font-size: inherit; + color:#BDDDFE; + background-color: rgb(0, 81, 132); + border:1px solid #BDDDFE; +} + +.scrutari-overlay-button-Close:hover { + background-color: #E45817; + border:1px solid #FFF; + color:#FFF; +} + +@media screen and (max-width: 500px) { + + .scrutari-overlay-Component_content { + padding:1rem; + } + + .scrutari-overlay-Component_header { + padding: 1rem; + } +} + + +/***************************************************** +* .scrutari-pagination : Surcharge de classes Scrutari par défaut +******************************************************/ + .scrutari-pagination-Current { background-color: #648bab; color: #fff; @@ -64,25 +153,107 @@ ******************************************************/ .scrutari-lav-Filtre { + padding-bottom: 5px; + border-bottom: solid 1px #eaeef3; +} + +.scrutari-lav-FiltreLabel { display: inline-block; margin-left: 5px; } +.scrutari-lav-Input { + display: grid; + grid-template-columns: 1fr max-content; + column-gap: 30px; +} + .scrutari-lav-Operateur { color: #acd0f9; } .scrutari-lav-Sequence { font-size: 2.5em; + margin-bottom: 15px; +} + +.scrutari-lav-Submit { + background: #f7651a; + color: #FFF !important; +} + +.scrutari-lav-TitreResultats { + margin-bottom: 25px; + margin-top: 50px; } .scrutari-lav-Total { font-size: 0.85em; } + +/***************************************************** +* .scrutari-lav-details- : Options de recherche +******************************************************/ + +.scrutari-lav-details-Container { + border-bottom: solid 1px #eaeef3; + margin-top: 10px; + padding-bottom: 10px; + margin-bottom: 35px; +} + +.scrutari-lav-details-Body { + padding-left: 15px; + margin-top: 10px; + display: grid; + grid-template-columns: max-content; +} + +.scrutari-lav-details-Body p { + border-bottom: solid 1px #eaeef3; + margin: 0; + padding-top: 4px; + padding-bottom: 4px; +} + +.scrutari-lav-details-Body button { + background: transparent; + padding: 0; + margin: 0; + border: none; +} + +.scrutari-lav-details-Body .fas { + color: #acd0f9; +} + +.scrutari-lav-details-Body .fas:hover { + color: #00c4f5; +} + +.scrutari-lav-details-Body p:last-child { + border-bottom: none; +} + +.scrutari-lav-details-Summary { + cursor: pointer; + font-family: 'Metropolis',sans-serif; + font-weight: 700; +} + + +/***************************************************** +* .scrutari-lav-history- : Historique +******************************************************/ + .scrutari-lav-history-Container { display: flex; align-items: baseline; + padding-top: 5px; + padding-bottom: 5px; + border-bottom: solid 1px #eaeef3; + margin-bottom: 5px; } .scrutari-lav-history-List { @@ -95,4 +266,17 @@ .scrutari-lav-history-Clear { flex-shrink: 0; + background-color: transparent; + } + +.scrutari-lav-history-Clear .fas { + color: #acd0f9; +} + +.scrutari-lav-history-Clear .fas:hover { + color: #00c4f5; +} + + + diff --git a/squelettes/javascript/scrutarijs/scrutarijs.css b/squelettes/javascript/scrutarijs/scrutarijs.css index 73dbc83..97f27b6 100644 --- a/squelettes/javascript/scrutarijs/scrutarijs.css +++ b/squelettes/javascript/scrutarijs/scrutarijs.css @@ -374,6 +374,92 @@ vertical-align: baseline; } +/******************************************************************************* +* .scrutari-overlay- v 0.4.2 +*******************************************************************************/ + +.scrutari-overlay-Component_blocker { + position: fixed; + top: 0; right: 0; bottom: 0; left: 0; + width: 100%; height: 100%; + overflow: hidden; + z-index: 10000; + padding: 20px; + box-sizing: border-box; + background-color: rgba(0,0,0, 0.75); + text-align: center; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +.scrutari-overlay-Component_content { + padding: 10px 20px; + text-align: left; + font-size: 90%; + min-width: 20vw; + max-width: 90vw; + max-height: 70vh; + overflow: auto; + background-color: #fff; +} + +.scrutari-overlay-Component_dialog { + position: relative; + box-sizing: border-box; + background: #fff; + box-shadow: 0 0 10px #000; + text-align: left; +} + +.scrutari-overlay-Component_footer { + clear: both; + padding-bottom: 8px; + padding-top: 8px; + padding-left: 10px; + padding-right: 10px; + text-align: right; +} + +.scrutari-overlay-Component_header { + text-align: left; + font-size: large; + min-height: 10px; + padding-top: 20px; + padding-bottom: 20px; + padding-left: 10px; + padding-right: 10px; +} + +.scrutari-overlay-Waiting { + cursor: wait; +} + + +/******************************************************************************* +* .overlay-button- +*******************************************************************************/ + +.scrutari-overlay-button-Close { + position: absolute; + top: -12.5px; + right: -12.5px; + display: block; + width: 30px; + height: 30px; + border-radius: 15px; + border: none; + font-size: 20px; + background-color: #000; + color: #fff; +} + +.scrutari-overlay-button-Close:hover { + background-color: #ddd; +} + + /***************************************************** * .scrutari-stats ******************************************************/ diff --git a/squelettes/javascript/scrutarijs/scrutarijs.js b/squelettes/javascript/scrutarijs/scrutarijs.js index 92e0f23..f87e49b 100644 --- a/squelettes/javascript/scrutarijs/scrutarijs.js +++ b/squelettes/javascript/scrutarijs/scrutarijs.js @@ -1,4 +1,4 @@ -/* version: r4191 */ +/* version: 4195 */ var Scrutari = {}; Scrutari.log = function (msg) { if ((console) && (console.log)) { @@ -1590,6 +1590,244 @@ Scrutari.Loc.prototype.escape = function (locKey, ...values) { } return Scrutari.escape(this.loc(locKey, values)); }; +Scrutari.Overlay = {}; +Scrutari.Overlay.idNumber = 1; +Scrutari.Overlay.overlayInfoStack = new Array(); +Scrutari.Overlay.closeTooltip = "Close"; +Scrutari.Overlay.classPrefix = "scrutari-overlay"; +Scrutari.Overlay.Info = function (overlayId, escapeClose, otherCloseKey) { + this.overlayId = overlayId; + this.escapeClose = escapeClose; + this.otherCloseKey = otherCloseKey; + this.afterEnd = null; + this.beforeEnd = null; +}; +Scrutari.Overlay.addEscapeKeyHandler = function (target) { + $(target).on('keydown.overlay', function (event) { + var lastOverlayInfo = Scrutari.Overlay.getLastOverlayInfo(); + if (lastOverlayInfo) { + let closeEvent = false; + if (lastOverlayInfo.escapeClose) { + if (event.key === "Escape") { + closeEvent = true; + } + } + if ((!closeEvent) && (lastOverlayInfo.otherCloseKey)) { + if (event.key === lastOverlayInfo.otherCloseKey) { + closeEvent = true; + } + } + if (closeEvent) { + event.preventDefault(); + event.stopPropagation(); + Scrutari.Overlay.end(lastOverlayInfo.overlayId); + } + } + }); +}; +Scrutari.Overlay.removeEscapeKeyHandler = function (target) { + $(target).off('keydown.overlay'); +}; +Scrutari.Overlay.getLastOverlayInfo = function () { + var length = Scrutari.Overlay.overlayInfoStack.length; + if (length > 0) { + return Scrutari.Overlay.overlayInfoStack[length - 1]; + } else { + return null; + } +}; +Scrutari.Overlay.getOverlayInfo = function (overlayId) { + for(let overlayInfo of Scrutari.Overlay.overlayInfoStack) { + if (overlayInfo.overlayId === overlayId) { + return overlayInfo; + } + } + return null; +}; +Scrutari.Overlay.removeOverlayInfo = function (overlayId) { + for(let i = 0, len = Scrutari.Overlay.overlayInfoStack.length; i < len; i++) { + let overlayInfo = Scrutari.Overlay.overlayInfoStack[i]; + if (overlayInfo.overlayId === overlayId) { + Scrutari.Overlay.overlayInfoStack.splice(i, 1); + break; + } + } + if (Scrutari.Overlay.overlayInfoStack.length === 0) { + Scrutari.Overlay.removeEscapeKeyHandler(document); + } +}; +Scrutari.Overlay.addOverlayInfo = function (overlayInfo) { + if (Scrutari.Overlay.overlayInfoStack.length === 0) { + Scrutari.Overlay.addEscapeKeyHandler(document); + } + Scrutari.Overlay.overlayInfoStack.push(overlayInfo); +}; +Scrutari.Overlay.start = function (settings) { + var closeTooltip = Scrutari.Overlay.closeTooltip; + if (settings.closeTooltip) { + closeTooltip = settings.closeTooltip; + } + var overlayIdNumber = Scrutari.Overlay.idNumber; + Scrutari.Overlay.idNumber++; + var overlayId = "overlay_" + overlayIdNumber; + var overlayInfo = new Scrutari.Overlay.Info(overlayId, _checkSetting("escapeClose", true)); + Scrutari.Overlay.addOverlayInfo(overlayInfo); + var $overlayBlocker = $(_getDiv("blocker")).attr("data-overlay-role", "blocker").attr("tabindex", "-1"); + var $overlayDialog = $(_getDiv("dialog")).appendTo($overlayBlocker); + $("body") + .append($overlayBlocker) + .css('overflow','hidden'); + var overlayBody = _getDiv("header") + _getDiv("content") + _getDiv("footer"); + var includeForm = false; + if (settings.formAttrs || settings.ajaxForm || settings.formSubmit) { + includeForm = true; + var $form = $(""); + if (settings.formAttrs) { + for(var prop in settings.formAttrs) { + $form.attr(prop, settings.formAttrs[prop]); + } + } + if (settings.ajaxForm) { + var initialBeforeSubmit = settings.ajaxForm.beforeSubmit; + settings.ajaxForm.beforeSubmit = function (arr, $form, options) { + if ((initialBeforeSubmit) && (initialBeforeSubmit(arr, $form, options) === false)) { + return false; + } + _startWaiting(); + }; + var initialSuccess = settings.ajaxForm.success; + settings.ajaxForm.success = function (data, textStatus, jqXHR, $form) { + _endWaiting(); + initialSuccess(data, textStatus, jqXHR, $form); + }; + $form.ajaxForm(settings.ajaxForm); + } else if (settings.formSubmit) { + $form.submit(function () { + return settings.formSubmit($(this)); + }); + } + $overlayDialog.append($form.html(overlayBody)); + $form.data("overlayId", overlayId); + } else { + $overlayDialog.html(overlayBody); + } + _setContent("header", settings.header); + _setContent("content", settings.content); + _setContent("footer", settings.footer); + var clickClose = _checkSetting("clickClose", true); + var showClose = _checkSetting("showClose", true); + $overlayBlocker + .click(function() { + if (clickClose) { + Scrutari.Overlay.end(overlayId); + } + }) + .css("z-index", 10000 + overlayIdNumber); + overlayInfo.beforeEnd = settings.beforeEnd; + overlayInfo.afterEnd = settings.afterEnd; + if (showClose) { + $overlayDialog + .append("") + .on("click.overlay", "[data-overlay-role='close']", function () { + Scrutari.Overlay.end(overlayId); + }); + } + $overlayDialog + .click(function (event) { + event.stopPropagation(); + }); + if (settings.isWaiting) { + _startWaiting(); + } + $overlayBlocker.fadeIn(function () { + $overlayDialog.show(); + if (settings.afterStart) { + settings.afterStart(overlayId, _endWaiting); + } else if (includeForm) { + $overlayDialog.find(":input").filter("[type!='hidden']").first().trigger("focus"); + } + setTimeout(function () { + overlayInfo.otherCloseKey = _checkSetting("closeKey", null); + }, 300); + }); + return overlayId; + function _checkSetting(propName, defaultValue) { + if (settings.hasOwnProperty(propName)) { + return settings[propName]; + } + return defaultValue; + } + function _setContent (name, content) { + let $element = $("#" + _getId(name)); + if (!content) { + $element.remove(); + } else if (content.jquery) { + $element.empty().append(content); + } else { + $element.empty().html(content); + } + } + function _startWaiting() { + $overlayBlocker.find("[type='submit']").prop("disabled", true); + $overlayBlocker.addClass(Scrutari.Overlay.classPrefix + "-Waiting"); + } + function _endWaiting() { + $overlayBlocker.find("[type='submit']").prop("disabled", false); + $overlayBlocker.removeClass(Scrutari.Overlay.classPrefix + "-Waiting"); + } + function _getDiv(name) { + return "
"; + } + function _getId(name) { + return overlayId + "_" + name; + } + function _getClass(suffix) { + if ((settings.classes) && (settings.classes.hasOwnProperty(suffix))) { + return settings.classes[suffix]; + } + let prefix = Scrutari.Overlay.classPrefix + "-Component_"; + if (settings.classPrefix) { + prefix = settings.classPrefix; + } + if ((settings.supplementaryClasses) && (settings.supplementaryClasses.hasOwnProperty(suffix))) { + return prefix + suffix + " " + settings.supplementaryClasses[suffix]; + } else { + return prefix + suffix; + } + } +}; +Scrutari.Overlay.end = function (overlayId, callback) { + if ((overlayId) && (overlayId.jquery)) { + overlayId = overlayId.data("overlayId"); + } + if (!overlayId) { + return; + } + var overlayInfo = Scrutari.Overlay.getOverlayInfo(overlayId); + if (!overlayInfo) { + return; + } + if (overlayInfo.beforeEnd) { + var result = overlayInfo.beforeEnd(overlayId); + if (result === false) { + return; + } + } + var afterEnd = overlayInfo.afterEnd; + Scrutari.Overlay.removeOverlayInfo(overlayId); + $("#" + overlayId + "_blocker").empty().fadeOut(function() { + $("#" + overlayId + "_blocker").remove(); + if ($("body").children("[data-overlay-role='blocker']").length === 0) { + $("body").css('overflow',''); + } + if (afterEnd) { + afterEnd(); + } + if (callback) { + callback(); + } + }); +}; Scrutari.FilterState = function () { this.empty = true; this.langOnly = true; @@ -1834,8 +2072,10 @@ Scrutari.Client = function (scrutariConfig, clientId) { subsearchErrorCallback: null, initFilterByQuery: Scrutari.DefaultUi.initFilterByQuery, displayError: Scrutari.DefaultUi.displayError, - modalAction: null, - newResultProcess: Scrutari.DefaultUi.newResultProcess + modalAction: Scrutari.DefaultUi.modalAction, + newResultProcess: Scrutari.DefaultUi.newResultProcess, + startLoading: Scrutari.DefaultUi.startLoading, + endLoading: Scrutari.DefaultUi.endLoading }; this.cssClasses = { disabled: "scrutari-Disabled", @@ -1870,9 +2110,6 @@ Scrutari.Client = function (scrutariConfig, clientId) { if (typeof SCRUTARI_HTML !== 'undefined') { this._htmlObject = SCRUTARI_HTML; } - if (typeof SCRUTARI_FRAMEWORKINIT === 'function') { - SCRUTARI_FRAMEWORKINIT(this); - } }; Scrutari.Client.prototype.loc = function (locKey) { return this._locInstance.loc(locKey); @@ -2046,12 +2283,8 @@ Scrutari.Client.prototype.$label = function (name) { Scrutari.Client.prototype.$link = function (name) { return this.$({scrutariLink: name}); }; -Scrutari.Client.prototype.$modal = function (name, action) { - var $modal = this.$({scrutariModal: name}); - if ((action) && (this.functions.modalAction)) { - this.functions.modalAction($modal, action); - } - return $modal; +Scrutari.Client.prototype.$modal = function (name) { + return Scrutari.$({scrutariModal: name}); }; Scrutari.Client.prototype.$panel = function (name, action) { var $panel = this.$({scrutariPanel: name}); @@ -2169,7 +2402,7 @@ Scrutari.Client.prototype.initForms = function () { let requestParameters = client.buildRequestParameters(); requestParameters["log"] = "all"; requestParameters["q"] = q; - client.$modal("loading", 'show'); + client.startLoading(); client.hook("newSearch", requestParameters, "mainsearch"); Scrutari.Result.newSearch(client.scrutariConfig, requestParameters, function (scrutariResult) {client.mainsearchResultCallback(scrutariResult);}, function (error) {client.mainsearchErrorCallback(error);}); } @@ -2181,7 +2414,7 @@ Scrutari.Client.prototype.initForms = function () { let requestParameters = client.buildRequestParameters(); requestParameters["q"] = q; requestParameters["flt-qid"] = client.history.mainCurrentScrutariResult.getQId(); - client.$modal("loading", 'show'); + client.startLoading(); client.hook("newSearch", requestParameters, "subsearch"); Scrutari.Result.newSearch(client.scrutariConfig, requestParameters, function (scrutariResult) {client.subsearchResultCallback(scrutariResult);}, function (error) {client.subsearchErrorCallback(error);}); } @@ -2201,7 +2434,9 @@ Scrutari.Client.prototype.initButtons = function (actionHandler) { if (!done) { switch(action) { case 'showModal': - client.$modal(target, 'show'); + if (client.functions.modalAction) { + client.functions.modalAction(client, target, 'show'); + } break; case 'removeHistory': client.history.removeHistory(target); @@ -2295,7 +2530,7 @@ Scrutari.Client.prototype.initChangeListeners = function (changeHandler) { Scrutari.Client.prototype.mainsearchResultCallback = function (scrutariResult) { var client = this; client.processResult(scrutariResult, "mainsearch"); - client.$modal("loading", 'hide'); + client.endLoading(); if (client.functions.mainsearchResultCallback) { client.functions.mainsearchResultCallback(client, scrutariResult); } @@ -2305,7 +2540,7 @@ Scrutari.Client.prototype.mainsearchErrorCallback = function (error) { if (client.functions.displayError) { client.functions.displayError(client, error, "mainsearch"); } - client.$modal("loading", 'hide'); + client.endLoading(); if (client.functions.mainsearchErrorCallback) { client.functions.mainsearchErrorCallback(client, error); } @@ -2313,7 +2548,7 @@ Scrutari.Client.prototype.mainsearchErrorCallback = function (error) { Scrutari.Client.prototype.subsearchResultCallback = function (scrutariResult) { var client = this; client.processResult(scrutariResult, "subsearch"); - client.$modal("loading", 'hide'); + client.endLoading(); if (client.functions.subsearchResultCallback) { client.functions.subsearchResultCallback(client, scrutariResult); } @@ -2323,7 +2558,7 @@ Scrutari.Client.prototype.subsearchErrorCallback = function (error) { if (client.functions.displayError) { client.functions.displayError(client, error, "subsearch"); } - client.$modal("loading", 'hide'); + client.endLoading(); if (client.functions.subsearchErrorCallback) { client.functions.subsearchErrorCallback(client, error); } @@ -2341,7 +2576,7 @@ Scrutari.Client.prototype.checkInitialQuery = function () { } else if (initialQId) { var requestParameters = client.buildRequestParameters(); requestParameters["qid"] = initialQId; - client.$modal("loading", 'show'); + client.startLoading(); client.hook("newSearch", requestParameters, "qidsearch"); Scrutari.Result.newSearch(client.scrutariConfig, requestParameters, function (scrutariResult) { var $mainSearchForm = client.$form('mainsearch'); @@ -2481,6 +2716,16 @@ Scrutari.Client.prototype.processResult = function (scrutariResult, searchOrigin } resultProcess.run(); }; +Scrutari.Client.prototype.startLoading = function () { + if (this.functions.startLoading) { + this.functions.startLoading(this); + } +}; +Scrutari.Client.prototype.endLoading = function () { + if (this.functions.endLoading) { + this.functions.endLoading(this); + } +}; Scrutari.Client.init = function (scrutariConfig, clientId, options, callback) { if (!$.templates) { throw new Error("JsRender is not installed"); @@ -2953,6 +3198,38 @@ Scrutari.DefaultUi.displayError = function (client, error, searchOrigin) { Scrutari.logError(error); } }; +Scrutari.DefaultUi.modalAction = function (client, name, action) { + var $modal = client.$modal(name); + if ($modal.length === 0) { + Scrutari.log("Unknown modal: " + name); + return; + } + switch(action) { + case 'show': + if (!$modal.data("overlayId")) { + var overlayId = Scrutari.Overlay.start({ + header: $modal.children("header").html(), + content: $modal.children("div").html(), + footer: $modal.children("footer").html(), + closeTooltip: client.loc("_ button_close"), + afterEnd: function () { + $modal.data("overlayId", null); + } + }); + $modal.data("overlayId", overlayId); + } + break; + case 'hide': + Scrutari.Overlay.end($modal.data("overlayId")); + break; + } +}; +Scrutari.DefaultUi.startLoading = function (client) { + Scrutari.DefaultUi.modalAction(client, 'loading', 'show'); +}; +Scrutari.DefaultUi.endLoading = function (client) { + Scrutari.DefaultUi.modalAction(client, 'loading', 'hide'); +}; Scrutari.DefaultUi.newResultProcess = function (client, scrutariResult, searchOrigin) { return new Scrutari.Process(client, scrutariResult, searchOrigin); };