Forum > Beginners

[SOLVED] Struggling to use InternetTools.

(1/3) > >>

JR2Media:
I'm attempting to use InternetTools (https://www.benibela.de/documentation/internettools/). I have cloned the latest source from the Github repo.

I've tried running the one liner:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---uses xquery;writeln(query('doc("http://example.org")//title').toString)
In my fpc.cfg I have the following:


--- Code: Text  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ----FuC:/Users/JR2/Projects/Pascal/lib/internettools/data/-FuC:/Users/JR2/Projects/Pascal/lib/internettools/internet/-FuC:/Users/JR2/Projects/Pascal/lib/internettools/system/
When I run the code I get the following error:


--- Code: Bash  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---fpc -Sg .\GoogleScraper.pasxquery.internals.common.pas(749,35) Error: Illegal expressionxquery.internals.common.pas(749,37) Error: Illegal expressionxquery.internals.common.pas(749,37) Fatal: Syntax error, ";" expected but "ordinal const" foundFatal: Compilation aborted
Is this an issue with the library and if so where is this error happening as I can't find it in the source.

Thanks all.

dsiders:

--- Quote from: JR2Media on April 29, 2021, 06:09:18 pm ---I'm attempting to use InternetTools (https://www.benibela.de/documentation/internettools/). I have cloned the latest source from the Github repo.

...

When I run the code I get the following error:


--- Code: Bash  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---fpc -Sg .\GoogleScraper.pasxquery.internals.common.pas(749,35) Error: Illegal expressionxquery.internals.common.pas(749,37) Error: Illegal expressionxquery.internals.common.pas(749,37) Fatal: Syntax error, ";" expected but "ordinal const" foundFatal: Compilation aborted
Is this an issue with the library and if so where is this error happening as I can't find it in the source.

--- End quote ---

Not sure why you can't find it in source...

The problems is:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---function xqround(const f: xqfloat): Int64;var tempf: xqfloat;begin  tempf := f + 0.5;  result := trunc(tempf);  if frac(tempf) < 0 then result -= 1;end; 
The library is assuming that $COPERATORS is ON and that is not the default for FPC. https://www.freepascal.org/docs-html/prog/progsu10.html.

lucamar:
@dsiders: Nitpicking, I know, but for clarity's sake to highlight a line of code (the 6th in this case) in the forum you should write:
    [code=pascal,6]
rather than use color tags:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---function xqround(const f: xqfloat): Int64;var tempf: xqfloat;begin  tempf := f + 0.5;  result := trunc(tempf);  if frac(tempf) < 0 then result -= 1;end;

dsiders:

--- Quote from: lucamar on April 29, 2021, 06:44:27 pm ---@dsiders: Nitpicking, I know, but for clarity's sake to highlight a line of code (the 6th in this case) in the forum you should write:
    [code=pascal,6]
rather than use color tags:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---function xqround(const f: xqfloat): Int64;var tempf: xqfloat;begin  tempf := f + 0.5;  result := trunc(tempf);  if frac(tempf) < 0 then result -= 1;end;
--- End quote ---

Thanks @lucamar. I was not aware of that usage.

JR2Media:
Thank you! Now getting an error that FLRE cannot be found. I've got the source, just figuring out how to add it. Adding it via the Project Inspector doesn't seem to work as I still get the error after adding it.

I'll figure it out. I hope.

Navigation

[0] Message Index

[#] Next page

Go to full version