mirror of
https://github.com/DataTables/DataTables.git
synced 2025-01-30 23:52:11 +01:00
New: In the syntax highlighting also pickout DataTables' API methods and link them to the reference page
This commit is contained in:
parent
f788dd28d3
commit
a444026985
@ -362,3 +362,13 @@
|
|||||||
*cursor: hand;
|
*cursor: hand;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.syntaxhighlighter .dtapi {
|
||||||
|
color: #069;
|
||||||
|
}
|
||||||
|
|
||||||
|
.syntaxhighlighter .dtapi:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
cursor: pointer;
|
||||||
|
*cursor: hand;
|
||||||
|
}
|
||||||
|
|
||||||
|
14
examples/examples_support/syntax/js/shCore.js
vendored
14
examples/examples_support/syntax/js/shCore.js
vendored
@ -45,6 +45,11 @@ eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a
|
|||||||
'new null return super switch ' +
|
'new null return super switch ' +
|
||||||
'this throw true try typeof var while with'
|
'this throw true try typeof var while with'
|
||||||
;
|
;
|
||||||
|
|
||||||
|
var datatablesAPI =
|
||||||
|
'fnSettings fnDraw fnFilter fnSort fnAddData fnDeleteRow fnClearTable fnGetData '+
|
||||||
|
'fnGetPosition fnGetNodes fnOpen fnClose fnUpdate fnSetColumnVis fnVersionCheck '+
|
||||||
|
'fnPageChange fnSortListener fnDestroy fnAdjustColumnSizing';
|
||||||
|
|
||||||
var r = SyntaxHighlighter.regexLib;
|
var r = SyntaxHighlighter.regexLib;
|
||||||
|
|
||||||
@ -54,7 +59,8 @@ eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a
|
|||||||
{ regex: r.singleLineCComments, css: 'comments' }, // one line comments
|
{ regex: r.singleLineCComments, css: 'comments' }, // one line comments
|
||||||
{ regex: r.multiLineCComments, css: 'comments' }, // multiline comments
|
{ regex: r.multiLineCComments, css: 'comments' }, // multiline comments
|
||||||
{ regex: /\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion
|
{ regex: /\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion
|
||||||
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keywords
|
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords
|
||||||
|
{ regex: new RegExp(this.getKeywords(datatablesAPI), 'gm'), css: 'dtapi' } // DataTables API methods
|
||||||
];
|
];
|
||||||
|
|
||||||
this.forHtmlScript(r.scriptScriptTags);
|
this.forHtmlScript(r.scriptScriptTags);
|
||||||
@ -298,6 +304,12 @@ var dtLinks = [
|
|||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
$('code.dtapi').each( function () {
|
||||||
|
if ( dtList.indexOf( this.innerHTML ) !== -1 ) {
|
||||||
|
$(this).addClass( 'datatables_ref' );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
/* Click handler to redirect to the documentation */
|
/* Click handler to redirect to the documentation */
|
||||||
$('code.datatables_ref').live('click', function () {
|
$('code.datatables_ref').live('click', function () {
|
||||||
var i = $.inArray( this.innerHTML.replace(/"/g,''), dtOptions );
|
var i = $.inArray( this.innerHTML.replace(/"/g,''), dtOptions );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user