assets/themes/j1/core/js/template.js in j1-template-2024.1.3 vs assets/themes/j1/core/js/template.js in j1-template-2024.1.4
- old
+ new
@@ -5135,39 +5135,39 @@
scanFinished = true;
}
// Default values
//
- voiceTags['a'] = new voiceTag('Link — ', '');
+ voiceTags['a'] = new voiceTag('Link' + pause_spoken, '');
voiceTags['q'] = new voiceTag(pause_spoken, '');
voiceTags['ol'] = new voiceTag(pause_spoken, '');
voiceTags['ul'] = new voiceTag(pause_spoken, '');
voiceTags['dl'] = new voiceTag(pause_spoken, '');
voiceTags['dt'] = new voiceTag(pause_spoken, '');
- voiceTags['img'] = new voiceTag('Image element — ', 'Element not spoken — ');
- voiceTags['table'] = new voiceTag('Table element — ', 'Element not spoken — ');
+ voiceTags['img'] = new voiceTag('Image element' + pause_spoken, 'Element not spoken' + pause_spoken);
+ voiceTags['table'] = new voiceTag('Table element' + pause_spoken, 'Element not spoken' + pause_spoken);
voiceTags['card-header'] = new voiceTag(pause_spoken, '');
- voiceTags['.doc-example'] = new voiceTag('Example element — ', 'Element not spoken — ');
- voiceTags['.admonitionblock'] = new voiceTag('Attention element — ', '');
- voiceTags['.listingblock'] = new voiceTag('Text element — ', 'Element not spoken — ');
- voiceTags['.gist'] = new voiceTag('Gist element — ', 'Element not spoken — ');
- voiceTags['.slider'] = new voiceTag('Slider element — ', 'Element not spoken — ');
- voiceTags['.modal'] = new voiceTag('Info element — ', 'Element not spoken — ');
- voiceTags['.masonry'] = new voiceTag('Masonry element — ', 'Element not spoken — ');
- voiceTags['.lightbox-block'] = new voiceTag('Lightbox element — ', 'Element not spoken — ');
- voiceTags['.gallery'] = new voiceTag('Gallery element — ', 'Element not spoken — ');
- voiceTags['.audioblock'] = new voiceTag('Audio element — ', 'Element not spoken — ');
- voiceTags['.videoblock'] = new voiceTag('Video element — ', 'Element not spoken — ');
- voiceTags['.videojs-player'] = new voiceTag('Video element — ', 'Element not spoken — ');
- voiceTags['.youtube-player'] = new voiceTag('Video element — ', 'Element not spoken — ');
- voiceTags['.dailymotion-player'] = new voiceTag('Video element — ', 'Element not spoken — ');
- voiceTags['.vimeo-player'] = new voiceTag('Video element — ', 'Element not spoken — ');
- voiceTags['.wistia-player'] = new voiceTag('Video element — ', 'Element not spoken — ');
- voiceTags['figure'] = new voiceTag('Figure element — ', 'Element not spoken — ');
- voiceTags['parallax-quoteblock'] = new voiceTag(pause_spoken, '');
- voiceTags['blockquote'] = new voiceTag(pause_spoken, '');
- voiceTags['quoteblock'] = new voiceTag(pause_spoken, '');
+ voiceTags['.doc-example'] = new voiceTag('Example element' + pause_spoken, 'Element not spoken' + pause_spoken);
+ voiceTags['.admonitionblock'] = new voiceTag('Attention element' + pause_spoken, pause_spoken);
+ voiceTags['.listingblock'] = new voiceTag('Text element' + pause_spoken, 'Element not spoken' + pause_spoken);
+ voiceTags['.gist'] = new voiceTag('Gist element' + pause_spoken, 'Element not spoken' + pause_spoken);
+ voiceTags['.slider'] = new voiceTag('Slider element' + pause_spoken, 'Element not spoken' + pause_spoken);
+ voiceTags['.modal'] = new voiceTag('Info element' + pause_spoken, 'Element not spoken' + pause_spoken);
+ voiceTags['.masonry'] = new voiceTag('Masonry element' + pause_spoken, 'Element not spoken' + pause_spoken);
+ voiceTags['.lightbox-block'] = new voiceTag('Lightbox element' + pause_spoken, 'Element not spoken' + pause_spoken);
+ voiceTags['.gallery'] = new voiceTag('Gallery element' + pause_spoken, 'Element not spoken' + pause_spoken);
+ voiceTags['.audioblock'] = new voiceTag('Audio element' + pause_spoken, 'Element not spoken' + pause_spoken);
+ voiceTags['.videoblock'] = new voiceTag('Video element' + pause_spoken, 'Element not spoken' + pause_spoken);
+ voiceTags['.videojs-player'] = new voiceTag('Video element' + pause_spoken, 'Element not spoken' + pause_spoken);
+ voiceTags['.youtube-player'] = new voiceTag('Video element' + pause_spoken, 'Element not spoken' + pause_spoken);
+ voiceTags['.dailymotion-player'] = new voiceTag('Video element' + pause_spoken, 'Element not spoken' + pause_spoken);
+ voiceTags['.vimeo-player'] = new voiceTag('Video element' + pause_spoken, 'Element not spoken' + pause_spoken);
+ voiceTags['.wistia-player'] = new voiceTag('Video element' + pause_spoken, 'Element not spoken' + pause_spoken);
+ voiceTags['figure'] = new voiceTag('Figure element' + pause_spoken, 'Element not spoken' + pause_spoken);
+ voiceTags['parallax-quoteblock'] = new voiceTag('', pause_spoken);
+ voiceTags['blockquote'] = new voiceTag('', pause_spoken);
+ voiceTags['quoteblock'] = new voiceTag('', pause_spoken);
ignoreTags = ['audio', 'button', 'canvas', 'code', 'del', 'pre', 'dialog', 'embed', 'form', 'head', 'iframe', 'meter', 'nav', 'noscript', 'object', 'picture', 'script', 'select', 'style', 'textarea', 'video'];
// TODO: NOT working for multiple 'tab' windows
// dispayed in the same browser
//
@@ -5336,10 +5336,11 @@
for (var node of headingsArray) {
// cleanup the innerText for compare
//
innerText = node.innerText.replaceAll('?', '');
innerText = node.innerText.replaceAll('!', '');
+ innerText = node.innerText + pause_spoken;
if (innerText == text) {
var headline = $('#' + node.id);
if (headline.length > 0) {
var offsetTop = headline.offset().top;
chunk.offsetTop = Math.round(offsetTop);
@@ -5575,17 +5576,20 @@
// Search for <h1> through <h6> and <li> and <br> to add
// a pause at the end of those tags. This is done
// because these tags require a pause, but often don't
// have a comma or period at the end of their text.
//
- $(clone).find('h1,h2,h3,h4,h5,h6,li,p').addBack('h1,h2,h3,h4,h5,h6,li,p').each(function () {
- $(this).append(pause_spoken);
+ $(clone).find('h1,h2,h3,h4,h5,h6,p,li').addBack('h1,h2,h3,h4,h5,h6,p,li').each(function () {
+ var text = $(this)[0].innerText;
+ text.replace(/\s+/g, '\s');
+ text = text + pause_spoken;
+ $(this)[0].innerText = text;
});
// Search for <br> tags to add a pause at the end.
$(clone).find('br').each(function () {
- $(this).after(pause_spoken);
+ $(this).append(pause_spoken);
});
// Search for <figure>, check for <figcaption>, insert
// that text if exists and then remove the whole DOM object.
//
@@ -5657,11 +5661,11 @@
// Search for parallax quote block elements.
//
$(clone).find('.parallax-quoteblock').addBack('.parallax-quoteblock').each(function () {
content_element = $(this).find('.quote-text');
- content = content_element[0].innerText + ' — ';
+ content = content_element[0].innerText + '' + pause_spoken;
prepend = voiceTags['quoteblock'].prepend;
appended = voiceTags['quoteblock'].append;
if (content !== undefined && content != '') {
$('<div>' + prepend + pause_spoken + content + '</div>').insertBefore(this);
$('<div>' + appended + pause_spoken + '</div>').insertBefore(this);
@@ -5672,11 +5676,11 @@
// Search for quote block elements.
//
$(clone).find('.quoteblock').addBack('.quoteblock').each(function () {
var attribution = $(this).find('.attribution');
content_element = $(this).find('blockquote');
- content = content_element[0].innerText + ' — ' + attribution[0].innerText + ' — ';
+ content = content_element[0].innerText + '' + attribution[0].innerText;
prepend = voiceTags['quoteblock'].prepend;
appended = voiceTags['quoteblock'].append;
if (content !== undefined && content != '') {
$('<div>' + prepend + pause_spoken + content + '</div>').insertBefore(this);
$('<div>' + appended + pause_spoken + '</div>').insertBefore(this);
@@ -5707,15 +5711,15 @@
$(clone).find('.audioblock').addBack('.audioblock').each(function () {
copy = $(this).find('.title').text();
prepend = voiceTags['.audioblock'].prepend;
appended = voiceTags['.audioblock'].append;
if (copy !== undefined && copy != '') {
- $('<div>' + prepend + pause_spoken + 'with the title, ' + copy + pause_spoken + '</div>').insertBefore(this);
- $('<div>' + appended + pause_spoken + '</div>').insertBefore(this);
+ $('<div>' + prepend + 'with the title, ' + copy + pause_spoken + '</div>').insertBefore(this);
+ $('<div>' + appended + '</div>').insertBefore(this);
} else {
- $('<div>' + prepend + pause_spoken + '</div>').insertBefore(this);
- $('<div>' + appended + pause_spoken + '</div>').insertBefore(this);
+ $('<div>' + prepend + '</div>').insertBefore(this);
+ $('<div>' + appended + '</div>').insertBefore(this);
}
$(this).remove();
});
// Search for HTML5 video players, check for the title and insert text
@@ -5724,15 +5728,15 @@
$(clone).find('.videoblock').addBack('.videoblock').each(function () {
copy = $(this).find('.title').text();
prepend = voiceTags['.videoblock'].prepend;
appended = voiceTags['.videoblock'].append;
if (copy !== undefined && copy != '') {
- $('<div>' + prepend + pause_spoken + 'with the title, ' + copy + pause_spoken + '</div>').insertBefore(this);
- $('<div>' + appended + pause_spoken + '</div>').insertBefore(this);
+ $('<div>' + prepend + 'with the title, ' + copy + pause_spoken + '</div>').insertBefore(this);
+ $('<div>' + appended + '</div>').insertBefore(this);
} else {
- $('<div>' + prepend + pause_spoken + '</div>').insertBefore(this);
- $('<div>' + appended + pause_spoken + '</div>').insertBefore(this);
+ $('<div>' + prepend + '</div>').insertBefore(this);
+ $('<div>' + appended + '</div>').insertBefore(this);
}
$(this).remove();
});
// Search for VideoJS players, check for the title and insert text
@@ -5741,15 +5745,15 @@
$(clone).find('.videojs-player').addBack('.videojs-player').each(function () {
copy = $(this).find('.video-title').text();
prepend = voiceTags['.videojs-player'].prepend;
appended = voiceTags['.videojs-player'].append;
if (copy !== undefined && copy != '') {
- $('<div>' + prepend + pause_spoken + 'with the title, ' + copy + pause_spoken + '</div>').insertBefore(this);
- $('<div>' + appended + pause_spoken + '</div>').insertBefore(this);
+ $('<div>' + prepend + 'with the title, ' + copy + pause_spoken + '</div>').insertBefore(this);
+ $('<div>' + appended + '</div>').insertBefore(this);
} else {
- $('<div>' + prepend + pause_spoken + '</div>').insertBefore(this);
- $('<div>' + appended + pause_spoken + '</div>').insertBefore(this);
+ $('<div>' + prepend + '</div>').insertBefore(this);
+ $('<div>' + appended + '</div>').insertBefore(this);
}
$(this).remove();
});
// Search for YouTube players, check for the title and insert text
@@ -5758,15 +5762,15 @@
$(clone).find('.youtube-player').addBack('.youtube-player').each(function () {
copy = $(this).find('.video-title').text();
prepend = voiceTags['.youtube-player'].prepend;
appended = voiceTags['.youtube-player'].append;
if (copy !== undefined && copy != '') {
- $('<div>' + prepend + pause_spoken + 'with the title, ' + copy + pause_spoken + '</div>').insertBefore(this);
- $('<div>' + appended + pause_spoken + '</div>').insertBefore(this);
+ $('<div>' + prepend + 'with the title, ' + copy + pause_spoken + '</div>').insertBefore(this);
+ $('<div>' + appended + '</div>').insertBefore(this);
} else {
- $('<div>' + prepend + pause_spoken + '</div>').insertBefore(this);
- $('<div>' + appended + pause_spoken + '</div>').insertBefore(this);
+ $('<div>' + prepend + '</div>').insertBefore(this);
+ $('<div>' + appended + '</div>').insertBefore(this);
}
$(this).remove();
});
// Search for Dailymotion players, check for the title and insert text
@@ -5775,15 +5779,15 @@
$(clone).find('.dailymotion-player').addBack('.dailymotion-player').each(function () {
copy = $(this).find('.video-title').text();
prepend = voiceTags['.dailymotion-player'].prepend;
appended = voiceTags['.dailymotion-player'].append;
if (copy !== undefined && copy != '') {
- $('<div>' + prepend + pause_spoken + 'with the title, ' + copy + pause_spoken + '</div>').insertBefore(this);
- $('<div>' + appended + pause_spoken + '</div>').insertBefore(this);
+ $('<div>' + prepend + 'with the title, ' + copy + pause_spoken + '</div>').insertBefore(this);
+ $('<div>' + appended + '</div>').insertBefore(this);
} else {
- $('<div>' + prepend + pause_spoken + '</div>').insertBefore(this);
- $('<div>' + appended + pause_spoken + '</div>').insertBefore(this);
+ $('<div>' + prepend + '</div>').insertBefore(this);
+ $('<div>' + appended + '</div>').insertBefore(this);
}
$(this).remove();
});
// Search for Vimeo players, check for the title and insert text
@@ -5792,15 +5796,15 @@
$(clone).find('.vimeo-player').addBack('.vimeo-player').each(function () {
copy = $(this).find('.video-title').text();
prepend = voiceTags['.vimeo-player'].prepend;
appended = voiceTags['.vimeo-player'].append;
if (copy !== undefined && copy != '') {
- $('<div>' + prepend + pause_spoken + 'with the title, ' + copy + pause_spoken + '</div>').insertBefore(this);
- $('<div>' + appended + pause_spoken + '</div>').insertBefore(this);
+ $('<div>' + prepend + 'with the title, ' + copy + pause_spoken + '</div>').insertBefore(this);
+ $('<div>' + appended + '</div>').insertBefore(this);
} else {
- $('<div>' + prepend + pause_spoken + '</div>').insertBefore(this);
- $('<div>' + appended + pause_spoken + '</div>').insertBefore(this);
+ $('<div>' + prepend + '</div>').insertBefore(this);
+ $('<div>' + appended + '</div>').insertBefore(this);
}
$(this).remove();
});
// Search for Wistia players, check for the title and insert text
@@ -5809,14 +5813,14 @@
$(clone).find('.wistia-player').addBack('.wistia-player').each(function () {
copy = $(this).find('.video-title').text();
prepend = voiceTags['.wistia-player'].prepend;
appended = voiceTags['.wistia-player'].append;
if (copy !== undefined && copy != '') {
- $('<div>' + prepend + pause_spoken + 'with the title, ' + copy + pause_spoken + '</div>').insertBefore(this);
- $('<div>' + appended + pause_spoken + '</div>').insertBefore(this);
+ $('<div>' + prepend + 'with the title, ' + copy + pause_spoken + '</div>').insertBefore(this);
+ $('<div>' + appended + '</div>').insertBefore(this);
} else {
- $('<div>' + prepend + pause_spoken + '</div>').insertBefore(this);
- $('<div>' + appended + pause_spoken + '</div>').insertBefore(this);
+ $('<div>' + prepend + '</div>').insertBefore(this);
+ $('<div>' + appended + '</div>').insertBefore(this);
}
$(this).remove();
});
// Search for cards|header elements and then remove the DOM object.
\ No newline at end of file