Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div>
  <svg width="0" height="0" style="position:absolute">
    <symbol id="uploadcare--icon-localhistory" veiwBox="0 0 32 32">
      <g>
        <path
          d="M21.3,5c-2.9-1.3-6.2-1.4-9.2-0.2C10.1,5.6,8.3,6.9,7,8.6L6.5,6.8C6.4,6.2,5.9,5.9,5.3,6C4.8,6.2,4.5,6.7,4.6,7.2l1,4.1   c0.1,0.5,0.5,0.8,1,0.8c0.1,0,0.2,0,0.2,0l4.1-1c0.5-0.1,0.9-0.7,0.7-1.2C11.6,9.3,11,9,10.5,9.2L8.8,9.6c1.1-1.3,2.4-2.3,4-2.9   c2.5-1,5.2-0.9,7.7,0.2c2.4,1.1,4.3,3,5.3,5.5c1,2.5,0.9,5.2-0.2,7.7s-3,4.3-5.5,5.3c-3.5,1.3-7.4,0.7-10.2-1.8   c-1.2-1.1-2.2-2.4-2.8-3.9c-0.2-0.5-0.8-0.8-1.3-0.6c-0.5,0.2-0.8,0.8-0.6,1.3c0.7,1.8,1.9,3.5,3.3,4.7c2.2,1.9,5,2.9,7.9,2.9   c1.5,0,2.9-0.3,4.3-0.8c3-1.2,5.3-3.4,6.6-6.3c1.3-2.9,1.4-6.2,0.2-9.2S24.3,6.3,21.3,5z"
        />
        <path
          d="M16.5,10c-0.6,0-1,0.4-1,1v6c0,0.3,0.1,0.6,0.4,0.8l4,3c0.2,0.1,0.4,0.2,0.6,0.2c0.3,0,0.6-0.1,0.8-0.4   c0.3-0.4,0.2-1.1-0.2-1.4l-3.6-2.7V11C17.5,10.4,17.1,10,16.5,10z"
        />
      </g>
    </symbol>
  </svg>
  <p>
    This widget will upload images only, plus crop:
    <input
      type="hidden"
      role="uploadcare-uploader"
      data-tabs="file camera dropbox localhistory"
      data-images-only=""
      data-crop=""
    />
  </p>
  <p>
    This widget will upload multiple file types:
    <input
      type="hidden"
      role="uploadcare-uploader"
      data-tabs="file camera dropbox localhistory"
      data-multiple=""
    />
  </p>
</div>

              
            
!

CSS

              
                body {
	margin: 16px;
}

p {
	margin: 8px 0;
}

code {
  font-family: monospace;
}

.uploadcare--tab_name_localhistory .uploadcare--tab__content {
	padding-left: 0;
	padding-right: 0;
}
              
            
!

JS

              
                uploadcare.registerTab('localhistory', function(container, button, dialogApi, settings, name) {
  function loadItems() {
    // Format: UUID isImage size filename
    var items = localStorage.getItem(localKey)

    if (!items) {
      return []
    }
    items = items.split('\n')
    for (var i = 0; i < items.length; i++) {
      var v = items[i].split(' ')

      v.splice(3, v.length, v.slice(3, v.length).join(' '))
      v[1] = !!parseInt(v[1])
      v[2] = parseInt(v[2])
      items[i] = v
    }

    return items
  }
  function saveItems(items) {
    items = items.slice(0, 100)
    for (var i = 0; i < items.length; i++) {
      var v = items[i].slice()

      v[1] = 0 + v[1] // bool → int
      items[i] = v.join(' ')
    }
    localStorage.setItem(localKey, items.join('\n'))
  }
  function addItem(fileInfo) {
    var items = loadItems()

    items = $.grep(items, function(v) {
      return v[0] !== fileInfo.uuid
    })
    var item = [fileInfo.uuid, fileInfo.isImage, fileInfo.size, fileInfo.name]

    items.unshift(item)
    saveItems(items)
  }
  function removeItem(item) {
    var items = loadItems()

    items = $.grep(items, function(v) {
      return v[0] !== item[0]
    })
    saveItems(items)
  }
  function makeItem(data) {
    var html = $('<div class="uploadcare--file uploadcare--files__item"></div>').append([
      $('<div class="uploadcare--file__description"></div>')
        .append([
          $('<div class="uploadcare--file__preview"></div>').append(
            data[1]
              ? $('<img/>', {src: settings.cdnBase + '/' + data[0] + '/-/quality/lightest/-/preview/54x54/'})
              : $(
                '<svg width="32" height="32" role="presentation" class="uploadcare--icon uploadcare--file__icon"><use xlink:href="#uploadcare--icon-file"/></svg>'
              )
          ),
          $('<div class="uploadcare--file__name"></div>').text(data[3]),
          $('<div class="uploadcare--file__size"></div>').text(uc.utils.readableFileSize(data[2])),
        ])
        .on('click', function(e) {
          dialogApi.addFiles('uploaded', [data[0]])
          e.preventDefault()
        }),
      $(
        '<button type="button" class="uploadcare--button uploadcare--button_icon uploadcare--button_muted uploadcare--file__remove">\
         <svg role="presentation" width="32" height="32" class="uploadcare--icon">\
           <use xlink:href="#uploadcare--icon-remove"></use>\
         </svg>\
       </button>'
      ).on('click', function() {
        html.remove()
        removeItem(data)
      }),
    ])


    return html
  }
  function populate(container) {
    var items = loadItems()

    for (var i = items.length - 1; i >= 0; i--) {
      var item = items[i]

      if (settings.imagesOnly && !item[1]) {
        continue
      }
      container.prepend(makeItem(item))
    }
  }
  var localStorage = window.localStorage
  var localKey = 'uploadcare_' + settings.publicKey
  var uc

  if (!localStorage) {
    button.hide()

    return
  }
  uploadcare.plugin(function(uploadcare) {
    uc = uploadcare
  })
  dialogApi.fileColl.onAdd.add(function(file) {
    file.done(function(fileInfo) {
      addItem(fileInfo)
    })
  })
  $(
    '<div class="uploadcare--tab__header">\
    <div class="uploadcare--text uploadcare--text_size_large uploadcare--tab__title">Previously uploaded files</div>\
  </div>'
  ).appendTo(container)
  populate(
    $('<div class="uploadcare--files"></div>')
      .toggleClass('uploadcare--files_type_table', !settings.imagesOnly)
      .toggleClass('uploadcare--files_type_tiles', settings.imagesOnly)
      .appendTo($('<div class="uploadcare--tab__content"></div>').appendTo(container))
  )
})
UPLOADCARE_LOCALE_TRANSLATIONS = {dialog: {tabs: {names: {localhistory: 'History'}}}}

              
            
!
999px

Console