//var strCheckoutMarkup = ''; var intTimeoutLength = 2000; var objQueryOpts = $.deparam.querystring(); var fragment = $.param.fragment(); var arrFragment = fragment.split("/"); $(document).ready(function() { if(isset(objQueryOpts.fuseaction)) { switch(objQueryOpts.fuseaction) { case "ede2.coursesupcoming": case "ede2.coursessubscribed": if(isset(objQueryOpts.entry) && is_numeric(objQueryOpts.entry)) { $("#entry-"+objQueryOpts.entry).addClass("cur"); $("#entry-"+objQueryOpts.entry).find(".dets").show(); } break; case "profile.form": if( isset(objQueryOpts.colval) && ( // pre-course quiz objQueryOpts.colval==5 // post reflective activity || objQueryOpts.colval==4 ) ) { // hide the second page title because there is only one page! $("#idPageTitle").hide(); } break; case "ede2.publichome": if(fragment == "idUpcoming") { //!MJ to do some work here $("body").addClass("courses-accentuated"); $("body").prepend($('
')); /* We need this to target and specify a higher z-index value than the .bg-overlay giving the contents focus aside from all else on page. */ $(".calendar").wrapInner('
'); var bgOverlay = $('
'); // div to serve as bg overlay. $(".calendar").prepend(bgOverlay); // append to .calendar div $("#idUpcoming").prependTo($(".calendar .contents")); // we need these vals for the width and height of bg-overlay el. var docH = $(document).innerHeight(); var winW = $(window).width(); // offset the bg overlay relative to calendar x y coords. var calCoords = $(".calendar").offset(); bgOverlay.css({ "width" : winW, "height" : docH, "top" : "-"+Math.round(calCoords.top)+"px", "left" : "-"+Math.round(calCoords.left)+"px" }); // the flickr effect. bgOverlay.delay(1000).fadeOut(1500, function() { // location.hash = "#top-pg"; $("body").removeClass("courses-accentuated"); }); } break; case "shopping.summarize": break; } switch(objQueryOpts.fuseaction) { case "public.create-html5": case "profile.myprofile": case "profile.form": //case "contact.form": //! does MJ needs this for every page or just create account on the public side? fnHackCreateAccountForm(); break; } } // GLOBAL VARIABLES // ########################################## var content_container = $("#main .content"); var orig_content_html = content_container.html(); $("#questions").addClass("js-true"); // assign on page load, user has javascript. // ########################################## //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* Display visibility (hide/show) for different tables found in "schedule" section of course overview page. */ // ############## // $("#schedule nav a").click(function() { $(this).parent().siblings().removeClass("cur").end().addClass("cur"); if ($(this).parent().is(":first-child")) { $(".day2").fadeOut(function() { $(".day1").fadeIn(); }); } else if ($(this).parent().is(":last-child")) { $(".day1").fadeOut(function() { $(".day2").fadeIn(); }); } }); $("input.error").live("blur",function(){ $(this).removeClass("error"); }); $("#idOnlineTrainingLanguageSelection").live("click", function(e){ e.preventDefault(); console.log('not going to this link because we need to confirm language first.'); var urlToMoveOn = $(this).attr("href"); html5popupalert( "

Select the language you want to do your EDE2 online training in.

" +"

Note, once you select a language, all your online training will be in this language.

" , { label: "English", func: function() { reConfirmOnlineTrainingLanguage(1, urlToMoveOn); }} , { label: "French", func: function() { reConfirmOnlineTrainingLanguage(2, urlToMoveOn); }} ) }); function reConfirmOnlineTrainingLanguage(language, urlToMoveOn) { var selectedLanguage = language == 1 ? "ENGLISH" : "FRENCH"; html5popupalert( "

You have selected to do ALL your online training in " + selectedLanguage + ".

" +"

Is this correct?

" , { label: "Yes", func: function() { confirmOnlineTrainingLanguage(language, urlToMoveOn); }} , { label: "No", func: function() { return true; }} ); } function confirmOnlineTrainingLanguage(language, urlToMoveOn) { $.ajax({ url: "https://ede2course.com/index.php?fuseaction=calendar.ajax&mode=select_online_training_language" , data: { language: language } }) .done(function(res){ console.log(res); try { objRes = $.parseJSON(res); } catch(e) { html5popupalert2("

