diff --git a/swh/web/static/css/odometer-theme-swh.css b/swh/web/static/css/odometer-theme-swh.css new file mode 100644 index 00000000..3cdbcdda --- /dev/null +++ b/swh/web/static/css/odometer-theme-swh.css @@ -0,0 +1,91 @@ +.odometer.odometer-auto-theme, .odometer.odometer-theme-default { + display: inline-block; + vertical-align: middle; + *vertical-align: auto; + *zoom: 1; + *display: inline; + position: relative; + } + .odometer.odometer-auto-theme .odometer-digit, .odometer.odometer-theme-default .odometer-digit { + display: inline-block; + vertical-align: middle; + *vertical-align: auto; + *zoom: 1; + *display: inline; + position: relative; + } + .odometer.odometer-auto-theme .odometer-digit .odometer-digit-spacer, .odometer.odometer-theme-default .odometer-digit .odometer-digit-spacer { + display: inline-block; + vertical-align: middle; + *vertical-align: auto; + *zoom: 1; + *display: inline; + visibility: hidden; + } + .odometer.odometer-auto-theme .odometer-digit .odometer-digit-inner, .odometer.odometer-theme-default .odometer-digit .odometer-digit-inner { + text-align: left; + display: block; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + overflow: hidden; + } + .odometer.odometer-auto-theme .odometer-digit .odometer-ribbon, .odometer.odometer-theme-default .odometer-digit .odometer-ribbon { + display: block; + } + .odometer.odometer-auto-theme .odometer-digit .odometer-ribbon-inner, .odometer.odometer-theme-default .odometer-digit .odometer-ribbon-inner { + display: block; + -webkit-backface-visibility: hidden; + } + .odometer.odometer-auto-theme .odometer-digit .odometer-value, .odometer.odometer-theme-default .odometer-digit .odometer-value { + display: block; + -webkit-transform: translateZ(0); + } + .odometer.odometer-auto-theme .odometer-digit .odometer-value.odometer-last-value, .odometer.odometer-theme-default .odometer-digit .odometer-value.odometer-last-value { + position: absolute; + } + .odometer.odometer-auto-theme.odometer-animating-up .odometer-ribbon-inner, .odometer.odometer-theme-default.odometer-animating-up .odometer-ribbon-inner { + -webkit-transition: -webkit-transform 2s; + -moz-transition: -moz-transform 2s; + -ms-transition: -ms-transform 2s; + -o-transition: -o-transform 2s; + transition: transform 2s; + } + .odometer.odometer-auto-theme.odometer-animating-up.odometer-animating .odometer-ribbon-inner, .odometer.odometer-theme-default.odometer-animating-up.odometer-animating .odometer-ribbon-inner { + -webkit-transform: translateY(-100%); + -moz-transform: translateY(-100%); + -ms-transform: translateY(-100%); + -o-transform: translateY(-100%); + transform: translateY(-100%); + } + .odometer.odometer-auto-theme.odometer-animating-down .odometer-ribbon-inner, .odometer.odometer-theme-default.odometer-animating-down .odometer-ribbon-inner { + -webkit-transform: translateY(-100%); + -moz-transform: translateY(-100%); + -ms-transform: translateY(-100%); + -o-transform: translateY(-100%); + transform: translateY(-100%); + } + .odometer.odometer-auto-theme.odometer-animating-down.odometer-animating .odometer-ribbon-inner, .odometer.odometer-theme-default.odometer-animating-down.odometer-animating .odometer-ribbon-inner { + -webkit-transition: -webkit-transform 2s; + -moz-transition: -moz-transform 2s; + -ms-transition: -ms-transform 2s; + -o-transition: -o-transform 2s; + transition: transform 2s; + -webkit-transform: translateY(0); + -moz-transform: translateY(0); + -ms-transform: translateY(0); + -o-transform: translateY(0); + transform: translateY(0); + } + + /* do not override SWH font choices + .odometer.odometer-auto-theme, .odometer.odometer-theme-default { + font-family: "Helvetica Neue", sans-serif; + line-height: 1.1em; + } + */ + .odometer.odometer-auto-theme .odometer-value, .odometer.odometer-theme-default .odometer-value { + text-align: center; + } diff --git a/swh/web/static/css/style.css b/swh/web/static/css/style.css index 78e11e7b..545c875e 100644 --- a/swh/web/static/css/style.css +++ b/swh/web/static/css/style.css @@ -1,441 +1,449 @@ /* version: 0.1 date: 21/09/15 author: swh email: swh website: softwareheritage.org version history: /style.css */ @import url(https://fonts.googleapis.com/css?family=Alegreya:400,400italic,700,700italic); @import url(https://fonts.googleapis.com/css?family=Alegreya+Sans:400,400italic,500,500italic,700,700italic,100,300,100italic,300italic); html { height: 100%; } body { font-family: 'Alegreya Sans', sans-serif; font-size: 1.7rem; line-height: 1.5; color: rgba(0, 0, 0, 0.55); padding-top: 80px; /* avoid fixed bootstrap navbar covers content */ padding-bottom: 120px; min-height: 100%; margin: 0; position: relative; } .heading { font-family: 'Alegreya', serif; } .shell, .text { font-size: 0.7em; } .logo img { max-height: 40px; } .logo .navbar-brand { padding: 5px; } .logo .sitename { padding: 15px 5px; } .jumbotron { padding: 0; background-color: rgba(0, 0, 0, 0); position: fixed; top: 0; width: 100%; } #swh-navbar-collapse { border-top-style: none; border-left-style: none; border-right-style: none; border-bottom: 5px solid; border-image: linear-gradient(to right, rgb(226, 0, 38) 0%, rgb(254, 205, 27) 100%) 1 1 1 1; width: 100%; padding: 5px; } .nav-horizontal { float: right; } h3[id], h4[id], a[id] { /* avoid in-page links covered by navbar */ padding-top: 80px; margin-top: -70px; } h1, h2, h3, h4 { margin: 0; color: #e20026; padding-bottom: 10px; } h1 { font-size: 1.8em; } h2 { font-size: 1.2em; } h3 { font-size: 1.1em; } a { color: rgba(0, 0, 0, 0.75); border-bottom-style: dotted; border-bottom-width: 1px; border-bottom-color: rgb(91, 94, 111); } a:hover { color: black; } ul.dropdown-menu a, .navbar-header a, ul.navbar-nav a { /* No decoration on links in dropdown menu */ border-bottom-style: none; color: #323232; font-weight: 700; } .navbar-header a:hover, ul.navbar-nav a:hover { color: #8f8f8f; } .sitename .first-word, .sitename .second-word { color: rgba(0, 0, 0, 0.75); font-weight: normal; font-size: 1.8rem; } .sitename .first-word { font-family: 'Alegreya Sans', sans-serif; } .sitename .second-word { font-family: 'Alegreya', serif; } ul.dropdown-menu > li, ul.dropdown-menu > li > ul > li { /* No decoration on bullet points in dropdown menu */ list-style-type: none; } .page { margin: 2em auto; width: 35em; border: 5px solid #ccc; padding: 0.8em; background: white; } .entries { list-style: none; margin: 0; padding: 0; } .entries li { margin: 0.8em 1.2em; } .entries li h2 { margin-left: -1em; } .add-entry { font-size: 0.9em; border-bottom: 1px solid #ccc; } .add-entry dl { font-weight: bold; } .metanav { text-align: right; font-size: 0.8em; padding: 0.3em; margin-bottom: 1em; background: #fafafa; } .flash { background: #cee5F5; padding: 0.5em; border: 1px solid #aacbe2; } .error { background: #f0d6d6; padding: 0.5em; } .file-found { color: #23BA49; } .file-notfound { color: #FF4747; } /* Bootstrap custom styling to correctly render multiple * form-controls in an input-group: * github.com/twbs/bootstrap/issues/12732 */ .input-group-field { display: table-cell; vertical-align: middle; border-radius:4px; min-width:1%; white-space: nowrap; } .input-group-field .form-control { border-radius: inherit !important; } .input-group-field:not(:first-child):not(:last-child) { border-radius:0; } .input-group-field:not(:first-child):not(:last-child) .form-control { border-left-width: 0; border-right-width: 0; } .input-group-field:last-child { border-top-left-radius:0; border-bottom-left-radius:0; } .input-group > span:not(:last-child) > button { border-radius: 0; } .multi-input-group > .input-group-btn { vertical-align: bottom; padding: 0; } .dataTables_filter { margin-top: 15px; } .dataTables_filter input { width: 70%; float: right; } tr.api-doc-route-upcoming > td, tr.api-doc-route-upcoming > td > a { font-size: 90%; } tr.api-doc-route-deprecated > td, tr.api-doc-route-deprecated > td > a { color: red; } #back-to-top { display: initial; position: fixed; bottom: 30px; right: 30px; z-index: 10; } #back-to-top a img { display: block; width: 32px; height: 32px; background-size: 32px 32px; text-indent: -999px; overflow: hidden; } .table > thead > tr > th { border-bottom: 1px solid #e20026; } .table > tbody > tr > td { border-style: none; } pre { background-color: #f5f5f5; } .dataTables_wrapper { position: static; } /* breadcrumbs */ .bread-crumbs{ display: inline-block; overflow: hidden; color: rgba(0, 0, 0, 0.55); } bread-crumbs ul { list-style-type: none; } .bread-crumbs li { float: left; list-style-type: none; } .bread-crumbs a { color: rgba(0, 0, 0, 0.75); border-bottom-style: none; } .bread-crumbs a:hover { color: rgba(0, 0, 0, 0.85); text-decoration: underline; } .title-small .bread-crumbs{ margin: -30px 0 25px; } #footer { background-color: #262626; color: hsl(0, 0%, 100%); font-size: 1.2rem; text-align: center; padding-top: 20px; padding-bottom: 20px; position: absolute; bottom: 0; left: 0; right: 0; } #footer a, #footer a:visited { color: hsl(0, 0%, 100%); } #footer a:hover { text-decoration: underline; } .highlightjs pre { background-color: transparent; border-radius: 0px; border-color: transparent; } .hljs { background-color: transparent; white-space: pre; } .scrollable-menu { max-height: 180px; overflow-x: hidden; } .swh-browse-top-navigation { border-bottom: 1px solid #ddd; min-height: 42px; padding: 4px 5px 0px 5px; } .swh-browse-bread-crumbs { font-size: inherit; vertical-align: text-top; margin-bottom: 1px; } .swh-metadata-table-row { border-top: 1px solid #ddd !important; } /* for block of numbers */ td.hljs-ln-numbers { -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; text-align: center; color: #ccc; border-right: 1px solid #CCC; vertical-align: top; padding-right: 5px; /* your custom style here */ } /* for block of code */ td.hljs-ln-code { padding-left: 10px; } .btn-swh { color: #6C6C6C; background-color: #EAEAEA; border-color: #EAEAEA; } .btn-swh:hover, .btn-swh:focus, .btn-swh:active, .btn-swh.active, .open .dropdown-toggle.btn-swh { color: #6C6C6C; background-color: #D4D4D4; border-color: #EAEAEA; } .btn-swh:active, .btn-swh.active, .open .dropdown-toggle.btn-swh { background-image: none; } .btn-swh.disabled, .btn-swh[disabled], fieldset[disabled] .btn-swh, .btn-swh.disabled:hover, .btn-swh[disabled]:hover, fieldset[disabled] .btn-swh:hover, .btn-swh.disabled:focus, .btn-swh[disabled]:focus, fieldset[disabled] .btn-swh:focus, .btn-swh.disabled:active, .btn-swh[disabled]:active, fieldset[disabled] .btn-swh:active, .btn-swh.disabled.active, .btn-swh[disabled].active, fieldset[disabled] .btn-swh.active { background-color: #EAEAEA; border-color: #EAEAEA; } .btn-swh .badge { color: #EAEAEA; background-color: #6C6C6C; } .swh-http-error { margin: 0 auto; text-align: center; } .swh-http-error-head { color: #2d353c; font-size: 30px; } .swh-http-error-code { bottom: 60%; color: #2d353c; font-size: 96px; line-height: 80px; margin-bottom: 10px!important; } .swh-http-error-desc { font-size: 12px; color: #647788; } .swh-http-error-desc pre { text-align: left; } + +.swh-table { + border-bottom: none !important; +} + +.swh-counter { + font-size: 150%; +} \ No newline at end of file diff --git a/swh/web/static/js/odometer/LICENSE b/swh/web/static/js/odometer/LICENSE new file mode 100644 index 00000000..d746b044 --- /dev/null +++ b/swh/web/static/js/odometer/LICENSE @@ -0,0 +1,8 @@ +Copyright (c) 2013 HubSpot, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/swh/web/static/js/odometer/odometer.js b/swh/web/static/js/odometer/odometer.js new file mode 100644 index 00000000..d66b4edf --- /dev/null +++ b/swh/web/static/js/odometer/odometer.js @@ -0,0 +1,653 @@ +(function() { + var COUNT_FRAMERATE, COUNT_MS_PER_FRAME, DIGIT_FORMAT, DIGIT_HTML, DIGIT_SPEEDBOOST, DURATION, FORMAT_MARK_HTML, FORMAT_PARSER, FRAMERATE, FRAMES_PER_VALUE, MS_PER_FRAME, MutationObserver, Odometer, RIBBON_HTML, TRANSITION_END_EVENTS, TRANSITION_SUPPORT, VALUE_HTML, addClass, createFromHTML, fractionalPart, now, removeClass, requestAnimationFrame, round, transitionCheckStyles, trigger, truncate, wrapJQuery, _jQueryWrapped, _old, _ref, _ref1, + __slice = [].slice; + + VALUE_HTML = ''; + + RIBBON_HTML = '' + VALUE_HTML + ''; + + DIGIT_HTML = '8' + RIBBON_HTML + ''; + + FORMAT_MARK_HTML = ''; + + DIGIT_FORMAT = '(,ddd).dd'; + + FORMAT_PARSER = /^\(?([^)]*)\)?(?:(.)(d+))?$/; + + FRAMERATE = 30; + + DURATION = 2000; + + COUNT_FRAMERATE = 20; + + FRAMES_PER_VALUE = 2; + + DIGIT_SPEEDBOOST = .5; + + MS_PER_FRAME = 1000 / FRAMERATE; + + COUNT_MS_PER_FRAME = 1000 / COUNT_FRAMERATE; + + TRANSITION_END_EVENTS = 'transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd'; + + transitionCheckStyles = document.createElement('div').style; + + TRANSITION_SUPPORT = (transitionCheckStyles.transition != null) || (transitionCheckStyles.webkitTransition != null) || (transitionCheckStyles.mozTransition != null) || (transitionCheckStyles.oTransition != null); + + requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame; + + MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; + + createFromHTML = function(html) { + var el; + el = document.createElement('div'); + el.innerHTML = html; + return el.children[0]; + }; + + removeClass = function(el, name) { + return el.className = el.className.replace(new RegExp("(^| )" + (name.split(' ').join('|')) + "( |$)", 'gi'), ' '); + }; + + addClass = function(el, name) { + removeClass(el, name); + return el.className += " " + name; + }; + + trigger = function(el, name) { + var evt; + if (document.createEvent != null) { + evt = document.createEvent('HTMLEvents'); + evt.initEvent(name, true, true); + return el.dispatchEvent(evt); + } + }; + + now = function() { + var _ref, _ref1; + return (_ref = (_ref1 = window.performance) != null ? typeof _ref1.now === "function" ? _ref1.now() : void 0 : void 0) != null ? _ref : +(new Date); + }; + + round = function(val, precision) { + if (precision == null) { + precision = 0; + } + if (!precision) { + return Math.round(val); + } + val *= Math.pow(10, precision); + val += 0.5; + val = Math.floor(val); + return val /= Math.pow(10, precision); + }; + + truncate = function(val) { + if (val < 0) { + return Math.ceil(val); + } else { + return Math.floor(val); + } + }; + + fractionalPart = function(val) { + return val - round(val); + }; + + _jQueryWrapped = false; + + (wrapJQuery = function() { + var property, _i, _len, _ref, _results; + if (_jQueryWrapped) { + return; + } + if (window.jQuery != null) { + _jQueryWrapped = true; + _ref = ['html', 'text']; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + property = _ref[_i]; + _results.push((function(property) { + var old; + old = window.jQuery.fn[property]; + return window.jQuery.fn[property] = function(val) { + var _ref1; + if ((val == null) || (((_ref1 = this[0]) != null ? _ref1.odometer : void 0) == null)) { + return old.apply(this, arguments); + } + return this[0].odometer.update(val); + }; + })(property)); + } + return _results; + } + })(); + + setTimeout(wrapJQuery, 0); + + Odometer = (function() { + function Odometer(options) { + var e, k, property, v, _base, _i, _len, _ref, _ref1, _ref2, + _this = this; + this.options = options; + this.el = this.options.el; + if (this.el.odometer != null) { + return this.el.odometer; + } + this.el.odometer = this; + _ref = Odometer.options; + for (k in _ref) { + v = _ref[k]; + if (this.options[k] == null) { + this.options[k] = v; + } + } + if ((_base = this.options).duration == null) { + _base.duration = DURATION; + } + this.MAX_VALUES = ((this.options.duration / MS_PER_FRAME) / FRAMES_PER_VALUE) | 0; + this.resetFormat(); + this.value = this.cleanValue((_ref1 = this.options.value) != null ? _ref1 : ''); + this.renderInside(); + this.render(); + try { + _ref2 = ['innerHTML', 'innerText', 'textContent']; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + property = _ref2[_i]; + if (this.el[property] != null) { + (function(property) { + return Object.defineProperty(_this.el, property, { + get: function() { + var _ref3; + if (property === 'innerHTML') { + return _this.inside.outerHTML; + } else { + return (_ref3 = _this.inside.innerText) != null ? _ref3 : _this.inside.textContent; + } + }, + set: function(val) { + return _this.update(val); + } + }); + })(property); + } + } + } catch (_error) { + e = _error; + this.watchForMutations(); + } + this; + } + + Odometer.prototype.renderInside = function() { + this.inside = document.createElement('div'); + this.inside.className = 'odometer-inside'; + this.el.innerHTML = ''; + return this.el.appendChild(this.inside); + }; + + Odometer.prototype.watchForMutations = function() { + var e, + _this = this; + if (MutationObserver == null) { + return; + } + try { + if (this.observer == null) { + this.observer = new MutationObserver(function(mutations) { + var newVal; + newVal = _this.el.innerText; + _this.renderInside(); + _this.render(_this.value); + return _this.update(newVal); + }); + } + this.watchMutations = true; + return this.startWatchingMutations(); + } catch (_error) { + e = _error; + } + }; + + Odometer.prototype.startWatchingMutations = function() { + if (this.watchMutations) { + return this.observer.observe(this.el, { + childList: true + }); + } + }; + + Odometer.prototype.stopWatchingMutations = function() { + var _ref; + return (_ref = this.observer) != null ? _ref.disconnect() : void 0; + }; + + Odometer.prototype.cleanValue = function(val) { + var _ref; + if (typeof val === 'string') { + val = val.replace((_ref = this.format.radix) != null ? _ref : '.', ''); + val = val.replace(/[.,]/g, ''); + val = val.replace('', '.'); + val = parseFloat(val, 10) || 0; + } + return round(val, this.format.precision); + }; + + Odometer.prototype.bindTransitionEnd = function() { + var event, renderEnqueued, _i, _len, _ref, _results, + _this = this; + if (this.transitionEndBound) { + return; + } + this.transitionEndBound = true; + renderEnqueued = false; + _ref = TRANSITION_END_EVENTS.split(' '); + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + event = _ref[_i]; + _results.push(this.el.addEventListener(event, function() { + if (renderEnqueued) { + return true; + } + renderEnqueued = true; + setTimeout(function() { + _this.render(); + renderEnqueued = false; + return trigger(_this.el, 'odometerdone'); + }, 0); + return true; + }, false)); + } + return _results; + }; + + Odometer.prototype.resetFormat = function() { + var format, fractional, parsed, precision, radix, repeating, _ref, _ref1; + format = (_ref = this.options.format) != null ? _ref : DIGIT_FORMAT; + format || (format = 'd'); + parsed = FORMAT_PARSER.exec(format); + if (!parsed) { + throw new Error("Odometer: Unparsable digit format"); + } + _ref1 = parsed.slice(1, 4), repeating = _ref1[0], radix = _ref1[1], fractional = _ref1[2]; + precision = (fractional != null ? fractional.length : void 0) || 0; + return this.format = { + repeating: repeating, + radix: radix, + precision: precision + }; + }; + + Odometer.prototype.render = function(value) { + var classes, cls, match, newClasses, theme, _i, _len; + if (value == null) { + value = this.value; + } + this.stopWatchingMutations(); + this.resetFormat(); + this.inside.innerHTML = ''; + theme = this.options.theme; + classes = this.el.className.split(' '); + newClasses = []; + for (_i = 0, _len = classes.length; _i < _len; _i++) { + cls = classes[_i]; + if (!cls.length) { + continue; + } + if (match = /^odometer-theme-(.+)$/.exec(cls)) { + theme = match[1]; + continue; + } + if (/^odometer(-|$)/.test(cls)) { + continue; + } + newClasses.push(cls); + } + newClasses.push('odometer'); + if (!TRANSITION_SUPPORT) { + newClasses.push('odometer-no-transitions'); + } + if (theme) { + newClasses.push("odometer-theme-" + theme); + } else { + newClasses.push("odometer-auto-theme"); + } + this.el.className = newClasses.join(' '); + this.ribbons = {}; + this.formatDigits(value); + return this.startWatchingMutations(); + }; + + Odometer.prototype.formatDigits = function(value) { + var digit, valueDigit, valueString, wholePart, _i, _j, _len, _len1, _ref, _ref1; + this.digits = []; + if (this.options.formatFunction) { + valueString = this.options.formatFunction(value); + _ref = valueString.split('').reverse(); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + valueDigit = _ref[_i]; + if (valueDigit.match(/0-9/)) { + digit = this.renderDigit(); + digit.querySelector('.odometer-value').innerHTML = valueDigit; + this.digits.push(digit); + this.insertDigit(digit); + } else { + this.addSpacer(valueDigit); + } + } + } else { + wholePart = !this.format.precision || !fractionalPart(value) || false; + _ref1 = value.toString().split('').reverse(); + for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { + digit = _ref1[_j]; + if (digit === '.') { + wholePart = true; + } + this.addDigit(digit, wholePart); + } + } + }; + + Odometer.prototype.update = function(newValue) { + var diff, + _this = this; + newValue = this.cleanValue(newValue); + if (!(diff = newValue - this.value)) { + return; + } + removeClass(this.el, 'odometer-animating-up odometer-animating-down odometer-animating'); + if (diff > 0) { + addClass(this.el, 'odometer-animating-up'); + } else { + addClass(this.el, 'odometer-animating-down'); + } + this.stopWatchingMutations(); + this.animate(newValue); + this.startWatchingMutations(); + setTimeout(function() { + _this.el.offsetHeight; + return addClass(_this.el, 'odometer-animating'); + }, 0); + return this.value = newValue; + }; + + Odometer.prototype.renderDigit = function() { + return createFromHTML(DIGIT_HTML); + }; + + Odometer.prototype.insertDigit = function(digit, before) { + if (before != null) { + return this.inside.insertBefore(digit, before); + } else if (!this.inside.children.length) { + return this.inside.appendChild(digit); + } else { + return this.inside.insertBefore(digit, this.inside.children[0]); + } + }; + + Odometer.prototype.addSpacer = function(chr, before, extraClasses) { + var spacer; + spacer = createFromHTML(FORMAT_MARK_HTML); + spacer.innerHTML = chr; + if (extraClasses) { + addClass(spacer, extraClasses); + } + return this.insertDigit(spacer, before); + }; + + Odometer.prototype.addDigit = function(value, repeating) { + var chr, digit, resetted, _ref; + if (repeating == null) { + repeating = true; + } + if (value === '-') { + return this.addSpacer(value, null, 'odometer-negation-mark'); + } + if (value === '.') { + return this.addSpacer((_ref = this.format.radix) != null ? _ref : '.', null, 'odometer-radix-mark'); + } + if (repeating) { + resetted = false; + while (true) { + if (!this.format.repeating.length) { + if (resetted) { + throw new Error("Bad odometer format without digits"); + } + this.resetFormat(); + resetted = true; + } + chr = this.format.repeating[this.format.repeating.length - 1]; + this.format.repeating = this.format.repeating.substring(0, this.format.repeating.length - 1); + if (chr === 'd') { + break; + } + this.addSpacer(chr); + } + } + digit = this.renderDigit(); + digit.querySelector('.odometer-value').innerHTML = value; + this.digits.push(digit); + return this.insertDigit(digit); + }; + + Odometer.prototype.animate = function(newValue) { + if (!TRANSITION_SUPPORT || this.options.animation === 'count') { + return this.animateCount(newValue); + } else { + return this.animateSlide(newValue); + } + }; + + Odometer.prototype.animateCount = function(newValue) { + var cur, diff, last, start, tick, + _this = this; + if (!(diff = +newValue - this.value)) { + return; + } + start = last = now(); + cur = this.value; + return (tick = function() { + var delta, dist, fraction; + if ((now() - start) > _this.options.duration) { + _this.value = newValue; + _this.render(); + trigger(_this.el, 'odometerdone'); + return; + } + delta = now() - last; + if (delta > COUNT_MS_PER_FRAME) { + last = now(); + fraction = delta / _this.options.duration; + dist = diff * fraction; + cur += dist; + _this.render(Math.round(cur)); + } + if (requestAnimationFrame != null) { + return requestAnimationFrame(tick); + } else { + return setTimeout(tick, COUNT_MS_PER_FRAME); + } + })(); + }; + + Odometer.prototype.getDigitCount = function() { + var i, max, value, values, _i, _len; + values = 1 <= arguments.length ? __slice.call(arguments, 0) : []; + for (i = _i = 0, _len = values.length; _i < _len; i = ++_i) { + value = values[i]; + values[i] = Math.abs(value); + } + max = Math.max.apply(Math, values); + return Math.ceil(Math.log(max + 1) / Math.log(10)); + }; + + Odometer.prototype.getFractionalDigitCount = function() { + var i, parser, parts, value, values, _i, _len; + values = 1 <= arguments.length ? __slice.call(arguments, 0) : []; + parser = /^\-?\d*\.(\d*?)0*$/; + for (i = _i = 0, _len = values.length; _i < _len; i = ++_i) { + value = values[i]; + values[i] = value.toString(); + parts = parser.exec(values[i]); + if (parts == null) { + values[i] = 0; + } else { + values[i] = parts[1].length; + } + } + return Math.max.apply(Math, values); + }; + + Odometer.prototype.resetDigits = function() { + this.digits = []; + this.ribbons = []; + this.inside.innerHTML = ''; + return this.resetFormat(); + }; + + Odometer.prototype.animateSlide = function(newValue) { + var boosted, cur, diff, digitCount, digits, dist, end, fractionalCount, frame, frames, i, incr, j, mark, numEl, oldValue, start, _base, _i, _j, _k, _l, _len, _len1, _len2, _m, _ref, _results; + oldValue = this.value; + fractionalCount = this.getFractionalDigitCount(oldValue, newValue); + if (fractionalCount) { + newValue = newValue * Math.pow(10, fractionalCount); + oldValue = oldValue * Math.pow(10, fractionalCount); + } + if (!(diff = newValue - oldValue)) { + return; + } + this.bindTransitionEnd(); + digitCount = this.getDigitCount(oldValue, newValue); + digits = []; + boosted = 0; + for (i = _i = 0; 0 <= digitCount ? _i < digitCount : _i > digitCount; i = 0 <= digitCount ? ++_i : --_i) { + start = truncate(oldValue / Math.pow(10, digitCount - i - 1)); + end = truncate(newValue / Math.pow(10, digitCount - i - 1)); + dist = end - start; + if (Math.abs(dist) > this.MAX_VALUES) { + frames = []; + incr = dist / (this.MAX_VALUES + this.MAX_VALUES * boosted * DIGIT_SPEEDBOOST); + cur = start; + while ((dist > 0 && cur < end) || (dist < 0 && cur > end)) { + frames.push(Math.round(cur)); + cur += incr; + } + if (frames[frames.length - 1] !== end) { + frames.push(end); + } + boosted++; + } else { + frames = (function() { + _results = []; + for (var _j = start; start <= end ? _j <= end : _j >= end; start <= end ? _j++ : _j--){ _results.push(_j); } + return _results; + }).apply(this); + } + for (i = _k = 0, _len = frames.length; _k < _len; i = ++_k) { + frame = frames[i]; + frames[i] = Math.abs(frame % 10); + } + digits.push(frames); + } + this.resetDigits(); + _ref = digits.reverse(); + for (i = _l = 0, _len1 = _ref.length; _l < _len1; i = ++_l) { + frames = _ref[i]; + if (!this.digits[i]) { + this.addDigit(' ', i >= fractionalCount); + } + if ((_base = this.ribbons)[i] == null) { + _base[i] = this.digits[i].querySelector('.odometer-ribbon-inner'); + } + this.ribbons[i].innerHTML = ''; + if (diff < 0) { + frames = frames.reverse(); + } + for (j = _m = 0, _len2 = frames.length; _m < _len2; j = ++_m) { + frame = frames[j]; + numEl = document.createElement('div'); + numEl.className = 'odometer-value'; + numEl.innerHTML = frame; + this.ribbons[i].appendChild(numEl); + if (j === frames.length - 1) { + addClass(numEl, 'odometer-last-value'); + } + if (j === 0) { + addClass(numEl, 'odometer-first-value'); + } + } + } + if (start < 0) { + this.addDigit('-'); + } + mark = this.inside.querySelector('.odometer-radix-mark'); + if (mark != null) { + mark.parent.removeChild(mark); + } + if (fractionalCount) { + return this.addSpacer(this.format.radix, this.digits[fractionalCount - 1], 'odometer-radix-mark'); + } + }; + + return Odometer; + + })(); + + Odometer.options = (_ref = window.odometerOptions) != null ? _ref : {}; + + setTimeout(function() { + var k, v, _base, _ref1, _results; + if (window.odometerOptions) { + _ref1 = window.odometerOptions; + _results = []; + for (k in _ref1) { + v = _ref1[k]; + _results.push((_base = Odometer.options)[k] != null ? (_base = Odometer.options)[k] : _base[k] = v); + } + return _results; + } + }, 0); + + Odometer.init = function() { + var el, elements, _i, _len, _ref1, _results; + if (document.querySelectorAll == null) { + return; + } + elements = document.querySelectorAll(Odometer.options.selector || '.odometer'); + _results = []; + for (_i = 0, _len = elements.length; _i < _len; _i++) { + el = elements[_i]; + _results.push(el.odometer = new Odometer({ + el: el, + value: (_ref1 = el.innerText) != null ? _ref1 : el.textContent + })); + } + return _results; + }; + + if ((((_ref1 = document.documentElement) != null ? _ref1.doScroll : void 0) != null) && (document.createEventObject != null)) { + _old = document.onreadystatechange; + document.onreadystatechange = function() { + if (document.readyState === 'complete' && Odometer.options.auto !== false) { + Odometer.init(); + } + return _old != null ? _old.apply(this, arguments) : void 0; + }; + } else { + document.addEventListener('DOMContentLoaded', function() { + if (Odometer.options.auto !== false) { + return Odometer.init(); + } + }, false); + } + + if (typeof define === 'function' && define.amd) { + define([], function() { + return Odometer; + }); + } else if (typeof exports !== "undefined" && exports !== null) { + module.exports = Odometer; + } else { + window.Odometer = Odometer; + } + +}).call(this); diff --git a/swh/web/static/js/odometer/odometer.min.js b/swh/web/static/js/odometer/odometer.min.js new file mode 100644 index 00000000..48da2e91 --- /dev/null +++ b/swh/web/static/js/odometer/odometer.min.js @@ -0,0 +1,2 @@ +/*! odometer 0.4.8 */ +(function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G=[].slice;q='',n=''+q+"",d='8'+n+"",g='',c="(,ddd).dd",h=/^\(?([^)]*)\)?(?:(.)(d+))?$/,i=30,f=2e3,a=20,j=2,e=.5,k=1e3/i,b=1e3/a,o="transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd",y=document.createElement("div").style,p=null!=y.transition||null!=y.webkitTransition||null!=y.mozTransition||null!=y.oTransition,w=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame,l=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,s=function(a){var b;return b=document.createElement("div"),b.innerHTML=a,b.children[0]},v=function(a,b){return a.className=a.className.replace(new RegExp("(^| )"+b.split(" ").join("|")+"( |$)","gi")," ")},r=function(a,b){return v(a,b),a.className+=" "+b},z=function(a,b){var c;return null!=document.createEvent?(c=document.createEvent("HTMLEvents"),c.initEvent(b,!0,!0),a.dispatchEvent(c)):void 0},u=function(){var a,b;return null!=(a=null!=(b=window.performance)&&"function"==typeof b.now?b.now():void 0)?a:+new Date},x=function(a,b){return null==b&&(b=0),b?(a*=Math.pow(10,b),a+=.5,a=Math.floor(a),a/=Math.pow(10,b)):Math.round(a)},A=function(a){return 0>a?Math.ceil(a):Math.floor(a)},t=function(a){return a-x(a)},C=!1,(B=function(){var a,b,c,d,e;if(!C&&null!=window.jQuery){for(C=!0,d=["html","text"],e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(function(a){var b;return b=window.jQuery.fn[a],window.jQuery.fn[a]=function(a){var c;return null==a||null==(null!=(c=this[0])?c.odometer:void 0)?b.apply(this,arguments):this[0].odometer.update(a)}}(a));return e}})(),setTimeout(B,0),m=function(){function a(b){var c,d,e,g,h,i,l,m,n,o,p=this;if(this.options=b,this.el=this.options.el,null!=this.el.odometer)return this.el.odometer;this.el.odometer=this,m=a.options;for(d in m)g=m[d],null==this.options[d]&&(this.options[d]=g);null==(h=this.options).duration&&(h.duration=f),this.MAX_VALUES=this.options.duration/k/j|0,this.resetFormat(),this.value=this.cleanValue(null!=(n=this.options.value)?n:""),this.renderInside(),this.render();try{for(o=["innerHTML","innerText","textContent"],i=0,l=o.length;l>i;i++)e=o[i],null!=this.el[e]&&!function(a){return Object.defineProperty(p.el,a,{get:function(){var b;return"innerHTML"===a?p.inside.outerHTML:null!=(b=p.inside.innerText)?b:p.inside.textContent},set:function(a){return p.update(a)}})}(e)}catch(q){c=q,this.watchForMutations()}}return a.prototype.renderInside=function(){return this.inside=document.createElement("div"),this.inside.className="odometer-inside",this.el.innerHTML="",this.el.appendChild(this.inside)},a.prototype.watchForMutations=function(){var a,b=this;if(null!=l)try{return null==this.observer&&(this.observer=new l(function(a){var c;return c=b.el.innerText,b.renderInside(),b.render(b.value),b.update(c)})),this.watchMutations=!0,this.startWatchingMutations()}catch(c){a=c}},a.prototype.startWatchingMutations=function(){return this.watchMutations?this.observer.observe(this.el,{childList:!0}):void 0},a.prototype.stopWatchingMutations=function(){var a;return null!=(a=this.observer)?a.disconnect():void 0},a.prototype.cleanValue=function(a){var b;return"string"==typeof a&&(a=a.replace(null!=(b=this.format.radix)?b:".",""),a=a.replace(/[.,]/g,""),a=a.replace("","."),a=parseFloat(a,10)||0),x(a,this.format.precision)},a.prototype.bindTransitionEnd=function(){var a,b,c,d,e,f,g=this;if(!this.transitionEndBound){for(this.transitionEndBound=!0,b=!1,e=o.split(" "),f=[],c=0,d=e.length;d>c;c++)a=e[c],f.push(this.el.addEventListener(a,function(){return b?!0:(b=!0,setTimeout(function(){return g.render(),b=!1,z(g.el,"odometerdone")},0),!0)},!1));return f}},a.prototype.resetFormat=function(){var a,b,d,e,f,g,i,j;if(a=null!=(i=this.options.format)?i:c,a||(a="d"),d=h.exec(a),!d)throw new Error("Odometer: Unparsable digit format");return j=d.slice(1,4),g=j[0],f=j[1],b=j[2],e=(null!=b?b.length:void 0)||0,this.format={repeating:g,radix:f,precision:e}},a.prototype.render=function(a){var b,c,d,e,f,g,h;for(null==a&&(a=this.value),this.stopWatchingMutations(),this.resetFormat(),this.inside.innerHTML="",f=this.options.theme,b=this.el.className.split(" "),e=[],g=0,h=b.length;h>g;g++)c=b[g],c.length&&((d=/^odometer-theme-(.+)$/.exec(c))?f=d[1]:/^odometer(-|$)/.test(c)||e.push(c));return e.push("odometer"),p||e.push("odometer-no-transitions"),f?e.push("odometer-theme-"+f):e.push("odometer-auto-theme"),this.el.className=e.join(" "),this.ribbons={},this.formatDigits(a),this.startWatchingMutations()},a.prototype.formatDigits=function(a){var b,c,d,e,f,g,h,i,j,k;if(this.digits=[],this.options.formatFunction)for(d=this.options.formatFunction(a),j=d.split("").reverse(),f=0,h=j.length;h>f;f++)c=j[f],c.match(/0-9/)?(b=this.renderDigit(),b.querySelector(".odometer-value").innerHTML=c,this.digits.push(b),this.insertDigit(b)):this.addSpacer(c);else for(e=!this.format.precision||!t(a)||!1,k=a.toString().split("").reverse(),g=0,i=k.length;i>g;g++)b=k[g],"."===b&&(e=!0),this.addDigit(b,e)},a.prototype.update=function(a){var b,c=this;return a=this.cleanValue(a),(b=a-this.value)?(v(this.el,"odometer-animating-up odometer-animating-down odometer-animating"),b>0?r(this.el,"odometer-animating-up"):r(this.el,"odometer-animating-down"),this.stopWatchingMutations(),this.animate(a),this.startWatchingMutations(),setTimeout(function(){return c.el.offsetHeight,r(c.el,"odometer-animating")},0),this.value=a):void 0},a.prototype.renderDigit=function(){return s(d)},a.prototype.insertDigit=function(a,b){return null!=b?this.inside.insertBefore(a,b):this.inside.children.length?this.inside.insertBefore(a,this.inside.children[0]):this.inside.appendChild(a)},a.prototype.addSpacer=function(a,b,c){var d;return d=s(g),d.innerHTML=a,c&&r(d,c),this.insertDigit(d,b)},a.prototype.addDigit=function(a,b){var c,d,e,f;if(null==b&&(b=!0),"-"===a)return this.addSpacer(a,null,"odometer-negation-mark");if("."===a)return this.addSpacer(null!=(f=this.format.radix)?f:".",null,"odometer-radix-mark");if(b)for(e=!1;;){if(!this.format.repeating.length){if(e)throw new Error("Bad odometer format without digits");this.resetFormat(),e=!0}if(c=this.format.repeating[this.format.repeating.length-1],this.format.repeating=this.format.repeating.substring(0,this.format.repeating.length-1),"d"===c)break;this.addSpacer(c)}return d=this.renderDigit(),d.querySelector(".odometer-value").innerHTML=a,this.digits.push(d),this.insertDigit(d)},a.prototype.animate=function(a){return p&&"count"!==this.options.animation?this.animateSlide(a):this.animateCount(a)},a.prototype.animateCount=function(a){var c,d,e,f,g,h=this;if(d=+a-this.value)return f=e=u(),c=this.value,(g=function(){var i,j,k;return u()-f>h.options.duration?(h.value=a,h.render(),void z(h.el,"odometerdone")):(i=u()-e,i>b&&(e=u(),k=i/h.options.duration,j=d*k,c+=j,h.render(Math.round(c))),null!=w?w(g):setTimeout(g,b))})()},a.prototype.getDigitCount=function(){var a,b,c,d,e,f;for(d=1<=arguments.length?G.call(arguments,0):[],a=e=0,f=d.length;f>e;a=++e)c=d[a],d[a]=Math.abs(c);return b=Math.max.apply(Math,d),Math.ceil(Math.log(b+1)/Math.log(10))},a.prototype.getFractionalDigitCount=function(){var a,b,c,d,e,f,g;for(e=1<=arguments.length?G.call(arguments,0):[],b=/^\-?\d*\.(\d*?)0*$/,a=f=0,g=e.length;g>f;a=++f)d=e[a],e[a]=d.toString(),c=b.exec(e[a]),null==c?e[a]=0:e[a]=c[1].length;return Math.max.apply(Math,e)},a.prototype.resetDigits=function(){return this.digits=[],this.ribbons=[],this.inside.innerHTML="",this.resetFormat()},a.prototype.animateSlide=function(a){var b,c,d,f,g,h,i,j,k,l,m,n,o,p,q,s,t,u,v,w,x,y,z,B,C,D,E;if(s=this.value,j=this.getFractionalDigitCount(s,a),j&&(a*=Math.pow(10,j),s*=Math.pow(10,j)),d=a-s){for(this.bindTransitionEnd(),f=this.getDigitCount(s,a),g=[],b=0,m=v=0;f>=0?f>v:v>f;m=f>=0?++v:--v){if(t=A(s/Math.pow(10,f-m-1)),i=A(a/Math.pow(10,f-m-1)),h=i-t,Math.abs(h)>this.MAX_VALUES){for(l=[],n=h/(this.MAX_VALUES+this.MAX_VALUES*b*e),c=t;h>0&&i>c||0>h&&c>i;)l.push(Math.round(c)),c+=n;l[l.length-1]!==i&&l.push(i),b++}else l=function(){E=[];for(var a=t;i>=t?i>=a:a>=i;i>=t?a++:a--)E.push(a);return E}.apply(this);for(m=w=0,y=l.length;y>w;m=++w)k=l[m],l[m]=Math.abs(k%10);g.push(l)}for(this.resetDigits(),D=g.reverse(),m=x=0,z=D.length;z>x;m=++x)for(l=D[m],this.digits[m]||this.addDigit(" ",m>=j),null==(u=this.ribbons)[m]&&(u[m]=this.digits[m].querySelector(".odometer-ribbon-inner")),this.ribbons[m].innerHTML="",0>d&&(l=l.reverse()),o=C=0,B=l.length;B>C;o=++C)k=l[o],q=document.createElement("div"),q.className="odometer-value",q.innerHTML=k,this.ribbons[m].appendChild(q),o===l.length-1&&r(q,"odometer-last-value"),0===o&&r(q,"odometer-first-value");return 0>t&&this.addDigit("-"),p=this.inside.querySelector(".odometer-radix-mark"),null!=p&&p.parent.removeChild(p),j?this.addSpacer(this.format.radix,this.digits[j-1],"odometer-radix-mark"):void 0}},a}(),m.options=null!=(E=window.odometerOptions)?E:{},setTimeout(function(){var a,b,c,d,e;if(window.odometerOptions){d=window.odometerOptions,e=[];for(a in d)b=d[a],e.push(null!=(c=m.options)[a]?(c=m.options)[a]:c[a]=b);return e}},0),m.init=function(){var a,b,c,d,e,f;if(null!=document.querySelectorAll){for(b=document.querySelectorAll(m.options.selector||".odometer"),f=[],c=0,d=b.length;d>c;c++)a=b[c],f.push(a.odometer=new m({el:a,value:null!=(e=a.innerText)?e:a.textContent}));return f}},null!=(null!=(F=document.documentElement)?F.doScroll:void 0)&&null!=document.createEventObject?(D=document.onreadystatechange,document.onreadystatechange=function(){return"complete"===document.readyState&&m.options.auto!==!1&&m.init(),null!=D?D.apply(this,arguments):void 0}):document.addEventListener("DOMContentLoaded",function(){return m.options.auto!==!1?m.init():void 0},!1),"function"==typeof define&&define.amd?define([],function(){return m}):"undefined"!=typeof exports&&null!==exports?module.exports=m:window.Odometer=m}).call(this); diff --git a/swh/web/templates/api-endpoints.html b/swh/web/templates/api-endpoints.html index 8dbe92d2..4472435e 100644 --- a/swh/web/templates/api-endpoints.html +++ b/swh/web/templates/api-endpoints.html @@ -1,75 +1,75 @@ {% extends "layout.html" %} {% load swh_templatetags %} {% block title %} Endpoints – Software Heritage API {% endblock %} {% block content %}

Below you can find a list of the available endpoints for version 1 of the Software Heritage API. For a more general introduction please refer to the API overview.

Endpoints marked "available" are considered stable for the current version of the API; endpoints marked "upcoming" are work in progress that will be stabilized in the near future.

- +
{% for route, doc in doc_routes %} {% if doc.tags|length > 0 %} {% else %} {% endif %} {% endfor %}
Endpoint Status Description
{% url doc.route_view_name %} {{ doc.tags|join:', ' }}{% url doc.route_view_name %} available{{ doc.doc_intro | safe_docstring_display | safe }}
{% endblock %} diff --git a/swh/web/templates/homepage.html b/swh/web/templates/homepage.html index d98ce96d..63dd9c12 100644 --- a/swh/web/templates/homepage.html +++ b/swh/web/templates/homepage.html @@ -1,58 +1,117 @@ {% extends "layout.html" %} {% load static %} {% block title %}The Software Heritage archive{% endblock %} + +{% block header %} + + +{% endblock %} + {% block content %}

Welcolme to the Software Heritage archive

Overview

The long term goal of the Software Heritage initiative is to collect all publicly available software in source code form together with its development history, replicate it massively to ensure its preservation, and share it with everyone who needs it. The Software Heritage archive is growing over time as we crawl new source code from software projects and development forges. We will incrementally release archive search and browse functionalities — as of now you can check whether source code you care about is already present in the archive or not.

Content

A significant amount of source code has already been ingested in the Software Heritage archive. It currently includes:

  • public repositories from GitHub
  • public repositories from the former Gitorious code hosting service
  • public repositories from the former Google Code project hosting service
  • source packages from the Debian distribution (as of August 2015, via the snapshot service)
  • releases from the GNU project (as of August 2015)

-

Archive access

+

Size

+ +

+ As of today the archive already contains and keeps safe for you the following amount + of objects: + +

+ +
+

Source files

+ 0 +
+
+

Directories

+ 0 +
+
+

Commits

+ 0 +
+
+

Authors

+ 0 +
+
+

Projects

+ 0 +
+
+

Releases

+ 0 +
+
+ +

+ +

Access

+ {% endblock %} \ No newline at end of file diff --git a/swh/web/templates/layout.html b/swh/web/templates/layout.html index 54ad9ff0..476d4bec 100644 --- a/swh/web/templates/layout.html +++ b/swh/web/templates/layout.html @@ -1,81 +1,81 @@ {% load static %} {% block title %}{% endblock %} - + {% block header %}{% endblock %}
{% block content %}{% endblock %}
back to top