Commit a5b83e8f authored by Aaron Harder's avatar Aaron Harder

Framed page: NPE checks + smarten up around the “default framed page” case

parent cd31c401
......@@ -114,8 +114,10 @@ module.exports=function($, window){
var last=$iframe[0].contentWindow.location.href, modes=global.BL.config.modes;
// TODO: Polling is lame, but iframe URL change events are not readily available
window.setInterval(function(){
var currentIframeURL = $iframe[0].contentWindow.location.href;
if(last!==currentIframeURL){
var currentIframeLocation = $iframe[0].contentWindow.location;
var currentIframeURL = currentIframeLocation.pathname + currentIframeLocation.hash;
if(last!==currentIframeURL && currentIframeURL!==defaultFrameURL){
last=currentIframeURL;
var result = view.parseUrlByMode(currentIframeURL);
view.brieflyIgnoreHashEvents();
......@@ -307,7 +309,7 @@ module.exports=function($, window){
if(!targetNode){
tree.openPath($("#nav-tree"), currentPath);
if(currentPath && currentPath!==defaultFrameURL){tree.openPath($("#nav-tree"), currentPath);}
}else{
targetNode.setActive(true);
}
......@@ -329,7 +331,7 @@ module.exports=function($, window){
if(currentPath === defaultFrameURL){
url=currentPath;
}else{
url = (mode.prefix?mode.prefix:"") + currentPath + (mode.postfix?mode.postfix:"") + (currentExtraHashSegments?("#!" + currentExtraHashSegments):"");
url = currentPath? ((mode.prefix?mode.prefix:"") + currentPath + (mode.postfix?mode.postfix:"") + (currentExtraHashSegments?("#!" + currentExtraHashSegments):"")) : defaultFrameURL;
}
}else{
url=currentPath;
......@@ -338,13 +340,15 @@ module.exports=function($, window){
url=url?url.replace(/\/\//g,"/"):url;
if(!options.skipIframeLoad){
var currentIframeUrl=$iframe[0].contentWindow.location.pathname;
if(currentIframeUrl!==url){
var currentIframeURL=$iframe[0].contentWindow.location.pathname;
if(currentIframeURL!==url){
view.brieflyIgnoreFrameLoadEvents();
$iframe.attr("src", url);
var parts=url.split("#");
if(parts[0]!==currentIframeUrl){
$loadingIndicator.css("display", "block");
if(url){
$iframe.attr("src", url);
var parts=url.split("#");
if(parts[0]!==currentIframeURL){
$loadingIndicator.css("display", "block");
}
}
}
}
......
......@@ -103,7 +103,7 @@ module.exports=function($, window, options){
///////////////////////////////////////////////////////////////////////////////////////////
tree.openPath=function($el, path, options){
var parts=path.split("/"), node, currentKey="";
var parts=(path||"").split("/"), node, currentKey="";
options=options||{};
parts.shift();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment