TuneText
Developer's Corner


Tips for using:




  JavaScript in TuneText-enabled content
Tips in no particular order.

1. Use external .js files.
Implementing your scripts as separate .js files (rather than including them in HTML code) allows reusing the scripts and speeding up the files loading: After the first download, the code stays in the browser cache.

2. Synchronization.
Your external JavaScript file should not contain commands that are executed during loading that file.
For example, do NOT use there document.write outside of any function. Instead, put the required document.write in some function and then call that function.

The reason for this restriction is the abnormal synchronization of IE during loading scripts from within other scripts (here, - from running TuneText). First, it executes all textual part of the JavaScript available on page, and only after that loads external files.

3. How to remove customization profiles after uninstalling TuneText.
TuneText uses the special persistence framework for browsers IE5+ , - Microsoft's userData. Depending on your operating system, the userData are saved in one of the following locations:

C:/WINDOWS/Profiles/SomeUser/UserData
C:/WINDOWS/Application Data/Microsoft/Internet Explorer/UserData
Documents and Settings/username/Application Data/Microsoft/Internet Explorer/UserData
However, you should process the data only through the browser (e.g., running TuneText), not directly!

Usually the actual size of TuneText profiles is minimal. For example, describing highlightings for the fragment consisting of thousands words takes just several bytes.
If, however, a size issue is very important to you, you can do one of the following.

  • Before removing TuneText Application from your disk, you should run its Clear utility.
    It's built into every TuneText (Ctrl-F5).
    OR
  • Download a similar utility from here, and run it from the directory where your TuneText was located.

Please also note, if size of available memory on your hard drive approaches zero, all UserData is cleared by your OS automatically.

3. Backslash.
Do not use "</" in the code of your scripts. Use "<\/" instead.

Technically, the first occurrence of "</" followed by any letter is considered the end tag for the SCRIPT element. While browsers are forgiving in this, authors should avoid using strings such as "</P>" in their embedded scripts. JavaScript allows authors to use a backslash to avoid ending the SCRIPT element prematurely.

Example: document.write("<\/P>")

4. Event handlers.
To enable its interactive interface, current version of TuneText overrides the following user's event handlers, if any:

onmousedown, onmouseup, ondblclick, onselectstart, oncontextmenu, onerror.

Users are able, however, to insert their code in onkeydown event handler, -- by modifying the function USERS_onkeydown() in TuneText_Design.js.
User's code can also override (generally not recommended!) TuneText event handlers oncopy, oncut, onbeforeprint, onafterprint.

Please also note. While in Edit mode, TuneText temporarly disables some of the handlers (within the scope of currently edited word only).

5. Do not replace HTML with JavaScript.
Apply your JavaScript mostly for adding elements of interactivity.
Main content should be formed by conventional HTML tags.
And your scripts should not be used for replacing the BODY content!
Otherwise, such newly generated content will be beyond TuneText's control.

If you need to replace some text at a runtime, use switching between several pre-made HTML Layers.


 Please check this page periodically for new updates