Vor Kurzem aufgerufene Suchen
Keine vor kurzem aufgerufene Suchen

Agent Tools
Beigetreten 16. Apr. 2021
·
Letzte Aktivität 27. Okt. 2021
Folge ich
0
Follower
0
Gesamtaktivitäten
6
Stimmen
2
Abonnements
2
AKTIVITÄTSÜBERSICHT
BADGES
BEITRÄGE
POSTS
COMMUNITY-KOMMENTARE
BEITRAGSKOMMENTARE
AKTIVITÄTSÜBERSICHT
Neueste Aktivität von Agent Tools
Agent Tools hat einen Kommentar hinterlassen
Hey Brett,
Thanks for the reply!
Here is the current default JS script for the Copenhagen theme. I cannot locate the "$(document).ready(function(){ ." that was previously located at the top of this script for the Copenhagen theme. Keep in mind I could be making a noob mistake and missing this somewhere.
JS Script:
document.addEventListener('DOMContentLoaded', function() {
function closest (element, selector) {
if (Element.prototype.closest) {
return element.closest(selector);
}
do {
if (Element.prototype.matches && element.matches(selector)
|| Element.prototype.msMatchesSelector && element.msMatchesSelector(selector)
|| Element.prototype.webkitMatchesSelector && element.webkitMatchesSelector(selector)) {
return element;
}
element = element.parentElement || element.parentNode;
} while (element !== null && element.nodeType === 1);
return null;
}
// social share popups
Array.prototype.forEach.call(document.querySelectorAll('.share a'), function(anchor) {
anchor.addEventListener('click', function(e) {
e.preventDefault();
window.open(this.href, '', 'height = 500, width = 500');
});
});
// show form controls when the textarea receives focus or backbutton is used and value exists
var commentContainerTextarea = document.querySelector('.comment-container textarea'),
commentContainerFormControls = document.querySelector('.comment-form-controls, .comment-ccs');
if (commentContainerTextarea) {
commentContainerTextarea.addEventListener('focus', function focusCommentContainerTextarea() {
commentContainerFormControls.style.display = 'block';
commentContainerTextarea.removeEventListener('focus', focusCommentContainerTextarea);
});
if (commentContainerTextarea.value !== '') {
commentContainerFormControls.style.display = 'block';
}
}
// Expand Request comment form when Add to conversation is clicked
var showRequestCommentContainerTrigger = document.querySelector('.request-container .comment-container .comment-show-container'),
requestCommentFields = document.querySelectorAll('.request-container .comment-container .comment-fields'),
requestCommentSubmit = document.querySelector('.request-container .comment-container .request-submit-comment');
if (showRequestCommentContainerTrigger) {
showRequestCommentContainerTrigger.addEventListener('click', function() {
showRequestCommentContainerTrigger.style.display = 'none';
Array.prototype.forEach.call(requestCommentFields, function(e) { e.style.display = 'block'; });
requestCommentSubmit.style.display = 'inline-block';
if (commentContainerTextarea) {
commentContainerTextarea.focus();
}
});
}
// Mark as solved button
var requestMarkAsSolvedButton = document.querySelector('.request-container .mark-as-solved:not([data-disabled])'),
requestMarkAsSolvedCheckbox = document.querySelector('.request-container .comment-container input[type=checkbox]'),
requestCommentSubmitButton = document.querySelector('.request-container .comment-container input[type=submit]');
if (requestMarkAsSolvedButton) {
requestMarkAsSolvedButton.addEventListener('click', function () {
requestMarkAsSolvedCheckbox.setAttribute('checked', true);
requestCommentSubmitButton.disabled = true;
this.setAttribute('data-disabled', true);
// Element.closest is not supported in IE11
closest(this, 'form').submit();
});
}
// Change Mark as solved text according to whether comment is filled
var requestCommentTextarea = document.querySelector('.request-container .comment-container textarea');
if (requestCommentTextarea) {
requestCommentTextarea.addEventListener('input', function() {
if (requestCommentTextarea.value === '') {
if (requestMarkAsSolvedButton) {
requestMarkAsSolvedButton.innerText = requestMarkAsSolvedButton.getAttribute('data-solve-translation');
}
requestCommentSubmitButton.disabled = true;
} else {
if (requestMarkAsSolvedButton) {
requestMarkAsSolvedButton.innerText = requestMarkAsSolvedButton.getAttribute('data-solve-and-submit-translation');
}
requestCommentSubmitButton.disabled = false;
}
});
}
// Disable submit button if textarea is empty
if (requestCommentTextarea && requestCommentTextarea.value === '') {
requestCommentSubmitButton.disabled = true;
}
// Submit requests filter form in the request list page
Array.prototype.forEach.call(document.querySelectorAll('#request-status-select, #request-organization-select'), function(el) {
el.addEventListener('change', function(e) {
e.stopPropagation();
closest(this, 'form').submit();
});
});
function toggleNavigation(toggleElement) {
var menu = document.getElementById('user-nav');
var isExpanded = menu.getAttribute('aria-expanded') === 'true';
menu.setAttribute('aria-expanded', !isExpanded);
toggleElement.setAttribute('aria-expanded', !isExpanded);
}
var burgerMenu = document.querySelector('.header .icon-menu');
var userMenu = document.querySelector('#user-nav');
burgerMenu.addEventListener('click', function(e) {
e.stopPropagation();
toggleNavigation(this);
});
burgerMenu.addEventListener('keyup', function(e) {
if (e.keyCode === 13) { // Enter key
e.stopPropagation();
toggleNavigation(this);
}
});
userMenu.addEventListener('keyup', function(e) {
if (e.keyCode === 27) { // Escape key
e.stopPropagation();
this.setAttribute('aria-expanded', false);
burgerMenu.setAttribute('aria-expanded', false);
}
});
if (userMenu.children.length === 0) {
burgerMenu.style.display = 'none';
}
// Submit organization form in the request page
var requestOrganisationSelect = document.querySelector('#request-organization select');
if (requestOrganisationSelect) {
requestOrganisationSelect.addEventListener('change', function() {
closest(this, 'form').submit();
});
}
// Toggles expanded aria to collapsible elements
Array.prototype.forEach.call(document.querySelectorAll('.collapsible-nav, .collapsible-sidebar'), function(el) {
el.addEventListener('click', function(e) {
e.stopPropagation();
var isExpanded = this.getAttribute('aria-expanded') === 'true';
this.setAttribute('aria-expanded', !isExpanded);
});
});
// If a section has more than 6 subsections, we collapse the list, and show a trigger to display them all
const seeAllTrigger = document.querySelector("#see-all-sections-trigger");
const subsectionsList = document.querySelector(".section-list");
if (subsectionsList && subsectionsList.children.length > 6) {
seeAllTrigger.setAttribute("aria-hidden", false);
seeAllTrigger.addEventListener("click", function(e) {
subsectionsList.classList.remove("section-list--collapsed");
seeAllTrigger.parentNode.removeChild(seeAllTrigger);
});
}
});
Kommentar anzeigen · Gepostet 09. Mai 2019 · Agent Tools
0
Follower
0
Stimmen
0
Kommentare
Agent Tools hat einen Kommentar hinterlassen
I have tried this numerous times with no success. Any help would be appreciated!
There is no $(document).ready(function(){ . in the JS file anymore. Not sure if this has been removed by Zendesk and I am unsure where to insert the JS snippet.
Thanks!
Kommentar anzeigen · Gepostet 07. Mai 2019 · Agent Tools
0
Follower
0
Stimmen
0
Kommentare