Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added url_prefix to static resources #145

Merged
merged 4 commits into from
Oct 20, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/GUI/css/styles.less
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
.npm-logo {
width: 79px;
height: @mainHeaderHeight;
background-image: url( /-/logo-sm );
background-image: url( -/logo-sm );
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAE8AAAAoCAYAAAC/xadkAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS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Mb/a7ngZhiPfWBhz0CPSRg3/jUJ1H4WvSr5X2SfFHLaCHCchfUvd2hnBEhsorEsP9Hs2Zc5Y+hs4n1ZXfZ2q5yukkTfl+YlrFPM5btv6feL1O+B/zwHNj9DV1y7e/NYZhiXbZxmvWCDANQOxd4Gel4EIQSu+nzc6PPoa61CDKUxdGMDEQI/+YkvbkRWMcbJ/Qv+Pj/QgOTCqnweuFXhZAOnYCr8GlNO+d9L7N95DQt7GW5e8OSlPbXUZ3puQ2gIMvwZET/OBH5M0O9jnPS/9XW8KPIb6b9+J8J52WOFi1zuvpTI9EkPJ7S3Q38LhWsbx2Z1Ezrvyc7T1jUD3AaCK2hK5l7f6kN2OVE7nPf9F67fa9Nnl41xk2rUtBC4gmyBdEjp+SGGEsYydUAj3O8C1MkhqeYMuC/Bx7RdLwEzwJMC/8BMgRNmbvi4hO6E51mXCX8Yr9CqdT7sdt/3UEzgfwGWjoSGvrYcFH+dGu8z/snzEDbQ/QwAP0g4eAm76ERUxrJRz/t4hFLVUwLqVYcF+dpbv0CaxeC93qUTdWUD1jVQ2Ujn0XS2/TrtsA4P0UWpn4qR8rzhuYvRfHUhNtaG8OoZLjyk3FDFmH1ZzQpn5HwWpZZP42WtqWaHUjOxqaQeiVkv21Rr7L86gFoumlh5j7nnGRSLY5iDeX4jRf3b9X4ABADgctRMdEJWtAAAAAElFTkSuQmCC);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there two identical background images?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a heads up, I put it there so browsers don't download an image if they don't need to. So basically less requests for every browser minus a few versions of IE

background-repeat: no-repeat;
background-position: center center;
Expand Down
10 changes: 5 additions & 5 deletions lib/GUI/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
<meta charset="utf-8">
<title>{{ name }}</title>

<link rel="icon" type="image/ico" href="/-/static/favicon.ico"/>
<link rel="stylesheet" type="text/css" href="/-/static/main.css">
<link rel="icon" type="image/ico" href="{{ baseUrl }}/-/static/favicon.ico"/>
<link rel="stylesheet" type="text/css" href="{{ baseUrl }}/-/static/main.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body class="body">
<header class="main-header">
<nav class="navbar navbar-default red-bg white no-border no-rnd-cnr" role="navigation">
<div class="container">
<div class="npm-logo navbar-left">
<a href="/"></a>
<a href="{{ baseUrl }}"></a>
</div>

<div class="navbar-right setup hidden-xs">
Expand Down Expand Up @@ -59,7 +59,7 @@

<section class="content container pkg-search-container" id="search-results"></section>

<script src="/-/static/jquery.min.js"></script>
<script type='text/javascript' src='/-/static/main.js'></script>
<script src="{{ baseUrl }}/-/static/jquery.min.js"></script>
<script type='text/javascript' src='{{ baseUrl }}/-/static/main.js'></script>
</body>
</html>
2 changes: 1 addition & 1 deletion lib/GUI/js/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ $(function() {

//Get the data
$.ajax({
url: '/-/readme/'+$entry.attr('data-name')+'/'+$entry.attr('data-version'),
url: '-/readme/'+$entry.attr('data-name')+'/'+$entry.attr('data-version'),
dataType: 'text',
success: function(html) {
var $readme = $("<div class='readme'>")
Expand Down
4 changes: 2 additions & 2 deletions lib/GUI/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ $(function() {
}

if( !currentResults ) {
$searchResults.html( "<img class='search-ajax' src='/-/static/ajax.gif' alt='Spinner'/>" );
$searchResults.html( "<img class='search-ajax' src='-/static/ajax.gif' alt='Spinner'/>" );
}

request = $.getJSON('/-/search/' + q, function( results ) {
request = $.getJSON('-/search/' + q, function( results ) {
currentResults = results;

if( results.length > 0 ) {
Expand Down
2 changes: 1 addition & 1 deletion lib/index-web.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = function(app, config, storage) {
res.send(template({
name: config.web.title || "Sinopia",
packages: packages,
baseUrl: config.url_prefix || req.protocol + '://' + req.get('host') + '/'
baseUrl: config.url_prefix || req.protocol + '://' + req.get('host')
}));
});
});
Expand Down
4 changes: 2 additions & 2 deletions lib/static/main.css

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions lib/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ $(function() {

//Get the data
$.ajax({
url: '/-/readme/'+$entry.attr('data-name')+'/'+$entry.attr('data-version'),
url: '-/readme/'+$entry.attr('data-name')+'/'+$entry.attr('data-version'),
dataType: 'text',
success: function(html) {
var $readme = $("<div class='readme'>")
Expand Down Expand Up @@ -161,10 +161,10 @@ $(function() {
}

if( !currentResults ) {
$searchResults.html( "<img class='search-ajax' src='/-/static/ajax.gif' alt='Spinner'/>" );
$searchResults.html( "<img class='search-ajax' src='-/static/ajax.gif' alt='Spinner'/>" );
}

request = $.getJSON('/-/search/' + q, function( results ) {
request = $.getJSON('-/search/' + q, function( results ) {
currentResults = results;

if( results.length > 0 ) {
Expand Down