Skip to content

Commit

Permalink
Fixing Issue #88 - Creating contextMenu on DOM Element
Browse files Browse the repository at this point in the history
(removed obsolete Firefox 12 hack in the process)
  • Loading branch information
rodneyrehm committed Nov 13, 2012
1 parent 1326fb7 commit 5ccc2e3
Show file tree
Hide file tree
Showing 23 changed files with 222 additions and 52 deletions.
1 change: 1 addition & 0 deletions demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ <h3 id="html">Example HTML: Simple Context Menu</h3>
<h2>jQuery Context Menu Demo Gallery</h2>
<ul id="demo-list">
<li class="current"><a href="demo.html">Simple Context Menu</a></li>
<li><a href="demo/on-dom-element.html">Context Menu on DOM Element</a></li>
<li><a href="demo/dynamic.html">Adding new Context Menu Triggers</a></li>
<li><a href="demo/dynamic-create.html">Create Context Menu on demand</a></li>
<li><a href="demo/async-create.html">Create Context Menu (asynchronous)</a></li>
Expand Down
1 change: 1 addition & 0 deletions demo/accesskeys.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ <h3 id="html">Example HTML: Accesskeys</h3>
<h2>jQuery Context Menu Demo Gallery</h2>
<ul id="demo-list">
<li><a href="../demo.html">Simple Context Menu</a></li>
<li><a href="on-dom-element.html">Context Menu on DOM Element</a></li>
<li><a href="dynamic.html">Adding new Context Menu Triggers</a></li>
<li><a href="dynamic-create.html">Create Context Menu on demand</a></li>
<li><a href="async-create.html">Create Context Menu (asynchronous)</a></li>
Expand Down
1 change: 1 addition & 0 deletions demo/async-create.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ <h3 id="html">Example HTML: Asynchronous</h3>
<h2>jQuery Context Menu Demo Gallery</h2>
<ul id="demo-list">
<li><a href="../demo.html">Simple Context Menu</a></li>
<li><a href="on-dom-element.html">Context Menu on DOM Element</a></li>
<li><a href="dynamic.html">Adding new Context Menu Triggers</a></li>
<li><a href="dynamic-create.html">Create Context Menu on demand</a></li>
<li class="current"><a href="async-create.html">Create Context Menu (asynchronous)</a></li>
Expand Down
1 change: 1 addition & 0 deletions demo/callback.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ <h3 id="html">Example HTML: Command's action (callbacks)</h3>
<h2>jQuery Context Menu Demo Gallery</h2>
<ul id="demo-list">
<li><a href="../demo.html">Simple Context Menu</a></li>
<li><a href="on-dom-element.html">Context Menu on DOM Element</a></li>
<li><a href="dynamic.html">Adding new Context Menu Triggers</a></li>
<li><a href="dynamic-create.html">Create Context Menu on demand</a></li>
<li><a href="async-create.html">Create Context Menu (asynchronous)</a></li>
Expand Down
1 change: 1 addition & 0 deletions demo/custom-command.html
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ <h3 id="html">Example HTML: Custom Command Types</h3>
<h2>jQuery Context Menu Demo Gallery</h2>
<ul id="demo-list">
<li><a href="../demo.html">Simple Context Menu</a></li>
<li><a href="on-dom-element.html">Context Menu on DOM Element</a></li>
<li><a href="dynamic.html">Adding new Context Menu Triggers</a></li>
<li><a href="dynamic-create.html">Create Context Menu on demand</a></li>
<li><a href="async-create.html">Create Context Menu (asynchronous)</a></li>
Expand Down
1 change: 1 addition & 0 deletions demo/disabled-callback.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ <h3 id="html">Example HTML: Disabled Callback</h3>
<h2>jQuery Context Menu Demo Gallery</h2>
<ul id="demo-list">
<li><a href="../demo.html">Simple Context Menu</a></li>
<li><a href="on-dom-element.html">Context Menu on DOM Element</a></li>
<li><a href="dynamic.html">Adding new Context Menu Triggers</a></li>
<li><a href="dynamic-create.html">Create Context Menu on demand</a></li>
<li><a href="async-create.html">Create Context Menu (asynchronous)</a></li>
Expand Down
1 change: 1 addition & 0 deletions demo/disabled-changing.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ <h3 id="html">Example HTML: Changing Disabled</h3>
<h2>jQuery Context Menu Demo Gallery</h2>
<ul id="demo-list">
<li><a href="../demo.html">Simple Context Menu</a></li>
<li><a href="on-dom-element.html">Context Menu on DOM Element</a></li>
<li><a href="dynamic.html">Adding new Context Menu Triggers</a></li>
<li><a href="dynamic-create.html">Create Context Menu on demand</a></li>
<li><a href="async-create.html">Create Context Menu (asynchronous)</a></li>
Expand Down
1 change: 1 addition & 0 deletions demo/disabled-menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ <h3 id="html">Example HTML: Disabled Context Menu</h3>
<h2>jQuery Context Menu Demo Gallery</h2>
<ul id="demo-list">
<li><a href="../demo.html">Simple Context Menu</a></li>
<li><a href="on-dom-element.html">Context Menu on DOM Element</a></li>
<li><a href="dynamic.html">Adding new Context Menu Triggers</a></li>
<li><a href="dynamic-create.html">Create Context Menu on demand</a></li>
<li><a href="async-create.html">Create Context Menu (asynchronous)</a></li>
Expand Down
1 change: 1 addition & 0 deletions demo/disabled.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ <h3 id="html">Example HTML: Disabled Command</h3>
<h2>jQuery Context Menu Demo Gallery</h2>
<ul id="demo-list">
<li><a href="../demo.html">Simple Context Menu</a></li>
<li><a href="on-dom-element.html">Context Menu on DOM Element</a></li>
<li><a href="dynamic.html">Adding new Context Menu Triggers</a></li>
<li><a href="dynamic-create.html">Create Context Menu on demand</a></li>
<li><a href="async-create.html">Create Context Menu (asynchronous)</a></li>
Expand Down
1 change: 1 addition & 0 deletions demo/dynamic-create.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ <h3 id="html">Example HTML: Dynamic on-demand Menu</h3>
<h2>jQuery Context Menu Demo Gallery</h2>
<ul id="demo-list">
<li><a href="../demo.html">Simple Context Menu</a></li>
<li><a href="on-dom-element.html">Context Menu on DOM Element</a></li>
<li><a href="dynamic.html">Adding new Context Menu Triggers</a></li>
<li class="current"><a href="dynamic-create.html">Create Context Menu on demand</a></li>
<li><a href="async-create.html">Create Context Menu (asynchronous)</a></li>
Expand Down
1 change: 1 addition & 0 deletions demo/html5-import.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ <h3 id="html">Example HTML: Importing HTML5 &lt;menu type=&quot;context&quot;&gt
<h2>jQuery Context Menu Demo Gallery</h2>
<ul id="demo-list">
<li><a href="../demo.html">Simple Context Menu</a></li>
<li><a href="on-dom-element.html">Context Menu on DOM Element</a></li>
<li><a href="dynamic.html">Adding new Context Menu Triggers</a></li>
<li><a href="dynamic-create.html">Create Context Menu on demand</a></li>
<li><a href="async-create.html">Create Context Menu (asynchronous)</a></li>
Expand Down
1 change: 1 addition & 0 deletions demo/html5-polyfill-firefox8.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ <h3 id="html">Example HTML: HTML5 Polyfill (Firefox 8)</h3>
<h2>jQuery Context Menu Demo Gallery</h2>
<ul id="demo-list">
<li><a href="../demo.html">Simple Context Menu</a></li>
<li><a href="on-dom-element.html">Context Menu on DOM Element</a></li>
<li><a href="dynamic.html">Adding new Context Menu Triggers</a></li>
<li><a href="dynamic-create.html">Create Context Menu on demand</a></li>
<li><a href="async-create.html">Create Context Menu (asynchronous)</a></li>
Expand Down
1 change: 1 addition & 0 deletions demo/html5-polyfill.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ <h3 id="html">Example HTML: HTML5 Polyfill</h3>
<h2>jQuery Context Menu Demo Gallery</h2>
<ul id="demo-list">
<li><a href="../demo.html">Simple Context Menu</a></li>
<li><a href="on-dom-element.html">Context Menu on DOM Element</a></li>
<li><a href="dynamic.html">Adding new Context Menu Triggers</a></li>
<li><a href="dynamic-create.html">Create Context Menu on demand</a></li>
<li><a href="async-create.html">Create Context Menu (asynchronous)</a></li>
Expand Down
1 change: 1 addition & 0 deletions demo/input.html
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ <h3 id="html">Example HTML: Input Commands</h3>
<h2>jQuery Context Menu Demo Gallery</h2>
<ul id="demo-list">
<li><a href="../demo.html">Simple Context Menu</a></li>
<li><a href="on-dom-element.html">Context Menu on DOM Element</a></li>
<li><a href="dynamic.html">Adding new Context Menu Triggers</a></li>
<li><a href="dynamic-create.html">Create Context Menu on demand</a></li>
<li><a href="async-create.html">Create Context Menu (asynchronous)</a></li>
Expand Down
1 change: 1 addition & 0 deletions demo/keeping-contextmenu-open.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ <h3 id="html">Example HTML: Keeping the Menu visible</h3>
<h2>jQuery Context Menu Demo Gallery</h2>
<ul id="demo-list">
<li><a href="../demo.html">Simple Context Menu</a></li>
<li><a href="on-dom-element.html">Context Menu on DOM Element</a></li>
<li><a href="dynamic.html">Adding new Context Menu Triggers</a></li>
<li><a href="dynamic-create.html">Create Context Menu on demand</a></li>
<li><a href="async-create.html">Create Context Menu (asynchronous)</a></li>
Expand Down
1 change: 1 addition & 0 deletions demo/menu-title.html
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ <h3 id="html">Example HTML: Menu Title</h3>
<h2>jQuery Context Menu Demo Gallery</h2>
<ul id="demo-list">
<li><a href="../demo.html">Simple Context Menu</a></li>
<li><a href="on-dom-element.html">Context Menu on DOM Element</a></li>
<li><a href="dynamic.html">Adding new Context Menu Triggers</a></li>
<li><a href="dynamic-create.html">Create Context Menu on demand</a></li>
<li><a href="async-create.html">Create Context Menu (asynchronous)</a></li>
Expand Down
136 changes: 136 additions & 0 deletions demo/on-dom-element.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
<head>
<meta charset="utf-8" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Context Menu on DOM Element Demo - jQuery contextMenu Plugin</title>
<meta name="description" content="simple contextMenu generator for interactive web applications based on jQuery" />

