Coder Social home page Coder Social logo

acronymizer.js's Introduction

#acronymizer.js

Wraps text in HTML with an element (acron by default) whilst keeping any bound events intact.

Link

https://github.com/xurion/acronymizer.js

Examples

Simple

var div = document.getElementById('myDiv'),
    acron = new Acronymizer({
        element: div,
        pattern: 'CSS'
    });

acron.init();

Advanced

var div = document.getElementById('myDiv'),
    acron = new Acronymizer();

acron.setElement(div);
acron.setPattern('PHP');
acron.setWrapper('a');
acron.setAttribute('href', 'php.html');
acron.init();

Install

To use acronymizer.js, simply add it to your markup:

<script type="text/javascript" src="acronymizer/dist/acronymizer.min.js"></script>

Skipping elements

To have acronymizer ignore elements, simply apply the "acronymizer-skip" class to that element. That element, as well as all nested elements, will be skipped.

History

acronymizer.js initially started it's life as an easy way to wrap text patterns in markup with acron elements. This allowed me to acronym abbreviations, like CSS and PHP and provide a tooltip as you hovered over it.

It has since been modified to be a JSHint-covered, tested class to allow the wrapping of any pattern with any element, along with any attributes.

acronymizer.js's People

Contributors

xurion avatar

Watchers

 avatar James Cloos avatar

acronymizer.js's Issues

Better error messages required for Acronymizer.go() failure.

By executing the Acronymizer.go() function without first defining either an element or pattern, the generic Error "All options have not been defined correctly" is thrown.

This needs to be made to throw a more specific Error. For example: "Cannot Acronymize: an element has not be defined" or "Cannot Acronymize: a pattern has not be defined".

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.