Skip to content
This repository
Browse code

removed functions related to old AbstractDateFacetWidget

  • Loading branch information...
commit 01df6179ec325c2c907a6ecba6b4672048e30bcc 1 parent ac81289
James McKinney authored November 06, 2009
66  helpers/ajaxsolr.support.js
@@ -74,69 +74,3 @@ String.prototype.strtr = function (replacePairs) {
74 74
   }
75 75
   return str;
76 76
 };
77  
-
78  
-/**
79  
- * Returns a date in ISO8601 format.
80  
- *
81  
- * @returns {Date} The date in ISO8601 format.
82  
- */
83  
-String.prototype.toDate = function () {
84  
-  return new Date().setISO8601(this);
85  
-};
86  
-
87  
-/**
88  
- * Returns a string representation of the given level of granularity, in the
89  
- * context of the date.
90  
- *
91  
- * @param {String} granularity The given level of granularity.
92  
- * @returns {String} The string representation of the level of granularity.
93  
- */
94  
-Date.prototype.datePartString = function (granularity) {
95  
-  return jQuery.strftime(AjaxSolr.dateFormats.datePartFormats[granularity.toUpperCase()], this, true);
96  
-};
97  
-
98  
-/**
99  
- * Returns a string representation of the date, truncated to the given level of
100  
- * granularity.
101  
- *
102  
- * @param {String} granularity The given level of granularity.
103  
- * @returns {String} The string representation of the date.
104  
- */
105  
-Date.prototype.toLongDateString = function (granularity) {
106  
-  return jQuery.strftime(AjaxSolr.dateFormats.longDateFormats[granularity.toUpperCase()], this, true);
107  
-};
108  
-
109  
-/**
110  
- * @see http://dansnetwork.com/2008/11/01/javascript-iso8601rfc3339-date-parser/ 
111  
- */
112  
-Date.prototype.setISO8601 = function (dString) {
113  
-  var regexp = /(\d\d\d\d)(-)?(\d\d)(-)?(\d\d)(T)?(\d\d)(:)?(\d\d)(:)?(\d\d)(\.\d+)?(Z|([+-])(\d\d)(:)?(\d\d))/;
114  
-
115  
-  if (dString.toString().match(new RegExp(regexp))) {
116  
-    var d = dString.match(new RegExp(regexp));
117  
-    var offset = 0;
118  
-
119  
-    this.setUTCDate(1);
120  
-    this.setUTCFullYear(parseInt(d[1], 10));
121  
-    this.setUTCMonth(parseInt(d[3], 10) - 1);
122  
-    this.setUTCDate(parseInt(d[5], 10));
123  
-    this.setUTCHours(parseInt(d[7], 10));
124  
-    this.setUTCMinutes(parseInt(d[9], 10));
125  
-    this.setUTCSeconds(parseInt(d[11], 10));
126  
-    if (d[12]) {
127  
-      this.setUTCMilliseconds(parseFloat(d[12]) * 1000);
128  
-    }
129  
-    else {
130  
-      this.setUTCMilliseconds(0);
131  
-    }
132  
-    if (d[13] != 'Z') {
133  
-      offset = (d[15] * 60) + parseInt(d[17], 10);
134  
-      offset *= ((d[14] == '-') ? -1 : 1);
135  
-      this.setTime(this.getTime() - offset * 60 * 1000);
136  
-    }
137  
-  }
138  
-  else {
139  
-    this.setTime(Date.parse(dString));
140  
-  }
141  
-  return this;
142  
-};
4  helpers/ajaxsolr.theme.js
@@ -10,10 +10,10 @@
10 10
  */
