/** * @files js for collapsible tree view with some helper functions for updating tree structure */ (function ($) { Drupal.behaviors.TaxonomyManagerTree = { attach: function(context, settings) { var treeSettings = settings.taxonomytree || []; if (treeSettings instanceof Array) { for (var i=0; ix').appendTo(this).click(function() { $(this).parent().fadeOut('fast', function() { $(this).remove(); }); return false; }); }); } /** * attaches a throbber element to the taxonomy manager */ Drupal.attachThrobber = function() { var div = $('#taxonomy-manager'); var throbber = $(''); throbber.appendTo("#taxonomy-manager-toolbar-throbber").hide(); throbber.ajaxStart(function() { $(this).show(); }); throbber.ajaxStop(function() { $(this).hide(); }); throbber.ajaxError(function() { alert("An AJAX error occurred. Reload the page and check your logs."); $(this).hide(); }); } /** * makes the div resizeable */ Drupal.attachResizeableTreeDiv = function() { $('img.div-grippie').each(function() { var staticOffset = null; var div = $(this).parents("fieldset").parent(); $(this).mousedown(startDrag); function startDrag(e) { staticOffset = div.width() - e.pageX; div.css('opacity', 0.5); $(document).mousemove(performDrag).mouseup(endDrag); return false; } function performDrag(e) { div.width(Math.max(200, staticOffset + e.pageX) + 'px'); return false; } function endDrag(e) { $(document).unbind("mousemove", performDrag).unbind("mouseup", endDrag); div.css('opacity', 1); } }); } /** * Adds select all / remove selection functionality. */ Drupal.attachGlobalSelectAll = function() { $('span.taxonomy-manager-select-helpers').once(function() { var form = $(this).parents('.form-wrapper:first'); $(this).find('span.select-all-children').click(function() { // Only select those that are visible to the end user. $(form).parent().find(' :checkbox:visible').attr('checked', true); }); $(this).find('span.deselect-all-children').click(function() { $(form).parent().find(':checkbox').attr("checked", false); }); }); } })(jQuery);