Skip to content

Commit

Permalink
Review automatic updates ajax url
Browse files Browse the repository at this point in the history
  • Loading branch information
rodfersou committed May 27, 2016
1 parent 46b796d commit 7d38622
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Expand Up @@ -4,6 +4,9 @@ Changelog
1.1b3 (unreleased)
------------------

- Review automatic updates ajax url.
[rodfersou]

- Use absolute paths to link to micro-updates.
[hvelarde]

Expand Down
7 changes: 6 additions & 1 deletion src/collective/liveblog/browser/templates/update.pt
Expand Up @@ -134,8 +134,13 @@
/* keep page updated */
setInterval(function () {
"use strict";
// Javascript URL parser: https://gist.github.com/jlong/2428561
var parser = document.createElement('a');
parser.href = location.href;
parser.pathname = parser.pathname.replace(/\/update*|\/view*/, '');
parser.pathname = parser.pathname + '/recent-updates';
$.ajax({
url: "recent-updates",
url: parser.href,
success: function (data) {
if (typeof data !== 'string') {
data = '';
Expand Down
7 changes: 6 additions & 1 deletion src/collective/liveblog/browser/templates/view.pt
Expand Up @@ -88,8 +88,13 @@
/* keep page updated */
setInterval(function () {
"use strict";
// Javascript URL parser: https://gist.github.com/jlong/2428561
var parser = document.createElement('a');
parser.href = location.href;
parser.pathname = parser.pathname.replace(/\/update*|\/view*/, '');
parser.pathname = parser.pathname + '/recent-updates';
$.ajax({
url: "recent-updates",
url: parser.href,
success: function (data) {
$("#micro-updates").prepend(data).fadeIn("slow");
/* in some cases a micro-update could be duplicated; remove it */
Expand Down

0 comments on commit 7d38622

Please sign in to comment.