{{ embed_script(assett('html5shiv::/dist/html5shiv.js'), null, null, 'ie') }}
{{ embed_script(assett('respond::/dest/respond.js'), null, null, 'ie') }}
{{ embed_script(assett('sugar::/release/sugar.min.js'), null, null, 'head') }}
{{ embed_script(assett('headjs::/dist/1.0.0/head.min.js'), null, null, 'head') }}
{{ embed_script(assett('jquery2::/dist/jquery.min.js'), null, null, 'head') }}
{{ embed_script(assett('jquery-migrate::/dist/jquery-migrate.min.js'), null, null, 'head') }}
{{ embed_script(assett('jquery-ui::/jquery-ui.min.js'), null, null, 'head') }}
{{ embed_script(assett('bootstrap::/dist/js/bootstrap.min.js'), null, null, 'head') }}
{{ embed_script(assett('jquery-cookie', 'jquery.cookie.min.js'), null, null, 'bottom') }}
{{ embed_script(assett('breakpoints::/breakpoints.js'), null, null, 'bottom') }}
{{ embed_script(assett('jquery-scrollbar::/jquery.scrollbar.min.js'), null, null, 'bottom') }}
{{ embed_script(assett('jquery-slimscroll::/jquery.slimscroll.min.js'), null, null, 'bottom') }}
{{ embed_script(assett('bootstrap-colorpicker::/dist/js/bootstrap-colorpicker.min.js'), null, null, 'bottom') }}
{{ embed_script(assett('moment::/min/moment.min.js'), null, null, 'bottom') }}
{{ embed_script(assett('bootstrap-slider::/dist/bootstrap-slider.min.js'), null, null, 'bottom') }}
{{ embed_script(assett('chosen::/chosen.jquery.min.js'), null, null, 'bottom') }}
{{ embed_script(assett('jquery-maskedinput::/dist/jquery.maskedinput.min.js'), null, null, 'bottom') }}
{{ embed_script(assett('jquery-tageditor::/jquery.tag-editor.min.js'), null, null, 'bottom') }}
{{ embed_script(assett('mixitup::/build/jquery.mixitup.min.js'), null, null, 'bottom') }}
{{ embed_script(assett('knockout::/dist/knockout.js'), null, null, 'bottom') }}
{{ embed_script(assett('chart-js::/dist/chart.min.js'), null, null, 'bottom') }}
{{ embed_script(assett('palette-js::/palette.js'), null, null, 'bottom') }}
{{ embed_script(assett('jquery-boilerplate::/dist/jquery.boilerplate.min.js'), null, null, 'bottom') }}
{{ embed_script(assett('ace::/src-min-noconflict/ace.js'), null, null, 'bottom') }}
{{ embed_script(assett('js-yaml::/dist/js-yaml.min.js'), null, null, 'bottom') }}
{{ embed_script(assett('jquery-infinitescroll::/dist/infinite-scroll.pkgd.min.js'), null, null, 'bottom') }}
{{ embed_script(assett('ckeditor::/ckeditor.js'), null, null, 'bottom') }}
{{ embed_script(assett('uri-js::/src/URI.min.js'), null, null, 'bottom') }}
{{ embed_script('/bundles/cmscore/plugins/modal.js', null, null, 'bottom') }}
{{ embed_script(assett('match-height::/dist/jquery.matchHeight-min.js'), null, null, 'bottom') }}
{{ embed_script(assett('clipboardjs::/dist/clipboard.js'), null, null, 'bottom') }}
{{ embed_script(assett('anchorme::/dist-browser/anchorme.min.js'), null, null, 'bottom') }}
{{ embed_script('/bundles/cmscore/searches.js', null, null, 'bottom') }}
{{ embed_script('/bundles/cmscore/dashboard/bulk.js', null, null, 'bottom') }}
{# HACK: cropper #}
{{ embed_script(assett('cropper::/dist/cropper.min.js')) }}
{{ embed_style(assett('cropper::/dist/cropper.min.css')) }}
{{ embed_script('/bundles/cmsfile/cropper.js', null, null, 'bottom') }}
{# HACK: toastr #}
{{ embed_script(assett('toastr::/toastr.min.js'), null, null, 'bottom') }}
{{ embed_style(assett('toastr::/toastr.min.css')) }}
{% inline_script %}
<script>
(function (window, document, $, undefined) {
$(function () {
toastr.options = {
closeButton: false,
debug: false,
newestOnTop: true,
progressBar: false,
positionClass: 'toast-top-right',
preventDuplicates: false,
onclick: null,
showDuration: '250',
hideDuration: '250',
timeOut: '1500',
extendedTimeOut: '500',
showEasing: 'swing',
hideEasing: 'linear',
showMethod: 'fadeIn',
hideMethod: 'fadeOut'
};
});
})(window, document, jQuery);
</script>
{% endinline %}
{# pulled from page editor stuff #}
{% inline_script %}
<script>
function htmlEscape(str) {
return String(str)
.replace(/&/g, '&')
.replace(/"/g, '"')
.replace(/'/g, ''')
.replace(/</g, '<')
.replace(/>/g, '>');
}
$.fn.serializeObject = function() {
var o = {}, a = this.serializeArray();
$.each(a, function() {
if (o[this.name] !== undefined) {
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}
o[this.name].push(this.value || '');
} else {
o[this.name] = this.value || '';
}
});
return o;
};
</script>
{% endinline %}
{% inline_script %}
<script>
(function (window, document, $, undefined) {
// hide modal content when hidden
$('body').on('hidden.bs.modal', '[data-campussuite-modal-autoempty]', function (e) {
var $target = $(e.target),
$content = $target.find('div.modal-content').first();
$content.empty();
});
// image loader plugin
window.csimgloader = function(elem, count) {
// init count
if (count === undefined) {
count = 1;
}
// should be an img element
var $elem = $(elem);
// grab the src of the image
var src = $elem.attr('src');
// set new html for loading purposes
var $parent = $elem.parent();
$parent.html('<img alt="" src="/bundles/cmscore/loading.gif" />');
// set a callback that runs in a few seconds to try and reload the image
setTimeout((function(parent, src, count) {
return function() {
if (count > 12) {
return;
}
count++;
var $parent = $(parent);
if ($.contains(document.documentElement, $parent[0])) {
$parent.html('<img alt="" src="' + src + '" onerror="(function(elem){jQuery(function() {window.csimgloader(elem, ' + count + ');});})(this);" />');
}
};
})($parent[0], src, count), 5000);
}
})(window, document, jQuery);
</script>
{% endinline %}
{% inline_script %}
<script>
CKEDITOR.dtd.$removeEmpty['em'] = false;
CKEDITOR.on('dialogDefinition', function(e) {
var dialog = e.data;
var dialogName = dialog.name;
var dialogDefinition = dialog.definition;
if (dialogName === 'link') {
var infoTab = dialogDefinition.getContents('info');
var urlOptions = infoTab.get('urlOptions');
urlOptions.children.push({
type: 'button',
id: 'browseSite',
label: 'Browse Files',
title: 'Browse Files',
onClick: function() {
var urlField = this.getDialog().getContentElement('info', 'url'),
cs = window.top.CAMPUSSUITE;
CampussuiteModals.open({
url: '/_dashboard/files/modal',
params: {
mode: (typeof CKEDITOR_MODAL_OVERRIDE !== 'undefined') ? CKEDITOR_MODAL_OVERRIDE : 'url',
container: cs.container,
value: urlField.getValue()
},
callback: function(selection) {
urlField.setValue(selection);
},
styles: 'modal-dialog--media'
});
}
});
urlOptions.children.push({
type: 'button',
id: 'browseContent',
label: 'Browse Content',
title: 'Browse Content',
onClick: function() {
var urlField = this.getDialog().getContentElement('info', 'url'),
cs = window.top.CAMPUSSUITE;
CampussuiteModals.open({
url: '/_dashboard/modules/modal',
params: {
containerId: cs.container
},
callback: function(selection) {
urlField.setValue(selection);
},
styles: 'modal-dialog--media'
});
}
});
}
if (dialogName === 'image') {
var tb = dialogDefinition.getContents('info');
var thing = tb.elements[0].children[0];
thing.children.push({
type: 'button',
id: 'browseSite',
label: 'Browse Files',
title: 'Browse Files',
onClick: function() {
var urlField = this.getDialog().getContentElement('info', 'txtUrl'),
cs = window.top.CAMPUSSUITE;
CampussuiteModals.open({
url: '/_dashboard/files/modal',
params: {
mode: (typeof CKEDITOR_MODAL_OVERRIDE !== 'undefined') ? CKEDITOR_MODAL_OVERRIDE : 'url',
container: cs.container,
value: urlField.getValue()
},
callback: function(selection) {
urlField.setValue(selection);
},
styles: 'modal-dialog--media'
});
}
});
}
});
</script>
{% endinline %}
{{ embed_script('/bundles/cmscore/AjaxSelect.js', null, null, 'bottom') }}
<script type="text/javascript">
window.CAMPUSSUITE = {
environment: '{{ cms.environment }}',
tenant: {
id: {{ cms.tenant.id }},
uid: '{{ cms.tenant.uid.toString() }}',
slug: '{{ cms.tenant.slug }}'
},
container: {{ (cms.department is not empty) ? cms.department.id : 'null' }}
};
</script>
{% inline_script %}
<script>
// Break point entry
$(function() {
var $window = $(window),
$console = $('#cs-console');
$window
.bind('enterBreakpoint321', function () {
if ($console.hasClass('sb-disable-autoload')) {
return;
}
$console
.removeClass('cs-console-md')
.removeClass('cs-console-lg sb-expand')
.addClass('cs-console-sm sb-collapse');
})
.bind('enterBreakpoint481', function () {
if ($console.hasClass('sb-disable-autoload')) {
return;
}
$console
.removeClass('cs-console-md')
.removeClass('cs-console-lg sb-expand')
.addClass('cs-console-sm sb-collapse');
})
.bind('enterBreakpoint821', function () {
if ($console.hasClass('sb-disable-autoload')) {
return;
}
$console
.removeClass('cs-console-sm')
.removeClass('cs-console-lg sb-expand')
.addClass('cs-console-md sb-collapse');
})
.bind('enterBreakpoint1065', function () {
if ($console.hasClass('sb-disable-autoload')) {
return;
}
$console
.removeClass('cs-console-sm sb-collapse')
.removeClass('cs-console-md sb-collapse')
.addClass('cs-console-lg sb-expand');
});
$window.setBreakpoints({
distinct: true,
breakpoints: [
// needing to set breakpoints at one pixel above where they should
// this better matches current css media queries
// these events need triggered once the viewport extends beyond the designated "real" sizes, hence the extra pixel
321,// 320
481,// 480
821,// 820
1065// 1064
]
});
});
// Console Sidebar Toggle
$(function() {
var $toggle = $('.cs-console-sb-toggle'),
$console = $('#cs-console');
$toggle.click(function () {
if ($console.hasClass('sb-collapse')) {
$console
.removeClass('sb-collapse')
.addClass('sb-expand');
} else {
$console
.removeClass('sb-expand')
.addClass('sb-collapse');
}
});
});
// Console Sidebar Hover
$(function() {
var $sidebar = $('#cs-console-sidebar'),
$console = $('#cs-console');
$sidebar.hover(
function () {
//if ( ! $console.hasClass('cs-console-sm')) {
if ($console.hasClass('cs-console-md')) {
$console
.addClass('sb-expand')
.removeClass('sb-collapse');
}
},
function () {
if ($console.hasClass('cs-console-md')) {
$console
.addClass('sb-collapse')
.removeClass('sb-expand');
}
}
);
});
// Console Sidebar Nav Toggle
$(function() {
$('ul.editor__side-nav').on('click', 'a', function(e) {
var $link = $(e.currentTarget),
$topmenu = $link.closest('ul'),
$topitem = $link.closest('li');
// remove the active state from all current items
// skip the currently selected item to prevent odd behavior
$topmenu
.find('li')
.not($topitem)
.removeClass('active');
// activate the current items
$topitem.addClass('active');
});
$('ul.cs-console-sb-menu').on('click', 'a', function(e) {
var $link = $(e.currentTarget),
$topmenu = $link.closest('ul'),
$submenu = null,
$topitem = null,
$subitem = null;
// fix the menus
if ($topmenu.hasClass('cs-sub-menu')) {
$submenu = $topmenu;
$topmenu = $submenu.closest('ul');
}
// if there is a submenu above, then there are two items to consider
if ($submenu !== null) {
$subitem = $link.closest('li');
$topitem = $subitem.closest('li');
} else {
$topitem = $link.closest('li');
}
// now, there might be a submenu related that we need to show
// if nothing returns, clear out the variable
$submenu = $topitem.children('ul.cs-sub-menu');
if ($submenu.length === 0) {
$submenu = null;
}
// remove the active state from all current items
// skip the currently selected item to prevent odd behavior
$topmenu
.find('li')
.not($topitem)
.not($subitem)
.removeClass('active');
// slide up all open submenus
// skip the currently selected item to prevent odd behavior
$topmenu
.find('ul.cs-sub-menu')
.not($submenu)
.slideUp(200);
// activate the current items
$topitem.addClass('active');
if ($subitem !== null) {
$subitem.addClass('active');
}
// if we have a submenu, open it
// items with submenus should not have other actions, prevent default then
if ($submenu !== null) {
$submenu.slideDown(200);
e.preventDefault();
}
});
});
// Console Sidebar Slimscroll
$(function() {
var resizeListener;
var pause = 500;
$('.sb-scroll').slimScroll({
height: 'auto',
size: '10px'
});
$(window).resize(function(){
clearTimeout(resizeListener);
resizeListener = setTimeout(
function() {
$('.sb-scroll').slimScroll({
height: 'auto'
});
},
pause
);
});
});
</script>
{% endinline %}
{% inline_script %}
<script>
$('[data-topbar="popover-bottom"]').popover({
html: true,
placement: 'bottom',
sanitize: false,
content: function () {
return $(this).siblings('.dropdown-content').html();
}
});
// Close popovers
$('body').on('click', function (e) {
$('[data-topbar="popover-bottom"]').each(function () {
if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) {
$(this).popover('hide');
}
});
});
// tooltips: https://getbootstrap.com/docs/3.3/javascript/#tooltips-examples
$(function () {
const elements = $('[data-toggle="tooltip"]');
for (let i=0; i < elements.length; i++) {
const element = $(elements[i]);
const isTriggeredByClick = ('click' === element.data('trigger'));
element.tooltip({
container: 'body',
placement: element.data('placement') ?? 'right',
trigger: isTriggeredByClick ? 'manual' : 'hover',
html: true,
template: '<div class="tooltip tooltip-custom" role="tooltip"><div class="tooltip-arrow tooltip-arrow-custom"></div><div class="tooltip-inner tooltip-inner-custom"></div></div>',
});
if (isTriggeredByClick) {
element.on('click', function (event) {
event.preventDefault();
event.stopPropagation();
$(this).tooltip('show');
});
}
element.on('show.bs.tooltip', function () {
const displayedTitle = $(this).data('originalTitle');
const tooltipElements = $('[data-toggle="tooltip"]');
for (let i=0; i < tooltipElements.length; i++) {
if (displayedTitle !== $(tooltipElements[i]).data('originalTitle')) {
$(tooltipElements[i]).tooltip('hide');
}
}
});
}
$('body').on('click', function () {
$('[data-toggle="tooltip"]').tooltip('hide');
});
});
</script>
{% endinline %}
{% include '@ui/dashboards/default/scripts/google-analytics.html.twig' %}
{% include '@ui/dashboards/default/scripts/zendesk.html.twig' %}
{% include '@ui/dashboards/default/scripts/churnzero.html.twig' %}