From f48e78d5c8078556a3b29452956b90c41d9b6d56 Mon Sep 17 00:00:00 2001 From: Martin Monperrus Date: Sun, 15 Dec 2019 16:59:21 +0000 Subject: [PATCH] fix: add support for progressive enhancement in included mode (#100) --- bibtexbrowser-test.php | 3 ++- bibtexbrowser.php | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/bibtexbrowser-test.php b/bibtexbrowser-test.php index d8cc0d1..655591c 100755 --- a/bibtexbrowser-test.php +++ b/bibtexbrowser-test.php @@ -66,6 +66,7 @@ class BTBTest extends PHPUnit_Framework_TestCase { // resetting the default link style bibtexbrowser_configure('BIBTEXBROWSER_LINK_STYLE','bib2links_default'); bibtexbrowser_configure('ABBRV_TYPE','index'); + bibtexbrowser_configure('BIBTEXBROWSER_USE_PROGRESSIVE_ENHANCEMENT', false); } function test_checkdoc() { @@ -759,7 +760,7 @@ class BTBTest extends PHPUnit_Framework_TestCase { $d = new SimpleDisplay(); $d->setDB($db); ob_start(); - $d->display(); + NoWrapper($d); $output = ob_get_clean(); $res = eval("return ".file_get_contents('reference-output-wp-publications.txt').";"); $this->assertEquals(strip_tags($res['rendered']), "[wp-publications bib=sample.bib all=1] gives:\n".strip_tags($output)."\n"); diff --git a/bibtexbrowser.php b/bibtexbrowser.php index 2bd0da4..62ac483 100755 --- a/bibtexbrowser.php +++ b/bibtexbrowser.php @@ -4210,7 +4210,7 @@ if (method_exists($content, 'getTitle')) { $content->display(); echo poweredby(); - if (BIBTEXBROWSER_USE_PROGRESSIVE_ENHANCEMENT) { + if (c('BIBTEXBROWSER_USE_PROGRESSIVE_ENHANCEMENT')) { javascript(); } @@ -4235,6 +4235,9 @@ usage: */ function NoWrapper($content) { echo $content->display(); + if (c('BIBTEXBROWSER_USE_PROGRESSIVE_ENHANCEMENT')) { + javascript(); + } } /** is used to create an subset of a bibtex file.