<script src="../jquery-1.8.2.min.js" type="text/javascript"></script>
<script src="../src/jquery.ui.position.js" type="text/javascript"></script>
<script src="../src/jquery.contextMenu.js" type="text/javascript"></script>
<script src="../prettify/prettify.js" type="text/javascript"></script>
<script src="../screen.js" type="text/javascript"></script>

<link href="../src/jquery.contextMenu.css" rel="stylesheet" type="text/css" />
<link href="../screen.css" rel="stylesheet" type="text/css" />
<link href="../prettify/prettify.sunburst.css" rel="stylesheet" type="text/css" />

<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-8922143-3']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

</script>
<style>
#the-node {
list-style: none;
margin: 0; padding: 0;
}
#the-node > li > span {
display: inline-block;
background: #fff;
}
#the-node > li {
background: #eee;
padding: 20px;
}
#the-node > li:hover {
background: #ddd;
}
#the-node > li + li {
margin-top: 5px;
}
</style>
</head>
<body>
<a id="github-forkme" href="https://github.com/medialize/jQuery-contextMenu"><img src="http://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub" /></a>
<div id="container">
<h1><a href="https://github.com/medialize/jQuery-contextMenu">jQuery contextMenu</a></h1>

<ul class="menu">
<li><a href="../index.html">About</a></li>
<li class="active"><a href="../demo.html">Demo</a></li>
<li><a href="../docs.html">Documentation</a></li>
<li><a href="http://rodneyrehm.de/en/">Author</a></li>
</ul>

