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 || {}; ...@@ -52,8 +52,11 @@ var QfqNS = QfqNS || {};
this.$parent = $container; this.$parent = $container;
this.$target = $("#" + $container.data("target")); this.$target = $("#" + $container.data("target"));
this.data = { 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"); this.currentUser = $container.data("uid");
var that = this; var that = this;
if (this.$target.val()) { if (this.$target.val()) {
...@@ -72,6 +75,7 @@ var QfqNS = QfqNS || {}; ...@@ -72,6 +75,7 @@ var QfqNS = QfqNS || {};
// Get data of a file and write it to data.text // Get data of a file and write it to data.text
$.get(this.data.url, function(response) { $.get(this.data.url, function(response) {
that.data.text = response; that.data.text = response;
console.log(response);
that._prepareBuild(); that._prepareBuild();
}); });
} else if (this.data.text) { } else if (this.data.text) {
...@@ -170,15 +174,14 @@ var QfqNS = QfqNS || {}; ...@@ -170,15 +174,14 @@ var QfqNS = QfqNS || {};
class: 'pull-left qfqLineCount', class: 'pull-left qfqLineCount',
text: lineCount text: lineCount
}); });
var cLine = line.replace(/\s/g, ' ') var cLine = line.replace('&', '&')
.replace(';', ';')
.replace('<', '&lt;') .replace('<', '&lt;')
.replace('>', '&gt;') .replace('>', '&gt;')
.replace('&', '&amp;') .replace(/\s/g, '&nbsp;')
.replace(';', '&semi;')
.replace('"', '&quot;') .replace('"', '&quot;')
.replace('\'', '&apos;') .replace('\'', '&apos;')
.replace('\\', '&bsol;') .replace('\\', '&bsol;');
.replace('/', '&sol;');
cLine = this.syntaxHighlight.highlightLine(cLine); cLine = this.syntaxHighlight.highlightLine(cLine);
var htmlCodeLine = $('<div/>', { var htmlCodeLine = $('<div/>', {
class: 'pull-right qfqCode' class: 'pull-right qfqCode'
......
...@@ -91,9 +91,6 @@ var QfqNS = QfqNS || {}; ...@@ -91,9 +91,6 @@ var QfqNS = QfqNS || {};
n.ElementBuilder.prototype._buildInput = function() { n.ElementBuilder.prototype._buildInput = function() {
var $block = {}; var $block = {};
if (this.type !== "hidden") {
$block = this._buildBlock(this.width);
}
var options = { var options = {
class: this._getOption(this.class), class: this._getOption(this.class),
...@@ -106,6 +103,12 @@ var QfqNS = QfqNS || {}; ...@@ -106,6 +103,12 @@ var QfqNS = QfqNS || {};
options.checked = this.checked; options.checked = this.checked;
} }
if (this.type !== "hidden") {
$block = this._buildBlock(this.width);
} else {
options.required = false;
}
var $input = $("<input />", options); var $input = $("<input />", options);
if (this.onClick === "submit") { if (this.onClick === "submit") {
...@@ -119,6 +122,7 @@ var QfqNS = QfqNS || {}; ...@@ -119,6 +122,7 @@ var QfqNS = QfqNS || {};
$block.append($input); $block.append($input);
return $block; return $block;
} else { } else {
$input.removeAttr("pattern");
return $input; return $input;
} }
}; };
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
data-uid='{uid: 5, name: "Definitely not an AI", avatar: "mockData/avatar1.png"}' data-uid='{uid: 5, name: "Definitely not an AI", avatar: "mockData/avatar1.png"}'
data-file="../javascript/src/CodeCorrection.js" data-file="../javascript/src/CodeCorrection.js"
data-target="codeCorrection-output1" data-target="codeCorrection-output1"
data-highlight="javascript" data-highlight="mockData/javascript.json"
> >
</div> </div>
<input id="codeCorrection-output1" name="correction-data" type="hidden" <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