il.LearningModule = { save_url: '', toc_refresh_url: '', init_frame: {}, last_frame_url: {}, all_targets: ["center_bottom", "right", "right_top", "right_bottom"], rating_url: '', close_html: '', setSaveUrl: function (url) { il.LearningModule.save_url = url; }, setTocRefreshUrl: function (url) { il.LearningModule.toc_refresh_url = url; }, setCloseHTML: function (html) { il.LearningModule.close_html = html; }, showContentFrame: function (e, target) { var href = e.target.href; $('body').trigger('il-lm-show-' + target + '-slate'); console.log('il-lm-show-' + target + '-slate'); if (!href) { href = $(e.target).parents("[href]").attr("href"); } if (href != "") { return il.LearningModule.loadContentFrame(href, target); } }, initContentFrame: function (href, target) { il.LearningModule.init_frame[target] = href; }, setLastFrameUrl: function (href, target) { il.LearningModule.last_frame_url[target] = href; }, openInitFrames: function () { var i, t; for (i = 0; i < il.LearningModule.all_targets.length; i++) { t = il.LearningModule.all_targets[i]; if (il.LearningModule.init_frame[t]) { il.LearningModule.loadContentFrame(il.LearningModule.init_frame[t], t); } else if (il.LearningModule.last_frame_url[t]) { il.LearningModule.loadContentFrame(il.LearningModule.last_frame_url[t], t); } } il.LearningModule.refreshLayout(); }, refreshLayout: function () { var e; // fix right content area if ($("#right_top_area > iframe").attr("src") && $("#right_bottom_area > iframe").attr("src")) { $("#right_cont_area").addClass("ilRightContAreaSplit"); //console.log("splitting"); } else { $("#right_cont_area").removeClass("ilRightContAreaSplit"); //console.log("unsplitting"); } if (!$("#right_top_area > iframe").attr("src") && !$("#right_bottom_area > iframe").attr("src")) { $("#right_cont_area").remove(); } // adapt main content e = $("#left_nav"); if (e.length != 0) { $("#fixed_content").addClass("ilLeftNavSpace"); } else { $("#fixed_content").removeClass("ilLeftNavSpace"); } e = $("#right_area, #right_cont_area"); if (e.length != 0) { $("#fixed_content").addClass("ilRightAreaSpace"); } else { $("#fixed_content").removeClass("ilRightAreaSpace"); } }, loadContentFrame: function (href, t) { var area, el_id = t + "_area"; var doc; doc = (window.top != window.self) ? window.parent.document : document; console.log(el_id); console.log(href); $("#" + el_id).parent().css("height", "100%"); // workaround for slate height $("#" + el_id + " > iframe", doc).attr("src", href); return false; //console.log("LoadContentFrame:" + href + ":" + t +":"); // exception we should get rid off if (t == "center_bottom") { el_id = "bot_center_area"; } if (t != "right_top" && t != "right_bottom") { area = $("#" + el_id, doc); if (area.length == 0) { $('body').append('