author | Giulio Cesare Solaroli <giulio.cesare@clipperz.com> | 2013-04-21 15:53:34 (UTC) |
---|---|---|
committer | Giulio Cesare Solaroli <giulio.cesare@clipperz.com> | 2013-04-21 15:53:34 (UTC) |
commit | 0608e045f6aa471916829468f48082ea07a453f4 (patch) (unidiff) | |
tree | 57748b9a76e592ae35b165cd6a203e12493d4044 /frontend/gamma/js/Zepto/data.js | |
parent | 074e70457c90344b3c1cb236105638d692a0066b (diff) | |
download | clipperz-0608e045f6aa471916829468f48082ea07a453f4.zip clipperz-0608e045f6aa471916829468f48082ea07a453f4.tar.gz clipperz-0608e045f6aa471916829468f48082ea07a453f4.tar.bz2 |
Removed extra JS libraries no longer used for the mobile version
Diffstat (limited to 'frontend/gamma/js/Zepto/data.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Zepto/data.js | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/frontend/gamma/js/Zepto/data.js b/frontend/gamma/js/Zepto/data.js deleted file mode 100644 index b4c289f..0000000 --- a/frontend/gamma/js/Zepto/data.js +++ b/dev/null | |||
@@ -1,67 +0,0 @@ | |||
1 | // Zepto.js | ||
2 | // (c) 2010-2012 Thomas Fuchs | ||
3 | // Zepto.js may be freely distributed under the MIT license. | ||
4 | |||
5 | // The following code is heavily inspired by jQuery's $.fn.data() | ||
6 | |||
7 | ;(function($) { | ||
8 | var data = {}, dataAttr = $.fn.data, camelize = $.camelCase, | ||
9 | exp = $.expando = 'Zepto' + (+new Date()) | ||
10 | |||
11 | // Get value from node: | ||
12 | // 1. first try key as given, | ||
13 | // 2. then try camelized key, | ||
14 | // 3. fall back to reading "data-*" attribute. | ||
15 | function getData(node, name) { | ||
16 | var id = node[exp], store = id && data[id] | ||
17 | if (name === undefined) return store || setData(node) | ||
18 | else { | ||
19 | if (store) { | ||
20 | if (name in store) return store[name] | ||
21 | var camelName = camelize(name) | ||
22 | if (camelName in store) return store[camelName] | ||
23 | } | ||
24 | return dataAttr.call($(node), name) | ||
25 | } | ||
26 | } | ||
27 | |||
28 | // Store value under camelized key on node | ||
29 | function setData(node, name, value) { | ||
30 | var id = node[exp] || (node[exp] = ++$.uuid), | ||
31 | store = data[id] || (data[id] = attributeData(node)) | ||
32 | if (name !== undefined) store[camelize(name)] = value | ||
33 | return store | ||
34 | } | ||
35 | |||
36 | // Read all "data-*" attributes from a node | ||
37 | function attributeData(node) { | ||
38 | var store = {} | ||
39 | $.each(node.attributes, function(i, attr){ | ||
40 | if (attr.name.indexOf('data-') == 0) | ||
41 | store[camelize(attr.name.replace('data-', ''))] = | ||
42 | $.zepto.deserializeValue(attr.value) | ||
43 | }) | ||
44 | return store | ||
45 | } | ||
46 | |||
47 | $.fn.data = function(name, value) { | ||
48 | return value === undefined ? | ||
49 | // set multiple values via object | ||
50 | $.isPlainObject(name) ? | ||
51 | this.each(function(i, node){ | ||
52 | $.each(name, function(key, value){ setData(node, key, value) }) | ||
53 | }) : | ||
54 | // get value from first element | ||
55 | this.length == 0 ? undefined : getData(this[0], name) : | ||
56 | // set value on all elements | ||
57 | this.each(function(){ setData(this, name, value) }) | ||
58 | } | ||
59 | |||
60 | $.fn.removeData = function(names) { | ||
61 | if (typeof names == 'string') names = names.split(/\s+/) | ||
62 | return this.each(function(){ | ||
63 | var id = this[exp], store = id && data[id] | ||
64 | if (store) $.each(names, function(){ delete store[camelize(this)] }) | ||
65 | }) | ||
66 | } | ||
67 | })(Zepto) | ||