• Stars
    star
    53
  • Rank 548,344 (Top 11 %)
  • Language
    JavaScript
  • Created about 14 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Inline Confirmation plugin for jQuery. One of the less obtrusive ways of implementing confirmation dialogues.

Inline Confirmation plugin for jQuery endorse

In a web app, it is very common to have actions that destroy (delete/remove) data. These actions, if you don’t already know, should always map to POST methods. On top of that, because these actions are destructive, the UI should always ask the user for confirmation.

But how do we actually implement the confirmation dialogue though? The vanilla JavaScript confirm box would be the easiest but at the same time the ugliest - this thing stalls most web browsers until the user acts on it.

An inline popup/modal box? Perhaps, but it is still obtrusive, in the sense that the popup/model boxes are usually in the way of other tasks.

Meet Inline Confirmation - a jQuery plugin for creating easy, less obtrusive confirmation dialogues!

Configuration

There are a few options to customise the behaviour of this plugin:

Option Type Description
confirm String The HTML for the confirm action (default: "<a href='#'>Confirm</a>").
cancel String The HTML for the cancel action (default: "<a href='#'>Cancel</a>").
separator String The HTML for the separator between the confirm and the cancel actions (default: " ").
reverse Boolean Revert the confirm and the cancel actions (default: false).
hideOriginalAction Boolean Whether or not to hide the original action, useful for display the dialogue as a modal if set to false (default: true).
bindsOnEvent String The JavaScript event handler for binding the confirmation action (default: "click").
expiresIn Integer Seconds before the confirmation dialogue closes automatically, 0 to disable this feature (default: 0).
confirmCallback Function The callback function to execute after the confirm action, accepts the original action object as an argument.
cancelCallback Function The callback function to execute after the cancel action, accepts the original action object as an argument.

Usage

// using default options
$("a.delete").inlineConfirmation();

// using some custom options
$("a.delete").inlineConfirmation({
  confirm: "<a href='#' class='confirm-yes'>Yes</a>",
  cancel: "<a href='#' class='confirm-no'>No</a>",
  separator: " | ",
  reverse: true,
  bindsOnEvent: "hover",
  confirmCallback: function(action) {
    action.parent().fadeIn();
  }
});

Demo

Click here for a simple demo.

Changelog

v1.4.2 [2013-03-07]

  • Use jQuery 1.7+'s on() instead of the old live()

v1.4.1 [2011-07-30]

  • Fixed a bug where timeouts aren't being reset correctly.
  • Fixed a bug where the click handler executes the default link behaviour.

v1.4.0 [2011-06-28]

  • Added a demo and readme to the repository.

v1.3.1 [2010-08-04]

  • Fixed a regression bug that causes expiresIn to stop working.

v1.3.0 [2010-08-04]

  • Removed allowMultiple option as tracking multiple instances of the dialogues is not a good idea (the code was broken anyway).
  • Added the original action object as an argument to the callback functions.
  • Fixed a bug where original actions would disappear.

v1.2.0 [2010-08-04]

  • Added hideOriginalAction option.

v1.1.0 [2010-08-04]

  • Added allowMultiple option.

v1.0.0 [2010-08-03]

  • Initial release.

More jQuery Plugins

Check out my other jQuery plugins:

License

Copyright (c) 2010-2012 Fred Wu

Released under the MIT license.

Bitdeli Badge

More Repositories

1

crawler

A high performance web crawler / scraper in Elixir.
Elixir
917
star
2

jquery-endless-scroll

Endless/infinite scrolling/pagination.
CoffeeScript
838
star
3

angel_nest

Project code name: Angel Nest. :)
Ruby
775
star
4

api_taster

A quick and easy way to visually test your Rails application's API.
Ruby
728
star
5

simple_bayes

A Naive Bayes machine learning implementation in Elixir.
Elixir
392
star
6

datamappify

Compose, decouple and manage domain logic and data persistence separately. Works particularly great for composing form objects!
Ruby
332
star
7

opq

Elixir queue! A simple, in-memory queue with worker pooling and rate limiting in Elixir.
Elixir
255
star
8

stemmer

An English (Porter2) stemming implementation in Elixir.
Elixir
149
star
9

bustle

Activities recording and retrieving using a simple Pub/Sub-like interface.
Ruby
93
star
10

ruby_decorators

Ruby method decorators inspired by Python.
Ruby
63
star
11

inherited_resources_views

Share and DRY up views between resources. Use with Inherited Resources.
Ruby
60
star
12

toy-robot-elixir

The infamous Toy Robot code test done in Elixir.
Elixir
45
star
13

skinny-coffee-machine

A simple JavaScript state machine with observers, for browsers and Node.js.
JavaScript
42
star
14

kohana-phamlp

This module is a bridge between the Kohana PHP framework (http://kohanaframework.org/) and the PHamlP library (http://code.google.com/p/phamlp/).
PHP
25
star
15

authlite

Authlite, an auth module for Kohana PHP framework, it offers greater flexibility than the official Auth module.
PHP
23
star
16

dotfiles

My dotfiles
Shell
18
star
17

amaze_hands

Amaze Hands is an amazing tool developed for analysing Kanban board cards.
Ruby
15
star
18

kthrottler

A Kohana port of Action Throtller (for Rails): http://github.com/fredwu/action_throttler
PHP
14
star
19

jquery-slideshow-lite

An extremely lightweight slideshow plugin for jQuery.
JavaScript
14
star
20

code-test-2016-cultureamp

Ruby
13
star
21

README-xplor

Fred @ Xplor - how to work with me.
10
star
22

code-test-2016-myob

Ruby
8
star
23

code-test-2016-trunkplatform

Ruby
6
star
24

action_throttler

An easy to use Rails plugin to quickly throttle application actions based on configurable duration and limit.
Ruby
6
star
25

app_reset

Resets (and if available, seeds) your databases.
Ruby
6
star
26

yield.rb

Aggregated token amounts and values. Supports ApeBoard, YieldWatch, Binance, CoinGecko and more.
Ruby
5
star
27

layerful

Layerful PHP framework.
4
star
28

advent_of_code_2018

https://adventofcode.com/2018/about
Elixir
4
star
29

security_guard

A collection of useful tools for auditing data and performing security checks.
Ruby
3
star
30

fredwu.me-v3

JavaScript
3
star
31

ruby-slim-tmbundle

https://github.com/slim-template/ruby-slim.tmbundle
3
star
32

kata-poker-hands-elixir

A coding kata for comparing poker hands - Elixir version.
Elixir
2
star
33

flower

Playground to test out the Lotus framework.
Ruby
2
star
34

jqstub

A simple stub library for jQuery / Zepto objects.
JavaScript
1
star
35

project_retard

One sale a day e-commerce platform built on Ruby on Rails.
JavaScript
1
star
36

reacraft

Ruby
1
star
37

kata-poker-hands-ruby

A coding kata for comparing poker hands - Ruby version.
Ruby
1
star
38

toy-robot-lolz

It's art. And it's beautiful.
Ruby
1
star
39

code-test-2016-adslot

CoffeeScript
1
star
40

spiky_xml

Just a spike on XML parsing in different environments.
JavaScript
1
star