0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-01-27 22:59:51 -05:00

Added fixed header

This commit is contained in:
Brian Peacock 2014-05-08 15:41:59 -05:00
parent 7e9b5944fd
commit f74d7cbd3e
8 changed files with 150 additions and 38 deletions

View file

@ -30,9 +30,23 @@ h1 {
text-align: center;
}
@contentWidth: 880px;
@headerPadding: 10px;
header {
position: fixed;
width: 100%;
background: #FFF;
top: 0;
#header-inner {
max-width: @contentWidth + @headerPadding*2;
margin: 0 auto;
}
}
#content {
max-width: @contentWidth;
margin: 0 auto;
max-width: 880px;
padding: 20px;
}
@ -95,8 +109,8 @@ h1 {
/*** Heading ***/
h2 {
border-bottom: 6px solid #424242;
padding-bottom: 10px;
margin-top: 40px;
margin: 40px 0 0;
padding: 0 @headerPadding 10px;
}
/*** Package Entries ***/

View file

@ -7,23 +7,27 @@
<link rel="stylesheet" type="text/css" href="/-/static/main.css">
</head>
<body>
<div id='content'>
<h1><a href='/'>{{ name }}</a></h1>
<header>
<div id='header-inner'>
<h1><a href='/'>{{ name }}</a></h1>
<div class='center'>
<article id='setup'>
<code>npm set registry {{ baseUrl }}</code><br>
<code>npm adduser --registry {{ baseUrl }}</code>
</article>
<div class='center'>
<article id='setup'>
<code>npm set registry {{ baseUrl }}</code><br>
<code>npm adduser --registry {{ baseUrl }}</code>
</article>
</div>
<h2>
Available Packages:
<form id='search-form'>
<input type='text' placeholder='Search' /><button class='clear icon-search'></button>
</form>
</h2>
</div>
</header>
<h2>
Available Packages:
<form id='search-form'>
<input type='text' placeholder='Search' /><button class='clear icon-search'></button>
</form>
</h2>
<div id='content'>
<div id='search-results'></div>
<div id='all-packages'>

30
lib/GUI/js/header.js Normal file
View file

@ -0,0 +1,30 @@
var $ = require('unopinionate').selector,
onScroll = require('onscroll');
$(function() {
var $header = $('header'),
$content = $('#content'),
bottomOffset = 52;
var scrollFunc = function(top) {
var limit = $header.outerHeight() - bottomOffset;
if(top < 0) {
$header.css('top', 0);
}
else if(top > limit) {
$header.css('top', -limit + 'px');
}
else {
$header.css('top', -top + 'px');
}
};
onScroll(scrollFunc);
scrollFunc();
$(window).resize(function() {
console.log('resize');
$content.css('margin-top', $header.outerHeight());
}).resize();
});

View file

@ -1,2 +1,3 @@
require('./search');
require('./entry');
require('./header');

View file

@ -51,7 +51,6 @@ $(function() {
});
}
else {
console.log("YAY");
request.abort();
currentResults = null;
$searchResults.html('');

File diff suppressed because one or more lines are too long

View file

@ -30,7 +30,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
+ "</p>\n</article>";
return buffer;
});
},{"handlebars/runtime":11}],2:[function(require,module,exports){
},{"handlebars/runtime":12}],2:[function(require,module,exports){
var $ = require('unopinionate').selector,
onClick = require('onclick'),
transitionComplete = require('transition-complete');
@ -102,11 +102,42 @@ $(function() {
}
});
});
},{"onclick":12,"transition-complete":13,"unopinionate":14}],3:[function(require,module,exports){
},{"onclick":13,"transition-complete":15,"unopinionate":16}],3:[function(require,module,exports){
var $ = require('unopinionate').selector,
onScroll = require('onscroll');
$(function() {
var $header = $('header'),
$content = $('#content'),
bottomOffset = 52;
var scrollFunc = function(top) {
var limit = $header.outerHeight() - bottomOffset;
if(top < 0) {
$header.css('top', 0);
}
else if(top > limit) {
$header.css('top', -limit + 'px');
}
else {
$header.css('top', -top + 'px');
}
};
onScroll(scrollFunc);
scrollFunc();
$(window).resize(function() {
console.log('resize');
$content.css('margin-top', $header.outerHeight());
}).resize();
});
},{"onscroll":14,"unopinionate":16}],4:[function(require,module,exports){
require('./search');
require('./entry');
},{"./entry":2,"./search":4}],4:[function(require,module,exports){
require('./header');
},{"./entry":2,"./header":3,"./search":5}],5:[function(require,module,exports){
var $ = require('unopinionate').selector,
template = require('../entry.hbs');
@ -160,7 +191,6 @@ $(function() {
});
}
else {
console.log("YAY");
request.abort();
currentResults = null;
$searchResults.html('');
@ -175,7 +205,7 @@ $(function() {
});
});
},{"../entry.hbs":1,"unopinionate":14}],5:[function(require,module,exports){
},{"../entry.hbs":1,"unopinionate":16}],6:[function(require,module,exports){
"use strict";
/*globals Handlebars: true */
var base = require("./handlebars/base");
@ -208,7 +238,7 @@ var Handlebars = create();
Handlebars.create = create;
exports["default"] = Handlebars;
},{"./handlebars/base":6,"./handlebars/exception":7,"./handlebars/runtime":8,"./handlebars/safe-string":9,"./handlebars/utils":10}],6:[function(require,module,exports){
},{"./handlebars/base":7,"./handlebars/exception":8,"./handlebars/runtime":9,"./handlebars/safe-string":10,"./handlebars/utils":11}],7:[function(require,module,exports){
"use strict";
var Utils = require("./utils");
var Exception = require("./exception")["default"];
@ -389,7 +419,7 @@ exports.log = log;var createFrame = function(object) {
return obj;
};
exports.createFrame = createFrame;
},{"./exception":7,"./utils":10}],7:[function(require,module,exports){
},{"./exception":8,"./utils":11}],8:[function(require,module,exports){
"use strict";
var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
@ -418,7 +448,7 @@ function Exception(message, node) {
Exception.prototype = new Error();
exports["default"] = Exception;
},{}],8:[function(require,module,exports){
},{}],9:[function(require,module,exports){
"use strict";
var Utils = require("./utils");
var Exception = require("./exception")["default"];
@ -556,7 +586,7 @@ exports.program = program;function invokePartial(partial, name, context, helpers
exports.invokePartial = invokePartial;function noop() { return ""; }
exports.noop = noop;
},{"./base":6,"./exception":7,"./utils":10}],9:[function(require,module,exports){
},{"./base":7,"./exception":8,"./utils":11}],10:[function(require,module,exports){
"use strict";
// Build out our basic SafeString type
function SafeString(string) {
@ -568,7 +598,7 @@ SafeString.prototype.toString = function() {
};
exports["default"] = SafeString;
},{}],10:[function(require,module,exports){
},{}],11:[function(require,module,exports){
"use strict";
/*jshint -W004 */
var SafeString = require("./safe-string")["default"];
@ -645,12 +675,12 @@ exports.escapeExpression = escapeExpression;function isEmpty(value) {
}
exports.isEmpty = isEmpty;
},{"./safe-string":9}],11:[function(require,module,exports){
},{"./safe-string":10}],12:[function(require,module,exports){
// Create a simple path alias to allow browserify to resolve
// the runtime on a supported path.
module.exports = require('./dist/cjs/handlebars.runtime');
},{"./dist/cjs/handlebars.runtime":5}],12:[function(require,module,exports){
},{"./dist/cjs/handlebars.runtime":6}],13:[function(require,module,exports){
var $ = require('unopinionate').selector;
var $document = $(document),
@ -815,7 +845,30 @@ $(document).bind('mousedown', click._doAnywheres);
module.exports = click;
},{"unopinionate":14}],13:[function(require,module,exports){
},{"unopinionate":16}],14:[function(require,module,exports){
var $ = require('unopinionate').selector;
var bodyScrollers = [];
$(function() {
var $html = $('html'),
$body = $('body');
$(window, document, 'body').bind('scroll touchmove', function() {
var top = $html[0].scrollTop || $body[0].scrollTop;
for(var i=0; i<bodyScrollers.length; i++) {
bodyScrollers[i](top);
}
});
});
var onScroll = function(callback) {
bodyScrollers.push(callback);
};
module.exports = onScroll;
},{"unopinionate":16}],15:[function(require,module,exports){
(function(root) {
var callbacks = [];
@ -879,7 +932,7 @@ module.exports = click;
}
})(this);
},{}],14:[function(require,module,exports){
},{}],16:[function(require,module,exports){
(function (global){
(function(root) {
var unopinionate = {
@ -906,4 +959,4 @@ module.exports = click;
})(typeof window != 'undefined' ? window : global);
}).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{}]},{},[3])
},{}]},{},[4])

View file

@ -29,6 +29,7 @@
"minimatch": ">= 0.2.14",
"mkdirp": ">= 0.3.5",
"onclick": "^0.1.0",
"onscroll": "0.0.3",
"request": ">= 2.31.0",
"semver": ">= 2.2.1",
"tar.gz": "^0.1.1",