Sorry, there was an issue saving your language, please try again.

"); } if(objRes.result=="1") { urlToMoveOn = urlToMoveOn + "&language="+language; window.location.href = urlToMoveOn; } else { html5popupalert2("

"+objRes.message+"

"); } }); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // ACCORDION(S) // ############## // //$("body.public .calendar .entry, .calendar .entry").live("click",function() { // clicking a header $("body.public .calendar .entry header, .calendar .entry header").click(function() { // don't do anything for past courses if(objQueryOpts.fuseaction=="ede2.pastcourses") return false; // var thisEntry = $(this).parent(); //console.log("click 1"); if (thisEntry.find(".dets").is(":visible")) { // if details visible, proceed. //console.log("click 2"); thisEntry.find(".dets").slideUp(function() { //console.log("click 3"); // wait until description slides back up before remove class. (smoother transition) thisEntry.removeClass("cur"); thisEntry.find(".popup-alert").slideUp(); }); } else if (thisEntry.find(".dets").not(":visible")) { // if details not visible - proceed. thisEntry.siblings().find(".popup-alert").slideUp(); thisEntry.siblings().removeClass("cur").find(".dets").slideUp(); thisEntry.addClass("cur"); thisEntry.find(".dets").slideDown(); } }); // clicking a register button - priv $("body.public .calendar .entry a.register").click(function() { if($(this).parent().find(".popup-alert").is(":visible")) { $(this).parent().find(".popup-alert").slideUp(); } else { $(this).parent().find(".popup-alert").slideDown(); } }); $("body.private .calendar .entry a.register").click(function() { var href = $(this).attr("href"); var tmp = href.split("/"); var id = tmp[3]; var attendance_type = tmp[4]; var popup_alert = $(this).parent().find(".popup-alert.profile-update"); var popup_alert_book = $(this).parent().find(".popup-alert.dialog-book"); $.post( "/includes/__EDE2Class/ajax/ajaxPriv.php?mode="+"checkProfile" ,{} , function(res) { var obj = $.parseJSON(res); if(obj.res==0) { popup_alert.slideDown(); } else { popup_alert_book.slideDown(); } } ); return; }); $("body.private .calendar .entry a.reg-with-book").click(function() { var bookLanguage = 1; if($(this).hasClass("book-en")) { bookLanguage = 1; } else { bookLanguage = 2; } var href = $(this).attr("href"); var tmp = href.split("/"); var id = tmp[3]; var attendance_type = tmp[4]; var options = { href: href , id: id , attendance_type: attendance_type , with_book: true , book_language: bookLanguage }; fnRegisterToCourse(options); }); $("body.private .calendar .entry a.reg-course-only").click(function() { var href = $(this).attr("href"); var tmp = href.split("/"); var id = tmp[3]; var attendance_type = tmp[4]; var options = { href: href , id: id , attendance_type: attendance_type , with_book: false }; fnRegisterToCourse(options); }); function fnRegisterToCourse(options) { $.post( "/includes/__EDE2Class/ajax/ajaxPriv.php?mode="+"registerToCourse" , { id: options.id , redir_location: "https://ede2course.com/index.php?fuseaction=ede2.coursesupcoming"+options.href , attendance_type: options.attendance_type , with_book: options.with_book || false , book_language: options.book_language } , function(res) { var obj = $.parseJSON(res); if(obj.res==1) { // window.location.href=obj.redir; // } else if(obj.res==-1) { // popup_alert.slideDown(); } else if(obj.res==-2) { // alert("An error occurred with your transaction, please try again."); } } ); } $("body.private .calendar .entry a.waitlist").click(function() { var href = $(this).attr("href"); var tmp = href.split("/"); var id = tmp[3]; var attendance_type = tmp[4]; var popup_alert = $(this).parent().find(".popup-alert"); //console.log(tmp); $.post( "/includes/__EDE2Class/ajax/ajaxPriv.php?mode="+"registerToCourse" , { id: id, redir_location: "https://ede2course.com/index.php?fuseaction=ede2.coursesupcoming"+href, attendance_type: attendance_type } , function(res) { var obj = $.parseJSON(res); //console.log(obj); if(obj.res==1) { // window.location.href=obj.redir; } else if(obj.res==-1) { popup_alert.slideDown(); } else if(obj.res==-2) { // alert("An error occurred with your transaction, please try again."); } } ); }); $(".register-step2").click(function(){ var href = $(this).attr("href"); var tmp = href.split("/"); var id = tmp[2]; var strPostLoginMode; if(tmp[1]=="register-sign-in") { strPostLoginMode = "registerCourseAfterSignIn"; } else { strPostLoginMode = "registerCourseAfterReg"; } $.post( "/includes/__EDE2Class/ajax/ajaxPublic.php?mode="+strPostLoginMode , { id: id } , function(res) { switch(strPostLoginMode) { case "registerCourseAfterSignIn": to = setTimeout(function() { window.location.href="/index.php?fuseaction=public.login"; }, intTimeoutLength); break; case "registerCourseAfterReg": to = setTimeout(function() { window.location.href="/index.php?fuseaction=public.create-html5"; }, intTimeoutLength); break; } } ); }); $("#questions h5").live("click",function() { if ($(this).siblings(".answer").is(":visible")) { // if answer visible, proceed. $(this).siblings(".answer").slideUp(function() { $(this).parent().removeClass("open"); }); } else if ($(this).siblings(".answer").not(":visible")) { // if answer not visible - proceed. $(this).parent().siblings().removeClass("open").find(".answer").slideUp(); $(this).parent().addClass("open"); $(this).siblings(".answer").slideDown(); } }); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* Public : Gallery */ // ############## // $("body.public .thumbnails a").click(function() { var newSrc = $(this).attr("href"); $(".gallery img:first").attr("src", newSrc); return false; }); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* Check height of window object and assign a "min-height" value to "#main" div. */ // ############## // var window_height = $(window).height(); $("section#main").css("min-height", window_height); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // LANGUAGE SELECTOR /* Upon "click" event, toggle the display of different languages. */ // ############## // $(".lang-sel .cur").click(function() { $(this).siblings("ul").fadeToggle(); }); // ====================================================== // /* When li element is selected (clicked) we replace the span (".cur") with the li value; we then re-append the element. The element being the markup required to output our arrow icon. */ $(".lang-sel li").click(function() { var cur_lang = $(this).parent().siblings(".cur"); var new_lang = $(this).text(); cur_lang.html(new_lang+""); $(this).parent().fadeOut(); }); // ====================================================== // /* If anything excluding ".lang-sel" or it's adjacent children are clicked, close menu. (presumably but typically the user intent) */ $(document).click(function() { $(".lang-sel ul").fadeOut(); }); $(".lang-sel").click(function(event) { event.stopPropagation(); }); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // FONT SIZE CHANGER /* Based on relative font size (em) metrics, increase or decrease global text size by re-declaring the body font size. */ // ############## // //read fontpref cookie (based on the old settings 4 is largest 6 is smallest) //If unset set it to 5 (med) and init the font size and add class for current intFontsize = getCookie("fontpref"); switch (intFontsize) { //small font case "6": $("body").css("font-size", "14px"); $(".font-size .sml").addClass("cur"); break; //medium font case "5": $("body").css("font-size", "16px"); $(".font-size .med").addClass("cur"); break; //large font case "4": $(".font-size .lrg").addClass("cur"); $("body").css("font-size", "18px"); break; //No cookie set, or invalid, so set it default: document.cookie='fontpref=5'; $("body").css("font-size", "16px"); $(".font-size .med").addClass("cur"); break; } $(".font-size .lrg a").click(function() { $(this).parent().siblings().removeClass("cur").end().addClass("cur"); $("body").css("font-size", "18px"); document.cookie='fontpref=4'; }); $(".font-size .med a").click(function() { $(this).parent().siblings().removeClass("cur").end().addClass("cur"); $("body").css("font-size", "16px"); document.cookie='fontpref=5'; }); $(".font-size .sml a").click(function() { $(this).parent().siblings().removeClass("cur").end().addClass("cur"); $("body").css("font-size", "14px"); document.cookie='fontpref=6'; }); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // TEAM PG. CATEGORIES /* Based on the selected role type, extract one (or multiple) strings from category title and return (display) profiles specific to selection. */ // ############## // /* $("body.ede2-team .sub1 a").click(function() { var sel_anchor_str = $(this).text(); var profiles = $(".profile"); profiles.hide(); /// profiles.each(function() { // evaluate h5 text (string), if value a match with the var reference, show/display profile. var h5_str = $(this).find("h5").text(); if (sel_anchor_str.match(h5_str)) { $(this).show(); } }); }); */ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // calling the Admin Table structure hack fnHackAdminTableStructure(); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // HTML5 VIDEO PLAYER // ############## // $("#vids-menu a").click(function() { var title = $(this).find("h6").text(); var path = "/styles/ede2_html5/_videos/"; ////// $(this).siblings().removeClass("is-playing"); // remove class from all other. $(this).addClass("is-playing"); // add class. ////// $(".video-wrapr .caption strong").text(title); // append title to caption. ////// // replace source element src attribute value. var this_href_val = $(this).attr("href"); this_href_val = this_href_val.replace("#", ""); // remove source els. from video - // $("video").find("source").remove(); // build source els. and append to video el. - // var mp4_source = $(''); // var webm_source = $(''); // mp4_source.appendTo($("video")); // webm_source.appendTo($("video")); ////// /* // create a new video element and re-append to DOM. var orig_vid = $("video"); var new_vid_el = orig_vid.clone(); console.log(new_vid_el); new_vid_el.find("source").remove(); mp4_source.appendTo(new_vid_el); webm_source.appendTo(new_vid_el); orig_vid.replaceWith(new_vid_el); // remove current video. */ sublime.ready(function() { // see http://docs.sublimevideo.net/javascript-api/application#prepare // see https://gist.github.com/rymai/921421 }); }); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // hack stuff... // add class is-cms to my testing pages. $("body.ede2-micheltesting5").addClass("is-cms"); $("body.cms-id-5 #idEmailFrm").addClass("default"); $("#idEmailForm p:first").remove(); //$("#nav-main ul:first > li").addClass("level1"); //!The hack for adding
is here //$("#form td input").wrap('
'); $("#form td .popup-alert").each(function() { $(this).appendTo($(this).siblings("p").children(".input")); }); //! calendar_style.css - need to remove this properly, where? //$('link[href="/includes/__CalendarClass/calendar_style.css"]').remove(); $("body.public-forgotpassword-html5 #main .content .grid").wrapInner('
'); // < Nic //fnHackCreateAccountForm(); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $("#filter_string").click(function(){ if($(this).attr("value")=="Looking for someone?") { $(this).attr("value",""); } }); ConfirmLogout = function() { html5popupalert( "Are you sure you want to logout?" , { label: "Cancel" } , { label: "Confirm" , func: function() { window.location.href="/index.php?fuseaction=authentication.sessionkiller"; } } ); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* Dashboard (Private home): Horizontally align contents in box relative to box height. */ var box = $("#main .cats a"); box.each(function() { var h3 = $(this).find("h3"), height_els = 0, boxH = $(this).height(); $(this).children().not("img").each(function() { height_els += $(this).outerHeight(true); }); h3.css("margin-top", Math.round((boxH - height_els) / 2)); }); }); // < end document.ready(); function fnHackAdminTableStructure(tableOnly) { // TABLE STRUCTURE / MARKUP /* Below is a temporary "hack" method/approach with intent to imitate the new boxed-core styles. */ ////////////////// /* Ask Nic: 1. remove square brackets surrounding current page. (both top and bottom of pg.) 2. when calling ajax function, can we run x,y, and z? (DOM manipulation) 3. need to remove "space" ( ) char. entity from #idPagerBot and #idPagerTop. (no other way to get around / fix styling) */ /* Managing lots of columns / data: ------------------------------------ 1. automate 3 period chars. at end of string (after 'x' amount of chars.) 2. limit the column display options to 6. */ // ############## // if(!tableOnly) { var createuser_input = $("#rptTable input[value$='User']"); var pagination_els = $("#idPagerTop"); createuser_input.appendTo($("#list_hd tr:first-child td:first-child")).addClass("btn1"); $("#list_hd tr:first-child td:first-child").wrapInner('
'); pagination_els.appendTo($("#rptTable #search")); $("#rptTable #search p span").remove(); $("#item_per_pg span").text("Results per page"); $("#filter_string").val("Looking for someone?"); $("#rptTable #search b:first").text("Export as file..."); $('#rptTable #search input[value$="file"]').addClass("text-only-btn"); $('#rptTable #search').appendTo(".sub-comps"); //! does not appear to be working. $("#filter_string").wrap('