// Specialized loader just for the banner element
function loadBannerJQ(){
var concordance = localStorage.getItem(‘concordance_title’);
var url = “https://thomasmorestudies.org/cf/Banners/” + concordance + “Banner.txt”;
const sidebar_div = jQuery(““);
jQuery.get( url, function( data ) {
sidebar_div.html(data);
jQuery(“#banner-content”).html( sidebar_div );
add_links_to_banner();
});
}
// This function replaces the first
tag in the banner with a link back to the concordance, // and to any pdf files associated with the concordance. // This way the links are next to the bold title, and not after the file description. function add_links_to_banner(){ var title = localStorage.getItem(‘concordance_title’); var old_br = document.getElementById(“banner-content”).innerHTML; // var concordances_URL = “https://thomasmorestudies.org/concordances-2/”; var concordances_URL = “https://thomasmorestudies.org/concordance-home/”; var conc_links = ” | Back to Concordances“; var pdf_list = pdf_dict[title]; pdf_list.forEach(function(value, index, array) { var file_name = title + (value.replace(/ /g, “”)) + “.pdf”; var link = ” | ” + value +” (PDF)” conc_links = conc_links + link; }); conc_links = conc_links + “
“; var new_br = old_br.replace(“
“, conc_links); document.getElementById(“banner-content”).innerHTML = new_br; } // Load the pdf file relevant for this page function loadPDFfile(idx, file_name) { var pdfFile = “https://thomasmorestudies.org/cf/PDFs/” + file_name; window.open(pdfFile, pdfFile, “top=” + (100*idx + 100) + “,left=” + (100*idx + 200) + “,width=400,height=500”); } var pdf_dict = {Apology:[“Concordance”, “Text”], CambridgeUtopia:[], CityOfGod:[], Confutation:[“Text Part 1”, “Text Part 2”], DeTristitia:[], Debellation:[“Concordance”, “Text”], DialogueComfort:[“Concordance”, “Text”], EnglishCorrespondence:[“Text”], EnglishPoems:[“Concordance”], HRT15:[“Thematic Index”, “Text”], HRT2:[“Lemmatized Concordance”, “Text”], Heresies:[], InstructionsAndPrayers:[“Text”], LastThings:[“Concordance”], LatinCorrespondence:[“Text”], LatinEpigrams:[“Text”], LucianTranslations:[], Passion:[“Text”], Pico:[“Concordance”], PoisonedBook:[“Text”], ResponsioLutherum:[], RichardIII:[“Lemmatized Concordance”, “Text”], Sallust:[], Supplication:[], TotBB:[“Text”], Utopia:[], CumulativeLatin:[], CumulativeEnglish:[], CumulativeComplete:[]}
tag in the banner with a link back to the concordance, // and to any pdf files associated with the concordance. // This way the links are next to the bold title, and not after the file description. function add_links_to_banner(){ var title = localStorage.getItem(‘concordance_title’); var old_br = document.getElementById(“banner-content”).innerHTML; // var concordances_URL = “https://thomasmorestudies.org/concordances-2/”; var concordances_URL = “https://thomasmorestudies.org/concordance-home/”; var conc_links = ” | Back to Concordances“; var pdf_list = pdf_dict[title]; pdf_list.forEach(function(value, index, array) { var file_name = title + (value.replace(/ /g, “”)) + “.pdf”; var link = ” | ” + value +” (PDF)” conc_links = conc_links + link; }); conc_links = conc_links + “
“; var new_br = old_br.replace(“
“, conc_links); document.getElementById(“banner-content”).innerHTML = new_br; } // Load the pdf file relevant for this page function loadPDFfile(idx, file_name) { var pdfFile = “https://thomasmorestudies.org/cf/PDFs/” + file_name; window.open(pdfFile, pdfFile, “top=” + (100*idx + 100) + “,left=” + (100*idx + 200) + “,width=400,height=500”); } var pdf_dict = {Apology:[“Concordance”, “Text”], CambridgeUtopia:[], CityOfGod:[], Confutation:[“Text Part 1”, “Text Part 2”], DeTristitia:[], Debellation:[“Concordance”, “Text”], DialogueComfort:[“Concordance”, “Text”], EnglishCorrespondence:[“Text”], EnglishPoems:[“Concordance”], HRT15:[“Thematic Index”, “Text”], HRT2:[“Lemmatized Concordance”, “Text”], Heresies:[], InstructionsAndPrayers:[“Text”], LastThings:[“Concordance”], LatinCorrespondence:[“Text”], LatinEpigrams:[“Text”], LucianTranslations:[], Passion:[“Text”], Pico:[“Concordance”], PoisonedBook:[“Text”], ResponsioLutherum:[], RichardIII:[“Lemmatized Concordance”, “Text”], Sallust:[], Supplication:[], TotBB:[“Text”], Utopia:[], CumulativeLatin:[], CumulativeEnglish:[], CumulativeComplete:[]}
NOTE: Parts of the concordances are still being worked on, and may have problems because of this. Thank you for your patience!
To load the table for a word, click on the word in “Wordlist”.
Once a table is loaded, click on any line in the table to scroll to that line in the text.
To access a new concordance, click on the large “Concordance” in front of the current title.
Styles
.entry-title{
display: none;
}
span.w:hover{
color: blue;
background-color: lightBlue;
}
div.w {
line-height: 1.1;
overflow: auto;
-webkit-overflow-scrolling: touch;
height: 400px;
resize:vertical;
}
tr:not(:first-child):hover{
color: blue;
background-color: lightBlue;
}
button{
padding: 7px;
}
.accordion {
background-color: #eee;
color: #444;
cursor: pointer;
padding: 18px;
padding-top: 8px;
padding-bottom: 8px;
width: 100%;
border: none;
text-align: left;
outline: none;
font-size: 15px;
transition: 0.4s;
}
.active, .accordion:hover {
background-color: #ccc;
}
.panel {
padding: 0 18px;
background-color: white;
display: none;
}
#main {
padding-top: 0;
}
.panel-grid-cell .widget-title {
margin-bottom: 10px;
}
.widget-title {
font-size: 25px;
}
.hide{
display: none;
}
.highlight {
animation-name: highlight;
animation-duration: 2s;
}
@keyframes highlight {
from {background-color: lightBlue;}
to {background-color: white;}
}
input:-moz-placeholder,
textarea:-moz-placeholder,
input::-moz-placeholder,
textarea::-moz-placeholder {
color: #545353;
opacity: 0.8;
}
input:-ms-input-placeholder,
textarea:-ms-input-placeholder {
color: #545353;
}
input::-webkit-input-placeholder,
textarea::-webkit-input-placeholder {
color: #545353;
}
input[type=search]{
color: black;
opacity: 1;
}
h1.title:hover{
color: blue;
background-color: lightBlue;
}
h1.title{
display: inline;
}
li:hover{
color: blue;
background-color: lightBlue;
}
ul.ConcList {
columns: 3;
-webkit-columns: 3;
-moz-columns: 3;
}
@media screen and (max-width: 600px){
ul.ConcList{columns: 1; -webkit-columns: 1; -moz-columns: 1;}
}
/* Reduce wasted space at the top */
.page-wrap {
padding-top: 0px;
}
.page .page-wrap .content-wrapper, .single .page-wrap .content-wrapper {
padding: 30px;
padding-top: 0px
}
/* Add ellipsis to the Text style, in case of cumulative concordances */
h3.ellipsis {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
Concordance:
Concordances
- De Tristitia Christi, CW 14
- Historia Richardi Tertii, CW 2
- Historia Richardi Tertii, CW 15
- Latin Correspondence
- Latin Epigrams, CW 3.2
- Lucian Translations [from Greek to Latin], CW 3.1
- Responsio ad Lutherum, CW 5
- Utopia, CW 4 edition
- Utopia, Cambridge UP edition
- Answer to a Poisoned Book, CW 11
- Apology, CW 9
- Confutation of Tyndale’s Answer, CW 8
- Debellation of Salem and Bizance, CW 10
- Dialogue Concerning Heresies, CW 6
- Dialogue of Comfort Against Tribulation, CW 12
- English Correspondence
- English Poems, CW 1
- History of Richard III, CW 2
- Instructions and Prayers, CW 13
- The Last Things, CW 1
- Life of Pico, CW 1
- Supplication of Souls, CW 7
- Treatise on the Blessed Body, CW 13
- Treatise on the Passion, CW 13
- Cumulative Test
- Cumulative Concordance of More’s Latin Works
- Cumulative Concordance of More’s English Works
- Cumulative Concordance of More’s Complete Works
- Augustine’s De civitate Dei
- Sallust’s Bellum Catilinae and Bellum Iugurthinum
- test File
- tester
Wordlist
The Concordance
The Text
Scripts
// Calls the function below with “this” as the parameter
function set_spans_when_entered(){
wrap_words_in_spans(this);
}
// When the user enters a large sidebar span, wrap all words
// in a
function wrap_words_in_spans(el){
if(el.classList.contains(“done”)){
return; // We’ve already dealt with this span
}
el.classList.remove(“undone”);
el.classList.add(“done”);
var old_text = el.innerHTML;
var new_text = old_text.replace(/(.*)(\(\d*\))/g, “$1$2“);
el.innerHTML = new_text;
}
// Load the table based on the clicked word
function tarmac_word_to_table(){
‘use strict’;
var word = this.innerHTML.split(“(“)[0];
if(this.classList.contains(“special_word”)){
word = “x” + word;
}
document.getElementById(‘list_lines’).innerHTML = “”;
loadDocJQ(“Tables/” + word, “list_lines”);
}
// When a concordance is first loaded, grab the first entry
// in the SideBar and load the corresponding table.
function tarmac_load_initial_table(){
‘use strict’;
// Find all word-spans
var sidebar_div = document.getElementById(‘wordlist’);
var sidebar_start = sidebar_div.innerHTML.substring(0, 150).split(“\n”)[0];
var word = sidebar_start.replace(/.*(\w*)\(\d*\).*/, “$1”);
//console.log(“Word = >” + word + “<");
if(word){
document.getElementById('list_lines').innerHTML = "";
loadDocJQ("Tables/" + word, "list_lines");
} else {
console.log("No word found");
}
}
// This is called when the user first visits a concordance
function setConc(){
'use strict';
var conc = this.id;
localStorage.setItem('concordance_title', conc);
document.getElementById('concordance_title').innerHTML = document.getElementById(conc).innerHTML;
document.getElementById('wordlist').innerHTML = "";
document.getElementById('text').innerHTML = "";
document.getElementById("mySearch").value = "";
loadDocJQ("SideBar", "wordlist");
document.getElementById('text').innerHTML = "";
document.getElementById('list_lines').innerHTML = "Table";
loadDocJQ("Text", "text");
}
// Call this after the text has loaded, for cumulative concordances
function setCumulativeConc(){
'use strict';
// Reset the title "The Text" in case we had been reading a cumulative concordance.
jQuery("#text").parent().prev().html("THE TEXT");
// If we just loaded a cumulative concordance, set the title text
var current_title = localStorage.getItem('concordance_title').toLowerCase();
if (current_title.indexOf("cumulative") != -1) {
var text_div = jQuery("#text");
var title_div = text_div.parent().prev();
var titles_list = jQuery(".work_title");
var first_title = titles_list.first().html();
title_div.html("THE TEXT: " + first_title);
title_div.addClass("ellipsis");
}
// Set the banner information
loadBannerJQ();
}
// TESTING EDITS MADE HERE
function loadDocJQ(el, div){
'use strict';
var concordance = localStorage.getItem('concordance_title');
// console.log("it works");
// loadDocJQ("SideBar", "wordlist");
var element_file = function () {
if (el == "SideBar") {
return "https://thomasmorestudies.org/cf/" + concordance + "/" + concordance + ".json";
} else {
return "https://thomasmorestudies.org/cf/" + concordance + "/" + concordance + el + ".txt";
}
}();
// console.log(element_file);
const tmp_div_in_memory = jQuery("“);
jQuery.get( element_file, function( data ) {
// NEW ALGORITHM
if (el == “SideBar”) {
// gets words array from data
var wordsArray = data.words;
// sets new wordlistString variable
// loops through whole words array in JSON file,
// surrounds word with span,
// and concatenates it to wordlistString
// console.log(dataString);
var wordlistString = “” + wordsArray[0] + “
” + wordsArray.splice(1).join(“
“) + ““; console.log(wordlistString); // sets wordlistString to HTML content of new div tmp_div_in_memory.html(wordlistString); // NEW ALGORITHM ENDS HERE } else { tmp_div_in_memory.html(data); jQuery(“#” + div).append( tmp_div_in_memory ); } // appends new div to one of the 3 sections of concordance jQuery(“#” + div).append( tmp_div_in_memory ); if(el == “SideBar”){ jQuery(“span.w”).click(tarmac_word_to_table); tarmac_load_initial_table(); //jQuery(“span.undone”).mouseover(set_spans_when_entered); } if(div == “list_lines”){ jQuery(“tr”).not(‘:first’).click(scroll_to_tr); //jQuery(“tr”).not(‘:first’).click(scroll_to_tr_nodiv); } if(el == “Text”){ setCumulativeConc(); // In case we loaded a cumulative } }); } // Scrolls the SideBar text so that “the_span” is at the top function scroll_to_WL(the_span){ ‘use strict’; var text_top = document.getElementById(‘wordlist’).offsetTop; var container = document.getElementById(‘wordlist’); container.scrollTop = the_span.offsetTop – text_top; } function searchWL() { ‘use strict’; var word = document.getElementById(“mySearch”).value; /* // Get all matching large spans that have the word in it as prefix var regex2 = new RegExp(“\n”+word+”(.*)(\(\d*\))”, “im”) var target2 = jQuery(“span.undone”).filter(function(){ return regex2.test(this.innerHTML); }); if(target2[0]){ wrap_words_in_spans(target2[0]); } /*console.log(target.size()); for(var i = 0; i ” + target[0].innerHTML.charAt(i) + “<"); }*/ // Get all matching spans var regex = new RegExp("^" + word, "i"); // i makes it case-insensitive var target = jQuery("span.w").filter(function(){ return regex.test(this.innerHTML); }); // Move the word list to the first match if(target[0]){ scroll_to_WL(target[0]); } } // This script is run when a user clicks on a row of the table. // It finds the corresponding row in the text, scrolls the text // to the appropriate row, and highlights that row. function scroll_to_tr(){ 'use strict'; var the_tag = this.cells[this.cells.length – 1].innerHTML; console.log(the_tag); var text_top = document.getElementById('text').offsetTop; var container = document.getElementById('text'); var scrollTo = document.getElementById(the_tag); container.scrollTop = scrollTo.offsetTop – text_top; highlightLine(scrollTo); } // This script is run when a user clicks on a row of the table. // It finds the corresponding row in the text, scrolls the text // to the appropriate row, and highlights that row. function scroll_to_tr_nodiv(){ 'use strict'; clear_highlight_tags(); var the_tag = "TARMAC" var text_line = this.cells[0].innerHTML; var span_id = this.cells[1].innerHTML; var span_block = document.getElementById(span_id); var container = document.getElementById('text'); var text_top = container.offsetTop; var old_text = span_block.innerHTML; var new_text = old_text.replace(text_line, "” + text_line + ““); span_block.innerHTML = new_text; var scrollTo = document.getElementById(the_tag); container.scrollTop = scrollTo.offsetTop – text_top; highlightLine(scrollTo); } // Remove the special tags we put in to do text scrolling and highlighting function clear_highlight_tags(){ //console.log(“Clearing”); elements_to_clear = document.getElementsByClassName(“tmp_span”); for(var i = 0; i < elements_to_clear.length; i++){ var el = elements_to_clear[i]; var line = el.innerHTML; var parent_span = el.parentElement; var old_text = parent_span.innerHTML; var new_text = old_text.replace(//, line); parent_span.innerHTML = new_text; } } function highlightLine(el) { ‘use strict’; el.classList.remove(‘highlight’); // reset animation void el.offsetWidth; // trigger reflow el.classList.add(‘highlight’); // start animation } function hideAccordion(){ jQuery(“#Concordances”).toggle(300); } // Function attached to text div to set titles on // cumulative concordances while scrolling function scroll_text(){ ‘use strict’; var current_title = localStorage.getItem(‘concordance_title’).toLowerCase(); if (current_title.indexOf(“cumulative”) == -1) { return; } var text_div = jQuery(“#text”); var title_div = text_div.parent().prev(); var text_div_top = text_div.position().top; var text_div_bottom = text_div_top + (text_div.height() / 2); var titles_list = jQuery(“.work_title”).filter(function(index) { return jQuery(this).position().top < text_div_bottom; }); var title_on_screen = titles_list.last(); title_div.html("The Text: " + title_on_screen.html()); } jQuery(document).ready(function(){ 'use strict'; jQuery(".ConcList").children().click(setConc); //jQuery("#wordlist_nodivs").click(find_clicked_word); //console.log("Set find_clicked_word"); var title = localStorage.getItem('concordance_title'); jQuery("#" + title).trigger("click"); // The line below used to have &&, but when I added the // scroll_text function above, it caused a syntax error?!?!!? if(title != null){ if(title != ""){ jQuery("#Concordances").toggle(); } } jQuery(".accordion").click(function() { this.classList.toggle("active"); jQuery(this).next().slideToggle("fast"); }); })
” + wordsArray.splice(1).join(“
“) + ““; console.log(wordlistString); // sets wordlistString to HTML content of new div tmp_div_in_memory.html(wordlistString); // NEW ALGORITHM ENDS HERE } else { tmp_div_in_memory.html(data); jQuery(“#” + div).append( tmp_div_in_memory ); } // appends new div to one of the 3 sections of concordance jQuery(“#” + div).append( tmp_div_in_memory ); if(el == “SideBar”){ jQuery(“span.w”).click(tarmac_word_to_table); tarmac_load_initial_table(); //jQuery(“span.undone”).mouseover(set_spans_when_entered); } if(div == “list_lines”){ jQuery(“tr”).not(‘:first’).click(scroll_to_tr); //jQuery(“tr”).not(‘:first’).click(scroll_to_tr_nodiv); } if(el == “Text”){ setCumulativeConc(); // In case we loaded a cumulative } }); } // Scrolls the SideBar text so that “the_span” is at the top function scroll_to_WL(the_span){ ‘use strict’; var text_top = document.getElementById(‘wordlist’).offsetTop; var container = document.getElementById(‘wordlist’); container.scrollTop = the_span.offsetTop – text_top; } function searchWL() { ‘use strict’; var word = document.getElementById(“mySearch”).value; /* // Get all matching large spans that have the word in it as prefix var regex2 = new RegExp(“\n”+word+”(.*)(\(\d*\))”, “im”) var target2 = jQuery(“span.undone”).filter(function(){ return regex2.test(this.innerHTML); }); if(target2[0]){ wrap_words_in_spans(target2[0]); } /*console.log(target.size()); for(var i = 0; i ” + target[0].innerHTML.charAt(i) + “<"); }*/ // Get all matching spans var regex = new RegExp("^" + word, "i"); // i makes it case-insensitive var target = jQuery("span.w").filter(function(){ return regex.test(this.innerHTML); }); // Move the word list to the first match if(target[0]){ scroll_to_WL(target[0]); } } // This script is run when a user clicks on a row of the table. // It finds the corresponding row in the text, scrolls the text // to the appropriate row, and highlights that row. function scroll_to_tr(){ 'use strict'; var the_tag = this.cells[this.cells.length – 1].innerHTML; console.log(the_tag); var text_top = document.getElementById('text').offsetTop; var container = document.getElementById('text'); var scrollTo = document.getElementById(the_tag); container.scrollTop = scrollTo.offsetTop – text_top; highlightLine(scrollTo); } // This script is run when a user clicks on a row of the table. // It finds the corresponding row in the text, scrolls the text // to the appropriate row, and highlights that row. function scroll_to_tr_nodiv(){ 'use strict'; clear_highlight_tags(); var the_tag = "TARMAC" var text_line = this.cells[0].innerHTML; var span_id = this.cells[1].innerHTML; var span_block = document.getElementById(span_id); var container = document.getElementById('text'); var text_top = container.offsetTop; var old_text = span_block.innerHTML; var new_text = old_text.replace(text_line, "” + text_line + ““); span_block.innerHTML = new_text; var scrollTo = document.getElementById(the_tag); container.scrollTop = scrollTo.offsetTop – text_top; highlightLine(scrollTo); } // Remove the special tags we put in to do text scrolling and highlighting function clear_highlight_tags(){ //console.log(“Clearing”); elements_to_clear = document.getElementsByClassName(“tmp_span”); for(var i = 0; i < elements_to_clear.length; i++){ var el = elements_to_clear[i]; var line = el.innerHTML; var parent_span = el.parentElement; var old_text = parent_span.innerHTML; var new_text = old_text.replace(//, line); parent_span.innerHTML = new_text; } } function highlightLine(el) { ‘use strict’; el.classList.remove(‘highlight’); // reset animation void el.offsetWidth; // trigger reflow el.classList.add(‘highlight’); // start animation } function hideAccordion(){ jQuery(“#Concordances”).toggle(300); } // Function attached to text div to set titles on // cumulative concordances while scrolling function scroll_text(){ ‘use strict’; var current_title = localStorage.getItem(‘concordance_title’).toLowerCase(); if (current_title.indexOf(“cumulative”) == -1) { return; } var text_div = jQuery(“#text”); var title_div = text_div.parent().prev(); var text_div_top = text_div.position().top; var text_div_bottom = text_div_top + (text_div.height() / 2); var titles_list = jQuery(“.work_title”).filter(function(index) { return jQuery(this).position().top < text_div_bottom; }); var title_on_screen = titles_list.last(); title_div.html("The Text: " + title_on_screen.html()); } jQuery(document).ready(function(){ 'use strict'; jQuery(".ConcList").children().click(setConc); //jQuery("#wordlist_nodivs").click(find_clicked_word); //console.log("Set find_clicked_word"); var title = localStorage.getItem('concordance_title'); jQuery("#" + title).trigger("click"); // The line below used to have &&, but when I added the // scroll_text function above, it caused a syntax error?!?!!? if(title != null){ if(title != ""){ jQuery("#Concordances").toggle(); } } jQuery(".accordion").click(function() { this.classList.toggle("active"); jQuery(this).next().slideToggle("fast"); }); })
Questions
- Do we want the TITLE of the page to change (this is in the browser title bar, at the very, very top) whenever the concordance changes? The current site does this.
- Do we want some particular word’s table to load automatically when we load the concordance?
- Do we want to put the pdf links on the master concordance page, and the individual pages, in the same fashion as they are on the current site?
- On the old site, pdfs open in the current window. Should we do that still? Currently, we have them opening in a separate window.
- We grabbed “Instructions and Prayers” from a different place than the concordance page. That link on the old CTMS site is broken. Is the text we grabbed okay?
- To make the Cumulatives work nicely, we slightly modified the tags in the source texts (ex “Corr” to “LCorr” or “ECorr” for the Latin and English Correspondences). Is that okay?
- When we copied the banner text from here: https://thomasmorestudies.org/EnglishConcordance/framconc.htm , we added italics around “The Complete…”. Is that okay?
- And we used the same banner text on the Latin cumulative concordance, so as to include R.S. Sylvester’s name. Is that okay?
- It would be good to remove “english-correspondence” from the URL of the concordance. Can Patrick do that?