reddit : onclick window.location - onclick

I am using reddit sharing button in my blog but when the share button is clicked it opens in same windows rather then in new window.
What needs to be changed to make the reddit to open in new window.
I searched the similar Question and Answer in stackoverflow but they seems do not match the question which i have.
Below is the code
<a href="http://www.reddit.com/submit" onclick="window.location = 'http://www.reddit.com/submit?url=' + encodeURIComponent(window.location); return false">
<img src="http://www.reddit.com/static/spreddit8.gif"
alt="submit to reddit" border="0" /> </a>

Related

Why is webpage scrolling when modal popup is closed?

When closing certain modal popups, page jumps to top.
Note:
I've built this page with Wordpress, using a combination of custom HTML and the Beaver Builder website builder. Wordpress theme is Astra.
Link to page with issue:
http://retirementinsuranceoptions.com/consuelo-avila
Once you get to web page, click on the "Book" option to navigate to the section that I'm having issues with. You'll notice that when you click on "Book an Appointment" or "Schedule a Chat", then close these popups, the page will jump to the top of the screen.
But, if you click on "Ask Consuelo a Question", then close the popup, the page doesn't scroll (which is what I'm interested in achieving for all other modal popups).
All buttons you see are styled anchor tags with href="#0".
I do notice a pattern...
The popup for the "Ask A Question" button contains a Form (from a Wordpress Plugin, Ninja Forms) which is a local asset on my site's server.
The popup content for "Book an Appointment" and "Schedule a Chat" are <iframe>s and <script>s that are provided from an outside source (Acuity Scheduling). I'm just embedding their code for the modal popup content. (provided below, but censored for privacy).
I'm not sure if/why this would make the page jump but thought it's worth mentioning because of how these popups are the only ones that make the page jump.
Lastly, I use a Wordpress plugin called "page scroll to id" on the page as well, but I've tried deactivating it and it didn't make any difference, so I think it's safe to say that this plugin isn't affecting this issue.
The HTML for the buttons:
<div id="button-only-div">
<a id="bio_book" class="ask-a-question push_button red" style="text-align: center;" href="#0">Book An Appointment</a><br />
<a id="bio_chat" class="ask-a-question push_button red" style="text-align: center;" href="#0">Schedule A Chat</a><br />
<a id="bio_question" class="ask-a-question push_button red" style="text-align: center;" href="#0">Ask Consuelo A Question</a>
</div>
The code for the Acuity Scheduling embedding:
<iframe src="https://app.acuityscheduling.com/schedule.php?(censored)" width="100%" height="800" frameBorder="0"></iframe> <script src="https://(censored).acuityscheduling.com/js/embed.js" type="text/javascript"></script>
Expected/Desired Result:
No "scroll to top" when modal popup is closed out.
Actual Result:
Some popups cause the page to scroll to top, some don't.
(I've been learning to code for the past year or so now. I love it, but I still have lots to learn! Thanks in advance S.O.!!)
This is a pretty redundant feature! It's not worth your trouble

Need help to go back to Login page when clicked on Logout button

I need help to come to the sign in page once clicking on logout button from any of the inside pages in Meteor.My code is below which does not work,
test.html
<div class="container">
Welcome <span>Deal Manager</span> | <a id="logout" href="#">Logout</a>
</div>
test.js
'click #logout': function() {
history.go("/login");
}
Hey I could try and find out the solution as below
replaced this
history.go("/login");
with
history.go(-2);
As per the pages I have replaced the path with the number.Hope this is a solution for the long run as well.

Selecting a link-button with the DomCrawler

I'm writing functional tests for my Symfony application.
However, i haven't found a way to click on a link button like this one
<a id="update" title ="Edit this folder" name="update" href="{{ path('folder_edit', { 'id': entity.id }) }}">
<button class="button-strong">
Edit
</button>
</a>
I try to click on it this way :
$link = $crawler->selectLink("Edit")->link();
$client->click($link);
I've tried many others ways but without any success.But when I'm running the tests he keeps throwing this exception :
InvalidArgumentException : The current node list is empty
I've looked if there is a way to just click on a button but it seems to be impossible if there is no form linked to it.
Thank you very much.
Firstly, having a <button> inside a <a> is invalid in HTML 5 and may not work as expected.
Coming to the answer, the reason you are getting that error is due to the difference in whitespace. The crawler will not ignore the whitespace and will thus not find a link that has the text EDIT.
HTML
<a id="update" title ="Edit this folder" name="update" href="#">Edit</a>
TEST
$link = $crawler->selectLink('Edit')->link();
$client->click($link);

Setting javascript function for all <a>

I have a lightbox script that Im using:
<a class="lb-image-link" href="images/image-1.jpg" data-lightbox="lb-set">
<img class="lb-image" src="images/thumb-image-1.jpg" width="150" height="150"/></a>
But for my clients sake to use CMS software I need to make the data-lightbox="lb-set" function work for all <a> tag on the page or to make it work as a class somehow if possible.
The page is HTML, how can I make this work? Im guessing I need to create javascript for this. Any help is greatly appreciated, thank you
One way would be to learn some jquery, if you are not already familiar with it
http://jquery.com/
and then you can easily attach a function to all click events on every a tag on the page with something like:
$("a").click(function(event) {
//your lighbox code goes here ...
});
EDIT
With the lightbox2 script you are using it doesn't look like there is a way to assign it to a group of links on your page based on class or tag type, so the above function is not relevant. At a quick glance, if you stick with that script the only way to have it work on multiple links on the same page is to include a unique data-lightbox="" attribute in each link, eg.
image #1
image #2
image #3
There are other lightbox scripts that allow you to set the lightbox based on tag type or class, for instance http://fancyapps.com/fancybox/ allows you to do the following:
<a class="fancybox" rel="group" href="big_image_1.jpg">image #1</a>
<a class="fancybox" rel="group" href="big_image_2.jpg">image #2</a>
and then use the script
<script type="text/javascript">
$(document).ready(function() {
$(".fancybox").fancybox();
});
</script>
the above essentially attaches the fancybox lightbox to anything that has a class="fancybox"
Not sure if that helps - there may not be much difference for you having to add a unique data-lightbox="image-3" to each link as apposed to adding a standard class to them :-)
Glen

