Merge branch 'develop'

This commit is contained in:
Lars Jung 2014-06-25 02:56:08 +02:00
commit 236293ce86
6 changed files with 29 additions and 19 deletions

View file

@ -2,6 +2,13 @@
**h5ai** uses [semantic versioning](http://semver.org/). **h5ai** uses [semantic versioning](http://semver.org/).
## v0.25.1 - *2014-06-25*
* fixes broken paths for filenames containing '+' characters
* fixes Google Universal Analytics
* fixes file type check
## v0.25.0 - *2014-06-22* ## v0.25.0 - *2014-06-22*
* adds sidebar * adds sidebar

View file

@ -1,6 +1,6 @@
{ {
"name": "h5ai", "name": "h5ai",
"version": "0.25.0", "version": "0.25.1",
"description": "a modern HTTP web server index", "description": "a modern HTTP web server index",
"url": "http://larsjung.de/h5ai/", "url": "http://larsjung.de/h5ai/",
"author": "Lars Jung", "author": "Lars Jung",

View file

@ -14,7 +14,7 @@ modulejs.define('core/types', ['config', '_'], function (config, _) {
_.each(types, function (patterns, type) { _.each(types, function (patterns, type) {
var pattern = '^' + _.map(patterns, function (p) { return escapeRegExp(p).replace(/\*/g, '.*'); }).join('|') + '$'; var pattern = '^(' + _.map(patterns, function (p) { return '(' + escapeRegExp(p).replace(/\*/g, '.*') + ')'; }).join('|') + ')$';
regexps[type] = new RegExp(pattern, 'i'); regexps[type] = new RegExp(pattern, 'i');
}); });
}, },

View file

@ -28,24 +28,25 @@ modulejs.define('ext/google-analytics-ga', ['_', 'core/settings'], function (_,
}); });
modulejs.define('ext/google-analytics-ua', ['_', 'core/settings'], function (_, allsettings) { modulejs.define('ext/google-analytics-ua', ['_', 'core/settings', 'core/event'], function (_, allsettings, event) {
var settings = _.extend({ var settings = _.extend({
enabled: false, enabled: false,
calls: [] id: 'UA-000000-0'
}, allsettings['google-analytics-ua']), }, allsettings['google-analytics-ua']),
win = window,
doc = document,
scriptLiteral = 'script',
id = 'h5ai-ga',
init = function () { init = function () {
if (!settings.enabled) { if (!settings.enabled) {
return; return;
} }
var win = window, var el, firstScriptElement;
doc = document,
scriptLiteral = 'script',
id = 'ga',
el, firstScriptElement;
win.GoogleAnalyticsObject = id; win.GoogleAnalyticsObject = id;
win[id] = win[id] || function () { win[id] = win[id] || function () {
@ -60,8 +61,16 @@ modulejs.define('ext/google-analytics-ua', ['_', 'core/settings'], function (_,
firstScriptElement = doc.getElementsByTagName(scriptLiteral)[0]; firstScriptElement = doc.getElementsByTagName(scriptLiteral)[0];
firstScriptElement.parentNode.insertBefore(el, firstScriptElement); firstScriptElement.parentNode.insertBefore(el, firstScriptElement);
_.each(settings.calls, function (call) { win[id]('create', settings.id, 'auto');
win[id].apply(win, call);
event.sub('location.changed', function (item) {
var loc = win.location;
win[id]('send', 'pageview', {
location: loc.protocol + '//' + loc.hostname + item.absHref,
page: loc.protocol + '//' + loc.host + item.absHref,
title: _.pluck(item.getCrumb(), 'label').join(' > ')
});
}); });
}; };

View file

@ -155,17 +155,11 @@ Options
/* /*
Adds Google Universial Analytics asynchronous tracking code. Adds Google Universial Analytics asynchronous tracking code.
for example:
"calls": [
['create', 'UA-XXXX-Y', 'auto'],
['send', 'pageview']
]
see: https://developers.google.com/analytics/devguides/collection/analyticsjs/ see: https://developers.google.com/analytics/devguides/collection/analyticsjs/
*/ */
"google-analytics-ua": { "google-analytics-ua": {
"enabled": false, "enabled": false,
"calls": [] "id": "UA-000000-0"
}, },
/* /*

View file

@ -2,7 +2,7 @@
function normalize_path($path, $trailing_slash = false) { function normalize_path($path, $trailing_slash = false) {
$path = preg_replace("#\\+|/+#", "/", $path); $path = preg_replace("#\\\\+|/+#", "/", $path);
return preg_match("#^(\w:)?/$#", $path) ? $path : (rtrim($path, "/") . ($trailing_slash ? "/" : "")); return preg_match("#^(\w:)?/$#", $path) ? $path : (rtrim($path, "/") . ($trailing_slash ? "/" : ""));
} }