PageSourceSearch

http://animesub.info/forum/js/jquery.growl.js

js animesub.info collected 2026-10-01 14:30:36 UTC 2,900 bytes, 114 lines download raw bytes

1/**************************************************************
2*
3* Growl - for the net and jQuery (http://labs.d-xp.com/growl/)
4* 
5* @author  : Artur Heinze
6* @version : 1.01 
7**************************************************************/
8
9(function($){
10  
11  //GROWL OBJECT
12  //--------------------------------------------------------------------
13  
14  $.Growl = {
15
16    _statsCount: 0,
17    
18    show: function(options){
19    
20      var settings = $.extend({
21        "id": ("gs"+$.Growl._statsCount++),
22        "icon": false,
23        "title": false,
24        "message": "",
25        "cls": "",
26        "speed": 500,
27        "timeout": 3000
28      },options);
29      
30      if($("#"+settings.id).length!=0){
31        $("#"+settings.id).remove();
32      }
33      
34      //append status
35      this._getContainer().prepend(
36        '<div id="'+settings.id+'" class="growlstatus '+settings.cls+'" style="display:none;"><div class="growlstatusclose"></div>'+settings.message+'</div>'
37      );
38      
39      var status = $("#"+settings.id);
40      
41      //bind close button
42      status.find(".growlstatusclose").bind('click',function(){
43        $.Growl.close($(this).parent().attr("id"),true,settings.speed);
44      });
45      
46      //show title
47      if(settings.title!==false){
48        $("#"+settings.id).prepend('<div class="growltitle">'+settings.title+'</div>');
49      }
50      
51      //show icon
52      if(settings.icon!==false){
53        
54        status.addClass("growlwithicon");
55        status.addClass("growlicon_"+settings.icon);
56      }
57      
58      status
59      //do not hide on hover
60      .hover(
61        function(){
62          $(this).addClass("growlhover");
63        },
64        function(){
65          $(this).removeClass("growlhover");
66          if(settings.timeout!==false){
67            window.setTimeout("$.Growl.close('"+settings.id+"')", settings.timeout);
68          }
69        }
70      )      
71      //show status+handle timeout
72      .fadeIn(settings.speed,function(){
73        if(settings.timeout!==false){
74          window.setTimeout("$.Growl.close('"+settings.id+"')", settings.timeout);
75        }
76      });
77      
78      return settings.id;
79    },
80    
81    close: function(id,force,speed){
82    
83      if(arguments.length==0){
84        $(".growlstatus",this._getContainer()).hide().remove();
85      }else{
86          if(!$("#"+id).hasClass("growlhover") || force){
87              $("#"+id).animate({opacity:"0.0"}, speed);
88              $("#"+id).slideUp(function(){
89                  $(this).remove();
90            })
91          }
92      }
93    
94    },
95    
96    _getContainer: function(){
97      
98      if($("#growlcontainer").length==0) {
99        $("body").append('<div id="growlcontainer"></div>');
100      }
101      
102      return $("#growlcontainer");
103      
104    }
105  
106  };
107  
108  
109  //HELPER FUNCTIONS
110  //--------------------------------------------------------------------
111  //
112  // none for now
113
114})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.