[update] Add code lines
This commit is contained in:
+14
-12
@@ -9,7 +9,8 @@ let express = require( 'express' ),
|
||||
ip = require( 'ip' ),
|
||||
util = require( 'util' ),
|
||||
path = require( 'path' ),
|
||||
Projects = require( './models/projects.class.js' )
|
||||
Projects = require( './models/projects.class.js' ),
|
||||
fs = require( 'fs' )
|
||||
|
||||
/**
|
||||
* App class
|
||||
@@ -47,20 +48,21 @@ class App
|
||||
// let project_5 = this.projects.create_project( 'dummy' )
|
||||
|
||||
// Some file
|
||||
project.files.create( './coucou/coco.txt', '1234' )
|
||||
project.files.create( './test-1.txt', 'content 1' )
|
||||
project.files.create( './toto/tata/ipsum.txt' )
|
||||
project.files.create_version( './test-1.txt', 'content 2' )
|
||||
project.files.create_version( './test-1.txt', 'content 31298' )
|
||||
project.files.create_version( './toto/tata/lorem.txt', '123456789' )
|
||||
project.files.create_version( './toto/tata/lorem.txt', '1aze' )
|
||||
project.files.create_version( './toto/tata/ipsum.txt', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia asperiores iure, animi voluptatibus ut officiis. Molestias, quod perferendis hic totam doloremque, porro aperiam enim tenetur, maxime inventore consequuntur nisi in?' )
|
||||
project.files.create_version( './folder-1/test-4.css', fs.readFileSync( '../test-folder/folder-1/test-4.css', 'utf8' ) )
|
||||
project.files.create_version( './folder-2/test-3.js', fs.readFileSync( '../test-folder/folder-2/test-3.js', 'utf8' ) )
|
||||
project.files.create_version( './test-1.html', fs.readFileSync( '../test-folder/test-1.html', 'utf8' ) )
|
||||
project.files.create_version( './test-2.php', fs.readFileSync( '../test-folder/test-2.php', 'utf8' ) )
|
||||
project.files.create_version( './big-one.txt', 'content 4\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline' )
|
||||
|
||||
// project.files.create_version( './toto/tata/lorem.txt', '123456789' )
|
||||
// project.files.create_version( './toto/tata/lorem.txt', '1aze' )
|
||||
// project.files.create_version( './toto/tata/ipsum.txt', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia asperiores iure, animi voluptatibus ut officiis. Molestias, quod perferendis hic totam doloremque, porro aperiam enim tenetur, maxime inventore consequuntur nisi in?' )
|
||||
|
||||
// Adding file versions
|
||||
let counting = 0
|
||||
setInterval( function()
|
||||
{
|
||||
project.files.create_version( './coucou/coco.txt', 'test: ' + counting++ )
|
||||
project.files.create_version( './multi-version.txt', 'test: ' + counting++ )
|
||||
}, 2000 )
|
||||
|
||||
// Creating and deleting file
|
||||
@@ -68,9 +70,9 @@ class App
|
||||
setInterval( function()
|
||||
{
|
||||
if( toggle )
|
||||
project.files.create( './toto/toggle.txt', 'content' )
|
||||
project.files.create( './toggle.txt', 'content' )
|
||||
else
|
||||
project.files.delete( './toto/toggle.txt', 'content' )
|
||||
project.files.delete( './toggle.txt', 'content' )
|
||||
|
||||
toggle = !toggle
|
||||
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
var application = angular.module( 'application', [ 'hljs' ] );
|
||||
var application = angular.module(
|
||||
'application',
|
||||
[
|
||||
'hljs'
|
||||
]
|
||||
);
|
||||
|
||||
application.constant( 'config', config );
|
||||
application.config( function( hljsServiceProvider )
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Global
|
||||
*/
|
||||
body {background:#24262e;font-size:14px;font-family:Helvetica,Arial;color:#f1f5ff;}
|
||||
body {background:#24262e;font-size:14px;font-family:Helvetica,Arial;color:#f1f5ff;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;}
|
||||
pre {font-family:monospace;line-height:initial;}
|
||||
a {text-decoration:none;}
|
||||
|
||||
@@ -36,11 +36,16 @@ section.page-project section.main {position:absolute;top:0;right:0;bottom:0;left
|
||||
section.page-project section.no-file {position:absolute;top:0;right:0;bottom:0;left:0;}
|
||||
section.page-project section.file {position:absolute;top:0;right:0;bottom:0;left:0;}
|
||||
section.page-project section.file .file-header {position:absolute;top:0;right:0;left:0;height:30px;line-height:30px;padding:0 0 0 10px;background:#777;}
|
||||
section.page-project section.file .versions-nav {position:absolute;top:30px;bottom:0;left:0;width:160px;background:#555;overflow-y:scroll;}
|
||||
section.page-project section.file .versions-nav {position:absolute;top:30px;bottom:0;left:0;width:160px;background:#555;overflow:auto;}
|
||||
section.page-project section.file .versions-nav .version {display:block;padding:10px;}
|
||||
section.page-project section.file .versions-nav .version.active {background:#666;}
|
||||
section.page-project section.file .code {position:absolute;top:30px;right:0;bottom:0;left:160px;background:#ff0;}
|
||||
section.page-project section.file .code pre code {position:absolute;top:0;right:0;bottom:0;left:0;}
|
||||
section.page-project section.file .code {position:absolute;top:30px;right:0;bottom:0;left:160px;overflow:auto;background:#282a36;}
|
||||
section.page-project section.file .code pre {position:relative;overflow:hidden;}
|
||||
section.page-project section.file .code pre code.lines {position:absolute;top:0;left:0;width:38px;padding:0.5em;line-height:16px;opacity:0.2;}
|
||||
section.page-project section.file .code pre code.hljs {margin-left:38px;}
|
||||
// section.page-project section.file .code pre code {position:absolute;top:0;left:20px;}
|
||||
|
||||
.hljs-line-numbers {text-align:right;border-right:1px solid #ccc;color:#999;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}
|
||||
|
||||
/**
|
||||
* Files tree nav
|
||||
|
||||
+211
-1
@@ -3,4 +3,214 @@ version: 0.6.1
|
||||
build date: 2016-04-02
|
||||
author: Chih-Hsuan Fan
|
||||
https://github.com/pc035860/angular-highlightjs.git */
|
||||
!function(a,b){"object"==typeof exports||"object"==typeof module&&module.exports?module.exports=b(require("angular"),require("highlight.js")):"function"==typeof define&&define.amd?define(["angular","hljs"],b):a.returnExports=b(a.angular,a.hljs)}(this,function(a,b){function c(b){return function(c){switch(c){case"escape":return a.isDefined(b.hljsEscape)?b.hljsEscape:b.escape;case"no-escape":return a.isDefined(b.hljsNoEscape)?b.hljsNoEscape:b.noEscape;case"onhighlight":return a.isDefined(b.hljsOnhighlight)?b.hljsOnhighlight:b.onhighlight}}}function d(b){var c=!0;return a.forEach(["source","include"],function(a){b[a]&&(c=!1)}),c}var e=a.module("hljs",[]);e.provider("hljsService",function(){var c={};return{setOptions:function(b){a.extend(c,b)},getOptions:function(){return a.copy(c)},$get:function(){return(b.configure||a.noop)(c),b}}}),e.factory("hljsCache",["$cacheFactory",function(a){return a("hljsCache")}]),e.controller("HljsCtrl",["hljsCache","hljsService","$interpolate","$window","$log",function(b,c,d,e,f){function g(a,b,c){var d;return function(){var f=this,g=arguments,h=function(){d=null,c||a.apply(f,g)},i=c&&!d;e.clearTimeout(d),d=e.setTimeout(h,b),i&&a.apply(f,g)}}function h(a,b){var c=b?"\\\\$&":"\\$&";return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,c)}function i(a){for(var b,c=[],d=new RegExp(r,"g"),e="",f=0;null!==(b=d.exec(a));)e+=a.substring(f,b.index)+s,f=b.index+b[0].length,c.push(b[0]);return e+=a.substr(f),{code:e,tokens:c}}function j(a,b){for(var c,d=new RegExp(s,"g"),e="",f=0;null!==(c=d.exec(a));)e+=a.substring(f,c.index)+b.shift(),f=c.index+c[0].length;return e+=a.substr(f)}var k=this,l=null,m=null,n=null,o=!1,p=null,q=null,r=h(d.startSymbol())+"((.|\\s)+?)"+h(d.endSymbol()),s="∫";k.init=function(a){l=a},k.setInterpolateScope=function(a){o=a,n&&k.highlight(n)},k.setLanguage=function(a){m=a,n&&k.highlight(n)},k.highlightCallback=function(a){q=a},k._highlight=function(e){if(l){var f,g,h;if(n=e,o&&(h=i(e),e=h.code),m?(g=k._cacheKey(m,!!o,e),f=b.get(g),f||(f=c.highlight(m,c.fixMarkup(e),!0),b.put(g,f))):(g=k._cacheKey(!!o,e),f=b.get(g),f||(f=c.highlightAuto(c.fixMarkup(e)),b.put(g,f))),e=f.value,o){(p||a.noop)(),h&&(e=j(e,h.tokens));var r=d(e);p=o.$watch(r,function(a,b){a!==b&&l.html(a)}),l.html(r(o))}else l.html(e);l.addClass(f.language),null!==q&&a.isFunction(q)&&q()}},k.highlight=g(k._highlight,17),k.clear=function(){l&&(n=null,l.text(""))},k.release=function(){l=null,o=null,(p||a.noop)(),p=null},k._cacheKey=function(){var a=Array.prototype.slice.call(arguments),b="!angular-highlightjs!";return a.join(b)}}]);var f,g,h,i,j;return f=["$parse",function(b){return{restrict:"EA",controller:"HljsCtrl",compile:function(e,f,g){var h=e[0].innerHTML.replace(/^(\r\n|\r|\n)/m,""),i=e[0].textContent.replace(/^(\r\n|\r|\n)/m,"");return e.html('<pre><code class="hljs"></code></pre>'),function(e,f,g,j){var k,l=c(g);if(a.isDefined(l("escape"))?k=b(l("escape")):a.isDefined(l("no-escape"))&&(k=b("false")),j.init(f.find("code")),l("onhighlight")&&j.highlightCallback(function(){e.$eval(l("onhighlight"))}),(h||i)&&d(g)){var m;m=k&&!k(e)?i:h,j.highlight(m)}e.$on("$destroy",function(){j.release()})}}}}],h=function(b){return function(){return{require:"?hljs",restrict:"A",link:function(c,d,e,f){f&&e.$observe(b,function(b){a.isDefined(b)&&f.setLanguage(b)})}}}},g=function(a){return function(){return{require:"?hljs",restrict:"A",link:function(b,c,d,e){e&&b.$watch(d[a],function(a,c){(a||a!==c)&&e.setInterpolateScope(a?b:null)})}}}},i=function(a){return function(){return{require:"?hljs",restrict:"A",link:function(b,c,d,e){e&&b.$watch(d[a],function(a,b){a?e.highlight(a):e.clear()})}}}},j=function(b){return["$http","$templateCache","$q",function(c,d,e){return{require:"?hljs",restrict:"A",compile:function(f,g,h){var i=g[b];return function(b,f,g,h){var j=0;h&&b.$watch(i,function(b){var f=++j;if(b&&a.isString(b)){var g,i;g=d.get(b),g||(i=e.defer(),c.get(b,{cache:d,transformResponse:function(a,b){return a}}).success(function(a){f===j&&i.resolve(a)}).error(function(){f===j&&h.clear(),i.resolve()}),g=i.promise),e.when(g).then(function(b){b&&(a.isArray(b)?b=b[1]:a.isObject(b)&&(b=b.data),b=b.replace(/^(\r\n|\r|\n)/m,""),h.highlight(b))})}else h.clear()})}}}}]},function(b){b.directive("hljs",f),a.forEach(["interpolate","hljsInterpolate","compile","hljsCompile"],function(a){b.directive(a,g(a))}),a.forEach(["language","hljsLanguage"],function(a){b.directive(a,h(a))}),a.forEach(["source","hljsSource"],function(a){b.directive(a,i(a))}),a.forEach(["include","hljsInclude"],function(a){b.directive(a,j(a))})}(e),"hljs"});
|
||||
! function(a, b) {
|
||||
"object" == typeof exports || "object" == typeof module && module.exports ? module.exports = b(require("angular"), require("highlight.js")) : "function" == typeof define && define.amd ? define(["angular", "hljs"], b) : a.returnExports = b(a.angular, a.hljs)
|
||||
}(this, function(a, b) {
|
||||
function c(b) {
|
||||
return function(c) {
|
||||
switch (c) {
|
||||
case "escape":
|
||||
return a.isDefined(b.hljsEscape) ? b.hljsEscape : b.escape;
|
||||
case "no-escape":
|
||||
return a.isDefined(b.hljsNoEscape) ? b.hljsNoEscape : b.noEscape;
|
||||
case "onhighlight":
|
||||
return a.isDefined(b.hljsOnhighlight) ? b.hljsOnhighlight : b.onhighlight
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function d(b) {
|
||||
var c = !0;
|
||||
return a.forEach(["source", "include"], function(a) {
|
||||
b[a] && (c = !1)
|
||||
}), c
|
||||
}
|
||||
var e = a.module("hljs", []);
|
||||
e.provider("hljsService", function() {
|
||||
var c = {};
|
||||
return {
|
||||
setOptions: function(b) {
|
||||
a.extend(c, b)
|
||||
},
|
||||
getOptions: function() {
|
||||
return a.copy(c)
|
||||
},
|
||||
$get: function() {
|
||||
return (b.configure || a.noop)(c), b
|
||||
}
|
||||
}
|
||||
}), e.factory("hljsCache", ["$cacheFactory", function(a) {
|
||||
return a("hljsCache")
|
||||
}]), e.controller("HljsCtrl", ["hljsCache", "hljsService", "$interpolate", "$window", "$log", function(b, c, d, e, f) {
|
||||
function g(a, b, c) {
|
||||
var d;
|
||||
return function() {
|
||||
var f = this,
|
||||
g = arguments,
|
||||
h = function() {
|
||||
d = null, c || a.apply(f, g)
|
||||
},
|
||||
i = c && !d;
|
||||
e.clearTimeout(d), d = e.setTimeout(h, b), i && a.apply(f, g)
|
||||
}
|
||||
}
|
||||
|
||||
function h(a, b) {
|
||||
var c = b ? "\\\\$&" : "\\$&";
|
||||
return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, c)
|
||||
}
|
||||
|
||||
function i(a) {
|
||||
for (var b, c = [], d = new RegExp(r, "g"), e = "", f = 0; null !== (b = d.exec(a));) e += a.substring(f, b.index) + s, f = b.index + b[0].length, c.push(b[0]);
|
||||
return e += a.substr(f), {
|
||||
code: e,
|
||||
tokens: c
|
||||
}
|
||||
}
|
||||
|
||||
function j(a, b) {
|
||||
for (var c, d = new RegExp(s, "g"), e = "", f = 0; null !== (c = d.exec(a));) e += a.substring(f, c.index) + b.shift(), f = c.index + c[0].length;
|
||||
return e += a.substr(f)
|
||||
}
|
||||
var k = this,
|
||||
l = null,
|
||||
m = null,
|
||||
n = null,
|
||||
o = !1,
|
||||
p = null,
|
||||
q = null,
|
||||
r = h(d.startSymbol()) + "((.|\\s)+?)" + h(d.endSymbol()),
|
||||
s = "∫";
|
||||
k.init = function(a) {
|
||||
l = a
|
||||
}, k.setInterpolateScope = function(a) {
|
||||
o = a, n && k.highlight(n)
|
||||
}, k.setLanguage = function(a) {
|
||||
m = a, n && k.highlight(n)
|
||||
}, k.highlightCallback = function(a) {
|
||||
q = a
|
||||
}, k._highlight = function(e) {
|
||||
if (l) {
|
||||
var f, g, h;
|
||||
if (n = e, o && (h = i(e), e = h.code), m ? (g = k._cacheKey(m, !!o, e), f = b.get(g), f || (f = c.highlight(m, c.fixMarkup(e), !0), b.put(g, f))) : (g = k._cacheKey(!!o, e), f = b.get(g), f || (f = c.highlightAuto(c.fixMarkup(e)), b.put(g, f))), e = f.value, o) {
|
||||
(p || a.noop)(), h && (e = j(e, h.tokens));
|
||||
var r = d(e);
|
||||
p = o.$watch(r, function(a, b) {
|
||||
a !== b && l.html(a)
|
||||
}), l.html(r(o))
|
||||
} else l.html(e);
|
||||
l.addClass(f.language), null !== q && a.isFunction(q) && q()
|
||||
}
|
||||
}, k.highlight = g(k._highlight, 17), k.clear = function() {
|
||||
l && (n = null, l.text(""))
|
||||
}, k.release = function() {
|
||||
l = null, o = null, (p || a.noop)(), p = null
|
||||
}, k._cacheKey = function() {
|
||||
var a = Array.prototype.slice.call(arguments),
|
||||
b = "!angular-highlightjs!";
|
||||
return a.join(b)
|
||||
}
|
||||
}]);
|
||||
var f, g, h, i, j;
|
||||
return f = ["$parse", function(b) {
|
||||
return {
|
||||
restrict: "EA",
|
||||
controller: "HljsCtrl",
|
||||
compile: function(e, f, g) {
|
||||
var h = e[0].innerHTML.replace(/^(\r\n|\r|\n)/m, ""),
|
||||
i = e[0].textContent.replace(/^(\r\n|\r|\n)/m, "");
|
||||
return e.html('<pre><code class="hljs"></code></pre>'),
|
||||
function(e, f, g, j) {
|
||||
var k, l = c(g);
|
||||
if (a.isDefined(l("escape")) ? k = b(l("escape")) : a.isDefined(l("no-escape")) && (k = b("false")), j.init(f.find("code")), l("onhighlight") && j.highlightCallback(function() {
|
||||
e.$eval(l("onhighlight"))
|
||||
}), (h || i) && d(g)) {
|
||||
var m;
|
||||
m = k && !k(e) ? i : h, j.highlight(m)
|
||||
}
|
||||
e.$on("$destroy", function() {
|
||||
j.release()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}], h = function(b) {
|
||||
return function() {
|
||||
return {
|
||||
require: "?hljs",
|
||||
restrict: "A",
|
||||
link: function(c, d, e, f) {
|
||||
f && e.$observe(b, function(b) {
|
||||
a.isDefined(b) && f.setLanguage(b)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}, g = function(a) {
|
||||
return function() {
|
||||
return {
|
||||
require: "?hljs",
|
||||
restrict: "A",
|
||||
link: function(b, c, d, e) {
|
||||
e && b.$watch(d[a], function(a, c) {
|
||||
(a || a !== c) && e.setInterpolateScope(a ? b : null)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}, i = function(a) {
|
||||
return function() {
|
||||
return {
|
||||
require: "?hljs",
|
||||
restrict: "A",
|
||||
link: function(b, c, d, e) {
|
||||
e && b.$watch(d[a], function(a, b) {
|
||||
a ? e.highlight(a) : e.clear()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}, j = function(b) {
|
||||
return ["$http", "$templateCache", "$q", function(c, d, e) {
|
||||
return {
|
||||
require: "?hljs",
|
||||
restrict: "A",
|
||||
compile: function(f, g, h) {
|
||||
var i = g[b];
|
||||
return function(b, f, g, h) {
|
||||
var j = 0;
|
||||
h && b.$watch(i, function(b) {
|
||||
var f = ++j;
|
||||
if (b && a.isString(b)) {
|
||||
var g, i;
|
||||
g = d.get(b), g || (i = e.defer(), c.get(b, {
|
||||
cache: d,
|
||||
transformResponse: function(a, b) {
|
||||
return a
|
||||
}
|
||||
}).success(function(a) {
|
||||
f === j && i.resolve(a)
|
||||
}).error(function() {
|
||||
f === j && h.clear(), i.resolve()
|
||||
}), g = i.promise), e.when(g).then(function(b) {
|
||||
b && (a.isArray(b) ? b = b[1] : a.isObject(b) && (b = b.data), b = b.replace(/^(\r\n|\r|\n)/m, ""), h.highlight(b))
|
||||
})
|
||||
} else h.clear()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}]
|
||||
},
|
||||
function(b) {
|
||||
b.directive("hljs", f), a.forEach(["interpolate", "hljsInterpolate", "compile", "hljsCompile"], function(a) {
|
||||
b.directive(a, g(a))
|
||||
}), a.forEach(["language", "hljsLanguage"], function(a) {
|
||||
b.directive(a, h(a))
|
||||
}), a.forEach(["source", "hljsSource"], function(a) {
|
||||
b.directive(a, i(a))
|
||||
}), a.forEach(["include", "hljsInclude"], function(a) {
|
||||
b.directive(a, j(a))
|
||||
})
|
||||
}(e), "hljs"
|
||||
});
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
.hljs{display:block;overflow-x:auto;padding:0.5em;color:#abb2bf;background:#282c34}.hljs-comment,.hljs-quote{color:#5c6370;font-style:italic}.hljs-doctag,.hljs-keyword,.hljs-formula{color:#c678dd}.hljs-section,.hljs-name,.hljs-selector-tag,.hljs-deletion,.hljs-subst{color:#e06c75}.hljs-literal{color:#56b6c2}.hljs-string,.hljs-regexp,.hljs-addition,.hljs-attribute,.hljs-meta-string{color:#98c379}.hljs-built_in,.hljs-class .hljs-title{color:#e6c07b}.hljs-variable,.hljs-template-variable,.hljs-type,.hljs-selector-class,.hljs-selector-attr,.hljs-selector-pseudo,.hljs-number{color:#d19a66}.hljs-symbol,.hljs-bullet,.hljs-link,.hljs-meta,.hljs-selector-id,.hljs-title{color:#61aeee}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:bold}.hljs-link{text-decoration:underline}
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
(function (w) {
|
||||
'use strict';
|
||||
|
||||
if (typeof w.hljs === 'undefined') {
|
||||
console.error('highlight.js not detected!');
|
||||
} else {
|
||||
w.hljs.initLineNumbersOnLoad = initLineNumbersOnLoad;
|
||||
w.hljs.lineNumbersBlock = lineNumbersBlock;
|
||||
}
|
||||
|
||||
function initLineNumbersOnLoad () {
|
||||
if (document.readyState === 'complete') {
|
||||
documentReady();
|
||||
} else {
|
||||
w.addEventListener('DOMContentLoaded', documentReady);
|
||||
}
|
||||
}
|
||||
|
||||
function documentReady () {
|
||||
try {
|
||||
var blocks = document.querySelectorAll('code.hljs');
|
||||
|
||||
for (var i in blocks) {
|
||||
if (blocks.hasOwnProperty(i)) {
|
||||
lineNumbersBlock(blocks[i]);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('LineNumbers error: ', e);
|
||||
}
|
||||
}
|
||||
|
||||
function lineNumbersBlock (element) {
|
||||
if (typeof element !== 'object') return;
|
||||
|
||||
var parent = element.parentNode;
|
||||
var lines = getCountLines(parent.textContent);
|
||||
|
||||
if (lines > 1) {
|
||||
var l = '';
|
||||
for (var i = 0; i < lines; i++) {
|
||||
l += (i + 1) + '\n';
|
||||
}
|
||||
|
||||
var linesPanel = document.createElement('code');
|
||||
linesPanel.className = 'hljs hljs-line-numbers';
|
||||
linesPanel.style.float = 'left';
|
||||
linesPanel.textContent = l;
|
||||
|
||||
parent.insertBefore(linesPanel, element);
|
||||
}
|
||||
}
|
||||
|
||||
function getCountLines(text) {
|
||||
if (text.length === 0) return 0;
|
||||
|
||||
var regExp = /\r\n|\r|\n/g;
|
||||
var lines = text.match(regExp);
|
||||
lines = lines ? lines.length : 0;
|
||||
|
||||
if (!text[text.length - 1].match(regExp)) {
|
||||
lines += 1;
|
||||
}
|
||||
|
||||
return lines;
|
||||
}
|
||||
}(window));
|
||||
@@ -43,7 +43,12 @@ section.page-project(ng-controller="ProjectController as controller",ng-init="in
|
||||
| {{_version.diff_percent}}
|
||||
section.code
|
||||
pre
|
||||
code.lines
|
||||
- var line_index = 1
|
||||
while line_index < 999
|
||||
.line= line_index++
|
||||
code(hljs,hljs-source="version.content")
|
||||
| {{ version.content }}
|
||||
|
||||
|
||||
include ../../partials/footer.jade
|
||||
|
||||
@@ -9,7 +9,6 @@ html(ng-app="application")
|
||||
script(src="/vendors/underscore/underscore-min.js")
|
||||
script(src="/vendors/underscore/mixins/deep_extend_javascript_objects_underscore_mixin.js")
|
||||
script(src="/vendors/highlight/highlight.pack.js")
|
||||
|
||||
script(src="/socket.io/socket.io.js")
|
||||
script(src="/vendors/moment.min.js")
|
||||
script(src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js")
|
||||
@@ -23,10 +22,11 @@ html(ng-app="application")
|
||||
|
||||
link(rel="stylesheet",href="/stylesheets/reset.min.css")
|
||||
link(rel="stylesheet",href="/stylesheets/style.css")
|
||||
//- link(rel="stylesheet",href="/vendors/highlight/styles/dracula.css")
|
||||
link(rel="stylesheet",href="/vendors/highlight/styles/dracula.css")
|
||||
//- link(rel="stylesheet",href="/vendors/highlight/styles/atom-one-dark.css")
|
||||
//- link(rel="stylesheet",href="/vendors/highlight/styles/gruvbox-dark.css")
|
||||
//- link(rel="stylesheet",href="/vendors/highlight/styles/monokai.css")
|
||||
link(rel="stylesheet",href="/vendors/highlight/styles/monokai-sublime.css")
|
||||
//- link(rel="stylesheet",href="/vendors/highlight/styles/monokai-sublime.css")
|
||||
//- link(rel="stylesheet",href="/vendors/highlight/styles/obsidian.css")
|
||||
//- link(rel="stylesheet",href="/vendors/highlight/styles/railscasts.css")
|
||||
//- link(rel="stylesheet",href="/vendors/highlight/styles/tomorrow-night.css")
|
||||
|
||||
@@ -3,10 +3,6 @@ body {
|
||||
padding:0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.toto .tata > span {
|
||||
background:url('kikoo.png') top left repeat-x;
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
qdsqsdsq
|
||||
@@ -0,0 +1,17 @@
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Test
|
||||
*/
|
||||
class ClassName extends AnotherClass
|
||||
{
|
||||
constructor( argument )
|
||||
{
|
||||
// code...
|
||||
}
|
||||
|
||||
test()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Test
|
||||
*/
|
||||
class ClassName extends AnotherClass
|
||||
{
|
||||
|
||||
function __construct( argument )
|
||||
{
|
||||
// code...
|
||||
}
|
||||
|
||||
function test()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Test
|
||||
*/
|
||||
class ClassName extends AnotherClass
|
||||
{
|
||||
|
||||
function __construct(argument)
|
||||
{
|
||||
|
||||
qsd
|
||||
# code...
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user