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

View file

@ -5,7 +5,6 @@ require_once $global['systemRootPath'] . 'plugin/Plugin.abstract.php';
class CustomizeAdvanced extends PluginAbstract {
public function getDescription() {
$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>";
@ -96,8 +95,7 @@ class CustomizeAdvanced extends PluginAbstract {
$p = AVideoPlugin::loadPlugin($value['dirName']);
if (is_object($p)) {
$foreginObjects = $p->getCustomizeAdvancedOptions();
if($foreginObjects)
{
if ($foreginObjects) {
foreach ($foreginObjects as $optionName => $defaultValue)
$obj->{$optionName} = $defaultValue;
}
@ -108,6 +106,8 @@ class CustomizeAdvanced extends PluginAbstract {
$obj->disableAboutLeftMenu = false;
$obj->disableContactLeftMenu = false;
$obj->disableNavbar = false;
$obj->disableNavBarInsideIframe = true;
$obj->autoHideNavbar = true;
$obj->videosCDN = "";
$obj->useFFMPEGToGenerateThumbs = false;
$obj->thumbsWidthPortrait = 170;
@ -156,9 +156,10 @@ class CustomizeAdvanced extends PluginAbstract {
$obj->showPrivateVideosOnSitemap = false;
$obj->enableOldPassHashCheck = true;
$obj->disableHTMLDescription = false;
$obj->disableTopMenusInsideIframe = true;
$obj->disableVideoSwap = false;
$obj->makeSwapVideosOnlyForAdmin = false;
$obj->disableCopyEmbed = false;
$obj->disableDownloadVideosList = false;
$parse = parse_url($global['webSiteRootURL']);
$domain = str_replace(".", "", $parse['host']);
@ -199,9 +200,12 @@ class CustomizeAdvanced extends PluginAbstract {
$obj = $this->getDataObject();
$content = '';
if($obj->disableTopMenusInsideIframe){
if ($obj->disableNavBarInsideIframe) {
$content .= '<script>$(function () {if(inIframe()){$("#mainNavBar").fadeOut();}});</script>';
}
if ($obj->autoHideNavbar) {
$content .= '<script>$(function () {$("#mainNavBar").autoHidingNavbar();});</script>';
}
return $content;
}
@ -243,7 +247,6 @@ class CustomizeAdvanced extends PluginAbstract {
return $btn;
}
public function getHeadCode() {
global $global;
$baseName = basename($_SERVER['REQUEST_URI']);
@ -298,5 +301,4 @@ class CustomizeAdvanced extends PluginAbstract {
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/bootgrid/jquery.bootgrid.js";
$jsFiles[] = "view/bootstrap/bootstrapSelectPicker/js/bootstrap-select.min.js";
//$jsFiles[] = "view/js/bootstrap-toggle/bootstrap-toggle.min.js";
$jsFiles[] = "view/js/js-cookie/js.cookie.js";
$jsFiles[] = "view/js/bootstrap-toggle/bootstrap-toggle.min.js";
$jsFiles[] = "view/js/jquery.bootstrap-autohidingnavbar.min.js";
$jsFiles[] = "view/css/flagstrap/js/jquery.flagstrap.min.js";
$jsFiles[] = "view/js/webui-popover/jquery.webui-popover.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-dialog -->
</div><!-- /.modal -->
<?php
if(empty($advancedCustom->disableDownloadVideosList)){
?>
<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">
<i class="fas fa-download"></i> <?php echo __("Download your videos list"); ?> (SEO .txt file)
@ -612,6 +615,7 @@
</a>
</div>
<?php
}
if ((User::isAdmin()) && (!$config->getDisable_youtubeupload())) {
?>
<div class="alert alert-info">
@ -1769,8 +1773,16 @@ if (User::isAdmin()) {
formatters: {
"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)); ?>\'/>';
<?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 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>';