Mercurial > defr > drupal > scald > dnd
comparison js/dnd-library.js @ 18:0d557e6e73f7
Added beautytips and some additional event handling code to the library.
author | David Eads <eads@chicagotech.org> |
---|---|
date | Fri, 06 Mar 2009 14:11:46 -0600 |
parents | 1a77f87927dd |
children | d83073a08b25 |
comparison
equal
deleted
inserted
replaced
17:1a77f87927dd | 18:0d557e6e73f7 |
---|---|
35 | 35 |
36 // Bind Drag and Drop plugin invocation to events emanating from Wysiwyg | 36 // Bind Drag and Drop plugin invocation to events emanating from Wysiwyg |
37 $editor.bind('wysiwygAttach', Drupal.behaviors.dndLibrary.attach_library); | 37 $editor.bind('wysiwygAttach', Drupal.behaviors.dndLibrary.attach_library); |
38 $editor.bind('wysiwygDetach', Drupal.behaviors.dndLibrary.detach_library); | 38 $editor.bind('wysiwygDetach', Drupal.behaviors.dndLibrary.detach_library); |
39 | 39 |
40 // Add basic hover behavior to editor items | 40 $('.editor-item', context).each(function () { |
41 $('.editor-item', context).hover(function() { | 41 $(this).bt(Drupal.settings.dndLibraryPreviews[this.id], { |
42 var $this = $(this); | 42 'trigger' : 'none', |
43 var p = $('#edit-body-wrapper').position(); | 43 'width' : 300, |
44 var preview = $(Drupal.settings.dndLibraryPreviews[this.id]).css({ | 44 'spikeLength' : 7, |
45 'position' : 'absolute', | 45 'spikeGirth' : 9, |
46 'top' : p.top + 150, | 46 'corner-radius' : 3, |
47 'left' : p.left + $('#edit-body-wrapper').width() + 150, | 47 'strokeWidth' : 1, |
48 'display' : 'none', | 48 'fill' : '#eee', |
49 'width' : '300px', | 49 'strokeStyle': '#555' |
50 'background-color' : '#ddd', | 50 }); |
51 'border' : '3px solid #999', | 51 $(this).hover(function() { |
52 'padding' : '4px', | 52 var $this = $(this); |
53 'z-index' : 10 | 53 this.btOn(); |
54 }); | 54 // Remove the preview once dragging of any image has commenced |
55 $('body').prepend(preview); | 55 $('img', $this).bind('drag', function(e) { |
56 preview.fadeIn('slow'); | 56 $this.btOff(); |
57 }, function() { | 57 }); |
58 $('#' + this.id.replace(/test/,'preview')).fadeOut('fast', function() { $(this).remove(); }); | 58 }, function() { |
59 this.btOff(); | |
60 }); | |
59 }); | 61 }); |
62 | |
60 | 63 |
61 // Ajax pager | 64 // Ajax pager |
62 $('.pager a', $this).click(function() { | 65 $('.pager a', $this).click(function() { |
63 $.getJSON(this.href, function(data) { | 66 $.getJSON(this.href, function(data) { |
64 Drupal.behaviors.dndLibrary.refreshLibrary.call($this.get(0), data, $editor); | 67 Drupal.behaviors.dndLibrary.refreshLibrary.call($this.get(0), data, $editor); |