How to WelCome control in Webpart code?

I need to place a webpart on the page. The webpart need to change Welcome control title. I need to change "WelCome UserName" to "UserName".
I tried http://www.wictorwilen.se/Post/Having-fun-with-the-SharePoint-Welcomeascx-control.aspx , But it did not worked in Webpart. If anybody have idea to change this control. Please share with me.
That article is a pretty comprehensive walkthrough of one way to do this - perhaps your focus should be to determine where you have gone wrong in the implementation of it?
An alternative (hacky) method would be to put some javscript into the page using a CEWP or modifying the master page that will search for the welcome string and remove it.
Hint - don't search for "Welcome", search for its container which looks a little like this (some attributes stripped out for clarity
<span title="Open Menu">
<div id="zz7_Menu_t" ...
class="ms-SPLink ms-SpLinkButtonInActive" >
<a accesskey="L" id="zz7_Menu" ... href="#" serverclientid="zz7_Menu"
menutokenvalues="MENUCLIENTID=zz7_Menu,
TEMPLATECLIENTID=zz3_ID_PersonalActionMenu">
Welcome UserName
</a>
</div>
</span>
Some links to get you started
http://www.dlocc.com/articles/style-a-page-using-the-content-editor-web-part-and-css/
http://www.cleverworkarounds.com/2008/02/28/more-sharepoint-branding-customisation-using-javascript-part-2/
http://blog.pathtosharepoint.com/2008/08/10/the-content-editor-web-part/

Resources