1
0
mirror of https://github.com/typemill/typemill.git synced 2025-01-16 21:08:20 +01:00

Merge pull request #502 from josefpavlik/figureSwipe_plugin

addJS and addInlineJS allow to specify attributes for tag <script>
This commit is contained in:
trendschau 2024-12-22 06:07:00 +01:00 committed by GitHub
commit a6c29a01c0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 8 deletions

View File

@ -82,19 +82,19 @@ class Assets
$this->inlineCSS[] = '<style>' . $CSS . '</style>';
}
public function addJS($JS)
public function addJS($JS, $attr)
{
$JSfile = $this->getFileUrl($JS);
if($JSfile)
{
$this->JS[] = '<script src="' . $JSfile . '"></script>';
$this->JS[] = '<script ' . $attr . ' src="' . $JSfile . '"></script>';
}
}
public function addInlineJS($JS)
public function addInlineJS($JS, $attr)
{
$this->inlineJS[] = '<script>' . $JS . '</script>';
$this->inlineJS[] = '<script' . $attr . '>' . $JS . '</script>';
}
public function addBloxConfigJS($JS)

View File

@ -201,14 +201,14 @@ abstract class Plugin implements EventSubscriberInterface
$this->container->get('view')->getEnvironment()->addFunction($function);
}
protected function addJS($JS)
protected function addJS($JS, $attr="")
{
$this->container->get('assets')->addJS($JS);
$this->container->get('assets')->addJS($JS, $attr);
}
protected function addInlineJS($JS)
protected function addInlineJS($JS, $attr="")
{
$this->container->get('assets')->addInlineJS($JS);
$this->container->get('assets')->addInlineJS($JS, $attr);
}
protected function addBloxConfigJS($JS)