Skip to content

Commit 6c17779

Browse files
authored
Remove function wrapper (#316)
1 parent 7214ab4 commit 6c17779

File tree

21 files changed

+39
-145
lines changed

21 files changed

+39
-145
lines changed

plugins/tiddlydesktop/modules/startup/globals.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ Set up globals:
88
* Copy version number from tiddler $:/TiddlyDesktop/version to variable $tw.desktop.version
99
1010
\*/
11-
(function(){
12-
13-
/*jslint node: true, browser: true */
14-
/*global $tw: false */
1511
"use strict";
1612

1713
// Export name and synchronous status
@@ -23,5 +19,3 @@ exports.startup = function() {
2319
$tw.desktop = $tw.desktop || {};
2420
$tw.desktop.version = $tw.wiki.getTiddlerText("$:/TiddlyDesktop/version");
2521
};
26-
27-
})();

plugins/tiddlydesktop/modules/startup/handlers.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ module-type: startup
66
Event handlers for the root widget
77
88
\*/
9-
(function(){
10-
11-
/*jslint node: true, browser: true */
12-
/*global $tw: false */
139
"use strict";
1410

1511
// Export name and synchronous status
@@ -66,4 +62,3 @@ exports.startup = function() {
6662
return false;
6763
});
6864
};
69-
})();

plugins/tiddlydesktop/modules/widgets/droplink.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ module-type: widget
66
Droplink widget
77
88
\*/
9-
(function(){
10-
11-
/*jslint node: true, browser: true */
12-
/*global $tw: false */
139
"use strict";
1410

1511
var Widget = require("$:/core/modules/widgets/widget.js").widget;
@@ -147,5 +143,3 @@ DropLinkWidget.prototype.refresh = function(changedTiddlers) {
147143
};
148144

149145
exports.droplink = DropLinkWidget;
150-
151-
})();

propagate-version.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ Propogate the version number from package.json to:
77
88
*/
99

10-
(function(){
11-
12-
/*jslint browser: true */
1310
"use strict";
1411

1512
var fs = require("fs"),
@@ -30,5 +27,3 @@ fs.writeFileSync("./source/tiddlywiki/plugins/tiddlywiki/tiddlydesktop/plugin.in
3027

3128
// Create $:/plugins/tiddlywiki/tiddlydesktop/version
3229
fs.writeFileSync("./source/tiddlywiki/plugins/tiddlywiki/tiddlydesktop/system/version.txt",packageInfo.version);
33-
34-
})();

source/js/backstage-window.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
Class for backstage windows
33
*/
44

5-
(function(){
6-
7-
/*jslint browser: true */
85
"use strict";
96

107
var windowBase = require("../js/window-base.js"),
@@ -127,5 +124,3 @@ BackstageWindow.prototype.reopen = function() {
127124
};
128125

129126
exports.BackstageWindow = BackstageWindow;
130-
131-
})();

source/js/main.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
Main script, executed via main.html
33
*/
44

5-
(function(){
6-
7-
/*jslint browser: true */
85
"use strict";
96

107
var gui = require("nw.gui"),
@@ -179,5 +176,3 @@ $tw.boot.boot(function() {
179176
$tw.desktop.windowList.openByUrl("backstage://WikiListWindow",{mustQuitOnClose: true});
180177
}
181178
});
182-
183-
})();

source/js/utils/classic-inject.js

Lines changed: 38 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,50 +2,46 @@
22
The JavaScript in this file is injected into each TiddlyWiki Classic page that loads
33
*/
44

