@@ -1,5 +1,5 | |||
|
1 |
/* |
|
|
2 |
Copyright (C) 2006-20 |
|
|
1 | /* Redmine - project management software | |
|
2 | Copyright (C) 2006-2012 Jean-Philippe Lang */ | |
|
3 | 3 | |
|
4 | 4 | function checkAll (id, checked) { |
|
5 | 5 | var els = Element.descendants(id); |
@@ -426,7 +426,7 function observeProjectModules() { | |||
|
426 | 426 | setVisible('project_trackers', c); |
|
427 | 427 | setVisible('project_issue_custom_fields', c); |
|
428 | 428 | }; |
|
429 | ||
|
429 | ||
|
430 | 430 | Event.observe(window, 'load', f); |
|
431 | 431 | Event.observe('project_enabled_module_names_issue_tracking', 'change', f); |
|
432 | 432 | } |
@@ -441,44 +441,44 var WarnLeavingUnsaved = Class.create({ | |||
|
441 | 441 | observedElements: false, |
|
442 | 442 | changedForms: false, |
|
443 | 443 | message: null, |
|
444 | ||
|
444 | ||
|
445 | 445 | initialize: function(message){ |
|
446 | 446 | this.observedForms = $$('form'); |
|
447 | 447 | this.observedElements = $$('textarea'); |
|
448 | 448 | this.message = message; |
|
449 | ||
|
449 | ||
|
450 | 450 | this.observedElements.each(this.observeChange.bind(this)); |
|
451 | 451 | this.observedForms.each(this.submitAction.bind(this)); |
|
452 | ||
|
452 | ||
|
453 | 453 | window.onbeforeunload = this.unload.bind(this); |
|
454 | 454 | }, |
|
455 | ||
|
455 | ||
|
456 | 456 | unload: function(){ |
|
457 | 457 | this.observedElements.each(function(el) {el.blur();}) |
|
458 | 458 | if(this.changedForms) |
|
459 | 459 | return this.message; |
|
460 | 460 | }, |
|
461 | ||
|
461 | ||
|
462 | 462 | setChanged: function(){ |
|
463 | 463 | this.changedForms = true; |
|
464 | 464 | }, |
|
465 | ||
|
465 | ||
|
466 | 466 | setUnchanged: function(){ |
|
467 | 467 | this.changedForms = false; |
|
468 | 468 | }, |
|
469 | ||
|
469 | ||
|
470 | 470 | observeChange: function(element){ |
|
471 | 471 | element.observe('change',this.setChanged.bindAsEventListener(this)); |
|
472 | 472 | }, |
|
473 | ||
|
473 | ||
|
474 | 474 | submitAction: function(element){ |
|
475 | 475 | element.observe('submit',this.setUnchanged.bindAsEventListener(this)); |
|
476 | 476 | } |
|
477 | 477 | }); |
|
478 | 478 | |
|
479 |
/* |
|
|
479 | /* | |
|
480 | 480 | * 1 - registers a callback which copies the csrf token into the |
|
481 |
* X-CSRF-Token header with each ajax request. Necessary to |
|
|
481 | * X-CSRF-Token header with each ajax request. Necessary to | |
|
482 | 482 | * work with rails applications which have fixed |
|
483 | 483 | * CVE-2011-0447 |
|
484 | 484 | * 2 - shows and hides ajax indicator |
General Comments 0
You need to be logged in to leave comments.
Login now