Twitter Direct Message Link - Convert <button> into <a> - javascript

If you log into twitter, and Direct Message is enabled, you'll see a "Send Message" button appear. I desire that URL. How do I get the URL for sending a specific user a DM? I dug into the code, and this is what we have. Thoughts?
Thanks in advance for your attention buddy.
This is what the button looks like:
Here is the (trimmed) code if you (R) Click > Inspect
`<button type="button" data-name="XYZABCTwitterName" data-screen-name="xyzabctwittername" data-user-id="4203234760" data-original-title="Send a Direct Message to XYZABCTwitterName">
<span>
<span>Message</span>
</span>
</button>`

There is a setup flow here that walks you through it
https://publish.twitter.com/
It generates the a HTML link and script tag to activate it.
Message #realDonaldTrump<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>

Related

How To make it so when you click an html button, it downloads a file to the persons computer?

<button type="submit" class="myButton" onclick="window.open('test.txt')">Money Dispenser</button>
Is the current code i have, and does not do anything at all when i click it. ( I want it to download test.txt to the computer or device of the user who cliked it)
I don't really understand what you are trying to achieve using a submit button, if it's not mandatory I'd use an <a>.
With pure HTML5 using the download attribute
<a href="test.txt" download>Money Dispenser</a>
Or with Javascript if you have to use a <button>
This has already been covered grealy in this question
But the gist of it is, create a function to download files as shown on that thread and add it to your <button>
<button onclick="donwloaURI('data:text/plain,Test', 'Test.txt')">Money Dispenser</button>
You can use the HTML download attribute to specify that the target will be downloaded when a user clicks on the hyperlink.
<a href="/download-file-path-here" download>
Money Dispenser
</a>
You can do using:
<a href="data:text/plain;charset=UTF-8,test.txt" download>Download</a>

Pass or append the value from input text to <a href="sms?:body=">

I'm trying to look for a how I can pass the value from in input textbox *href="sms:?body" It is a dynamic value that changes every time a user creates a new account. The idea is that once I click on the "Send Invite by SMS" the value or referral code that is included in the input text will also be included in the SMS body message.
Sample work in progress
<input class="input" disabled="true" placeholder="Referral Code" ng-model="account.referral_code_string" id="input-refcode">
<a ng-model="account.referral_code_string" href="sms:?body=" class="sms-btn" >Send Invite by SMS</a>
Update
I have managed to bind the input text on the sms anchor but when I try tap on the button the SMS app doesn't open up. It shows unsafe:sms but when I try using only href with a sample text(href="sms:?body=text") it opens up the SMS app
You can use ngHref to append it to your link.
<a ng-href="sms?:body={{account.referral_code_string}}" class="sms-btn">Send Invite by SMS</a>
See: https://docs.angularjs.org/api/ng/directive/ngHref
Working Example: http://plnkr.co/edit/3z145H?p=preview

Clicking a JavaScript link on website

