Giter Club home page Giter Club logo

text-descrambler's Introduction

Text deScrambler - A jQuery Plugin.

Check out the interactive demo here.


Description

Text DeScrambler is a jQuery plugin designed to simulate the cliched movie trope of a sequence of characters being descrambled (usually in the context of a hacker realising the password was the bad guy's wife's birthday backwards all along, or whatever).

Usage

When called on an element with a text value, the scramble mothod will reveal that value through a process that simulates the 'unscrambling' of each character in the string.

$(".elementToScramble").scramble(4000, 20, "alphabet", true);

Parameters

$element.scramble(duration, interval, characterSet, uppercase)
duration
  • Description: Time, in milliseconds, over which the deScrambling effect will take place.
  • Type: Number.
  • Optional.
  • Default: 3000.
  • Min: 1000.
  • Max: 20000.
interval
  • Description: Time, in milliseconds, between each successive character being unscrambled.
  • Type: Number.
  • Optional.
  • Default: 20.
  • Min: 5.
  • Max: 1000.
characterSet
  • Description: The character set (from a list of pre-defined character set) to use when substituting scrambled characters in the string.
  • Type: String.
  • Optional.
  • Default: "all".
  • Acceptable parameters:
    • "all" - combination of all character sets.
    • "alphanumeric" - all letters and numbers.
    • "alphabet" - all letters only.
    • "punctuation" - punctuation only.
    • "numbers" - numbers only.
uppercase
  • Description: Determines whether the substitued scrambled characters are to be uppercase or lowercase.
  • Type: Boolean.
  • Optional.
  • Default: true.

Installation

# EITHER: annotated plugin
curl https://github.com/cjbarnaby/text-descrambler/raw/master/dist/descrambler.js > descrambler.js
# OR: minimized plugin
curl https://github.com/cjbarnaby/text-descrambler/raw/master/dist/descrambler.min.js > descrambler.js
  • Copy jQuery to your app's directory:
curl https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.js > jQuery.js
  • Create a file for your own custom JavaScript:
touch main.js
  • Add jQuery and the deScrambler plugin to your HTML:
<head>
  <script src="jQuery.js"></script>
  <script src="dist/descrambler.js"></script>
  <script src="main.js"></script>
</head>
<body>
  <p>Here's some text.</p>
</body>
  • Start scrambling! In your custom main.js file:
$(document).ready(function() {
  $("p").scramble();
});

Notes

  • This plugin works best with monospace fonts.
  • If (interval / duration / $el.text().length) < 1, the scrambling sequence will run indefinitely (and never resolve to the element's original text value).

text-descrambler's People

Contributors

cjbarnaby avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.