Commit 9b298896 authored by bbaer's avatar bbaer
Browse files

Fixed initialization of code correction

parent 84a1b4af
Pipeline #1443 passed with stage
in 1 minute and 58 seconds
{
"language": "javascript",
"classes": [
{
"position": 0,
"name": "qfqSyntaxDoc",
"description": "jsDoc"
},
{
"position": 1,
"name": "qfqSyntaxWord",
"description": "Reserved Words"
},
{
"position": 2,
"name": "qfqSyntaxData",
"description": "Datatypes"
}
],
"multiLine": [
{
"start": "(\/\\*\\*)(.*)$",
"end": "(\\*\/)(.*)$",
"styleId": 0
}
],
"singleWord": [
{
"regex": "^(.*)(\\\".*\\\")(.*)$",
"styleId": 2
},
{
"regex": "(.*)(function)(.*)",
"styleId": 1
},
{
"regex": "^(.*)( if )(.*)$",
"styleId": 1
},
{
"regex": "^(.*)( for )(.*)$",
"styleId": 1
},
{
"regex": "^(.*)(this)(.*)$",
"styleId": 1
},
{
"regex": "^(.*)( var )(/*)$",
"styleId": 1
},
{
"regex": "^(.*)([0-9]+)(.*)$",
"styleId": 2
}
]
}
\ No newline at end of file
......@@ -52,8 +52,11 @@ var QfqNS = QfqNS || {};
this.$parent = $container;
this.$target = $("#" + $container.data("target"));
this.data = {
url: $container.data("file")
url: this.$parent.data("file"),
text: this.$parent.data("text")
};
this.language = this.$parent.data("highlight") || "typo3conf/ext/qfq/Resources/Public/Json/javascript.json";
console.log(this.data);
this.currentUser = $container.data("uid");
var that = this;
if (this.$target.val()) {
......@@ -72,6 +75,7 @@ var QfqNS = QfqNS || {};
// Get data of a file and write it to data.text
$.get(this.data.url, function(response) {
that.data.text = response;
console.log(response);
that._prepareBuild();
});
} else if (this.data.text) {
......@@ -170,15 +174,14 @@ var QfqNS = QfqNS || {};
class: 'pull-left qfqLineCount',
text: lineCount
});
var cLine = line.replace(/\s/g, ' ')
var cLine = line.replace('&', '&')
.replace(';', ';')
.replace('<', '&lt;')
.replace('>', '&gt;')
.replace('&', '&amp;')
.replace(';', '&semi;')
.replace(/\s/g, '&nbsp;')
.replace('"', '&quot;')
.replace('\'', '&apos;')
.replace('\\', '&bsol;')
.replace('/', '&sol;');
.replace('\\', '&bsol;');
cLine = this.syntaxHighlight.highlightLine(cLine);
var htmlCodeLine = $('<div/>', {
class: 'pull-right qfqCode'
......
......@@ -91,9 +91,6 @@ var QfqNS = QfqNS || {};
n.ElementBuilder.prototype._buildInput = function() {
var $block = {};
if (this.type !== "hidden") {
$block = this._buildBlock(this.width);
}
var options = {
class: this._getOption(this.class),
......@@ -106,6 +103,12 @@ var QfqNS = QfqNS || {};
options.checked = this.checked;
}
if (this.type !== "hidden") {
$block = this._buildBlock(this.width);
} else {
options.required = false;
}
var $input = $("<input />", options);
if (this.onClick === "submit") {
......@@ -119,6 +122,7 @@ var QfqNS = QfqNS || {};
$block.append($input);
return $block;
} else {
$input.removeAttr("pattern");
return $input;
}
};
......
......@@ -46,7 +46,7 @@
data-uid='{uid: 5, name: "Definitely not an AI", avatar: "mockData/avatar1.png"}'
data-file="../javascript/src/CodeCorrection.js"
data-target="codeCorrection-output1"
data-highlight="javascript"
data-highlight="mockData/javascript.json"
>
</div>
<input id="codeCorrection-output1" name="correction-data" type="hidden"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment