allo- / ffprofile

A tool to create firefox profiles with personalized defaults.
GNU Affero General Public License v3.0
784 stars 56 forks source link

Bug on 'Start', 'save' and 'save and next' button going back to the 'Start' page #207

Closed Starli0n closed 4 years ago

Starli0n commented 4 years ago

Hi,

After installing, there is a bug on those buttons:

They make all return to the 'Start' page which is not the case on the installed website.

It is no blocking as the save feature is well taken into account.

allo- commented 4 years ago

Are you sure all Javascript is running? I cannot reproduce, but the tab switching depends on Bootstrap tabs (to be eventually replaced by something more lightweight ...)

https://www.w3schools.com/bootstrap/bootstrap_tabs_pills.asp

Starli0n commented 4 years ago

Ah...

What do you mean by "all Javacript is running" ?

I did not install any further Javacript library in global, do you ?

Should I install Bootstrap as I thought it could be handled by a CDN ?

Please note that I did not perform the last optional line from the install procedure which is:

allo- commented 4 years ago

Are bootstrap3 and jquery in installed apps? Then urlpatterns += staticfiles_urlpatterns() should allow to load them, when DEBUG=True is set. See the browser console for error messages and if everything is loading and if there are other error messages.

Starli0n commented 4 years ago

Yes, I added bootstrap3 and jquery along side profilemaker in INSTALLED_APPS.

But indeed, I have a Javascript error, the file /static/js/csp.js seems to be missing, as you can see on the log:

Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
Django version 3.0.4, using settings 'project.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
[15/Sep/2020 14:44:33] "GET / HTTP/1.1" 200 54845
[15/Sep/2020 14:44:33] "GET /static/js/jquery.js HTTP/1.1" 304 0
[15/Sep/2020 14:44:33] "GET /static/js/csp.js HTTP/1.1" 404 1767
[15/Sep/2020 14:44:33] "GET /static/js/csp.js HTTP/1.1" 404 1767
[15/Sep/2020 14:44:33] "GET /static/forkme_right_green_007200.png HTTP/1.1" 304 0

I have the same kind of messages into the Javascript console.

To run on debug mode, should I run the following command ?

$ DEBUG=True ./manage.py runserver
allo- commented 4 years ago

The csp part does not matter (It should not be in the repo, but it should not cause problems either). jquery 304 looks good. I thought about errors or warnigs in the browser console (pressing F12). I think we have an old bug open for avoiding js, but currently you need to allow first party js. But as jquery is loaded, the problem probably is not a scriptblocker addon.

Starli0n commented 4 years ago

I checked on webbrowser with no addon installed and I have the same behavior.

(By the way, if it was an addon issue, the problem should occur on the https://ffprofile.com as well)

Inside the console error (F12), I have 2 errors:

Here are the details for the second one:

Uncaught Error: Syntax error, unrecognized expression: .nav-pills a[href=#form0]
    at Function.ga.error (jquery.js:2)
    at ga.tokenize (jquery.js:2)
    at ga.select (jquery.js:2)
    at Function.ga [as find] (jquery.js:2)
    at r.fn.init.find (jquery.js:2)
    at new r.fn.init (jquery.js:2)
    at r (jquery.js:2)
    at (index):684
allo- commented 4 years ago

I wonder if this is due to a more recent jQuery version using querySelector which seems to need quotes here:

https://github.com/allo-/firefox-profilemaker/blob/8d8c146511bef5d118f402ed9c022319bade4f27/templates/main.html#L191

please try to use

$('.nav-pills a[href="#'+url.split('#')[1]+'"]').tab('show');

With added doublequotes for matching the link target.

Starli0n commented 4 years ago

Indeed, it fixes the issue :+1:

allo- commented 4 years ago

I opened a bug for replacing bootstrap sometime. I currently cannot work much on it, but I want it since quite a while because it is kind of ironic that the website needs JS.