1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-04 10:19:24 +02:00

Autohide navbar

This commit is contained in:
daniel 2020-06-13 14:16:14 -03:00
parent 1a5003be06
commit 331b83e89f
5 changed files with 104 additions and 76 deletions

View file

@ -1808,7 +1808,7 @@ function url_get_contents($url, $ctx = "", $timeout = 0) {
// If is URL try wget First // If is URL try wget First
if (empty($ctx)) { if (empty($ctx)) {
$filename = getTmpDir("YPTurl_get_contents") . md5($url); $filename = getTmpDir("YPTurl_get_contents") . md5($url);
wget($url, $filename); if(wget($url, $filename)){
$result = file_get_contents($filename); $result = file_get_contents($filename);
unlink($filename); unlink($filename);
if(!empty($result)){ if(!empty($result)){
@ -1821,6 +1821,7 @@ function url_get_contents($url, $ctx = "", $timeout = 0) {
} }
} }
} }
}
if (empty($ctx)) { if (empty($ctx)) {
$opts = array( $opts = array(
@ -3277,6 +3278,9 @@ function wget($url, $filename) {
//echo $cmd; //echo $cmd;
exec($cmd); exec($cmd);
wgetRemoveLock($url); wgetRemoveLock($url);
if(!file_exists($filename)){
return false;
}
if (filesize($filename) > 1000000) { if (filesize($filename) > 1000000) {
return true; return true;
} }

View file

@ -5,11 +5,10 @@ require_once $global['systemRootPath'] . 'plugin/Plugin.abstract.php';
class CustomizeAdvanced extends PluginAbstract { class CustomizeAdvanced extends PluginAbstract {
public function getDescription() { public function getDescription() {
$txt = "Fine Tuning your AVideo"; $txt = "Fine Tuning your AVideo";
$help = "<br><small><a href='https://github.com/WWBN/AVideo/wiki/Advanced-Customization-Plugin' target='__blank'><i class='fas fa-question-circle'></i> Help</a></small>"; $help = "<br><small><a href='https://github.com/WWBN/AVideo/wiki/Advanced-Customization-Plugin' target='__blank'><i class='fas fa-question-circle'></i> Help</a></small>";
return $txt.$help; return $txt . $help;
} }
public function getName() { public function getName() {
@ -85,29 +84,30 @@ class CustomizeAdvanced extends PluginAbstract {
$o->type = "textarea"; $o->type = "textarea";
$o->value = ""; $o->value = "";
$obj->footerHTMLCode = $o; $obj->footerHTMLCode = $o;
$obj->signInOnRight= true; $obj->signInOnRight = true;
$obj->signInOnLeft= true; $obj->signInOnLeft = true;
$obj->forceCategory= false; $obj->forceCategory = false;
$obj->autoPlayAjax= false; $obj->autoPlayAjax = false;
$plugins = Plugin::getAllEnabled(); $plugins = Plugin::getAllEnabled();
//import external plugins configuration options //import external plugins configuration options
foreach ($plugins as $value) { foreach ($plugins as $value) {
$p = AVideoPlugin::loadPlugin($value['dirName']); $p = AVideoPlugin::loadPlugin($value['dirName']);
if (is_object($p)) { if (is_object($p)) {
$foreginObjects=$p->getCustomizeAdvancedOptions(); $foreginObjects = $p->getCustomizeAdvancedOptions();
if($foreginObjects) if ($foreginObjects) {
{ foreach ($foreginObjects as $optionName => $defaultValue)
foreach($foreginObjects as $optionName => $defaultValue) $obj->{$optionName} = $defaultValue;
$obj->{$optionName}=$defaultValue;
} }
} }
} }
$obj->disableHelpLeftMenu= false; $obj->disableHelpLeftMenu = false;
$obj->disableAboutLeftMenu= false; $obj->disableAboutLeftMenu = false;
$obj->disableContactLeftMenu= false; $obj->disableContactLeftMenu = false;
$obj->disableNavbar= false; $obj->disableNavbar = false;
$obj->disableNavBarInsideIframe = true;
$obj->autoHideNavbar = true;
$obj->videosCDN = ""; $obj->videosCDN = "";
$obj->useFFMPEGToGenerateThumbs = false; $obj->useFFMPEGToGenerateThumbs = false;
$obj->thumbsWidthPortrait = 170; $obj->thumbsWidthPortrait = 170;
@ -153,12 +153,13 @@ class CustomizeAdvanced extends PluginAbstract {
$o->value = ""; $o->value = "";
$obj->videoNotFoundText = $o; $obj->videoNotFoundText = $o;
$obj->siteMapRowsLimit = 100; $obj->siteMapRowsLimit = 100;
$obj->showPrivateVideosOnSitemap= false; $obj->showPrivateVideosOnSitemap = false;
$obj->enableOldPassHashCheck = true; $obj->enableOldPassHashCheck = true;
$obj->disableHTMLDescription = false; $obj->disableHTMLDescription = false;
$obj->disableTopMenusInsideIframe = true;
$obj->disableVideoSwap = false; $obj->disableVideoSwap = false;
$obj->makeSwapVideosOnlyForAdmin = false; $obj->makeSwapVideosOnlyForAdmin = false;
$obj->disableCopyEmbed = false;
$obj->disableDownloadVideosList = false;
$parse = parse_url($global['webSiteRootURL']); $parse = parse_url($global['webSiteRootURL']);
$domain = str_replace(".", "", $parse['host']); $domain = str_replace(".", "", $parse['host']);
@ -169,9 +170,9 @@ class CustomizeAdvanced extends PluginAbstract {
return $obj; return $obj;
} }
public function getHelp(){ public function getHelp() {
if(User::isAdmin()){ if (User::isAdmin()) {
return "<h2 id='CustomizeAdvanced help'>CustomizeAdvanced (admin)</h2><p>".$this->getDescription()."</p><table class='table'><tbody><tr><td>EnableWavesurfer</td><td>Enables the visualisation for audio. This will always download full audio first, so with big audio-files, you might better disable it.</td></tr><tr><td>commentsMaxLength</td><td>Maximum lenght for comments in videos</td></tr><tr><td>disableYoutubePlayerIntegration</td> <td>Disables the integrating of youtube-videos and just embed them.</td></tr><tr><td>EnableMinifyJS</td><td>Minify your JS. Clear videos/cache after changing this option.</td></tr></tbody></table>"; return "<h2 id='CustomizeAdvanced help'>CustomizeAdvanced (admin)</h2><p>" . $this->getDescription() . "</p><table class='table'><tbody><tr><td>EnableWavesurfer</td><td>Enables the visualisation for audio. This will always download full audio first, so with big audio-files, you might better disable it.</td></tr><tr><td>commentsMaxLength</td><td>Maximum lenght for comments in videos</td></tr><tr><td>disableYoutubePlayerIntegration</td> <td>Disables the integrating of youtube-videos and just embed them.</td></tr><tr><td>EnableMinifyJS</td><td>Minify your JS. Clear videos/cache after changing this option.</td></tr></tbody></table>";
} }
return ""; return "";
} }
@ -184,10 +185,10 @@ class CustomizeAdvanced extends PluginAbstract {
global $global, $config; global $global, $config;
$obj = $this->getDataObject(); $obj = $this->getDataObject();
$video = Video::getVideo($videos_id, "viewable", true); $video = Video::getVideo($videos_id, "viewable", true);
if(!empty($video['rrating']) && empty($_GET['rrating'])){ if (!empty($video['rrating']) && empty($_GET['rrating'])) {
$suffix = strtoupper(str_replace("-", "", $video['rrating'])); $suffix = strtoupper(str_replace("-", "", $video['rrating']));
eval("\$show = \$obj->askRRatingConfirmationBeforePlay_$suffix;"); eval("\$show = \$obj->askRRatingConfirmationBeforePlay_$suffix;");
if(!empty($show)){ if (!empty($show)) {
include "{$global['systemRootPath']}plugin/CustomizeAdvanced/confirmRating.php"; include "{$global['systemRootPath']}plugin/CustomizeAdvanced/confirmRating.php";
exit; exit;
} }
@ -199,16 +200,19 @@ class CustomizeAdvanced extends PluginAbstract {
$obj = $this->getDataObject(); $obj = $this->getDataObject();
$content = ''; $content = '';
if($obj->disableTopMenusInsideIframe){ if ($obj->disableNavBarInsideIframe) {
$content .= '<script>$(function () {if(inIframe()){$("#mainNavBar").fadeOut();}});</script>'; $content .= '<script>$(function () {if(inIframe()){$("#mainNavBar").fadeOut();}});</script>';
} }
if ($obj->autoHideNavbar) {
$content .= '<script>$(function () {$("#mainNavBar").autoHidingNavbar();});</script>';
}
return $content; return $content;
} }
public function getHTMLMenuRight() { public function getHTMLMenuRight() {
global $global; global $global;
$obj = $this->getDataObject(); $obj = $this->getDataObject();
if($obj->filterRRating){ if ($obj->filterRRating) {
include $global['systemRootPath'] . 'plugin/CustomizeAdvanced/menuRight.php'; include $global['systemRootPath'] . 'plugin/CustomizeAdvanced/menuRight.php';
} }
} }
@ -216,7 +220,7 @@ class CustomizeAdvanced extends PluginAbstract {
public function getHTMLMenuLeft() { public function getHTMLMenuLeft() {
global $global; global $global;
$obj = $this->getDataObject(); $obj = $this->getDataObject();
if($obj->filterRRating){ if ($obj->filterRRating) {
include $global['systemRootPath'] . 'plugin/CustomizeAdvanced/menuLeft.php'; include $global['systemRootPath'] . 'plugin/CustomizeAdvanced/menuLeft.php';
} }
} }
@ -224,31 +228,30 @@ class CustomizeAdvanced extends PluginAbstract {
public static function getVideoWhereClause() { public static function getVideoWhereClause() {
$sql = ""; $sql = "";
$obj = AVideoPlugin::getObjectData("CustomizeAdvanced"); $obj = AVideoPlugin::getObjectData("CustomizeAdvanced");
if($obj->filterRRating && isset($_GET['rrating'])){ if ($obj->filterRRating && isset($_GET['rrating'])) {
if($_GET['rrating']==="0"){ if ($_GET['rrating'] === "0") {
$sql .= " AND v.rrating = ''"; $sql .= " AND v.rrating = ''";
}else if(in_array($_GET['rrating'],Video::$rratingOptions)){ } else if (in_array($_GET['rrating'], Video::$rratingOptions)) {
$sql .= " AND v.rrating = '{$_GET['rrating']}'"; $sql .= " AND v.rrating = '{$_GET['rrating']}'";
} }
} }
return $sql; return $sql;
} }
public function getVideosManagerListButton(){ public function getVideosManagerListButton() {
$btn = ""; $btn = "";
if(User::isAdmin()){ if (User::isAdmin()) {
$btn = '<button type="button" class="btn btn-default btn-light btn-sm btn-xs btn-block " onclick="updateDiskUsage(\' + row.id + \');" data-row-id="right" data-toggle="tooltip" data-placement="left" title="Update Disk usage"><i class="fas fa-chart-line"></i> Update Disk Usage</button>'; $btn = '<button type="button" class="btn btn-default btn-light btn-sm btn-xs btn-block " onclick="updateDiskUsage(\' + row.id + \');" data-row-id="right" data-toggle="tooltip" data-placement="left" title="Update Disk usage"><i class="fas fa-chart-line"></i> Update Disk Usage</button>';
$btn .= '<button type="button" class="btn btn-default btn-light btn-sm btn-xs btn-block " onclick="removeThumbs(\' + row.id + \');" data-row-id="right" data-toggle="tooltip" data-placement="left" title="RemoveThumbs"><i class="fas fa-images"></i> Remove Thumbs</button>'; $btn .= '<button type="button" class="btn btn-default btn-light btn-sm btn-xs btn-block " onclick="removeThumbs(\' + row.id + \');" data-row-id="right" data-toggle="tooltip" data-placement="left" title="RemoveThumbs"><i class="fas fa-images"></i> Remove Thumbs</button>';
} }
return $btn; return $btn;
} }
public function getHeadCode() {
public function getHeadCode(){
global $global; global $global;
$baseName = basename($_SERVER['REQUEST_URI']); $baseName = basename($_SERVER['REQUEST_URI']);
$js = ""; $js = "";
if($baseName === 'mvideos'){ if ($baseName === 'mvideos') {
$js .= "<script>function updateDiskUsage(videos_id){ $js .= "<script>function updateDiskUsage(videos_id){
modal.showPleaseWait(); modal.showPleaseWait();
\$.ajax({ \$.ajax({
@ -258,7 +261,7 @@ class CustomizeAdvanced extends PluginAbstract {
success: function (response) { success: function (response) {
if(response.error){ if(response.error){
swal({ swal({
title: \"".__("Sorry!")."\", title: \"" . __("Sorry!") . "\",
text: response.msg, text: response.msg,
type: \"error\", type: \"error\",
html: true html: true
@ -279,13 +282,13 @@ class CustomizeAdvanced extends PluginAbstract {
success: function (response) { success: function (response) {
if(response.error){ if(response.error){
swal({ swal({
title: \"".__("Sorry!")."\", title: \"" . __("Sorry!") . "\",
text: response.msg, text: response.msg,
icon: \"error\" icon: \"error\"
}); });
}else{ }else{
swal({ swal({
title: \"".__("Success!")."\", title: \"" . __("Success!") . "\",
text: \"\", text: \"\",
icon: \"success\" icon: \"success\"
}); });
@ -298,5 +301,4 @@ class CustomizeAdvanced extends PluginAbstract {
return $js; return $js;
} }
} }

View file

@ -63,8 +63,8 @@ $jsFiles[] = "view/js/seetalert/sweetalert.min.js";
$jsFiles[] = "view/js/bootpag/jquery.bootpag.min.js"; $jsFiles[] = "view/js/bootpag/jquery.bootpag.min.js";
$jsFiles[] = "view/js/bootgrid/jquery.bootgrid.js"; $jsFiles[] = "view/js/bootgrid/jquery.bootgrid.js";
$jsFiles[] = "view/bootstrap/bootstrapSelectPicker/js/bootstrap-select.min.js"; $jsFiles[] = "view/bootstrap/bootstrapSelectPicker/js/bootstrap-select.min.js";
//$jsFiles[] = "view/js/bootstrap-toggle/bootstrap-toggle.min.js"; $jsFiles[] = "view/js/bootstrap-toggle/bootstrap-toggle.min.js";
$jsFiles[] = "view/js/js-cookie/js.cookie.js"; $jsFiles[] = "view/js/jquery.bootstrap-autohidingnavbar.min.js";
$jsFiles[] = "view/css/flagstrap/js/jquery.flagstrap.min.js"; $jsFiles[] = "view/css/flagstrap/js/jquery.flagstrap.min.js";
$jsFiles[] = "view/js/webui-popover/jquery.webui-popover.min.js"; $jsFiles[] = "view/js/webui-popover/jquery.webui-popover.min.js";
$jsFiles[] = "view/js/bootstrap-list-filter/bootstrap-list-filter.min.js"; $jsFiles[] = "view/js/bootstrap-list-filter/bootstrap-list-filter.min.js";

View file

@ -0,0 +1,10 @@
/*
* Bootstrap Auto-Hiding Navbar - v4.0.0
* An extension for Bootstrap's fixed navbar which hides the navbar while the page is scrolling downwards and shows it the other way. The plugin is able to show/hide the navbar programmatically as well.
* http://www.virtuosoft.eu/code/bootstrap-autohidingnavbar/
*
* Made by István Ujj-Mészáros
* Under Apache License v2.0 License
*/
!function(s,t,e,o){var n,h="autoHidingNavbar",a=s(t),r=s(e),i=null,u=null,l=70,f=0,d=null,c=a.height(),g=!0,m={disableAutohide:!1,showOnUpscroll:!0,showOnBottom:!0,hideOffset:"auto",animationDuration:200,navbarOffset:0};function p(t,e){this.element=s(t),this.settings=s.extend({},m,e),this._defaults=m,this._name=h,this.init()}function w(t){if(g){t.element.addClass("navbar-hidden").animate({top:-1*parseInt(t.element.css("height"),10)+t.settings.navbarOffset},{queue:!1,duration:t.settings.animationDuration});try{s(".dropdown.open .dropdown-toggle, .dropdown.show .dropdown-toggle",t.element).dropdown("toggle")}catch(t){}g=!1,t.element.trigger("hide.autoHidingNavbar")}}function O(t){g||(t.element.removeClass("navbar-hidden").animate({top:0},{queue:!1,duration:t.settings.animationDuration}),g=!0,t.element.trigger("show.autoHidingNavbar"))}function b(t){t.settings.disableAutohide||(f=(new Date).getTime(),function(t){var e=a.scrollTop(),i=e-d;if(d=e,i<0){if(g)return;(t.settings.showOnUpscroll||e<=n)&&O(t)}else if(0<i){if(!g)return t.settings.showOnBottom&&e+c===r.height()&&O(t);n<=e&&w(t)}}(t))}p.prototype={init:function(){var t;return this.elements={navbar:this.element},this.setDisableAutohide(this.settings.disableAutohide),this.setShowOnUpscroll(this.settings.showOnUpscroll),this.setShowOnBottom(this.settings.showOnBottom),this.setHideOffset(this.settings.hideOffset),this.setAnimationDuration(this.settings.animationDuration),n="auto"===this.settings.hideOffset?parseInt(this.element.css("height"),10):this.settings.hideOffset,t=this,r.on("scroll."+h,function(){(new Date).getTime()-f>l?b(t):(clearTimeout(i),i=setTimeout(function(){b(t)},l))}),a.on("resize."+h,function(){clearTimeout(u),u=setTimeout(function(){c=a.height()},l)}),this.element},setDisableAutohide:function(t){return this.settings.disableAutohide=t,this.element},setShowOnUpscroll:function(t){return this.settings.showOnUpscroll=t,this.element},setShowOnBottom:function(t){return this.settings.showOnBottom=t,this.element},setHideOffset:function(t){return this.settings.hideOffset=t,this.element},setAnimationDuration:function(t){return this.settings.animationDuration=t,this.element},show:function(){return O(this),this.element},hide:function(){return w(this),this.element},destroy:function(){return r.off("."+h),a.off("."+h),O(this),s.data(this,"plugin_"+h,null),this.element}},s.fn[h]=function(e){var i,n=arguments;return e===o||"object"==typeof e?this.each(function(){s.data(this,"plugin_"+h)||s.data(this,"plugin_"+h,new p(this,e))}):"string"==typeof e&&"_"!==e[0]&&"init"!==e?(this.each(function(){var t=s.data(this,"plugin_"+h);t instanceof p&&"function"==typeof t[e]&&(i=t[e].apply(t,Array.prototype.slice.call(n,1)))}),i!==o?i:this):void 0}}(jQuery,window,document);

View file

@ -603,6 +603,9 @@
</div><!-- /.modal-content --> </div><!-- /.modal-content -->
</div><!-- /.modal-dialog --> </div><!-- /.modal-dialog -->
</div><!-- /.modal --> </div><!-- /.modal -->
<?php
if(empty($advancedCustom->disableDownloadVideosList)){
?>
<div class="btn-group pull-right" role="group"> <div class="btn-group pull-right" role="group">
<a href="<?php echo $global['webSiteRootURL']; ?>objects/videos.txt.php?type=seo" target="_blank" class="btn btn-default btn-sm"> <a href="<?php echo $global['webSiteRootURL']; ?>objects/videos.txt.php?type=seo" target="_blank" class="btn btn-default btn-sm">
<i class="fas fa-download"></i> <?php echo __("Download your videos list"); ?> (SEO .txt file) <i class="fas fa-download"></i> <?php echo __("Download your videos list"); ?> (SEO .txt file)
@ -612,6 +615,7 @@
</a> </a>
</div> </div>
<?php <?php
}
if ((User::isAdmin()) && (!$config->getDisable_youtubeupload())) { if ((User::isAdmin()) && (!$config->getDisable_youtubeupload())) {
?> ?>
<div class="alert alert-info"> <div class="alert alert-info">
@ -1769,8 +1773,16 @@ if (User::isAdmin()) {
formatters: { formatters: {
"commands": function (column, row) "commands": function (column, row)
{ {
var embedBtn = '<button type="button" class="btn btn-xs btn-default command-embed" id="embedBtn' + row.id + '" onclick="getEmbedCode(' + row.id + ')" data-toggle="tooltip" data-placement="left" title="<?php echo str_replace("'", "\\'", __("Copy embed code")); ?>"><span class="fa fa-copy" aria-hidden="true"></span> <span id="copied' + row.id + '" style="display:none;"><?php echo str_replace("'", "\\'", __("Copied")); ?></span></button>' var embedBtn = '';
<?php
if(empty($advancedCustom->disableCopyEmbed)){
?>
embedBtn += '<button type="button" class="btn btn-xs btn-default command-embed" id="embedBtn' + row.id + '" onclick="getEmbedCode(' + row.id + ')" data-toggle="tooltip" data-placement="left" title="<?php echo str_replace("'", "\\'", __("Copy embed code")); ?>"><span class="fa fa-copy" aria-hidden="true"></span> <span id="copied' + row.id + '" style="display:none;"><?php echo str_replace("'", "\\'", __("Copied")); ?></span></button>'
embedBtn += '<input type="hidden" id="embedInput' + row.id + '" value=\'<?php echo str_replace("{embedURL}", "{$global['webSiteRootURL']}vEmbed/' + row.id + '", str_replace("'", "\"", $advancedCustom->embedCodeTemplate)); ?>\'/>'; embedBtn += '<input type="hidden" id="embedInput' + row.id + '" value=\'<?php echo str_replace("{embedURL}", "{$global['webSiteRootURL']}vEmbed/' + row.id + '", str_replace("'", "\"", $advancedCustom->embedCodeTemplate)); ?>\'/>';
<?php
}
?>
var editBtn = '<button type="button" class="btn btn-xs btn-default command-edit" data-row-id="' + row.id + '" data-toggle="tooltip" data-placement="left" title="<?php echo str_replace("'", "\\'", __("Edit")); ?>"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span></button>' var editBtn = '<button type="button" class="btn btn-xs btn-default command-edit" data-row-id="' + row.id + '" data-toggle="tooltip" data-placement="left" title="<?php echo str_replace("'", "\\'", __("Edit")); ?>"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span></button>'
var deleteBtn = '<button type="button" class="btn btn-default btn-xs command-delete" data-row-id="' + row.id + '" data-toggle="tooltip" data-placement="left" title="<?php echo str_replace("'", "\\'", __("Delete")); ?>"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></button>'; var deleteBtn = '<button type="button" class="btn btn-default btn-xs command-delete" data-row-id="' + row.id + '" data-toggle="tooltip" data-placement="left" title="<?php echo str_replace("'", "\\'", __("Delete")); ?>"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></button>';
var activeBtn = '<button style="color: #090" type="button" class="btn btn-default btn-xs command-active" data-row-id="' + row.id + '" data-toggle="tooltip" data-placement="left" title="<?php echo str_replace("'", "\\'", __("Inactivate")); ?>"><span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span></button>'; var activeBtn = '<button style="color: #090" type="button" class="btn btn-default btn-xs command-active" data-row-id="' + row.id + '" data-toggle="tooltip" data-placement="left" title="<?php echo str_replace("'", "\\'", __("Inactivate")); ?>"><span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span></button>';