Skip to content

Commit 3160f98

Browse files
committed
Merge master into release branch
2 parents ff4d352 + b6ec8ce commit 3160f98

File tree

6 files changed

+62
-4
lines changed

6 files changed

+62
-4
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "patterns",
3-
"version": "2.0.1",
3+
"version": "2.0.6",
44
"main": "bundle.js",
55
"devDependencies": {
66
"jasmine": "https://github.com/jcbrand/jasmine.git#1_3_x"

build.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141

4242
// Core
4343
"pat-utils": "core/utils",
44+
"pat-pluggable": "core/pluggable",
4445
"pat-compat": "core/compat",
4546
"pat-jquery-ext": "core/jquery-ext",
4647
"pat-logger": "core/logger",

changes.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44

55
- #383 pat-equaliser sets the height to early
66

7+
## 2.0.6 - Dec. 10, 2014
8+
9+
- New core module pluggable.js which allows the creation of Pluggable patterns.
10+
11+
## 2.0.5 - Dec. 4, 2014
12+
13+
- #383 pat-equaliser sets the height to early
14+
715
## 2.0.4 - Oct. 7, 2014
816

917
- spectrum lib for colour picker now defaults to hsv values. Keep hex as default for backward compatibility (SLC ref 9849)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "patterns",
3-
"version": "2.0.1",
3+
"version": "2.0.6",
44
"title": "Markup patterns to drive behaviour.",
55
"description":
66
"Patterns is a JavaScript library that enables designers to build rich interactive prototypes without the need for writing any Javascript. All events are triggered by classes and other attributes in the HTML, without abusing the HTML as a programming language. Accessibility, SEO and well structured HTML are core values of Patterns.",

src/core/pluggable.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
define([
2+
"jquery",
3+
"pat-utils"
4+
], function($, utils) {
5+
var pluggable = {
6+
7+
extend: function (attrs) {
8+
return utils.extend(this, attrs);
9+
},
10+
11+
registerPlugin: function (name, callback) {
12+
this.plugins[name] = callback;
13+
},
14+
15+
initializePlugins: function () {
16+
var args = arguments;
17+
_.each(_.keys(this.plugins), $.proxy(function (k) {
18+
$.proxy(this.plugins[k], this)(this, args);
19+
}, this));
20+
return args;
21+
}
22+
};
23+
return pluggable;
24+
});

src/core/utils.js

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ define([
2424
return plugin;
2525
};
2626

27+
2728
// Underscore.js 1.3.1
2829
// (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
2930
// Underscore is freely distributable under the MIT license.
@@ -46,13 +47,35 @@ define([
4647
clearTimeout(timeout);
4748
timeout = setTimeout(later, wait);
4849
};
49-
};
50+
}
51+
52+
// Is a given variable an object?
53+
function isObject(obj) {
54+
var type = typeof obj;
55+
return type === 'function' || type === 'object' && !!obj;
56+
}
57+
58+
// Extend a given object with all the properties in passed-in object(s).
59+
function extend(obj) {
60+
if (!isObject(obj)) return obj;
61+
var source, prop;
62+
for (var i = 1, length = arguments.length; i < length; i++) {
63+
source = arguments[i];
64+
for (prop in source) {
65+
if (hasOwnProperty.call(source, prop)) {
66+
obj[prop] = source[prop];
67+
}
68+
}
69+
}
70+
return obj;
71+
}
72+
// END: Taken from Underscore.js until here.
5073

5174
function rebaseURL(base, url) {
5275
if (url.indexOf("://")!==-1 || url[0]==="/")
5376
return url;
5477
return base.slice(0, base.lastIndexOf("/")+1) + url;
55-
};
78+
}
5679

5780
function findLabel(input) {
5881
for (var label=input.parentNode; label && label.nodeType!==11; label=label.parentNode)
@@ -183,6 +206,8 @@ define([
183206
jquery_plugin: jquery_plugin,
184207
debounce: debounce,
185208
escapeRegExp: escapeRegExp,
209+
isObject: isObject,
210+
extend: extend,
186211
rebaseURL: rebaseURL,
187212
findLabel: findLabel,
188213
elementInViewport: elementInViewport,

0 commit comments

Comments
 (0)