Topbar Focusizer Download 1.1.1

5.0
us Allon Prooit 5 months ago

A small component to keep the topbar in focus. Also includes javascript that is supposed to make the topbar scroll up when scrolling down and then return after scrolling back up.
Needing help to further develop it.
V1.0 - Initial release. Keeps the topbar constantly in focus.
V1.1 - Code corrected for the community to help develop it.
V1.1.1 - Code corrected by Rafael Amorim. Code needs to be adjusted for right side buttons in CSS.

Comments
us Allon Prooit Replied 3 months ago

Many thanks to Rafael Amorim for the code adjustment. I am still not able to make this component work for the White Theme I use but apparently it works on a number of other themes. Indeed, Facebook, built on OSSN 3.0 seems to be using this component now to make the upper bar scroll up when scrolling down and reappear when scrolling up. Please let me know if you have any success with this working for the White Theme and, if so please let me know what adjustments, if any, had to be made. Thanks!

Breton Rafael Amorim Replied 5 months ago

Allon

With propper free time, I looked at your code, same as Arsalan and Michael do with my code all the time :-)

First of all, put the code on GitHub, not only the zip file. It allows other developers to look at your code and easily point out where is needed some fix.

Second, it is helpful if any new changes in your component are an increment in version, such as 1.1.1 or beta-1, beta-2, etc. It allows users and developers to check the local version and decide if an update is a good decision.

Finnaly, I tested the component on 6.1 with goblue theme (default installation). CSS code works, but JS code
document.getElementById("topbar") don't call nothing, because the div has a topbar class, not an id. So, my sugestion is:

var prevScrollpos = window.pageYOffset;
window.onscroll = function() {
  var currentScrollPos = window.pageYOffset;
  if (prevScrollpos > currentScrollPos) {
    $('.topbar').css('top','0px');
  } else {
    $('.topbar').css('top','-60px');
  }
  prevScrollpos = currentScrollPos;
}

This code solve the animation issues. Buttons and menu item at top right still need attention. Take a look on CSS.

I hope it helps.

Respectfully

us Allon Prooit Replied 5 months ago

Ok, I've uploaded a new V1.1 with some slight adjustments. I'm not getting any error messages now and hoping the community can help with the javascript code.

Indonesian Arsalan Shah Replied 5 months ago

I am still getting error

ossn.site.js:2821 Uncaught TypeError: Cannot read properties of null (reading 'style')
at window.onscroll (ossn.site.js:2821:38)

enter image description here

There other issue as I mentioned in my first comment is the wall form is under the topbar so I can't write or select some menus of wall form Same with other pages profile , groups. etc

enter image description here

I can only provide feedback about errors I am not sure the logic behind your JS so I can't help with it.

us Allon Prooit Replied 5 months ago

Well, Michael provided the 2 different means...
The 1st appends the data to the head of the site without cache.
The 2nd lets the data be cached and minified.
I was thinking the 1st is the underwear and the 2nd is the pants.
Sorry if my thinking is wrong.
Also, can we please address the issue of the topbar not scrolling up when scrolling down as it's meant to? Thanks!

Indonesian Arsalan Shah Replied 5 months ago

Just seen your code and as Michael explained to you about extend views I would like to ask you again

ossn_extend_view('js/ossn/site/head', 'js/topbarfocusizer');
ossn_extend_view('js/ossn.site', 'js/topbarfocusizer');

Sorry let me make a little Joke here, Why wearing two underwear same time? Why you are loading same JS two times in the same page? you need one of it only.

us Allon Prooit Replied 5 months ago

You're right, I uploaded the wrong one again. I forgot to save the new js file before zipping it up. Sorry.

Indonesian Arsalan Shah Replied 5 months ago

Still same your old 1.1 and new one still same :)

us Allon Prooit Replied 5 months ago

Sorry again, Mr. Michael. I reincluded them in an attempt to get the errors to go away with V1.0 and mistakenly left them there. I reuploaded V1.1 without them. It still shows the same javascript error though.

German Michael Z├╝lsdorff Replied 5 months ago

Just tried V1.1
and I give up trying to help at this point because you seem not really willing to take advice.

Two days ago I wrote "Now, that this file IS already recognized as Javascript, any additional <script></script> tags inside are not allowed / confusing the script interpreter.

Not a line of yours you don't understand this sentence, you don't agree ... whatever. You just silently leave the </script> tag in place. I'm sorry, but my idea of cooperation is different.

Component

Developer: Allon
License GPL v2
Type: Tools
Requires Ossn Version : 5.6
Latest Version: 1.1.1
Last Updated 4 months ago
Repository Url View Repository

Versions