Gestion de la coloration svg 'in-url'
This commit is contained in:
parent
49d35f828e
commit
190610a032
|
@ -168,7 +168,7 @@
|
||||||
display: block;
|
display: block;
|
||||||
margin: 1em;
|
margin: 1em;
|
||||||
color: #333;
|
color: #333;
|
||||||
white-space: nowrap;
|
// white-space: nowrap;
|
||||||
|
|
||||||
// svg (icone)
|
// svg (icone)
|
||||||
svg{
|
svg{
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
32
index.php
32
index.php
|
@ -37,14 +37,46 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* [2] Gestion du routage
|
/* [2] Gestion du routage
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
|
|
||||||
|
|
||||||
/* (1) On initialise le routeur
|
/* (1) On initialise le routeur
|
||||||
---------------------------------------------------------*/
|
---------------------------------------------------------*/
|
||||||
$R = new Router( $_GET['url'] );
|
$R = new Router( $_GET['url'] );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* (2) Gestion des SVG avec couleur modifiée */
|
||||||
|
// path/to/resource/filename-HEXADE.svg
|
||||||
|
$R->get('(.+)@([a-f0-9]{6})(\.svg)', function($matches){
|
||||||
|
$path = __ROOT__.'/'.$matches[0].$matches[2];
|
||||||
|
|
||||||
|
header('Content-Type: image/svg+xml');
|
||||||
|
|
||||||
|
// On crée la partie ajoutée
|
||||||
|
$stylesheet = "\n<style type='text/css'>\n";
|
||||||
|
$stylesheet .= "\t#stylisable{\n";
|
||||||
|
$stylesheet .= "\t\tfill: #".$matches[1]." !important;\n";
|
||||||
|
$stylesheet .= "\t\tfill-opacity: 1 !important;\n";
|
||||||
|
$stylesheet .= "\t}\n";
|
||||||
|
$stylesheet .= "</style></svg>";
|
||||||
|
|
||||||
|
// On récupère le fichier
|
||||||
|
$file = file_get_contents($path);
|
||||||
|
|
||||||
|
// On ajoute le style
|
||||||
|
$file = str_replace('</svg>', $stylesheet, $file);
|
||||||
|
|
||||||
|
echo $file;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* (3) On cree les regles de routage QUAND ON EST CONNECTE
|
/* (3) On cree les regles de routage QUAND ON EST CONNECTE
|
||||||
---------------------------------------------------------*/
|
---------------------------------------------------------*/
|
||||||
/* (2) Si on est connecté */
|
/* (2) Si on est connecté */
|
||||||
|
|
Loading…
Reference in New Issue