Version Description
Download this release
Release Info
Developer | niteo |
Plugin | CMP – Coming Soon & Maintenance Plugin by NiteoThemes |
Version | 3.6.1 |
Comparing to | |
See all releases |
Code changes from version 3.6 to 3.6.1
- cmp-advanced.php +3 -3
- cmp-settings.php +4 -5
- inc/class-cmp-render_html.php +4 -98
- inc/settings/settings-background.php +2 -6
- js/external/vidim.min.js +1 -8
- niteo-cmp.php +2 -2
- readme.txt +7 -1
cmp-advanced.php
CHANGED
@@ -295,7 +295,7 @@ $mode_change_email = get_option('niteoCS_mode_change_email_address', get_opt
|
|
295 |
|
296 |
<td>
|
297 |
<fieldset class="page-whitelist-switch x1" style="margin-top: 1em;">
|
298 |
-
<h4><?php _e('CMP Whitelist -
|
299 |
<select name="niteoCS_page-whitelist[]" class="cmp-whitelist-select" multiple="multiple">
|
300 |
<option value="-1" <?php echo in_array('-1', $niteoCS_page_whitelist) ? 'selected' : '';?>><?php _e('Homepage', 'cmp-coming-soon-maintenance');?></option>
|
301 |
<?php
|
@@ -307,7 +307,7 @@ $mode_change_email = get_option('niteoCS_mode_change_email_address', get_opt
|
|
307 |
|
308 |
<p class="cmp-hint" style="margin-top:0"><?php _e('By default CMP is enabled on all pages. Leave this field empty to use default settings.', 'cmp-coming-soon-maintenance');?></p>
|
309 |
|
310 |
-
<h4><?php _e('You can also add the
|
311 |
<textarea name="niteoCS-whitelist-custom" cols="40" rows="5"><?php
|
312 |
if ( !empty($niteoCS_page_whitelist_custom) ) {
|
313 |
foreach ($niteoCS_page_whitelist_custom as $wl_url) {
|
@@ -329,7 +329,7 @@ $mode_change_email = get_option('niteoCS_mode_change_email_address', get_opt
|
|
329 |
|
330 |
<p class="cmp-hint" style="margin-top:0"><?php _e('If you want to exclude some pages from CMP you can select them here.', 'cmp-coming-soon-maintenance');?></p>
|
331 |
|
332 |
-
<h4><?php _e('You can also add the
|
333 |
<textarea name="niteoCS-blacklist-custom" cols="40" rows="5"><?php
|
334 |
if ( !empty($niteoCS_page_blacklist_custom) ) {
|
335 |
foreach ($niteoCS_page_blacklist_custom as $bl_url) {
|
295 |
|
296 |
<td>
|
297 |
<fieldset class="page-whitelist-switch x1" style="margin-top: 1em;">
|
298 |
+
<h4><?php _e('CMP Whitelist - set CMP landing page to specific page(s) only.', 'cmp-coming-soon-maintenance');?></h4>
|
299 |
<select name="niteoCS_page-whitelist[]" class="cmp-whitelist-select" multiple="multiple">
|
300 |
<option value="-1" <?php echo in_array('-1', $niteoCS_page_whitelist) ? 'selected' : '';?>><?php _e('Homepage', 'cmp-coming-soon-maintenance');?></option>
|
301 |
<?php
|
307 |
|
308 |
<p class="cmp-hint" style="margin-top:0"><?php _e('By default CMP is enabled on all pages. Leave this field empty to use default settings.', 'cmp-coming-soon-maintenance');?></p>
|
309 |
|
310 |
+
<h4><?php _e('You can also add the page URLs manually.', 'cmp-coming-soon-maintenance');?></h4>
|
311 |
<textarea name="niteoCS-whitelist-custom" cols="40" rows="5"><?php
|
312 |
if ( !empty($niteoCS_page_whitelist_custom) ) {
|
313 |
foreach ($niteoCS_page_whitelist_custom as $wl_url) {
|
329 |
|
330 |
<p class="cmp-hint" style="margin-top:0"><?php _e('If you want to exclude some pages from CMP you can select them here.', 'cmp-coming-soon-maintenance');?></p>
|
331 |
|
332 |
+
<h4><?php _e('You can also add the page URLs manually.', 'cmp-coming-soon-maintenance');?></h4>
|
333 |
<textarea name="niteoCS-blacklist-custom" cols="40" rows="5"><?php
|
334 |
if ( !empty($niteoCS_page_blacklist_custom) ) {
|
335 |
foreach ($niteoCS_page_blacklist_custom as $bl_url) {
|
cmp-settings.php
CHANGED
@@ -262,9 +262,8 @@ if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
|
|
262 |
|
263 |
|
264 |
if (isset($_POST['niteoCS_analytics_other'])) {
|
265 |
-
$
|
266 |
-
|
267 |
-
update_option('niteoCS_analytics_other', sanitize_text_field($js_code));
|
268 |
}
|
269 |
|
270 |
if ( isset($_POST['niteoCS_seo_visibility']) ) {
|
@@ -957,8 +956,8 @@ add_thickbox();
|
|
957 |
</p>
|
958 |
|
959 |
<p class="analytics-switch other">
|
960 |
-
<label for="niteoCS_analytics_other"><?php _e('Insert your
|
961 |
-
<textarea name="niteoCS_analytics_other" rows="5" class="code"><?php echo stripslashes(
|
962 |
</p>
|
963 |
</fieldset>
|
964 |
</td>
|
262 |
|
263 |
|
264 |
if (isset($_POST['niteoCS_analytics_other'])) {
|
265 |
+
$js_code = $this->niteo_sanitize_html( $_POST['niteoCS_analytics_other'] );
|
266 |
+
update_option('niteoCS_analytics_other', $js_code);
|
|
|
267 |
}
|
268 |
|
269 |
if ( isset($_POST['niteoCS_seo_visibility']) ) {
|
956 |
</p>
|
957 |
|
958 |
<p class="analytics-switch other">
|
959 |
+
<label for="niteoCS_analytics_other"><?php _e('Insert your the code provided by your Analytics Plugin or Website.', 'cmp-coming-soon-maintenance');?></label><br>
|
960 |
+
<textarea name="niteoCS_analytics_other" rows="5" class="code"><?php echo stripslashes( $niteoCS_analytics_other ); ?></textarea>
|
961 |
</p>
|
962 |
</fieldset>
|
963 |
</td>
|
inc/class-cmp-render_html.php
CHANGED
@@ -1287,11 +1287,8 @@ class CMP_Coming_Soon_and_Maintenance_Render_HTML extends CMP_Coming_Soon_and_Ma
|
|
1287 |
// other js code
|
1288 |
case 'other':
|
1289 |
if ( get_option('niteoCS_analytics_other', '') !== '' ) {
|
1290 |
-
$
|
1291 |
-
|
1292 |
-
<?php echo stripslashes( esc_js( $niteoCS_analytics_other ) );?>
|
1293 |
-
</script>
|
1294 |
-
<?php
|
1295 |
}
|
1296 |
|
1297 |
break;
|
@@ -1366,7 +1363,7 @@ class CMP_Coming_Soon_and_Maintenance_Render_HTML extends CMP_Coming_Soon_and_Ma
|
|
1366 |
// VIDIM script for background video
|
1367 |
case '5':
|
1368 |
$video_autoloop = get_option('niteoCS_video_autoloop', '1'); ?>
|
1369 |
-
<script src='<?php echo plugins_url('cmp-coming-soon-maintenance/js/external/vidim.min.js');?>'></script>
|
1370 |
<script>
|
1371 |
<?php
|
1372 |
$video_poster = wp_get_attachment_image_src( get_option('niteoCS_video_thumb'), 'large' );
|
@@ -1743,53 +1740,6 @@ class CMP_Coming_Soon_and_Maintenance_Render_HTML extends CMP_Coming_Soon_and_Ma
|
|
1743 |
return $banner_ids;
|
1744 |
}
|
1745 |
|
1746 |
-
/**
|
1747 |
-
* filter wp_head and wp_footer and return whitelisted hooks
|
1748 |
-
*
|
1749 |
-
* @since 3.5.6
|
1750 |
-
* @return array
|
1751 |
-
**/
|
1752 |
-
// public function cmp_filter_head_scripts_and_styles( $allowed, $in_footer ) {
|
1753 |
-
|
1754 |
-
// // we must fake wp_head to actually get all scripts and styles
|
1755 |
-
// ob_start();
|
1756 |
-
// wp_head();
|
1757 |
-
// ob_end_clean();
|
1758 |
-
|
1759 |
-
// $handles = array();
|
1760 |
-
// $handles['scripts'] = array();
|
1761 |
-
// $handles['styles'] = array();
|
1762 |
-
|
1763 |
-
// // Print all loaded Scripts
|
1764 |
-
// global $wp_scripts;
|
1765 |
-
// global $wp_styles;
|
1766 |
-
|
1767 |
-
// // get scripts
|
1768 |
-
// foreach( $allowed['scripts'] as $handle ) :
|
1769 |
-
|
1770 |
-
// if ( !$in_footer ) {
|
1771 |
-
// if ( in_array( $handle, $wp_scripts->groups ) && isset($wp_scripts->registered[$handle]) ) {
|
1772 |
-
// $handles['scripts'][] = $wp_scripts->registered[$handle]->src;
|
1773 |
-
// }
|
1774 |
-
// } else {
|
1775 |
-
// if ( in_array( $handle, $wp_scripts->groups ) && in_array( $handle, $wp_scripts->in_footer ) && isset($wp_scripts->registered[$handle]) ) {
|
1776 |
-
// $handles['scripts'][] = $wp_scripts->registered[$handle]->src;
|
1777 |
-
// }
|
1778 |
-
// }
|
1779 |
-
|
1780 |
-
// endforeach;
|
1781 |
-
|
1782 |
-
// // get_styles
|
1783 |
-
// foreach( $wp_styles->queue as $style ) :
|
1784 |
-
// if ( isset( $wp_styles->registered[$style] ) && is_object( $wp_styles->registered[$style] ) && in_array( $wp_styles->registered[$style]->handle, $allowed['styles'] ) ) {
|
1785 |
-
// $handles['styles'][] = $wp_styles->registered[$style]->src;
|
1786 |
-
// }
|
1787 |
-
// endforeach;
|
1788 |
-
|
1789 |
-
// return $handles;
|
1790 |
-
|
1791 |
-
// }
|
1792 |
-
|
1793 |
/**
|
1794 |
* print whitelisted scripts and styles to cmp_head
|
1795 |
*
|
@@ -1797,26 +1747,6 @@ class CMP_Coming_Soon_and_Maintenance_Render_HTML extends CMP_Coming_Soon_and_Ma
|
|
1797 |
* @return html
|
1798 |
**/
|
1799 |
public function cmp_wp_head() {
|
1800 |
-
|
1801 |
-
$handles_allowed = array(
|
1802 |
-
'scripts' => array(
|
1803 |
-
),
|
1804 |
-
'styles' => array(
|
1805 |
-
)
|
1806 |
-
);
|
1807 |
-
|
1808 |
-
// $handles_src = $this->cmp_filter_head_scripts_and_styles( $handles_allowed, false );
|
1809 |
-
|
1810 |
-
// foreach ( $handles_src['scripts'] as $src ) {
|
1811 |
-
// echo '<script src="' . esc_url( $src ) . '"></script>' . PHP_EOL;
|
1812 |
-
// }
|
1813 |
-
|
1814 |
-
// foreach ( $handles_src['styles'] as $src ) {
|
1815 |
-
// echo '<link href="' . esc_url( $src ). '" rel="stylesheet">' . PHP_EOL;
|
1816 |
-
// }
|
1817 |
-
|
1818 |
-
// handle actions added by allowed plugins in wp_head
|
1819 |
-
|
1820 |
// Plugin Name: Insert Headers and Footers
|
1821 |
if ( class_exists('InsertHeadersAndFooters') ) {
|
1822 |
$ihaf = new InsertHeadersAndFooters();
|
@@ -1838,29 +1768,6 @@ class CMP_Coming_Soon_and_Maintenance_Render_HTML extends CMP_Coming_Soon_and_Ma
|
|
1838 |
*/
|
1839 |
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
1840 |
|
1841 |
-
// $handles_allowed = array(
|
1842 |
-
// 'scripts' => array(
|
1843 |
-
// 'simpleanalytics_script'
|
1844 |
-
// ),
|
1845 |
-
// 'styles' => array(
|
1846 |
-
|
1847 |
-
// )
|
1848 |
-
// );
|
1849 |
-
|
1850 |
-
// $handles_src = $this->cmp_filter_head_scripts_and_styles( $handles_allowed, true );
|
1851 |
-
|
1852 |
-
// foreach ( $handles_src['scripts'] as $src ) {
|
1853 |
-
// echo '<script src="' . esc_url( $src ). '"></script>' . PHP_EOL;
|
1854 |
-
// }
|
1855 |
-
|
1856 |
-
|
1857 |
-
// foreach ( $handles_src['styles'] as $src ) {
|
1858 |
-
// echo '<link href="' . esc_url( $src ). '" rel="stylesheet">' . PHP_EOL;
|
1859 |
-
// }
|
1860 |
-
|
1861 |
-
|
1862 |
-
|
1863 |
-
// handle actions added by allowed plugins in wp_footer
|
1864 |
// Plugin Name: Insert Headers and Footers
|
1865 |
if ( class_exists('InsertHeadersAndFooters') ) {
|
1866 |
$ihaf = new InsertHeadersAndFooters();
|
@@ -1868,11 +1775,10 @@ class CMP_Coming_Soon_and_Maintenance_Render_HTML extends CMP_Coming_Soon_and_Ma
|
|
1868 |
}
|
1869 |
|
1870 |
// Plugin Name: SimpleAnalytics
|
1871 |
-
|
1872 |
if ( is_plugin_active( 'simpleanalytics/simple-analytics.php' ) ) {
|
1873 |
echo '<script src="https://cdn.simpleanalytics.io/hello.js"></script>' . PHP_EOL;
|
1874 |
}
|
1875 |
-
|
1876 |
}
|
1877 |
|
1878 |
}
|
1287 |
// other js code
|
1288 |
case 'other':
|
1289 |
if ( get_option('niteoCS_analytics_other', '') !== '' ) {
|
1290 |
+
$analytics_code = get_option('niteoCS_analytics_other', '');
|
1291 |
+
echo stripslashes( $analytics_code );
|
|
|
|
|
|
|
1292 |
}
|
1293 |
|
1294 |
break;
|
1363 |
// VIDIM script for background video
|
1364 |
case '5':
|
1365 |
$video_autoloop = get_option('niteoCS_video_autoloop', '1'); ?>
|
1366 |
+
<script src='<?php echo plugins_url('cmp-coming-soon-maintenance/js/external/vidim.min.js?v=1.0.2"');?>'></script>
|
1367 |
<script>
|
1368 |
<?php
|
1369 |
$video_poster = wp_get_attachment_image_src( get_option('niteoCS_video_thumb'), 'large' );
|
1740 |
return $banner_ids;
|
1741 |
}
|
1742 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1743 |
/**
|
1744 |
* print whitelisted scripts and styles to cmp_head
|
1745 |
*
|
1747 |
* @return html
|
1748 |
**/
|
1749 |
public function cmp_wp_head() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1750 |
// Plugin Name: Insert Headers and Footers
|
1751 |
if ( class_exists('InsertHeadersAndFooters') ) {
|
1752 |
$ihaf = new InsertHeadersAndFooters();
|
1768 |
*/
|
1769 |
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
1770 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1771 |
// Plugin Name: Insert Headers and Footers
|
1772 |
if ( class_exists('InsertHeadersAndFooters') ) {
|
1773 |
$ihaf = new InsertHeadersAndFooters();
|
1775 |
}
|
1776 |
|
1777 |
// Plugin Name: SimpleAnalytics
|
|
|
1778 |
if ( is_plugin_active( 'simpleanalytics/simple-analytics.php' ) ) {
|
1779 |
echo '<script src="https://cdn.simpleanalytics.io/hello.js"></script>' . PHP_EOL;
|
1780 |
}
|
1781 |
+
|
1782 |
}
|
1783 |
|
1784 |
}
|
inc/settings/settings-background.php
CHANGED
@@ -273,7 +273,7 @@ $gradient_array = array(
|
|
273 |
|
274 |
<p><?php _e('YouTube background doesn`t work on mobile devices therefore only thumbnail will be displayed on mobile devices. You can upload custom thumbnail image by pressing button below. ', 'cmp-coming-soon-maintenance');?></p>
|
275 |
<input type="hidden" class="widefat" id="niteoCS-video-thumb-id" name="niteoCS_video_thumb" value="<?php echo esc_attr( $niteoCS_video_thumb ); ?>" />
|
276 |
-
<input id="add-video-thumb" type="button" class="button" value="<?php _e('Media Library', 'cmp-coming-soon-maintenance');?>"
|
277 |
|
278 |
<div class="video-thumb-wrapper background-thumb-wrapper">
|
279 |
<?php
|
@@ -282,17 +282,13 @@ $gradient_array = array(
|
|
282 |
if ( isset( $img[0] ) ) {
|
283 |
echo '<img src="' .$img[0] . '" alt="">';
|
284 |
}
|
285 |
-
|
286 |
-
}
|
287 |
-
?>
|
288 |
<div class="thumbnail-overlay"></div>
|
289 |
</div>
|
290 |
|
291 |
<input id="delete-video-thumb" type="button" class="button" value="Remove Thumbnail" />
|
292 |
|
293 |
</div>
|
294 |
-
|
295 |
-
<!-- enable / disable autoolop video checkbox -->
|
296 |
|
297 |
</fieldset>
|
298 |
|
273 |
|
274 |
<p><?php _e('YouTube background doesn`t work on mobile devices therefore only thumbnail will be displayed on mobile devices. You can upload custom thumbnail image by pressing button below. ', 'cmp-coming-soon-maintenance');?></p>
|
275 |
<input type="hidden" class="widefat" id="niteoCS-video-thumb-id" name="niteoCS_video_thumb" value="<?php echo esc_attr( $niteoCS_video_thumb ); ?>" />
|
276 |
+
<input id="add-video-thumb" type="button" class="button" value="<?php _e('Media Library', 'cmp-coming-soon-maintenance');?>" />
|
277 |
|
278 |
<div class="video-thumb-wrapper background-thumb-wrapper">
|
279 |
<?php
|
282 |
if ( isset( $img[0] ) ) {
|
283 |
echo '<img src="' .$img[0] . '" alt="">';
|
284 |
}
|
285 |
+
} ?>
|
|
|
|
|
286 |
<div class="thumbnail-overlay"></div>
|
287 |
</div>
|
288 |
|
289 |
<input id="delete-video-thumb" type="button" class="button" value="Remove Thumbnail" />
|
290 |
|
291 |
</div>
|
|
|
|
|
292 |
|
293 |
</fieldset>
|
294 |
|
js/external/vidim.min.js
CHANGED
@@ -1,8 +1 @@
|
|
1 |
-
/*
|
2 |
-
* vidim v1.0.1
|
3 |
-
* 2018-08-24T13:55:53.385Z
|
4 |
-
* https://github.com/OriginalEXE/vidim
|
5 |
-
*
|
6 |
-
* Made by Ante Sepic
|
7 |
-
*/
|
8 |
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.vidim=e()}(this,function(){"use strict";function t(t,e){Object.keys(e).forEach(function(i){t.hasOwnProperty(i)||(t[i]=e[i])})}function e(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return"string"==typeof t?e.querySelector(t):t}function i(t,e){var i,s,o,n,r=0,a=function(){r=Date.now(),i=null,n=t.apply(s,o),i||(s=o=null)},l=function(){var l=Date.now();r||(r=l);var h=e-(l-r);return s=this,o=arguments,h<=0||h>e?(i&&(clearTimeout(i),i=null),r=l,n=t.apply(s,o),i||(s=o=null)):i||(i=setTimeout(a,h)),n};return l.cancel=function(){clearTimeout(i),r=0,i=s=o=null},l}function s(t){"loading"!=document.readyState?t():document.addEventListener("DOMContentLoaded",t)}var o=function(t,e){return e={exports:{}},t(e,e.exports),e.exports}(function(t){function e(t){if(t)return i(t)}function i(t){for(var i in e.prototype)t[i]=e.prototype[i];return t}t.exports=e,e.prototype.on=e.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},e.prototype.once=function(t,e){function i(){this.off(t,i),e.apply(this,arguments)}return i.fn=e,this.on(t,i),this},e.prototype.off=e.prototype.removeListener=e.prototype.removeAllListeners=e.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var i=this._callbacks["$"+t];if(!i)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var s,o=0;o<i.length;o++)if((s=i[o])===e||s.fn===e){i.splice(o,1);break}return this},e.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),i=this._callbacks["$"+t];if(i){i=i.slice(0);for(var s=0,o=i.length;s<o;++s)i[s].apply(this,e)}return this},e.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},e.prototype.hasListeners=function(t){return!!this.listeners(t).length}}),n=Object.freeze({setDefaults:t,getElement:e,throttle:i,ready:s}),r=function(e){var i={preload:"auto"},s={_initializeProvider:function(){t(this._options,i),this._constructPlayer(),this._dispatch(),this._listen()},_constructPlayer:function(){this.el=document.createElement("video"),this.el.setAttribute("playsinline",""),this._options.loop&&this.el.setAttribute("loop",""),this._options.autoplay&&this.el.setAttribute("autoplay",""),this._options.preload&&this.el.setAttribute("preload",this._options.preload),this._options.muted&&(this.el.muted=!0),this.el.style.position="absolute",this.el.style.left="50%",this.el.style.top="50%",this.el.style.transform="translate(-50%, -50%)",this.el.style.webkitTransform="translate(-50%, -50%)",this.el.style.msTransform="translate(-50%, -50%)",this.el.style.oTransform="translate(-50%, -50%)",this.el.style.mozTransform="translate(-50%, -50%)",this.el.style.minWidth="calc( 100% + 2px )",this.el.style.minHeight="calc( 100% + 2px )",this.el.style.opacity="0";var t=this._options.src;if(t.length&&"string"!=typeof t)for(var e=0;e<t.length;e++){var i=document.createElement("source");i.setAttribute("type",t[e].type),i.setAttribute("src",t[e].src),this.el.appendChild(i)}this.wrapper.appendChild(this.el),this._options.startAt&&(this.el.currentTime=this._options.startAt),"function"==typeof this._options.onReady&&this._options.onReady(this),this.emit("ready"),this._constructOverlay(),this.resize()},_dispatch:function(){var t=this;this.el.addEventListener("play",function(){t.emit("play",t)},!1),this.el.addEventListener("pause",function(){t.emit("pause",t)},!1),this.el.addEventListener("ended",function(){t.emit("end",t)},!1),this.el.addEventListener("canplay",function(){t.emit("canplay",t)},!1),this.el.addEventListener("canplaythrough",function(){t.emit("canplaythrough",t)},!1)},_listen:function(){var t=this;this.on("play",function(){t.el.style.opacity="1"}),this._options.showPosterBeforePlay||this.once("play",function(){t.wrapper.style.backgroundImage="url('"+t._options.poster+"')"}),this._options.showPosterOnEnd&&this.on("end",function(){t.el.style.opacity="0"}),this._options.showPosterOnPause&&this.on("pause",function(){t.el.style.opacity="0"})},play:function(){return this.el.play(),this},pause:function(){return this.el.pause(),this},setVolume:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;return this.el.volume=parseFloat(t/100),this},getVolume:function(){return 100*this.el.volume},mute:function(){return this.el.muted=!0,this},unMute:function(){return this.el.muted=!1,this},setTime:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.el.currentTime=t,this},getTime:function(){return this.el.currentTime},getDuration:function(){return this.el.duration},showPoster:function(){this.pause().el.style.opacity="0"},changeSource:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.el.innerHTML="",t.length&&"string"!=typeof t)for(var i=0;i<t.length;i++){var s=document.createElement("source");s.setAttribute("type",t[i].type),s.setAttribute("src",t[i].src),this.el.appendChild(s)}if(this.el.load&&this.el.load(),this._options.startAt&&(this.el.currentTime=this._options.startAt),e){var o=this._options.poster;-1!==this.wrapper.style.backgroundImage.indexOf(o)&&(this.wrapper.style.backgroundImage="url('"+e+"')"),this._options.poster=e}},destroy:function(){this.emit("destroy"),this.el.pause&&this.el.pause(),this.el.src="",this.el.load&&this.el.load();try{this.wrapper.parentNode.removeChild(this.wrapper)}catch(t){}e.deleteInstance(this.vidimID),delete this.container.vidimID,this.off()},resize:function(){if(this.el){var t=this.container.offsetHeight,e=this.container.offsetWidth;"BODY"===this.container.nodeName&&(e=window.innerWidth,t=window.innerHeight),1<this._options.ratio&&e/t<this._options.ratio||1>this._options.ratio&&t/e<this._options.ratio?(this.el.style.maxHeight="calc( 100% + 2px )",this.el.style.maxWidth=""):(this.el.style.maxHeight="",this.el.style.maxWidth="calc( 100% + 2px )"),this.emit("resize")}}};e.registerProvider("HTML5",s)},a=!1,l=function(e){var i={quality:"hd1080"},s={_initializeProvider:function(){var e=this;a?(t(this._options,i),this._constructPlayer(),this._listen()):window.addEventListener("vidimYouTubeAPIReady",function(){t(e._options,i),e._constructPlayer(),e._listen()},!1)},_constructPlayer:function(){var t=this;if(11===this._options.src.length)this.videoID=this._options.src;else{var e=/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=|\?v=)([^#\&\?]*).*/,i=this._options.src.match(e);if(!i||11!==i[2].length)return new Error("Provided source is not a valid YouTube url");this.videoID=i[2]}var s=document.createElement("div");this.wrapper.appendChild(s);var o={videoId:this.videoID,playerVars:{allowfullscreen:!1,controls:0,enablejsapi:1,disablekb:1,fs:0,iv_load_policy:3,modestbranding:1,origin:void 0!==window.location.origin?window.location.origin:window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:""),playsinline:1,rel:0,showinfo:0,start:this._options.startAt,autoplay:+this._options.autoplay},events:{onReady:function(){if(t._options.muted&&t.mute(),t.player.setPlaybackQuality(t._options.quality),"function"==typeof t._options.onReady&&t._options.onReady(t),t.emit("ready"),t._options.loop){var e=void 0;t.on("play",function(){e=setInterval(function(){(0===t.getTime()||t.getTime()+.15>t.getDuration())&&(t.setTime(0),t.play())},100)}),t.on("pause",function(){clearInterval(e)}),t.on("destroy",function(){clearInterval(e)})}},onStateChange:function(e){switch(e.data){case 0:t.emit("end",t);break;case 1:t.emit("play",t);break;case 2:t.emit("pause",t);break;case 3:t.emit("buffering",t)}}}};this._options.loop&&(o.playerVars.playlist=this.videoID,o.playerVars.loop=1),this.player=new YT.Player(s,o),this.el=this.player.getIframe(),this.el.style.position="absolute",this.el.style.left="50%",this.el.style.top="50%",this.el.style.transform="translate(-50%, -50%)",this.el.style.webkitTransform="translate(-50%, -50%)",this.el.style.msTransform="translate(-50%, -50%)",this.el.style.oTransform="translate(-50%, -50%)",this.el.style.mozTransform="translate(-50%, -50%)",this.el.style.minWidth="calc( 100% + 2px )",this.el.style.minHeight="calc( 100% + 2px )",this.el.style.opacity="0",this._constructOverlay(),this.resize()},_listen:function(){var t=this;this.on("play",function(){t.el.style.opacity="1"}),this._options.showPosterBeforePlay||this.once("play",function(){t.wrapper.style.backgroundImage="url('"+t._options.poster+"')"}),this._options.showPosterOnEnd?this.on("end",function(){t.el.style.opacity="0"}):this.on("end",function(){t.player.seekTo(t.player.getDuration()),t.player.playVideo(),t.player.pauseVideo()}),this._options.showPosterOnPause&&this.on("pause",function(){t.el.style.opacity="0"})},play:function(){return this.player.playVideo(),this},pause:function(){return this.player.pauseVideo(),this},setVolume:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;return this.player.setVolume(t),this},getVolume:function(){return this.getVolume()},mute:function(){return this.player.mute(),this},unMute:function(){return this.player.unMute(),this},setTime:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.player.seekTo(t,!0),this},getTime:function(){return this.player.getCurrentTime()},getDuration:function(){return this.player.getDuration()},showPoster:function(){this.pause().el.style.opacity="0"},changeSource:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(11===t.length)this.videoID=t;else{var i=/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=|\?v=)([^#\&\?]*).*/,s=t.match(i);if(!s||11!==s[2].length)return new Error("Provided source is not a valid YouTube url");this.videoID=s[2]}if(this.player.loadPlaylist(this.videoID,0,this._options.startAt,this._options.quality),this.player.setLoop(this._options.loop),e){var o=this._options.poster;-1!==this.wrapper.style.backgroundImage.indexOf(o)&&(this.wrapper.style.backgroundImage="url('"+e+"')"),this._options.poster=e}},destroy:function(){this.emit("destroy"),this.player.destroy();try{this.wrapper.parentNode.removeChild(this.wrapper)}catch(t){}e.deleteInstance(this.vidimID),delete this.container.vidimID,this.off()},resize:function(){if(this.el){var t=this.container.offsetHeight,e=this.container.offsetWidth;"BODY"===this.container.nodeName&&(e=window.innerWidth,t=window.innerHeight),1<this._options.ratio&&e/t<this._options.ratio||1>this._options.ratio&&t/e<this._options.ratio?(this.el.style.maxHeight="calc( 100% + 2px )",this.el.style.maxWidth="",this.el.style.height="",this.el.style.width=this.el.offsetHeight*this._options.ratio+200+"px"):(this.el.style.maxHeight="",this.el.style.maxWidth="calc( 100% + 2px )",this.el.style.height=this.el.offsetWidth/this._options.ratio+"px",this.el.style.width="",this.el.offsetHeight<this.wrapper.offsetHeight+140&&(this.el.style.height=this.el.offsetWidth/this._options.ratio+140+"px")),this.emit("resize")}}};e.registerProvider("YouTube",s)},h=document.createElement("script");h.src="https://www.youtube.com/iframe_api",document.querySelector("body").appendChild(h);var p=document.createEvent("Event");if(p.initEvent("vidimYouTubeAPIReady",!0,!0),void 0===window.onYouTubeIframeAPIReady)window.onYouTubeIframeAPIReady=function(){window.vidimYouTubeAPIReady=!0,a=!0,window.dispatchEvent(p)};else{var c=window.onYouTubeIframeAPIReady;window.onYouTubeIframeAPIReady=function(){c(),window.vidimYouTubeAPIReady=!0,a=!0,window.dispatchEvent(p)}}return function(a){function h(t,e){g[t]="function"==typeof e?e.call(a,w):e}function p(t){return m[t]?m[t]:null}function c(t){return t=e(t),void 0!==t.vidimID&&m[t.vidimID]?m[t.vidimID]:null}function u(){for(var t in m)m[t].hasOwnProperty("destroy")&&m[t].destroy();m={}}function d(t){delete m[t]}function y(){var t=document.querySelectorAll("[data-vidim]");if(t.length)for(var e=0;e<t.length;e++){var i=t[e],s=i.getAttribute("data-vidim");if(void 0===i.vidimID)try{var o=/({|,)(?:\s*)(?:')?([A-Za-z_$\.][A-Za-z0-9_ \-\.$]*)(?:')?(?:\s*):/g,n=s.replace(o,'$1"$2":').replace(/:\s?'/g,':"').replace(/'\s?}/g,'"}').replace(/',"/g,'","'),r=JSON.parse(n);new f(i,r)}catch(t){}}}function f(i){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Object.keys(s).forEach(function(t){_.push(t)}),t(s,w),s.src&&!g[s.type]?new Error("No provider can handle type: '"+s.type+"'"):("string"==typeof s.ratio&&("4/3"===s.ratio?s.ratio=4/3:s.ratio=16/9),this._options=s,this.container=e(i),this.container?(-1===_.indexOf("zIndex")&&"BODY"===this.container.nodeName&&(this._options.zIndex=-1),void this._initialize()):new Error("Could not find the container: "+i))}if(void 0!==a.document){var v=0,m={},w={wrapperClass:"",overlayClass:"",src:!1,type:"HTML5",ratio:1.7778,autoplay:!0,loop:!0,poster:"",showPosterBeforePlay:!0,showPosterOnEnd:!1,showPosterOnPause:!1,zIndex:0,autoResize:!0,muted:!0,startAt:0,onReady:!1},_=[],g={},b=f.prototype;return b._initialize=function(){if(this.vidimID=v++,this.container.vidimID=this.vidimID,m[this.vidimID]=this,o(this),!this._options.src&&this._options.poster)return this._constructWrapper(),void(this.destroy=function(){this.emit("destroy");try{this.wrapper.parentNode.removeChild(this.wrapper)}catch(t){}f.deleteInstance(this.vidimID),delete this.container.vidimID,this.off()});var t=g[this._options.type];for(var e in t)this[e]=t[e];if("function"!=typeof this._initializeProvider)return new Error("Provider is missing method: _initializeProvider");this._constructWrapper(),this._initializeProvider(),this._options.autoResize&&window.addEventListener("resize",i(this.resize,200).bind(this),!1),this.resize()},b._constructWrapper=function(){"static"===getComputedStyle(this.container,null).getPropertyValue("position")&&(this.container.style.position="relative"),this.wrapper=document.createElement("div"),"BODY"===this.container.nodeName?this.wrapper.style.position="fixed":this.wrapper.style.position="absolute",this._options.wrapperClass&&("function"==typeof this._options.wrapperClass?this.wrapper.classList.add(this._options.wrapperClass.call(this)):this.wrapper.classList.add(this._options.wrapperClass)),this.wrapper.style.left=0,this.wrapper.style.top=0,this.wrapper.style.height="100%",this.wrapper.style.width="100%",this.wrapper.style.overflow="hidden",this.wrapper.style.zIndex=parseInt(this._options.zIndex,10),this._options.poster&&(this.wrapper.style.backgroundSize="cover",this.wrapper.style.backgroundPosition="center center",this.wrapper.style.backgroundRepear="no-repeat",this._options.showPosterBeforePlay&&(this.wrapper.style.backgroundImage="url('"+this._options.poster+"')")),this.container.insertBefore(this.wrapper,this.container.firstChild)},b._constructOverlay=function(){this.overlay=document.createElement("div"),this.overlay.style.position="absolute",this._options.overlayClass&&("function"==typeof this._options.overlayClass?this.overlay.classList.add(this._options.overlayClass.call(this)):this.overlay.classList.add(this._options.overlayClass)),this.overlay.style.left=0,this.overlay.style.top=0,this.overlay.style.height="100%",this.overlay.style.width="100%",this.wrapper.appendChild(this.overlay)},f.getInstanceFromID=p,f.getInstanceFromElement=c,f.registerProvider=h,f.destroyAllInstances=u,f.deleteInstance=d,f.utility=n,f.scanDOM=y,r(f),l(f),s(y),f}}("undefined"!=typeof window?window:void 0)});
|
1 |
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.vidim=e()}(this,function(){"use strict";var t,e=(function(t){function e(t){if(t)return function(t){for(var i in e.prototype)t[i]=e.prototype[i];return t}(t)}t.exports=e,e.prototype.on=e.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},e.prototype.once=function(t,e){function i(){this.off(t,i),e.apply(this,arguments)}return i.fn=e,this.on(t,i),this},e.prototype.off=e.prototype.removeListener=e.prototype.removeAllListeners=e.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var i,s=this._callbacks["$"+t];if(!s)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var o=0;o<s.length;o++)if((i=s[o])===e||i.fn===e){s.splice(o,1);break}return this},e.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),i=this._callbacks["$"+t];if(i)for(var s=0,o=(i=i.slice(0)).length;s<o;++s)i[s].apply(this,e);return this},e.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},e.prototype.hasListeners=function(t){return!!this.listeners(t).length}}(t={exports:{}},t.exports),t.exports);function i(t,e){Object.keys(e).forEach(function(i){t.hasOwnProperty(i)||(t[i]=e[i])})}function s(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return"string"==typeof t?e.querySelector(t):t}function o(t,e){var i,s,o,n,r=0,a=function(){r=Date.now(),i=null,n=t.apply(s,o),i||(s=o=null)},l=function(){var l=Date.now();r||(r=l);var h=e-(l-r);return s=this,o=arguments,h<=0||h>e?(i&&(clearTimeout(i),i=null),r=l,n=t.apply(s,o),i||(s=o=null)):i||(i=setTimeout(a,h)),n};return l.cancel=function(){clearTimeout(i),r=0,i=s=o=null},l}function n(t){"loading"!=document.readyState?t():document.addEventListener("DOMContentLoaded",t)}var r=Object.freeze({setDefaults:i,getElement:s,throttle:o,ready:n}),a=!1,l=document.createElement("script");l.src="https://www.youtube.com/iframe_api",document.querySelector("body").appendChild(l);var h=document.createEvent("Event");if(h.initEvent("vidimYouTubeAPIReady",!0,!0),void 0===window.onYouTubeIframeAPIReady)window.onYouTubeIframeAPIReady=function(){window.vidimYouTubeAPIReady=!0,a=!0,window.dispatchEvent(h)};else{var p=window.onYouTubeIframeAPIReady;window.onYouTubeIframeAPIReady=function(){p(),window.vidimYouTubeAPIReady=!0,a=!0,window.dispatchEvent(h)}}return function(t){if(void 0!==t.document){var l=0,h={},p={wrapperClass:"",overlayClass:"",src:!1,type:"HTML5",ratio:1.7778,autoplay:!0,loop:!0,poster:"",showPosterBeforePlay:!0,showPosterOnEnd:!1,showPosterOnPause:!1,zIndex:0,autoResize:!0,muted:!0,startAt:0,onReady:!1},c=[],u={},d=f.prototype;return d._initialize=function(){if(this.vidimID=l++,this.container.vidimID=this.vidimID,h[this.vidimID]=this,e(this),!this._options.src&&this._options.poster)return this._constructWrapper(),void(this.destroy=function(){this.emit("destroy");try{this.wrapper.parentNode.removeChild(this.wrapper)}catch(t){}f.deleteInstance(this.vidimID),delete this.container.vidimID,this.off()});var t=u[this._options.type];for(var i in t)this[i]=t[i];if("function"!=typeof this._initializeProvider)return new Error("Provider is missing method: _initializeProvider");this._constructWrapper(),this._initializeProvider(),this._options.autoResize&&window.addEventListener("resize",o(this.resize,200).bind(this),!1),this.resize()},d._constructWrapper=function(){"static"===getComputedStyle(this.container,null).getPropertyValue("position")&&(this.container.style.position="relative"),this.wrapper=document.createElement("div"),"BODY"===this.container.nodeName?this.wrapper.style.position="fixed":this.wrapper.style.position="absolute",this._options.wrapperClass&&("function"==typeof this._options.wrapperClass?this.wrapper.classList.add(this._options.wrapperClass.call(this)):this.wrapper.classList.add(this._options.wrapperClass)),this.wrapper.style.left=0,this.wrapper.style.top=0,this.wrapper.style.height="100%",this.wrapper.style.width="100%",this.wrapper.style.overflow="hidden",this.wrapper.style.zIndex=parseInt(this._options.zIndex,10),this._options.poster&&(this.wrapper.style.backgroundSize="cover",this.wrapper.style.backgroundPosition="center center",this.wrapper.style.backgroundRepear="no-repeat",this._options.showPosterBeforePlay&&(this.wrapper.style.backgroundImage="url('"+this._options.poster+"')")),this.container.insertBefore(this.wrapper,this.container.firstChild)},d._constructOverlay=function(){this.overlay=document.createElement("div"),this.overlay.style.position="absolute",this._options.overlayClass&&("function"==typeof this._options.overlayClass?this.overlay.classList.add(this._options.overlayClass.call(this)):this.overlay.classList.add(this._options.overlayClass)),this.overlay.style.left=0,this.overlay.style.top=0,this.overlay.style.height="100%",this.overlay.style.width="100%",this.wrapper.appendChild(this.overlay)},f.getInstanceFromID=function(t){return h[t]?h[t]:null},f.getInstanceFromElement=function(t){return void 0!==(t=s(t)).vidimID&&h[t.vidimID]?h[t.vidimID]:null},f.registerProvider=function(e,i){u[e]="function"==typeof i?i.call(t,p):i},f.destroyAllInstances=function(){for(var t in h)h[t].hasOwnProperty("destroy")&&h[t].destroy();h={}},f.deleteInstance=function(t){delete h[t]},f.utility=r,f.scanDOM=y,function(t){var e={preload:"auto"},s={_initializeProvider:function(){i(this._options,e),this._constructPlayer(),this._dispatch(),this._listen()},_constructPlayer:function(){this.el=document.createElement("video"),this.el.setAttribute("playsinline",""),this._options.loop&&this.el.setAttribute("loop",""),this._options.autoplay&&this.el.setAttribute("autoplay",""),this._options.preload&&this.el.setAttribute("preload",this._options.preload),this._options.muted&&(this.el.muted=!0),this.el.style.position="absolute",this.el.style.left="50%",this.el.style.top="50%",this.el.style.transform="translate(-50%, -50%)",this.el.style.webkitTransform="translate(-50%, -50%)",this.el.style.msTransform="translate(-50%, -50%)",this.el.style.oTransform="translate(-50%, -50%)",this.el.style.mozTransform="translate(-50%, -50%)",this.el.style.minWidth="calc( 100% + 2px )",this.el.style.minHeight="calc( 100% + 2px )",this.el.style.opacity="0";var t=this._options.src;if(t.length&&"string"!=typeof t)for(var e=0;e<t.length;e++){var i=document.createElement("source");i.setAttribute("type",t[e].type),i.setAttribute("src",t[e].src),this.el.appendChild(i)}this.wrapper.appendChild(this.el),this._options.startAt&&(this.el.currentTime=this._options.startAt),"function"==typeof this._options.onReady&&this._options.onReady(this),this.emit("ready"),this._constructOverlay(),this.resize()},_dispatch:function(){var t=this;this.el.addEventListener("play",function(){t.emit("play",t)},!1),this.el.addEventListener("pause",function(){t.emit("pause",t)},!1),this.el.addEventListener("ended",function(){t.emit("end",t)},!1),this.el.addEventListener("canplay",function(){t.emit("canplay",t)},!1),this.el.addEventListener("canplaythrough",function(){t.emit("canplaythrough",t)},!1)},_listen:function(){var t=this;this.on("play",function(){t.el.style.opacity="1"}),this._options.showPosterBeforePlay||this.once("play",function(){t.wrapper.style.backgroundImage="url('"+t._options.poster+"')"}),this._options.showPosterOnEnd&&this.on("end",function(){t.el.style.opacity="0"}),this._options.showPosterOnPause&&this.on("pause",function(){t.el.style.opacity="0"})},play:function(){return this.el.play(),this},pause:function(){return this.el.pause(),this},setVolume:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;return this.el.volume=parseFloat(t/100),this},getVolume:function(){return 100*this.el.volume},mute:function(){return this.el.muted=!0,this},unMute:function(){return this.el.muted=!1,this},setTime:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.el.currentTime=t,this},getTime:function(){return this.el.currentTime},getDuration:function(){return this.el.duration},showPoster:function(){this.pause().el.style.opacity="0"},changeSource:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.el.innerHTML="",t.length&&"string"!=typeof t)for(var i=0;i<t.length;i++){var s=document.createElement("source");s.setAttribute("type",t[i].type),s.setAttribute("src",t[i].src),this.el.appendChild(s)}if(this.el.load&&this.el.load(),this._options.startAt&&(this.el.currentTime=this._options.startAt),e){var o=this._options.poster;-1!==this.wrapper.style.backgroundImage.indexOf(o)&&(this.wrapper.style.backgroundImage="url('"+e+"')"),this._options.poster=e}},destroy:function(){this.emit("destroy"),this.el.pause&&this.el.pause(),this.el.src="",this.el.load&&this.el.load();try{this.wrapper.parentNode.removeChild(this.wrapper)}catch(t){}t.deleteInstance(this.vidimID),delete this.container.vidimID,this.off()},resize:function(){if(this.el){var t=this.container.offsetHeight,e=this.container.offsetWidth;"BODY"===this.container.nodeName&&(e=window.innerWidth,t=window.innerHeight),1<this._options.ratio&&e/t<this._options.ratio||1>this._options.ratio&&t/e<this._options.ratio?(this.el.style.maxHeight="calc( 100% + 2px )",this.el.style.maxWidth=""):(this.el.style.maxHeight="",this.el.style.maxWidth="calc( 100% + 2px )"),this.emit("resize")}}};t.registerProvider("HTML5",s)}(f),function(t){var e={quality:"hd1080"},s={_initializeProvider:function(){var t=this;a?(i(this._options,e),this._constructPlayer(),this._listen()):window.addEventListener("vidimYouTubeAPIReady",function(){i(t._options,e),t._constructPlayer(),t._listen()},!1)},_constructPlayer:function(){var t=this;if(11===this._options.src.length)this.videoID=this._options.src;else{var e=this._options.src.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=|\?v=)([^#\&\?]*).*/);if(!e||11!==e[2].length)return new Error("Provided source is not a valid YouTube url");this.videoID=e[2]}var i=document.createElement("div");this.wrapper.appendChild(i);var s={videoId:this.videoID,playerVars:{allowfullscreen:!1,controls:0,enablejsapi:1,disablekb:1,fs:0,iv_load_policy:3,modestbranding:1,origin:void 0!==window.location.origin?window.location.origin:window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:""),playsinline:1,rel:0,showinfo:0,start:this._options.startAt,autoplay:+this._options.autoplay},events:{onReady:function(){if(t._options.muted&&t.mute(),t.player.setPlaybackQuality(t._options.quality),"function"==typeof t._options.onReady&&t._options.onReady(t),t.emit("ready"),t._options.loop){var e=void 0;t.on("play",function(){e=setInterval(function(){(0===t.getTime()||t.getTime()+.15>t.getDuration())&&(t.setTime(0),t.play())},100)}),t.on("pause",function(){clearInterval(e)}),t.on("destroy",function(){clearInterval(e)})}},onStateChange:function(e){switch(e.data){case 0:t.emit("end",t);break;case 1:t.emit("play",t);break;case 2:t.emit("pause",t);break;case 3:t.emit("buffering",t)}}}};this._options.loop&&(s.playerVars.playlist=this.videoID,s.playerVars.loop=1),this.player=new YT.Player(i,s),this.el=this.player.getIframe(),this.el.style.position="absolute",this.el.style.left="50%",this.el.style.top="calc(50% - 58px)",this.el.style.transform="translate(-50%, -50%)",this.el.style.webkitTransform="translate(-50%, -50%)",this.el.style.msTransform="translate(-50%, -50%)",this.el.style.oTransform="translate(-50%, -50%)",this.el.style.mozTransform="translate(-50%, -50%)",this.el.style.minWidth="calc( 100% + 2px )",this.el.style.minHeight="calc( 100% + 122px )",this.el.style.opacity="0",this._constructOverlay(),this.resize()},_listen:function(){var t=this;this.on("play",function(){t.el.style.opacity="1"}),this._options.showPosterBeforePlay||this.once("play",function(){t.wrapper.style.backgroundImage="url('"+t._options.poster+"')"}),this._options.showPosterOnEnd?this.on("end",function(){t.el.style.opacity="0"}):this.on("end",function(){t.player.seekTo(t.player.getDuration()),t.player.playVideo(),t.player.pauseVideo()}),this._options.showPosterOnPause&&this.on("pause",function(){t.el.style.opacity="0"})},play:function(){return this.player.playVideo(),this},pause:function(){return this.player.pauseVideo(),this},setVolume:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;return this.player.setVolume(t),this},getVolume:function(){return this.getVolume()},mute:function(){return this.player.mute(),this},unMute:function(){return this.player.unMute(),this},setTime:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.player.seekTo(t,!0),this},getTime:function(){return this.player.getCurrentTime()},getDuration:function(){return this.player.getDuration()},showPoster:function(){this.pause().el.style.opacity="0"},changeSource:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(11===t.length)this.videoID=t;else{var i=t.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=|\?v=)([^#\&\?]*).*/);if(!i||11!==i[2].length)return new Error("Provided source is not a valid YouTube url");this.videoID=i[2]}if(this.player.loadPlaylist(this.videoID,0,this._options.startAt,this._options.quality),this.player.setLoop(this._options.loop),e){var s=this._options.poster;-1!==this.wrapper.style.backgroundImage.indexOf(s)&&(this.wrapper.style.backgroundImage="url('"+e+"')"),this._options.poster=e}},destroy:function(){this.emit("destroy"),this.player.destroy();try{this.wrapper.parentNode.removeChild(this.wrapper)}catch(t){}t.deleteInstance(this.vidimID),delete this.container.vidimID,this.off()},resize:function(){if(this.el){var t=this.container.offsetHeight,e=this.container.offsetWidth;"BODY"===this.container.nodeName&&(e=window.innerWidth,t=window.innerHeight),1<this._options.ratio&&e/t<this._options.ratio||1>this._options.ratio&&t/e<this._options.ratio?(this.el.style.maxHeight="calc( 100% + 122px )",this.el.style.maxWidth="",this.el.style.height="",this.el.style.width=this.el.offsetHeight*this._options.ratio+200+"px"):(this.el.style.maxHeight="",this.el.style.maxWidth="calc( 100% + 2px )",this.el.style.height=this.el.offsetWidth/this._options.ratio+"px",this.el.style.width="",this.el.offsetHeight<this.wrapper.offsetHeight+140&&(this.el.style.height=this.el.offsetWidth/this._options.ratio+140+"px")),this.emit("resize")}}};t.registerProvider("YouTube",s)}(f),n(y),f}function y(){var t=document.querySelectorAll("[data-vidim]");if(t.length)for(var e=0;e<t.length;e++){var i=t[e],s=i.getAttribute("data-vidim");if(void 0===i.vidimID)try{var o=s.replace(/({|,)(?:\s*)(?:')?([A-Za-z_$\.][A-Za-z0-9_ \-\.$]*)(?:')?(?:\s*):/g,'$1"$2":').replace(/:\s?'/g,':"').replace(/'\s?}/g,'"}').replace(/',"/g,'","');new f(i,JSON.parse(o))}catch(t){}}}function f(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Object.keys(e).forEach(function(t){c.push(t)}),i(e,p),e.src&&!u[e.type]?new Error("No provider can handle type: '"+e.type+"'"):("string"==typeof e.ratio&&("4/3"===e.ratio?e.ratio=4/3:e.ratio=16/9),this._options=e,this.container=s(t),this.container?(-1===c.indexOf("zIndex")&&"BODY"===this.container.nodeName&&(this._options.zIndex=-1),void this._initialize()):new Error("Could not find the container: "+t))}}("undefined"!=typeof window?window:void 0)});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
niteo-cmp.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: CMP - Coming Soon & Maintenance Plugin
|
4 |
Plugin URI: https://wordpress.org/plugins/cmp-coming-soon-maintenance/
|
5 |
Description: Display customizable landing page for Coming Soon, Maintenance & Under Construction page.
|
6 |
-
Version: 3.6
|
7 |
Author: NiteoThemes
|
8 |
Author URI: https://www.niteothemes.com
|
9 |
Text Domain: cmp-coming-soon-maintenance
|
@@ -64,7 +64,7 @@ if ( ! class_exists( 'CMP_Coming_Soon_and_Maintenance' ) ) :
|
|
64 |
|
65 |
private function constants() {
|
66 |
// define constants
|
67 |
-
$this->define( 'CMP_VERSION', '3.6' );
|
68 |
$this->define( 'CMP_DEBUG', FALSE );
|
69 |
$this->define( 'CMP_AUTHOR', 'NiteoThemes' );
|
70 |
$this->define( 'CMP_AUTHOR_HOMEPAGE', 'https://niteothemes.com' );
|
3 |
Plugin Name: CMP - Coming Soon & Maintenance Plugin
|
4 |
Plugin URI: https://wordpress.org/plugins/cmp-coming-soon-maintenance/
|
5 |
Description: Display customizable landing page for Coming Soon, Maintenance & Under Construction page.
|
6 |
+
Version: 3.6.1
|
7 |
Author: NiteoThemes
|
8 |
Author URI: https://www.niteothemes.com
|
9 |
Text Domain: cmp-coming-soon-maintenance
|
64 |
|
65 |
private function constants() {
|
66 |
// define constants
|
67 |
+
$this->define( 'CMP_VERSION', '3.6.1' );
|
68 |
$this->define( 'CMP_DEBUG', FALSE );
|
69 |
$this->define( 'CMP_AUTHOR', 'NiteoThemes' );
|
70 |
$this->define( 'CMP_AUTHOR_HOMEPAGE', 'https://niteothemes.com' );
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: coming soon, landing page, launch page, maintenance mode, under constructi
|
|
5 |
Requires at least: 3.0
|
6 |
Requires PHP: 5.3
|
7 |
Tested up to: 5.2
|
8 |
-
Stable tag: 3.6
|
9 |
License: GPLv2 or later
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -145,6 +145,12 @@ https://www.youtube.com/watch?v=uxuJfHzwdtE
|
|
145 |
<p>Nothing is better than a good feedback! Please go to <a href="https://wordpress.org/support/plugin/cmp-coming-soon-maintenance/reviews/">Plugin reviews</a> and rate it! Alternatively you can click on a Donate button too!:)</p>
|
146 |
|
147 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
<h4>CMP 3.6 - 26-Aug-19</h4>
|
149 |
<ul>
|
150 |
<li>Added new Subscribe integration with Mailster premium WordPress plugin.</li>
|
5 |
Requires at least: 3.0
|
6 |
Requires PHP: 5.3
|
7 |
Tested up to: 5.2
|
8 |
+
Stable tag: 3.6.1
|
9 |
License: GPLv2 or later
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
145 |
<p>Nothing is better than a good feedback! Please go to <a href="https://wordpress.org/support/plugin/cmp-coming-soon-maintenance/reviews/">Plugin reviews</a> and rate it! Alternatively you can click on a Donate button too!:)</p>
|
146 |
|
147 |
== Changelog ==
|
148 |
+
<h4>CMP 3.6.1 - 26-Sept-19</h4>
|
149 |
+
<ul>
|
150 |
+
<li>Changes in Custom Analytics code: it can contain any Javascript code now. It also requires code wrapped in '<script>' tags. Make sure to test your analytics after this update.</li>
|
151 |
+
<li>Updated YouTube fullscreen background video to hide video title correctly. Thanks to @theking007</li>
|
152 |
+
</ul>
|
153 |
+
|
154 |
<h4>CMP 3.6 - 26-Aug-19</h4>
|
155 |
<ul>
|
156 |
<li>Added new Subscribe integration with Mailster premium WordPress plugin.</li>
|