public $infobulle;
public $blendmode = "normal";
public $extra;
+ public $extraraw;
public $id;
public $rot;
public $class;
public $tooltipBackgroundColor = null;
public $parallax = 0;
public $attachLeft = false;
- public $allowsAnimation = false;
+ public $allowsAnimation = true;
+ public $forceTexture = false;
protected $role = 'button';
$v = $matches[1];
}
$k = trim($e[0]);
+
if ($normalizeKey) {
$k = mb_strtolower($k);
}
+ if ($k === 'animationtype') {
+ break;
+ }
$res[$k] = $v;
}
return $res;
}
+ public static function parseAnimationsInExtra($extra)
+ {
+ if (!$extra) {
+ return [];
+ }
+
+ $e = explode('animationtype=', $extra, 2);
+ if (count($e) === 1) {
+ return [];
+ }
+
+ return self::parseAnimations('type=' . $e[1]);
+ }
+
public static function parseAnimations($animations)
{
$anims = explode('---', $animations);
public function __construct($id, $init, &$compiler)
{
$this->_init = $init;
+ $this->extraraw = '';
foreach ($init as $k => $v) {
if ($k == 'extra') {
+ $this->extraraw = $v;
if (CubeIT_Util_Json::isJson($v)) {
$v = CubeIT_Util_Json::decode($v);
} else if (strpos($v, '=') !== false && strpos($v, '&') !== false) {
public function getAdditionnalContent()
{
$res = '';
+
+// if ($this->uid == '831d0b8600') {
+// die($this->allowsAnimation . '/' . $this->image_rollover . '/' . $this->extraraw);
+// }
+
+ if ($this->allowsAnimation) {
+ if (stristr($this->image_rollover, 'type=') && $this instanceof contentLink) {
+ $animations = self::parseAnimations($this->image_rollover);
+ } else {
+ $animations = self::parseAnimationsInExtra($this->extraraw);
+ }
+ if (count($animations)) {
+ foreach ($animations as $animation) {
+ if (isset($animation['blendmode'])) {
+ $this->blendmode = $animation['blendmode'];
+ unset($animation['blendmode']);
+ }
+ if (isset($animation['zindex'])) {
+ if ($animation['zindex'] >= 10) {
+ $this->zindex = $animation['zindex'];
+ } else {
+ $this->zindex += $animation['zindex'];
+ }
+ }
+ if (isset($animation['addzindex'])) {
+ $this->addzindex = $animation['addzindex'];
+ }
+ if (isset($animation['parallax'])) {
+ $this->parallax = $animation['parallax'];
+ unlink($animation['parallax']);
+ }
+ if ($animation['type'] === 'draggable') {
+ $this->defaultZIndex = 70;
+ $this->interactive = true;
+ }
+ }
+
+ $res .= ' data-animations="' . htmlspecialchars(json_encode($animations), ENT_QUOTES) . '" ';
+ if ($this->_isHiddenFirst($animations)) {
+ $res .= ' data-animation-hide ';
+ }
+ if ($this->_isFinallyHidden($animations)) {
+ $res .= ' data-animation-hide-on-leave ';
+ }
+ }
+ }
+ if ($this->forceTexture && $this->getDepth() >= 40) {
+ $res .= ' data-force-texture="1" ';
+ }
+
+
if ($this->role !== '') {
$res .= ' role="' . $this->role . '"';
}
$res .= ' data-parallax="' . $this->parallax . '"';
}
+
return $res;
}
+ protected function _isFinallyHidden($animations)
+ {
+ $hiddenAnimations = ['fadeout', 'unmask'];
+ foreach ($animations as $animation) {
+ if (isset($animation['type']) && in_array($animation['type'], $hiddenAnimations)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected function _isHiddenFirst($animations)
+ {
+ $hiddenAnimations = ['reveal', 'fadein', 'translatefrom'];
+ foreach ($animations as $animation) {
+ if (isset($animation['type']) && in_array($animation['type'], $hiddenAnimations)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
public function getClasses()
{
return $res;
}
- public function getAdditionnalContent()
- {
- $res = parent::getAdditionnalContent();
- if ($this->allowsAnimation) {
- $animations = self::parseAnimations($this->image_rollover);
- foreach ($animations as $animation) {
- if (isset($animation['blendmode'])) {
- $this->blendmode = $animation['blendmode'];
- unset($animation['blendmode']);
- }
- if (isset($animation['zindex'])) {
- if ($animation['zindex'] >= 10) {
- $this->zindex = $animation['zindex'];
- } else {
- $this->zindex += $animation['zindex'];
- }
- }
- if (isset($animation['addzindex'])) {
- $this->addzindex = $animation['addzindex'];
- }
- if (isset($animation['parallax'])) {
- $this->parallax = $animation['parallax'];
- unlink($animation['parallax']);
- }
- if ($animation['type'] === 'draggable') {
- $this->defaultZIndex = 70;
- $this->interactive = true;
- }
- }
- $res .= ' data-animations="' . htmlspecialchars(json_encode($animations), ENT_QUOTES) . '" ';
- if ($this->_isHiddenFirst($animations)) {
- $res .= ' data-animation-hide ';
- }
- if ($this->_isFinallyHidden($animations)) {
- $res .= ' data-animation-hide-on-leave ';
- }
- }
- if ($this->forceTexture && $this->getDepth() >= 40) {
- $res .= ' data-force-texture="1" ';
- }
- return $res;
- }
-
- protected function _isFinallyHidden($animations)
- {
- $hiddenAnimations = ['fadeout', 'unmask'];
- foreach ($animations as $animation) {
- if (isset($animation['type']) && in_array($animation['type'], $hiddenAnimations)) {
- return true;
- }
- }
- return false;
- }
-
- protected function _isHiddenFirst($animations)
- {
- $hiddenAnimations = ['reveal', 'fadein', 'translatefrom'];
- foreach ($animations as $animation) {
- if (isset($animation['type']) && in_array($animation['type'], $hiddenAnimations)) {
- return true;
- }
- }
- return false;
- }
}
class eventOverlayLink extends wsHTML5Link
public function getBackgroundSize()
{
-
$size = '100%';
$animations = self::parseAnimations($this->image_rollover);
foreach ($animations as $animation) {