{"_id":"@claviska/jquery-announce","_rev":"2-808381b7b71aaee1c08e83f4bae56f5d","name":"@claviska/jquery-announce","description":"A micro-plugin for displaying unobtrusive announcements.","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@claviska/jquery-announce","description":"A micro-plugin for displaying unobtrusive announcements.","version":"1.0.0","author":{"name":"Cory LaViska"},"homepage":"https://github.com/claviska/jquery-alertable","license":"MIT","repository":{"type":"git","url":"git+https://github.com/claviska/jquery-announce.git"},"dependencies":{"jquery":">= 1.8.x"},"devDependencies":{"del":"^2.2.0","gulp":"^3.9.1","gulp-help":"^1.6.1","gulp-rename":"^1.2.2","gulp-uglify":"^1.5.3"},"gitHead":"b4b53707d4a2031f16843133cccacef2267d977e","bugs":{"url":"https://github.com/claviska/jquery-announce/issues"},"_id":"@claviska/jquery-announce@1.0.0","scripts":{},"_shasum":"90ccddd13c479f63fe60e7ad86550dd6bd0ed783","_from":".","_npmVersion":"3.10.8","_nodeVersion":"7.0.0","_npmUser":{"name":"claviska","email":"cory@abeautifulsite.net"},"dist":{"shasum":"90ccddd13c479f63fe60e7ad86550dd6bd0ed783","tarball":"https://registry.npmjs.org/@claviska/jquery-announce/-/jquery-announce-1.0.0.tgz","integrity":"sha512-dNDrDX4Zs5UCo6F8FENB1HGpuLasUYx+6iPzHpyW2T8xSYX0+ukM/DraOlHvtGyyAZ3huFt2Ksc+17UZX05YTA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBREzVwneylS82KWgWGIA36sO26dlpiNbwIZh/G4YQZDAiArT+IGEeRhNcE6m9EpEP/EFhe1pS5bbC562m/UUQ8ogw=="}]},"maintainers":[{"name":"claviska","email":"cory@abeautifulsite.net"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/jquery-announce-1.0.0.tgz_1487093946415_0.8316073182504624"}}},"readme":"# jquery.announce.js - A micro-plugin for displaying unobtrusive announcements.\n\nDeveloped by Cory LaViska for A Beautiful Site, LLC\n\nLicensed under the MIT license: http://opensource.org/licenses/MIT\n\n## Overview:\n\nThis plugin provides a minimal, lightweight, and customizable notification API for showing unobtrusive announcements in various styles. It's flexible enough to mold to your application's existing stylesheet and markup.\n\nFeatures:\n\n- Simple syntax:\n  - `$.announce.info('Hello there!')`\n  - `$.announce.danger('Delete this?')`\n  - `$.announce.success('All done?')`\n  - `$.announce.warning('Are you sure?')`\n- Minimal default styles; easy to customize or write your own.\n- Show/hide hooks for adding custom animation (works well with Velocity.js).\n- Responsive\n- Works well with Bootstrap and other frameworks\n- Compact! (about 110 lines)\n\n## Demo\n\nA quick demo can be found on CodePen: http://codepen.io/claviska/pen/EZrrZz\n\nA local demo can be found in `example.html`.\n\n## Installing\n\nInclude the minified version of this plugin in your project or install via NPM:\n\n```\nnpm install --save @claviska/jquery-announce\n```\n\n## Using the plugin\n\n```javascript\n// Minimal example\n$.announce.info('Hi there!');\n\n// Example with options\n$.announce.info({\n  message: 'Well <em>hello</em> there!',\n  duration: 2000,\n  hideOnClick: true,\n  html: true\n});\n```\n\n### Methods\n\nThe following announcements are included by default:\n\n- `$.announce.info(options)`\n- `$.announce.danger(options)`\n- `$.announce.success(options)`\n- `$.announce.warning(options)`\n\nThere is also a method to create custom announcements:\n\n- `$.announce.say('your-custom-type', options)`\n\nIn this case, the resulting announcement will be assigned the following classes that you can use for styling purposes: `announce announce-your-custom-type`\n\n**Note:** By design, only one announcement will ever be shown at a time. Multiple notifications (i.e. stacking or growl-style) are outside the scope of this micro-plugin.\n\n### Options\n\nIf `options` is a string, it will be used as the message. If options is an object, it will be merged with `$.announce.defaults`.\n\nAvailable options:\n\n- `className`: The class name to assign to the announcement.\n- `duration`: The length of time in milliseconds to show the announcement.\n- `hideOnClick`: If true, the announcement will be hidden when the user clicks on it.\n- `html`: If true, HTML will not be escaped when setting the message.\n- `show`: Function for showing the announcement. Use `this` to reference the announcement element. Must return a promise-compatible object that resolves when the promise is completely visible. (This promise is currently not used, but is included for future enhancements.) Default value:\n  ```javascript\n  function() {\n    var defer = $.Deferred();\n    $(this).fadeIn(250, function() {\n      defer.resolve();\n    });\n    return defer;\n  }\n  ```\n- `hide`: Function for hiding the announcement. Use `this` to reference the announcement element. Must return a promise-compatible object that resolves when the announcement is completely hidden. Default value:\n  ```javascript\n  function() {\n    var defer = $.Deferred();\n    $(this).fadeOut(250, function() {\n      $(this).remove();\n      defer.resolve();\n    });\n    return defer;\n  }\n  ```\n\nYou may also update the default options *before calling either method*:\n\n```javascript\n$.announce.defaults.optionName = yourValue;\n```\n\n### Promises\n\nAll announcements return a promise-compatible ([jQuery-deferred](https://api.jquery.com/jquery.deferred/)) object that will resolve once the announcement is completely hidden:\n\n```javascript\n$.announce.info('Hi there!').then(function() {\n  console.log('Dismissed!');\n});\n```\n","maintainers":[{"name":"claviska","email":"cory@abeautifulsite.net"}],"time":{"modified":"2022-06-12T16:04:58.612Z","created":"2017-02-14T17:39:08.287Z","1.0.0":"2017-02-14T17:39:08.287Z"},"homepage":"https://github.com/claviska/jquery-alertable","repository":{"type":"git","url":"git+https://github.com/claviska/jquery-announce.git"},"author":{"name":"Cory LaViska"},"bugs":{"url":"https://github.com/claviska/jquery-announce/issues"},"license":"MIT","readmeFilename":"readme.md"}