js update: jquery 1.7.2 / simplemodal 1.4.2

This commit is contained in:
Thomas NOËL 2012-07-06 14:29:16 +02:00
parent 06573d4808
commit d7330ae1dc
4 changed files with 28 additions and 389 deletions

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,26 @@
/*
* SimpleModal 1.4.2 - jQuery Plugin
* http://simplemodal.com/
* Copyright (c) 2011 Eric Martin
* Licensed under MIT and GPL
* Date: Sat, Dec 17 2011 15:35:38 -0800
*/
(function(b){"function"===typeof define&&define.amd?define(["jquery"],b):b(jQuery)})(function(b){var j=[],k=b(document),l=b.browser.msie&&6===parseInt(b.browser.version)&&"object"!==typeof window.XMLHttpRequest,n=b.browser.msie&&7===parseInt(b.browser.version),m=null,h=b(window),i=[];b.modal=function(a,d){return b.modal.impl.init(a,d)};b.modal.close=function(){b.modal.impl.close()};b.modal.focus=function(a){b.modal.impl.focus(a)};b.modal.setContainerDimensions=function(){b.modal.impl.setContainerDimensions()};
b.modal.setPosition=function(){b.modal.impl.setPosition()};b.modal.update=function(a,d){b.modal.impl.update(a,d)};b.fn.modal=function(a){return b.modal.impl.init(this,a)};b.modal.defaults={appendTo:"body",focus:!0,opacity:50,overlayId:"simplemodal-overlay",overlayCss:{},containerId:"simplemodal-container",containerCss:{},dataId:"simplemodal-data",dataCss:{},minHeight:null,minWidth:null,maxHeight:null,maxWidth:null,autoResize:!1,autoPosition:!0,zIndex:1E3,close:!0,closeHTML:'<a class="modalCloseImg" title="Close"></a>',
closeClass:"simplemodal-close",escClose:!0,overlayClose:!1,fixed:!0,position:null,persist:!1,modal:!0,onOpen:null,onShow:null,onClose:null};b.modal.impl={d:{},init:function(a,d){if(this.d.data)return!1;m=b.browser.msie&&!b.boxModel;this.o=b.extend({},b.modal.defaults,d);this.zIndex=this.o.zIndex;this.occb=!1;if("object"===typeof a){if(a=a instanceof jQuery?a:b(a),this.d.placeholder=!1,0<a.parent().parent().size()&&(a.before(b("<span></span>").attr("id","simplemodal-placeholder").css({display:"none"})),
this.d.placeholder=!0,this.display=a.css("display"),!this.o.persist))this.d.orig=a.clone(!0)}else if("string"===typeof a||"number"===typeof a)a=b("<div></div>").html(a);else return alert("SimpleModal Error: Unsupported data type: "+typeof a),this;this.create(a);this.open();b.isFunction(this.o.onShow)&&this.o.onShow.apply(this,[this.d]);return this},create:function(a){this.getDimensions();if(this.o.modal&&l)this.d.iframe=b('<iframe src="javascript:false;"></iframe>').css(b.extend(this.o.iframeCss,
{display:"none",opacity:0,position:"fixed",height:i[0],width:i[1],zIndex:this.o.zIndex,top:0,left:0})).appendTo(this.o.appendTo);this.d.overlay=b("<div></div>").attr("id",this.o.overlayId).addClass("simplemodal-overlay").css(b.extend(this.o.overlayCss,{display:"none",opacity:this.o.opacity/100,height:this.o.modal?j[0]:0,width:this.o.modal?j[1]:0,position:"fixed",left:0,top:0,zIndex:this.o.zIndex+1})).appendTo(this.o.appendTo);this.d.container=b("<div></div>").attr("id",this.o.containerId).addClass("simplemodal-container").css(b.extend({position:this.o.fixed?
"fixed":"absolute"},this.o.containerCss,{display:"none",zIndex:this.o.zIndex+2})).append(this.o.close&&this.o.closeHTML?b(this.o.closeHTML).addClass(this.o.closeClass):"").appendTo(this.o.appendTo);this.d.wrap=b("<div></div>").attr("tabIndex",-1).addClass("simplemodal-wrap").css({height:"100%",outline:0,width:"100%"}).appendTo(this.d.container);this.d.data=a.attr("id",a.attr("id")||this.o.dataId).addClass("simplemodal-data").css(b.extend(this.o.dataCss,{display:"none"})).appendTo("body");this.setContainerDimensions();
this.d.data.appendTo(this.d.wrap);(l||m)&&this.fixIE()},bindEvents:function(){var a=this;b("."+a.o.closeClass).bind("click.simplemodal",function(b){b.preventDefault();a.close()});a.o.modal&&a.o.close&&a.o.overlayClose&&a.d.overlay.bind("click.simplemodal",function(b){b.preventDefault();a.close()});k.bind("keydown.simplemodal",function(b){a.o.modal&&9===b.keyCode?a.watchTab(b):a.o.close&&a.o.escClose&&27===b.keyCode&&(b.preventDefault(),a.close())});h.bind("resize.simplemodal orientationchange.simplemodal",
function(){a.getDimensions();a.o.autoResize?a.setContainerDimensions():a.o.autoPosition&&a.setPosition();l||m?a.fixIE():a.o.modal&&(a.d.iframe&&a.d.iframe.css({height:i[0],width:i[1]}),a.d.overlay.css({height:j[0],width:j[1]}))})},unbindEvents:function(){b("."+this.o.closeClass).unbind("click.simplemodal");k.unbind("keydown.simplemodal");h.unbind(".simplemodal");this.d.overlay.unbind("click.simplemodal")},fixIE:function(){var a=this.o.position;b.each([this.d.iframe||null,!this.o.modal?null:this.d.overlay,
"fixed"===this.d.container.css("position")?this.d.container:null],function(b,f){if(f){var g=f[0].style;g.position="absolute";if(2>b)g.removeExpression("height"),g.removeExpression("width"),g.setExpression("height",'document.body.scrollHeight > document.body.clientHeight ? document.body.scrollHeight : document.body.clientHeight + "px"'),g.setExpression("width",'document.body.scrollWidth > document.body.clientWidth ? document.body.scrollWidth : document.body.clientWidth + "px"');else{var c,e;a&&a.constructor===
Array?(c=a[0]?"number"===typeof a[0]?a[0].toString():a[0].replace(/px/,""):f.css("top").replace(/px/,""),c=-1===c.indexOf("%")?c+' + (t = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"':parseInt(c.replace(/%/,""))+' * ((document.documentElement.clientHeight || document.body.clientHeight) / 100) + (t = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"',a[1]&&(e="number"===typeof a[1]?
a[1].toString():a[1].replace(/px/,""),e=-1===e.indexOf("%")?e+' + (t = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft) + "px"':parseInt(e.replace(/%/,""))+' * ((document.documentElement.clientWidth || document.body.clientWidth) / 100) + (t = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft) + "px"')):(c='(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (t = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"',
e='(document.documentElement.clientWidth || document.body.clientWidth) / 2 - (this.offsetWidth / 2) + (t = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft) + "px"');g.removeExpression("top");g.removeExpression("left");g.setExpression("top",c);g.setExpression("left",e)}}})},focus:function(a){var d=this,a=a&&-1!==b.inArray(a,["first","last"])?a:"first",f=b(":input:enabled:visible:"+a,d.d.wrap);setTimeout(function(){0<f.length?f.focus():d.d.wrap.focus()},
10)},getDimensions:function(){var a=b.browser.opera&&"9.5"<b.browser.version&&"1.3">b.fn.jquery||b.browser.opera&&"9.5">b.browser.version&&"1.2.6"<b.fn.jquery?h[0].innerHeight:h.height();j=[k.height(),k.width()];i=[a,h.width()]},getVal:function(a,b){return a?"number"===typeof a?a:"auto"===a?0:0<a.indexOf("%")?parseInt(a.replace(/%/,""))/100*("h"===b?i[0]:i[1]):parseInt(a.replace(/px/,"")):null},update:function(a,b){if(!this.d.data)return!1;this.d.origHeight=this.getVal(a,"h");this.d.origWidth=this.getVal(b,
"w");this.d.data.hide();a&&this.d.container.css("height",a);b&&this.d.container.css("width",b);this.setContainerDimensions();this.d.data.show();this.o.focus&&this.focus();this.unbindEvents();this.bindEvents()},setContainerDimensions:function(){var a=l||n,d=this.d.origHeight?this.d.origHeight:b.browser.opera?this.d.container.height():this.getVal(a?this.d.container[0].currentStyle.height:this.d.container.css("height"),"h"),a=this.d.origWidth?this.d.origWidth:b.browser.opera?this.d.container.width():
this.getVal(a?this.d.container[0].currentStyle.width:this.d.container.css("width"),"w"),f=this.d.data.outerHeight(!0),g=this.d.data.outerWidth(!0);this.d.origHeight=this.d.origHeight||d;this.d.origWidth=this.d.origWidth||a;var c=this.o.maxHeight?this.getVal(this.o.maxHeight,"h"):null,e=this.o.maxWidth?this.getVal(this.o.maxWidth,"w"):null,c=c&&c<i[0]?c:i[0],e=e&&e<i[1]?e:i[1],h=this.o.minHeight?this.getVal(this.o.minHeight,"h"):"auto",d=d?this.o.autoResize&&d>c?c:d<h?h:d:f?f>c?c:this.o.minHeight&&
"auto"!==h&&f<h?h:f:h,c=this.o.minWidth?this.getVal(this.o.minWidth,"w"):"auto",a=a?this.o.autoResize&&a>e?e:a<c?c:a:g?g>e?e:this.o.minWidth&&"auto"!==c&&g<c?c:g:c;this.d.container.css({height:d,width:a});this.d.wrap.css({overflow:f>d||g>a?"auto":"visible"});this.o.autoPosition&&this.setPosition()},setPosition:function(){var a,b;a=i[0]/2-this.d.container.outerHeight(!0)/2;b=i[1]/2-this.d.container.outerWidth(!0)/2;var f="fixed"!==this.d.container.css("position")?h.scrollTop():0;this.o.position&&"[object Array]"===
Object.prototype.toString.call(this.o.position)?(a=f+(this.o.position[0]||a),b=this.o.position[1]||b):a=f+a;this.d.container.css({left:b,top:a})},watchTab:function(a){if(0<b(a.target).parents(".simplemodal-container").length){if(this.inputs=b(":input:enabled:visible:first, :input:enabled:visible:last",this.d.data[0]),!a.shiftKey&&a.target===this.inputs[this.inputs.length-1]||a.shiftKey&&a.target===this.inputs[0]||0===this.inputs.length)a.preventDefault(),this.focus(a.shiftKey?"last":"first")}else a.preventDefault(),
this.focus()},open:function(){this.d.iframe&&this.d.iframe.show();b.isFunction(this.o.onOpen)?this.o.onOpen.apply(this,[this.d]):(this.d.overlay.show(),this.d.container.show(),this.d.data.show());this.o.focus&&this.focus();this.bindEvents()},close:function(){if(!this.d.data)return!1;this.unbindEvents();if(b.isFunction(this.o.onClose)&&!this.occb)this.occb=!0,this.o.onClose.apply(this,[this.d]);else{if(this.d.placeholder){var a=b("#simplemodal-placeholder");this.o.persist?a.replaceWith(this.d.data.removeClass("simplemodal-data").css("display",
this.display)):(this.d.data.hide().remove(),a.replaceWith(this.d.orig))}else this.d.data.hide().remove();this.d.container.hide().remove();this.d.overlay.hide();this.d.iframe&&this.d.iframe.hide().remove();this.d.overlay.remove();this.d={}}}}});

