whoops 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,10 +1,18 @@
1
1
  source "http://rubygems.org"
2
2
  gemspec
3
3
 
4
+ platform :ruby do
5
+ gem 'bson_ext'
6
+ end
7
+
4
8
  group :development do
5
- if RUBY_VERSION =~ /1.8/
6
- gem "ruby-debug"
7
- else
8
- gem "ruby-debug19"
9
+ unless ENV["CI"]
10
+ gem 'ruby-debug-base19', '0.11.23' if RUBY_VERSION.include? '1.9.1'
11
+ gem 'ruby-debug19', :platforms => :ruby_19
12
+ gem 'ruby-debug', :platforms => :mri_18
9
13
  end
10
- end
14
+ end
15
+
16
+ group :test do
17
+ gem 'rake'
18
+ end
data/README.asciidoc CHANGED
@@ -3,6 +3,8 @@ Whoops
3
3
  Daniel Higginbotham <daniel@flyingmachinestudios.com>
4
4
  2011-07-09
5
5
 
6
+ image::https://secure.travis-ci.org/driv3r/whoops.png?branch=master[]
7
+
6
8
  == What is Whoops?
7
9
 
8
10
  Whoops is a logging system. It consists of a Rails engine (which records logs and provides an interface to them) and a logger. Full documentation can be found at http://www.whoopsapp.com[the Whoops web site].
@@ -21,4 +23,4 @@ Whoops is a logging system. It consists of a Rails engine (which records logs an
21
23
 
22
24
  == License
23
25
 
24
- This project uses MIT-LICENSE.
26
+ This project uses MIT-LICENSE.
@@ -27,5 +27,3 @@
27
27
  @import "forms.scss";
28
28
  @import "tables.scss";
29
29
  @import "patterns.scss";
30
-
31
- @import "whoops.css.scss";
@@ -3,7 +3,7 @@
3
3
  * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4
4
  * the top of the compiled file, but it's generally better to create a new file per style scope.
5
5
  *= require_self
6
- *= require 'bootstrap'
6
+ *= require 'whoops'
7
7
 
8
8
 
9
9
  */
@@ -1,3 +1,5 @@
1
+ @import "bootstrap.scss";
2
+
1
3
  body {
2
4
  padding-top:60px;
3
5
  color:#333;
@@ -67,9 +69,10 @@ li {
67
69
  @include box-shadow(0 1px 2px rgba(0,0,0,.05));
68
70
 
69
71
  .page {
70
- display: inline;
72
+ display: inline;
71
73
  }
72
- a, .current {
74
+
75
+ a, .current, .page.gap {
73
76
  float: left;
74
77
  padding: 0 14px;
75
78
  line-height: ($baseline * 2) - 2;
@@ -91,6 +94,10 @@ li {
91
94
  .next a {
92
95
  border: 0;
93
96
  }
97
+
98
+ .last a {
99
+ border-left: 1px solid #ddd;
100
+ }
94
101
  }
95
102
 
96
103
  /* main page table links */
@@ -12,14 +12,9 @@ module EventGroupsHelper
12
12
  @filter_options = Hash.new{|h, k| h[k] = []}
13
13
 
14
14
  @filter_options["service"] = Whoops::EventGroup.services.to_a
15
-
16
- all_event_groups.each do |event_group|
17
- mundane_fields = (Whoops::Filter.field_names & Whoops::EventGroup.field_names) - ["service", "message"]
18
- mundane_fields.each do |field_name|
19
- @filter_options[field_name] << event_group.send(field_name)
20
- end
21
- end
22
-
15
+ @filter_options["environment"] = Whoops::EventGroup.all.distinct("environment")
16
+ @filter_options["event_type"] = Whoops::EventGroup.all.distinct("event_type")
17
+
23
18
  # add the field name as an empty option
24
19
  @filter_options.keys.each do |field_name|
25
20
  @filter_options[field_name].compact!
@@ -50,16 +50,7 @@ class Whoops::EventGroup
50
50
 
51
51
  # @return sorted set of all applicable namespaces
52
52
  def self.services
53
- services = SortedSet.new
54
- previous_service = []
55
- all(:sort => [[:service, :asc]]).each do |group|
56
- services << group.service
57
- split = group.service.split(".")
58
- common = (previous_service & split)
59
- services << common.join(".") unless common.blank?
60
- previous_service = split
61
- end
62
- services
53
+ all.distinct(:service).sort
63
54
  end
64
55
 
65
56
  def handle_archival
@@ -4,12 +4,12 @@
4
4
  %table.event-group-list.bordered-table.zebra-striped
5
5
  %thead
6
6
  %tr
7
- %th.header Service
8
- %th.header Message
9
- %th.header Type
10
- %th.header Env
11
- %th.header Last Occurrence
12
- %th.header
7
+ %th Service
8
+ %th Message
9
+ %th Type
10
+ %th Env
11
+ %th Last Occurrence
12
+ %th
13
13
  %tbody
14
14
  - @event_groups.each do |event_group|
15
15
  %tr
data/lib/whoops/engine.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Whoops
2
2
  class Engine < Rails::Engine
3
3
  initializer "static assets" do |app|
4
- app.middleware.use ::ActionDispatch::Static, File.expand_path("../../../app/assets", __FILE__)
4
+ app.middleware.use ::ActionDispatch::Static, File.expand_path("../../../app/assets/javascripts", __FILE__)
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whoops
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 1
10
- version: 0.2.1
9
+ - 2
10
+ version: 0.2.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Daniel Higginbotham
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-02-03 00:00:00 Z
18
+ date: 2012-05-14 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rails
@@ -73,40 +73,25 @@ dependencies:
73
73
  version: "0"
74
74
  type: :runtime
75
75
  version_requirements: *id004
76
- - !ruby/object:Gem::Dependency
77
- name: bson_ext
78
- prerelease: false
79
- requirement: &id005 !ruby/object:Gem::Requirement
80
- none: false
81
- requirements:
82
- - - ">="
83
- - !ruby/object:Gem::Version
84
- hash: 3
85
- segments:
86
- - 0
87
- version: "0"
88
- type: :runtime
89
- version_requirements: *id005
90
76
  - !ruby/object:Gem::Dependency
91
77
  name: mongoid
92
78
  prerelease: false
93
- requirement: &id006 !ruby/object:Gem::Requirement
79
+ requirement: &id005 !ruby/object:Gem::Requirement
94
80
  none: false
95
81
  requirements:
96
- - - "="
82
+ - - ~>
97
83
  - !ruby/object:Gem::Version
98
- hash: 29
84
+ hash: 11
99
85
  segments:
100
86
  - 2
101
87
  - 4
102
- - 1
103
- version: 2.4.1
88
+ version: "2.4"
104
89
  type: :runtime
105
- version_requirements: *id006
90
+ version_requirements: *id005
106
91
  - !ruby/object:Gem::Dependency
107
92
  name: kaminari
108
93
  prerelease: false
109
- requirement: &id007 !ruby/object:Gem::Requirement
94
+ requirement: &id006 !ruby/object:Gem::Requirement
110
95
  none: false
111
96
  requirements:
112
97
  - - ">="
@@ -116,11 +101,11 @@ dependencies:
116
101
  - 0
117
102
  version: "0"
118
103
  type: :runtime
119
- version_requirements: *id007
104
+ version_requirements: *id006
120
105
  - !ruby/object:Gem::Dependency
121
106
  name: rspec-rails
122
107
  prerelease: false
123
- requirement: &id008 !ruby/object:Gem::Requirement
108
+ requirement: &id007 !ruby/object:Gem::Requirement
124
109
  none: false
125
110
  requirements:
126
111
  - - ">="
@@ -130,11 +115,11 @@ dependencies:
130
115
  - 0
131
116
  version: "0"
132
117
  type: :development
133
- version_requirements: *id008
118
+ version_requirements: *id007
134
119
  - !ruby/object:Gem::Dependency
135
120
  name: fabrication
136
121
  prerelease: false
137
- requirement: &id009 !ruby/object:Gem::Requirement
122
+ requirement: &id008 !ruby/object:Gem::Requirement
138
123
  none: false
139
124
  requirements:
140
125
  - - ">="
@@ -144,11 +129,11 @@ dependencies:
144
129
  - 0
145
130
  version: "0"
146
131
  type: :development
147
- version_requirements: *id009
132
+ version_requirements: *id008
148
133
  - !ruby/object:Gem::Dependency
149
134
  name: faker
150
135
  prerelease: false
151
- requirement: &id010 !ruby/object:Gem::Requirement
136
+ requirement: &id009 !ruby/object:Gem::Requirement
152
137
  none: false
153
138
  requirements:
154
139
  - - ">="
@@ -158,11 +143,11 @@ dependencies:
158
143
  - 0
159
144
  version: "0"
160
145
  type: :development
161
- version_requirements: *id010
146
+ version_requirements: *id009
162
147
  - !ruby/object:Gem::Dependency
163
148
  name: capybara
164
149
  prerelease: false
165
- requirement: &id011 !ruby/object:Gem::Requirement
150
+ requirement: &id010 !ruby/object:Gem::Requirement
166
151
  none: false
167
152
  requirements:
168
153
  - - ">="
@@ -174,7 +159,7 @@ dependencies:
174
159
  - 0
175
160
  version: 0.4.0
176
161
  type: :development
177
- version_requirements: *id011
162
+ version_requirements: *id010
178
163
  description: A Rails engine which receives logs and provides an interface for them
179
164
  email:
180
165
  executables: []
@@ -184,12 +169,7 @@ extensions: []
184
169
  extra_rdoc_files: []
185
170
 
186
171
  files:
187
- - app/assets/javascripts/hideshow.js
188
172
  - app/assets/javascripts/jquery-1.5.2.min.js
189
- - app/assets/javascripts/jquery.equalHeight.js
190
- - app/assets/javascripts/jquery.form.js
191
- - app/assets/javascripts/jquery.tablesorter.min.js
192
- - app/assets/javascripts/ui.js
193
173
  - app/assets/javascripts/whoops.js
194
174
  - app/assets/stylesheets/autocomplete.scss
195
175
  - app/assets/stylesheets/bootstrap.scss
@@ -1,39 +0,0 @@
1
- // Andy Langton's show/hide/mini-accordion @ http://andylangton.co.uk/jquery-show-hide
2
-
3
- // this tells jquery to run the function below once the DOM is ready
4
- $(document).ready(function() {
5
-
6
- // choose text for the show/hide link - can contain HTML (e.g. an image)
7
- var showText='Show';
8
- var hideText='Hide';
9
-
10
- // initialise the visibility check
11
- var is_visible = false;
12
-
13
- // append show/hide links to the element directly preceding the element with a class of "toggle"
14
- $('.toggle').prev().append(' <a href="#" class="toggleLink">'+hideText+'</a>');
15
-
16
- // hide all of the elements with a class of 'toggle'
17
- $('.toggle').show();
18
-
19
- // capture clicks on the toggle links
20
- $('a.toggleLink').click(function() {
21
-
22
- // switch visibility
23
- is_visible = !is_visible;
24
-
25
- // change the link text depending on whether the element is shown or hidden
26
- if ($(this).text()==showText) {
27
- $(this).text(hideText);
28
- $(this).parent().next('.toggle').slideDown('slow');
29
- }
30
- else {
31
- $(this).text(showText);
32
- $(this).parent().next('.toggle').slideUp('slow');
33
- }
34
-
35
- // return false so any link destination is not followed
36
- return false;
37
-
38
- });
39
- });
@@ -1,20 +0,0 @@
1
- // make sure the $ is pointing to JQuery and not some other library
2
- (function($){
3
- // add a new method to JQuery
4
-
5
- $.fn.equalHeight = function() {
6
- // find the tallest height in the collection
7
- // that was passed in (.column)
8
- tallest = 0;
9
- this.each(function(){
10
- thisHeight = $(this).height();
11
- if( thisHeight > tallest)
12
- tallest = thisHeight;
13
- });
14
-
15
- // set each items height to use the tallest value found
16
- this.each(function(){
17
- $(this).height(tallest);
18
- });
19
- }
20
- })(jQuery);
@@ -1,825 +0,0 @@
1
- /*!
2
- * jQuery Form Plugin
3
- * version: 2.73 (03-MAY-2011)
4
- * @requires jQuery v1.3.2 or later
5
- *
6
- * Examples and documentation at: http://malsup.com/jquery/form/
7
- * Dual licensed under the MIT and GPL licenses:
8
- * http://www.opensource.org/licenses/mit-license.php
9
- * http://www.gnu.org/licenses/gpl.html
10
- */
11
- ;(function($) {
12
-
13
- /*
14
- Usage Note:
15
- -----------
16
- Do not use both ajaxSubmit and ajaxForm on the same form. These
17
- functions are intended to be exclusive. Use ajaxSubmit if you want
18
- to bind your own submit handler to the form. For example,
19
-
20
- $(document).ready(function() {
21
- $('#myForm').bind('submit', function(e) {
22
- e.preventDefault(); // <-- important
23
- $(this).ajaxSubmit({
24
- target: '#output'
25
- });
26
- });
27
- });
28
-
29
- Use ajaxForm when you want the plugin to manage all the event binding
30
- for you. For example,
31
-
32
- $(document).ready(function() {
33
- $('#myForm').ajaxForm({
34
- target: '#output'
35
- });
36
- });
37
-
38
- When using ajaxForm, the ajaxSubmit function will be invoked for you
39
- at the appropriate time.
40
- */
41
-
42
- /**
43
- * ajaxSubmit() provides a mechanism for immediately submitting
44
- * an HTML form using AJAX.
45
- */
46
- $.fn.ajaxSubmit = function(options) {
47
- // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
48
- if (!this.length) {
49
- log('ajaxSubmit: skipping submit process - no element selected');
50
- return this;
51
- }
52
-
53
- if (typeof options == 'function') {
54
- options = { success: options };
55
- }
56
-
57
- var action = this.attr('action');
58
- var url = (typeof action === 'string') ? $.trim(action) : '';
59
- if (url) {
60
- // clean url (don't include hash vaue)
61
- url = (url.match(/^([^#]+)/)||[])[1];
62
- }
63
- url = url || window.location.href || '';
64
-
65
- options = $.extend(true, {
66
- url: url,
67
- success: $.ajaxSettings.success,
68
- type: this[0].getAttribute('method') || 'GET', // IE7 massage (see issue 57)
69
- iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'
70
- }, options);
71
-
72
- // hook for manipulating the form data before it is extracted;
73
- // convenient for use with rich editors like tinyMCE or FCKEditor
74
- var veto = {};
75
- this.trigger('form-pre-serialize', [this, options, veto]);
76
- if (veto.veto) {
77
- log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
78
- return this;
79
- }
80
-
81
- // provide opportunity to alter form data before it is serialized
82
- if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
83
- log('ajaxSubmit: submit aborted via beforeSerialize callback');
84
- return this;
85
- }
86
-
87
- var n,v,a = this.formToArray(options.semantic);
88
- if (options.data) {
89
- options.extraData = options.data;
90
- for (n in options.data) {
91
- if(options.data[n] instanceof Array) {
92
- for (var k in options.data[n]) {
93
- a.push( { name: n, value: options.data[n][k] } );
94
- }
95
- }
96
- else {
97
- v = options.data[n];
98
- v = $.isFunction(v) ? v() : v; // if value is fn, invoke it
99
- a.push( { name: n, value: v } );
100
- }
101
- }
102
- }
103
-
104
- // give pre-submit callback an opportunity to abort the submit
105
- if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
106
- log('ajaxSubmit: submit aborted via beforeSubmit callback');
107
- return this;
108
- }
109
-
110
- // fire vetoable 'validate' event
111
- this.trigger('form-submit-validate', [a, this, options, veto]);
112
- if (veto.veto) {
113
- log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
114
- return this;
115
- }
116
-
117
- var q = $.param(a);
118
-
119
- if (options.type.toUpperCase() == 'GET') {
120
- options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
121
- options.data = null; // data is null for 'get'
122
- }
123
- else {
124
- options.data = q; // data is the query string for 'post'
125
- }
126
-
127
- var $form = this, callbacks = [];
128
- if (options.resetForm) {
129
- callbacks.push(function() { $form.resetForm(); });
130
- }
131
- if (options.clearForm) {
132
- callbacks.push(function() { $form.clearForm(); });
133
- }
134
-
135
- // perform a load on the target only if dataType is not provided
136
- if (!options.dataType && options.target) {
137
- var oldSuccess = options.success || function(){};
138
- callbacks.push(function(data) {
139
- var fn = options.replaceTarget ? 'replaceWith' : 'html';
140
- $(options.target)[fn](data).each(oldSuccess, arguments);
141
- });
142
- }
143
- else if (options.success) {
144
- callbacks.push(options.success);
145
- }
146
-
147
- options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg
148
- var context = options.context || options; // jQuery 1.4+ supports scope context
149
- for (var i=0, max=callbacks.length; i < max; i++) {
150
- callbacks[i].apply(context, [data, status, xhr || $form, $form]);
151
- }
152
- };
153
-
154
- // are there files to upload?
155
- var fileInputs = $('input:file', this).length > 0;
156
- var mp = 'multipart/form-data';
157
- var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);
158
-
159
- // options.iframe allows user to force iframe mode
160
- // 06-NOV-09: now defaulting to iframe mode if file input is detected
161
- if (options.iframe !== false && (fileInputs || options.iframe || multipart)) {
162
- // hack to fix Safari hang (thanks to Tim Molendijk for this)
163
- // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
164
- if (options.closeKeepAlive) {
165
- $.get(options.closeKeepAlive, fileUpload);
166
- }
167
- else {
168
- fileUpload();
169
- }
170
- }
171
- else {
172
- $.ajax(options);
173
- }
174
-
175
- // fire 'notify' event
176
- this.trigger('form-submit-notify', [this, options]);
177
- return this;
178
-
179
-
180
- // private function for handling file uploads (hat tip to YAHOO!)
181
- function fileUpload() {
182
- var form = $form[0];
183
-
184
- if ($(':input[name=submit],:input[id=submit]', form).length) {
185
- // if there is an input with a name or id of 'submit' then we won't be
186
- // able to invoke the submit fn on the form (at least not x-browser)
187
- alert('Error: Form elements must not have name or id of "submit".');
188
- return;
189
- }
190
-
191
- var s = $.extend(true, {}, $.ajaxSettings, options);
192
- s.context = s.context || s;
193
- var id = 'jqFormIO' + (new Date().getTime()), fn = '_'+id;
194
- var $io = $('<iframe id="' + id + '" name="' + id + '" src="'+ s.iframeSrc +'" />');
195
- var io = $io[0];
196
-
197
- $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
198
-
199
- var xhr = { // mock object
200
- aborted: 0,
201
- responseText: null,
202
- responseXML: null,
203
- status: 0,
204
- statusText: 'n/a',
205
- getAllResponseHeaders: function() {},
206
- getResponseHeader: function() {},
207
- setRequestHeader: function() {},
208
- abort: function(status) {
209
- var e = (status === 'timeout' ? 'timeout' : 'aborted');
210
- log('aborting upload... ' + e);
211
- this.aborted = 1;
212
- $io.attr('src', s.iframeSrc); // abort op in progress
213
- xhr.error = e;
214
- s.error && s.error.call(s.context, xhr, e, e);
215
- g && $.event.trigger("ajaxError", [xhr, s, e]);
216
- s.complete && s.complete.call(s.context, xhr, e);
217
- }
218
- };
219
-
220
- var g = s.global;
221
- // trigger ajax global events so that activity/block indicators work like normal
222
- if (g && ! $.active++) {
223
- $.event.trigger("ajaxStart");
224
- }
225
- if (g) {
226
- $.event.trigger("ajaxSend", [xhr, s]);
227
- }
228
-
229
- if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {
230
- if (s.global) {
231
- $.active--;
232
- }
233
- return;
234
- }
235
- if (xhr.aborted) {
236
- return;
237
- }
238
-
239
- var timedOut = 0, timeoutHandle;
240
-
241
- // add submitting element to data if we know it
242
- var sub = form.clk;
243
- if (sub) {
244
- var n = sub.name;
245
- if (n && !sub.disabled) {
246
- s.extraData = s.extraData || {};
247
- s.extraData[n] = sub.value;
248
- if (sub.type == "image") {
249
- s.extraData[n+'.x'] = form.clk_x;
250
- s.extraData[n+'.y'] = form.clk_y;
251
- }
252
- }
253
- }
254
-
255
- // take a breath so that pending repaints get some cpu time before the upload starts
256
- function doSubmit() {
257
- // make sure form attrs are set
258
- var t = $form.attr('target'), a = $form.attr('action');
259
-
260
- // update form attrs in IE friendly way
261
- form.setAttribute('target',id);
262
- if (form.getAttribute('method') != 'POST') {
263
- form.setAttribute('method', 'POST');
264
- }
265
- if (form.getAttribute('action') != s.url) {
266
- form.setAttribute('action', s.url);
267
- }
268
-
269
- // ie borks in some cases when setting encoding
270
- if (! s.skipEncodingOverride) {
271
- $form.attr({
272
- encoding: 'multipart/form-data',
273
- enctype: 'multipart/form-data'
274
- });
275
- }
276
-
277
- // support timout
278
- if (s.timeout) {
279
- timeoutHandle = setTimeout(function() { timedOut = true; cb(true); }, s.timeout);
280
- }
281
-
282
- // add "extra" data to form if provided in options
283
- var extraInputs = [];
284
- try {
285
- if (s.extraData) {
286
- for (var n in s.extraData) {
287
- extraInputs.push(
288
- $('<input type="hidden" name="'+n+'" value="'+s.extraData[n]+'" />')
289
- .appendTo(form)[0]);
290
- }
291
- }
292
-
293
- // add iframe to doc and submit the form
294
- $io.appendTo('body');
295
- io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
296
- form.submit();
297
- }
298
- finally {
299
- // reset attrs and remove "extra" input elements
300
- form.setAttribute('action',a);
301
- if(t) {
302
- form.setAttribute('target', t);
303
- } else {
304
- $form.removeAttr('target');
305
- }
306
- $(extraInputs).remove();
307
- }
308
- }
309
-
310
- if (s.forceSync) {
311
- doSubmit();
312
- }
313
- else {
314
- setTimeout(doSubmit, 10); // this lets dom updates render
315
- }
316
-
317
- var data, doc, domCheckCount = 50, callbackProcessed;
318
-
319
- function cb(e) {
320
- if (xhr.aborted || callbackProcessed) {
321
- return;
322
- }
323
- if (e === true && xhr) {
324
- xhr.abort('timeout');
325
- return;
326
- }
327
-
328
- var doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
329
- if (!doc || doc.location.href == s.iframeSrc) {
330
- // response not received yet
331
- if (!timedOut)
332
- return;
333
- }
334
- io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);
335
-
336
- var ok = true;
337
- try {
338
- if (timedOut) {
339
- throw 'timeout';
340
- }
341
-
342
- var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc);
343
- log('isXml='+isXml);
344
- if (!isXml && window.opera && (doc.body == null || doc.body.innerHTML == '')) {
345
- if (--domCheckCount) {
346
- // in some browsers (Opera) the iframe DOM is not always traversable when
347
- // the onload callback fires, so we loop a bit to accommodate
348
- log('requeing onLoad callback, DOM not available');
349
- setTimeout(cb, 250);
350
- return;
351
- }
352
- // let this fall through because server response could be an empty document
353
- //log('Could not access iframe DOM after mutiple tries.');
354
- //throw 'DOMException: not available';
355
- }
356
-
357
- //log('response detected');
358
- xhr.responseText = doc.body ? doc.body.innerHTML : doc.documentElement ? doc.documentElement.innerHTML : null;
359
- xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
360
- if (isXml)
361
- s.dataType = 'xml';
362
- xhr.getResponseHeader = function(header){
363
- var headers = {'content-type': s.dataType};
364
- return headers[header];
365
- };
366
-
367
- var scr = /(json|script|text)/.test(s.dataType);
368
- if (scr || s.textarea) {
369
- // see if user embedded response in textarea
370
- var ta = doc.getElementsByTagName('textarea')[0];
371
- if (ta) {
372
- xhr.responseText = ta.value;
373
- }
374
- else if (scr) {
375
- // account for browsers injecting pre around json response
376
- var pre = doc.getElementsByTagName('pre')[0];
377
- var b = doc.getElementsByTagName('body')[0];
378
- if (pre) {
379
- xhr.responseText = pre.textContent;
380
- }
381
- else if (b) {
382
- xhr.responseText = b.innerHTML;
383
- }
384
- }
385
- }
386
- else if (s.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
387
- xhr.responseXML = toXml(xhr.responseText);
388
- }
389
-
390
- data = httpData(xhr, s.dataType, s);
391
- }
392
- catch(e){
393
- log('error caught:',e);
394
- ok = false;
395
- xhr.error = e;
396
- s.error && s.error.call(s.context, xhr, 'error', e);
397
- g && $.event.trigger("ajaxError", [xhr, s, e]);
398
- }
399
-
400
- if (xhr.aborted) {
401
- log('upload aborted');
402
- ok = false;
403
- }
404
-
405
- // ordering of these callbacks/triggers is odd, but that's how $.ajax does it
406
- if (ok) {
407
- s.success && s.success.call(s.context, data, 'success', xhr);
408
- g && $.event.trigger("ajaxSuccess", [xhr, s]);
409
- }
410
-
411
- g && $.event.trigger("ajaxComplete", [xhr, s]);
412
-
413
- if (g && ! --$.active) {
414
- $.event.trigger("ajaxStop");
415
- }
416
-
417
- s.complete && s.complete.call(s.context, xhr, ok ? 'success' : 'error');
418
-
419
- callbackProcessed = true;
420
- if (s.timeout)
421
- clearTimeout(timeoutHandle);
422
-
423
- // clean up
424
- setTimeout(function() {
425
- $io.removeData('form-plugin-onload');
426
- $io.remove();
427
- xhr.responseXML = null;
428
- }, 100);
429
- }
430
-
431
- var toXml = $.parseXML || function(s, doc) { // use parseXML if available (jQuery 1.5+)
432
- if (window.ActiveXObject) {
433
- doc = new ActiveXObject('Microsoft.XMLDOM');
434
- doc.async = 'false';
435
- doc.loadXML(s);
436
- }
437
- else {
438
- doc = (new DOMParser()).parseFromString(s, 'text/xml');
439
- }
440
- return (doc && doc.documentElement && doc.documentElement.nodeName != 'parsererror') ? doc : null;
441
- };
442
- var parseJSON = $.parseJSON || function(s) {
443
- return window['eval']('(' + s + ')');
444
- };
445
-
446
- var httpData = function( xhr, type, s ) { // mostly lifted from jq1.4.4
447
- var ct = xhr.getResponseHeader('content-type') || '',
448
- xml = type === 'xml' || !type && ct.indexOf('xml') >= 0,
449
- data = xml ? xhr.responseXML : xhr.responseText;
450
-
451
- if (xml && data.documentElement.nodeName === 'parsererror') {
452
- $.error && $.error('parsererror');
453
- }
454
- if (s && s.dataFilter) {
455
- data = s.dataFilter(data, type);
456
- }
457
- if (typeof data === 'string') {
458
- if (type === 'json' || !type && ct.indexOf('json') >= 0) {
459
- data = parseJSON(data);
460
- } else if (type === "script" || !type && ct.indexOf("javascript") >= 0) {
461
- $.globalEval(data);
462
- }
463
- }
464
- return data;
465
- };
466
- }
467
- };
468
-
469
- /**
470
- * ajaxForm() provides a mechanism for fully automating form submission.
471
- *
472
- * The advantages of using this method instead of ajaxSubmit() are:
473
- *
474
- * 1: This method will include coordinates for <input type="image" /> elements (if the element
475
- * is used to submit the form).
476
- * 2. This method will include the submit element's name/value data (for the element that was
477
- * used to submit the form).
478
- * 3. This method binds the submit() method to the form for you.
479
- *
480
- * The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely
481
- * passes the options argument along after properly binding events for submit elements and
482
- * the form itself.
483
- */
484
- $.fn.ajaxForm = function(options) {
485
- // in jQuery 1.3+ we can fix mistakes with the ready state
486
- if (this.length === 0) {
487
- var o = { s: this.selector, c: this.context };
488
- if (!$.isReady && o.s) {
489
- log('DOM not ready, queuing ajaxForm');
490
- $(function() {
491
- $(o.s,o.c).ajaxForm(options);
492
- });
493
- return this;
494
- }
495
- // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
496
- log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
497
- return this;
498
- }
499
-
500
- return this.ajaxFormUnbind().bind('submit.form-plugin', function(e) {
501
- if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed
502
- e.preventDefault();
503
- $(this).ajaxSubmit(options);
504
- }
505
- }).bind('click.form-plugin', function(e) {
506
- var target = e.target;
507
- var $el = $(target);
508
- if (!($el.is(":submit,input:image"))) {
509
- // is this a child element of the submit el? (ex: a span within a button)
510
- var t = $el.closest(':submit');
511
- if (t.length == 0) {
512
- return;
513
- }
514
- target = t[0];
515
- }
516
- var form = this;
517
- form.clk = target;
518
- if (target.type == 'image') {
519
- if (e.offsetX != undefined) {
520
- form.clk_x = e.offsetX;
521
- form.clk_y = e.offsetY;
522
- } else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
523
- var offset = $el.offset();
524
- form.clk_x = e.pageX - offset.left;
525
- form.clk_y = e.pageY - offset.top;
526
- } else {
527
- form.clk_x = e.pageX - target.offsetLeft;
528
- form.clk_y = e.pageY - target.offsetTop;
529
- }
530
- }
531
- // clear form vars
532
- setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100);
533
- });
534
- };
535
-
536
- // ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
537
- $.fn.ajaxFormUnbind = function() {
538
- return this.unbind('submit.form-plugin click.form-plugin');
539
- };
540
-
541
- /**
542
- * formToArray() gathers form element data into an array of objects that can
543
- * be passed to any of the following ajax functions: $.get, $.post, or load.
544
- * Each object in the array has both a 'name' and 'value' property. An example of
545
- * an array for a simple login form might be:
546
- *
547
- * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
548
- *
549
- * It is this array that is passed to pre-submit callback functions provided to the
550
- * ajaxSubmit() and ajaxForm() methods.
551
- */
552
- $.fn.formToArray = function(semantic) {
553
- var a = [];
554
- if (this.length === 0) {
555
- return a;
556
- }
557
-
558
- var form = this[0];
559
- var els = semantic ? form.getElementsByTagName('*') : form.elements;
560
- if (!els) {
561
- return a;
562
- }
563
-
564
- var i,j,n,v,el,max,jmax;
565
- for(i=0, max=els.length; i < max; i++) {
566
- el = els[i];
567
- n = el.name;
568
- if (!n) {
569
- continue;
570
- }
571
-
572
- if (semantic && form.clk && el.type == "image") {
573
- // handle image inputs on the fly when semantic == true
574
- if(!el.disabled && form.clk == el) {
575
- a.push({name: n, value: $(el).val()});
576
- a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
577
- }
578
- continue;
579
- }
580
-
581
- v = $.fieldValue(el, true);
582
- if (v && v.constructor == Array) {
583
- for(j=0, jmax=v.length; j < jmax; j++) {
584
- a.push({name: n, value: v[j]});
585
- }
586
- }
587
- else if (v !== null && typeof v != 'undefined') {
588
- a.push({name: n, value: v});
589
- }
590
- }
591
-
592
- if (!semantic && form.clk) {
593
- // input type=='image' are not found in elements array! handle it here
594
- var $input = $(form.clk), input = $input[0];
595
- n = input.name;
596
- if (n && !input.disabled && input.type == 'image') {
597
- a.push({name: n, value: $input.val()});
598
- a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
599
- }
600
- }
601
- return a;
602
- };
603
-
604
- /**
605
- * Serializes form data into a 'submittable' string. This method will return a string
606
- * in the format: name1=value1&amp;name2=value2
607
- */
608
- $.fn.formSerialize = function(semantic) {
609
- //hand off to jQuery.param for proper encoding
610
- return $.param(this.formToArray(semantic));
611
- };
612
-
613
- /**
614
- * Serializes all field elements in the jQuery object into a query string.
615
- * This method will return a string in the format: name1=value1&amp;name2=value2
616
- */
617
- $.fn.fieldSerialize = function(successful) {
618
- var a = [];
619
- this.each(function() {
620
- var n = this.name;
621
- if (!n) {
622
- return;
623
- }
624
- var v = $.fieldValue(this, successful);
625
- if (v && v.constructor == Array) {
626
- for (var i=0,max=v.length; i < max; i++) {
627
- a.push({name: n, value: v[i]});
628
- }
629
- }
630
- else if (v !== null && typeof v != 'undefined') {
631
- a.push({name: this.name, value: v});
632
- }
633
- });
634
- //hand off to jQuery.param for proper encoding
635
- return $.param(a);
636
- };
637
-
638
- /**
639
- * Returns the value(s) of the element in the matched set. For example, consider the following form:
640
- *
641
- * <form><fieldset>
642
- * <input name="A" type="text" />
643
- * <input name="A" type="text" />
644
- * <input name="B" type="checkbox" value="B1" />
645
- * <input name="B" type="checkbox" value="B2"/>
646
- * <input name="C" type="radio" value="C1" />
647
- * <input name="C" type="radio" value="C2" />
648
- * </fieldset></form>
649
- *
650
- * var v = $(':text').fieldValue();
651
- * // if no values are entered into the text inputs
652
- * v == ['','']
653
- * // if values entered into the text inputs are 'foo' and 'bar'
654
- * v == ['foo','bar']
655
- *
656
- * var v = $(':checkbox').fieldValue();
657
- * // if neither checkbox is checked
658
- * v === undefined
659
- * // if both checkboxes are checked
660
- * v == ['B1', 'B2']
661
- *
662
- * var v = $(':radio').fieldValue();
663
- * // if neither radio is checked
664
- * v === undefined
665
- * // if first radio is checked
666
- * v == ['C1']
667
- *
668
- * The successful argument controls whether or not the field element must be 'successful'
669
- * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
670
- * The default value of the successful argument is true. If this value is false the value(s)
671
- * for each element is returned.
672
- *
673
- * Note: This method *always* returns an array. If no valid value can be determined the
674
- * array will be empty, otherwise it will contain one or more values.
675
- */
676
- $.fn.fieldValue = function(successful) {
677
- for (var val=[], i=0, max=this.length; i < max; i++) {
678
- var el = this[i];
679
- var v = $.fieldValue(el, successful);
680
- if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) {
681
- continue;
682
- }
683
- v.constructor == Array ? $.merge(val, v) : val.push(v);
684
- }
685
- return val;
686
- };
687
-
688
- /**
689
- * Returns the value of the field element.
690
- */
691
- $.fieldValue = function(el, successful) {
692
- var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
693
- if (successful === undefined) {
694
- successful = true;
695
- }
696
-
697
- if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
698
- (t == 'checkbox' || t == 'radio') && !el.checked ||
699
- (t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
700
- tag == 'select' && el.selectedIndex == -1)) {
701
- return null;
702
- }
703
-
704
- if (tag == 'select') {
705
- var index = el.selectedIndex;
706
- if (index < 0) {
707
- return null;
708
- }
709
- var a = [], ops = el.options;
710
- var one = (t == 'select-one');
711
- var max = (one ? index+1 : ops.length);
712
- for(var i=(one ? index : 0); i < max; i++) {
713
- var op = ops[i];
714
- if (op.selected) {
715
- var v = op.value;
716
- if (!v) { // extra pain for IE...
717
- v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
718
- }
719
- if (one) {
720
- return v;
721
- }
722
- a.push(v);
723
- }
724
- }
725
- return a;
726
- }
727
- return $(el).val();
728
- };
729
-
730
- /**
731
- * Clears the form data. Takes the following actions on the form's input fields:
732
- * - input text fields will have their 'value' property set to the empty string
733
- * - select elements will have their 'selectedIndex' property set to -1
734
- * - checkbox and radio inputs will have their 'checked' property set to false
735
- * - inputs of type submit, button, reset, and hidden will *not* be effected
736
- * - button elements will *not* be effected
737
- */
738
- $.fn.clearForm = function() {
739
- return this.each(function() {
740
- $('input,select,textarea', this).clearFields();
741
- });
742
- };
743
-
744
- /**
745
- * Clears the selected form elements.
746
- */
747
- $.fn.clearFields = $.fn.clearInputs = function() {
748
- return this.each(function() {
749
- var t = this.type, tag = this.tagName.toLowerCase();
750
- if (t == 'text' || t == 'password' || tag == 'textarea') {
751
- this.value = '';
752
- }
753
- else if (t == 'checkbox' || t == 'radio') {
754
- this.checked = false;
755
- }
756
- else if (tag == 'select') {
757
- this.selectedIndex = -1;
758
- }
759
- });
760
- };
761
-
762
- /**
763
- * Resets the form data. Causes all form elements to be reset to their original value.
764
- */
765
- $.fn.resetForm = function() {
766
- return this.each(function() {
767
- // guard against an input with the name of 'reset'
768
- // note that IE reports the reset function as an 'object'
769
- if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) {
770
- this.reset();
771
- }
772
- });
773
- };
774
-
775
- /**
776
- * Enables or disables any matching elements.
777
- */
778
- $.fn.enable = function(b) {
779
- if (b === undefined) {
780
- b = true;
781
- }
782
- return this.each(function() {
783
- this.disabled = !b;
784
- });
785
- };
786
-
787
- /**
788
- * Checks/unchecks any matching checkboxes or radio buttons and
789
- * selects/deselects and matching option elements.
790
- */
791
- $.fn.selected = function(select) {
792
- if (select === undefined) {
793
- select = true;
794
- }
795
- return this.each(function() {
796
- var t = this.type;
797
- if (t == 'checkbox' || t == 'radio') {
798
- this.checked = select;
799
- }
800
- else if (this.tagName.toLowerCase() == 'option') {
801
- var $sel = $(this).parent('select');
802
- if (select && $sel[0] && $sel[0].type == 'select-one') {
803
- // deselect all other options
804
- $sel.find('option').selected(false);
805
- }
806
- this.selected = select;
807
- }
808
- });
809
- };
810
-
811
- // helper fn for console logging
812
- // set $.fn.ajaxSubmit.debug to true to enable debug logging
813
- function log() {
814
- if ($.fn.ajaxSubmit.debug) {
815
- var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
816
- if (window.console && window.console.log) {
817
- window.console.log(msg);
818
- }
819
- else if (window.opera && window.opera.postError) {
820
- window.opera.postError(msg);
821
- }
822
- }
823
- };
824
-
825
- })(jQuery);
@@ -1,4 +0,0 @@
1
-
2
- (function($){$.extend({tablesorter:new
3
- function(){var parsers=[],widgets=[];this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",cssChildRow:"expand-child",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,sortLocaleCompare:true,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",decimal:'/\.|\,/g',onRenderHeader:null,selectorHeaders:'thead th',debug:false};function benchmark(s,d){log(s+","+(new Date().getTime()-d.getTime())+"ms");}this.benchmark=benchmark;function log(s){if(typeof console!="undefined"&&typeof console.debug!="undefined"){console.log(s);}else{alert(s);}}function buildParserCache(table,$headers){if(table.config.debug){var parsersDebug="";}if(table.tBodies.length==0)return;var rows=table.tBodies[0].rows;if(rows[0]){var list=[],cells=rows[0].cells,l=cells.length;for(var i=0;i<l;i++){var p=false;if($.metadata&&($($headers[i]).metadata()&&$($headers[i]).metadata().sorter)){p=getParserById($($headers[i]).metadata().sorter);}else if((table.config.headers[i]&&table.config.headers[i].sorter)){p=getParserById(table.config.headers[i].sorter);}if(!p){p=detectParserForColumn(table,rows,-1,i);}if(table.config.debug){parsersDebug+="column:"+i+" parser:"+p.id+"\n";}list.push(p);}}if(table.config.debug){log(parsersDebug);}return list;};function detectParserForColumn(table,rows,rowIndex,cellIndex){var l=parsers.length,node=false,nodeValue=false,keepLooking=true;while(nodeValue==''&&keepLooking){rowIndex++;if(rows[rowIndex]){node=getNodeFromRowAndCellIndex(rows,rowIndex,cellIndex);nodeValue=trimAndGetNodeText(table.config,node);if(table.config.debug){log('Checking if value was empty on row:'+rowIndex);}}else{keepLooking=false;}}for(var i=1;i<l;i++){if(parsers[i].is(nodeValue,table,node)){return parsers[i];}}return parsers[0];}function getNodeFromRowAndCellIndex(rows,rowIndex,cellIndex){return rows[rowIndex].cells[cellIndex];}function trimAndGetNodeText(config,node){return $.trim(getElementText(config,node));}function getParserById(name){var l=parsers.length;for(var i=0;i<l;i++){if(parsers[i].id.toLowerCase()==name.toLowerCase()){return parsers[i];}}return false;}function buildCache(table){if(table.config.debug){var cacheTime=new Date();}var totalRows=(table.tBodies[0]&&table.tBodies[0].rows.length)||0,totalCells=(table.tBodies[0].rows[0]&&table.tBodies[0].rows[0].cells.length)||0,parsers=table.config.parsers,cache={row:[],normalized:[]};for(var i=0;i<totalRows;++i){var c=$(table.tBodies[0].rows[i]),cols=[];if(c.hasClass(table.config.cssChildRow)){cache.row[cache.row.length-1]=cache.row[cache.row.length-1].add(c);continue;}cache.row.push(c);for(var j=0;j<totalCells;++j){cols.push(parsers[j].format(getElementText(table.config,c[0].cells[j]),table,c[0].cells[j]));}cols.push(cache.normalized.length);cache.normalized.push(cols);cols=null;};if(table.config.debug){benchmark("Building cache for "+totalRows+" rows:",cacheTime);}return cache;};function getElementText(config,node){var text="";if(!node)return"";if(!config.supportsTextContent)config.supportsTextContent=node.textContent||false;if(config.textExtraction=="simple"){if(config.supportsTextContent){text=node.textContent;}else{if(node.childNodes[0]&&node.childNodes[0].hasChildNodes()){text=node.childNodes[0].innerHTML;}else{text=node.innerHTML;}}}else{if(typeof(config.textExtraction)=="function"){text=config.textExtraction(node);}else{text=$(node).text();}}return text;}function appendToTable(table,cache){if(table.config.debug){var appendTime=new Date()}var c=cache,r=c.row,n=c.normalized,totalRows=n.length,checkCell=(n[0].length-1),tableBody=$(table.tBodies[0]),rows=[];for(var i=0;i<totalRows;i++){var pos=n[i][checkCell];rows.push(r[pos]);if(!table.config.appender){var l=r[pos].length;for(var j=0;j<l;j++){tableBody[0].appendChild(r[pos][j]);}}}if(table.config.appender){table.config.appender(table,rows);}rows=null;if(table.config.debug){benchmark("Rebuilt table:",appendTime);}applyWidget(table);setTimeout(function(){$(table).trigger("sortEnd");},0);};function buildHeaders(table){if(table.config.debug){var time=new Date();}var meta=($.metadata)?true:false;var header_index=computeTableHeaderCellIndexes(table);$tableHeaders=$(table.config.selectorHeaders,table).each(function(index){this.column=header_index[this.parentNode.rowIndex+"-"+this.cellIndex];this.order=formatSortingOrder(table.config.sortInitialOrder);this.count=this.order;if(checkHeaderMetadata(this)||checkHeaderOptions(table,index))this.sortDisabled=true;if(checkHeaderOptionsSortingLocked(table,index))this.order=this.lockedOrder=checkHeaderOptionsSortingLocked(table,index);if(!this.sortDisabled){var $th=$(this).addClass(table.config.cssHeader);if(table.config.onRenderHeader)table.config.onRenderHeader.apply($th);}table.config.headerList[index]=this;});if(table.config.debug){benchmark("Built headers:",time);log($tableHeaders);}return $tableHeaders;};function computeTableHeaderCellIndexes(t){var matrix=[];var lookup={};var thead=t.getElementsByTagName('THEAD')[0];var trs=thead.getElementsByTagName('TR');for(var i=0;i<trs.length;i++){var cells=trs[i].cells;for(var j=0;j<cells.length;j++){var c=cells[j];var rowIndex=c.parentNode.rowIndex;var cellId=rowIndex+"-"+c.cellIndex;var rowSpan=c.rowSpan||1;var colSpan=c.colSpan||1
4
- var firstAvailCol;if(typeof(matrix[rowIndex])=="undefined"){matrix[rowIndex]=[];}for(var k=0;k<matrix[rowIndex].length+1;k++){if(typeof(matrix[rowIndex][k])=="undefined"){firstAvailCol=k;break;}}lookup[cellId]=firstAvailCol;for(var k=rowIndex;k<rowIndex+rowSpan;k++){if(typeof(matrix[k])=="undefined"){matrix[k]=[];}var matrixrow=matrix[k];for(var l=firstAvailCol;l<firstAvailCol+colSpan;l++){matrixrow[l]="x";}}}}return lookup;}function checkCellColSpan(table,rows,row){var arr=[],r=table.tHead.rows,c=r[row].cells;for(var i=0;i<c.length;i++){var cell=c[i];if(cell.colSpan>1){arr=arr.concat(checkCellColSpan(table,headerArr,row++));}else{if(table.tHead.length==1||(cell.rowSpan>1||!r[row+1])){arr.push(cell);}}}return arr;};function checkHeaderMetadata(cell){if(($.metadata)&&($(cell).metadata().sorter===false)){return true;};return false;}function checkHeaderOptions(table,i){if((table.config.headers[i])&&(table.config.headers[i].sorter===false)){return true;};return false;}function checkHeaderOptionsSortingLocked(table,i){if((table.config.headers[i])&&(table.config.headers[i].lockedOrder))return table.config.headers[i].lockedOrder;return false;}function applyWidget(table){var c=table.config.widgets;var l=c.length;for(var i=0;i<l;i++){getWidgetById(c[i]).format(table);}}function getWidgetById(name){var l=widgets.length;for(var i=0;i<l;i++){if(widgets[i].id.toLowerCase()==name.toLowerCase()){return widgets[i];}}};function formatSortingOrder(v){if(typeof(v)!="Number"){return(v.toLowerCase()=="desc")?1:0;}else{return(v==1)?1:0;}}function isValueInArray(v,a){var l=a.length;for(var i=0;i<l;i++){if(a[i][0]==v){return true;}}return false;}function setHeadersCss(table,$headers,list,css){$headers.removeClass(css[0]).removeClass(css[1]);var h=[];$headers.each(function(offset){if(!this.sortDisabled){h[this.column]=$(this);}});var l=list.length;for(var i=0;i<l;i++){h[list[i][0]].addClass(css[list[i][1]]);}}function fixColumnWidth(table,$headers){var c=table.config;if(c.widthFixed){var colgroup=$('<colgroup>');$("tr:first td",table.tBodies[0]).each(function(){colgroup.append($('<col>').css('width',$(this).width()));});$(table).prepend(colgroup);};}function updateHeaderSortCount(table,sortList){var c=table.config,l=sortList.length;for(var i=0;i<l;i++){var s=sortList[i],o=c.headerList[s[0]];o.count=s[1];o.count++;}}function multisort(table,sortList,cache){if(table.config.debug){var sortTime=new Date();}var dynamicExp="var sortWrapper = function(a,b) {",l=sortList.length;for(var i=0;i<l;i++){var c=sortList[i][0];var order=sortList[i][1];var s=(table.config.parsers[c].type=="text")?((order==0)?makeSortFunction("text","asc",c):makeSortFunction("text","desc",c)):((order==0)?makeSortFunction("numeric","asc",c):makeSortFunction("numeric","desc",c));var e="e"+i;dynamicExp+="var "+e+" = "+s;dynamicExp+="if("+e+") { return "+e+"; } ";dynamicExp+="else { ";}var orgOrderCol=cache.normalized[0].length-1;dynamicExp+="return a["+orgOrderCol+"]-b["+orgOrderCol+"];";for(var i=0;i<l;i++){dynamicExp+="}; ";}dynamicExp+="return 0; ";dynamicExp+="}; ";if(table.config.debug){benchmark("Evaling expression:"+dynamicExp,new Date());}eval(dynamicExp);cache.normalized.sort(sortWrapper);if(table.config.debug){benchmark("Sorting on "+sortList.toString()+" and dir "+order+" time:",sortTime);}return cache;};function makeSortFunction(type,direction,index){var a="a["+index+"]",b="b["+index+"]";if(type=='text'&&direction=='asc'){return"("+a+" == "+b+" ? 0 : ("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : ("+a+" < "+b+") ? -1 : 1 )));";}else if(type=='text'&&direction=='desc'){return"("+a+" == "+b+" ? 0 : ("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : ("+b+" < "+a+") ? -1 : 1 )));";}else if(type=='numeric'&&direction=='asc'){return"("+a+" === null && "+b+" === null) ? 0 :("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : "+a+" - "+b+"));";}else if(type=='numeric'&&direction=='desc'){return"("+a+" === null && "+b+" === null) ? 0 :("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : "+b+" - "+a+"));";}};function makeSortText(i){return"((a["+i+"] < b["+i+"]) ? -1 : ((a["+i+"] > b["+i+"]) ? 1 : 0));";};function makeSortTextDesc(i){return"((b["+i+"] < a["+i+"]) ? -1 : ((b["+i+"] > a["+i+"]) ? 1 : 0));";};function makeSortNumeric(i){return"a["+i+"]-b["+i+"];";};function makeSortNumericDesc(i){return"b["+i+"]-a["+i+"];";};function sortText(a,b){if(table.config.sortLocaleCompare)return a.localeCompare(b);return((a<b)?-1:((a>b)?1:0));};function sortTextDesc(a,b){if(table.config.sortLocaleCompare)return b.localeCompare(a);return((b<a)?-1:((b>a)?1:0));};function sortNumeric(a,b){return a-b;};function sortNumericDesc(a,b){return b-a;};function getCachedSortType(parsers,i){return parsers[i].type;};this.construct=function(settings){return this.each(function(){if(!this.tHead||!this.tBodies)return;var $this,$document,$headers,cache,config,shiftDown=0,sortOrder;this.config={};config=$.extend(this.config,$.tablesorter.defaults,settings);$this=$(this);$.data(this,"tablesorter",config);$headers=buildHeaders(this);this.config.parsers=buildParserCache(this,$headers);cache=buildCache(this);var sortCSS=[config.cssDesc,config.cssAsc];fixColumnWidth(this);$headers.click(function(e){var totalRows=($this[0].tBodies[0]&&$this[0].tBodies[0].rows.length)||0;if(!this.sortDisabled&&totalRows>0){$this.trigger("sortStart");var $cell=$(this);var i=this.column;this.order=this.count++%2;if(this.lockedOrder)this.order=this.lockedOrder;if(!e[config.sortMultiSortKey]){config.sortList=[];if(config.sortForce!=null){var a=config.sortForce;for(var j=0;j<a.length;j++){if(a[j][0]!=i){config.sortList.push(a[j]);}}}config.sortList.push([i,this.order]);}else{if(isValueInArray(i,config.sortList)){for(var j=0;j<config.sortList.length;j++){var s=config.sortList[j],o=config.headerList[s[0]];if(s[0]==i){o.count=s[1];o.count++;s[1]=o.count%2;}}}else{config.sortList.push([i,this.order]);}};setTimeout(function(){setHeadersCss($this[0],$headers,config.sortList,sortCSS);appendToTable($this[0],multisort($this[0],config.sortList,cache));},1);return false;}}).mousedown(function(){if(config.cancelSelection){this.onselectstart=function(){return false};return false;}});$this.bind("update",function(){var me=this;setTimeout(function(){me.config.parsers=buildParserCache(me,$headers);cache=buildCache(me);},1);}).bind("updateCell",function(e,cell){var config=this.config;var pos=[(cell.parentNode.rowIndex-1),cell.cellIndex];cache.normalized[pos[0]][pos[1]]=config.parsers[pos[1]].format(getElementText(config,cell),cell);}).bind("sorton",function(e,list){$(this).trigger("sortStart");config.sortList=list;var sortList=config.sortList;updateHeaderSortCount(this,sortList);setHeadersCss(this,$headers,sortList,sortCSS);appendToTable(this,multisort(this,sortList,cache));}).bind("appendCache",function(){appendToTable(this,cache);}).bind("applyWidgetId",function(e,id){getWidgetById(id).format(this);}).bind("applyWidgets",function(){applyWidget(this);});if($.metadata&&($(this).metadata()&&$(this).metadata().sortlist)){config.sortList=$(this).metadata().sortlist;}if(config.sortList.length>0){$this.trigger("sorton",[config.sortList]);}applyWidget(this);});};this.addParser=function(parser){var l=parsers.length,a=true;for(var i=0;i<l;i++){if(parsers[i].id.toLowerCase()==parser.id.toLowerCase()){a=false;}}if(a){parsers.push(parser);};};this.addWidget=function(widget){widgets.push(widget);};this.formatFloat=function(s){var i=parseFloat(s);return(isNaN(i))?0:i;};this.formatInt=function(s){var i=parseInt(s);return(isNaN(i))?0:i;};this.isDigit=function(s,config){return/^[-+]?\d*$/.test($.trim(s.replace(/[,.']/g,'')));};this.clearTableBody=function(table){if($.browser.msie){function empty(){while(this.firstChild)this.removeChild(this.firstChild);}empty.apply(table.tBodies[0]);}else{table.tBodies[0].innerHTML="";}};}});$.fn.extend({tablesorter:$.tablesorter.construct});var ts=$.tablesorter;ts.addParser({id:"text",is:function(s){return true;},format:function(s){return $.trim(s.toLocaleLowerCase());},type:"text"});ts.addParser({id:"digit",is:function(s,table){var c=table.config;return $.tablesorter.isDigit(s,c);},format:function(s){return $.tablesorter.formatFloat(s);},type:"numeric"});ts.addParser({id:"currency",is:function(s){return/^[£$€?.]/.test(s);},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/[£$€]/g),""));},type:"numeric"});ts.addParser({id:"ipAddress",is:function(s){return/^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/.test(s);},format:function(s){var a=s.split("."),r="",l=a.length;for(var i=0;i<l;i++){var item=a[i];if(item.length==2){r+="0"+item;}else{r+=item;}}return $.tablesorter.formatFloat(r);},type:"numeric"});ts.addParser({id:"url",is:function(s){return/^(https?|ftp|file):\/\/$/.test(s);},format:function(s){return jQuery.trim(s.replace(new RegExp(/(https?|ftp|file):\/\//),''));},type:"text"});ts.addParser({id:"isoDate",is:function(s){return/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(s);},format:function(s){return $.tablesorter.formatFloat((s!="")?new Date(s.replace(new RegExp(/-/g),"/")).getTime():"0");},type:"numeric"});ts.addParser({id:"percent",is:function(s){return/\%$/.test($.trim(s));},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g),""));},type:"numeric"});ts.addParser({id:"usLongDate",is:function(s){return s.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/));},format:function(s){return $.tablesorter.formatFloat(new Date(s).getTime());},type:"numeric"});ts.addParser({id:"shortDate",is:function(s){return/\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(s);},format:function(s,table){var c=table.config;s=s.replace(/\-/g,"/");if(c.dateFormat=="us"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$1/$2");}else if(c.dateFormat=="uk"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$2/$1");}else if(c.dateFormat=="dd/mm/yy"||c.dateFormat=="dd-mm-yy"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/,"$1/$2/$3");}return $.tablesorter.formatFloat(new Date(s).getTime());},type:"numeric"});ts.addParser({id:"time",is:function(s){return/^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/.test(s);},format:function(s){return $.tablesorter.formatFloat(new Date("2000/01/01 "+s).getTime());},type:"numeric"});ts.addParser({id:"metadata",is:function(s){return false;},format:function(s,table,cell){var c=table.config,p=(!c.parserMetadataName)?'sortValue':c.parserMetadataName;return $(cell).metadata()[p];},type:"numeric"});ts.addWidget({id:"zebra",format:function(table){if(table.config.debug){var time=new Date();}var $tr,row=-1,odd;$("tr:visible",table.tBodies[0]).each(function(i){$tr=$(this);if(!$tr.hasClass(table.config.cssChildRow))row++;odd=(row%2==0);$tr.removeClass(table.config.widgetZebra.css[odd?0:1]).addClass(table.config.widgetZebra.css[odd?1:0])});if(table.config.debug){$.tablesorter.benchmark("Applying Zebra widget",time);}}});})(jQuery);
@@ -1,28 +0,0 @@
1
- $(document).ready(function()
2
- {
3
- $(".tablesorter").tablesorter();
4
- }
5
- );
6
-
7
- $(document).ready(function() {
8
- //When page loads...
9
- $(".tab_content").hide(); //Hide all content
10
- $("ul.tabs li:first").addClass("active").show(); //Activate first tab
11
- $(".tab_content:first").show(); //Show first tab content
12
-
13
- //On Click Event
14
- $("ul.tabs li").click(function() {
15
-
16
- $("ul.tabs li").removeClass("active"); //Remove any "active" class
17
- $(this).addClass("active"); //Add "active" class to selected tab
18
- $(".tab_content").hide(); //Hide all tab content
19
-
20
- var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
21
- $(activeTab).fadeIn(); //Fade in the active ID content
22
- return false;
23
- });
24
- })
25
-
26
- $(function(){
27
- $('.column').equalHeight();
28
- });