Permalink
Browse files

v0.2.0

  • Loading branch information...
1 parent 3e32179 commit 78e940cb23dda60fa39b574ed06bc02f99eae83d @niklasramo niklasramo committed Sep 28, 2016
View
@@ -2,4 +2,6 @@ language: node_js
node_js:
- "4"
env:
- email: false
+ global:
+ - secure: VUU14zf9WKf/lRHKJInITvdvgppXDgrM0UYSxe3EvO5ElQKCivB/lHddIIUA8mdwQz5i5GCizrePssLr1OR0dfF98s33pYIuN4Enrpkyq7X90pKr7ru3ZrwrqLH2PC5U6ta4GppVsrgFYmRHpuwhGlm0Fpf0obGweTGXwsZtCBQ=
+ - secure: lsrw8vXXY6eOHxEGh3oB57zEtUlw1tt0CnJ8PLRGb2twumDpzKeeAKXSJjvbb13csGZvJbesOgpufdXtFIoT9LraGLA14xBBS7xVTPuhr0NCEC/MEpsXVvNkS10Vd+VsEtNMvPpMe4a0vRkNge+IlhQY4pRpnME14kaniF9BiCE=
View
@@ -0,0 +1,3 @@
+Authors ordered by first contribution.
+
+Niklas Rämö <inramo@gmail.com>
Binary file not shown.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
@@ -4,20 +4,17 @@
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
- <title>Muuri - A dynamic grid layout with built-in support for dragging and dropping grid items.</title>
+ <title>Muuri</title>
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1">
- <link rel="stylesheet" href="styles/normalize.css">
<link rel="stylesheet" href="styles/main.css">
- <link href='https://fonts.googleapis.com/css?family=Fira+Sans:400,300,300italic,400italic,500,500italic,700,700italic' rel='stylesheet' type='text/css'>
- <script src="scripts/vendor/palikka.js"></script>
</head>
<body>
<section id="demo">
<div class="container">
- <div class="btn-group" role="group" aria-label="...">
+ <div class="btn-group">
<button type="button" class="btn btn-default demo-init">Init</button>
<button type="button" class="btn btn-default demo-destroy">Destroy</button>
<button type="button" class="btn btn-default demo-show">Show</button>
@@ -35,9 +32,6 @@
</section>
<script src="scripts/vendor/jquery.js"></script>
- <script src="scripts/vendor/bootstrap.js"></script>
- <script src="scripts/vendor/lodash.js"></script>
- <script src="scripts/vendor/mezr.js"></script>
<script src="scripts/vendor/velocity.js"></script>
<script src="scripts/vendor/hammer.js"></script>
<script src="../muuri.js"></script>
View
@@ -1,43 +1,24 @@
-palikka
-.define(['jQuery'], function () {
-
- return window[this.id];
-
-})
-.define('docReady', ['jQuery'], function ($) {
-
- return palikka.defer(function (resolve) {
- $(resolve);
- });
-
-})
-.define('demo', ['jQuery', 'docReady'], function ($) {
+$(function () {
var m = {};
var $grid = $('.grid');
var $root = $('html');
var uuid = 0;
-
- m.grid = null;
-
- m.init = function () {
-
- init();
-
- // Bind events.
- $('.demo-init').on('click', init);
- $('.demo-destroy').on('click', destroy);
- $('.demo-show').on('click', show);
- $('.demo-hide').on('click', hide);
- $('.demo-add').on('click', add);
- $('.demo-remove').on('click', remove);
- $('.demo-refresh').on('click', refresh);
- $('.demo-layout').on('click', layout);
- $('.demo-synchronize').on('click', synchronize);
-
- return m;
-
- };
+ var grid = null;
+
+ // Bind events.
+ $('.demo-init').on('click', init);
+ $('.demo-destroy').on('click', destroy);
+ $('.demo-show').on('click', show);
+ $('.demo-hide').on('click', hide);
+ $('.demo-add').on('click', add);
+ $('.demo-remove').on('click', remove);
+ $('.demo-refresh').on('click', refresh);
+ $('.demo-layout').on('click', layout);
+ $('.demo-synchronize').on('click', synchronize);
+
+ // Init.
+ init();
//
// Helper utilities
@@ -73,18 +54,19 @@ palikka
function init() {
- if (!m.grid) {
+ if (!grid) {
var dragCounter = 0;
- m.grid = new Muuri({
+ grid = new Muuri({
container: $grid.get(0),
items: generateElements(20),
+ dragEnabled: true,
dragReleaseEasing: 'ease-in',
dragContainer: document.body
});
- m.grid
+ grid
.on('dragstart', function () {
++dragCounter;
$root.addClass('dragging');
@@ -101,19 +83,19 @@ palikka
function destroy() {
- if (m.grid) {
- m.grid.destroy();
+ if (grid) {
+ grid.destroy();
$grid.empty();
- m.grid = null;
+ grid = null;
uuid = 0;
}
}
function show() {
- if (m.grid) {
- m.grid.show(_.sampleSize(m.grid.get('inactive'), 5), function (items) {
+ if (grid) {
+ grid.show(grid.get('inactive').slice(0, 5), function (items) {
console.log('CALLBACK: Hide ' + items.length + ' items');
});
}
@@ -122,8 +104,8 @@ palikka
function hide() {
- if (m.grid) {
- m.grid.hide(_.sampleSize(m.grid.get('active'), 5), function (items) {
+ if (grid) {
+ grid.hide(grid.get('active').slice(0, 5), function (items) {
console.log('CALLBACK: Hide ' + items.length + ' items');
});
}
@@ -132,12 +114,12 @@ palikka
function add() {
- if (m.grid) {
+ if (grid) {
var items = generateElements(5);
items.forEach(function (item) {
item.style.display = 'none';
});
- m.grid.show(m.grid.add(items), function (items) {
+ grid.show(grid.add(items), function (items) {
console.log('CALLBACK: Added ' + items.length + ' items');
});
}
@@ -146,9 +128,9 @@ palikka
function remove() {
- if (m.grid) {
- m.grid.hide(_.sampleSize(m.grid.get('active'), 5), function (items) {
- m.grid.remove(items, true);
+ if (grid) {
+ grid.hide(grid.get('active').slice(0, 5), function (items) {
+ grid.remove(items, true);
console.log('CALLBACK: Removed ' + items.length + ' items');
});
}
@@ -157,8 +139,8 @@ palikka
function layout() {
- if (m.grid) {
- m.grid.layout(function () {
+ if (grid) {
+ grid.layout(function () {
console.log('CALLBACK: Layout');
});
}
@@ -167,20 +149,18 @@ palikka
function refresh() {
- if (m.grid) {
- m.grid.refresh();
+ if (grid) {
+ grid.refresh();
}
}
function synchronize() {
- if (m.grid) {
- m.grid.synchronize();
+ if (grid) {
+ grid.synchronize();
}
}
- return m.init();
-
});
Oops, something went wrong.

0 comments on commit 78e940c

Please sign in to comment.