scala-news-reader
rss/atom news reader in scala
git clone https://9o.is/git/scala-news-reader.git
jquery.bsFormAlerts.min.js
(1896B)
1 /*! bsFormAlerts version: 0.1.2
2 * 2013-04-18
3 * Author: Tim Nelson
4 * Website: http://eltimn.github.com/jquery-bs-formalerts
5 * MIT License http://www.opensource.org/licenses/mit-license.php
6 */
7 (function(r,t,e){"use strict";function n(r){return"notice"===r?"info":"danger"===r?"error":r}function s(t){var e=r.grep(t,function(r){return"error"===r.priority}).length;if(e>0)return"error";var n=r.grep(t,function(r){return"warning"===r.priority}).length;if(n>0)return"warning";var s=r.grep(t,function(r){return"success"===r.priority}).length;return s>0?"success":"info"}function o(r){return r.closest("div.control-group")}function i(r){r.removeClass("info"),r.removeClass("warning"),r.removeClass("error"),r.removeClass("success")}var a=function(t,n){var s=this;this.element=t,this.options=r.extend({},r.fn.bsFormAlerts.defaults,n),r(e).on("set-alert-id-"+this.options.alertid,function(){var r=Array.prototype.slice.call(arguments,1);s.renderAlerts(r)}),r(e).on("clear-alert-id."+this.options.alertid,function(){s.clear()})};a.prototype={constructor:a,clear:function(){var t=r(this.element),e=o(t);i(e),t.html("")},renderAlerts:function(t){var e=r(this.element);if(t.length>0){var a=o(e),l=s(t);i(a),e.html("");var c=r("<ul/>");r.each(t,function(t,e){if(e.message&&e.message.length>0){var s=r("<li/>",{"class":"text-"+n(e.priority)}).html(e.message);c.append(s)}}),e.append(c),a.addClass(n(l))}}};var l=r.fn.bsFormAlerts;r.fn.bsFormAlerts=function(t){return this.each(function(){var e=r(this),n=e.data("bsFormAlerts"),s="object"==typeof t&&t;n||e.data("bsFormAlerts",n=new a(this,s)),"string"==typeof t&&n[t]()})},r.fn.bsFormAlerts.Constructor=a,r.fn.bsFormAlerts.defaults={alertid:"bs-form-alert"},r.fn.bsFormAlerts.noConflict=function(){return r.fn.bsFormAlerts=l,this},r(e).ready(function(){r("[data-alertid]").each(function(){var t=r(this);t.bsFormAlerts(t.data())})})})(jQuery,window,document);