mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
make jshint happy
This commit is contained in:
parent
a737090442
commit
7085c7db12
1 changed files with 20 additions and 15 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
/*global md5 */
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
const DATA_PREFIX = "data-poll-";
|
const DATA_PREFIX = "data-poll-";
|
||||||
|
@ -12,23 +14,26 @@
|
||||||
start: /\[poll([^\]]*)\]([\s\S]*)/igm,
|
start: /\[poll([^\]]*)\]([\s\S]*)/igm,
|
||||||
stop: /\[\/poll\]/igm,
|
stop: /\[\/poll\]/igm,
|
||||||
|
|
||||||
emitter: function(blockContents, matches, options) {
|
emitter: function(blockContents, matches) {
|
||||||
// post-process inside block contents
|
var o, contents = [];
|
||||||
var contents = [];
|
|
||||||
|
|
||||||
|
// post-process inside block contents
|
||||||
if (blockContents.length) {
|
if (blockContents.length) {
|
||||||
var self = this, b;
|
var self = this, b;
|
||||||
while ((b = blockContents.shift()) !== undefined) {
|
|
||||||
this.processBlock(b, blockContents).forEach(function (bc) {
|
var postProcess = function(bc) {
|
||||||
if (typeof bc === "string" || bc instanceof String) {
|
if (typeof bc === "string" || bc instanceof String) {
|
||||||
var processed = self.processInline(String(bc));
|
var processed = self.processInline(String(bc));
|
||||||
if (processed.length) {
|
if (processed.length) {
|
||||||
contents.push(["p"].concat(processed));
|
contents.push(["p"].concat(processed));
|
||||||
}
|
|
||||||
} else {
|
|
||||||
contents.push(bc);
|
|
||||||
}
|
}
|
||||||
});
|
} else {
|
||||||
|
contents.push(bc);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
while ((b = blockContents.shift()) !== undefined) {
|
||||||
|
this.processBlock(b, blockContents).forEach(postProcess);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +61,7 @@
|
||||||
if (isNaN(step)) { step = 1; }
|
if (isNaN(step)) { step = 1; }
|
||||||
// dynamically generate options
|
// dynamically generate options
|
||||||
contents.push(["bulletlist"]);
|
contents.push(["bulletlist"]);
|
||||||
for (var o = min; o <= max; o += step) {
|
for (o = min; o <= max; o += step) {
|
||||||
contents[0].push(["listitem", String(o)]);
|
contents[0].push(["listitem", String(o)]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,7 +84,7 @@
|
||||||
var style = styles.join(";");
|
var style = styles.join(";");
|
||||||
|
|
||||||
// add option id (hash) + style
|
// add option id (hash) + style
|
||||||
for (var o = 1; o < contents[0].length; o++) {
|
for (o = 1; o < contents[0].length; o++) {
|
||||||
// break as soon as the list is done
|
// break as soon as the list is done
|
||||||
if (contents[0][o][0] !== "listitem") { break; }
|
if (contents[0][o][0] !== "listitem") { break; }
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue