X-Git-Url: https://scm.cri.minesparis.psl.eu/git/Plinn.git/blobdiff_plain/f4fc9ed779ba87bd6ed11ee48fd84b920f9de30c..9f74f9ce0087b9e2406458847fb7e68863a7be2a:/skins/ajax_scripts/javascript_events_api.js

diff --git a/skins/ajax_scripts/javascript_events_api.js b/skins/ajax_scripts/javascript_events_api.js
index 127ac6f..b4df40e 100644
--- a/skins/ajax_scripts/javascript_events_api.js
+++ b/skins/ajax_scripts/javascript_events_api.js
@@ -1,4 +1,4 @@
-// (c) Benoît PIN 2006-2009
+// (c) Benoît PIN 2006-2014
 // http://plinn.org
 // Licence GPL
 // 
@@ -6,7 +6,7 @@
 // Meta functions for events management.
 
 var addListener; /* (ob, eventName, listenerFunction, group) add event listener eventName without "on" prefix.
-				 *  optionally, listeners can be grouped to make removing convenient.
+				 *	optionally, listeners can be grouped to make removing convenient.
 				 */
 var removeListener; // (ob, eventName, listenerFunction, group) remove event listener.
 var removeGroupListeners; // (group) remove all listeners in group.
@@ -29,7 +29,7 @@ var getCopyOfNode; /* (node) returns a clone of the given node.
 
 var copyPrototype; // (descendant, parent) lightwheight javascript inheritance
 if (!history.pushState) {
-    history.pushState = function(){};
+	history.pushState = function(){};
 }
 
 (function(){
@@ -45,6 +45,8 @@ function buildMetaFunctions() {
 	disablePropagation = _build_disablePropagation();
 	getWindowWidth = _build_getWindowWidth();
 	getWindowHeight = _build_getWindowHeight();
+	getWindowScrollX = _build_getWindowScrollX();
+	getWindowScrollY = _build_getWindowScrollY();
 	clearSelection = _build_clearSelection();
 }
 
@@ -210,6 +212,32 @@ function _build_getWindowHeight() {
 	}
 }
 
+function _build_getWindowScrollX() {
+	if (window.scrollX !== undefined) {
+		return function(){
+			return window.scrollX;
+		};
+	}
+	else {
+		return function(){
+			return document.body.scrollLeft;
+		};
+	}
+}
+
+function _build_getWindowScrollY() {
+	if (window.scrollY !== undefined) {
+		return function(){
+			return window.scrollY;
+		};
+	}
+	else {
+		return function(){
+			return document.body.scrollTop;
+		};
+	}
+}
+
 function _build_clearSelection() {
 	if (document.selection) {
 		return function() {
@@ -226,12 +254,12 @@ function _build_clearSelection() {
 buildMetaFunctions();
 
 addListener(window, 'load', function(evt) {
-    // html5 facade
-    if (!document.body.classList) {
-        var nop = function(){};
-        var fakeDOMTokenList = {'length':0, 'item':nop, 'contains':nop, 'add':nop, 'remove':nop, 'toggle':nop}
-        Element.prototype.classList = fakeDOMTokenList;
-    }
+	// html5 facade
+	if (!document.body.classList) {
+		var nop = function(){};
+		var fakeDOMTokenList = {'length':0, 'item':nop, 'contains':nop, 'add':nop, 'remove':nop, 'toggle':nop};
+		Element.prototype.classList = fakeDOMTokenList;
+	}
 });