mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-02-28 04:36:24 +00:00
Monotone-Parent: 145acd1ad78984a6f26963cc9b6abb3e5c915bcd
Monotone-Revision: d73281348e68338299c1595a484a8a1033de3cd1 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2006-07-17T17:30:42 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -41,23 +41,125 @@ function moveTo(uri) {
|
||||
alert("MoveTo: " + uri);
|
||||
}
|
||||
|
||||
function popupSearchMenu(elem, event, menuName)
|
||||
function popupSearchMenu(event, menuId)
|
||||
{
|
||||
relX = (event.pageX
|
||||
- (elem.parentNode.offsetLeft + elem.offsetLeft));
|
||||
relY = (event.pageY
|
||||
- elem.parentNode.parentNode.parentNode.offsetTop);
|
||||
window.alert(elem.style.height);
|
||||
// if (event.button == 1
|
||||
// &&
|
||||
// acceptClick = false;
|
||||
// bodyOnClick = "" + document.body.getAttribute("onclick");
|
||||
// document.body.setAttribute("onclick", "onBodyClick('" + menuId + "'); return false;");
|
||||
// popup = document.getElementById(menuId);
|
||||
// popup.setAttribute("style", "visibility: visible; top: " + event.pageY
|
||||
// + "px; left: " + event.pageX + "px;" );
|
||||
// menuClickNode = node;
|
||||
// window.alert
|
||||
var node = event.target;
|
||||
|
||||
return false;
|
||||
superNode = node.parentNode.parentNode.parentNode;
|
||||
relX = (event.pageX - superNode.offsetLeft - node.offsetLeft);
|
||||
relY = (event.pageY - superNode.offsetTop - node.offsetTop);
|
||||
|
||||
if (event.button == 0
|
||||
&& relX < 24) {
|
||||
log('popup');
|
||||
event.cancelBubble = true;
|
||||
event.returnValue = false;
|
||||
|
||||
var popup = document.getElementById(menuId);
|
||||
hideMenu(popup);
|
||||
|
||||
var menuTop = superNode.offsetTop + node.offsetTop + node.offsetHeight;
|
||||
var menuLeft = superNode.offsetLeft + node.offsetLeft;
|
||||
var heightDiff = (window.innerHeight
|
||||
- (menuTop + popup.offsetHeight));
|
||||
if (heightDiff < 0)
|
||||
menuTop += heightDiff;
|
||||
|
||||
var leftDiff = (window.innerWidth
|
||||
- (menuLeft + popup.offsetWidth));
|
||||
if (leftDiff < 0)
|
||||
menuLeft -= popup.offsetWidth;
|
||||
|
||||
popup.style.top = menuTop + "px";
|
||||
popup.style.left = menuLeft + "px";
|
||||
popup.style.visibility = "visible";
|
||||
menuClickNode = node;
|
||||
|
||||
bodyOnClick = "" + document.body.getAttribute("onclick");
|
||||
document.body.setAttribute("onclick", "onBodyClick('" + menuId + "');");
|
||||
}
|
||||
}
|
||||
|
||||
function setSearchCriteria(event)
|
||||
{
|
||||
searchField = document.getElementById('searchValue');
|
||||
searchCriteria = document.getElementById('searchCriteria');
|
||||
|
||||
node = event.target;
|
||||
searchField.setAttribute("ghost-phrase", node.innerHTML);
|
||||
searchCriteria = node.getAttribute('id');
|
||||
}
|
||||
|
||||
function onSearchChange()
|
||||
{
|
||||
log('onSearchChange');
|
||||
}
|
||||
|
||||
function onSearchMouseDown(event)
|
||||
{
|
||||
log('onSearchMouseDown');
|
||||
|
||||
searchField = document.getElementById('searchValue');
|
||||
superNode = searchField.parentNode.parentNode.parentNode;
|
||||
relX = (event.pageX - superNode.offsetLeft - searchField.offsetLeft);
|
||||
relY = (event.pageY - superNode.offsetTop - searchField.offsetTop);
|
||||
|
||||
if (relY < 24) {
|
||||
log('menu');
|
||||
event.cancelBubble = true;
|
||||
event.returnValue = false;
|
||||
}
|
||||
}
|
||||
|
||||
function onSearchFocus(event)
|
||||
{
|
||||
log('onSearchFocus');
|
||||
searchField = document.getElementById('searchValue');
|
||||
ghostPhrase = searchField.getAttribute("ghost-phrase");
|
||||
if (searchField.value == ghostPhrase) {
|
||||
searchField.value = "";
|
||||
searchField.setAttribute("modified", "");
|
||||
} else {
|
||||
searchField.select();
|
||||
}
|
||||
|
||||
searchField.style.color = "#000";
|
||||
}
|
||||
|
||||
function onSearchBlur()
|
||||
{
|
||||
log('onSearchBlur');
|
||||
var searchField = document.getElementById('searchValue');
|
||||
var ghostPhrase = searchField.getAttribute("ghost-phrase");
|
||||
|
||||
if (searchField.value == "") {
|
||||
searchField.setAttribute("modified", "");
|
||||
searchField.style.color = "#aaa";
|
||||
searchField.value = ghostPhrase;
|
||||
} else if (searchField.value == ghostPhrase) {
|
||||
searchField.setAttribute("modified", "");
|
||||
searchField.style.color = "#aaa";
|
||||
} else {
|
||||
searchField.setAttribute("modified", "yes");
|
||||
searchField.style.color = "#000";
|
||||
}
|
||||
}
|
||||
|
||||
function initCriteria()
|
||||
{
|
||||
var searchCriteria = document.getElementById('searchCriteria');
|
||||
var searchField = document.getElementById('searchValue');
|
||||
var firstOption;
|
||||
|
||||
if (searchCriteria.value == ''
|
||||
|| searchField.value == '') {
|
||||
firstOption = document.getElementById('searchOptions').childNodes[1];
|
||||
searchCriteria.value = firstOption.getAttribute('id');
|
||||
searchField.value = firstOption.innerHTML;
|
||||
searchField.setAttribute('ghost-phrase', firstOption.innerHTML);
|
||||
searchField.setAttribute("modified", "");
|
||||
searchField.style.color = "#aaa";
|
||||
|
||||
log(searchField.value);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user