Subversion Repositories Applications.framework

Compare Revisions

Ignore whitespace Rev 468 → Rev 469

/branches/v0.3-aleaume/doc/PhpDoc/js/jquery.iviewer.js
New file
0,0 → 1,1169
/*
* iviewer Widget for jQuery UI
* https://github.com/can3p/iviewer
*
* Copyright (c) 2009 - 2012 Dmitry Petrov
* Dual licensed under the MIT and GPL licenses.
* - http://www.opensource.org/licenses/mit-license.php
* - http://www.gnu.org/copyleft/gpl.html
*
* Author: Dmitry Petrov
* Version: 0.7.7
*/
 
( function( $, undefined ) {
 
//this code was taken from the https://github.com/furf/jquery-ui-touch-punch
var mouseEvents = {
touchstart: 'mousedown',
touchmove: 'mousemove',
touchend: 'mouseup'
},
gesturesSupport = 'ongesturestart' in document.createElement('div');
 
 
/**
* Convert a touch event to a mouse-like
*/
function makeMouseEvent (event) {
var touch = event.originalEvent.changedTouches[0];
 
return $.extend(event, {
type: mouseEvents[event.type],
which: 1,
pageX: touch.pageX,
pageY: touch.pageY,
screenX: touch.screenX,
screenY: touch.screenY,
clientX: touch.clientX,
clientY: touch.clientY,
isTouchEvent: true
});
}
 
var mouseProto = $.ui.mouse.prototype,
_mouseInit = $.ui.mouse.prototype._mouseInit;
 
mouseProto._mouseInit = function() {
var self = this;
self._touchActive = false;
 
this.element.bind( 'touchstart.' + this.widgetName, function(event) {
if (gesturesSupport && event.originalEvent.touches.length > 1) { return; }
self._touchActive = true;
return self._mouseDown(makeMouseEvent(event));
})
 
var self = this;
// these delegates are required to keep context
this._mouseMoveDelegate = function(event) {
if (gesturesSupport && event.originalEvent.touches && event.originalEvent.touches.length > 1) { return; }
if (self._touchActive) {
return self._mouseMove(makeMouseEvent(event));
}
};
this._mouseUpDelegate = function(event) {
if (self._touchActive) {
self._touchActive = false;
return self._mouseUp(makeMouseEvent(event));
}
};
 
$(document)
.bind('touchmove.'+ this.widgetName, this._mouseMoveDelegate)
.bind('touchend.' + this.widgetName, this._mouseUpDelegate);
 
_mouseInit.apply(this);
}
 
/**
* Simple implementation of jQuery like getters/setters
* var val = something();
* something(val);
*/
var setter = function(setter, getter) {
return function(val) {
if (arguments.length === 0) {
return getter.apply(this);
} else {
setter.apply(this, arguments);
}
}
};
 
/**
* Internet explorer rotates image relative left top corner, so we should
* shift image when it's rotated.
*/
var ieTransforms = {
'0': {
marginLeft: 0,
marginTop: 0,
filter: 'progid:DXImageTransform.Microsoft.Matrix(M11=1, M12=0, M21=0, M22=1, SizingMethod="auto expand")'
},
 
'90': {
marginLeft: -1,
marginTop: 1,
filter: 'progid:DXImageTransform.Microsoft.Matrix(M11=0, M12=-1, M21=1, M22=0, SizingMethod="auto expand")'
},
 
'180': {
marginLeft: 0,
marginTop: 0,
filter: 'progid:DXImageTransform.Microsoft.Matrix(M11=-1, M12=0, M21=0, M22=-1, SizingMethod="auto expand")'
},
 
'270': {
marginLeft: -1,
marginTop: 1,
filter: 'progid:DXImageTransform.Microsoft.Matrix(M11=0, M12=1, M21=-1, M22=0, SizingMethod="auto expand")'
}
},
// this test is the inversion of the css filters test from the modernizr project
useIeTransforms = function() {
var modElem = document.createElement('modernizr'),
mStyle = modElem.style,
omPrefixes = 'Webkit Moz O ms',
domPrefixes = omPrefixes.toLowerCase().split(' '),
props = ("transform" + ' ' + domPrefixes.join("Transform ") + "Transform").split(' ');
for ( var i in props ) {
var prop = props[i];
if ( !$.contains(prop, "-") && mStyle[prop] !== undefined ) {
return false;
}
}
return true;
}();
 
$.widget( "ui.iviewer", $.ui.mouse, {
widgetEventPrefix: "iviewer",
options : {
/**
* start zoom value for image, not used now
* may be equal to "fit" to fit image into container or scale in %
**/
zoom: "fit",
/**
* base value to scale image
**/
zoom_base: 100,
/**
* maximum zoom
**/
zoom_max: 800,
/**
* minimum zoom
**/
zoom_min: 25,
/**
* base of rate multiplier.
* zoom is calculated by formula: zoom_base * zoom_delta^rate
**/
zoom_delta: 1.4,
/**
* whether the zoom should be animated.
*/
zoom_animation: true,
/**
* if true plugin doesn't add its own controls
**/
ui_disabled: false,
/**
* If false mousewheel will be disabled
*/
mousewheel: true,
/**
* if false, plugin doesn't bind resize event on window and this must
* be handled manually
**/
update_on_resize: true,
/**
* event is triggered when zoom value is changed
* @param int new zoom value
* @return boolean if false zoom action is aborted
**/
onZoom: jQuery.noop,
/**
* event is triggered when zoom value is changed after image is set to the new dimensions
* @param int new zoom value
* @return boolean if false zoom action is aborted
**/
onAfterZoom: jQuery.noop,
/**
* event is fired on drag begin
* @param object coords mouse coordinates on the image
* @return boolean if false is returned, drag action is aborted
**/
onStartDrag: jQuery.noop,
/**
* event is fired on drag action
* @param object coords mouse coordinates on the image
**/
onDrag: jQuery.noop,
/**
* event is fired on drag stop
* @param object coords mouse coordinates on the image
**/
onStopDrag: jQuery.noop,
/**
* event is fired when mouse moves over image
* @param object coords mouse coordinates on the image
**/
onMouseMove: jQuery.noop,
/**
* mouse click event
* @param object coords mouse coordinates on the image
**/
onClick: jQuery.noop,
/**
* event is fired when image starts to load
*/
onStartLoad: null,
/**
* event is fired, when image is loaded and initially positioned
*/
onFinishLoad: null,
/**
* event is fired when image load error occurs
*/
onErrorLoad: null
},
 
_create: function() {
var me = this;
 
//drag variables
this.dx = 0;
this.dy = 0;
 
/* object containing actual information about image
* @img_object.object - jquery img object
* @img_object.orig_{width|height} - original dimensions
* @img_object.display_{width|height} - actual dimensions
*/
this.img_object = {};
 
this.zoom_object = {}; //object to show zoom status
 
this._angle = 0;
 
this.current_zoom = this.options.zoom;
 
if(this.options.src === null){
return;
}
 
this.container = this.element;
 
this._updateContainerInfo();
 
//init container
this.container.css("overflow","hidden");
 
if (this.options.update_on_resize == true) {
$(window).resize(function() {
me.update();
});
}
 
this.img_object = new $.ui.iviewer.ImageObject(this.options.zoom_animation);
 
if (this.options.mousewheel) {
this.container.bind('mousewheel.iviewer', function(ev, delta)
{
//this event is there instead of containing div, because
//at opera it triggers many times on div
var zoom = (delta > 0)?1:-1,
container_offset = me.container.offset(),
mouse_pos = {
//jquery.mousewheel 3.1.0 uses strange MozMousePixelScroll event
//which is not being fixed by jQuery.Event
x: (ev.pageX || ev.originalEvent.pageX) - container_offset.left,
y: (ev.pageY || ev.originalEvent.pageX) - container_offset.top
};
 
me.zoom_by(zoom, mouse_pos);
return false;
});
 
if (gesturesSupport) {
var gestureThrottle = +new Date();
var originalScale, originalCenter;
this.img_object.object()
// .bind('gesturestart', function(ev) {
.bind('touchstart', function(ev) {
originalScale = me.current_zoom;
var touches = ev.originalEvent.touches,
container_offset;
if (touches.length == 2) {
container_offset = me.container.offset();
originalCenter = {
x: (touches[0].pageX + touches[1].pageX) / 2 - container_offset.left,
y: (touches[0].pageY + touches[1].pageY) / 2 - container_offset.top
};
} else {
originalCenter = null;
}
}).bind('gesturechange', function(ev) {
//do not want to import throttle function from underscore
var d = +new Date();
if ((d - gestureThrottle) < 50) { return; }
gestureThrottle = d;
var zoom = originalScale * ev.originalEvent.scale;
me.set_zoom(zoom, originalCenter);
ev.preventDefault();
}).bind('gestureend', function(ev) {
originalCenter = null;
});
}
}
 
//init object
this.img_object.object()
//bind mouse events
.click(function(e){return me._click(e)})
.prependTo(this.container);
 
this.container.bind('mousemove', function(ev) { me._handleMouseMove(ev); });
 
this.loadImage(this.options.src);
 
if(!this.options.ui_disabled)
{
this.createui();
}
 
this._mouseInit();
},
 
destroy: function() {
$.Widget.prototype.destroy.call( this );
this._mouseDestroy();
this.img_object.object().remove();
this.container.off('.iviewer');
this.container.css('overflow', ''); //cleanup styles on destroy
},
 
_updateContainerInfo: function()
{
this.options.height = this.container.height();
this.options.width = this.container.width();
},
 
update: function()
{
this._updateContainerInfo()
this.setCoords(this.img_object.x(), this.img_object.y());
},
 
loadImage: function( src )
{
this.current_zoom = this.options.zoom;
var me = this;
 
this._trigger('onStartLoad', 0, src);
 
this.container.addClass("iviewer_loading");
this.img_object.load(src, function() {
me._imageLoaded(src);
}, function() {
me._trigger("onErrorLoad", 0, src);
});
},
 
_imageLoaded: function(src) {
this.container.removeClass("iviewer_loading");
this.container.addClass("iviewer_cursor");
 
if(this.options.zoom == "fit"){
this.fit(true);
}
else {
this.set_zoom(this.options.zoom, true);
}
 
this._trigger('onFinishLoad', 0, src);
},
 
/**
* fits image in the container
*
* @param {boolean} skip_animation
**/
fit: function(skip_animation)
{
var aspect_ratio = this.img_object.orig_width() / this.img_object.orig_height();
var window_ratio = this.options.width / this.options.height;
var choose_left = (aspect_ratio > window_ratio);
var new_zoom = 0;
 
if(choose_left){
new_zoom = this.options.width / this.img_object.orig_width() * 100;
}
else {
new_zoom = this.options.height / this.img_object.orig_height() * 100;
}
 
this.set_zoom(new_zoom, skip_animation);
},
 
/**
* center image in container
**/
center: function()
{
this.setCoords(-Math.round((this.img_object.display_width() - this.options.width)/2),
-Math.round((this.img_object.display_height() - this.options.height)/2));
},
 
/**
* move a point in container to the center of display area
* @param x a point in container
* @param y a point in container
**/
moveTo: function(x, y)
{
var dx = x-Math.round(this.options.width/2);
var dy = y-Math.round(this.options.height/2);
 
var new_x = this.img_object.x() - dx;
var new_y = this.img_object.y() - dy;
 
this.setCoords(new_x, new_y);
},
 
/**
* Get container offset object.
*/
getContainerOffset: function() {
return jQuery.extend({}, this.container.offset());
},
 
/**
* set coordinates of upper left corner of image object
**/
setCoords: function(x,y)
{
//do nothing while image is being loaded
if(!this.img_object.loaded()) { return; }
 
var coords = this._correctCoords(x,y);
this.img_object.x(coords.x);
this.img_object.y(coords.y);
},
 
_correctCoords: function( x, y )
{
x = parseInt(x, 10);
y = parseInt(y, 10);
 
//check new coordinates to be correct (to be in rect)
if(y > 0){
y = 0;
}
if(x > 0){
x = 0;
}
if(y + this.img_object.display_height() < this.options.height){
y = this.options.height - this.img_object.display_height();
}
if(x + this.img_object.display_width() < this.options.width){
x = this.options.width - this.img_object.display_width();
}
if(this.img_object.display_width() <= this.options.width){
x = -(this.img_object.display_width() - this.options.width)/2;
}
if(this.img_object.display_height() <= this.options.height){
y = -(this.img_object.display_height() - this.options.height)/2;
}
 
return { x: x, y:y };
},
 
 
/**
* convert coordinates on the container to the coordinates on the image (in original size)
*
* @return object with fields x,y according to coordinates or false
* if initial coords are not inside image
**/
containerToImage : function (x,y)
{
var coords = { x : x - this.img_object.x(),
y : y - this.img_object.y()
};
 
coords = this.img_object.toOriginalCoords(coords);
 
return { x : util.descaleValue(coords.x, this.current_zoom),
y : util.descaleValue(coords.y, this.current_zoom)
};
},
 
/**
* convert coordinates on the image (in original size, and zero angle) to the coordinates on the container
*
* @return object with fields x,y according to coordinates
**/
imageToContainer : function (x,y)
{
var coords = {
x : util.scaleValue(x, this.current_zoom),
y : util.scaleValue(y, this.current_zoom)
};
 
return this.img_object.toRealCoords(coords);
},
 
/**
* get mouse coordinates on the image
* @param e - object containing pageX and pageY fields, e.g. mouse event object
*
* @return object with fields x,y according to coordinates or false
* if initial coords are not inside image
**/
_getMouseCoords : function(e)
{
var containerOffset = this.container.offset();
coords = this.containerToImage(e.pageX - containerOffset.left, e.pageY - containerOffset.top);
 
return coords;
},
 
/**
* set image scale to the new_zoom
*
* @param {number} new_zoom image scale in %
* @param {boolean} skip_animation
* @param {x: number, y: number} Coordinates of point the should not be moved on zoom. The default is the center of image.
**/
set_zoom: function(new_zoom, skip_animation, zoom_center)
{
if (this._trigger('onZoom', 0, new_zoom) == false) {
return;
}
 
//do nothing while image is being loaded
if(!this.img_object.loaded()) { return; }
 
zoom_center = zoom_center || {
x: Math.round(this.options.width/2),
y: Math.round(this.options.height/2)
}
 
if(new_zoom < this.options.zoom_min)
{
new_zoom = this.options.zoom_min;
}
else if(new_zoom > this.options.zoom_max)
{
new_zoom = this.options.zoom_max;
}
 
/* we fake these values to make fit zoom properly work */
if(this.current_zoom == "fit")
{
var old_x = zoom_center.x + Math.round(this.img_object.orig_width()/2);
var old_y = zoom_center.y + Math.round(this.img_object.orig_height()/2);
this.current_zoom = 100;
}
else {
var old_x = -this.img_object.x() + zoom_center.x;
var old_y = -this.img_object.y() + zoom_center.y
}
 
var new_width = util.scaleValue(this.img_object.orig_width(), new_zoom);
var new_height = util.scaleValue(this.img_object.orig_height(), new_zoom);
var new_x = util.scaleValue( util.descaleValue(old_x, this.current_zoom), new_zoom);
var new_y = util.scaleValue( util.descaleValue(old_y, this.current_zoom), new_zoom);
 
new_x = zoom_center.x - new_x;
new_y = zoom_center.y - new_y;
 
new_width = Math.floor(new_width);
new_height = Math.floor(new_height);
new_x = Math.floor(new_x);
new_y = Math.floor(new_y);
 
this.img_object.display_width(new_width);
this.img_object.display_height(new_height);
 
var coords = this._correctCoords( new_x, new_y ),
self = this;
 
this.img_object.setImageProps(new_width, new_height, coords.x, coords.y,
skip_animation, function() {
self._trigger('onAfterZoom', 0, new_zoom );
});
this.current_zoom = new_zoom;
 
this.update_status();
},
 
/**
* changes zoom scale by delta
* zoom is calculated by formula: zoom_base * zoom_delta^rate
* @param Integer delta number to add to the current multiplier rate number
* @param {x: number, y: number=} Coordinates of point the should not be moved on zoom.
**/
zoom_by: function(delta, zoom_center)
{
var closest_rate = this.find_closest_zoom_rate(this.current_zoom);
 
var next_rate = closest_rate + delta;
var next_zoom = this.options.zoom_base * Math.pow(this.options.zoom_delta, next_rate)
if(delta > 0 && next_zoom < this.current_zoom)
{
next_zoom *= this.options.zoom_delta;
}
 
if(delta < 0 && next_zoom > this.current_zoom)
{
next_zoom /= this.options.zoom_delta;
}
 
this.set_zoom(next_zoom, undefined, zoom_center);
},
 
/**
* Rotate image
* @param {num} deg Degrees amount to rotate. Positive values rotate image clockwise.
* Currently 0, 90, 180, 270 and -90, -180, -270 values are supported
*
* @param {boolean} abs If the flag is true if, the deg parameter will be considered as
* a absolute value and relative otherwise.
* @return {num|null} Method will return current image angle if called without any arguments.
**/
angle: function(deg, abs) {
if (arguments.length === 0) { return this.img_object.angle(); }
 
if (deg < -270 || deg > 270 || deg % 90 !== 0) { return; }
if (!abs) { deg += this.img_object.angle(); }
if (deg < 0) { deg += 360; }
if (deg >= 360) { deg -= 360; }
 
if (deg === this.img_object.angle()) { return; }
 
this.img_object.angle(deg);
//the rotate behavior is different in all editors. For now we just center the
//image. However, it will be better to try to keep the position.
this.center();
this._trigger('angle', 0, { angle: this.img_object.angle() });
},
 
/**
* finds closest multiplier rate for value
* basing on zoom_base and zoom_delta values from settings
* @param Number value zoom value to examine
**/
find_closest_zoom_rate: function(value)
{
if(value == this.options.zoom_base)
{
return 0;
}
 
function div(val1,val2) { return val1 / val2 };
function mul(val1,val2) { return val1 * val2 };
 
var func = (value > this.options.zoom_base)?mul:div;
var sgn = (value > this.options.zoom_base)?1:-1;
 
var mltplr = this.options.zoom_delta;
var rate = 1;
 
while(Math.abs(func(this.options.zoom_base, Math.pow(mltplr,rate)) - value) >
Math.abs(func(this.options.zoom_base, Math.pow(mltplr,rate+1)) - value))
{
rate++;
}
 
return sgn * rate;
},
 
/* update scale info in the container */
update_status: function()
{
if(!this.options.ui_disabled)
{
var percent = Math.round(100*this.img_object.display_height()/this.img_object.orig_height());
if(percent)
{
this.zoom_object.html(percent + "%");
}
}
},
 
/**
* Get some information about the image.
* Currently orig_(width|height), display_(width|height), angle, zoom and src params are supported.
*
* @param {string} parameter to check
* @param {boolean} withoutRotation if param is orig_width or orig_height and this flag is set to true,
* method will return original image width without considering rotation.
*
*/
info: function(param, withoutRotation) {
if (!param) { return; }
 
switch (param) {
case 'orig_width':
case 'orig_height':
if (withoutRotation) {
return (this.img_object.angle() % 180 === 0 ? this.img_object[param]() :
param === 'orig_width' ? this.img_object.orig_height() :
this.img_object.orig_width());
} else {
return this.img_object[param]();
}
case 'display_width':
case 'display_height':
case 'angle':
return this.img_object[param]();
case 'zoom':
return this.current_zoom;
case 'src':
return this.img_object.object().attr('src');
case 'coords':
return {
x: this.img_object.x(),
y: this.img_object.y()
};
}
},
 
/**
* callback for handling mousdown event to start dragging image
**/
_mouseStart: function( e )
{
$.ui.mouse.prototype._mouseStart.call(this, e);
if (this._trigger('onStartDrag', 0, this._getMouseCoords(e)) === false) {
return false;
}
 
/* start drag event*/
this.container.addClass("iviewer_drag_cursor");
 
//#10: fix movement quirks for ipad
this._dragInitialized = !(e.originalEvent.changedTouches && e.originalEvent.changedTouches.length==1);
 
this.dx = e.pageX - this.img_object.x();
this.dy = e.pageY - this.img_object.y();
return true;
},
 
_mouseCapture: function( e ) {
return true;
},
 
/**
* Handle mouse move if needed. User can avoid using this callback, because
* he can get the same information through public methods.
* @param {jQuery.Event} e
*/
_handleMouseMove: function(e) {
this._trigger('onMouseMove', e, this._getMouseCoords(e));
},
 
/**
* callback for handling mousemove event to drag image
**/
_mouseDrag: function(e)
{
$.ui.mouse.prototype._mouseDrag.call(this, e);
 
//#10: imitate mouseStart, because we can get here without it on iPad for some reason
if (!this._dragInitialized) {
this.dx = e.pageX - this.img_object.x();
this.dy = e.pageY - this.img_object.y();
this._dragInitialized = true;
}
 
var ltop = e.pageY - this.dy;
var lleft = e.pageX - this.dx;
 
this.setCoords(lleft, ltop);
this._trigger('onDrag', e, this._getMouseCoords(e));
return false;
},
 
/**
* callback for handling stop drag
**/
_mouseStop: function(e)
{
$.ui.mouse.prototype._mouseStop.call(this, e);
this.container.removeClass("iviewer_drag_cursor");
this._trigger('onStopDrag', 0, this._getMouseCoords(e));
},
 
_click: function(e)
{
this._trigger('onClick', 0, this._getMouseCoords(e));
},
 
/**
* create zoom buttons info box
**/
createui: function()
{
var me=this;
 
$("<div>", { 'class': "iviewer_zoom_in iviewer_common iviewer_button"})
.bind('mousedown touchstart',function(){me.zoom_by(1); return false;})
.appendTo(this.container);
 
$("<div>", { 'class': "iviewer_zoom_out iviewer_common iviewer_button"})
.bind('mousedown touchstart',function(){me.zoom_by(- 1); return false;})
.appendTo(this.container);
 
$("<div>", { 'class': "iviewer_zoom_zero iviewer_common iviewer_button"})
.bind('mousedown touchstart',function(){me.set_zoom(100); return false;})
.appendTo(this.container);
 
$("<div>", { 'class': "iviewer_zoom_fit iviewer_common iviewer_button"})
.bind('mousedown touchstart',function(){me.fit(this); return false;})
.appendTo(this.container);
 
this.zoom_object = $("<div>").addClass("iviewer_zoom_status iviewer_common")
.appendTo(this.container);
 
$("<div>", { 'class': "iviewer_rotate_left iviewer_common iviewer_button"})
.bind('mousedown touchstart',function(){me.angle(-90); return false;})
.appendTo(this.container);
 
$("<div>", { 'class': "iviewer_rotate_right iviewer_common iviewer_button" })
.bind('mousedown touchstart',function(){me.angle(90); return false;})
.appendTo(this.container);
 
this.update_status(); //initial status update
}
 
} );
 
/**
* @class $.ui.iviewer.ImageObject Class represents image and provides public api without
* extending image prototype.
* @constructor
* @param {boolean} do_anim Do we want to animate image on dimension changes?
*/
$.ui.iviewer.ImageObject = function(do_anim) {
this._img = $("<img>")
//this is needed, because chromium sets them auto otherwise
.css({ position: "absolute", top :"0px", left: "0px"});
 
this._loaded = false;
this._swapDimensions = false;
this._do_anim = do_anim || false;
this.x(0, true);
this.y(0, true);
this.angle(0);
};
 
 
/** @lends $.ui.iviewer.ImageObject.prototype */
(function() {
/**
* Restore initial object state.
*
* @param {number} w Image width.
* @param {number} h Image height.
*/
this._reset = function(w, h) {
this._angle = 0;
this._swapDimensions = false;
this.x(0);
this.y(0);
 
this.orig_width(w);
this.orig_height(h);
this.display_width(w);
this.display_height(h);
};
 
/**
* Check if image is loaded.
*
* @return {boolean}
*/
this.loaded = function() { return this._loaded; };
 
/**
* Load image.
*
* @param {string} src Image url.
* @param {Function=} loaded Function will be called on image load.
*/
this.load = function(src, loaded, error) {
var self = this;
 
loaded = loaded || jQuery.noop;
this._loaded = false;
 
//If we assign new image url to the this._img IE9 fires onload event and image width and
//height are set to zero. So, we create another image object and load image through it.
var img = new Image();
img.onload = function() {
self._loaded = true;
self._reset(this.width, this.height);
 
self._img
.removeAttr("width")
.removeAttr("height")
.removeAttr("style")
//max-width is reset, because plugin breaks in the twitter bootstrap otherwise
.css({ position: "absolute", top :"0px", left: "0px", maxWidth: "none"})
 
self._img[0].src = src;
loaded();
};
 
img.onerror = error;
 
//we need this because sometimes internet explorer 8 fires onload event
//right after assignment (synchronously)
setTimeout(function() {
img.src = src;
}, 0);
 
this.angle(0);
};
 
this._dimension = function(prefix, name) {
var horiz = '_' + prefix + '_' + name,
vert = '_' + prefix + '_' + (name === 'height' ? 'width' : 'height');
return setter(function(val) {
this[this._swapDimensions ? horiz: vert] = val;
},
function() {
return this[this._swapDimensions ? horiz: vert];
});
};
 
/**
* Getters and setter for common image dimensions.
* display_ means real image tag dimensions
* orig_ means physical image dimensions.
* Note, that dimensions are swapped if image is rotated. It necessary,
* because as little as possible code should know about rotation.
*/
this.display_width = this._dimension('display', 'width'),
this.display_height = this._dimension('display', 'height'),
this.display_diff = function() { return Math.floor( this.display_width() - this.display_height() ) };
this.orig_width = this._dimension('orig', 'width'),
this.orig_height = this._dimension('orig', 'height'),
 
/**
* Setter for X coordinate. If image is rotated we need to additionaly shift an
* image to map image coordinate to the visual position.
*
* @param {number} val Coordinate value.
* @param {boolean} skipCss If true, we only set the value and do not touch the dom.
*/
this.x = setter(function(val, skipCss) {
this._x = val;
if (!skipCss) {
this._finishAnimation();
this._img.css("left",this._x + (this._swapDimensions ? this.display_diff() / 2 : 0) + "px");
}
},
function() {
return this._x;
});
 
/**
* Setter for Y coordinate. If image is rotated we need to additionaly shift an
* image to map image coordinate to the visual position.
*
* @param {number} val Coordinate value.
* @param {boolean} skipCss If true, we only set the value and do not touch the dom.
*/
this.y = setter(function(val, skipCss) {
this._y = val;
if (!skipCss) {
this._finishAnimation();
this._img.css("top",this._y - (this._swapDimensions ? this.display_diff() / 2 : 0) + "px");
}
},
function() {
return this._y;
});
 
/**
* Perform image rotation.
*
* @param {number} deg Absolute image angle. The method will work with values 0, 90, 180, 270 degrees.
*/
this.angle = setter(function(deg) {
var prevSwap = this._swapDimensions;
 
this._angle = deg;
this._swapDimensions = deg % 180 !== 0;
 
if (prevSwap !== this._swapDimensions) {
var verticalMod = this._swapDimensions ? -1 : 1;
this.x(this.x() - verticalMod * this.display_diff() / 2, true);
this.y(this.y() + verticalMod * this.display_diff() / 2, true);
};
 
var cssVal = 'rotate(' + deg + 'deg)',
img = this._img;
 
jQuery.each(['', '-webkit-', '-moz-', '-o-', '-ms-'], function(i, prefix) {
img.css(prefix + 'transform', cssVal);
});
 
if (useIeTransforms) {
jQuery.each(['-ms-', ''], function(i, prefix) {
img.css(prefix + 'filter', ieTransforms[deg].filter);
});
 
img.css({
marginLeft: ieTransforms[deg].marginLeft * this.display_diff() / 2,
marginTop: ieTransforms[deg].marginTop * this.display_diff() / 2
});
}
},
function() { return this._angle; });
 
/**
* Map point in the container coordinates to the point in image coordinates.
* You will get coordinates of point on image with respect to rotation,
* but will be set as if image was not rotated.
* So, if image was rotated 90 degrees, it's (0,0) point will be on the
* top right corner.
*
* @param {{x: number, y: number}} point Point in container coordinates.
* @return {{x: number, y: number}}
*/
this.toOriginalCoords = function(point) {
switch (this.angle()) {
case 0: return { x: point.x, y: point.y }
case 90: return { x: point.y, y: this.display_width() - point.x }
case 180: return { x: this.display_width() - point.x, y: this.display_height() - point.y }
case 270: return { x: this.display_height() - point.y, y: point.x }
}
};
 
/**
* Map point in the image coordinates to the point in container coordinates.
* You will get coordinates of point on container with respect to rotation.
* Note, if image was rotated 90 degrees, it's (0,0) point will be on the
* top right corner.
*
* @param {{x: number, y: number}} point Point in container coordinates.
* @return {{x: number, y: number}}
*/
this.toRealCoords = function(point) {
switch (this.angle()) {
case 0: return { x: this.x() + point.x, y: this.y() + point.y }
case 90: return { x: this.x() + this.display_width() - point.y, y: this.y() + point.x}
case 180: return { x: this.x() + this.display_width() - point.x, y: this.y() + this.display_height() - point.y}
case 270: return { x: this.x() + point.y, y: this.y() + this.display_height() - point.x}
}
};
 
/**
* @return {jQuery} Return image node. this is needed to add event handlers.
*/
this.object = setter(jQuery.noop,
function() { return this._img; });
 
/**
* Change image properties.
*
* @param {number} disp_w Display width;
* @param {number} disp_h Display height;
* @param {number} x
* @param {number} y
* @param {boolean} skip_animation If true, the animation will be skiped despite the
* value set in constructor.
* @param {Function=} complete Call back will be fired when zoom will be complete.
*/
this.setImageProps = function(disp_w, disp_h, x, y, skip_animation, complete) {
complete = complete || jQuery.noop;
 
this.display_width(disp_w);
this.display_height(disp_h);
this.x(x, true);
this.y(y, true);
 
var w = this._swapDimensions ? disp_h : disp_w;
var h = this._swapDimensions ? disp_w : disp_h;
 
var params = {
width: w,
height: h,
top: y - (this._swapDimensions ? this.display_diff() / 2 : 0) + "px",
left: x + (this._swapDimensions ? this.display_diff() / 2 : 0) + "px"
};
 
if (useIeTransforms) {
jQuery.extend(params, {
marginLeft: ieTransforms[this.angle()].marginLeft * this.display_diff() / 2,
marginTop: ieTransforms[this.angle()].marginTop * this.display_diff() / 2
});
}
 
var swapDims = this._swapDimensions,
img = this._img;
 
//here we come: another IE oddness. If image is rotated 90 degrees with a filter, than
//width and height getters return real width and height of rotated image. The bad news
//is that to set height you need to set a width and vice versa. Fuck IE.
//So, in this case we have to animate width and height manually.
if(useIeTransforms && swapDims) {
var ieh = this._img.width(),
iew = this._img.height(),
iedh = params.height - ieh;
iedw = params.width - iew;
 
delete params.width;
delete params.height;
}
 
if (this._do_anim && !skip_animation) {
this._img.stop(true)
.animate(params, {
duration: 200,
complete: complete,
step: function(now, fx) {
if(useIeTransforms && swapDims && (fx.prop === 'top')) {
var percent = (now - fx.start) / (fx.end - fx.start);
 
img.height(ieh + iedh * percent);
img.width(iew + iedw * percent);
img.css('top', now);
}
}
});
} else {
this._img.css(params);
setTimeout(complete, 0); //both if branches should behave equally.
}
};
 
//if we set image coordinates we need to be sure that no animation is active atm
this._finishAnimation = function() {
this._img.stop(true, true);
}
 
}).apply($.ui.iviewer.ImageObject.prototype);
 
 
 
var util = {
scaleValue: function(value, toZoom)
{
return value * toZoom / 100;
},
 
descaleValue: function(value, fromZoom)
{
return value * 100 / fromZoom;
}
};
 
} )( jQuery, undefined );
/branches/v0.3-aleaume/doc/PhpDoc/js/jquery.dotdotdot-1.5.9.js
New file
0,0 → 1,602
/*
* jQuery dotdotdot 1.5.9
*
* Copyright (c) 2013 Fred Heusschen
* www.frebsite.nl
*
* Plugin website:
* dotdotdot.frebsite.nl
*
* Dual licensed under the MIT and GPL licenses.
* http://en.wikipedia.org/wiki/MIT_License
* http://en.wikipedia.org/wiki/GNU_General_Public_License
*/
 
