Changeset 3768:42e99b4be675 for admin/js
- Timestamp:
- 07/06/18 16:37:54 (7 years ago)
- Branch:
- default
- Location:
- admin/js
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/js/_blog_theme.js
r3706 r3768 8 8 $(this).after( 9 9 $(bar).toggleWithLegend($(this).parent().children('.toggle-bloc'), { 10 img_on_ src: dotclear.img_plus_theme_src,10 img_on_txt: dotclear.img_plus_theme_txt, 11 11 img_on_alt: dotclear.img_plus_theme_alt, 12 img_off_ src: dotclear.img_minus_theme_src,12 img_off_txt: dotclear.img_minus_theme_txt, 13 13 img_off_alt: dotclear.img_minus_theme_alt, 14 14 legend_click: true 15 15 })); 16 16 $(this).children('img').click(function() { 17 // Click on theme thumbnail 17 18 $(this).parent().parent().children('.bloc-toggler').click(); 18 19 }); … … 43 44 $('input[type=submit]', this).click(function() { 44 45 var keyword = $(this).attr('name'); 46 if (!keyword) { 47 return true; 48 } 45 49 var maction = keyword.match(rxActionType); 46 50 var action = maction[0]; -
admin/js/_plugins.js
r3762 r3768 6 6 $('table.modules.expandable tr.line').each(function() { 7 7 $('td.module-name, th.module-name', this).toggleWithLegend($(this).next('.module-more'), { 8 img_on_ src: dotclear.img_plus_src,8 img_on_txt: dotclear.img_plus_txt, 9 9 img_on_alt: dotclear.img_plus_alt, 10 img_off_ src: dotclear.img_minus_src,10 img_off_txt: dotclear.img_minus_txt, 11 11 img_off_alt: dotclear.img_minus_alt, 12 12 legend_click: true … … 28 28 $('input[type=submit]', this).click(function() { 29 29 var keyword = $(this).attr('name'); 30 if (!keyword) { 31 return true; 32 } 30 33 var maction = keyword.match(rxActionType); 31 34 var action = maction[0]; -
admin/js/common.js
r3706 r3768 69 69 jQuery.fn.toggleWithLegend = function(target, s) { 70 70 var defaults = { 71 img_on_ src: dotclear.img_plus_src,71 img_on_txt: dotclear.img_plus_txt, 72 72 img_on_alt: dotclear.img_plus_alt, 73 img_off_ src: dotclear.img_minus_src,73 img_off_txt: dotclear.img_minus_txt, 74 74 img_off_alt: dotclear.img_minus_alt, 75 75 unfolded_sections: dotclear.unfolded_sections, … … 96 96 speed = speed || 0; 97 97 if (p.hide) { 98 $(i).get(0). src = p.img_on_src;99 $(i).get(0). alt = p.img_on_alt;98 $(i).get(0).value = p.img_on_txt; 99 $(i).get(0).setAttribute('aria-label', p.img_on_alt); 100 100 target.addClass('hide'); 101 101 } else { 102 $(i).get(0). src = p.img_off_src;103 $(i).get(0). alt = p.img_off_alt;102 $(i).get(0).value = p.img_off_txt; 103 $(i).get(0).setAttribute('aria-label', p.img_off_alt); 104 104 target.removeClass('hide'); 105 105 if (p.fn) { … … 122 122 }; 123 123 return this.each(function() { 124 var i = document.createElement('img'); 125 i.src = p.img_off_src; 126 i.alt = p.img_off_alt; 127 var a = document.createElement('a'); 128 a.href = '#'; 129 $(a).append(i); 130 $(a).css({ 131 border: 'none', 132 outline: 'none' 133 }); 134 var ctarget = p.legend_click ? this : a; 124 var b = document.createElement('input'); 125 b.setAttribute('type', 'submit'); 126 b.className = 'details-cmd'; 127 b.value = p.img_on_txt; 128 b.setAttribute('aria-label', p.img_off_alt); 129 130 var ctarget = p.legend_click ? this : b; 135 131 $(ctarget).css('cursor', 'pointer'); 136 132 if (p.legend_click) { 137 133 $(ctarget).find('label').css('cursor', 'pointer'); 138 134 } 139 $(ctarget).click(function( ) {135 $(ctarget).click(function(e) { 140 136 if (p.user_pref && set_user_pref) { 141 137 if (p.hide ^ p.reverse_user_pref) { … … 158 154 }); 159 155 } 160 toggle(i, p.speed); 156 toggle(b, p.speed); 157 e.preventDefault(); 161 158 return false; 162 159 }); 163 toggle($( i).get(0));164 $(this).prepend( ' ').prepend(a);160 toggle($(b).get(0)); 161 $(this).prepend(b); 165 162 }); 166 163 }; … … 180 177 }; 181 178 var singleExpander = function singleExpander(line) { 182 $('<input type="image" src="' + dotclear.img_plus_src + '" alt="' + dotclear.img_plus_alt + '"/>').click(function(e) {179 $('<input class="details-cmd" type="submit" value="' + dotclear.img_plus_txt + '" aria-label="' + dotclear.img_plus_alt + '"/>').click(function(e) { 183 180 toggleArrow(this); 184 181 $.expandContent.options.callback.call(this, line); … … 187 184 }; 188 185 var multipleExpander = function multipleExpander(line, lines) { 189 $('<input type="image" src="' + dotclear.img_plus_src + '" alt="' + dotclear.img_plus_alt + '"/>').click(function(e) {186 $('<input class="details-cmd" type="submit" value="' + dotclear.img_plus_txt + '" aria-label="' + dotclear.img_plus_alt + '"/>').click(function(e) { 190 187 var that = this; 191 188 var action = toggleArrow(this); … … 200 197 action = action || ''; 201 198 if (action == '') { 202 if (button. alt== dotclear.img_plus_alt) {199 if (button.getAttribute('aria-label') == dotclear.img_plus_alt) { 203 200 action = 'open'; 204 201 } else { … … 207 204 } 208 205 if (action == 'open') { 209 button. src = dotclear.img_minus_src;210 button. alt = dotclear.img_minus_alt;211 } else { 212 button. src = dotclear.img_plus_src;213 button. alt = dotclear.img_plus_alt;206 button.value = dotclear.img_minus_txt; 207 button.setAttribute('aria-label', dotclear.img_minus_alt); 208 } else { 209 button.value = dotclear.img_plus_txt; 210 button.setAttribute('aria-label', dotclear.img_plus_alt); 214 211 } 215 212 return action; … … 221 218 } 222 219 var p = { 223 img_on_ src: dotclear.img_plus_src,220 img_on_txt: dotclear.img_plus_txt, 224 221 img_on_alt: dotclear.img_plus_alt, 225 img_off_ src: dotclear.img_minus_src,222 img_off_txt: dotclear.img_minus_txt, 226 223 img_off_alt: dotclear.img_minus_alt 227 224 }; … … 247 244 }; 248 245 var textToggler = function(o) { 249 var i = $('<img src="' + p.img_on_src + '" alt="' + p.img_on_alt + '"/>');246 var b = $('<input class="details-cmd" type="submit" value="' + p.img_on_txt + '" aria-label="' + p.img_on_alt + '"/>'); 250 247 o.css('cursor', 'pointer'); 251 248 var hide = true; 252 o.prepend(' ').prepend( i);249 o.prepend(' ').prepend(b); 253 250 o.click(function() { 254 251 $(this).nextAll().each(function() { … … 261 258 }); 262 259 hide = !hide; 263 var img = $(this).find('i mg');260 var img = $(this).find('input.details-cmd'); 264 261 if (!hide) { 265 img.attr('src', p.img_off_src); 266 } else { 267 img.attr('src', p.img_on_src); 262 img.attr('value', p.img_off_txt); 263 img.attr('aria-label', p.img_off_alt); 264 } else { 265 img.attr('value', p.img_on_txt); 266 img.attr('aria-label', p.img_on_alt); 268 267 } 269 268 }); … … 278 277 var img = $('<p id="help-button"><span><a href="">' + dotclear.msg.help + '</a></span></p>'); 279 278 var select = $(); 280 img.click(function( ) {279 img.click(function(e) { 281 280 return toggle(); 281 e.preventDefault(); 282 282 }); 283 283 $('#content').append(img);
Note: See TracChangeset
for help on using the changeset viewer.