Fix next page button when url doesn't end with page number

This commit is contained in:
Matthias Grundmann 2018-06-07 19:07:58 +02:00
parent c510bd9bf1
commit 89f6a73275
No known key found for this signature in database
GPG Key ID: CF3BB4CEC9904593

View File

@ -32,7 +32,11 @@ define(['jquery',
} }
this.set('content',content); this.set('content',content);
this.set('lessonUrl',document.URL.replace(/\.lesson.*/,'.lesson')); this.set('lessonUrl',document.URL.replace(/\.lesson.*/,'.lesson'));
this.set('pageNum',document.URL.replace(/.*\.lesson\/(\d{1,4})$/,'$1')); if (/.*\.lesson\/(\d{1,4})$/.test(document.URL)) {
this.set('pageNum',document.URL.replace(/.*\.lesson\/(\d{1,4})$/,'$1'));
} else {
this.set('pageNum',0);
}
this.trigger('content:loaded',this,loadHelps); this.trigger('content:loaded',this,loadHelps);
}, },