Loading max.xq +0 −3 Changes for max.xq: 0 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -149,9 +149,6 @@ function max:htmlFragmentAndTargetSearchWithNavigationBar($project, $routeDoc, $ replace value of node $c/descendant-or-self::*[@*:id=$targetId]/@*:id with "target" ) return $c (: return for $hit in ft:mark($d[.//text() contains text {$search}]) return $hit :) }; Loading package.json +0 −1 Changes for package.json: 0 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ "scripts": {}, "dependencies": { "install": "^0.12.1", "openseadragon": "^2.4.0", "readline": "^1.3.0", "xmldom": "^0.1.27" } Loading ui/js/Max.js 0 → 100644 +222 −0 Changes for ui/js/Max.js: 222 added lines, 0 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 { constructor(pid, baseURL, pluginsURL,fid) { this.projectID = pid; this.baseURL = baseURL; this.pluginsBaseURL = pluginsURL; this.plugins = new Array(); this.fragmentID = fid; } run(){ if(this.isInFragmentContext()) { this.textOptions(); if(this.isWithNotes()){ //ajout d'une colonne de notes + placement this.manageMarginNotes(); this.bindNotesClick(); } this.bindNavigationTool(); this.bindTooltips(); this.runPlugins(); //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.push(p); console.log(p.getName() + " plugin was added") } getBaseURL(){ return this.baseURL; } getPluginsBaseURL(){ return this.pluginsBaseURL; } scrollToID(id) { this.scrollToElement($("#" + id.replace(".","\\."))); } scrollToElement(element, delay) { var 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(){ var optionName = $(this).data('option'); if(localStorage. getItem(MAX_LOCAL_STORAGE_PREFIX + optionName) === MAX_VISIBLE_PROPERTY_STRING) { $(this).attr("checked", "checked"); //updates visibility $("."+optionName).show(); } else{ $(this).removeAttr("checked"); //updates visibility $("."+optionName).hide(); } }) } manageMarginNotes(){ var mainContainer = $("#main_max_container"); var leftBloc = mainContainer.children(":first"); leftBloc.addClass("row"); $("#text").addClass("col-sm-8"); leftBloc.append("<div id='margin_notes' class='col-sm-2'></div>"); var previousNote = null; $(".manchette_droite").each(function(){ //stocke le top original avant de déplacer la note var originalTop = $(this).position().top; //déplacement de la note dans la colonne prévue $(this).appendTo("#margin_notes"); //mise à jour top (+anti-chevauchement) var newTop = originalTop; if (previousNote != null && previousNote.position() != null) { var bottomPrevious = previousNote.position().top + previousNote.height(); if (bottomPrevious + 5 > newTop) { newTop = bottomPrevious + 5; } } $(this).css("top", newTop +"px"); previousNote = $(this); }); } /* Branchements 'onClick' notes de bas de page */ bindNotesClick(){ var me = this; $(NOTE_TO_TXT_CLASS).click(function(event){ event.preventDefault(); var target = $(this).attr("href").replace('#',''); me.scrollToID(target); }); } /*Branchements 'onClick' sur les flèches de la barre de navigation*/ bindNavigationTool (){ if($('#nav_previous').length){ $('#nav_previous').click( function(evt){ var current = $("#navigation-tool").find('button').attr("id").replace("selected-","");//remove 'selected' prefix window.location.href=$("li[id='"+current+"']").prev().find("a").attr("href"); }); } if($('#nav_next').length){ $('#nav_next').click( function(evt){ var current = $("#navigation-tool").find('button').attr("id").replace("selected-","");//remove 'selected' prefix window.location.href=($("li[id='"+current+"']").next().find("a").attr("href")); }); } } bindTooltips (){ $('[data-toggle="tooltip"]').each(function(){ var noteNumber = $(this).attr('id').substr(5); //clones bottom page note var noteContent = $("#wrap_bdp_" + noteNumber).clone(); //removes note call (</a>) noteContent.find(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 } } ); }); } runPlugins(){ for(let i = 0; i < this.plugins.length; i++) this.plugins[i].run() } /* Vérifie si le contexte courant (page) est une consultation d'un fragment (présence d'un élement identifié 'text') */ isInFragmentContext(){ return $("#text").length > 0 } isWithNotes(){ return $(".note").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(MAX_LOCAL_STORAGE_PREFIX + className, MAX_VISIBLE_PROPERTY_STRING); } else{ $("."+className).hide(); localStorage.removeItem(MAX_LOCAL_STORAGE_PREFIX + className); } } toString() { return this.projectID +"s MaX"; } } window.MAX = new Max(projectId, baseURI, pluginsBaseURI, fragmentId); $(document).ready(function(){ MAX.run() }) ui/js/Plugin.js 0 → 100644 +13 −0 Changes for ui/js/Plugin.js: 13 added lines, 0 removed lines. Original line number Diff line number Diff line class Plugin { constructor(name) { this.name = name; console.log('Plugin '+ name + ' built !') } getName(){ return this.name; } run(){} } export { Plugin } No newline at end of file ui/lib/bootstrap.bundle.min.js 0 → 120000 +1 −0 Changes for ui/lib/bootstrap.bundle.min.js: 1 added line, 0 removed lines. Original line number Diff line number Diff line ../../node_modules/bootstrap/dist/js/bootstrap.bundle.min.js No newline at end of file Loading
max.xq +0 −3 Changes for max.xq: 0 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -149,9 +149,6 @@ function max:htmlFragmentAndTargetSearchWithNavigationBar($project, $routeDoc, $ replace value of node $c/descendant-or-self::*[@*:id=$targetId]/@*:id with "target" ) return $c (: return for $hit in ft:mark($d[.//text() contains text {$search}]) return $hit :) }; Loading
package.json +0 −1 Changes for package.json: 0 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ "scripts": {}, "dependencies": { "install": "^0.12.1", "openseadragon": "^2.4.0", "readline": "^1.3.0", "xmldom": "^0.1.27" } Loading
ui/js/Max.js 0 → 100644 +222 −0 Changes for ui/js/Max.js: 222 added lines, 0 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 { constructor(pid, baseURL, pluginsURL,fid) { this.projectID = pid; this.baseURL = baseURL; this.pluginsBaseURL = pluginsURL; this.plugins = new Array(); this.fragmentID = fid; } run(){ if(this.isInFragmentContext()) { this.textOptions(); if(this.isWithNotes()){ //ajout d'une colonne de notes + placement this.manageMarginNotes(); this.bindNotesClick(); } this.bindNavigationTool(); this.bindTooltips(); this.runPlugins(); //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.push(p); console.log(p.getName() + " plugin was added") } getBaseURL(){ return this.baseURL; } getPluginsBaseURL(){ return this.pluginsBaseURL; } scrollToID(id) { this.scrollToElement($("#" + id.replace(".","\\."))); } scrollToElement(element, delay) { var 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(){ var optionName = $(this).data('option'); if(localStorage. getItem(MAX_LOCAL_STORAGE_PREFIX + optionName) === MAX_VISIBLE_PROPERTY_STRING) { $(this).attr("checked", "checked"); //updates visibility $("."+optionName).show(); } else{ $(this).removeAttr("checked"); //updates visibility $("."+optionName).hide(); } }) } manageMarginNotes(){ var mainContainer = $("#main_max_container"); var leftBloc = mainContainer.children(":first"); leftBloc.addClass("row"); $("#text").addClass("col-sm-8"); leftBloc.append("<div id='margin_notes' class='col-sm-2'></div>"); var previousNote = null; $(".manchette_droite").each(function(){ //stocke le top original avant de déplacer la note var originalTop = $(this).position().top; //déplacement de la note dans la colonne prévue $(this).appendTo("#margin_notes"); //mise à jour top (+anti-chevauchement) var newTop = originalTop; if (previousNote != null && previousNote.position() != null) { var bottomPrevious = previousNote.position().top + previousNote.height(); if (bottomPrevious + 5 > newTop) { newTop = bottomPrevious + 5; } } $(this).css("top", newTop +"px"); previousNote = $(this); }); } /* Branchements 'onClick' notes de bas de page */ bindNotesClick(){ var me = this; $(NOTE_TO_TXT_CLASS).click(function(event){ event.preventDefault(); var target = $(this).attr("href").replace('#',''); me.scrollToID(target); }); } /*Branchements 'onClick' sur les flèches de la barre de navigation*/ bindNavigationTool (){ if($('#nav_previous').length){ $('#nav_previous').click( function(evt){ var current = $("#navigation-tool").find('button').attr("id").replace("selected-","");//remove 'selected' prefix window.location.href=$("li[id='"+current+"']").prev().find("a").attr("href"); }); } if($('#nav_next').length){ $('#nav_next').click( function(evt){ var current = $("#navigation-tool").find('button').attr("id").replace("selected-","");//remove 'selected' prefix window.location.href=($("li[id='"+current+"']").next().find("a").attr("href")); }); } } bindTooltips (){ $('[data-toggle="tooltip"]').each(function(){ var noteNumber = $(this).attr('id').substr(5); //clones bottom page note var noteContent = $("#wrap_bdp_" + noteNumber).clone(); //removes note call (</a>) noteContent.find(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 } } ); }); } runPlugins(){ for(let i = 0; i < this.plugins.length; i++) this.plugins[i].run() } /* Vérifie si le contexte courant (page) est une consultation d'un fragment (présence d'un élement identifié 'text') */ isInFragmentContext(){ return $("#text").length > 0 } isWithNotes(){ return $(".note").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(MAX_LOCAL_STORAGE_PREFIX + className, MAX_VISIBLE_PROPERTY_STRING); } else{ $("."+className).hide(); localStorage.removeItem(MAX_LOCAL_STORAGE_PREFIX + className); } } toString() { return this.projectID +"s MaX"; } } window.MAX = new Max(projectId, baseURI, pluginsBaseURI, fragmentId); $(document).ready(function(){ MAX.run() })
ui/js/Plugin.js 0 → 100644 +13 −0 Changes for ui/js/Plugin.js: 13 added lines, 0 removed lines. Original line number Diff line number Diff line class Plugin { constructor(name) { this.name = name; console.log('Plugin '+ name + ' built !') } getName(){ return this.name; } run(){} } export { Plugin } No newline at end of file
ui/lib/bootstrap.bundle.min.js 0 → 120000 +1 −0 Changes for ui/lib/bootstrap.bundle.min.js: 1 added line, 0 removed lines. Original line number Diff line number Diff line ../../node_modules/bootstrap/dist/js/bootstrap.bundle.min.js No newline at end of file