From f1f337c871cef06f9ce08a092673ab8c7a985ddd Mon Sep 17 00:00:00 2001 From: John Bintz Date: Tue, 6 Dec 2011 14:57:28 -0500 Subject: [PATCH] jscroll --- README.md | 1 + Rakefile | 51 +- .../javascripts/jquery-ui-timepicker-addon.js | 145 +-- vendor/assets/javascripts/jquery.cookies.js | 924 +++++------------- vendor/assets/javascripts/jquery.jscroll.js | 80 ++ vendor/assets/javascripts/moment.js | 86 +- .../assets/javascripts/underscore.string.js | 4 +- 7 files changed, 493 insertions(+), 798 deletions(-) create mode 100644 vendor/assets/javascripts/jquery.jscroll.js diff --git a/README.md b/README.md index 572d1e6..ae3ca68 100644 --- a/README.md +++ b/README.md @@ -10,3 +10,4 @@ Every other project is owned by the original owner, I'm just aggregating for my * [Ajax File Upload](http://phpletter.com/Our-Projects/AjaxFileUpload/) * [jQuery UI Timepicker Addon](http://trentrichardson.com/examples/timepicker/) * [underscore.string](https://github.com/edtsech/underscore.string) +* [jScroll](http://www.wduffy.co.uk/jScroll/) diff --git a/Rakefile b/Rakefile index 8ff0150..890d44b 100644 --- a/Rakefile +++ b/Rakefile @@ -2,30 +2,6 @@ require "bundler/gem_tasks" require 'httparty' require 'zip/zip' -def process_zip_url(url, entries = {}) - mkdir_p 'tmp' - - response = HTTParty.get(url) - File.open(target = 'tmp/elastic.zip', 'wb') { |fh| fh.print response.body } - - Zip::ZipFile.foreach(target) do |entry| - entries.each do |search_entry, target_filename| - if entry.name[search_entry] - case File.extname(search_entry) - when '.js' - target = 'vendor/assets/javascripts' - when '.css' - target = 'vendor/assets/stylesheets' - end - - entry.extract(File.join(target, target_filename)) - end - - yield entry if block_given? - end - end -end - sources = { 'jquery.cookies' => [ 'http://cookies.googlecode.com/svn/trunk/jquery.cookies.js' @@ -55,9 +31,36 @@ sources = { ], 'underscore.string' => [ 'https://raw.github.com/edtsech/underscore.string/master/lib/underscore.string.js' + ], + 'jScroll' => [ + 'https://github.com/downloads/wduffy/jScroll/jquery.jscroll.js' ] } +def process_zip_url(url, entries = {}) + mkdir_p 'tmp' + + response = HTTParty.get(url) + File.open(target = 'tmp/elastic.zip', 'wb') { |fh| fh.print response.body } + + Zip::ZipFile.foreach(target) do |entry| + entries.each do |search_entry, target_filename| + if entry.name[search_entry] + case File.extname(search_entry) + when '.js' + target = 'vendor/assets/javascripts' + when '.css' + target = 'vendor/assets/stylesheets' + end + + entry.extract(File.join(target, target_filename)) + end + + yield entry if block_given? + end + end +end + desc 'Update verything' task :update do rm_rf 'vendor/assets' diff --git a/vendor/assets/javascripts/jquery-ui-timepicker-addon.js b/vendor/assets/javascripts/jquery-ui-timepicker-addon.js index d72c481..ade2f29 100644 --- a/vendor/assets/javascripts/jquery-ui-timepicker-addon.js +++ b/vendor/assets/javascripts/jquery-ui-timepicker-addon.js @@ -1,8 +1,8 @@ /* * jQuery timepicker addon * By: Trent Richardson [http://trentrichardson.com] -* Version 0.9.7 -* Last Modified: 10/02/2011 +* Version 0.9.8 +* Last Modified: 12/03/2011 * * Copyright 2011 Trent Richardson * Dual licensed under the MIT and GPL licenses. @@ -12,15 +12,15 @@ * HERES THE CSS: * .ui-timepicker-div .ui-widget-header { margin-bottom: 8px; } * .ui-timepicker-div dl { text-align: left; } -* .ui-timepicker-div dl dt { height: 25px; } -* .ui-timepicker-div dl dd { margin: -25px 10px 10px 65px; } +* .ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; } +* .ui-timepicker-div dl dd { margin: 0 10px 10px 65px; } * .ui-timepicker-div td { font-size: 90%; } * .ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; } */ (function($) { -$.extend($.ui, { timepicker: { version: "0.9.7" } }); +$.extend($.ui, { timepicker: { version: "0.9.8" } }); /* Time picker manager. Use the singleton instance of this class, $.timepicker, to interact with the time picker. @@ -54,10 +54,10 @@ function Timepicker() { showMillisec: false, showTimezone: false, showTime: true, - stepHour: 0.05, - stepMinute: 0.05, - stepSecond: 0.05, - stepMillisec: 0.5, + stepHour: 1, + stepMinute: 1, + stepSecond: 1, + stepMillisec: 1, hour: 0, minute: 0, second: 0, @@ -83,7 +83,9 @@ function Timepicker() { altFieldTimeOnly: true, showTimepicker: true, timezoneIso8609: false, - timezoneList: null + timezoneList: null, + addSliderAccess: false, + sliderAccessArgs: null }; $.extend(this._defaults, this.regional['']); } @@ -341,10 +343,10 @@ $.extend(Timepicker.prototype, { // Added by Peter Medeiros: // - Figure out what the hour/minute/second max should be based on the step values. // - Example: if stepMinute is 15, then minMax is 45. - hourMax = (o.hourMax - ((o.hourMax - o.hourMin) % o.stepHour)).toFixed(0), - minMax = (o.minuteMax - ((o.minuteMax - o.minuteMin) % o.stepMinute)).toFixed(0), - secMax = (o.secondMax - ((o.secondMax - o.secondMin) % o.stepSecond)).toFixed(0), - millisecMax = (o.millisecMax - ((o.millisecMax - o.millisecMin) % o.stepMillisec)).toFixed(0), + hourMax = parseInt((o.hourMax - ((o.hourMax - o.hourMin) % o.stepHour)) ,10), + minMax = parseInt((o.minuteMax - ((o.minuteMax - o.minuteMin) % o.stepMinute)) ,10), + secMax = parseInt((o.secondMax - ((o.secondMax - o.secondMin) % o.stepSecond)) ,10), + millisecMax = parseInt((o.millisecMax - ((o.millisecMax - o.millisecMin) % o.stepMillisec)) ,10), dp_id = this.inst.id.toString().replace(/([^A-Za-z0-9_])/g, ''); // Prevent displaying twice @@ -365,10 +367,10 @@ $.extend(Timepicker.prototype, { size; // Hours + html += '
'; if (o.showHour && o.hourGrid > 0) { - html += '
' + - '
' + - '
'; + html += '
'; for (var h = o.hourMin; h <= hourMax; h += parseInt(o.hourGrid,10)) { hourGridSize++; @@ -382,70 +384,63 @@ $.extend(Timepicker.prototype, { html += ''; } - html += '
' + tmph + '
' + - '
'; - } else html += '
'; - - html += '
' + o.minuteText + '
'; + html += ''; + } + html += ''; // Minutes + html += '
' + o.minuteText + '
'+ + '
'; + if (o.showMinute && o.minuteGrid > 0) { - html += '
' + - '
' + - '
'; + html += '
'; for (var m = o.minuteMin; m <= minMax; m += parseInt(o.minuteGrid,10)) { minuteGridSize++; html += ''; } - html += '
' + ((m < 10) ? '0' : '') + m + '
' + - '
'; - } else html += '
'; + html += ''; + } + html += ''; // Seconds html += '
' + o.secondText + '
'; + ((o.showSecond) ? '' : noDisplay) + '>' + o.secondText + ''+ + '
'; if (o.showSecond && o.secondGrid > 0) { - html += '
' + - '
' + - '
'; + html += '
'; for (var s = o.secondMin; s <= secMax; s += parseInt(o.secondGrid,10)) { secondGridSize++; html += ''; } - html += '
' + ((s < 10) ? '0' : '') + s + '
' + - '
'; - } else html += '
'; + html += ''; + } + html += ''; // Milliseconds html += '
' + o.millisecText + '
'; + ((o.showMillisec) ? '' : noDisplay) + '>' + o.millisecText + ''+ + '
'; if (o.showMillisec && o.millisecGrid > 0) { - html += '
' + - '
' + - '
'; + html += '
'; for (var l = o.millisecMin; l <= millisecMax; l += parseInt(o.millisecGrid,10)) { millisecGridSize++; - html += ''; + html += ''; } - html += '
' + ((l < 10) ? '0' : '') + s + '' + ((l < 10) ? '0' : '') + l + '
' + - '
'; - } else html += '
'; + html += ''; + } + html += ''; // Timezone html += '
= this.min) + margin = margin + opts.top + $window.scrollTop() - this.min; + + if (margin > max) + margin = max; + + return ({"marginTop" : margin + 'px'}); + } + } + + }; + + // Public: Default values + $.fn.jScroll.defaults = { + speed : "slow", + top : 10 + }; + +})(jQuery); \ No newline at end of file diff --git a/vendor/assets/javascripts/moment.js b/vendor/assets/javascripts/moment.js index 9565ed1..31e2039 100644 --- a/vendor/assets/javascripts/moment.js +++ b/vendor/assets/javascripts/moment.js @@ -3,7 +3,7 @@ // (c) 2011 Tim Wood // Moment.js is freely distributable under the terms of the MIT license. // -// Version 1.1.2 +// Version 1.2.0 (function (Date, undefined) { @@ -13,7 +13,7 @@ hasModule = (typeof module !== 'undefined'), paramsToParse = 'months|monthsShort|weekdays|weekdaysShort|longDateFormat|relativeTime|ordinal|meridiem'.split('|'), i, - VERSION = "1.1.2", + VERSION = "1.2.0", shortcuts = 'Month|Date|Hours|Minutes|Seconds'.split('|'); // left zero fill a number @@ -30,21 +30,24 @@ function dateAddRemove(date, _input, adding, val) { var isString = (typeof _input === 'string'), input = isString ? {} : _input, - ms, M, currentDate; + ms, d, M, currentDate; if (isString && val) { input[_input] = val; } ms = (input.ms || input.milliseconds || 0) + (input.s || input.seconds || 0) * 1e3 + // 1000 (input.m || input.minutes || 0) * 6e4 + // 1000 * 60 - (input.h || input.hours || 0) * 36e5 + // 1000 * 60 * 60 - (input.d || input.days || 0) * 864e5 + // 1000 * 60 * 60 * 24 - (input.w || input.weeks || 0) * 6048e5; // 1000 * 60 * 60 * 24 * 7 + (input.h || input.hours || 0) * 36e5; // 1000 * 60 * 60 + d = (input.d || input.days || 0) + + (input.w || input.weeks || 0) * 7; M = (input.M || input.months || 0) + (input.y || input.years || 0) * 12; if (ms) { date.setTime(+date + ms * adding); } + if (d) { + date.setDate(date.getDate() + d * adding); + } if (M) { currentDate = date.getDate(); date.setDate(1); @@ -76,7 +79,8 @@ currentHours = date.getHours(), currentMinutes = date.getMinutes(), currentSeconds = date.getSeconds(), - charactersToReplace = /(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|dddd?|do?|w[o|w]?|YYYY|YY|a|A|hh?|HH?|mm?|ss?|zz?|LL?L?L?)/g, + currentZone = date.getTimezoneOffset(), + charactersToReplace = /(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|dddd?|do?|w[o|w]?|YYYY|YY|a|A|hh?|HH?|mm?|ss?|zz?|ZZ?|LL?L?L?)/g, nonuppercaseLetters = /[^A-Z]/g, timezoneRegex = /\([A-Za-z ]+\)|:[0-9]{2} [A-Z]{3} /g, ordinal = moment.ordinal, @@ -173,6 +177,10 @@ // depreciating 'zz' fall through to 'z' case 'z' : return (date.toString().match(timezoneRegex) || [''])[0].replace(nonuppercaseLetters, ''); + case 'Z' : + return (currentZone > 0 ? '+' : '-') + leftZeroFill(~~(currentZone / 60), 2) + ':' + leftZeroFill(~~(currentZone % 60), 2); + case 'ZZ' : + return (currentZone > 0 ? '+' : '-') + leftZeroFill(~~(10 * currentZone / 6), 4); // LONG DATES case 'L' : case 'LL' : @@ -189,9 +197,13 @@ // date from string and format string function makeDateFromStringAndFormat(string, format) { - var inArray = [0], - tokenCharacters = /(\\)?(MM?|DD?D?D?|YYYY|YY|a|A|hh?|HH?|mm?|ss?)/g, - inputCharacters = /(\\)?([0-9]+|am|pm)/gi, + var inArray = [0, 0, 1, 0, 0, 0, 0], + timezoneHours = 0, + timezoneMinutes = 0, + isUsingUTC = false, + tokenCharacters = /(\\)?(MM?|DD?D?D?|YYYY|YY|a|A|hh?|HH?|mm?|ss?|ZZ?)/g, + inputCharacters = /(\\)?([0-9]+|am|pm|([\+\-]\d\d:?\d\d))/gi, + timezoneParseRegex = /([\+\-]|\d\d)/gi, inputParts = string.match(inputCharacters), formatParts = format.match(tokenCharacters), i, @@ -199,6 +211,7 @@ // function to convert string input to date function addTime(format, input) { + var a; switch (format) { // MONTH case 'M' : @@ -222,7 +235,7 @@ inArray[0] = input + (input > 70 ? 1900 : 2000); break; case 'YYYY' : - inArray[0] = ~~input; + inArray[0] = ~~Math.abs(input); break; // AM / PM case 'a' : @@ -252,6 +265,24 @@ case 'ss' : inArray[5] = ~~input; break; + // TIMEZONE + case 'Z' : + // fall through to ZZ + case 'ZZ' : + isUsingUTC = true; + a = input.match(timezoneParseRegex); + if (a[1]) { + timezoneHours = ~~a[1]; + } + if (a[2]) { + timezoneMinutes = ~~a[2]; + } + // reverse offsets + if (a[0] === '-') { + timezoneHours = -timezoneHours; + timezoneMinutes = -timezoneMinutes; + } + break; } } for (i = 0; i < formatParts.length; i++) { @@ -261,7 +292,15 @@ if (isPm && inArray[3] < 12) { inArray[3] += 12; } - return dateFromArray(inArray); + // if is 12 am, change hours to 0 + if (! isPm && inArray[3] === 12) { + inArray[3] = 0; + } + // handle timezone + inArray[3] += timezoneHours; + inArray[4] += timezoneMinutes; + // return + return isUsingUTC ? new Date(Date.UTC.apply({}, inArray)) : dateFromArray(inArray); } // compare two arrays, return the number of differences @@ -281,7 +320,7 @@ // date from string and array of format strings function makeDateFromStringAndArray(string, formats) { var output, - inputCharacters = /(\\)?([0-9]+|am|pm)/gi, + inputCharacters = /(\\)?([0-9]+|am|pm|([\+\-]\d\d:?\d\d))/gi, inputParts = string.match(inputCharacters), scores = [], scoreToBeat = 99, @@ -436,6 +475,14 @@ return this._d; }, + toString : function () { + return this._d.toString(); + }, + + toDate : function () { + return this._d; + }, + format : function (inputString) { return formatDate(this._d, inputString); }, @@ -484,8 +531,12 @@ }, isLeapYear : function () { - var year = this._d.getFullYear(); + var year = this.year(); return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; + }, + + isDST : function () { + return this.zone() !== moment([this.year()]).zone(); } }; @@ -501,7 +552,7 @@ }; } - // loop through and add shortcuts + // loop through and add shortcuts (Month, Date, Hours, Minutes, Seconds) for (i = 0; i < shortcuts.length; i ++) { makeShortcut(shortcuts[i].toLowerCase(), shortcuts[i]); } @@ -514,6 +565,11 @@ return this._d.getDay(); }; + // add shortcut for timezone offset (no setter) + moment.fn.zone = function () { + return this._d.getTimezoneOffset(); + }; + // CommonJS module is defined if (hasModule) { module.exports = moment; diff --git a/vendor/assets/javascripts/underscore.string.js b/vendor/assets/javascripts/underscore.string.js index 4392984..221cf48 100644 --- a/vendor/assets/javascripts/underscore.string.js +++ b/vendor/assets/javascripts/underscore.string.js @@ -167,8 +167,8 @@ // Defining underscore.string var _s = { - - VERSION: '1.2.0', + + VERSION: '2.0.0', isBlank: sArgs(function(str){ return (/^\s*$/).test(str);