12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- /* ajouter un lien lors de copie/colle */
- function addLink() {
- var body_element = document.getElementsByTagName('body')[0];
- var selection;
- selection = window.getSelection();
- var pagelink = " Lire plus sur : <a href='"+document.location.href+"'>"+document.location.href+"</a>"; // change this if you want
- var copytext = selection + pagelink;
- var newdiv = document.createElement('div');
- body_element.appendChild(newdiv);
- newdiv.innerHTML = copytext;
- selection.selectAllChildren(newdiv);
- window.setTimeout(function() {
- body_element.removeChild(newdiv);
- },0);
- }
- /* afficher / masquer un div */
- function showhideme(id) {
- shown = document.getElementById(id).style.display;
- if (shown == 'block') shown2 = 'none'; else shown2 = 'block';
- document.getElementById(id).style.display=shown2;
- }
- function MM_openBrWindow(theURL,winName,features) {
- window.open(theURL,winName,features);
- }
- function confirmeAction(message){
- reponse = confirm(message);return reponse;
- }
- function confirmeSupprime(){
- reponse = confirm("Etes-vous certain de vouloir supprimer cette ressource ?");return reponse;
- }
- /* AJAX */
- function sendData(page, div)
- {
- if(document.all) var XhrObj = new ActiveXObject("Microsoft.XMLHTTP") ;
- else var XhrObj = new XMLHttpRequest();
- var content = document.getElementById(div);
- XhrObj.open("POST", page);
- XhrObj.onreadystatechange = function(){
- if (XhrObj.readyState == 4 && XhrObj.status == 200)
- content.innerHTML = XhrObj.responseText ;
- }
- XhrObj.setRequestHeader('Content-type', 'application/x-www-form-urlencoded; charset=iso-8859-1');
- XhrObj.send(null);
- }
- function sendData2(page, div, laclass)
- {
- if(document.all) var XhrObj = new ActiveXObject("Microsoft.XMLHTTP") ;
- else var XhrObj = new XMLHttpRequest();
- var content = document.getElementById(div);
- XhrObj.open("GET", page);
- XhrObj.onreadystatechange = function(){
- if (XhrObj.readyState == 4 && XhrObj.status == 200) content.innerHTML = XhrObj.responseText;
- else content.innerHTML = "<div class=\"" + laclass + "\">Chargement...</div>";
- }
- XhrObj.setRequestHeader('Content-type', 'application/x-www-form-urlencoded; charset=iso-8859-1');
- XhrObj.send(null);
- }
- function fillbox (valeur, zone, div)
- {
- document.getElementById(zone).value = valeur;
- sendData('stop.php', div);
- }
|