[0] | 1 | $(function() { |
---|
[2287] | 2 | // expend theme info |
---|
[2195] | 3 | $('.module-sshot').not('.current-theme .module-sshot').each(function(){ |
---|
| 4 | var bar = $('<div>').addClass('bloc-toggler'); |
---|
| 5 | $(this).after( |
---|
| 6 | $(bar).toggleWithLegend($(this).parent().children('.toggle-bloc'),{ |
---|
| 7 | img_on_src: dotclear.img_plus_theme_src, |
---|
| 8 | img_on_alt: dotclear.img_plus_theme_alt, |
---|
| 9 | img_off_src: dotclear.img_minus_theme_src, |
---|
[2290] | 10 | img_off_alt: dotclear.img_minus_theme_alt, |
---|
[2195] | 11 | legend_click: true |
---|
| 12 | })); |
---|
[2290] | 13 | $(this).children('img').click(function(){ |
---|
| 14 | $(this).parent().parent().children('.bloc-toggler').click(); |
---|
| 15 | }); |
---|
[2192] | 16 | }); |
---|
[2287] | 17 | |
---|
| 18 | // dirty short search blocker |
---|
| 19 | $('div.modules-search form input[type=submit]').click(function(){ |
---|
| 20 | var mlen = $('input[name=m_search]',$(this).parent()).val(); |
---|
| 21 | if (mlen.length > 2){return true;}else{return false;} |
---|
| 22 | }); |
---|
[2487] | 23 | |
---|
| 24 | // checkboxes selection |
---|
| 25 | $('.checkboxes-helpers').each(function() { |
---|
| 26 | dotclear.checkboxesHelpers(this); |
---|
| 27 | }); |
---|
| 28 | |
---|
| 29 | // actions tests |
---|
| 30 | $('.modules-form-actions').each(function(){ |
---|
| 31 | var rxActionType = /^[^\[]+/; |
---|
| 32 | var rxActionValue = /([^\[]+)\]$/; |
---|
| 33 | var checkboxes = $(this).find('input[type=checkbox]'); |
---|
| 34 | |
---|
| 35 | // check if submit is a global action or one line action |
---|
| 36 | $("input[type=submit]",this).click(function() { |
---|
| 37 | var keyword = $(this).attr('name'); |
---|
| 38 | var maction = keyword.match(rxActionType); |
---|
| 39 | var action = maction[0]; |
---|
| 40 | var mvalues = keyword.match(rxActionValue); |
---|
| 41 | |
---|
| 42 | // action on multiple modules |
---|
| 43 | if (!mvalues) { |
---|
| 44 | var checked = false; |
---|
| 45 | |
---|
| 46 | // check if there is checkboxes in form |
---|
| 47 | if(checkboxes.length > 0) { |
---|
| 48 | // check if there is at least one checkbox checked |
---|
| 49 | $(checkboxes).each(function() { |
---|
| 50 | if (this.checked) { |
---|
| 51 | checked = true; |
---|
| 52 | } |
---|
| 53 | }); |
---|
| 54 | if (!checked) { |
---|
| 55 | //alert(dotclear.msg.no_selection); |
---|
| 56 | return false; |
---|
| 57 | } |
---|
| 58 | } |
---|
| 59 | |
---|
| 60 | // confirm delete |
---|
| 61 | if (action == 'delete') { |
---|
| 62 | return window.confirm(dotclear.msg.confirm_delete_themes); |
---|
| 63 | } |
---|
| 64 | |
---|
| 65 | // action on one module |
---|
| 66 | }else { |
---|
| 67 | var module = mvalues[1]; |
---|
| 68 | |
---|
| 69 | // confirm delete |
---|
| 70 | if (action == 'delete') { |
---|
| 71 | return window.confirm(dotclear.msg.confirm_delete_theme.replace('%s',module)); |
---|
| 72 | } |
---|
| 73 | } |
---|
| 74 | |
---|
| 75 | return true; |
---|
| 76 | }); |
---|
| 77 | }); |
---|
[2566] | 78 | }); |
---|