Giter VIP home page Giter VIP logo

jquery.natocallout's Introduction

jQuery.NatoCallout

NATO Callout Decoder - jQuery plugin

About

NatoCallout takes a string (as the option "decode") and, using the the NATO phonetic alphabet*, returns a string with the corresponding callout for each character of the "decode" string. Optionally it will append this string to the selected element(s). This is super useful to help users communicate things like registration codes to others verbally.

Usage

String return:

var decodeString = $.NatoCallout({'decode': 'This is a test'});

Shortcut:

var decodeString = $.NatoCallout('This is a test');

Will both set the variable "decodeString" to:

Tango Hotel India Sierra -SPACE- India Sierra -SPACE- Alpha -SPACE- Tango Echo Sierra Tango

Append to matching element(s):

$('#element').NatoCallout({'decode': 'This is a test'});

Will append the following to the element "element":

Tango Hotel India Sierra -SPACE- India Sierra -SPACE- Alpha -SPACE- Tango Echo Sierra Tango

Options

Below are the options which can be provided to NatoCallout along with their defaults:

{
      'decode'      : 'NatoCallout',
      'prefix'      : ' ',
      'postfix'     : '',
      'includeCase' : false,
      'upperOnly'   : true,
      'shortCase'   : false
}
  • Decode: the string to decode to the NATO phonetic alphabet
  • Prefix: the text and/or HTML to prepend to each decoded character (default is a space)
  • Postfix: the text and/or HTML to append to each decoded character
  • Include Case: whether or not to prepend the case of the decoded character to the decode
  • Upper Only: whether or not to prepend the case of the decoded character to the decode ONLY if it is uppercase (ignored if includeCase is false)
  • Short Case: whether or not to prepend the case of the decoded character to the decode using the corresponding "short" version (Uppercase = Upper, Lowercase = Lower) (ignored if includeCase is false)

Options Usage

If we wanted to make a simple list we could add a postfix of say, a line break:

$('#element').NatoCallout({'decode': 'This is a test', 'postfix': '<br />'});

Producing:

Tango
Hotel
India
Sierra
-SPACE-
India
Sierra
-SPACE-
Alpha
-SPACE-
Tango
Echo
Sierra
Tango

We could also get fancy, and do things like insert the callout into an ordered or unordered list, or a table:

$('#element').NatoCallout({'decode': 'This is a test', 'prefix': '<li>', 'postfix': '</li>'});
$('#element').NatoCallout({'decode': 'This is a test', 'prefix': '<tr><td>', 'postfix': '</td></tr>'});

If element "element" were an unordered list, with the first example the output would be:

  • Tango
  • Hotel
  • India
  • Sierra
  • -SPACE-
  • India
  • Sierra
  • -SPACE-
  • Alpha
  • -SPACE-
  • Tango
  • Echo
  • Sierra
  • Tango

References

githalytics.com alpha

jquery.natocallout's People

Watchers

 avatar  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.