nestablejs
Version:
NestableJS is a javascript library for creating drag & drop heirarchical lists.
208 lines (187 loc) • 11.7 kB
HTML
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link href="https://mobius1.github.io/NestableJS/assets/css/pace.min.css" rel="stylesheet">
<link href="https://mobius1.github.io/NestableJS/assets/fontawesome/css/all.css" rel="stylesheet">
<link rel="stylesheet" href="//cdn.materialdesignicons.com/4.5.95/css/materialdesignicons.min.css">
<link href="https://mobius1.github.io/NestableJS/assets/themify-icons/themify-icons.min.css" rel="stylesheet">
<link href="https://mobius1.github.io/NestableJS/assets/css/metisMenu.min.css" rel="stylesheet">
<link href="https://mobius1.github.io/NestableJS/assets/css/github.min.css" rel="stylesheet">
<link href="https://mobius1.github.io/NestableJS/assets/css/prism.css" rel="stylesheet">
<link href="https://mobius1.github.io/NestableJS/assets/css/style.css" rel="stylesheet">
<link href="https://mobius1.github.io/NestableJS/assets/css/demos/dropzone.css" rel="stylesheet">
<title>NestableJS - DOCS</title>
<!-- Favicon -->
<link rel="icon" type="image/png" href="https://mobius1.github.io/NestableJS/assets/img/favicon.png" />
</head>
<body class="sidebar-layout">
<nav class="navbar navbar-top">
<a class="navbar-brand" href="index-2.html">
<img src="https://mobius1.github.io/NestableJS/assets/img/logo.png" alt="">
</a>
<button class="navbar-toggler" type="button" id="sidebarCollapse">
<span class="navbar-toggler-icon"></span>
</button>
</nav>
<nav id="sidebar">
<div class="sidebar-header">
<h3><i class="mdi mdi-format-list-bulleted-square"></i><span>Nestable</span>JS</h3>
<div class="dropdown version">
<a class="ver-drop dropdown-toggle" href="#" role="button" id="versionDropdownMenu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
v0.13.1
</a>
<div class="dropdown-menu" aria-labelledby="versionDropdownMenu">
<div>Versions</div>
</div>
</div>
<div class="form-group has-search">
<span class="ti-search form-control-feedback"></span>
<input type="text" class="form-control" placeholder="Search docs ...">
</div>
<!-- /.Actual search box -->
</div>
<ul class="metismenu sidebarMenu list-unstyled" id="sidebarMenu">
<li><a href="https://mobius1.github.io/SelectableJS/index.html">Home</a></li>
<li>
<a class="has-arrow" href="#" aria-expanded="false">Overview</a>
<ul aria-expanded="false">
<li><a href="api/index.html">Introduction</a></li>
<li><a href="api/getting-started.html">Getting Started</a></li>
</ul>
</li>
<li class="active">
<a class="has-arrow" href="#" aria-expanded="true">API</a>
<ul aria-expanded="true">
<li>
<a class="has-arrow" href="api/options.html">Options</a>
<ul aria-expanded="true">
</ul>
</li>
<li>
<a href="api/public-methods.html">Public Methods</a>
<ul aria-expanded="true">
</ul>
</li>
<li><a href="api/events.html">Events</a></li>
</ul>
</li>
</ul>
</nav>
<!-- /.End of Sidebar Holder -->
<div class="page-content">
<div class="content-wrapper">
<div class="row">
<div class="col-md-9 content">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="#">Home</a></li>
<li class="breadcrumb-item"><a href="#">Demos</a></li>
<li class="breadcrumb-item active">Dropzone</li>
</ol>
</nav>
<!-- /.End of breadcrumb -->
<div class="doc-content">
<p data-height="800" data-theme-id="0" data-slug-hash="jQoXOw" data-default-tab="result" data-user="Mobius1" data-pen-title="jQoXOw" class="codepen">See the Pen <a href="https://codepen.io/Mobius1/pen/jQoXOw/">jQoXOw</a> by Karl Saunders (<a href="https://codepen.io/Mobius1">@Mobius1</a>) on <a href="https://codepen.io">CodePen</a>.</p>
<script async src="https://static.codepen.io/assets/embed/ei.js"></script>
<p>
<pre class="language-js"><code>/* --------- DROPZONE INSTANCE --------- */
const DROPZONE = new Dropzone("#dropzone", {
autoProcessQueue: false,
clickable: '#addFiles',
});
/* --------- SELECTABLE INSTANCE --------- */
const SELECTABLE = new Selectable({
appendTo: "#dropzone",
ignore: "[data-dz-remove]", // stop remove button triggering selection
});
/* --------- SELECTABLE EVENTS --------- */
SELECTABLE.on("end", (e, selected) => {
// show the "removeFiles" button if we have selected files
removeFiles.classList.toggle("active", selected.length);
});
/* --------- DROPZONE EVENTS --------- */
DROPZONE.on("addedfile", function(file) {
const el = file.previewElement;
// add element to Selectable instance when added by Dropzone
SELECTABLE.add(el);
});
DROPZONE.on("removedfile", function(file) {
const el = file.previewElement;
// remove element from Selectable instance when removed by Dropzone
SELECTABLE.remove(el);
});
/* --------- BUTTONS --------- */
const removeFiles = document.getElementById("removeFiles");
removeFiles.addEventListener("click", e => {
// get files
const files = DROPZONE.files;
if ( files.length ) {
for ( const file of files ) {
// get the item instance from Selectable
const el = SELECTABLE.get(file.previewElement);
// if it's selected, then remove it.
// Dropzone is set to listen to "removedfile" and
// will remove it from the Selectable instance
if ( el.selected ) {
DROPZONE.removeFile(file);
// hide the button
removeFiles.classList.remove("active");
}
}
}
});
</code></pre>
</p>
</div>
<!-- /.End of documentation text content -->
<div class="footer-btn d-flex justify-content-between">
<!-- <a href="#" class="btn"><i class="fas fa-arrow-circle-left"></i>Previous</a> -->
<a href="options.html" class="btn">Next<i class="fas fa-arrow-circle-right"></i></a>
</div>
<!-- /.End of footer button -->
</div>
<div class="col-md-3 d-none d-sm-none d-md-block rightSidebar">
<ul class="section-nav" id="section-nav">
</ul>
<!-- /.End of section nav -->
</div>
</div>
</div>
<footer class="site-footer">
<div class="row align-items-center ">
<div class="col-md-7 order-md-first order-last">
<div class="Copyright-text">
<p class="m-0">Copyright © 2018 <a href="#" target="_blank">Karl Saunders</a>. All rights reserved. </p>
<p class="m-0 d-none d-sm-block">Built with <a href="#" target="_blank">bdtask </a> using a <a href="#" target="_blank">theme</a> provided by <a href="#" target="_blank">docBanao.</a></p>
</div>
</div>
<div class="col-md-5">
<ul class="footer-menu">
<li><a href="#">Terms of use </a></li>
<li><a href="changelog.html">Changelog</a></li>
</ul>
</div>
</div>
</footer><!-- /.End of site footer -->
</div><!-- /.Page Content Holder -->
<div class="overlay"></div>
<!-- Optional JavaScript -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<script src="https://mobius1.github.io/NestableJS/assets/js/pace.min.js"></script>
<script src="https://mobius1.github.io/NestableJS/assets/js/jquery.dd.min.js"></script>
<script src="https://mobius1.github.io/NestableJS/assets/js/metisMenu.min.js"></script>
<script src="https://mobius1.github.io/NestableJS/assets/js/ResizeSensor.min.js"></script>
<script src="https://mobius1.github.io/NestableJS/assets/js/theia-sticky-sidebar.min.js"></script>
<script type="text/javascript" src="https://mobius1.github.io/NestableJS/assets/js/prism.min.js"></script>
<script type="text/javascript" src="https://rawgit.com/enyo/dropzone/master/dist/dropzone.js"></script>
<script id="main-js" type="text/javascript" src="https://unpkg.com/nestablejs@0.2.0/dist/nestable.js"></script>
<script src="https://mobius1.github.io/NestableJS/assets/js/script.js"></script>
</body>
</html>