From 9f6909ddc41af1ad6d8ef4c4d4c3cc25d8a746b8 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Tue, 6 Nov 2012 17:21:56 +0000 Subject: [PATCH] Appeasing the gods of JSHint --- core/boot.js | 45 ++++++++++--------- core/modules/filters.js | 2 +- core/modules/macros/fields.js | 1 - core/modules/macros/list/list.js | 2 +- core/modules/macros/list/listviews/cecily.js | 4 +- core/modules/macros/list/listviews/classic.js | 2 +- .../modules/macros/list/listviews/sideways.js | 4 +- core/modules/macros/navigator.js | 3 +- core/modules/macros/scrollable.js | 6 +-- core/modules/macros/view/view.js | 2 +- core/modules/macros/view/viewers/date.js | 2 +- core/modules/macros/view/viewers/link.js | 4 +- .../macros/view/viewers/relativedate.js | 2 +- core/modules/macros/view/viewers/text.js | 4 +- .../modules/macros/view/viewers/transclude.js | 4 +- core/modules/macros/view/viewers/wikified.js | 4 +- core/modules/parsers/imageparser.js | 18 ++++---- .../newwikitextparser/rules/classblock.js | 2 +- .../newwikitextparser/rules/classrun.js | 2 +- core/modules/savers/upload.js | 2 +- core/modules/serializers.js | 2 +- core/modules/startup.js | 4 +- core/modules/utils/dom/browser.js | 4 +- core/modules/utils/dom/dom.js | 2 +- core/modules/utils/dom/modal.js | 2 +- core/modules/utils/utils.js | 2 +- core/modules/wiki.js | 2 +- core/plugins/fullscreen/init.js | 2 +- 28 files changed, 69 insertions(+), 66 deletions(-) diff --git a/core/boot.js b/core/boot.js index cc98d4473..2d8920312 100644 --- a/core/boot.js +++ b/core/boot.js @@ -39,7 +39,7 @@ if(typeof(window) === "undefined" && !global.$tw) { // Crypto helper object // Setup crypto -$tw.crypto = new function() { +var Crypto = function() { var password = null, callSjcl = function(method,inputText) { var outputText; @@ -49,20 +49,20 @@ $tw.crypto = new function() { try { outputText = $tw.crypto.sjcl[method](password,inputText); } catch(ex) { - console.log("Crypto error:" + ex) + console.log("Crypto error:" + ex); outputText = null; } return outputText; }, getPassword = function() { if($tw.browser) { - password = prompt("Enter password to decrypt TiddlyWiki"); + password = window.prompt("Enter password to decrypt TiddlyWiki"); } }; this.setPassword = function(newPassword) { password = newPassword; - } + }; this.encrypt = function(text) { return callSjcl("encrypt",text); }; @@ -70,6 +70,7 @@ $tw.crypto = new function() { return callSjcl("decrypt",text); }; }; +$tw.crypto = new Crypto(); $tw.crypto.sjcl = $tw.browser ? window.sjcl : require("./sjcl.js"); @@ -453,6 +454,7 @@ $tw.Wiki.prototype.installPlugins = function() { Register all the module tiddlers that have a module type */ $tw.Wiki.prototype.registerModuleTiddlers = function() { + /*jslint evil: true */ var title, tiddler; // If in the browser, define any modules from plugins if($tw.browser) { @@ -466,7 +468,7 @@ $tw.Wiki.prototype.registerModuleTiddlers = function() { tiddler.fields.text, "})" ]; - $tw.modules.define(tiddler.fields.title,tiddler.fields["module-type"],window.eval(source.join(""))); + $tw.modules.define(tiddler.fields.title,tiddler.fields["module-type"],window["eval"](source.join(""))); } } } @@ -750,27 +752,28 @@ Load all the tiddlers from a directory $tw.extractTiddlersFromPath = function(filepath,basetitle,excludeRegExp) { basetitle = basetitle || "$:/plugins"; excludeRegExp = excludeRegExp || /^\.DS_Store$|.meta$/; - var tiddlers = []; + var tiddlers = [], + stat, files, pluginInfo, pluginTiddlers, f, file, titlePrefix, t, filesInfo, p, tidInfo, typeInfo, text; if(fs.existsSync(filepath)) { - var stat = fs.statSync(filepath); + stat = fs.statSync(filepath); if(stat.isDirectory()) { - var files = fs.readdirSync(filepath); + files = fs.readdirSync(filepath); // Look for a tiddlywiki.plugin file if(files.indexOf("tiddlywiki.plugin") !== -1) { // Read the plugin information - var pluginInfo = JSON.parse(fs.readFileSync(filepath + "/tiddlywiki.plugin").toString("utf8")); + pluginInfo = JSON.parse(fs.readFileSync(filepath + "/tiddlywiki.plugin").toString("utf8")); // Read the plugin files - var pluginTiddlers = []; - for(var f=0; f titlePrefix.length) { pluginInfo.tiddlers[pluginTiddlers[t].title.substr(titlePrefix.length)] = pluginTiddlers[t]; @@ -783,18 +786,18 @@ $tw.extractTiddlersFromPath = function(filepath,basetitle,excludeRegExp) { // Look for a tiddlywiki.files file } else if(files.indexOf("tiddlywiki.files") !== -1) { // If so, process the files it describes - var filesInfo = JSON.parse(fs.readFileSync(filepath + "/tiddlywiki.files").toString("utf8")); - for(var p=0; p