<h2 id="demo">Demo: Context Menu on DOM Element</h2>
<p><code>jQuery.contextMenu</code> allows you to bind your menu to a DOM Element</p>
<div class="inline-spaces">
<ul id="the-node">
<li><span>right click me 1</span></li>
<li><span>right click me 2</span></li>
<li>right click me 3</li>
<li>right click me 4</li>
</li>
</div>

<h3 id="code">Example code: Context Menu on DOM Element</h3>
<script type="text/javascript" class="showcase">
$(function(){
$('#the-node').contextMenu({
selector: 'li',
callback: function(key, options) {
var m = "clicked: " + key + " on " + $(this).text();
window.console && console.log(m) || alert(m);
},
items: {
"edit": {name: "Edit", icon: "edit"},
"cut": {name: "Cut", icon: "cut"},
"copy": {name: "Copy", icon: "copy"},
"paste": {name: "Paste", icon: "paste"},
"delete": {name: "Delete", icon: "delete"},
"sep1": "---------",
"quit": {name: "Quit", icon: "quit"}
}
});
});
</script>

<h3 id="html">Example HTML: Context Menu on DOM Element</h3>
<div style="display:none" class="showcase" data-showcase-import=".menu-1, .menu-1 + button"></div>

<h2>jQuery Context Menu Demo Gallery</h2>
<ul id="demo-list">
<li><a href="../demo.html">Simple Context Menu</a></li>
<li class="current"><a href="on-dom-element.html">Context Menu on DOM Element</a></li>
<li><a href="dynamic.html">Adding new Context Menu Triggers</a></li>
<li><a href="dynamic-create.html">Create Context Menu on demand</a></li>
<li><a href="async-create.html">Create Context Menu (asynchronous)</a></li>

