HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Opening popup programatically
I'm looking for a way to open a vanilla popup overlay type window programatically, via javascript or other means. something similar to window.open("myfavortieurl","Popup");
i'm not looking for how to format a link on a page for it to launch in a popup target, i don't have trouble there.
Thanks in advance.
0
Comments
Good question, you wan to to avoid opening actual windows.
I take it you already know this:
You can simply
it will look for the href attr
You can
You can include a heading
<h1>Heading</h1><p>Message</p>
grep is your friend.
That will set an anchor on the page to display in a popup when clicked, right? I guess from there I could use js to 'click' the link, but I was curious if there was a more direct path.
Vanilla Wiki, Tastes Great! 31,000 viewers can't be wrong. || Plugin Development Explained
no clicking or anchor involved.
paste in your console and run it for a test.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Oh, fantastic! I'm not at a real browser at the moment, but I will try it out tonight.
Vanilla Wiki, Tastes Great! 31,000 viewers can't be wrong. || Plugin Development Explained
themehook
you may need to fiddle with the .css element for .Popup
mynew.js
someone may want to improve on this. but here is a start.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
I like how jquery.ui.dialog handles things. It is a lot more intuitive and the popup code could be adapted to use it.
I'm not a huge fan of using every jquery.ui widget under the box, but that is good one.
grep is your friend.
I used this on my PrivacyNotice plugin, to popup the notice on the same page. Works really well.
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
@vrijvlinder said:
certainly easier to enable and disable then the themehooks.
http://vanillaforums.org/addon/privacynotice-plugin> @vrijvlinder said:
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
via console, i've been working my way through this.
it seems like im close, but the popup does not open. It would appear that I've got the correct selector, because it echos back the right tag. but then nothing.
if i then enter $.popup({},"Hi");
a popup opens but it only contains the word "Hi".
Vanilla Wiki, Tastes Great! 31,000 viewers can't be wrong. || Plugin Development Explained
I had something similar happen , did you try using the full url ?
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
jQuery.popup(options, data);
simply calls the function with whatever options and data you pass it. Meaning that these two$('.P > a:first').popup();
and$.popup({},"Hi");
have nothing to do with one another. I've been working on refactoring our Popup plugin and whilst reading through the source haven't found a way to programatically set a target URL. The target is in fact pulled directly from thehref
value of a link (or the closest parent link) so this might well be the best workaround for now (like you originally pointed out):...and then later on:
P.S.: You could also create the element in Javascript without appending it to the DOM and then go from there.
Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub
thanks Kasper, the click was what was needed.
In fact, since via the theme i had already associated that anchor tag with a popup, looks like all i need to do on this one is call click....
Vanilla Wiki, Tastes Great! 31,000 viewers can't be wrong. || Plugin Development Explained