/[drupal]/contributions/modules/activeedit/activeedit.js
ViewVC logotype

Contents of /contributions/modules/activeedit/activeedit.js

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download) (as text)
Thu Apr 3 21:38:19 2008 UTC (19 months, 3 weeks ago) by nedjo
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +33 -313 lines
File MIME type: text/javascript
Major refactoring of activeedit. Remove almost everything but leave enough to begin afresh with, based on popups. Only a single active edit is implemented: footer. No theme-specific support, no node or comment support. Todo: pass updated data back for rendering in the original element (e.g., footer).
1 // $Id: activemenu.js,v 1.1 2008/03/28 16:36:44 nedjo Exp $
2
3 Drupal.behaviors.activeEdit = function (context) {
4 $('body:not(.activeedit-processed)')
5 .addClass('activeedit-processed')
6 .prepend('<div class="activeedit-enable"><label><input class="activeedit-enable" type="checkbox" /> '+ Drupal.t('Active editing mode') +'</label></div>')
7 .find('input.activeedit-enable')
8 .click(function () {
9 var checked = $(this).is(':checked');
10 $.each(Drupal.settings.activeEdit, function (key, value) {
11 var delimiter = value['#url'].indexOf('?') == -1 ? '?' : '&';
12 $(value['#selector']).each(function () {
13 var a = document.createElement('a');
14 $(a)
15 .attr('href', value['#url'] + delimiter +'activeedit_element='+ key)
16 .addClass('activeedit');
17 if (checked) {
18 var link = $(this)
19 .wrap(a)
20 .mouseover(function() {
21 $(this).addClass('activeedit-active');
22 })
23 .mouseout(function() {
24 $(this).removeClass('activeedit-active');
25 })
26 .parent('a.activeedit')
27 .get(0);
28 Drupal.behaviors.popups(document);
29 }
30 else {
31 $(this)
32 .unbind('mouseover')
33 .unbind('mouseout')
34 .parent('a')
35 .replaceWith(this);
36 }
37 });
38 });
39 });
40 };

  ViewVC Help
Powered by ViewVC 1.1.2