Browse Source

rename as 'Molequul'

pull/14/head
desandro 15 years ago
parent
commit
27c8457477
  1. 8
      README.md
  2. 14
      docs/animating-css-transitions.html
  3. 14
      docs/animating-jquery.html
  4. 24
      docs/appending.html
  5. 14
      docs/basic-multi-column.html
  6. 14
      docs/basic-single-column.html
  7. 2
      docs/css/style.css
  8. 40
      docs/filtering-hashes.html
  9. 22
      docs/filtering.html
  10. 50
      docs/index.html
  11. 32
      docs/infinite-scroll.html
  12. 2
      docs/js/rando-lorem-text.js
  13. 10
      docs/pages/2.html
  14. 10
      docs/pages/3.html
  15. 10
      docs/pages/4.html
  16. 10
      docs/pages/5.html
  17. 14
      docs/tumblelog.html
  18. 90
      jquery.molequul.js

8
README.md

@ -1,12 +1,12 @@
jQuery Mercutio
jQuery Molequul
==============
Mercutio is a layout plugin for jQuery. Think of it as the flip side of CSS floats. Whereas floating arranges elements horizontally then vertically, Mercutio arranges elements vertically then horizontally according to a grid. The result minimizes vertical gaps between elements of varying height, just like a mason fitting stones in a wall.
Molequul is a layout plugin for jQuery. Think of it as the flip side of CSS floats. Whereas floating arranges elements horizontally then vertically, Molequul arranges elements vertically then horizontally according to a grid. The result minimizes vertical gaps between elements of varying height, just like a mason fitting stones in a wall.
The primer in docs/index.html has all the documentation to get you started.
Code repository: [github.com/desandro/mercutio](http://github.com/desandro/mercutio)
Code repository: [github.com/desandro/molequul](http://github.com/desandro/molequul)
View the docs live: [desandro.com/demo/mercutio/docs](http://desandro.com/demo/mercutio/docs/)
View the docs live: [desandro.com/demo/molequul/docs](http://desandro.com/demo/molequul/docs/)
Copyright (c) 2010 David DeSandro, licensed MIT

14
docs/animating-css-transitions.html

@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery Mercutio &rsaquo; Animating with CSS transitions</title>
<title>jQuery Molequul &rsaquo; Animating with CSS transitions</title>
<link rel="stylesheet" href="css/style.css" media="screen" />
<style media="screen">
@ -20,7 +20,7 @@
<body>
<div id="site-nav">
<h1>jQuery Mercutio</h1>
<h1>jQuery Molequul</h1>
<ul>
<li><a href=".">Primer</a></li>
<li><a href="basic-single-column.html">Basic single-column</a></li>
@ -49,9 +49,9 @@
<p>Alternatively, you can rely on CSS3 transitions to animate layout rearrangements. CSS transitions are supported by Firefox 4, Chrome 5, Safari 4, and Opera 10.5.</p>
<p> In your script, leave out the <code>animate</code> option. </p>
<pre id="code"><code><span class="keyword">$</span>(<span class="string">'#demo'</span>).mercutio({ columnWidth: <span class="constant">100</span> });</code></pre>
<pre id="code"><code><span class="keyword">$</span>(<span class="string">'#demo'</span>).molequul({ columnWidth: <span class="constant">100</span> });</code></pre>
<p>In the CSS, add transition properties. Mercutio will add a class of <code>masoned</code> to the container after the first arrangement so transitions can be applied afterward.</p>
<p>In the CSS, add transition properties. Molequul will add a class of <code>masoned</code> to the container after the first arrangement so transitions can be applied afterward.</p>
<pre><code><span class="id">#demo</span><span class="class">.masoned</span>, <span class="id">#demo</span><span class="class">.masoned .box</span> {
<span class="prop">-webkit-transition</span>: <span class="value">all .7s ease-out</span>;
<span class="prop">-moz-transition</span>: <span class="value">all .7s ease-out</span>;
@ -174,7 +174,7 @@
</div> <!-- #demo -->
<p id="footer">
jQuery Mercutio by <a href="http://desandro.com/">David DeSandro</a><br />
jQuery Molequul by <a href="http://desandro.com/">David DeSandro</a><br />
<a href="http://github.com/lrbabe/jquery-smartresize">smartresize jQuery event plugin</a> by Louis-Rémi Babé and <a href="http://paulirish.com/2009/throttled-smartresize-jquery-event-handler/">Paul Irish</a>
</p>
@ -182,11 +182,11 @@
<script src="js/jquery-1.4.2.min.js"></script>
<script src="../jquery.mercutio.js"></script>
<script src="../jquery.molequul.js"></script>
<script>
$(function(){
$('#demo').mercutio({ columnWidth: 100 });
$('#demo').molequul({ columnWidth: 100 });
});
</script>

14
docs/animating-jquery.html

@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery Mercutio &rsaquo; Animating with jQuery</title>
<title>jQuery Molequul &rsaquo; Animating with jQuery</title>
<link rel="stylesheet" href="css/style.css" media="screen" />
@ -12,7 +12,7 @@
<body>
<div id="site-nav">
<h1>jQuery Mercutio</h1>
<h1>jQuery Molequul</h1>
<ul>
<li><a href=".">Primer</a></li>
<li><a href="basic-single-column.html">Basic single-column</a></li>
@ -40,14 +40,14 @@
<div class="copy">
<p>As of version 1.1, rearrangements can be animated when the container is resized.</p>
<pre id="code"><code><span class="keyword">$</span>(<span class="string">'#demo'</span>).mercutio({
<pre id="code"><code><span class="keyword">$</span>(<span class="string">'#demo'</span>).molequul({
columnWidth: <span class="constant">100</span>,
animate: <span class="constant">true</span>
});</code></pre>
<p>Animation options are set with <code>animationOptions</code>. See the <a href="http://api.jquery.com/animate/#animate-properties-options">jQuery API for animate options</a> for details on available animation options.</p>
<pre><code><span class="keyword">$</span>(<span class="string">'#demo'</span>).mercutio({
<pre><code><span class="keyword">$</span>(<span class="string">'#demo'</span>).molequul({
columnWidth: <span class="constant">100</span>,
animate: <span class="constant">true</span>,
animationOptions: {
@ -172,18 +172,18 @@
</div> <!-- #demo -->
<p id="footer">
jQuery Mercutio by <a href="http://desandro.com/">David DeSandro</a><br />
jQuery Molequul by <a href="http://desandro.com/">David DeSandro</a><br />
<a href="http://github.com/lrbabe/jquery-smartresize">smartresize jQuery event plugin</a> by Louis-Rémi Babé and <a href="http://paulirish.com/2009/throttled-smartresize-jquery-event-handler/">Paul Irish</a>
</p>
</div> <!-- #content -->
<script src="js/jquery-1.4.2.min.js"></script>
<script src="../jquery.mercutio.js"></script>
<script src="../jquery.molequul.js"></script>
<script>
$(function(){
$('#demo').mercutio({
$('#demo').molequul({
columnWidth: 100,
animate: true,
animationOptions: {

24
docs/appending.html

@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery Mercutio &rsaquo; Appending new elements</title>
<title>jQuery Molequul &rsaquo; Appending new elements</title>
<link rel="stylesheet" href="css/style.css" media="screen" />
@ -12,7 +12,7 @@
<body>
<div id="site-nav">
<h1>jQuery Mercutio</h1>
<h1>jQuery Molequul</h1>
<ul>
<li><a href=".">Primer</a></li>
<li><a href="basic-single-column.html">Basic single-column</a></li>
@ -38,13 +38,13 @@
<h1>Appending new elements</h1>
<div class="copy">
<p>New elements can be appended to &lsquo;masoned&rsquo; containers and then arranged to the layout using the <code>appendedContent</code> option. <code>appendedContent</code> accepts the a jQuery object of the newly appended elements. In this example, each time <a href="#append_new_bricks">the button</a> is clicked, new <code>box</code> elements are created and then together made into a jQuery object. This object is first appended to the wrapping container, then the boxes are rearranged with a <code>.mercutio()</code> call. Finally, using the callback function, the new boxes are dynamically styled. </p>
<p>In the click function, <code>appendedContent</code> was the only option to specify in the mercutio configuration since Mercutio saves all previous options. Using <code>appendedContent</code>, the Mercutio script saves some processing time as it only rearranges the box(es) inside that appended container.</p>
<p>New elements can be appended to &lsquo;masoned&rsquo; containers and then arranged to the layout using the <code>appendedContent</code> option. <code>appendedContent</code> accepts the a jQuery object of the newly appended elements. In this example, each time <a href="#append_new_bricks">the button</a> is clicked, new <code>box</code> elements are created and then together made into a jQuery object. This object is first appended to the wrapping container, then the boxes are rearranged with a <code>.molequul()</code> call. Finally, using the callback function, the new boxes are dynamically styled. </p>
<p>In the click function, <code>appendedContent</code> was the only option to specify in the molequul configuration since Molequul saves all previous options. Using <code>appendedContent</code>, the Molequul script saves some processing time as it only rearranges the box(es) inside that appended container.</p>
<pre id="code"><code><span class="comment">// cache mercutio wrap</span>
<pre id="code"><code><span class="comment">// cache molequul wrap</span>
<span class="storage">var</span> <span class="keyword">$</span>wall <span class="keyword">=</span> <span class="keyword">$</span>(<span class="string">'#demo'</span>).find(<span class="string">'.wrap'</span>);
<span class="keyword">$</span>wall.mercutio({
<span class="keyword">$</span>wall.molequul({
columnWidth: <span class="constant">100</span>,
itemSelector: <span class="string">'.box'</span>
});
@ -72,7 +72,7 @@
<span class="comment">// append new elements</span>
.append( <span class="keyword">$</span>boxes )
<span class="comment">// arrange new elements</span>
.mercutio( { appendedContent: <span class="keyword">$</span>boxes } ,
.molequul( { appendedContent: <span class="keyword">$</span>boxes } ,
<span class="comment">// using a callback to style new elements</span>
<span class="storage">function</span>() {
<span class="keyword">$</span>(<span class="constant">this</span>).css({background: <span class="string">'#222'</span>, color: <span class="string">'#EEE'</span> });
@ -124,21 +124,21 @@
</div> <!-- #demo -->
<p id="footer">
jQuery Mercutio by <a href="http://desandro.com/">David DeSandro</a>
jQuery Molequul by <a href="http://desandro.com/">David DeSandro</a>
</p>
</div> <!-- #content -->
<script src="js/jquery-1.4.2.min.js"></script>
<script src="../jquery.mercutio.js"></script>
<script src="../jquery.molequul.js"></script>
<script src="js/rando-lorem-text.js"></script>
<script>
$(function(){
// cache mercutio wrap
// cache molequul wrap
var $wall = $('#demo').find('.wrap');
$wall.mercutio({
$wall.molequul({
columnWidth: 100,
itemSelector: '.box'
});
@ -165,7 +165,7 @@
// append new elements
.append( $boxes )
// arrange new elements
.mercutio( { appendedContent: $boxes } ,
.molequul( { appendedContent: $boxes } ,
// using a callback to style new elements
function() {
$(this).css({background: '#222', color: '#EEE' });

14
docs/basic-multi-column.html

@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery Mercutio &rsaquo; Basic multi-column example</title>
<title>jQuery Molequul &rsaquo; Basic multi-column example</title>
<link rel="stylesheet" href="css/style.css" media="screen" />
@ -12,7 +12,7 @@
<body>
<div id="site-nav">
<h1>jQuery Mercutio</h1>
<h1>jQuery Molequul</h1>
<ul>
<li><a href=".">Primer</a></li>
<li><a href="basic-single-column.html">Basic single-column</a></li>
@ -38,9 +38,9 @@
<h1>Basic multi-column example</h1>
<div class="copy">
<p>This example demonstrates the basic effect of jQuery Mercutio. All &lsquo;bricks&rsquo; have outerWidths (width + padding + border + margin) that are multiples of 100 pixels. <code>columnWidth</code> is set to <code>100</code>.</p>
<p>This example demonstrates the basic effect of jQuery Molequul. All &lsquo;bricks&rsquo; have outerWidths (width + padding + border + margin) that are multiples of 100 pixels. <code>columnWidth</code> is set to <code>100</code>.</p>
<pre id="code"><code><span class="keyword">$</span>(<span class="string">'#demo'</span>).mercutio({
<pre id="code"><code><span class="keyword">$</span>(<span class="string">'#demo'</span>).molequul({
columnWidth: <span class="constant">100</span>,
itemSelector: <span class="string">'.box'</span>
});</code></pre>
@ -246,17 +246,17 @@
</div> <!-- #demo -->
<p id="footer">
jQuery Mercutio by <a href="http://desandro.com/">David DeSandro</a>
jQuery Molequul by <a href="http://desandro.com/">David DeSandro</a>
</p>
</div> <!-- #content -->
<script src="js/jquery-1.4.2.min.js"></script>
<script src="../jquery.mercutio.js"></script>
<script src="../jquery.molequul.js"></script>
<script>
$(function(){
$('#demo').mercutio({
$('#demo').molequul({
columnWidth: 100,
itemSelector: '.box'
});

14
docs/basic-single-column.html

@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery Mercutio &rsaquo; Basic single-column example</title>
<title>jQuery Molequul &rsaquo; Basic single-column example</title>
<link rel="stylesheet" href="css/style.css" media="screen" />
@ -12,7 +12,7 @@
<body>
<div id="site-nav">
<h1>jQuery Mercutio</h1>
<h1>jQuery Molequul</h1>
<ul>
<li><a href=".">Primer</a></li>
<li class="selected"><a href="basic-single-column.html">Basic single-column</a>
@ -38,9 +38,9 @@
<h1>Basic single-column example</h1>
<div class="copy">
<p>This example demonstrates the basic effect of jQuery Mercutio. All &lsquo;bricks&rsquo; have the same width, so <code>singleMode</code> is set to <code>true</code>.</p>
<p>This example demonstrates the basic effect of jQuery Molequul. All &lsquo;bricks&rsquo; have the same width, so <code>singleMode</code> is set to <code>true</code>.</p>
<pre id="code"><code><span class="keyword">$</span>(<span class="string">'#demo'</span>).mercutio({
<pre id="code"><code><span class="keyword">$</span>(<span class="string">'#demo'</span>).molequul({
singleMode: <span class="constant">true</span>,
itemSelector: <span class="string">'.box'</span>
});</code></pre>
@ -242,17 +242,17 @@
</div> <!-- #demo -->
<p id="footer">
jQuery Mercutio by <a href="http://desandro.com/">David DeSandro</a>
jQuery Molequul by <a href="http://desandro.com/">David DeSandro</a>
</p>
</div> <!-- #content -->
<script src="js/jquery-1.4.2.min.js"></script>
<script src="../jquery.mercutio.js"></script>
<script src="../jquery.molequul.js"></script>
<script>
$(function(){
$('#demo').mercutio({
$('#demo').molequul({
singleMode: true,
itemSelector: '.box'
});

2
docs/css/style.css

@ -178,7 +178,7 @@ button {
font-size: 85%;
}
/**** Mercutio CSS ****/
/**** Molequul CSS ****/
.wrap {
background: #FFF;

40
docs/filtering-hashes.html

@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery Mercutio &rsaquo; Filtering hashes</title>
<title>jQuery Molequul &rsaquo; Filtering hashes</title>
<link rel="stylesheet" href="css/style.css" media="screen" />
<style>
@ -15,7 +15,7 @@
<body>
<div id="site-nav">
<h1>jQuery Mercutio</h1>
<h1>jQuery Molequul</h1>
<ul>
<li><a href=".">Primer</a></li>
<li><a href="basic-single-column.html">Basic single-column</a></li>
@ -47,7 +47,7 @@
speed <span class="keyword">=</span> <span class="constant">1000</span>, <span class="comment">// animation speed</span>
<span class="keyword">$</span>wall <span class="keyword">=</span> <span class="keyword">$</span>(<span class="string">'#demo'</span>).find(<span class="string">'.wrap'</span>),
mercutioOptions <span class="keyword">=</span> { <span class="comment">// initial mercutio options</span>
molequulOptions <span class="keyword">=</span> { <span class="comment">// initial molequul options</span>
columnWidth: <span class="constant">100</span>,
itemSelector: <span class="string">'.box:not(.invis)'</span>,
animate: <span class="constant">true</span>,
@ -60,21 +60,21 @@
<span class="comment">// run on window.load so we can capture any incoming hashes</span>
<span class="keyword">$</span>(<span class="id">window</span>).load(<span class="storage">function</span>(){
<span class="comment">// run mercutio on start-up to capture all the boxes we'll need</span>
<span class="keyword">$</span>wall.mercutio(mercutioOptions);
<span class="comment">// run molequul on start-up to capture all the boxes we'll need</span>
<span class="keyword">$</span>wall.molequul(molequulOptions);
<span class="keyword">if</span> ( <span class="id">window</span>.<span class="keyword">location</span>.<span class="keyword">hash</span> ) {
<span class="comment">// get rid of the '#' from the hash</span>
<span class="storage">var</span> possibleFilterClass <span class="keyword">=</span> <span class="id">window</span>.<span class="keyword">location</span>.<span class="keyword">hash</span>.replace(<span class="string">'#'</span>, <span class="string">''</span>);
<span class="keyword">switch</span> (possibleFilterClass) {
<span class="comment">// if the hash matches the following words</span>
<span class="keyword">case</span> <span class="string">'red'</span> : <span class="keyword">case</span> <span class="string">'gray'</span> : <span class="keyword">case</span> <span class="string">'black'</span> :
<span class="comment">// set mercutio options animate to false</span>
mercutioOptions.animate <span class="keyword">=</span> false;
<span class="comment">// set molequul options animate to false</span>
molequulOptions.animate <span class="keyword">=</span> false;
<span class="comment">// hide boxes that don't match the filter class</span>
<span class="keyword">$</span>wall.children().not(<span class="string">'.'</span><span class="keyword">+</span>possibleFilterClass)
.toggleClass(<span class="string">'invis'</span>).hide();
<span class="comment">// run mercutio again, this time with the necessary stuff hidden</span>
<span class="keyword">$</span>wall.mercutio(mercutioOptions);
<span class="comment">// run molequul again, this time with the necessary stuff hidden</span>
<span class="keyword">$</span>wall.molequul(molequulOptions);
<span class="keyword">break</span>;
}
}
@ -98,7 +98,7 @@
<span class="keyword">$</span>wall.children(filterClass<span class="keyword">+</span>'.invis')
.toggleClass(<span class="string">'invis'</span>).fadeIn(speed);
}
<span class="keyword">$</span>wall.mercutio({ animate: <span class="constant">true</span> });
<span class="keyword">$</span>wall.molequul({ animate: <span class="constant">true</span> });
<span class="comment">// set hash in URL</span>
<span class="id">window</span>.<span class="keyword">location</span>.<span class="keyword">hash</span> <span class="keyword">=</span> color;
<span class="keyword">return</span> <span class="constant">false</span>;
@ -326,13 +326,13 @@
</div> <!-- #demo -->
<p id="footer">
jQuery Mercutio by <a href="http://desandro.com/">David DeSandro</a>
jQuery Molequul by <a href="http://desandro.com/">David DeSandro</a>
</p>
</div> <!-- #content -->
<script src="js/jquery-1.4.2.min.js"></script>
<script src="../jquery.mercutio.js"></script>
<script src="../jquery.molequul.js"></script>
<script>
$(function(){
@ -340,7 +340,7 @@
speed = 1000, // animation speed
$wall = $('#demo').find('.wrap'),
mercutioOptions = { // initial mercutio options
molequulOptions = { // initial molequul options
columnWidth: 100,
itemSelector: '.box:not(.invis)',
animate: true,
@ -353,21 +353,21 @@
// run on window.load so we can capture any incoming hashes
$(window).load(function(){
// run mercutio on start-up to capture all the boxes we'll need
$wall.mercutio(mercutioOptions);
// run molequul on start-up to capture all the boxes we'll need
$wall.molequul(molequulOptions);
if ( window.location.hash ) {
// get rid of the '#' from the hash
var possibleFilterClass = window.location.hash.replace('#', '');
switch (possibleFilterClass) {
// if the hash matches the following words
case 'red' : case 'gray' : case 'black' :
// set mercutio options animate to false
mercutioOptions.animate = false;
// set molequul options animate to false
molequulOptions.animate = false;
// hide boxes that don't match the filter class
$wall.children().not('.'+possibleFilterClass)
.toggleClass('invis').hide();
// run mercutio again, this time with the necessary stuff hidden
$wall.mercutio(mercutioOptions);
// run molequul again, this time with the necessary stuff hidden
$wall.molequul(molequulOptions);
break;
}
}
@ -393,7 +393,7 @@
.toggleClass('invis').fadeIn(speed);
}
$wall.mercutio({ animate: true });
$wall.molequul({ animate: true });
// set hash in URL
window.location.hash = color;
return false;

22
docs/filtering.html

@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery Mercutio &rsaquo; Filtering</title>
<title>jQuery Molequul &rsaquo; Filtering</title>
<link rel="stylesheet" href="css/style.css" media="screen" />
<style>
@ -15,7 +15,7 @@
<body>
<div id="site-nav">
<h1>jQuery Mercutio</h1>
<h1>jQuery Molequul</h1>
<ul>
<li><a href=".">Primer</a></li>
<li><a href="basic-single-column.html">Basic single-column</a></li>
@ -41,16 +41,16 @@
<h1>Filtering</h1>
<div class="copy">
<p>Filtering is supported by Mercutio since v1.2. This example demonstrates how to show, hide, and rearrange visible items, using some basic logic. Each control button has a class that matches a class of arrangeable elements: <code>gray</code>, <code>red</code>, and <code>black</code>. When one of these buttons is clicked, the arrangeable elements that have a matching class are shown, and the elements that do not match are hidden. To keep track of what's visible, a class of <code>invis</code> is added and removed to each element. In this example, the mercutio settings have <code>itemSelector</code> as <code><span class="string">'.box:not(.invis)'</span></code>, so only visible elements will be arranged in the layout. After the proper elements are hidden and the others shown, <code>.mercutio()</code> is called and the layout is rearranged.</p>
<p>Filtering is supported by Molequul since v1.2. This example demonstrates how to show, hide, and rearrange visible items, using some basic logic. Each control button has a class that matches a class of arrangeable elements: <code>gray</code>, <code>red</code>, and <code>black</code>. When one of these buttons is clicked, the arrangeable elements that have a matching class are shown, and the elements that do not match are hidden. To keep track of what's visible, a class of <code>invis</code> is added and removed to each element. In this example, the molequul settings have <code>itemSelector</code> as <code><span class="string">'.box:not(.invis)'</span></code>, so only visible elements will be arranged in the layout. After the proper elements are hidden and the others shown, <code>.molequul()</code> is called and the layout is rearranged.</p>
<pre id="code"><code><span class="storage">var</span>
speed <span class="storage">=</span> <span class="constant">1000</span>, <span class="comment">// animation speed</span>
<span class="keyword">$</span>wall <span class="keyword">=</span> <span class="keyword">$</span>(<span class="string">'#demo'</span>).find(<span class="string">'.wrap'</span>)
;
<span class="keyword">$</span>wall.mercutio({
<span class="keyword">$</span>wall.molequul({
columnWidth: <span class="constant">100</span>,
<span class="comment">// only apply mercutio layout to visible elements</span>
<span class="comment">// only apply molequul layout to visible elements</span>
itemSelector: <span class="string">'.box:not(.invis)'</span>,
animate: <span class="constant">true</span>,
animationOptions: {
@ -74,7 +74,7 @@
<span class="keyword">$</span>wall.children(colorClass<span class="storage">+</span><span class="string">'.invis'</span>)
.toggleClass(<span class="string">'invis'</span>).fadeIn(speed);
}
<span class="keyword">$</span>wall.mercutio();
<span class="keyword">$</span>wall.molequul();
<span class="keyword">return</span> <span class="constant">false</span>;
});</code></pre>
@ -301,13 +301,13 @@
</div> <!-- #demo -->
<p id="footer">
jQuery Mercutio by <a href="http://desandro.com/">David DeSandro</a>
jQuery Molequul by <a href="http://desandro.com/">David DeSandro</a>
</p>
</div> <!-- #content -->
<script src="js/jquery-1.4.2.min.js"></script>
<script src="../jquery.mercutio.js"></script>
<script src="../jquery.molequul.js"></script>
<script>
$(function(){
@ -316,9 +316,9 @@
$wall = $('#demo').find('.wrap')
;
$wall.mercutio({
$wall.molequul({
columnWidth: 100,
// only apply mercutio layout to visible elements
// only apply molequul layout to visible elements
selector: '.box',
animate: true,
animationOptions: {
@ -331,7 +331,7 @@
console.log('click')
var className = $(this).attr('class'),
filterSelector = className === 'all' ? '*' : '.' + className;
$wall.mercutio({ filter: filterSelector });
$wall.molequul({ filter: filterSelector });
return false;
});

50
docs/index.html

@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery Mercutio &rsaquo; Primer</title>
<title>jQuery Molequul &rsaquo; Primer</title>
<link rel="stylesheet" href="css/style.css" media="screen" />
@ -12,7 +12,7 @@
<body>
<div id="site-nav">
<h1>jQuery Mercutio</h1>
<h1>jQuery Molequul</h1>
<ul>
<li class="selected"><a href=".">Primer</a>
<ul>
@ -45,7 +45,7 @@
<h1>Primer</h1>
<div class="copy">
<p>Mercutio is a layout plugin for jQuery. Think of it as the flip side of CSS floats. Whereas floating arranges elements horizontally then vertically, Mercutio arranges elements vertically then horizontally according to a grid. The result minimizes vertical gaps between elements of varying height, just like a mason fitting stones in a wall.</p>
<p>Molequul is a layout plugin for jQuery. Think of it as the flip side of CSS floats. Whereas floating arranges elements horizontally then vertically, Molequul arranges elements vertically then horizontally according to a grid. The result minimizes vertical gaps between elements of varying height, just like a mason fitting stones in a wall.</p>
</div><!-- .copy -->
@ -118,7 +118,7 @@
</div>
<div class="example">
<h3>Mercutio</h3>
<h3>Molequul</h3>
<div id="secondary" class="wrap">
<div class="box col1">
<h5>1</h5>
@ -191,23 +191,23 @@
<h2 id="min-config">Minimum recommended configuration</h2>
<p>Configuring Mercutio is fairly easy. Simply call the <code>.mercutio()</code> method on the container element. Depending on the layout, you&rsquo;ll most likely need to specify one option.</p>
<p>Configuring Molequul is fairly easy. Simply call the <code>.molequul()</code> method on the container element. Depending on the layout, you&rsquo;ll most likely need to specify one option.</p>
<p>For layouts with elements that span multiple widths, like the <a href="basic-multi-column.html">basic multi-column example</a>:</p>
<pre><code><span class="keyword">$</span>(<span class="string">'#wrapper'</span>).mercutio({ columnWidth: <span class="constant">200</span> });</code></pre>
<pre><code><span class="keyword">$</span>(<span class="string">'#wrapper'</span>).molequul({ columnWidth: <span class="constant">200</span> });</code></pre>
<p>For layouts with elements that span the same width, like the <a href="basic-single-column.html">basic single-column example</a>:</p>
<pre><code><span class="keyword">$</span>(<span class="string">'#wrapper'</span>).mercutio({ singleMode: <span class="constant">true</span> });</code></pre>
<pre><code><span class="keyword">$</span>(<span class="string">'#wrapper'</span>).molequul({ singleMode: <span class="constant">true</span> });</code></pre>
<p>No need to worry about how many columns, or width of gutters, or how big the container is. Thanks to the wonders of jQuery’s <code>outerWidth()</code> and <code>innerWidth()</code> methods, Mercutio appropriately accounts for the space of any margin, padding, and border-width set with CSS.</p>
<p>No need to worry about how many columns, or width of gutters, or how big the container is. Thanks to the wonders of jQuery’s <code>outerWidth()</code> and <code>innerWidth()</code> methods, Molequul appropriately accounts for the space of any margin, padding, and border-width set with CSS.</p>
<p>This plugin is designed to progressively enhance the layout, so &lsquo;brick&rsquo; elements should be floated if JavaScript is disabled. Floating also ensures that the bricks width will be measured correctly.</p>
<h2 id="options">Plugin options</h2>
<pre><code><span class="keyword">$</span>(<span class="string">'#wrapper'</span>).mercutio({
<pre><code><span class="keyword">$</span>(<span class="string">'#wrapper'</span>).molequul({
singleMode: <span class="constant">false</span>,
<span class="comment">// Disables measuring the width of each floated element.
@ -224,7 +224,7 @@
// Required for Infinite Scroll with window resizing.</span>
resizeable: <span class="constant">true</span>,
<span class="comment">// Binds a Mercutio call to window resizes
<span class="comment">// Binds a Molequul call to window resizes
// so layout appears fluid.
// default: true</span>
@ -240,44 +240,44 @@
// Useful for Infinite Scroll integration.</span>
saveOptions: <span class="constant">true</span>,
<span class="comment">// Mercutio will use the options from previous Mercutio
<span class="comment">// Molequul will use the options from previous Molequul
// calls by default, so you only have to enter in options once
// default: true</span>
}, <span class="storage">function</span>() {}
<span class="comment">// Optional callback.
// 'this' will refer to the applicable elements Mercutio just rearranged</span>
// 'this' will refer to the applicable elements Molequul just rearranged</span>
);</code></pre>
<h2 id="code-repository">Code repository</h2>
<p>This project lives on GitHub at <a href="http://github.com/desandro/mercutio">github.com/desandro/mercutio</a>, where you can follow progress, download all this documentation, grab the latest version of the script, or fork this project and make it better yourself.</p>
<p>This project lives on GitHub at <a href="http://github.com/desandro/molequul">github.com/desandro/molequul</a>, where you can follow progress, download all this documentation, grab the latest version of the script, or fork this project and make it better yourself.</p>
<p>There you can find an <a href="http://github.com/desandro/mercutio/issues">issue tracker</a> where you can look through other people&rsquo;s <a href="http://github.com/desandro/mercutio/issues/closed">resolved issues</a> or submit a new one for yourself. If you&rsquo;re still having trouble, try <a href="http://wiki.github.com/desandro/mercutio/">looking over the FAQ</a>.</p>
<p>There you can find an <a href="http://github.com/desandro/molequul/issues">issue tracker</a> where you can look through other people&rsquo;s <a href="http://github.com/desandro/molequul/issues/closed">resolved issues</a> or submit a new one for yourself. If you&rsquo;re still having trouble, try <a href="http://wiki.github.com/desandro/molequul/">looking over the FAQ</a>.</p>
<h2 id="resizing">Window resizing</h2>
<p>By default, Mercutio binds a call to the browser window for resizing. But the rearrangement script is triggered only when the layout adds or loses a column, so you don&rsquo;t have to worry about Mercutio slowing down window resizes, or with fixed layouts.</p>
<p>By default, Molequul binds a call to the browser window for resizing. But the rearrangement script is triggered only when the layout adds or loses a column, so you don&rsquo;t have to worry about Molequul slowing down window resizes, or with fixed layouts.</p>
<h2 id="images">Handling images &amp; other media</h2>
<p>Since Mercutio measures the height of the elements when placing them, you will need to account for images and other media that haven&rsquo;t loaded yet. For images, the best method is to specify the width and height of images inline.</p>
<p>Since Molequul measures the height of the elements when placing them, you will need to account for images and other media that haven&rsquo;t loaded yet. For images, the best method is to specify the width and height of images inline.</p>
<pre><code><span class="storage">&lt;img src=<span class="string">"img_file.jpg"</span> width=<span class="string">"280"</span> height=<span class="string">"160"</span> /&gt;</span></code></pre>
<p>If you&rsquo;re using a PHP-based CMS, you can use the <a href="http://php.net/manual/en/function.getimagesize.php">getimagesize</a> function.</p>
<p>If this is not possible or if you&rsquo;re dealing with @font-face fonts, another option is to call Mercutio after all media has loaded. This is done by calling the function inside of <code>$(window).load()</code> instead of <code>$(document).ready()</code>.</p>
<p>If this is not possible or if you&rsquo;re dealing with @font-face fonts, another option is to call Molequul after all media has loaded. This is done by calling the function inside of <code>$(window).load()</code> instead of <code>$(document).ready()</code>.</p>
<pre><code><span class="keyword">$</span>(<span class="support">window</span>).<span class="keyword">load</span>(<span class="storage">function</span>(){
<span class="keyword">$</span>(<span class="string">'#wrapper'</span>).mercutio({ columnWidth: <span class="constant">200</span> });
<span class="keyword">$</span>(<span class="string">'#wrapper'</span>).molequul({ columnWidth: <span class="constant">200</span> });
});</code></pre>
<h2 id="anchor-links">Resolving anchor links</h2>
<p>Since Mercutio relies on absolute positioning, any anchor links that occur within or after the wrapping element will not work when the page first loads. The following script is one solution.</p>
<p>Since Molequul relies on absolute positioning, any anchor links that occur within or after the wrapping element will not work when the page first loads. The following script is one solution.</p>
<pre><code><span class="keyword">$</span>(<span class="support">window</span>).<span class="keyword">load</span>(<span class="storage">function</span>(){
<span class="keyword">if</span> ( <span class="keyword">window</span>.<span class="keyword">location</span>.<span class="keyword">hash</span> ) {
@ -290,7 +290,7 @@
<h2 id="inthewild">Examples in the wild</h2>
<p>In addition to the examples below, see <a href="http://delicious.com/desandro/jquerymercutio">delicious links tagged with jquerymercutio</a> and <a href="http://emberapp.com/desandro/collections/jquery-mercutio">jQuery Mercutio Collection on Ember for screenshots</a>.</p>
<p>In addition to the examples below, see <a href="http://delicious.com/desandro/jquerymolequul">delicious links tagged with jquerymolequul</a> and <a href="http://emberapp.com/desandro/collections/jquery-molequul">jQuery Molequul Collection on Ember for screenshots</a>.</p>
<ul>
@ -335,12 +335,12 @@
<ul>
<li><a href="http://paulirish.com">Paul Irish</a> for his <a href="http://www.infinite-scroll.com">Infinite Scroll</a> plugin, which served as a template I used to produce a plugin of my own. The <code>appendedContent</code> option was design to work specifically with Infinite Scroll. Infinite Scroll is packaged with these docs.</li>
<li>Louis-Rémi Babé and Paul Irish for the <a href="http://github.com/lrbabe/jquery-smartresize">jQuery SmartResize plugin</a>. This adds a special <em>smartresize</em> event to jQuery, so window resize events do not have to be executed on every frame. This plugin is used within jQuery Mercutio.</li>
<li>Louis-Rémi Babé and Paul Irish for the <a href="http://github.com/lrbabe/jquery-smartresize">jQuery SmartResize plugin</a>. This adds a special <em>smartresize</em> event to jQuery, so window resize events do not have to be executed on every frame. This plugin is used within jQuery Molequul.</li>
</ul>
<h2 id="license">License</h2>
<p>jQuery Mercutio is licensed under the MIT license, just like <a href="http://jquery.org/license">jQuery itself.</a> It may be used for personal and commercial applications.</p>
<p>jQuery Molequul is licensed under the MIT license, just like <a href="http://jquery.org/license">jQuery itself.</a> It may be used for personal and commercial applications.</p>
<div class="license-copy">
<h3>The MIT License</h3>
@ -358,17 +358,17 @@
</div> <!-- .copy -->
<p id="footer">
jQuery Mercutio by <a href="http://desandro.com/">David DeSandro</a>
jQuery Molequul by <a href="http://desandro.com/">David DeSandro</a>
</p>
</div> <!-- #content -->
<script src="js/jquery-1.4.2.min.js"></script>
<script src="../jquery.mercutio.js"></script>
<script src="../jquery.molequul.js"></script>
<script>
$(function(){
$('#secondary').mercutio({columnWidth: 100});
$('#secondary').molequul({columnWidth: 100});
});
</script>

32
docs/infinite-scroll.html

@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery Mercutio &rsaquo; Infinite Scroll</title>
<title>jQuery Molequul &rsaquo; Infinite Scroll</title>
<link rel="stylesheet" href="css/style.css" media="screen" />
@ -12,7 +12,7 @@
<body>
<div id="site-nav">
<h1>jQuery Mercutio</h1>
<h1>jQuery Molequul</h1>
<ul>
<li><a href=".">Primer</a></li>
<li><a href="basic-single-column.html">Basic single-column</a></li>
@ -38,18 +38,18 @@
<h1>Infinite Scroll</h1>
<div class="copy">
<p>Mercutio integrates well with auto-paging scripts like <a href="http://www.infinite-scroll.com/">Infinite Scroll</a> by <a href="http://paulirish.com">Paul Irish</a>. Using the <code>appendedContent</code> option, Mercutio will only re-position the newly appended elements, and skip over all the previous elements that are already in their proper position, thus saving precious milliseconds of page load time.</p>
<p>Molequul integrates well with auto-paging scripts like <a href="http://www.infinite-scroll.com/">Infinite Scroll</a> by <a href="http://paulirish.com">Paul Irish</a>. Using the <code>appendedContent</code> option, Molequul will only re-position the newly appended elements, and skip over all the previous elements that are already in their proper position, thus saving precious milliseconds of page load time.</p>
<p>Setting up the Mercutio call is just the same as normally would be. Since this layout uses both Infinite Scroll and resizable, <code>itemSelector</code> is recommended.</p>
<p>Setting up the Molequul call is just the same as normally would be. Since this layout uses both Infinite Scroll and resizable, <code>itemSelector</code> is recommended.</p>
<pre><code><span class="storage">var</span> <span class="keyword">$</span>wall <span class="keyword">= $</span>(<span class="string">'#demo'</span>);
<span class="keyword">$</span>wall.mercutio({
<span class="keyword">$</span>wall.molequul({
columnWidth: <span class="constant">100</span>,
itemSelector: <span class="string">'.box:visible'</span>
});</code></pre>
<p>In the Infinite Scroll configuration, call Mercutio as a callback. Infinite Scroll provides the newly loaded elements as an argument, <code>newElements</code> in the example code. As this argument is an array of the DOM nodes, it needs to be passed in as a jQuery object to be used for the value of <code>appendedContent</code>.</p>
<p>In the Infinite Scroll configuration, call Molequul as a callback. Infinite Scroll provides the newly loaded elements as an argument, <code>newElements</code> in the example code. As this argument is an array of the DOM nodes, it needs to be passed in as a jQuery object to be used for the value of <code>appendedContent</code>.</p>
<pre id="code"><code><span class="keyword">$</span>wall.infinitescroll({
navSelector : <span class="string">'#page_nav'</span>, <span class="comment">// selector for the paged navigation </span>
@ -63,9 +63,9 @@
<span class="keyword">$</span>(<span class="string">'#infscr-loading'</span>).animate({opacity: .<span class="constant">8</span>},<span class="constant">2000</span>).fadeOut(<span class="string">'normal'</span>);
}
},
<span class="comment">// call mercutio as a callback</span>
<span class="comment">// call molequul as a callback</span>
<span class="storage">function</span>( newElements ) {
<span class="keyword">$</span>(<span class="constant">this</span>).mercutio({ appendedContent: <span class="keyword">$</span>( newElements ) });
<span class="keyword">$</span>(<span class="constant">this</span>).molequul({ appendedContent: <span class="keyword">$</span>( newElements ) });
}
);</code></pre>
@ -73,12 +73,12 @@
<p><a href="./#images">As recommended in the primer,</a> the best solution to handle images is to have the size attributes defined in the <code>img</code> tag, especially when using Infinite Scroll. This is the solution employed in the example below.</p>
<p>Of course, this is not a viable option in some CMSs, most notably <a href="http://tumblr.com">Tumblr</a>. In this situation, Mercutio needs to be called after the newly-appended images are fully loaded. This is done by delaying the Mercutio callback.</p>
<p>Of course, this is not a viable option in some CMSs, most notably <a href="http://tumblr.com">Tumblr</a>. In this situation, Molequul needs to be called after the newly-appended images are fully loaded. This is done by delaying the Molequul callback.</p>
<pre><code><span class="comment">// call mercutio as a callback, after 1000 milliseconds</span>
<pre><code><span class="comment">// call molequul as a callback, after 1000 milliseconds</span>
<span class="storage">function</span>( newElements ) {
setTimeout(<span class="storage">function</span>() {
<span class="keyword">$</span>wall.mercutio({ appendedContent: <span class="keyword">$</span>(newElements) });
<span class="keyword">$</span>wall.molequul({ appendedContent: <span class="keyword">$</span>(newElements) });
}, <span class="constant">1000</span>);
}</code></pre>
@ -313,21 +313,21 @@
</p>
<p id="footer">
jQuery Mercutio by <a href="http://desandro.com/">David DeSandro</a> <br />
jQuery Molequul by <a href="http://desandro.com/">David DeSandro</a> <br />
<a href="http://www.infinite-scroll.com/">Infinite Scroll</a> by <a href="http://paulirish.com">Paul Irish</a>
</p>
</div>
<script src="js/jquery-1.4.2.min.js"></script>
<script src="../jquery.mercutio.js"></script>
<script src="../jquery.molequul.js"></script>
<script src="js/jquery.infinitescroll.min.js"></script>
<script>
$(function(){
var $wall = $('#demo');
$wall.mercutio({
$wall.molequul({
columnWidth: 100,
itemSelector: '.box:visible'
});
@ -344,8 +344,8 @@
$('#infscr-loading').animate({opacity: .8},2000).fadeOut('normal');
}
},
// call mercutio as a callback.
function( newElements ) { $(this).mercutio({ appendedContent: $(newElements) }); }
// call molequul as a callback.
function( newElements ) { $(this).molequul({ appendedContent: $(newElements) }); }
);
});

2
docs/js/rando-lorem-text.js

@ -1,6 +1,6 @@
/*
* This is just a utitlity script so we can
* add random content to mercutio-ed layouts
* add random content to molequul-ed layouts
*/
var

10
docs/pages/2.html

@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery Mercutio &rsaquo; Page 2</title>
<title>jQuery Molequul &rsaquo; Page 2</title>
<link rel="stylesheet" href="../css/style.css" media="screen" />
@ -12,7 +12,7 @@
<body>
<div id="site-nav">
<h1>jQuery Mercutio</h1>
<h1>jQuery Molequul</h1>
<ul>
<li><a href="..">Primer</a></li>
<li><a href="../basic-single-column.html">Basic single-column</a></li>
@ -188,16 +188,16 @@
</div> <!-- .wrap -->
<p id="footer">
jQuery Mercutio by <a href="http://desandro.com/">David DeSandro</a>
jQuery Molequul by <a href="http://desandro.com/">David DeSandro</a>
</p>
</div> <!-- #content -->
<script src="../js/jquery-1.4.2.min.js"></script>
<script src="../../jquery.mercutio.js"></script>
<script src="../../jquery.molequul.js"></script>
<script>
$(function(){
$('#demo').mercutio({
$('#demo').molequul({
columnWidth: 100,
itemSelector: '.box'
});

10
docs/pages/3.html

@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery Mercutio &rsaquo; Page 3</title>
<title>jQuery Molequul &rsaquo; Page 3</title>
<link rel="stylesheet" href="../css/style.css" media="screen" />
@ -12,7 +12,7 @@
<body>
<div id="site-nav">
<h1>jQuery Mercutio</h1>
<h1>jQuery Molequul</h1>
<ul>
<li><a href="..">Primer</a></li>
<li><a href="../basic-single-column.html">Basic single-column</a></li>
@ -170,16 +170,16 @@
</div> <!-- /.wrap -->
<p id="footer">
jQuery Mercutio by <a href="http://desandro.com/">David DeSandro</a>
jQuery Molequul by <a href="http://desandro.com/">David DeSandro</a>
</p>
</div><!-- #content -->
<script src="../js/jquery-1.4.2.min.js"></script>
<script src="../../jquery.mercutio.js"></script>
<script src="../../jquery.molequul.js"></script>
<script>
$(function(){
$('#demo').mercutio({
$('#demo').molequul({
columnWidth: 100,
itemSelector: '.box'
});

10
docs/pages/4.html

@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery Mercutio &rsaquo; Page 4</title>
<title>jQuery Molequul &rsaquo; Page 4</title>
<link rel="stylesheet" href="../css/style.css" media="screen" />
@ -12,7 +12,7 @@
<body>
<div id="site-nav">
<h1>jQuery Mercutio</h1>
<h1>jQuery Molequul</h1>
<ul>
<li><a href="..">Primer</a></li>
<li><a href="../basic-single-column.html">Basic single-column</a></li>
@ -160,17 +160,17 @@
</div> <!-- /.wrap -->
<p id="footer">
jQuery Mercutio by <a href="http://desandro.com/">David DeSandro</a>
jQuery Molequul by <a href="http://desandro.com/">David DeSandro</a>
</p>
</div><!-- #content -->
<script src="../js/jquery-1.4.2.min.js"></script>
<script src="../../jquery.mercutio.js"></script>
<script src="../../jquery.molequul.js"></script>
<script>
$(function(){
$('#demo').mercutio({
$('#demo').molequul({
columnWidth: 100,
itemSelector: '.box'
});

10
docs/pages/5.html

@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery Mercutio &rsaquo; Page 5</title>
<title>jQuery Molequul &rsaquo; Page 5</title>
<link rel="stylesheet" href="../css/style.css" media="screen" />
@ -12,7 +12,7 @@
<body>
<div id="site-nav">
<h1>jQuery Mercutio</h1>
<h1>jQuery Molequul</h1>
<ul>
<li><a href="..">Primer</a></li>
<li><a href="../basic-single-column.html">Basic single-column</a></li>
@ -164,16 +164,16 @@
</div> <!-- /.wrap -->
<p id="footer">
jQuery Mercutio by <a href="http://desandro.com/">David DeSandro</a>
jQuery Molequul by <a href="http://desandro.com/">David DeSandro</a>
</p>
</div><!-- #content -->
<script src="../js/jquery-1.4.2.min.js"></script>
<script src="../../jquery.mercutio.js"></script>
<script src="../../jquery.molequul.js"></script>
<script>
$(function(){
$('#demo').mercutio({
$('#demo').molequul({
columnWidth: 100,
itemSelector: '.box'
});

14
docs/tumblelog.html

@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery Mercutio &rsaquo; Tumblelog example</title>
<title>jQuery Molequul &rsaquo; Tumblelog example</title>
<link rel="stylesheet" href="css/style.css" media="screen" />
@ -11,7 +11,7 @@
<body>
<div id="site-nav">
<h1>jQuery Mercutio</h1>
<h1>jQuery Molequul</h1>
<ul>
<li><a href=".">Primer</a></li>
<li><a href="basic-single-column.html">Basic single-column</a></li>
@ -37,7 +37,7 @@
<div class="copy">
<p>A tumblelog is a good example of a typical use case for Mercutio.</p>
<p>A tumblelog is a good example of a typical use case for Molequul.</p>
<p>There are three sizes of columns used:</p>
<ul>
<li><code>.col1</code> : 220px</li>
@ -47,7 +47,7 @@
<p>With 10px of margin on right and left sides that makes for a grid with columns 240px wide.</p>
<pre id="code"><code><span class="keyword">$</span>(<span class="storage">function</span>(){
<span class="keyword">$</span>(<span class="string">'#tumblelog'</span>).mercutio({ columnWidth: <span class="constant">240</span> });
<span class="keyword">$</span>(<span class="string">'#tumblelog'</span>).molequul({ columnWidth: <span class="constant">240</span> });
});</code></pre>
@ -234,16 +234,16 @@
</div> <!-- /#tumblelog -->
<p id="footer">
jQuery Mercutio by <a href="http://desandro.com/">David DeSandro</a>
jQuery Molequul by <a href="http://desandro.com/">David DeSandro</a>
</p>
</div> <!-- #content -->
<script src="js/jquery-1.4.2.min.js"></script>
<script src="../jquery.mercutio.js"></script>
<script src="../jquery.molequul.js"></script>
<script>
$(function(){
$('#tumblelog').mercutio({columnWidth: 240})
$('#tumblelog').molequul({columnWidth: 240})
})
</script>

90
jquery.mercutio.js → jquery.molequul.js

@ -1,7 +1,7 @@
/*************************************************
** jQuery Mercutio version 0.1
** jQuery Molequul version 0.1
** Copyright David DeSandro, licensed MIT
** http://desandro.com/resources/jquery-mercutio
** http://desandro.com/resources/jquery-molequul
**************************************************/
(function($){
@ -151,13 +151,13 @@
};
// ========================= mercutio ===============================
// ========================= molequul ===============================
var mercutioMethods = {
var molequulMethods = {
filter : function( $cards ) {
var props = this.data('mercutio'),
var props = this.data('molequul'),
filter = props.opts.filter === '' ? '*' : props.opts.filter;
if ( !filter ) {
@ -213,7 +213,7 @@
x = props.colW * shortCol + props.posLeft;
y = minimumY;
position = mercutioMethods.position( x, y );
position = molequulMethods.position( x, y );
// position the brick
props.styleQueue.push({ $el: this, style: position });
@ -229,7 +229,7 @@
singleColumn : function( colYs, props ) {
return this.each(function(){
$(this).mercutio( 'placeCard', props.colCount, colYs, props );
$(this).molequul( 'placeCard', props.colCount, colYs, props );
});
},
@ -243,7 +243,7 @@
if ( colSpan === 1 ) {
// if brick spans only one column, just like singleMode
$this.mercutio( 'placeCard', props.colCount, colYs, props );
$this.molequul( 'placeCard', props.colCount, colYs, props );
} else {
// brick spans more than one column
// how many different places could this brick fit horizontally
@ -258,7 +258,7 @@
groupY[i] = Math.max.apply( Math, groupColY );
}
$this.mercutio( 'placeCard', groupCount, groupY, props );
$this.molequul( 'placeCard', groupCount, groupY, props );
}
});
},
@ -279,7 +279,7 @@
// process styleQueue
$.each( props.styleQueue, function( i, obj ){
// var style = mercutioMethods.parseTransformStyle( obj.style );
// var style = molequulMethods.parseTransformStyle( obj.style );
for ( var prop in obj.style ) {
console.log( prop, obj.style[prop] )
// switch ( obj.style[prop] ) {
@ -302,7 +302,7 @@
// set all data so we can retrieve it for appended appendedContent
// or anyone else's crazy jquery fun
this.data( 'mercutio', props );
this.data( 'molequul', props );
return this;
},
@ -311,23 +311,23 @@
// accepts cards-to-be-laid-out and colYs to start with
layout : function( $cards, colYs ) {
var props = this.data('mercutio');
var props = this.data('molequul');
// console.log( props.opts.hiddenStyle.scale )
// layout logic
var layoutMode = props.opts.singleMode ? 'singleColumn' : 'multiColumn';
$cards.mercutio( layoutMode, colYs, props );
$cards.molequul( layoutMode, colYs, props );
// set the height of the container to the tallest column
props.containerHeight = Math.max.apply( Math, props.colYs );
var containerStyle = { height: props.containerHeight - props.posTop };
props.styleQueue.push({ $el: this, style: containerStyle });
// this[ props.applyStyle ]( containerStyle, animOpts ).mercutio( 'complete', props );
// this[ props.applyStyle ]( containerStyle, animOpts ).molequul( 'complete', props );
this.mercutio( 'complete', props );
this.molequul( 'complete', props );
return this;
@ -344,18 +344,18 @@
},
resize : function() {
// console.log( this.data('mercutio') , this[0].id )
var props = this.data('mercutio'),
// console.log( this.data('molequul') , this[0].id )
var props = this.data('molequul'),
prevColCount = props.colCount;
props.initialized = true;
// get updated colCount
this.mercutio( 'getColCount', props );
this.molequul( 'getColCount', props );
if ( props.colCount !== prevColCount ) {
// if column count has changed, do a new column cound
var colYs = mercutioMethods.resetColYs( props );
this.mercutio( 'layout', props.$cards.filtered, colYs );
var colYs = molequulMethods.resetColYs( props );
this.molequul( 'layout', props.$cards.filtered, colYs );
}
return this;
@ -373,7 +373,7 @@
// only run though on initial init
setup : function() {
var props = this.data('mercutio');
var props = this.data('molequul');
props.$cards = {};
props.styleQueue = [];
// need to get cards
@ -385,11 +385,11 @@
// if colW == 0, back out before divide by zero
if ( !props.colW ) {
window.console && console.error('Column width calculated to be zero. Stopping Mercutio plugin before divide by zero. Check that the width of first child inside the mercutio container is not zero.');
window.console && console.error('Column width calculated to be zero. Stopping Molequul plugin before divide by zero. Check that the width of first child inside the molequul container is not zero.');
return this;
}
this.css('position', 'relative').mercutio( 'getColCount', props );
this.css('position', 'relative').molequul( 'getColCount', props );
cardStyle = { position: 'absolute' };
if ( usingTransforms ) {
@ -405,10 +405,10 @@
props.posLeft = Math.round( $cursor.position().left );
$cursor.remove();
// add mercutio class first time around
// add molequul class first time around
var $container = this;
setTimeout(function(){
$container.addClass('mercutio');
$container.addClass('molequul');
}, 1 );
return this;
@ -421,7 +421,7 @@
return this.each(function() {
var $this = $(this),
data = $this.data('mercutio'),
data = $this.data('molequul'),
props = data || {};
// checks if masonry has been called before on this object
@ -431,28 +431,28 @@
props.opts = $.extend(
{},
$.fn.mercutio.defaults,
$.fn.molequul.defaults,
previousOptions,
options
);
$this.data( 'mercutio', props );
$this.data( 'molequul', props );
if ( !props.initialized ) {
$this.mercutio( 'setup' );
$this.molequul( 'setup' );
}
var colYs = mercutioMethods.resetColYs( props );
var colYs = molequulMethods.resetColYs( props );
$this
.mercutio( 'filter', props.$cards.all )
.mercutio( 'layout', props.$cards.filtered, colYs );
.molequul( 'filter', props.$cards.all )
.molequul( 'layout', props.$cards.filtered, colYs );
// binding window resizing
if ( props.opts.resizeable ) {
$(window).bind('smartresize.mercutio', function() { $this.mercutio( 'resize' ); } );
$(window).bind('smartresize.molequul', function() { $this.molequul( 'resize' ); } );
} else if ( !props.opts.resizeable && !!previousOptions.resizeable ) {
$(window).unbind('smartresize.mercutio');
$(window).unbind('smartresize.molequul');
}
});
@ -469,11 +469,11 @@
},
translate : function( x, y ) {
return mercutioMethods.transform('translate(' + x + 'px, ' + y + 'px) scale(1)')
return molequulMethods.transform('translate(' + x + 'px, ' + y + 'px) scale(1)')
},
translate3d : function( x, y ) {
return mercutioMethods.transform('translate3d(' + x + 'px, ' + y + 'px, 0) scale(1)')
return molequulMethods.transform('translate3d(' + x + 'px, ' + y + 'px, 0) scale(1)')
},
positionAbs : function( x, y ) {
@ -485,24 +485,24 @@
if ( usingTransforms ) {
var translateMethod = Modernizr.csstransforms3d ? 'translate3d' : 'translate';
mercutioMethods.position = mercutioMethods[ translateMethod ];
molequulMethods.position = molequulMethods[ translateMethod ];
} else {
mercutioMethods.position = mercutioMethods.positionAbs;
molequulMethods.position = molequulMethods.positionAbs;
}
// mercutioMethods.position = Modernizr.csstransforms3d ? mercutioMethods.translate3d : mercutioMethods.positionAbs;
// molequulMethods.position = Modernizr.csstransforms3d ? molequulMethods.translate3d : molequulMethods.positionAbs;
// mercutio code begin
$.fn.mercutio = function( firstArg ) {
// molequul code begin
$.fn.molequul = function( firstArg ) {
// Method calling logic
var method = mercutioMethods[ firstArg ];
var method = molequulMethods[ firstArg ];
if ( method ) {
// remove firstArg, which is a string of the function name, from arguments
var args = Array.prototype.slice.call( arguments, 1 );
return method.apply( this, args );
} else if ( !firstArg || typeof firstArg === 'object' ) {
return mercutioMethods.init.apply( this, arguments );
return molequulMethods.init.apply( this, arguments );
}
@ -510,14 +510,14 @@
// Default plugin options
$.fn.mercutio.defaults = {
$.fn.molequul.defaults = {
// singleMode: false,
// columnWidth: undefined,
// itemSelector: undefined,
// appendedContent: undefined,
// saveOptions: true,
resizeable: true,
hiddenClass : 'mercutio-hidden',
hiddenClass : 'molequul-hidden',
hiddenStyle : {
opacity : 0,
scale: 0.001
Loading…
Cancel
Save