View File

@ -1,368 +0,0 @@
/*
* SimpleModal @VERSION - jQuery Plugin
* http://www.ericmmartin.com/projects/simplemodal/
* http://plugins.jquery.com/project/SimpleModal
* http://code.google.com/p/simplemodal/
*
* Copyright (c) 2007 Eric Martin - http://ericmmartin.com
*
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* Revision: $Id: jquery.simplemodal.js 99 2008-02-04 16:31:09Z emartin24 $
*
*/
/**
* SimpleModal is a lightweight jQuery plugin that provides a simple
* interface to create a modal dialog.
*
* The goal of SimpleModal is to provide developers with a cross-browser
* overlay and container that will be populated with data provided to
* SimpleModal.
*
* There are two ways to call SimpleModal:
* 1) As a chained function on a jQuery object, like $('#myDiv').modal();.
* This call would place the DOM object, #myDiv, inside a modal dialog.
* Chaining requires a jQuery object. An optional options object can be
* passed as a parameter.
*
* @example $('<div>my data</div>').modal({options});
* @example $('#myDiv').modal({options});
* @example jQueryObject.modal({options});
*
* 2) As a stand-alone function, like $.modal(data). The data parameter
* is required and an optional options object can be passed as a second
* parameter. This method provides more flexibility in the types of data
* that are allowed. The data could be a DOM object, a jQuery object, HTML
* or a string.
*
* @example $.modal('<div>my data</div>', {options});
* @example $.modal('my data', {options});
* @example $.modal($('#myDiv'), {options});
* @example $.modal(jQueryObject, {options});
* @example $.modal(document.getElementById('myDiv'), {options});
*
* A SimpleModal call can contain multiple elements, but only one modal
* dialog can be created at a time. Which means that all of the matched
* elements will be displayed within the modal container.
*
* SimpleModal internally sets the CSS needed to display the modal dialog
* properly in all browsers, yet provides the developer with the flexibility
* to easily control the look and feel. The styling for SimpleModal can be
* done through external stylesheets, or through SimpleModal, using the
* overlayCss and/or containerCss options.
*
* SimpleModal has been tested in the following browsers:
* - IE 6, 7
* - Firefox 2
* - Opera 9
* - Safari 3
*
* @name SimpleModal
* @type jQuery
* @requires jQuery v1.1.2
* @cat Plugins/Windows and Overlays
* @author Eric Martin (http://ericmmartin.com)
* @version @VERSION
*/
(function ($) {
/*
* Stand-alone function to create a modal dialog.
*
* @param {string, object} data A string, jQuery object or DOM object
* @param {object} [options] An optional object containing options overrides
*/
$.modal = function (data, options) {
return $.modal.impl.init(data, options);
};
/*
* Stand-alone close function to close the modal dialog
*/
$.modal.close = function () {
// call close with the external parameter set to true
$.modal.impl.close(true);
};
/*
* Chained function to create a modal dialog.
*
* @param {object} [options] An optional object containing options overrides
*/
$.fn.modal = function (options) {
return $.modal.impl.init(this, options);
};
/*
* SimpleModal default options
*
* overlay: (Number:50) The overlay div opacity value, from 0 - 100
* overlayId: (String:'modalOverlay') The DOM element id for the overlay div
* overlayCss: (Object:{}) The CSS styling for the overlay div
* containerId: (String:'modalContainer') The DOM element id for the container div
* containerCss: (Object:{}) The CSS styling for the container div
* close: (Boolean:true) Show the default window close icon? Uses CSS class modalCloseImg
* closeTitle: (String:'Close') The title value of the default close link. Depends on close
* closeClass: (String:'modalClose') The CSS class used to bind to the close event
* persist: (Boolean:false) Persist the data across modal calls? Only used for existing
DOM elements. If true, the data will be maintained across modal calls, if false,
the data will be reverted to its original state.
* onOpen: (Function:null) The callback function used in place of SimpleModal's open
* onShow: (Function:null) The callback function used after the modal dialog has opened
* onClose: (Function:null) The callback function used in place of SimpleModal's close
*/
$.modal.defaults = {
overlay: 50,
overlayId: 'modalOverlay',
overlayCss: {},
containerId: 'modalContainer',
containerCss: {},
close: true,
closeTitle: 'Close',
closeClass: 'modalClose',
persist: false,
onOpen: null,
onShow: null,
onClose: null
};
/*
* Main modal object
*/
$.modal.impl = {
/*
* Modal dialog options
*/
opts: null,
/*
* Contains the modal dialog elements and is the object passed
* back to the callback (onOpen, onShow, onClose) functions
*/
dialog: {},
/*
* Initialize the modal dialog
*/
init: function (data, options) {
// don't allow multiple calls
if (this.dialog.data) {
return false;
}
// merge defaults and user options
this.opts = $.extend({}, $.modal.defaults, options);
// determine how to handle the data based on its type
if (typeof data == 'object') {
// convert DOM object to a jQuery object
data = data instanceof jQuery ? data : $(data);
// if the object came from the DOM, keep track of its parent
if (data.parent().parent().size() > 0) {
this.dialog.parentNode = data.parent();
// persist changes? if not, make a clone of the element
if (!this.opts.persist) {
this.dialog.original = data.clone(true);
}
}
}
else if (typeof data == 'string' || typeof data == 'number') {
// just insert the data as innerHTML
data = $('<div>').html(data);
}
else {
// unsupported data type!
if (console) {
console.log('SimpleModal Error: Unsupported data type: ' + typeof data);
}
return false;
}
this.dialog.data = data.addClass('modalData');
data = null;
// create the modal overlay, container and, if necessary, iframe
this.create();
// display the modal dialog
this.open();
// useful for adding events/manipulating data in the modal dialog
if ($.isFunction(this.opts.onShow)) {
this.opts.onShow.apply(this, [this.dialog]);
}
// don't break the chain =)
return this;
},
/*
* Create and add the modal overlay and container to the page
*/
create: function () {
// create the overlay
this.dialog.overlay = $('<div>')
.attr('id', this.opts.overlayId)
.addClass('modalOverlay')
.css($.extend(this.opts.overlayCss, {
opacity: this.opts.overlay / 100,
height: '100%',
width: '100%',
position: 'fixed',
left: 0,
top: 0,
zIndex: 3000
}))
.hide()
.appendTo('body');
// create the container
this.dialog.container = $('<div>')
.attr('id', this.opts.containerId)
.addClass('modalContainer')
.css($.extend(this.opts.containerCss, {
position: 'fixed',
zIndex: 3100
}))
.append(this.opts.close
? '<a class="modalCloseImg '
+ this.opts.closeClass
+ '" title="'
+ this.opts.closeTitle + '"></a>'
: '')
.hide()
.appendTo('body');
// fix issues with IE and create an iframe
if ($.browser.msie && ($.browser.version < 7)) {
this.fixIE();
}
// hide the data and add it to the container
this.dialog.container.append(this.dialog.data.hide());
},
/*
* Bind events
*/
bindEvents: function () {
var modal = this;
// bind the close event to any element with the closeClass class
$('.' + this.opts.closeClass).click(function (e) {
e.preventDefault();
modal.close();
});
},
/*
* Unbind events
*/
unbindEvents: function () {
// remove the close event
$('.' + this.opts.closeClass).unbind('click');
},
/*
* Fix issues in IE 6
*/
fixIE: function () {
var wHeight = $(document.body).height() + 'px';
var wWidth = $(document.body).width() + 'px';
// position hacks
this.dialog.overlay.css({position: 'absolute', height: wHeight, width: wWidth});
this.dialog.container.css({position: 'absolute'});
// add an iframe to prevent select options from bleeding through
this.dialog.iframe = $('<iframe src="javascript:false;">')
.css($.extend(this.opts.iframeCss, {
opacity: 0,
position: 'absolute',
height: wHeight,
width: wWidth,
zIndex: 1000,
width: '100%',
top: 0,
left: 0
}))
.hide()
.appendTo('body');
},
/*
* Open the modal dialog elements
* - Note: If you use the onOpen callback, you must "show" the
* overlay and container elements manually
* (the iframe will be handled by SimpleModal)
*/
open: function () {
// display the iframe
if (this.dialog.iframe) {
this.dialog.iframe.show();
}
if ($.isFunction(this.opts.onOpen)) {
// execute the onOpen callback
this.opts.onOpen.apply(this, [this.dialog]);
}
else {
// display the remaining elements
this.dialog.overlay.show();
this.dialog.container.show();
this.dialog.data.show();
}
// bind default events
this.bindEvents();
},
/*
* Close the modal dialog
* - Note: If you use an onClose callback, you must remove the
* overlay, container and iframe elements manually
*
* @param {boolean} external Indicates whether the call to this
* function was internal or external. If it was external, the
* onClose callback will be ignored
*/
close: function (external) {
// prevent close when dialog does not exist
if (!this.dialog.data) {
return false;
}
if ($.isFunction(this.opts.onClose) && !external) {
// execute the onClose callback
this.opts.onClose.apply(this, [this.dialog]);
}
else {
// if the data came from the DOM, put it back
if (this.dialog.parentNode) {
// save changes to the data?
if (this.opts.persist) {
// insert the (possibly) modified data back into the DOM
this.dialog.data.hide().appendTo(this.dialog.parentNode);
}
else {
// remove the current and insert the original,
// unmodified data back into the DOM
this.dialog.data.remove();
this.dialog.original.appendTo(this.dialog.parentNode);
}
}
else {
// otherwise, remove it
this.dialog.data.remove();
}
// remove the remaining elements
this.dialog.container.remove();
this.dialog.overlay.remove();
if (this.dialog.iframe) {
this.dialog.iframe.remove();
}
// reset the dialog object
this.dialog = {};
}
// remove the default events
this.unbindEvents();
}
};
})(jQuery);

View File

@ -7,8 +7,8 @@
<link rel="alternate stylesheet" title="org" type="text/css" href="{{ MEDIA_URL }}css/style.css"/>
<link rel="alternate stylesheet" title="encrier" type="text/css" href="{{ MEDIA_URL }}style.css" />
<title>{% block title %}Accès Internet{% endblock %}</title>
<script type="text/javascript" src="{{ MEDIA_URL }}js/jquery.js"></script>
<script type="text/javascript" src="{{ MEDIA_URL }}js/jquery.simplemodal.js"></script>
<script type="text/javascript" src="{{ MEDIA_URL }}js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="{{ MEDIA_URL }}js/jquery.simplemodal.1.4.2.min.js"></script>
{% block extra_head %}
{% endblock %}
{% block extra_scripts %}