I am editing a javascript file for the first time and was wondering if someone could help point me in the right direction.
h&&""!=g&&(k+='<strong>Get Directions:</strong> '+g+"<br>"),
The code above is just a snippet from a larger file but is what I am trying to edit. I have added 'Get Directions' but now I want to remove the URL being shown in the middle of the link so that it reads "Click Here".
The +g+ is outputting an office URL.
I am unsure of how to edit the line as everything I do breaks the module.
E.g. example that does not work....
h&&""!=g&&(k+='<strong>Get Directions:</strong> 'Click Here"<br>"),
It's confusing because you are using ' and " on the same line to enclose strings. The "Click Here" text should be inside the string like this:
Click Here<br>')
Does this work?
h&&""!=g&&(k+='<strong>Get Directions:</strong> Click here<br>'),
Related
In my Js script i tried escaping,setting string to another complete variable and everything i can think of doing.
But cant figure out why the "/ "character in the background-image:url("../") is giving me such a hard time.
Here is a piece of code from my Js script.
let image = "../../" + value.image;
receptenMarkup += '<div class="receptImage" style="background-image:url("../../'+ value.image +'");" alt="test"></div><img src="'+ image + '">';
"../../'+ value.image +'" comes back correctly in the console.log as the path.
Image comes back as the correct path.
Example:
../../images/recepten/thai-chicken.jpg
My console.log of the entire markup also shows a correct path.
<div class="receptImage" style="background-image:url("../../images/recepten/noodle- soup.jpg");" alt="test">
but!! here is the Result in the inspector..
RESULT INSPECTOR:
<div class="receptImage" style="background-image:url(" ..="" images="" recepten="" noodle-soup.jpg");"="" alt="test"></div><img src="../../images/recepten/noodle-soup.jpg">
Notice the image url works great and fine!
The CSS part on the other hand gets all sorts of crazy.
I cant get this to work properly and point the background image to the right path.
I collect a lot of Json data and make cards based on that.
the background image needs to be in a div so i can style it in RWD and not deform like an image tag does.
Somehow i cant get this to work.
Can anyone please give me pointers?
I tried
1: using ../../ to escape ../../ to escape
2: using just "/'value.image'" to go to the root of the website as W3 suggests, no go.
I bee at this for hours now and my deadline is approaching..
Please can anyone explain why the / becomes a space and i get stuff like image=.. in there which i didnt even type that wat.
URL and IMG react differently.
The problem isn't the /, it's the mismatched quote characters delimiting the strings and attribute values.
The simple fix for this is to use a template literal:
receptenMarkup += `<div class="receptImage" style="background-image: url('../../${value.image}');" alt="test"></div><img src="${image}">`;
Side note; I would suggest making all paths relative to the site root, not relative to the current page.
I'm using jspdf library for generating PDF file from html. It is really nice one. But I have an issue with last line on each page of the pdf.
Here is a DEMO and my javascript:
var pdf = new jsPDF();
$('#generatePdfBtn').click(function () {
pdf.fromHTML($('#printableContent').html(), 15, 15, {
'width': 400
});
pdf.save('myPdf.pdf');
});
When you generate a pdf by clicking on a button, you will see that at the end of the first page we have "pararaph 30" and normally on next page of pdf we should see next "pararaph 31" paragraph. But I don't see it and instead see "pararaph 32". Why last line is being lost? Any ideas please?
Try this:
Open your jspdf.js or jspdf.debug.js local file and modify this:
this.pdf.internal.getVerticalCoordinateString(this.y), style.color, "Td");
Erasing style.color and save as:
this.pdf.internal.getVerticalCoordinateString(this.y), "Td");
Then it runs correctly on firefox and chrome. At least that worked for me and this is a solution until they fix that failure.
Well there is a trick, If you can determine, where you need to put the page break, then you can simply place a "" there to force it. In this way you can avoid the text from being chopped off.
Working DEMO: http://jsfiddle.net/nq361uoz/4/
Unfortunately, this is a known bug in jsPDF which is still in open status in the GitHub repository.
More info here: https://github.com/MrRio/jsPDF/issues/555
Hope this helps!
My guess it cut's the line as it is written not within the margins. Most simple way is to make a loop, that every 31th row is duplicated. Not the best solution, but the quickest.
I currently have a PHP preg_match and cURL script that gets the content of a specific line and displays it.
http://cdadownloader.cf is the link. If you will paste in the form e.g 5640653 it will scrape the content of http://www.cda.pl/video/5640653, then the preg_match
preg_match_all("~^\s*file\s*:\s*'(.*?)',?\s*$~m", $source_code, $file);
will look inside the script tags for a line called " file "
file: 'http://vgra012.cda.pl/13495603584734.flv?st=s5O2O-YWjbPgOLS3GLGHGg&e=1453683496',
and will get is contents in this case
http://vgra009.cda.pl/13495603584734.flv?st=Vu78-g3noIN23uy_9-mKZQ&e=1453683460
by using
substr($file[0][0], 23,-2)
the URL is displayed and used.
Everything works fine ( download buttons does not work as i still have a problem with headers so only works with right click to save )
now they have added a premium player that uses a variable to store the url and i have no idea how to get its contents
$f().setClip('http://vrbx098.cda.pl/vl73f1740f66221a2168a374b86409140d.mp4?st=D-wuSToxZfD4e4UGaXw4qg&e=1453679326');
Would someone be able to point me in the right direction without unnecessary comments ? :) Thanks in Advance
Okay, I think I understand what you are wanting. Here is something for you to try:
preg_match("~setClip\('(.*?)'~", $page_contents, $setclip_match);
$setclip_url = $setclip_match[1];
I'm trying to align the text in the menu at:
http://crango.uofydating.com/dir/New2.html
In the 1st tab, I want there to be a line break after "Item".
In the 2nd and 3rd tab, I want there to be a line break after "This is".
I only posted the part of the menu that I need help with, so it may look a bit odd. But it is connected to some Javascript code which makes it more challenging to edit. The JS can't be removed.
Here is your solution
I have created a fiddle for you
Use .html() instead of .text()
CODE:
.html('<strong>' + $(this).find('a').html() + '</strong>')
It works great ;)
Check it
Fiddle http://jsfiddle.net/krunalp1993/yL6Tn/1/
Hope this helps you :)
In your js code, you are setting back to your original text inside strong tags with .html inside the .click method. So just insert the line break in there.
Insert break in this line in your js:
.html('<strong>' + $(this).text() + '</strong>')
So eventually I want to have a greasemonkey script but for now I have only been working with firebug to test out my html/javascript.
I have this code to insert one button in the HTML toolbar for blogger.
The button is supposed to replace all the with " " as blogger seems to just randomly add into my blogs posts and can cause the published article to look weird (a bunch of words separated in between with s will not want to break in the middle unlike the same words separated with " ").
document.getElementById("postingHtmlToolbar").firstChild.innerHTML += '<div id="SP" class="goog-inline-block goog-toolbar-button" title="SP" role="button" style="-moz-user-select: none;"><div class="goog-inline-block goog-toolbar-button-outer-box"><div class="goog-inline-block goog-toolbar-button-inner-box"><b>SP</b></div></div></div>';
Which trimming away the formatting just leaves us with.
<b>SP</b>
The funny thing is that that same code (minus the href, javascript: stuff) run from firebug works perfectly.
But when it is inserted like this and run it blanks the entire web page and writes the value of document.getElementById('postingHtmlBox').value.replace(/ /g, ' ') into this black page.
Am I forgetting something stupid? Is this supposed to happen? Do I have some stupid syntax error? What would you suggest as a solution?
Don't put JS code in href. use onclick:
<b>SP</b>
Try adding void(0); to the end of the href.
Basically, the output of the last statement (if any) is replacing the document (i've had the same problem), so making the last statement one with no output will avoid the problem