{"id":13402737,"url":"https://github.com/CodeSeven/toastr","last_synced_at":"2025-03-14T08:31:08.726Z","repository":{"id":3158387,"uuid":"4188772","full_name":"CodeSeven/toastr","owner":"CodeSeven","description":"Simple javascript toast notifications","archived":false,"fork":false,"pushed_at":"2023-02-27T15:44:28.000Z","size":2049,"stargazers_count":11842,"open_issues_count":159,"forks_count":2039,"subscribers_count":341,"default_branch":"master","last_synced_at":"2024-04-14T22:20:20.045Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://www.toastrjs.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CodeSeven.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2012-05-01T01:38:04.000Z","updated_at":"2024-04-14T17:32:56.000Z","dependencies_parsed_at":"2023-01-13T12:19:27.447Z","dependency_job_id":"f8dba0cb-798e-4f3d-aa96-872e6f7f19e5","html_url":"https://github.com/CodeSeven/toastr","commit_stats":{"total_commits":311,"total_committers":71,"mean_commits":4.380281690140845,"dds":0.5080385852090032,"last_synced_commit":"50092cc604850a16c985520b63df184d3e0b4086"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeSeven%2Ftoastr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeSeven%2Ftoastr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeSeven%2Ftoastr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeSeven%2Ftoastr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CodeSeven","download_url":"https://codeload.github.com/CodeSeven/toastr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221449531,"owners_count":16823609,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T19:01:20.176Z","updated_at":"2024-10-25T18:30:34.817Z","avatar_url":"https://github.com/CodeSeven.png","language":"JavaScript","readme":"# toastr\n**toastr** is a Javascript library for non-blocking notifications. jQuery is required. The goal is to create a simple core library that can be customized and extended.\n\n[![Build Status](https://travis-ci.org/CodeSeven/toastr.svg)](https://travis-ci.org/CodeSeven/toastr)\nBrowser testing provided by BrowserStack.\n\n## Current Version\n2.1.4\n\n## Demo\n- Demo can be found at http://codeseven.github.io/toastr/demo.html\n- [Demo using FontAwesome icons with toastr](http://plnkr.co/edit/6W9URNyyp2ItO4aUWzBB?p=preview)\n\n## CDNs\n[![cdnjs](https://img.shields.io/cdnjs/v/toastr.js.svg)](https://cdnjs.com/libraries/toastr.js)\n[![jsdelivr](https://data.jsdelivr.com/v1/package/npm/toastr/badge)](https://www.jsdelivr.com/package/npm/toastr)\n\nToastr is hosted at cdnjs and jsdelivr\n\n#### Debug\n- [//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.css](//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.css)\n\n#### Minified\n- [//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js](//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js)\n- [//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css](//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css)\n\n## Install\n\n#### [NuGet Gallery](http://nuget.org/packages/toastr)\n```\nInstall-Package toastr\n```\n\n#### [Bower](http://bower.io/search/?q=toastr)\n```\nbower install toastr\n```\n\n#### [npm](https://www.npmjs.com/package/toastr)\n```\nnpm install --save toastr\n```\n\n#### [yarn](https://yarnpkg.com/en/package/toastr)\n```\nyarn add toastr\n```\n\n#### [Ruby on Rails](https://github.com/tylergannon/toastr-rails)\n```ruby\n# Gemfile\n\ngem 'toastr-rails'\n```\n\n```coffee\n# application.coffee\n\n#= require toastr\n```\n\n```scss\n// application.scss\n\n@import \"toastr\";\n```\n\n\n\n\n## Wiki and Change Log\n[Wiki including Change Log](https://github.com/CodeSeven/toastr/wiki)\n\n## Breaking Changes\n\n#### Animation Changes\nThe following animations options have been deprecated and should be replaced:\n\n - Replace `options.fadeIn` with `options.showDuration`\n - Replace `options.onFadeIn` with `options.onShown`\n - Replace `options.fadeOut` with `options.hideDuration`\n - Replace `options.onFadeOut` with `options.onHidden`\n\n## Quick Start\n\n### 3 Easy Steps\nFor other API calls, see the [demo](http://codeseven.github.io/toastr/demo.html).\n\n1. Link to toastr.css `\u003clink href=\"toastr.css\" rel=\"stylesheet\"/\u003e`\n\n2. Link to toastr.js `\u003cscript src=\"toastr.js\"\u003e\u003c/script\u003e`\n\n3. use toastr to display a toast for info, success, warning or error\n\t```js\n\t// Display an info toast with no title\n\ttoastr.info('Are you the 6 fingered man?')\n\t```\n\n### Other Options\n```js\n// Display a warning toast, with no title\ntoastr.warning('My name is Inigo Montoya. You killed my father, prepare to die!')\n\n// Display a success toast, with a title\ntoastr.success('Have fun storming the castle!', 'Miracle Max Says')\n\n// Display an error toast, with a title\ntoastr.error('I do not think that word means what you think it means.', 'Inconceivable!')\n\n// Immediately remove current toasts without using animation\ntoastr.remove()\n\n// Remove current toasts using animation\ntoastr.clear()\n\n// Override global options\ntoastr.success('We do have the Kapua suite available.', 'Turtle Bay Resort', {timeOut: 5000})\n```\n\n### Escape HTML characters\nIn case you want to escape HTML characters in title and message\n\n\ttoastr.options.escapeHtml = true;\n\n### Close Button\nOptionally enable a close button\n```js\ntoastr.options.closeButton = true;\n````\n\nOptionally override the close button's HTML.\n\n```js\ntoastr.options.closeHtml = '\u003cbutton\u003e\u003ci class=\"icon-off\"\u003e\u003c/i\u003e\u003c/button\u003e';\n```\n\nYou can also override the CSS/LESS for `#toast-container .toast-close-button`\n\nOptionally override the hide animation when the close button is clicked (falls back to hide configuration).\n```js\ntoastr.options.closeMethod = 'fadeOut';\ntoastr.options.closeDuration = 300;\ntoastr.options.closeEasing = 'swing';\n```\n\n### Display Sequence\nShow newest toast at bottom (top is default)\n```js\ntoastr.options.newestOnTop = false;\n```\n\n### Callbacks\n```js\n// Define a callback for when the toast is shown/hidden/clicked\ntoastr.options.onShown = function() { console.log('hello'); }\ntoastr.options.onHidden = function() { console.log('goodbye'); }\ntoastr.options.onclick = function() { console.log('clicked'); }\ntoastr.options.onCloseClick = function() { console.log('close button clicked'); }\n```\n\n### Animation Options\nToastr will supply default animations, so you do not have to provide any of these settings. However you have the option to override the animations if you like.\n\n#### Easings\nOptionally override the animation easing to show or hide the toasts. Default is swing. swing and linear are built into jQuery.\n```js\ntoastr.options.showEasing = 'swing';\ntoastr.options.hideEasing = 'linear';\ntoastr.options.closeEasing = 'linear';\n```\n\nUsing the jQuery Easing plugin (http://www.gsgd.co.uk/sandbox/jquery/easing/)\n```js\ntoastr.options.showEasing = 'easeOutBounce';\ntoastr.options.hideEasing = 'easeInBack';\ntoastr.options.closeEasing = 'easeInBack';\n```\n\n#### Animation Method\nUse the jQuery show/hide method of your choice. These default to fadeIn/fadeOut. The methods fadeIn/fadeOut, slideDown/slideUp, and show/hide are built into jQuery.\n```js\ntoastr.options.showMethod = 'slideDown';\ntoastr.options.hideMethod = 'slideUp';\ntoastr.options.closeMethod = 'slideUp';\n```\n\n### Prevent Duplicates\nRather than having identical toasts stack, set the preventDuplicates property to true. Duplicates are matched to the previous toast based on their message content.\n```js\ntoastr.options.preventDuplicates = true;\n```\n\n### Timeouts\nControl how toastr interacts with users by setting timeouts appropriately.\n```js\ntoastr.options.timeOut = 30; // How long the toast will display without user interaction\ntoastr.options.extendedTimeOut = 60; // How long the toast will display after a user hovers over it\n```\n\n### Prevent from Auto Hiding\nTo prevent toastr from closing based on the timeouts, set the `timeOut` and `extendedTimeOut` options to `0`. The toastr will persist until selected.\n\n```js\ntoastr.options.timeOut = 0;\ntoastr.options.extendedTimeOut = 0;\n```\n\n### Progress Bar\nVisually indicate how long before a toast expires.\n```js\ntoastr.options.progressBar = true;\n```\n\n### rtl\nFlip the toastr to be displayed properly for right-to-left languages.\n```js\ntoastr.options.rtl = true;\n```\n\n## Building Toastr\n\nTo build the minified and css versions of Toastr you will need [node](http://nodejs.org) installed. (Use Homebrew or Chocolatey.)\n\n```\nnpm install -g gulp karma-cli\nnpm install\n```\n\nAt this point the dependencies have been installed and you can build Toastr\n\n- Run the analytics `gulp analyze`\n- Run the test `gulp test`\n- Run the build `gulp`\n\n## Contributing\n\nFor a pull request to be considered it must resolve a bug, or add a feature which is beneficial to a large audience.\n\nPull requests must pass existing unit tests, CI processes, and add additional tests to indicate successful operation of a new feature, or the resolution of an identified bug.\n\nRequests must be made against the `develop` branch. Pull requests submitted against the `master` branch will not be considered.\n\nAll pull requests are subject to approval by the repository owners, who have sole discretion over acceptance or denial.\n\n## Authors\n**John Papa**\n\n+ [http://twitter.com/John_Papa](http://twitter.com/John_Papa)\n\n**Tim Ferrell**\n\n+ [http://twitter.com/ferrell_tim](http://twitter.com/ferrell_tim)\n\n**Hans Fjällemark**\n\n+ [http://twitter.com/hfjallemark](http://twitter.com/hfjallemark)\n\n## Credits\nInspired by https://github.com/Srirangan/notifer.js/.\n\n## Copyright\nCopyright © 2012-2015\n\n## License\ntoastr is under MIT license - http://www.opensource.org/licenses/mit-license.php\n","funding_links":[],"categories":["JavaScript","Notifications","Notification","Notifications [🔝](#readme)","UI Components","Programming Languages","通知"],"sub_categories":["Runner","Save","Notification, Snackbar and Toast","运行器","运行器e2e测试"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCodeSeven%2Ftoastr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCodeSeven%2Ftoastr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCodeSeven%2Ftoastr/lists"}