Skip to content

Commit

Permalink
Updated toastr to 2.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed May 21, 2014
1 parent 468677a commit 5721dee
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 30 deletions.
58 changes: 32 additions & 26 deletions src/deploy.web/Fake.Deploy.Web/Scripts/toastr.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
options: {},
subscribe: subscribe,
success: success,
version: '2.0.2',
version: '2.0.3',
warning: warning
};

Expand All @@ -48,6 +48,18 @@
});
}

function getContainer(options, create) {
if (!options) { options = getOptions(); }
$container = $('#' + options.containerId);
if ($container.length) {
return $container;
}
if(create) {
$container = createContainer(options);
}
return $container;
}

function info(message, title, optionsOverride) {
return notify({
type: toastType.info,
Expand Down Expand Up @@ -124,6 +136,17 @@
return false;
}

function createContainer(options) {
$container = $('<div/>')
.attr('id', options.containerId)
.addClass(options.positionClass)
.attr('aria-live', 'polite')
.attr('role', 'alert');

$container.appendTo($(options.target));
return $container;
}

function getDefaults() {
return {
tapToDismiss: true,
Expand Down Expand Up @@ -159,15 +182,12 @@
}

function publish(args) {
if (!listener) {
return;
}
if (!listener) { return; }
listener(args);
}

function notify(map) {
var
options = getOptions(),
var options = getOptions(),
iconClass = map.iconClass || options.iconClass;

if (typeof (map.optionsOverride) !== 'undefined') {
Expand All @@ -177,9 +197,8 @@

toastId++;

$container = getContainer(options);
var
intervalId = null,
$container = getContainer(options, true);
var intervalId = null,
$toastElement = $('<div/>'),
$titleElement = $('<div/>'),
$messageElement = $('<div/>'),
Expand Down Expand Up @@ -222,14 +241,16 @@
$toastElement[options.showMethod](
{ duration: options.showDuration, easing: options.showEasing, complete: options.onShown }
);

if (options.timeOut > 0) {
intervalId = setTimeout(hideToast, options.timeOut);
}

$toastElement.hover(stickAround, delayedhideToast);
$toastElement.hover(stickAround, delayedHideToast);
if (!options.onclick && options.tapToDismiss) {
$toastElement.click(hideToast);
}

if (options.closeButton && $closeElement) {
$closeElement.click(function (event) {
if( event.stopPropagation ) {
Expand Down Expand Up @@ -275,7 +296,7 @@
});
}

function delayedhideToast() {
function delayedHideToast() {
if (options.timeOut > 0 || options.extendedTimeOut > 0) {
intervalId = setTimeout(hideToast, options.extendedTimeOut);
}
Expand All @@ -288,21 +309,6 @@
);
}
}
function getContainer(options) {
if (!options) { options = getOptions(); }
$container = $('#' + options.containerId);
if ($container.length) {
return $container;
}
$container = $('<div/>')
.attr('id', options.containerId)
.addClass(options.positionClass)
.attr('aria-live', 'polite')
.attr('role', 'alert');

$container.appendTo($(options.target));
return $container;
}

function getOptions() {
return $.extend({}, getDefaults(), toastr.options);
Expand Down
3 changes: 1 addition & 2 deletions src/deploy.web/Fake.Deploy.Web/Scripts/toastr.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion src/deploy.web/Fake.Deploy.Web/content/toastr.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/*
* Toastr
* Version 2.0.2
* Copyright 2012-2014 John Papa and Hans Fjällemark.
* All Rights Reserved.
* Use, reproduction, distribution, and modification of this code is subject to the terms and
Expand Down
2 changes: 1 addition & 1 deletion src/deploy.web/Fake.Deploy.Web/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
<package id="Nancy.Viewengines.Razor" version="0.22.2" targetFramework="net40" />
<package id="Newtonsoft.Json" version="6.0.3" targetFramework="net40" />
<package id="System.Web.Razor.Unofficial" version="2.0.2" targetFramework="net40" />
<package id="toastr" version="2.0.2" targetFramework="net40" />
<package id="toastr" version="2.0.3" targetFramework="net40" />
</packages>

0 comments on commit 5721dee

Please sign in to comment.