|
| 1 | +function listfiles(domelement,folder){ |
| 2 | + files = []; |
| 3 | + var httpcimages = new XMLHttpRequest(); |
| 4 | + httpcimages.onreadystatechange = function() { |
| 5 | + if (this.readyState == 4 && this.status == 200) { |
| 6 | + files = JSON.parse(this.responseText); |
| 7 | + var locallinks = []; |
| 8 | + var oldlinks = domelement.getElementsByTagName("A"); |
| 9 | + for(var index = 0;index < oldlinks.length;index++){ |
| 10 | + locallinks.push(oldlinks[index]); |
| 11 | + } |
| 12 | + for(var index = 0;index < files.length;index++){ |
| 13 | + var newa = document.createElement("A"); |
| 14 | + newa.href = folder + "/" + files[index]; |
| 15 | + newa.innerHTML = files[index]; |
| 16 | + domelement.appendChild(newa); |
| 17 | + locallinks.push(newa); |
| 18 | + } |
| 19 | + rainbow(locallinks); |
| 20 | + } |
| 21 | + }; |
| 22 | + httpcimages.open("GET", "dir.php?filename=" + folder, true); |
| 23 | + httpcimages.send(); |
| 24 | + |
| 25 | +} |
| 26 | + |
| 27 | +function rlistfiles(domelement,folder){ |
| 28 | + files = []; |
| 29 | + var httpcimages = new XMLHttpRequest(); |
| 30 | + httpcimages.onreadystatechange = function() { |
| 31 | + if (this.readyState == 4 && this.status == 200) { |
| 32 | + files = JSON.parse(this.responseText); |
| 33 | + var locallinks = []; |
| 34 | + var oldlinks = domelement.getElementsByTagName("A"); |
| 35 | + for(var index = 0;index < oldlinks.length;index++){ |
| 36 | + locallinks.push(oldlinks[index]); |
| 37 | + } |
| 38 | + for(var index = 0;index < files.length;index++){ |
| 39 | + var newa = document.createElement("A"); |
| 40 | + newa.href = files[index]; |
| 41 | + newa.innerHTML = files[index]; |
| 42 | + domelement.appendChild(newa); |
| 43 | + locallinks.push(newa); |
| 44 | + } |
| 45 | + rainbow(locallinks); |
| 46 | + } |
| 47 | + }; |
| 48 | + httpcimages.open("GET", "rdir.php?filename=" + folder, true); |
| 49 | + httpcimages.send(); |
| 50 | + |
| 51 | +} |
| 52 | + |
| 53 | +function googleyeyes(n){ |
| 54 | + var square = 1; |
| 55 | + if(innerWidth > innerHeight){ |
| 56 | + square = innerHeight; |
| 57 | + } |
| 58 | + else{ |
| 59 | + square = innerWidth; |
| 60 | + } |
| 61 | + for(var index = 0;index < n;index++){ |
| 62 | + var eye = document.createElement("DIV"); |
| 63 | + eye.style.position = "absolute"; |
| 64 | + eye.style.borderRadius = "50%"; |
| 65 | + eye.style.border = "solid"; |
| 66 | + eye.style.backgroundColor = "white"; |
| 67 | + eye.style.zIndex = "-1"; |
| 68 | + var pupil = document.createElement("DIV"); |
| 69 | + pupil.style.position = "absolute"; |
| 70 | + pupil.style.borderRadius = "50%"; |
| 71 | + pupil.style.border = "solid"; |
| 72 | + pupil.style.backgroundColor = "black"; |
| 73 | + pupil.style.zIndex = "0"; |
| 74 | + eyesize = Math.round(0.2*Math.random()*square); |
| 75 | + if(eyesize < 20){ |
| 76 | + eyesize = 20; |
| 77 | + } |
| 78 | + eyeleft = Math.round(Math.random()*innerWidth); |
| 79 | + eyetop = Math.round(Math.random()*innerHeight); |
| 80 | + |
| 81 | + eye.style.width = eyesize.toString() + "px"; |
| 82 | + eye.style.height = eyesize.toString() + "px"; |
| 83 | + if(eyetop > innerHeight - eyesize - 30){ |
| 84 | + eyetop = innerHeight - eyesize - 30; |
| 85 | + } |
| 86 | + if(eyeleft > innerWidth - eyesize - 30){ |
| 87 | + eyeleft = innerWidth - eyesize - 30; |
| 88 | + } |
| 89 | + |
| 90 | + eye.style.top = eyetop.toString() + "px"; |
| 91 | + eye.style.left = eyeleft.toString() + "px"; |
| 92 | + |
| 93 | + |
| 94 | + pupil.style.width = (0.3*eyesize).toString() + "px"; |
| 95 | + pupil.style.height = (0.3*eyesize).toString() + "px"; |
| 96 | + |
| 97 | + pupilleft = Math.round(0.7*Math.random()*eyesize); |
| 98 | + pupiltop = Math.round(0.7*Math.random()*eyesize); |
| 99 | + pupil.style.left = pupilleft.toString() + "px"; |
| 100 | + pupil.style.top = pupiltop.toString() + "px"; |
| 101 | + |
| 102 | + eye.appendChild(pupil); |
| 103 | + |
| 104 | + document.body.appendChild(eye); |
| 105 | + |
| 106 | + } |
| 107 | +} |
| 108 | + |
| 109 | +function listimages(domelement,folder){ |
| 110 | + |
| 111 | + images = []; |
| 112 | + var httpcimages = new XMLHttpRequest(); |
| 113 | + httpcimages.onreadystatechange = function() { |
| 114 | + if (this.readyState == 4 && this.status == 200) { |
| 115 | + images = JSON.parse(this.responseText); |
| 116 | + for(var index = 0;index < images.length;index++){ |
| 117 | + var newimg = document.createElement("IMG"); |
| 118 | + newimg.src = folder + "/" + images[index]; |
| 119 | + domelement.appendChild(newimg); |
| 120 | + } |
| 121 | + } |
| 122 | + }; |
| 123 | + httpcimages.open("GET", "dir.php?filename=" + folder, true); |
| 124 | + httpcimages.send(); |
| 125 | + |
| 126 | +} |
| 127 | + |
| 128 | + |
| 129 | +function rainbowstring(localelement){ |
| 130 | + text = localelement.innerHTML; |
| 131 | + localelement.innerHTML = ""; |
| 132 | + n = text.length; |
| 133 | + for(var index = 0; index < n; index++){ |
| 134 | + var newspan = document.createElement("SPAN"); |
| 135 | + newspan.innerHTML = text.charAt(index); |
| 136 | + |
| 137 | + H = index*360/n; |
| 138 | + z = 255*(1 - Math.abs((H/60)%2 - 1)); |
| 139 | + |
| 140 | + if(H < 60){ |
| 141 | + red = 255; |
| 142 | + green = Math.round(z); |
| 143 | + blue = 0; |
| 144 | + } |
| 145 | + if(H >= 60 && H < 120){ |
| 146 | + red = Math.round(z); |
| 147 | + green = 255; |
| 148 | + blue = 0; |
| 149 | + } |
| 150 | + if(H >= 120 && H < 180){ |
| 151 | + red = 0; |
| 152 | + green = 255; |
| 153 | + blue = Math.round(z); |
| 154 | + } |
| 155 | + if(H >= 180 && H < 240){ |
| 156 | + red = 0; |
| 157 | + green = Math.round(z); |
| 158 | + blue = 255; |
| 159 | + } |
| 160 | + if(H >= 240 && H < 300){ |
| 161 | + red = Math.round(z); |
| 162 | + green = 0; |
| 163 | + blue = 255; |
| 164 | + } |
| 165 | + if(H >= 300 && H < 360){ |
| 166 | + red = 255; |
| 167 | + green = 0; |
| 168 | + blue = Math.round(z); |
| 169 | + } |
| 170 | + |
| 171 | + redstring = red.toString(16); |
| 172 | + if(redstring.length < 2){ |
| 173 | + redstring = "0" + redstring; |
| 174 | + } |
| 175 | + greenstring = green.toString(16); |
| 176 | + if(greenstring.length < 2){ |
| 177 | + greenstring = "0" + greenstring; |
| 178 | + } |
| 179 | + bluestring = blue.toString(16); |
| 180 | + if(bluestring.length < 2){ |
| 181 | + bluestring = "0" + bluestring; |
| 182 | + } |
| 183 | + color = "#" + redstring + greenstring + bluestring; |
| 184 | + newspan.style.color = color; |
| 185 | + localelement.appendChild(newspan); |
| 186 | + } |
| 187 | + |
| 188 | + |
| 189 | +} |
| 190 | +function rainbow(localarray){ |
| 191 | + n = localarray.length; |
| 192 | + theta = 0; |
| 193 | + for(var index = 0;index < n;index++){ |
| 194 | + |
| 195 | + H = index*360/n; |
| 196 | + z = 255*(1 - Math.abs((H/60)%2 - 1)); |
| 197 | + |
| 198 | + if(H < 60){ |
| 199 | + red = 255; |
| 200 | + green = Math.round(z); |
| 201 | + blue = 0; |
| 202 | + } |
| 203 | + if(H >= 60 && H < 120){ |
| 204 | + red = Math.round(z); |
| 205 | + green = 255; |
| 206 | + blue = 0; |
| 207 | + } |
| 208 | + if(H >= 120 && H < 180){ |
| 209 | + red = 0; |
| 210 | + green = 255; |
| 211 | + blue = Math.round(z); |
| 212 | + } |
| 213 | + if(H >= 180 && H < 240){ |
| 214 | + red = 0; |
| 215 | + green = Math.round(z); |
| 216 | + blue = 255; |
| 217 | + } |
| 218 | + if(H >= 240 && H < 300){ |
| 219 | + red = Math.round(z); |
| 220 | + green = 0; |
| 221 | + blue = 255; |
| 222 | + } |
| 223 | + if(H >= 300 && H < 360){ |
| 224 | + red = 255; |
| 225 | + green = 0; |
| 226 | + blue = Math.round(z); |
| 227 | + } |
| 228 | + |
| 229 | + redstring = red.toString(16); |
| 230 | + if(redstring.length < 2){ |
| 231 | + redstring = "0" + redstring; |
| 232 | + } |
| 233 | + greenstring = green.toString(16); |
| 234 | + if(greenstring.length < 2){ |
| 235 | + greenstring = "0" + greenstring; |
| 236 | + } |
| 237 | + bluestring = blue.toString(16); |
| 238 | + if(bluestring.length < 2){ |
| 239 | + bluestring = "0" + bluestring; |
| 240 | + } |
| 241 | + color = "#" + redstring + greenstring + bluestring; |
| 242 | + //console.log(color); |
| 243 | + localarray[index].style.backgroundColor = color;// + "80"; |
| 244 | + localarray[index].style.borderColor = color; |
| 245 | + } |
| 246 | +} |
0 commit comments