diff options
author | Andrew Dolgov <[email protected]> | 2009-01-20 18:46:21 +0100 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2009-01-20 18:46:21 +0100 |
commit | bf3c98384d5de2f319ef19f934fc324eb33f399a (patch) | |
tree | 2a0d0d9801d68b3f12e06b7acc0ca6ff333cf385 | |
parent | 3381c755bef4358750dcbd90986747e37c632651 (diff) |
rework subtoolbar actions dropdown
-rw-r--r-- | feedlist.js | 19 | ||||
-rw-r--r-- | functions.php | 91 | ||||
-rw-r--r-- | images/down_arrow.png | bin | 208 -> 135 bytes | |||
-rw-r--r-- | tt-rss.css | 36 | ||||
-rw-r--r-- | viewfeed.js | 19 |
5 files changed, 128 insertions, 37 deletions
diff --git a/feedlist.js b/feedlist.js index 68c93e4c5..177f057cd 100644 --- a/feedlist.js +++ b/feedlist.js @@ -8,6 +8,7 @@ var mouse_y = 0; var mouse_x = 0; var resize_enabled = false; +var selection_disabled = false; var counters_last_request = 0; function toggle_sortable_feedlist(enabled) { @@ -552,6 +553,10 @@ function mouse_move_handler(e) { } } +function enable_selection(b) { + disable_selection = !b; +} + function enable_resize(b) { resize_enabled = b; } @@ -569,6 +574,12 @@ function mouse_down_handler(e) { document.onselectstart = function() { return false; }; return false; } + + if (selection_disabled) { + document.onselectstart = function() { return false; }; + return false; + } + } catch (e) { exception_error("mouse_move_handler", e); } @@ -577,7 +588,13 @@ function mouse_down_handler(e) { function mouse_up_handler(e) { try { mouse_is_down = false; - document.onselectstart = null; + + if (!disable_selection) { + document.onselectstart = null; + var e = document.getElementById("headlineActionsBody"); + if (e) Element.hide(e); + } + } catch (e) { exception_error("mouse_move_handler", e); } diff --git a/functions.php b/functions.php index 50374dc1d..be793c49a 100644 --- a/functions.php +++ b/functions.php @@ -3978,10 +3978,10 @@ } - if (strpos($_SESSION["client.userAgent"], "MSIE") === false) { + print "<td class=\"headlineActions$rtl_cpart\">"; - print "<td class=\"headlineActions$rtl_cpart\"> - <ul class=\"headlineDropdownMenu\"> + +/* print"<ul class=\"headlineDropdownMenu\"> <li class=\"top2\"> ".__('Select:')." <a href=\"$sel_all_link\">".__('All')."</a>, @@ -3998,18 +3998,6 @@ <li><span class=\"insensitive\">".__('Mark as read:')."</span></li> <li onclick=\"$catchup_sel_link\"> ".__('Selection')."</li>"; -/* if (!get_pref($link, 'COMBINED_DISPLAY_MODE')) { - - print " - <li onclick=\"catchupRelativeToArticle(0)\"> ".__("Above active article")."</li> - <li onclick=\"catchupRelativeToArticle(1)\"> ".__("Below active article")."</li>"; - } else { - print " - <li><span class=\"insensitive\"> ".__("Above active article")."</span></li> - <li><span class=\"insensitive\"> ".__("Below active article")."</span></li>"; - - } */ - print "<li onclick=\"$catchup_feed_link\"> ".__('Entire feed')."</li>"; //print "<li><span class=\"insensitive\">--------</span></li>"; @@ -4032,29 +4020,60 @@ } } - print "</ul></li></ul>"; - print "</td>"; - - } else { - // old style subtoolbar: - - print "<td class=\"headlineActions$rtl_cpart\">". - __('Select:')." - <a href=\"$sel_all_link\">".__('All')."</a>, - <a href=\"$sel_unread_link\">".__('Unread')."</a>, - <a href=\"$sel_none_link\">".__('None')."</a> - ". - __('Toggle:')." <a href=\"$tog_unread_link\">".__('Unread')."</a>, - <a href=\"$tog_marked_link\">".__('Starred')."</a> - ". - __('Mark as read:')." - <a href=\"#\" onclick=\"$catchup_page_link\">".__('Page')."</a>, - <a href=\"#\" onclick=\"$catchup_feed_link\">".__('Feed')."</a>"; - - print "</td>"; - + print "</ul></li></ul>"; */ + + print __('Select:')." + <a href=\"$sel_all_link\">".__('All')."</a>, + <a href=\"$sel_unread_link\">".__('Unread')."</a>, + <a href=\"$sel_inv_link\">".__('Invert')."</a>, + <a href=\"$sel_none_link\">".__('None')."</a></li>"; + + print " "; + + print "<span + onmouseover=\"enable_selection(false)\" + onmouseout=\"enable_selection(true)\" + onclick=\"toggleHeadlineActions()\" id=\"headlineActionsDrop\">". + __("Actions...") . " <img src=\"images/down_arrow.png\"> + </span>"; + + print "<ul id=\"headlineActionsBody\" style=\"display : none\">"; + + print "<li><span class=\"insensitive\">".__('Selection toggle:')."</span></li> + <li onclick=\"$tog_unread_link\"> ".__('Unread')."</li> + <li onclick=\"$tog_marked_link\"> ".__('Starred')."</li> + <li onclick=\"$tog_published_link\"> ".__('Published')."</li> + <!-- <li><span class=\"insensitive\">--------</span></li> --> + <li><span class=\"insensitive\">".__('Mark as read:')."</span></li> + <li onclick=\"$catchup_sel_link\"> ".__('Selection')."</li>"; + + print "<li onclick=\"$catchup_feed_link\"> ".__('Entire feed'). + "</li>"; + + //print "<li><span class=\"insensitive\">--------</span></li>"; + print "<li><span class=\"insensitive\">".__('Assign label:')."</span></li>"; + + $result = db_query($link, "SELECT id, caption FROM ttrss_labels2 WHERE + owner_uid = '".$_SESSION["uid"]."' ORDER BY caption"); + + while ($line = db_fetch_assoc($result)) { + + $label_id = $line["id"]; + $label_caption = $line["caption"]; + + if ($feed_id < -10 && $feed_id == -11-$label_id) { + print "<li onclick=\"javascript:selectionRemoveLabel($label_id)\"> + $label_caption ".__('(remove)')."</li>"; + } else { + print "<li onclick=\"javascript:selectionAssignLabel($label_id)\"> + $label_caption</li>"; + } } + print "</ul>"; + + print "</td>"; + print "<td class=\"headlineTitle$rtl_cpart\">"; print "<span id=\"subtoolbar_search\" diff --git a/images/down_arrow.png b/images/down_arrow.png Binary files differindex c2a8c2787..ded833282 100644 --- a/images/down_arrow.png +++ b/images/down_arrow.png diff --git a/tt-rss.css b/tt-rss.css index fe8f11a28..48db0f9a6 100644 --- a/tt-rss.css +++ b/tt-rss.css @@ -2130,3 +2130,39 @@ pre, code { font-size : 12px; font-family : monospace; } + +span#headlineActionsDrop { + border : 1px solid #c0c0c0; + padding : 1px 5px 1px 10px; + color : #063064; + cursor : pointer; +} + +ul#headlineActionsBody { + list-style-type : none; + position : absolute; + margin : 0px; + padding : 0px; + background-color : white; + width : 150px; + z-index : 4; + top : auto; + left : auto; + border-width : 1px 1px 1px 1px; + border-color : #c0c0c0; + border-style : solid; + margin-left : -1px; + max-height : 250px; + overflow : auto; +} + +ul#headlineActionsBody li { + padding : 2px 5px 2px 10px; + color : black; +} + +ul#headlineActionsBody li:hover { + color : #4684ff; + cursor : pointer; + background : #ecf4ff; +} diff --git a/viewfeed.js b/viewfeed.js index e5f1f8aeb..de7f26812 100644 --- a/viewfeed.js +++ b/viewfeed.js @@ -2038,3 +2038,22 @@ function show_labels_in_headlines(transport) { } } + +function toggleHeadlineActions() { + try { + var e = document.getElementById("headlineActionsBody"); + var p = document.getElementById("headlineActionsDrop"); + + if (!Element.visible(e)) { + Element.show(e); + } else { + Element.hide(e); + } + + e.style.left = (p.offsetLeft + 1) + "px"; +// e.style.top = (p.offsetTop + p.offsetHeight - 1) + "px"; + + } catch (e) { + exception_error("toggleHeadlineActions", e); + } +} |