mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-26 18:03:39 +01:00
Executing default action on click on mobile devices
This commit is contained in:
parent
a4730b3511
commit
0d66fcd9d1
@ -375,6 +375,25 @@ egwFnct.prototype.exec = function()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether this is currently run on a mobile browser
|
||||||
|
*/
|
||||||
|
var _egw_mobileBrowser = null;
|
||||||
|
|
||||||
|
function egwIsMobile() {
|
||||||
|
|
||||||
|
if (_egw_mobileBrowser == null)
|
||||||
|
{
|
||||||
|
var ua = navigator.userAgent;
|
||||||
|
|
||||||
|
_egw_mobileBrowser =
|
||||||
|
ua.match(/iPhone/i) || ua.match(/iPad/i) || ua.match(/iPod/) ||
|
||||||
|
ua.match(/Android/i) || ua.match(/SymbianOS/i);
|
||||||
|
}
|
||||||
|
|
||||||
|
return _egw_mobileBrowser;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
sprintf() for JavaScript 0.6
|
sprintf() for JavaScript 0.6
|
||||||
|
@ -19,7 +19,6 @@ _egwActionClasses["popup"] = {
|
|||||||
function egwPopupAction(_id, _handler, _caption, _icon, _onExecute, _allowOnMultiple)
|
function egwPopupAction(_id, _handler, _caption, _icon, _onExecute, _allowOnMultiple)
|
||||||
{
|
{
|
||||||
var action = new egwAction(_id, _handler, _caption, _icon, _onExecute, _allowOnMultiple);
|
var action = new egwAction(_id, _handler, _caption, _icon, _onExecute, _allowOnMultiple);
|
||||||
|
|
||||||
action.type = "popup";
|
action.type = "popup";
|
||||||
action.canHaveChildren = ["popup"];
|
action.canHaveChildren = ["popup"];
|
||||||
action["default"] = false;
|
action["default"] = false;
|
||||||
@ -82,13 +81,11 @@ function egwPopupActionImplementation()
|
|||||||
|
|
||||||
ai.type = "popup";
|
ai.type = "popup";
|
||||||
|
|
||||||
ai.doRegisterAction = function(_aoi, _callback, _context)
|
/**
|
||||||
{
|
* Registers the handler for the default action
|
||||||
var node = _aoi.getDOMNode();
|
*/
|
||||||
|
ai._registerDefault = function(_node, _callback, _context) {
|
||||||
if (node)
|
var defaultHandler = function(e) {
|
||||||
{
|
|
||||||
node.ondblclick = function(e) {
|
|
||||||
if (typeof document.selection != "undefined" && typeof document.selection.empty != "undefined")
|
if (typeof document.selection != "undefined" && typeof document.selection.empty != "undefined")
|
||||||
{
|
{
|
||||||
document.selection.empty();
|
document.selection.empty();
|
||||||
@ -104,7 +101,18 @@ function egwPopupActionImplementation()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
node.oncontextmenu = function(e) {
|
if (egwIsMobile()) {
|
||||||
|
$(_node).bind('click', defaultHandler);
|
||||||
|
} else {
|
||||||
|
_node.dblclick = defaultHandler;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers the handler for the context menu
|
||||||
|
*/
|
||||||
|
ai._registerContext = function(_node, _callback, _context) {
|
||||||
|
var contextHandler = function(e) {
|
||||||
//Obtain the event object
|
//Obtain the event object
|
||||||
if (!e)
|
if (!e)
|
||||||
{
|
{
|
||||||
@ -129,6 +137,21 @@ function egwPopupActionImplementation()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (egwIsMobile()) {
|
||||||
|
$(_node).bind('taphold', contextHandler);
|
||||||
|
} else {
|
||||||
|
_node.oncontextmenu = contextHandler;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ai.doRegisterAction = function(_aoi, _callback, _context)
|
||||||
|
{
|
||||||
|
var node = _aoi.getDOMNode();
|
||||||
|
|
||||||
|
if (node)
|
||||||
|
{
|
||||||
|
this._registerDefault(node, _callback, _context);
|
||||||
|
this._registerContext(node, _callback, _context);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user