]>
jfr.im git - irc/quakenet/qwebirc.git/blob - js/ui/notifications.js
1 qwebirc
.ui
.HilightController
= new Class({
2 initialize: function(parent
) {
7 match: function(text
) {
8 var nick
= this.parent
.nickname
;
9 if(nick
!= this.prevnick
)
10 this.regex
= new RegExp('\\b' + RegExp
.escape(nick
) + '\\b', "i");
12 if(text
.match(this.regex
))
18 qwebirc
.ui
.Beeper
= new Class({
19 initialize: function(uiOptions
) {
20 this.uiOptions
= uiOptions
;
22 this.soundInited
= false;
23 this.soundReady
= false;
25 if(this.uiOptions
.BEEP_ON_MENTION
)
28 soundInit: function() {
31 if(!$defined(Browser
.Plugins
.Flash
) || Browser
.Plugins
.Flash
.version
< 8)
33 this.soundInited
= true;
35 this.soundPlayer
= new qwebirc
.sound
.SoundPlayer();
36 this.soundPlayer
.addEvent("ready", function() {
37 this.soundReady
= true;
40 this.soundPlayer
.go();
43 if(!this.soundReady
|| !this.uiOptions
.BEEP_ON_MENTION
)
46 this.soundPlayer
.beep();
50 qwebirc
.ui
.Flasher
= new Class({
51 initialize: function(uiOptions
) {
52 this.uiOptions
= uiOptions
;
54 this.windowFocused
= false;
55 this.canUpdateTitle
= true;
56 this.titleText
= document
.title
;
58 var favIcons
= $$("link[rel=icon]"), favIconParent
= $$("head");
59 if(favIcons
&& favIcons
.length
> 0 && favIconParent
&& favIconParent
.length
> 0) {
60 this.favIcon
= favIcons
[0];
61 this.favIconParent
= favIconParent
[0];
62 this.favIconVisible
= true;
63 this.emptyFavIcon
= new Element("link");
64 this.emptyFavIcon
.rel
= "shortcut icon";
65 this.emptyFavIcon
.href
= "/images/empty_favicon.ico";
67 this.flashing
= false;
71 this.canFlash
= false;
75 if(!this.uiOptions
.FLASH_ON_MENTION
|| this.windowFocused
|| !this.canFlash
|| this.flashing
)
78 this.titleText
= document
.title
; /* just in case */
79 var flashA = function() {
81 this.canUpdateTitle
= false;
82 document
.title
= "Activity!";
84 this.flasher
= flashB
.delay(500);
87 var flashB = function() {
89 this.canUpdateTitle
= true;
90 document
.title
= this.titleText
;
92 this.flasher
= flashA
.delay(500);
98 cancelFlash: function() {
99 if(!this.canFlash
|| !$defined(this.flasher
))
102 this.flashing
= false;
104 $clear(this.flasher
);
108 document
.title
= this.titleText
;
109 this.canUpdateTitle
= true;
111 hideFavIcon: function() {
112 if(this.favIconVisible
) {
113 this.favIconVisible
= false;
114 this.favIconParent
.removeChild(this.favIcon
);
115 this.favIconParent
.appendChild(this.emptyFavIcon
);
118 showFavIcon: function() {
119 if(!this.favIconVisible
) {
120 this.favIconVisible
= true;
121 this.favIconParent
.removeChild(this.emptyFavIcon
);
122 this.favIconParent
.appendChild(this.favIcon
);
125 updateTitle: function(text
) {
126 this.titleText
= text
;
127 return this.canUpdateTitle
;
129 focusChange: function(value
) {