mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 10:07:19 +00:00
JSHint-prompted tweaks
This commit is contained in:
parent
3e899d8daf
commit
6a7a5a2591
@ -649,7 +649,7 @@ $tw.plugins.loadPluginsFromFolder(path.resolve($tw.boot.wikiPath,"./tiddlers"),n
|
||||
$tw.plugins.registerPluginModules();
|
||||
|
||||
// Run any startup plugin modules
|
||||
var mainModules = $tw.plugins.moduleTypes["startup"];
|
||||
var mainModules = $tw.plugins.moduleTypes.startup;
|
||||
for(var m=0; m<mainModules.length; m++) {
|
||||
mainModules[m].startup.call($tw);
|
||||
}
|
||||
|
@ -30,6 +30,6 @@ exports.htmlEntities = {quot:34, amp:38, apos:39, lt:60, gt:62, nbsp:160, iexcl:
|
||||
|
||||
exports.preferences = {
|
||||
animationDuration: 400
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
||||
|
@ -21,15 +21,14 @@ exports.info = {
|
||||
};
|
||||
|
||||
exports.handleEvent = function(event) {
|
||||
switch(event.type) {
|
||||
case "click":
|
||||
var buttonEvent = document.createEvent("Event");
|
||||
buttonEvent.initEvent("tw-" + this.params.name,true,true);
|
||||
buttonEvent.tiddlerTitle = this.tiddlerTitle;
|
||||
buttonEvent.commandOrigin = this;
|
||||
event.target.dispatchEvent(buttonEvent);
|
||||
event.preventDefault();
|
||||
return false;
|
||||
if(event.type === "click") {
|
||||
var buttonEvent = document.createEvent("Event");
|
||||
buttonEvent.initEvent("tw-" + this.params.name,true,true);
|
||||
buttonEvent.tiddlerTitle = this.tiddlerTitle;
|
||||
buttonEvent.commandOrigin = this;
|
||||
event.target.dispatchEvent(buttonEvent);
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
@ -22,15 +22,14 @@ exports.info = {
|
||||
};
|
||||
|
||||
exports.handleEvent = function(event) {
|
||||
switch(event.type) {
|
||||
case "click":
|
||||
var text = this.wiki.renderTiddler(this.downloadType,this.downloadTitle),
|
||||
link = document.createElement("a");
|
||||
link.setAttribute("download",this.downloadFilename);
|
||||
link.setAttribute("href","data:" + this.downloadType + "," + encodeURIComponent(text));
|
||||
link.click();
|
||||
event.preventDefault();
|
||||
return false;
|
||||
if(event.type === "click") {
|
||||
var text = this.wiki.renderTiddler(this.downloadType,this.downloadTitle),
|
||||
link = document.createElement("a");
|
||||
link.setAttribute("download",this.downloadFilename);
|
||||
link.setAttribute("href","data:" + this.downloadType + "," + encodeURIComponent(text));
|
||||
link.click();
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
@ -27,20 +27,19 @@ exports.info = {
|
||||
};
|
||||
|
||||
exports.handleEvent = function (event) {
|
||||
switch(event.type) {
|
||||
case "click":
|
||||
if(isLinkExternal(this.params.to)) {
|
||||
event.target.setAttribute("target","_blank");
|
||||
return true;
|
||||
} else {
|
||||
var navEvent = document.createEvent("Event");
|
||||
navEvent.initEvent("tw-navigate",true,true);
|
||||
navEvent.navigateTo = this.params.to;
|
||||
navEvent.navigateFrom = this;
|
||||
event.target.dispatchEvent(navEvent);
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
if(event.type === "click") {
|
||||
if(isLinkExternal(this.params.to)) {
|
||||
event.target.setAttribute("target","_blank");
|
||||
return true;
|
||||
} else {
|
||||
var navEvent = document.createEvent("Event");
|
||||
navEvent.initEvent("tw-navigate",true,true);
|
||||
navEvent.navigateTo = this.params.to;
|
||||
navEvent.navigateFrom = this;
|
||||
event.target.dispatchEvent(navEvent);
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -90,18 +90,17 @@ exports.getSliderChildren = function() {
|
||||
};
|
||||
|
||||
exports.handleEvent = function(event) {
|
||||
switch(event.type) {
|
||||
case "click":
|
||||
if(event.target === this.domNode.firstChild.firstChild) {
|
||||
this.isOpen = !this.isOpen;
|
||||
if(!this.saveOpenState()) {
|
||||
this.refreshInDom({});
|
||||
}
|
||||
event.preventDefault();
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
if(event.type === "click") {
|
||||
if(event.target === this.domNode.firstChild.firstChild) {
|
||||
this.isOpen = !this.isOpen;
|
||||
if(!this.saveOpenState()) {
|
||||
this.refreshInDom({});
|
||||
}
|
||||
event.preventDefault();
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
@ -163,9 +163,9 @@ exports.postRenderInDom = function() {
|
||||
var StoryView = this.wiki.macros.story.viewers[this.params.storyview];
|
||||
if(StoryView) {
|
||||
this.storyview = new StoryView(this);
|
||||
};
|
||||
}
|
||||
if(!this.storyview) {
|
||||
StoryView = this.wiki.macros.story.viewers["scroller"];
|
||||
StoryView = this.wiki.macros.story.viewers.scroller;
|
||||
if(StoryView) {
|
||||
this.storyview = new StoryView(this);
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ exports.compileFilter = function(filterString) {
|
||||
operator = operation.operators[p];
|
||||
operatorInfo = this.operators[operator.operator];
|
||||
if(!operatorInfo) { // Check for it being a field operator
|
||||
operatorInfo = this.operators["field"];
|
||||
operatorInfo = this.operators.field;
|
||||
}
|
||||
output.push(operatorInfo[type](operator));
|
||||
type = "filter";
|
||||
@ -139,29 +139,25 @@ exports.operators = {
|
||||
},
|
||||
"is": {
|
||||
selector: function(operator) {
|
||||
switch(operator.operand) {
|
||||
case "tiddler":
|
||||
if(operator.prefix === "!") {
|
||||
return "subResults = [];";
|
||||
} else {
|
||||
return "for(var title in source) {$tw.utils.pushTop(subResults,title);}";
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw "Unknown operand for 'is' filter operator";
|
||||
if(operator.operand === "tiddler") {
|
||||
if(operator.prefix === "!") {
|
||||
return "subResults = [];";
|
||||
} else {
|
||||
return "for(var title in source) {$tw.utils.pushTop(subResults,title);}";
|
||||
}
|
||||
} else {
|
||||
throw "Unknown operand for 'is' filter operator";
|
||||
}
|
||||
},
|
||||
filter: function(operator) {
|
||||
switch(operator.operand) {
|
||||
case "tiddler":
|
||||
if(operator.prefix === "!") {
|
||||
return "subResults = [];";
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw "Unknown operand for 'is' filter operator";
|
||||
if(operator.operand === "tiddler") {
|
||||
if(operator.prefix === "!") {
|
||||
return "subResults = [];";
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
} else {
|
||||
throw "Unknown operand for 'is' filter operator";
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -248,7 +248,7 @@ exports.initParsers = function(moduleType) {
|
||||
}
|
||||
}
|
||||
// Install the wikitext rules
|
||||
modules = $tw.plugins.moduleTypes["wikitextrule"];
|
||||
modules = $tw.plugins.moduleTypes.wikitextrule;
|
||||
var wikitextparser = this.parsers["text/x-tiddlywiki"];
|
||||
if(modules && wikitextparser) {
|
||||
for(n=0; n<modules.length; n++) {
|
||||
|
11
run.sh
11
run.sh
@ -12,13 +12,4 @@ node ../core/boot.js \
|
||||
popd > /dev/null
|
||||
|
||||
# run jshint
|
||||
jshint ./core/*.js
|
||||
jshint ./core/modules/*.js
|
||||
jshint ./core/modules/commands/*.js
|
||||
jshint ./core/modules/macros/*.js
|
||||
jshint ./core/modules/macros/edit/*.js
|
||||
jshint ./core/modules/macros/edit/editors/*.js
|
||||
jshint ./core/modules/parsers/*.js
|
||||
jshint ./core/modules/parsers/wikitextparser/*.js
|
||||
jshint ./core/modules/parsers/wikitextparser/rules/*.js
|
||||
jshint ./core/modules/treenodes/*.js
|
||||
jshint core
|
||||
|
Loading…
Reference in New Issue
Block a user