Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added css fixes and updated demo app
  • Loading branch information
mythz committed Nov 28, 2011
1 parent 8c66d11 commit 1acd776
Show file tree
Hide file tree
Showing 11 changed files with 128 additions and 84 deletions.
30 changes: 26 additions & 4 deletions demo.htm
@@ -1,16 +1,18 @@
<!doctype html>
<html lang="en-us">
<head>
<title>jQuip - jQuery in parts</title>
<title>jquip - jQuery-in-parts</title>
<script type="text/javascript" src="src/jquip.js"></script>
<script type="text/javascript" src="src/jquip.events.js"></script>
<script type="text/javascript" src="src/jquip.docready.js"></script>
<script type="text/javascript" src="src/jquip.css.js"></script>
<script type="text/javascript" src="src/jquip.ajax.js"></script>
<script type="text/javascript" src="src/jquip.events.js"></script>
<script type="text/javascript" src="src/jquip.custom.js"></script>
<script type="text/javascript">
$(function() {
$(document.body).append("<p>This message added on document ready</p>");
$(document.body)
.css({'font-family':'Arial'})
.append("<p>This message added on document ready</p>");
$(".attrs button").click(function ()
{
var $dl = $(this).next();
Expand All @@ -19,15 +21,35 @@
$dl.append("<dt>" + name + "</dt>").append("<dd>" + val + "</dd>");
});
});
var compiledTpl = $._template($("#tpl").html()), $win = $(window);
$win.resize(function(){
var html = compiledTpl({width: $win.width(), height: $win.height()});
$("#winsize").html(html);
});
$win.resize();

function rgb()
{
return Math.floor(Math.random() * 255);
}
$("body > button").click(function(){
$(document.body).css({background:"rgb(" + rgb() + "," + rgb() + "," + rgb() + ")"});
});
});
</script>
</head>
<body>
<script id="tpl" type="text/tpl">
<p>The Size of this window is <%= width %>x<%= height %> (uses $.template - resize to update).</p>
</script>

<h2>Simple Demo</h2>

<div id="winsize"></div>
<button>Change Background</button>

<div class="attrs" data-one="uno" data-two="due" data-three="tre">
<button>Print Data Attributes</button>
<button>Print Data Attributes</button>
<dl></dl>
</div>

Expand Down
30 changes: 26 additions & 4 deletions demo.min.htm
Expand Up @@ -3,31 +3,53 @@
<head>
<title>jQuip - jQuery in parts</title>
<script type="text/javascript" src="dist/jquip.min.js"></script>
<script type="text/javascript" src="dist/jquip.events.min.js"></script>
<script type="text/javascript" src="dist/jquip.docready.min.js"></script>
<script type="text/javascript" src="dist/jquip.css.min.js"></script>
<script type="text/javascript" src="dist/jquip.ajax.min.js"></script>
<script type="text/javascript" src="dist/jquip.events.min.js"></script>
<script type="text/javascript" src="dist/jquip.custom.min.js"></script>
<script type="text/javascript">
$(function() {
$(document.body).append("<p>This message added on document ready</p>");
$(document.body)
.css({'font-family':'Arial'})
.append("<p>This message added on document ready</p>");
$(".attrs button").click(function ()
{
var $dl = $(this).next();
var $dl = $(this).next();
$.each($(this).parent().data(), function (name, val)
{
$dl.append("<dt>" + name + "</dt>").append("<dd>" + val + "</dd>");
});
});
var compiledTpl = $._template($("#tpl").html()), $win = $(window);
$win.resize(function(){
var html = compiledTpl({width: $win.width(), height: $win.height()});
$("#winsize").html(html);
});
$win.resize();

function rgb()
{
return Math.floor(Math.random() * 255);
}
$("body > button").click(function(){
$(document.body).css({background:"rgb(" + rgb() + "," + rgb() + "," + rgb() + ")"});
});
});
</script>
</head>
<body>
<script id="tpl" type="text/tpl">
<p>The Size of this window is <%= width %>x<%= height %> (uses $.template - resize to update).</p>
</script>

<h2>Simple Demo</h2>

<div id="winsize"></div>
<button>Change Background</button>

<div class="attrs" data-one="uno" data-two="due" data-three="tre">
<button>Print Data Attributes</button>
<button>Print Data Attributes</button>
<dl></dl>
</div>

Expand Down
110 changes: 55 additions & 55 deletions dist/jquip.all.closure-advanced.js

