Skip to content

Commit

Permalink
Neuen <meta>-Tag in der Werbung integriert, um das Weiterschalten z…
Browse files Browse the repository at this point in the history
…u verzögern. #45
  • Loading branch information
DracoBlue committed Jan 17, 2016
1 parent 9b72374 commit 5bcbba4
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 5 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ Die App beinhaltet direkt eine `config.json`.
"twitter_widget_id": "627066449773875201", // die Twitter Widget ID von https://twitter.com/settings/widgets
"event_location": "Uni-Komplex Am Neuen Palais", // Wenn bei Events der Veranstaltungsort übereinstimmt, wird die Veranstaltung mit gehighlighted
"force_page": null, // kann erzwingen, dass nur eine Seite angezeigt wird. Sollte per ?page= ondemand überschrieben werden.
"ads_update_frequency": 60, // wie häufig Werbug geladen werden soll
"ads": [
"one.html", // welche werbug als erstes angezeigt wird
"two.html" // welche werbung als nächstes angezeigt wird
Expand Down Expand Up @@ -274,7 +273,13 @@ Zusätzlich die config.json erweitern, um:

und dann wird `hans.html` angezeigt, sobald die AdView angezeigt wird.

Mit `ads_update_frequency` ist die Frequenz angegeben in der die Werbug ersetzt wird.
Wenn die Datei folgenden Tag enthält:

``` html
<meta name="next-page-in" content="260" />
```

wird das Schalten zur nächsten Screen um 260 Sekunden verzögert.

# Benutzung als Split-Panel

Expand Down
1 change: 0 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"twitter_widget_id": "641883662246649856",
"event_location": "Uni-Komplex Am Neuen Palais",
"force_page": null,
"ads_update_frequency": 60,
"ads": [
"two.html"
]
Expand Down
8 changes: 7 additions & 1 deletion static/js/views/AdView.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ define('views/AdView', ["jquery", "config", "views/BaseView"], function ($, conf
var that = this;
this.currentIndex = 0;
if (!config.get('ads')) throw new Error('Missing config.ads attribute for AdView');
if (!config.get('ads_update_frequency')) throw new Error('Missing config.ads_update_frequency attribute for AdView');

if (config.get('ads').length == 0) {
$(this.el).addClass('is-hidden');
Expand All @@ -31,6 +30,13 @@ define('views/AdView', ["jquery", "config", "views/BaseView"], function ($, conf
"dataType": "html",
"success": function(response) {
domElement.html(response);

var refreshMetaTag = $(domElement).find('meta[name=next-page-in]');
if (refreshMetaTag) {
jsb.fireEvent('PageSwitcherView::SHOW_NEW_PAGE_IN', {
"seconds": parseInt(refreshMetaTag.attr('content'), 10)
});
}
}
});
}
Expand Down
8 changes: 7 additions & 1 deletion static/js/views/PageSwitcherView.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ define('views/PageSwitcherView', ['jquery', "config", "moment", "views/BaseView"
that.showNextPage();
}, (this.waiting_time / this.max_progress) * 1000);
}

jsb.whenFired('PageSwitcherView::SHOW_NEW_PAGE_IN', function(values) {
that.new_page_in = values.seconds;
that.max_progress = values.seconds;
});
},

showCurrentPage: function() {
Expand Down Expand Up @@ -57,7 +62,8 @@ define('views/PageSwitcherView', ['jquery', "config", "moment", "views/BaseView"

this.showCurrentPage();

this.new_page_in = this.max_progress;
this.max_progress = config.get('switch_page_frequency');
this.new_page_in = config.get('switch_page_frequency');
}

this.render();
Expand Down
1 change: 1 addition & 0 deletions two.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<meta name="next-page-in" content="260" />
<strong class="page-headline"><span class="js_ads_headline">Werbung</span></strong>
<div class="js_body">
<video style="max-width: 100%; max-height: 100%" src="http://streamup.uni-potsdam.de/flash/83040532_hi.mp4" autoplay="autoplay"></video>
Expand Down

0 comments on commit 5bcbba4

Please sign in to comment.