clipboard-toastr-rails 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +22 -0
- data/README.md +131 -0
- data/Rakefile +12 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/clipboard-toastr-rails/engine.rb +6 -0
- data/lib/clipboard-toastr-rails/version.rb +5 -0
- data/lib/clipboard-toastr-rails.rb +2 -0
- data/test/test_helper.rb +7 -0
- data/vendor/assets/javascripts/clipboard-toastr.js +2 -0
- data/vendor/assets/javascripts/clipboard.js +7 -0
- data/vendor/assets/javascripts/toastr.js +476 -0
- data/vendor/assets/stylesheets/toastr.scss +201 -0
- metadata +15 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ffb0f8d8f3febe84b7e7dd48f94b60f87466546
|
4
|
+
data.tar.gz: 1bb640f72c92893e5bdc56ddbeb25ae86aba470b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52bfe7cd7e788ccc851fff7e235363218073b0995dbcc649c0df2c9ff106049f132b21e0a637123470e84d9d9fdde1824c1f3d93eea64a35dca56bd7a0bd9084
|
7
|
+
data.tar.gz: 7b01493a2e9ba28126ddb209fdb8821c8156a69b26d467355add9691297debb12def008f388a1f6e544a26680034108a445651aa4393f5a1f0531bab132c5a7c
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2016 Kai Park
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
# clipboard-toastr-rails
|
2
|
+
[![Gem
|
3
|
+
Version](https://badge.fury.io/rb/clipboard-toastr-rails.svg)](https://badge.fury.io/rb/clipboard-toastr-rails)
|
4
|
+
[![Build
|
5
|
+
Status](https://travis-ci.org/ggomagundan/clipboard-toastr-rails.svg?branch=master)](https://travis-ci.org/ggomagundan/clipboard-toastr-rails)
|
6
|
+
|
7
|
+
clipboard-toastr-rails gem is the integration of clipboard.js and toastr javascript
|
8
|
+
library(using 2.2 Version) for your Rails 4, 5 application.
|
9
|
+
|
10
|
+
Ruby gems url: https://rubygems.org/gems/clipboard-toastr-rails
|
11
|
+
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
Add this line to your application's Gemfile:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
gem 'clipboard-toastr-rails'
|
19
|
+
```
|
20
|
+
|
21
|
+
And then execute:
|
22
|
+
|
23
|
+
$ bundle
|
24
|
+
|
25
|
+
Or install it yourself as:
|
26
|
+
|
27
|
+
$ gem install clipboard-toastr-rails
|
28
|
+
|
29
|
+
Now you need to edit your `app/assets/javascripts/application.js` file
|
30
|
+
and add the following line:
|
31
|
+
``` javascript
|
32
|
+
//= require clipboard-toastr
|
33
|
+
```
|
34
|
+
|
35
|
+
And you need to edit your `app/assets/stylesheets/application.css` file
|
36
|
+
and add the following line:
|
37
|
+
|
38
|
+
```css
|
39
|
+
*= require toastr
|
40
|
+
```
|
41
|
+
|
42
|
+
If Use `app/assets/stylesheets/application.scss` file
|
43
|
+
```scss
|
44
|
+
@import "toastr";
|
45
|
+
```
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
## Usage
|
54
|
+
|
55
|
+
Here is the example working code to test with your Rails application.
|
56
|
+
|
57
|
+
Add this sample code to your `app/assets/javascripts/application.js`
|
58
|
+
file
|
59
|
+
|
60
|
+
``` javascript
|
61
|
+
$(document).ready(function(){
|
62
|
+
|
63
|
+
clip = new Clipboard('.copy-target')
|
64
|
+
|
65
|
+
toastr.options = {
|
66
|
+
"positionClass": "toast-bottom-center",
|
67
|
+
....
|
68
|
+
....
|
69
|
+
}
|
70
|
+
|
71
|
+
$(".copy-target").click ->
|
72
|
+
toastr.info "Copy Success Alert"
|
73
|
+
|
74
|
+
|
75
|
+
});
|
76
|
+
```
|
77
|
+
|
78
|
+
```html
|
79
|
+
|
80
|
+
<html>
|
81
|
+
<head>
|
82
|
+
...
|
83
|
+
</head>
|
84
|
+
|
85
|
+
<body>
|
86
|
+
...
|
87
|
+
...
|
88
|
+
|
89
|
+
<span class="copy-target" data-clipboard-text="COPY CONTENT">Copy Link</span>
|
90
|
+
|
91
|
+
...
|
92
|
+
...
|
93
|
+
</body>
|
94
|
+
|
95
|
+
</html>
|
96
|
+
|
97
|
+
```
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
## Full documentation
|
103
|
+
|
104
|
+
The Documentation is at
|
105
|
+
[Clipboard.js Document](https://clipboardjs.com/)
|
106
|
+
[Toastr Document](http://codeseven.github.io/toastr/)
|
107
|
+
|
108
|
+
## Change Log
|
109
|
+
|
110
|
+
Current Version 1.0.0
|
111
|
+
|
112
|
+
This link listing [Change Log](https://github.com/ggomagundan/clipboard-toastr-rails/blob/master/CHANGE_LOG.md)
|
113
|
+
|
114
|
+
|
115
|
+
## Contributing
|
116
|
+
|
117
|
+
1. Fork it
|
118
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
119
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
120
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
121
|
+
5. Create new Pull Request
|
122
|
+
|
123
|
+
|
124
|
+
## License
|
125
|
+
|
126
|
+
The gem is available as open source under the terms of the [MIT
|
127
|
+
License](http://opensource.org/licenses/MIT).
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "md-date-time-picker-rails"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/test/test_helper.rb
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
/*!
|
2
|
+
* clipboard.js v1.5.15
|
3
|
+
* https://zenorocha.github.io/clipboard.js
|
4
|
+
*
|
5
|
+
* Licensed MIT © Zeno Rocha
|
6
|
+
*/
|
7
|
+
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Clipboard=e()}}(function(){var e,t,n;return function e(t,n,i){function o(a,c){if(!n[a]){if(!t[a]){var l="function"==typeof require&&require;if(!c&&l)return l(a,!0);if(r)return r(a,!0);var s=new Error("Cannot find module '"+a+"'");throw s.code="MODULE_NOT_FOUND",s}var u=n[a]={exports:{}};t[a][0].call(u.exports,function(e){var n=t[a][1][e];return o(n?n:e)},u,u.exports,e,t,n,i)}return n[a].exports}for(var r="function"==typeof require&&require,a=0;a<i.length;a++)o(i[a]);return o}({1:[function(e,t,n){function i(e,t){for(;e&&e!==document;){if(e.matches(t))return e;e=e.parentNode}}if(Element&&!Element.prototype.matches){var o=Element.prototype;o.matches=o.matchesSelector||o.mozMatchesSelector||o.msMatchesSelector||o.oMatchesSelector||o.webkitMatchesSelector}t.exports=i},{}],2:[function(e,t,n){function i(e,t,n,i,r){var a=o.apply(this,arguments);return e.addEventListener(n,a,r),{destroy:function(){e.removeEventListener(n,a,r)}}}function o(e,t,n,i){return function(n){n.delegateTarget=r(n.target,t),n.delegateTarget&&i.call(e,n)}}var r=e("./closest");t.exports=i},{"./closest":1}],3:[function(e,t,n){n.node=function(e){return void 0!==e&&e instanceof HTMLElement&&1===e.nodeType},n.nodeList=function(e){var t=Object.prototype.toString.call(e);return void 0!==e&&("[object NodeList]"===t||"[object HTMLCollection]"===t)&&"length"in e&&(0===e.length||n.node(e[0]))},n.string=function(e){return"string"==typeof e||e instanceof String},n.fn=function(e){var t=Object.prototype.toString.call(e);return"[object Function]"===t}},{}],4:[function(e,t,n){function i(e,t,n){if(!e&&!t&&!n)throw new Error("Missing required arguments");if(!c.string(t))throw new TypeError("Second argument must be a String");if(!c.fn(n))throw new TypeError("Third argument must be a Function");if(c.node(e))return o(e,t,n);if(c.nodeList(e))return r(e,t,n);if(c.string(e))return a(e,t,n);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function o(e,t,n){return e.addEventListener(t,n),{destroy:function(){e.removeEventListener(t,n)}}}function r(e,t,n){return Array.prototype.forEach.call(e,function(e){e.addEventListener(t,n)}),{destroy:function(){Array.prototype.forEach.call(e,function(e){e.removeEventListener(t,n)})}}}function a(e,t,n){return l(document.body,e,t,n)}var c=e("./is"),l=e("delegate");t.exports=i},{"./is":3,delegate:2}],5:[function(e,t,n){function i(e){var t;if("SELECT"===e.nodeName)e.focus(),t=e.value;else if("INPUT"===e.nodeName||"TEXTAREA"===e.nodeName)e.focus(),e.setSelectionRange(0,e.value.length),t=e.value;else{e.hasAttribute("contenteditable")&&e.focus();var n=window.getSelection(),i=document.createRange();i.selectNodeContents(e),n.removeAllRanges(),n.addRange(i),t=n.toString()}return t}t.exports=i},{}],6:[function(e,t,n){function i(){}i.prototype={on:function(e,t,n){var i=this.e||(this.e={});return(i[e]||(i[e]=[])).push({fn:t,ctx:n}),this},once:function(e,t,n){function i(){o.off(e,i),t.apply(n,arguments)}var o=this;return i._=t,this.on(e,i,n)},emit:function(e){var t=[].slice.call(arguments,1),n=((this.e||(this.e={}))[e]||[]).slice(),i=0,o=n.length;for(i;i<o;i++)n[i].fn.apply(n[i].ctx,t);return this},off:function(e,t){var n=this.e||(this.e={}),i=n[e],o=[];if(i&&t)for(var r=0,a=i.length;r<a;r++)i[r].fn!==t&&i[r].fn._!==t&&o.push(i[r]);return o.length?n[e]=o:delete n[e],this}},t.exports=i},{}],7:[function(t,n,i){!function(o,r){if("function"==typeof e&&e.amd)e(["module","select"],r);else if("undefined"!=typeof i)r(n,t("select"));else{var a={exports:{}};r(a,o.select),o.clipboardAction=a.exports}}(this,function(e,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=n(t),r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),c=function(){function e(t){i(this,e),this.resolveOptions(t),this.initSelection()}return a(e,[{key:"resolveOptions",value:function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.action=t.action,this.emitter=t.emitter,this.target=t.target,this.text=t.text,this.trigger=t.trigger,this.selectedText=""}},{key:"initSelection",value:function e(){this.text?this.selectFake():this.target&&this.selectTarget()}},{key:"selectFake",value:function e(){var t=this,n="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandlerCallback=function(){return t.removeFake()},this.fakeHandler=document.body.addEventListener("click",this.fakeHandlerCallback)||!0,this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[n?"right":"left"]="-9999px";var i=window.pageYOffset||document.documentElement.scrollTop;this.fakeElem.addEventListener("focus",window.scrollTo(0,i)),this.fakeElem.style.top=i+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,document.body.appendChild(this.fakeElem),this.selectedText=(0,o.default)(this.fakeElem),this.copyText()}},{key:"removeFake",value:function e(){this.fakeHandler&&(document.body.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(document.body.removeChild(this.fakeElem),this.fakeElem=null)}},{key:"selectTarget",value:function e(){this.selectedText=(0,o.default)(this.target),this.copyText()}},{key:"copyText",value:function e(){var t=void 0;try{t=document.execCommand(this.action)}catch(e){t=!1}this.handleResult(t)}},{key:"handleResult",value:function e(t){this.emitter.emit(t?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}},{key:"clearSelection",value:function e(){this.target&&this.target.blur(),window.getSelection().removeAllRanges()}},{key:"destroy",value:function e(){this.removeFake()}},{key:"action",set:function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"copy";if(this._action=t,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function e(){return this._action}},{key:"target",set:function e(t){if(void 0!==t){if(!t||"object"!==("undefined"==typeof t?"undefined":r(t))||1!==t.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&t.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(t.hasAttribute("readonly")||t.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=t}},get:function e(){return this._target}}]),e}();e.exports=c})},{select:5}],8:[function(t,n,i){!function(o,r){if("function"==typeof e&&e.amd)e(["module","./clipboard-action","tiny-emitter","good-listener"],r);else if("undefined"!=typeof i)r(n,t("./clipboard-action"),t("tiny-emitter"),t("good-listener"));else{var a={exports:{}};r(a,o.clipboardAction,o.tinyEmitter,o.goodListener),o.clipboard=a.exports}}(this,function(e,t,n,i){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function l(e,t){var n="data-clipboard-"+e;if(t.hasAttribute(n))return t.getAttribute(n)}var s=o(t),u=o(n),f=o(i),d=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),h=function(e){function t(e,n){r(this,t);var i=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return i.resolveOptions(n),i.listenClick(e),i}return c(t,e),d(t,[{key:"resolveOptions",value:function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof t.action?t.action:this.defaultAction,this.target="function"==typeof t.target?t.target:this.defaultTarget,this.text="function"==typeof t.text?t.text:this.defaultText}},{key:"listenClick",value:function e(t){var n=this;this.listener=(0,f.default)(t,"click",function(e){return n.onClick(e)})}},{key:"onClick",value:function e(t){var n=t.delegateTarget||t.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new s.default({action:this.action(n),target:this.target(n),text:this.text(n),trigger:n,emitter:this})}},{key:"defaultAction",value:function e(t){return l("action",t)}},{key:"defaultTarget",value:function e(t){var n=l("target",t);if(n)return document.querySelector(n)}},{key:"defaultText",value:function e(t){return l("text",t)}},{key:"destroy",value:function e(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}]),t}(u.default);e.exports=h})},{"./clipboard-action":7,"good-listener":4,"tiny-emitter":6}]},{},[8])(8)});
|
@@ -0,0 +1,476 @@
|
|
1
|
+
/*
|
2
|
+
* Toastr
|
3
|
+
* Copyright 2012-2015
|
4
|
+
* Authors: John Papa, Hans Fjällemark, and Tim Ferrell.
|
5
|
+
* All Rights Reserved.
|
6
|
+
* Use, reproduction, distribution, and modification of this code is subject to the terms and
|
7
|
+
* conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php
|
8
|
+
*
|
9
|
+
* ARIA Support: Greta Krafsig
|
10
|
+
*
|
11
|
+
* Project: https://github.com/CodeSeven/toastr
|
12
|
+
*/
|
13
|
+
/* global define */
|
14
|
+
(function (define) {
|
15
|
+
define(['jquery'], function ($) {
|
16
|
+
return (function () {
|
17
|
+
var $container;
|
18
|
+
var listener;
|
19
|
+
var toastId = 0;
|
20
|
+
var toastType = {
|
21
|
+
error: 'error',
|
22
|
+
info: 'info',
|
23
|
+
success: 'success',
|
24
|
+
warning: 'warning'
|
25
|
+
};
|
26
|
+
|
27
|
+
var toastr = {
|
28
|
+
clear: clear,
|
29
|
+
remove: remove,
|
30
|
+
error: error,
|
31
|
+
getContainer: getContainer,
|
32
|
+
info: info,
|
33
|
+
options: {},
|
34
|
+
subscribe: subscribe,
|
35
|
+
success: success,
|
36
|
+
version: '2.1.3',
|
37
|
+
warning: warning
|
38
|
+
};
|
39
|
+
|
40
|
+
var previousToast;
|
41
|
+
|
42
|
+
return toastr;
|
43
|
+
|
44
|
+
////////////////
|
45
|
+
|
46
|
+
function error(message, title, optionsOverride) {
|
47
|
+
return notify({
|
48
|
+
type: toastType.error,
|
49
|
+
iconClass: getOptions().iconClasses.error,
|
50
|
+
message: message,
|
51
|
+
optionsOverride: optionsOverride,
|
52
|
+
title: title
|
53
|
+
});
|
54
|
+
}
|
55
|
+
|
56
|
+
function getContainer(options, create) {
|
57
|
+
if (!options) { options = getOptions(); }
|
58
|
+
$container = $('#' + options.containerId);
|
59
|
+
if ($container.length) {
|
60
|
+
return $container;
|
61
|
+
}
|
62
|
+
if (create) {
|
63
|
+
$container = createContainer(options);
|
64
|
+
}
|
65
|
+
return $container;
|
66
|
+
}
|
67
|
+
|
68
|
+
function info(message, title, optionsOverride) {
|
69
|
+
return notify({
|
70
|
+
type: toastType.info,
|
71
|
+
iconClass: getOptions().iconClasses.info,
|
72
|
+
message: message,
|
73
|
+
optionsOverride: optionsOverride,
|
74
|
+
title: title
|
75
|
+
});
|
76
|
+
}
|
77
|
+
|
78
|
+
function subscribe(callback) {
|
79
|
+
listener = callback;
|
80
|
+
}
|
81
|
+
|
82
|
+
function success(message, title, optionsOverride) {
|
83
|
+
return notify({
|
84
|
+
type: toastType.success,
|
85
|
+
iconClass: getOptions().iconClasses.success,
|
86
|
+
message: message,
|
87
|
+
optionsOverride: optionsOverride,
|
88
|
+
title: title
|
89
|
+
});
|
90
|
+
}
|
91
|
+
|
92
|
+
function warning(message, title, optionsOverride) {
|
93
|
+
return notify({
|
94
|
+
type: toastType.warning,
|
95
|
+
iconClass: getOptions().iconClasses.warning,
|
96
|
+
message: message,
|
97
|
+
optionsOverride: optionsOverride,
|
98
|
+
title: title
|
99
|
+
});
|
100
|
+
}
|
101
|
+
|
102
|
+
function clear($toastElement, clearOptions) {
|
103
|
+
var options = getOptions();
|
104
|
+
if (!$container) { getContainer(options); }
|
105
|
+
if (!clearToast($toastElement, options, clearOptions)) {
|
106
|
+
clearContainer(options);
|
107
|
+
}
|
108
|
+
}
|
109
|
+
|
110
|
+
function remove($toastElement) {
|
111
|
+
var options = getOptions();
|
112
|
+
if (!$container) { getContainer(options); }
|
113
|
+
if ($toastElement && $(':focus', $toastElement).length === 0) {
|
114
|
+
removeToast($toastElement);
|
115
|
+
return;
|
116
|
+
}
|
117
|
+
if ($container.children().length) {
|
118
|
+
$container.remove();
|
119
|
+
}
|
120
|
+
}
|
121
|
+
|
122
|
+
// internal functions
|
123
|
+
|
124
|
+
function clearContainer (options) {
|
125
|
+
var toastsToClear = $container.children();
|
126
|
+
for (var i = toastsToClear.length - 1; i >= 0; i--) {
|
127
|
+
clearToast($(toastsToClear[i]), options);
|
128
|
+
}
|
129
|
+
}
|
130
|
+
|
131
|
+
function clearToast ($toastElement, options, clearOptions) {
|
132
|
+
var force = clearOptions && clearOptions.force ? clearOptions.force : false;
|
133
|
+
if ($toastElement && (force || $(':focus', $toastElement).length === 0)) {
|
134
|
+
$toastElement[options.hideMethod]({
|
135
|
+
duration: options.hideDuration,
|
136
|
+
easing: options.hideEasing,
|
137
|
+
complete: function () { removeToast($toastElement); }
|
138
|
+
});
|
139
|
+
return true;
|
140
|
+
}
|
141
|
+
return false;
|
142
|
+
}
|
143
|
+
|
144
|
+
function createContainer(options) {
|
145
|
+
$container = $('<div/>')
|
146
|
+
.attr('id', options.containerId)
|
147
|
+
.addClass(options.positionClass);
|
148
|
+
|
149
|
+
$container.appendTo($(options.target));
|
150
|
+
return $container;
|
151
|
+
}
|
152
|
+
|
153
|
+
function getDefaults() {
|
154
|
+
return {
|
155
|
+
tapToDismiss: true,
|
156
|
+
toastClass: 'toast',
|
157
|
+
containerId: 'toast-container',
|
158
|
+
debug: false,
|
159
|
+
|
160
|
+
showMethod: 'fadeIn', //fadeIn, slideDown, and show are built into jQuery
|
161
|
+
showDuration: 300,
|
162
|
+
showEasing: 'swing', //swing and linear are built into jQuery
|
163
|
+
onShown: undefined,
|
164
|
+
hideMethod: 'fadeOut',
|
165
|
+
hideDuration: 1000,
|
166
|
+
hideEasing: 'swing',
|
167
|
+
onHidden: undefined,
|
168
|
+
closeMethod: false,
|
169
|
+
closeDuration: false,
|
170
|
+
closeEasing: false,
|
171
|
+
closeOnHover: true,
|
172
|
+
|
173
|
+
extendedTimeOut: 1000,
|
174
|
+
iconClasses: {
|
175
|
+
error: 'toast-error',
|
176
|
+
info: 'toast-info',
|
177
|
+
success: 'toast-success',
|
178
|
+
warning: 'toast-warning'
|
179
|
+
},
|
180
|
+
iconClass: 'toast-info',
|
181
|
+
positionClass: 'toast-top-right',
|
182
|
+
timeOut: 5000, // Set timeOut and extendedTimeOut to 0 to make it sticky
|
183
|
+
titleClass: 'toast-title',
|
184
|
+
messageClass: 'toast-message',
|
185
|
+
escapeHtml: false,
|
186
|
+
target: 'body',
|
187
|
+
closeHtml: '<button type="button">×</button>',
|
188
|
+
closeClass: 'toast-close-button',
|
189
|
+
newestOnTop: true,
|
190
|
+
preventDuplicates: false,
|
191
|
+
progressBar: false,
|
192
|
+
progressClass: 'toast-progress',
|
193
|
+
rtl: false
|
194
|
+
};
|
195
|
+
}
|
196
|
+
|
197
|
+
function publish(args) {
|
198
|
+
if (!listener) { return; }
|
199
|
+
listener(args);
|
200
|
+
}
|
201
|
+
|
202
|
+
function notify(map) {
|
203
|
+
var options = getOptions();
|
204
|
+
var iconClass = map.iconClass || options.iconClass;
|
205
|
+
|
206
|
+
if (typeof (map.optionsOverride) !== 'undefined') {
|
207
|
+
options = $.extend(options, map.optionsOverride);
|
208
|
+
iconClass = map.optionsOverride.iconClass || iconClass;
|
209
|
+
}
|
210
|
+
|
211
|
+
if (shouldExit(options, map)) { return; }
|
212
|
+
|
213
|
+
toastId++;
|
214
|
+
|
215
|
+
$container = getContainer(options, true);
|
216
|
+
|
217
|
+
var intervalId = null;
|
218
|
+
var $toastElement = $('<div/>');
|
219
|
+
var $titleElement = $('<div/>');
|
220
|
+
var $messageElement = $('<div/>');
|
221
|
+
var $progressElement = $('<div/>');
|
222
|
+
var $closeElement = $(options.closeHtml);
|
223
|
+
var progressBar = {
|
224
|
+
intervalId: null,
|
225
|
+
hideEta: null,
|
226
|
+
maxHideTime: null
|
227
|
+
};
|
228
|
+
var response = {
|
229
|
+
toastId: toastId,
|
230
|
+
state: 'visible',
|
231
|
+
startTime: new Date(),
|
232
|
+
options: options,
|
233
|
+
map: map
|
234
|
+
};
|
235
|
+
|
236
|
+
personalizeToast();
|
237
|
+
|
238
|
+
displayToast();
|
239
|
+
|
240
|
+
handleEvents();
|
241
|
+
|
242
|
+
publish(response);
|
243
|
+
|
244
|
+
if (options.debug && console) {
|
245
|
+
console.log(response);
|
246
|
+
}
|
247
|
+
|
248
|
+
return $toastElement;
|
249
|
+
|
250
|
+
function escapeHtml(source) {
|
251
|
+
if (source == null) {
|
252
|
+
source = '';
|
253
|
+
}
|
254
|
+
|
255
|
+
return source
|
256
|
+
.replace(/&/g, '&')
|
257
|
+
.replace(/"/g, '"')
|
258
|
+
.replace(/'/g, ''')
|
259
|
+
.replace(/</g, '<')
|
260
|
+
.replace(/>/g, '>');
|
261
|
+
}
|
262
|
+
|
263
|
+
function personalizeToast() {
|
264
|
+
setIcon();
|
265
|
+
setTitle();
|
266
|
+
setMessage();
|
267
|
+
setCloseButton();
|
268
|
+
setProgressBar();
|
269
|
+
setRTL();
|
270
|
+
setSequence();
|
271
|
+
setAria();
|
272
|
+
}
|
273
|
+
|
274
|
+
function setAria() {
|
275
|
+
var ariaValue = '';
|
276
|
+
switch (map.iconClass) {
|
277
|
+
case 'toast-success':
|
278
|
+
case 'toast-info':
|
279
|
+
ariaValue = 'polite';
|
280
|
+
break;
|
281
|
+
default:
|
282
|
+
ariaValue = 'assertive';
|
283
|
+
}
|
284
|
+
$toastElement.attr('aria-live', ariaValue);
|
285
|
+
}
|
286
|
+
|
287
|
+
function handleEvents() {
|
288
|
+
if (options.closeOnHover) {
|
289
|
+
$toastElement.hover(stickAround, delayedHideToast);
|
290
|
+
}
|
291
|
+
|
292
|
+
if (!options.onclick && options.tapToDismiss) {
|
293
|
+
$toastElement.click(hideToast);
|
294
|
+
}
|
295
|
+
|
296
|
+
if (options.closeButton && $closeElement) {
|
297
|
+
$closeElement.click(function (event) {
|
298
|
+
if (event.stopPropagation) {
|
299
|
+
event.stopPropagation();
|
300
|
+
} else if (event.cancelBubble !== undefined && event.cancelBubble !== true) {
|
301
|
+
event.cancelBubble = true;
|
302
|
+
}
|
303
|
+
|
304
|
+
if (options.onCloseClick) {
|
305
|
+
options.onCloseClick(event);
|
306
|
+
}
|
307
|
+
|
308
|
+
hideToast(true);
|
309
|
+
});
|
310
|
+
}
|
311
|
+
|
312
|
+
if (options.onclick) {
|
313
|
+
$toastElement.click(function (event) {
|
314
|
+
options.onclick(event);
|
315
|
+
hideToast();
|
316
|
+
});
|
317
|
+
}
|
318
|
+
}
|
319
|
+
|
320
|
+
function displayToast() {
|
321
|
+
$toastElement.hide();
|
322
|
+
|
323
|
+
$toastElement[options.showMethod](
|
324
|
+
{duration: options.showDuration, easing: options.showEasing, complete: options.onShown}
|
325
|
+
);
|
326
|
+
|
327
|
+
if (options.timeOut > 0) {
|
328
|
+
intervalId = setTimeout(hideToast, options.timeOut);
|
329
|
+
progressBar.maxHideTime = parseFloat(options.timeOut);
|
330
|
+
progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
|
331
|
+
if (options.progressBar) {
|
332
|
+
progressBar.intervalId = setInterval(updateProgress, 10);
|
333
|
+
}
|
334
|
+
}
|
335
|
+
}
|
336
|
+
|
337
|
+
function setIcon() {
|
338
|
+
if (map.iconClass) {
|
339
|
+
$toastElement.addClass(options.toastClass).addClass(iconClass);
|
340
|
+
}
|
341
|
+
}
|
342
|
+
|
343
|
+
function setSequence() {
|
344
|
+
if (options.newestOnTop) {
|
345
|
+
$container.prepend($toastElement);
|
346
|
+
} else {
|
347
|
+
$container.append($toastElement);
|
348
|
+
}
|
349
|
+
}
|
350
|
+
|
351
|
+
function setTitle() {
|
352
|
+
if (map.title) {
|
353
|
+
var suffix = map.title;
|
354
|
+
if (options.escapeHtml) {
|
355
|
+
suffix = escapeHtml(map.title);
|
356
|
+
}
|
357
|
+
$titleElement.append(suffix).addClass(options.titleClass);
|
358
|
+
$toastElement.append($titleElement);
|
359
|
+
}
|
360
|
+
}
|
361
|
+
|
362
|
+
function setMessage() {
|
363
|
+
if (map.message) {
|
364
|
+
var suffix = map.message;
|
365
|
+
if (options.escapeHtml) {
|
366
|
+
suffix = escapeHtml(map.message);
|
367
|
+
}
|
368
|
+
$messageElement.append(suffix).addClass(options.messageClass);
|
369
|
+
$toastElement.append($messageElement);
|
370
|
+
}
|
371
|
+
}
|
372
|
+
|
373
|
+
function setCloseButton() {
|
374
|
+
if (options.closeButton) {
|
375
|
+
$closeElement.addClass(options.closeClass).attr('role', 'button');
|
376
|
+
$toastElement.prepend($closeElement);
|
377
|
+
}
|
378
|
+
}
|
379
|
+
|
380
|
+
function setProgressBar() {
|
381
|
+
if (options.progressBar) {
|
382
|
+
$progressElement.addClass(options.progressClass);
|
383
|
+
$toastElement.prepend($progressElement);
|
384
|
+
}
|
385
|
+
}
|
386
|
+
|
387
|
+
function setRTL() {
|
388
|
+
if (options.rtl) {
|
389
|
+
$toastElement.addClass('rtl');
|
390
|
+
}
|
391
|
+
}
|
392
|
+
|
393
|
+
function shouldExit(options, map) {
|
394
|
+
if (options.preventDuplicates) {
|
395
|
+
if (map.message === previousToast) {
|
396
|
+
return true;
|
397
|
+
} else {
|
398
|
+
previousToast = map.message;
|
399
|
+
}
|
400
|
+
}
|
401
|
+
return false;
|
402
|
+
}
|
403
|
+
|
404
|
+
function hideToast(override) {
|
405
|
+
var method = override && options.closeMethod !== false ? options.closeMethod : options.hideMethod;
|
406
|
+
var duration = override && options.closeDuration !== false ?
|
407
|
+
options.closeDuration : options.hideDuration;
|
408
|
+
var easing = override && options.closeEasing !== false ? options.closeEasing : options.hideEasing;
|
409
|
+
if ($(':focus', $toastElement).length && !override) {
|
410
|
+
return;
|
411
|
+
}
|
412
|
+
clearTimeout(progressBar.intervalId);
|
413
|
+
return $toastElement[method]({
|
414
|
+
duration: duration,
|
415
|
+
easing: easing,
|
416
|
+
complete: function () {
|
417
|
+
removeToast($toastElement);
|
418
|
+
clearTimeout(intervalId);
|
419
|
+
if (options.onHidden && response.state !== 'hidden') {
|
420
|
+
options.onHidden();
|
421
|
+
}
|
422
|
+
response.state = 'hidden';
|
423
|
+
response.endTime = new Date();
|
424
|
+
publish(response);
|
425
|
+
}
|
426
|
+
});
|
427
|
+
}
|
428
|
+
|
429
|
+
function delayedHideToast() {
|
430
|
+
if (options.timeOut > 0 || options.extendedTimeOut > 0) {
|
431
|
+
intervalId = setTimeout(hideToast, options.extendedTimeOut);
|
432
|
+
progressBar.maxHideTime = parseFloat(options.extendedTimeOut);
|
433
|
+
progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
|
434
|
+
}
|
435
|
+
}
|
436
|
+
|
437
|
+
function stickAround() {
|
438
|
+
clearTimeout(intervalId);
|
439
|
+
progressBar.hideEta = 0;
|
440
|
+
$toastElement.stop(true, true)[options.showMethod](
|
441
|
+
{duration: options.showDuration, easing: options.showEasing}
|
442
|
+
);
|
443
|
+
}
|
444
|
+
|
445
|
+
function updateProgress() {
|
446
|
+
var percentage = ((progressBar.hideEta - (new Date().getTime())) / progressBar.maxHideTime) * 100;
|
447
|
+
$progressElement.width(percentage + '%');
|
448
|
+
}
|
449
|
+
}
|
450
|
+
|
451
|
+
function getOptions() {
|
452
|
+
return $.extend({}, getDefaults(), toastr.options);
|
453
|
+
}
|
454
|
+
|
455
|
+
function removeToast($toastElement) {
|
456
|
+
if (!$container) { $container = getContainer(); }
|
457
|
+
if ($toastElement.is(':visible')) {
|
458
|
+
return;
|
459
|
+
}
|
460
|
+
$toastElement.remove();
|
461
|
+
$toastElement = null;
|
462
|
+
if ($container.children().length === 0) {
|
463
|
+
$container.remove();
|
464
|
+
previousToast = undefined;
|
465
|
+
}
|
466
|
+
}
|
467
|
+
|
468
|
+
})();
|
469
|
+
});
|
470
|
+
}(typeof define === 'function' && define.amd ? define : function (deps, factory) {
|
471
|
+
if (typeof module !== 'undefined' && module.exports) { //Node
|
472
|
+
module.exports = factory(require('jquery'));
|
473
|
+
} else {
|
474
|
+
window.toastr = factory(window.jQuery);
|
475
|
+
}
|
476
|
+
}));
|
@@ -0,0 +1,201 @@
|
|
1
|
+
.toast-title {
|
2
|
+
font-weight: bold;
|
3
|
+
}
|
4
|
+
.toast-message {
|
5
|
+
-ms-word-wrap: break-word;
|
6
|
+
word-wrap: break-word;
|
7
|
+
}
|
8
|
+
.toast-message a,
|
9
|
+
.toast-message label {
|
10
|
+
color: #ffffff;
|
11
|
+
}
|
12
|
+
.toast-message a:hover {
|
13
|
+
color: #cccccc;
|
14
|
+
text-decoration: none;
|
15
|
+
}
|
16
|
+
.toast-close-button {
|
17
|
+
position: relative;
|
18
|
+
right: -0.3em;
|
19
|
+
top: -0.3em;
|
20
|
+
float: right;
|
21
|
+
font-size: 20px;
|
22
|
+
font-weight: bold;
|
23
|
+
color: #ffffff;
|
24
|
+
-webkit-text-shadow: 0 1px 0 #ffffff;
|
25
|
+
text-shadow: 0 1px 0 #ffffff;
|
26
|
+
opacity: 0.8;
|
27
|
+
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=80);
|
28
|
+
filter: alpha(opacity=80);
|
29
|
+
}
|
30
|
+
.toast-close-button:hover,
|
31
|
+
.toast-close-button:focus {
|
32
|
+
color: #000000;
|
33
|
+
text-decoration: none;
|
34
|
+
cursor: pointer;
|
35
|
+
opacity: 0.4;
|
36
|
+
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=40);
|
37
|
+
filter: alpha(opacity=40);
|
38
|
+
}
|
39
|
+
/*Additional properties for button version
|
40
|
+
iOS requires the button element instead of an anchor tag.
|
41
|
+
If you want the anchor version, it requires `href="#"`.*/
|
42
|
+
button.toast-close-button {
|
43
|
+
padding: 0;
|
44
|
+
cursor: pointer;
|
45
|
+
background: transparent;
|
46
|
+
border: 0;
|
47
|
+
-webkit-appearance: none;
|
48
|
+
}
|
49
|
+
.toast-top-center {
|
50
|
+
top: 0;
|
51
|
+
right: 0;
|
52
|
+
width: 100%;
|
53
|
+
}
|
54
|
+
.toast-bottom-center {
|
55
|
+
bottom: 0;
|
56
|
+
right: 0;
|
57
|
+
width: 100%;
|
58
|
+
}
|
59
|
+
.toast-top-full-width {
|
60
|
+
top: 0;
|
61
|
+
right: 0;
|
62
|
+
width: 100%;
|
63
|
+
}
|
64
|
+
.toast-bottom-full-width {
|
65
|
+
bottom: 0;
|
66
|
+
right: 0;
|
67
|
+
width: 100%;
|
68
|
+
}
|
69
|
+
.toast-top-left {
|
70
|
+
top: 12px;
|
71
|
+
left: 12px;
|
72
|
+
}
|
73
|
+
.toast-top-right {
|
74
|
+
top: 12px;
|
75
|
+
right: 12px;
|
76
|
+
}
|
77
|
+
.toast-bottom-right {
|
78
|
+
right: 12px;
|
79
|
+
bottom: 12px;
|
80
|
+
}
|
81
|
+
.toast-bottom-left {
|
82
|
+
bottom: 12px;
|
83
|
+
left: 12px;
|
84
|
+
}
|
85
|
+
#toast-container {
|
86
|
+
position: fixed;
|
87
|
+
z-index: 999999;
|
88
|
+
/*overrides*/
|
89
|
+
|
90
|
+
}
|
91
|
+
#toast-container * {
|
92
|
+
-moz-box-sizing: border-box;
|
93
|
+
-webkit-box-sizing: border-box;
|
94
|
+
box-sizing: border-box;
|
95
|
+
}
|
96
|
+
#toast-container > div {
|
97
|
+
position: relative;
|
98
|
+
overflow: hidden;
|
99
|
+
margin: 0 0 6px;
|
100
|
+
padding: 15px 15px 15px 50px;
|
101
|
+
width: 300px;
|
102
|
+
-moz-border-radius: 3px 3px 3px 3px;
|
103
|
+
-webkit-border-radius: 3px 3px 3px 3px;
|
104
|
+
border-radius: 3px 3px 3px 3px;
|
105
|
+
background-position: 15px center;
|
106
|
+
background-repeat: no-repeat;
|
107
|
+
-moz-box-shadow: 0 0 12px #999999;
|
108
|
+
-webkit-box-shadow: 0 0 12px #999999;
|
109
|
+
box-shadow: 0 0 12px #999999;
|
110
|
+
color: #ffffff;
|
111
|
+
opacity: 0.8;
|
112
|
+
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=80);
|
113
|
+
filter: alpha(opacity=80);
|
114
|
+
}
|
115
|
+
#toast-container > div:hover {
|
116
|
+
-moz-box-shadow: 0 0 12px #000000;
|
117
|
+
-webkit-box-shadow: 0 0 12px #000000;
|
118
|
+
box-shadow: 0 0 12px #000000;
|
119
|
+
opacity: 1;
|
120
|
+
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100);
|
121
|
+
filter: alpha(opacity=100);
|
122
|
+
cursor: pointer;
|
123
|
+
}
|
124
|
+
#toast-container > .toast-info {
|
125
|
+
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGwSURBVEhLtZa9SgNBEMc9sUxxRcoUKSzSWIhXpFMhhYWFhaBg4yPYiWCXZxBLERsLRS3EQkEfwCKdjWJAwSKCgoKCcudv4O5YLrt7EzgXhiU3/4+b2ckmwVjJSpKkQ6wAi4gwhT+z3wRBcEz0yjSseUTrcRyfsHsXmD0AmbHOC9Ii8VImnuXBPglHpQ5wwSVM7sNnTG7Za4JwDdCjxyAiH3nyA2mtaTJufiDZ5dCaqlItILh1NHatfN5skvjx9Z38m69CgzuXmZgVrPIGE763Jx9qKsRozWYw6xOHdER+nn2KkO+Bb+UV5CBN6WC6QtBgbRVozrahAbmm6HtUsgtPC19tFdxXZYBOfkbmFJ1VaHA1VAHjd0pp70oTZzvR+EVrx2Ygfdsq6eu55BHYR8hlcki+n+kERUFG8BrA0BwjeAv2M8WLQBtcy+SD6fNsmnB3AlBLrgTtVW1c2QN4bVWLATaIS60J2Du5y1TiJgjSBvFVZgTmwCU+dAZFoPxGEEs8nyHC9Bwe2GvEJv2WXZb0vjdyFT4Cxk3e/kIqlOGoVLwwPevpYHT+00T+hWwXDf4AJAOUqWcDhbwAAAAASUVORK5CYII=") !important;
|
126
|
+
}
|
127
|
+
#toast-container > .toast-error {
|
128
|
+
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAHOSURBVEhLrZa/SgNBEMZzh0WKCClSCKaIYOED+AAKeQQLG8HWztLCImBrYadgIdY+gIKNYkBFSwu7CAoqCgkkoGBI/E28PdbLZmeDLgzZzcx83/zZ2SSXC1j9fr+I1Hq93g2yxH4iwM1vkoBWAdxCmpzTxfkN2RcyZNaHFIkSo10+8kgxkXIURV5HGxTmFuc75B2RfQkpxHG8aAgaAFa0tAHqYFfQ7Iwe2yhODk8+J4C7yAoRTWI3w/4klGRgR4lO7Rpn9+gvMyWp+uxFh8+H+ARlgN1nJuJuQAYvNkEnwGFck18Er4q3egEc/oO+mhLdKgRyhdNFiacC0rlOCbhNVz4H9FnAYgDBvU3QIioZlJFLJtsoHYRDfiZoUyIxqCtRpVlANq0EU4dApjrtgezPFad5S19Wgjkc0hNVnuF4HjVA6C7QrSIbylB+oZe3aHgBsqlNqKYH48jXyJKMuAbiyVJ8KzaB3eRc0pg9VwQ4niFryI68qiOi3AbjwdsfnAtk0bCjTLJKr6mrD9g8iq/S/B81hguOMlQTnVyG40wAcjnmgsCNESDrjme7wfftP4P7SP4N3CJZdvzoNyGq2c/HWOXJGsvVg+RA/k2MC/wN6I2YA2Pt8GkAAAAASUVORK5CYII=") !important;
|
129
|
+
}
|
130
|
+
#toast-container > .toast-success {
|
131
|
+
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADsSURBVEhLY2AYBfQMgf///3P8+/evAIgvA/FsIF+BavYDDWMBGroaSMMBiE8VC7AZDrIFaMFnii3AZTjUgsUUWUDA8OdAH6iQbQEhw4HyGsPEcKBXBIC4ARhex4G4BsjmweU1soIFaGg/WtoFZRIZdEvIMhxkCCjXIVsATV6gFGACs4Rsw0EGgIIH3QJYJgHSARQZDrWAB+jawzgs+Q2UO49D7jnRSRGoEFRILcdmEMWGI0cm0JJ2QpYA1RDvcmzJEWhABhD/pqrL0S0CWuABKgnRki9lLseS7g2AlqwHWQSKH4oKLrILpRGhEQCw2LiRUIa4lwAAAABJRU5ErkJggg==") !important;
|
132
|
+
}
|
133
|
+
#toast-container > .toast-warning {
|
134
|
+
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGYSURBVEhL5ZSvTsNQFMbXZGICMYGYmJhAQIJAICYQPAACiSDB8AiICQQJT4CqQEwgJvYASAQCiZiYmJhAIBATCARJy+9rTsldd8sKu1M0+dLb057v6/lbq/2rK0mS/TRNj9cWNAKPYIJII7gIxCcQ51cvqID+GIEX8ASG4B1bK5gIZFeQfoJdEXOfgX4QAQg7kH2A65yQ87lyxb27sggkAzAuFhbbg1K2kgCkB1bVwyIR9m2L7PRPIhDUIXgGtyKw575yz3lTNs6X4JXnjV+LKM/m3MydnTbtOKIjtz6VhCBq4vSm3ncdrD2lk0VgUXSVKjVDJXJzijW1RQdsU7F77He8u68koNZTz8Oz5yGa6J3H3lZ0xYgXBK2QymlWWA+RWnYhskLBv2vmE+hBMCtbA7KX5drWyRT/2JsqZ2IvfB9Y4bWDNMFbJRFmC9E74SoS0CqulwjkC0+5bpcV1CZ8NMej4pjy0U+doDQsGyo1hzVJttIjhQ7GnBtRFN1UarUlH8F3xict+HY07rEzoUGPlWcjRFRr4/gChZgc3ZL2d8oAAAAASUVORK5CYII=") !important;
|
135
|
+
}
|
136
|
+
#toast-container.toast-top-center > div,
|
137
|
+
#toast-container.toast-bottom-center > div {
|
138
|
+
width: 300px;
|
139
|
+
margin-left: auto;
|
140
|
+
margin-right: auto;
|
141
|
+
}
|
142
|
+
#toast-container.toast-top-full-width > div,
|
143
|
+
#toast-container.toast-bottom-full-width > div {
|
144
|
+
width: 96%;
|
145
|
+
margin-left: auto;
|
146
|
+
margin-right: auto;
|
147
|
+
}
|
148
|
+
.toast {
|
149
|
+
background-color: #030303;
|
150
|
+
}
|
151
|
+
.toast-success {
|
152
|
+
background-color: #51a351;
|
153
|
+
}
|
154
|
+
.toast-error {
|
155
|
+
background-color: #bd362f;
|
156
|
+
}
|
157
|
+
.toast-info {
|
158
|
+
background-color: #2f96b4;
|
159
|
+
}
|
160
|
+
.toast-warning {
|
161
|
+
background-color: #f89406;
|
162
|
+
}
|
163
|
+
|
164
|
+
.toast-progress {
|
165
|
+
position: absolute;
|
166
|
+
left: 0;
|
167
|
+
bottom: 0;
|
168
|
+
height: 4px;
|
169
|
+
background-color: #000000;
|
170
|
+
opacity: 0.4;
|
171
|
+
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=40);
|
172
|
+
filter: alpha(opacity=40);
|
173
|
+
}
|
174
|
+
|
175
|
+
/*Responsive Design*/
|
176
|
+
@media all and (max-width: 240px) {
|
177
|
+
#toast-container > div {
|
178
|
+
padding: 8px 8px 8px 50px;
|
179
|
+
width: 11em;
|
180
|
+
}
|
181
|
+
#toast-container .toast-close-button {
|
182
|
+
right: -0.2em;
|
183
|
+
top: -0.2em;
|
184
|
+
}
|
185
|
+
}
|
186
|
+
@media all and (min-width: 241px) and (max-width: 480px) {
|
187
|
+
#toast-container > div {
|
188
|
+
padding: 8px 8px 8px 50px;
|
189
|
+
width: 18em;
|
190
|
+
}
|
191
|
+
#toast-container .toast-close-button {
|
192
|
+
right: -0.2em;
|
193
|
+
top: -0.2em;
|
194
|
+
}
|
195
|
+
}
|
196
|
+
@media all and (min-width: 481px) and (max-width: 768px) {
|
197
|
+
#toast-container > div {
|
198
|
+
padding: 15px 15px 15px 50px;
|
199
|
+
width: 25em;
|
200
|
+
}
|
201
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clipboard-toastr-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kai Park
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: clipboard.js and toastr.js to rails Gem
|
14
14
|
email: ggogun@gmail.com
|
@@ -16,7 +16,20 @@ executables: []
|
|
16
16
|
extensions: []
|
17
17
|
extra_rdoc_files: []
|
18
18
|
files:
|
19
|
+
- LICENSE
|
20
|
+
- README.md
|
21
|
+
- Rakefile
|
22
|
+
- bin/console
|
23
|
+
- bin/setup
|
24
|
+
- lib/clipboard-toastr-rails.rb
|
25
|
+
- lib/clipboard-toastr-rails/engine.rb
|
26
|
+
- lib/clipboard-toastr-rails/version.rb
|
19
27
|
- test/clipboard_toastr_rails_test.rb
|
28
|
+
- test/test_helper.rb
|
29
|
+
- vendor/assets/javascripts/clipboard-toastr.js
|
30
|
+
- vendor/assets/javascripts/clipboard.js
|
31
|
+
- vendor/assets/javascripts/toastr.js
|
32
|
+
- vendor/assets/stylesheets/toastr.scss
|
20
33
|
homepage: https://github.com/ggomagundan/clipboard-toastr-rails
|
21
34
|
licenses:
|
22
35
|
- MIT
|