Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
flexslider
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hebotek
flexslider
Commits
731d21f7
Commit
731d21f7
authored
Feb 18, 2013
by
Andy Hausmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved handling of Inline JS by adding a new ViewHelper.
parent
d7f02315
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
114 additions
and
25 deletions
+114
-25
Div.php
Classes/Utility/Div.php
+20
-0
AddJsInlineViewHelper.php
Classes/ViewHelpers/AddJsInlineViewHelper.php
+68
-0
JavaScript.html
Resources/Private/Partials/JavaScript.html
+1
-24
JavaScriptRaw.html
Resources/Private/Partials/JavaScriptRaw.html
+24
-0
List.html
Resources/Private/Templates/FlexSlider/List.html
+1
-1
No files found.
Classes/Utility/Div.php
View file @
731d21f7
...
...
@@ -4,6 +4,7 @@
* Copyright notice
*
* (c) 2012-2013 Andy Hausmann <andy@sota-studio.de>
* (c) 2012-2013 Xaver Maierhofer <xaver.maierhofer@xwissen.info>
*
* All rights reserved
*
...
...
@@ -28,6 +29,7 @@
* Helper Class which makes various tools and helper available
*
* @author Andy Hausmann <andy@sota-studio.de>
* @author Xaver Maierhofer <xaver.maierhofer@xwissen.info>
* @package flexslider
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later
*/
...
...
@@ -115,6 +117,24 @@ class Tx_Flexslider_Utility_Div
}
}
/**
* Checks a passed CSS or JS file and adds it to the Frontend.
*
* @param string $script JS Block
* @param string $addUnique Unique key to avoid multiple inclusions
* @param bool $moveToFooter Flag to include file into footer - doesn't work for CSS files
*/
public
static
function
addJsInline
(
$code
,
$name
,
$moveToFooter
=
false
)
{
if
(
$code
)
{
//$code = '<script type="text/javascript">'.$code.'</script>';
(
$moveToFooter
)
?
$GLOBALS
[
'TSFE'
]
->
getPageRenderer
()
->
addJsFooterInlineCode
(
$name
,
$code
)
:
$GLOBALS
[
'TSFE'
]
->
getPageRenderer
()
->
addJsInlineCode
(
$name
,
$code
);
}
}
/**
* Adds/renders a Flash message.
*
...
...
Classes/ViewHelpers/AddJsInlineViewHelper.php
0 → 100644
View file @
731d21f7
<?php
/***************************************************************
* Copyright notice
*
* (c) 2012-2013 Andy Hausmann <andy@sota-studio.de>
* (c) 2012-2013 Xaver Maierhofer <xaver.maierhofer@xwissen.info>
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
*
* Renders Inline JS via PageRenderer and enables Plugins to throw it into external files,
* close to the ending body tag or just to special stuff with it, like concatenation, compression and such.
*
* = Examples =
*
* <code title="Single argument">
* <fs:AddJsInline code="$();" name="unique-name" moveToFooter="0" />
* </code>
* <output>
* </output>
*
* @author Andy Hausmann <andy@sota-studio.de>
* @author Xaver Maierhofer <xaver.maierhofer@xwissen.info>
* @package flexslider
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later
*/
class
Tx_Flexslider_ViewHelpers_AddJsInlineViewHelper
extends
Tx_Fluid_Core_ViewHelper_AbstractTagBasedViewHelper
{
/**
* Adds JS and CSS to the frontend
*
* @param null $code The JS code
* @param bool $moveToFooter Move the the ending body tag?
* @param null $uniqueLabel Unique label in order to avoid multiple code blocks of the same code.
* @return void
*/
public
function
render
(
$code
=
null
,
$name
=
''
,
$moveToFooter
=
false
)
{
if
(
$code
)
{
Tx_Flexslider_Utility_Div
::
addJsInline
(
$code
,
$name
,
$moveToFooter
);
}
}
}
?>
\ No newline at end of file
Resources/Private/Partials/JavaScript.html
View file @
731d21f7
<script
type=
"text/javascript"
>
<!
[
CDATA
[
$
(
window
).
load
(
function
()
{
]]
>
$
(
'#fs-{data.uid}.flexslider'
).
flexslider
(
<!
[
CDATA
[
{
]]
>
animation
:
"{settings.animation}"
,
slideDirection
:
"{settings.slideDirection}"
,
slideshow
:
<
f
:
if
condition
=
"{settings.slideshow} > 0"
><
f
:
then
>
true
<
/f:then><f:else>false</
f
:
else
><
/f:if>
,
slideshowSpeed
:
<
f
:
if
condition
=
"{settings.slideshowSpeed} > 0"
><
f
:
then
>
{
settings
.
slideshowSpeed
}
<
/f:then><f:else>7000</
f
:
else
><
/f:if>
,
animationDuration
:
<
f
:
if
condition
=
"{settings.animationDuration} > 0"
><
f
:
then
>
{
settings
.
animationDuration
}
<
/f:then><f:else>600</
f
:
else
><
/f:if>
,
controlNav
:
<
f
:
if
condition
=
"{settings.controlNav} > 0"
><
f
:
then
>
true
<
/f:then><f:else>false</
f
:
else
><
/f:if>
,
directionNav
:
<
f
:
if
condition
=
"{settings.directionNav} > 0"
><
f
:
then
>
true
<
/f:then><f:else>false</
f
:
else
><
/f:if>
,
keyboardNav
:
<
f
:
if
condition
=
"{settings.keyboardNav} > 0"
><
f
:
then
>
true
<
/f:then><f:else>false</
f
:
else
><
/f:if>
,
mousewheel
:
<
f
:
if
condition
=
"{settings.mousewheel} > 0"
><
f
:
then
>
true
<
/f:then><f:else>false</
f
:
else
><
/f:if>
,
prevText
:
"<f:translate key="
prevText
">Prev</f:translate>"
,
nextText
:
"<f:translate key="
nextText
">Next</f:translate>"
,
pausePlay
:
<
f
:
if
condition
=
"{settings.pausePlay} > 0"
><
f
:
then
>
true
<
/f:then><f:else>false</
f
:
else
><
/f:if>
,
pauseText
:
"<f:translate key="
pauseText
">Pause</f:translate>"
,
playText
:
"<f:translate key="
playText
">Play</f:translate>"
,
randomize
:
<
f
:
if
condition
=
"{settings.randomize} > 0"
><
f
:
then
>
true
<
/f:then><f:else>false</
f
:
else
><
/f:if>
,
animationLoop
:
<
f
:
if
condition
=
"{settings.animationLoop} > 0"
><
f
:
then
>
true
<
/f:then><f:else>false</
f
:
else
><
/f:if>
,
pauseOnHover
:
<
f
:
if
condition
=
"{settings.pauseOnHover} > 0"
><
f
:
then
>
true
<
/f:then><f:else>false</
f
:
else
><
/f:if
>
<!
[
CDATA
[
});
});
]]
>
<
f
:
render
partial
=
'JavaScriptRaw'
arguments
=
'{settings: settings, data: data}'
/>
</script>
\ No newline at end of file
Resources/Private/Partials/JavaScriptRaw.html
0 → 100644
View file @
731d21f7
<![CDATA[ $(window).load(function() { ]]>
$('#fs-{data.uid}.flexslider').flexslider(
<![CDATA[{]]>
animation: "{settings.animation}",
slideDirection: "{settings.slideDirection}",
slideshow:
<f:if
condition=
"{settings.slideshow} > 0"
><f:then>
true
</f:then><f:else>
false
</f:else></f:if>
,
slideshowSpeed:
<f:if
condition=
"{settings.slideshowSpeed} > 0"
><f:then>
{settings.slideshowSpeed}
</f:then><f:else>
7000
</f:else></f:if>
,
animationDuration:
<f:if
condition=
"{settings.animationDuration} > 0"
><f:then>
{settings.animationDuration}
</f:then><f:else>
600
</f:else></f:if>
,
controlNav:
<f:if
condition=
"{settings.controlNav} > 0"
><f:then>
true
</f:then><f:else>
false
</f:else></f:if>
,
directionNav:
<f:if
condition=
"{settings.directionNav} > 0"
><f:then>
true
</f:then><f:else>
false
</f:else></f:if>
,
keyboardNav:
<f:if
condition=
"{settings.keyboardNav} > 0"
><f:then>
true
</f:then><f:else>
false
</f:else></f:if>
,
mousewheel:
<f:if
condition=
"{settings.mousewheel} > 0"
><f:then>
true
</f:then><f:else>
false
</f:else></f:if>
,
prevText: "
<f:translate
key=
"prevText"
>
Prev
</f:translate>
",
nextText: "
<f:translate
key=
"nextText"
>
Next
</f:translate>
",
pausePlay:
<f:if
condition=
"{settings.pausePlay} > 0"
><f:then>
true
</f:then><f:else>
false
</f:else></f:if>
,
pauseText: "
<f:translate
key=
"pauseText"
>
Pause
</f:translate>
",
playText: "
<f:translate
key=
"playText"
>
Play
</f:translate>
",
randomize:
<f:if
condition=
"{settings.randomize} > 0"
><f:then>
true
</f:then><f:else>
false
</f:else></f:if>
,
animationLoop:
<f:if
condition=
"{settings.animationLoop} > 0"
><f:then>
true
</f:then><f:else>
false
</f:else></f:if>
,
pauseOnHover:
<f:if
condition=
"{settings.pauseOnHover} > 0"
><f:then>
true
</f:then><f:else>
false
</f:else></f:if>
<![CDATA[
});
});
]]>
\ No newline at end of file
Resources/Private/Templates/FlexSlider/List.html
View file @
731d21f7
...
...
@@ -9,7 +9,7 @@
<f:if
condition=
"<f:count subject='{flexSliders}' /> > 0"
>
<f:render
partial=
"ResourceFiles"
arguments=
"{settings: settings}"
/>
<f:render
partial=
"JavaScript"
arguments=
"{settings: settings, data: data}"
/>
<f:render
partial=
"JavaScript"
arguments=
"{settings: settings, data: data}"
/>
<div
class=
"flexslider"
id=
"fs-{data.uid}"
>
<ul
class=
"slides"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment