|
|
@ -1,5 +1,15 @@
|
|
|
|
(function() {
|
|
|
|
(function() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var repeat = function(string, count) {
|
|
|
|
|
|
|
|
var repeatedString = '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < count; i++) {
|
|
|
|
|
|
|
|
repeatedString += string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return repeatedString;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
angular
|
|
|
|
angular
|
|
|
|
.module('NginxConfigIoApp', ['ngclipboard', '720kb.tooltips'])
|
|
|
|
.module('NginxConfigIoApp', ['ngclipboard', '720kb.tooltips'])
|
|
|
|
.controller('NginxConfigIoController', function NginxConfigIoController($scope, $location, $timeout) {
|
|
|
|
.controller('NginxConfigIoController', function NginxConfigIoController($scope, $location, $timeout) {
|
|
|
@ -67,14 +77,18 @@
|
|
|
|
// SCOPE FUNCTIONS //
|
|
|
|
// SCOPE FUNCTIONS //
|
|
|
|
/////////////////////
|
|
|
|
/////////////////////
|
|
|
|
$scope.refreshHighlighting = function() {
|
|
|
|
$scope.refreshHighlighting = function() {
|
|
|
|
document.querySelectorAll('main .file .code.source').forEach(function(code) {
|
|
|
|
var sourceCodes = document.querySelectorAll('main .file .code.source');
|
|
|
|
$timeout(function(code) {
|
|
|
|
|
|
|
|
code.nextSibling.innerHTML = code.innerHTML;
|
|
|
|
for (var i = 0; i < sourceCodes.length; i++) {
|
|
|
|
if (code.nextSibling.children.length && code.nextSibling.children[0].children.length) {
|
|
|
|
var sourceCode = sourceCodes[i];
|
|
|
|
hljs.highlightBlock(code.nextSibling.children[0].children[0]);
|
|
|
|
|
|
|
|
|
|
|
|
$timeout(function(_sourceCode) {
|
|
|
|
|
|
|
|
_sourceCode.nextSibling.innerHTML = _sourceCode.innerHTML;
|
|
|
|
|
|
|
|
if (_sourceCode.nextSibling.children.length && _sourceCode.nextSibling.children[0].children.length) {
|
|
|
|
|
|
|
|
hljs.highlightBlock(_sourceCode.nextSibling.children[0].children[0]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, 0, true, code);
|
|
|
|
}, 0, true, sourceCode);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
$scope.setDataFromHash = function() {
|
|
|
|
$scope.setDataFromHash = function() {
|
|
|
@ -176,10 +190,10 @@
|
|
|
|
pre: function preLink(scope, iElement, iAttrs, controller) {
|
|
|
|
pre: function preLink(scope, iElement, iAttrs, controller) {
|
|
|
|
var tabs = parseInt(iAttrs.ngIncludeTabs || 0);
|
|
|
|
var tabs = parseInt(iAttrs.ngIncludeTabs || 0);
|
|
|
|
|
|
|
|
|
|
|
|
var startRegex = new RegExp('\t'.repeat(tabs - 1));
|
|
|
|
var startRegex = new RegExp(repeat('\t', tabs - 1));
|
|
|
|
|
|
|
|
|
|
|
|
controller.template = controller.template
|
|
|
|
controller.template = controller.template
|
|
|
|
.replace(/^(.*)$/mg, '\t'.repeat(tabs) + '$1')
|
|
|
|
.replace(/^(.*)$/mg, repeat('\t', tabs) + '$1')
|
|
|
|
.replace(startRegex, '')
|
|
|
|
.replace(startRegex, '')
|
|
|
|
.replace(/\s*$/, '');
|
|
|
|
.replace(/\s*$/, '');
|
|
|
|
},
|
|
|
|
},
|
|
|
|