[ Index ] |
|
Code source de Dotclear 1.2.5 |
1 /* ***** BEGIN LICENSE BLOCK ***** 2 * This file is part of DotClear. 3 * Copyright (c) 2004 Olivier Meunier and contributors. All rights 4 * reserved. 5 * 6 * DotClear is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * DotClear is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with DotClear; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * 20 * ***** END LICENSE BLOCK ***** */ 21 22 /*img = new Image; 23 img.src = 'images/moins.png';*/ 24 25 function getE(id) 26 { 27 if(document.getElementById) { 28 return document.getElementById(id); 29 } else if(document.all) { 30 return document.all[id]; 31 } else return; 32 } 33 34 function openClose(id,mode) 35 { 36 element = getE(id); 37 img = getE('img_'+id); 38 39 if(element.style) { 40 if(mode == 0) { 41 if(element.style.display == 'block' ) { 42 element.style.display = 'none'; 43 img.src = 'images/plus.png'; 44 } else { 45 element.style.display = 'block'; 46 img.src = 'images/moins.png'; 47 } 48 } else if(mode == 1) { 49 element.style.display = 'block'; 50 img.src = 'images/moins.png'; 51 } else if(mode == -1) { 52 element.style.display = 'none'; 53 img.src = 'images/plus.png'; 54 } 55 } 56 } 57 58 function mOpenClose(idArray,mode) 59 { 60 for(var i=0;i<idArray.length;i++) { 61 openClose(idArray[i],mode); 62 } 63 } 64 65 function popup(url) 66 { 67 window.open(url,'dc_popup', 68 'alwaysRaised=yes,dependent=yes,toolbar=no,height=420,width=500,menubar=no,resizable=yes,scrollbars=yes,status=no'); 69 } 70 71 function limitArea(e,limit) 72 { 73 if (e.value.length > limit) { 74 e.value = e.value.substring(0,limit); 75 } 76 } 77 78 function createCookie(name,value) { 79 document.cookie = name+"="+value+";path=/;"; 80 } 81 82 function readCookie(name) { 83 var nameEQ = name + "="; 84 var ca = document.cookie.split(';'); 85 for(var i=0;i < ca.length;i++) { 86 var c = ca[i]; 87 while (c.charAt(0)==' ') c = c.substring(1,c.length); 88 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); 89 } 90 return null; 91 } 92 93 function openCloseOptions(id,cookie_name,mode) 94 { 95 if (mode != null) { 96 openClose(id,mode); 97 98 e = getE(id); 99 if (e.style.display == 'block') { 100 cookie_value = '1'; 101 } else { 102 cookie_value = '-1'; 103 } 104 105 createCookie(cookie_name,cookie_value); 106 } else { 107 cookie = readCookie(cookie_name); 108 if (!cookie) { 109 cookie = -1 110 } 111 openClose(id,cookie); 112 } 113 } 114 115 function setNow() 116 { 117 var now = new Date(); 118 var y = now.getFullYear(); 119 var m = now.getMonth(); 120 var d = now.getDate(); 121 var h = now.getHours(); 122 var i = now.getMinutes(); 123 var s = now.getSeconds(); 124 125 if (m.length == 1) { 126 m = '0'+m; 127 } 128 129 e = getE('p_dt_y'); 130 e.value = y; 131 e = getE('p_dt_m'); 132 e.selectedIndex = m; 133 e = getE('p_dt_d'); 134 e.value = d; 135 e = getE('p_dt_h'); 136 e.value = h; 137 e = getE('p_dt_i'); 138 e.value = i; 139 e = getE('p_dt_s'); 140 e.value = s; 141 } 142 143 function str2url(str,encoding,ucfirst) 144 { 145 str = str.toUpperCase(); 146 str = str.toLowerCase(); 147 148 str = str.replace(/[\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5]/g,'a'); 149 str = str.replace(/[\u00E7]/g,'c'); 150 str = str.replace(/[\u00E8\u00E9\u00EA\u00EB]/g,'e'); 151 str = str.replace(/[\u00EC\u00ED\u00EE\u00EF]/g,'i'); 152 str = str.replace(/[\u00F2\u00F3\u00F4\u00F5\u00F6\u00F8]/g,'o'); 153 str = str.replace(/[\u00F9\u00FA\u00FB\u00FC]/g,'u'); 154 str = str.replace(/[\u00FD\u00FF]/g,'y'); 155 str = str.replace(/[\u00F1]/g,'n'); 156 str = str.replace(/[\u0153]/g,'oe'); 157 str = str.replace(/[\u00E6]/g,'ae'); 158 str = str.replace(/[\u00DF]/g,'ss'); 159 160 str = str.replace(/[^a-z0-9_\s\'\:\/\[\]-]/g,''); 161 str = trim(str); 162 str = str.replace(/[\s\'\:\/\[\]-]+/g,' '); 163 str = str.replace(/[ ]/g,'-'); 164 165 if (ucfirst == 1) { 166 c = str.charAt(0); 167 str = c.toUpperCase()+str.slice(1); 168 } 169 170 return str; 171 } 172 173 function trim(s) { 174 s = s.replace(/[ ]*$/,''); 175 s = s.replace(/^[ ]*/,''); 176 return s; 177 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Feb 23 21:40:15 2007 | par Balluche grâce à PHPXref 0.7 |