Skip to content

Commit

Permalink
set max version to 21 and remove jquery dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
radoslavius authored and Radoslav Štofko committed Mar 1, 2021
1 parent 85918f5 commit 8f17812
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
4 changes: 2 additions & 2 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Examples:
http://nextcloud.example.com/index.php/apps/files/?hide-sidebars
http://nextcloud.example.com/index.php/apps/files/?dir=/New%20folder&hide-sidebars
```]]></description>
<version>1.0.7</version>
<version>1.1.0</version>
<licence>agpl</licence>
<author mail="rstofko@gmail.com" >Radoslav Stofko</author>
<namespace>HideSidebars</namespace>
Expand All @@ -26,6 +26,6 @@ http://nextcloud.example.com/index.php/apps/files/?dir=/New%20folder&hide-sideba
<repository>https://github.com/pointcz/hidesidebars</repository>
<screenshot>https://raw.githubusercontent.com/pointcz/hidesidebars/master/.readme/hidesidebars.png</screenshot>
<dependencies>
<nextcloud min-version="15" max-version="20"/>
<nextcloud min-version="15" max-version="21"/>
</dependencies>
</info>
31 changes: 22 additions & 9 deletions js/script.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
$(document).ready(function () {
window.addEventListener('DOMContentLoaded', function(event) {
if (getParameterByName('hide-sidebars') !== null) {
hideSidebars();
}

function getParameterByName (name, url) {
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
Expand All @@ -13,13 +13,26 @@ $(document).ready(function () {
return decodeURIComponent(results[2].replace(/\+/g, " "));
}

function hideSidebars () {
$('#header,#app-navigation,#app-navigation-vue,.app-navigation-toggle').hide();
$('#app-content').css('margin-left', 0);
$('#content,#content-vue').css('padding-top', 0);
$('#controls').css('top', 0).css('padding-left', 0);
$('#filestable thead').css('top', '44px');
$('#app-navigation-toggle').css('z-index', 0);
function hideSidebars() {
var changeStyles = [
{el: '#header', style: 'display', value: 'none'},
{el: '#app-navigation', style: 'display', value: 'none'},
{el: '#app-navigation-vue', style: 'display', value: 'none'},
{el: '.app-navigation-toggle', style: 'display', value: 'none'},
{el: '#app-content', style: 'marginLeft', value: 0},
{el: '#content', style: 'paddingTop', value: 0},
{el: '#content-vue', style: 'paddingTop', value: 0},
{el: '#controls', style: 'top', value: 0},
{el: '#controls', style: 'paddingLeft', value: 0},
{el: '#filestable thead', style: 'top', value: '44px'},
{el: '#app-navigation-toggle', style: 'zIndex', value: 0},
];
for (var i = 0; i < changeStyles.length; i += 1) {
var element = document.querySelectorAll(changeStyles[i].el);
if (element.length) {
element[0].style[changeStyles[i].style] = changeStyles[i].value;
}
}
}

});

0 comments on commit 8f17812

Please sign in to comment.