GithubHelp home page GithubHelp logo

bootstrap-prompts's Introduction

Bootstrap-Prompts is an implementation to replace the alert(), prompt(),confirm() notifications on the browser when using Twitter Bootstrap with Modal information.

Requires

  • Requires Twitter Bootstrap and JQuery to be initialized before using alert()

TODO

Need to implement prompt() and confirm() actions so that they return

bootstrap-prompts's People

Contributors

danteoh avatar sairam avatar weisjohn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bootstrap-prompts's Issues

Do not work with Bootstrap v3.0 (have fixed source code)

It work again when fixed by myself.
Fixed source code below:

/*! bootstrap-prompts-alert.js [for Bootstrap v3.0](Fixed by Cow258)*/
bootStrapAlertHeader = 'Alert'; window._originalAlert = window.alert; window.alert = function (text) { var bootStrapAlert = function () { if (!$.fn.modal.Constructor) return false; if ($('#windowAlertModal').length == 1) return true; $('body').append('<div id="windowAlertModal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true"><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button><h4 class="modal-title text-danger">' + bootStrapAlertHeader + '</h4></div><div class="modal-body"><p> alert text </p></div><div class="modal-footer" style="text-align: center;"><button class="btn btn-danger" data-dismiss="modal" aria-hidden="true">Close</button></div></div></div></div>'); return true; }; if (bootStrapAlert()) { $('#windowAlertModal .modal-body p').text(text); $('#windowAlertModal').modal(); } else { console.log('bootstrap was not found'); window._originalAlert(text); } }
bootStrapConfirmHeader = 'Confirm'; window._originalConfirm = window.confirm; window.confirm = function (text, cb) { var initTemplate = function () { if ($('#windowConfirmModal').length == 1) return true; $('body').append('<div id="windowConfirmModal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true"><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button><h4 class="modal-title text-danger">' + bootStrapConfirmHeader + '</h4></div><div class="modal-body"><p> alert text </p></div><div class="modal-footer" style="text-align: center;"><button class="btn btn-primary" data-dismiss="modal" aria-hidden="true">YES</button><button class="btn btn-danger" data-dismiss="modal" aria-hidden="true">NO</button></div></div></div></div>'); }; var bootStrapConfirm = function () { if (!$.fn.modal.Constructor) return false; $('body').off('click', '#windowConfirmModal .btn-primary'); $('body').off('click', '#windowConfirmModal .btn-danger'); function confirm() { cb(true); } function deny() { cb(false); } $('body').on('click', '#windowConfirmModal .btn-primary', confirm); $('body').on('click', '#windowConfirmModal .btn-danger', deny); return true; }; initTemplate(); if (bootStrapConfirm()) { $('#windowConfirmModal .modal-body p').text(text); $('#windowConfirmModal').modal(); } else { console.log('bootstrap was not found'); cb(window._originalConfirm(text)); } };

Close Alert doesn't display correctly

This works for me.

  •    <button class="btn btn-danger" data-dismiss="modal" aria-hidden="true">&times;</button> \
    
  •    <button class="btn btn-danger" data-dismiss="modal" aria-hidden="true">Close</button> \
    

Demo is broken (at least in Chrome).

The first button gives a normal plain-jane JavaScript alert().
The second button does nothing (except look pretty, thanks to Bootstrap).

(This is in the latest version of Chrome, on Windows 7.)

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.