Skip to content

Commit 13ec079

Browse files
committed
replace hightlint.js with googld prettify.js due to performance sucks
1 parent fa32e96 commit 13ec079

6 files changed

Lines changed: 67 additions & 19 deletions

File tree

‎cache.manifest‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
CACHE MANIFEST
2-
# Build: 20151224034542
2+
# Build: 20151224104142
33

44
CACHE:
55
resources/css/bootstrap.min.css
6-
resources/css/highlight.min.css
76
resources/fonts/Dressedless_Three.svg
87
resources/fonts/Dressedless_Three.ttf
98
resources/images/codelf_logo.png
109
resources/images/twohardtings.jpg
10+
src/lib/ZeroClipboard.min.js
1111
src/lib/bootstrap.min.js
12-
src/lib/highlight.min.js
1312
src/lib/jquery.min.js
13+
src/lib/prettify.js
1414
src/lib/tether.min.js
1515

1616
NETWORK:

‎index.html‎

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@
1111
<link rel="apple-touch-icon" sizes="144x144" href="resources/images/codelf_logo.png">
1212
<link rel="apple-touch-icon-precomposed" href="resources/images/codelf_logo.png">
1313
<link rel="stylesheet" href="resources/css/bootstrap.min.css">
14-
<link rel="stylesheet" href="resources/css/highlight.min.css">
1514
<style>
15+
/*google prettify*/
16+
.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}
17+
/*end google prettify*/
18+
1619
html,body{
1720
-webkit-font-smoothing: antialiased;
1821
}
@@ -208,6 +211,9 @@
208211
overflow: scroll;
209212
-webkit-overflow-scrolling: touch;
210213
}
214+
.sourcecode-modal code{
215+
display: inline-block;
216+
}
211217
.variable-btns>.variable-btns__copy{
212218
display: none;
213219
}
@@ -335,17 +341,19 @@ <h5 class="variable-wrap" data-id="{id}" data-repo="{repo}" data-url="{url}" dat
335341
<a target="_blank">Repo</a>
336342
</div>
337343
<div class="modal-body">
338-
<pre><code></code></pre>
344+
<script type="text/html">
345+
<pre><code class="prettyprint linenums">{code}</code></pre>
346+
</script>
339347
</div>
340348
</div>
341349
</div>
342350
</div>
343351
<script type="text/html" template="variableMenu">
344352
<div class="btn-group-vertical variable-btns" role="group">
345-
<button type="button" class="btn btn-secondary"><a href="{repo}" target="_blank">Repo</a></button>
346353
<button type="button" class="btn btn-secondary"><a href="#{val}">Search</a></button>
347-
<button type="button" class="btn btn-secondary variable-btns__code" data-id="{id}">Codes</button>
354+
<button type="button" class="btn btn-secondary"><a href="{repo}" target="_blank">Repo</a></button>
348355
<button type="button" class="btn btn-secondary variable-btns__copy" data-clipboard-text="{val}">Copy</button>
356+
<button type="button" class="btn btn-secondary variable-btns__code" data-id="{id}">Codes</button>
349357
</div>
350358
</script>
351359
<!-- http://tholman.com/github-corners/ -->
@@ -354,8 +362,8 @@ <h5 class="variable-wrap" data-id="{id}" data-repo="{repo}" data-url="{url}" dat
354362
<script src="src/lib/tether.min.js"></script>
355363
<script src="src/lib/jquery.min.js"></script>
356364
<script src="src/lib/bootstrap.min.js"></script>
357-
<script src="src/lib/ZeroClipboard.min.js"></script>
358-
<script src="src/lib/highlight.min.js"></script>
365+
<script src="src/lib/ZeroClipboard.min.js" defer></script>
366+
<script src="src/lib/prettify.js" defer></script>
359367
<script>
360368
$(function () {
361369
//utils
@@ -622,7 +630,8 @@ <h5 class="variable-wrap" data-id="{id}" data-repo="{repo}" data-url="{url}" dat
622630
variableMenuTpl: $('script[template="variableMenu"]').html(),
623631

624632
sourceCodeModal: $('.sourcecode-modal'),
625-
sourceCodeContent: $('.sourcecode-modal pre code'),
633+
sourceCodeContent: $('.sourcecode-modal .modal-body'),
634+
sourceCodeContentTpl: $('.sourcecode-modal .modal-body script').html(),
626635

627636
githubCorner: $('.github-corner svg'),
628637

@@ -799,9 +808,6 @@ <h5 class="variable-wrap" data-id="{id}" data-repo="{repo}" data-url="{url}" dat
799808
}
800809
function renderGithubCorner(){
801810
els.githubCorner.css({fill: randomColor()});
802-
setTimeout(function(){
803-
hljs.highlightBlock(els.sourceCodeContent[0]);
804-
},300);
805811
}
806812

807813
function renderSearchResult(data,page){
@@ -895,9 +901,9 @@ <h5 class="variable-wrap" data-id="{id}" data-repo="{repo}" data-url="{url}" dat
895901

896902
function renderSourceCode(data){
897903
if(data){
898-
els.sourceCodeContent.text(data.code);
904+
els.sourceCodeContent.html(els.sourceCodeContentTpl.replace('{code}',data.code));
899905
setTimeout(function(){
900-
hljs.highlightBlock(els.sourceCodeContent[0]);
906+
PR.prettyPrint();
901907
},100);
902908
}
903909
}

‎resources/css/highlight.min.css‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎src/lib/highlight.min.js‎

Lines changed: 0 additions & 3 deletions
This file was deleted.

‎src/lib/prettify-small.tgz‎

38.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)