diff --git a/app/assets/javascripts/DkBreve.js b/app/assets/javascripts/DkBreve.js index d9884064..edc71af7 100644 --- a/app/assets/javascripts/DkBreve.js +++ b/app/assets/javascripts/DkBreve.js @@ -194,7 +194,7 @@ $(document).ready(function () { if(typeof (has_facs)!== 'undefined') { if (!(has_facs)) { document.getElementsByClassName('ocr')[0].addEventListener("scroll", function () { - let currentOcrPage = getOcrCurrentPage(); + let currentOcrPage = getOcrCurrentPage(); let citationPageNumber = document.getElementById('pageNumber'); let hashTagInURI = document.getElementById('hashTagInURI'); if (citationPageNumber) { @@ -212,11 +212,13 @@ $(document).ready(function () { ocrScrollTopOffset = ocrScrollTop + 9, // Magic number 9 is 1 px less than the margin added when setting pages ocrBreaks = $('.pageBreak', ocrElem); var i = 0; - if ($(ocrBreaks[0]).position().top + ocrScrollTopOffset > ocrScrollTop) { - return 1; // user are before the very first pageBreak => page 1 - } - while (i < ocrBreaks.length && $(ocrBreaks[i]).position().top + ocrScrollTopOffset <= ocrScrollTop) { - i++; + if ($(ocrBreaks).length){ + if ($(ocrBreaks[0]).position().top + ocrScrollTopOffset > ocrScrollTop) { + return 1; // user are before the very first pageBreak => page 1 + } + while (i < ocrBreaks.length && $(ocrBreaks[i]).position().top + ocrScrollTopOffset <= ocrScrollTop) { + i++; + } } return i + 1; } diff --git a/app/assets/javascripts/text_service/comments_in_modal.js b/app/assets/javascripts/text_service/comments_in_modal.js index a1844a69..ef343368 100644 --- a/app/assets/javascripts/text_service/comments_in_modal.js +++ b/app/assets/javascripts/text_service/comments_in_modal.js @@ -4,11 +4,11 @@ var comments = document.querySelectorAll('a[title="Kommentar"]'); for (var i = 0; i < comments.length; i++) { var comment = comments[i]; comment.dataset.toggle = "modal"; - comment.dataset.target = "#comment"; + comment.dataset.target = "#comment_modal"; comment.addEventListener("click", function (event) { event.preventDefault() - var modal = document.getElementById('comment'); + var modal = document.getElementById('comment_modal'); var modal_body = modal.getElementsByClassName('modal-body')[0]; var xhttp = new XMLHttpRequest(); diff --git a/app/assets/javascripts/text_service/ie_message.js b/app/assets/javascripts/text_service/ie_message.js new file mode 100644 index 00000000..1540791a --- /dev/null +++ b/app/assets/javascripts/text_service/ie_message.js @@ -0,0 +1,33 @@ +"use strict"; +function ie_message() { + if (is_ie()){ + var notification = document.querySelectorAll('.org-11bfca9f-f278-4d0e-8384-2a2d064e8f6c.ie_message'); + if (notification){ + notification[0].classList.remove('hidden'); + } + + } +} + +function is_ie(){ + var ua = window.navigator.userAgent; + var msie = ua.indexOf("MSIE "); + + if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) // If Internet Explorer, return version number + { + return true; + } + else // If another browser, return 0 + { + return false; + } + + return false; +} + +function closeBanner(){ + var banner = document.getElementById('ie_banner'); + banner.style.display = 'none'; +} + +window.addEventListener('load', ie_message, false); diff --git a/app/assets/javascripts/text_service/infos_in_modal.js b/app/assets/javascripts/text_service/infos_in_modal.js new file mode 100644 index 00000000..14d92cbe --- /dev/null +++ b/app/assets/javascripts/text_service/infos_in_modal.js @@ -0,0 +1,24 @@ +"use strict"; +var infos = document.querySelectorAll('a.info[title="Tekstkritik"]'); + +for (var i = 0; i < infos.length; i++) { + var info = infos[i]; + info.dataset.toggle = "modal"; + info.dataset.target = "#info_modal"; + + info.addEventListener("click", function (event) { + event.preventDefault() + let modal = document.getElementById('info_modal'); + let modal_body = modal.getElementsByClassName('modal-body')[0]; + let text_critic = this.parentElement.nextElementSibling; + modal_body.innerHTML = text_critic.innerHTML; + text_critic.setAttribute("style", "display: none !important"); + let witnesses = text_critic.querySelectorAll('.witness[title]'); + let modal_footer = modal.getElementsByClassName('modal-footer')[0]; + modal_footer.innerHTML = '
]: Lemma symbol
'; + for (var i = 0; i < witnesses.length; i++) { + modal_footer.innerHTML += '
' + witnesses[i].innerHTML + ': ' + witnesses[i].getAttribute('title')+'
'; + } + + }); +} \ No newline at end of file diff --git a/app/assets/javascripts/text_service/show_relevant_text_possibilities.js b/app/assets/javascripts/text_service/show_relevant_text_possibilities.js new file mode 100644 index 00000000..dcffe480 --- /dev/null +++ b/app/assets/javascripts/text_service/show_relevant_text_possibilities.js @@ -0,0 +1,27 @@ +"use strict"; + +function show_relevant_text_possibilities() { + + let pageBreaks = document.querySelectorAll('.symbol.pagination.edition'); + pageBreaks.forEach(function(pageBreak) { + pageBreak.parentElement.style.display = 'inline'; + pageBreak.innerHTML = ' ' + pageBreak.innerHTML; + }); + + pageBreaks = document.querySelectorAll('.symbol.pagination.other'); + pageBreaks.forEach(function(pageBreak) { + pageBreak.innerHTML = '🗏 ' + pageBreak.innerHTML; + }); + + let types = ['quote', 'comment', 'translation', 'modernized', 'info', 'person', 'place', 'title', 'pagination.other']; + types.forEach(function(type) + { + var symbols = document.querySelectorAll('.symbol.' + type); + if (symbols.length != 0){ + var button = document.getElementById(type); + button.classList.remove("hidden"); + } + }); +} + +window.addEventListener('load', show_relevant_text_possibilities(), false); \ No newline at end of file diff --git a/app/assets/javascripts/text_service/toggle_info.js b/app/assets/javascripts/text_service/toggle_info.js new file mode 100644 index 00000000..ec19605d --- /dev/null +++ b/app/assets/javascripts/text_service/toggle_info.js @@ -0,0 +1,22 @@ +"use strict"; + +function toggle_infos() { + let text_infos = document.querySelectorAll("span.symbol.info"); + if (this.checked) { + for (i = 0; i < text_infos.length; i++) { + text_infos[i].style.display = 'inline'; + text_infos[i].classList.add('icon', 'info'); + text_infos[i].parentElement.style.display = 'inline'; + } + } else { + for (i = 0; i < text_infos.length; i++) { + text_infos[i].style.display = 'none'; + text_infos[i].parentElement.style.display = 'none'; + } + } +} + +let show_infos = document.getElementById('Show_infos'); +if (show_infos) { + show_infos.addEventListener('click', toggle_infos, false); +} diff --git a/app/assets/javascripts/text_service/toggle_locations.js b/app/assets/javascripts/text_service/toggle_locations.js new file mode 100644 index 00000000..7cc0bcde --- /dev/null +++ b/app/assets/javascripts/text_service/toggle_locations.js @@ -0,0 +1,22 @@ +"use strict"; + +function toggle_location() { + let text_locations = document.querySelectorAll("span.symbol.place"); + if (this.checked) { + for (i = 0; i < text_locations.length; i++) { + text_locations[i].style.display = 'inline'; + text_locations[i].classList.add('icon', 'location_on'); + text_locations[i].parentElement.style.display = 'inline'; + } + } else { + for (i = 0; i < text_locations.length; i++) { + text_locations[i].style.display = 'none'; + text_locations[i].parentElement.style.display = 'none'; + } + } +} + +let show_locations = document.getElementById('Show_locations'); +if (show_locations) { + show_locations.addEventListener('click', toggle_location, false); +} diff --git a/app/assets/javascripts/text_service/toggle_modernisation.js b/app/assets/javascripts/text_service/toggle_modernisation.js new file mode 100644 index 00000000..320e3a05 --- /dev/null +++ b/app/assets/javascripts/text_service/toggle_modernisation.js @@ -0,0 +1,22 @@ +"use strict"; + +function toggle_modernizations() { + let text_modernizations = document.querySelectorAll("span.symbol.modernized"); + if (this.checked) { + for (i = 0; i < text_modernizations.length; i++) { + text_modernizations[i].style.display = 'inline'; + text_modernizations[i].classList.add('icon', 'filter_vintage'); + text_modernizations[i].parentElement.style.display = 'inline'; + } + } else { + for (i = 0; i < text_modernizations.length; i++) { + text_modernizations[i].style.display = 'none'; + text_modernizations[i].parentElement.style.display = 'none'; + } + } +} + +let show_modernizations = document.getElementById('Show_modernizations'); +if (show_modernizations) { + show_modernizations.addEventListener('click', toggle_modernizations, false); +} diff --git a/app/assets/javascripts/text_service/toggle_pagebreaks.js b/app/assets/javascripts/text_service/toggle_pagebreaks.js new file mode 100644 index 00000000..ef8f1ffc --- /dev/null +++ b/app/assets/javascripts/text_service/toggle_pagebreaks.js @@ -0,0 +1,34 @@ +"use strict"; + +function toggle_pagebreak() { + let text_pagebreaks = document.querySelectorAll(".symbol.pagination.other"); + if (this.checked) { + for (i = 0; i < text_pagebreaks.length; i++) { + text_pagebreaks[i].style.display = 'inline'; + text_pagebreaks[i].parentElement.style.display = 'inline'; + } + } else { + for (i = 0; i < text_pagebreaks.length; i++) { + text_pagebreaks[i].style.display = 'none'; + text_pagebreaks[i].parentElement.style.display = 'none'; + } + } + + text_pagebreaks = document.querySelectorAll(".symbol.pagination.edition"); + if (this.checked) { + for (i = 0; i < text_pagebreaks.length; i++) { + text_pagebreaks[i].style.position = 'static'; + text_pagebreaks[i].firstChild.classList.remove('hidden'); + } + } else { + for (i = 0; i < text_pagebreaks.length; i++) { + text_pagebreaks[i].style.position = 'absolute'; + text_pagebreaks[i].firstChild.classList.add('hidden'); + } + } +} + +let show_pagebreaks = document.getElementById('Show_pagebreaks'); +if (show_pagebreaks) { + show_pagebreaks.addEventListener('click', toggle_pagebreak, false); +} diff --git a/app/assets/javascripts/text_service/toggle_persons.js b/app/assets/javascripts/text_service/toggle_persons.js new file mode 100644 index 00000000..cacb0231 --- /dev/null +++ b/app/assets/javascripts/text_service/toggle_persons.js @@ -0,0 +1,20 @@ +"use strict"; + +function toggle_person() { + let text_persons = document.querySelectorAll("span.symbol.person"); + if (this.checked) { + for (i = 0; i < text_persons.length; i++) { + text_persons[i].style.display = 'inline'; + text_persons[i].classList.add('icon', 'person'); + } + } else { + for (i = 0; i < text_persons.length; i++) { + text_persons[i].style.display = 'none'; + } + } +} + +let show_persons = document.getElementById('Show_persons'); +if (show_persons) { + show_persons.addEventListener('click', toggle_person, false); +} diff --git a/app/assets/javascripts/text_service/qutation_service.js b/app/assets/javascripts/text_service/toggle_qutation_service.js similarity index 58% rename from app/assets/javascripts/text_service/qutation_service.js rename to app/assets/javascripts/text_service/toggle_qutation_service.js index 410703dc..b41827ac 100644 --- a/app/assets/javascripts/text_service/qutation_service.js +++ b/app/assets/javascripts/text_service/toggle_qutation_service.js @@ -1,14 +1,14 @@ "use strict"; function toggle_vis_kun_denne_del() { - let text_possibility_elements = document.getElementsByClassName("exposableDocumentFunctions"); + let comments = document.querySelectorAll("span.symbol.quote"); if (this.checked) { - for (i = 0; i < text_possibility_elements.length; i++) { - text_possibility_elements[i].style.display = 'block'; + for (i = 0; i < comments.length; i++) { + comments[i].style.display = 'block'; } } else { - for (i = 0; i < text_possibility_elements.length; i++) { - text_possibility_elements[i].style.display = 'none'; + for (i = 0; i < comments.length; i++) { + comments[i].style.display = 'none'; } } } diff --git a/app/assets/javascripts/text_service/toggle_related_texts.js b/app/assets/javascripts/text_service/toggle_related_texts.js new file mode 100644 index 00000000..1928a39d --- /dev/null +++ b/app/assets/javascripts/text_service/toggle_related_texts.js @@ -0,0 +1,17 @@ +/** + * Created by bimo on 9/28/18. + */ +"use strict"; + +function toggleRelatedTexts() { + let text_possibility_toolbar = document.getElementsByClassName("relatedTextsToolbar")[0]; + let btn = document.getElementById("toggleRelatedTexts"); + + if (btn.classList.contains('active')) { + text_possibility_toolbar.classList.add('hidden'); + } else { + text_possibility_toolbar.classList.remove('hidden'); + } + + btn.classList.toggle("active"); +} diff --git a/app/assets/javascripts/text_service/toggle_text_comments.js b/app/assets/javascripts/text_service/toggle_text_comments.js new file mode 100644 index 00000000..0b5882b2 --- /dev/null +++ b/app/assets/javascripts/text_service/toggle_text_comments.js @@ -0,0 +1,23 @@ +"use strict"; + +function toggle_text_comments() { + let text_comments = document.querySelectorAll("span.symbol.comment"); + if (this.checked) { + for (i = 0; i < text_comments.length; i++) { + text_comments[i].style.display = 'inline'; + text_comments[i].classList.add('icon', 'comment'); + text_comments[i].parentElement.classList.add ('show_comments'); + + } + } else { + for (i = 0; i < text_comments.length; i++) { + text_comments[i].style.display = 'none'; + text_comments[i].parentElement.classList.remove ('show_comments'); + } + } +} + +let show_comments = document.getElementById('Show_comments'); +if (show_comments) { + show_comments.addEventListener('click', toggle_text_comments, false); +} diff --git a/app/assets/javascripts/text_service/toggle_text_possibilities.js b/app/assets/javascripts/text_service/toggle_text_possibilities.js index e38e64f0..671185e5 100644 --- a/app/assets/javascripts/text_service/toggle_text_possibilities.js +++ b/app/assets/javascripts/text_service/toggle_text_possibilities.js @@ -3,7 +3,7 @@ */ "use strict"; -function toggleExposable() { +function toggleTextPossibilities() { let text_possibility_toolbar = document.getElementsByClassName("textPossibilitiesToolbar")[0]; let btn = document.getElementById("toggleTextPossibilities"); diff --git a/app/assets/javascripts/text_service/toggle_titles.js b/app/assets/javascripts/text_service/toggle_titles.js new file mode 100644 index 00000000..91787e12 --- /dev/null +++ b/app/assets/javascripts/text_service/toggle_titles.js @@ -0,0 +1,22 @@ +"use strict"; + +function toggle_title() { + let text_titles = document.querySelectorAll("span.symbol.title"); + if (this.checked) { + for (i = 0; i < text_titles.length; i++) { + text_titles[i].style.display = 'inline'; + text_titles[i].classList.add('icon', 'title'); + text_titles[i].parentElement.style.display = 'inline'; + } + } else { + for (i = 0; i < text_titles.length; i++) { + text_titles[i].style.display = 'none'; + text_titles[i].parentElement.style.display = 'none'; + } + } +} + +let show_titles = document.getElementById('Show_titles'); +if (show_titles) { + show_titles.addEventListener('click', toggle_title, false); +} diff --git a/app/assets/javascripts/text_service/toggle_translation.js b/app/assets/javascripts/text_service/toggle_translation.js new file mode 100644 index 00000000..9202d374 --- /dev/null +++ b/app/assets/javascripts/text_service/toggle_translation.js @@ -0,0 +1,22 @@ +"use strict"; + +function toggle_translation() { + let text_translations = document.querySelectorAll("span.symbol.translation"); + if (this.checked) { + for (i = 0; i < text_translations.length; i++) { + text_translations[i].style.display = 'inline'; + text_translations[i].classList.add('icon', 'translate'); + text_translations[i].parentElement.style.display = 'inline'; + } + } else { + for (i = 0; i < text_translations.length; i++) { + text_translations[i].style.display = 'none'; + text_translations[i].parentElement.style.display = 'none'; + } + } +} + +let show_translations = document.getElementById('Show_translations'); +if (show_translations) { + show_translations.addEventListener('click', toggle_translation, false); +} diff --git a/app/assets/stylesheets/General/_general.scss b/app/assets/stylesheets/General/_general.scss index b4c8d9a8..731d2272 100644 --- a/app/assets/stylesheets/General/_general.scss +++ b/app/assets/stylesheets/General/_general.scss @@ -1,7 +1,23 @@ +a{ + text-decoration: underline; +} + +a.comment{ + text-decoration: none; + pointer-events: none; +} + +a.show_comments{ + pointer-events: auto !important; + text-decoration: underline !important; + cursor: pointer !important; +} + #toc { .current_entry_parent { background-Color: #d1d8e6; } + .current_entry { font-weight: bold; font-family: 'nowaymedium', sans-serif; @@ -14,32 +30,38 @@ } } -#blacklight-modal{ - h1{ +#blacklight-modal { + h1 { width: 100%; text-align: center; } + .btn { border-color: #002E70; + &.btn-outline-secondary, &.btn-link { background-Color: #FFF6C4; color: #002E70; + &:hover { color: #002E70; } + &.active { cursor: text; background-Color: #002E70; color: #FFF6C4; } } - &.btn-link{ - margin: 0; + + &.btn-link { + margin: 0; + &:hover { background-Color: #FFF6C4 !important; text-decoration: none; } - } + } } } @@ -100,9 +122,13 @@ article.om-tekstportalen { .org-63a1bc7e-5093-4bf0-8d2e-fcf5bfe32aca { margin-bottom: 0; } +#info_modal .modal-footer > :not(:first-child) { + margin-left: 0 +} .exposableDocumentFunctions { line-height: 1; + a { font-size: 0; visibility: hidden; @@ -117,6 +143,76 @@ article.om-tekstportalen { } } +.page-notification.ie_message { + text-shadow: none; + + a { + display: inline-block; + text-decoration: underline; + + &:hover { + color: white; + } + } + + .close_notification { + position: absolute; + right: 1.5rem; + top: 1.5rem; + + &:hover { + color: white; + } + } +} + +span.symbol, a.translation, a.modernized{ + display: none; + cursor: pointer; +} +span.symbol.title, span.symbol.person, span.symbol.place{ + cursor: auto; +} + +a.comment{ + pointer-events: none; + cursor: default; +} + +.hide_unicode_icon{ + font-size: 0; + &:before{ + font-size: large; + display: inline; + font-weight: bold; + } +} +span.symbol{ + &.translation, + &.modernized, + &.info, + &.person, + &.comment, + &.place, + &.title{ + @extend .hide_unicode_icon; + } +} + + +.quote { + font-size: medium; + visibility: visible; + position: absolute; + left: 0; + color: #000; + line-height: 1; +} + +.the_whole { + display: none; +} + .btn { display: inline; } diff --git a/app/assets/stylesheets/General/_indexpages.scss b/app/assets/stylesheets/General/_indexpages.scss index edf37b02..92f09db7 100644 --- a/app/assets/stylesheets/General/_indexpages.scss +++ b/app/assets/stylesheets/General/_indexpages.scss @@ -7,7 +7,7 @@ } a { display: inline; - text-decoration: none; + //text-decoration: none; &:hover { text-decoration: underline; } diff --git a/app/assets/stylesheets/General/_landingPage.scss b/app/assets/stylesheets/General/_landingPage.scss index da0e79fd..9cf3fc2f 100644 --- a/app/assets/stylesheets/General/_landingPage.scss +++ b/app/assets/stylesheets/General/_landingPage.scss @@ -140,6 +140,20 @@ main .document { border-bottom: 1px solid #c0c0c0; } +.toolbar_container{ + display: flex; + flex-direction: row; + flex-wrap: wrap; + + .atom-e7937846-48b1-4797-9eb4-8cd4837fc421{ + display: inline-block; + margin-right: 10px; + label:before{ + margin-right: 0; + } + } +} + .textToolbar, .lpFacsContainer .downloadLinkContainer { margin-left: 10px; margin-right: 10px; @@ -222,24 +236,46 @@ main .document { position: relative; } -.pageBreak { - a > small { - visibility: visible; +//a.pagination{ +// display: inline; +//} +//.symbol.pagination.edition { +// display: inline ; +// //a > small { +// // visibility: visible; +// position: absolute; +// left: 5px; +// //} +// +// margin-left: 0; +// width: 0; +// height: 0; +// padding: 0; +// +// &:after { +// content: "\007C"; +// color: $secondary; +// } +//} +a.pagination{ + display: none; + font-family: 'nowayregular', sans-serif; + .symbol.pagination{ + display: inline; + font-size: 14px; + font-weight: normal; + } +} +.pageBreak, a.pagination { + small.edition { position: absolute; left: 5px; } - a { - visibility: hidden; - margin-left: 0; - width: 0; - height: 0; - padding: 0; - } - &:after { content: "\007C"; color: $secondary; + font-size: large; } } diff --git a/app/views/catalog/_comment.html.erb b/app/views/catalog/_comment.html.erb index d0b59ee4..8988ba08 100644 --- a/app/views/catalog/_comment.html.erb +++ b/app/views/catalog/_comment.html.erb @@ -1,5 +1,5 @@ -