mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-09-14 13:51:24 +00:00
Obeisance to JSHint for core modules
There are still some warnings about making functions in a loop, but I’ll fix those as a separate pull request because the fixes are more than typographic errors.
This commit is contained in:
@@ -93,7 +93,7 @@ Modal.prototype.display = function(title,options) {
|
||||
});
|
||||
// Setup the link if present
|
||||
if(options.downloadLink) {
|
||||
modalLink.href = options.downloadLink
|
||||
modalLink.href = options.downloadLink;
|
||||
modalLink.appendChild(document.createTextNode("Right-click to save changes"));
|
||||
modalBody.appendChild(modalLink);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ var bumpSequenceNumber = function(object) {
|
||||
if(sequenceNumber !== null) {
|
||||
object.sequenceNumber = sequenceNumber++;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var TW_TextNode = function(text) {
|
||||
bumpSequenceNumber(this);
|
||||
@@ -79,7 +79,7 @@ TW_Element.prototype.insertBefore = function(node,nextSibling) {
|
||||
} else {
|
||||
this.appendChild(node);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
TW_Element.prototype.removeChild = function(node) {
|
||||
var p = this.children.indexOf(node);
|
||||
@@ -93,9 +93,9 @@ TW_Element.prototype.hasChildNodes = function() {
|
||||
};
|
||||
|
||||
Object.defineProperty(TW_Element.prototype, "firstChild", {
|
||||
get: function() {
|
||||
return this.children[0];
|
||||
}
|
||||
get: function() {
|
||||
return this.children[0];
|
||||
}
|
||||
});
|
||||
|
||||
TW_Element.prototype.addEventListener = function(type,listener,useCapture) {
|
||||
@@ -106,22 +106,22 @@ Object.defineProperty(TW_Element.prototype, "className", {
|
||||
get: function() {
|
||||
return this.attributes["class"] || "";
|
||||
},
|
||||
set: function(value) {
|
||||
this.attributes["class"] = value;
|
||||
}
|
||||
set: function(value) {
|
||||
this.attributes["class"] = value;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(TW_Element.prototype, "value", {
|
||||
get: function() {
|
||||
return this.attributes["value"] || "";
|
||||
return this.attributes.value || "";
|
||||
},
|
||||
set: function(value) {
|
||||
this.attributes["value"] = value;
|
||||
}
|
||||
set: function(value) {
|
||||
this.attributes.value = value;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(TW_Element.prototype, "outerHTML", {
|
||||
get: function() {
|
||||
get: function() {
|
||||
var output = [],attr,a,v;
|
||||
output.push("<",this.tag);
|
||||
if(this.attributes) {
|
||||
@@ -143,7 +143,7 @@ Object.defineProperty(TW_Element.prototype, "outerHTML", {
|
||||
output.push("</",this.tag,">");
|
||||
}
|
||||
return output.join("");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(TW_Element.prototype, "innerHTML", {
|
||||
@@ -162,10 +162,10 @@ Object.defineProperty(TW_Element.prototype, "innerHTML", {
|
||||
return b.join("");
|
||||
}
|
||||
},
|
||||
set: function(value) {
|
||||
this.isRaw = true;
|
||||
this.rawHTML = value;
|
||||
}
|
||||
set: function(value) {
|
||||
this.isRaw = true;
|
||||
this.rawHTML = value;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(TW_Element.prototype, "textContent", {
|
||||
@@ -193,7 +193,7 @@ Object.defineProperty(TW_Element.prototype, "formattedTextContent", {
|
||||
b.push("\n");
|
||||
}
|
||||
if(this.tag === "li") {
|
||||
b.push("* ")
|
||||
b.push("* ");
|
||||
}
|
||||
$tw.utils.each(this.children,function(node) {
|
||||
b.push(node.formattedTextContent);
|
||||
|
||||
@@ -41,7 +41,7 @@ exports.copyDirectory = function(srcPath,dstPath) {
|
||||
if(err) {
|
||||
return err;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
copy(srcPath,dstPath);
|
||||
@@ -70,7 +70,7 @@ exports.copyFile = function(srcPath,dstPath) {
|
||||
fs.closeSync(srcFile);
|
||||
fs.closeSync(dstFile);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Remove trailing path separator
|
||||
|
||||
@@ -41,9 +41,9 @@ exports.addClassToParseTreeNode = function(node,classString) {
|
||||
|
||||
exports.addStyleToParseTreeNode = function(node,name,value) {
|
||||
node.attributes = node.attributes || {};
|
||||
node.attributes["style"] = node.attributes["style"] || {type: "string", value: ""};
|
||||
if(node.attributes["style"].type === "string") {
|
||||
node.attributes["style"].value += name + ":" + value + ";";
|
||||
node.attributes.style = node.attributes.style || {type: "string", value: ""};
|
||||
if(node.attributes.style.type === "string") {
|
||||
node.attributes.style.value += name + ":" + value + ";";
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -24,15 +24,16 @@ exports.repackPlugin = function(title,additionalTiddlers,excludeTiddlers) {
|
||||
throw "No such tiddler as " + title;
|
||||
}
|
||||
// Extract the JSON
|
||||
var jsonPluginTiddler;
|
||||
try {
|
||||
var jsonPluginTiddler = JSON.parse(pluginTiddler.fields.text);
|
||||
jsonPluginTiddler = JSON.parse(pluginTiddler.fields.text);
|
||||
} catch(e) {
|
||||
throw "Cannot parse plugin tiddler " + title + "\nError: " + e;
|
||||
}
|
||||
// Get the list of tiddlers
|
||||
var tiddlers = Object.keys(jsonPluginTiddler.tiddlers);
|
||||
// Add the additional tiddlers
|
||||
$tw.utils.pushTop(tiddlers,additionalTiddlers)
|
||||
$tw.utils.pushTop(tiddlers,additionalTiddlers);
|
||||
// Remove any excluded tiddlers
|
||||
for(var t=tiddlers.length-1; t>=0; t--) {
|
||||
if(excludeTiddlers.indexOf(tiddlers[t]) !== -1) {
|
||||
@@ -75,6 +76,6 @@ exports.repackPlugin = function(title,additionalTiddlers,excludeTiddlers) {
|
||||
$tw.rootWidget.dispatchEvent({type: "tw-auto-save-wiki"});
|
||||
// Return a heartwarming confirmation
|
||||
return "Plugin " + title + " successfully saved";
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user