22The 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 ;
0 commit comments