Changeset 3815:267811f4aafb for admin/js/common.js
- Timestamp:
- 08/22/18 11:57:07 (7 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/js/common.js
r3805 r3815 164 164 (function($) { 165 165 $.expandContent = function(opts) { 166 var defaults = {};167 $.expandContent.options = $.extend({}, defaults, opts);168 166 if (opts == undefined || opts.callback == undefined || !$.isFunction(opts.callback)) { 169 167 return; 170 168 } 171 169 if (opts.line != undefined) { 172 multipleExpander(opts.line, opts.lines );170 multipleExpander(opts.line, opts.lines, opts.callback); 173 171 } 174 172 opts.lines.each(function() { 175 singleExpander(this );176 }); 177 }; 178 var singleExpander = function singleExpander(line ) {173 singleExpander(this, opts.callback); 174 }); 175 }; 176 var singleExpander = function singleExpander(line, callback) { 179 177 $('<input class="details-cmd" type="submit" value="' + dotclear.img_plus_txt + '" aria-label="' + dotclear.img_plus_alt + '"/>').click(function(e) { 180 178 toggleArrow(this); 181 $.expandContent.options.callback.call(this,line);179 callback(line); 182 180 e.preventDefault(); 183 181 }).prependTo($(line).children().get(0)); // first td 184 182 }; 185 var multipleExpander = function multipleExpander(line, lines ) {183 var multipleExpander = function multipleExpander(line, lines, callback) { 186 184 $('<input class="details-cmd" type="submit" value="' + dotclear.img_plus_txt + '" aria-label="' + dotclear.img_plus_alt + '"/>').click(function(e) { 187 var that = this;188 185 var action = toggleArrow(this); 189 186 lines.each(function() { 190 187 toggleArrow(this.firstChild.firstChild, action); 191 $.expandContent.options.callback.call(that,this, action);188 callback(this, action); 192 189 }); 193 190 e.preventDefault();
Note: See TracChangeset
for help on using the changeset viewer.