Primefaces p:overlayPanel show on right click, prevent browser contextMenu? - jsf

<p:overlayPanel showEvent="contextmenu" ..>
I like to show the overlay on right click. The browser also shows its context menu.
Is there a way to prevent browser showing its context menu?
Thanks.

You can write a javaScript function to disable browser contextMenu. Something like this
<script type="text/javascript">
document.oncontextmenu=function(){return false};
</script>
For your information, This technique will fail if the user disables JavaScript.

Related

How can I get rid of the call to action button on my Weebly site?

I can't find any way to get rid of the call to action button on my landing page layout in Weebly. Is it possible to get rid of this button?
You need to perform two steps.
Remove the button from the desktop layout.
Open the layout file in HTML edit mode.
Remove the following line:
<div class="button-wrap">{action:button global="false"}</div>
Remove the button from the mobile layout.
Add the following script to the Header Code of the page:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js">
</script>
<script language='javascript'>
$(document).ready(function(){
$('.landing-container').remove();
});
</script>
You can see it in action on this site for gluten free products.

Page action to open new page

Can I use a page action to directly open a new page? I have a link in my popup.html, but it would be better to have the page open when they click the icon so that they would only need one click instead of two.
<!doctype html>
<html>
<head>
<title>Popup</title>
<link href="popup.css" rel="stylesheet" type="text/css">
</head>
<body>
click here
</body>
</html>
Yes, a way to achieve this would be as follows:
chrome.pageAction.onClicked.addListener(function(tab){
chrome.tabs.create({url: "http://www.domain.com/details.html", "active":true});
});
See Chrome Page Action | onClicked
Note that you will need to declare the tabs permission in your manifest file:
"permissions": ["tabs",...],
I don't think there is any elegant way to handle both the situations on page action click:
Open popup
Open a new page
If you always want to open a new tab with some URL whenever page action is clicked, just remove the popup. And use the code just like #Flo has mentioned.
chrome.pageAction.onClicked.addListener(function(tab) {
chrome.tabs.create({url: "http://www.example.com", "active":true});
});
PS: To remove the popup, there are two options:
Remove the popup from manifest.json
Pragmatically like chrome.pageAction.setPopup('')

The radio and checkbox buttons are not getting rendered in a Spotify app.

I'm trying to use HTML radio buttons in my Spotify app.
When the Inspector tool is used, the code for radio button is present there, but the radio button is not getting rendered in the browser inside the Spotify client. I am also getting the same result for the checkbox.
The same code is used with normal browsers like IE, Mozilla, or Chrome and the radio button gets rendered without any trouble.
Can anybody tell me why the radio button is not getting rendered in the sandboxed browser inside the Spotify client?
Thanks,
When looking at the radio button in the inspector, you can see that the input tag is getting the -webkit-appearance:none attribute set in the sp://import/css/shared.css and sp://import/css/reset.css files.
button, input, textarea {
-webkit-appearance: none;
font-family: inherit;
font-size: 12px;
}
The sp://import/css/adam.css and sp://import/css/eve.css files import the sp://import/css/shared.css file, which is how you are probably getting that attribute. The behavior only exists for the radio and checkbox types because the other input types are overridden elsewhere.
Tip: If you view the css attributes in the inspector, you can actually check them to remove or re-add the style.
Solution:
<input type="radio" style="-webkit-appearance:radio" />
<input type="checkbox" style="-webkit-appearance:checkbox" />
Be warned: It may have been the intention of the developers to not show radio/checkbox buttons, so your app may have approval issues because of the UI guidelines.
Regards,
Kevin
This post says it's a bug:
Spotify - Using Checkbox UI elements
(didn't check on spotify api doc tought...)

Dojo layout rendering problem

Press F5 in this example: DojoToolkit.
First the content is shown, and after that the layout gets into it's final state. In my application I want the opposite, so that the layout gets rendered, and after that the content is displayed. I don't want that 'jumping' phenomenon when loading. Is it possible to fix this somehow?
No, I don't think that there is such an option. Anyway, you could use a container div (with all the dojo layout elements in it) with initial state visbility:hidden, and after the page is loaded and parsed change it's visibility to "visible".
<div id="container" style="visibility:hidden">
<!-- dijit widgets inside the "container"-->
</div>
<script type="text/javascript">
dojo.ready(function(){
dojo.style("container:, "visibility", "visible");
});
</script>

changing the content of browser in XULRunner

I have an Xulrunner app that loads fullscreen without any controls and loads a html page by default. The only thing it has is browser element and a popup menu visible on right click.
In the popup menu there is option to quit. Then there is a menu entry 'theme2'. I want the browser to load another html when theme2 is clicked.
This is my main.xul, thats loaded by default:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window id="main" title="Edusoft" hidechrome="true" sizemode="maximized" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript">
function do()
{
var browser1 = document.getElementById('browser');
browser1.loadURI("chrome://myapp/content/theme2/home.html");
}
</script>
<browser id="browser" type="content" src="chrome://myapp/content/theme1/index.html" flex="1" context="clipmenu"/>
<popupset>
<menupopup id="clipmenu">
<menuitem label="About Us"/>
<menuseparator/>
<menuitem label="Theme2" oncommand="do();"/>
<menuseparator/>
<menuitem label="Exit" oncommand="close();"/>
</menupopup>
</popupset>
</window>
I tried this, but when the page is loaded this way.. the popup menu is nomore in the new page.
window.location.assign()
There is something like loaduri(), but i have no idea on how to use it.
Ok I figured it out.
document.getElementById('browser').loadURI('chrome://myapp/content/flash/demo.htm')

Resources