Loading rxq/html.xqm +1 −2 Changes for rxq/html.xqm: 1 added line, 2 removed lines. Original line number Diff line number Diff line Loading @@ -109,7 +109,6 @@ declare %private function max.html:generateAllJSImports($projectId, $pageId, $fr var route ="{$pageId}"; var fragmentId ="{$fragmentId}"; </script>, <script type="text/javascript" src='{max.config:getBaseURI() || "core/ui/js/Max.js"}'/>, max.html:generateJavascriptImports($projectId) }; Loading Loading @@ -185,7 +184,7 @@ declare %private function max.html:buildMenu( $fragmentId as xs:string ?) as item()+ { let $params := map {'projectId' : $projectId, 'selectedTarget' : $menuId, 'baseURI' : max.config:getBaseURI()} let $params := map {'projectId' : $projectId, 'selectedTarget' : $menuId||'.html', 'baseURI' : max.config:getBaseURI()} (:menu translation:) let $translatedXmlMenu := copy $c := doc("../editions/" || $projectId || "/" || $max.cons:MENU_FILE) Loading ui/css/ead.css +30 −1 Changes for ui/css/ead.css: 30 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ .smcaps { font-variant: small-caps;} #toc, nav{ #toc, .side-toc nav, .browse nav{ margin-top: 6em; } Loading Loading @@ -43,6 +43,8 @@ header { width: 100%; border-bottom: 1px solid #1b1e21; background-color: white; display: flex; } header h1 { Loading @@ -50,6 +52,33 @@ header h1 { padding-left: 0.5em; } /* menu top */ header #menu, header #menu nav{ display: flex; justify-content : center; align-items: center; } header nav button { display: none;/*...*/ } header nav ul { display : flex; margin :0; list-style-type: none; } header nav ul li a{ margin : 10px; text-decoration : none; } header nav ul li.active{ font-weight : bold; } /*----------*/ footer { border-top: 1px solid #1b1e21; text-align: center; Loading ui/js/Max.js +10 −165 Changes for ui/js/Max.js: 10 added lines, 165 removed lines. Original line number Diff line number Diff line window.MAX_LOCAL_STORAGE_PREFIX = "MaXLS."; window.MAX_VISIBLE_PROPERTY_STRING = "visible"; window.NOTE_TO_TXT_CLASS = ".note_to_text"; class Max { export default class Max { constructor(pid,baseURL, pluginsURL, fid) { this.projectID = pid; this.baseURL = baseURL; this.pluginsBaseURL = pluginsURL; this.plugins = []; this.baseURL = baseURL; this.fragmentID = fid; } run() { if (this.isInFragmentContext()) { if (this.isWithNotes()) { //ajout d'une colonne de notes + placement this.manageMarginNotes(); } this.bindNavigationTool(); this.bindTooltips(); this.runPlugins(); this.textOptions(); //affiche le bas de page si non vide if ($("#bas_de_page .footnote").length > 0) $("#bas_de_page").show(); } } getProjectID() { return this.projectID; } getFragmentID() { return this.fragmentID; } addPlugin(p) { this.plugins[p.getName()] = p; } getBaseURL() { return this.baseURL; } getPluginsBaseURL() { return this.pluginsBaseURL; } scrollToID(id) { this.scrollToElement($("#" + id.replace(".", "\\."))); } scrollToElement(element, delay) { let offset = $('#topbar').length === 1 ? $('#topbar').height() + ($('#breadcrumb').length === 1 ? $('#breadcrumb').height() : 0) + 10 : 0; if (element.offset() != null) $('html, body').animate({ scrollTop: element.offset().top - offset }, delay); } textOptions() { //shows option's button if needed if ($("#options-list li").length > 0) { $("#txt_options").show(); } //checkbox options (load from localstorage) $(".visibility_toggle").each(function () { let optionName = $(this).data('option'); if (localStorage.getItem(window.MAX_LOCAL_STORAGE_PREFIX + optionName) === window.MAX_VISIBLE_PROPERTY_STRING) { $(this).attr("checked", "checked"); //updates visibility $("." + optionName).show(); } else { $(this).removeAttr("checked"); //updates visibility $("." + optionName).hide(); } }); } manageMarginNotes() { let mainContainer = $("#main-max-container"); let leftBloc = mainContainer.children(":first"); leftBloc.addClass("row"); $("#text").addClass("col-sm-8"); leftBloc.append("<div id='margin_notes' class='col-sm-2'></div>"); let previousNote = null; $(".manchette_droite").each(function () { //stocke le top original avant de déplacer la note let originalTop = $(this).position().top; //déplacement de la note dans la colonne prévue $(this).appendTo("#margin_notes"); //mise à jour top (+anti-chevauchement) let newTop = originalTop; if (previousNote != null && previousNote.position() != null) { let bottomPrevious = previousNote.position().top + previousNote.height(); if (bottomPrevious + 5 > newTop) { newTop = bottomPrevious + 5; } } $(this).css("top", newTop + "px"); previousNote = $(this); }); } /*Branchements 'onClick' sur les flèches de la barre de navigation*/ bindNavigationTool() { //local function : find next or previous nav link let nextOrPrevious = function (step) { let current = $("#navigation-tool").find('button').attr("id").replace("selected-", "");//remove 'selected' prefix let links = $('#dropdown-navigation').find('li'); let position = links.index(document.getElementById(current)); let nextOrPrevious = links.get(position + step); window.location.href = $(nextOrPrevious).find('a').attr("href"); }; if ($('#nav_previous').length) { $('#nav_previous').click( function () { nextOrPrevious(-1); }); } if ($('#nav_next').length) { $('#nav_next').click( function () { nextOrPrevious(1); }); } } bindTooltips() { try { $('[data-toggle="tooltip"]').each(function () { let noteNumber = $(this).attr('id').substr(5); //clones bottom page note let noteContent = $("#wrap_bdp_" + noteNumber).clone(); //removes note call (</a>) noteContent.find(window.NOTE_TO_TXT_CLASS).remove(); //tooltip mapping $(this).tooltip( { html: true, // allows html content title: noteContent.html(), delay: { "show": 0,//instantatly shown "hide": 3000 //displayed during 3seconds } } ); }); } catch (e) { console.log('tooltips error ' + e); } } runPlugins() { Object.keys(this.plugins).forEach((k) =>{ this.plugins[k].run(); Loading @@ -172,36 +34,19 @@ class Max { d'un fragment (présence d'un élement identifié 'text') */ isInFragmentContext() { return $("#text").length > 0; return document.getElementById("text"); } isWithNotes() { return $(".appel_note_marge").length > 0; } /*Affichage / masquage des éléments d'une classe CSS depuis un checkBox des options d'affichage */ setClassVisibility(className) { if ($('#toggle_' + className).prop("checked")) { $("." + className).show(); localStorage.setItem(window.MAX_LOCAL_STORAGE_PREFIX + className, window.MAX_VISIBLE_PROPERTY_STRING); } else { $("." + className).hide(); localStorage.removeItem(window.MAX_LOCAL_STORAGE_PREFIX + className); } } toString() { return this.projectID + "s MaX"; } } window.MAX = new Max(projectId, baseURI, pluginsBaseURI, fragmentId); $(document).ready(function () { "use strict"; window.MAX.run(); }); //window.MAX = new Max(projectId, baseURI, pluginsBaseURI, fragmentId); // //$(document).ready(function () { // "use strict"; // window.MAX.run(); //}); ui/js/ead.js +5 Changes for ui/js/ead.js: 5 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -164,4 +164,9 @@ async function initPorteDocumentsPage(project_id) { } //window.addEventListener("DOMContentLoaded", (event) => { // console.log("222") // initEADPage(); // }); ui/templates/ead.html +7 −4 Changes for ui/templates/ead.html: 7 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -3,16 +3,18 @@ <head> <meta charset="UTF-8"/> <link rel="stylesheet" href="{$baseURI}core/ui/css/ead.css"/> <link rel="stylesheet" href="{$baseURI}plugins/side_toc/side_toc.css"/> <script type="text/javascript" src="{$baseURI}plugins/side_toc/side_toc.js"></script> <script type="text/javascript" src="{$baseURI}core/ui/js/ead.js"></script> <script type="text/javascript" src="{$baseURI}core/ui/lib/Sortable.min.js"></script> <script type="text/javascript" src="{$baseURI}core/ui/lib/Sortable.min.js"/> <script type="text/javascript" src="{$baseURI}plugins/side_toc/side_toc.js"/> <script type="text/javascript" src="{$baseURI}core/ui/js/ead.js"/> <title>{$prettyName}</title> {$head} </head> <body> <header> <h1><a href="{$baseURI}{$projectId}/accueil.html">{$prettyName}</a></h1> <div id="menu"> {$menu} </div> </header> <section class="browse"> {$content} Loading @@ -20,6 +22,7 @@ <footer> <p>Site réalisé par le Pôle document numérique - MRSH - Caen | © 2012 - 2020</p> </footer> {$jsImports} <script> initEADPage(); Loading Loading
rxq/html.xqm +1 −2 Changes for rxq/html.xqm: 1 added line, 2 removed lines. Original line number Diff line number Diff line Loading @@ -109,7 +109,6 @@ declare %private function max.html:generateAllJSImports($projectId, $pageId, $fr var route ="{$pageId}"; var fragmentId ="{$fragmentId}"; </script>, <script type="text/javascript" src='{max.config:getBaseURI() || "core/ui/js/Max.js"}'/>, max.html:generateJavascriptImports($projectId) }; Loading Loading @@ -185,7 +184,7 @@ declare %private function max.html:buildMenu( $fragmentId as xs:string ?) as item()+ { let $params := map {'projectId' : $projectId, 'selectedTarget' : $menuId, 'baseURI' : max.config:getBaseURI()} let $params := map {'projectId' : $projectId, 'selectedTarget' : $menuId||'.html', 'baseURI' : max.config:getBaseURI()} (:menu translation:) let $translatedXmlMenu := copy $c := doc("../editions/" || $projectId || "/" || $max.cons:MENU_FILE) Loading
ui/css/ead.css +30 −1 Changes for ui/css/ead.css: 30 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ .smcaps { font-variant: small-caps;} #toc, nav{ #toc, .side-toc nav, .browse nav{ margin-top: 6em; } Loading Loading @@ -43,6 +43,8 @@ header { width: 100%; border-bottom: 1px solid #1b1e21; background-color: white; display: flex; } header h1 { Loading @@ -50,6 +52,33 @@ header h1 { padding-left: 0.5em; } /* menu top */ header #menu, header #menu nav{ display: flex; justify-content : center; align-items: center; } header nav button { display: none;/*...*/ } header nav ul { display : flex; margin :0; list-style-type: none; } header nav ul li a{ margin : 10px; text-decoration : none; } header nav ul li.active{ font-weight : bold; } /*----------*/ footer { border-top: 1px solid #1b1e21; text-align: center; Loading
ui/js/Max.js +10 −165 Changes for ui/js/Max.js: 10 added lines, 165 removed lines. Original line number Diff line number Diff line window.MAX_LOCAL_STORAGE_PREFIX = "MaXLS."; window.MAX_VISIBLE_PROPERTY_STRING = "visible"; window.NOTE_TO_TXT_CLASS = ".note_to_text"; class Max { export default class Max { constructor(pid,baseURL, pluginsURL, fid) { this.projectID = pid; this.baseURL = baseURL; this.pluginsBaseURL = pluginsURL; this.plugins = []; this.baseURL = baseURL; this.fragmentID = fid; } run() { if (this.isInFragmentContext()) { if (this.isWithNotes()) { //ajout d'une colonne de notes + placement this.manageMarginNotes(); } this.bindNavigationTool(); this.bindTooltips(); this.runPlugins(); this.textOptions(); //affiche le bas de page si non vide if ($("#bas_de_page .footnote").length > 0) $("#bas_de_page").show(); } } getProjectID() { return this.projectID; } getFragmentID() { return this.fragmentID; } addPlugin(p) { this.plugins[p.getName()] = p; } getBaseURL() { return this.baseURL; } getPluginsBaseURL() { return this.pluginsBaseURL; } scrollToID(id) { this.scrollToElement($("#" + id.replace(".", "\\."))); } scrollToElement(element, delay) { let offset = $('#topbar').length === 1 ? $('#topbar').height() + ($('#breadcrumb').length === 1 ? $('#breadcrumb').height() : 0) + 10 : 0; if (element.offset() != null) $('html, body').animate({ scrollTop: element.offset().top - offset }, delay); } textOptions() { //shows option's button if needed if ($("#options-list li").length > 0) { $("#txt_options").show(); } //checkbox options (load from localstorage) $(".visibility_toggle").each(function () { let optionName = $(this).data('option'); if (localStorage.getItem(window.MAX_LOCAL_STORAGE_PREFIX + optionName) === window.MAX_VISIBLE_PROPERTY_STRING) { $(this).attr("checked", "checked"); //updates visibility $("." + optionName).show(); } else { $(this).removeAttr("checked"); //updates visibility $("." + optionName).hide(); } }); } manageMarginNotes() { let mainContainer = $("#main-max-container"); let leftBloc = mainContainer.children(":first"); leftBloc.addClass("row"); $("#text").addClass("col-sm-8"); leftBloc.append("<div id='margin_notes' class='col-sm-2'></div>"); let previousNote = null; $(".manchette_droite").each(function () { //stocke le top original avant de déplacer la note let originalTop = $(this).position().top; //déplacement de la note dans la colonne prévue $(this).appendTo("#margin_notes"); //mise à jour top (+anti-chevauchement) let newTop = originalTop; if (previousNote != null && previousNote.position() != null) { let bottomPrevious = previousNote.position().top + previousNote.height(); if (bottomPrevious + 5 > newTop) { newTop = bottomPrevious + 5; } } $(this).css("top", newTop + "px"); previousNote = $(this); }); } /*Branchements 'onClick' sur les flèches de la barre de navigation*/ bindNavigationTool() { //local function : find next or previous nav link let nextOrPrevious = function (step) { let current = $("#navigation-tool").find('button').attr("id").replace("selected-", "");//remove 'selected' prefix let links = $('#dropdown-navigation').find('li'); let position = links.index(document.getElementById(current)); let nextOrPrevious = links.get(position + step); window.location.href = $(nextOrPrevious).find('a').attr("href"); }; if ($('#nav_previous').length) { $('#nav_previous').click( function () { nextOrPrevious(-1); }); } if ($('#nav_next').length) { $('#nav_next').click( function () { nextOrPrevious(1); }); } } bindTooltips() { try { $('[data-toggle="tooltip"]').each(function () { let noteNumber = $(this).attr('id').substr(5); //clones bottom page note let noteContent = $("#wrap_bdp_" + noteNumber).clone(); //removes note call (</a>) noteContent.find(window.NOTE_TO_TXT_CLASS).remove(); //tooltip mapping $(this).tooltip( { html: true, // allows html content title: noteContent.html(), delay: { "show": 0,//instantatly shown "hide": 3000 //displayed during 3seconds } } ); }); } catch (e) { console.log('tooltips error ' + e); } } runPlugins() { Object.keys(this.plugins).forEach((k) =>{ this.plugins[k].run(); Loading @@ -172,36 +34,19 @@ class Max { d'un fragment (présence d'un élement identifié 'text') */ isInFragmentContext() { return $("#text").length > 0; return document.getElementById("text"); } isWithNotes() { return $(".appel_note_marge").length > 0; } /*Affichage / masquage des éléments d'une classe CSS depuis un checkBox des options d'affichage */ setClassVisibility(className) { if ($('#toggle_' + className).prop("checked")) { $("." + className).show(); localStorage.setItem(window.MAX_LOCAL_STORAGE_PREFIX + className, window.MAX_VISIBLE_PROPERTY_STRING); } else { $("." + className).hide(); localStorage.removeItem(window.MAX_LOCAL_STORAGE_PREFIX + className); } } toString() { return this.projectID + "s MaX"; } } window.MAX = new Max(projectId, baseURI, pluginsBaseURI, fragmentId); $(document).ready(function () { "use strict"; window.MAX.run(); }); //window.MAX = new Max(projectId, baseURI, pluginsBaseURI, fragmentId); // //$(document).ready(function () { // "use strict"; // window.MAX.run(); //});
ui/js/ead.js +5 Changes for ui/js/ead.js: 5 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -164,4 +164,9 @@ async function initPorteDocumentsPage(project_id) { } //window.addEventListener("DOMContentLoaded", (event) => { // console.log("222") // initEADPage(); // });
ui/templates/ead.html +7 −4 Changes for ui/templates/ead.html: 7 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -3,16 +3,18 @@ <head> <meta charset="UTF-8"/> <link rel="stylesheet" href="{$baseURI}core/ui/css/ead.css"/> <link rel="stylesheet" href="{$baseURI}plugins/side_toc/side_toc.css"/> <script type="text/javascript" src="{$baseURI}plugins/side_toc/side_toc.js"></script> <script type="text/javascript" src="{$baseURI}core/ui/js/ead.js"></script> <script type="text/javascript" src="{$baseURI}core/ui/lib/Sortable.min.js"></script> <script type="text/javascript" src="{$baseURI}core/ui/lib/Sortable.min.js"/> <script type="text/javascript" src="{$baseURI}plugins/side_toc/side_toc.js"/> <script type="text/javascript" src="{$baseURI}core/ui/js/ead.js"/> <title>{$prettyName}</title> {$head} </head> <body> <header> <h1><a href="{$baseURI}{$projectId}/accueil.html">{$prettyName}</a></h1> <div id="menu"> {$menu} </div> </header> <section class="browse"> {$content} Loading @@ -20,6 +22,7 @@ <footer> <p>Site réalisé par le Pôle document numérique - MRSH - Caen | © 2012 - 2020</p> </footer> {$jsImports} <script> initEADPage(); Loading