rbrindley: branch rbrindley/vmenus_revamp r4420 - in /team/rbrindley/vmenus_r...
SVN commits to the Asterisk-GUI project
asterisk-gui-commits at lists.digium.com
Tue Jan 13 14:22:02 CST 2009
Author: rbrindley
Date: Tue Jan 13 14:22:02 2009
New Revision: 4420
URL: http://svn.digium.com/svn-view/asterisk-gui?view=rev&rev=4420
Log:
- implemented the addAction function
- included jquery.delegate-1.1 js library
- added select function to store the id of the tab clicked
- implemented event delegation for click and dblclick events of actions
- fixed click events to not execute if its a dblclick
Modified:
team/rbrindley/vmenus_revamp/config/js/menus2.js
team/rbrindley/vmenus_revamp/config/menus2.html
Modified: team/rbrindley/vmenus_revamp/config/js/menus2.js
URL: http://svn.digium.com/svn-view/asterisk-gui/team/rbrindley/vmenus_revamp/config/js/menus2.js?view=diff&rev=4420&r1=4419&r2=4420
==============================================================================
--- team/rbrindley/vmenus_revamp/config/js/menus2.js (original)
+++ team/rbrindley/vmenus_revamp/config/js/menus2.js Tue Jan 13 14:22:02 2009
@@ -27,3 +27,11 @@
html.removeClass('template');
html.appendTo('#actions_list');
}
+
+ function addAction(action) {
+ var vmenu = $(selected).find('.vmenu');
+ var new_tmp = vmenu.children(':last').remove();
+
+ vmenu.append(action);
+ vmenu.append(new_tmp);
+ }
Modified: team/rbrindley/vmenus_revamp/config/menus2.html
URL: http://svn.digium.com/svn-view/asterisk-gui/team/rbrindley/vmenus_revamp/config/menus2.html?view=diff&rev=4420&r1=4419&r2=4420
==============================================================================
--- team/rbrindley/vmenus_revamp/config/menus2.html (original)
+++ team/rbrindley/vmenus_revamp/config/menus2.html Tue Jan 13 14:22:02 2009
@@ -252,6 +252,7 @@
<!-- load Javascript -->
<script type="text/javascript" src="js/jquery.js"></script>
+<script type="text/javascript" src="js/jquery.delegate-1.1.js"></script>
<script type="text/javascript" src="js/jquery.ui.core.js"></script>
<script type="text/javascript" src="js/jquery.ui.tabs.js"></script>
<script type="text/javascript" src="js/jquery.ui.draggable.js"></script>
@@ -348,14 +349,32 @@
disabledClass: 'ui-tabs-disabled-side',
panelClass: 'ui-tabs-panel-side',
hideClass: 'ui-tabs-hide-side',
- loadingClass: 'ui-tabs-loading-side'
+ loadingClass: 'ui-tabs-loading-side',
+ select: function(e, ui) {
+ selected = ui.tab.toString().split('#')[1];
+ }
});
- $('#actions_list').click( $.delegate({
- '.action': function (e) {
- $(e.target).children('.info').toggle();
- }
- }));
+ //initiate event delegation
+ $('#actions_list')
+ .delegate('click','.action', function (e) {
+ /* This is very odd code I know, but when a user
+ * dblclicks the click events are still triggered.
+ * This is to delay click events on .action(s)
+ * until we know it isn't a dblclick */
+ window.clearTimeout(clickTimer);
+ if (e.detail == 1) {
+ clickObj = $(e.target).parents('.action');
+ var doClick = function() {
+ clickObj.children('.info').toggle();
+ }
+ clickTimer = window.setTimeout(doClick, 200);
+ }
+ })
+ .delegate('dblclick','.action', function (e) {
+ window.clearTimeout(clickTimer);
+ addAction($(e.target).parents('.action').clone());
+ });
//generate the actions list
action_template = $('#actions_list > .template');
@@ -375,6 +394,9 @@
/* many variables only need to be pulled from html once. */
var action_template; //html template for actions
+ var clickTimer; //single click timer
+ var clickObj; //single click object
+ var selected; //the selected tab id
</script>
<!-- end load Javascript -->
</body>
More information about the asterisk-gui-commits
mailing list