summaryrefslogtreecommitdiffstats
path: root/public
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2012-02-16 01:35:23 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2012-02-16 01:35:23 +0000
commitfc7b71b334a458f3192d3f8a851a49a94f4285b4 (patch)
treea7951f5f1d52606d254b614c0027a588e37c9fa8 /public
parenta6bad4a47d19975c9d77f537bf5bf29b074be5e8 (diff)
downloadredmine-fc7b71b334a458f3192d3f8a851a49a94f4285b4.tar.gz
redmine-fc7b71b334a458f3192d3f8a851a49a94f4285b4.zip
replace tabs to spaces and fix indents public/javascripts/context_menu.js
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8889 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'public')
-rw-r--r--public/javascripts/context_menu.js176
1 files changed, 88 insertions, 88 deletions
diff --git a/public/javascripts/context_menu.js b/public/javascripts/context_menu.js
index a383ebe00..d6d800a28 100644
--- a/public/javascripts/context_menu.js
+++ b/public/javascripts/context_menu.js
@@ -5,42 +5,42 @@ var observingContextMenuClick;
ContextMenu = Class.create();
ContextMenu.prototype = {
- initialize: function (url) {
- this.url = url;
- this.createMenu();
+ initialize: function (url) {
+ this.url = url;
+ this.createMenu();
- if (!observingContextMenuClick) {
- Event.observe(document, 'click', this.Click.bindAsEventListener(this));
- Event.observe(document, 'contextmenu', this.RightClick.bindAsEventListener(this));
- observingContextMenuClick = true;
- }
-
- this.unselectAll();
- this.lastSelected = null;
- },
+ if (!observingContextMenuClick) {
+ Event.observe(document, 'click', this.Click.bindAsEventListener(this));
+ Event.observe(document, 'contextmenu', this.RightClick.bindAsEventListener(this));
+ observingContextMenuClick = true;
+ }
+
+ this.unselectAll();
+ this.lastSelected = null;
+ },
- RightClick: function(e) {
- this.hideMenu();
- // do not show the context menu on links
- if (Event.element(e).tagName == 'A') { return; }
- var tr = Event.findElement(e, 'tr');
- if (tr == document || tr == undefined || !tr.hasClassName('hascontextmenu')) { return; }
- Event.stop(e);
- if (!this.isSelected(tr)) {
- this.unselectAll();
- this.addSelection(tr);
- this.lastSelected = tr;
- }
- this.showMenu(e);
- },
+ RightClick: function(e) {
+ this.hideMenu();
+ // do not show the context menu on links
+ if (Event.element(e).tagName == 'A') { return; }
+ var tr = Event.findElement(e, 'tr');
+ if (tr == document || tr == undefined || !tr.hasClassName('hascontextmenu')) { return; }
+ Event.stop(e);
+ if (!this.isSelected(tr)) {
+ this.unselectAll();
+ this.addSelection(tr);
+ this.lastSelected = tr;
+ }
+ this.showMenu(e);
+ },
Click: function(e) {
- if (Event.element(e).tagName == 'A' && Event.element(e).hasClassName('submenu')) {
- Event.stop(e)
- return;
- }
- this.hideMenu();
- if (Event.element(e).tagName == 'A' || Event.element(e).tagName == 'IMG') { return; }
+ if (Event.element(e).tagName == 'A' && Event.element(e).hasClassName('submenu')) {
+ Event.stop(e)
+ return;
+ }
+ this.hideMenu();
+ if (Event.element(e).tagName == 'A' || Event.element(e).tagName == 'IMG') { return; }
if (Event.isLeftClick(e) || (navigator.appVersion.match(/\bMSIE\b/))) {
var tr = Event.findElement(e, 'tr');
if (tr!=null && tr!=document && tr.hasClassName('hascontextmenu')) {
@@ -114,7 +114,7 @@ ContextMenu.prototype = {
var max_height;
$('context-menu').style['left'] = (render_x + 'px');
- $('context-menu').style['top'] = (render_y + 'px');
+ $('context-menu').style['top'] = (render_y + 'px');
Element.update('context-menu', '');
new Ajax.Updater({success:'context-menu'}, this.url,
@@ -123,34 +123,34 @@ ContextMenu.prototype = {
evalScripts:true,
parameters:Form.serialize(Event.findElement(e, 'form')),
onComplete:function(request){
- dims = $('context-menu').getDimensions();
- menu_width = dims.width;
- menu_height = dims.height;
- max_width = mouse_x + 2*menu_width;
- max_height = mouse_y + menu_height;
-
- var ws = window_size();
- window_width = ws.width;
- window_height = ws.height;
-
- /* display the menu above and/or to the left of the click if needed */
- if (max_width > window_width) {
- render_x -= menu_width;
- $('context-menu').addClassName('reverse-x');
- } else {
- $('context-menu').removeClassName('reverse-x');
- }
- if (max_height > window_height) {
- render_y -= menu_height;
- $('context-menu').addClassName('reverse-y');
- } else {
- $('context-menu').removeClassName('reverse-y');
- }
- if (render_x <= 0) render_x = 1;
- if (render_y <= 0) render_y = 1;
- $('context-menu').style['left'] = (render_x + 'px');
- $('context-menu').style['top'] = (render_y + 'px');
-
+ dims = $('context-menu').getDimensions();
+ menu_width = dims.width;
+ menu_height = dims.height;
+ max_width = mouse_x + 2*menu_width;
+ max_height = mouse_y + menu_height;
+
+ var ws = window_size();
+ window_width = ws.width;
+ window_height = ws.height;
+
+ /* display the menu above and/or to the left of the click if needed */
+ if (max_width > window_width) {
+ render_x -= menu_width;
+ $('context-menu').addClassName('reverse-x');
+ } else {
+ $('context-menu').removeClassName('reverse-x');
+ }
+ if (max_height > window_height) {
+ render_y -= menu_height;
+ $('context-menu').addClassName('reverse-y');
+ } else {
+ $('context-menu').removeClassName('reverse-y');
+ }
+ if (render_x <= 0) render_x = 1;
+ if (render_y <= 0) render_y = 1;
+ $('context-menu').style['left'] = (render_x + 'px');
+ $('context-menu').style['top'] = (render_y + 'px');
+
Effect.Appear('context-menu', {duration: 0.20});
if (window.parseStylesheets) { window.parseStylesheets(); } // IE
}})
@@ -187,8 +187,8 @@ ContextMenu.prototype = {
},
checkSelectionBox: function(tr, checked) {
- var inputs = Element.getElementsBySelector(tr, 'input');
- if (inputs.length > 0) { inputs[0].checked = checked; }
+ var inputs = Element.getElementsBySelector(tr, 'input');
+ if (inputs.length > 0) { inputs[0].checked = checked; }
},
isSelected: function(tr) {
@@ -205,32 +205,32 @@ ContextMenu.prototype = {
}
function toggleIssuesSelection(el) {
- var boxes = el.getElementsBySelector('input[type=checkbox]');
- var all_checked = true;
- for (i = 0; i < boxes.length; i++) { if (boxes[i].checked == false) { all_checked = false; } }
- for (i = 0; i < boxes.length; i++) {
- if (all_checked) {
- boxes[i].checked = false;
- boxes[i].up('tr').removeClassName('context-menu-selection');
- } else if (boxes[i].checked == false) {
- boxes[i].checked = true;
- boxes[i].up('tr').addClassName('context-menu-selection');
- }
- }
+ var boxes = el.getElementsBySelector('input[type=checkbox]');
+ var all_checked = true;
+ for (i = 0; i < boxes.length; i++) { if (boxes[i].checked == false) { all_checked = false; } }
+ for (i = 0; i < boxes.length; i++) {
+ if (all_checked) {
+ boxes[i].checked = false;
+ boxes[i].up('tr').removeClassName('context-menu-selection');
+ } else if (boxes[i].checked == false) {
+ boxes[i].checked = true;
+ boxes[i].up('tr').addClassName('context-menu-selection');
+ }
+ }
}
function window_size() {
- var w;
- var h;
- if (window.innerWidth) {
- w = window.innerWidth;
- h = window.innerHeight;
- } else if (document.documentElement) {
- w = document.documentElement.clientWidth;
- h = document.documentElement.clientHeight;
- } else {
- w = document.body.clientWidth;
- h = document.body.clientHeight;
- }
- return {width: w, height: h};
+ var w;
+ var h;
+ if (window.innerWidth) {
+ w = window.innerWidth;
+ h = window.innerHeight;
+ } else if (document.documentElement) {
+ w = document.documentElement.clientWidth;
+ h = document.documentElement.clientHeight;
+ } else {
+ w = document.body.clientWidth;
+ h = document.body.clientHeight;
+ }
+ return {width: w, height: h};
}