Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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

Save Automatically?

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

              
                <html>
<head>
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <script src='//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'></script>
  <script src='//bonanzapublic.s3.amazonaws.com/assets/burn_bundle.js?20150605'></script>

  <!-- Instantiate burn widget -->
  <script type='text/javascript'>
    var burnWidget = new BONZ.BurnWidget({
      apiKey: 'wvr2tks22d4zkmk',
      userId: 'eric-demo', // A unique id that identifies this user within *your* application
      onIndex: function(jsonResponse) {
        // Callback to be triggered when requesting all burns for this user
        console.log(jsonResponse);
      },
      onShow: function(imageSelector, jsonResponse) {
        // Callback to be triggered after the show/edit burn is popped up
        console.log(imageSelector);
        console.log(jsonResponse);
      },
      onCreate: function(imageSelector, jsonResponse) {
        // Callback to be triggered after a burn is queued/created.
        // We recommend adding your own functionality to save the id and user_id the returned in jsonResponse
        console.log(imageSelector);
        console.log(jsonResponse);
      },
      onSave: function(imageSelector, jsonResponse) {
        // Callback to be triggered after the user selects a final mask
        // We recommend adding your own functionality to save the final_result_url the returned in jsonResponse
        console.log(jsonResponse);
        $(imageSelector).attr('src', jsonResponse.final_result_url);
      },
      onError: function(message) {
        // Callback to be triggered if the API action raises an exception
        console.log(message);
      }
    });
    
    function burn(form) {
      burnWidget.launch({ url: $('input[type=text]', $(form)).val() });
      $('input[type=text]', $(form)).val('');
    }

    function burnImage() {
      // Queues a new burn from the src of the image element
      burnWidget.launch({ image: $('#image1') });
    }
    
    function burnURL(el) {
      // Queues a new burn from a URL
      burnWidget.launch({ url: $(el).attr('href') });
    }
    
    function showBurnByID(id) {
      // Shows the progress of the background burn with the specified id.
      burnWidget.launch({ id: id });
    }
    
    function showBurnByImage() {
      // Gets the id of the background burn from the data-id attribute,
      // and shows the progress of the burn.
      burnWidget.launch({ image: $('#image2') });
    }

    function viewBurns() {
      // Gets all in progress/complete burns for the user identified
      // by the userId parameter when instantiating a new BONZ.BurnWidget.
      burnWidget.launch();
    }
  </script>
</head>
<body>
  <h2>Burn any image accessible via a web browser</h2>
  <p>Enter a URL to an image in the box below.</p>
  <form action='#' method='post' onsubmit='burn(this); return false;'>
    <input type='text' name='remoteUrl' style='width: 400px;' />
    <input type='submit' />
  </form>
  
  <h2>Queue a burn using the <tt>src</tt> attribute of an <tt>img</tt> element.</h2>
  <img id='image1' src='https://bonanzaimagestest.s3.amazonaws.com/uploads/burnees/1432752586-1964-6184.jpg' style='width: 25%' />
  <p><a href='#' onclick='burnImage(); return false;'>Burn image</a></p>
  
  <h2>Queue a burn from a remote URL</h2>
  <p><a href='https://bonanzaimagestest.s3.amazonaws.com/uploads/burnees/1432752586-1964-6184.jpg' onclick='burnURL(this); return false;'>Burn URL</a></p>
  
  <h2>View the progress/edit a previously queued image</h2>
  <p>This example shows the progress of the Background Burn with the ID of 10297598</p>
  <p><a href='#' onclick='showBurnByID(10297598); return false;'>Show burn by ID</a></p>
  
  <p>This example shows the progress of the Background Burn with the ID of 6653207</p>
  <img id='image2' src='http://www.bonanza.com/background_masks/15807159.png?1397051807&composite=1' data-id='6653207' />
  <p><a href='#' onclick='showBurnByImage(); return false;'>Show burn by image</a></p>
  
  <h2>View all burns for a specific user</h2>
  <p><a href='#' onclick='viewBurns(); return false;'>View all burns</a>.</p>
</body>
</html>

              
            
!

CSS

              
                
              
            
!

JS

              
                
              
            
!
999px

Console