Click here to Skip to main content
Licence BSD
First Posted 25 Dec 2008
Views 6,023
Downloads 11
Bookmarked 4 times

Telemetered Secure Data Effect

By James Ritchie Carroll | 25 Dec 2008
JavaScript based effect that simulates the transmission of secure data to a terminal.

1

2
2 votes, 40.0%
3

4
3 votes, 60.0%
5
4.11/5 - 5 votes
μ 4.11, σa 1.92 [?]

TelemeteredDataEffect

Introduction

This JavaScript based effect simulates the character-by-character transmission of secure data to a terminal.

Background

The code has been designed to move through a set of text on a character-by-character basis with a telemetry data received audio “blip”. This happens by making a copy of the text in a hidden DIV tag, and clearing the tag text then showing the DIV. Next, each character is reintroduced into the DIV tag one at a time while playing a “blip” sound.

The script also supports changing the audio “blip” style through an embedded tag: <!--SWAPSOUND-->. Here is the function that displays the next character:

Disclaimer: I have only tested the code on Internet Explorer so far.

function DisplayNextChar()
{
    var nextChar = text.charAt(index);

    if (nextChar == "<")
    {
        var endOfTag = text.indexOf(">", index) + 1;
        var tag = text.substring(index, endOfTag).toUpperCase();

        if (tag == "<!--SWAPSOUND-->")
        {
            Pause();
            tickSound = !tickSound;
            Resume();
        }
        else if (tag == "<BR>")
            document.all.message.innerHTML += "<BR><BR>";
        else
            document.all.message.innerHTML += tag;

        index = endOfTag;
    }
    else if (nextChar == "&")
    {
        var endOfElem = text.indexOf(";", index) + 1;

        document.all.message.innerHTML += text.substring(index, endOfElem);
        index = endOfElem;
    }
    else
    {
        document.all.message.innerHTML += nextChar;
        index++;
    }

    document.all.ScrollMarker.scrollIntoView();

    if (index >= text.length - 1)
    {
        Pause();
        document.all.EndTransmissionSound.src = "BlipEnd.wma";
    }
    else if (nextChar == ".")
    {
        Pause();
        setTimeout(Resume, 100);
    }
}

To add to the effect, the sound balance is rotated from one speaker to the other, adding to the allusion that the data is moving. This is accomplished by adjusting the sound’s balance property on a timer:

function RotateBalance()
{
    var balance = document.all.TelemetrySound.balance;

    balance += 50;
    if (balance > 5000) balance = -5000;

    document.all.TelemetrySound.balance = balance;
}

Using the code

The following code shows some example text and the script code in ONLOAD that starts the effect (make sure and download the entire set of script for proper operation - only excerpts of the code have been provided):

<BODY BGCOLOR="black" ONLOAD="InitTextEffect()" STYLE="MARGIN: 0px">
    <DIV ID="message" CLASS="message" STYLE="DISPLAY:none; PADDING-LEFT: 10px; ">
      Transmission one.<BR>
      <!--SWAPSOUND--><BR>
      Transmission two.<BR>
    </DIV>
    <A HREF="#" ID="ScrollMarker"></A>
</BODY>

License

This article, along with any associated source code and files, is licensed under The BSD License

About the Author

James Ritchie Carroll

Architect

United States United States

Member


Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
-- There are no messages in this forum --
Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120209.1 | Last Updated 25 Dec 2008
Article Copyright 2008 by James Ritchie Carroll
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid