home page is restored, so is context view
|
Before Width: | Height: | Size: 781 B |
|
Before Width: | Height: | Size: 596 B |
|
Before Width: | Height: | Size: 244 B |
|
Before Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 156 B |
|
Before Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 587 B |
|
Before Width: | Height: | Size: 109 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 138 B |
|
Before Width: | Height: | Size: 3 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 496 B |
|
Before Width: | Height: | Size: 425 B |
|
Before Width: | Height: | Size: 501 B |
|
Before Width: | Height: | Size: 441 B |
|
Before Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 905 B |
|
Before Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 216 B |
|
Before Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 764 B |
|
Before Width: | Height: | Size: 192 B |
|
Before Width: | Height: | Size: 618 B |
|
Before Width: | Height: | Size: 69 B |
|
Before Width: | Height: | Size: 337 B |
|
Before Width: | Height: | Size: 271 B |
|
Before Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 161 B |
|
Before Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 237 B |
|
Before Width: | Height: | Size: 410 B |
|
Before Width: | Height: | Size: 598 B |
|
Before Width: | Height: | Size: 475 B |
|
Before Width: | Height: | Size: 814 B |
|
Before Width: | Height: | Size: 642 B |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 84 B |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 935 B |
|
Before Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 328 B |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 515 B |
|
|
@ -1,69 +0,0 @@
|
|||
/*
|
||||
* AccessKey Hints
|
||||
*
|
||||
* Checks all HTML elements on this page that can have an accesskey attribute
|
||||
* (<a>, <area>, <button>, <input>, <label>, <legend> and <textarea>)
|
||||
* and creates or appends the title attribute to include platform-specific
|
||||
* hint in the title, i.e. "Alt+S" (Win)
|
||||
* or "Ctrl+S)" (Mac). If a title exists, a space plus the hint wrapped in
|
||||
* parentheses is appended. The only exception is if the title already contains
|
||||
* 'accesskey', 'Alt+' or 'Ctrl+' (case-insensitive) in which case this script
|
||||
* will leave it alone.
|
||||
*
|
||||
* Use the following markup to include the library:
|
||||
* <script type="text/javascript" src="access-key-hints.js"></script>
|
||||
*/
|
||||
var accessKeyHintsAdder = {
|
||||
|
||||
run : function() {
|
||||
var elemTypes = new Array('a','area','button','input','label','legend','textarea');
|
||||
for(var i = 0; i < elemTypes.length; i++)
|
||||
{
|
||||
accessKeyHintsAdder.addHint(document.getElementsByTagName(elemTypes[i]));
|
||||
}
|
||||
},
|
||||
|
||||
addHint : function(elems) {
|
||||
var elem;
|
||||
var i = 0;
|
||||
|
||||
processElements:
|
||||
while(elem = elems.item(i++))
|
||||
{
|
||||
var accessKey = elem.getAttributeNode("accesskey");
|
||||
if (!accessKey || !accessKey.value)
|
||||
continue processElements;
|
||||
|
||||
var title = elem.getAttributeNode("title");
|
||||
if (title && title.value)
|
||||
{
|
||||
var overrides = new Array('accesskey','alt+','ctrl+');
|
||||
for (var j=0; j < overrides.length; j++)
|
||||
{
|
||||
if (title.value.toLowerCase().indexOf(overrides[j]) != -1)
|
||||
continue processElements;
|
||||
}
|
||||
elem.setAttribute("title", title.value + ' (' + this.getHintText(accessKey.value) + ')');
|
||||
}
|
||||
else
|
||||
{
|
||||
elem.setAttribute("title", this.getHintText(accessKey.value));
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
getHintText : function(accessKey) {
|
||||
return this.getModifier() + '+' + accessKey.toUpperCase();
|
||||
},
|
||||
|
||||
getModifier : function() {
|
||||
var ua = navigator.userAgent.toLowerCase();
|
||||
if (ua.indexOf('mac') == -1)
|
||||
return 'Alt';
|
||||
else
|
||||
return 'Ctrl';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$(accessKeyHintsAdder.run);
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
(function($){
|
||||
/* hoverIntent by Brian Cherne */
|
||||
$.fn.hoverIntent = function(f,g) {
|
||||
// default configuration options
|
||||
var cfg = {
|
||||
sensitivity: 7,
|
||||
interval: 100,
|
||||
timeout: 400
|
||||
};
|
||||
// override configuration options with user supplied object
|
||||
cfg = $.extend(cfg, g ? { over: f, out: g } : f );
|
||||
|
||||
// instantiate variables
|
||||
// cX, cY = current X and Y position of mouse, updated by mousemove event
|
||||
// pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
|
||||
var cX, cY, pX, pY;
|
||||
|
||||
// A private function for getting mouse position
|
||||
var track = function(ev) {
|
||||
cX = ev.pageX;
|
||||
cY = ev.pageY;
|
||||
};
|
||||
|
||||
// A private function for comparing current and previous mouse position
|
||||
var compare = function(ev,ob) {
|
||||
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
|
||||
// compare mouse positions to see if they've crossed the threshold
|
||||
if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
|
||||
$(ob).unbind("mousemove",track);
|
||||
// set hoverIntent state to true (so mouseOut can be called)
|
||||
ob.hoverIntent_s = 1;
|
||||
return cfg.over.apply(ob,[ev]);
|
||||
} else {
|
||||
// set previous coordinates for next time
|
||||
pX = cX; pY = cY;
|
||||
// use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
|
||||
ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
|
||||
}
|
||||
};
|
||||
|
||||
// A private function for delaying the mouseOut function
|
||||
var delay = function(ev,ob) {
|
||||
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
|
||||
ob.hoverIntent_s = 0;
|
||||
return cfg.out.apply(ob,[ev]);
|
||||
};
|
||||
|
||||
// A private function for handling mouse 'hovering'
|
||||
var handleHover = function(e) {
|
||||
// next three lines copied from jQuery.hover, ignore children onMouseOver/onMouseOut
|
||||
var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget;
|
||||
while ( p && p != this ) { try { p = p.parentNode; } catch(e) { p = this; } }
|
||||
if ( p == this ) { return false; }
|
||||
|
||||
// copy objects to be passed into t (required for event object to be passed in IE)
|
||||
var ev = jQuery.extend({},e);
|
||||
var ob = this;
|
||||
|
||||
// cancel hoverIntent timer if it exists
|
||||
if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }
|
||||
|
||||
// else e.type == "onmouseover"
|
||||
if (e.type == "mouseover") {
|
||||
// set "previous" X and Y position based on initial entry point
|
||||
pX = ev.pageX; pY = ev.pageY;
|
||||
// update "current" X and Y position based on mousemove
|
||||
$(ob).bind("mousemove",track);
|
||||
// start polling interval (self-calling timeout) to compare mouse coordinates over time
|
||||
if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}
|
||||
|
||||
// else e.type == "onmouseout"
|
||||
} else {
|
||||
// unbind expensive mousemove event
|
||||
$(ob).unbind("mousemove",track);
|
||||
// if hoverIntent state is true, then call the mouseOut function after the specified delay
|
||||
if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
|
||||
}
|
||||
};
|
||||
|
||||
// bind the function to the two event listeners
|
||||
return this.mouseover(handleHover).mouseout(handleHover);
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
/* Czech initialisation for the jQuery UI date picker plugin. */
|
||||
/* Written by Pavel Župa (pavel.zupa@gmail.com). */
|
||||
jQuery(function($){
|
||||
$.datepicker.regional['cz'] = {
|
||||
closeText: 'zavřít',
|
||||
prevText: 'předchozí',
|
||||
nextText: 'další',
|
||||
currentText: 'dnes',
|
||||
monthNames: ['Leden','Únor','Březen','Duben','Květen','Červen',
|
||||
'Červenec','Srpen','Září','Říjen','Listopad','Prosinec'],
|
||||
monthNamesShort: ['Led','Úno','Bře','Dub','Kvě','Čer',
|
||||
'Čec','Srp','Zář','Říj','Lis','Pro'],
|
||||
dayNames: ['Neděle','Pondělí','Úterý','Středa','Čtvrtek','Pátek','Sobota'],
|
||||
dayNamesShort: ['Ne','Po','Út','St','Čt','Pá','So'],
|
||||
dayNamesMin: ['Ne','Po','Út','St','Čt','Pá','So'],
|
||||
weekHeader: 'č.',
|
||||
dateFormat: 'dd.mm.yy',
|
||||
firstDay: 1,
|
||||
isRTL: false,
|
||||
showMonthAfterYear: false,
|
||||
yearSuffix: ''};
|
||||
$.datepicker.setDefaults($.datepicker.regional['cz']);
|
||||
});
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
/* German initialisation for the jQuery UI date picker plugin. */
|
||||
/* Written by Milian Wolff (mail@milianw.de). */
|
||||
jQuery(function($){
|
||||
$.datepicker.regional['de'] = {
|
||||
closeText: 'schließen',
|
||||
prevText: '<zurück',
|
||||
nextText: 'Vor>',
|
||||
currentText: 'heute',
|
||||
monthNames: ['Januar','Februar','März','April','Mai','Juni',
|
||||
'Juli','August','September','Oktober','November','Dezember'],
|
||||
monthNamesShort: ['Jan','Feb','Mär','Apr','Mai','Jun',
|
||||
'Jul','Aug','Sep','Okt','Nov','Dez'],
|
||||
dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'],
|
||||
dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'],
|
||||
dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'],
|
||||
weekHeader: 'Wo',
|
||||
dateFormat: 'dd.mm.yy',
|
||||
firstDay: 1,
|
||||
isRTL: false,
|
||||
showMonthAfterYear: false,
|
||||
yearSuffix: ''};
|
||||
$.datepicker.setDefaults($.datepicker.regional['de']);
|
||||
});
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
/* Inicialización en español para la extensión 'UI date picker' para jQuery. */
|
||||
/* Traducido por Vester (xvester@gmail.com). */
|
||||
jQuery(function($){
|
||||
$.datepicker.regional['es'] = {
|
||||
closeText: 'Cerrar',
|
||||
prevText: '<Ant',
|
||||
nextText: 'Sig>',
|
||||
currentText: 'Hoy',
|
||||
monthNames: ['Enero','Febrero','Marzo','Abril','Mayo','Junio',
|
||||
'Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'],
|
||||
monthNamesShort: ['Ene','Feb','Mar','Abr','May','Jun',
|
||||
'Jul','Ago','Sep','Oct','Nov','Dic'],
|
||||
dayNames: ['Domingo','Lunes','Martes','Miércoles','Jueves','Viernes','Sábado'],
|
||||
dayNamesShort: ['Dom','Lun','Mar','Mié','Juv','Vie','Sáb'],
|
||||
dayNamesMin: ['Do','Lu','Ma','Mi','Ju','Vi','Sá'],
|
||||
weekHeader: 'Sm',
|
||||
dateFormat: 'dd/mm/yy',
|
||||
firstDay: 1,
|
||||
isRTL: false,
|
||||
showMonthAfterYear: false,
|
||||
yearSuffix: ''};
|
||||
$.datepicker.setDefaults($.datepicker.regional['es']);
|
||||
});
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
/* French initialisation for the jQuery UI date picker plugin. */
|
||||
/* Written by Keith Wood (kbwood{at}iinet.com.au) and Stéphane Nahmani (sholby@sholby.net). */
|
||||
jQuery(function($){
|
||||
$.datepicker.regional['fr'] = {
|
||||
closeText: 'Fermer',
|
||||
prevText: '<Préc',
|
||||
nextText: 'Suiv>',
|
||||
currentText: 'Courant',
|
||||
monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin',
|
||||
'Juillet','Août','Septembre','Octobre','Novembre','Décembre'],
|
||||
monthNamesShort: ['Jan','Fév','Mar','Avr','Mai','Jun',
|
||||
'Jul','Aoû','Sep','Oct','Nov','Déc'],
|
||||
dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],
|
||||
dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'],
|
||||
dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'],
|
||||
weekHeader: 'Sm',
|
||||
dateFormat: 'dd/mm/yy',
|
||||
firstDay: 1,
|
||||
isRTL: false,
|
||||
showMonthAfterYear: false,
|
||||
yearSuffix: ''};
|
||||
$.datepicker.setDefaults($.datepicker.regional['fr']);
|
||||
});
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
/* Hebrew initialisation for the UI Datepicker extension. */
|
||||
/* Written by Amir Hardon (ahardon at gmail dot com). */
|
||||
jQuery(function($){
|
||||
$.datepicker.regional['he'] = {
|
||||
closeText: 'סגור',
|
||||
prevText: '<הקודם',
|
||||
nextText: 'הבא>',
|
||||
currentText: 'היום',
|
||||
monthNames: ['ינואר','פברואר','מרץ','אפריל','מאי','יוני',
|
||||
'יולי','אוגוסט','ספטמבר','אוקטובר','נובמבר','דצמבר'],
|
||||
monthNamesShort: ['1','2','3','4','5','6',
|
||||
'7','8','9','10','11','12'],
|
||||
dayNames: ['ראשון','שני','שלישי','רביעי','חמישי','שישי','שבת'],
|
||||
dayNamesShort: ['א\'','ב\'','ג\'','ד\'','ה\'','ו\'','שבת'],
|
||||
dayNamesMin: ['א\'','ב\'','ג\'','ד\'','ה\'','ו\'','שבת'],
|
||||
weekHeader: 'Wk',
|
||||
dateFormat: 'dd/mm/yy',
|
||||
firstDay: 0,
|
||||
isRTL: true,
|
||||
showMonthAfterYear: false,
|
||||
yearSuffix: ''};
|
||||
$.datepicker.setDefaults($.datepicker.regional['he']);
|
||||
});
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
/* Dutch (UTF-8) initialisation for the jQuery UI date picker plugin. */
|
||||
/* Written by Mathias Bynens <http://mathiasbynens.be/> */
|
||||
jQuery(function($){
|
||||
$.datepicker.regional['nl'] = {
|
||||
closeText: 'Sluiten',
|
||||
prevText: '←',
|
||||
nextText: '→',
|
||||
currentText: 'Vandaag',
|
||||
monthNames: ['januari', 'februari', 'maart', 'april', 'mei', 'juni',
|
||||
'juli', 'augustus', 'september', 'oktober', 'november', 'december'],
|
||||
monthNamesShort: ['jan', 'feb', 'maa', 'apr', 'mei', 'jun',
|
||||
'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
|
||||
dayNames: ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'],
|
||||
dayNamesShort: ['zon', 'maa', 'din', 'woe', 'don', 'vri', 'zat'],
|
||||
dayNamesMin: ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'],
|
||||
weekHeader: 'Wk',
|
||||
dateFormat: 'dd-mm-yy',
|
||||
firstDay: 1,
|
||||
isRTL: false,
|
||||
showMonthAfterYear: false,
|
||||
yearSuffix: ''};
|
||||
$.datepicker.setDefaults($.datepicker.regional['nl']);
|
||||
});
|
||||
4
public/javascripts/jquery-1.7.1.min.js
vendored
356
public/javascripts/jquery-ui-1.8.17.custom.min.js
vendored
|
|
@ -1,493 +0,0 @@
|
|||
/*!
|
||||
* jQuery blockUI plugin
|
||||
* Version 2.38 (29-MAR-2011)
|
||||
* @requires jQuery v1.2.3 or later
|
||||
*
|
||||
* Examples at: http://malsup.com/jquery/block/
|
||||
* Copyright (c) 2007-2010 M. Alsup
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* Thanks to Amir-Hossein Sobhi for some excellent contributions!
|
||||
*/
|
||||
|
||||
;(function($) {
|
||||
|
||||
if (/1\.(0|1|2)\.(0|1|2)/.test($.fn.jquery) || /^1.1/.test($.fn.jquery)) {
|
||||
alert('blockUI requires jQuery v1.2.3 or later! You are using v' + $.fn.jquery);
|
||||
return;
|
||||
}
|
||||
|
||||
$.fn._fadeIn = $.fn.fadeIn;
|
||||
|
||||
var noOp = function() {};
|
||||
|
||||
// this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle
|
||||
// retarded userAgent strings on Vista)
|
||||
var mode = document.documentMode || 0;
|
||||
var setExpr = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8);
|
||||
var ie6 = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent) && !mode;
|
||||
|
||||
// global $ methods for blocking/unblocking the entire page
|
||||
$.blockUI = function(opts) { install(window, opts); };
|
||||
$.unblockUI = function(opts) { remove(window, opts); };
|
||||
|
||||
// convenience method for quick growl-like notifications (http://www.google.com/search?q=growl)
|
||||
$.growlUI = function(title, message, timeout, onClose) {
|
||||
var $m = $('<div class="growlUI"></div>');
|
||||
if (title) $m.append('<h1>'+title+'</h1>');
|
||||
if (message) $m.append('<h2>'+message+'</h2>');
|
||||
if (timeout == undefined) timeout = 3000;
|
||||
$.blockUI({
|
||||
message: $m, fadeIn: 700, fadeOut: 1000, centerY: false,
|
||||
timeout: timeout, showOverlay: false,
|
||||
onUnblock: onClose,
|
||||
css: $.blockUI.defaults.growlCSS
|
||||
});
|
||||
};
|
||||
|
||||
// plugin method for blocking element content
|
||||
$.fn.block = function(opts) {
|
||||
return this.unblock({ fadeOut: 0 }).each(function() {
|
||||
if ($.css(this,'position') == 'static')
|
||||
this.style.position = 'relative';
|
||||
if ($.browser.msie)
|
||||
this.style.zoom = 1; // force 'hasLayout'
|
||||
install(this, opts);
|
||||
});
|
||||
};
|
||||
|
||||
// plugin method for unblocking element content
|
||||
$.fn.unblock = function(opts) {
|
||||
return this.each(function() {
|
||||
remove(this, opts);
|
||||
});
|
||||
};
|
||||
|
||||
$.blockUI.version = 2.38; // 2nd generation blocking at no extra cost!
|
||||
|
||||
// override these in your code to change the default behavior and style
|
||||
$.blockUI.defaults = {
|
||||
// message displayed when blocking (use null for no message)
|
||||
message: '<h1>Please wait...</h1>',
|
||||
|
||||
title: null, // title string; only used when theme == true
|
||||
draggable: true, // only used when theme == true (requires jquery-ui.js to be loaded)
|
||||
|
||||
theme: false, // set to true to use with jQuery UI themes
|
||||
|
||||
// styles for the message when blocking; if you wish to disable
|
||||
// these and use an external stylesheet then do this in your code:
|
||||
// $.blockUI.defaults.css = {};
|
||||
css: {
|
||||
padding: 0,
|
||||
margin: 0,
|
||||
width: '30%',
|
||||
top: '40%',
|
||||
left: '35%',
|
||||
textAlign: 'center',
|
||||
color: '#000',
|
||||
border: '3px solid #aaa',
|
||||
backgroundColor:'#fff',
|
||||
cursor: 'wait'
|
||||
},
|
||||
|
||||
// minimal style set used when themes are used
|
||||
themedCSS: {
|
||||
width: '30%',
|
||||
top: '40%',
|
||||
left: '35%'
|
||||
},
|
||||
|
||||
// styles for the overlay
|
||||
overlayCSS: {
|
||||
backgroundColor: '#000',
|
||||
opacity: 0.6,
|
||||
cursor: 'wait'
|
||||
},
|
||||
|
||||
// styles applied when using $.growlUI
|
||||
growlCSS: {
|
||||
width: '350px',
|
||||
top: '10px',
|
||||
left: '',
|
||||
right: '10px',
|
||||
border: 'none',
|
||||
padding: '5px',
|
||||
opacity: 0.6,
|
||||
cursor: 'default',
|
||||
color: '#fff',
|
||||
backgroundColor: '#000',
|
||||
'-webkit-border-radius': '10px',
|
||||
'-moz-border-radius': '10px',
|
||||
'border-radius': '10px'
|
||||
},
|
||||
|
||||
// IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w
|
||||
// (hat tip to Jorge H. N. de Vasconcelos)
|
||||
iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank',
|
||||
|
||||
// force usage of iframe in non-IE browsers (handy for blocking applets)
|
||||
forceIframe: false,
|
||||
|
||||
// z-index for the blocking overlay
|
||||
baseZ: 1000,
|
||||
|
||||
// set these to true to have the message automatically centered
|
||||
centerX: true, // <-- only effects element blocking (page block controlled via css above)
|
||||
centerY: true,
|
||||
|
||||
// allow body element to be stetched in ie6; this makes blocking look better
|
||||
// on "short" pages. disable if you wish to prevent changes to the body height
|
||||
allowBodyStretch: true,
|
||||
|
||||
// enable if you want key and mouse events to be disabled for content that is blocked
|
||||
bindEvents: true,
|
||||
|
||||
// be default blockUI will supress tab navigation from leaving blocking content
|
||||
// (if bindEvents is true)
|
||||
constrainTabKey: true,
|
||||
|
||||
// fadeIn time in millis; set to 0 to disable fadeIn on block
|
||||
fadeIn: 200,
|
||||
|
||||
// fadeOut time in millis; set to 0 to disable fadeOut on unblock
|
||||
fadeOut: 400,
|
||||
|
||||
// time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock
|
||||
timeout: 0,
|
||||
|
||||
// disable if you don't want to show the overlay
|
||||
showOverlay: true,
|
||||
|
||||
// if true, focus will be placed in the first available input field when
|
||||
// page blocking
|
||||
focusInput: true,
|
||||
|
||||
// suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity)
|
||||
applyPlatformOpacityRules: true,
|
||||
|
||||
// callback method invoked when fadeIn has completed and blocking message is visible
|
||||
onBlock: null,
|
||||
|
||||
// callback method invoked when unblocking has completed; the callback is
|
||||
// passed the element that has been unblocked (which is the window object for page
|
||||
// blocks) and the options that were passed to the unblock call:
|
||||
// onUnblock(element, options)
|
||||
onUnblock: null,
|
||||
|
||||
// don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493
|
||||
quirksmodeOffsetHack: 4,
|
||||
|
||||
// class name of the message block
|
||||
blockMsgClass: 'blockMsg'
|
||||
};
|
||||
|
||||
// private data and functions follow...
|
||||
|
||||
var pageBlock = null;
|
||||
var pageBlockEls = [];
|
||||
|
||||
function install(el, opts) {
|
||||
var full = (el == window);
|
||||
var msg = opts && opts.message !== undefined ? opts.message : undefined;
|
||||
opts = $.extend({}, $.blockUI.defaults, opts || {});
|
||||
opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {});
|
||||
var css = $.extend({}, $.blockUI.defaults.css, opts.css || {});
|
||||
var themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {});
|
||||
msg = msg === undefined ? opts.message : msg;
|
||||
|
||||
// remove the current block (if there is one)
|
||||
if (full && pageBlock)
|
||||
remove(window, {fadeOut:0});
|
||||
|
||||
// if an existing element is being used as the blocking content then we capture
|
||||
// its current place in the DOM (and current display style) so we can restore
|
||||
// it when we unblock
|
||||
if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) {
|
||||
var node = msg.jquery ? msg[0] : msg;
|
||||
var data = {};
|
||||
$(el).data('blockUI.history', data);
|
||||
data.el = node;
|
||||
data.parent = node.parentNode;
|
||||
data.display = node.style.display;
|
||||
data.position = node.style.position;
|
||||
if (data.parent)
|
||||
data.parent.removeChild(node);
|
||||
}
|
||||
|
||||
var z = opts.baseZ;
|
||||
|
||||
// blockUI uses 3 layers for blocking, for simplicity they are all used on every platform;
|
||||
// layer1 is the iframe layer which is used to supress bleed through of underlying content
|
||||
// layer2 is the overlay layer which has opacity and a wait cursor (by default)
|
||||
// layer3 is the message content that is displayed while blocking
|
||||
|
||||
var lyr1 = ($.browser.msie || opts.forceIframe)
|
||||
? $('<iframe class="blockUI" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+opts.iframeSrc+'"></iframe>')
|
||||
: $('<div class="blockUI" style="display:none"></div>');
|
||||
|
||||
var lyr2 = opts.theme
|
||||
? $('<div class="blockUI blockOverlay ui-widget-overlay" style="z-index:'+ (z++) +';display:none"></div>')
|
||||
: $('<div class="blockUI blockOverlay" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');
|
||||
|
||||
var lyr3, s;
|
||||
if (opts.theme && full) {
|
||||
s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+z+';display:none;position:fixed">' +
|
||||
'<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || ' ')+'</div>' +
|
||||
'<div class="ui-widget-content ui-dialog-content"></div>' +
|
||||
'</div>';
|
||||
}
|
||||
else if (opts.theme) {
|
||||
s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement ui-dialog ui-widget ui-corner-all" style="z-index:'+z+';display:none;position:absolute">' +
|
||||
'<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || ' ')+'</div>' +
|
||||
'<div class="ui-widget-content ui-dialog-content"></div>' +
|
||||
'</div>';
|
||||
}
|
||||
else if (full) {
|
||||
s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage" style="z-index:'+z+';display:none;position:fixed"></div>';
|
||||
}
|
||||
else {
|
||||
s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement" style="z-index:'+z+';display:none;position:absolute"></div>';
|
||||
}
|
||||
lyr3 = $(s);
|
||||
|
||||
// if we have a message, style it
|
||||
if (msg) {
|
||||
if (opts.theme) {
|
||||
lyr3.css(themedCSS);
|
||||
lyr3.addClass('ui-widget-content');
|
||||
}
|
||||
else
|
||||
lyr3.css(css);
|
||||
}
|
||||
|
||||
// style the overlay
|
||||
if (!opts.theme && (!opts.applyPlatformOpacityRules || !($.browser.mozilla && /Linux/.test(navigator.platform))))
|
||||
lyr2.css(opts.overlayCSS);
|
||||
lyr2.css('position', full ? 'fixed' : 'absolute');
|
||||
|
||||
// make iframe layer transparent in IE
|
||||
if ($.browser.msie || opts.forceIframe)
|
||||
lyr1.css('opacity',0.0);
|
||||
|
||||
//$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el);
|
||||
var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el);
|
||||
$.each(layers, function() {
|
||||
this.appendTo($par);
|
||||
});
|
||||
|
||||
if (opts.theme && opts.draggable && $.fn.draggable) {
|
||||
lyr3.draggable({
|
||||
handle: '.ui-dialog-titlebar',
|
||||
cancel: 'li'
|
||||
});
|
||||
}
|
||||
|
||||
// ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling)
|
||||
var expr = setExpr && (!$.boxModel || $('object,embed', full ? null : el).length > 0);
|
||||
if (ie6 || expr) {
|
||||
// give body 100% height
|
||||
if (full && opts.allowBodyStretch && $.boxModel)
|
||||
$('html,body').css('height','100%');
|
||||
|
||||
// fix ie6 issue when blocked element has a border width
|
||||
if ((ie6 || !$.boxModel) && !full) {
|
||||
var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth');
|
||||
var fixT = t ? '(0 - '+t+')' : 0;
|
||||
var fixL = l ? '(0 - '+l+')' : 0;
|
||||
}
|
||||
|
||||
// simulate fixed position
|
||||
$.each([lyr1,lyr2,lyr3], function(i,o) {
|
||||
var s = o[0].style;
|
||||
s.position = 'absolute';
|
||||
if (i < 2) {
|
||||
full ? s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"')
|
||||
: s.setExpression('height','this.parentNode.offsetHeight + "px"');
|
||||
full ? s.setExpression('width','jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"')
|
||||
: s.setExpression('width','this.parentNode.offsetWidth + "px"');
|
||||
if (fixL) s.setExpression('left', fixL);
|
||||
if (fixT) s.setExpression('top', fixT);
|
||||
}
|
||||
else if (opts.centerY) {
|
||||
if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');
|
||||
s.marginTop = 0;
|
||||
}
|
||||
else if (!opts.centerY && full) {
|
||||
var top = (opts.css && opts.css.top) ? parseInt(opts.css.top) : 0;
|
||||
var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"';
|
||||
s.setExpression('top',expression);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// show the message
|
||||
if (msg) {
|
||||
if (opts.theme)
|
||||
lyr3.find('.ui-widget-content').append(msg);
|
||||
else
|
||||
lyr3.append(msg);
|
||||
if (msg.jquery || msg.nodeType)
|
||||
$(msg).show();
|
||||
}
|
||||
|
||||
if (($.browser.msie || opts.forceIframe) && opts.showOverlay)
|
||||
lyr1.show(); // opacity is zero
|
||||
if (opts.fadeIn) {
|
||||
var cb = opts.onBlock ? opts.onBlock : noOp;
|
||||
var cb1 = (opts.showOverlay && !msg) ? cb : noOp;
|
||||
var cb2 = msg ? cb : noOp;
|
||||
if (opts.showOverlay)
|
||||
lyr2._fadeIn(opts.fadeIn, cb1);
|
||||
if (msg)
|
||||
lyr3._fadeIn(opts.fadeIn, cb2);
|
||||
}
|
||||
else {
|
||||
if (opts.showOverlay)
|
||||
lyr2.show();
|
||||
if (msg)
|
||||
lyr3.show();
|
||||
if (opts.onBlock)
|
||||
opts.onBlock();
|
||||
}
|
||||
|
||||
// bind key and mouse events
|
||||
bind(1, el, opts);
|
||||
|
||||
if (full) {
|
||||
pageBlock = lyr3[0];
|
||||
pageBlockEls = $(':input:enabled:visible',pageBlock);
|
||||
if (opts.focusInput)
|
||||
setTimeout(focus, 20);
|
||||
}
|
||||
else
|
||||
center(lyr3[0], opts.centerX, opts.centerY);
|
||||
|
||||
if (opts.timeout) {
|
||||
// auto-unblock
|
||||
var to = setTimeout(function() {
|
||||
full ? $.unblockUI(opts) : $(el).unblock(opts);
|
||||
}, opts.timeout);
|
||||
$(el).data('blockUI.timeout', to);
|
||||
}
|
||||
};
|
||||
|
||||
// remove the block
|
||||
function remove(el, opts) {
|
||||
var full = (el == window);
|
||||
var $el = $(el);
|
||||
var data = $el.data('blockUI.history');
|
||||
var to = $el.data('blockUI.timeout');
|
||||
if (to) {
|
||||
clearTimeout(to);
|
||||
$el.removeData('blockUI.timeout');
|
||||
}
|
||||
opts = $.extend({}, $.blockUI.defaults, opts || {});
|
||||
bind(0, el, opts); // unbind events
|
||||
|
||||
var els;
|
||||
if (full) // crazy selector to handle odd field errors in ie6/7
|
||||
els = $('body').children().filter('.blockUI').add('body > .blockUI');
|
||||
else
|
||||
els = $('.blockUI', el);
|
||||
|
||||
if (full)
|
||||
pageBlock = pageBlockEls = null;
|
||||
|
||||
if (opts.fadeOut) {
|
||||
els.fadeOut(opts.fadeOut);
|
||||
setTimeout(function() { reset(els,data,opts,el); }, opts.fadeOut);
|
||||
}
|
||||
else
|
||||
reset(els, data, opts, el);
|
||||
};
|
||||
|
||||
// move blocking element back into the DOM where it started
|
||||
function reset(els,data,opts,el) {
|
||||
els.each(function(i,o) {
|
||||
// remove via DOM calls so we don't lose event handlers
|
||||
if (this.parentNode)
|
||||
this.parentNode.removeChild(this);
|
||||
});
|
||||
|
||||
if (data && data.el) {
|
||||
data.el.style.display = data.display;
|
||||
data.el.style.position = data.position;
|
||||
if (data.parent)
|
||||
data.parent.appendChild(data.el);
|
||||
$(el).removeData('blockUI.history');
|
||||
}
|
||||
|
||||
if (typeof opts.onUnblock == 'function')
|
||||
opts.onUnblock(el,opts);
|
||||
};
|
||||
|
||||
// bind/unbind the handler
|
||||
function bind(b, el, opts) {
|
||||
var full = el == window, $el = $(el);
|
||||
|
||||
// don't bother unbinding if there is nothing to unbind
|
||||
if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked')))
|
||||
return;
|
||||
if (!full)
|
||||
$el.data('blockUI.isBlocked', b);
|
||||
|
||||
// don't bind events when overlay is not in use or if bindEvents is false
|
||||
if (!opts.bindEvents || (b && !opts.showOverlay))
|
||||
return;
|
||||
|
||||
// bind anchors and inputs for mouse and key events
|
||||
var events = 'mousedown mouseup keydown keypress';
|
||||
b ? $(document).bind(events, opts, handler) : $(document).unbind(events, handler);
|
||||
|
||||
// former impl...
|
||||
// var $e = $('a,:input');
|
||||
// b ? $e.bind(events, opts, handler) : $e.unbind(events, handler);
|
||||
};
|
||||
|
||||
// event handler to suppress keyboard/mouse events when blocking
|
||||
function handler(e) {
|
||||
// allow tab navigation (conditionally)
|
||||
if (e.keyCode && e.keyCode == 9) {
|
||||
if (pageBlock && e.data.constrainTabKey) {
|
||||
var els = pageBlockEls;
|
||||
var fwd = !e.shiftKey && e.target === els[els.length-1];
|
||||
var back = e.shiftKey && e.target === els[0];
|
||||
if (fwd || back) {
|
||||
setTimeout(function(){focus(back)},10);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
var opts = e.data;
|
||||
// allow events within the message content
|
||||
if ($(e.target).parents('div.' + opts.blockMsgClass).length > 0)
|
||||
return true;
|
||||
|
||||
// allow events for content that is not being blocked
|
||||
return $(e.target).parents().children().filter('div.blockUI').length == 0;
|
||||
};
|
||||
|
||||
function focus(back) {
|
||||
if (!pageBlockEls)
|
||||
return;
|
||||
var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0];
|
||||
if (e)
|
||||
e.focus();
|
||||
};
|
||||
|
||||
function center(el, x, y) {
|
||||
var p = el.parentNode, s = el.style;
|
||||
var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth');
|
||||
var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth');
|
||||
if (x) s.left = l > 0 ? (l+'px') : '0';
|
||||
if (y) s.top = t > 0 ? (t+'px') : '0';
|
||||
};
|
||||
|
||||
function sz(el, p) {
|
||||
return parseInt($.css(el,p))||0;
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
|
@ -1,145 +0,0 @@
|
|||
/**
|
||||
* Cookie plugin
|
||||
*
|
||||
* Copyright (c) 2006 Klaus Hartl (stilbuero.de)
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create a cookie with the given name and value and other optional parameters.
|
||||
*
|
||||
* @example $.cookie('the_cookie', 'the_value');
|
||||
* @desc Set the value of a cookie.
|
||||
* @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
|
||||
* @desc Create a cookie with all available options.
|
||||
* @example $.cookie('the_cookie', 'the_value');
|
||||
* @desc Create a session cookie.
|
||||
* @example $.cookie('the_cookie', null);
|
||||
* @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
|
||||
* used when the cookie was set.
|
||||
*
|
||||
* @param String name The name of the cookie.
|
||||
* @param String value The value of the cookie.
|
||||
* @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
|
||||
* @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
|
||||
* If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
|
||||
* If set to null or omitted, the cookie will be a session cookie and will not be retained
|
||||
* when the the browser exits.
|
||||
* @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
|
||||
* @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
|
||||
* @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
|
||||
* require a secure protocol (like HTTPS).
|
||||
* @type undefined
|
||||
*
|
||||
* @name $.cookie
|
||||
* @cat Plugins/Cookie
|
||||
* @author Klaus Hartl/klaus.hartl@stilbuero.de
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create multiple cookies at once stored in an object, with optional parameters affecting them all.
|
||||
*
|
||||
* @example $.cookie({ 'the_cookie' : 'the_value' });
|
||||
* @desc Set/delete multiple cookies at once.
|
||||
* @example $.cookie({ 'the_cookie' : 'the_value' }, { expires: 7, path: '/', domain: 'jquery.com', secure: true });
|
||||
* @desc Set/delete multiple cookies with options.
|
||||
*
|
||||
* @param Object name An object with multiple cookie name-value pairs.
|
||||
* @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
|
||||
* @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
|
||||
* If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
|
||||
* If set to null or omitted, the cookie will be a session cookie and will not be retained
|
||||
* when the the browser exits.
|
||||
* @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
|
||||
* @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
|
||||
* @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
|
||||
* require a secure protocol (like HTTPS).
|
||||
* @type undefined
|
||||
*
|
||||
* @name $.cookie
|
||||
* @cat Plugins/Cookie
|
||||
* @author Klaus Hartl/klaus.hartl@stilbuero.de
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get the value of a cookie with the given name.
|
||||
*
|
||||
* @example $.cookie('the_cookie');
|
||||
* @desc Get the value of a cookie.
|
||||
*
|
||||
* @param String name The name of the cookie.
|
||||
* @return The value of the cookie.
|
||||
* @type String
|
||||
*
|
||||
* @name $.cookie
|
||||
* @cat Plugins/Cookie
|
||||
* @author Klaus Hartl/klaus.hartl@stilbuero.de
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get the names and values of all cookies for the page.
|
||||
*
|
||||
* @example $.cookie();
|
||||
* @desc Get all the cookies for the page
|
||||
*
|
||||
* @return an object with the name-value pairs of all available cookies.
|
||||
* @type Object
|
||||
*
|
||||
* @name $.cookie
|
||||
* @cat Plugins/Cookie
|
||||
* @author Klaus Hartl/klaus.hartl@stilbuero.de
|
||||
*/
|
||||
|
||||
|
||||
jQuery.cookie = function(name, value, options) {
|
||||
if (typeof value != 'undefined' || (name && typeof name != 'string')) { // name and value given, set cookie
|
||||
if (typeof name == 'string') {
|
||||
options = options || {};
|
||||
if (value === null) {
|
||||
value = '';
|
||||
options.expires = -1;
|
||||
}
|
||||
var expires = '';
|
||||
if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
|
||||
var date;
|
||||
if (typeof options.expires == 'number') {
|
||||
date = new Date();
|
||||
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
|
||||
} else {
|
||||
date = options.expires;
|
||||
}
|
||||
expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
|
||||
}
|
||||
// CAUTION: Needed to parenthesize options.path and options.domain
|
||||
// in the following expressions, otherwise they evaluate to undefined
|
||||
// in the packed version for some reason...
|
||||
var path = options.path ? '; path=' + (options.path) : '';
|
||||
var domain = options.domain ? '; domain=' + (options.domain) : '';
|
||||
var secure = options.secure ? '; secure' : '';
|
||||
document.cookie = name + '=' + encodeURIComponent(value) + expires + path + domain + secure;
|
||||
} else { // `name` is really an object of multiple cookies to be set.
|
||||
for (var n in name) { jQuery.cookie(n, name[n], value||options); }
|
||||
}
|
||||
} else { // get cookie (or all cookies if name is not provided)
|
||||
var returnValue = {};
|
||||
if (document.cookie) {
|
||||
var cookies = document.cookie.split(';');
|
||||
for (var i = 0; i < cookies.length; i++) {
|
||||
var cookie = jQuery.trim(cookies[i]);
|
||||
// Does this cookie string begin with the name we want?
|
||||
if (!name) {
|
||||
var nameLength = cookie.indexOf('=');
|
||||
returnValue[ cookie.substr(0, nameLength)] = decodeURIComponent(cookie.substr(nameLength+1));
|
||||
} else if (cookie.substr(0, name.length + 1) == (name + '=')) {
|
||||
returnValue = decodeURIComponent(cookie.substr(name.length + 1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -1,785 +0,0 @@
|
|||
/*!
|
||||
* jQuery Form Plugin
|
||||
* version: 2.49 (18-OCT-2010)
|
||||
* @requires jQuery v1.3.2 or later
|
||||
*
|
||||
* Examples and documentation at: http://malsup.com/jquery/form/
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*/
|
||||
;(function($) {
|
||||
|
||||
/*
|
||||
Usage Note:
|
||||
-----------
|
||||
Do not use both ajaxSubmit and ajaxForm on the same form. These
|
||||
functions are intended to be exclusive. Use ajaxSubmit if you want
|
||||
to bind your own submit handler to the form. For example,
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#myForm').bind('submit', function(e) {
|
||||
e.preventDefault(); // <-- important
|
||||
$(this).ajaxSubmit({
|
||||
target: '#output'
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Use ajaxForm when you want the plugin to manage all the event binding
|
||||
for you. For example,
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#myForm').ajaxForm({
|
||||
target: '#output'
|
||||
});
|
||||
});
|
||||
|
||||
When using ajaxForm, the ajaxSubmit function will be invoked for you
|
||||
at the appropriate time.
|
||||
*/
|
||||
|
||||
/**
|
||||
* ajaxSubmit() provides a mechanism for immediately submitting
|
||||
* an HTML form using AJAX.
|
||||
*/
|
||||
$.fn.ajaxSubmit = function(options) {
|
||||
// fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
|
||||
if (!this.length) {
|
||||
log('ajaxSubmit: skipping submit process - no element selected');
|
||||
return this;
|
||||
}
|
||||
|
||||
if (typeof options == 'function') {
|
||||
options = { success: options };
|
||||
}
|
||||
|
||||
var url = $.trim(this.attr('action'));
|
||||
if (url) {
|
||||
// clean url (don't include hash vaue)
|
||||
url = (url.match(/^([^#]+)/)||[])[1];
|
||||
}
|
||||
url = url || window.location.href || '';
|
||||
|
||||
options = $.extend(true, {
|
||||
url: url,
|
||||
type: this.attr('method') || 'GET',
|
||||
iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'
|
||||
}, options);
|
||||
|
||||
// hook for manipulating the form data before it is extracted;
|
||||
// convenient for use with rich editors like tinyMCE or FCKEditor
|
||||
var veto = {};
|
||||
this.trigger('form-pre-serialize', [this, options, veto]);
|
||||
if (veto.veto) {
|
||||
log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
|
||||
return this;
|
||||
}
|
||||
|
||||
// provide opportunity to alter form data before it is serialized
|
||||
if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
|
||||
log('ajaxSubmit: submit aborted via beforeSerialize callback');
|
||||
return this;
|
||||
}
|
||||
|
||||
var n,v,a = this.formToArray(options.semantic);
|
||||
if (options.data) {
|
||||
options.extraData = options.data;
|
||||
for (n in options.data) {
|
||||
if(options.data[n] instanceof Array) {
|
||||
for (var k in options.data[n]) {
|
||||
a.push( { name: n, value: options.data[n][k] } );
|
||||
}
|
||||
}
|
||||
else {
|
||||
v = options.data[n];
|
||||
v = $.isFunction(v) ? v() : v; // if value is fn, invoke it
|
||||
a.push( { name: n, value: v } );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// give pre-submit callback an opportunity to abort the submit
|
||||
if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
|
||||
log('ajaxSubmit: submit aborted via beforeSubmit callback');
|
||||
return this;
|
||||
}
|
||||
|
||||
// fire vetoable 'validate' event
|
||||
this.trigger('form-submit-validate', [a, this, options, veto]);
|
||||
if (veto.veto) {
|
||||
log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
|
||||
return this;
|
||||
}
|
||||
|
||||
var q = $.param(a);
|
||||
|
||||
if (options.type.toUpperCase() == 'GET') {
|
||||
options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
|
||||
options.data = null; // data is null for 'get'
|
||||
}
|
||||
else {
|
||||
options.data = q; // data is the query string for 'post'
|
||||
}
|
||||
|
||||
var $form = this, callbacks = [];
|
||||
if (options.resetForm) {
|
||||
callbacks.push(function() { $form.resetForm(); });
|
||||
}
|
||||
if (options.clearForm) {
|
||||
callbacks.push(function() { $form.clearForm(); });
|
||||
}
|
||||
|
||||
// perform a load on the target only if dataType is not provided
|
||||
if (!options.dataType && options.target) {
|
||||
var oldSuccess = options.success || function(){};
|
||||
callbacks.push(function(data) {
|
||||
var fn = options.replaceTarget ? 'replaceWith' : 'html';
|
||||
$(options.target)[fn](data).each(oldSuccess, arguments);
|
||||
});
|
||||
}
|
||||
else if (options.success) {
|
||||
callbacks.push(options.success);
|
||||
}
|
||||
|
||||
options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg
|
||||
var context = options.context || options; // jQuery 1.4+ supports scope context
|
||||
for (var i=0, max=callbacks.length; i < max; i++) {
|
||||
callbacks[i].apply(context, [data, status, xhr || $form, $form]);
|
||||
}
|
||||
};
|
||||
|
||||
// are there files to upload?
|
||||
var fileInputs = $('input:file', this).length > 0;
|
||||
var mp = 'multipart/form-data';
|
||||
var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);
|
||||
|
||||
// options.iframe allows user to force iframe mode
|
||||
// 06-NOV-09: now defaulting to iframe mode if file input is detected
|
||||
if (options.iframe !== false && (fileInputs || options.iframe || multipart)) {
|
||||
// hack to fix Safari hang (thanks to Tim Molendijk for this)
|
||||
// see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
|
||||
if (options.closeKeepAlive) {
|
||||
$.get(options.closeKeepAlive, fileUpload);
|
||||
}
|
||||
else {
|
||||
fileUpload();
|
||||
}
|
||||
}
|
||||
else {
|
||||
$.ajax(options);
|
||||
}
|
||||
|
||||
// fire 'notify' event
|
||||
this.trigger('form-submit-notify', [this, options]);
|
||||
return this;
|
||||
|
||||
|
||||
// private function for handling file uploads (hat tip to YAHOO!)
|
||||
function fileUpload() {
|
||||
var form = $form[0];
|
||||
|
||||
if ($(':input[name=submit],:input[id=submit]', form).length) {
|
||||
// if there is an input with a name or id of 'submit' then we won't be
|
||||
// able to invoke the submit fn on the form (at least not x-browser)
|
||||
alert('Error: Form elements must not have name or id of "submit".');
|
||||
return;
|
||||
}
|
||||
|
||||
var s = $.extend(true, {}, $.ajaxSettings, options);
|
||||
s.context = s.context || s;
|
||||
var id = 'jqFormIO' + (new Date().getTime()), fn = '_'+id;
|
||||
window[fn] = function() {
|
||||
var f = $io.data('form-plugin-onload');
|
||||
if (f) {
|
||||
f();
|
||||
window[fn] = undefined;
|
||||
try { delete window[fn]; } catch(e){}
|
||||
}
|
||||
}
|
||||
var $io = $('<iframe id="' + id + '" name="' + id + '" src="'+ s.iframeSrc +'" onload="window[\'_\'+this.id]()" />');
|
||||
var io = $io[0];
|
||||
|
||||
$io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
|
||||
|
||||
var xhr = { // mock object
|
||||
aborted: 0,
|
||||
responseText: null,
|
||||
responseXML: null,
|
||||
status: 0,
|
||||
statusText: 'n/a',
|
||||
getAllResponseHeaders: function() {},
|
||||
getResponseHeader: function() {},
|
||||
setRequestHeader: function() {},
|
||||
abort: function() {
|
||||
this.aborted = 1;
|
||||
$io.attr('src', s.iframeSrc); // abort op in progress
|
||||
}
|
||||
};
|
||||
|
||||
var g = s.global;
|
||||
// trigger ajax global events so that activity/block indicators work like normal
|
||||
if (g && ! $.active++) {
|
||||
$.event.trigger("ajaxStart");
|
||||
}
|
||||
if (g) {
|
||||
$.event.trigger("ajaxSend", [xhr, s]);
|
||||
}
|
||||
|
||||
if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {
|
||||
if (s.global) {
|
||||
$.active--;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (xhr.aborted) {
|
||||
return;
|
||||
}
|
||||
|
||||
var cbInvoked = false;
|
||||
var timedOut = 0;
|
||||
|
||||
// add submitting element to data if we know it
|
||||
var sub = form.clk;
|
||||
if (sub) {
|
||||
var n = sub.name;
|
||||
if (n && !sub.disabled) {
|
||||
s.extraData = s.extraData || {};
|
||||
s.extraData[n] = sub.value;
|
||||
if (sub.type == "image") {
|
||||
s.extraData[n+'.x'] = form.clk_x;
|
||||
s.extraData[n+'.y'] = form.clk_y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// take a breath so that pending repaints get some cpu time before the upload starts
|
||||
function doSubmit() {
|
||||
// make sure form attrs are set
|
||||
var t = $form.attr('target'), a = $form.attr('action');
|
||||
|
||||
// update form attrs in IE friendly way
|
||||
form.setAttribute('target',id);
|
||||
if (form.getAttribute('method') != 'POST') {
|
||||
form.setAttribute('method', 'POST');
|
||||
}
|
||||
if (form.getAttribute('action') != s.url) {
|
||||
form.setAttribute('action', s.url);
|
||||
}
|
||||
|
||||
// ie borks in some cases when setting encoding
|
||||
if (! s.skipEncodingOverride) {
|
||||
$form.attr({
|
||||
encoding: 'multipart/form-data',
|
||||
enctype: 'multipart/form-data'
|
||||
});
|
||||
}
|
||||
|
||||
// support timout
|
||||
if (s.timeout) {
|
||||
setTimeout(function() { timedOut = true; cb(); }, s.timeout);
|
||||
}
|
||||
|
||||
// add "extra" data to form if provided in options
|
||||
var extraInputs = [];
|
||||
try {
|
||||
if (s.extraData) {
|
||||
for (var n in s.extraData) {
|
||||
extraInputs.push(
|
||||
$('<input type="hidden" name="'+n+'" value="'+s.extraData[n]+'" />')
|
||||
.appendTo(form)[0]);
|
||||
}
|
||||
}
|
||||
|
||||
// add iframe to doc and submit the form
|
||||
$io.appendTo('body');
|
||||
$io.data('form-plugin-onload', cb);
|
||||
form.submit();
|
||||
}
|
||||
finally {
|
||||
// reset attrs and remove "extra" input elements
|
||||
form.setAttribute('action',a);
|
||||
if(t) {
|
||||
form.setAttribute('target', t);
|
||||
} else {
|
||||
$form.removeAttr('target');
|
||||
}
|
||||
$(extraInputs).remove();
|
||||
}
|
||||
}
|
||||
|
||||
if (s.forceSync) {
|
||||
doSubmit();
|
||||
}
|
||||
else {
|
||||
setTimeout(doSubmit, 10); // this lets dom updates render
|
||||
}
|
||||
|
||||
var data, doc, domCheckCount = 50;
|
||||
|
||||
function cb() {
|
||||
if (cbInvoked) {
|
||||
return;
|
||||
}
|
||||
|
||||
$io.removeData('form-plugin-onload');
|
||||
|
||||
var ok = true;
|
||||
try {
|
||||
if (timedOut) {
|
||||
throw 'timeout';
|
||||
}
|
||||
// extract the server response from the iframe
|
||||
doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
|
||||
|
||||
var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc);
|
||||
log('isXml='+isXml);
|
||||
if (!isXml && window.opera && (doc.body == null || doc.body.innerHTML == '')) {
|
||||
if (--domCheckCount) {
|
||||
// in some browsers (Opera) the iframe DOM is not always traversable when
|
||||
// the onload callback fires, so we loop a bit to accommodate
|
||||
log('requeing onLoad callback, DOM not available');
|
||||
setTimeout(cb, 250);
|
||||
return;
|
||||
}
|
||||
// let this fall through because server response could be an empty document
|
||||
//log('Could not access iframe DOM after mutiple tries.');
|
||||
//throw 'DOMException: not available';
|
||||
}
|
||||
|
||||
//log('response detected');
|
||||
cbInvoked = true;
|
||||
xhr.responseText = doc.documentElement ? doc.documentElement.innerHTML : null;
|
||||
xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
|
||||
xhr.getResponseHeader = function(header){
|
||||
var headers = {'content-type': s.dataType};
|
||||
return headers[header];
|
||||
};
|
||||
|
||||
var scr = /(json|script)/.test(s.dataType);
|
||||
if (scr || s.textarea) {
|
||||
// see if user embedded response in textarea
|
||||
var ta = doc.getElementsByTagName('textarea')[0];
|
||||
if (ta) {
|
||||
xhr.responseText = ta.value;
|
||||
}
|
||||
else if (scr) {
|
||||
// account for browsers injecting pre around json response
|
||||
var pre = doc.getElementsByTagName('pre')[0];
|
||||
var b = doc.getElementsByTagName('body')[0];
|
||||
if (pre) {
|
||||
xhr.responseText = pre.innerHTML;
|
||||
}
|
||||
else if (b) {
|
||||
xhr.responseText = b.innerHTML;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (s.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
|
||||
xhr.responseXML = toXml(xhr.responseText);
|
||||
}
|
||||
data = $.httpData(xhr, s.dataType);
|
||||
}
|
||||
catch(e){
|
||||
log('error caught:',e);
|
||||
ok = false;
|
||||
xhr.error = e;
|
||||
$.handleError(s, xhr, 'error', e);
|
||||
}
|
||||
|
||||
// ordering of these callbacks/triggers is odd, but that's how $.ajax does it
|
||||
if (ok) {
|
||||
s.success.call(s.context, data, 'success', xhr);
|
||||
if (g) {
|
||||
$.event.trigger("ajaxSuccess", [xhr, s]);
|
||||
}
|
||||
}
|
||||
if (g) {
|
||||
$.event.trigger("ajaxComplete", [xhr, s]);
|
||||
}
|
||||
if (g && ! --$.active) {
|
||||
$.event.trigger("ajaxStop");
|
||||
}
|
||||
if (s.complete) {
|
||||
s.complete.call(s.context, xhr, ok ? 'success' : 'error');
|
||||
}
|
||||
|
||||
// clean up
|
||||
setTimeout(function() {
|
||||
$io.removeData('form-plugin-onload');
|
||||
$io.remove();
|
||||
xhr.responseXML = null;
|
||||
}, 100);
|
||||
}
|
||||
|
||||
function toXml(s, doc) {
|
||||
if (window.ActiveXObject) {
|
||||
doc = new ActiveXObject('Microsoft.XMLDOM');
|
||||
doc.async = 'false';
|
||||
doc.loadXML(s);
|
||||
}
|
||||
else {
|
||||
doc = (new DOMParser()).parseFromString(s, 'text/xml');
|
||||
}
|
||||
return (doc && doc.documentElement && doc.documentElement.tagName != 'parsererror') ? doc : null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* ajaxForm() provides a mechanism for fully automating form submission.
|
||||
*
|
||||
* The advantages of using this method instead of ajaxSubmit() are:
|
||||
*
|
||||
* 1: This method will include coordinates for <input type="image" /> elements (if the element
|
||||
* is used to submit the form).
|
||||
* 2. This method will include the submit element's name/value data (for the element that was
|
||||
* used to submit the form).
|
||||
* 3. This method binds the submit() method to the form for you.
|
||||
*
|
||||
* The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely
|
||||
* passes the options argument along after properly binding events for submit elements and
|
||||
* the form itself.
|
||||
*/
|
||||
$.fn.ajaxForm = function(options) {
|
||||
// in jQuery 1.3+ we can fix mistakes with the ready state
|
||||
if (this.length === 0) {
|
||||
var o = { s: this.selector, c: this.context };
|
||||
if (!$.isReady && o.s) {
|
||||
log('DOM not ready, queuing ajaxForm');
|
||||
$(function() {
|
||||
$(o.s,o.c).ajaxForm(options);
|
||||
});
|
||||
return this;
|
||||
}
|
||||
// is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
|
||||
log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
|
||||
return this;
|
||||
}
|
||||
|
||||
return this.ajaxFormUnbind().bind('submit.form-plugin', function(e) {
|
||||
if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed
|
||||
e.preventDefault();
|
||||
$(this).ajaxSubmit(options);
|
||||
}
|
||||
}).bind('click.form-plugin', function(e) {
|
||||
var target = e.target;
|
||||
var $el = $(target);
|
||||
if (!($el.is(":submit,input:image"))) {
|
||||
// is this a child element of the submit el? (ex: a span within a button)
|
||||
var t = $el.closest(':submit');
|
||||
if (t.length == 0) {
|
||||
return;
|
||||
}
|
||||
target = t[0];
|
||||
}
|
||||
var form = this;
|
||||
form.clk = target;
|
||||
if (target.type == 'image') {
|
||||
if (e.offsetX != undefined) {
|
||||
form.clk_x = e.offsetX;
|
||||
form.clk_y = e.offsetY;
|
||||
} else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
|
||||
var offset = $el.offset();
|
||||
form.clk_x = e.pageX - offset.left;
|
||||
form.clk_y = e.pageY - offset.top;
|
||||
} else {
|
||||
form.clk_x = e.pageX - target.offsetLeft;
|
||||
form.clk_y = e.pageY - target.offsetTop;
|
||||
}
|
||||
}
|
||||
// clear form vars
|
||||
setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100);
|
||||
});
|
||||
};
|
||||
|
||||
// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
|
||||
$.fn.ajaxFormUnbind = function() {
|
||||
return this.unbind('submit.form-plugin click.form-plugin');
|
||||
};
|
||||
|
||||
/**
|
||||
* formToArray() gathers form element data into an array of objects that can
|
||||
* be passed to any of the following ajax functions: $.get, $.post, or load.
|
||||
* Each object in the array has both a 'name' and 'value' property. An example of
|
||||
* an array for a simple login form might be:
|
||||
*
|
||||
* [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
|
||||
*
|
||||
* It is this array that is passed to pre-submit callback functions provided to the
|
||||
* ajaxSubmit() and ajaxForm() methods.
|
||||
*/
|
||||
$.fn.formToArray = function(semantic) {
|
||||
var a = [];
|
||||
if (this.length === 0) {
|
||||
return a;
|
||||
}
|
||||
|
||||
var form = this[0];
|
||||
var els = semantic ? form.getElementsByTagName('*') : form.elements;
|
||||
if (!els) {
|
||||
return a;
|
||||
}
|
||||
|
||||
var i,j,n,v,el,max,jmax;
|
||||
for(i=0, max=els.length; i < max; i++) {
|
||||
el = els[i];
|
||||
n = el.name;
|
||||
if (!n) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (semantic && form.clk && el.type == "image") {
|
||||
// handle image inputs on the fly when semantic == true
|
||||
if(!el.disabled && form.clk == el) {
|
||||
a.push({name: n, value: $(el).val()});
|
||||
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
v = $.fieldValue(el, true);
|
||||
if (v && v.constructor == Array) {
|
||||
for(j=0, jmax=v.length; j < jmax; j++) {
|
||||
a.push({name: n, value: v[j]});
|
||||
}
|
||||
}
|
||||
else if (v !== null && typeof v != 'undefined') {
|
||||
a.push({name: n, value: v});
|
||||
}
|
||||
}
|
||||
|
||||
if (!semantic && form.clk) {
|
||||
// input type=='image' are not found in elements array! handle it here
|
||||
var $input = $(form.clk), input = $input[0];
|
||||
n = input.name;
|
||||
if (n && !input.disabled && input.type == 'image') {
|
||||
a.push({name: n, value: $input.val()});
|
||||
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
|
||||
}
|
||||
}
|
||||
return a;
|
||||
};
|
||||
|
||||
/**
|
||||
* Serializes form data into a 'submittable' string. This method will return a string
|
||||
* in the format: name1=value1&name2=value2
|
||||
*/
|
||||
$.fn.formSerialize = function(semantic) {
|
||||
//hand off to jQuery.param for proper encoding
|
||||
return $.param(this.formToArray(semantic));
|
||||
};
|
||||
|
||||
/**
|
||||
* Serializes all field elements in the jQuery object into a query string.
|
||||
* This method will return a string in the format: name1=value1&name2=value2
|
||||
*/
|
||||
$.fn.fieldSerialize = function(successful) {
|
||||
var a = [];
|
||||
this.each(function() {
|
||||
var n = this.name;
|
||||
if (!n) {
|
||||
return;
|
||||
}
|
||||
var v = $.fieldValue(this, successful);
|
||||
if (v && v.constructor == Array) {
|
||||
for (var i=0,max=v.length; i < max; i++) {
|
||||
a.push({name: n, value: v[i]});
|
||||
}
|
||||
}
|
||||
else if (v !== null && typeof v != 'undefined') {
|
||||
a.push({name: this.name, value: v});
|
||||
}
|
||||
});
|
||||
//hand off to jQuery.param for proper encoding
|
||||
return $.param(a);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the value(s) of the element in the matched set. For example, consider the following form:
|
||||
*
|
||||
* <form><fieldset>
|
||||
* <input name="A" type="text" />
|
||||
* <input name="A" type="text" />
|
||||
* <input name="B" type="checkbox" value="B1" />
|
||||
* <input name="B" type="checkbox" value="B2"/>
|
||||
* <input name="C" type="radio" value="C1" />
|
||||
* <input name="C" type="radio" value="C2" />
|
||||
* </fieldset></form>
|
||||
*
|
||||
* var v = $(':text').fieldValue();
|
||||
* // if no values are entered into the text inputs
|
||||
* v == ['','']
|
||||
* // if values entered into the text inputs are 'foo' and 'bar'
|
||||
* v == ['foo','bar']
|
||||
*
|
||||
* var v = $(':checkbox').fieldValue();
|
||||
* // if neither checkbox is checked
|
||||
* v === undefined
|
||||
* // if both checkboxes are checked
|
||||
* v == ['B1', 'B2']
|
||||
*
|
||||
* var v = $(':radio').fieldValue();
|
||||
* // if neither radio is checked
|
||||
* v === undefined
|
||||
* // if first radio is checked
|
||||
* v == ['C1']
|
||||
*
|
||||
* The successful argument controls whether or not the field element must be 'successful'
|
||||
* (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
|
||||
* The default value of the successful argument is true. If this value is false the value(s)
|
||||
* for each element is returned.
|
||||
*
|
||||
* Note: This method *always* returns an array. If no valid value can be determined the
|
||||
* array will be empty, otherwise it will contain one or more values.
|
||||
*/
|
||||
$.fn.fieldValue = function(successful) {
|
||||
for (var val=[], i=0, max=this.length; i < max; i++) {
|
||||
var el = this[i];
|
||||
var v = $.fieldValue(el, successful);
|
||||
if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) {
|
||||
continue;
|
||||
}
|
||||
v.constructor == Array ? $.merge(val, v) : val.push(v);
|
||||
}
|
||||
return val;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the value of the field element.
|
||||
*/
|
||||
$.fieldValue = function(el, successful) {
|
||||
var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
|
||||
if (successful === undefined) {
|
||||
successful = true;
|
||||
}
|
||||
|
||||
if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
|
||||
(t == 'checkbox' || t == 'radio') && !el.checked ||
|
||||
(t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
|
||||
tag == 'select' && el.selectedIndex == -1)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (tag == 'select') {
|
||||
var index = el.selectedIndex;
|
||||
if (index < 0) {
|
||||
return null;
|
||||
}
|
||||
var a = [], ops = el.options;
|
||||
var one = (t == 'select-one');
|
||||
var max = (one ? index+1 : ops.length);
|
||||
for(var i=(one ? index : 0); i < max; i++) {
|
||||
var op = ops[i];
|
||||
if (op.selected) {
|
||||
var v = op.value;
|
||||
if (!v) { // extra pain for IE...
|
||||
v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
|
||||
}
|
||||
if (one) {
|
||||
return v;
|
||||
}
|
||||
a.push(v);
|
||||
}
|
||||
}
|
||||
return a;
|
||||
}
|
||||
return $(el).val();
|
||||
};
|
||||
|
||||
/**
|
||||
* Clears the form data. Takes the following actions on the form's input fields:
|
||||
* - input text fields will have their 'value' property set to the empty string
|
||||
* - select elements will have their 'selectedIndex' property set to -1
|
||||
* - checkbox and radio inputs will have their 'checked' property set to false
|
||||
* - inputs of type submit, button, reset, and hidden will *not* be effected
|
||||
* - button elements will *not* be effected
|
||||
*/
|
||||
$.fn.clearForm = function() {
|
||||
return this.each(function() {
|
||||
$('input,select,textarea', this).clearFields();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Clears the selected form elements.
|
||||
*/
|
||||
$.fn.clearFields = $.fn.clearInputs = function() {
|
||||
return this.each(function() {
|
||||
var t = this.type, tag = this.tagName.toLowerCase();
|
||||
if (t == 'text' || t == 'password' || tag == 'textarea') {
|
||||
this.value = '';
|
||||
}
|
||||
else if (t == 'checkbox' || t == 'radio') {
|
||||
this.checked = false;
|
||||
}
|
||||
else if (tag == 'select') {
|
||||
this.selectedIndex = -1;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Resets the form data. Causes all form elements to be reset to their original value.
|
||||
*/
|
||||
$.fn.resetForm = function() {
|
||||
return this.each(function() {
|
||||
// guard against an input with the name of 'reset'
|
||||
// note that IE reports the reset function as an 'object'
|
||||
if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) {
|
||||
this.reset();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Enables or disables any matching elements.
|
||||
*/
|
||||
$.fn.enable = function(b) {
|
||||
if (b === undefined) {
|
||||
b = true;
|
||||
}
|
||||
return this.each(function() {
|
||||
this.disabled = !b;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks/unchecks any matching checkboxes or radio buttons and
|
||||
* selects/deselects and matching option elements.
|
||||
*/
|
||||
$.fn.selected = function(select) {
|
||||
if (select === undefined) {
|
||||
select = true;
|
||||
}
|
||||
return this.each(function() {
|
||||
var t = this.type;
|
||||
if (t == 'checkbox' || t == 'radio') {
|
||||
this.checked = select;
|
||||
}
|
||||
else if (this.tagName.toLowerCase() == 'option') {
|
||||
var $sel = $(this).parent('select');
|
||||
if (select && $sel[0] && $sel[0].type == 'select-one') {
|
||||
// deselect all other options
|
||||
$sel.find('option').selected(false);
|
||||
}
|
||||
this.selected = select;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// helper fn for console logging
|
||||
// set $.fn.ajaxSubmit.debug to true to enable debug logging
|
||||
function log() {
|
||||
if ($.fn.ajaxSubmit.debug) {
|
||||
var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
|
||||
if (window.console && window.console.log) {
|
||||
window.console.log(msg);
|
||||
}
|
||||
else if (window.opera && window.opera.postError) {
|
||||
window.opera.postError(msg);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
|
||||
(function($){$.fn.editable=function(target,options){if('disable'==target){$(this).data('disabled.editable',true);return;}
|
||||
if('enable'==target){$(this).data('disabled.editable',false);return;}
|
||||
if('destroy'==target){$(this).unbind($(this).data('event.editable')).removeData('disabled.editable').removeData('event.editable');return;}
|
||||
var settings=$.extend({},$.fn.editable.defaults,{target:target},options);var plugin=$.editable.types[settings.type].plugin||function(){};var submit=$.editable.types[settings.type].submit||function(){};var buttons=$.editable.types[settings.type].buttons||$.editable.types['defaults'].buttons;var content=$.editable.types[settings.type].content||$.editable.types['defaults'].content;var element=$.editable.types[settings.type].element||$.editable.types['defaults'].element;var reset=$.editable.types[settings.type].reset||$.editable.types['defaults'].reset;var callback=settings.callback||function(){};var onedit=settings.onedit||function(){};var onsubmit=settings.onsubmit||function(){};var onreset=settings.onreset||function(){};var onerror=settings.onerror||reset;if(settings.tooltip){$(this).attr('title',settings.tooltip);}
|
||||
settings.autowidth='auto'==settings.width;settings.autoheight='auto'==settings.height;return this.each(function(){var self=this;var savedwidth=$(self).width();var savedheight=$(self).height();$(this).data('event.editable',settings.event);if(!$.trim($(this).html())){$(this).html(settings.placeholder);}
|
||||
$(this).bind(settings.event,function(e){if(true===$(this).data('disabled.editable')){return;}
|
||||
if(self.editing){return;}
|
||||
if(false===onedit.apply(this,[settings,self])){return;}
|
||||
e.preventDefault();e.stopPropagation();if(settings.tooltip){$(self).removeAttr('title');}
|
||||
if(0==$(self).width()){settings.width=savedwidth;settings.height=savedheight;}else{if(settings.width!='none'){settings.width=settings.autowidth?$(self).width():settings.width;}
|
||||
if(settings.height!='none'){settings.height=settings.autoheight?$(self).height():settings.height;}}
|
||||
if($(this).html().toLowerCase().replace(/(;|")/g,'')==settings.placeholder.toLowerCase().replace(/(;|")/g,'')){$(this).html('');}
|
||||
self.editing=true;self.revert=$(self).html();$(self).html('');var form=$('<form />');if(settings.cssclass){if('inherit'==settings.cssclass){form.attr('class',$(self).attr('class'));}else{form.attr('class',settings.cssclass);}}
|
||||
if(settings.style){if('inherit'==settings.style){form.attr('style',$(self).attr('style'));form.css('display',$(self).css('display'));}else{form.attr('style',settings.style);}}
|
||||
var input=element.apply(form,[settings,self]);var input_content;if(settings.loadurl){var t=setTimeout(function(){input.disabled=true;content.apply(form,[settings.loadtext,settings,self]);},100);var loaddata={};loaddata[settings.id]=self.id;if($.isFunction(settings.loaddata)){$.extend(loaddata,settings.loaddata.apply(self,[self.revert,settings]));}else{$.extend(loaddata,settings.loaddata);}
|
||||
$.ajax({type:settings.loadtype,url:settings.loadurl,data:loaddata,async:false,success:function(result){window.clearTimeout(t);input_content=result;input.disabled=false;}});}else if(settings.data){input_content=settings.data;if($.isFunction(settings.data)){input_content=settings.data.apply(self,[self.revert,settings]);}}else{input_content=self.revert;}
|
||||
content.apply(form,[input_content,settings,self]);input.attr('name',settings.name);buttons.apply(form,[settings,self]);$(self).append(form);plugin.apply(form,[settings,self]);$(':input:visible:enabled:first',form).focus();if(settings.select){input.select();}
|
||||
input.keydown(function(e){if(e.keyCode==27){e.preventDefault();reset.apply(form,[settings,self]);}});var t;if('cancel'==settings.onblur){input.blur(function(e){t=setTimeout(function(){reset.apply(form,[settings,self]);},500);});}else if('submit'==settings.onblur){input.blur(function(e){t=setTimeout(function(){form.submit();},200);});}else if($.isFunction(settings.onblur)){input.blur(function(e){settings.onblur.apply(self,[input.val(),settings]);});}else{input.blur(function(e){});}
|
||||
form.submit(function(e){if(t){clearTimeout(t);}
|
||||
e.preventDefault();if(false!==onsubmit.apply(form,[settings,self])){if(false!==submit.apply(form,[settings,self])){if($.isFunction(settings.target)){var str=settings.target.apply(self,[input.val(),settings]);$(self).html(str);self.editing=false;callback.apply(self,[self.innerHTML,settings]);if(!$.trim($(self).html())){$(self).html(settings.placeholder);}}else{var submitdata={};submitdata[settings.name]=input.val();submitdata[settings.id]=self.id;if($.isFunction(settings.submitdata)){$.extend(submitdata,settings.submitdata.apply(self,[self.revert,settings]));}else{$.extend(submitdata,settings.submitdata);}
|
||||
if('PUT'==settings.method){submitdata['_method']='put';}
|
||||
$(self).html(settings.indicator);var ajaxoptions={type:'POST',data:submitdata,dataType:'html',url:settings.target,success:function(result,status){if(ajaxoptions.dataType=='html'){$(self).html(result);}
|
||||
self.editing=false;callback.apply(self,[result,settings]);if(!$.trim($(self).html())){$(self).html(settings.placeholder);}},error:function(xhr,status,error){onerror.apply(form,[settings,self,xhr]);}};$.extend(ajaxoptions,settings.ajaxoptions);$.ajax(ajaxoptions);}}}
|
||||
$(self).attr('title',settings.tooltip);return false;});});this.reset=function(form){if(this.editing){if(false!==onreset.apply(form,[settings,self])){$(self).html(self.revert);self.editing=false;if(!$.trim($(self).html())){$(self).html(settings.placeholder);}
|
||||
if(settings.tooltip){$(self).attr('title',settings.tooltip);}}}};});};$.editable={types:{defaults:{element:function(settings,original){var input=$('<input type="hidden"></input>');$(this).append(input);return(input);},content:function(string,settings,original){$(':input:first',this).val(string);},reset:function(settings,original){original.reset(this);},buttons:function(settings,original){var form=this;if(settings.submit){if(settings.submit.match(/>$/)){var submit=$(settings.submit).click(function(){if(submit.attr("type")!="submit"){form.submit();}});}else{var submit=$('<button type="submit" />');submit.html(settings.submit);}
|
||||
$(this).append(submit);}
|
||||
if(settings.cancel){if(settings.cancel.match(/>$/)){var cancel=$(settings.cancel);}else{var cancel=$('<button type="cancel" />');cancel.html(settings.cancel);}
|
||||
$(this).append(cancel);$(cancel).click(function(event){if($.isFunction($.editable.types[settings.type].reset)){var reset=$.editable.types[settings.type].reset;}else{var reset=$.editable.types['defaults'].reset;}
|
||||
reset.apply(form,[settings,original]);return false;});}}},text:{element:function(settings,original){var input=$('<input />');if(settings.width!='none'){input.width(settings.width);}
|
||||
if(settings.height!='none'){input.height(settings.height);}
|
||||
input.attr('autocomplete','off');$(this).append(input);return(input);}},textarea:{element:function(settings,original){var textarea=$('<textarea />');if(settings.rows){textarea.attr('rows',settings.rows);}else if(settings.height!="none"){textarea.height(settings.height);}
|
||||
if(settings.cols){textarea.attr('cols',settings.cols);}else if(settings.width!="none"){textarea.width(settings.width);}
|
||||
$(this).append(textarea);return(textarea);}},select:{element:function(settings,original){var select=$('<select />');$(this).append(select);return(select);},content:function(data,settings,original){if(String==data.constructor){eval('var json = '+data);}else{var json=data;}
|
||||
for(var key in json){if(!json.hasOwnProperty(key)){continue;}
|
||||
if('selected'==key){continue;}
|
||||
var option=$('<option />').val(key).append(json[key]);$('select',this).append(option);}
|
||||
$('select',this).children().each(function(){if($(this).val()==json['selected']||$(this).text()==$.trim(original.revert)){$(this).attr('selected','selected');}});}}},addInputType:function(name,input){$.editable.types[name]=input;}};$.fn.editable.defaults={name:'value',id:'id',type:'text',width:'auto',height:'auto',event:'click.editable',onblur:'cancel',loadtype:'GET',loadtext:'Loading...',placeholder:'Click to edit',loaddata:{},submitdata:{},ajaxoptions:{}};})(jQuery);
|
||||
|
|
@ -1,163 +0,0 @@
|
|||
(function($) {
|
||||
/*
|
||||
* Simulate drag of a JQuery UI sortable list
|
||||
* Repository: https://github.com/mattheworiordan/jquery.simulate.drag-sortable.js
|
||||
* Author: http://mattheworiordan.com
|
||||
*
|
||||
* options are:
|
||||
* - move: move item up (positive) or down (negative) by Integer amount
|
||||
* - handle: selector for the draggable handle element (optional)
|
||||
* - listItem: selector to limit which sibling items can be used for reordering
|
||||
* - placeHolder: if a placeholder is used during dragging, we need to consider it's height
|
||||
*
|
||||
*/
|
||||
$.fn.simulateDragSortable = function(options) {
|
||||
// build main options before element iteration
|
||||
var opts = $.extend({}, $.fn.simulateDragSortable.defaults, options);
|
||||
|
||||
// iterate and move each matched element
|
||||
return this.each(function() {
|
||||
// allow for a drag handle if item is not draggable
|
||||
var that = this,
|
||||
handle = opts.handle ? $(this).find(opts.handle)[0] : $(this)[0],
|
||||
listItem = opts.listItem,
|
||||
placeHolder = opts.placeHolder,
|
||||
sibling = $(this),
|
||||
moveCounter = Math.floor(opts.move),
|
||||
direction = moveCounter > 0 ? 'down' : 'up',
|
||||
moveVerticalAmount = 0,
|
||||
dragPastBy = 0;
|
||||
|
||||
if (moveCounter === 0) { return; }
|
||||
|
||||
while (moveCounter !== 0) {
|
||||
if (direction === 'down') {
|
||||
if (sibling.next(listItem).length) {
|
||||
sibling = sibling.next(listItem);
|
||||
moveVerticalAmount += sibling.outerHeight();
|
||||
}
|
||||
moveCounter -= 1;
|
||||
} else {
|
||||
if (sibling.prev(listItem).length) {
|
||||
sibling = sibling.prev(listItem);
|
||||
moveVerticalAmount -= sibling.outerHeight();
|
||||
}
|
||||
moveCounter += 1;
|
||||
}
|
||||
}
|
||||
|
||||
var center = findCenter(handle);
|
||||
var x = Math.floor(center.x), y = Math.floor(center.y);
|
||||
dispatchEvent(handle, 'mousedown', createEvent('mousedown', handle, { clientX: x, clientY: y }));
|
||||
// simulate drag start
|
||||
dispatchEvent(document, 'mousemove', createEvent('mousemove', document, { clientX: x+1, clientY: y+1 }));
|
||||
|
||||
// Sortable is using a fixed height placeholder meaning items jump up and down as you drag variable height items into fixed height placeholder
|
||||
placeHolder = placeHolder && $(this).parent().find(placeHolder);
|
||||
if (placeHolder && placeHolder.length) {
|
||||
// we're going to move past it, and back again
|
||||
moveVerticalAmount += (direction === 'down' ? -1 : 1) * Math.min($(this).outerHeight() / 2, 5);
|
||||
// Sortable UI bug when dragging down and place holder exists. You need to drag past by the total height of this
|
||||
// and then drag back to the right point
|
||||
dragPastBy = (direction === 'down' ? 1 : -1) * $(this).outerHeight() / 2;
|
||||
} else {
|
||||
// no place holder
|
||||
if (direction === 'down') {
|
||||
// need to move at least as far as this item and or the last sibling
|
||||
if ($(this).outerHeight() > $(sibling).outerHeight()) {
|
||||
moveVerticalAmount += $(this).outerHeight() - $(sibling).outerHeight();
|
||||
}
|
||||
moveVerticalAmount += $(sibling).outerHeight() / 2;
|
||||
} else {
|
||||
// move a little extra to ensure item clips into next position
|
||||
moveVerticalAmount -= Math.min($(this).outerHeight() / 2, 5);
|
||||
}
|
||||
}
|
||||
|
||||
if (sibling[0] !== $(this)[0]) {
|
||||
// step through so that the UI controller can determine when to show the placeHolder
|
||||
var targetOffset = moveVerticalAmount + dragPastBy;
|
||||
for (var offset = 0; Math.abs(offset) < Math.abs(targetOffset); offset += (direction === 'down' ? 10 : -10)) {
|
||||
// drag move
|
||||
dispatchEvent(document, 'mousemove', createEvent('mousemove', document, { clientX: x, clientY: y + offset }));
|
||||
}
|
||||
dispatchEvent(document, 'mousemove', createEvent('mousemove', document, { clientX: x, clientY: y + targetOffset }));
|
||||
} else {
|
||||
if (window.console) {
|
||||
console.log('Could not move as at top or bottom already');
|
||||
}
|
||||
}
|
||||
|
||||
setTimeout(function() {
|
||||
dispatchEvent(document, 'mousemove', createEvent('mousemove', document, { clientX: x, clientY: y + moveVerticalAmount }));
|
||||
}, 5);
|
||||
setTimeout(function() {
|
||||
dispatchEvent(handle, 'mouseup', createEvent('mouseup', handle, { clientX: x, clientY: y + moveVerticalAmount }));
|
||||
}, 10);
|
||||
});
|
||||
};
|
||||
|
||||
function createEvent(type, target, options) {
|
||||
var evt;
|
||||
var e = $.extend({
|
||||
target: target,
|
||||
preventDefault: function() { },
|
||||
stopImmediatePropagation: function() { },
|
||||
stopPropagation: function() { },
|
||||
isPropagationStopped: function() { return true; },
|
||||
isImmediatePropagationStopped: function() { return true; },
|
||||
isDefaultPrevented: function() { return true; },
|
||||
bubbles: true,
|
||||
cancelable: (type != "mousemove"),
|
||||
view: window,
|
||||
detail: 0,
|
||||
screenX: 0,
|
||||
screenY: 0,
|
||||
clientX: 0,
|
||||
clientY: 0,
|
||||
ctrlKey: false,
|
||||
altKey: false,
|
||||
shiftKey: false,
|
||||
metaKey: false,
|
||||
button: 0,
|
||||
relatedTarget: undefined
|
||||
}, options || {});
|
||||
|
||||
if ($.isFunction(document.createEvent)) {
|
||||
evt = document.createEvent("MouseEvents");
|
||||
evt.initMouseEvent(type, e.bubbles, e.cancelable, e.view, e.detail,
|
||||
e.screenX, e.screenY, e.clientX, e.clientY,
|
||||
e.ctrlKey, e.altKey, e.shiftKey, e.metaKey,
|
||||
e.button, e.relatedTarget || document.body.parentNode);
|
||||
} else if (document.createEventObject) {
|
||||
evt = document.createEventObject();
|
||||
$.extend(evt, e);
|
||||
evt.button = { 0:1, 1:4, 2:2 }[evt.button] || evt.button;
|
||||
}
|
||||
return evt;
|
||||
}
|
||||
|
||||
function dispatchEvent(el, type, evt) {
|
||||
if (el.dispatchEvent) {
|
||||
el.dispatchEvent(evt);
|
||||
} else if (el.fireEvent) {
|
||||
el.fireEvent('on' + type, evt);
|
||||
}
|
||||
return evt;
|
||||
}
|
||||
|
||||
function findCenter(el) {
|
||||
var el = $(el), o = el.offset();
|
||||
return {
|
||||
x: o.left + el.outerWidth() / 2,
|
||||
y: o.top + el.outerHeight() / 2
|
||||
};
|
||||
}
|
||||
|
||||
//
|
||||
// plugin defaults
|
||||
//
|
||||
$.fn.simulateDragSortable.defaults = {
|
||||
move: 0
|
||||
};
|
||||
})(jQuery);
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
// HTML Truncator for jQuery
|
||||
// by Henrik Nyh <http://henrik.nyh.se> 2008-02-28.
|
||||
// modified by Eric Allen <http://hackerengineer.net> 2010-04-02
|
||||
// Free to modify and redistribute with credit.
|
||||
|
||||
(function($) {
|
||||
|
||||
var trailing_whitespace = true;
|
||||
|
||||
$.fn.truncate = function(options) {
|
||||
|
||||
var opts = $.extend({}, $.fn.truncate.defaults, options);
|
||||
|
||||
$(this).each(function() {
|
||||
|
||||
var content_length = $.trim(squeeze($(this).text())).length;
|
||||
if (content_length <= opts.max_length)
|
||||
return; // bail early if not overlong
|
||||
|
||||
var actual_max_length = opts.max_length - opts.more.length - 3; // 3 for " ()"
|
||||
var truncated_node = recursivelyTruncate(this, actual_max_length);
|
||||
var full_node = $(this).hide();
|
||||
|
||||
truncated_node.insertAfter(full_node);
|
||||
|
||||
findNodeForMore(truncated_node).append('...');
|
||||
});
|
||||
}
|
||||
|
||||
// Note that the " (…more)" bit counts towards the max length – so a max
|
||||
// length of 10 would truncate "1234567890" to "12 (…more)".
|
||||
$.fn.truncate.defaults = {
|
||||
max_length: 100,
|
||||
more: '…more',
|
||||
less: 'less'
|
||||
};
|
||||
|
||||
function recursivelyTruncate(node, max_length) {
|
||||
return (node.nodeType == 3) ? truncateText(node, max_length) : truncateNode(node, max_length);
|
||||
}
|
||||
|
||||
function truncateNode(node, max_length) {
|
||||
var node = $(node);
|
||||
var new_node = node.clone().empty();
|
||||
var truncatedChild;
|
||||
node.contents().each(function() {
|
||||
var remaining_length = max_length - new_node.text().length;
|
||||
if (remaining_length == 0) return; // breaks the loop
|
||||
truncatedChild = recursivelyTruncate(this, remaining_length);
|
||||
if (truncatedChild) new_node.append(truncatedChild);
|
||||
});
|
||||
return new_node;
|
||||
}
|
||||
|
||||
function truncateText(node, max_length) {
|
||||
var text = squeeze(node.data);
|
||||
if (trailing_whitespace) // remove initial whitespace if last text
|
||||
text = text.replace(/^ /, ''); // node had trailing whitespace.
|
||||
trailing_whitespace = !!text.match(/ $/);
|
||||
var text = text.slice(0, max_length);
|
||||
// Ensure HTML entities are encoded
|
||||
// http://debuggable.com/posts/encode-html-entities-with-jquery:480f4dd6-13cc-4ce9-8071-4710cbdd56cb
|
||||
text = $('<div/>').text(text).html();
|
||||
return text;
|
||||
}
|
||||
|
||||
// Collapses a sequence of whitespace into a single space.
|
||||
function squeeze(string) {
|
||||
return string.replace(/\s+/g, ' ');
|
||||
}
|
||||
|
||||
// Finds the last, innermost block-level element
|
||||
function findNodeForMore(node) {
|
||||
var $node = $(node);
|
||||
var last_child = $node.children(":last");
|
||||
if (!last_child) return node;
|
||||
var display = last_child.css('display');
|
||||
if (!display || display=='inline') return $node;
|
||||
return findNodeForMore(last_child);
|
||||
};
|
||||
})(jQuery);
|
||||
|
|
@ -1,286 +0,0 @@
|
|||
/* Nifty Corners Cube - rounded corners with CSS and Javascript
|
||||
Copyright 2006 Alessandro Fulciniti (a.fulciniti@html.it)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
var niftyOk=(document.getElementById && document.createElement && Array.prototype.push);
|
||||
|
||||
function strFind(str, what){
|
||||
return(str.indexOf(what)>=0 ? true : false);
|
||||
}
|
||||
|
||||
var oldonload=window.onload;
|
||||
if(typeof(NiftyLoad)!='function') NiftyLoad=function(){};
|
||||
if(typeof(oldonload)=='function')
|
||||
window.onload=function(){oldonload();NiftyLoad()};
|
||||
else window.onload=function(){NiftyLoad()};
|
||||
|
||||
function Nifty(selector,options){
|
||||
if(niftyOk==false) return;
|
||||
var i,v=selector.split(","),h=0;
|
||||
if(options==undefined) options="";
|
||||
if(strFind(options,"fixed-height"))
|
||||
h=getElementsBySelector(v[0])[0].offsetHeight;
|
||||
for(i=0;i<v.length;i++)
|
||||
Rounded(v[i],options);
|
||||
if(strFind(options,"height")) SameHeight(selector,h);
|
||||
}
|
||||
|
||||
function Rounded(selector,options){
|
||||
var i,top="",bottom="",v=new Array();
|
||||
if(options!=""){
|
||||
options=options.replace("left","tl bl");
|
||||
options=options.replace("right","tr br");
|
||||
options=options.replace("top","tr tl");
|
||||
options=options.replace("bottom","br bl");
|
||||
options=options.replace("transparent","alias");
|
||||
if(strFind(options,"tl")){
|
||||
top="both";
|
||||
if(!strFind(options,"tr")) top="left";
|
||||
}
|
||||
else if(strFind(options,"tr")) top="right";
|
||||
if(strFind(options,"bl")){
|
||||
bottom="both";
|
||||
if(!strFind(options,"br")) bottom="left";
|
||||
}
|
||||
else if(strFind(options,"br")) bottom="right";
|
||||
}
|
||||
if(top=="" && bottom=="" && !strFind(options,"none")){top="both";bottom="both";}
|
||||
v=getElementsBySelector(selector);
|
||||
for(i=0;i<v.length;i++){
|
||||
FixIE(v[i]);
|
||||
if(top!="") AddTop(v[i],top,options);
|
||||
if(bottom!="") AddBottom(v[i],bottom,options);
|
||||
}
|
||||
}
|
||||
|
||||
function AddTop(el,side,options){
|
||||
var d=CreateEl("b"),lim=4,border="",p,i,btype="r",bk,color;
|
||||
d.style.marginLeft="-"+getPadding(el,"Left")+"px";
|
||||
d.style.marginRight="-"+getPadding(el,"Right")+"px";
|
||||
if(strFind(options,"alias") || (color=getBk(el))=="transparent"){
|
||||
color="transparent";bk="transparent"; border=getParentBk(el);btype="t";
|
||||
}
|
||||
else{
|
||||
bk=getParentBk(el); border=Mix(color,bk);
|
||||
}
|
||||
d.style.background=bk;
|
||||
d.className="niftycorners";
|
||||
p=getPadding(el,"Top");
|
||||
if(strFind(options,"small")){
|
||||
d.style.marginBottom=(p-2)+"px";
|
||||
btype+="s"; lim=2;
|
||||
}
|
||||
else if(strFind(options,"big")){
|
||||
d.style.marginBottom=(p-10)+"px";
|
||||
btype+="b"; lim=8;
|
||||
}
|
||||
else d.style.marginBottom=(p-5)+"px";
|
||||
for(i=1;i<=lim;i++)
|
||||
d.appendChild(CreateStrip(i,side,color,border,btype));
|
||||
el.style.paddingTop="0";
|
||||
el.insertBefore(d,el.firstChild);
|
||||
}
|
||||
|
||||
function AddBottom(el,side,options){
|
||||
var d=CreateEl("b"),lim=4,border="",p,i,btype="r",bk,color;
|
||||
d.style.marginLeft="-"+getPadding(el,"Left")+"px";
|
||||
d.style.marginRight="-"+getPadding(el,"Right")+"px";
|
||||
if(strFind(options,"alias") || (color=getBk(el))=="transparent"){
|
||||
color="transparent";bk="transparent"; border=getParentBk(el);btype="t";
|
||||
}
|
||||
else{
|
||||
bk=getParentBk(el); border=Mix(color,bk);
|
||||
}
|
||||
d.style.background=bk;
|
||||
d.className="niftycorners";
|
||||
p=getPadding(el,"Bottom");
|
||||
if(strFind(options,"small")){
|
||||
d.style.marginTop=(p-2)+"px";
|
||||
btype+="s"; lim=2;
|
||||
}
|
||||
else if(strFind(options,"big")){
|
||||
d.style.marginTop=(p-10)+"px";
|
||||
btype+="b"; lim=8;
|
||||
}
|
||||
else d.style.marginTop=(p-5)+"px";
|
||||
for(i=lim;i>0;i--)
|
||||
d.appendChild(CreateStrip(i,side,color,border,btype));
|
||||
el.style.paddingBottom=0;
|
||||
el.appendChild(d);
|
||||
}
|
||||
|
||||
function CreateStrip(index,side,color,border,btype){
|
||||
var x=CreateEl("b");
|
||||
x.className=btype+index;
|
||||
x.style.backgroundColor=color;
|
||||
x.style.borderColor=border;
|
||||
if(side=="left"){
|
||||
x.style.borderRightWidth="0";
|
||||
x.style.marginRight="0";
|
||||
}
|
||||
else if(side=="right"){
|
||||
x.style.borderLeftWidth="0";
|
||||
x.style.marginLeft="0";
|
||||
}
|
||||
return(x);
|
||||
}
|
||||
|
||||
function CreateEl(x){
|
||||
return(document.createElement(x));
|
||||
}
|
||||
|
||||
function FixIE(el){
|
||||
if(el.currentStyle!=null && el.currentStyle.hasLayout!=null && el.currentStyle.hasLayout==false)
|
||||
el.style.display="inline-block";
|
||||
}
|
||||
|
||||
function SameHeight(selector,maxh){
|
||||
var i,v=selector.split(","),t,j,els=[],gap;
|
||||
for(i=0;i<v.length;i++){
|
||||
t=getElementsBySelector(v[i]);
|
||||
els=els.concat(t);
|
||||
}
|
||||
for(i=0;i<els.length;i++){
|
||||
if(els[i].offsetHeight>maxh) maxh=els[i].offsetHeight;
|
||||
els[i].style.height="auto";
|
||||
}
|
||||
for(i=0;i<els.length;i++){
|
||||
gap=maxh-els[i].offsetHeight;
|
||||
if(gap>0){
|
||||
t=CreateEl("b");t.className="niftyfill";t.style.height=gap+"px";
|
||||
nc=els[i].lastChild;
|
||||
if(nc.className=="niftycorners")
|
||||
els[i].insertBefore(t,nc);
|
||||
else els[i].appendChild(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getElementsBySelector(selector){
|
||||
var i,j,selid="",selclass="",tag=selector,tag2="",v2,k,f,a,s=[],objlist=[],c;
|
||||
if(strFind(selector,"#")){ //id selector like "tag#id"
|
||||
if(strFind(selector," ")){ //descendant selector like "tag#id tag"
|
||||
s=selector.split(" ");
|
||||
var fs=s[0].split("#");
|
||||
if(fs.length==1) return(objlist);
|
||||
f=document.getElementById(fs[1]);
|
||||
if(f){
|
||||
v=f.getElementsByTagName(s[1]);
|
||||
for(i=0;i<v.length;i++) objlist.push(v[i]);
|
||||
}
|
||||
return(objlist);
|
||||
}
|
||||
else{
|
||||
s=selector.split("#");
|
||||
tag=s[0];
|
||||
selid=s[1];
|
||||
if(selid!=""){
|
||||
f=document.getElementById(selid);
|
||||
if(f) objlist.push(f);
|
||||
return(objlist);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(strFind(selector,".")){ //class selector like "tag.class"
|
||||
s=selector.split(".");
|
||||
tag=s[0];
|
||||
selclass=s[1];
|
||||
if(strFind(selclass, " ")){ //descendant selector like tag1.classname tag2
|
||||
s=selclass.split(" ");
|
||||
selclass=s[0];
|
||||
tag2=s[1];
|
||||
}
|
||||
}
|
||||
var v=document.getElementsByTagName(tag); // tag selector like "tag"
|
||||
if(selclass==""){
|
||||
for(i=0;i<v.length;i++) objlist.push(v[i]);
|
||||
return(objlist);
|
||||
}
|
||||
for(i=0;i<v.length;i++){
|
||||
c=v[i].className.split(" ");
|
||||
for(j=0;j<c.length;j++){
|
||||
if(c[j]==selclass){
|
||||
if(tag2=="") objlist.push(v[i]);
|
||||
else{
|
||||
v2=v[i].getElementsByTagName(tag2);
|
||||
for(k=0;k<v2.length;k++) objlist.push(v2[k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return(objlist);
|
||||
}
|
||||
|
||||
function getParentBk(x){
|
||||
var el=x.parentNode,c;
|
||||
while(el.tagName.toUpperCase()!="HTML" && (c=getBk(el))=="transparent")
|
||||
el=el.parentNode;
|
||||
if(c=="transparent") c="#FFFFFF";
|
||||
return(c);
|
||||
}
|
||||
|
||||
function getBk(x){
|
||||
var c=getStyleProp(x,"backgroundColor");
|
||||
if(c==null || c=="transparent" || strFind(c,"rgba(0, 0, 0, 0)"))
|
||||
return("transparent");
|
||||
if(strFind(c,"rgb")) c=rgb2hex(c);
|
||||
return(c);
|
||||
}
|
||||
|
||||
function getPadding(x,side){
|
||||
var p=getStyleProp(x,"padding"+side);
|
||||
if(p==null || !strFind(p, "px")) return(0);
|
||||
return(parseInt(p));
|
||||
}
|
||||
|
||||
function getStyleProp(x,prop){
|
||||
if(x.currentStyle)
|
||||
return(x.currentStyle[prop]);
|
||||
if(document.defaultView.getComputedStyle)
|
||||
return(document.defaultView.getComputedStyle(x,'')[prop]);
|
||||
return(null);
|
||||
}
|
||||
|
||||
function rgb2hex(value){
|
||||
var hex="",v,h,i;
|
||||
var regexp=/([0-9]+)[, ]+([0-9]+)[, ]+([0-9]+)/;
|
||||
var h=regexp.exec(value);
|
||||
for(i=1;i<4;i++){
|
||||
v=parseInt(h[i]).toString(16);
|
||||
if(v.length==1) hex+="0"+v;
|
||||
else hex+=v;
|
||||
}
|
||||
return("#"+hex);
|
||||
}
|
||||
|
||||
function Mix(c1,c2){
|
||||
var i,step1,step2,x,y,r=new Array(3);
|
||||
if(c1.length==4)step1=1;
|
||||
else step1=2;
|
||||
if(c2.length==4) step2=1;
|
||||
else step2=2;
|
||||
for(i=0;i<3;i++){
|
||||
x=parseInt(c1.substr(1+step1*i,step1),16);
|
||||
if(step1==1) x=16*x+x;
|
||||
y=parseInt(c2.substr(1+step2*i,step2),16);
|
||||
if(step2==1) y=16*y+y;
|
||||
r[i]=Math.floor((x*50+y*50)/100);
|
||||
r[i]=r[i].toString(16);
|
||||
if(r[i].length==1) r[i]="0"+r[i];
|
||||
}
|
||||
return("#"+r[0]+r[1]+r[2]);
|
||||
}
|
||||
|
|
@ -1,283 +0,0 @@
|
|||
// Copyright (c) 2005 Marty Haught, Thomas Fuchs
|
||||
//
|
||||
// See http://script.aculo.us for more info
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
if(!Control) var Control = {};
|
||||
Control.Slider = Class.create();
|
||||
|
||||
// options:
|
||||
// axis: 'vertical', or 'horizontal' (default)
|
||||
//
|
||||
// callbacks:
|
||||
// onChange(value)
|
||||
// onSlide(value)
|
||||
Control.Slider.prototype = {
|
||||
initialize: function(handle, track, options) {
|
||||
var slider = this;
|
||||
|
||||
if(handle instanceof Array) {
|
||||
this.handles = handle.collect( function(e) { return $(e) });
|
||||
} else {
|
||||
this.handles = [$(handle)];
|
||||
}
|
||||
|
||||
this.track = $(track);
|
||||
this.options = options || {};
|
||||
|
||||
this.axis = this.options.axis || 'horizontal';
|
||||
this.increment = this.options.increment || 1;
|
||||
this.step = parseInt(this.options.step || '1');
|
||||
this.range = this.options.range || $R(0,1);
|
||||
|
||||
this.value = 0; // assure backwards compat
|
||||
this.values = this.handles.map( function() { return 0 });
|
||||
this.spans = this.options.spans ? this.options.spans.map(function(s){ return $(s) }) : false;
|
||||
this.options.startSpan = $(this.options.startSpan || null);
|
||||
this.options.endSpan = $(this.options.endSpan || null);
|
||||
|
||||
this.restricted = this.options.restricted || false;
|
||||
|
||||
this.maximum = this.options.maximum || this.range.end;
|
||||
this.minimum = this.options.minimum || this.range.start;
|
||||
|
||||
// Will be used to align the handle onto the track, if necessary
|
||||
this.alignX = parseInt(this.options.alignX || '0');
|
||||
this.alignY = parseInt(this.options.alignY || '0');
|
||||
|
||||
this.trackLength = this.maximumOffset() - this.minimumOffset();
|
||||
this.handleLength = this.isVertical() ? this.handles[0].offsetHeight : this.handles[0].offsetWidth;
|
||||
|
||||
this.active = false;
|
||||
this.dragging = false;
|
||||
this.disabled = false;
|
||||
|
||||
if(this.options.disabled) this.setDisabled();
|
||||
|
||||
// Allowed values array
|
||||
this.allowedValues = this.options.values ? this.options.values.sortBy(Prototype.K) : false;
|
||||
if(this.allowedValues) {
|
||||
this.minimum = this.allowedValues.min();
|
||||
this.maximum = this.allowedValues.max();
|
||||
}
|
||||
|
||||
this.eventMouseDown = this.startDrag.bindAsEventListener(this);
|
||||
this.eventMouseUp = this.endDrag.bindAsEventListener(this);
|
||||
this.eventMouseMove = this.update.bindAsEventListener(this);
|
||||
|
||||
// Initialize handles in reverse (make sure first handle is active)
|
||||
this.handles.each( function(h,i) {
|
||||
i = slider.handles.length-1-i;
|
||||
slider.setValue(parseFloat(
|
||||
(slider.options.sliderValue instanceof Array ?
|
||||
slider.options.sliderValue[i] : slider.options.sliderValue) ||
|
||||
slider.range.start), i);
|
||||
Element.makePositioned(h); // fix IE
|
||||
Event.observe(h, "mousedown", slider.eventMouseDown);
|
||||
});
|
||||
|
||||
Event.observe(this.track, "mousedown", this.eventMouseDown);
|
||||
Event.observe(document, "mouseup", this.eventMouseUp);
|
||||
Event.observe(document, "mousemove", this.eventMouseMove);
|
||||
|
||||
this.initialized = true;
|
||||
},
|
||||
dispose: function() {
|
||||
var slider = this;
|
||||
Event.stopObserving(this.track, "mousedown", this.eventMouseDown);
|
||||
Event.stopObserving(document, "mouseup", this.eventMouseUp);
|
||||
Event.stopObserving(document, "mousemove", this.eventMouseMove);
|
||||
this.handles.each( function(h) {
|
||||
Event.stopObserving(h, "mousedown", slider.eventMouseDown);
|
||||
});
|
||||
},
|
||||
setDisabled: function(){
|
||||
this.disabled = true;
|
||||
},
|
||||
setEnabled: function(){
|
||||
this.disabled = false;
|
||||
},
|
||||
getNearestValue: function(value){
|
||||
if(this.allowedValues){
|
||||
if(value >= this.allowedValues.max()) return(this.allowedValues.max());
|
||||
if(value <= this.allowedValues.min()) return(this.allowedValues.min());
|
||||
|
||||
var offset = Math.abs(this.allowedValues[0] - value);
|
||||
var newValue = this.allowedValues[0];
|
||||
this.allowedValues.each( function(v) {
|
||||
var currentOffset = Math.abs(v - value);
|
||||
if(currentOffset <= offset){
|
||||
newValue = v;
|
||||
offset = currentOffset;
|
||||
}
|
||||
});
|
||||
return newValue;
|
||||
}
|
||||
if(value > this.range.end) return this.range.end;
|
||||
if(value < this.range.start) return this.range.start;
|
||||
return value;
|
||||
},
|
||||
setValue: function(sliderValue, handleIdx){
|
||||
if(!this.active) {
|
||||
this.activeHandle = this.handles[handleIdx];
|
||||
this.activeHandleIdx = handleIdx;
|
||||
this.updateStyles();
|
||||
}
|
||||
handleIdx = handleIdx || this.activeHandleIdx || 0;
|
||||
if(this.initialized && this.restricted) {
|
||||
if((handleIdx>0) && (sliderValue<this.values[handleIdx-1]))
|
||||
sliderValue = this.values[handleIdx-1];
|
||||
if((handleIdx < (this.handles.length-1)) && (sliderValue>this.values[handleIdx+1]))
|
||||
sliderValue = this.values[handleIdx+1];
|
||||
}
|
||||
sliderValue = this.getNearestValue(sliderValue);
|
||||
this.values[handleIdx] = sliderValue;
|
||||
this.value = this.values[0]; // assure backwards compat
|
||||
|
||||
this.handles[handleIdx].style[this.isVertical() ? 'top' : 'left'] =
|
||||
this.translateToPx(sliderValue);
|
||||
|
||||
this.drawSpans();
|
||||
if(!this.dragging || !this.event) this.updateFinished();
|
||||
},
|
||||
setValueBy: function(delta, handleIdx) {
|
||||
this.setValue(this.values[handleIdx || this.activeHandleIdx || 0] + delta,
|
||||
handleIdx || this.activeHandleIdx || 0);
|
||||
},
|
||||
translateToPx: function(value) {
|
||||
return Math.round(
|
||||
((this.trackLength-this.handleLength)/(this.range.end-this.range.start)) *
|
||||
(value - this.range.start)) + "px";
|
||||
},
|
||||
translateToValue: function(offset) {
|
||||
return ((offset/(this.trackLength-this.handleLength) *
|
||||
(this.range.end-this.range.start)) + this.range.start);
|
||||
},
|
||||
getRange: function(range) {
|
||||
var v = this.values.sortBy(Prototype.K);
|
||||
range = range || 0;
|
||||
return $R(v[range],v[range+1]);
|
||||
},
|
||||
minimumOffset: function(){
|
||||
return(this.isVertical() ? this.alignY : this.alignX);
|
||||
},
|
||||
maximumOffset: function(){
|
||||
return(this.isVertical() ?
|
||||
this.track.offsetHeight - this.alignY : this.track.offsetWidth - this.alignX);
|
||||
},
|
||||
isVertical: function(){
|
||||
return (this.axis == 'vertical');
|
||||
},
|
||||
drawSpans: function() {
|
||||
var slider = this;
|
||||
if(this.spans)
|
||||
$R(0, this.spans.length-1).each(function(r) { slider.setSpan(slider.spans[r], slider.getRange(r)) });
|
||||
if(this.options.startSpan)
|
||||
this.setSpan(this.options.startSpan,
|
||||
$R(0, this.values.length>1 ? this.getRange(0).min() : this.value ));
|
||||
if(this.options.endSpan)
|
||||
this.setSpan(this.options.endSpan,
|
||||
$R(this.values.length>1 ? this.getRange(this.spans.length-1).max() : this.value, this.maximum));
|
||||
},
|
||||
setSpan: function(span, range) {
|
||||
if(this.isVertical()) {
|
||||
span.style.top = this.translateToPx(range.start);
|
||||
span.style.height = this.translateToPx(range.end - range.start + this.range.start);
|
||||
} else {
|
||||
span.style.left = this.translateToPx(range.start);
|
||||
span.style.width = this.translateToPx(range.end - range.start + this.range.start);
|
||||
}
|
||||
},
|
||||
updateStyles: function() {
|
||||
this.handles.each( function(h){ Element.removeClassName(h, 'selected') });
|
||||
Element.addClassName(this.activeHandle, 'selected');
|
||||
},
|
||||
startDrag: function(event) {
|
||||
if(Event.isLeftClick(event)) {
|
||||
if(!this.disabled){
|
||||
this.active = true;
|
||||
|
||||
var handle = Event.element(event);
|
||||
var pointer = [Event.pointerX(event), Event.pointerY(event)];
|
||||
if(handle==this.track) {
|
||||
var offsets = Position.cumulativeOffset(this.track);
|
||||
this.event = event;
|
||||
this.setValue(this.translateToValue(
|
||||
(this.isVertical() ? pointer[1]-offsets[1] : pointer[0]-offsets[0])-(this.handleLength/2)
|
||||
));
|
||||
var offsets = Position.cumulativeOffset(this.activeHandle);
|
||||
this.offsetX = (pointer[0] - offsets[0]);
|
||||
this.offsetY = (pointer[1] - offsets[1]);
|
||||
} else {
|
||||
// find the handle (prevents issues with Safari)
|
||||
while((this.handles.indexOf(handle) == -1) && handle.parentNode)
|
||||
handle = handle.parentNode;
|
||||
|
||||
this.activeHandle = handle;
|
||||
this.activeHandleIdx = this.handles.indexOf(this.activeHandle);
|
||||
this.updateStyles();
|
||||
|
||||
var offsets = Position.cumulativeOffset(this.activeHandle);
|
||||
this.offsetX = (pointer[0] - offsets[0]);
|
||||
this.offsetY = (pointer[1] - offsets[1]);
|
||||
}
|
||||
}
|
||||
Event.stop(event);
|
||||
}
|
||||
},
|
||||
update: function(event) {
|
||||
if(this.active) {
|
||||
if(!this.dragging) this.dragging = true;
|
||||
this.draw(event);
|
||||
// fix AppleWebKit rendering
|
||||
if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);
|
||||
Event.stop(event);
|
||||
}
|
||||
},
|
||||
draw: function(event) {
|
||||
var pointer = [Event.pointerX(event), Event.pointerY(event)];
|
||||
var offsets = Position.cumulativeOffset(this.track);
|
||||
pointer[0] -= this.offsetX + offsets[0];
|
||||
pointer[1] -= this.offsetY + offsets[1];
|
||||
this.event = event;
|
||||
this.setValue(this.translateToValue( this.isVertical() ? pointer[1] : pointer[0] ));
|
||||
if(this.initialized && this.options.onSlide)
|
||||
this.options.onSlide(this.values.length>1 ? this.values : this.value, this);
|
||||
},
|
||||
endDrag: function(event) {
|
||||
if(this.active && this.dragging) {
|
||||
this.finishDrag(event, true);
|
||||
Event.stop(event);
|
||||
}
|
||||
this.active = false;
|
||||
this.dragging = false;
|
||||
},
|
||||
finishDrag: function(event, success) {
|
||||
this.active = false;
|
||||
this.dragging = false;
|
||||
this.updateFinished();
|
||||
},
|
||||
updateFinished: function() {
|
||||
if(this.initialized && this.options.onChange)
|
||||
this.options.onChange(this.values.length>1 ? this.values : this.value, this);
|
||||
this.event = null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,121 +0,0 @@
|
|||
|
||||
/*
|
||||
* Superfish v1.4.8 - jQuery menu widget
|
||||
* Copyright (c) 2008 Joel Birch
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt
|
||||
*/
|
||||
|
||||
;(function($){
|
||||
$.fn.superfish = function(op){
|
||||
|
||||
var sf = $.fn.superfish,
|
||||
c = sf.c,
|
||||
$arrow = $(['<span class="',c.arrowClass,'"> »</span>'].join('')),
|
||||
over = function(){
|
||||
var $$ = $(this), menu = getMenu($$);
|
||||
clearTimeout(menu.sfTimer);
|
||||
$$.showSuperfishUl().siblings().hideSuperfishUl();
|
||||
},
|
||||
out = function(){
|
||||
var $$ = $(this), menu = getMenu($$), o = sf.op;
|
||||
clearTimeout(menu.sfTimer);
|
||||
menu.sfTimer=setTimeout(function(){
|
||||
o.retainPath=($.inArray($$[0],o.$path)>-1);
|
||||
$$.hideSuperfishUl();
|
||||
if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);}
|
||||
},o.delay);
|
||||
},
|
||||
getMenu = function($menu){
|
||||
var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0];
|
||||
sf.op = sf.o[menu.serial];
|
||||
return menu;
|
||||
},
|
||||
addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); };
|
||||
|
||||
return this.each(function() {
|
||||
var s = this.serial = sf.o.length;
|
||||
var o = $.extend({},sf.defaults,op);
|
||||
o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){
|
||||
$(this).addClass([o.hoverClass,c.bcClass].join(' '))
|
||||
.filter('li:has(ul)').removeClass(o.pathClass);
|
||||
});
|
||||
sf.o[s] = sf.op = o;
|
||||
|
||||
$('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() {
|
||||
if (o.autoArrows) addArrow( $('>a:first-child',this) );
|
||||
})
|
||||
.not('.'+c.bcClass)
|
||||
.hideSuperfishUl();
|
||||
|
||||
var $a = $('a',this);
|
||||
$a.each(function(i){
|
||||
var $li = $a.eq(i).parents('li');
|
||||
$a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);});
|
||||
});
|
||||
o.onInit.call(this);
|
||||
|
||||
}).each(function() {
|
||||
var menuClasses = [c.menuClass];
|
||||
if (sf.op.dropShadows && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass);
|
||||
$(this).addClass(menuClasses.join(' '));
|
||||
});
|
||||
};
|
||||
|
||||
var sf = $.fn.superfish;
|
||||
sf.o = [];
|
||||
sf.op = {};
|
||||
sf.IE7fix = function(){
|
||||
var o = sf.op;
|
||||
if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity!=undefined)
|
||||
this.toggleClass(sf.c.shadowClass+'-off');
|
||||
};
|
||||
sf.c = {
|
||||
bcClass : 'sf-breadcrumb',
|
||||
menuClass : 'sf-js-enabled',
|
||||
anchorClass : 'sf-with-ul',
|
||||
arrowClass : 'sf-sub-indicator',
|
||||
shadowClass : 'sf-shadow'
|
||||
};
|
||||
sf.defaults = {
|
||||
hoverClass : 'sfHover',
|
||||
pathClass : 'overideThisToUse',
|
||||
pathLevels : 1,
|
||||
delay : 800,
|
||||
animation : {opacity:'show'},
|
||||
speed : 'normal',
|
||||
autoArrows : true,
|
||||
dropShadows : true,
|
||||
disableHI : false, // true disables hoverIntent detection
|
||||
onInit : function(){}, // callback functions
|
||||
onBeforeShow: function(){},
|
||||
onShow : function(){},
|
||||
onHide : function(){}
|
||||
};
|
||||
$.fn.extend({
|
||||
hideSuperfishUl : function(){
|
||||
var o = sf.op,
|
||||
not = (o.retainPath===true) ? o.$path : '';
|
||||
o.retainPath = false;
|
||||
var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass)
|
||||
.find('>ul').hide().css('visibility','hidden');
|
||||
o.onHide.call($ul);
|
||||
return this;
|
||||
},
|
||||
showSuperfishUl : function(){
|
||||
var o = sf.op,
|
||||
sh = sf.c.shadowClass+'-off',
|
||||
$ul = this.addClass(o.hoverClass)
|
||||
.find('>ul:hidden').css('visibility','visible');
|
||||
sf.IE7fix.call($ul);
|
||||
o.onBeforeShow.call($ul);
|
||||
$ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul); o.onShow.call($ul); });
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
|
@ -1,90 +0,0 @@
|
|||
|
||||
/*
|
||||
* Supersubs v0.2b - jQuery plugin
|
||||
* Copyright (c) 2008 Joel Birch
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
*
|
||||
* This plugin automatically adjusts submenu widths of suckerfish-style menus to that of
|
||||
* their longest list item children. If you use this, please expect bugs and report them
|
||||
* to the jQuery Google Group with the word 'Superfish' in the subject line.
|
||||
*
|
||||
*/
|
||||
|
||||
;(function($){ // $ will refer to jQuery within this closure
|
||||
|
||||
$.fn.supersubs = function(options){
|
||||
var opts = $.extend({}, $.fn.supersubs.defaults, options);
|
||||
// return original object to support chaining
|
||||
return this.each(function() {
|
||||
// cache selections
|
||||
var $$ = $(this);
|
||||
// support metadata
|
||||
var o = $.meta ? $.extend({}, opts, $$.data()) : opts;
|
||||
// get the font size of menu.
|
||||
// .css('fontSize') returns various results cross-browser, so measure an em dash instead
|
||||
var fontsize = $('<li id="menu-fontsize">—</li>').css({
|
||||
'padding' : 0,
|
||||
'position' : 'absolute',
|
||||
'top' : '-999em',
|
||||
'width' : 'auto'
|
||||
}).appendTo($$).width(); //clientWidth is faster, but was incorrect here
|
||||
// remove em dash
|
||||
$('#menu-fontsize').remove();
|
||||
// cache all ul elements
|
||||
$ULs = $$.find('ul');
|
||||
// loop through each ul in menu
|
||||
$ULs.each(function(i) {
|
||||
// cache this ul
|
||||
var $ul = $ULs.eq(i);
|
||||
// get all (li) children of this ul
|
||||
var $LIs = $ul.children();
|
||||
// get all anchor grand-children
|
||||
var $As = $LIs.children('a');
|
||||
// force content to one line and save current float property
|
||||
var liFloat = $LIs.css('white-space','nowrap').css('float');
|
||||
// remove width restrictions and floats so elements remain vertically stacked
|
||||
var emWidth = $ul.add($LIs).add($As).css({
|
||||
'float' : 'none',
|
||||
'width' : 'auto'
|
||||
})
|
||||
// this ul will now be shrink-wrapped to longest li due to position:absolute
|
||||
// so save its width as ems. Clientwidth is 2 times faster than .width() - thanks Dan Switzer
|
||||
.end().end()[0].clientWidth / fontsize;
|
||||
// add more width to ensure lines don't turn over at certain sizes in various browsers
|
||||
emWidth += o.extraWidth;
|
||||
// restrict to at least minWidth and at most maxWidth
|
||||
if (emWidth > o.maxWidth) { emWidth = o.maxWidth; }
|
||||
else if (emWidth < o.minWidth) { emWidth = o.minWidth; }
|
||||
emWidth += 'em';
|
||||
// set ul to width in ems
|
||||
$ul.css('width',emWidth);
|
||||
// restore li floats to avoid IE bugs
|
||||
// set li width to full width of this ul
|
||||
// revert white-space to normal
|
||||
$LIs.css({
|
||||
'float' : liFloat,
|
||||
'width' : '100%',
|
||||
'white-space' : 'normal'
|
||||
})
|
||||
// update offset position of descendant ul to reflect new width of parent
|
||||
.each(function(){
|
||||
var $childUl = $('>ul',this);
|
||||
var offsetDirection = $childUl.css('left')!==undefined ? 'left' : 'right';
|
||||
$childUl.css(offsetDirection,emWidth);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
};
|
||||
// expose defaults
|
||||
$.fn.supersubs.defaults = {
|
||||
minWidth : 9, // requires em unit.
|
||||
maxWidth : 25, // requires em unit.
|
||||
extraWidth : 0 // extra width can ensure lines don't sometimes turn over due to slight browser differences in how they round-off values
|
||||
};
|
||||
|
||||
})(jQuery); // plugin code ends
|
||||
|
Before Width: | Height: | Size: 199 B |
|
Before Width: | Height: | Size: 180 B |
|
Before Width: | Height: | Size: 180 B |
|
Before Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 108 B |
|
Before Width: | Height: | Size: 100 B |
|
Before Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 4.3 KiB |