From bb56dfe6aa024ce67a1c88fb1305c8138c9b2844 Mon Sep 17 00:00:00 2001 From: Florent Bruneau Date: Sat, 6 Nov 2010 21:27:29 +0100 Subject: [PATCH] Move header javascript to xorg.js. Signed-off-by: Florent Bruneau --- htdocs/javascript/xorg.js | 63 ++++++++++++++++++++++---------- templates/skin/common.title.header.tpl | 66 ++++++++++++++-------------------- 2 files changed, 71 insertions(+), 58 deletions(-) diff --git a/htdocs/javascript/xorg.js b/htdocs/javascript/xorg.js index ccc9c0b..532e696 100644 --- a/htdocs/javascript/xorg.js +++ b/htdocs/javascript/xorg.js @@ -21,23 +21,29 @@ 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'] + var hr = dt.getHours(); + var mi = dt.getMinutes(); + if (mi < 10) { + mi = '0' + mi; + } + var se = dt.getSeconds(); + if (se < 10) { + se = '0' + se; + } - return days[dy]+' '+wd+' '+months[mh]+' '+yr+'
'+time; + $(".date-heure").html(days[dy] + ' ' + wd + ' ' + months[mh] + ' ' + yr + '
' + + hr + ':' + mi + ':' + se); } // }}} @@ -205,10 +211,10 @@ function goodiesPopup(node, goodies) { // {{{ function auto_links() function auto_links() { - url = document.URL; - fqdn = url.replace(/^https?:\/\/([^\/]*)\/.*$/,'$1'); - light = (url.indexOf('display=light') > url.indexOf('?')); - resource_page = (url.indexOf('rss') > -1 || url.indexOf('ical') > -1); + var url = document.URL; + var fqdn = url.replace(/^https?:\/\/([^\/]*)\/.*$/,'$1'); + var light = (url.indexOf('display=light') > url.indexOf('?')); + var resource_page = (url.indexOf('rss') > -1 || url.indexOf('ical') > -1); $("a,link").each( function(i) { @@ -359,6 +365,27 @@ function checkPassword(box, okLabel) { * The real OnLoad */ -$(document).ready(auto_links); +$(document).ready(function() { + auto_links(); + getNow(); + setInterval(getNow, 1000); + $("#quick") + .focus(function() { + if ($(this).val() === 'Recherche dans l\'annuaire') { + $(this).val(''); + } + $("#quick_button").show(); + }) + .blur(function() { + $("#quick_button").hide(); + }); + $("#quick_button").click(function() { + if ($("#quick").val() === 'Recherche dans l\'annuaire' + || $("#quick").val() === '') { + return false; + } + return true; + }); +}); // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: diff --git a/templates/skin/common.title.header.tpl b/templates/skin/common.title.header.tpl index 4075c5b..8102455 100644 --- a/templates/skin/common.title.header.tpl +++ b/templates/skin/common.title.header.tpl @@ -19,44 +19,30 @@ {* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *} {* *} {**************************************************************************} - - - - - - -
- - {$globals->core->NbIns|number_format} polytechniciens sur le web - {if t($smarty.request.quick)} - {assign var=requestQuick value=$smarty.request.quick|smarty:nodefaults} - {else} - {assign var=requestQuick value='Recherche dans l\'annuaire'} - {/if} -
-
- - -
-
- {if $smarty.session.auth gt AUTH_PUBLIC && $smarty.session.notifs} - {$smarty.session.notifs} événement{if $smarty.session.notifs gt 1}s{/if} - {/if} -
+ + + + + + +
+ {$globals->core->NbIns|number_format} polytechniciens sur le web + {if t($smarty.request.quick)} + {assign var=requestQuick value=$smarty.request.quick} + {else} + {assign var=requestQuick value='Recherche dans l\'annuaire'} + {/if} +
+
+ + +
+
+ {if $smarty.session.auth gt AUTH_PUBLIC && $smarty.session.notifs} + {$smarty.session.notifs} événement{if $smarty.session.notifs gt 1}s{/if} + {/if} +
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} -- 2.1.4