mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 04:29:28 +01:00
Detect Flash player click-to-play mode and inform user how to allow it for copy to clipboard from context menu
- Fix hovering over copy to clipboard brings a wierd small grey box
This commit is contained in:
parent
42413373b5
commit
f3de318e81
@ -16,7 +16,9 @@
|
|||||||
/phpgwapi/js/zeroclipboard/dist/ZeroClipboard.min.js;
|
/phpgwapi/js/zeroclipboard/dist/ZeroClipboard.min.js;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZeroClipboard.config( { swfPath: egw.webserverUrl+"/phpgwapi/js/zeroclipboard/dist/ZeroClipboard.swf" } );
|
/* Set flashLoadTimeout to something close to immediate as we need to inspect error event, right when
|
||||||
|
* we open the context menu in order to detect Flash player's click-to-play mode*/
|
||||||
|
ZeroClipboard.config( { swfPath: egw.webserverUrl+"/phpgwapi/js/zeroclipboard/dist/ZeroClipboard.swf", flashLoadTimeout: 400} );
|
||||||
|
|
||||||
if (typeof window._egwActionClasses == "undefined")
|
if (typeof window._egwActionClasses == "undefined")
|
||||||
window._egwActionClasses = {};
|
window._egwActionClasses = {};
|
||||||
@ -147,7 +149,7 @@ function egwPopupActionImplementation()
|
|||||||
// Stop action from bubbling up to parents
|
// Stop action from bubbling up to parents
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.cancelBubble = true;
|
e.cancelBubble = true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -345,6 +347,36 @@ function egwPopupActionImplementation()
|
|||||||
// Bindings for copy to system clipboard
|
// Bindings for copy to system clipboard
|
||||||
menu.instance.dhtmlxmenu.attachEvent("onShow", function(zoneId,ev) {
|
menu.instance.dhtmlxmenu.attachEvent("onShow", function(zoneId,ev) {
|
||||||
var client = new ZeroClipboard($j('#'+this.idPrefix+'egw_os_clipboard', this.base));
|
var client = new ZeroClipboard($j('#'+this.idPrefix+'egw_os_clipboard', this.base));
|
||||||
|
|
||||||
|
// We need to check if the browser settings for Flash player is set to click-to-play
|
||||||
|
// then prompting user in order to allow or block Flash player
|
||||||
|
jQuery('#global-zeroclipboard-html-bridge').hover(function (){
|
||||||
|
var $zeroClip = jQuery(this);
|
||||||
|
if ($zeroClip.hasClass('flash-deactivated'))
|
||||||
|
{
|
||||||
|
$zeroClip.addClass('flash-click-to-play-dialog');
|
||||||
|
egw.message("In order to copy to clipboard, you need to allow Flash player by clicking on gray box.\nYou can permanently allow Flash player for EGroupware in your browser settings.","info")
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$zeroClip.removeClass('flash-click-to-play-dialog')
|
||||||
|
}
|
||||||
|
});
|
||||||
|
client.on({
|
||||||
|
error:function (e){
|
||||||
|
// Detect if the Flash player is on click-to-play mode or is deactivated
|
||||||
|
if (e.name == "flash-deactivated")
|
||||||
|
{
|
||||||
|
// Indicate both flash-deactivated and click-to-play mode
|
||||||
|
jQuery('#global-zeroclipboard-html-bridge').addClass('flash-deactivated');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
jQuery('#global-zeroclipboard-html-bridge').removeClass('flash-deactivated');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
client.on("copy",function(event) {
|
client.on("copy",function(event) {
|
||||||
event.clipboardData.setData('text/plain', $j(_links.egw_os_clipboard.actionObj.data.target).text().trim());
|
event.clipboardData.setData('text/plain', $j(_links.egw_os_clipboard.actionObj.data.target).text().trim());
|
||||||
event.clipboardData.setData('text/html', $j(_links.egw_os_clipboard.actionObj.data.target).html());
|
event.clipboardData.setData('text/html', $j(_links.egw_os_clipboard.actionObj.data.target).html());
|
||||||
@ -708,7 +740,7 @@ function egwPopupActionImplementation()
|
|||||||
{
|
{
|
||||||
// Create an action to add selected to clipboard
|
// Create an action to add selected to clipboard
|
||||||
clipboard_action = mgr.addAction('popup', 'egw_os_clipboard', egw.lang('Copy to OS clipboard'), egw.image('copy'), function(action) {
|
clipboard_action = mgr.addAction('popup', 'egw_os_clipboard', egw.lang('Copy to OS clipboard'), egw.image('copy'), function(action) {
|
||||||
|
|
||||||
},true);
|
},true);
|
||||||
clipboard_action.group = 2.5;
|
clipboard_action.group = 2.5;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user