pull/12/head
Szekeres Bálint 7 years ago
parent adc897bd48
commit 611f86b5d5

@ -57,6 +57,11 @@ header .url .input-group-append .input-group-text {
background-color: transparent; background-color: transparent;
} }
header .url .input-group-prepend .input-group-text img,
header .url .input-group-append .input-group-text img {
margin-top: 4px;
}
header .url .input-group-append .input-group-text img { header .url .input-group-append .input-group-text img {
opacity: 0.5; opacity: 0.5;
} }

@ -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, sourceCode);
} }
}, 0, true, code);
});
}; };
$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*$/, '');
}, },

Loading…
Cancel
Save