Merge pull request #480 from matthias-g/fixPageNum

Fix next page button when url doesn't end with page number
This commit is contained in:
misfir3 2018-06-07 11:27:29 -06:00 committed by GitHub
commit 0030c7bdfb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,7 +32,11 @@ define(['jquery',
}
this.set('content',content);
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);
},