diff --git a/assets/js/app.js b/assets/js/app.js index 24b7c53..c1b7c69 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -35,7 +35,7 @@ }, specialMime: { markdown: ['markdown', 'mdown', 'mkdn', 'md', 'mkd', 'mdwn', 'mdtxt', 'mdtext', 'text'], - images: ['jpg', 'jpeg', 'gif', 'png', 'bmp'], + image: ['jpg', 'jpeg', 'gif', 'png', 'bmp'], markup: ['htm', 'html', 'xhtml'] }, githubDataBuffer: null @@ -123,10 +123,10 @@ setHighlight: function(target) { $('.sidebar ul.nav li').removeClass('active'); - var tLi = target.parent(); + let tLi = target.parent(); tLi.addClass('active'); - var tParent = tLi.parents('li'); + let tParent = tLi.parents('li'); while (tParent.length > 0) { tParent.addClass('active hide-before-after'); tParent = tParent.parents('li'); @@ -154,12 +154,6 @@ if (!s.useDummyData) octaDoc.helper.github.getFilesAndDirFromDocDir(function(data) { dataProcessor(data); - // s.githubDataBuffer = data; - - // data = octaDoc.helper.dataParser.sideMenu.menuDataBuilder(data.tree); - // data = octaDoc.ui.sideMenu.build.constructDom(data); - - // if (cb) cb(data); }); else { @@ -167,14 +161,7 @@ url: _o_.string.concat('dummy-menu.json?random=', Math.floor(Math.random() * 10000)), success: function(xhr) { if (!xhr.responseText) return; - xhr = JSON.parse(xhr.responseText); - // s.githubDataBuffer = xhr; - - // xhr = octaDoc.helper.dataParser.sideMenu.menuDataBuilder(xhr.tree); - // xhr = octaDoc.ui.sideMenu.build.constructDom(xhr); - - // if (cb) cb(xhr); dataProcessor(xhr); } }); @@ -288,7 +275,7 @@ $('a#document-title').text(data); }, content: function(data) { - if (s.specialMime.images.indexOf(data.extension) !== -1) { + if (s.specialMime.image.indexOf(data.extension) !== -1) { $('div#document-wrapper').html( _o_.string.format('', data.extension, data.content) ); diff --git a/assets/js/app.min.js b/assets/js/app.min.js index 854703a..4aee96b 100644 --- a/assets/js/app.min.js +++ b/assets/js/app.min.js @@ -18,4 +18,4 @@ * */ -(function(w,d,s){'use strict';s=Object.assign(s,{execScript:true,useDummyData:false,octapushJS:{pluginUrl:'https://cdn.rawgit.com/octapush/octapushJS/418319e3/plugins/',loadPlugin:['array']},specialMime:{markdown:['markdown','mdown','mkdn','md','mkd','mdwn','mdtxt','mdtext','text'],images:['jpg','jpeg','gif','png','bmp'],markup:['htm','html','xhtml']},githubDataBuffer:null});var h={register:function(){if(s.execScript)h.events.register.apply()},ui:{register:function(a){if(_o_.string.isEqual(a,'load',false)){h.ui.document.register.apply();h.ui.sideMenu.appearances.color.apply()}else if(_o_.string.isEqual(a,'ready',false)){h.ui.sideMenu.register(function(){h.ui.page.init.apply()})}},document:{register:function(){h.helper.dataParser.appTitleCase.apply();h.ui.document.title.apply();h.ui.document.initScrollbar.apply();h.ui.page.footer.apply()},title:function(a){let title=s.title;if(_o_.string.isEqual(s.behaviour.common.docTitleType,'page',false)&&!_o_.compare.isNullOrEmpty(a))title=_o_.utility.ifNull(a,s.title);else if(_o_.string.isEqual(s.behaviour.common.docTitleType,'combine',false)&&!_o_.compare.isNullOrEmpty(a))title=_o_.string.format('{1} {2} {3}',s.title,s.behaviour.common.docTitleCombineSeparator,a);$('head > title').text(title)},initScrollbar:function(){$('div.main-panel').css('overflow','hidden !important').perfectScrollbar()}},sideMenu:{register:function(a){h.ui.sideMenu.title.apply();h.ui.sideMenu.build.init(function(){h.ui.sideMenu.appearances.case.apply();h.events.sideMenu.hamburger.click.apply();if(a)a()})},title:function(){$('.sidebar .logo a').text(s.title)},appearances:{color:function(){$('.sidebar').attr({'data-background-color':s.behaviour.sideMenu.background,'data-active-color':s.behaviour.sideMenu.color});$('.off-canvas-sidebar').attr({'data-background-color':s.behaviour.sideMenu.background,'data-active-color':s.behaviour.sideMenu.color})},case:function(){$('.sidebar ul.nav p').removeClass('capitalize uppercase lowercase').addClass(_o_.string.toLower(s.behaviour.sideMenu.textCase));h.ui.plugins.perfectScrollbar.init('#sidebar-wrap')}},setHighlight:function(a){$('.sidebar ul.nav li').removeClass('active');var b=a.parent();b.addClass('active');var c=b.parents('li');while(c.length>0){c.addClass('active hide-before-after');c=c.parents('li')}},build:{init:function(b){h.ui.sideMenu.build.fetchItems(function(a){$('.sidebar ul.nav').html(a);h.events.sideMenu.menuItem.register.apply();if(b)b(a)})},fetchItems:function(b){if(!s.useDummyData)h.helper.github.getFilesAndDirFromDocDir(function(a){s.githubDataBuffer=a;a=h.helper.dataParser.sideMenu.menuDataBuilder(a.tree);a=h.ui.sideMenu.build.constructDom(a);if(b)b(a)});else{_o_.ajax.get({url:_o_.string.concat('dummy-menu.json?random=',Math.floor(Math.random()*10000)),success:function(a){if(!a.responseText)return;a=JSON.parse(a.responseText);s.githubDataBuffer=a;a=h.helper.dataParser.sideMenu.menuDataBuilder(a.tree);a=h.ui.sideMenu.build.constructDom(a);if(b)b(a)}})}},constructDom:function(f){var g='';_o_.utility.each(f,function(a,b){if(_o_.compare.isString(b)){var c=a.split('.');if(s.behaviour.sideMenu.useNumberOnFileNameToSort===true)c=_o_.array.removeFirst(c,1);var d=_o_.array.removeLast(c,0).join('');g+=_o_.string.format('
  • {2}

  • ',b,d)}else{var e=_o_.string.concat('
  • ','','
  • ');if(s.behaviour.sideMenu.useNumberOnFileNameToSort===true)a=_o_.array.removeFirst(a.split('.'),1).join('');g+=_o_.string.format(e,a,_o_.string.dasherize(a))}});return g}}},page:{init:function(){var b=h.helper.utility.hash.get(true);var c='';if(_o_.compare.isArray(b)&&!_o_.string.isEqual(b[0],'')){c=_o_.array.takeFirst(b,1)[0];var d=h.helper.dataParser.sideMenu.getExtensionFromPath(c);var e=h.helper.dataParser.sideMenu.getFileTitle(c);h.helper.github.readFile(h.helper.dataParser.sideMenu.getUrlByPath(c),function(a){h.ui.page.update({title:e,extension:d,content:a})})}else{c=s.behaviour.page.pathOfInitialPage;if(_o_.string.isEqual(c,'first-menu-item',false)){c=$('ul.nav li:first a:first').attr('href').substr(1);$('ul.nav li:first a:first').trigger('click')}else{h.helper.github.readFile(h.helper.dataParser.sideMenu.getUrlByPath(c),function(a){h.ui.page.update({title:s.title,extension:h.helper.dataParser.sideMenu.getExtensionFromPath(c),content:a})})}}h.ui.sideMenu.setHighlight($(_o_.string.format('ul.nav a[href="#{1}"]',decodeURI(c))))},update:function(a){if(s.behaviour.common.docTitleType)h.ui.document.title(decodeURI(a.title));h.ui.page.header(a.title);h.ui.page.content(a)},header:function(a){a=decodeURI(a);switch(_o_.string.toLower(s.behaviour.page.titleCase)){case'capitalize':a=_o_.string.capitalize(a,true);break;case'uppercase':a=_o_.string.toUpper(a);break;case'lowercase':a=_o_.string.toLower(a);break;default:break}$('a#document-title').text(a)},content:function(a){if(s.specialMime.images.indexOf(a.extension)!==-1){$('div#document-wrapper').html(_o_.string.format('',a.extension,a.content))}else{a.content=h.helper.utility.base64.decode(a.content);if(s.specialMime.markdown.indexOf(a.extension)!==-1){$('div#document-wrapper').html((new showdown.Converter({openLinksInNewWindow:s.behaviour.common.openExternalLinkOnNewTab,simplifiedAutoLink:s.behaviour.page.markdown.encodeUrls,encodeEmails:s.behaviour.page.markdown.encodeEmails,ghCompatibleHeaderId:true,tables:true})).makeHtml(a.content))}else if(s.specialMime.markup.indexOf(a.extension)!==-1){$('div#document-wrapper').html('
    ');h.events.page.iframe.load(a.content)}else{$('div#document-wrapper').html(_o_.string.format('
    {1}
    ',a.content))}h.ui.page.wrapComponents.apply();h.ui.plugins.hljs.reInit.apply();h.events.page.anchors.click.apply()}var b=h.helper.utility.hash.get(true);if(b.length<2){$('div.main-panel').scrollTop(0)}else{b=_o_.array.takeLast(b,1)[0];h.helper.utility.hash.scroll(_o_.string.concat('#',b))}h.ui.plugins.perfectScrollbar.update('div.main-panel')},wrapComponents:function(){$('div#document-wrapper.content table').addClass(_o_.string.format('table {1}',s.behaviour.page.markdown.stripTable===true?'table-striped':'')).wrap('
    ');$('div#document-wrapper.content img').addClass('center-block').css('max-width','100%').wrap('
    ')},footer:function(c){var d='';_o_.utility.each(s.behaviour.footerLinks,function(a,b){b.target=s.behaviour.common.openExternalLinkOnNewTab?'target="_blank"':' ';d+=_o_.string.template('
  • {{title}}
  • ',b)});$('.footer > .container-fluid > nav').html(_o_.string.format('',d))}},plugins:{hljs:{reInit:function(){hljs.initHighlighting.called=false;hljs.initHighlighting();h.ui.plugins.perfectScrollbar.reInit('pre > code.ps-add, iframe-ps.add')}},perfectScrollbar:{init:function(a){a=$(a);if(a.length>0)a.perfectScrollbar()},reInit:function(a){a=$(a);if(a.length>0){a.perfectScrollbar('destroy');a.perfectScrollbar()}},update:function(a){a=$(a);if(a.length>0)a.perfectScrollbar('update')}}}},events:{register:function(){h.events.document.register.apply()},document:{register:function(){w.onLoad=h.events.document.load(function(){h.events.document.ready.apply()})},load:function(a){h.ui.register('load');_o_.settings.pluginsPath=s.octapushJS.pluginUrl;_o_.utility.importPlugin(s.octapushJS.loadPlugin,function(){if(a)a()})},ready:function(){$(function(){h.ui.register('ready')})}},sideMenu:{hamburger:{click:function(){h.helper.events.rebind({target:'button.navbar-toggle',eventName:'click',fn:function(){$('#sidebar-wrap').fadeToggle(function(){if(_o_.string.isEqual($('#sidebar-wrap').css('display'),'none',false)){$('div.main-panel').css('width','100%')}else{$('div.main-panel').css('width','calc(100% - 260px)');h.ui.plugins.perfectScrollbar.reInit('#sidebar-wrap')}})}})}},logo:{click:function(){}},menuItem:{register:function(){h.events.sideMenu.menuItem.click.apply();h.events.sideMenu.menuItem.parent.register.apply()},click:function(){h.helper.events.rebind({target:'.sidebar ul.nav a',eventName:'click',fn:function(e){var b=$(this);var c=b.data('toggle')!==undefined;var d=_o_.string.removeLeft(b.attr('href'),1);if(!c){Pace.restart();h.ui.sideMenu.setHighlight(b);h.helper.utility.hash.set(d);h.helper.github.readFile(h.helper.dataParser.sideMenu.getUrlByPath(d),function(a){h.ui.page.update({title:h.helper.dataParser.sideMenu.getFileTitle(d),extension:h.helper.dataParser.sideMenu.getExtensionFromPath(d),content:a})});return false}}})},parent:{register:function(){h.events.sideMenu.menuItem.parent.hidden.apply();h.events.sideMenu.menuItem.parent.shown.apply()},hidden:function(){h.helper.events.rebind({target:$('.sidebar ul.nav a[data-toggle="collapse"]').parents('li').find('div.collapse'),eventName:'hidden.bs.collapse',fn:function(e){h.ui.plugins.perfectScrollbar.update('#sidebar-wrap')}})},shown:function(){h.helper.events.rebind({target:$('.sidebar ul.nav a[data-toggle="collapse"]').parents('li').find('div.collapse'),eventName:'shown.bs.collapse',fn:function(e){h.ui.plugins.perfectScrollbar.update('#sidebar-wrap')}})}}}},page:{iframe:{load:function(a){h.helper.events.rebind({target:'#page-iframe',eventName:'load',fn:function(){if(a)$(this).contents().find('body').html(a)}})}},anchors:{click:function(){h.helper.events.rebind({target:'div.main-panel a[href]',eventName:'click',fn:function(e){e.preventDefault();let that=$(this);let href=that.attr('href');if(_o_.string.isStartsWith(href,'mailto:')){return true}else if(_o_.string.isStartsWith(href,'#')){if(_o_.string.isContain(href,'/')){let nHref=href.substr(2);var b=h.helper.dataParser.sideMenu.getUrlByPath(nHref);if(!b){alert('Invalid Url.');return}Pace.restart();h.ui.sideMenu.setHighlight($(_o_.string.format('ul.nav li a[href="#{1}"]',nHref)));h.helper.utility.hash.set(nHref);h.helper.github.readFile(b,function(a){h.ui.page.update({title:h.helper.dataParser.sideMenu.getFileTitle(b),extension:h.helper.dataParser.sideMenu.getExtensionFromPath(nHref),content:a})})}else{h.helper.utility.hash.scroll(href,function(){h.ui.plugins.perfectScrollbar.update('div.main-panel')})}return false}else{let win=w.open(href);if(win)win.focus();else alert('Please allow popup for this site.');return false}}})}}}},helper:{utility:{base64:{encode:function(c){return _o_.compare.isNullOrEmpty(c)?'':btoa(encodeURIComponent(c).replace(/%([0-9A-F]{2})/g,function(a,b){return String.fromCharCode(_o_.string.concat('0x',b))}))},decode:function(a){return _o_.compare.isNullOrEmpty(a)?'':decodeURIComponent(atob(a).split('').map(function(c){return _o_.string.concat('%',(_o_.string.concat('00',c.charCodeAt(0).toString(16))).slice(-2))}).join(''))}},hash:{location:function(a){return!_o_.utility.ifNull(a,false)?(w.location).toString():w.location.toString().replace(w.location.hash,'')},get:function(a){return _o_.utility.ifNull(a,true)?w.location.hash.substr(1).split('#'):w.location.hash},set:function(a,b){b=_o_.utility.ifNull(b,true);if(!_o_.string.isStartsWith(a,'#'))a=_o_.string.concat('#',a);if(b){w.location.hash=a}else{if(w.location.hash.toString().indexOf(a)===-1)w.location.hash=_o_.string.format('{1}{2}',h.helper.utility.hash.get(),a)}},scroll:function(a,b){if($(a).length>0){$('div.main-panel').scrollTop(0).stop().animate({scrollTop:$(a).offset().top},s.behaviour.common.scrollSpeed,function(){h.helper.utility.hash.set(a,false);if(b)b()})}}},isMobileBrowser:function(){if(navigator.userAgent.match(/Android/i)||navigator.userAgent.match(/webOS/i)||navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/iPod/i)||navigator.userAgent.match(/BlackBerry/i)||navigator.userAgent.match(/Windows Phone/i))return true;else return false}},github:{getDocDirectoryUrl:function(b){_o_.ajax.get({url:_o_.string.template('https://api.github.com/repos/{{owner}}/{{project}}/git/trees/{{branch}}',s.githubData),success:function(a){if(!a.responseText)return;a=JSON.parse(a.responseText);a.tree=a.tree.filter(function(i){if(_o_.string.isEqual(i.path,s.githubData.docDirectory))return i});if((a.tree).length>0&&b)b(a.tree[0].url)}})},getFilesAndDirFromDocDir:function(c){h.helper.github.getDocDirectoryUrl(function(b){if(!b)alert('Please refine your "githubData" from "config.js" file.');else _o_.ajax.get({url:_o_.string.format('{1}?recursive=1',b),success:function(a){if(!a.responseText)return;a=JSON.parse(a.responseText);if(c)c(a)}})})},readFile:function(b,c){_o_.ajax.get({url:b,success:function(a){if(!a.responseText)return;a=JSON.parse(a.responseText);if(c)c(a.content)}})}},events:{rebind:function(a){$(a.target).off(a.eventName).on(a.eventName,a.fn)}},dataParser:{arrayContainString:function(a,b){b=_o_.string.toLower(b);a=a.map(function(i){return _o_.string.toLower(i)});for(let i=0;i0&&!h.helper.dataParser.arrayContainString(s.behaviour.sideMenu.hideFilesOrDirectory,i.path)){if(_o_.string.isEqual(i.type,'tree')){if(!s.behaviour.sideMenu.hideEmptyDirectory)return i}else{if(s.behaviour.sideMenu.showMdFilesOnly){return i}else{if(_o_.string.isEndsWith(_o_.string.toLower(i.path),'.md'))return i}}}})},insertAdditionals:function(a){let before=(s.behaviour.sideMenu.before).reverse();if(before.length>0)for(let i=0;i0)for(let i=0;i title').text(title)},initScrollbar:function(){$('div.main-panel').css('overflow','hidden !important').perfectScrollbar()}},sideMenu:{register:function(a){h.ui.sideMenu.title.apply();h.ui.sideMenu.build.init(function(){h.ui.sideMenu.appearances.case.apply();h.events.sideMenu.hamburger.click.apply();if(a)a()})},title:function(){$('.sidebar .logo a').text(s.title)},appearances:{color:function(){$('.sidebar').attr({'data-background-color':s.behaviour.sideMenu.background,'data-active-color':s.behaviour.sideMenu.color});$('.off-canvas-sidebar').attr({'data-background-color':s.behaviour.sideMenu.background,'data-active-color':s.behaviour.sideMenu.color})},case:function(){$('.sidebar ul.nav p').removeClass('capitalize uppercase lowercase').addClass(_o_.string.toLower(s.behaviour.sideMenu.textCase));h.ui.plugins.perfectScrollbar.init('#sidebar-wrap')}},setHighlight:function(a){$('.sidebar ul.nav li').removeClass('active');let tLi=a.parent();tLi.addClass('active');let tParent=tLi.parents('li');while(tParent.length>0){tParent.addClass('active hide-before-after');tParent=tParent.parents('li')}},build:{init:function(b){h.ui.sideMenu.build.fetchItems(function(a){$('.sidebar ul.nav').html(a);h.events.sideMenu.menuItem.register.apply();if(b)b(a)})},fetchItems:function(b){function dataProcessor(a){s.githubDataBuffer=a;a=h.helper.dataParser.sideMenu.menuDataBuilder(a.tree);a=h.ui.sideMenu.build.constructDom(a);if(b)b(a)}if(!s.useDummyData)h.helper.github.getFilesAndDirFromDocDir(function(a){dataProcessor(a)});else{_o_.ajax.get({url:_o_.string.concat('dummy-menu.json?random=',Math.floor(Math.random()*10000)),success:function(a){if(!a.responseText)return;a=JSON.parse(a.responseText);dataProcessor(a)}})}},constructDom:function(f){var g='';_o_.utility.each(f,function(a,b){if(_o_.compare.isString(b)){var c=a.split('.');if(s.behaviour.sideMenu.useNumberOnFileNameToSort===true)c=_o_.array.removeFirst(c,1);var d=_o_.array.removeLast(c,0).join('');g+=_o_.string.format('
  • {2}

  • ',b,d)}else{var e=_o_.string.concat('
  • ','','
  • ');if(s.behaviour.sideMenu.useNumberOnFileNameToSort===true)a=_o_.array.removeFirst(a.split('.'),1).join('');g+=_o_.string.format(e,a,_o_.string.dasherize(a))}});return g}}},page:{init:function(){var b=h.helper.utility.hash.get(true);var c='';if(_o_.compare.isArray(b)&&!_o_.string.isEqual(b[0],'')){c=_o_.array.takeFirst(b,1)[0];var d=h.helper.dataParser.sideMenu.getExtensionFromPath(c);var e=h.helper.dataParser.sideMenu.getFileTitle(c);h.helper.github.readFile(h.helper.dataParser.sideMenu.getUrlByPath(c),function(a){h.ui.page.update({title:e,extension:d,content:a})})}else{c=s.behaviour.page.pathOfInitialPage;if(_o_.string.isEqual(c,'first-menu-item',false)){c=$('ul.nav li:first a:first').attr('href').substr(1);$('ul.nav li:first a:first').trigger('click')}else{h.helper.github.readFile(h.helper.dataParser.sideMenu.getUrlByPath(c),function(a){h.ui.page.update({title:s.title,extension:h.helper.dataParser.sideMenu.getExtensionFromPath(c),content:a})})}}h.ui.sideMenu.setHighlight($(_o_.string.format('ul.nav a[href="#{1}"]',decodeURI(c))))},update:function(a){if(s.behaviour.common.docTitleType)h.ui.document.title(decodeURI(a.title));h.ui.page.header(a.title);h.ui.page.content(a)},header:function(a){a=decodeURI(a);switch(_o_.string.toLower(s.behaviour.page.titleCase)){case'capitalize':a=_o_.string.capitalize(a,true);break;case'uppercase':a=_o_.string.toUpper(a);break;case'lowercase':a=_o_.string.toLower(a);break;default:break}$('a#document-title').text(a)},content:function(a){if(s.specialMime.image.indexOf(a.extension)!==-1){$('div#document-wrapper').html(_o_.string.format('',a.extension,a.content))}else{a.content=h.helper.utility.base64.decode(a.content);if(s.specialMime.markdown.indexOf(a.extension)!==-1){$('div#document-wrapper').html((new showdown.Converter({openLinksInNewWindow:s.behaviour.common.openExternalLinkOnNewTab,simplifiedAutoLink:s.behaviour.page.markdown.encodeUrls,encodeEmails:s.behaviour.page.markdown.encodeEmails,ghCompatibleHeaderId:true,tables:true})).makeHtml(a.content))}else if(s.specialMime.markup.indexOf(a.extension)!==-1){$('div#document-wrapper').html('
    ');h.events.page.iframe.load(a.content)}else{$('div#document-wrapper').html(_o_.string.format('
    {1}
    ',a.content))}h.ui.page.wrapComponents.apply();h.ui.plugins.hljs.reInit.apply();h.events.page.anchors.click.apply()}var b=h.helper.utility.hash.get(true);if(b.length<2){$('div.main-panel').scrollTop(0)}else{b=_o_.array.takeLast(b,1)[0];h.helper.utility.hash.scroll(_o_.string.concat('#',b))}h.ui.plugins.perfectScrollbar.update('div.main-panel')},wrapComponents:function(){$('div#document-wrapper.content table').addClass(_o_.string.format('table {1}',s.behaviour.page.markdown.stripTable===true?'table-striped':'')).wrap('
    ');$('div#document-wrapper.content img').addClass('center-block').css('max-width','100%').wrap('
    ')},footer:function(c){var d='';_o_.utility.each(s.behaviour.footerLinks,function(a,b){b.target=s.behaviour.common.openExternalLinkOnNewTab?'target="_blank"':' ';d+=_o_.string.template('
  • {{title}}
  • ',b)});$('.footer > .container-fluid > nav').html(_o_.string.format('
      {1}
    ',d))}},plugins:{hljs:{reInit:function(){hljs.initHighlighting.called=false;hljs.initHighlighting();h.ui.plugins.perfectScrollbar.reInit('pre > code.ps-add, iframe-ps.add')}},perfectScrollbar:{init:function(a){a=$(a);if(a.length>0)a.perfectScrollbar()},reInit:function(a){a=$(a);if(a.length>0){a.perfectScrollbar('destroy');a.perfectScrollbar()}},update:function(a){a=$(a);if(a.length>0)a.perfectScrollbar('update')}}}},events:{register:function(){h.events.document.register.apply()},document:{register:function(){w.onLoad=h.events.document.load(function(){h.events.document.ready.apply()})},load:function(a){h.ui.register('load');_o_.settings.pluginsPath=s.octapushJS.pluginUrl;_o_.utility.importPlugin(s.octapushJS.loadPlugin,function(){if(a)a()})},ready:function(){$(function(){h.ui.register('ready')})}},sideMenu:{hamburger:{click:function(){h.helper.events.rebind({target:'button.navbar-toggle',eventName:'click',fn:function(){$('#sidebar-wrap').fadeToggle(function(){if(_o_.string.isEqual($('#sidebar-wrap').css('display'),'none',false)){$('div.main-panel').css('width','100%')}else{$('div.main-panel').css('width','calc(100% - 260px)');h.ui.plugins.perfectScrollbar.reInit('#sidebar-wrap')}})}})}},logo:{click:function(){}},menuItem:{register:function(){h.events.sideMenu.menuItem.click.apply();h.events.sideMenu.menuItem.parent.register.apply()},click:function(){h.helper.events.rebind({target:'.sidebar ul.nav a',eventName:'click',fn:function(e){var b=$(this);var c=b.data('toggle')!==undefined;var d=_o_.string.removeLeft(b.attr('href'),1);if(!c){Pace.restart();h.ui.sideMenu.setHighlight(b);h.helper.utility.hash.set(d);h.helper.github.readFile(h.helper.dataParser.sideMenu.getUrlByPath(d),function(a){h.ui.page.update({title:h.helper.dataParser.sideMenu.getFileTitle(d),extension:h.helper.dataParser.sideMenu.getExtensionFromPath(d),content:a})});return false}}})},parent:{register:function(){h.events.sideMenu.menuItem.parent.hidden.apply();h.events.sideMenu.menuItem.parent.shown.apply()},hidden:function(){h.helper.events.rebind({target:$('.sidebar ul.nav a[data-toggle="collapse"]').parents('li').find('div.collapse'),eventName:'hidden.bs.collapse',fn:function(e){h.ui.plugins.perfectScrollbar.update('#sidebar-wrap')}})},shown:function(){h.helper.events.rebind({target:$('.sidebar ul.nav a[data-toggle="collapse"]').parents('li').find('div.collapse'),eventName:'shown.bs.collapse',fn:function(e){h.ui.plugins.perfectScrollbar.update('#sidebar-wrap')}})}}}},page:{iframe:{load:function(a){h.helper.events.rebind({target:'#page-iframe',eventName:'load',fn:function(){if(a)$(this).contents().find('body').html(a)}})}},anchors:{click:function(){h.helper.events.rebind({target:'div.main-panel a[href]',eventName:'click',fn:function(e){e.preventDefault();let that=$(this);let href=that.attr('href');if(_o_.string.isStartsWith(href,'mailto:')){return true}else if(_o_.string.isStartsWith(href,'#')){if(_o_.string.isContain(href,'/')){let nHref=href.substr(2);var b=h.helper.dataParser.sideMenu.getUrlByPath(nHref);if(!b){alert('Invalid Url.');return}Pace.restart();h.ui.sideMenu.setHighlight($(_o_.string.format('ul.nav li a[href="#{1}"]',nHref)));h.helper.utility.hash.set(nHref);h.helper.github.readFile(b,function(a){h.ui.page.update({title:h.helper.dataParser.sideMenu.getFileTitle(b),extension:h.helper.dataParser.sideMenu.getExtensionFromPath(nHref),content:a})})}else{h.helper.utility.hash.scroll(href,function(){h.ui.plugins.perfectScrollbar.update('div.main-panel')})}return false}else{let win=w.open(href);if(win)win.focus();else alert('Please allow popup for this site.');return false}}})}}}},helper:{utility:{base64:{encode:function(c){return _o_.compare.isNullOrEmpty(c)?'':btoa(encodeURIComponent(c).replace(/%([0-9A-F]{2})/g,function(a,b){return String.fromCharCode(_o_.string.concat('0x',b))}))},decode:function(a){return _o_.compare.isNullOrEmpty(a)?'':decodeURIComponent(atob(a).split('').map(function(c){return _o_.string.concat('%',(_o_.string.concat('00',c.charCodeAt(0).toString(16))).slice(-2))}).join(''))}},hash:{location:function(a){return!_o_.utility.ifNull(a,false)?(w.location).toString():w.location.toString().replace(w.location.hash,'')},get:function(a){return _o_.utility.ifNull(a,true)?w.location.hash.substr(1).split('#'):w.location.hash},set:function(a,b){b=_o_.utility.ifNull(b,true);if(!_o_.string.isStartsWith(a,'#'))a=_o_.string.concat('#',a);if(b){w.location.hash=a}else{if(w.location.hash.toString().indexOf(a)===-1)w.location.hash=_o_.string.format('{1}{2}',h.helper.utility.hash.get(),a)}},scroll:function(a,b){if($(a).length>0){$('div.main-panel').scrollTop(0).stop().animate({scrollTop:$(a).offset().top},s.behaviour.common.scrollSpeed,function(){h.helper.utility.hash.set(a,false);if(b)b()})}}},isMobileBrowser:function(){if(navigator.userAgent.match(/Android/i)||navigator.userAgent.match(/webOS/i)||navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/iPod/i)||navigator.userAgent.match(/BlackBerry/i)||navigator.userAgent.match(/Windows Phone/i))return true;else return false}},github:{getDocDirectoryUrl:function(b){_o_.ajax.get({url:_o_.string.template('https://api.github.com/repos/{{owner}}/{{project}}/git/trees/{{branch}}',s.githubData),success:function(a){if(!a.responseText)return;a=JSON.parse(a.responseText);a.tree=a.tree.filter(function(i){if(_o_.string.isEqual(i.path,s.githubData.docDirectory))return i});if((a.tree).length>0&&b)b(a.tree[0].url)}})},getFilesAndDirFromDocDir:function(c){h.helper.github.getDocDirectoryUrl(function(b){if(!b)alert('Please refine your "githubData" from "config.js" file.');else _o_.ajax.get({url:_o_.string.format('{1}?recursive=1',b),success:function(a){if(!a.responseText)return;a=JSON.parse(a.responseText);if(c)c(a)}})})},readFile:function(b,c){_o_.ajax.get({url:b,success:function(a){if(!a.responseText)return;a=JSON.parse(a.responseText);if(c)c(a.content)}})}},events:{rebind:function(a){$(a.target).off(a.eventName).on(a.eventName,a.fn)}},dataParser:{arrayContainString:function(a,b){b=_o_.string.toLower(b);a=a.map(function(i){return _o_.string.toLower(i)});for(let i=0;i0&&!h.helper.dataParser.arrayContainString(s.behaviour.sideMenu.hideFilesOrDirectory,i.path)){if(_o_.string.isEqual(i.type,'tree')){if(!s.behaviour.sideMenu.hideEmptyDirectory)return i}else{if(s.behaviour.sideMenu.showMdFilesOnly){return i}else{if(_o_.string.isEndsWith(_o_.string.toLower(i.path),'.md'))return i}}}})},insertAdditionals:function(a){let before=(s.behaviour.sideMenu.before).reverse();if(before.length>0)for(let i=0;i0)for(let i=0;i - + \ No newline at end of file