Trying to set a copy to clipboard link in blogger blog1 widget - clipboard

Im trying to configure a copy link to clipboard in my home page in blogger for each different article (data:post.url), at the end of other links to social webs, but I've not luck with the sintaxis.
This is what I would like to obtain:
<a href='javascript:getlink("https://www.venalacocina.com");'>
And this is the code what I'm trying to write to obtain those result
<a class='copi' expr:href='"javascript:getlink(\""+ data:post.url + "\");' id='btnCopiar'>
I'm lost with the appropriate use of " and " ¿how many and where should I use them to set the correct code?
¿Would someone give me the correct code correctly written?
thanks a lot in advance

In the end I did it; it was just a question of time.
I just changed and simplified the expression calling directly getlink() function and this is the result working perfectly for me:
<a class='copi' expr:onclick='"getlink(&apos;"+ data:post.url + "&apos;);"' id='btnCopiar'>

Related

How to interpolate ruby language in a link to path

I would like to insert the type of my object in my link to. this one is not always the same so I don't want to write it in real letter.
I would like to write something like :
link to "my mission", edit_+ mission.type.downcase + _path(mission)
I don't even know if its possible.
Thanks for your help
You can use instance_eval like:
link_to "my mission", instance_eval("edit_#{mission.type.downcase}_path(mission)")
You might a regular html tag a little easier:
<a href='<%= edit_+ mission.type.downcase + _path(mission)%>'>
mission_path
</a>

How to use substring() with Import.io?

I'm having some issues with XPath and import.io and I hope you'll be able to help me. :)
The html code:
<a href="page.php?var=12345">
For the moment, I manage to extract the content of the href ( page.php?var=12345 ) with this:
./td[3]/a[1]/#href
Though, I would like to just collect: 12345
substring might be the solution but it does not seem to work on import.io as I use it...
substring(./td[3]/a[1]/#href,13)
Any ideas of what the problem is?
Thank's a lot in advance!
Try using this for the xpath: (Have the field selected as Text)
.//*[#class='oeil']/a/#href
Then use this for your regex:
([^=]*)$
This will get you the ISBN number you are looking for.
import.io only support functions in XPath when they return a node list
Your path expression is fine, but perhaps it should be
substring(./td[3]/a[1]/#href,14)
"Does not seem to work" is not a very clear description of what is wrong. Do you get error messages? Is the output wrong? Do you have any code surrounding the path expression you could show?
You can use substring, but using substring-after() would be even better.
substring-after(/a/#href,'=')
assuming as input the tiny snippet you have shown:
<a href="page.php?var=12345"/>
will select
12345
and taking into account the structure of your input
substring-after(./td[3]/a[1]/#href,'=')
A leading . in a path expression selects only immediate child td nodes of the current context node. I trust you know what you are doing.

Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS) (CWE ID 80)

My Project Client wants all the application to be Veracode Compliant....After giving it for Veracode Staic Scan found that there are 326 flaws which are needed to be fixed as a part of Cross Site Scripting Error.
The application for which Scan was given is basically built using ASP Classic (VBScript).
some of the lines reported are:
<td <%=feltfarve%> nowrap><%=tabeltekst_start%><%=rsDBox("filnavn")%><%=tabeltekst_slut%></td>
<a onmouseover="EnterContent('ToolTip','<%=f(33)%>','<% if sagerRS("dkrerefnr") <> "" then Response.Write (replace(f(34),"%1", sagerRS("dkrerefnr"))) else Response.Write(replace(f(34),"%1", f(35))) end if%>'); Activate();" onmouseout="deActivate()" href="javascript:void(0)"><img src="/secure/images/rolloverknap/gray_e.gif" border="0" WIDTH="12" HEIGHT="12"></a>
Response.Write " <a onmouseover=""EnterContent('ToolTip','"& f(36) &"','" & kretxt & "'); Activate();"" onmouseout=""deActivate()"" href=""javascript:void(0)""><img src=""/secure/images/rolloverknap/gray_i.gif"" border=""0"" WIDTH=""12"" HEIGHT=""12""></a> "
What type of fix can be applied to solve these Cross Scripting Flaws??
Looking at your code there are several variables that could create problems. I'm not exactly sure how Veracode checks for problems, but if any of these variables come from a user supplied value, they pose a risk.
First the basics, if you allow > and < in any variable, especially combined with allowing " and ', everything is a thread. They can insert pretty much anything.
In your case allowing " and ' is enough to create problems, because a lot of variables are already inserted inside Javascript code like onmouseover and onmouseout
Besides that feltfarve could always cause a problem, even if you don't allow these charactors.
feltfarve in <td <%=feltfarve%> nowrap> is inside a tag without qoutes or anything. If somebody could modify the value to onmouseover=doBadStuff() your in trouble. If they combine it with style they could even make it full screen, so almost anybody would hover it.
Keep in mind that if you directly insert values from your database, what %=rsDBox("filid")%> is doing I think, then you must be 100% sure that you properly check them on insert.
Since DB best practise is to insert data as provided (not encoded), you should always check these values before you put them in your HTML.
I think we should use Server.HTMLEncode to fix XSS (cross site scripting) threat.

VBScript Syntax Highlighting in Web Page

Single Code Comment for Visual Basic Script (VBScript) seems to be not working , i am using
Google-code-prettify
https://code.google.com/p/google-code-prettify/
For more details please see this fiddle :
http://jsfiddle.net/dekajp/27skU/1/
<div>
<pre class="prettyprint lang-vb">
' Variable Declaration
Dim szToken
Dim oXMLHTTP
Dim szBaseUri, szUri
szToken ="Please see Logon code example for how to obtain a Token"
' set the base URI path
</pre>
</div>
Looks like the single quote comment is not working or am i missing something ?
I'm not familiar with the tool. I am familiar with VB and VB.net you're using but see if this syntax works better for you. AHH... also... you can't use ' unless you're using straight VB programming. You must exit your ' with an addition ' at the end. Looking at Fiddle... all your Declarations and szToken were all highlighted as comments.
<div>
<pre class="prettyprint lang-vb">
<!--Variable Declaration-->
Dim szToken as String
Dim oXMLHTTP
Dim szBaseUri, szUri
szToken.text = ("Please see Logon code example for how to obtain a Token")
<!--set the base URI path-->
</pre>
</div>
I have similar situation. I removed run-prettify.js script and added prettify.js + lang-vb.js, and it helped. It's still not perfect, so I'm figuring out how to modify it, but. Comments are working great.

page name, or argumentless URL string in smarty?

I have a search form, and I want to create a "Start Over" link that just returns users to the page without any arguments. What Smarty code can I use? For example, if they are at http://website.com/search.php?value1=x&value2=y, I want to get http://website.com/search.php or just search.php, so I can construct <a href='{$string}'>Start Over</a>.
I would just fill a variable in your php that you send to smarty? you could get that in smarty I guess, but that's not really a good way. just do something like this:
$yourSmartyVar->assign("string",$_SERVER[’PHP_SELF’])
That should give you the scriptname without querystring if I remember correctly. If it doesn't you could use $_SERVER[’SCRIPT_NAME’] if that suits you better, or even use http://php.net/manual/en/function.parse-url.php

Resources