[SPIP] +2.1.12
[velocampus/web/www.git] / www / squelettes / inc-theme-head.html
1 [<link rel="stylesheet" href="(#CHEMIN{css/slidernav.css})" type="text/css" media="projection, screen, tv" />]
2 [<link rel="stylesheet" href="(#CHEMIN{css/style_maparaan.css}|direction_css)" type="text/css" media="projection, screen, tv" />]
3
4 <script type="text/javascript">
5 // menulang sur clic
6 // author : erational <http://www.erational.org>
7 $(document).ready(function(){
8 $(".formulaire_menu_lang").hide(); // on cache le menu_lang
9
10 $(".cookie_lang").click( function() { // sur les liens qui possedent la classe cookie_lang, on pose le cookie de leur attribut rel.
11 var lang = $(this).attr("rel");
12 $(".formulaire_menu_lang form option").removeAttr("selected");
13 $(".formulaire_menu_lang form option[@value='"+lang+"']").attr("selected","selected");
14 $(".formulaire_menu_lang form").submit();
15 return false;
16 });
17
18 });
19 </script>
20
21 <script type="text/javascript">
22
23 // JavaScript Document
24 /* Smooth scrolling */
25
26 var ss = {
27 fixAllLinks: function() {
28 // Get a list of all links in the page
29 var allLinks = document.getElementsByTagName('a');
30 // Walk through the list
31 for (var i=0;i<allLinks.length;i++) {
32 var lnk = allLinks[i];
33 if ((lnk.href && lnk.href.indexOf('#') != -1) &&
34 ( (lnk.pathname == location.pathname) ||
35 ('/'+lnk.pathname == location.pathname) ) &&
36 (lnk.search == location.search)) {
37 // If the link is internal to the page (begins in #)
38 // then attach the smoothScroll function as an onclick
39 // event handler
40 ss.addEvent(lnk,'click',ss.smoothScroll);
41 }
42 }
43 },
44
45 smoothScroll: function(e) {
46 // This is an event handler; get the clicked on element,
47 // in a cross-browser fashion
48 if (window.event) {
49 target = window.event.srcElement;
50 } else if (e) {
51 target = e.target;
52 } else return;
53
54 // Make sure that the target is an element, not a text node
55 // within an element
56 if (target.nodeName.toLowerCase() != 'a') {
57 target = target.parentNode;
58 }
59
60 // Paranoia; check this is an A tag
61 if (target.nodeName.toLowerCase() != 'a') return;
62
63 // Find the <a name> tag corresponding to this href
64 // First strip off the hash (first character)
65 anchor = target.hash.substr(1);
66 // Now loop all A tags until we find one with that name
67 var allLinks = document.getElementsByTagName('a');
68 var destinationLink = null;
69 for (var i=0;i<allLinks.length;i++) {
70 var lnk = allLinks[i];
71 if (lnk.name && (lnk.name == anchor)) {
72 destinationLink = lnk;
73 break;
74 }
75 }
76
77 // If we didn't find a destination, give up and let the browser do
78 // its thing
79 if (!destinationLink) return true;
80
81 // Find the destination's position
82 var destx = destinationLink.offsetLeft;
83 var desty = destinationLink.offsetTop;
84 var thisNode = destinationLink;
85 while (thisNode.offsetParent &&
86 (thisNode.offsetParent != document.body)) {
87 thisNode = thisNode.offsetParent;
88 destx += thisNode.offsetLeft;
89 desty += thisNode.offsetTop;
90 }
91
92 // Stop any current scrolling
93 clearInterval(ss.INTERVAL);
94
95 cypos = ss.getCurrentYPos();
96
97 ss_stepsize = parseInt((desty-cypos)/ss.STEPS);
98 ss.INTERVAL =
99 setInterval('ss.scrollWindow('+ss_stepsize+','+desty+',"'+anchor+'")',10);
100
101 // And stop the actual click happening
102 if (window.event) {
103 window.event.cancelBubble = true;
104 window.event.returnValue = false;
105 }
106 if (e && e.preventDefault && e.stopPropagation) {
107 e.preventDefault();
108 e.stopPropagation();
109 }
110 },
111
112 scrollWindow: function(scramount,dest,anchor) {
113 wascypos = ss.getCurrentYPos();
114 isAbove = (wascypos < dest);
115 window.scrollTo(0,wascypos + scramount);
116 iscypos = ss.getCurrentYPos();
117 isAboveNow = (iscypos < dest);
118 if ((isAbove != isAboveNow) || (wascypos == iscypos)) {
119 // if we've just scrolled past the destination, or
120 // we haven't moved from the last scroll (i.e., we're at the
121 // bottom of the page) then scroll exactly to the link
122 window.scrollTo(0,dest);
123 // cancel the repeating timer
124 clearInterval(ss.INTERVAL);
125 // and jump to the link directly so the URL's right
126 location.hash = anchor;
127 }
128 },
129
130 getCurrentYPos: function() {
131 if (document.body && document.body.scrollTop)
132 return document.body.scrollTop;
133 if (document.documentElement && document.documentElement.scrollTop)
134 return document.documentElement.scrollTop;
135 if (window.pageYOffset)
136 return window.pageYOffset;
137 return 0;
138 },
139
140 addEvent: function(elm, evType, fn, useCapture) {
141 // addEvent and removeEvent
142 // cross-browser event handling for IE5+, NS6 and Mozilla
143 // By Scott Andrew
144 if (elm.addEventListener){
145 elm.addEventListener(evType, fn, useCapture);
146 return true;
147 } else if (elm.attachEvent){
148 var r = elm.attachEvent("on"+evType, fn);
149 return r;
150 } else {
151 alert("Handler could not be removed");
152 }
153 }
154 }
155
156 ss.STEPS = 25;
157
158 ss.addEvent(window,"load",ss.fixAllLinks);
159 </script>