Initial Commit

This commit is contained in:
2019-11-21 12:25:31 +01:00
commit f4aabcb9b1
13959 changed files with 787761 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
/**
* @author ThemePunch <info@themepunch.com>
* @link http://www.themepunch.com/
* @copyright 2017 ThemePunch
*/
.rs-addon-polyfold {
position: absolute;
left: 0;
width: 100%;
height: auto;
z-index: 1099;
pointer-events: none;
}
.rs-addon-polyfold div {
position: absolute;
border-style: solid;
box-sizing: content-box;
}
.rs-addon-poly-nav-level {z-index: 999}
.rs-addon-poly-static-level {z-index: 99}
.rs-addon-polyfold:not(.rs-addon-poly-center) div:first-child {left: 0}
.rs-addon-polyfold:not(.rs-addon-poly-center) div:last-child {right: 0}
.rs-addon-poly-center div:first-child {right: 50%}
.rs-addon-poly-center div:last-child {left: 50%}
.rs-addon-polyfold:not(.rs-addon-poly-top),
.rs-addon-polyfold:not(.rs-addon-poly-top) div {bottom: 0}
.rs-addon-poly-top {top: 0}
.rs-addon-poly-top div {top: 0}

View File

@@ -0,0 +1,360 @@
/**
* @author ThemePunch <info@themepunch.com>
* @link http://www.themepunch.com/
* @copyright 2017 ThemePunch
*/
;(function() {
'use strict';
var $,
win,
baseClass = 'rs-addon-polyfold',
topClass = 'rs-addon-poly-top',
bottomClass = 'rs-addon-poly-bottom',
centerClass = 'rs-addon-poly-center',
navLevel = 'rs-addon-poly-nav-level',
staticLevel = 'rs-addon-poly-static-level';
window.RsPolyfoldAddOn = function(_$, slider, options) {
if(!_$ || !slider) return;
$ = _$;
win = $(window);
// add hook to listen if the element is removed from the DOM
$.event.special.polyfoldDestroyed = {remove: function(evt) {evt.handler();}};
new RsPolyfold(slider, options);
};
function RsPolyfold(slider, options) {
this.calc = false;
this.slider = slider;
this.scrolled = false;
this.ids = slider[0].id;
this.time = options.time;
this.ease = options.ease;
this.color = options.color;
this.point = options.point;
this.height = options.height;
this.onScroll = options.scroll;
this.inverted = options.inverted;
this.animated = options.animated;
this.negative = options.negative;
this.placement = options.placement;
this.leftWidth = options.leftWidth;
this.rightWidth = options.rightWidth;
this.responsive = options.responsive;
this.range = options.range === 'slider';
this.isTop = options.position === 'top';
this.starter = this.calculate.bind(this);
slider.one('revolution.slide.onloaded', this.init.bind(this));
}
RsPolyfold.prototype = {
init: function() {
// bounce if the slider has been removed from the DOM before the onloaded event fires
if(!document.body.contains(this.slider[0])) {
this.destroy();
return;
}
var animeClass,
cls = baseClass,
container = document.createElement('div'),
frag = document.createDocumentFragment();
this.left = document.createElement('div');
this.right = document.createElement('div');
// poly resizing always based on the first level
this.gridWidth = this.slider[0].opt.gridwidth;
if(Array.isArray(this.gridWidth)) this.gridWidth = this.gridWidth[0];
if(!this.isTop) {
animeClass = bottomClass;
cls += ' ' + bottomClass;
}
else {
animeClass = topClass;
cls += ' ' + topClass;
}
// sets the z-index
if(this.placement > 1) {
cls += ' ';
if(this.placement === 2) {
cls += navLevel;
// set arrow z-index to same as bullets/tabs/thumbs
this.slider.find('.tparrows').css('z-index', 1000);
}
else {
cls += staticLevel;
}
}
// CSS3 transition
if(this.animated) {
var style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = '#' + this.ids + '_wrapper .' + animeClass + ' div ' +
'{transition: border-width ' + this.time + 's ' + this.ease + ';}';
document.getElementsByTagName('head')[0].appendChild(style);
}
// draw from center or sides
if(this.point === 'center') cls += ' ' + centerClass;
frag.appendChild(this.left);
frag.appendChild(this.right);
container.className = cls;
container.appendChild(frag);
// garbage collection from custom event set above
this.slider.one('polyfoldDestroyed', this.destroy.bind(this));
// insert poly div after ".rev_slider"
this.slider[0].parentNode.insertBefore(container, this.slider.nextSibling);
// resize and scroll events
win.on('resize.rspolyaddon' + this.ids, this.resize.bind(this));
if(this.onScroll) win.on('scroll.rspolyaddon' + this.ids, this.draw.bind(this));
// set the border colors
this.colors();
// kick it off
this.resize(false, true);
},
colors: function() {
var leftColor,
rightColor;
if(!this.negative) {
if(!this.isTop) {
leftColor = 'transparent transparent transparent ' + this.color;
rightColor = 'transparent transparent ' + this.color + ' transparent';
}
else {
leftColor = this.color + ' transparent transparent transparent';
rightColor = 'transparent ' + this.color + ' transparent transparent';
}
}
else {
if(!this.isTop) {
leftColor = 'transparent transparent ' + this.color + ' transparent';
rightColor = 'transparent transparent transparent ' + this.color;
}
else {
leftColor = "transparent " + this.color + " transparent transparent";
rightColor = this.color + " transparent transparent transparent";
}
}
this.left.style.borderColor = leftColor;
this.right.style.borderColor = rightColor;
},
draw: function(event) {
var offset,
leftWidth,
rightWidth;
if(this.onScroll) {
if(event) this.scrolled = true;
var slideRect = this.slider[0].getBoundingClientRect();
// if slider is in viewport
if(slideRect.top + window.pageYOffset < this.winHeight + window.pageYOffset && slideRect.bottom > 0) {
if(!this.isTop) {
if(!this.inverted) {
offset = this.calc !== false ? slideRect.bottom - this.calc : this.left.getBoundingClientRect().top;
this.calc = this.polyHeight * ((this.drawHeight - offset) / this.drawHeight);
}
else {
offset = this.calc !== false ? slideRect.bottom : this.left.getBoundingClientRect().top;
this.calc = this.polyHeight - (this.polyHeight * (((this.drawHeight - offset) / this.drawHeight)));
}
}
else {
var dif = this.range ? this.winHeight - this.sliderHeight : 0;
if(!this.inverted) {
offset = this.calc !== false ? slideRect.top + this.calc : this.left.getBoundingClientRect().top;
this.calc = this.polyHeight * ((offset - dif) / this.drawHeight);
}
else {
offset = this.calc !== false ? slideRect.top : this.left.getBoundingClientRect().top;
this.calc = this.polyHeight - (this.polyHeight * ((offset - dif) / this.drawHeight));
}
}
this.calc = Math.floor(Math.min(Math.max(this.calc, 0), this.polyHeight));
}
else {
return 1;
}
}
// simple fixed draw for no scroll setting
else {
this.calc = this.polyHeight;
}
if(!this.negative) {
if(!this.isTop) {
leftWidth = this.calc + 'px 0 0 ' + Math.ceil(this.drawWidth * this.leftWidth) + 'px';
rightWidth = '0 0 ' + this.calc + 'px ' + Math.ceil(this.drawWidth * this.rightWidth) + 'px';
}
else {
leftWidth = this.calc + 'px ' + Math.ceil(this.drawWidth * this.leftWidth) + 'px 0 0';
rightWidth = '0 ' + Math.ceil(this.drawWidth * this.rightWidth) + 'px ' + this.calc + 'px 0';
}
}
else {
if(!this.isTop) {
leftWidth = '0 0 ' + this.calc + 'px ' + Math.ceil(this.drawWidth * this.leftWidth) + 'px';
rightWidth = this.calc + 'px 0 0 ' + Math.ceil(this.drawWidth * this.rightWidth) + 'px';
}
else {
leftWidth = "0 " + Math.ceil(this.drawWidth * this.leftWidth) + "px " + this.calc + 'px 0';
rightWidth = this.calc + 'px ' + Math.ceil(this.drawWidth * this.rightWidth) + 'px 0 0';
}
}
this.left.style.borderWidth = leftWidth;
this.right.style.borderWidth = rightWidth;
if(this.onScroll) return offset;
},
resize: function(event, init) {
this.winHeight = window.innerHeight;
this.drawWidth = this.slider[0].clientWidth;
this.sliderHeight = this.slider[0].clientHeight;
this.drawHeight = this.range ? this.sliderHeight : this.winHeight;
this.polyHeight = this.responsive ? Math.round(this.height * (this.drawWidth / this.gridWidth)) : this.height;
// always make slider.height the max-height
this.polyHeight = Math.min(this.polyHeight, this.sliderHeight);
if(!init || !this.onScroll) {
this.draw();
}
// need to draw a few times on document.ready for accuracy
else if(this.onScroll) {
this.oldOffset = 0;
this.newOffset = 1;
this.calculate();
}
},
calculate: function() {
// need to draw a few times on document.ready for accuracy
if(!this.scrolled && this.newOffset !== this.oldOffset) {
this.oldOffset = this.newOffset;
this.newOffset = this.draw();
window.requestAnimationFrame(this.starter);
}
else {
delete this.starter;
}
},
destroy: function() {
win.off('scroll.rspolyaddon' + this.ids + ' resize.rspolyaddon' + this.ids);
for(var prop in this) if(this.hasOwnProperty(prop)) delete this[prop];
}
};
})();

