diff options
| author | Andreas Brachold <vdr07@deltab.de> | 2008-01-05 08:53:59 +0000 |
|---|---|---|
| committer | Andreas Brachold <vdr07@deltab.de> | 2008-01-05 08:53:59 +0000 |
| commit | bd621d08630edcf0f7f2a3679f57f0429d3f0704 (patch) | |
| tree | 6c37f956a8bc132202eaceb367a58f9f13e62473 | |
| parent | be19847c9a759bc7018e912fe25e86f8b721062b (diff) | |
| download | xxv-bd621d08630edcf0f7f2a3679f57f0429d3f0704.tar.gz xxv-bd621d08630edcf0f7f2a3679f57f0429d3f0704.tar.bz2 | |
* AUTOTIMER: Don't create timer with same data
* alist: show matched timer as tooltip
| -rw-r--r-- | skins/deltab/alist.tmpl | 7 | ||||
| -rw-r--r-- | skins/deltab/style.css | 4 | ||||
| -rw-r--r-- | skins/deltab/tooltip.js | 241 | ||||
| -rw-r--r-- | skins/stone/alist.tmpl | 9 | ||||
| -rw-r--r-- | skins/stone/tooltip.js | 88 | ||||
| -rw-r--r-- | skins/stone_flat/alist.tmpl | 7 |
6 files changed, 293 insertions, 63 deletions
diff --git a/skins/deltab/alist.tmpl b/skins/deltab/alist.tmpl index df418ff..ca27fc2 100644 --- a/skins/deltab/alist.tmpl +++ b/skins/deltab/alist.tmpl @@ -15,9 +15,10 @@ <!-- active: <?% param.timers.$id.activeTimer.size %?> --> <!-- deactive:<?% param.timers.$id.deactiveTimer.size %?> --> <?% END %?> - <a href="?cmd=tlist&data=<?% param.timers.$id.allTimer.join(',') %?>"> - <img src="images/onoff.<?% global.imagetyp %?>" alt="" title="<?% gettext("Planned recordings") %?>" /> - </a> + <a href="?cmd=tlist&data=<?% param.timers.$id.allTimer.join('_') %?>" + onmouseover="ttptlist(this, '<?% gettext("Planned recordings") %?>','<?% param.timers.$id.allTimer.join('_') %?>', -400);" + <img src="images/info.<?% global.imagetyp %?>" alt="" /> + </a> <?% END %?> <?% END %?> <a href="?cmd=search&data=<?% url( title ) %?>"> diff --git a/skins/deltab/style.css b/skins/deltab/style.css index 1576664..fc8945a 100644 --- a/skins/deltab/style.css +++ b/skins/deltab/style.css @@ -408,8 +408,6 @@ font-size:8px; #TOOLTIP { position:absolute; width:400px; -top:0; -left:0; z-index:5; visibility:hidden; } @@ -428,7 +426,7 @@ margin:0; padding:3px; } -#ttwindow p.description { +#ttwindow p.description, p.title { border-left:1px dashed #4080ff; border-right:1px dashed #4080ff; border-bottom:1px dashed #4080ff; diff --git a/skins/deltab/tooltip.js b/skins/deltab/tooltip.js index 191b2e5..89cb309 100644 --- a/skins/deltab/tooltip.js +++ b/skins/deltab/tooltip.js @@ -8,10 +8,70 @@ var ttp_visable = 0; var ttp_offset_x = 0; var ttp_x_start = -1; var ttp_y_start = -1; +var ttp_active = 1; +var ttp_inside = 0; + +var ie5=document.all&&document.getElementById; +var ns6=document.getElementById&&!document.all; +var opera =window.opera; +var dom=(!opera && document.compatMode && document.compatMode!="BackCompat"); + +function iecompattest(){ + return dom ? document.documentElement : document.body +} + +function getScrollingPosition() { + var x = 0, y = 0; + if( ns6 || typeof( window.pageYOffset ) == 'number' ) { + y = window.pageYOffset; + x = window.pageXOffset; + } else { + y = iecompattest().scrollTop; + x = iecompattest().scrollLeft; + } + return [ x, y ]; +} + +function WindowSize () { + var width = 0, height = 0; + if( ns6 || typeof( window.innerWidth ) == 'number' ) { + width = window.innerWidth; + height = window.innerHeight; + } else { + width = iecompattest().clientWidth; + height = iecompattest().clientHeight; + } + return [ width, height ]; +} function ttp_update_pos(){ - document.getElementById('TOOLTIP').style.left = (ttp_offset_x + ttp_x) + "px"; - document.getElementById('TOOLTIP').style.top = (ttp_y + 20) + "px"; + var Size = WindowSize(); + + var x = ttp_x + ttp_offset_x; + var y = ttp_y; + + var ele = document.getElementById('TOOLTIP'); + var scrPos = getScrollingPosition(); + + if(x + 500 > Size[0] + scrPos[0]) { + x = Size[0] - 500; + } + if(y + 150 > Size[1] + scrPos[1]) { + y = Size[1] - (y - 10); + ele.style.top = ''; + if(ie5&&!opera) { + ele.style.removeAttribute('top'); + y += scrPos[1]; + } + ele.style.bottom = y + "px"; + } else { + ele.style.bottom = ''; + if(ie5&&!opera) { + ele.style.removeAttribute('bottom'); + } + ele.style.top = (y + 20) + "px"; + } + ele.style.left = x + "px"; } var ttp_ie = document.all?true:false; @@ -30,21 +90,20 @@ if (ttp_x < 0) {ttp_x = 0;} if (ttp_y < 0) {ttp_y = 0;} if(ttp_visable) { - if(Math.abs(ttp_x_start - ttp_x) > 5 - || Math.abs(ttp_y_start - ttp_y) > 5) { - ttp_make_invisable(this); + if(Math.abs(ttp_x_start - ttp_x) > 15 + || Math.abs(ttp_y_start - ttp_y) > 15) { + ttp_make_invisable(); } ttp_update_pos(); } } - -function ttp_update_content(title, description){ +function ttp_update_content(title, description, style){ var utitle = unescape(title); ttp_content = '<div id="ttwindow"><p class="topic">'; ttp_content += utitle.substr(0,50); if (utitle.length > 50) {ttp_content += '...';} - ttp_content += '</p><p class="description">' + ttp_content += '</p><p class="' + style +'">'; if(description == 'WAIT') { ttp_content += '<img src="images/wait.gif" alt="" />'; } else { @@ -53,44 +112,43 @@ function ttp_update_content(title, description){ ttp_content += '</p></div>'; } -function ttp_make_visable(title, description){ +function ttp_make_visable(title, description, style){ ttp_update_pos(); - document.getElementById('TOOLTIP').style.visibility = "visible"; - ttp_update_content(title, description); - document.getElementById('TOOLTIP').innerHTML = ttp_content; - ttp_visable = 1; + ttp_update_content(title, description, style); + var ele = document.getElementById('TOOLTIP'); + ele.innerHTML = ttp_content; + ele.style.visibility = "visible"; } -function ttp_make_invisable(self){ - clearTimeout(ttp_timer); - ttp_visable = 0; - document.getElementById('TOOLTIP').style.visibility = "hidden"; +function ttp_make_invisable(){ + var ele = document.getElementById('TOOLTIP'); + + if(ttp_visable || ele.style.visibility == "visible") { + clearTimeout(ttp_timer); + ele.style.visibility = "hidden"; + } + ttp_visable = 0; + ttp_inside = 0; } -function ttp(self, title, description, offset_x){ - self.onmouseout=function(){ ttp_make_invisable(this); }; - if(description && ttp_x != -1 && ttp_y != -1){ - ttp_offset_x = offset_x; - ttp_timer = setTimeout("ttp_make_visable('"+escape(title)+"', '"+escape(description)+"')", 750); - } +function ttp_enable(enable){ + ttp_make_invisable(); + ttp_active = enable } function ttp_make_req_visable(title, eventid, x, y){ - if(!eventid || eventid<=0 - || Math.abs(x - ttp_x) > 20 - || Math.abs(y - ttp_y) > 20) { + if(!eventid || eventid<=0 || ttp_inside==0 + || Math.abs(x - ttp_x) > 15 + || Math.abs(y - ttp_y) > 15) { + clearTimeout(ttp_timer); + ttp_inside = 0; return false; } - ttp_update_pos(); - ttp_update_content(title,'WAIT'); - - document.getElementById('TOOLTIP').innerHTML = ttp_content; - document.getElementById('TOOLTIP').style.visibility = "visible"; - ttp_visable = 1; ttp_x_start = ttp_x; ttp_y_start = ttp_y; + ttp_make_visable(title,'WAIT','description'); var fnWhenDone = function (oXML, sData) { @@ -102,11 +160,7 @@ function ttp_make_req_visable(title, eventid, x, y){ content = '...'; } - ttp_update_pos(); - ttp_update_content(title,content); - - document.getElementById('TOOLTIP').innerHTML = ttp_content; - document.getElementById('TOOLTIP').style.visibility = "visible"; + ttp_make_visable(title,content,'description'); }; var url = "?cmd=edescription&data=" + eventid + "&ajax=json"; @@ -117,15 +171,116 @@ function ttp_make_req_visable(title, eventid, x, y){ } - function ttpreq(self, title, eventid, offset_x){ - self.onmouseout=function(){ ttp_make_invisable(this); }; - if(eventid && ttp_x != -1 && ttp_y != -1){ - ttp_offset_x = offset_x; - ttp_timer = setTimeout("ttp_make_req_visable('"+escape(title)+"', '"+eventid+"', '"+ttp_x+"', '"+ttp_y+"')", 750); - } + if(ttp_active) { + self.onmouseout=function(){ ttp_make_invisable(); }; + if(eventid && ttp_x != -1 && ttp_y != -1){ + ttp_offset_x = offset_x; + ttp_inside = 1; + ttp_timer = setTimeout("ttp_make_req_visable('"+escape(title)+"', '"+eventid+"', '"+ttp_x+"', '"+ttp_y+"')", 750); + } + } +} + + +function ttp_make_tlist_visable(title, tlist, x, y){ + + if(!tlist || ttp_inside==0 + || Math.abs(x - ttp_x) > 15 + || Math.abs(y - ttp_y) > 15) { + clearTimeout(ttp_timer); + ttp_inside = 0; + return false; + } + + ttp_x_start = ttp_x; + ttp_y_start = ttp_y; + ttp_make_visable(title,'WAIT','title'); + + var fnWhenDone = function (oAnswer, sData) { + var content = ""; + var values = eval('(' + oAnswer.responseText + ')'); + if(values && values.data && typeof(values.data) == 'object'){ + for (var i = 1; i < values.data.length; i++) { + var x = values.data[i]; + if ((x[1] & 1) == 0) { //Status + content += '<span class="deactive">'; + } + //var d = new Date(x[9] * 1000); + content += x[4]; //Day + content += " - "; + content += x[5]; //Start + content += "-"; + content += x[6]; //Stop + content += " - "; + if (x[2].length > 15) {//Channel + content += x[2].substring(0, 13); + content += '...'; + } else { + content += x[2]; + } + content += " - "; + if (x[7].length > 23) { + content += x[7].substring(0, 21); + content += '...'; + } else { + content += x[7]; //File + } + if ((x[1] & 1) == 0) { //Status + content += "</span>"; + } + content += "<br />"; + } + } else { + content = '...'; + } + + ttp_make_visable(title,content,'title'); + }; + + var url = "?cmd=tlist&data=" + tlist + "&ajax=json"; + var aconn = new XHRequest(); + if(!aconn) + return false; + return aconn.connect(url, fnWhenDone, tlist); } + +function ttptlist(self, title, tlist, offset_x){ + if(ttp_active) { + self.onmouseout=function(){ ttp_make_invisable(); }; + if(tlist && ttp_x != -1 && ttp_y != -1){ + ttp_offset_x = offset_x; + ttp_inside = 1; + ttp_timer = setTimeout("ttp_make_tlist_visable('"+escape(title)+"', '"+tlist+"', '"+ttp_x+"', '"+ttp_y+"')", 750); + } + } +} +function ttp_make_direct_visable(title, description, x, y){ + + if(ttp_inside==0 + || Math.abs(x - ttp_x) > 15 + || Math.abs(y - ttp_y) > 15) { + clearTimeout(ttp_timer); + ttp_inside = 0; + return false; + } + + ttp_x_start = ttp_x; + ttp_y_start = ttp_y; + ttp_make_visable(title,description,'description'); +} + +function ttp(self, title, description, offset_x){ + if(ttp_active) { + self.onmouseout=function(){ ttp_make_invisable(); }; + if(description && ttp_x != -1 && ttp_y != -1){ + ttp_offset_x = offset_x; + ttp_inside = 1; + ttp_timer = setTimeout("ttp_make_direct_visable('"+escape(title)+"', '"+escape(description)+"')", 750); + } + } +} /** XHRequest based on ** ** XHConn - Simple XMLHTTP Interface - bfults@gmail.com - 2005-04-08 ** ** Code licensed under Creative Commons Attribution-ShareAlike License ** diff --git a/skins/stone/alist.tmpl b/skins/stone/alist.tmpl index 93c71f1..0d01822 100644 --- a/skins/stone/alist.tmpl +++ b/skins/stone/alist.tmpl @@ -16,10 +16,11 @@ <!-- active: <?% param.timers.$id.activeTimer.size %?> --> <!-- deactive:<?% param.timers.$id.deactiveTimer.size %?> --> <?% END %?> - <a href="?cmd=tlist&data=<?% param.timers.$id.allTimer.join(',') %?>"> - <img src="images/onoff.<?% global.imagetyp %?>" alt="" title="<?% gettext("Planned recordings") %?>" /> - </a> - <?% END %?> + <a href="?cmd=tlist&data=<?% param.timers.$id.allTimer.join('_') %?>" + onmouseover="ttptlist(this, '<?% gettext("Planned recordings") %?>','<?% param.timers.$id.allTimer.join('_') %?>', -200);" + <img src="images/info.<?% global.imagetyp %?>" alt="" /> + </a> + <?% END %?> <?% END %?> <a href="?cmd=search&data=<?% url( title ) %?>"> <img src="images/find.<?% global.imagetyp %?>" alt="" title="<?% gettext("Search for repeats") %?>" /> diff --git a/skins/stone/tooltip.js b/skins/stone/tooltip.js index f2bc938..a940fd4 100644 --- a/skins/stone/tooltip.js +++ b/skins/stone/tooltip.js @@ -98,12 +98,12 @@ if(ttp_visable) { } } -function ttp_update_content(title, description){ +function ttp_update_content(title, description, style){ var utitle = unescape(title); ttp_content = '<table class="areatable" summary=""><tr><td class="areahead">'; ttp_content += utitle.substr(0,50); if (utitle.length > 50) {ttp_content += '...';} - ttp_content += '</td></tr><tr><td class="areatext"><font class="description">'; + ttp_content += '</td></tr><tr><td class="areatext"><font class="' + style +'">'; if(description == 'WAIT') { ttp_content += '<img src="images/wait.gif" alt="" />'; } else { @@ -112,9 +112,9 @@ function ttp_update_content(title, description){ ttp_content += '</font></td></tr><tr><td class="areabottom"></td></tr></table>'; } -function ttp_make_visable(title, description){ +function ttp_make_visable(title, description, style){ ttp_update_pos(); - ttp_update_content(title, description); + ttp_update_content(title, description, style); var ele = document.getElementById('TOOLTIP'); ele.innerHTML = ttp_content; ele.style.visibility = "visible"; @@ -148,7 +148,7 @@ function ttp_make_req_visable(title, eventid, x, y){ ttp_x_start = ttp_x; ttp_y_start = ttp_y; - ttp_make_visable(title,'WAIT'); + ttp_make_visable(title,'WAIT','description'); var fnWhenDone = function (oXML, sData) { @@ -160,7 +160,7 @@ function ttp_make_req_visable(title, eventid, x, y){ content = '...'; } - ttp_make_visable(title,content); + ttp_make_visable(title,content,'description'); }; var url = "?cmd=edescription&data=" + eventid + "&ajax=json"; @@ -182,6 +182,80 @@ function ttpreq(self, title, eventid, offset_x){ } } + +function ttp_make_tlist_visable(title, tlist, x, y){ + + if(!tlist || ttp_inside==0 + || Math.abs(x - ttp_x) > 15 + || Math.abs(y - ttp_y) > 15) { + clearTimeout(ttp_timer); + ttp_inside = 0; + return false; + } + + ttp_x_start = ttp_x; + ttp_y_start = ttp_y; + ttp_make_visable(title,'WAIT','title'); + + var fnWhenDone = function (oAnswer, sData) { + var content = ""; + var values = eval('(' + oAnswer.responseText + ')'); + if(values && values.data && typeof(values.data) == 'object'){ + for (var i = 1; i < values.data.length; i++) { + var x = values.data[i]; + if ((x[1] & 1) == 0) { //Status + content += '<span class="deactive">'; + } + //var d = new Date(x[9] * 1000); + content += x[4]; //Day + content += " - "; + content += x[5]; //Start + content += "-"; + content += x[6]; //Stop + content += " - "; + if (x[2].length > 15) {//Channel + content += x[2].substring(0, 13); + content += '...'; + } else { + content += x[2]; + } + content += " - "; + if (x[7].length > 23) { + content += x[7].substring(0, 21); + content += '...'; + } else { + content += x[7]; //File + } + if ((x[1] & 1) == 0) { //Status + content += "</span>"; + } + content += "<br />"; + } + } else { + content = '...'; + } + + ttp_make_visable(title,content,'title'); + }; + + var url = "?cmd=tlist&data=" + tlist + "&ajax=json"; + var aconn = new XHRequest(); + if(!aconn) + return false; + return aconn.connect(url, fnWhenDone, tlist); +} + + +function ttptlist(self, title, tlist, offset_x){ + if(ttp_active) { + self.onmouseout=function(){ ttp_make_invisable(); }; + if(tlist && ttp_x != -1 && ttp_y != -1){ + ttp_offset_x = offset_x; + ttp_inside = 1; + ttp_timer = setTimeout("ttp_make_tlist_visable('"+escape(title)+"', '"+tlist+"', '"+ttp_x+"', '"+ttp_y+"')", 750); + } + } +} function ttp_make_direct_visable(title, description, x, y){ if(ttp_inside==0 @@ -194,7 +268,7 @@ function ttp_make_direct_visable(title, description, x, y){ ttp_x_start = ttp_x; ttp_y_start = ttp_y; - ttp_make_visable(title,description); + ttp_make_visable(title,description,'description'); } function ttp(self, title, description, offset_x){ diff --git a/skins/stone_flat/alist.tmpl b/skins/stone_flat/alist.tmpl index dfba26e..e6a509d 100644 --- a/skins/stone_flat/alist.tmpl +++ b/skins/stone_flat/alist.tmpl @@ -16,9 +16,10 @@ <!-- active: <?% param.timers.$id.activeTimer.size %?> --> <!-- deactive:<?% param.timers.$id.deactiveTimer.size %?> --> <?% END %?> - <a href="?cmd=tlist&data=<?% param.timers.$id.allTimer.join(',') %?>"> - <img src="images/onoff.<?% global.imagetyp %?>" alt="" title="<?% gettext("Planned recordings") %?>" /> - </a> + <a href="?cmd=tlist&data=<?% param.timers.$id.allTimer.join(',') %?>" + onmouseover="ttptlist(this, '<?% gettext("Planned recordings") %?>','<?% param.timers.$id.allTimer.join(',') %?>', -350);" + <img src="images/info.<?% global.imagetyp %?>" alt="" /> + </a> <?% END %?> <?% END %?> <a href="?cmd=search&data=<?% url( title ) %?>"> |
