Skip to content

Case Statement for inline code #1

Description

@meskarune

Change the inline image code so that elements is all links (elements[i].href) then use a case statement to do the right thing per type.

            // Display Image Links Inline
            var elements = document.querySelectorAll('a[href$=".png"], a[href$=".jpg"], a[href$=".gif"]'),
                l = elements.length, i, current;
            for(i=0; i<l; i++) {
                current = elements[i];
                var href = current.getAttribute('href');
                current.innerHTML = '<img width="100" src="' + href + '" >';
            }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions