Skip to content
Browse files

Added simple script to generate production ready code

  • Loading branch information...
1 parent 14302bf commit 5486de8f05b033a0390c08e3ef0f79bdb8219ece @bjornd committed
Showing with 185 additions and 8 deletions.
  1. +13 −0 gacode
  2. +1 −8 index.html → index-dev.html
  3. +83 −0 index-prod.html
  4. +83 −0 index-prod.html-e
  5. +5 −0 production.sh
View
13 gacode
@@ -0,0 +1,13 @@
+<script type="text/javascript">
+
+ var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', 'UA-20607161-6']);
+ _gaq.push(['_trackPageview']);
+
+ (function() {
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+ })();
+
+</script>
View
9 index.html → index-dev.html
@@ -11,14 +11,7 @@
<script src="jvectormap/jquery-jvectormap.min.js"></script>
<script src="js/jquery-ui-1.9.1.custom.min.js"></script>
<script src="js/app.js"></script>
- <script>
- $(function(){
- $.get('map-sample.svg', function(response){
- $('#input-source').val(response);
- }, 'text');
- app();
- });
- </script>
+%gacode%
</head>
<body>
<div id="card-input" class="card">
View
83 index-prod.html
@@ -0,0 +1,83 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <title>SVG to jVectorMap converter</title>
+ <link href="jvectormap/jquery-jvectormap.css" rel="stylesheet" media="all"/>
+ <link href="css/style.css" rel="stylesheet" media="all"/>
+ <link href="css/jquery-ui-1.9.1.custom.min.css" rel="stylesheet" media="all"/>
+ <script src="js/knockout-2.2.0.js"></script>
+ <script src="js/jquery-1.8.2.min.js"></script>
+ <script src="jvectormap/jquery-jvectormap.min.js"></script>
+ <script src="js/jquery-ui-1.9.1.custom.min.js"></script>
+ <script src="js/app.js"></script>
+
+<script type="text/javascript">
+
+ var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', 'UA-20607161-6']);
+ _gaq.push(['_trackPageview']);
+
+ (function() {
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+ })();
+
+</script>
+</head>
+<body>
+ <div id="card-input" class="card">
+ <div class="card-header">Paste SVG code</div>
+ <div class="card-content">
+ <div id="input-id-attribute"><label>Id attribute:</label><input value="id"/></div>
+ <div id="input-name-attribute"><label>Name attribute:</label><input value="title"/></div>
+ <textarea id="input-source"></textarea>
+ </div>
+ <div class="card-footer">
+ <button id="input-convert">Convert to map</button>
+ </div>
+ </div>
+ <div id="card-settings" class="card">
+ <div class="card-header">Settings</div>
+ <div class="card-content">
+ <div id="settings-panel">
+ <label>Map name: <input type="text" value="map" id="setting-map-name"/></label>
+ <label>Region parameters:</label>
+ <div id="settings-table">
+ <table cellpadding="0" cellspacing="0" width="100%">
+ <thead>
+ <tr class="header">
+ <th>id</th>
+ <th>name</th>
+ </tr>
+ </thead>
+ <tbody data-bind="foreach: map.paths">
+ <tr data-bind="attr: {'data-region-id': originalId}">
+ <td data-bind="text: id"></td>
+ <td data-bind="text: name"></td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ <div id="settings-divider"></div>
+ <div id="settings-map"></div>
+ </div>
+ <div class="card-footer">
+ <button id="setting-save">Save</button>
+ </div>
+ </div>
+ <div id="card-save" class="card">
+ <div class="card-header">Copy map source</div>
+ <div class="card-content">
+ <textarea id="save-source"></textarea>
+ </div>
+ <div class="card-footer"></div>
+ </div>
+ <div id="edit-dialog">
+ <div><label for="edit-dialog-id">Id</label><input id="edit-dialog-id"/></div>
+ <div><label for="edit-dialog-name">Name</label><input id="edit-dialog-name"/></div>
+ </div>
+</body>
+</html>
View
83 index-prod.html-e
@@ -0,0 +1,83 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <title>SVG to jVectorMap converter</title>
+ <link href="jvectormap/jquery-jvectormap.css" rel="stylesheet" media="all"/>
+ <link href="css/style.css" rel="stylesheet" media="all"/>
+ <link href="css/jquery-ui-1.9.1.custom.min.css" rel="stylesheet" media="all"/>
+ <script src="js/knockout-2.2.0.js"></script>
+ <script src="js/jquery-1.8.2.min.js"></script>
+ <script src="jvectormap/jquery-jvectormap.min.js"></script>
+ <script src="js/jquery-ui-1.9.1.custom.min.js"></script>
+ <script src="js/app.js"></script>
+%gacode%
+<script type="text/javascript">
+
+ var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', 'UA-20607161-6']);
+ _gaq.push(['_trackPageview']);
+
+ (function() {
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+ })();
+
+</script>
+</head>
+<body>
+ <div id="card-input" class="card">
+ <div class="card-header">Paste SVG code</div>
+ <div class="card-content">
+ <div id="input-id-attribute"><label>Id attribute:</label><input value="id"/></div>
+ <div id="input-name-attribute"><label>Name attribute:</label><input value="title"/></div>
+ <textarea id="input-source"></textarea>
+ </div>
+ <div class="card-footer">
+ <button id="input-convert">Convert to map</button>
+ </div>
+ </div>
+ <div id="card-settings" class="card">
+ <div class="card-header">Settings</div>
+ <div class="card-content">
+ <div id="settings-panel">
+ <label>Map name: <input type="text" value="map" id="setting-map-name"/></label>
+ <label>Region parameters:</label>
+ <div id="settings-table">
+ <table cellpadding="0" cellspacing="0" width="100%">
+ <thead>
+ <tr class="header">
+ <th>id</th>
+ <th>name</th>
+ </tr>
+ </thead>
+ <tbody data-bind="foreach: map.paths">
+ <tr data-bind="attr: {'data-region-id': originalId}">
+ <td data-bind="text: id"></td>
+ <td data-bind="text: name"></td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ <div id="settings-divider"></div>
+ <div id="settings-map"></div>
+ </div>
+ <div class="card-footer">
+ <button id="setting-save">Save</button>
+ </div>
+ </div>
+ <div id="card-save" class="card">
+ <div class="card-header">Copy map source</div>
+ <div class="card-content">
+ <textarea id="save-source"></textarea>
+ </div>
+ <div class="card-footer"></div>
+ </div>
+ <div id="edit-dialog">
+ <div><label for="edit-dialog-id">Id</label><input id="edit-dialog-id"/></div>
+ <div><label for="edit-dialog-name">Name</label><input id="edit-dialog-name"/></div>
+ </div>
+</body>
+</html>
View
5 production.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+gacode=`cat gacode`
+sed '/%gacode%/r gacode' <index-dev.html >index-prod.html
+sed -i -e 's/%gacode%//g' index-prod.html

0 comments on commit 5486de8

Please sign in to comment.
Something went wrong with that request. Please try again.