Skip to content

Commit 8903c62

Browse files
committed
Load fuse via the same CDN as the other scripts
1 parent 2487343 commit 8903c62

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

docs/v2/index.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6560,8 +6560,7 @@ <h2 class="header">
65606560

65616561
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js" integrity="sha384-xBuQ/xzmlsLoJpyjoggmTEz8OWUFM0/RC5BsqQBDX2v5cMvDHcMakNTNrHIW2I5f" crossorigin="anonymous"></script>
65626562
<script src="//stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js" integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm" crossorigin="anonymous"></script>
6563-
<script src="//cdn.jsdelivr.net/combine/npm/[email protected]/lib/codemirror.js,npm/[email protected]/mode/coffeescript/coffeescript.js,npm/[email protected]/addon/lint/coffeescript-lint.js,npm/[email protected]/mode/javascript/javascript.js"></script>
6564-
<script src="//cdnjs.cloudflare.com/ajax/libs/fuse.js/3.0.4/fuse.min.js"></script>
6563+
<script src="//cdn.jsdelivr.net/combine/npm/[email protected]/lib/codemirror.js,npm/[email protected]/mode/coffeescript/coffeescript.js,npm/[email protected]/addon/lint/coffeescript-lint.js,npm/[email protected]/mode/javascript/javascript.js,npm/[email protected]/dist/fuse.min.js"></script>
65656564
<script src="browser-compiler/coffeescript.js"></script>
65666565
<script>
65676566
(function(){window.location.origin||(window.location.origin=window.location.protocol+'//'+window.location.hostname),window.GA_TRACKING_ID='UA-106156830-1',null==window.dataLayer&&(window.dataLayer=[]),window.gtag=function(){window.dataLayer.push(arguments)},window.gtag('js',new Date),window.gtag('config',window.GA_TRACKING_ID),$(document).ready(function(){var buildSearch,clearHash,closeTry,editors,initializeEditor,initializeScrollspyFromHash,initializeTryEditors,lastCompilationElapsedTime,previousHash,replaceState,textareas,toggleSidebar,toggleTry;return toggleSidebar=function(){return $('.navbar-toggler, .sidebar').toggleClass('show')},$('[data-toggle="offcanvas"]').click(toggleSidebar),$('[data-action="sidebar-nav"]').click(function(event){return $('.navbar-toggler').is(':visible')&&(event.preventDefault(),toggleSidebar(),setTimeout(function(){return window.location=event.target.href},260)),gtag('event','sidebar_navigate',{event_category:'navigation',event_label:event.target.href.replace(window.location.origin,'')})}),$('.main').scrollspy({target:'#contents',offset:Math.round($('main').css('padding-top').replace('px',''))}),initializeScrollspyFromHash=function(hash){return $('#contents a.active[href!=\''+hash+'\']').removeClass('show')},$('.main').on('activate.bs.scrollspy',function(event,target){var $target;if($('#contents a.active[href!=\''+target.relatedTarget+'\']').removeClass('show'),$target=$('#contents a[href=\''+target.relatedTarget+'\']'),$target.prop('href')!==window.location.origin+'/#try')return replaceState($target.prop('href')),gtag('config',GA_TRACKING_ID,{page_path:$target.prop('href').replace(window.location.origin,'')})}),textareas=[],editors=[],lastCompilationElapsedTime=200,$('textarea').each(function(index){return textareas[index]=this,$(this).data('index',index)}),initializeEditor=function($textarea){var editor,index,mode,pending;if(index=$textarea.data('index'),mode=$textarea.hasClass('javascript-output')?'javascript':'coffeescript',editors[index]=editor=CodeMirror.fromTextArea($textarea[0],{mode:mode,theme:'twilight',indentUnit:2,tabSize:2,lineWrapping:!0,lineNumbers:!1,inputStyle:'contenteditable',readOnly:'coffeescript'!==mode,viewportMargin:2e308}),'coffeescript'===mode)return pending=null,editor.on('change',function(){return clearTimeout(pending),pending=setTimeout(function(){var coffee,exception,lastCompilationStartTime,link,output;lastCompilationStartTime=Date.now();try{if(coffee=editor.getValue(),0===index&&$('#try').hasClass('show')){$('#try').hasClass('show')&&(link='try:'+encodeURIComponent(coffee),replaceState(window.location.href.split('#')[0]+'#'+link));try{null!=window.localStorage&&window.localStorage.setItem('tryCoffeeScriptCode',coffee)}catch(error){exception=error}}output=CoffeeScript.compile(coffee,{bare:!0}),lastCompilationElapsedTime=Math.max(200,Date.now()-lastCompilationStartTime)}catch(error){exception=error,output=''+exception}return editors[index+1].setValue(output),gtag('event','edit_code',{event_category:'engagement',event_label:$textarea.closest('[data-example]').data('example')})},lastCompilationElapsedTime)}),editor.addKeyMap({Tab:function Tab(cm){return cm.somethingSelected()?cm.indentSelection('add'):/^\t/m.test(cm.getValue())?cm.execCommand('insertTab'):cm.execCommand('insertSoftTab')},"Shift-Tab":function ShiftTab(cm){return cm.indentSelection('subtract')},Enter:function Enter(cm){return cm.options.indentWithTabs=/^\t/m.test(cm.getValue()),cm.execCommand('newlineAndIndent')}})},$('.placeholder-code').one('mouseover',function(){var $siblingColumn,$textarea;return $textarea=$(this).prev('textarea'),$(this).remove(),initializeEditor($textarea),$siblingColumn=$($textarea.parent().siblings()[0]),$siblingColumn.children('.placeholder-code').remove(),initializeEditor($($siblingColumn.children('textarea')[0]))}),initializeTryEditors=function(){return initializeEditor($('#try-coffeescript-coffee')),initializeEditor($('#try-coffeescript-js'))},$('[data-action="run-code-example"]').click(function(){var index,js,run;return run=$(this).data('run'),index=$('#'+$(this).data('example')+'-js').data('index'),js=null==editors[index]?$(textareas[index]).val():editors[index].getValue(),!0!==run&&(js=js+'\nalert('+unescape(run)+');'),window.eval(js),gtag('event','run_code',{event_category:'engagement',event_label:$(this).closest('[data-example]').data('example')})}),previousHash=null,toggleTry=function(checkLocalStorage){var coffee,exception;if($('#try, #try-link').toggleClass('show'),!$('#try').hasClass('show'))return previousHash?replaceState(previousHash):clearHash();if(window.location.hash&&(previousHash=window.location.hash),0===$('#try .CodeMirror').length&&initializeTryEditors(),checkLocalStorage&&null!=window.localStorage)try{return coffee=window.localStorage.getItem('tryCoffeeScriptCode'),null==coffee?replaceState('#try'):editors[0].setValue(coffee)}catch(error){return exception=error,replaceState('#try')}else return replaceState('#try')},closeTry=function(){return $('#try, #try-link').removeClass('show'),previousHash?replaceState(previousHash):clearHash()},$('[data-toggle="try"]').click(function(event){return event.preventDefault(),toggleTry(!0)}),$('[data-close="try"]').click(closeTry),$('[data-action="scroll-to-top"]').click(function(){if(!$('#try').hasClass('show'))return $('.main')[0].scrollTop=0,setTimeout(clearHash,10)}),clearHash=function(){return window.history.replaceState({},document.title,window.location.pathname)},replaceState=function(newURL){return 0===(null==newURL?void 0:newURL.indexOf('#'))&&(newURL=''+window.location.pathname+newURL),window.history.replaceState({},document.title,newURL||'')},$(window).on('hashchange',function(){if(''===window.location.hash)return clearHash()}),null!=window.location.hash&&('#try'===window.location.hash?toggleTry(!0):0===window.location.hash.indexOf('#try')?(0===$('#try .CodeMirror').length&&initializeTryEditors(),editors[0].setValue(decodeURIComponent(window.location.hash.slice(5))),toggleTry(!1)):''===window.location.hash?clearHash():(initializeScrollspyFromHash(window.location.hash),1<window.location.hash.length&&document.getElementById(window.location.hash.slice(1).replace(/try:.*/,'')).scrollIntoView())),buildSearch=function(catalogue,keys){var searchOptions;return searchOptions={includeScore:!0,shouldSort:!0,includeMatches:!0,threshold:.2,location:0,distance:1e3,maxPatternLength:32,minMatchCharLength:4,keys:keys},new Fuse(window.searchCollections[catalogue],searchOptions)},window.fuseDocs=buildSearch('docs',['section','content']),window.fuseLogs=buildSearch('changelogs',['content'])}),$(document).on('keyup','#cs-search-input-navbar',function(){var ctmpl,key,list,markContent,markText,markTitle,parseResults,resContainer,resultList,results,searchResultBox,tmpl,tmplList;if(resContainer=$('#search-results'),searchResultBox=$('#searchResultBox'),resContainer.hide().html(''),searchResultBox.hide(),!!(3<=this.value.length)){for(key in markText=function(text){return'<span class="cs-docsearch-suggestion--highlight">'+text+'</span>'},markTitle=function(title,matches){var i,len,m,marked;for(i=0,len=matches.length;i<len;i++)m=matches[i],marked=markText(title.slice(m[0],m[1])),title=title.slice(0,m[0])+marked+title.slice(m[1]);return title},markContent=function(content,matches){var end,i,len,m,mContent,marked,start;for(mContent=[],i=0,len=matches.length;i<len;i++)m=matches[i],marked=markText(content.slice(m[0],m[1])),start=50<m[0]?m[0]-50:0,end=m[1]+50,mContent.push('&hellip;'+content.slice(start,m[0])+marked+content.slice(m[1],end)+'&hellip;');return mContent.join(' ')},tmpl=window.searchResultTemplate,tmplList=window.searchResultsListTemplate,resultList={},results=[],parseResults=function(docs){var content,countMatches,doc,href,i,indices,j,key,len,len1,match,matches,parent,results1,title;for(results1=[],i=0,len=docs.length;i<len;i++){doc=docs[i];var _doc=doc,_doc$item=_doc.item;for(title=_doc$item.title,href=_doc$item.href,content=_doc$item.content,parent=_doc$item.parent,matches=_doc.matches,resultList[parent]&&0<resultList[parent].length||(resultList[parent]=[]),countMatches=0,(j=0,len1=matches.length);j<len1;j++){match=matches[j];var _match=match;key=_match.key,indices=_match.indices,'section'===key&&0<indices.length&&(title=markTitle(title,indices),countMatches+=indices.length),'content'===key&&(content=markContent(content,indices),countMatches+=indices.length)}1>countMatches||results1.push(resultList[parent].push(tmplList({title:title,subsection:title,content:content,href:href})))}return results1},parseResults(window.fuseDocs.search(this.value)),parseResults(window.fuseLogs.search(this.value)),resultList)(list=resultList[key],!(1>list.length))&&(ctmpl=tmpl({section:key,results:list.join('')}),results.push(ctmpl));if(0<results.length)return searchResultBox.show(),resContainer.show().html(results.join(''))}}),$(document).on('click','.searchWrapper',function(){var href;return href=$(this).data('href'),'#'===href[0]?window.location.hash=href:window.location=href})}).call(this);

