Plus de rangement
Control freaking
This commit is contained in:
parent
9c16c152da
commit
c65be5f9fb
7 changed files with 69 additions and 5 deletions
Binary file not shown.
Before Width: | Height: | Size: 957 KiB |
Before Width: | Height: | Size: 125 KiB After Width: | Height: | Size: 125 KiB |
|
@ -1,14 +1,15 @@
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<!-- un jour, on pourrait ajouter un relai snowflake -->
|
<!-- un jour, on pourrait ajouter un relai snowflake -->
|
||||||
|
<!-- un jour, on pourrait ajouter miroir en .oignon -->
|
||||||
<html lang="fr">
|
<html lang="fr">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>La Distorsion</title>
|
<title>La Distorsion</title>
|
||||||
|
|
||||||
<link href="styles/simple.css" rel="stylesheet" title="Simple" />
|
<link href="css/simple.css" rel="stylesheet" title="Simple" />
|
||||||
<link href="styles/darkmagenta.css" rel="alternate stylesheet" title="Darkmagenta" />
|
<link href="css/darkmagenta.css" rel="alternate stylesheet" title="Darkmagenta" />
|
||||||
|
|
||||||
<script src="styleswitcher.js"></script>
|
<script src="js/styleswitcher.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>La Distorsion</h1>
|
<h1>La Distorsion</h1>
|
||||||
|
@ -26,7 +27,7 @@
|
||||||
|
|
||||||
<h2>Site en (dé)construction</h2>
|
<h2>Site en (dé)construction</h2>
|
||||||
|
|
||||||
<img src="construction-opti.webp" alt="un super gif de déconstruction">
|
<img src="img/construction-opti.webp" alt="un super gif de déconstruction">
|
||||||
|
|
||||||
<h2>Les trucs à venir</h2>
|
<h2>Les trucs à venir</h2>
|
||||||
|
|
||||||
|
|
64
site/js/styleswitcher.js
Normal file
64
site/js/styleswitcher.js
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
function setActiveStyleSheet(title) {
|
||||||
|
var i, a, main;
|
||||||
|
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
|
||||||
|
if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
|
||||||
|
a.disabled = true;
|
||||||
|
if(a.getAttribute("title") == title) a.disabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getActiveStyleSheet() {
|
||||||
|
var i, a;
|
||||||
|
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
|
||||||
|
if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPreferredStyleSheet() {
|
||||||
|
var i, a;
|
||||||
|
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
|
||||||
|
if(a.getAttribute("rel").indexOf("style") != -1
|
||||||
|
&& a.getAttribute("rel").indexOf("alt") == -1
|
||||||
|
&& a.getAttribute("title")
|
||||||
|
) return a.getAttribute("title");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function createCookie(name,value,days) {
|
||||||
|
if (days) {
|
||||||
|
var date = new Date();
|
||||||
|
date.setTime(date.getTime()+(days*24*60*60*1000));
|
||||||
|
var expires = "; expires="+date.toGMTString();
|
||||||
|
}
|
||||||
|
else expires = "";
|
||||||
|
document.cookie = name+"="+value+expires+"; path=/";
|
||||||
|
}
|
||||||
|
|
||||||
|
function readCookie(name) {
|
||||||
|
var nameEQ = name + "=";
|
||||||
|
var ca = document.cookie.split(';');
|
||||||
|
for(var i=0;i < ca.length;i++) {
|
||||||
|
var c = ca[i];
|
||||||
|
while (c.charAt(0)==' ') c = c.substring(1,c.length);
|
||||||
|
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.onload = function(e) {
|
||||||
|
var cookie = readCookie("style");
|
||||||
|
var title = cookie ? cookie : getPreferredStyleSheet();
|
||||||
|
setActiveStyleSheet(title);
|
||||||
|
}
|
||||||
|
|
||||||
|
window.onunload = function(e) {
|
||||||
|
var title = getActiveStyleSheet();
|
||||||
|
createCookie("style", title, 365);
|
||||||
|
}
|
||||||
|
|
||||||
|
var cookie = readCookie("style");
|
||||||
|
var title = cookie ? cookie : getPreferredStyleSheet();
|
||||||
|
setActiveStyleSheet(title);
|
|
@ -1 +0,0 @@
|
||||||
function setActiveStyleSheet(title) {
var i, a, main;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
a.disabled = true;
if(a.getAttribute("title") == title) a.disabled = false;
}
}
}
function getActiveStyleSheet() {
var i, a;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
}
return null;
}
function getPreferredStyleSheet() {
var i, a;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1
&& a.getAttribute("rel").indexOf("alt") == -1
&& a.getAttribute("title")
) return a.getAttribute("title");
}
return null;
}
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
window.onload = function(e) {
var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);
}
window.onunload = function(e) {
var title = getActiveStyleSheet();
createCookie("style", title, 365);
}
var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);
|
|
Loading…
Add table
Reference in a new issue