View File

@@ -0,0 +1,16 @@
/**
* @author ThemePunch <info@themepunch.com>
* @link http://www.themepunch.com/
* @copyright 2017 ThemePunch
*/
;(function(){function g(b,a){this.calc=!1;this.slider=b;this.scrolled=!1;this.ids=b[0].id;this.time=a.time;this.ease=a.ease;this.color=a.color;this.point=a.point;this.height=a.height;this.onScroll=a.scroll;this.inverted=a.inverted;this.animated=a.animated;this.negative=a.negative;this.placement=a.placement;this.leftWidth=a.leftWidth;this.rightWidth=a.rightWidth;this.responsive=a.responsive;this.range="slider"===a.range;this.isTop="top"===a.position;this.starter=this.calculate.bind(this);b.one("revolution.slide.onloaded",
this.init.bind(this))}var d,e;window.RsPolyfoldAddOn=function(b,a,c){b&&a&&(d=b,e=d(window),d.event.special.polyfoldDestroyed={remove:function(a){a.handler()}},new g(a,c))};g.prototype={init:function(){if(document.body.contains(this.slider[0])){var b,a="rs-addon-polyfold",c=document.createElement("div"),d=document.createDocumentFragment();this.left=document.createElement("div");this.right=document.createElement("div");this.gridWidth=this.slider[0].opt.gridwidth;Array.isArray(this.gridWidth)&&(this.gridWidth=
this.gridWidth[0]);this.isTop?(b="rs-addon-poly-top",a+=" rs-addon-poly-top"):(b="rs-addon-poly-bottom",a+=" rs-addon-poly-bottom");1<this.placement&&(a+=" ",2===this.placement?(a+="rs-addon-poly-nav-level",this.slider.find(".tparrows").css("z-index",1E3)):a+="rs-addon-poly-static-level");if(this.animated){var f=document.createElement("style");f.type="text/css";f.innerHTML="#"+this.ids+"_wrapper ."+b+" div {transition: border-width "+this.time+"s "+this.ease+";}";document.getElementsByTagName("head")[0].appendChild(f)}"center"===
this.point&&(a+=" rs-addon-poly-center");d.appendChild(this.left);d.appendChild(this.right);c.className=a;c.appendChild(d);this.slider.one("polyfoldDestroyed",this.destroy.bind(this));this.slider[0].parentNode.insertBefore(c,this.slider.nextSibling);e.on("resize.rspolyaddon"+this.ids,this.resize.bind(this));if(this.onScroll)e.on("scroll.rspolyaddon"+this.ids,this.draw.bind(this));this.colors();this.resize(!1,!0)}else this.destroy()},colors:function(){var b,a;this.negative?this.isTop?(b="transparent "+
this.color+" transparent transparent",a=this.color+" transparent transparent transparent"):(b="transparent transparent "+this.color+" transparent",a="transparent transparent transparent "+this.color):this.isTop?(b=this.color+" transparent transparent transparent",a="transparent "+this.color+" transparent transparent"):(b="transparent transparent transparent "+this.color,a="transparent transparent "+this.color+" transparent");this.left.style.borderColor=b;this.right.style.borderColor=a},draw:function(b){var a,
c;if(this.onScroll)if(b&&(this.scrolled=!0),a=this.slider[0].getBoundingClientRect(),a.top+window.pageYOffset<this.winHeight+window.pageYOffset&&0<a.bottom)this.isTop?(b=this.range?this.winHeight-this.sliderHeight:0,this.inverted?(a=!1!==this.calc?a.top:this.left.getBoundingClientRect().top,this.calc=this.polyHeight-(a-b)/this.drawHeight*this.polyHeight):(a=!1!==this.calc?a.top+this.calc:this.left.getBoundingClientRect().top,this.calc=(a-b)/this.drawHeight*this.polyHeight)):this.inverted?(a=!1!==
this.calc?a.bottom:this.left.getBoundingClientRect().top,this.calc=this.polyHeight-(this.drawHeight-a)/this.drawHeight*this.polyHeight):(a=!1!==this.calc?a.bottom-this.calc:this.left.getBoundingClientRect().top,this.calc=(this.drawHeight-a)/this.drawHeight*this.polyHeight),this.calc=Math.floor(Math.min(Math.max(this.calc,0),this.polyHeight));else return 1;else this.calc=this.polyHeight;this.negative?this.isTop?(b="0 "+Math.ceil(this.drawWidth*this.leftWidth)+"px "+this.calc+"px 0",c=this.calc+"px "+
Math.ceil(this.drawWidth*this.rightWidth)+"px 0 0"):(b="0 0 "+this.calc+"px "+Math.ceil(this.drawWidth*this.leftWidth)+"px",c=this.calc+"px 0 0 "+Math.ceil(this.drawWidth*this.rightWidth)+"px"):this.isTop?(b=this.calc+"px "+Math.ceil(this.drawWidth*this.leftWidth)+"px 0 0",c="0 "+Math.ceil(this.drawWidth*this.rightWidth)+"px "+this.calc+"px 0"):(b=this.calc+"px 0 0 "+Math.ceil(this.drawWidth*this.leftWidth)+"px",c="0 0 "+this.calc+"px "+Math.ceil(this.drawWidth*this.rightWidth)+"px");this.left.style.borderWidth=
b;this.right.style.borderWidth=c;if(this.onScroll)return a},resize:function(b,a){this.winHeight=window.innerHeight;this.drawWidth=this.slider[0].clientWidth;this.sliderHeight=this.slider[0].clientHeight;this.drawHeight=this.range?this.sliderHeight:this.winHeight;this.polyHeight=this.responsive?Math.round(this.drawWidth/this.gridWidth*this.height):this.height;this.polyHeight=Math.min(this.polyHeight,this.sliderHeight);a&&this.onScroll?this.onScroll&&(this.oldOffset=0,this.newOffset=1,this.calculate()):
this.draw()},calculate:function(){this.scrolled||this.newOffset===this.oldOffset?delete this.starter:(this.oldOffset=this.newOffset,this.newOffset=this.draw(),window.requestAnimationFrame(this.starter))},destroy:function(){e.off("scroll.rspolyaddon"+this.ids+" resize.rspolyaddon"+this.ids);for(var b in this)this.hasOwnProperty(b)&&delete this[b]}}})();

View File

@@ -0,0 +1,40 @@
<?php
/*
* @author ThemePunch <info@themepunch.com>
* @link http://www.themepunch.com/
* @copyright 2017 ThemePunch
*/
if( !defined( 'ABSPATH') ) exit();
require_once(RS_POLYFOLD_PLUGIN_PATH . 'framework/slider.front.class.php');
class RsPolyfoldSliderFront extends RsAddonPolyfoldSliderFront {
protected static $_Version,
$_PluginUrl,
$_PluginTitle;
public function __construct($_version, $_pluginUrl, $_pluginTitle, $_isAdmin = false) {
static::$_Version = $_version;
static::$_PluginUrl = $_pluginUrl;
static::$_PluginTitle = $_pluginTitle;
if(!$_isAdmin) {
parent::enqueueScripts();
}
else {
parent::enqueuePreview();
}
parent::writeInitScript();
}
}
?>