(function( $ )
{
if ( $.fn.dotdotdot )
{
return;
}
 
$.fn.dotdotdot = function( o )
{
if ( this.length == 0 )
{
if ( !o || o.debug !== false )
{
debug( true, 'No element found for "' + this.selector + '".' );
}
return this;
}
if ( this.length > 1 )
{
return this.each(
function()
{
$(this).dotdotdot( o );
}
);
}
 
 
var $dot = this;
 
if ( $dot.data( 'dotdotdot' ) )
{
$dot.trigger( 'destroy.dot' );
}
 
$dot.data( 'dotdotdot-style', $dot.attr( 'style' ) );
$dot.css( 'word-wrap', 'break-word' );
 
$dot.bind_events = function()
{
$dot.bind(
'update.dot',
function( e, c )
{
e.preventDefault();
e.stopPropagation();
 
opts.maxHeight = ( typeof opts.height == 'number' )
? opts.height
: getTrueInnerHeight( $dot );
 
opts.maxHeight += opts.tolerance;
 
if ( typeof c != 'undefined' )
{
if ( typeof c == 'string' || c instanceof HTMLElement )
{
c = $('<div />').append( c ).contents();
}
if ( c instanceof $ )
{
orgContent = c;
}
}
 
$inr = $dot.wrapInner( '<div class="dotdotdot" />' ).children();
$inr.empty()
.append( orgContent.clone( true ) )
.css({
'height' : 'auto',
'width' : 'auto',
'border' : 'none',
'padding' : 0,
'margin' : 0
});
 
var after = false,
trunc = false;
 
if ( conf.afterElement )
{
after = conf.afterElement.clone( true );
conf.afterElement.remove();
}
if ( test( $inr, opts ) )
{
if ( opts.wrap == 'children' )
{
trunc = children( $inr, opts, after );
}
else
{
trunc = ellipsis( $inr, $dot, $inr, opts, after );
}
}
$inr.replaceWith( $inr.contents() );
$inr = null;
if ( $.isFunction( opts.callback ) )
{
opts.callback.call( $dot[ 0 ], trunc, orgContent );
}
 
conf.isTruncated = trunc;
return trunc;
}
 
).bind(
'isTruncated.dot',
function( e, fn )
{
e.preventDefault();
e.stopPropagation();
 
if ( typeof fn == 'function' )
{
fn.call( $dot[ 0 ], conf.isTruncated );
}
return conf.isTruncated;
}
 
).bind(
'originalContent.dot',
function( e, fn )
{
e.preventDefault();
e.stopPropagation();
 
if ( typeof fn == 'function' )
{
fn.call( $dot[ 0 ], orgContent );
}
return orgContent;
}
 
).bind(
'destroy.dot',
function( e )
{
e.preventDefault();
e.stopPropagation();
 
$dot.unwatch()
.unbind_events()
.empty()
.append( orgContent )
.attr( 'style', $dot.data( 'dotdotdot-style' ) )
.data( 'dotdotdot', false );
}
);
return $dot;
}; // /bind_events
 
$dot.unbind_events = function()
{
$dot.unbind('.dot');
return $dot;
}; // /unbind_events
 
$dot.watch = function()
{
$dot.unwatch();
if ( opts.watch == 'window' )
{
var $window = $(window),
_wWidth = $window.width(),
_wHeight = $window.height();
 
$window.bind(
'resize.dot' + conf.dotId,
function()
{
if ( _wWidth != $window.width() || _wHeight != $window.height() || !opts.windowResizeFix )
{
_wWidth = $window.width();
_wHeight = $window.height();
if ( watchInt )
{
clearInterval( watchInt );
}
watchInt = setTimeout(
function()
{
$dot.trigger( 'update.dot' );
}, 10
);
}
}
);
}
else
{
watchOrg = getSizes( $dot );
watchInt = setInterval(
function()
{
var watchNew = getSizes( $dot );
if ( watchOrg.width != watchNew.width ||
watchOrg.height != watchNew.height )
{
$dot.trigger( 'update.dot' );
watchOrg = getSizes( $dot );
}
}, 100
);
}
return $dot;
};
$dot.unwatch = function()
{
$(window).unbind( 'resize.dot' + conf.dotId );
if ( watchInt )
{
clearInterval( watchInt );
}
return $dot;
};
 
var orgContent = $dot.contents(),
opts = $.extend( true, {}, $.fn.dotdotdot.defaults, o ),
conf = {},
watchOrg = {},
watchInt = null,
$inr = null;
 
conf.afterElement = getElement( opts.after, $dot );
conf.isTruncated = false;
conf.dotId = dotId++;
 
 
$dot.data( 'dotdotdot', true )
.bind_events()
.trigger( 'update.dot' );
 
if ( opts.watch )
{
$dot.watch();
}
 
return $dot;
};
 
 
// public
$.fn.dotdotdot.defaults = {
'ellipsis' : '... ',
'wrap' : 'word',
'lastCharacter': {
'remove' : [ ' ', ',', ';', '.', '!', '?' ],
'noEllipsis' : []
},
'tolerance' : 0,
'callback' : null,
'after' : null,
'height' : null,
'watch' : false,
'windowResizeFix': true,
'debug' : false
};
 
// private
var dotId = 1;
 
function children( $elem, o, after )
{
var $elements = $elem.children(),
isTruncated = false;
 
$elem.empty();
 
for ( var a = 0, l = $elements.length; a < l; a++ )
{
var $e = $elements.eq( a );
$elem.append( $e );
if ( after )
{
$elem.append( after );
}
if ( test( $elem, o ) )
{
$e.remove();
isTruncated = true;
break;
}
else
{
if ( after )
{
after.remove();
}
}
}
return isTruncated;
}
function ellipsis( $elem, $d, $i, o, after )
{
var $elements = $elem.contents(),
isTruncated = false;
 
$elem.empty();
 
var notx = 'table, thead, tbody, tfoot, tr, col, colgroup, object, embed, param, ol, ul, dl, select, optgroup, option, textarea, script, style';
for ( var a = 0, l = $elements.length; a < l; a++ )
{
 
if ( isTruncated )
{
break;
}
 
var e = $elements[ a ],
$e = $(e);
 
if ( typeof e == 'undefined' )
{
continue;
}
 
$elem.append( $e );
if ( after )
{
$elem[ ( $elem.is( notx ) ) ? 'after' : 'append' ]( after );
}
if ( e.nodeType == 3 )
{
if ( test( $i, o ) )
{
isTruncated = ellipsisElement( $e, $d, $i, o, after );
}
}
else
{
isTruncated = ellipsis( $e, $d, $i, o, after );
}
 
if ( !isTruncated )
{
if ( after )
{
after.remove();
}
}
}
return isTruncated;
}
function ellipsisElement( $e, $d, $i, o, after )
{
var isTruncated = false,
e = $e[ 0 ];
 
if ( typeof e == 'undefined' )
{
return false;
}
 
var seporator = ( o.wrap == 'letter' ) ? '' : ' ',
textArr = getTextContent( e ).split( seporator ),
position = -1,
midPos = -1,
startPos = 0,
endPos = textArr.length - 1;
 
while ( startPos <= endPos )
{
var m = Math.floor( ( startPos + endPos ) / 2 );
if ( m == midPos )
{
break;
}
midPos = m;
 
setTextContent( e, textArr.slice( 0, midPos + 1 ).join( seporator ) + o.ellipsis );
 
if ( !test( $i, o ) )
{
position = midPos;
startPos = midPos;
}
else
{
endPos = midPos;
}
}
if ( position != -1 && !( textArr.length == 1 && textArr[ 0 ].length == 0 ) )
{
var txt = addEllipsis( textArr.slice( 0, position + 1 ).join( seporator ), o );
isTruncated = true;
setTextContent( e, txt );
}
else
{
var $w = $e.parent();
$e.remove();
 
var afterLength = ( after ) ? after.length : 0 ;
 
if ( $w.contents().size() > afterLength )
{
var $n = $w.contents().eq( -1 - afterLength );
isTruncated = ellipsisElement( $n, $d, $i, o, after );
}
else
{
var $p = $w.prev()
var e = $p.contents().eq( -1 )[ 0 ];
 
if ( typeof e != 'undefined' )
{
var txt = addEllipsis( getTextContent( e ), o );
setTextContent( e, txt );
if ( after )
{
$p.append( after );
}
$w.remove();
isTruncated = true;
}
 
}
}
 
return isTruncated;
}
function test( $i, o )
{
return $i.innerHeight() > o.maxHeight;
}
function addEllipsis( txt, o )
{
while( $.inArray( txt.slice( -1 ), o.lastCharacter.remove ) > -1 )
{
txt = txt.slice( 0, -1 );
}
if ( $.inArray( txt.slice( -1 ), o.lastCharacter.noEllipsis ) < 0 )
{
txt += o.ellipsis;
}
return txt;
}
function getSizes( $d )
{
return {
'width' : $d.innerWidth(),
'height': $d.innerHeight()
};
}
function setTextContent( e, content )
{
if ( e.innerText )
{
e.innerText = content;
}
else if ( e.nodeValue )
{
e.nodeValue = content;
}
else if (e.textContent)
{
e.textContent = content;
}
 
}
function getTextContent( e )
{
if ( e.innerText )
{
return e.innerText;
}
else if ( e.nodeValue )
{
return e.nodeValue;
}
else if ( e.textContent )
{
return e.textContent;
}
else
{
return "";
}
}
function getElement( e, $i )
{
if ( typeof e == 'undefined' )
{
return false;
}
if ( !e )
{
return false;
}
if ( typeof e == 'string' )
{
e = $(e, $i);
return ( e.length )
? e
: false;
}
if ( typeof e == 'object' )
{
return ( typeof e.jquery == 'undefined' )
? false
: e;
}
return false;
}
function getTrueInnerHeight( $el )
{
var h = $el.innerHeight(),
a = [ 'paddingTop', 'paddingBottom' ];
 
for ( var z = 0, l = a.length; z < l; z++ ) {
var m = parseInt( $el.css( a[ z ] ), 10 );
if ( isNaN( m ) )
{
m = 0;
}
h -= m;
}
return h;
}
function debug( d, m )
{
if ( !d )
{
return false;
}
if ( typeof m == 'string' )
{
m = 'dotdotdot: ' + m;
}
else
{
m = [ 'dotdotdot:', m ];
}
 
if ( typeof window.console != 'undefined' )
{
if ( typeof window.console.log != 'undefined' )
{
window.console.log( m );
}
}
return false;
}
 
// override jQuery.html
var _orgHtml = $.fn.html;
$.fn.html = function( str ) {
if ( typeof str != 'undefined' )
{
if ( this.data( 'dotdotdot' ) )
{
if ( typeof str != 'function' )
{
return this.trigger( 'update', [ str ] );
}
}
return _orgHtml.call( this, str );
}
return _orgHtml.call( this );
};
 
 
// override jQuery.text
var _orgText = $.fn.text;
$.fn.text = function( str ) {
if ( typeof str != 'undefined' )
{
if ( this.data( 'dotdotdot' ) )
{
var temp = $( '<div />' );
temp.text( str );
str = temp.html();
temp.remove();
return this.trigger( 'update', [ str ] );
}
return _orgText.call( this, str );
}
return _orgText.call( this );
};
 
 
})( jQuery );
/branches/v0.3-aleaume/doc/PhpDoc/js/jquery.iviewer.min.js
New file
0,0 → 1,47
/*
* iviewer Widget for jQuery UI
* https://github.com/can3p/iviewer
*
* Copyright (c) 2009 - 2012 Dmitry Petrov
* Dual licensed under the MIT and GPL licenses.
* - http://www.opensource.org/licenses/mit-license.php
* - http://www.gnu.org/copyleft/gpl.html
*
* Author: Dmitry Petrov
* Version: 0.7.7
*/
(function($,undefined){var mouseEvents={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup"},gesturesSupport="ongesturestart"in document.createElement("div");function makeMouseEvent(event){var touch=event.originalEvent.changedTouches[0];return $.extend(event,{type:mouseEvents[event.type],which:1,pageX:touch.pageX,pageY:touch.pageY,screenX:touch.screenX,screenY:touch.screenY,clientX:touch.clientX,clientY:touch.clientY,isTouchEvent:true})}var mouseProto=$.ui.mouse.prototype,_mouseInit=$.ui.mouse.prototype._mouseInit;
mouseProto._mouseInit=function(){var self=this;self._touchActive=false;this.element.bind("touchstart."+this.widgetName,function(event){if(gesturesSupport&&event.originalEvent.touches.length>1)return;self._touchActive=true;return self._mouseDown(makeMouseEvent(event))});var self=this;this._mouseMoveDelegate=function(event){if(gesturesSupport&&event.originalEvent.touches&&event.originalEvent.touches.length>1)return;if(self._touchActive)return self._mouseMove(makeMouseEvent(event))};this._mouseUpDelegate=
function(event){if(self._touchActive){self._touchActive=false;return self._mouseUp(makeMouseEvent(event))}};$(document).bind("touchmove."+this.widgetName,this._mouseMoveDelegate).bind("touchend."+this.widgetName,this._mouseUpDelegate);_mouseInit.apply(this)};var setter=function(setter,getter){return function(val){if(arguments.length===0)return getter.apply(this);else setter.apply(this,arguments)}};var ieTransforms={"0":{marginLeft:0,marginTop:0,filter:'progid:DXImageTransform.Microsoft.Matrix(M11=1, M12=0, M21=0, M22=1, SizingMethod="auto expand")'},
90:{marginLeft:-1,marginTop:1,filter:'progid:DXImageTransform.Microsoft.Matrix(M11=0, M12=-1, M21=1, M22=0, SizingMethod="auto expand")'},180:{marginLeft:0,marginTop:0,filter:'progid:DXImageTransform.Microsoft.Matrix(M11=-1, M12=0, M21=0, M22=-1, SizingMethod="auto expand")'},270:{marginLeft:-1,marginTop:1,filter:'progid:DXImageTransform.Microsoft.Matrix(M11=0, M12=1, M21=-1, M22=0, SizingMethod="auto expand")'}},useIeTransforms=function(){var el=document.createElement("div");el.style.cssText=["-ms-",
"",""].join("filter:blur(2px); ");return!!el.style.cssText&&document.documentMode<9}();$.widget("ui.iviewer",$.ui.mouse,{widgetEventPrefix:"iviewer",options:{zoom:"fit",zoom_base:100,zoom_max:800,zoom_min:25,zoom_delta:1.4,zoom_animation:true,ui_disabled:false,mousewheel:true,update_on_resize:true,onZoom:jQuery.noop,onAfterZoom:jQuery.noop,onStartDrag:jQuery.noop,onDrag:jQuery.noop,onStopDrag:jQuery.noop,onMouseMove:jQuery.noop,onClick:jQuery.noop,onStartLoad:null,onFinishLoad:null,onErrorLoad:null},
_create:function(){var me=this;this.dx=0;this.dy=0;this.img_object={};this.zoom_object={};this._angle=0;this.current_zoom=this.options.zoom;if(this.options.src===null)return;this.container=this.element;this._updateContainerInfo();this.container.css("overflow","hidden");if(this.options.update_on_resize==true)$(window).resize(function(){me.update()});this.img_object=new $.ui.iviewer.ImageObject(this.options.zoom_animation);if(this.options.mousewheel){this.container.bind("mousewheel.iviewer",function(ev,
delta){var zoom=delta>0?1:-1,container_offset=me.container.offset(),mouse_pos={x:ev.pageX-container_offset.left,y:ev.pageY-container_offset.top};me.zoom_by(zoom,mouse_pos);return false});if(gesturesSupport){var gestureThrottle=+new Date;var originalScale,originalCenter;this.img_object.object().bind("touchstart",function(ev){originalScale=me.current_zoom;var touches=ev.originalEvent.touches,container_offset;if(touches.length==2){container_offset=me.container.offset();originalCenter={x:(touches[0].pageX+
touches[1].pageX)/2-container_offset.left,y:(touches[0].pageY+touches[1].pageY)/2-container_offset.top}}else originalCenter=null}).bind("gesturechange",function(ev){var d=+new Date;if(d-gestureThrottle<50)return;gestureThrottle=d;var zoom=originalScale*ev.originalEvent.scale;me.set_zoom(zoom,originalCenter);ev.preventDefault()}).bind("gestureend",function(ev){originalCenter=null})}}this.img_object.object().click(function(e){return me._click(e)}).prependTo(this.container);this.container.bind("mousemove",
function(ev){me._handleMouseMove(ev)});this.loadImage(this.options.src);if(!this.options.ui_disabled)this.createui();this._mouseInit()},destroy:function(){$.Widget.prototype.destroy.call(this);this._mouseDestroy();this.img_object.object().remove();this.container.off(".iviewer");this.container.css("overflow","")},_updateContainerInfo:function(){this.options.height=this.container.height();this.options.width=this.container.width()},update:function(){this._updateContainerInfo();this.setCoords(this.img_object.x(),
this.img_object.y())},loadImage:function(src){this.current_zoom=this.options.zoom;var me=this;this._trigger("onStartLoad",0,src);this.container.addClass("iviewer_loading");this.img_object.load(src,function(){me._imageLoaded(src)},function(){me._trigger("onErrorLoad",0,src)})},_imageLoaded:function(src){this.container.removeClass("iviewer_loading");this.container.addClass("iviewer_cursor");if(this.options.zoom=="fit")this.fit(true);else this.set_zoom(this.options.zoom,true);this._trigger("onFinishLoad",
0,src)},fit:function(skip_animation){var aspect_ratio=this.img_object.orig_width()/this.img_object.orig_height();var window_ratio=this.options.width/this.options.height;var choose_left=aspect_ratio>window_ratio;var new_zoom=0;if(choose_left)new_zoom=this.options.width/this.img_object.orig_width()*100;else new_zoom=this.options.height/this.img_object.orig_height()*100;this.set_zoom(new_zoom,skip_animation)},center:function(){this.setCoords(-Math.round((this.img_object.display_width()-this.options.width)/
2),-Math.round((this.img_object.display_height()-this.options.height)/2))},moveTo:function(x,y){var dx=x-Math.round(this.options.width/2);var dy=y-Math.round(this.options.height/2);var new_x=this.img_object.x()-dx;var new_y=this.img_object.y()-dy;this.setCoords(new_x,new_y)},getContainerOffset:function(){return jQuery.extend({},this.container.offset())},setCoords:function(x,y){if(!this.img_object.loaded())return;var coords=this._correctCoords(x,y);this.img_object.x(coords.x);this.img_object.y(coords.y)},
_correctCoords:function(x,y){x=parseInt(x,10);y=parseInt(y,10);if(y>0)y=0;if(x>0)x=0;if(y+this.img_object.display_height()<this.options.height)y=this.options.height-this.img_object.display_height();if(x+this.img_object.display_width()<this.options.width)x=this.options.width-this.img_object.display_width();if(this.img_object.display_width()<=this.options.width)x=-(this.img_object.display_width()-this.options.width)/2;if(this.img_object.display_height()<=this.options.height)y=-(this.img_object.display_height()-
this.options.height)/2;return{x:x,y:y}},containerToImage:function(x,y){var coords={x:x-this.img_object.x(),y:y-this.img_object.y()};coords=this.img_object.toOriginalCoords(coords);return{x:util.descaleValue(coords.x,this.current_zoom),y:util.descaleValue(coords.y,this.current_zoom)}},imageToContainer:function(x,y){var coords={x:util.scaleValue(x,this.current_zoom),y:util.scaleValue(y,this.current_zoom)};return this.img_object.toRealCoords(coords)},_getMouseCoords:function(e){var containerOffset=this.container.offset();
coords=this.containerToImage(e.pageX-containerOffset.left,e.pageY-containerOffset.top);return coords},set_zoom:function(new_zoom,skip_animation,zoom_center){if(this._trigger("onZoom",0,new_zoom)==false)return;if(!this.img_object.loaded())return;zoom_center=zoom_center||{x:Math.round(this.options.width/2),y:Math.round(this.options.height/2)};if(new_zoom<this.options.zoom_min)new_zoom=this.options.zoom_min;else if(new_zoom>this.options.zoom_max)new_zoom=this.options.zoom_max;if(this.current_zoom=="fit"){var old_x=
zoom_center.x+Math.round(this.img_object.orig_width()/2);var old_y=zoom_center.y+Math.round(this.img_object.orig_height()/2);this.current_zoom=100}else{var old_x=-this.img_object.x()+zoom_center.x;var old_y=-this.img_object.y()+zoom_center.y}var new_width=util.scaleValue(this.img_object.orig_width(),new_zoom);var new_height=util.scaleValue(this.img_object.orig_height(),new_zoom);var new_x=util.scaleValue(util.descaleValue(old_x,this.current_zoom),new_zoom);var new_y=util.scaleValue(util.descaleValue(old_y,
this.current_zoom),new_zoom);new_x=zoom_center.x-new_x;new_y=zoom_center.y-new_y;new_width=Math.floor(new_width);new_height=Math.floor(new_height);new_x=Math.floor(new_x);new_y=Math.floor(new_y);this.img_object.display_width(new_width);this.img_object.display_height(new_height);var coords=this._correctCoords(new_x,new_y),self=this;this.img_object.setImageProps(new_width,new_height,coords.x,coords.y,skip_animation,function(){self._trigger("onAfterZoom",0,new_zoom)});this.current_zoom=new_zoom;this.update_status()},
zoom_by:function(delta,zoom_center){var closest_rate=this.find_closest_zoom_rate(this.current_zoom);var next_rate=closest_rate+delta;var next_zoom=this.options.zoom_base*Math.pow(this.options.zoom_delta,next_rate);if(delta>0&&next_zoom<this.current_zoom)next_zoom*=this.options.zoom_delta;if(delta<0&&next_zoom>this.current_zoom)next_zoom/=this.options.zoom_delta;this.set_zoom(next_zoom,undefined,zoom_center)},angle:function(deg,abs){if(arguments.length===0)return this.img_object.angle();if(deg<-270||
deg>270||deg%90!==0)return;if(!abs)deg+=this.img_object.angle();if(deg<0)deg+=360;if(deg>=360)deg-=360;if(deg===this.img_object.angle())return;this.img_object.angle(deg);this.center();this._trigger("angle",0,{angle:this.img_object.angle()})},find_closest_zoom_rate:function(value){if(value==this.options.zoom_base)return 0;function div(val1,val2){return val1/val2}function mul(val1,val2){return val1*val2}var func=value>this.options.zoom_base?mul:div;var sgn=value>this.options.zoom_base?1:-1;var mltplr=
this.options.zoom_delta;var rate=1;while(Math.abs(func(this.options.zoom_base,Math.pow(mltplr,rate))-value)>Math.abs(func(this.options.zoom_base,Math.pow(mltplr,rate+1))-value))rate++;return sgn*rate},update_status:function(){if(!this.options.ui_disabled){var percent=Math.round(100*this.img_object.display_height()/this.img_object.orig_height());if(percent)this.zoom_object.html(percent+"%")}},info:function(param,withoutRotation){if(!param)return;switch(param){case "orig_width":case "orig_height":if(withoutRotation)return this.img_object.angle()%
180===0?this.img_object[param]():param==="orig_width"?this.img_object.orig_height():this.img_object.orig_width();else return this.img_object[param]();case "display_width":case "display_height":case "angle":return this.img_object[param]();case "zoom":return this.current_zoom;case "src":return this.img_object.object().attr("src");case "coords":return{x:this.img_object.x(),y:this.img_object.y()}}},_mouseStart:function(e){$.ui.mouse.prototype._mouseStart.call(this,e);if(this._trigger("onStartDrag",0,
this._getMouseCoords(e))===false)return false;this.container.addClass("iviewer_drag_cursor");this._dragInitialized=!(e.originalEvent.changedTouches&&e.originalEvent.changedTouches.length==1);this.dx=e.pageX-this.img_object.x();this.dy=e.pageY-this.img_object.y();return true},_mouseCapture:function(e){return true},_handleMouseMove:function(e){this._trigger("onMouseMove",e,this._getMouseCoords(e))},_mouseDrag:function(e){$.ui.mouse.prototype._mouseDrag.call(this,e);if(!this._dragInitialized){this.dx=
e.pageX-this.img_object.x();this.dy=e.pageY-this.img_object.y();this._dragInitialized=true}var ltop=e.pageY-this.dy;var lleft=e.pageX-this.dx;this.setCoords(lleft,ltop);this._trigger("onDrag",e,this._getMouseCoords(e));return false},_mouseStop:function(e){$.ui.mouse.prototype._mouseStop.call(this,e);this.container.removeClass("iviewer_drag_cursor");this._trigger("onStopDrag",0,this._getMouseCoords(e))},_click:function(e){this._trigger("onClick",0,this._getMouseCoords(e))},createui:function(){var me=
this;$("<div>",{"class":"iviewer_zoom_in iviewer_common iviewer_button"}).bind("mousedown touchstart",function(){me.zoom_by(1);return false}).appendTo(this.container);$("<div>",{"class":"iviewer_zoom_out iviewer_common iviewer_button"}).bind("mousedown touchstart",function(){me.zoom_by(-1);return false}).appendTo(this.container);$("<div>",{"class":"iviewer_zoom_zero iviewer_common iviewer_button"}).bind("mousedown touchstart",function(){me.set_zoom(100);return false}).appendTo(this.container);$("<div>",
{"class":"iviewer_zoom_fit iviewer_common iviewer_button"}).bind("mousedown touchstart",function(){me.fit(this);return false}).appendTo(this.container);this.zoom_object=$("<div>").addClass("iviewer_zoom_status iviewer_common").appendTo(this.container);$("<div>",{"class":"iviewer_rotate_left iviewer_common iviewer_button"}).bind("mousedown touchstart",function(){me.angle(-90);return false}).appendTo(this.container);$("<div>",{"class":"iviewer_rotate_right iviewer_common iviewer_button"}).bind("mousedown touchstart",
function(){me.angle(90);return false}).appendTo(this.container);this.update_status()}});$.ui.iviewer.ImageObject=function(do_anim){this._img=$("<img>").css({position:"absolute",top:"0px",left:"0px"});this._loaded=false;this._swapDimensions=false;this._do_anim=do_anim||false;this.x(0,true);this.y(0,true);this.angle(0)};(function(){this._reset=function(w,h){this._angle=0;this._swapDimensions=false;this.x(0);this.y(0);this.orig_width(w);this.orig_height(h);this.display_width(w);this.display_height(h)};
this.loaded=function(){return this._loaded};this.load=function(src,loaded,error){var self=this;loaded=loaded||jQuery.noop;this._loaded=false;var img=new Image;img.onload=function(){self._loaded=true;self._reset(this.width,this.height);self._img.removeAttr("width").removeAttr("height").removeAttr("style").css({position:"absolute",top:"0px",left:"0px",maxWidth:"none"});self._img[0].src=src;loaded()};img.onerror=error;setTimeout(function(){img.src=src},0);this.angle(0)};this._dimension=function(prefix,
name){var horiz="_"+prefix+"_"+name,vert="_"+prefix+"_"+(name==="height"?"width":"height");return setter(function(val){this[this._swapDimensions?horiz:vert]=val},function(){return this[this._swapDimensions?horiz:vert]})};this.display_width=this._dimension("display","width"),this.display_height=this._dimension("display","height"),this.display_diff=function(){return Math.floor(this.display_width()-this.display_height())};this.orig_width=this._dimension("orig","width"),this.orig_height=this._dimension("orig",
"height"),this.x=setter(function(val,skipCss){this._x=val;if(!skipCss){this._finishAnimation();this._img.css("left",this._x+(this._swapDimensions?this.display_diff()/2:0)+"px")}},function(){return this._x});this.y=setter(function(val,skipCss){this._y=val;if(!skipCss){this._finishAnimation();this._img.css("top",this._y-(this._swapDimensions?this.display_diff()/2:0)+"px")}},function(){return this._y});this.angle=setter(function(deg){var prevSwap=this._swapDimensions;this._angle=deg;this._swapDimensions=
deg%180!==0;if(prevSwap!==this._swapDimensions){var verticalMod=this._swapDimensions?-1:1;this.x(this.x()-verticalMod*this.display_diff()/2,true);this.y(this.y()+verticalMod*this.display_diff()/2,true)}var cssVal="rotate("+deg+"deg)",img=this._img;jQuery.each(["","-webkit-","-moz-","-o-","-ms-"],function(i,prefix){img.css(prefix+"transform",cssVal)});if(useIeTransforms){jQuery.each(["-ms-",""],function(i,prefix){img.css(prefix+"filter",ieTransforms[deg].filter)});img.css({marginLeft:ieTransforms[deg].marginLeft*
this.display_diff()/2,marginTop:ieTransforms[deg].marginTop*this.display_diff()/2})}},function(){return this._angle});this.toOriginalCoords=function(point){switch(this.angle()){case 0:return{x:point.x,y:point.y};case 90:return{x:point.y,y:this.display_width()-point.x};case 180:return{x:this.display_width()-point.x,y:this.display_height()-point.y};case 270:return{x:this.display_height()-point.y,y:point.x}}};this.toRealCoords=function(point){switch(this.angle()){case 0:return{x:this.x()+point.x,y:this.y()+
point.y};case 90:return{x:this.x()+this.display_width()-point.y,y:this.y()+point.x};case 180:return{x:this.x()+this.display_width()-point.x,y:this.y()+this.display_height()-point.y};case 270:return{x:this.x()+point.y,y:this.y()+this.display_height()-point.x}}};this.object=setter(jQuery.noop,function(){return this._img});this.setImageProps=function(disp_w,disp_h,x,y,skip_animation,complete){complete=complete||jQuery.noop;this.display_width(disp_w);this.display_height(disp_h);this.x(x,true);this.y(y,
true);var w=this._swapDimensions?disp_h:disp_w;var h=this._swapDimensions?disp_w:disp_h;var params={width:w,height:h,top:y-(this._swapDimensions?this.display_diff()/2:0)+"px",left:x+(this._swapDimensions?this.display_diff()/2:0)+"px"};if(useIeTransforms)jQuery.extend(params,{marginLeft:ieTransforms[this.angle()].marginLeft*this.display_diff()/2,marginTop:ieTransforms[this.angle()].marginTop*this.display_diff()/2});var swapDims=this._swapDimensions,img=this._img;if(useIeTransforms&&swapDims){var ieh=
this._img.width(),iew=this._img.height(),iedh=params.height-ieh;iedw=params.width-iew;delete params.width;delete params.height}if(this._do_anim&&!skip_animation)this._img.stop(true).animate(params,{duration:200,complete:complete,step:function(now,fx){if(useIeTransforms&&swapDims&&fx.prop==="top"){var percent=(now-fx.start)/(fx.end-fx.start);img.height(ieh+iedh*percent);img.width(iew+iedw*percent);img.css("top",now)}}});else{this._img.css(params);setTimeout(complete,0)}};this._finishAnimation=function(){this._img.stop(true,
true)}}).apply($.ui.iviewer.ImageObject.prototype);var util={scaleValue:function(value,toZoom){return value*toZoom/100},descaleValue:function(value,fromZoom){return value*100/fromZoom}}})(jQuery,undefined);
/branches/v0.3-aleaume/doc/PhpDoc/js/jquery.dotdotdot-1.5.9.min.js
New file
0,0 → 1,15
/*
* jQuery dotdotdot 1.5.9
*
* Copyright (c) 2013 Fred Heusschen
* www.frebsite.nl
*
* Plugin website:
* dotdotdot.frebsite.nl
*
* Dual licensed under the MIT and GPL licenses.
* http://en.wikipedia.org/wiki/MIT_License
* http://en.wikipedia.org/wiki/GNU_General_Public_License
*/
 
(function(a){function c(a,b,c){var d=a.children(),e=!1;a.empty();for(var g=0,h=d.length;h>g;g++){var i=d.eq(g);if(a.append(i),c&&a.append(c),f(a,b)){i.remove(),e=!0;break}c&&c.remove()}return e}function d(b,c,g,h,i){var j=b.contents(),k=!1;b.empty();for(var l="table, thead, tbody, tfoot, tr, col, colgroup, object, embed, param, ol, ul, dl, select, optgroup, option, textarea, script, style",m=0,n=j.length;n>m&&!k;m++){var o=j[m],p=a(o);void 0!==o&&(b.append(p),i&&b[b.is(l)?"after":"append"](i),3==o.nodeType?f(g,h)&&(k=e(p,c,g,h,i)):k=d(p,c,g,h,i),k||i&&i.remove())}return k}function e(a,b,c,d,h){var k=!1,l=a[0];if(l===void 0)return!1;for(var m="letter"==d.wrap?"":" ",n=j(l).split(m),o=-1,p=-1,q=0,r=n.length-1;r>=q;){var s=Math.floor((q+r)/2);if(s==p)break;p=s,i(l,n.slice(0,p+1).join(m)+d.ellipsis),f(c,d)?r=p:(o=p,q=p)}if(-1==o||1==n.length&&0==n[0].length){var u=a.parent();a.remove();var v=h?h.length:0;if(u.contents().size()>v){var w=u.contents().eq(-1-v);k=e(w,b,c,d,h)}else{var x=u.prev(),l=x.contents().eq(-1)[0];if(l!==void 0){var t=g(j(l),d);i(l,t),h&&x.append(h),u.remove(),k=!0}}}else{var t=g(n.slice(0,o+1).join(m),d);k=!0,i(l,t)}return k}function f(a,b){return a.innerHeight()>b.maxHeight}function g(b,c){for(;a.inArray(b.slice(-1),c.lastCharacter.remove)>-1;)b=b.slice(0,-1);return 0>a.inArray(b.slice(-1),c.lastCharacter.noEllipsis)&&(b+=c.ellipsis),b}function h(a){return{width:a.innerWidth(),height:a.innerHeight()}}function i(a,b){a.innerText?a.innerText=b:a.nodeValue?a.nodeValue=b:a.textContent&&(a.textContent=b)}function j(a){return a.innerText?a.innerText:a.nodeValue?a.nodeValue:a.textContent?a.textContent:""}function k(b,c){return b===void 0?!1:b?"string"==typeof b?(b=a(b,c),b.length?b:!1):"object"==typeof b?b.jquery===void 0?!1:b:!1:!1}function l(a){for(var b=a.innerHeight(),c=["paddingTop","paddingBottom"],d=0,e=c.length;e>d;d++){var f=parseInt(a.css(c[d]),10);isNaN(f)&&(f=0),b-=f}return b}function m(a,b){return a?(b="string"==typeof b?"dotdotdot: "+b:["dotdotdot:",b],window.console!==void 0&&window.console.log!==void 0&&window.console.log(b),!1):!1}if(!a.fn.dotdotdot){a.fn.dotdotdot=function(e){if(0==this.length)return e&&e.debug===!1||m(!0,'No element found for "'+this.selector+'".'),this;if(this.length>1)return this.each(function(){a(this).dotdotdot(e)});var g=this;g.data("dotdotdot")&&g.trigger("destroy.dot"),g.data("dotdotdot-style",g.attr("style")),g.css("word-wrap","break-word"),g.bind_events=function(){return g.bind("update.dot",function(b,e){b.preventDefault(),b.stopPropagation(),j.maxHeight="number"==typeof j.height?j.height:l(g),j.maxHeight+=j.tolerance,e!==void 0&&(("string"==typeof e||e instanceof HTMLElement)&&(e=a("<div />").append(e).contents()),e instanceof a&&(i=e)),q=g.wrapInner('<div class="dotdotdot" />').children(),q.empty().append(i.clone(!0)).css({height:"auto",width:"auto",border:"none",padding:0,margin:0});var h=!1,k=!1;return n.afterElement&&(h=n.afterElement.clone(!0),n.afterElement.remove()),f(q,j)&&(k="children"==j.wrap?c(q,j,h):d(q,g,q,j,h)),q.replaceWith(q.contents()),q=null,a.isFunction(j.callback)&&j.callback.call(g[0],k,i),n.isTruncated=k,k}).bind("isTruncated.dot",function(a,b){return a.preventDefault(),a.stopPropagation(),"function"==typeof b&&b.call(g[0],n.isTruncated),n.isTruncated}).bind("originalContent.dot",function(a,b){return a.preventDefault(),a.stopPropagation(),"function"==typeof b&&b.call(g[0],i),i}).bind("destroy.dot",function(a){a.preventDefault(),a.stopPropagation(),g.unwatch().unbind_events().empty().append(i).attr("style",g.data("dotdotdot-style")).data("dotdotdot",!1)}),g},g.unbind_events=function(){return g.unbind(".dot"),g},g.watch=function(){if(g.unwatch(),"window"==j.watch){var b=a(window),c=b.width(),d=b.height();b.bind("resize.dot"+n.dotId,function(){c==b.width()&&d==b.height()&&j.windowResizeFix||(c=b.width(),d=b.height(),p&&clearInterval(p),p=setTimeout(function(){g.trigger("update.dot")},10))})}else o=h(g),p=setInterval(function(){var a=h(g);(o.width!=a.width||o.height!=a.height)&&(g.trigger("update.dot"),o=h(g))},100);return g},g.unwatch=function(){return a(window).unbind("resize.dot"+n.dotId),p&&clearInterval(p),g};var i=g.contents(),j=a.extend(!0,{},a.fn.dotdotdot.defaults,e),n={},o={},p=null,q=null;return n.afterElement=k(j.after,g),n.isTruncated=!1,n.dotId=b++,g.data("dotdotdot",!0).bind_events().trigger("update.dot"),j.watch&&g.watch(),g},a.fn.dotdotdot.defaults={ellipsis:"... ",wrap:"word",lastCharacter:{remove:[" ",",",";",".","!","?"],noEllipsis:[]},tolerance:0,callback:null,after:null,height:null,watch:!1,windowResizeFix:!0,debug:!1};var b=1,n=a.fn.html;a.fn.html=function(a){return a!==void 0?this.data("dotdotdot")&&"function"!=typeof a?this.trigger("update",[a]):n.call(this,a):n.call(this)};var o=a.fn.text;a.fn.text=function(b){if(b!==void 0){if(this.data("dotdotdot")){var c=a("<div />");return c.text(b),b=c.html(),c.remove(),this.trigger("update",[b])}return o.call(this,b)}return o.call(this)}}})(jQuery);
/branches/v0.3-aleaume/doc/PhpDoc/js/prism.min.js
New file
0,0 → 1,16
/**
* Prism: Lightweight, robust, elegant syntax highlighting
* MIT license http://www.opensource.org/licenses/mit-license.php/
* @author Lea Verou http://lea.verou.me
*/(function(){var e=/\blang(?:uage)?-(?!\*)(\w+)\b/i,t=self.Prism={util:{type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},clone:function(e){var n=t.util.type(e);switch(n){case"Object":var r={};for(var i in e)e.hasOwnProperty(i)&&(r[i]=t.util.clone(e[i]));return r;case"Array":return e.slice()}return e}},languages:{extend:function(e,n){var r=t.util.clone(t.languages[e]);for(var i in n)r[i]=n[i];return r},insertBefore:function(e,n,r,i){i=i||t.languages;var s=i[e],o={};for(var u in s)if(s.hasOwnProperty(u)){if(u==n)for(var a in r)r.hasOwnProperty(a)&&(o[a]=r[a]);o[u]=s[u]}return i[e]=o},DFS:function(e,n){for(var r in e){n.call(e,r,e[r]);t.util.type(e)==="Object"&&t.languages.DFS(e[r],n)}}},highlightAll:function(e,n){var r=document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code');for(var i=0,s;s=r[i++];)t.highlightElement(s,e===!0,n)},highlightElement:function(r,i,s){var o,u,a=r;while(a&&!e.test(a.className))a=a.parentNode;if(a){o=(a.className.match(e)||[,""])[1];u=t.languages[o]}if(!u)return;r.className=r.className.replace(e,"").replace(/\s+/g," ")+" language-"+o;a=r.parentNode;/pre/i.test(a.nodeName)&&(a.className=a.className.replace(e,"").replace(/\s+/g," ")+" language-"+o);var f=r.textContent;if(!f)return;f=f.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ");var l={element:r,language:o,grammar:u,code:f};t.hooks.run("before-highlight",l);if(i&&self.Worker){var c=new Worker(t.filename);c.onmessage=function(e){l.highlightedCode=n.stringify(JSON.parse(e.data),o);t.hooks.run("before-insert",l);l.element.innerHTML=l.highlightedCode;s&&s.call(l.element);t.hooks.run("after-highlight",l)};c.postMessage(JSON.stringify({language:l.language,code:l.code}))}else{l.highlightedCode=t.highlight(l.code,l.grammar,l.language);t.hooks.run("before-insert",l);l.element.innerHTML=l.highlightedCode;s&&s.call(r);t.hooks.run("after-highlight",l)}},highlight:function(e,r,i){return n.stringify(t.tokenize(e,r),i)},tokenize:function(e,n,r){var i=t.Token,s=[e],o=n.rest;if(o){for(var u in o)n[u]=o[u];delete n.rest}e:for(var u in n){if(!n.hasOwnProperty(u)||!n[u])continue;var a=n[u],f=a.inside,l=!!a.lookbehind,c=0;a=a.pattern||a;for(var h=0;h<s.length;h++){var p=s[h];if(s.length>e.length)break e;if(p instanceof i)continue;a.lastIndex=0;var d=a.exec(p);if(d){l&&(c=d[1].length);var v=d.index-1+c,d=d[0].slice(c),m=d.length,g=v+m,y=p.slice(0,v+1),b=p.slice(g+1),w=[h,1];y&&w.push(y);var E=new i(u,f?t.tokenize(d,f):d);w.push(E);b&&w.push(b);Array.prototype.splice.apply(s,w)}}}return s},hooks:{all:{},add:function(e,n){var r=t.hooks.all;r[e]=r[e]||[];r[e].push(n)},run:function(e,n){var r=t.hooks.all[e];if(!r||!r.length)return;for(var i=0,s;s=r[i++];)s(n)}}},n=t.Token=function(e,t){this.type=e;this.content=t};n.stringify=function(e,r,i){if(typeof e=="string")return e;if(Object.prototype.toString.call(e)=="[object Array]")return e.map(function(t){return n.stringify(t,r,e)}).join("");var s={type:e.type,content:n.stringify(e.content,r,i),tag:"span",classes:["token",e.type],attributes:{},language:r,parent:i};s.type=="comment"&&(s.attributes.spellcheck="true");t.hooks.run("wrap",s);var o="";for(var u in s.attributes)o+=u+'="'+(s.attributes[u]||"")+'"';return"<"+s.tag+' class="'+s.classes.join(" ")+'" '+o+">"+s.content+"</"+s.tag+">"};if(!self.document){self.addEventListener("message",function(e){var n=JSON.parse(e.data),r=n.language,i=n.code;self.postMessage(JSON.stringify(t.tokenize(i,t.languages[r])));self.close()},!1);return}var r=document.getElementsByTagName("script");r=r[r.length-1];if(r){t.filename=r.src;document.addEventListener&&!r.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",t.highlightAll)}})();;
Prism.languages.markup={comment:/&lt;!--[\w\W]*?-->/g,prolog:/&lt;\?.+?\?>/,doctype:/&lt;!DOCTYPE.+?>/,cdata:/&lt;!\[CDATA\[[\w\W]*?]]>/i,tag:{pattern:/&lt;\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|\w+))?\s*)*\/?>/gi,inside:{tag:{pattern:/^&lt;\/?[\w:-]+/i,inside:{punctuation:/^&lt;\/?/,namespace:/^[\w-]+?:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/gi,inside:{punctuation:/=|>|"/g}},punctuation:/\/?>/g,"attr-name":{pattern:/[\w:-]+/g,inside:{namespace:/^[\w-]+?:/}}}},entity:/&amp;#?[\da-z]{1,8};/gi};Prism.hooks.add("wrap",function(e){e.type==="entity"&&(e.attributes.title=e.content.replace(/&amp;/,"&"))});;
Prism.languages.css={comment:/\/\*[\w\W]*?\*\//g,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*{))/gi,inside:{punctuation:/[;:]/g}},url:/url\((["']?).*?\1\)/gi,selector:/[^\{\}\s][^\{\};]*(?=\s*\{)/g,property:/(\b|\B)[\w-]+(?=\s*:)/ig,string:/("|')(\\?.)*?\1/g,important:/\B!important\b/gi,ignore:/&(lt|gt|amp);/gi,punctuation:/[\{\};:]/g};Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{style:{pattern:/(&lt;|<)style[\w\W]*?(>|&gt;)[\w\W]*?(&lt;|<)\/style(>|&gt;)/ig,inside:{tag:{pattern:/(&lt;|<)style[\w\W]*?(>|&gt;)|(&lt;|<)\/style(>|&gt;)/ig,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.css}}});;
Prism.languages.css.selector={pattern:/[^\{\}\s][^\{\}]*(?=\s*\{)/g,inside:{"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/g,"pseudo-class":/:[-\w]+(?:\(.*\))?/g,"class":/\.[-:\.\w]+/g,id:/#[-:\.\w]+/g}};Prism.languages.insertBefore("css","ignore",{hexcode:/#[\da-f]{3,6}/gi,entity:/\\[\da-f]{1,8}/gi,number:/[\d%\.]+/g,"function":/(attr|calc|cross-fade|cycle|element|hsla?|image|lang|linear-gradient|matrix3d|matrix|perspective|radial-gradient|repeating-linear-gradient|repeating-radial-gradient|rgba?|rotatex|rotatey|rotatez|rotate3d|rotate|scalex|scaley|scalez|scale3d|scale|skewx|skewy|skew|steps|translatex|translatey|translatez|translate3d|translate|url|var)/ig});;
Prism.languages.clike={comment:{pattern:/(^|[^\\])(\/\*[\w\W]*?\*\/|(^|[^:])\/\/.*?(\r?\n|$))/g,lookbehind:!0},string:/("|')(\\?.)*?\1/g,"class-name":{pattern:/((?:(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/ig,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|catch|finally|null|break|continue)\b/g,"boolean":/\b(true|false)\b/g,"function":{pattern:/[a-z0-9_]+\(/ig,inside:{punctuation:/\(/}}, number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,operator:/[-+]{1,2}|!|&lt;=?|>=?|={1,3}|(&amp;){1,2}|\|?\||\?|\*|\/|\~|\^|\%/g,ignore:/&(lt|gt|amp);/gi,punctuation:/[{}[\];(),.:]/g};;
Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(var|let|if|else|while|do|for|return|in|instanceof|function|new|with|typeof|try|catch|finally|null|break|continue)\b/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?|NaN|-?Infinity)\b/g});Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/g,lookbehind:!0}});Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/(&lt;|<)script[\w\W]*?(>|&gt;)[\w\W]*?(&lt;|<)\/script(>|&gt;)/ig,inside:{tag:{pattern:/(&lt;|<)script[\w\W]*?(>|&gt;)|(&lt;|<)\/script(>|&gt;)/ig,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.javascript}}});;
Prism.languages.php=Prism.languages.extend("clike",{keyword:/\b(and|or|xor|array|as|break|case|cfunction|class|const|continue|declare|default|die|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|for|foreach|function|include|include_once|global|if|new|return|static|switch|use|require|require_once|var|while|abstract|interface|public|implements|extends|private|protected|parent|static|throw|null|echo|print|trait|namespace|use|final|yield|goto|instanceof|finally|try|catch)\b/ig, constant:/\b[A-Z0-9_]{2,}\b/g});Prism.languages.insertBefore("php","keyword",{delimiter:/(\?>|&lt;\?php|&lt;\?)/ig,variable:/(\$\w+)\b/ig,"package":{pattern:/(\\|namespace\s+|use\s+)[\w\\]+/g,lookbehind:!0,inside:{punctuation:/\\/}}});Prism.languages.insertBefore("php","operator",{property:{pattern:/(->)[\w]+/g,lookbehind:!0}}); Prism.languages.markup&&(Prism.hooks.add("before-highlight",function(a){"php"===a.language&&(a.tokenStack=[],a.code=a.code.replace(/(?:&lt;\?php|&lt;\?|<\?php|<\?)[\w\W]*?(?:\?&gt;|\?>)/ig,function(b){a.tokenStack.push(b);return"{{{PHP"+a.tokenStack.length+"}}}"}))}),Prism.hooks.add("after-highlight",function(a){if("php"===a.language){for(var b=0,c;c=a.tokenStack[b];b++)a.highlightedCode=a.highlightedCode.replace("{{{PHP"+(b+1)+"}}}",Prism.highlight(c,a.grammar,"php"));a.element.innerHTML=a.highlightedCode}}), Prism.hooks.add("wrap",function(a){"php"===a.language&&"markup"===a.type&&(a.content=a.content.replace(/(\{\{\{PHP[0-9]+\}\}\})/g,'<span class="token php">$1</span>'))}),Prism.languages.insertBefore("php","comment",{markup:{pattern:/(&lt;|<)[^?]\/?(.*?)(>|&gt;)/g,inside:Prism.languages.markup},php:/\{\{\{PHP[0-9]+\}\}\}/g}));;
Prism.languages.insertBefore("php","variable",{"this":/\$this/g,global:/\$_?(GLOBALS|SERVER|GET|POST|FILES|REQUEST|SESSION|ENV|COOKIE|HTTP_RAW_POST_DATA|argc|argv|php_errormsg|http_response_header)/g,scope:{pattern:/\b[\w\\]+::/g,inside:{keyword:/(static|self|parent)/,punctuation:/(::|\\)/}}});;
(function(){function e(e,t){return Array.prototype.slice.call((t||document).querySelectorAll(e))}function n(e,t,n){var r=t.replace(/\s+/g,"").split(","),i=+e.getAttribute("data-line-offset")||0,s=parseFloat(getComputedStyle(e).lineHeight);for(var o=0,u;u=r[o++];){u=u.split("-");var a=+u[0],f=+u[1]||a,l=document.createElement("div");l.textContent=Array(f-a+2).join(" \r\n");l.className=(n||"")+" line-highlight";l.setAttribute("data-start",a);f>a&&l.setAttribute("data-end",f);l.style.top=(a-i-1)*s+"px";(e.querySelector("code")||e).appendChild(l)}}function r(){var t=location.hash.slice(1);e(".temporary.line-highlight").forEach(function(e){e.parentNode.removeChild(e)});var r=(t.match(/\.([\d,-]+)$/)||[,""])[1];if(!r||document.getElementById(t))return;var i=t.slice(0,t.lastIndexOf(".")),s=document.getElementById(i);if(!s)return;s.hasAttribute("data-line")||s.setAttribute("data-line","");n(s,r,"temporary ");document.querySelector(".temporary.line-highlight").scrollIntoView()}if(!window.Prism)return;var t=crlf=/\r?\n|\r/g,i=0;Prism.hooks.add("after-highlight",function(t){var s=t.element.parentNode,o=s&&s.getAttribute("data-line");if(!s||!o||!/pre/i.test(s.nodeName))return;clearTimeout(i);e(".line-highlight",s).forEach(function(e){e.parentNode.removeChild(e)});n(s,o);i=setTimeout(r,1)});addEventListener("hashchange",r)})();;
Prism.hooks.add("after-highlight",function(e){var t=e.element.parentNode;if(!t||!/pre/i.test(t.nodeName)||t.className.indexOf("line-numbers")===-1){return}var n=1+e.code.split("\n").length;var r;lines=new Array(n);lines=lines.join("<span></span>");r=document.createElement("span");r.className="line-numbers-rows";r.innerHTML=lines;if(t.hasAttribute("data-start")){t.style.counterReset="linenumber "+(parseInt(t.getAttribute("data-start"),10)-1)}e.element.appendChild(r)})
;
(function(){if(!self.Prism||!self.document||!document.querySelector)return;var e={js:"javascript",html:"markup",svg:"markup"};Array.prototype.slice.call(document.querySelectorAll("pre[data-src]")).forEach(function(t){var n=t.getAttribute("data-src"),r=(n.match(/\.(\w+)$/)||[,""])[1],i=e[r]||r,s=document.createElement("code");s.className="language-"+i;t.textContent="";s.textContent="Loading…";t.appendChild(s);var o=new XMLHttpRequest;o.open("GET",n,!0);o.onreadystatechange=function(){if(o.readyState==4)if(o.status<400&&o.responseText){s.textContent=o.responseText;Prism.highlightElement(s)}else o.status>=400?s.textContent="✖ Error "+o.status+" while fetching file: "+o.statusText:s.textContent="✖ Error: File does not exist or is empty"};o.send(null)})})();;
/branches/v0.3-aleaume/doc/PhpDoc/js/jquery.smooth-scroll.js
New file
0,0 → 1,32
$(document).ready(function() {
function filterPath(string) {
return string
.replace(/^\//,'')
.replace(/(index|default).[a-zA-Z]{3,4}$/,'')
.replace(/\/$/,'');
}
var locationPath = filterPath(location.pathname);
 
$('a[href*=#]').each(function() {
var thisPath = filterPath(this.pathname) || locationPath;
if ( locationPath == thisPath
&& (location.hostname == this.hostname || !this.hostname)
&& this.hash.replace(/#/,'') ) {
var $target = $(this.hash), target = this.hash;
if (target) {
$(this).click(function(event) {
if (!$(this.hash).offset()) {
return;
}
 
event.preventDefault();
position = $(this.hash).offset().top;
 
$('html,body').animate({scrollTop: position}, 400, function() {
location.hash = target;
});
});
}
}
});
});