documentation/site/scripts.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js" integrity="sha384-xBuQ/xzmlsLoJpyjoggmTEz8OWUFM0/RC5BsqQBDX2v5cMvDHcMakNTNrHIW2I5f" crossorigin="anonymous"></script>
22
<script src="//stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js" integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm" crossorigin="anonymous"></script>
3-
<script src="//cdn.jsdelivr.net/combine/npm/[email protected]/lib/codemirror.js,npm/[email protected]/mode/coffeescript/coffeescript.js,npm/[email protected]/addon/lint/coffeescript-lint.js,npm/[email protected]/mode/javascript/javascript.js"></script>
4-
<script src="//cdnjs.cloudflare.com/ajax/libs/fuse.js/3.0.4/fuse.min.js"></script>
3+
<script src="//cdn.jsdelivr.net/combine/npm/[email protected]/lib/codemirror.js,npm/[email protected]/mode/coffeescript/coffeescript.js,npm/[email protected]/addon/lint/coffeescript-lint.js,npm/[email protected]/mode/javascript/javascript.js,npm/[email protected]/dist/fuse.min.js"></script>
54
<script src="browser-compiler/coffeescript.js"></script>
65
<script>
76
<%= includeScript('docs.coffee') %>

0 commit comments

Comments
 (0)