Large diffs are not rendered by default.

19 changes: 9 additions & 10 deletions dist/jquip.all.js
Expand Up @@ -31,7 +31,7 @@ window['$'] = window['jquip'] = (function(){
col: [2, "<table><tbody></tbody><colgroup>", "</colgroup></table>"],
area: [1, "<map>", "</map>"],
_default: [0, "", ""] },
rComplexQuery = /[,\s.\[]/, emptyArr = [],
rComplexQuery = /[,\s.\[>+]/, emptyArr = [],
breaker = {},
ArrayProto = Array.prototype, ObjProto = Object.prototype,
hasOwn = ObjProto.hasOwnProperty,
Expand Down Expand Up @@ -439,7 +439,8 @@ window['$'] = window['jquip'] = (function(){
qry = qry || $['query'];
var firstChar = sel.charAt(0), arg = sel.substring(1), complex = rComplexQuery.test(arg), el;
try{
if (complex) return slice.call(qry(sel, ctx));
if (complex)
return slice.call(qry(sel, ctx));
return complex
? slice.call(qry(sel, ctx))
: (firstChar == "#"
Expand Down Expand Up @@ -1067,7 +1068,7 @@ $['plug']("css", function ($) {
}
curCSS = getComputedStyle || currentStyle;

$['fn']['css '] = function (name, value) {
$['fn']['css'] = function (name, value) {
if (arguments.length === 2 && value === undefined) return this;

return access(this, name, value, true, function (el, name, value) {
Expand All @@ -1076,7 +1077,7 @@ $['plug']("css", function ($) {
};
$['cssNumber'] = { "zIndex": true, "fontWeight": true, "opacity": true, "zoom": true, "lineHeight": true };
$['cssProps'] = { "float": $['support']['cssFloat'] ? "cssFloat" : "styleFloat" };
$['style'] = function style(el, name, value, extra) {
function style(el, name, value, extra) {
if (!el || el.nodeType === 3 || el.nodeType === 8 || !el.style) return;
var ret, origName = camelCase(name), style = el.style, hooks = $['cssHooks'][origName];
name = $['cssProps'][origName] || origName;
Expand All @@ -1093,7 +1094,7 @@ $['plug']("css", function ($) {
return ret;
return style[name];
}
};
} $['style'] = style;
function css(el, name, extra) {
var ret, origName = camelCase(name), hooks = $['cssHooks'][origName];
name = $['cssProps'][origName] || origName;
Expand Down Expand Up @@ -1139,13 +1140,11 @@ $['plug']("css", function ($) {
$['fn'][type] = function (size) {
var el = this[0];
if (!el) return size == null ? null : this;

if ($['isFunction'](size))
return this.each(function (i) {
var self = $(this);
self[type](size.call(this, i, self[type]()));
});

if ($['isWindow'](el)) {
var docElemProp = el.document.documentElement["client" + name], body = el.document.body;
return el.document.compatMode === "CSS1Compat" && docElemProp || body && body["client" + name] || docElemProp;
Expand All @@ -1159,7 +1158,7 @@ $['plug']("css", function ($) {
ret = parseFloat(orig);
return $['isNaN'](ret) ? orig : ret;
}
else return this.css(type, typeof size === "string" ? size : size + "px");
else return this['css'](type, typeof size === "string" ? size : size + "px");
};
});

Expand Down Expand Up @@ -1225,7 +1224,7 @@ $['plug']("custom", function($){
interpolate : /<%=([\s\S]+?)%>/g,
escape : /<%-([\s\S]+?)%>/g
};
$['template'] = function(str, data) {
$['_template'] = function(str, data) {
var c = $['templateSettings'];
var tmpl = 'var __p=[],print=function(){__p.push.apply(__p,arguments);};' +
'with(obj||{}){__p.push(\'' +
Expand All @@ -1246,7 +1245,7 @@ $['plug']("custom", function($){
.replace(/\t/g, '\\t')
+ "');}return __p.join('');";
var func = new Function('obj', '_', tmpl);
return data ? func(data, _) : function(data) { return func(data, _) };
return data ? func(data, $) : function(data) { return func(data, $) };
};
});
$['plug']("docready", function ($) {
Expand Down
2 changes: 1 addition & 1 deletion dist/jquip.all.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/jquip.css.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/jquip.custom.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/jquip.min.js

Large diffs are not rendered by default.

0 comments on commit 1acd776

Please sign in to comment.