remove trailing white-spaces from public/javascripts/context_menu.js

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8890 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2012-02-16 01:35:52 +00:00
parent fc7b71b334
commit a8f98bb749
1 changed files with 20 additions and 20 deletions

View File

@ -1,5 +1,5 @@
/* redMine - project management software /* Redmine - project management software
Copyright (C) 2006-2008 Jean-Philippe Lang */ Copyright (C) 2006-2012 Jean-Philippe Lang */
var observingContextMenuClick; var observingContextMenuClick;
@ -14,11 +14,11 @@ ContextMenu.prototype = {
Event.observe(document, 'contextmenu', this.RightClick.bindAsEventListener(this)); Event.observe(document, 'contextmenu', this.RightClick.bindAsEventListener(this));
observingContextMenuClick = true; observingContextMenuClick = true;
} }
this.unselectAll(); this.unselectAll();
this.lastSelected = null; this.lastSelected = null;
}, },
RightClick: function(e) { RightClick: function(e) {
this.hideMenu(); this.hideMenu();
// do not show the context menu on links // do not show the context menu on links
@ -41,7 +41,7 @@ ContextMenu.prototype = {
} }
this.hideMenu(); this.hideMenu();
if (Event.element(e).tagName == 'A' || Event.element(e).tagName == 'IMG') { return; } if (Event.element(e).tagName == 'A' || Event.element(e).tagName == 'IMG') { return; }
if (Event.isLeftClick(e) || (navigator.appVersion.match(/\bMSIE\b/))) { if (Event.isLeftClick(e) || (navigator.appVersion.match(/\bMSIE\b/))) {
var tr = Event.findElement(e, 'tr'); var tr = Event.findElement(e, 'tr');
if (tr!=null && tr!=document && tr.hasClassName('hascontextmenu')) { if (tr!=null && tr!=document && tr.hasClassName('hascontextmenu')) {
// a row was clicked, check if the click was on checkbox // a row was clicked, check if the click was on checkbox
@ -90,7 +90,7 @@ ContextMenu.prototype = {
} }
} }
}, },
createMenu: function() { createMenu: function() {
if (!$('context-menu')) { if (!$('context-menu')) {
var menu = document.createElement("div"); var menu = document.createElement("div");
@ -99,7 +99,7 @@ ContextMenu.prototype = {
document.getElementById("content").appendChild(menu); document.getElementById("content").appendChild(menu);
} }
}, },
showMenu: function(e) { showMenu: function(e) {
var mouse_x = Event.pointerX(e); var mouse_x = Event.pointerX(e);
var mouse_y = Event.pointerY(e); var mouse_y = Event.pointerY(e);
@ -114,10 +114,10 @@ ContextMenu.prototype = {
var max_height; var max_height;
$('context-menu').style['left'] = (render_x + 'px'); $('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', ''); Element.update('context-menu', '');
new Ajax.Updater({success:'context-menu'}, this.url, new Ajax.Updater({success:'context-menu'}, this.url,
{asynchronous:true, {asynchronous:true,
method: 'get', method: 'get',
evalScripts:true, evalScripts:true,
@ -128,11 +128,11 @@ ContextMenu.prototype = {
menu_height = dims.height; menu_height = dims.height;
max_width = mouse_x + 2*menu_width; max_width = mouse_x + 2*menu_width;
max_height = mouse_y + menu_height; max_height = mouse_y + menu_height;
var ws = window_size(); var ws = window_size();
window_width = ws.width; window_width = ws.width;
window_height = ws.height; window_height = ws.height;
/* display the menu above and/or to the left of the click if needed */ /* display the menu above and/or to the left of the click if needed */
if (max_width > window_width) { if (max_width > window_width) {
render_x -= menu_width; render_x -= menu_width;
@ -150,22 +150,22 @@ ContextMenu.prototype = {
if (render_y <= 0) render_y = 1; if (render_y <= 0) render_y = 1;
$('context-menu').style['left'] = (render_x + 'px'); $('context-menu').style['left'] = (render_x + 'px');
$('context-menu').style['top'] = (render_y + 'px'); $('context-menu').style['top'] = (render_y + 'px');
Effect.Appear('context-menu', {duration: 0.20}); Effect.Appear('context-menu', {duration: 0.20});
if (window.parseStylesheets) { window.parseStylesheets(); } // IE if (window.parseStylesheets) { window.parseStylesheets(); } // IE
}}) }})
}, },
hideMenu: function() { hideMenu: function() {
Element.hide('context-menu'); Element.hide('context-menu');
}, },
addSelection: function(tr) { addSelection: function(tr) {
tr.addClassName('context-menu-selection'); tr.addClassName('context-menu-selection');
this.checkSelectionBox(tr, true); this.checkSelectionBox(tr, true);
this.clearDocumentSelection(); this.clearDocumentSelection();
}, },
toggleSelection: function(tr) { toggleSelection: function(tr) {
if (this.isSelected(tr)) { if (this.isSelected(tr)) {
this.removeSelection(tr); this.removeSelection(tr);
@ -173,28 +173,28 @@ ContextMenu.prototype = {
this.addSelection(tr); this.addSelection(tr);
} }
}, },
removeSelection: function(tr) { removeSelection: function(tr) {
tr.removeClassName('context-menu-selection'); tr.removeClassName('context-menu-selection');
this.checkSelectionBox(tr, false); this.checkSelectionBox(tr, false);
}, },
unselectAll: function() { unselectAll: function() {
var rows = $$('.hascontextmenu'); var rows = $$('.hascontextmenu');
for (i=0; i<rows.length; i++) { for (i=0; i<rows.length; i++) {
this.removeSelection(rows[i]); this.removeSelection(rows[i]);
} }
}, },
checkSelectionBox: function(tr, checked) { checkSelectionBox: function(tr, checked) {
var inputs = Element.getElementsBySelector(tr, 'input'); var inputs = Element.getElementsBySelector(tr, 'input');
if (inputs.length > 0) { inputs[0].checked = checked; } if (inputs.length > 0) { inputs[0].checked = checked; }
}, },
isSelected: function(tr) { isSelected: function(tr) {
return Element.hasClassName(tr, 'context-menu-selection'); return Element.hasClassName(tr, 'context-menu-selection');
}, },
clearDocumentSelection: function() { clearDocumentSelection: function() {
if (document.selection) { if (document.selection) {
document.selection.clear(); // IE document.selection.clear(); // IE