I am trying through VBA to generate automatically a report from my bank's website.
I managed to reach the website and plug in my user id and password without any problem. I've reached the page where I can normally generate the report.
Now I have to simulate a click on the link... But I can't manage to do it.
Here is a screenshot of the website, with the HTML code of the link I have to click on to generate the report (Summary Report Copy).
Here is the HTML code of the link I need to click on:
<a id="irCustomStepOne:headerDataTableId:23:reportnamestatus" href="#" style="float:left;" title="Summary Report Copy" onclick="jsf.util.chain(this,event,'if(isDateValidForMassPayPD()==\'false\' & isWareHouseRptPD(\'23\') ==\'true\'){RichFaces.$(\'irCustomStepOne:panelWareHouseRptError\').show(event, {\'top\':\'100px\', \'left\':\'300px\'});return false;}else{if(!onReportLink(\'23\')) return false;}','mojarra.jsfcljs(document.getElementById(\'irCustomStepOne\'),{\'irCustomStepOne:headerDataTableId:23:reportnamestatus\':\'irCustomStepOne:headerDataTableId:23:reportnamestatus\',\'repId\':\'3368127\',\'dayTypeKey\':\'PREVIOUS_DAY\',\'userAction\':\'Run\'},\'_blank\')');return false" class="">Summary Report Copy</a>
I've tried this line of VBA code, but doesn't work:
IE.Document.getElementById("irCustomStepOne:headerDataTableId:23:reportnamestatus").FireEvent "onclick"
How can I click on this "Summary Report Copy" thanks to VBA?
Here is the complete HTML code of the part of the webpage where the link is located. Maybe I am not using the right ID?
<td width="290px">
<span id="irCustomStepOne:headerDataTableId:23:reportNmGrp">
<a id="irCustomStepOne:headerDataTableId:23:reportnamestatus" href="#" style="float:left;" title="Summary Report Copy" onclick="jsf.util.chain(this,event,'if(isDateValidForMassPayPD()==\'false\' & isWareHouseRptPD(\'23\') ==\'true\'){RichFaces.$(\'irCustomStepOne:panelWareHouseRptError\').show(event, {\'top\':\'100px\', \'left\':\'300px\'});return false;}else{if(!onReportLink(\'23\')) return false;}','mojarra.jsfcljs(document.getElementById(\'irCustomStepOne\'),{\'irCustomStepOne:headerDataTableId:23:reportnamestatus\':\'irCustomStepOne:headerDataTableId:23:reportnamestatus\',\'repId\':\'3368127\',\'dayTypeKey\':\'PREVIOUS_DAY\',\'userAction\':\'Run\'},\'_blank\')');return false">Summary Report Copy</a>
<a id="irCustomStepOne:headerDataTableId:23:reportnamePrint" href="#" style="float:left;display:none;" title="Summary Report Copy" onclick="jsf.util.chain(this,event,'if (!onReportLink(\'23\')) return false;','mojarra.jsfcljs(document.getElementById(\'irCustomStepOne\'),{\'irCustomStepOne:headerDataTableId:23:reportnamePrint\':\'irCustomStepOne:headerDataTableId:23:reportnamePrint\',\'repId\':\'3368127\',\'dayTypeKey\':\'PREVIOUS_DAY\',\'userAction\':\'Print\'},\'_blank\')');return false">Summary Report Copy</a>
<span id="irCustomStepOne:headerDataTableId:23:rpId" style="float:left;display:none;">3368127</span>
</span>
</td>
This always worked for me. Try it please:
For each lnk in IE.Document.getElementByTagName("a")
If lnk.ID = "irCustomStepOne:headerDataTableId:23:reportnamestat‌​us" Then
lnk.Click
Exit For
Next
You might have to wait for the page to be fully loaded. Something like
Do: VBA.DoEvents: Loop While IE.Busy ' wait for the page to load
Dim el 'As IHTMLElement
Set el = IE.Document.getElementById("irCustomStepOne:headerDataTableId:23:reportnamestat‌​us")
If el Is Nothing Then el = IE.Document.querySelector("a[title='Summary Report Copy']")
If el Is Nothing Then MsgBox("Link not found!") : Exit Sub
el.click
Do: VBA.DoEvents: Loop While IE.Busy ' wait for next page to load

Adding stripe button to the pricing table

I'm using marketers delight 3 wp child theme, their pricing tables. I want to replace the standard "order now" button with the stripe script button. I can only put URL's in that field. What can I do in this case?
Here is the stripe script itself:
<form action="/charge" method="POST">
<script
src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="xxx"
data-image="/square-image.png"
data-name="xxxx"
data-name="Silver Package"
data-label="Buy the Silver Package - $29.99"
data-description="Silver Package ($29.99)"
data-amount="2999">
</script>
</form>
How can I add this button to the pricing table if that Order Now field can be filled only with an URL?
Edit the theme. Open up the template for that specific part, remove or comment the button with php so it does not show up in devtools and place this stripe code.
Might not be the best approach, pick the one you like the most
Try to inject it into the href field like this:
$injection= ' ">'.$stripe_button_code.' <a style="display:none';
<a href="<?=$injection;?>"> title
Try to put an onclick action on the link that clicks on the stripe
button somewhere on the page
Same as 2 but if you can't use onclick maybe you can use
javascript:function(){ } for the href
Edit the theme file and do it without work arounds [Reccomended]

Scrapy parsing of the hidden information appearing after link click

I try to parse some hidden information:
<a id="showInfoBtn" rel="nofollow" title="SomeTitle" href="some_link/some_hash"
onclick="return showInfo(event)">Info showed here after click</a>
When I manually click to this link, only get request to http://www.google-analytics.com appears at the firebug. And page not reloaded - only info showed as a link text.
How can I get info by scrapy?
I did not understand very well if what you're trying to get is to show some info inside the a tag or in other part of the page. But in any of the cases that will also depend on what does the showInfo() function return.
If the first case is what you need and showInfo() returns the text with the info, i believe this is what you're looking for:
<a id="showInfoBtn" rel="nofollow" title="SomeTitle" href="#" onclick="this.innerHTML=showInfo(event)">
Info showed here after click
</a>
Here's a demo with the example http://jsfiddle.net/P49Dv/ ;)

Categories