...
 
Commits (3)
......@@ -42,24 +42,24 @@ $( document ).ready(function() {
/* #########################################################################
# Load and append SVG file
######################################################################### */
var s = Snap("#map");
//var s = Snap("#map");
//Have Snap load the SVG file; use optimized and minimized file for web
//Snap.load('res/tub_floorplan.svg', onSVGLoaded );
Snap.load('res/tub_floorplan.min.svg', onSVGLoaded );
function onSVGLoaded( svg ) {
s.append( svg );
setTimeout(function(){
//Snap.load('res/tub_floorplan.min.svg', onSVGLoaded );
//function onSVGLoaded( svg ) {
// s.append( svg );
// setTimeout(function(){
// Interesting theory (?), why "0" - obviously - still makes a difference https://stackoverflow.com/a/41893544
console.log('Short delay to recalculate dimensions AFTER appending svg content (https://collaborating.tuhh.de/tobias.zeumer/tub-floorplan/issues/25)');
onSVGappended();
}, 0);
}
// console.log('Short delay to recalculate dimensions AFTER appending svg content (https://collaborating.tuhh.de/tobias.zeumer/tub-floorplan/issues/25)');
// onSVGappended();
// }, 0);
// }
/* #########################################################################
# Everything that relies on the svg being loaded
######################################################################### */
function onSVGappended(){
// function onSVGappended(){
// Remove any inline styles (since Inkscape just keeps adding them; https://bugs.launchpad.net/inkscape/+bug/167937)
// Get default styles from webStyles.css
$('.mainlayer').find('*').removeAttr('style');
......@@ -182,7 +182,7 @@ $( document ).ready(function() {
event.stopPropagation(); // Prevent modal being closed immediately
// tmp: use svg description for shelves as title
var aria_title = $(this).children("desc").text();
var aria_title = $(this).children("desc").text().trim();
$(this).attr('title', aria_title);
......@@ -367,7 +367,7 @@ $( document ).ready(function() {
// SVG READY END
}
// }
/* #########################################################################
......
@echo off
:: Deploy with php (should be available everywhere)
php deploy.php
:: -----------------------------------------------------------------------------
:: Or convert with this batch (without creating html output); remove REM's
:: -----------------------------------------------------------------------------
:: Install SVGO
:: npm install -g svgo
:: Default
REM echo .
REM echo Default minimizing to tub_floorplan.min.svg
REM call svgo -i tub_floorplan.svg -o tub_floorplan.min.svg --config ./conf-svgo/tubmap.yml
:: Readable
REM echo .
REM echo .
REM echo Readable minimizing to tub_floorplan.min-pretty.svg
REM call svgo -i tub_floorplan.svg -o tub_floorplan.min-pretty.svg --config ./conf-svgo/tubmap.yml --pretty
REM echo .
REM echo .
start /b cmd /k
<?php
// Create minimized SVG
echo "1. Default minimizing to tub_floorplan.min.svg\n";
exec("svgo -i tub_floorplan.svg -o tub_floorplan.min.svg --config ./conf-svgo/tubmap.yml");
// Create minimized SVG, but still readable
echo "2. Readable minimizing to tub_floorplan.min-pretty.svg\n";
exec("svgo -i tub_floorplan.svg -o tub_floorplan.min-pretty.svg --config ./conf-svgo/tubmap.yml --pretty");
// Load SVG and page
echo "3. Load tub_floorplan.min.svg and index.html\n";
$svg = file_get_contents('tub_floorplan.min.svg');
$html = file_get_contents('index.html');
// Inject SVG into page
echo "4, Create output.html with svg included file\n";
$out = str_replace('<!--SVG-INJECT-->', $svg, $html);
file_put_contents('output.html', $out);
?>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
@echo off
:: Install SVGO
:: npm install -g svgo
:: Default
echo .
echo Default minimizing to tub_floorplan.min.svg
call svgo -i tub_floorplan.svg -o tub_floorplan.min.svg --config ./conf-svgo/tubmap.yml
:: Readable
echo .
echo .
echo Readable minimizing to tub_floorplan.min-pretty.svg
call svgo -i tub_floorplan.svg -o tub_floorplan.min-pretty.svg --config ./conf-svgo/tubmap.yml --pretty
echo .
echo .
start /b cmd /k