<li><a href="keeping-contextmenu-open.html">Keeping the context menu open</a></li>
<li><a href="callback.html">Command's action (callbacks)</a></li>

<li><a href="trigger-left-click.html">Left-Click Trigger</a></li>
<li><a href="trigger-hover.html">Hover Activated Context Menu</a></li>
<li><a href="trigger-hover-autohide.html">Hover Activated Context Menu With Autohide</a></li>
<li><a href="trigger-custom.html">Custom Activated Context Menu</a></li>

<li><a href="disabled-menu.html">Disabled Menu</a></li>
<li><a href="disabled.html">Disabled Command</a></li>
<li><a href="disabled-callback.html">Disabled Callback Command</a></li>
<li><a href="disabled-changing.html">Changing Command's disabled status</a></li>

<li><a href="accesskeys.html">Accesskeys</a></li>
<li><a href="sub-menus.html">Submenus</a></li>

<li><a href="input.html">Input Commands</a></li>
<li><a href="custom-command.html">Custom Command Types</a></li>

<li><a href="menu-title.html">Menus with titles</a></li>

<li><a href="html5-import.html">Importing HTML5 &lt;menu type=&quot;context&quot;&gt;</a></li>
<li><a href="html5-polyfill.html">HTML5 Polyfill</a></li>
<li><a href="html5-polyfill-firefox8.html">HTML5 Polyfill (Firefox 8)</a></li>
</ul>
</div>
</body>
</html>
1 change: 1 addition & 0 deletions demo/sub-menus.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ <h3 id="html">Example HTML: Submenus</h3>
<h2>jQuery Context Menu Demo Gallery</h2>
<ul id="demo-list">
<li><a href="../demo.html">Simple Context Menu</a></li>
<li><a href="on-dom-element.html">Context Menu on DOM Element</a></li>
<li><a href="dynamic.html">Adding new Context Menu Triggers</a></li>
<li><a href="dynamic-create.html">Create Context Menu on demand</a></li>
<li><a href="async-create.html">Create Context Menu (asynchronous)</a></li>
Expand Down
1 change: 1 addition & 0 deletions demo/trigger-custom.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ <h3 id="html">Example HTML: Custom Activated Context Menu</h3>
<h2>jQuery Context Menu Demo Gallery</h2>
<ul id="demo-list">
<li><a href="../demo.html">Simple Context Menu</a></li>
<li><a href="on-dom-element.html">Context Menu on DOM Element</a></li>
<li><a href="dynamic.html">Adding new Context Menu Triggers</a></li>
<li><a href="dynamic-create.html">Create Context Menu on demand</a></li>
<li><a href="async-create.html">Create Context Menu (asynchronous)</a></li>
Expand Down
1 change: 1 addition & 0 deletions demo/trigger-hover-autohide.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ <h3 id="html">Example HTML: Hover Activated Context Menu With Autohide</h3>
<h2>jQuery Context Menu Demo Gallery</h2>
<ul id="demo-list">
<li><a href="../demo.html">Simple Context Menu</a></li>
<li><a href="on-dom-element.html">Context Menu on DOM Element</a></li>
<li><a href="dynamic.html">Adding new Context Menu Triggers</a></li>
<li><a href="dynamic-create.html">Create Context Menu on demand</a></li>
<li><a href="async-create.html">Create Context Menu (asynchronous)</a></li>
Expand Down
1 change: 1 addition & 0 deletions demo/trigger-hover.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ <h3 id="html">Example HTML: Hover Activated Context Menu</h3>
<h2>jQuery Context Menu Demo Gallery</h2>
<ul id="demo-list">
<li><a href="../demo.html">Simple Context Menu</a></li>
<li><a href="on-dom-element.html">Context Menu on DOM Element</a></li>
<li><a href="dynamic.html">Adding new Context Menu Triggers</a></li>
<li><a href="dynamic-create.html">Create Context Menu on demand</a></li>
<li><a href="async-create.html">Create Context Menu (asynchronous)</a></li>
Expand Down
1 change: 1 addition & 0 deletions demo/trigger-left-click.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ <h3 id="html">Example HTML: Left-Click Trigger</h3>
<h2>jQuery Context Menu Demo Gallery</h2>
<ul id="demo-list">
<li><a href="../demo.html">Simple Context Menu</a></li>
<li><a href="on-dom-element.html">Context Menu on DOM Element</a></li>
<li><a href="dynamic.html">Adding new Context Menu Triggers</a></li>
<li><a href="dynamic-create.html">Create Context Menu on demand</a></li>
<li><a href="async-create.html">Create Context Menu (asynchronous)</a></li>
Expand Down
Loading

0 comments on commit 5ccc2e3

Please sign in to comment.