X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=htdocs%2Fjavascript%2Fxorg.js;h=d804403d8b0876ae66b4a10562dfc43a1bd9910d;hb=6a686adb39d65e4472497f4ce69f0314085cead3;hp=0e5f5d0f016d3501768204a444c140eb26873d52;hpb=08fa70684fd1332178cddb6b318151335fb4506c;p=platal.git
diff --git a/htdocs/javascript/xorg.js b/htdocs/javascript/xorg.js
index 0e5f5d0..d804403 100644
--- a/htdocs/javascript/xorg.js
+++ b/htdocs/javascript/xorg.js
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2003-2008 Polytechnique.org *
+ * Copyright (C) 2003-2010 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -18,27 +18,32 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-var is_netscape = (navigator.appName.substring(0,8) == "Netscape");
-var is_IE = (navigator.appName.substring(0,9) == "Microsoft");
+var is_IE = $.browser.msie;
// {{{ function getNow()
+var days = ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'];
+var months = ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet',
+ 'août', 'septembre', 'octobre', 'novembre', 'décembre']
function getNow() {
- dt = new Date();
- dy = dt.getDay();
- mh = dt.getMonth();
- wd = dt.getDate();
- yr = dt.getYear();
+ var dt = new Date();
+ var dy = dt.getDay();
+ var mh = dt.getMonth();
+ var wd = dt.getDate();
+ var yr = dt.getYear();
if (yr<1000) yr += 1900;
- hr = dt.getHours();
- mi = dt.getMinutes();
-
- time = (mi < 10) ? hr +':0'+mi : hr+':'+mi;
- days = ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'];
- months = ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet',
- 'août', 'septembre', 'octobre', 'novembre', 'décembre']
-
- return days[dy]+' '+wd+' '+months[mh]+' '+yr+'
'+time;
+ var hr = dt.getHours();
+ var mi = dt.getMinutes();
+ if (mi < 10) {
+ mi = '0' + mi;
+ }
+ var se = dt.getSeconds();
+ if (se < 10) {
+ se = '0' + se;
+ }
+
+ $(".date-heure").html(days[dy] + ' ' + wd + ' ' + months[mh] + ' ' + yr + '
'
+ + hr + ':' + mi + ':' + se);
}
// }}}
@@ -46,51 +51,29 @@ function getNow() {
function canAddSearchEngine()
{
- if (((typeof window.sidebar == "object") && (typeof window.sidebar.addSearchEngine == "function"))
- || ((typeof window.sidebar == "object") && (typeof window.sidebar.addSearchEngine == "function"))) {
- return true;
- }
- return false;
+ if (((typeof window.sidebar == "object") && $.isFunction(window.sidebar.addSearchEngine))
+ || ((typeof window.external == "object") && $.isFunction(window.external.AddSearchProvider))) {
+ return true;
+ }
+ return false;
}
function addSearchEngine()
{
- var searchURI = "http://www.polytechnique.org/xorg.opensearch.xml";
- if ((typeof window.sidebar == "object") && (typeof window.sidebar.addSearchEngine == "function")) {
- window.sidebar.addSearchEngine(
- searchURI,
- "http://www.polytechnique.org/images/xorg.png",
- "Annuaire Polytechnique.org",
- "Academic");
- } else {
- try {
- window.external.AddSearchProvider(searchURI);
- } catch(e) {
- alert("Impossible d'installer la barre de recherche");
+ var searchURI = "http://www.polytechnique.org/xorg.opensearch.xml";
+ if ((typeof window.sidebar == "object") && $.isFunction(window.sidebar.addSearchEngine)) {
+ window.sidebar.addSearchEngine(
+ searchURI,
+ "http://www.polytechnique.org/images/xorg.png",
+ "Annuaire Polytechnique.org",
+ "Academic");
+ } else {
+ try {
+ window.external.AddSearchProvider(searchURI);
+ } catch(e) {
+ alert("Impossible d'installer la barre de recherche");
+ }
}
- }
-}
-
-// }}}
-// {{{ Events
-
-function eventClosure(obj, methodName) {
- return (function(e) {
- e = e || window.event;
- return obj[methodName](e);
- });
-}
-
-function attachEvent(obj, evt, f, useCapture) {
- if (!useCapture) useCapture = false;
-
- if (obj.addEventListener) {
- obj.addEventListener(evt, f, useCapture);
- return true;
- } else if (obj.attachEvent) {
- return obj.attachEvent("on"+evt, f);
- }
- return false;
}
// }}}
@@ -98,13 +81,11 @@ function attachEvent(obj, evt, f, useCapture) {
function dynpost(action, values)
{
- var body = document.getElementsByTagName('body')[0];
-
var form = document.createElement('form');
form.action = action;
form.method = 'post';
- body.appendChild(form);
+ $('body').get(0).appendChild(form);
for (var k in values) {
var input = document.createElement('input');
@@ -117,6 +98,7 @@ function dynpost(action, values)
form.submit();
}
+
function dynpostkv(action, k, v)
{
var dict = {};
@@ -149,133 +131,362 @@ RegExp.escape = function(text) {
// {{{ function popWin()
-function popWin(theNode,w,h) {
+function popWin(theNode, w, h) {
window.open(theNode.href, '_blank',
- 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width='+w+',height='+h);
+ 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width='+w+',height='+h);
+ return false;
}
// }}}
// {{{ function goodiesPopup()
-function goodiesPopup(node) {
- if (node.href.indexOf('ical') > -1) {
- __goodies_popup(node, __goodies_ical_sites, 'Calendrier iCal');
- } else if (node.href.indexOf('rss') > -1 && (node.href.indexOf('xml') > -1 || node.href.indexOf('hash'))) {
- __goodies_popup(node, __goodies_rss_sites, 'Fil rss');
- }
+var __goodies_active = true;
+
+var __goodies_ical = {
+ default_title: 'Calendrier iCal',
+ sites: [
+ {'url_prefix': '',
+ 'img': 'images/icons/calendar_view_day.gif',
+ 'title': 'Calendrier iCal'},
+ {'url_prefix': 'http://www.google.com/calendar/render?cid=',
+ 'img': 'images/goodies/add-google-calendar.gif',
+ 'title': 'Ajouter à Google Calendar'},
+ {'url_prefix': 'https://www.google.com/calendar/hosted/polytechnique.org/render?cid=',
+ 'img': 'images/goodies/add-google-calendar.gif',
+ 'title': 'Ajouter à Google Apps / Calendar'}
+ ]
+};
+
+var __goodies_rss = {
+ default_title: 'Fils RSS',
+ sites: [
+ {'url_prefix': '',
+ 'img': 'images/icons/feed.gif',
+ 'title': 'Fil rss'},
+ {'url_prefix': 'http://fusion.google.com/add?feedurl=',
+ 'img': 'images/goodies/add-google.gif',
+ 'alt': 'Add to Google',
+ 'title': 'Ajouter à iGoogle/Google Reader'},
+ {'url_prefix': 'http://www.netvibes.com/subscribe.php?url=',
+ 'img': 'images/goodies/add-netvibes.gif',
+ 'title': 'Ajouter à Netvibes'},
+ {'url_prefix': 'http://add.my.yahoo.com/content?.intl=fr&url=',
+ 'img': 'images/goodies/add-yahoo.gif',
+ 'alt': 'Add to My Yahoo!',
+ 'title': 'Ajouter à My Yahoo!'}
+ ]
+};
+
+function disableGoodiesPopups() {
+ __goodies_active = false;
}
-var __goodies_ical_sites = [
- {'url_prefix': '',
- 'img': 'images/icons/calendar_view_day.gif',
- 'title': 'Calendrier iCal'},
- {'url_prefix': 'http://www.google.com/calendar/render?cid=',
- 'img': 'images/goodies/add-google-calendar.gif',
- 'title': 'Ajouter à Google Calendar'}
-];
-var __goodies_rss_sites = [
- {'url_prefix': '',
- 'img': 'images/icons/feed.gif',
- 'title': 'Fil rss'},
- {'url_prefix': 'http://fusion.google.com/add?feedurl=',
- 'img': 'images/goodies/add-google.gif',
- 'alt': 'Add to Google',
- 'title': 'Ajouter à iGoogle/Google Reader'},
- {'url_prefix': 'http://www.netvibes.com/subscribe.php?url=',
- 'img': 'images/goodies/add-netvibes.gif',
- 'title': 'Ajouter à Netvibes'},
- {'url_prefix': 'http://add.my.yahoo.com/content?.intl=fr&url=',
- 'img': 'images/goodies/add-yahoo.gif',
- 'alt': 'Add to My Yahoo!',
- 'title': 'Ajouter à My Yahoo!'}
-];
-
-function __goodies_popupText(url, sites) {
+function goodiesPopup(node, goodies) {
var text = '