logster 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/Guardfile +8 -0
- data/LICENSE.txt +22 -0
- data/README.md +38 -0
- data/Rakefile +18 -0
- data/assets/javascript/app.js +377 -0
- data/assets/javascript/external/ember.js +44267 -0
- data/assets/javascript/external/ember.min.js +19 -0
- data/assets/javascript/external/handlebars.min.js +28 -0
- data/assets/javascript/external/jquery.min.js +5 -0
- data/assets/javascript/external/lodash.min.js +56 -0
- data/assets/javascript/external/moment.min.js +6 -0
- data/assets/javascript/templates/application.handlebars +1 -0
- data/assets/javascript/templates/index.handlebars +48 -0
- data/assets/javascript/templates/message.handlebars +7 -0
- data/assets/stylesheets/app.css +188 -0
- data/bower_components/ember/.bower.json +22 -0
- data/bower_components/ember/.gitignore +5 -0
- data/bower_components/ember/Makefile +9 -0
- data/bower_components/ember/README.md +12 -0
- data/bower_components/ember/bower.json +11 -0
- data/bower_components/ember/component.json +13 -0
- data/bower_components/ember/composer.json +27 -0
- data/bower_components/ember/ember-template-compiler.js +320 -0
- data/bower_components/ember/ember.js +44267 -0
- data/bower_components/ember/ember.min.js +19 -0
- data/bower_components/ember/ember.prod.js +42649 -0
- data/bower_components/ember/package.json +11 -0
- data/bower_components/handlebars/.bower.json +16 -0
- data/bower_components/handlebars/.gitignore +2 -0
- data/bower_components/handlebars/README.md +11 -0
- data/bower_components/handlebars/bower.json +6 -0
- data/bower_components/handlebars/component.json +9 -0
- data/bower_components/handlebars/composer.json +35 -0
- data/bower_components/handlebars/handlebars-source.gemspec +21 -0
- data/bower_components/handlebars/handlebars.amd.js +2719 -0
- data/bower_components/handlebars/handlebars.amd.min.js +28 -0
- data/bower_components/handlebars/handlebars.js +2746 -0
- data/bower_components/handlebars/handlebars.js.nuspec +17 -0
- data/bower_components/handlebars/handlebars.min.js +28 -0
- data/bower_components/handlebars/handlebars.runtime.amd.js +515 -0
- data/bower_components/handlebars/handlebars.runtime.amd.min.js +27 -0
- data/bower_components/handlebars/handlebars.runtime.js +530 -0
- data/bower_components/handlebars/handlebars.runtime.min.js +27 -0
- data/bower_components/handlebars/lib/handlebars/source.rb +11 -0
- data/bower_components/jquery/.bower.json +37 -0
- data/bower_components/jquery/MIT-LICENSE.txt +21 -0
- data/bower_components/jquery/bower.json +27 -0
- data/bower_components/jquery/dist/jquery.js +9111 -0
- data/bower_components/jquery/dist/jquery.min.js +5 -0
- data/bower_components/jquery/dist/jquery.min.map +1 -0
- data/bower_components/jquery/src/ajax.js +806 -0
- data/bower_components/jquery/src/ajax/jsonp.js +89 -0
- data/bower_components/jquery/src/ajax/load.js +75 -0
- data/bower_components/jquery/src/ajax/parseJSON.js +13 -0
- data/bower_components/jquery/src/ajax/parseXML.js +28 -0
- data/bower_components/jquery/src/ajax/script.js +64 -0
- data/bower_components/jquery/src/ajax/var/nonce.js +5 -0
- data/bower_components/jquery/src/ajax/var/rquery.js +3 -0
- data/bower_components/jquery/src/ajax/xhr.js +130 -0
- data/bower_components/jquery/src/attributes.js +11 -0
- data/bower_components/jquery/src/attributes/attr.js +143 -0
- data/bower_components/jquery/src/attributes/classes.js +158 -0
- data/bower_components/jquery/src/attributes/prop.js +96 -0
- data/bower_components/jquery/src/attributes/support.js +35 -0
- data/bower_components/jquery/src/attributes/val.js +153 -0
- data/bower_components/jquery/src/callbacks.js +205 -0
- data/bower_components/jquery/src/core.js +500 -0
- data/bower_components/jquery/src/core/access.js +60 -0
- data/bower_components/jquery/src/core/init.js +123 -0
- data/bower_components/jquery/src/core/parseHTML.js +39 -0
- data/bower_components/jquery/src/core/ready.js +96 -0
- data/bower_components/jquery/src/core/var/rsingleTag.js +4 -0
- data/bower_components/jquery/src/css.js +455 -0
- data/bower_components/jquery/src/css/addGetHookIf.js +24 -0
- data/bower_components/jquery/src/css/curCSS.js +57 -0
- data/bower_components/jquery/src/css/defaultDisplay.js +69 -0
- data/bower_components/jquery/src/css/hiddenVisibleSelectors.js +15 -0
- data/bower_components/jquery/src/css/support.js +83 -0
- data/bower_components/jquery/src/css/swap.js +28 -0
- data/bower_components/jquery/src/css/var/cssExpand.js +3 -0
- data/bower_components/jquery/src/css/var/getStyles.js +5 -0
- data/bower_components/jquery/src/css/var/isHidden.js +13 -0
- data/bower_components/jquery/src/css/var/rmargin.js +3 -0
- data/bower_components/jquery/src/css/var/rnumnonpx.js +5 -0
- data/bower_components/jquery/src/data.js +175 -0
- data/bower_components/jquery/src/data/Data.js +181 -0
- data/bower_components/jquery/src/data/accepts.js +20 -0
- data/bower_components/jquery/src/data/var/data_priv.js +5 -0
- data/bower_components/jquery/src/data/var/data_user.js +5 -0
- data/bower_components/jquery/src/deferred.js +149 -0
- data/bower_components/jquery/src/deprecated.js +13 -0
- data/bower_components/jquery/src/dimensions.js +50 -0
- data/bower_components/jquery/src/effects.js +642 -0
- data/bower_components/jquery/src/effects/Tween.js +114 -0
- data/bower_components/jquery/src/effects/animatedSelector.js +13 -0
- data/bower_components/jquery/src/event.js +859 -0
- data/bower_components/jquery/src/event/alias.js +39 -0
- data/bower_components/jquery/src/event/support.js +9 -0
- data/bower_components/jquery/src/exports/amd.js +18 -0
- data/bower_components/jquery/src/exports/global.js +32 -0
- data/bower_components/jquery/src/intro.js +44 -0
- data/bower_components/jquery/src/jquery.js +36 -0
- data/bower_components/jquery/src/manipulation.js +583 -0
- data/bower_components/jquery/src/manipulation/_evalUrl.js +18 -0
- data/bower_components/jquery/src/manipulation/support.js +24 -0
- data/bower_components/jquery/src/manipulation/var/rcheckableType.js +3 -0
- data/bower_components/jquery/src/offset.js +204 -0
- data/bower_components/jquery/src/outro.js +1 -0
- data/bower_components/jquery/src/queue.js +142 -0
- data/bower_components/jquery/src/queue/delay.js +22 -0
- data/bower_components/jquery/src/selector-native.js +171 -0
- data/bower_components/jquery/src/selector-sizzle.js +14 -0
- data/bower_components/jquery/src/selector.js +1 -0
- data/bower_components/jquery/src/serialize.js +111 -0
- data/bower_components/jquery/src/sizzle/dist/sizzle.js +2015 -0
- data/bower_components/jquery/src/sizzle/dist/sizzle.min.js +3 -0
- data/bower_components/jquery/src/sizzle/dist/sizzle.min.map +1 -0
- data/bower_components/jquery/src/traversing.js +200 -0
- data/bower_components/jquery/src/traversing/findFilter.js +100 -0
- data/bower_components/jquery/src/traversing/var/rneedsContext.js +6 -0
- data/bower_components/jquery/src/var/arr.js +3 -0
- data/bower_components/jquery/src/var/class2type.js +4 -0
- data/bower_components/jquery/src/var/concat.js +5 -0
- data/bower_components/jquery/src/var/hasOwn.js +5 -0
- data/bower_components/jquery/src/var/indexOf.js +5 -0
- data/bower_components/jquery/src/var/pnum.js +3 -0
- data/bower_components/jquery/src/var/push.js +5 -0
- data/bower_components/jquery/src/var/rnotwhite.js +3 -0
- data/bower_components/jquery/src/var/slice.js +5 -0
- data/bower_components/jquery/src/var/strundefined.js +3 -0
- data/bower_components/jquery/src/var/support.js +4 -0
- data/bower_components/jquery/src/var/toString.js +5 -0
- data/bower_components/jquery/src/var/trim.js +3 -0
- data/bower_components/jquery/src/wrap.js +78 -0
- data/bower_components/lodash/.bower.json +34 -0
- data/bower_components/lodash/LICENSE.txt +22 -0
- data/bower_components/lodash/bower.json +23 -0
- data/bower_components/lodash/dist/lodash.compat.js +7157 -0
- data/bower_components/lodash/dist/lodash.compat.min.js +61 -0
- data/bower_components/lodash/dist/lodash.js +6785 -0
- data/bower_components/lodash/dist/lodash.min.js +56 -0
- data/bower_components/lodash/dist/lodash.underscore.js +4979 -0
- data/bower_components/lodash/dist/lodash.underscore.min.js +39 -0
- data/bower_components/moment/.bower.json +31 -0
- data/bower_components/moment/LICENSE +22 -0
- data/bower_components/moment/bower.json +20 -0
- data/bower_components/moment/lang/ar-ma.js +56 -0
- data/bower_components/moment/lang/ar.js +56 -0
- data/bower_components/moment/lang/bg.js +86 -0
- data/bower_components/moment/lang/br.js +107 -0
- data/bower_components/moment/lang/bs.js +139 -0
- data/bower_components/moment/lang/ca.js +66 -0
- data/bower_components/moment/lang/cs.js +155 -0
- data/bower_components/moment/lang/cv.js +59 -0
- data/bower_components/moment/lang/cy.js +77 -0
- data/bower_components/moment/lang/da.js +56 -0
- data/bower_components/moment/lang/de.js +71 -0
- data/bower_components/moment/lang/el.js +79 -0
- data/bower_components/moment/lang/en-au.js +62 -0
- data/bower_components/moment/lang/en-ca.js +59 -0
- data/bower_components/moment/lang/en-gb.js +63 -0
- data/bower_components/moment/lang/eo.js +65 -0
- data/bower_components/moment/lang/es.js +75 -0
- data/bower_components/moment/lang/et.js +76 -0
- data/bower_components/moment/lang/eu.js +60 -0
- data/bower_components/moment/lang/fa.js +97 -0
- data/bower_components/moment/lang/fi.js +103 -0
- data/bower_components/moment/lang/fo.js +56 -0
- data/bower_components/moment/lang/fr-ca.js +54 -0
- data/bower_components/moment/lang/fr.js +58 -0
- data/bower_components/moment/lang/gl.js +71 -0
- data/bower_components/moment/lang/he.js +77 -0
- data/bower_components/moment/lang/hi.js +105 -0
- data/bower_components/moment/lang/hr.js +140 -0
- data/bower_components/moment/lang/hu.js +105 -0
- data/bower_components/moment/lang/hy-am.js +113 -0
- data/bower_components/moment/lang/id.js +67 -0
- data/bower_components/moment/lang/is.js +124 -0
- data/bower_components/moment/lang/it.js +59 -0
- data/bower_components/moment/lang/ja.js +58 -0
- data/bower_components/moment/lang/ka.js +108 -0
- data/bower_components/moment/lang/km.js +55 -0
- data/bower_components/moment/lang/ko.js +63 -0
- data/bower_components/moment/lang/lb.js +160 -0
- data/bower_components/moment/lang/lt.js +118 -0
- data/bower_components/moment/lang/lv.js +77 -0
- data/bower_components/moment/lang/mk.js +86 -0
- data/bower_components/moment/lang/ml.js +64 -0
- data/bower_components/moment/lang/mr.js +104 -0
- data/bower_components/moment/lang/ms-my.js +66 -0
- data/bower_components/moment/lang/nb.js +57 -0
- data/bower_components/moment/lang/ne.js +105 -0
- data/bower_components/moment/lang/nl.js +67 -0
- data/bower_components/moment/lang/nn.js +56 -0
- data/bower_components/moment/lang/pl.js +98 -0
- data/bower_components/moment/lang/pt-br.js +56 -0
- data/bower_components/moment/lang/pt.js +60 -0
- data/bower_components/moment/lang/ro.js +72 -0
- data/bower_components/moment/lang/ru.js +163 -0
- data/bower_components/moment/lang/sk.js +156 -0
- data/bower_components/moment/lang/sl.js +144 -0
- data/bower_components/moment/lang/sq.js +61 -0
- data/bower_components/moment/lang/sr-cyr.js +106 -0
- data/bower_components/moment/lang/sr.js +106 -0
- data/bower_components/moment/lang/sv.js +63 -0
- data/bower_components/moment/lang/ta.js +112 -0
- data/bower_components/moment/lang/th.js +58 -0
- data/bower_components/moment/lang/tl-ph.js +58 -0
- data/bower_components/moment/lang/tr.js +93 -0
- data/bower_components/moment/lang/tzm-la.js +55 -0
- data/bower_components/moment/lang/tzm.js +55 -0
- data/bower_components/moment/lang/uk.js +157 -0
- data/bower_components/moment/lang/uz.js +55 -0
- data/bower_components/moment/lang/vi.js +62 -0
- data/bower_components/moment/lang/zh-cn.js +108 -0
- data/bower_components/moment/lang/zh-tw.js +84 -0
- data/bower_components/moment/min/langs.js +5991 -0
- data/bower_components/moment/min/langs.min.js +3 -0
- data/bower_components/moment/min/moment-with-langs.js +7993 -0
- data/bower_components/moment/min/moment-with-langs.min.js +9 -0
- data/bower_components/moment/min/moment.min.js +6 -0
- data/bower_components/moment/moment.js +2489 -0
- data/bower_components/moment/readme.md +368 -0
- data/lib/logster.rb +9 -0
- data/lib/logster/logger.rb +31 -0
- data/lib/logster/message.rb +42 -0
- data/lib/logster/middleware/reporter.rb +13 -0
- data/lib/logster/middleware/viewer.rb +122 -0
- data/lib/logster/rails/railtie.rb +39 -0
- data/lib/logster/redis_store.rb +124 -0
- data/lib/logster/version.rb +3 -0
- data/logster.gemspec +30 -0
- data/test/logster/middleware/test_viewer.rb +34 -0
- data/test/logster/test_redis_store.rb +112 -0
- data/test/test_helper.rb +6 -0
- data/website/Gemfile +6 -0
- data/website/config.ru +2 -0
- data/website/data/data.json +1 -0
- data/website/docker_container/logster.yml +95 -0
- data/website/sample.rb +85 -0
- data/website/scripts/persist_logs.rb +13 -0
- metadata +375 -0
@@ -0,0 +1,158 @@
|
|
1
|
+
define([
|
2
|
+
"../core",
|
3
|
+
"../var/rnotwhite",
|
4
|
+
"../var/strundefined",
|
5
|
+
"../data/var/data_priv",
|
6
|
+
"../core/init"
|
7
|
+
], function( jQuery, rnotwhite, strundefined, data_priv ) {
|
8
|
+
|
9
|
+
var rclass = /[\t\r\n\f]/g;
|
10
|
+
|
11
|
+
jQuery.fn.extend({
|
12
|
+
addClass: function( value ) {
|
13
|
+
var classes, elem, cur, clazz, j, finalValue,
|
14
|
+
proceed = typeof value === "string" && value,
|
15
|
+
i = 0,
|
16
|
+
len = this.length;
|
17
|
+
|
18
|
+
if ( jQuery.isFunction( value ) ) {
|
19
|
+
return this.each(function( j ) {
|
20
|
+
jQuery( this ).addClass( value.call( this, j, this.className ) );
|
21
|
+
});
|
22
|
+
}
|
23
|
+
|
24
|
+
if ( proceed ) {
|
25
|
+
// The disjunction here is for better compressibility (see removeClass)
|
26
|
+
classes = ( value || "" ).match( rnotwhite ) || [];
|
27
|
+
|
28
|
+
for ( ; i < len; i++ ) {
|
29
|
+
elem = this[ i ];
|
30
|
+
cur = elem.nodeType === 1 && ( elem.className ?
|
31
|
+
( " " + elem.className + " " ).replace( rclass, " " ) :
|
32
|
+
" "
|
33
|
+
);
|
34
|
+
|
35
|
+
if ( cur ) {
|
36
|
+
j = 0;
|
37
|
+
while ( (clazz = classes[j++]) ) {
|
38
|
+
if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
|
39
|
+
cur += clazz + " ";
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
// only assign if different to avoid unneeded rendering.
|
44
|
+
finalValue = jQuery.trim( cur );
|
45
|
+
if ( elem.className !== finalValue ) {
|
46
|
+
elem.className = finalValue;
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
return this;
|
53
|
+
},
|
54
|
+
|
55
|
+
removeClass: function( value ) {
|
56
|
+
var classes, elem, cur, clazz, j, finalValue,
|
57
|
+
proceed = arguments.length === 0 || typeof value === "string" && value,
|
58
|
+
i = 0,
|
59
|
+
len = this.length;
|
60
|
+
|
61
|
+
if ( jQuery.isFunction( value ) ) {
|
62
|
+
return this.each(function( j ) {
|
63
|
+
jQuery( this ).removeClass( value.call( this, j, this.className ) );
|
64
|
+
});
|
65
|
+
}
|
66
|
+
if ( proceed ) {
|
67
|
+
classes = ( value || "" ).match( rnotwhite ) || [];
|
68
|
+
|
69
|
+
for ( ; i < len; i++ ) {
|
70
|
+
elem = this[ i ];
|
71
|
+
// This expression is here for better compressibility (see addClass)
|
72
|
+
cur = elem.nodeType === 1 && ( elem.className ?
|
73
|
+
( " " + elem.className + " " ).replace( rclass, " " ) :
|
74
|
+
""
|
75
|
+
);
|
76
|
+
|
77
|
+
if ( cur ) {
|
78
|
+
j = 0;
|
79
|
+
while ( (clazz = classes[j++]) ) {
|
80
|
+
// Remove *all* instances
|
81
|
+
while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
|
82
|
+
cur = cur.replace( " " + clazz + " ", " " );
|
83
|
+
}
|
84
|
+
}
|
85
|
+
|
86
|
+
// only assign if different to avoid unneeded rendering.
|
87
|
+
finalValue = value ? jQuery.trim( cur ) : "";
|
88
|
+
if ( elem.className !== finalValue ) {
|
89
|
+
elem.className = finalValue;
|
90
|
+
}
|
91
|
+
}
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
return this;
|
96
|
+
},
|
97
|
+
|
98
|
+
toggleClass: function( value, stateVal ) {
|
99
|
+
var type = typeof value;
|
100
|
+
|
101
|
+
if ( typeof stateVal === "boolean" && type === "string" ) {
|
102
|
+
return stateVal ? this.addClass( value ) : this.removeClass( value );
|
103
|
+
}
|
104
|
+
|
105
|
+
if ( jQuery.isFunction( value ) ) {
|
106
|
+
return this.each(function( i ) {
|
107
|
+
jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
|
108
|
+
});
|
109
|
+
}
|
110
|
+
|
111
|
+
return this.each(function() {
|
112
|
+
if ( type === "string" ) {
|
113
|
+
// toggle individual class names
|
114
|
+
var className,
|
115
|
+
i = 0,
|
116
|
+
self = jQuery( this ),
|
117
|
+
classNames = value.match( rnotwhite ) || [];
|
118
|
+
|
119
|
+
while ( (className = classNames[ i++ ]) ) {
|
120
|
+
// check each className given, space separated list
|
121
|
+
if ( self.hasClass( className ) ) {
|
122
|
+
self.removeClass( className );
|
123
|
+
} else {
|
124
|
+
self.addClass( className );
|
125
|
+
}
|
126
|
+
}
|
127
|
+
|
128
|
+
// Toggle whole class name
|
129
|
+
} else if ( type === strundefined || type === "boolean" ) {
|
130
|
+
if ( this.className ) {
|
131
|
+
// store className if set
|
132
|
+
data_priv.set( this, "__className__", this.className );
|
133
|
+
}
|
134
|
+
|
135
|
+
// If the element has a class name or if we're passed "false",
|
136
|
+
// then remove the whole classname (if there was one, the above saved it).
|
137
|
+
// Otherwise bring back whatever was previously saved (if anything),
|
138
|
+
// falling back to the empty string if nothing was stored.
|
139
|
+
this.className = this.className || value === false ? "" : data_priv.get( this, "__className__" ) || "";
|
140
|
+
}
|
141
|
+
});
|
142
|
+
},
|
143
|
+
|
144
|
+
hasClass: function( selector ) {
|
145
|
+
var className = " " + selector + " ",
|
146
|
+
i = 0,
|
147
|
+
l = this.length;
|
148
|
+
for ( ; i < l; i++ ) {
|
149
|
+
if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
|
150
|
+
return true;
|
151
|
+
}
|
152
|
+
}
|
153
|
+
|
154
|
+
return false;
|
155
|
+
}
|
156
|
+
});
|
157
|
+
|
158
|
+
});
|
@@ -0,0 +1,96 @@
|
|
1
|
+
define([
|
2
|
+
"../core",
|
3
|
+
"../core/access",
|
4
|
+
"./support"
|
5
|
+
], function( jQuery, access, support ) {
|
6
|
+
|
7
|
+
var rfocusable = /^(?:input|select|textarea|button)$/i;
|
8
|
+
|
9
|
+
jQuery.fn.extend({
|
10
|
+
prop: function( name, value ) {
|
11
|
+
return access( this, jQuery.prop, name, value, arguments.length > 1 );
|
12
|
+
},
|
13
|
+
|
14
|
+
removeProp: function( name ) {
|
15
|
+
return this.each(function() {
|
16
|
+
delete this[ jQuery.propFix[ name ] || name ];
|
17
|
+
});
|
18
|
+
}
|
19
|
+
});
|
20
|
+
|
21
|
+
jQuery.extend({
|
22
|
+
propFix: {
|
23
|
+
"for": "htmlFor",
|
24
|
+
"class": "className"
|
25
|
+
},
|
26
|
+
|
27
|
+
prop: function( elem, name, value ) {
|
28
|
+
var ret, hooks, notxml,
|
29
|
+
nType = elem.nodeType;
|
30
|
+
|
31
|
+
// don't get/set properties on text, comment and attribute nodes
|
32
|
+
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
|
33
|
+
return;
|
34
|
+
}
|
35
|
+
|
36
|
+
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
|
37
|
+
|
38
|
+
if ( notxml ) {
|
39
|
+
// Fix name and attach hooks
|
40
|
+
name = jQuery.propFix[ name ] || name;
|
41
|
+
hooks = jQuery.propHooks[ name ];
|
42
|
+
}
|
43
|
+
|
44
|
+
if ( value !== undefined ) {
|
45
|
+
return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?
|
46
|
+
ret :
|
47
|
+
( elem[ name ] = value );
|
48
|
+
|
49
|
+
} else {
|
50
|
+
return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?
|
51
|
+
ret :
|
52
|
+
elem[ name ];
|
53
|
+
}
|
54
|
+
},
|
55
|
+
|
56
|
+
propHooks: {
|
57
|
+
tabIndex: {
|
58
|
+
get: function( elem ) {
|
59
|
+
return elem.hasAttribute( "tabindex" ) || rfocusable.test( elem.nodeName ) || elem.href ?
|
60
|
+
elem.tabIndex :
|
61
|
+
-1;
|
62
|
+
}
|
63
|
+
}
|
64
|
+
}
|
65
|
+
});
|
66
|
+
|
67
|
+
// Support: IE9+
|
68
|
+
// Selectedness for an option in an optgroup can be inaccurate
|
69
|
+
if ( !support.optSelected ) {
|
70
|
+
jQuery.propHooks.selected = {
|
71
|
+
get: function( elem ) {
|
72
|
+
var parent = elem.parentNode;
|
73
|
+
if ( parent && parent.parentNode ) {
|
74
|
+
parent.parentNode.selectedIndex;
|
75
|
+
}
|
76
|
+
return null;
|
77
|
+
}
|
78
|
+
};
|
79
|
+
}
|
80
|
+
|
81
|
+
jQuery.each([
|
82
|
+
"tabIndex",
|
83
|
+
"readOnly",
|
84
|
+
"maxLength",
|
85
|
+
"cellSpacing",
|
86
|
+
"cellPadding",
|
87
|
+
"rowSpan",
|
88
|
+
"colSpan",
|
89
|
+
"useMap",
|
90
|
+
"frameBorder",
|
91
|
+
"contentEditable"
|
92
|
+
], function() {
|
93
|
+
jQuery.propFix[ this.toLowerCase() ] = this;
|
94
|
+
});
|
95
|
+
|
96
|
+
});
|
@@ -0,0 +1,35 @@
|
|
1
|
+
define([
|
2
|
+
"../var/support"
|
3
|
+
], function( support ) {
|
4
|
+
|
5
|
+
(function() {
|
6
|
+
var input = document.createElement( "input" ),
|
7
|
+
select = document.createElement( "select" ),
|
8
|
+
opt = select.appendChild( document.createElement( "option" ) );
|
9
|
+
|
10
|
+
input.type = "checkbox";
|
11
|
+
|
12
|
+
// Support: iOS 5.1, Android 4.x, Android 2.3
|
13
|
+
// Check the default checkbox/radio value ("" on old WebKit; "on" elsewhere)
|
14
|
+
support.checkOn = input.value !== "";
|
15
|
+
|
16
|
+
// Must access the parent to make an option select properly
|
17
|
+
// Support: IE9, IE10
|
18
|
+
support.optSelected = opt.selected;
|
19
|
+
|
20
|
+
// Make sure that the options inside disabled selects aren't marked as disabled
|
21
|
+
// (WebKit marks them as disabled)
|
22
|
+
select.disabled = true;
|
23
|
+
support.optDisabled = !opt.disabled;
|
24
|
+
|
25
|
+
// Check if an input maintains its value after becoming a radio
|
26
|
+
// Support: IE9, IE10
|
27
|
+
input = document.createElement( "input" );
|
28
|
+
input.value = "t";
|
29
|
+
input.type = "radio";
|
30
|
+
support.radioValue = input.value === "t";
|
31
|
+
})();
|
32
|
+
|
33
|
+
return support;
|
34
|
+
|
35
|
+
});
|
@@ -0,0 +1,153 @@
|
|
1
|
+
define([
|
2
|
+
"../core",
|
3
|
+
"./support",
|
4
|
+
"../core/init"
|
5
|
+
], function( jQuery, support ) {
|
6
|
+
|
7
|
+
var rreturn = /\r/g;
|
8
|
+
|
9
|
+
jQuery.fn.extend({
|
10
|
+
val: function( value ) {
|
11
|
+
var hooks, ret, isFunction,
|
12
|
+
elem = this[0];
|
13
|
+
|
14
|
+
if ( !arguments.length ) {
|
15
|
+
if ( elem ) {
|
16
|
+
hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
|
17
|
+
|
18
|
+
if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
|
19
|
+
return ret;
|
20
|
+
}
|
21
|
+
|
22
|
+
ret = elem.value;
|
23
|
+
|
24
|
+
return typeof ret === "string" ?
|
25
|
+
// handle most common string cases
|
26
|
+
ret.replace(rreturn, "") :
|
27
|
+
// handle cases where value is null/undef or number
|
28
|
+
ret == null ? "" : ret;
|
29
|
+
}
|
30
|
+
|
31
|
+
return;
|
32
|
+
}
|
33
|
+
|
34
|
+
isFunction = jQuery.isFunction( value );
|
35
|
+
|
36
|
+
return this.each(function( i ) {
|
37
|
+
var val;
|
38
|
+
|
39
|
+
if ( this.nodeType !== 1 ) {
|
40
|
+
return;
|
41
|
+
}
|
42
|
+
|
43
|
+
if ( isFunction ) {
|
44
|
+
val = value.call( this, i, jQuery( this ).val() );
|
45
|
+
} else {
|
46
|
+
val = value;
|
47
|
+
}
|
48
|
+
|
49
|
+
// Treat null/undefined as ""; convert numbers to string
|
50
|
+
if ( val == null ) {
|
51
|
+
val = "";
|
52
|
+
|
53
|
+
} else if ( typeof val === "number" ) {
|
54
|
+
val += "";
|
55
|
+
|
56
|
+
} else if ( jQuery.isArray( val ) ) {
|
57
|
+
val = jQuery.map( val, function( value ) {
|
58
|
+
return value == null ? "" : value + "";
|
59
|
+
});
|
60
|
+
}
|
61
|
+
|
62
|
+
hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
|
63
|
+
|
64
|
+
// If set returns undefined, fall back to normal setting
|
65
|
+
if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
|
66
|
+
this.value = val;
|
67
|
+
}
|
68
|
+
});
|
69
|
+
}
|
70
|
+
});
|
71
|
+
|
72
|
+
jQuery.extend({
|
73
|
+
valHooks: {
|
74
|
+
select: {
|
75
|
+
get: function( elem ) {
|
76
|
+
var value, option,
|
77
|
+
options = elem.options,
|
78
|
+
index = elem.selectedIndex,
|
79
|
+
one = elem.type === "select-one" || index < 0,
|
80
|
+
values = one ? null : [],
|
81
|
+
max = one ? index + 1 : options.length,
|
82
|
+
i = index < 0 ?
|
83
|
+
max :
|
84
|
+
one ? index : 0;
|
85
|
+
|
86
|
+
// Loop through all the selected options
|
87
|
+
for ( ; i < max; i++ ) {
|
88
|
+
option = options[ i ];
|
89
|
+
|
90
|
+
// IE6-9 doesn't update selected after form reset (#2551)
|
91
|
+
if ( ( option.selected || i === index ) &&
|
92
|
+
// Don't return options that are disabled or in a disabled optgroup
|
93
|
+
( support.optDisabled ? !option.disabled : option.getAttribute( "disabled" ) === null ) &&
|
94
|
+
( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
|
95
|
+
|
96
|
+
// Get the specific value for the option
|
97
|
+
value = jQuery( option ).val();
|
98
|
+
|
99
|
+
// We don't need an array for one selects
|
100
|
+
if ( one ) {
|
101
|
+
return value;
|
102
|
+
}
|
103
|
+
|
104
|
+
// Multi-Selects return an array
|
105
|
+
values.push( value );
|
106
|
+
}
|
107
|
+
}
|
108
|
+
|
109
|
+
return values;
|
110
|
+
},
|
111
|
+
|
112
|
+
set: function( elem, value ) {
|
113
|
+
var optionSet, option,
|
114
|
+
options = elem.options,
|
115
|
+
values = jQuery.makeArray( value ),
|
116
|
+
i = options.length;
|
117
|
+
|
118
|
+
while ( i-- ) {
|
119
|
+
option = options[ i ];
|
120
|
+
if ( (option.selected = jQuery.inArray( jQuery(option).val(), values ) >= 0) ) {
|
121
|
+
optionSet = true;
|
122
|
+
}
|
123
|
+
}
|
124
|
+
|
125
|
+
// force browsers to behave consistently when non-matching value is set
|
126
|
+
if ( !optionSet ) {
|
127
|
+
elem.selectedIndex = -1;
|
128
|
+
}
|
129
|
+
return values;
|
130
|
+
}
|
131
|
+
}
|
132
|
+
}
|
133
|
+
});
|
134
|
+
|
135
|
+
// Radios and checkboxes getter/setter
|
136
|
+
jQuery.each([ "radio", "checkbox" ], function() {
|
137
|
+
jQuery.valHooks[ this ] = {
|
138
|
+
set: function( elem, value ) {
|
139
|
+
if ( jQuery.isArray( value ) ) {
|
140
|
+
return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
|
141
|
+
}
|
142
|
+
}
|
143
|
+
};
|
144
|
+
if ( !support.checkOn ) {
|
145
|
+
jQuery.valHooks[ this ].get = function( elem ) {
|
146
|
+
// Support: Webkit
|
147
|
+
// "" is returned instead of "on" if a value isn't specified
|
148
|
+
return elem.getAttribute("value") === null ? "on" : elem.value;
|
149
|
+
};
|
150
|
+
}
|
151
|
+
});
|
152
|
+
|
153
|
+
});
|
@@ -0,0 +1,205 @@
|
|
1
|
+
define([
|
2
|
+
"./core",
|
3
|
+
"./var/rnotwhite"
|
4
|
+
], function( jQuery, rnotwhite ) {
|
5
|
+
|
6
|
+
// String to Object options format cache
|
7
|
+
var optionsCache = {};
|
8
|
+
|
9
|
+
// Convert String-formatted options into Object-formatted ones and store in cache
|
10
|
+
function createOptions( options ) {
|
11
|
+
var object = optionsCache[ options ] = {};
|
12
|
+
jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) {
|
13
|
+
object[ flag ] = true;
|
14
|
+
});
|
15
|
+
return object;
|
16
|
+
}
|
17
|
+
|
18
|
+
/*
|
19
|
+
* Create a callback list using the following parameters:
|
20
|
+
*
|
21
|
+
* options: an optional list of space-separated options that will change how
|
22
|
+
* the callback list behaves or a more traditional option object
|
23
|
+
*
|
24
|
+
* By default a callback list will act like an event callback list and can be
|
25
|
+
* "fired" multiple times.
|
26
|
+
*
|
27
|
+
* Possible options:
|
28
|
+
*
|
29
|
+
* once: will ensure the callback list can only be fired once (like a Deferred)
|
30
|
+
*
|
31
|
+
* memory: will keep track of previous values and will call any callback added
|
32
|
+
* after the list has been fired right away with the latest "memorized"
|
33
|
+
* values (like a Deferred)
|
34
|
+
*
|
35
|
+
* unique: will ensure a callback can only be added once (no duplicate in the list)
|
36
|
+
*
|
37
|
+
* stopOnFalse: interrupt callings when a callback returns false
|
38
|
+
*
|
39
|
+
*/
|
40
|
+
jQuery.Callbacks = function( options ) {
|
41
|
+
|
42
|
+
// Convert options from String-formatted to Object-formatted if needed
|
43
|
+
// (we check in cache first)
|
44
|
+
options = typeof options === "string" ?
|
45
|
+
( optionsCache[ options ] || createOptions( options ) ) :
|
46
|
+
jQuery.extend( {}, options );
|
47
|
+
|
48
|
+
var // Last fire value (for non-forgettable lists)
|
49
|
+
memory,
|
50
|
+
// Flag to know if list was already fired
|
51
|
+
fired,
|
52
|
+
// Flag to know if list is currently firing
|
53
|
+
firing,
|
54
|
+
// First callback to fire (used internally by add and fireWith)
|
55
|
+
firingStart,
|
56
|
+
// End of the loop when firing
|
57
|
+
firingLength,
|
58
|
+
// Index of currently firing callback (modified by remove if needed)
|
59
|
+
firingIndex,
|
60
|
+
// Actual callback list
|
61
|
+
list = [],
|
62
|
+
// Stack of fire calls for repeatable lists
|
63
|
+
stack = !options.once && [],
|
64
|
+
// Fire callbacks
|
65
|
+
fire = function( data ) {
|
66
|
+
memory = options.memory && data;
|
67
|
+
fired = true;
|
68
|
+
firingIndex = firingStart || 0;
|
69
|
+
firingStart = 0;
|
70
|
+
firingLength = list.length;
|
71
|
+
firing = true;
|
72
|
+
for ( ; list && firingIndex < firingLength; firingIndex++ ) {
|
73
|
+
if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
|
74
|
+
memory = false; // To prevent further calls using add
|
75
|
+
break;
|
76
|
+
}
|
77
|
+
}
|
78
|
+
firing = false;
|
79
|
+
if ( list ) {
|
80
|
+
if ( stack ) {
|
81
|
+
if ( stack.length ) {
|
82
|
+
fire( stack.shift() );
|
83
|
+
}
|
84
|
+
} else if ( memory ) {
|
85
|
+
list = [];
|
86
|
+
} else {
|
87
|
+
self.disable();
|
88
|
+
}
|
89
|
+
}
|
90
|
+
},
|
91
|
+
// Actual Callbacks object
|
92
|
+
self = {
|
93
|
+
// Add a callback or a collection of callbacks to the list
|
94
|
+
add: function() {
|
95
|
+
if ( list ) {
|
96
|
+
// First, we save the current length
|
97
|
+
var start = list.length;
|
98
|
+
(function add( args ) {
|
99
|
+
jQuery.each( args, function( _, arg ) {
|
100
|
+
var type = jQuery.type( arg );
|
101
|
+
if ( type === "function" ) {
|
102
|
+
if ( !options.unique || !self.has( arg ) ) {
|
103
|
+
list.push( arg );
|
104
|
+
}
|
105
|
+
} else if ( arg && arg.length && type !== "string" ) {
|
106
|
+
// Inspect recursively
|
107
|
+
add( arg );
|
108
|
+
}
|
109
|
+
});
|
110
|
+
})( arguments );
|
111
|
+
// Do we need to add the callbacks to the
|
112
|
+
// current firing batch?
|
113
|
+
if ( firing ) {
|
114
|
+
firingLength = list.length;
|
115
|
+
// With memory, if we're not firing then
|
116
|
+
// we should call right away
|
117
|
+
} else if ( memory ) {
|
118
|
+
firingStart = start;
|
119
|
+
fire( memory );
|
120
|
+
}
|
121
|
+
}
|
122
|
+
return this;
|
123
|
+
},
|
124
|
+
// Remove a callback from the list
|
125
|
+
remove: function() {
|
126
|
+
if ( list ) {
|
127
|
+
jQuery.each( arguments, function( _, arg ) {
|
128
|
+
var index;
|
129
|
+
while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
|
130
|
+
list.splice( index, 1 );
|
131
|
+
// Handle firing indexes
|
132
|
+
if ( firing ) {
|
133
|
+
if ( index <= firingLength ) {
|
134
|
+
firingLength--;
|
135
|
+
}
|
136
|
+
if ( index <= firingIndex ) {
|
137
|
+
firingIndex--;
|
138
|
+
}
|
139
|
+
}
|
140
|
+
}
|
141
|
+
});
|
142
|
+
}
|
143
|
+
return this;
|
144
|
+
},
|
145
|
+
// Check if a given callback is in the list.
|
146
|
+
// If no argument is given, return whether or not list has callbacks attached.
|
147
|
+
has: function( fn ) {
|
148
|
+
return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
|
149
|
+
},
|
150
|
+
// Remove all callbacks from the list
|
151
|
+
empty: function() {
|
152
|
+
list = [];
|
153
|
+
firingLength = 0;
|
154
|
+
return this;
|
155
|
+
},
|
156
|
+
// Have the list do nothing anymore
|
157
|
+
disable: function() {
|
158
|
+
list = stack = memory = undefined;
|
159
|
+
return this;
|
160
|
+
},
|
161
|
+
// Is it disabled?
|
162
|
+
disabled: function() {
|
163
|
+
return !list;
|
164
|
+
},
|
165
|
+
// Lock the list in its current state
|
166
|
+
lock: function() {
|
167
|
+
stack = undefined;
|
168
|
+
if ( !memory ) {
|
169
|
+
self.disable();
|
170
|
+
}
|
171
|
+
return this;
|
172
|
+
},
|
173
|
+
// Is it locked?
|
174
|
+
locked: function() {
|
175
|
+
return !stack;
|
176
|
+
},
|
177
|
+
// Call all callbacks with the given context and arguments
|
178
|
+
fireWith: function( context, args ) {
|
179
|
+
if ( list && ( !fired || stack ) ) {
|
180
|
+
args = args || [];
|
181
|
+
args = [ context, args.slice ? args.slice() : args ];
|
182
|
+
if ( firing ) {
|
183
|
+
stack.push( args );
|
184
|
+
} else {
|
185
|
+
fire( args );
|
186
|
+
}
|
187
|
+
}
|
188
|
+
return this;
|
189
|
+
},
|
190
|
+
// Call all the callbacks with the given arguments
|
191
|
+
fire: function() {
|
192
|
+
self.fireWith( this, arguments );
|
193
|
+
return this;
|
194
|
+
},
|
195
|
+
// To know if the callbacks have already been called at least once
|
196
|
+
fired: function() {
|
197
|
+
return !!fired;
|
198
|
+
}
|
199
|
+
};
|
200
|
+
|
201
|
+
return self;
|
202
|
+
};
|
203
|
+
|
204
|
+
return jQuery;
|
205
|
+
});
|