Posted By

martias21 on 07/08/11


Tagged

cubepoints


Versions (?)

CubePoints Notify Pop-up Redesign: jquery.notice.js


 / Published in: jQuery
 

The file is located at wp-content\plugins\cubepoints\modules\notice

  1. /**
  2. * jQuery.noticeAdd() and jQuery.noticeRemove()
  3. * These functions create and remove growl-like notices
  4. *
  5. * Copyright (c) 2009 Tim Benniks
  6. *
  7. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8. * of this software and associated documentation files (the "Software"), to deal
  9. * in the Software without restriction, including without limitation the rights
  10. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. * copies of the Software, and to permit persons to whom the Software is
  12. * furnished to do so, subject to the following conditions:
  13. *
  14. * The above copyright notice and this permission notice shall be included in
  15. * all copies or substantial portions of the Software.
  16. *
  17. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  22. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  23. * THE SOFTWARE.
  24. *
  25. * @author Tim Benniks <[email protected]>
  26. * @copyright 2009 timbenniks.com
  27. * @version $Id: jquery.notice.js 1 2009-01-24 12:24:18Z timbenniks $
  28. **/
  29. (function(jQuery)
  30. {
  31. jQuery.extend({
  32. noticeAdd: function(options)
  33. {
  34. var defaults = {
  35. inEffect: {opacity: 'show'}, // in effect
  36. inEffectDuration: 600, // in effect duration in miliseconds
  37. stayTime: 3000, // time in miliseconds before the item has to disappear
  38. text: '', // content of the item
  39. stay: false, // should the notice item stay or not?
  40. type: 'notice' // could also be error, succes
  41. }
  42.  
  43. // declare varaibles
  44. var options, noticeWrapAll, noticeItemOuter, noticeItemInner;
  45.  
  46. options = jQuery.extend({}, defaults, options);
  47. noticeWrapAll = (!jQuery('.notice-wrap').length) ? jQuery('<div></div>').addClass('notice-wrap').appendTo('body') : jQuery('.notice-wrap');
  48. noticeItemOuter = jQuery('<div></div>').addClass('notice-item-wrapper');
  49. noticeItemInner = jQuery('<div></div>').hide().addClass('notice-item ' + options.type).appendTo(noticeWrapAll).html('<p>'+options.text+'</p>').animate(options.inEffect, options.inEffectDuration).wrap(noticeItemOuter);
  50.  
  51. // hmmmz, zucht
  52. if(navigator.userAgent.match(/MSIE 6/i))
  53. {
  54. noticeWrapAll.css({top: document.documentElement.scrollTop});
  55. }
  56.  
  57. if(!options.stay)
  58. {
  59. setTimeout(function()
  60. {
  61. jQuery.noticeRemove(noticeItemInner);
  62. },
  63. options.stayTime);
  64. }
  65. },
  66.  
  67. noticeRemove: function(obj)
  68. {
  69. obj.animate({opacity: '0'}, 200, function()
  70. {
  71. obj.parent().animate({height: '0px'}, 100, function()
  72. {
  73. obj.parent().remove();
  74. });
  75. });
  76. }
  77. });
  78. })(jQuery);

Report this snippet  

You need to login to post a comment.