-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathindexNotMinified.min.js
2 lines (2 loc) · 27.2 KB
/
indexNotMinified.min.js
1
2
!function(window,$,undefined){"use strict";function treeGroup(){}function lowerCaseEncodeURI(e){return encodeURIComponent(e).toLowerCase()}function searchIncludeHash(){var e="";return searchInclude.jsr&&searchInclude.jsv&&searchInclude.smp&&searchInclude.txt||(e+="&f="+(searchInclude.jsr?"":"jsr-")+(searchInclude.jsv?"":"jsv-")+(searchInclude.smp?"":"smp-")+(searchInclude.txt?"":"txt-")),e}function searchContent(e){var t,a,n,s,o=content.categories,r=o.length;for(content.filter=[],$.observable(content).setProperty("searchtext",""),searchtextElem&&searchtextElem.removeClass("selected"),t=1;o&&t<r;t++)a=o[t],n=undefined,"jsr"===a.filter&&!searchInclude.jsr||"jsv"===a.filter&&!searchInclude.jsv||a.hidden||!searchCat(a,e.toLowerCase(),content[a.name],content.find[a.name])||(n=!0,s=!0),$.observable(a).setProperty("filtered",n);$.observable(content).setProperty({noSearch:s||!e?"":"No results found for <span class='searchterm'>"+e+"</span>...",filterlen:content.filter.length})}function searchCat(e,t,a,n){var s,o,r,i,c,l,d;if(t&&(l=e.categories))for(o=l.length,s=0;l&&s<o;s++)d=l[s],c=i=undefined,"jsr"===d.filter&&!searchInclude.jsr||"jsv"===d.filter&&!searchInclude.jsv||d.hidden||(i=searchTopic(d.name,t,a,n),c=searchCat(d,t,a,n),i&&i.length||c?r=i:i=undefined),$.observable(d).setProperty("filtered",i);return r}function searchTopic(e,t,a,n){var s,o,r,i,c,l,d,h,p,m,u,g,f,v=a[e],y=n[e];if(y){if(o=y.sections.length,p=[],("jsr"!==v.filter||searchInclude.jsr)&&("jsv"!==v.filter||searchInclude.jsv))for(s=0;s<o;s++)l=v.sections[s],g=y.sections[s],f=undefined,l&&g.text&&("sample"===l._type&&searchInclude.smp||"sample"!==l._type&&searchInclude.txt)&&(i=g.text,r=i.toLowerCase().indexOf(t),r+1&&(d=i.substring(r-35,r),(c=d.lastIndexOf("\n")+1||d.search(/\s/)+1)&&(d=d.slice(c)),h=i.substr(r+t.length,210-t.length-d.length),(c=h.indexOf("\n")+1)&&(h=h.slice(0,c-1)),m=e+"@"+content.filter.length,f="#search?s="+lowerCaseEncodeURI(t)+searchIncludeHash()+"&l="+m,$.observable(l).setProperty("searchAnchor","#search?s="+lowerCaseEncodeURI(t)+searchIncludeHash()+"&l="+m),u={section:m,searchTerm:htmlConverter(i.substr(r,t.length)),text:htmlConverter(d)+"<span class='searchterm'>"+htmlConverter(i.substr(r,t.length))+"</span>"+htmlConverter(h)},p.push(u),content.filter.push(u))),$.observable(l).setProperty("searchAnchor",f);return $.observable(v).setProperty("filtered",p),v.filtered}}function clearSearch(e){var t,a=content.categories,n=a.length;for(content.filter=[];a&&n-- >1;)t=a[n],t.filtered=undefined,!t.hidden&&clearSearchCat(t,content[t.name])}function clearSearchCat(e,t){var a,n,s;if(n=e.categories)for(a=n.length;n&&a--;)s=n[a],s.hidden||(s.filtered=undefined,clearSearchTopic(s.name,t),clearSearchCat(s,t))}function clearSearchTopic(e,t){var a,n,s=t[e];if(s)for(a=s.sections.length,s.filtered=undefined;a--;)n=s.sections[a],$.observable(n).setProperty("searchAnchor",undefined)}function getCategory(e,t,a){function n(e,t,a){if(selectedCategory=r[0][e])return topCategory=homeCategory=selectedCategory;topCategory=undefined,o.push(a);for(var s,i=t.length;i--;)if(s=t[i],s.name===e||s.categories&&(s=n(e,s.categories,s))){for(;a=o.pop();)topCategory=a,a.expanded||$.observable(a).setProperty("expanded",!0);return s}o.pop()}var s,o=[],r=content.categories,i=topCategoryName,c=$.Deferred();return selectedCategory=e&&n(e,r)||r[0].jsrender,topCategory=topCategory||selectedCategory,t&&!e&&(topCategory=searchCategory,page&&(page.category=undefined)),topCategoryName=topCategory.name,topCategoryName!==i&&(i&&$("#id-"+i).removeClass("selected").addClass("unselected"),$("#id-"+topCategoryName).removeClass("unselected").addClass("selected")),content.topCategory!==topCategory&&(content.catName=e,$.observable(content).setProperty("topCategory",topCategory)),t?content.searched!==t||content.searchExclude!==a?loadAllContent().then(function(){loadAllContent("find").then(function(){setTimeout(function(){searchContent(t),$.observable(content).setProperty("searched",t),content.searchExclude=a,c.resolve()})})}):c.resolve():topCategory.loaded||topCategory.loading?topCategory.loaded&&(content.searched&&setTimeout(function(){clearSearch(),$.observable(content).setProperty({search:undefined,filterlen:0}),content.searched=undefined}),c.resolve()):(topCategory.loading=" ",s=topCategory,$.getScript("documentation/contents-"+topCategory.name+".min.js").then(function(){$.observable(s).setProperty("loaded",!0),c.resolve()})),c.promise()}function fetchCategory(){save();var e,t,a,n,s=topCategory,o=selectedCategory,r=location.hash;if(history&&history.replaceState)if(history.state&&history.state.url===document.URL)historyIndex=history.state.index,historyStates[historyIndex]?history.replaceState(historyStates[historyIndex],""):historyStates[historyIndex]=history.state;else{historyIndex++;var i=historyStates[historyIndex]={url:document.URL,index:historyIndex};history.replaceState(i,""),historyStates[historyIndex-1]&&(historyStates[historyIndex-1].scroll=$(window).scrollTop())}return r&&"#home"!==r||(r="#"+(homeCategory&&homeCategory.key||"jsrender")),e=searchRegex.exec(r),e[1]&&($.observable(searchInclude).setProperty({jsr:!e[3],jsv:!e[4],smp:!e[5],txt:!e[6]}),$.observable(content).setProperty("search",t=decodeURIComponent(e[1]).toLowerCase())),a=e[8],n=e[2],e=e[7],getCategory(e,t,n).then(function(){if(page){var n=s!==topCategory;if(topCategoryName=topCategory.name,"home"!==topCategoryName&&!content[topCategoryName])throw topCategoryName+" not loaded. Ensure category.loaded not saved as 'true'...";$.observable(page).setProperty({category:selectedCategory}),n&&(s.loading="",s&&s.key&&$("#logo-"+s.key).removeClass("selected").addClass("unselected"),topCategory.key&&$("#logo-"+topCategory.key).removeClass("unselected").addClass("selected")),page.navTo(r,n||o!==selectedCategory)}else initPageParams={catName:e,searchTerm:t,section:a}})}function initPage(e,t,a){$.observable(content).setProperty({searchTitle:t&&e&&content[topCategoryName][e].title,catName:e}),t&&$.observable(topSearchTree).setProperty({sectionIndex:a&&parseInt(a),topicName:e,selected:a&&e+"@"+a})}function signature(e){var t,a,n,s=this.data,o=(e.object?e.object+".":"")+e.name;if(e.method){for(o+="(",a=0,n=s.params.length;a<n;a++)t=s.params[a],o+=(t.optional?"[":"")+(a?", ":"")+t.name+(t.optional?"]":"");o+=")"}return o}function getContent(e){if(!e)return"";var t,a,n,s=content.categories,o=topCategoryName,r="JsViewsDocTopics/"+topCategoryName,i={},c={};if(e===s)for(o="categories",r="JsViewsDocCategories",a=e.length;a--;)n=e[a],i[a]=n.loaded,c[a]=n.loading,delete n.loading,delete n.loaded;if(t="var content = $.views.documentation.content;\n\ncontent."+o+' = content.useStorage && $.parseJSON(localStorage.getItem("'+r+'")) ||\n'+stringify(e)+";",e===s)for(a=e.length;a--;)e[a].loading=c[a],e[a].loaded=i[a];return t}function stringify(e){return JSON.stringify(e,null," ")}function parse(val){var data;try{return eval("data="+val+";"),data}catch(e){}}function save(){if(content.editable){for(var e,t,a=content.categories,n=a.length,s=page.contents(!0,".savetext"),o={},r={},i={},c={};n-- >1;)t=a[n],o[n]=t.loaded,r[n]=t.loading,i[n]=t.loadedfind,c[n]=t.loadingfind,a[n].loaded=a[n].loadedfind=!1,a[n].loading=a[n].loadingfind="";for(localStorage.setItem("JsViewsDocCategories",stringify(a)),n=a.length;n-- >1;)a[n].loaded=o[n],a[n].loading=r[n],a[n].loadedfind=i[n],a[n].loadingfind=c[n];e=content[topCategoryName],e&&localStorage.setItem("JsViewsDocTopics/"+topCategoryName,stringify(e)),s[0].value=getContent(e),s[1].value=getContent(a)}}function loadAllContent(e){var t=content.categories,a=t.length,n=0,s=$.Deferred(),o="loading"+(e||""),r="loaded"+(e||"");for(e=e||"contents",loadedAll=!0;a-- >1;)!function(){var i=t[a];i.hidden||("contents"===e?content:content[e])[i.name]||(n++,i[o]=" ",$.getScript("documentation/"+e+"-"+i.name+".min.js").then(function(){$.observable(i).setProperty(r,!0),i.loading="",n--,n||s.resolve()}))}();return n||s.resolve(),s.promise()}var page,selectedCategory,topCategory,homeCategory,topCategoryName,scrollTargetElem,skipLoad,searchbox,initPageParams,prevLochash,isSearchTreeSelectionChange,isLeftNavSelectionChange,topSearchTree,loadedAll,searchtextElem,searchNavElem,sideNavElem,hoverTextElem,useBodyToScroll,content=$.views.documentation.content,searchInclude=content.include,searchRegex=/#(?:search\?s=([^&]+)(&f=(jsr-)?(jsv-)?(smp-)?(txt-)?)?(?:&l=)?)?([^@]+)?(?:@(.+))?$/,searchCategory={name:"home","class":"search",loaded:!0,search:!0},allowEdit=!1,md=new Remarkable("full",{html:!0,breaks:!1,linkify:!0,typographer:!0,highlight:function(e,t){if(t&&hljs.getLanguage(t))try{return hljs.highlight(t,e).value}catch(a){}try{return hljs.highlightAuto(e).value}catch(a){}return""}}),htmlConverter=$.views.converters.html,historyIndex=-1,historyStates={},sampleFrames={},pageTag={init:function(){window.pagetag=page=this,page.data=content,page.category=selectedCategory},onAfterLink:function(){var e=this;e.contents().on("click",".insertsection",function(){e.addSection($.view(this),this.innerText,this.getAttribute("data-type"),this.className.indexOf("append")>=0)}).on("click",".savedata",function(){save()}).on("click",".addsignature",function(t){e.addSignature($.view(this)),t.stopImmediatePropagation()}).on("click",".addparam",function(){e.addParam($.view(this))}).on("click",".addarg",function(){e.addParam($.view(this),!0)}).on("click",".addlink",function(){e.addLink($.view(this))}).on("click",".addtopic",function(){e.addTopic($.view(this))}).on("click",".addcodetab",function(){e.addCodeTab($.view(this))}).on("click",".defaultsample",function(){var e=$.view(this).data,t="jsr"===e.jsrJsvJqui;$.observable(e).setProperty({html:'<script id="myTmpl" type="text/x-jsrender">\n {{:name}}\n</script>\n\n<div id="page"></div>',code:'var myTmpl = $.templates("#myTmpl"),\n data = { name: "Jo" }'+(t?',\n html = myTmpl.render(data);\n\n$("#page").html(html);':';\n\nmyTmpl.link("#page", data);')})}).on("click",".removesection",function(){var t=$.view(this);e.removeSection(t.get("array").data,t.getIndex())}).on("click",".runSample",function(){$.view(this).ctx.parentTags.section.sampleFrame.runCode()}).on("click",".revertSample",function(){var e=$.view(this).ctx.tag,t="section"===e.tagName?e:e.parent.parents.section;t.sampleFrame.runCode(!0)}).on("click",".tryIt",function(){var e=$.view(this).parent.tag,t=e.tabs,a=t.tabCount-1;t.setTab(t.selectedIndex===a?0:a)}).on("keyup",".try textarea",function(){$.observable($.view(this).ctx.parentTags.section.sampleFrame).setProperty("ranIt",!0)}).on("contextmenu",function(){var t=!e.editable;if(!t||!content.search&&(allowEdit||content.allowEdit))return $.observable(content).setProperty("editable",t),e.tree&&$.observable(e.tree).setProperty("editable",t),$.observable(e).setProperty("editable",t),save(),!1})},onDispose:function(){save()},template:"#pagePanelTmpl",modes:{details:1,summary:0,edit:2},mode:0,editable:!1,setTree:function(e){this.tree=e,$.observable(e).setProperty("selected",selectedCategory),e.onSelectionChange=function(t){save(location.hash=t.name),e.editable&&e.refresh(),isLeftNavSelectionChange=!0},e.onExpansionChange=function(e){save(e.name)}},iframeLoaded:function(e,t){sampleFrames[e].getScript(t)},addSignature:function(e){var t=e.data.signatures,a=t.length,n=$.extend(!0,{},this.data.subTypes.signature);t[a-1]&&($.extend(!0,n,t[a-1]),$._removeData(n),$._removeData(n.params)),$.observable(t).insert(n)},addParam:function(e,t){var a=t?e.data.args:e.data.params,n=$.extend(!0,{},this.data.subTypes.param);$.observable(a).insert(n)},addLink:function(e){var t=e.data.links,a=$.extend(!0,{},this.data.subTypes.link);$.observable(t).insert(a)},addTopic:function(e){var t=e.data.topics,a=$.extend(!0,{},this.data.subTypes.topic);$.observable(t).insert(a)},addCodeTab:function(e){var t=e.data.codetabs=e.data.codetabs||[],a=$.extend(!0,{},this.data.subTypes.codetab);$.observable(t).insert(a)},addSection:function(e,t,a,n){function s(e,t){var a,n,o=e.categories||[],r=o.length;for(n=0;n<r;n++)a=o[n],h[c=a.name]&&u.topics.push({hash:c,label:a.label}),t&&s(a,t)}var o,r,i,c,l,d=this.category,h=this.data[topCategoryName],p=(h||topCategory)[d.name],m=this.data.sectionTypes,u=$.extend(!0,{},m[t]);a&&(p=n?e.data:e.parent.get("item").data),p?(p.leftsections&&(o=e.ctx.tag,l=o.tagCtx.props.left),i=l?p.leftsections:p.sections,i||(i=[],$.observable(p).setProperty("sections",i)),r=n?i.length:e.getIndex(),"links"===t&&s(d),$.observable(i).insert(r,u)):p||(h[d.name]={title:d.label,path:"",sections:[u]},e.refresh(),(o=e.childTags(!0,"selectList")[0])&&o.toggleSelect(0)),save()},removeSection:function(e,t){$.observable(e).remove(t),save()},tryIt:function(e){var t=e.data;$.observable(t).setProperty("tryIt",!t.tryIt)},hideCategory:function(e){function t(e,a,s){n.push(s);for(var o,r=a.length;r--;)if(o=a[r],o.name===e||o.categories&&(o=t(e,o.categories,o))){for(;s=n.pop();)if(s.hidden)return s;return o}n.pop()}var a,n=[],s=this.data.categories;return a=e&&t(e,s),a&&a.hidden},scrollTo:function(e){location.hash=e},navTo:function(e,t){var a,n,s,o,r,i,c,l;return prevLochash!==e&&((a=searchRegex.exec(e))&&((i=a[1])&&$.observable(searchInclude).setProperty({jsr:!a[3],jsv:!a[4],smp:!a[5],txt:!a[6]}),o=a[7],r=a[8],(n=r&&i)?(n=o+"@"+r,a=content.filter[r].text,$.observable(content).setProperty("searchtext",topSearchTree.searchtext=a),searchtextElem.addClass("selected")):(a=r,c=content.searchtext,$.observable(content).setProperty("searchtext",topSearchTree.searchtext=undefined),searchtextElem.removeClass("selected")),initPage(o,i,r),!i&&page.tree&&($.observable(page.tree).setProperty("selected",selectedCategory),l=$(".sidenav li.selected")[0])),a&&(scrollTargetElem=document.getElementById(e+"$"))?(skipLoad=!0,t=t===!0||!isSearchTreeSelectionChange,setTimeout(function(){if(e===location.hash&&(!t&&scrollTargetElem||window.scrollTo(0,0),scrollTargetElem)){s=$(scrollTargetElem).offset().top-(content.searched?n?140:120:40),$.observable(content).setProperty("loc",e);var a=document.documentElement;useBodyToScroll===undefined&&(useBodyToScroll=!a.scrollTop)&&((useBodyToScroll=(a=document.body).scrollTop)||(a.scrollTop=1,(useBodyToScroll=a.scrollTop)&&(a.scrollTop=0))),$(useBodyToScroll?"body":"html").delay(150).animate({scrollTop:s},n?100:625,function(){isSearchTreeSelectionChange||e!==location.hash||(n=document.getElementById(n+"$"))&&searchNavElem.animate({scrollTop:searchNavElem.scrollTop()-searchNavElem.height()/2+$(n).offset().top-searchbox.offset().top-60},150),scrollTargetElem=isSearchTreeSelectionChange=!1})}})):(l=!isLeftNavSelectionChange&&l,scrollTargetElem=isSearchTreeSelectionChange=isLeftNavSelectionChange=!1,setTimeout(function(){c||window.scrollTo(0,historyStates[historyIndex]&&historyStates[historyIndex].scroll||0),l&&sideNavElem.animate({scrollTop:l.offsetTop-sideNavElem.height()/2},150)})),prevLochash=e),!1}},searchTreeTag={baseTag:"tree",filter:!0,init:function(e){e.ctx.tree=topSearchTree},onAfterLink:function(){var e=this;e.contents("ul").on("click",".toggle",function(e){$.view(this).ctx.tag.toggle(),e.stopImmediatePropagation()})},template:'<ul class="tree">{^{for}}{^{searchTreeNode/}}{{/for}}</ul>'},searchTreeNodeTag={baseTag:"treeNode",template:"{^{if !hidden && filtered}}<li {{:filtered.length ? 'class=\"withgroup\"' : ''}} data-link=\"class{merge: ~tree.topicName === name toggle='topicsel'}\">{^{if categories && categories.length }}<span class=\"spacerbox\"></span>{{else}}<span class=\"spacer\">•</span>{{/if}}<span class=\"searchitem\">{{>label}}</span> {{if filtered.length}}<span class='searchgroup'>{^{for filtered ~name=name}}<div class='searchcontext' id='{{:section}}$' data-link=\"{on ~tree.select section true} class{merge: ~tree.selected === section toggle='sectionsel'} {on 'mouseenter' ~tree.mouseenter ~name}\">{{:text}}</div><span class='searchplace'></span>{{/for}}</span>{{/if}}</li>{{if filtered.length}}<li class='aftergroup'></li>{{/if}}<li><ul>{^{for categories }}{^{searchTreeNode/}}{{/for}}</ul></li>{{/if}}"},sectionTag={init:function(e){this.data=e.view.data},render:function(e,t){var a="edit"===t,n="";return a&&(t=this.selected?t:"editview",this.parent.parents.section&&!this.parent.parents.section.selected||(n='<button class="toggleselect cmdbtn">'+(this.selected?'ok</button><button class="up cmdbtn">up</button><button class="down cmdbtn">down':"edit")+'</button><span class="removesection"></span><br/>')),this.tagCtx.tmpl=this.templates[t][e],n+=this.tagCtx.render(),a?'<div class="mode-'+t+'">'+n+"</div>":n},onAfterLink:function(){var e=this;"edit"===e.ctxPrm("mode")&&(e.contents(".cmdbtn").on("click",function(e){return e.stopPropagation(),e.stopImmediatePropagation(),!1}),e.contents().on("click",function(t){$(t.target).is("cmdbtn,a,input,textarea,button,img,.removesection")||e.toggleSelect()}),e.contents(!0,".toggleselect:first").on("click",function(){e.toggleSelect()}),e.contents(!0,".up").on("click",function(t){e.moveUp(),t.stopImmediatePropagation()}),e.contents(!0,".down").on("click",function(t){e.moveDown(),t.stopImmediatePropagation()}))},onDispose:function(){this.parent.selectedChild===this&&(this.parent.selectedChild=null)},moveUp:function(){var e=this.tagCtx.view.index,t=this.parent.tagCtx.args[0];e&&$.observable(t).move(e,e-1),save()},moveDown:function(){var e=this.tagCtx.view.index,t=this.parent.tagCtx.args[0];e+1<t.length&&$.observable(t).move(e,e+1),save()},toggleSelect:function(){$.observable(this).setProperty("selected",!this.selected),this.refresh(),this.parent.onToggleSelect&&this.parent.onToggleSelect(this),save()}},sectionButtonsTag={render:function(e){var t='<div class="buttons">',a=this.ctxPrm("sectionType");for(var n in e)t+='<button class="'+(this.tagCtx.props.append?"append ":"")+'insertsection cmdbtn" '+(a?'data-type="'+a+'"':"")+">"+n+"</button>";return t+"</div>"}},sectionTitleTag={template:"#sectionTitleTmpl"},sectionHeaderTag={template:"#sectionHeaderTmpl"},sampleFrameTag={init:function(){var e=this,t=$.parseJSON(stringify(e.parent.parents.section.data)),a=t.codetabs;e.parent.sampleFrame=e,e.getScript=function(n){if(e.loadScript=n,t.url){var s=$.trim(e.iframeWnd.document.body.innerHTML).replace(/ /g,"\n"),o=s.indexOf('\n<!--<script src="'),r=e.iframeWnd.document.head||"";o>0&&(s=s.slice(0,o)),r&&(r=r.innerHTML.replace(/^.*sample-viewer.*$/m,"").replace(/<style type="text\/css"><\/style>/,"").replace(/^\n*.*\.js"><\/script>\n*/,"")),$.get(t.url+".js",function(o){n({code:o}),e.origData=e.sampleData={url:t.url,html:s,header:r,code:o},e.tryItData={html:s,header:r,code:o},a&&e.loadTabs(a)},"text")}else r=t.header?t.header+"\n":"",n(t),e.origData=e.sampleData={data:t.data,markup:t.markup,header:r,action:t.action,html:t.html,code:t.code,jsrJsvJqui:t.jsrJsvJqui,nocss:t.nocss},e.tryItData={data:t.data,markup:t.markup,header:r,html:t.html,code:t.code,jsrJsvJqui:t.jsrJsvJqui,nocss:t.nocss},a&&e.loadTabs(a);this.parent.tabs.activateTabs()}},loadTabs:function(e){var t=this;$.each(e,function(e,a){$.get(a.url,function(a){t.tryItData["c"+e]=t.sampleData["c"+e]=a},"text")})},template:'<div class="nosearch" style="height: {{attr:height}}px;"><div style="padding: 10px;">Loading...</div></div><iframe src="{{attr:url||\'samples/iframedefault\' + (jsrJsvJqui||\'\') + (nocss?\'_nocss\':\'\')}}.html" class="sampleframe" name="result" style="height: {{attr:height}}px;"></iframe>',onBind:function(){var e=this,t=e.iframeWnd=$(e.parentElem).find(".sampleframe")[0].contentWindow;t&&(sampleFrames[t._tgId=e._tgId]=e),e.parent.tabs.onSelectionChange=function(){e.onTabChange.apply(e,arguments)};e.linkCtx.data},onDispose:function(){this.iframeWnd.$&&this.iframeWnd.$.observe&&this.iframeWnd.$.unobserve(),this.iframeWnd=this.parent.sampleFrame=this.parentElem=undefined},onTabChange:function(e,t){$.observable(this).setProperty("tryIt",e===t.tabCount-1)},runCode:function(e){e&&($.observable(this.tryItData).setProperty(this.origData),$.observable(this).setProperty("ranIt",!e)),this.loadScript(this.tryItData)}},sampleFieldsTag={init:function(){this.data=this.tagCtx.view.data.tryItData},render:function(e,t,a){function n(){var e,t=r.code,a=t&&0===t.indexOf("$(function()"),n=r.html,s=r.header;return p||(s=s?s.replace(/^\S/gm," $&"):"",e=l||s&&!d?"":' <link href="samples.css" rel="stylesheet" />\n',s="append"===d?e+s:s+e),'<!DOCTYPE html>\n<!-- To run the current sample code in your own environment, copy this to an html page. -->\n\n<html>\n<head>\n <script src="//code.jquery.com/jquery-3.6.1.min.js"></script>\n'+(p?' <base href="//www.jsviews.com/'+p.slice(0,p.lastIndexOf("/"))+'/" />\n'+(a?"<script>\n"+t+"\n</script>\n":""):("jqui"===c?' <script src="//code.jquery.com/ui/1.13.2/jquery-ui.min.js"></script>\n <link href="//code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css" rel="stylesheet" />\n':"")+' <base href="//www.jsviews.com/samples/" />\n <script src="../download/js'+("jsr"===c?"render":"views")+'.min.js"></script>\n'+("jqui"===c?' <script src="../download/sample-tag-controls/jsviews-jqueryui-widgets.min.js"></script>\n':""))+(s||"")+"</head>\n<body>\n\n"+(n?n+(t&&!a?"\n\n<script>\n"+t+"\n</script>":""):r.markup?'<div id="result"></div>\n\n<script id="theTmpl" type="text/x-jsrender">\n'+r.markup+"\n</script>\n\n<script>\nvar data = "+stringify(r.data)+';\n\nvar template = $.templates("#theTmpl");\n\n'+("jsr"===c?'var htmlOutput = template.render(data);\n\n$("#result").html(htmlOutput);':'template.link("#result", data);')+"\n</script>":"")+"\n\n</body>\n</html>\n"}function s(e,t){var a=r[e],n="data"===e,s={code:"js",markup:"jsr",html:"jsr"};return a&&(a="<label>"+(t||e),a+=h?':<textarea data-link="'+(n?"{stringify:tryItData."+e+":parse}":"tryItData."+e)+'"></textarea></label>':":<pre>"+(n?hljs.highlight("json",stringify(r[e])).value:hljs.highlight(s[e]||"javascript",r[e]).value)+"</pre></label>"),a||""}var o="",r=this.data,i=this.tagCtx.view.data.origData,c=i.jsrJsvJqui,l=i.nocss,d=i.action,h="edit"===e,p=this.parent.parents.section.data.url;return"full"===e?o+='<textarea class="fullcode">'+htmlConverter(n())+"</textarea>":"code"===e?o+=s(t,a):r.html?o+=s("html")+s("code","javascript"):r.markup&&(o+=s("markup","template markup")+s("data")),o}},templates={page:$.templates({markup:"#pageTmpl",tags:{sectionButtons:sectionButtonsTag,sectionHeader:sectionHeaderTag,sectionTitle:sectionTitleTag},converters:{newsearch:function(e){return e.toLowerCase()}}})},sectionTemplates={summary:{para:$.templates("#paraTmpl"),api:$.templates({markup:"#apiTmpl",helpers:{signature:signature}}),tag:$.templates({markup:"#tagTmpl",helpers:{signature:signature}}),data:$.templates("#dataTmpl"),template:$.templates({markup:"#templateTmpl"}),code:$.templates("#codeTmpl"),sample:$.templates({markup:"#sampleTmpl",tags:{sampleFrame:sampleFrameTag,sampleFields:sampleFieldsTag},helpers:{tabsTmpl:function(){var e,t=this.data.codetabs||[],a=t.length,n='{^{tabs tabCaption="How it works"}}{{for ~sections}}{{if ~mode!=="summary" || !detail}}{^{section _type ~mode /}}{{/if}}{{/for}}{{else tabCaption="Code"}}<div class="code">{{sampleFields/}}</div>';for(e=0;e<a;e++)n+='{{else tabCaption="'+t[e].label+'"}}<div class="codetab">{{sampleFields "code" "c'+e+'" "'+t[e].url+'"/}}</div>';return n+='{{else tabCaption="Full Code"}}{{sampleFields "full"/}}{{else tabCaption="Try it"}}<div class="runButtons"><em>Try it:</em> make changes below, then run... <button class="runSample" data-link="disabled{:!ranIt}">Run code</button><button class="revertSample" data-link="disabled{:!ranIt}">Clear changes</button></div><div class="try">{{sampleFields "edit"/}}</div>{{/tabs}}'}}}),links:$.templates({markup:"#linksTmpl",helpers:{url:function(e){return location.pathname+"#"+e}}})},edit:{para:$.templates("#editParaTmpl"),api:$.templates("#editApiTmpl"),tag:$.templates("#editTagTmpl"),data:$.templates("#editDataTmpl"),template:$.templates("#editTemplateTmpl"),code:$.templates("#editCodeTmpl"),sample:$.templates("#editSampleTmpl"),links:$.templates("#editLinksTmpl")}},testDiv=$("#testHtml")[0];document.onkeydown=function(e){e=e||window.event;var t=e.keyCode;e.altKey||e.shiftKey||(27===t?content.searchTree.close():e.ctrlKey&&(content.search&&(39===t?content.searchTree.next():37===t&&content.searchTree.prev()),191===t&&(searchbox.focus(),window.scrollTo(0,0))))},treeGroup.prototype={select:function(e){e&&this.selected!==e&&(location.hash="search?s="+lowerCaseEncodeURI(content.search)+searchIncludeHash()+"&l="+e,searchtextElem.addClass("selected"))},unselect:function(){location.hash="search?s="+lowerCaseEncodeURI(content.search)+searchIncludeHash(),searchtextElem.removeClass("selected")},changing:function(e,t){var a=" ",n=t.value;return n&&(a=n!==content.search?"<b>Enter</b>: Search...<br/><b>Escape</b>: Quit<br/><b>Ctrl+Left/Right Arrow</b>: Prev/Next result":""),$.observable(content).setProperty("noSearch",a),!1},onEnter:function(e,t){var a,n=e.target.value;if(13===e.keyCode&&n&&!content.editable)return a=content.search!==n,n="#search?s="+lowerCaseEncodeURI(n)+searchIncludeHash(),void(location.hash!==n&&(location.hash=n,$.observable(content).setProperty("noSearch",a?"Loading...":"")))},prev:function(){$("#prev").focus();var e=this.sectionIndex===undefined?content.filterlen-1:this.sectionIndex-1;e>=0?this.select(content.filter[e].section):e===-1&&this.unselect()},next:function(){$("#next").focus();var e=this.sectionIndex===undefined?0:this.sectionIndex+1;e<content.filterlen?this.select(content.filter[e].section):e===content.filterlen&&this.unselect()},close:function(){var e=searchRegex.exec(location.hash);location.hash=e&&e[7]||topCategoryName},mouseenter:function(e,t,a){var n=a.linkCtx.data;$.observable(content).setProperty({hoverText:n.text,hoverTopicSel:this.topicName===e}),hoverTextElem.show().offset({top:a.linkCtx.elem.offsetTop+searchNavElem.offset().top-searchNavElem.scrollTop()})},mouseleave:function(e,t){hoverTextElem.hide()},mousewheel:function(e,t){hoverTextElem.hide(),e.preventDefault(),searchNavElem.scrollTop(searchNavElem.scrollTop()+e.originalEvent.deltaY)},click:function(e,t){var a=searchNavElem.position().left+10;hoverTextElem.hide(),isSearchTreeSelectionChange=!0,this.select($.view(document.elementFromPoint(a,e.clientY)).data.section)}},sectionTemplates.editview=sectionTemplates.detail=sectionTemplates.summary,sectionTag.templates=sectionTemplates,$.views.tags({page:pageTag,section:sectionTag,searchTree:searchTreeTag,searchTreeNode:searchTreeNodeTag}),$.views.helpers({stringify:stringify}),$.views.converters({stringify:stringify,getContent:getContent,syntax:function(e){return"<pre>"+hljs.highlight(this.tagCtx.args[1],e).value+"</pre>"},parse:parse,md:function(e){return md.render(e)}}),topSearchTree=content.searchTree=new treeGroup,setTimeout(function(){$("#initial-load").html("Loading...")},2e3),fetchCategory().then(function(){for(var e,t=content.categories,a=t.length;a--;)t[a].loadedfind=t[a].loadingfind=undefined;content.topCategory=topCategory||selectedCategory,templates.page.link("#id-content",content,{templates:templates}),searchtextElem=$("#searchtext"),searchbox=$("#id-searchbox"),searchNavElem=$(".searchnav"),sideNavElem=$(".sidenav"),hoverTextElem=$("#hovertext"),"scrollRestoration"in history&&(history.scrollRestoration="manual"),$(window).on("hashchange",fetchCategory).on("unload",save),$.observe(searchInclude,"jsr","jsv","smp","txt",function(e,t){location.hash="search?s="+searchRegex.exec(location.hash)[1]+searchIncludeHash()}),$("#logo-"+topCategory.key).removeClass("unselected").addClass("selected"),e=$(".main-item.selected"),page.navTo(location.hash),$(".main-item").on("click",function(){e.removeClass("selected").addClass("unselected"),e=$(this).addClass("selected").removeClass("unselected"),location.hash=this.id.slice(5)}),loadedAll||setTimeout(function(){loadAllContent()})})}(this,this.jQuery);
//# sourceMappingURL=index.min.js.map