Not my stuff, but from http://davidsimpson.me/2014/02/06/responsive-gallery-a-user-macro-for-atlassian-confluence/

Name

Responsive Gallery

Macro Body Processing

Render HTML

Output format

HTML

Usage



Code

## Macro: responsive-gallery## Macro title: Responsive Gallery
## Macro has a body: N
## Body processing: n/a
## Output: HTML
##
## Developed by: David Simpson <david@davidsimpson.me>
## Date created: 2013-11-20
## Installed by: My Name
  
## @noparams
  
<ac:structured-macro ac:name="gallery" />
  
<script>
  (function() { // from: http://stackoverflow.com/a/8584217/1958200
    jQuery.fn.changeElementType = function(newType) {
      var attrs = {};
      jQuery.each(this[0].attributes, function(idx, attr) {
        attrs[attr.nodeName] = attr.nodeValue;
      });
      this.replaceWith(function() {
        return jQuery("<" + newType + "/>", attrs).append($(this).contents());
      });
    }
  })(jQuery);
  
  jQuery("td.gallery-image")
    .unwrap().unwrap().unwrap() // unwrap tr, tbody & table 
    .changeElementType("span");
  jQuery('.gallery tr').remove(); // remove extra rows
  jQuery('a.gallery-link').css({'display':'inline'}); // fix styles
</script>

 

 

  • Ingen etiketter