123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872 |
- // Generated by CoffeeScript 1.6.2
- /*!
- jQuery Waypoints - v2.0.5
- Copyright (c) 2011-2014 Caleb Troughton
- Licensed under the MIT license.
- https://github.com/imakewebthings/jquery-waypoints/blob/master/licenses.txt
- */
- (function() {
- var t = [].indexOf || function(t) {
- for (var e = 0, n = this.length; e < n; e++) {
- if (e in this && this[e] === t)
- return e
- }
- return -1
- }, e = [].slice;
- (function(t, e) {
- return e(t.jQuery, t)
- })(window, function(n, r) {
- var i, o, l, s, f, u, c, a, h, d, p, y, v, w, g, m;
- i = n(r);
- a = t.call(r, "ontouchstart") >= 0;
- s = {horizontal: {},vertical: {}};
- f = 1;
- c = {};
- u = "waypoints-context-id";
- p = "resize.waypoints";
- y = "scroll.waypoints";
- v = 1;
- w = "waypoints-waypoint-ids";
- g = "waypoint";
- m = "waypoints";
- o = function() {
- function t(t) {
- var e = this;
- this.$element = t;
- this.element = t[0];
- this.didResize = false;
- this.didScroll = false;
- this.id = "context" + f++;
- this.oldScroll = {x: t.scrollLeft(),y: t.scrollTop()};
- this.waypoints = {horizontal: {},vertical: {}};
- this.element[u] = this.id;
- c[this.id] = this;
- t.bind(y, function() {
- var t;
- if (!(e.didScroll || a)) {
- e.didScroll = true;
- t = function() {
- e.doScroll();
- return e.didScroll = false
- };
- return r.setTimeout(t, n[m].settings.scrollThrottle)
- }
- });
- t.bind(p, function() {
- var t;
- if (!e.didResize) {
- e.didResize = true;
- t = function() {
- n[m]("refresh");
- return e.didResize = false
- };
- return r.setTimeout(t, n[m].settings.resizeThrottle)
- }
- })
- }
- t.prototype.doScroll = function() {
- var t, e = this;
- t = {horizontal: {newScroll: this.$element.scrollLeft(),oldScroll: this.oldScroll.x,forward: "right",backward: "left"},vertical: {newScroll: this.$element.scrollTop(),oldScroll: this.oldScroll.y,forward: "down",backward: "up"}};
- if (a && (!t.vertical.oldScroll || !t.vertical.newScroll)) {
- n[m]("refresh")
- }
- n.each(t, function(t, r) {
- var i, o, l;
- l = [];
- o = r.newScroll > r.oldScroll;
- i = o ? r.forward : r.backward;
- n.each(e.waypoints[t], function(t, e) {
- var n, i;
- if (r.oldScroll < (n = e.offset) && n <= r.newScroll) {
- return l.push(e)
- } else if (r.newScroll < (i = e.offset) && i <= r.oldScroll) {
- return l.push(e)
- }
- });
- l.sort(function(t, e) {
- return t.offset - e.offset
- });
- if (!o) {
- l.reverse()
- }
- return n.each(l, function(t, e) {
- if (e.options.continuous || t === l.length - 1) {
- return e.trigger([i])
- }
- })
- });
- return this.oldScroll = {x: t.horizontal.newScroll,y: t.vertical.newScroll}
- };
- t.prototype.refresh = function() {
- var t, e, r, i = this;
- r = n.isWindow(this.element);
- e = this.$element.offset();
- this.doScroll();
- t = {horizontal: {contextOffset: r ? 0 : e.left,contextScroll: r ? 0 : this.oldScroll.x,contextDimension: this.$element.width(),oldScroll: this.oldScroll.x,forward: "right",backward: "left",offsetProp: "left"},vertical: {contextOffset: r ? 0 : e.top,contextScroll: r ? 0 : this.oldScroll.y,contextDimension: r ? n[m]("viewportHeight") : this.$element.height(),oldScroll: this.oldScroll.y,forward: "down",backward: "up",offsetProp: "top"}};
- return n.each(t, function(t, e) {
- return n.each(i.waypoints[t], function(t, r) {
- var i, o, l, s, f;
- i = r.options.offset;
- l = r.offset;
- o = n.isWindow(r.element) ? 0 : r.$element.offset()[e.offsetProp];
- if (n.isFunction(i)) {
- i = i.apply(r.element)
- } else if (typeof i === "string") {
- i = parseFloat(i);
- if (r.options.offset.indexOf("%") > -1) {
- i = Math.ceil(e.contextDimension * i / 100)
- }
- }
- r.offset = o - e.contextOffset + e.contextScroll - i;
- if (r.options.onlyOnScroll && l != null || !r.enabled) {
- return
- }
- if (l !== null && l < (s = e.oldScroll) && s <= r.offset) {
- return r.trigger([e.backward])
- } else if (l !== null && l > (f = e.oldScroll) && f >= r.offset) {
- return r.trigger([e.forward])
- } else if (l === null && e.oldScroll >= r.offset) {
- return r.trigger([e.forward])
- }
- })
- })
- };
- t.prototype.checkEmpty = function() {
- if (n.isEmptyObject(this.waypoints.horizontal) && n.isEmptyObject(this.waypoints.vertical)) {
- this.$element.unbind([p, y].join(" "));
- return delete c[this.id]
- }
- };
- return t
- }();
- l = function() {
- function t(t, e, r) {
- var i, o;
- if (r.offset === "bottom-in-view") {
- r.offset = function() {
- var t;
- t = n[m]("viewportHeight");
- if (!n.isWindow(e.element)) {
- t = e.$element.height()
- }
- return t - n(this).outerHeight()
- }
- }
- this.$element = t;
- this.element = t[0];
- this.axis = r.horizontal ? "horizontal" : "vertical";
- this.callback = r.handler;
- this.context = e;
- this.enabled = r.enabled;
- this.id = "waypoints" + v++;
- this.offset = null;
- this.options = r;
- e.waypoints[this.axis][this.id] = this;
- s[this.axis][this.id] = this;
- i = (o = this.element[w]) != null ? o : [];
- i.push(this.id);
- this.element[w] = i
- }
- t.prototype.trigger = function(t) {
- if (!this.enabled) {
- return
- }
- if (this.callback != null) {
- this.callback.apply(this.element, t)
- }
- if (this.options.triggerOnce) {
- return this.destroy()
- }
- };
- t.prototype.disable = function() {
- return this.enabled = false
- };
- t.prototype.enable = function() {
- this.context.refresh();
- return this.enabled = true
- };
- t.prototype.destroy = function() {
- delete s[this.axis][this.id];
- delete this.context.waypoints[this.axis][this.id];
- return this.context.checkEmpty()
- };
- t.getWaypointsByElement = function(t) {
- var e, r;
- r = t[w];
- if (!r) {
- return []
- }
- e = n.extend({}, s.horizontal, s.vertical);
- return n.map(r, function(t) {
- return e[t]
- })
- };
- return t
- }();
- d = {init: function(t, e) {
- var r;
- e = n.extend({}, n.fn[g].defaults, e);
- if ((r = e.handler) == null) {
- e.handler = t
- }
- this.each(function() {
- var t, r, i, s;
- t = n(this);
- i = (s = e.context) != null ? s : n.fn[g].defaults.context;
- if (!n.isWindow(i)) {
- i = t.closest(i)
- }
- i = n(i);
- r = c[i[0][u]];
- if (!r) {
- r = new o(i)
- }
- return new l(t, r, e)
- });
- n[m]("refresh");
- return this
- },disable: function() {
- return d._invoke.call(this, "disable")
- },enable: function() {
- return d._invoke.call(this, "enable")
- },destroy: function() {
- return d._invoke.call(this, "destroy")
- },prev: function(t, e) {
- return d._traverse.call(this, t, e, function(t, e, n) {
- if (e > 0) {
- return t.push(n[e - 1])
- }
- })
- },next: function(t, e) {
- return d._traverse.call(this, t, e, function(t, e, n) {
- if (e < n.length - 1) {
- return t.push(n[e + 1])
- }
- })
- },_traverse: function(t, e, i) {
- var o, l;
- if (t == null) {
- t = "vertical"
- }
- if (e == null) {
- e = r
- }
- l = h.aggregate(e);
- o = [];
- this.each(function() {
- var e;
- e = n.inArray(this, l[t]);
- return i(o, e, l[t])
- });
- return this.pushStack(o)
- },_invoke: function(t) {
- this.each(function() {
- var e;
- e = l.getWaypointsByElement(this);
- return n.each(e, function(e, n) {
- n[t]();
- return true
- })
- });
- return this
- }};
- n.fn[g] = function() {
- var t, r;
- r = arguments[0], t = 2 <= arguments.length ? e.call(arguments, 1) : [];
- if (d[r]) {
- return d[r].apply(this, t)
- } else if (n.isFunction(r)) {
- return d.init.apply(this, arguments)
- } else if (n.isPlainObject(r)) {
- return d.init.apply(this, [null, r])
- } else if (!r) {
- return n.error("jQuery Waypoints needs a callback function or handler option.")
- } else {
- return n.error("The " + r + " method does not exist in jQuery Waypoints.")
- }
- };
- n.fn[g].defaults = {context: r,continuous: true,enabled: true,horizontal: false,offset: 0,triggerOnce: false};
- h = {refresh: function() {
- return n.each(c, function(t, e) {
- return e.refresh()
- })
- },viewportHeight: function() {
- var t;
- return (t = r.innerHeight) != null ? t : i.height()
- },aggregate: function(t) {
- var e, r, i;
- e = s;
- if (t) {
- e = (i = c[n(t)[0][u]]) != null ? i.waypoints : void 0
- }
- if (!e) {
- return []
- }
- r = {horizontal: [],vertical: []};
- n.each(r, function(t, i) {
- n.each(e[t], function(t, e) {
- return i.push(e)
- });
- i.sort(function(t, e) {
- return t.offset - e.offset
- });
- r[t] = n.map(i, function(t) {
- return t.element
- });
- return r[t] = n.unique(r[t])
- });
- return r
- },above: function(t) {
- if (t == null) {
- t = r
- }
- return h._filter(t, "vertical", function(t, e) {
- return e.offset <= t.oldScroll.y
- })
- },below: function(t) {
- if (t == null) {
- t = r
- }
- return h._filter(t, "vertical", function(t, e) {
- return e.offset > t.oldScroll.y
- })
- },left: function(t) {
- if (t == null) {
- t = r
- }
- return h._filter(t, "horizontal", function(t, e) {
- return e.offset <= t.oldScroll.x
- })
- },right: function(t) {
- if (t == null) {
- t = r
- }
- return h._filter(t, "horizontal", function(t, e) {
- return e.offset > t.oldScroll.x
- })
- },enable: function() {
- return h._invoke("enable")
- },disable: function() {
- return h._invoke("disable")
- },destroy: function() {
- return h._invoke("destroy")
- },extendFn: function(t, e) {
- return d[t] = e
- },_invoke: function(t) {
- var e;
- e = n.extend({}, s.vertical, s.horizontal);
- return n.each(e, function(e, n) {
- n[t]();
- return true
- })
- },_filter: function(t, e, r) {
- var i, o;
- i = c[n(t)[0][u]];
- if (!i) {
- return []
- }
- o = [];
- n.each(i.waypoints[e], function(t, e) {
- if (r(i, e)) {
- return o.push(e)
- }
- });
- o.sort(function(t, e) {
- return t.offset - e.offset
- });
- return n.map(o, function(t) {
- return t.element
- })
- }};
- n[m] = function() {
- var t, n;
- n = arguments[0], t = 2 <= arguments.length ? e.call(arguments, 1) : [];
- if (h[n]) {
- return h[n].apply(null, t)
- } else {
- return h.aggregate.call(null, n)
- }
- };
- n[m].settings = {resizeThrottle: 100,scrollThrottle: 30};
- return i.on("load.waypoints", function() {
- return n[m]("refresh")
- })
- })
- }).call(this);
- // Generated by CoffeeScript 1.6.2
- /*
- Sticky Elements Shortcut for jQuery Waypoints - v2.0.5
- Copyright (c) 2011-2014 Caleb Troughton
- Licensed under the MIT license.
- https://github.com/imakewebthings/jquery-waypoints/blob/master/licenses.txt
- */
- (function() {
- (function(t, n) {
- return n(t.jQuery)
- })(window, function(t) {
- var n, i;
- n = {wrapper: '<div class="sticky-wrapper" />',stuckClass: "stuck",direction: "down right"};
- i = function(t, n) {
- var i;
- t.wrap(n.wrapper);
- i = t.parent();
- return i.data("isWaypointStickyWrapper", true)
- };
- t.waypoints("extendFn", "sticky", function(r) {
- var e, a, s;
- a = t.extend({}, t.fn.waypoint.defaults, n, r);
- e = i(this, a);
- s = a.handler;
- a.handler = function(n) {
- var i, r;
- i = t(this).children(":first");
- r = a.direction.indexOf(n) !== -1;
- i.toggleClass(a.stuckClass, r);
- e.height(r ? i.outerHeight() : "");
- if (s != null) {
- return s.call(this, n)
- }
- };
- e.waypoint(a);
- return this.data("stuckClass", a.stuckClass)
- });
- return t.waypoints("extendFn", "unsticky", function() {
- var t;
- t = this.parent();
- if (!t.data("isWaypointStickyWrapper")) {
- return this
- }
- t.waypoint("destroy");
- this.unwrap();
- return this.removeClass(this.data("stuckClass"))
- })
- })
- }).call(this);
- /*
- *
- * jqTransform
- * by mathieu vilaplana mvilaplana@dfc-e.com
- * Designer ghyslain armand garmand@dfc-e.com
- *
- *
- * Version 1.0 25.09.08
- * Version 1.1 06.08.09
- * Add event click on Checkbox and Radio
- * Auto calculate the size of a select element
- * Can now, disabled the elements
- * Correct bug in ff if click on select (overflow=hidden)
- * No need any more preloading !!
- *
- ******************************************** */
- (function($) {
- var defaultOptions = {preloadImg: true};
- var jqTransformImgPreloaded = false;
-
- var jqTransformPreloadHoverFocusImg = function(strImgUrl) {
- //guillemets to remove for ie
- strImgUrl = strImgUrl.replace(/^url\((.*)\)/, '$1').replace(/^\"(.*)\"$/, '$1');
- var imgHover = new Image();
- imgHover.src = strImgUrl.replace(/\.([a-zA-Z]*)$/, '-hover.$1');
- var imgFocus = new Image();
- imgFocus.src = strImgUrl.replace(/\.([a-zA-Z]*)$/, '-focus.$1');
- };
- /***************************
- Labels
- ***************************/
- var jqTransformGetLabel = function(objfield) {
- var selfForm = $(objfield.get(0).form);
- var oLabel = objfield.next();
- if (!oLabel.is('label')) {
- oLabel = objfield.prev();
- if (oLabel.is('label')) {
- var inputname = objfield.attr('id');
- if (inputname) {
- oLabel = selfForm.find('label[for="' + inputname + '"]');
- }
- }
- }
- if (oLabel.is('label')) {
- return oLabel.css('cursor', 'pointer');
- }
- return false;
- };
- /* Hide all open selects */
- var jqTransformHideSelect = function(oTarget) {
- var ulVisible = $('.jqTransformSelectWrapper ul:visible');
- ulVisible.each(function() {
- var oSelect = $(this).parents(".jqTransformSelectWrapper:first").find("select").get(0);
- //do not hide if click on the label object associated to the select
- if (!(oTarget && oSelect.oLabel && oSelect.oLabel.get(0) == oTarget.get(0))) {
- $(this).hide();
- }
- });
- };
- /* Check for an external click */
- var jqTransformCheckExternalClick = function(event) {
- if ($(event.target).parents('.jqTransformSelectWrapper').length === 0) {
- jqTransformHideSelect($(event.target));
- }
- };
- /* Apply document listener */
- var jqTransformAddDocumentListener = function() {
- $(document).mousedown(jqTransformCheckExternalClick);
- };
- /* Add a new handler for the reset action */
- var jqTransformReset = function(f) {
- var sel;
- $('.jqTransformSelectWrapper select', f).each(function() {
- sel = (this.selectedIndex < 0) ? 0 : this.selectedIndex;
- $('ul', $(this).parent()).each(function() {
- $('a:eq(' + sel + ')', this).click();
- });
- });
- $('a.jqTransformCheckbox, a.jqTransformRadio', f).removeClass('jqTransformChecked');
- $('input:checkbox, input:radio', f).each(function() {
- if (this.checked) {
- $('a', $(this).parent()).addClass('jqTransformChecked');
- }
- });
- };
- /***************************
- Buttons
- ***************************/
- $.fn.jqTransInputButton = function() {
- return this.each(function() {
- var newBtn = $('<button id="' + this.id + '" name="' + this.name + '" type="' + this.type + '" class="' + this.className + ' jqTransformButton"><span><span>' + $(this).attr('value') + '</span></span>')
- .hover(function() {
- newBtn.addClass('jqTransformButton_hover');
- }, function() {
- newBtn.removeClass('jqTransformButton_hover')
- })
- .mousedown(function() {
- newBtn.addClass('jqTransformButton_click')
- })
- .mouseup(function() {
- newBtn.removeClass('jqTransformButton_click')
- })
- ;
- $(this).replaceWith(newBtn);
- });
- };
- /***************************
- Text Fields
- ***************************/
- $.fn.jqTransInputText = function() {
- return this.each(function() {
- var $input = $(this);
-
- if ($input.hasClass('jqtranformdone') || !$input.is('input')) {
- return;
- }
- $input.addClass('jqtranformdone');
-
- var oLabel = jqTransformGetLabel($(this));
- oLabel && oLabel.bind('click', function() {
- $input.focus();
- });
-
- var inputSize = $input.width();
- if ($input.attr('size')) {
- inputSize = $input.attr('size') * 10;
- $input.css('width', inputSize);
- }
-
- $input.addClass("jqTransformInput").wrap('<div class="jqTransformInputWrapper"><div class="jqTransformInputInner"><div></div></div></div>');
- var $wrapper = $input.parent().parent().parent();
- $wrapper.css("width", inputSize + 10);
- $input
- .focus(function() {
- $wrapper.addClass("jqTransformInputWrapper_focus");
- })
- .blur(function() {
- $wrapper.removeClass("jqTransformInputWrapper_focus");
- })
- .hover(function() {
- $wrapper.addClass("jqTransformInputWrapper_hover");
- }, function() {
- $wrapper.removeClass("jqTransformInputWrapper_hover");
- })
- ;
- /* If this is safari we need to add an extra class */
- $.browser.safari && $wrapper.addClass('jqTransformSafari');
- $.browser.safari && $input.css('width', $wrapper.width() + 16);
- this.wrapper = $wrapper;
-
- });
- };
- /***************************
- Check Boxes
- ***************************/
-
- $.fn.jqTransCheckBox = function() {
- return this.each(function() {
- if ($(this).hasClass('jqTransformHidden')) {
- return;
- }
-
- var $input = $(this);
- var inputSelf = this;
-
- var aLink = $('<a href="#" class="jqTransformCheckbox" rel="' + this.name + '"></a>');
- //wrap and add the link
- $input.addClass('jqTransformHidden').wrap('<span class="jqTransformCheckboxWrapper"></span>').parent().prepend(aLink);
- //on change, change the class of the link
- $input.change(function() {
- inputSelf.checked && aLink.addClass('jqTransformChecked') || aLink.removeClass('jqTransformChecked');
- return true;
- });
- // Click Handler, trigger the click and change event on the input
- aLink.click(function() {
- //do nothing if the original input is disabled
- if ($input.attr('disabled')) {
- return false;
- }
- //trigger the envents on the input object
- $input.trigger('click');
- return false;
- });
- // set the default state
- inputSelf.checked && aLink.addClass('jqTransformChecked');
- });
- };
- /***************************
- Radio Buttons
- ***************************/
- $.fn.jqTransRadio = function() {
- return this.each(function() {
- if ($(this).hasClass('jqTransformHidden')) {
- return;
- }
-
- var $input = $(this);
- var inputSelf = this;
-
- oLabel = jqTransformGetLabel($input);
- oLabel = oLabel || $input.closest('label');
- oLabel && oLabel.click(function() {
- aLink.trigger('click');
- });
-
- var aLink = $('<a href="#" class="jqTransformRadio" rel="' + this.name + '"></a>');
- $input.addClass('jqTransformHidden').wrap('<span class="jqTransformRadioWrapper"></span>').parent().prepend(aLink);
-
- $input.change(function() {
- inputSelf.checked && aLink.addClass('jqTransformChecked') || aLink.removeClass('jqTransformChecked');
- return true;
- });
- // Click Handler
- aLink.click(function() {
- if ($input.attr('disabled')) {
- return false;
- }
- $input.prop('checked', true);
- $input.trigger('change');
- // uncheck all others of same name input radio elements
- $('input[name="' + $input.attr('name') + '"]', inputSelf.form).not($input).each(function() {
- $(this).attr('type') == 'radio' && $(this).trigger('change');
- });
-
- return false;
- });
- // set the default state
- inputSelf.checked && aLink.addClass('jqTransformChecked');
- });
- };
- /***************************
- TextArea
- ***************************/
- $.fn.jqTransTextarea = function() {
- return this.each(function() {
- var textarea = $(this);
-
- if (textarea.hasClass('jqtransformdone')) {
- return;
- }
- textarea.addClass('jqtransformdone');
-
- oLabel = jqTransformGetLabel(textarea);
- oLabel && oLabel.click(function() {
- textarea.focus();
- });
-
- var strTable = '<table cellspacing="0" cellpadding="0" border="0" class="jqTransformTextarea">';
- strTable += '<tr><td id="jqTransformTextarea-tl"></td><td id="jqTransformTextarea-tm"></td><td id="jqTransformTextarea-tr"></td></tr>';
- strTable += '<tr><td id="jqTransformTextarea-ml"> </td><td id="jqTransformTextarea-mm"><div></div></td><td id="jqTransformTextarea-mr"> </td></tr>';
- strTable += '<tr><td id="jqTransformTextarea-bl"></td><td id="jqTransformTextarea-bm"></td><td id="jqTransformTextarea-br"></td></tr>';
- strTable += '</table>';
- var oTable = $(strTable)
- .insertAfter(textarea)
- .hover(function() {
- !oTable.hasClass('jqTransformTextarea-focus') && oTable.addClass('jqTransformTextarea-hover');
- }, function() {
- oTable.removeClass('jqTransformTextarea-hover');
- })
- ;
-
- textarea
- .focus(function() {
- oTable.removeClass('jqTransformTextarea-hover').addClass('jqTransformTextarea-focus');
- })
- .blur(function() {
- oTable.removeClass('jqTransformTextarea-focus');
- })
- .appendTo($('#jqTransformTextarea-mm div', oTable))
- ;
- this.oTable = oTable;
- if ($.browser.safari) {
- $('#jqTransformTextarea-mm', oTable)
- .addClass('jqTransformSafariTextarea')
- .find('div')
- .css('height', textarea.height())
- .css('width', textarea.width())
- ;
- }
- });
- };
- /***************************
- Select
- ***************************/
- $.fn.jqTransSelect = function() {
- return this.each(function(index) {
- var $select = $(this);
-
- if ($select.hasClass('jqTransformHidden')) {
- return;
- }
- if ($select.attr('multiple')) {
- return;
- }
-
- oLabel = jqTransformGetLabel($select);
- oLabel = oLabel || $select.closest('label');
- oLabel && oLabel.click(function() {
- aLink.trigger('click');
- });
- /* First thing we do is Wrap it */
- var $wrapper = $select
- .addClass('jqTransformHidden')
- .wrap('<div class="jqTransformSelectWrapper"></div>')
- .parent()
- ;
- /* Now add the html for the select */
- $wrapper.prepend('<div><span></span><a href="#" class="jqTransformSelectOpen"></a></div><ul></ul>');
- var $ul = $('ul', $wrapper).css('width', $select.width()).hide();
- /* Now we add the options */
- $('option', this).each(function(i) {
- var oLi = $('<li><a href="#" index="' + i + '">' + $(this).html() + '</a></li>');
- $ul.append(oLi);
- });
- /* Add click handler to the a */
- $ul.find('a').click(function() {
- $('a.selected', $wrapper).removeClass('selected');
- $(this).addClass('selected');
- /* Fire the onchange event */
- if ($select[0].selectedIndex != $(this).attr('index')) {
- $select[0].selectedIndex = $(this).attr('index');
- $select.trigger('change');
- }
-
- $select[0].selectedIndex = $(this).attr('index');
- $('span:eq(0)', $wrapper).html($(this).html());
- $ul.hide();
- return false;
- });
- /* Set the default */
- $('a:eq(' + this.selectedIndex + ')', $ul).click();
- $('span:first', $wrapper).click(function() {
- $("a.jqTransformSelectOpen", $wrapper).trigger('click');
- });
- oLabel && oLabel.click(function() {
- $("a.jqTransformSelectOpen", $wrapper).trigger('click');
- });
- this.oLabel = oLabel;
- /* Apply the click handler to the Open */
- var oLinkOpen = $('a.jqTransformSelectOpen', $wrapper)
- .click(function() {
- //Check if box is already open to still allow toggle, but close all other selects
- if ($ul.css('display') == 'none') {
- jqTransformHideSelect();
- }
- if ($select.attr('disabled')) {
- return false;
- }
-
- $ul.slideToggle('fast', function() {
- var offSet = ($('a.selected', $ul).offset().top - $ul.offset().top);
- $ul.animate({scrollTop: offSet});
- });
- return false;
- })
- ;
- // Set the new width
- var iSelectWidth = $select.outerWidth();
- var oSpan = $('span:first', $wrapper);
- var newWidth = iSelectWidth;
- $wrapper.css('width', newWidth);
- $ul.css('width', newWidth - 2);
- oSpan.css({width: iSelectWidth});
- // Calculate the height if necessary, less elements that the default height
- //show the ul to calculate the block, if ul is not displayed li height value is 0
- $ul.css({display: 'block',visibility: 'hidden'});
- var iSelectHeight = ($('li', $ul).length) * ($('li:first', $ul).height()); //+1 else bug ff
- (iSelectHeight < $ul.height()) && $ul.css({height: iSelectHeight,'overflow': 'hidden'}); //hidden else bug with ff
- $ul.css({display: 'none',visibility: 'visible'});
-
- });
- };
- $.fn.jqTransform = function(options) {
- var opt = $.extend({}, defaultOptions, options);
- /* each form */
- return this.each(function() {
- var selfForm = $(this);
- if (selfForm.hasClass('jqtransformdone')) {
- return;
- }
- selfForm.addClass('jqtransformdone');
-
- $('input:submit, input:reset, input[type="button"]', this).jqTransInputButton();
- $('input:text, input:password', this).jqTransInputText();
- $('input:checkbox', this).jqTransCheckBox();
- $('input:radio', this).jqTransRadio();
- $('textarea', this).jqTransTextarea();
-
- if ($('select', this).jqTransSelect().length > 0) {
- jqTransformAddDocumentListener();
- }
- selfForm.bind('reset', function() {
- var action = function() {
- jqTransformReset(this);
- };
- window.setTimeout(action, 10);
- });
-
-
- }); /* End Form each */
-
- }; /* End the Plugin */
- })(jQuery);
|