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

Override native js functions window.alert and window.confirm #380

Conversation

orthagh
Copy link
Contributor

@orthagh orthagh commented Jan 19, 2016

(with identical behaviors)

For a prettier dialog :

image

@orthagh orthagh added this to the 0.91 milestone Jan 19, 2016
@orthagh orthagh mentioned this pull request Jan 19, 2016
@tomolimo
Copy link
Contributor

Is there a possible title for the dialog?

// return early
return confirmed;
};");
}
}
?>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why can't we like commits facebook-style ?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like
... ok i leave here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yes, I understand now :)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haha @tomolimo i was scared of a tomahawklimo to be sent :p

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:)

@tomolimo
Copy link
Contributor

???

@orthagh
Copy link
Contributor Author

orthagh commented Jan 19, 2016

Here is the optional caption :

window.confirm('My confirm dialog', 'My title');

window.alert('My alert dialog', 'My title');

If not present, no title title is displayed for confirm.
For alert, "Information" by default (title is always present)

@tomolimo
Copy link
Contributor

Perfect!

@orthagh
Copy link
Contributor Author

orthagh commented Jan 19, 2016

I'll keep this pr unmerged until Friday.

Waiting for suggestions and improvments

@orthagh orthagh self-assigned this Jan 19, 2016
@tomolimo
Copy link
Contributor

ok

orthagh added a commit that referenced this pull request Jan 22, 2016
…rm_functions

Override native js functions window.alert and window.confirm
@orthagh orthagh merged commit 345ecf9 into glpi-project:master Jan 22, 2016
@tomolimo
Copy link
Contributor

There is a problem as confirm() is asynchronous and works with the last clicked element....
If there is no clicked element this doesn't work in this case confirm returns immediately.
Those dialog boxes MUST be synchronous by definition.

@tomolimo
Copy link
Contributor

I don't have time to fix this now, but I can do it on Monday

@orthagh
Copy link
Contributor Author

orthagh commented Jan 22, 2016

Yes. Native confirm function is synchronous and new implementation is asynchronous (no solution for that, i spent 3hours to tests various code).
The idea was to retrigger click on last element to resend the confirm dialog and the value returned.

It absolutely can't work if you don't have a user stimuli (generally 'click').

I let you think and test a solution but i doubt it will be possible.
I think we need to remove all confirm functions from code and replace by a generic function do display a jquery dialog but with an asynchronous mode (with a click listener on affected element).

@tomolimo
Copy link
Contributor

I'll check that on Monday.
I've got already some ideas.
Regards
Tomolimo

-------- Original message --------
From: Alexandre Delaunay
Date:22/01/2016 16:54 (GMT+01:00)
To: glpi-project/glpi
Cc: "Moron, Olivier"
Subject: Re: [glpi] Override native js functions window.alert and window.confirm (#380)

Yes. Native confirm function is synchronous and new implementation is asynchronous (no solution for that, i spent 3hours to tests various code).
The idea was to retrigger click on last element to resend the confirm dialog and the value returned.

It absolutely can't work if you don't have a user stimuli (generally 'click').

I let you think and test a solution but i doubt it will be possible.
I think we need to remove all confirm functions from code and replace by a generic function do display a jquery dialog but with an asynchronous mode (with a click listener on affected element).


Reply to this email directly or view it on GitHubhttps://github.com//pull/380#issuecomment-173959813.

@tomolimo
Copy link
Contributor

Questions: do we use Bootstrap?
and if we use it: which version of Bootstrap do we use in 0.91?

@orthagh
Copy link
Contributor Author

orthagh commented Jan 25, 2016

No

@tomolimo
Copy link
Contributor

At the end : can't changed asynch to synch :(

@orthagh orthagh deleted the 0.91/override_js_alert_and_confirm_functions branch October 3, 2016 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants