Skip to content

Commit

Permalink
Now loading scaffold template from a javascript source. The file scaf…
Browse files Browse the repository at this point in the history
…fold.template is now no longer used, but serves as a more convenient way to edit the scaffold that is now stored in a JavaScript variable in scaffold.template.js

This solves an issue with cross site origin problems if people tried to use the downloaded full-featured version of PatViz from GitHub and ran it locally (i.e. from a file:/// address). Ugly, but it works.
  • Loading branch information
Rinke Hoekstra committed Jul 22, 2014
1 parent d1be4b1 commit 69ba8eb
Show file tree
Hide file tree
Showing 4 changed files with 289 additions and 49 deletions.
6 changes: 5 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,11 @@
};

</script>
<script src="http://data2semantics.github.io/PatViz/js/patents.js"></script>
<script src="scaffold.template.js"></script>
<script src="js/patents.js"></script>






Expand Down
8 changes: 4 additions & 4 deletions js/patents.js
Original file line number Diff line number Diff line change
Expand Up @@ -501,12 +501,12 @@ function increase(){
function save(){
console.log('save clicked...');
$('#downloadlink').empty();
$.get('http://data2semantics.github.io/PatViz/scaffold.template',function(data){
// $.getJSON('http://data2semantics.github.io/PatViz/scaffold.template?callback=?',function(data){

var save_page = $('<html></html>');

var $scaffold = $(data);

//var $scaffold = $(data);
var $scaffold = $(scaffold_template);

var data_text = JSON.stringify(data_cache);

Expand All @@ -533,7 +533,7 @@ function save(){
$("#downloadlink").append("<div class='alert alert-success'><a href='" + datauri + "'>Download HTML-page</a></div>");
$("#downloadlink").append("<div class='alert alert-info'>Right click the link above, and select 'Save link as...' from the context menu</div>")

});
// });



Expand Down
88 changes: 44 additions & 44 deletions scaffold.template
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<head>
<title>Patents Visualizer</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name='viewport' content='width=device-width, initial-scale=1'>

<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<link href='http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css' rel='stylesheet'>
<link rel='stylesheet' href='http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css' />

<style type="text/css">
<style type='text/css'>
html { height: 100% }
body { height: 100%; margin: 0px; padding: 0px }

Expand Down Expand Up @@ -33,7 +33,7 @@
display: block;
}

#year { font-size: 32px; font-weight: bolder; font-family: "Open Sans", helvetica; vertical-align: bottom;}
#year { font-size: 32px; font-weight: bolder; font-family: 'Open Sans', helvetica; vertical-align: bottom;}


/* Media height for map */
Expand Down Expand Up @@ -126,55 +126,55 @@



<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://jquery-csv.googlecode.com/files/jquery.csv-0.71.js"></script>
<script src="http://code.jquery.com/ui/1.11.0/jquery-ui.min.js"></script>
<script src="http://data2semantics.github.io/PatViz/js/jquery.base64.js"></script>
<script src='http://code.jquery.com/jquery-1.11.1.min.js'></script>
<script src='https://jquery-csv.googlecode.com/files/jquery.csv-0.71.js'></script>
<script src='http://code.jquery.com/ui/1.11.0/jquery-ui.min.js'></script>
<script src='http://data2semantics.github.io/PatViz/js/jquery.base64.js'></script>





<script id="googleapi" type="text/javascript">
<script id='googleapi' type='text/javascript'>

// Nothing here ...

</script>

<script id="scaffoldjs" type="text/javascript">
<script id='scaffoldjs' type='text/javascript'>

// Nothing here...

</script>

<script src="http://data2semantics.github.io/PatViz/js/patents.js"></script>
<script src='http://data2semantics.github.io/PatViz/js/patents.js'></script>



</head>
<body>
<nav class="navbar navbar-default" role="navigation">
<nav class='navbar navbar-default' role='navigation'>
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<div class='navbar-header'>
<button type='button' class='navbar-toggle' data-toggle='collapse' data-target='#bs-example-navbar-collapse-1'>
<span class='sr-only'>Toggle navigation</span>
<span class='icon-bar'></span>
</button>
<a class="navbar-brand" href="#">PatViz</a>
<a class='navbar-brand' href='#'>PatViz</a>
</div>

<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right" id='yearcontrol'>
<div class='collapse navbar-collapse' id='bs-example-navbar-collapse-1'>
<ul class='nav navbar-nav navbar-right' id='yearcontrol'>
<li>
<span id="decrease" class="btn btn-default navbar-btn"><span class="glyphicon glyphicon-chevron-left"></span></span>
<span id='decrease' class='btn btn-default navbar-btn'><span class='glyphicon glyphicon-chevron-left'></span></span>
</li>
<li><span id="year"></span></li>
<li><span id="increase" class="btn btn-default navbar-btn"><span class="glyphicon glyphicon-chevron-right"></span></span></li>
<li><span id='year'></span></li>
<li><span id='increase' class='btn btn-default navbar-btn'><span class='glyphicon glyphicon-chevron-right'></span></span></li>
<li><div class='btn btn-success disabled navbar-btn' id='play'>Play</div></li>
<li><div class='btn btn-danger disabled navbar-btn' id='stop'>Stop</div></li>
<li class="divider">&nbsp;</li>
<li><div class='btn btn-default navbar-btn' data-toggle="modal" data-target="#legend-modal" id='legend'>Legend</div></li>
<li class='divider'>&nbsp;</li>
<li><div class='btn btn-default navbar-btn' data-toggle='modal' data-target='#legend-modal' id='legend'>Legend</div></li>
</ul>
</div><!-- /.navbar-collapse -->
</nav>
Expand All @@ -190,46 +190,46 @@
</div>
</div>
</div>
<div class="row">
<div class='row'>
<div class='col-md-12'>
<div id="map-canvas"></div>
<div id='map-canvas'></div>
</div>
</div>


<div class="row">
<div class='row'>
<div class='col-md-12'>
<hr/>
<img style="height: 50px; float: left;" src="http://data2semantics.github.io/PatViz/img/logo-no-subtitle-150dpi-small.png"/>
<img style="height: 50px; float: left;" src="http://data2semantics.github.io/PatViz/img/COMMIT_logo_RGB.jpg"/>
<div style="float:left;">
<img style='height: 50px; float: left;' src='http://data2semantics.github.io/PatViz/img/logo-no-subtitle-150dpi-small.png'/>
<img style='height: 50px; float: left;' src='http://data2semantics.github.io/PatViz/img/COMMIT_logo_RGB.jpg'/>
<div style='float:left;'>
<small><strong>PatViz</strong> - Patent Collaboration Visualizer, Copyright (c) 2013, Rinke Hoekstra and Loet Leydesdorff<br/>
For more information, please visit the <a href="http://www.leydesdorff.net/software/patstat/">companion website</a> (on PatStat only), or if you would like to run this tool locally, visit our <a href="http://github.com/Data2Semantics/PatViz" target="_new">GitHub</a> pages.</small>
For more information, please visit the <a href='http://www.leydesdorff.net/software/patstat/'>companion website</a> (on PatStat only), or if you would like to run this tool locally, visit our <a href='http://github.com/Data2Semantics/PatViz' target='_new'>GitHub</a> pages.</small>
</div>
<img style="height: 50px; float: right;" src="http://data2semantics.github.io/PatViz/img/uva.png"/>
<img style="height: 50px; float: right;" src="http://data2semantics.github.io/PatViz/img/VUlogo_EN_Wit_FC_tcm9-201388.png"/>
<img style='height: 50px; float: right;' src='http://data2semantics.github.io/PatViz/img/uva.png'/>
<img style='height: 50px; float: right;' src='http://data2semantics.github.io/PatViz/img/VUlogo_EN_Wit_FC_tcm9-201388.png'/>
</div>
</div>
</div>


<!-- Modal -->
<div class="modal fade" id="legend-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel">Legend</h4>
<div class='modal fade' id='legend-modal' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true'>
<div class='modal-dialog'>
<div class='modal-content'>
<div class='modal-header'>
<button type='button' class='close' data-dismiss='modal' aria-hidden='true'>&times;</button>
<h4 class='modal-title' id='myModalLabel'>Legend</h4>
</div>
<div class="modal-body" id="legendpane">
<div class='modal-body' id='legendpane'>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>
<div class='modal-footer'>
<button type='button' class='btn btn-primary' data-dismiss='modal'>Close</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->


<script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<script src='http://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js'></script>
</body>
Loading

0 comments on commit 69ba8eb

Please sign in to comment.