5-
(function () {
6-
7-
/*
8-
Returns true if successful, false if failed, null if not available
9-
*/
10-
var injectedSaveFile = function(path,content) {
11-
// Find the message box element
12-
var messageBox = document.getElementById("tiddlyfox-message-box");
13-
if(messageBox) {
14-
// Create the message element and put it in the message box
15-
var message = document.createElement("div");
16-
message.setAttribute("data-tiddlyfox-path",path);
17-
message.setAttribute("data-tiddlyfox-content",content);
18-
messageBox.appendChild(message);
19-
// Create and dispatch the custom event to the extension
20-
var event = document.createEvent("Events");
21-
event.initEvent("tiddlyfox-save-file",true,false);
22-
message.dispatchEvent(event);
23-
}
24-
return true;
25-
};
26-
27-
/*
28-
Returns text if successful, false if failed, null if not available
29-
*/
30-
var injectedLoadFile = function(path) {
31-
if(getLocalPath(document.location.toString()) === path) {
32-
return this.tiddlywikiSourceText;
33-
} else {
34-
return false;
35-
}
36-
};
37-
38-
var injectedConvertUriToUTF8 = function(path) {
39-
return path;
5+
/*
6+
Returns true if successful, false if failed, null if not available
7+
*/
8+
var injectedSaveFile = function(path,content) {
9+
// Find the message box element
10+
var messageBox = document.getElementById("tiddlyfox-message-box");
11+
if(messageBox) {
12+
// Create the message element and put it in the message box
13+
var message = document.createElement("div");
14+
message.setAttribute("data-tiddlyfox-path",path);
15+
message.setAttribute("data-tiddlyfox-content",content);
16+
messageBox.appendChild(message);
17+
// Create and dispatch the custom event to the extension
18+
var event = document.createEvent("Events");
19+
event.initEvent("tiddlyfox-save-file",true,false);
20+
message.dispatchEvent(event);
4021
}
22+
return true;
23+
};
4124

42-
var injectedConvertUnicodeToFileFormat = function(s) {
43-
return s;
25+
/*
26+
Returns text if successful, false if failed, null if not available
27+
*/
28+
var injectedLoadFile = function(path) {
29+
if(getLocalPath(document.location.toString()) === path) {
30+
return this.tiddlywikiSourceText;
31+
} else {
32+
return false;
4433
}
34+
};
35+
36+
var injectedConvertUriToUTF8 = function(path) {
37+
return path;
38+
}
4539

46-
window.mozillaSaveFile = injectedSaveFile;
47-
window.mozillaLoadFile = injectedLoadFile;
48-
window.convertUriToUTF8 = injectedConvertUriToUTF8;
49-
window.convertUnicodeToFileFormat = injectedConvertUnicodeToFileFormat;
40+
var injectedConvertUnicodeToFileFormat = function(s) {
41+
return s;
42+
}
5043

51-
})();
44+
window.mozillaSaveFile = injectedSaveFile;
45+
window.mozillaLoadFile = injectedLoadFile;
46+
window.convertUriToUTF8 = injectedConvertUriToUTF8;
47+
window.convertUnicodeToFileFormat = injectedConvertUnicodeToFileFormat;

source/js/utils/devtools.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
Utilities concerned with managing the devtools panel
33
*/
44

5-
(function(){
6-
7-
/*jslint browser: true */
85
"use strict";
96

107
/*
@@ -21,5 +18,3 @@ exports.trapDevTools = function(window_nwjs,document) {
2118
return true;
2219
});
2320
};
24-
25-
})();

source/js/utils/dom.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
Utilities concerned with the DOM
33
*/
44

5-
(function(){
6-
7-
/*jslint browser: true */
85
"use strict";
96

107
exports.decodeQueryString = function(location) {
@@ -55,5 +52,3 @@ exports.findParentWithTag = function(node,tagName) {
5552
}
5653
return null;
5754
};
58-
59-
})();

source/js/utils/file.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
Utilities concerned with file and path manipulation
33
*/
44

5-
(function(){
6-
7-
/*jslint browser: true */
85
"use strict";
96

107
exports.convertFileUrlToPath = function(url) {
@@ -28,5 +25,3 @@ exports.convertPathToFileUrl = function(path) {
2825
}
2926
return fileUriPrefix + path.replace(/\\/g,"/");
3027
}
31-
32-
})();

0 commit comments

Comments
 (0)