Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get rid of Ajax.Request in favour of plain JS #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bascht
Copy link

@bascht bascht commented Feb 16, 2017

Remove the Prototype.js dependency of the Sound Plugin in favour of
a plain JavaScript XMLHttpRequest().

See also jenkinsci/build-monitor-plugin#159

Remove the `Prototype.js` dependency of the Sound Plugin in favour of
a plain JavaScript XMLHttpRequest().

See also jenkinsci/build-monitor-plugin#159
@cafebabe cafebabe self-assigned this Feb 17, 2017
@cafebabe
Copy link
Member

Hi, just had a quick look into this. I'm happy to make this change but as prototype seems to be provided by Jenkins core I can't yet see why this is necessary. Looking at your build-monitor-plugin it looks like the sounds JS is being injected into a page without prototype. How is that happening? I'll have more time to look into this soon, but any background you can give me will be useful.

@bascht
Copy link
Author

bascht commented Feb 17, 2017

Thanks for your feedback, @cafebabe! I could've provided a bit more context in the first place:

The build monitor plugin included prototype.js until ~ last year, when they removed it (probably because of compatibility issues with Angular) in jenkinsci/build-monitor-plugin@321cfb2. (See lines 31+32 in that diff).

So I started to investigate how I could make the sound plugin work without depending on prototype.js and as it turned out, it only required a few lines of JS (if http://youmightnotneedjquery.com/#request is correct).

@ywchang
Copy link

ywchang commented Mar 22, 2017

Any update on this one? Or any workaround?

@bascht
Copy link
Author

bascht commented Mar 22, 2017

@ywchang So far none, but you could backport the change from https://github.com/bascht/sounds-plugin/blob/a89fa7aeba2bde568ae383becab87aa67bb527e8/src/main/resources/net/hurstfrost/hudson/sounds/SoundsAgentPageDecorator/header.jelly as a workaround (just override it in a custom JavaScript, in userContent. That's what we did to get it working again)

@ywchang
Copy link

ywchang commented Mar 22, 2017

@bascht Thanks for reply. But could you please share more details?

I know it is a js issue. So should I go to my jenkins server node to directly overwrite this jelly file or I need to fork the source code, make the change, package the plugin by myself and re-install it from my jenkins server?

@cafebabe
Copy link
Member

cafebabe commented Mar 26, 2017 via email

@bascht
Copy link
Author

bascht commented Mar 27, 2017

@cafebabe No worries. :) Thanks for your the update.
@ywchang I could've been a little more precise: We worked our way around this issue by using the Simple Theme Plugin which let's you include custom CSS / JavaScript files. That way I could override the missing function and use a bit of basic JavaScript to glue in the missing polling / callbacks. The full code is here: https://gist.github.com/bascht/70b08d5da133cff6ad182b835b83e6c4

Hope it helps. ;)

@paul-uz
Copy link

paul-uz commented Aug 8, 2022

paging Dr @cafebabe

@cafebabe
Copy link
Member

cafebabe commented Aug 8, 2022

paging Dr @cafebabe

What's gone wrong? I've not been here for a while. I clicked on the 'Details' link and getting a DNS error from jenkins.ci.cloudbees.com, what/who triggered this merge? Can't really see what the merge is trying to change (Ajax.Request is already gone). Can someone catch me up pls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants