| [1659] | 1 | /* | 
|---|
|  | 2 | # -- BEGIN LICENSE BLOCK --------------------------------------- | 
|---|
|  | 3 | # | 
|---|
|  | 4 | # This file is part of Dotclear 2. | 
|---|
|  | 5 | # | 
|---|
|  | 6 | # Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear | 
|---|
|  | 7 | # Licensed under the GPL version 2.0 license. | 
|---|
|  | 8 | # See LICENSE file or | 
|---|
|  | 9 | # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html | 
|---|
|  | 10 | # | 
|---|
|  | 11 | # -- END LICENSE BLOCK ----------------------------------------- | 
|---|
|  | 12 | */ | 
|---|
|  | 13 |  | 
|---|
| [1648] | 14 | dotclear.postExpander = function(line) { | 
|---|
|  | 15 | var title = $(line).find('.widget-name'); | 
|---|
| [1659] | 16 | title.find('.form-note').remove(); | 
|---|
|  | 17 | order = title.find('input[name*=order]'); | 
|---|
|  | 18 | link = $('<a href="#" alt="expand" class="aexpand"/>').append(title.text()); | 
|---|
|  | 19 | title.empty().append(order).append(link); | 
|---|
| [1648] | 20 |  | 
|---|
|  | 21 | var img = document.createElement('img'); | 
|---|
|  | 22 | img.src = dotclear.img_plus_src; | 
|---|
|  | 23 | img.alt = dotclear.img_plus_alt; | 
|---|
|  | 24 | img.className = 'expand'; | 
|---|
|  | 25 | $(img).css('cursor','pointer'); | 
|---|
| [1659] | 26 | img.onclick = function() { dotclear.viewPostContent($(this).parents('li')); }; | 
|---|
|  | 27 | link.click(function(e) { | 
|---|
|  | 28 | e.preventDefault(); | 
|---|
|  | 29 | dotclear.viewPostContent($(this).parents('li')); | 
|---|
|  | 30 | }); | 
|---|
| [1648] | 31 |  | 
|---|
|  | 32 | title.prepend(img); | 
|---|
|  | 33 | }; | 
|---|
|  | 34 |  | 
|---|
|  | 35 | dotclear.viewPostContent = function(line,action) { | 
|---|
|  | 36 | var action = action || 'toogle'; | 
|---|
| [1659] | 37 | var img = line.find('.expand'); | 
|---|
| [1648] | 38 | var isopen = img.attr('alt') == dotclear.img_plus_alt; | 
|---|
|  | 39 |  | 
|---|
|  | 40 | if( action == 'close' || ( action == 'toogle' && !isopen ) ) { | 
|---|
| [1659] | 41 | line.find('.widgetSettings').hide(); | 
|---|
| [1648] | 42 | img.attr('src', dotclear.img_plus_src); | 
|---|
|  | 43 | img.attr('alt', dotclear.img_plus_alt); | 
|---|
|  | 44 | } else if ( action == 'open' || ( action == 'toogle' && isopen ) ) { | 
|---|
| [1659] | 45 | line.find('.widgetSettings').show(); | 
|---|
| [1648] | 46 | img.attr('src', dotclear.img_minus_src); | 
|---|
|  | 47 | img.attr('alt', dotclear.img_minus_alt); | 
|---|
|  | 48 | } | 
|---|
|  | 49 |  | 
|---|
|  | 50 | }; | 
|---|
|  | 51 |  | 
|---|
|  | 52 | $(function() { | 
|---|
| [1651] | 53 | // reset | 
|---|
| [0] | 54 | $('input[name="wreset"]').click(function() { | 
|---|
|  | 55 | return window.confirm(dotclear.msg.confirm_widgets_reset); | 
|---|
|  | 56 | }); | 
|---|
|  | 57 |  | 
|---|
| [1651] | 58 | // plier/déplier | 
|---|
| [1648] | 59 | $('#dndnav > li, #dndextra > li, #dndcustom > li').each(function() { | 
|---|
|  | 60 | dotclear.postExpander(this); | 
|---|
| [1659] | 61 | dotclear.viewPostContent($(this), 'close'); | 
|---|
| [1648] | 62 | }); | 
|---|
| [0] | 63 |  | 
|---|
| [1651] | 64 | // remove | 
|---|
|  | 65 | $('input[name*=rem]').change(function () { | 
|---|
|  | 66 | if ($(this).attr("checked")) { | 
|---|
|  | 67 | $(this).parents('li').remove(); | 
|---|
|  | 68 | } | 
|---|
|  | 69 | }); | 
|---|
| [0] | 70 |  | 
|---|
| [1651] | 71 | }); | 
|---|