////////////////////////////////////////////////////
// DESIGNPLUS CONFIG //
////////////////////////////////////////////////////
// Legacy
var DT_variables = {
iframeID: '',
// Path to the hosted USU Design Tools
path: 'https://designtools.ciditools.com/',
templateCourse: '2056552',
// OPTIONAL: Relocate Ally alternative formats dropdown and hide heading
overrideAllyHeadings: true,
// OPTIONAL: Button will be hidden from view until launched using shortcut keys
hideButton: true,
// OPTIONAL: Limit by course format
limitByFormat: false, // Change to true to limit by format
// adjust the formats as needed. Format must be set for the course and in this array for tools to load
formatArray: [
'online',
'on-campus',
'blended'
],
// OPTIONAL: Limit tools loading by users role
limitByRole: false, // set to true to limit to roles in the roleArray
// adjust roles as needed
roleArray: [
'student',
'teacher',
'admin'
],
// OPTIONAL: Limit tools to an array of Canvas user IDs
limitByUser: false, // Change to true to limit by user
// add users to array (Canvas user ID not SIS user ID)
userArray: [
'1234',
'987654'
]
};
// New
DpPrimary = {
lms: 'canvas',
templateCourse: '2398074',
hideButton: false,
extendedCourse: '', // added in sub-account theme
sharedCourse: '', // added from localStorage
courseFormats: [],
canvasRoles: [],
canvasUsers: [],
canvasCourseIds: [],
plugins: [],
excludedModules: [],
includedModules: [],
lang: 'en',
defaultToLegacy: false,
enableVersionSwitching: false,
}
// merge with extended/shared customizations config
DpConfig = { ...DpPrimary, ...(window.DpConfig ?? {}) }
$(function () {
const uriPrefix = (location.href.includes('.beta.')) ? 'beta.' : '';
const toolsUri = (DpConfig.toolsUri) ? DpConfig.toolsUri : `https://${uriPrefix}designplus.ciditools.com/`;
$.getScript(`${toolsUri}js/controller.js`);
});
////////////////////////////////////////////////////
// END DESIGNPLUS CONFIG //
////////////////////////////////////////////////////
/*EvaluationKIT START*/
var evalkit_jshosted = document.createElement('script');
evalkit_jshosted.setAttribute('defer', 'defer');
evalkit_jshosted.setAttribute('type', 'text/javascript');
evalkit_jshosted.setAttribute('src', 'https://everettcc.evaluationkit.com/canvas/js');
document.getElementsByTagName('head')[0].appendChild(evalkit_jshosted);
/*EvaluationKIT END*/
/*
@title EvCC Canvas JS Override
@version 1.03
@author William Frankhouser / John Melson
@desc Override the default JS for the login page
@log
v1.03 Added FreshChat widget code
*/
var quizRegEx = new RegExp(/quizzes\/[0-9]*/);
$(document).ready(function(){
// LOGIN Page DESKTOP
// #################################
// New login warning
// $('.ic-Login__innerContent').prepend('
' +
// '
' +
// '
New to Canvas? Use your EvCC
username' +
// ' and
password to log in. See the bottom of this page for more information.
');
// Update Footer
// Footer Links
$('.ic-Login-Body #footer #footer-links').html('' +
'eLearning at EvCC | ' +
'425-388-9027 | ' +
'eLearning Help Desk
' +
'Student Help Guide | ' +
'Privacy Policy | ' +
'Terms of Service' +
'
');
// Footer Info Box
// Update 2017-09-06 with new login information
/*
$('.ic-Login-Body #footer').append("chat loading...
");
$('.ic-Login-Body #footer').append(''+
'
Canvas Login Information
' +
'
To log in, enter your EvCC Username and Password.
' +
'
Don\'t know your username or password?
' +
'
- Visit MyEvCC and click "My Account" to look up your username
' +
'- Use the password reset page if you do not know your password.
'
);
/*
*/
$('.ic-Login-Body #footer').append(''+
'
Canvas Login Information
' +
'
To log in, enter your EvCC Username and Password.
' +
'
Don\'t know your username or password?
' +
'
- Visit MyEvCC and click "My Account" to look up your username
' +
'- Use the password reset page if you do not know your password.
' +
'
chat loading...
'
);
/*
// Removed in place of a new chat widget libraryh3lp see above chat loading...
$('.ic-Login-Body #footer').append('' +
'
' +
'
' +
'
Canvas Login Information' +
'
To log in, enter your EvCC Username and Password.
' +
'
Don\'t know your username or password?
' +
'
- Visit MyEvCC and click "My Account" to look up your username
' +
'- Use the password reset page if you do not know your password.
'
);
*/
// if( $(".error_box .error_text").text() == 'Invalid password' ){
// $(".error_box .error_text").text('Invalid PIN');
// }
// if( $("#flash_message_holder .ic-flash-error div").text() == 'Incorrect username and/or password' ){
// $("#flash_message_holder .ic-flash-error div").text('Incorrect EvCC ID and/or PIN');
// }
// if( $("#flash_message_holder .ic-flash-error div").text() == 'Incorrect username and/or password' ){
// $("#flash_message_holder .ic-flash-error div").text('Incorrect EvCC ID and/or PIN');
// }
// Login MOBILE
// ##################
if ( $("#f1_container #login_form").attr("action") == "/login" ){
$("html").css("background","#c60c0c");
}
$("#f1_container #login_form .forgotBlock").append('
Canvas Login Information
' +
'
To log in, enter your EvCC Username and Password. ' +
'If you have forgotten your password, go to the ' +
'password reset page.
');
$("#f1_container #login_form .forgotBlock > a.forgot-password").css("color", "#ffffff");
// Login Form
// $("#f1_container #login_form .ic-Input[name='pseudonym_session[unique_id]']").attr("placeholder", "EvCC ID Number");
// $("#f1_container #login_form .ic-Input[type='password']").attr("placeholder","PIN Number");
// Error Messages
// if( $("#f1_container div.error").text() == 'Invalid username or password' ){
// $("#f1_container div.error").text('Incorrect EvCC ID and/or PIN');
// }
// if( $("#f1_container div.error").text() == 'No password was given' ){
// $("#f1_container div.error").text('No PIN was given');
// }
// if( $("#f1_container #login_form .forgotBlock > a.forgot-password").text() == 'Forgot Password?' ){
// $("#f1_container #login_form .forgotBlock > a.forgot-password").text('Don\'t know your PIN?');
// }
// Profile Settings for username
// - do not allow changing of full name, only Display Name
// ##################
// Disable the user & sortable names on profile page
if (window.location.href.indexOf("courses") && (window.location.href.indexOf("details") > 0
|| window.location.href.indexOf("settings") > 0 || window.location.href.indexOf("profile") > 0)) {
var patt=/"current_user_roles"\:\[.*("admin").*\]/m; // check in Canvas INT = { } "current_user_roles":["user","student","admin"]
var b=document.body;
if(patt.test(b.innerHTML)) {
$("#user_name").prop('disabled',false);
$("#user_sortable_name").prop('disabled',false);
} else {
$("#user_name").prop('disabled',true);
$("#user_sortable_name").prop('disabled',true);
}
}
// Academic integrity statement for pilot courses Winter 2017:
// CMST& 102 - 2640 (S17)
if (ENV.context_asset_string === "course_1440671") {
// Insert academic integrity statement above submission button
// for all quizzes and assignments.
$("form#submit_quiz_form div.form-actions, div#submit_assignment table.formtable td.button-container")
.prepend('
I pledge that the work I am submitting is my own '
+ 'and follows the EvCC standards for academic integrity. I understand that if I have used '
+ 'external sources I am responsible for properly citing or crediting them.
');
}
// Academic integrity statement for quizzes -- Summer 2018
if (ENV.context_asset_string === 'course_1650626' || ENV.context_asset_string === 'course_1650627') {
if (quizRegEx.test(window.location.href)) {
// Only show statement when quiz is initially opened
if ($("#take_quiz_link").length > 0) {
// Hide quiz start button
$("#take_quiz_link").addClass("hidden");
// Add statement
$("#quiz_show .take_quiz_button").before('
By taking this quiz you acknowledge that you understand and agree to follow the academic honesty policies for this course and Everett Community College. Not doing so may result in a failing grade on this quiz or the course. Incidents of suspected academic dishonesty will be reported to the Dean of Student Development as a violation of the Student Conduct Code.
If you have questions about this statement, please contact your instructor before opening the quiz.
');
// Button handler
$("#quiz_show").on("click", "#agree_ok a.btn", function(e) {
e.preventDefault();
$("#integrity_statement").remove();
$("#take_quiz_link").removeClass("hidden");
});
}
}
}
// ALLY
window.ALLY_CFG = {
'baseUrl': 'https://prod.ally.ac',
'clientId': 26,
'lti13Id': '90000000001789'
};
$.getScript(ALLY_CFG.baseUrl + '/integration/canvas/ally.js');
// EvCC links in sidebar
checkSidebar();
});
// Set MutationObserver for EvCC sidebar links
function checkSidebar() {
var config = {childList: true, subtree: true};
var observer;
var src;
var el = document.querySelector('#right-side-wrapper > #right-side .ic-sidebar-logo');
if (el) {
addEvccLinks();
} else {
src = document.querySelector('#right-side');
observer = new MutationObserver(function(mutations) {
observer.disconnect();
addEvccLinks();
});
observer.observe(src, config);
}
}
// Adds EvCC specific links to top area of right sidebar
function addEvccLinks() {
var evccLinks = '
';
$('div.events_list.evcc_events').remove();
$("#right-side .ic-sidebar-logo").after(evccLinks);
}
// Fresh Chat Widgets // wfrankhouser
/*
// Removed in place of a new chat widget libraryh3lp
function initFreshChat() {
window.fcWidget.init({
token: "f62a4ab5-819b-4a0d-830c-34ac87e77005",
host: "https://wchat.freshchat.com"
});
}
*/
if (window.location.href.indexOf("login") > 0 ){
//New libraryh3lp char code added 8/25/2020 SK
var x = document.createElement("script"); x.type = "text/javascript"; x.async = true;
x.src = (document.location.protocol === "https:" ? "https://" : "http://") + "libraryh3lp.com/js/libraryh3lp.js?15696";
var y = document.getElementsByTagName("script")[0]; y.parentNode.insertBefore(x, y);
//Old FreshChat Code removed 8/25/2020 SK
//function initialize(i,t){var e;i.getElementById(t)?initFreshChat():((e=i.createElement("script")).id=t,e.async=!0,e.src="https://wchat.freshchat.com/js/widget.js",e.onload=initFreshChat,i.head.appendChild(e))}
//function initiateCall(){initialize(document,"freshchat-js-sdk")}
//window.addEventListener?window.addEventListener("load",initiateCall,!1):window.attachEvent("load",initiateCall,!1);
}
//H5P
(function () {
if (window.h5pCanvasResizerLoaded) {
console.error('Canvas Reszier has been included more than once.');
return;
}
window.h5pCanvasResizerLoaded = true;
/**
* @param {Window} sourceWindow
* @return {HTMLIFrameElement}
*/
function getIframeElementByWindow(sourceWindow, doc) {
doc = doc || document;
var iframes = doc.getElementsByTagName('iframe');
for (var i = 0; i < iframes.length; i++) {
if (iframes[i].contentWindow === sourceWindow) {
return iframes[i];
}
if (iframes[i].src.substr(0, 11) === 'javascript:') {
// Look inside the iframe (typically WYSIWYG)
var child = getIframeElementByWindow(sourceWindow, iframes[i].contentDocument);
if (child) {
return child;
}
}
}
}
window.addEventListener('message', function (event) {
try {
console.log('HP5 message event', typeof event.data);
var message = JSON.parse(event.data);
if (message.subject === 'lti.frameResize') {
console.log('H5P message', message);
// Get sender
var iframe = getIframeElementByWindow(event.source);
if (!iframe || iframe.id === 'tool_content') {
return; // Cannot find sender, or sender already using ToolLaunchResizer
}
// Get new height
var newHeight = message.height;
if (parseInt(newHeight) <= 0) {
// Ensure visibility
newHeight = '1px';
}
// Adapt iframe size to content height and wrapper width
iframe.style.width = '100%';
iframe.style.height = newHeight;
}
}
catch (err) {
console.log('HP5 message error', err);
}
});
})();