Skip to content
This repository has been archived by the owner on Feb 18, 2020. It is now read-only.

Commit

Permalink
Version 1.1.1. Fixed bug with conflict between keyboard shortcuts and…
Browse files Browse the repository at this point in the history
… inputs.

- Various JS resource updates.
- Renamed files for easier future development.
  • Loading branch information
acolangelo committed Feb 3, 2013
1 parent 71652d1 commit 74b6a67
Show file tree
Hide file tree
Showing 19 changed files with 10,136 additions and 65 deletions.
2 changes: 1 addition & 1 deletion README.md
@@ -1,6 +1,6 @@
#<a id="docs" href="#docs">jPanelMenu</a>

###Version 1.1
###Version 1.1.1

jPanelMenu is a [jQuery](http://jquery.com) plugin that creates a paneled-style menu (like the type seen in the mobile versions of [Facebook](http://m.facebook.com) and [Google](http://google.com), as well as in many native iPhone applications).

Expand Down
12 changes: 7 additions & 5 deletions docs/examples/jrespond/index.html
Expand Up @@ -132,15 +132,17 @@ <h2 id="about"><a href="#about">Who Made This Wonderful Little Plugin?</a></h2>
View my uncompressed script for this page at http://jpanelmenu.com/js/script.js
Other Included Files:
http://jpanelmenu.com/js/lib/modernizr-2.6.1.min.js
http://jpanelmenu.com/js/lib/respond-1.1.0.min.js
http://jpanelmenu.com/js/lib/jRespond-0.7.2.min.js
http://jpanelmenu.com/js/lib/jPanelMenu-1.1.0.min.js
http://jpanelmenu.com/js/lib/respond.js
http://jpanelmenu.com/js/lib/jRespond.js
http://jpanelmenu.com/js/lib/highlight.min.js
http://jpanelmenu.com/js/lib/jquery-1.9.0.js
http://jpanelmenu.com/js/lib/jquery.jpanelmenu.min.js
http://jpanelmenu.com/js/lib/plugins.js
-->
http://jpanelmenu.com/js/script.js
-->
<script src="../../js/example-jRespond.min.js"></script>
</body>
</html>
24 changes: 7 additions & 17 deletions docs/index.html
Expand Up @@ -40,15 +40,8 @@ <h1 class="logo"><a href="." class="ss-list">jPanelMenu</a></h1>
</header>

<div class="content">
<section>
<h2 id="form"><a href="#">Sample with inputfields</a></h2>
<form action="">
<input type="text">
<textarea name="" id="" cols="30" rows="10"></textarea>
</form>
</section>
<section class="intro">
<h2 id="overview"><a href="#">Version 1.1</a></h2>
<h2 id="overview"><a href="#">Version 1.1.1</a></h2>
<div class="text">
<p>jPanelMenu is a <a href="http://jquery.com">jQuery</a> plugin that creates a paneled-style menu (like the type seen in the mobile versions of <a href="http://m.facebook.com">Facebook</a> and <a href="http://google.com">Google</a>, as well as in many native iPhone applications).</p>
<p class="jPM-specific">Just click on the menu button (the top left of this page) to see it in action.</p>
Expand Down Expand Up @@ -548,19 +541,16 @@ <h2 id="about"><a href="#about">Who Made This Wonderful Little Plugin?</a></h2>
View my uncompressed script for this page at http://jpanelmenu.com/js/script.js
Other Included Files:
http://jpanelmenu.com/js/lib/modernizr-2.6.1.min.js
http://jpanelmenu.com/js/lib/respond-1.1.0.min.js
http://jpanelmenu.com/js/lib/jPanelMenu-1.1.0.min.js
http://jpanelmenu.com/js/lib/respond.js
http://jpanelmenu.com/js/lib/highlight.min.js
http://jpanelmenu.com/js/lib/jquery-1.9.0.js
http://jpanelmenu.com/js/lib/jquery.jpanelmenu.min.js
http://jpanelmenu.com/js/lib/plugins.js
http://jpanelmenu.com/js/script.js
-->

<script src="js/lib/modernizr-2.6.1.min.js"></script>
<script src="js/lib/respond-1.1.0.min.js"></script>
<script src="../jPanelMenu-1.1.0.js"></script>
<script src="js/lib/highlight.min.js"></script>
<script src="js/lib/plugins.js"></script>
<script src="js/script.js"></script>
<script src="js/script.min.js"></script>
</body>
</html>
8 changes: 8 additions & 0 deletions docs/js/example-jRespond.js
@@ -1,3 +1,11 @@
// @codekit-prepend lib/modernizr-2.6.1.min.js
// @codekit-prepend lib/respond.js
// @codekit-prepend lib/jRespond.js
// @codekit-prepend lib/highlight.min.js
// @codekit-prepend lib/jquery-1.9.0.js
// @codekit-prepend lib/jquery.jpanelmenu.min.js
// @codekit-prepend lib/plugins.js

var jPanelMenu = {};
$(function() {
$('pre').each(function(i, e) {hljs.highlightBlock(e)});
Expand Down
6 changes: 4 additions & 2 deletions docs/js/example-jRespond.min.js

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions docs/js/lib/jPanelMenu-1.1.0.min.js

This file was deleted.

7 changes: 0 additions & 7 deletions docs/js/lib/jRespond-0.7.2.min.js

This file was deleted.

181 changes: 181 additions & 0 deletions docs/js/lib/jRespond.js
@@ -0,0 +1,181 @@
/*! jRespond.js v 0.9 | Author: Jeremy Fields [jeremy.fields@viget.com], 2013 | License: MIT */
/*! viewportSize | Author: Tyson Matanich, 2013 | License: MIT */

(function(win,doc,undefined) {

'use strict';

win.jRespond = function(breakpoints) {

// array for registered functions
var mediaListeners = [];

// array that corresponds to mediaListeners and holds the current on/off state
var mediaInit = [];

// array of media query breakpoints; adjust as needed
var mediaBreakpoints = breakpoints;

// store the current breakpoint
var curr = '';

// window resize event timer stuff
var resizeTimer;
var resizeW = 0;
var resizeTmrFast = 100;
var resizeTmrSlow = 500;
var resizeTmrSpd = resizeTmrSlow;

// send media to the mediaListeners array
var addFunction = function(elm) {

var brkpt = elm['breakpoint'];
var entr = elm['enter'] || undefined;

// add function to stack
mediaListeners.push(elm);

// add corresponding entry to mediaInit
mediaInit.push(false);

if (testForCurr(brkpt)) {
if (entr !== undefined) {
entr.call();
}
mediaInit[(mediaListeners.length - 1)] = true;
}
};

// loops through all registered functions and determines what should be fired
var cycleThrough = function() {

var enterArray = [];
var exitArray = [];

for (var i = 0; i < mediaListeners.length; i++) {
var brkpt = mediaListeners[i]['breakpoint'];
var entr = mediaListeners[i]['enter'] || undefined;
var exit = mediaListeners[i]['exit'] || undefined;

if (brkpt === '*') {
if (entr !== undefined) {
enterArray.push(entr);
}
if (exit !== undefined) {
exitArray.push(exit);
}
} else if (testForCurr(brkpt)) {
if (entr !== undefined && !mediaInit[i]) {
enterArray.push(entr);
}
mediaInit[i] = true;
} else {
if (exit !== undefined && mediaInit[i]) {
exitArray.push(exit);
}
mediaInit[i] = false;
}
}

// loop through exit functions to call
for (var j = 0; j < exitArray.length; j++) {
exitArray[j].call();
}

// then loop through enter functions to call
for (var k = 0; k < enterArray.length; k++) {
enterArray[k].call();
}
};

// checks for the correct breakpoint against the mediaBreakpoints list
var returnBreakpoint = function(width) {

var foundBrkpt = false;

// look for existing breakpoint based on width
for (var i = 0; i < mediaBreakpoints.length; i++) {

// if registered breakpoint found, break out of loop
if (width >= mediaBreakpoints[i]['enter'] && width <= mediaBreakpoints[i]['exit']) {
foundBrkpt = true;

break;
}
}

// if breakpoint is found and it's not the current one
if (foundBrkpt && curr !== mediaBreakpoints[i]['label']) {
curr = mediaBreakpoints[i]['label'];

// run the loop
cycleThrough();

// or if no breakpoint applies
} else if (!foundBrkpt && curr !== '') {
curr = '';

// run the loop
cycleThrough();
}

};

// takes the breakpoint/s arguement from an object and tests it against the current state
var testForCurr = function(elm) {

// if there's an array of breakpoints
if (typeof elm === 'object') {
if (elm.join().indexOf(curr) >= 0) {
return true;
}

// if the string is '*' then run at every breakpoint
} else if (elm === '*') {
return true;

// or if it's a single breakpoint
} else if (typeof elm === 'string') {
if (curr === elm) {
return true;
}
}
};

// self-calling function that checks the browser width and delegates if it detects a change
var checkResize = function() {

// get current width
var w = viewportSize.getWidth();

// if there is a change speed up the timer and fire the returnBreakpoint function
if (w !== resizeW) {
resizeTmrSpd = resizeTmrFast;

returnBreakpoint(w);

// otherwise keep on keepin' on
} else {
resizeTmrSpd = resizeTmrSlow;
}

resizeW = w;

// calls itself on a setTimeout
setTimeout(checkResize, resizeTmrSpd);
};
checkResize();

// return
return {
addFunc: function(elm) { addFunction(elm); },
getBreakpoint: function() { return curr; }
};

};

}(this,this.document));


/*! viewportSize | Author: Tyson Matanich, 2013 | License: MIT */
(function(n){n.viewportSize={},n.viewportSize.getHeight=function(){return t("Height")},n.viewportSize.getWidth=function(){return t("Width")};var t=function(t){var f,o=t.toLowerCase(),e=n.document,i=e.documentElement,r,u;return n["inner"+t]===undefined?f=i["client"+t]:n["inner"+t]!=i["client"+t]?(r=e.createElement("body"),r.id="vpw-test-b",r.style.cssText="overflow:scroll",u=e.createElement("div"),u.id="vpw-test-d",u.style.cssText="position:absolute;top:-1000px",u.innerHTML="<style>@media("+o+":"+i["client"+t]+"px){body#vpw-test-b div#vpw-test-d{"+o+":7px!important}}<\/style>",r.appendChild(u),i.insertBefore(r,e.head),f=u["offset"+t]==7?i["client"+t]:n["inner"+t],i.removeChild(r)):f=n["inner"+t],f}})(this);
2 changes: 0 additions & 2 deletions docs/js/lib/jquery-1.8.2.min.js

This file was deleted.

0 comments on commit 74b6a67

Please sign in to comment.