Skip to content

Commit

Permalink
Merge branch 'menubar' into datepicker
Browse files Browse the repository at this point in the history
Conflicts:
	ui/jquery.ui.menu.js
  • Loading branch information
scottgonzalez committed Mar 19, 2012
2 parents 6ded35c + f83c963 commit 25baf88
Show file tree
Hide file tree
Showing 17 changed files with 1,386 additions and 23 deletions.
42 changes: 23 additions & 19 deletions demos/index.html
Expand Up @@ -20,6 +20,8 @@
<script src="../ui/jquery.ui.draggable.js"></script>
<script src="../ui/jquery.ui.droppable.js"></script>
<script src="../ui/jquery.ui.menu.js"></script>
<script src="../ui/jquery.ui.menubar.js"></script>
<script src="../ui/jquery.ui.popup.js"></script>
<script src="../ui/jquery.ui.position.js"></script>
<script src="../ui/jquery.ui.progressbar.js"></script>
<script src="../ui/jquery.ui.resizable.js"></script>
Expand Down Expand Up @@ -111,28 +113,28 @@
<script src="../ui/i18n/jquery.ui.datepicker-zh-TW.js"></script>
<script>
$(function() {

$('.left-nav a').click(function(ev) {
window.location.hash = this.href.replace(/.+\/([^\/]+)\/index\.html/,'$1') + '|default';
loadPage(this.href);
$('.left-nav a.selected').removeClass('selected');
$(this).addClass('selected');
ev.preventDefault();
});

if (window.location.hash) {
if (window.location.hash.indexOf('|') === -1) {
window.location.hash += '|default';
}
window.location.hash += '|default';
}
var path = window.location.href.replace(/(index\.html)?#/,'');
path = path.replace('\|','/') + '.html';
loadPage(path);
}
}

function loadPage(path) {
function loadPage(path) {
var section = path.replace(/\/[^\/]+\.html/,'');
var header = section.replace(/.+\/([^\/]+)/,'$1').replace(/_/, ' ');

$('td.normal div.normal')
.empty()
.append('<h4 class="demo-subheader">Functional demo:</h4>')
Expand All @@ -148,7 +150,7 @@
$(this).click(function() {

resetDemos();

$(this).parents('ul').find('li').removeClass('demo-config-on');
$(this).parent().addClass('demo-config-on');
$('#demo-notes').fadeOut();
Expand All @@ -167,8 +169,8 @@
$('#demo-config-menu a').each(function(){
if (this.href.indexOf(demo + '.html') !== -1) {
$(this).parents('ul').find('li').removeClass('demo-config-on');
$(this).parent().addClass('demo-config-on');
loadDemo(this.href);
$(this).parent().addClass('demo-config-on');
loadDemo(this.href);
}
});
}
Expand All @@ -184,10 +186,10 @@
.end()
.end()
;

resetDemos();
}

function loadDemo(path) {
var directory = path.match(/([^\/]+)\/[^\/\.]+\.html$/)[1];
$.get(path, function(data) {
Expand All @@ -207,7 +209,7 @@
$('#demo-link a').attr('href', path);
updateDemoNotes();
updateDemoSource(source);

if (/default.html$/.test(path)) {
$.get("documentation/docs-" + path.match(/demos\/(.+)\//)[1] + ".html", function(html) {
$("#demo-source").after(html);
Expand Down Expand Up @@ -241,7 +243,7 @@
$('#demo-notes').show();
notes.hide();
}

function updateDemoSource(source) {
if ($('#demo-source').length == 0) {
$('<div id="demo-source"><a href="#" class="source-closed">View Source</a><div><pre><code></code></pre></div></div>').insertAfter('#demo-notes');
Expand All @@ -257,12 +259,12 @@

$('#demo-source code').empty().text(cleanedSource);
}

function resetDemos() {
$.datepicker.setDefaults($.extend({showMonthAfterYear: false}, $.datepicker.regional['']));
$(".ui-dialog-content").remove();
$(".ui-dialog-content").remove();
}

});
</script>
</head>
Expand All @@ -285,6 +287,8 @@
<dd><a href="datepicker/index.html">Datepicker</a></dd>
<dd><a href="dialog/index.html">Dialog</a></dd>
<dd><a href="menu/index.html">Menu</a></dd>
<dd><a href="menubar/index.html">Menubar</a></dd>
<dd><a href="popup/index.html">Popup</a></dd>
<dd><a href="progressbar/index.html">Progressbar</a></dd>
<dd><a href="slider/index.html">Slider</a></dd>
<dd><a href="spinner/index.html">Spinner</a></dd>
Expand All @@ -305,7 +309,7 @@
<dd><a href="widget/index.html">Widget</a></dd>
<dt>About jQuery UI</dt>
<dd><a href="http://jqueryui.com/docs/Getting_Started">Getting Started</a></dd>
<dd><a href="http://jqueryui.com/docs/Upgrade_Guide">Upgrade Guide</a></dd>
<dd><a href="http://jqueryui.com/docs/Upgrade_Guide">Upgrade Guide</a></dd>
<dd><a href="http://jqueryui.com/docs/Changelog">Changelog</a></dd>
<dd><a href="http://jqueryui.com/docs/Roadmap">Roadmap</a></dd>
<dd><a href="http://jqueryui.com/docs/Subversion">Subversion Access</a></dd>
Expand All @@ -326,7 +330,7 @@ <h3>Instructions</h3>
<p>
These demos showcase some common uses of each jQuery UI plugin. Simply copy and paste code from the demos to get started. Have fun playing with them.
</p>

</div>

</td>
Expand Down
65 changes: 65 additions & 0 deletions demos/menu/contextmenu.html
@@ -0,0 +1,65 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>jQuery UI Menu - Contextmenu demo</title>
<link href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
<script src="../../jquery-1.7.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.position.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.menu.js"></script>
<script src="../../ui/jquery.ui.button.js"></script>
<script src="../../ui/jquery.ui.popup.js"></script>
<link href="../demos.css" rel="stylesheet" />
<script>
$(function() {
var btn = $(".demo button").button({
icons: {
primary: "ui-icon-home",
secondary: "ui-icon-triangle-1-s"
}
});
$("#cities").menu({
select: function(event, ui) {
$("#log").append("<div>Selected " + ui.item.text() + "</div>");
},
trigger : btn});
});
</script>
<style>
.ui-menu { width: 200px; position: absolute; }
</style>
</head>
<body>

<div class="demo">

<button>Select a city</button>
<ul id="cities">
<li><a href="#Amsterdam">Amsterdam</a></li>
<li><a href="#Anaheim">Anaheim</a></li>
<li><a href="#Cologne">Cologne</a></li>
<li><a href="#Frankfurt">Frankfurt</a></li>
<li><a href="#Magdeburg">Magdeburg</a></li>
<li><a href="#Munich">Munich</a></li>
<li><a href="#Utrecht">Utrecht</a></li>
<li><a href="#Zurich">Zurich</a></li>
</ul>

<div id="log"></div>

</div><!-- End demo -->

<div class="demo-description">

<p>A simple contextmenu: Click the button, or tab to it and hit space to open the menu. Use the mouse or cursor keys to select an item, click it or hit enter to select it.</p>

<p>The keyboard handling is part of the menu. Using the input option to menu is configured to add the key event handlers to the button, as that button gets focused when clicked.</p>

</div><!-- End demo-description -->



</body>
</html>

0 comments on commit 25baf88

Please sign in to comment.