forgot some files
bzr revid: nicolas.vanhoren@openerp.com-20130212133904-1vmygammre3e305y
This commit is contained in:
@@ -0,0 +1,309 @@
|
||||
/**
|
||||
* achtung 0.3.0
|
||||
*
|
||||
* Growl-like notifications for jQuery
|
||||
*
|
||||
* Copyright (c) 2009 Josh Varner <josh@voxwerk.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* Portions of this file are from the jQuery UI CSS framework.
|
||||
*
|
||||
* @license http://www.opensource.org/licenses/mit-license.php
|
||||
* @author Josh Varner <josh@voxwerk.com>
|
||||
*/
|
||||
|
||||
/* IE 6 doesn't support position: fixed */
|
||||
* html #achtung-overlay {
|
||||
position:absolute;
|
||||
}
|
||||
|
||||
/* IE6 includes padding in width */
|
||||
* html .achtung {
|
||||
width: 280px;
|
||||
}
|
||||
|
||||
#achtung-overlay {
|
||||
overflow: hidden;
|
||||
position: fixed;
|
||||
top: 15px;
|
||||
right: 15px;
|
||||
width: 280px;
|
||||
z-index:50;
|
||||
}
|
||||
|
||||
.achtung {
|
||||
display:none;
|
||||
margin-bottom: 8px;
|
||||
padding: 15px 15px;
|
||||
background-color: #000;
|
||||
color: white;
|
||||
width: 250px;
|
||||
font-weight: bold;
|
||||
position:relative;
|
||||
overflow: hidden;
|
||||
-moz-box-shadow: #aaa 1px 1px 2px;
|
||||
-webkit-box-shadow: #aaa 1px 1px 2px;
|
||||
box-shadow: #aaa 1px 1px 2px;
|
||||
-moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px;
|
||||
/* Note that if using show/hide animations, IE will lose
|
||||
this setting */
|
||||
opacity: .85;
|
||||
filter:Alpha(Opacity=85);
|
||||
}
|
||||
|
||||
/**
|
||||
* This section from jQuery UI CSS framework
|
||||
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
|
||||
* Can (and should) be removed if you are already loading the jQuery UI CSS
|
||||
* to reduce payload size.
|
||||
*/
|
||||
.ui-icon { display: block; overflow: hidden; background-repeat: no-repeat; }
|
||||
.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
|
||||
.ui-icon-carat-1-n { background-position: 0 0; }
|
||||
.ui-icon-carat-1-ne { background-position: -16px 0; }
|
||||
.ui-icon-carat-1-e { background-position: -32px 0; }
|
||||
.ui-icon-carat-1-se { background-position: -48px 0; }
|
||||
.ui-icon-carat-1-s { background-position: -64px 0; }
|
||||
.ui-icon-carat-1-sw { background-position: -80px 0; }
|
||||
.ui-icon-carat-1-w { background-position: -96px 0; }
|
||||
.ui-icon-carat-1-nw { background-position: -112px 0; }
|
||||
.ui-icon-carat-2-n-s { background-position: -128px 0; }
|
||||
.ui-icon-carat-2-e-w { background-position: -144px 0; }
|
||||
.ui-icon-triangle-1-n { background-position: 0 -16px; }
|
||||
.ui-icon-triangle-1-ne { background-position: -16px -16px; }
|
||||
.ui-icon-triangle-1-e { background-position: -32px -16px; }
|
||||
.ui-icon-triangle-1-se { background-position: -48px -16px; }
|
||||
.ui-icon-triangle-1-s { background-position: -64px -16px; }
|
||||
.ui-icon-triangle-1-sw { background-position: -80px -16px; }
|
||||
.ui-icon-triangle-1-w { background-position: -96px -16px; }
|
||||
.ui-icon-triangle-1-nw { background-position: -112px -16px; }
|
||||
.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
|
||||
.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
|
||||
.ui-icon-arrow-1-n { background-position: 0 -32px; }
|
||||
.ui-icon-arrow-1-ne { background-position: -16px -32px; }
|
||||
.ui-icon-arrow-1-e { background-position: -32px -32px; }
|
||||
.ui-icon-arrow-1-se { background-position: -48px -32px; }
|
||||
.ui-icon-arrow-1-s { background-position: -64px -32px; }
|
||||
.ui-icon-arrow-1-sw { background-position: -80px -32px; }
|
||||
.ui-icon-arrow-1-w { background-position: -96px -32px; }
|
||||
.ui-icon-arrow-1-nw { background-position: -112px -32px; }
|
||||
.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
|
||||
.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
|
||||
.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
|
||||
.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
|
||||
.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
|
||||
.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
|
||||
.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
|
||||
.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
|
||||
.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
|
||||
.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
|
||||
.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
|
||||
.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
|
||||
.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
|
||||
.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
|
||||
.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
|
||||
.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
|
||||
.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
|
||||
.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
|
||||
.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
|
||||
.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
|
||||
.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
|
||||
.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
|
||||
.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
|
||||
.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
|
||||
.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
|
||||
.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
|
||||
.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
|
||||
.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
|
||||
.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
|
||||
.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
|
||||
.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
|
||||
.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
|
||||
.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
|
||||
.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
|
||||
.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
|
||||
.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
|
||||
.ui-icon-arrow-4 { background-position: 0 -80px; }
|
||||
.ui-icon-arrow-4-diag { background-position: -16px -80px; }
|
||||
.ui-icon-extlink { background-position: -32px -80px; }
|
||||
.ui-icon-newwin { background-position: -48px -80px; }
|
||||
.ui-icon-refresh { background-position: -64px -80px; }
|
||||
.ui-icon-shuffle { background-position: -80px -80px; }
|
||||
.ui-icon-transfer-e-w { background-position: -96px -80px; }
|
||||
.ui-icon-transferthick-e-w { background-position: -112px -80px; }
|
||||
.ui-icon-folder-collapsed { background-position: 0 -96px; }
|
||||
.ui-icon-folder-open { background-position: -16px -96px; }
|
||||
.ui-icon-document { background-position: -32px -96px; }
|
||||
.ui-icon-document-b { background-position: -48px -96px; }
|
||||
.ui-icon-note { background-position: -64px -96px; }
|
||||
.ui-icon-mail-closed { background-position: -80px -96px; }
|
||||
.ui-icon-mail-open { background-position: -96px -96px; }
|
||||
.ui-icon-suitcase { background-position: -112px -96px; }
|
||||
.ui-icon-comment { background-position: -128px -96px; }
|
||||
.ui-icon-person { background-position: -144px -96px; }
|
||||
.ui-icon-print { background-position: -160px -96px; }
|
||||
.ui-icon-trash { background-position: -176px -96px; }
|
||||
.ui-icon-locked { background-position: -192px -96px; }
|
||||
.ui-icon-unlocked { background-position: -208px -96px; }
|
||||
.ui-icon-bookmark { background-position: -224px -96px; }
|
||||
.ui-icon-tag { background-position: -240px -96px; }
|
||||
.ui-icon-home { background-position: 0 -112px; }
|
||||
.ui-icon-flag { background-position: -16px -112px; }
|
||||
.ui-icon-calendar { background-position: -32px -112px; }
|
||||
.ui-icon-cart { background-position: -48px -112px; }
|
||||
.ui-icon-pencil { background-position: -64px -112px; }
|
||||
.ui-icon-clock { background-position: -80px -112px; }
|
||||
.ui-icon-disk { background-position: -96px -112px; }
|
||||
.ui-icon-calculator { background-position: -112px -112px; }
|
||||
.ui-icon-zoomin { background-position: -128px -112px; }
|
||||
.ui-icon-zoomout { background-position: -144px -112px; }
|
||||
.ui-icon-search { background-position: -160px -112px; }
|
||||
.ui-icon-wrench { background-position: -176px -112px; }
|
||||
.ui-icon-gear { background-position: -192px -112px; }
|
||||
.ui-icon-heart { background-position: -208px -112px; }
|
||||
.ui-icon-star { background-position: -224px -112px; }
|
||||
.ui-icon-link { background-position: -240px -112px; }
|
||||
.ui-icon-cancel { background-position: 0 -128px; }
|
||||
.ui-icon-plus { background-position: -16px -128px; }
|
||||
.ui-icon-plusthick { background-position: -32px -128px; }
|
||||
.ui-icon-minus { background-position: -48px -128px; }
|
||||
.ui-icon-minusthick { background-position: -64px -128px; }
|
||||
.ui-icon-close { background-position: -80px -128px; }
|
||||
.ui-icon-closethick { background-position: -96px -128px; }
|
||||
.ui-icon-key { background-position: -112px -128px; }
|
||||
.ui-icon-lightbulb { background-position: -128px -128px; }
|
||||
.ui-icon-scissors { background-position: -144px -128px; }
|
||||
.ui-icon-clipboard { background-position: -160px -128px; }
|
||||
.ui-icon-copy { background-position: -176px -128px; }
|
||||
.ui-icon-contact { background-position: -192px -128px; }
|
||||
.ui-icon-image { background-position: -208px -128px; }
|
||||
.ui-icon-video { background-position: -224px -128px; }
|
||||
.ui-icon-script { background-position: -240px -128px; }
|
||||
.ui-icon-alert { background-position: 0 -144px; }
|
||||
.ui-icon-info { background-position: -16px -144px; }
|
||||
.ui-icon-notice { background-position: -32px -144px; }
|
||||
.ui-icon-help { background-position: -48px -144px; }
|
||||
.ui-icon-check { background-position: -64px -144px; }
|
||||
.ui-icon-bullet { background-position: -80px -144px; }
|
||||
.ui-icon-radio-off { background-position: -96px -144px; }
|
||||
.ui-icon-radio-on { background-position: -112px -144px; }
|
||||
.ui-icon-pin-w { background-position: -128px -144px; }
|
||||
.ui-icon-pin-s { background-position: -144px -144px; }
|
||||
.ui-icon-play { background-position: 0 -160px; }
|
||||
.ui-icon-pause { background-position: -16px -160px; }
|
||||
.ui-icon-seek-next { background-position: -32px -160px; }
|
||||
.ui-icon-seek-prev { background-position: -48px -160px; }
|
||||
.ui-icon-seek-end { background-position: -64px -160px; }
|
||||
.ui-icon-seek-first { background-position: -80px -160px; }
|
||||
.ui-icon-stop { background-position: -96px -160px; }
|
||||
.ui-icon-eject { background-position: -112px -160px; }
|
||||
.ui-icon-volume-off { background-position: -128px -160px; }
|
||||
.ui-icon-volume-on { background-position: -144px -160px; }
|
||||
.ui-icon-power { background-position: 0 -176px; }
|
||||
.ui-icon-signal-diag { background-position: -16px -176px; }
|
||||
.ui-icon-signal { background-position: -32px -176px; }
|
||||
.ui-icon-battery-0 { background-position: -48px -176px; }
|
||||
.ui-icon-battery-1 { background-position: -64px -176px; }
|
||||
.ui-icon-battery-2 { background-position: -80px -176px; }
|
||||
.ui-icon-battery-3 { background-position: -96px -176px; }
|
||||
.ui-icon-circle-plus { background-position: 0 -192px; }
|
||||
.ui-icon-circle-minus { background-position: -16px -192px; }
|
||||
.ui-icon-circle-close { background-position: -32px -192px; }
|
||||
.ui-icon-circle-triangle-e { background-position: -48px -192px; }
|
||||
.ui-icon-circle-triangle-s { background-position: -64px -192px; }
|
||||
.ui-icon-circle-triangle-w { background-position: -80px -192px; }
|
||||
.ui-icon-circle-triangle-n { background-position: -96px -192px; }
|
||||
.ui-icon-circle-arrow-e { background-position: -112px -192px; }
|
||||
.ui-icon-circle-arrow-s { background-position: -128px -192px; }
|
||||
.ui-icon-circle-arrow-w { background-position: -144px -192px; }
|
||||
.ui-icon-circle-arrow-n { background-position: -160px -192px; }
|
||||
.ui-icon-circle-zoomin { background-position: -176px -192px; }
|
||||
.ui-icon-circle-zoomout { background-position: -192px -192px; }
|
||||
.ui-icon-circle-check { background-position: -208px -192px; }
|
||||
.ui-icon-circlesmall-plus { background-position: 0 -208px; }
|
||||
.ui-icon-circlesmall-minus { background-position: -16px -208px; }
|
||||
.ui-icon-circlesmall-close { background-position: -32px -208px; }
|
||||
.ui-icon-squaresmall-plus { background-position: -48px -208px; }
|
||||
.ui-icon-squaresmall-minus { background-position: -64px -208px; }
|
||||
.ui-icon-squaresmall-close { background-position: -80px -208px; }
|
||||
.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
|
||||
.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
|
||||
.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
|
||||
.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
|
||||
.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
|
||||
.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
|
||||
|
||||
.achtung .achtung-message-icon {
|
||||
margin-top: 0px;
|
||||
margin-left: -.5em;
|
||||
margin-right: .5em;
|
||||
float: left;
|
||||
zoom: 1;
|
||||
}
|
||||
|
||||
.achtung .ui-icon.achtung-close-button {
|
||||
float: right;
|
||||
margin-right: -8px;
|
||||
margin-top: -12px;
|
||||
cursor: pointer;
|
||||
color: white;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.achtung .ui-icon.achtung-close-button:after {
|
||||
content: "x"
|
||||
}
|
||||
|
||||
/* Slightly darker for these colors (readability) */
|
||||
.achtungSuccess, .achtungFail, .achtungWait {
|
||||
/* Note that if using show/hide animations, IE will lose
|
||||
this setting */
|
||||
opacity: .93; filter:Alpha(Opacity=93);
|
||||
}
|
||||
|
||||
.achtungSuccess {
|
||||
background-color: #4DB559;
|
||||
}
|
||||
|
||||
.achtungFail {
|
||||
background-color: #D64450;
|
||||
}
|
||||
|
||||
.achtungWait {
|
||||
background-color: #658093;
|
||||
}
|
||||
|
||||
.achtungSuccess .ui-icon.achtung-close-button,
|
||||
.achtungFail .ui-icon.achtung-close-button {
|
||||
background-image: url(images/ui-icons_444444_256x240.png);
|
||||
}
|
||||
|
||||
.achtungSuccess .ui-icon.achtung-close-button-hover,
|
||||
.achtungFail .ui-icon.achtung-close-button-hover {
|
||||
background-image: url(images/ui-icons_000000_256x240.png);
|
||||
}
|
||||
|
||||
.achtung .wait-icon {
|
||||
background-image: url('images/wait.gif');
|
||||
}
|
||||
|
||||
.achtung .achtung-message {
|
||||
display: inline;
|
||||
}
|
||||
@@ -0,0 +1,273 @@
|
||||
/**
|
||||
* achtung 0.3.0
|
||||
*
|
||||
* Growl-like notifications for jQuery
|
||||
*
|
||||
* Copyright (c) 2009 Josh Varner <josh@voxwerk.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @license http://www.opensource.org/licenses/mit-license.php
|
||||
* @author Josh Varner <josh@voxwerk.com>
|
||||
*/
|
||||
|
||||
/*globals jQuery,clearTimeout,document,navigator,setTimeout
|
||||
*/
|
||||
(function($) {
|
||||
|
||||
/**
|
||||
* This is based on the jQuery UI $.widget code. I would have just made this
|
||||
* a $.widget but I didn't want the jQuery UI dependency.
|
||||
*/
|
||||
$.fn.achtung = function(options)
|
||||
{
|
||||
var isMethodCall = (typeof options === 'string'),
|
||||
args = Array.prototype.slice.call(arguments, 0),
|
||||
name = 'achtung';
|
||||
|
||||
// handle initialization and non-getter methods
|
||||
return this.each(function() {
|
||||
var instance = $.data(this, name);
|
||||
|
||||
// prevent calls to internal methods
|
||||
if (isMethodCall && options.substring(0, 1) === '_') {
|
||||
return this;
|
||||
}
|
||||
|
||||
// constructor
|
||||
(!instance && !isMethodCall &&
|
||||
$.data(this, name, new $.achtung(this))._init(args));
|
||||
|
||||
// method call
|
||||
(instance && isMethodCall && $.isFunction(instance[options]) &&
|
||||
instance[options].apply(instance, args.slice(1)));
|
||||
});
|
||||
};
|
||||
|
||||
$.achtung = function(element)
|
||||
{
|
||||
var args = Array.prototype.slice.call(arguments, 0), $el;
|
||||
|
||||
if (!element || !element.nodeType) {
|
||||
$el = $('<div />');
|
||||
return $el.achtung.apply($el, args);
|
||||
}
|
||||
|
||||
this.$container = $(element);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Static members
|
||||
**/
|
||||
$.extend($.achtung, {
|
||||
version: '0.3.0',
|
||||
$overlay: false,
|
||||
defaults: {
|
||||
timeout: 10,
|
||||
disableClose: false,
|
||||
icon: false,
|
||||
className: '',
|
||||
animateClassSwitch: false,
|
||||
showEffects: {'opacity':'toggle','height':'toggle'},
|
||||
hideEffects: {'opacity':'toggle','height':'toggle'},
|
||||
showEffectDuration: 500,
|
||||
hideEffectDuration: 700
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Non-static members
|
||||
**/
|
||||
$.extend($.achtung.prototype, {
|
||||
$container: false,
|
||||
closeTimer: false,
|
||||
options: {},
|
||||
|
||||
_init: function(args)
|
||||
{
|
||||
var o, self = this;
|
||||
|
||||
args = $.isArray(args) ? args : [];
|
||||
|
||||
|
||||
args.unshift($.achtung.defaults);
|
||||
args.unshift({});
|
||||
|
||||
o = this.options = $.extend.apply($, args);
|
||||
|
||||
if (!$.achtung.$overlay) {
|
||||
$.achtung.$overlay = $('<div id="achtung-overlay"></div>').appendTo(document.body);
|
||||
}
|
||||
|
||||
if (!o.disableClose) {
|
||||
$('<span class="achtung-close-button ui-icon ui-icon-close" />')
|
||||
.click(function () { self.close(); })
|
||||
.hover(function () { $(this).addClass('achtung-close-button-hover'); },
|
||||
function () { $(this).removeClass('achtung-close-button-hover'); })
|
||||
.prependTo(this.$container);
|
||||
}
|
||||
|
||||
this.changeIcon(o.icon, true);
|
||||
|
||||
if (o.message) {
|
||||
this.$container.append($('<span class="achtung-message">' + o.message + '</span>'));
|
||||
}
|
||||
|
||||
(o.className && this.$container.addClass(o.className));
|
||||
(o.css && this.$container.css(o.css));
|
||||
|
||||
this.$container
|
||||
.addClass('achtung')
|
||||
.appendTo($.achtung.$overlay);
|
||||
|
||||
if (o.showEffects) {
|
||||
this.$container.toggle();
|
||||
} else {
|
||||
this.$container.show();
|
||||
}
|
||||
|
||||
if (o.timeout > 0) {
|
||||
this.timeout(o.timeout);
|
||||
}
|
||||
},
|
||||
|
||||
timeout: function(timeout)
|
||||
{
|
||||
var self = this;
|
||||
|
||||
if (this.closeTimer) {
|
||||
clearTimeout(this.closeTimer);
|
||||
}
|
||||
|
||||
this.closeTimer = setTimeout(function() { self.close(); }, timeout * 1000);
|
||||
this.options.timeout = timeout;
|
||||
},
|
||||
|
||||
/**
|
||||
* Change the CSS class associated with this message, using
|
||||
* a transition if available (not availble in Safari/Webkit).
|
||||
* If no transition is available, the switch is immediate.
|
||||
*
|
||||
* #LATER Check if this has been corrected in Webkit or jQuery UI
|
||||
* #TODO Make transition time configurable
|
||||
* @param newClass string Name of new class to associate
|
||||
*/
|
||||
changeClass: function(newClass)
|
||||
{
|
||||
var self = this;
|
||||
|
||||
if (this.options.className === newClass) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.$container.queue(function() {
|
||||
if (!self.options.animateClassSwitch ||
|
||||
/webkit/.test(navigator.userAgent.toLowerCase()) ||
|
||||
!$.isFunction($.fn.switchClass)) {
|
||||
self.$container.removeClass(self.options.className);
|
||||
self.$container.addClass(newClass);
|
||||
} else {
|
||||
self.$container.switchClass(self.options.className, newClass, 500);
|
||||
}
|
||||
|
||||
self.options.className = newClass;
|
||||
self.$container.dequeue();
|
||||
});
|
||||
},
|
||||
|
||||
changeIcon: function(newIcon, force)
|
||||
{
|
||||
var self = this;
|
||||
|
||||
if ((force !== true || newIcon === false) && this.options.icon === newIcon) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (force || this.options.icon === false) {
|
||||
this.$container.prepend($('<span class="achtung-message-icon ui-icon ' + newIcon + '" />'));
|
||||
this.options.icon = newIcon;
|
||||
return;
|
||||
} else if (newIcon === false) {
|
||||
this.$container.find('.achtung-message-icon').remove();
|
||||
this.options.icon = false;
|
||||
return;
|
||||
}
|
||||
|
||||
this.$container.queue(function() {
|
||||
var $span = $('.achtung-message-icon', self.$container);
|
||||
|
||||
if (!self.options.animateClassSwitch ||
|
||||
/webkit/.test(navigator.userAgent.toLowerCase()) ||
|
||||
!$.isFunction($.fn.switchClass)) {
|
||||
$span.removeClass(self.options.icon);
|
||||
$span.addClass(newIcon);
|
||||
} else {
|
||||
$span.switchClass(self.options.icon, newIcon, 500);
|
||||
}
|
||||
|
||||
self.options.icon = newIcon;
|
||||
self.$container.dequeue();
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
changeMessage: function(newMessage)
|
||||
{
|
||||
this.$container.queue(function() {
|
||||
$('.achtung-message', $(this)).html(newMessage);
|
||||
$(this).dequeue();
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
update: function(options)
|
||||
{
|
||||
(options.className && this.changeClass(options.className));
|
||||
(options.css && this.$container.css(options.css));
|
||||
(typeof(options.icon) !== 'undefined' && this.changeIcon(options.icon));
|
||||
(options.message && this.changeMessage(options.message));
|
||||
(options.timeout && this.timeout(options.timeout));
|
||||
},
|
||||
|
||||
close: function()
|
||||
{
|
||||
var o = this.options, $container = this.$container;
|
||||
|
||||
if (o.hideEffects) {
|
||||
this.$container.animate(o.hideEffects, o.hideEffectDuration);
|
||||
} else {
|
||||
this.$container.hide();
|
||||
}
|
||||
|
||||
$container.queue(function() {
|
||||
$container.removeData('achtung');
|
||||
$container.remove();
|
||||
|
||||
if ($.achtung.$overlay && $.achtung.$overlay.is(':empty')) {
|
||||
$.achtung.$overlay.remove();
|
||||
$.achtung.$overlay = false;
|
||||
}
|
||||
|
||||
$container.dequeue();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
Reference in New Issue
Block a user