11 11
 AjaxSolr.theme.prototype.list_items = function (list, items, separator) {
12 12
   jQuery(list).empty();
13  
-  for (var i = 0, ilength = items.length; i < ilength; i++) {
  13
+  for (var i = 0, lengthi = items.length; i < lengthi; i++) {
14 14
     var li = jQuery('<li/>');
15 15
     if (AjaxSolr.isArray(items[i])) {
16  
-      for (var j = 0, jlength = items[i].length; j < jlength; j++) {
  16
+      for (var j = 0, lengthj = items[i].length; j < lengthj; j++) {
17 17
         if (separator && j > 0) {
18 18
           li.append(separator);
19 19
         }
246  helpers/jquery.strftime.js
... ...
@@ -1,246 +0,0 @@
1  
-/*
2  
- * JQuery strftime plugin
3  
- * Version 1.0.1 (12/06/2008)
4  
- *
5  
- * No documentation at this point, sorry.
6  
- *
7  
- * Home page: http://projects.nocternity.net/jquery-strftime/
8  
- * Examples: http://projects.nocternity.net/jquery-strftime/demo.html
9  
- *
10  
- * Copyright (c) 2008 Emmanuel Benoît
11  
- * 
12  
- * Permission is hereby granted, free of charge, to any person obtaining
13  
- * a copy of this software and associated documentation files (the
14  
- * "Software"), to deal in the Software without restriction, including
15  
- * without limitation the rights to use, copy, modify, merge, publish,
16  
- * distribute, sublicense, and/or sell copies of the Software, and to
17  
- * permit persons to whom the Software is furnished to do so, subject to
18  
- * the following conditions:
19  
- * 
20  
- * The above copyright notice and this permission notice shall be
21  
- * included in all copies or substantial portions of the Software.
22  
- * 
23  
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24  
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25  
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26  
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27  
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28  
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29  
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30  
- */
31  
-
32  
-(function($) {
33  
-
34  
-	var _defaults = {
35  
-		'days_short' : [ 'Sun', 'Mon' , 'Tue' , 'Wed' , 'Thu' ,
36  
-				'Fri' , 'Sat' ] ,
37  
-		'days_long' : [ 'Sunday' , 'Monday' , 'Tuesday' ,
38  
-				'Wednesday' , 'Thursday' , 'Friday' ,
39  
-				'Saturday' ] ,
40  
-		'months_short' : [ 'Jan' , 'Feb' , 'Mar' , 'Apr' ,
41  
-				'May' , 'Jun' , 'Jul' , 'Aug' ,
42  
-				'Sep' , 'Oct' , 'Nov' , 'Dec' ] ,
43  
-		'months_long' : [ 'January' , 'February' , 'March' ,
44  
-				'April' , 'May' , 'June' , 'July' ,
45  
-				'August' , 'September' , 'October' ,
46  
-				'November' , 'December' ] ,
47  
-		'period' : [ 'AM' , 'PM' ] ,
48  
-		'format' : '%m/%d/%Y'
49  
-	};
50  
-
51  
-	var _useText = _defaults;
52  
-
53  
-	var _finaliseObj = function ( _obj , _month , _dow , _period ) {
54  
-		_obj.a = _useText.days_short[ _dow ];
55  
-		_obj.A = _useText.days_long[ _dow ];
56  
-		_obj.b = _useText.months_short[ _month ];
57  
-		_obj.B = _useText.months_long[ _month ];
58  
-		_obj.p = _useText.period [ _period ];
59  
-		_obj.m = _month + 1;
60  
-
61  
-		var _tmp;
62  
-
63  
-		if ( _obj.Y > 0 ) {
64  
-			_tmp = _obj.Y.toString( );
65  
-			if ( _tmp.length < 2 ) {
66  
-				_tmp = '0' + _tmp;
67  
-			} else if ( _tmp.length > 2 ) {
68  
-				_tmp = _tmp.substring( _tmp.length - 2 );
69  
-			}
70  
-			_obj.y = _tmp;
71  
-		} else {
72  
-			_obj.y = _obj.Y;
73  
-		}
74  
-
75  
-		var _check = [ 'd' , 'm' , 'H' , 'I' , 'M' , 'S' ];
76  
-		for ( var i in _check ) {
77  
-			_tmp = _obj[ _check[ i ] ];
78  
-			_tmp = _tmp.toString( );
79  
-			if ( _tmp.length < 2 ) {
80  
-				_tmp = '0' + _tmp;
81  
-			}
82  
-			_obj[ _check[ i ] ] = _tmp;
83  
-		}
84  
-
85  
-		return _obj;
86  
-	};
87  
-
88  
-	var _dateTimeToDtObj = function ( dateTime , utc ) {
89  
-		var _obj, _month, _dow, _period;
90  
-		if ( utc ) {
91  
-			_obj = {
92  
-				'H' : dateTime.getUTCHours( ) ,
93  
-				'I' : dateTime.getUTCHours( ) < 13 ? dateTime.getUTCHours( ) : dateTime.getUTCHours( ) - 12,
94  
-				'l' : dateTime.getUTCHours( ) < 13 ? dateTime.getUTCHours( ) : dateTime.getUTCHours( ) - 12,
95  
-				'M' : dateTime.getUTCMinutes( ) ,
96  
-				'S' : dateTime.getUTCSeconds( ) ,
97  
-				'e' : dateTime.getUTCDate( ) ,
98  
-				'd' : dateTime.getUTCDate( ) ,
99  
-				'Y' : dateTime.getUTCFullYear( )
100  
-			};
101  
-			_month = dateTime.getUTCMonth( );
102  
-			_dow = dateTime.getUTCDay( );
103  
-			_period = dateTime.getUTCHours( ) < 13 ? 0 : 1;
104  
-		} else {
105  
-			_obj = {
106  
-				'H' : dateTime.getHours( ) ,
107  
-				'I' : dateTime.getHours( ) < 13 ? dateTime.getHours( ) : dateTime.getHours( ) - 12,
108  
-				'l' : dateTime.getHours( ) < 13 ? dateTime.getHours( ) : dateTime.getHours( ) - 12,
109  
-				'M' : dateTime.getMinutes( ) ,
110  
-				'S' : dateTime.getSeconds( ) ,
111  
-				'e' : dateTime.getDate( ) ,
112  
-				'd' : dateTime.getDate( ) ,
113  
-				'Y' : dateTime.getFullYear( )
114  
-			};
115  
-			_month = dateTime.getMonth( );
116  
-			_dow = dateTime.getDay( );
117  
-			_period = dateTime.getHours( ) < 13 ? 0 : 1;
118  
-		}
119  
-		return _finaliseObj( _obj , _month , _dow , _period );
120  
-	};
121  
-
122  
-	var _objToDtObj = function ( obj ) {
123  
-		var _defs = {
124  
-			'H' : 0 ,
125  
-			'I' : 0 ,
126  
-			'l' : 0 ,
127  
-			'M' : 0 ,
128  
-			'S' : 0 ,
129  
-			'e' : 1 ,
130  
-			'd' : 1 ,
131  
-			'Y' : 1 ,
132  
-			'm' : 1
133  
-		};
134  
-		var _dtObj = {};
135  
-
136  
-		for ( var i in _defs ) {
137  
-			if ( typeof obj[ i ] != 'number' || obj[ i ] % 1 != 0 ) {
138  
-				_dtObj[ i ] = _defs[ i ];
139  
-			} else {
140  
-				_dtObj[ i ] = obj[ i ];
141  
-			}
142  
-		}
143  
-
144  
-		_dtObj.m --;
145  
-
146  
-		var _dow;
147  
-		if ( typeof obj.dow == 'number' && obj.dow % 1 == 0 ) {
148  
-			_dow = obj.dow;
149  
-		} else {
150  
-			_dow = 0;
151  
-		}
152  
-
153  
-		return _finaliseObj( _dtObj , _dtObj.m , _dow );
154  
-	};
155  
-
156  
-	$.strftime = function ( fmt , dateTime , utc ) {
157  
-
158  
-		if ( fmt && typeof fmt == 'object' ) {
159  
-			dateTime = fmt.dateTime;
160  
-			utc = fmt.utc;
161  
-			fmt = fmt.format;
162  
-		}
163  
-
164  
-		if ( !fmt || ( typeof fmt != 'string' ) ) {
165  
-			fmt = _useText.format;
166  
-		}
167  
-
168  
-		var _dtObj;
169  
-		if ( dateTime && ( typeof dateTime == 'object' ) ) {
170  
-			if ( dateTime instanceof Date ) {
171  
-				_dtObj = _dateTimeToDtObj( dateTime , utc );
172  
-			} else {
173  
-				_dtObj = _objToDtObj( dateTime );
174  
-			}
175  
-		} else {
176  
-			_dtObj = _dateTimeToDtObj( new Date( ) , utc );
177  
-		}
178  
-
179  
-		var _text = '' , _state = 0;
180  
-		for ( var i = 0 ; i < fmt.length ; i ++ ) {
181  
-			if ( _state == 0 ) {
182  
-				if ( fmt.charAt(i) == '%' ) {
183  
-					_state = 1;
184  
-				} else {
185  
-					_text += fmt.charAt( i );
186  
-				}
187  
-			} else {
188  
-				if ( typeof _dtObj[ fmt.charAt( i ) ] != 'undefined' ) {
189  
-					_text += _dtObj[ fmt.charAt( i ) ];
190  
-				} else {
191  
-					_text += '%';
192  
-					if ( fmt.charAt( i ) != '%' ) {
193  
-						_text += fmt.charAt( i );
194  
-					}
195  
-				}
196  
-				_state = 0;
197  
-			}
198  
-		}
199  
-		if ( _state == 1 ) {
200  
-			_text += '%';
201  
-		}
202  
-
203  
-		return _text;
204  
-	};
205  
-
206  
-	$.extend( $.strftime , {
207  
-		setText: function ( obj ) {
208  
-			if ( typeof obj != 'object' ) {
209  
-				throw new Error( '$.strftime.setText() : invalid parameter' );
210  
-			}
211  
-
212  
-			var _count = 0;
213  
-			for ( var i in obj ) {
214  
-				if ( typeof _defaults[ i ] == 'undefined' ) {
215  
-					throw new Error( '$.strftime.setText() : invalid field "' + i + '"' );
216  
-				} else if ( i == 'format' && typeof obj[ i ] != 'string' ) {
217  
-					throw new Error( '$.strftime.setText() : invalid type for the "format" field' );
218  
-				} else if ( i != 'format' && ! ( obj[ i ] instanceof Array ) ) {
219  
-					throw new Error( '$.strftime.setText() : field "' + i + '" should be an array' );
220  
-				} else if ( obj[ i ].length != _defaults[ i ].length ) {
221  
-					throw new Error( '$.strftime.setText() : field "' + i + '" has incorrect length '
222  
-							+ obj[ i ].length + ' (should be ' + _defaults[ i ].length + ')'
223  
-					       );
224  
-				}
225  
-				_count ++;
226  
-			}
227  
-			if ( _count != 5 ) {
228  
-				throw new Error( '$.strftime.setText() : 5 fields expected, ' + _count + ' found' );
229  
-			}
230  
-
231  
-			_useText = obj;
232  
-		},
233  
-
234  
-		defaults: function ( ) {
235  
-			_useText = _defaults;
236  
-		}
237  
-	} );
238  
-
239  
-	$.fn.strftime = function ( fmt , dateTime , utc ) {
240  
-		var _text = $.strftime( fmt , dateTime , utc );
241  
-		return this.each( function( ) {
242  
-			$(this).html( _text );
243  
-		});
244  
-	};
245  
-
246  
-})(jQuery);

0 notes on commit 01df617

Please sign in to comment.
Something went wrong with that request. Please try again.