1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-27 07:43:14 +00:00

JSHint obeisance for plugins folder

Also add a jshintignore file to skip the various imported modules
This commit is contained in:
Jermolene 2014-08-30 21:32:55 +01:00
parent 3a67fdb768
commit 9c74afdd1a
29 changed files with 63 additions and 57 deletions

7
.jshintignore Normal file
View File

@ -0,0 +1,7 @@
plugins/tiddlywiki/browser-sniff/files
plugins/tiddlywiki/codemirror/files/
plugins/tiddlywiki/d3/files/
plugins/tiddlywiki/highlight/files/
plugins/tiddlywiki/jasmine/files/
plugins/tiddlywiki/markdown/files/
plugins/tiddlywiki/markdown/files/

View File

@ -13,7 +13,7 @@ Initialise $:/info/browser tiddlers
"use strict";
exports.getInfoTiddlerFields = function() {
var mapBoolean = function(value) {return value ? "yes" : "no"},
var mapBoolean = function(value) {return value ? "yes" : "no";},
infoTiddlerFields = [];
// Basics
if($tw.browser) {

View File

@ -113,7 +113,7 @@ CecilyStoryView.prototype.lookupTiddlerInMap = function(title,domNode) {
if(tiddler) {
var draftOf = tiddler.fields["draft.of"];
if(draftOf && this.map.positions[draftOf]) {
return this.map.positions[draftOf]
return this.map.positions[draftOf];
}
}
// Try looking the target tiddler up in the map

View File

@ -25,14 +25,14 @@ Config options "$:/config/CodeMirror" e.g. to allow vim key bindings
/*global $tw: false */
"use strict";
var CODEMIRROR_OPTIONS = "$:/config/CodeMirror"
var CODEMIRROR_OPTIONS = "$:/config/CodeMirror";
// Install CodeMirror
if($tw.browser && !window.CodeMirror) {
window.CodeMirror = require("$:/plugins/tiddlywiki/codemirror/lib/codemirror.js");
// Install required CodeMirror plugins
var configOptions = $tw.wiki.getTiddlerData(CODEMIRROR_OPTIONS,{}),
req = configOptions["require"];
req = configOptions.require;
if(req) {
if($tw.utils.isArray(req)) {
for(var index=0; index<req.length; index++) {

View File

@ -57,7 +57,7 @@ BarWidget.prototype.createChart = function(parent,nextSibling) {
n = 4; // number of layers
m = 58; // number of samples per layer
stack = d3.layout.stack();
layers = stack(d3.range(n).map(function() { return bumpLayer(m, .1); }));
layers = stack(d3.range(n).map(function() { return bumpLayer(m, 0.1); }));
}
// Calculate the maximum data values
var yGroupMax = d3.max(layers, function(layer) { return d3.max(layer, function(d) { return d.y; }); }),
@ -69,7 +69,7 @@ BarWidget.prototype.createChart = function(parent,nextSibling) {
// x-scale
var x = d3.scale.ordinal()
.domain(d3.range(m))
.rangeRoundBands([0, width], .08);
.rangeRoundBands([0, width], 0.08);
// y-scale
var y = d3.scale.linear()
.domain([0, yStackMax])
@ -157,9 +157,9 @@ BarWidget.prototype.createChart = function(parent,nextSibling) {
// Inspired by Lee Byron's test data generator.
function bumpLayer(n, o) {
function bump(a) {
var x = 1 / (.1 + Math.random()),
y = 2 * Math.random() - .5,
z = 10 / (.1 + Math.random());
var x = 1 / (0.1 + Math.random()),
y = 2 * Math.random() - 0.5,
z = 10 / (0.1 + Math.random());
for (var i = 0; i < n; i++) {
var w = (i / n - y) * z;
a[i] += x * Math.exp(-w * w);

View File

@ -24,20 +24,19 @@ function FileSystemAdaptor(options) {
this.logger = new $tw.utils.Logger("FileSystem");
this.setwatcher = function(filename, title) {
return undefined;
return this.watchers[filename] = this.watchers[filename] ||
fs.watch(filename, {persistent: false}, function(e) {
self.logger.log("Error:",e,filename);
if(e === "change") {
var tiddlers = $tw.loadTiddlersFromFile(filename).tiddlers;
for(var t in tiddlers) {
if(tiddlers[t].title) {
self.wiki.addTiddler(tiddlers[t]);
}
}
}
});
}
//return this.watchers[filename] = this.watchers[filename] ||
// fs.watch(filename, {persistent: false}, function(e) {
// self.logger.log("Error:",e,filename);
// if(e === "change") {
// var tiddlers = $tw.loadTiddlersFromFile(filename).tiddlers;
// for(var t in tiddlers) {
// if(tiddlers[t].title) {
// self.wiki.addTiddler(tiddlers[t]);
// }
// }
// }
// });
};
for(var f in $tw.boot.files) {
var fileInfo = $tw.boot.files[f];
this.setwatcher(fileInfo.filepath, f);
@ -108,7 +107,7 @@ Given a tiddler title and an array of existing filenames, generate a new legal f
*/
FileSystemAdaptor.prototype.generateTiddlerFilename = function(title,extension,existingFilenames) {
// First remove any of the characters that are illegal in Windows filenames
var baseFilename = title.replace(/\<|\>|\:|\"|\/|\\|\||\?|\*|\^/g,"_");
var baseFilename = title.replace(/<|>|\:|\"|\/|\\|\||\?|\*|\^/g,"_");
// Truncate the filename if it is too long
if(baseFilename.length > 200) {
baseFilename = baseFilename.substr(0,200) + extension;

View File

@ -48,7 +48,7 @@ Static method that returns true if this saver is capable of working
*/
exports.canSave = function(wiki) {
// Check if we're running under node-webkit
return (typeof process == "object")
return (typeof process == "object");
};
/*

View File

@ -37,7 +37,7 @@ TiddlyWebAdaptor.prototype.getHost = function() {
TiddlyWebAdaptor.prototype.getTiddlerInfo = function(tiddler) {
return {
bag: tiddler.fields["bag"]
bag: tiddler.fields.bag
};
};
@ -248,7 +248,7 @@ TiddlyWebAdaptor.prototype.convertTiddlerToTiddlyWebFormat = function(tiddler) {
// Default the content type and convert the type "text/x-tiddlywiki" into null
if(result.type === "text/x-tiddlywiki") {
result.type = null;
};
}
result.type = result.type || "text/vnd.tiddlywiki";
return JSON.stringify(result,null,$tw.config.preferences.jsonSpaces);
};