From: Art Cancro Date: Thu, 8 Jul 2010 04:41:12 +0000 (+0000) Subject: * Bubble tooltips were not working properly in some browsers. Removed all JavaScript... X-Git-Tag: v7.86~114 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=13473e686921141b9334a90ab17f8d452ea95a74 * Bubble tooltips were not working properly in some browsers. Removed all JavaScript and replaced with one driven purely by CSS. --- diff --git a/webcit/README.txt b/webcit/README.txt index ba8563e35..a31452402 100644 --- a/webcit/README.txt +++ b/webcit/README.txt @@ -206,9 +206,7 @@ further customization. ---------------- WebCit contains support for calendaring and scheduling. In order to use it -you must have libical v0.26 (or newer) on your system. You must also be -running a Citadel server with calendaring support. The calendar service will -be automatically configured and installed if your host system supports it. +you must have libical v0.26 (or newer) on your system. WebCit also provides iCalendar format free/busy data for calendar clients. Unlike with some other servers, there is no need for each user to "publish" diff --git a/webcit/calendar_view.c b/webcit/calendar_view.c index a60697a62..5f7de0d9e 100644 --- a/webcit/calendar_view.c +++ b/webcit/calendar_view.c @@ -274,14 +274,19 @@ void calendar_month_view_display_events(int year, int month, int day) ); } + wc_printf("" "" + , (Cal->unread)?"_unread":"_read", Cal->cal_msgnum, year, month, day - ); + ); + + escputs((char *) icalproperty_get_comment(p)); + + wc_printf(""); wc_printf("%s: %s
", _("From"), Cal->from); wc_printf("%s ", _("Summary:")); @@ -377,9 +382,7 @@ void calendar_month_view_display_events(int year, int month, int day) wc_printf("
"); } - wc_printf("\">"); - escputs((char *) - icalproperty_get_comment(p)); + wc_printf("
"); wc_printf("

\n"); if (all_day_event) { @@ -663,21 +666,6 @@ void calendar_month_view(int year, int month, int day) { wc_printf("" /* end of inner table */ "" /* end of outer table */ "\n"); - - /* - * Initialize the bubble tooltips. - * - * Yes, this is as stupid as it looks. Instead of just making the call - * to btt_enableTooltips() straight away, we have to create a timer event - * and let it initialize as an event after 1 millisecond. This is to - * work around a bug in Internet Explorer that causes it to crash if we - * manipulate the innerHTML of various DOM nodes while the page is still - * being rendered. See http://www.shaftek.org/blog/archives/000212.html - * for more information. - */ - StrBufAppendPrintf(WC->trailing_javascript, - " setTimeout(\"btt_enableTooltips('inner_month')\", 1); \n" - ); } /* @@ -959,10 +947,13 @@ void calendar_day_view_display_events(time_t thetime, wc_printf("
  • " "" + , (Cal->unread)?"_unread":"_read", - Cal->cal_msgnum, year, month, day); + Cal->cal_msgnum, year, month, day + ); + escputs((char *) icalproperty_get_comment(p)); + wc_printf(""); wc_printf("%s
    ", _("All day event")); wc_printf("%s: %s
    ", _("From"), Cal->from); wc_printf("%s ", _("Summary:")); @@ -990,8 +981,7 @@ void calendar_day_view_display_events(time_t thetime, escputs((char *)icalproperty_get_comment(q)); wc_printf("
    "); } - wc_printf("\">"); - escputs((char *) icalproperty_get_comment(p)); + wc_printf("
    "); wc_printf("
    ("); wc_printf(_("All day event")); wc_printf(")
  • \n"); @@ -1001,10 +991,13 @@ void calendar_day_view_display_events(time_t thetime, wc_printf("
  • " "" + , (Cal->unread)?"_unread":"_read", - Cal->cal_msgnum, year, month, day); + Cal->cal_msgnum, year, month, day + ); + escputs((char *) icalproperty_get_comment(p)); + wc_printf(""); wc_printf("%s
    ", _("Ongoing event")); wc_printf("%s: %s
    ", _("From"), Cal->from); wc_printf("%s ", _("Summary:")); @@ -1026,8 +1019,7 @@ void calendar_day_view_display_events(time_t thetime, escputs((char *)icalproperty_get_comment(q)); wc_printf("
    "); } - wc_printf("\">"); - escputs((char *) icalproperty_get_comment(p)); + wc_printf("
    "); wc_printf("
    ("); wc_printf(_("Ongoing event")); wc_printf(")
  • \n"); @@ -1082,9 +1074,12 @@ void calendar_day_view_display_events(time_t thetime, ); wc_printf("cal_msgnum, year, month, day, t.hour); + "class=\"event_title\">" + , + Cal->cal_msgnum, year, month, day, t.hour + ); + escputs((char *) icalproperty_get_comment(p)); + wc_printf(""); wc_printf("%s: %s
    ", _("From"), Cal->from); wc_printf("%s ", _("Summary:")); escputs((char *) icalproperty_get_comment(p)); @@ -1111,9 +1106,7 @@ void calendar_day_view_display_events(time_t thetime, escputs((char *)icalproperty_get_comment(q)); wc_printf("
    "); } - wc_printf("\">"); - - escputs((char *) icalproperty_get_comment(p)); + wc_printf("
    "); wc_printf("
    \n"); } } @@ -1342,10 +1335,6 @@ void calendar_day_view(int year, int month, int day) { wc_printf("" /* end of inner table */ ""); - - StrBufAppendPrintf(WC->trailing_javascript, - " setTimeout(\"btt_enableTooltips('inner_day')\", 1); \n" - ); } diff --git a/webcit/static/BubbleTooltips.js b/webcit/static/BubbleTooltips.js deleted file mode 100644 index 19ec98023..000000000 --- a/webcit/static/BubbleTooltips.js +++ /dev/null @@ -1,115 +0,0 @@ -/* - * JavaScript code to create "bubble tooltips" - * - * Copyright (C) 2006 Alessandro Fulciniti [http://web-graphics.com] - * Copyright (C) 2006 Art Cancro [http://www.citadel.org] - * - * The original version of this module was released into the public - * domain. This version is distributed as part of the Citadel system - * under the terms of the GNU General Public License v3. - * - */ - -function btt_enableTooltips(id) -{ - var links, i, h; - if (!document.getElementById || !document.getElementsByTagName) { - return; - } - h = document.createElement("span"); - h.id = "btc"; - h.setAttribute("id", "btc"); - h.style.position = "absolute"; - document.getElementsByTagName("body")[0].appendChild(h); - if (id == null) { - links = document.getElementsByTagName("a"); - } - else { - links = document.getElementById(id).getElementsByTagName("a"); - } - for (i = 0; i < links.length; i++) { - btt_Prepare(links[i]); - } -} - -function btt_Prepare(el) -{ - var tooltip, b, s, l, ih; - ih = el.getAttribute("btt_tooltext"); - if (!ih) { - return; - } - el.removeAttribute("btt_tooltext"); - el.removeAttribute("title"); - tooltip = btt_CreateEl("span", "tooltip"); - s = btt_CreateEl("span", "top"); - s.appendChild(document.createTextNode("")); - s.innerHTML = ih; - tooltip.appendChild(s); - b = btt_CreateEl("b", "bottom"); - tooltip.appendChild(b); - btt_setOpacity(tooltip); - el.tooltip = tooltip; - el.onmouseover = btt_showTooltip; - el.onmouseout = btt_hideTooltip; - el.onmousemove = btt_Locate; -} - -function btt_showTooltip(e) -{ - document.getElementById("btc").appendChild(this.tooltip); - btt_Locate(e); -} - -function btt_hideTooltip(e) -{ - var d = document.getElementById("btc"); - if (d.childNodes.length > 0) { - d.removeChild(d.firstChild); - } -} - -function btt_setOpacity(el) -{ - el.style.filter = "alpha(opacity:95)"; - el.style.KHTMLOpacity = "0.95"; - el.style.MozOpacity = "0.95"; - el.style.opacity = "0.95"; -} - -function btt_CreateEl(t, c) -{ - var x = document.createElement(t); - x.className = c; - x.style.display = "block"; - return (x); -} - -function btt_Locate(e) -{ - var posx = 0, posy = 0; - if (e == null) { - e = window.event; - } - if (e.pageX || e.pageY) { - posx = e.pageX; - posy = e.pageY; - } - - else if (e.clientX || e.clientY) { - if (document.documentElement.scrollTop) { - posx = - e.clientX + - document.documentElement.scrollLeft; - posy = - e.clientY + document.documentElement.scrollTop; - } - - else { - posx = e.clientX + document.body.scrollLeft; - posy = e.clientY + document.body.scrollTop; - } - } - document.getElementById("btc").style.top = (posy + 10) + "px"; - document.getElementById("btc").style.left = (posx - 260) + "px"; -} diff --git a/webcit/static/bt.css b/webcit/static/bt.css deleted file mode 100644 index 74b30a19a..000000000 --- a/webcit/static/bt.css +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2005 - 2009 The Citadel Team - * Licensed under the GPL V3 - */ -.tooltip { - width: 300px; - color: #000; - font:lighter 11px/1.3 sans-serif; - text-decoration: none; - text-align: left; -} - -.tooltip span.top { - padding: 30px 8px 0; - background: url(bt.gif) no-repeat top -} - -.tooltip b.bottom { - padding:3px 8px 15px; - color: #548912; - background: url(bt.gif) no-repeat bottom -} diff --git a/webcit/static/bt.gif b/webcit/static/bt.gif deleted file mode 100644 index 6670c482f..000000000 Binary files a/webcit/static/bt.gif and /dev/null differ diff --git a/webcit/static/bubble.gif b/webcit/static/bubble.gif new file mode 100644 index 000000000..93adba3e2 Binary files /dev/null and b/webcit/static/bubble.gif differ diff --git a/webcit/static/bubble_filler.gif b/webcit/static/bubble_filler.gif new file mode 100644 index 000000000..49c9a6b6b Binary files /dev/null and b/webcit/static/bubble_filler.gif differ diff --git a/webcit/static/t/head.html b/webcit/static/t/head.html index fbdcbbb7d..37caceb1c 100644 --- a/webcit/static/t/head.html +++ b/webcit/static/t/head.html @@ -8,7 +8,6 @@ - @@ -20,7 +19,6 @@ - diff --git a/webcit/static/webcit.css b/webcit/static/webcit.css index d71112296..b3699d786 100644 --- a/webcit/static/webcit.css +++ b/webcit/static/webcit.css @@ -1735,3 +1735,57 @@ li.event_unread span, a.event_read_title { .chat_text_class { } + +/*---------- bubble tooltips start -----------*/ + +a.event_title, a.event_unread, a.event_read { + position:relative; + z-index:24; +} + +a.event_title span, a.event_unread span, a.event_read span { + display: none; +} + +/* background:; ie hack, something must be changed in a for ie to execute it */ + +a.event_title:hover, a.event_unread:hover, a.event_read:hover { + z-index:25; + background:; +} + +a.event_title:hover span.tooltip, a.event_unread:hover span.tooltip, a.event_read:hover span.tooltip { + display:block; + position:absolute; + top:0px; left:0; + padding: 15px 0 0 0; + width:200px; + text-align: center; + filter: alpha(opacity:90); + KHTMLOpacity: 0.90; + MozOpacity: 0.90; + opacity: 0.90; +} + +a.event_title:hover span.btttop, a.event_unread:hover span.btttop, a.event_read:hover span.btttop { + display: block; + padding: 30px 8px 0; + background: url(/static/bubble.gif) no-repeat top; +} + +/* different middle bg for stretch */ +a.event_title:hover span.bttmiddle, a.event_unread:hover span.bttmiddle, a.event_read:hover span.bttmiddle { + display: block; + padding: 0 8px; + background: url(/static/bubble_filler.gif) repeat bottom; + color: #022750; + font-size: 10px; +} + +a.event_title:hover span.bttbottom, a.event_unread:hover span.bttbottom, a.event_read:hover span.bttbottom { + display: block; + padding:3px 8px 10px; + background: url(/static/bubble.gif) no-repeat bottom; +} + +/*---------- bubble tooltips end -----------*/