0};this.IsRoot=function(){return l==null};this.IsTabletLayout=function(n){return this.isGivenLayout("Tablet",n)};this.getLayout=function(n){return this.isGivenLayout("Mobile",n)?"Mobile":this.isGivenLayout("Tablet",n)?"Tablet":"Web"};this.isGivenLayout=function(n,t){if(this.IsResponsive&&this.Breakpoints){var i=this.Breakpoints.mediums[n],r=this.Breakpoints.prop;return r=="max-width"?(t||(t=window.innerWidth),t<=i):window.matchMedia("("+r+": "+i+"px)").matches}return!1};this.ProcessMicroContentXhtml=function(n,t){var i=MadCap.Utilities.SanitizeHtml(""+n+"<\/div>"),r=new MadCap.Utilities.Url(t).ToFolder(),u=MadCap.Utilities.HasRuntimeFileType("TriPane"),f=u?"#":"";return MadCap.Utilities.FixLinks(i,r,f,this.ContentFolder)};this.LoadLanguage=function(n,t){var i=this;require([this.LanguageUrl],function(r){i.Language=r;n.call(t,r)})};this.LoadBreakpoints=function(n,t){if(this.IsResponsive&&this.IsRoot()){var i=this;require([this.BreakpointsUrl],function(r){i.Breakpoints=r;n.call(t,r)})}else n.call(t,null)};this.LoadConcepts=function(){var n=$.Deferred();return require([o+"Data/Concepts.js"],function(t){a=t;n.resolve(a)}),n.promise()};this.LoadAllConcepts=function(n){function i(){u++;u==e+1&&n()}var u=0,e=f.length,t,r;for(this.LoadConcepts().then(i),t=0;t0&&(e.n[o].previous=e.n[o-1]);e=k(e)}for(l=[],a=!1,o=0;o1||!t){if(f=t&&!(n.QueryMap.GetItem("TocPath")||n.QueryMap.GetItem("BrowseSequencesPath"))&&!MadCap.String.IsNullOrEmpty(n.Fragment)?new MadCap.Utilities.Url(n.Fragment):n,r=f.QueryMap.GetItem("TocPath"),r!=null?i="Toc":(u=f.QueryMap.GetItem("BrowseSequencesPath"),u!=null&&(i="BrowseSequences")),n.HashMap.GetItem("cshid")==null){var o=n.Query.indexOf("?"),s=n.Query.lastIndexOf("?"),e="";o!=s&&(e=n.Query.substr(o,s));t&&(n=new MadCap.Utilities.Url(n.Fragment.substr(1)));MadCap.String.IsNullOrEmpty(e)||(n.Query=e)}}else n=new MadCap.Utilities.Url(this.DefaultStartTopic).ToRelative(this.GetContentPath());return{TocType:i,TocPath:r,BrowseSequencesPath:u,Href:n}};this.FindTocNode=function(n,t,i,r){e.FindNode("Toc",n,t,i,r)};this.FindBrowseSequenceNode=function(n,t,i){e.FindNode("BrowseSequences",n,t,i)};this.FindNode=function(n,t,i,r,u){e.FindNodeInToc(n,t,i,r,u,!0)};this.FindNodeInToc=function(n,t,i,r,u,o){e.LoadToc([n,u]).then(function(u){var l=new MadCap.Utilities.Url(e.GetMasterHelpSystem().GetContentPath()),s=i,a=0,h,c;for(i.IsAbsolute||(s=MadCap.String.IsNullOrEmpty(l.FullPath)?i:l.CombinePath(i),s=s.ToRelative(e.GetPath()),s=new MadCap.Utilities.Url("/"+s.FullPath)),c=1;c0&&o?MadCap.Utilities.AsyncForeach(f,function(u,f){u.FindNode(n,t,i,function(n){if(typeof n!="undefined"){r(n);return}f()})},function(){r(h)}):r(h)})})};this.NodeDepth=function(n){for(var t=1;n.parent&&n.c!==undefined;)t++,n=n.parent;return t};this.LoadGlossary=function(n,t){if(typeof this.Glossary!="undefined"){n.call(t,this.Glossary);return}var i=this;this.GetGlossary(function(r){var u,f;if(r&&r.terms)for(r.termMap=Object.create(null),u=0;ur?1:0});n.f=i.join("; ")}t.e&&(typeof n.e=="undefined"&&(n.e={}),$.each(t.e,function(t,i){typeof n.e[t]!="undefined"?e.MergeIndexEntries(n.e[t],i):n.e[t]=i}))};this.FindIndexEntry=function(n,t){e.LoadIndex(function(i){i.entries||(i.entries={},$.each(i.terms,function(n,t){i.entries[t.t]=t}));var r=n.split(":"),f=r.length,u=i.entries[r[0]];u?e.LoadRootIndexEntry(u,function(n){for(var i=n,u=1;ur?1:0}),n};this.GetSearchDBs=function(n){var t=[],i=this;require([o+"Data/Search.js"],function(r){function o(i){if(i!=null)for(var r=0;r=0?(r.LoadMerge(n,t),!0):!1}n=="previous"?s(t):n=="next"&&c(t)}function y(n,t){var i=$(n).children(t+":last")[0],r;return i!=null?(r=y(i,t),r!=null)?r:i:null}function l(n){for(var r=null,t=n,u;;){if(t==t.ownerDocument.documentElement){r=i;break}if(u=MadCap.Dom.GetAttributeInt(t,"ownerHelpSystemIndex",-1),u>=0){r=f[u];break}t=t.parentNode}return r}function k(n){var t="",r=-1,u=$(n).children("TocEntry")[0],i;for(u!=null?(t=encodeURIComponent(MadCap.Dom.GetAttribute(n,"Title")),r=0):r=$(n).index()+1,t.length>0&&(t+="|"),t+="_____"+r,i=n.parentNode;i!=null&&i.parentNode.nodeType==1;i=i.parentNode)t==null&&(t=""),t.length>0&&(t="|"+t),t=encodeURIComponent(MadCap.Dom.GetAttribute(i,"Title"))+t;return t}function p(n){var i,t,f,r,e,u;if(n.parentNode==n.ownerDocument.documentElement)return 0;for(i=0,r=MadCap.Dom.GetAttribute(n,"Link"),r!=null&&i++,t=n.previousSibling;t!=null;t=t.previousSibling)t.nodeType==1&&(f=MadCap.Dom.GetAttributeInt(t,"DescendantCount",0),i+=f,r=MadCap.Dom.GetAttribute(t,"Link"),r!=null&&(e=new MadCap.Utilities.Url(r),u=e.Extension.toLowerCase(),(u=="htm"||u=="html")&&i++));return i+p(n.parentNode)}var r=this,i=n,u=t,a=!1,e=null,c=[],o=null,s=null,f=[];(function(){})();this.Init=function(n){function u(n){a=!0;e=n.documentElement;w()}if(a){n!=null&&n();return}n!=null&&c.push(n);var r=null;t==MadCap.WebHelp.TocFile.TocType.Toc?r="Toc.xml":t==MadCap.WebHelp.TocFile.TocType.BrowseSequence&&(r="BrowseSequences.xml");this.LoadToc(i.GetPath()+"Data/"+r,u)};this.LoadToc=function(n,t){function r(n){if(!n||!n.documentElement){t!=null&&t(n);return}t!=null&&t(n)}if(u==MadCap.WebHelp.TocFile.TocType.Toc&&i.IsWebHelpPlus)MadCap.Utilities.Xhr.CallWebService(i.GetPath()+"Service/Service.asmx/GetToc",!0,r,null);else if(u==MadCap.WebHelp.TocFile.TocType.BrowseSequence&&i.IsWebHelpPlus)MadCap.Utilities.Xhr.CallWebService(i.GetPath()+"Service/Service.asmx/GetBrowseSequences",!0,r,null);else{var f=n.indexOf("/")==-1?i.GetPath()+"Data/"+n:n;MadCap.Utilities.Xhr.Load(f,!1,r,null,null)}};this.LoadChunk=function(n,t,r){function u(t){var f,i,o,u,e;if(!t||!t.documentElement){r!=null&&r(n);return}for(n.removeAttribute("Chunk"),f=t.documentElement,i=0,o=f.childNodes.length;i0&&(p=h[h.length-1],MadCap.String.StartsWith(p,"_____")&&(c=parseInt(p.substring(5)),h.splice(h.length-1,1))),r=e,a=0,w=h.length;a=0)y=c==0?r:$(r).children("TocEntry")[c-1];else{var d=l(r),k=t.ToRelative(new MadCap.Utilities.Url(d.GetPath())),y=v(r,k.FullPath.toLowerCase(),!0);y||(y=v(r,k.PlainPath.toLowerCase(),!1))}o=null;s=null;i(y)}}function u(n){var t=MadCap.Dom.GetAttribute(n,"Chunk");return t!=null?(r.LoadChunk(n,t,function(){r.GetTocNode(o,s,i)}),!0):!1}function f(n){var t=$(n).attr("MergeHint")||-1;return t>=0?(r.LoadMerge(n,function(){r.GetTocNode(o,s,i)}),!0):!1}this.Init(h)};this.GetEntrySequenceIndex=function(n,t,i){function r(n){var t=-1;n!=null&&(t=p(n));i(t)}this.GetTocNode(n,t,r)};this.GetIndexTotalForEntry=function(n,t,i){function r(n){var r=-1,t;if(n!=null){for(t=n;t.parentNode!=e;)t=t.parentNode;r=MadCap.Dom.GetAttributeInt(t,"DescendantCount",-1)}i(r)}this.GetTocNode(n,t,r)}};MadCap.WebHelp.TocFile.TocType={Toc:0,BrowseSequence:1};MadCap.WebHelp.IndexEntry=function(n,t){var u=MadCap.Dom.GetChildNodeByTagName(n,"Links",0).childNodes,e=u.length,f=0,i,r;for(this.Term=MadCap.Dom.GetAttribute(n,"Term"),this.IndexLinks=[],this.Level=t,this.GeneratedReferenceType=MadCap.Dom.GetAttribute(n,"GeneratedReferenceType"),i=0;i -1) ? "yes" : "no";
menu = (setup.indexOf("Menu") > -1) ? "yes" : "no";
locationBar = (setup.indexOf("LocationBar") > -1) ? "yes" : "no";
statusBar = (setup.indexOf("StatusBar") > -1) ? "yes" : "no";
resizable = (setup.indexOf("Resizable") > -1) ? "yes" : "no";
}
browserOptions = "toolbar=" + toolbar + ", menubar=" + menu + ", location=" + locationBar + ", status=" + statusBar + ", resizable=" + resizable;
}
var windowSize = LoadSize(skin);
if (windowSize)
size = ", top=" + windowSize.topPx + ", left=" + windowSize.leftPx + ", width=" + windowSize.widthPx + ", height=" + windowSize.heightPx;
}
OnGetSkinComplete();
}
else
{
OnGetSkinComplete();
}
});
});
}
function LoadSize(skin)
{
var useDefaultSize = MadCap.String.ToBool(skin.UseBrowserDefaultSize, true);
if (useDefaultSize)
return null;
var topPx = MadCap.String.ToInt(skin.Top, 0);
var leftPx = MadCap.String.ToInt(skin.Left, 0);
var bottomPx = MadCap.String.ToInt(skin.Bottom, 0);
var rightPx = MadCap.String.ToInt(skin.Right, 0);
var widthPx = MadCap.String.ToInt(skin.Width, 800);
var heightPx = MadCap.String.ToInt(skin.Height, 600);
var anchors = skin.Anchors;
if (anchors)
{
var aTop = (anchors.indexOf("Top") > -1) ? true : false;
var aLeft = (anchors.indexOf("Left") > -1) ? true : false;
var aBottom = (anchors.indexOf("Bottom") > -1) ? true : false;
var aRight = (anchors.indexOf("Right") > -1) ? true : false;
var aWidth = (anchors.indexOf("Width") > -1) ? true : false;
var aHeight = (anchors.indexOf("Height") > -1) ? true : false;
}
if (aLeft && aRight)
widthPx = screen.width - (leftPx + rightPx);
else if (!aLeft && aRight)
leftPx = screen.width - (widthPx + rightPx);
else if (aWidth)
leftPx = (screen.width / 2) - (widthPx / 2);
if (aTop && aBottom)
heightPx = screen.height - (topPx + bottomPx);
else if (!aTop && aBottom)
topPx = screen.height - (heightPx + bottomPx);
else if (aHeight)
topPx = (screen.height / 2) - (heightPx / 2);
//
var windowSize = {};
windowSize.topPx = topPx;
windowSize.leftPx = leftPx;
windowSize.widthPx = widthPx;
windowSize.heightPx = heightPx;
return windowSize;
}
})();