Code Monkey home page Code Monkey logo

jquery.dialogue.js's Introduction

jquery.dialogue.js

A lightweight, awesome and beautiful browser dialog alternative for jquery. Easily customizable via CSS and definitely gets the job done.

Use

<script src="jquery-1.5.2.min.js" type="text/javascript"></script>
<script src="jquery.dialogue.js" type="text/javascript"></script>
<link href="jquery.dialogue.css" rel="stylesheet" media="screen" type="text/css" />

Examples

$.dialogue.alert('hello world'); 
$.dialogue.alert('hello world', {titleText : 'Custom Alert Title'}); 
$.dialogue.confirm('Are you sure you want to continue?', {titleText : 'Confirm'});
$.dialogue.input('Is this cool?', {}, function(r) { $.dialogue.alert(r); }); 
$.dialogue.input('Example w/ a custom dimension', {width : 350, height : 150}); 

see demo.html

More Examples

Confirm w/ callback

$.dialogue.confirm("Are you sure?", {}, function(v) {

  if(v) {
    // do your thing
  } else {
    // do nothing
  }

});

Alert from an element's content

$.dialogue.alert($('#somediv')); 

Themes

Facebook LOL. Use this CSS file.

<link href="src/jquery.dialogue-fb.css" rel="stylesheet" media="screen" type="text/css" /a>

Ruby on Rails?

Not a problem! Just find and override your rails.js w/ this code. If someone else has a better idea of doing this let us know!

$('a[data-confirm], a[data-method], a[data-remote]').live('click.rails', function(e) {
    var link = $(this);

    var message = link.data('confirm');
    
    $.dialogue.confirm(message, {}, function(r) {

      if(r) {

        if (link.data('remote') != undefined) {
          handleRemote(link);
          return false;
        } else if (link.data('method')) {
          handleMethod(link);
          return false;
        }

      } else {
        return false;
      }

    });

    return false; 
}); 

And you'll now be able to use it w/o changing anything on your rails code! Awesome eh?

<%= link_to 'foo', 'bar', :confirm => "Are you sure?" %>

or

<%= link_to 'foo', 'bar', :method => :delete, :remote => true, :confirm => "Are you sure?" %>

Contributing/Issues

Want to contribute? Issues? Great! Don't hesitate :D

License

MIT

Credits

Most credits go to http://thrivingkings.com/apprise for the initial code and the CSS. We're using it on our app and we've been improving and refactoring it eventually rewriting everything again from scratch.

Others

Copyright 2011 - ProudCloud.net {:build => 'a better web'}

jquery.dialogue.js's People

Contributors

jasontorres avatar voidnothings avatar

Stargazers

Björn Calamay 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.