[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: use a gambas web cgi in a phpBB forum
[Thread Prev] | [Thread Next]
- Subject: Re: use a gambas web cgi in a phpBB forum
- From: Bruce Steers <bsteers4@xxxxxxxxx>
- Date: Fri, 5 Dec 2025 17:39:39 +0000
- To: user@xxxxxxxxxxxxxxxxxxxxxx
On Thu, 4 Dec 2025 at 19:40, Lee <t.lee.davidson@xxxxxxxxx> wrote:
> On 12/4/25 10:41 AM, Bruce Steers wrote:
> > if found this little beauty...
> > var e = a.parentNode.parentNode.getElementsByTagName('CODE')[0];
> > a is passed in the onclick handler as "this" like so...
> > <a href="#" style="color:green" onclick="runCode(this); return
> false;">💻 Run code</a>
> >
> > That gets the correct code box then e.innerText has the code with line
> breaks and no html.
>
> Yes, I'm still interested to learn how the code highlighting issue might
> be solved. And, I still don't understand how you solved
> it, because getting a handle on the current element ("this") requires user
> interaction, ie. the "onClick" event. I see how that
> would work for executing the code, but not how it would work for
> highlighting it on page load.
>
> Anyway, in post #66 in that thread, you said, "Anyone got experience in
> getting a website server certified?"
> You don't need to get the website server certified. All you need to do is
> install a SSL certificate. Then, set your server to
> also use port 443 perhaps in a virtual host depending on the server
> software. For the certificate, you might want to take a look
> at https://letsencrypt.org/.
>
>
> --
> Lee
cheers Lee, i aded a 443 Virtualhost to my server now :)
also i found a nice hack for the highlighting.
the gambas code boxes have a "gambas" class so i used this code to get all
gambas classes and ensure they are code blocks.....
<script>
window.onload = function() {
var gbcode = document.getElementsByClassName('gambas');
for(var i = 0; i < gbcode.length; i++) {
var ele = gbcode[i];
if (ele.tagName == "CODE" ) { makeGB(ele); };
};
};
async function makeGB(codebox) {
var txt = codebox.innerHTML.replace(/<br>/g, "");
txt = txt.replace(/\r\n/g, "\n");
const url = "
https://138.68.116.47/cgi-bin/GambasRun.gambas?mode=gambas&Code=" +
encodeURI(txt);
try {
const response = await fetch(url);
if (!response.ok) {throw new Error(`Response status:
${response.status}`);}
const result = await response.text();
codebox.style.backgroundColor = "#FFFFFE";
codebox.innerHTML = (result);
}
catch (error) { console.error(error.message);}
}
</script>
I have added that to the
phpBB/styles/<stylename>/template/overall_footer.html just before the
</body> tag.
on all styles.
I just need to figure out how to stop the default highlighter trying to
highlight it as it just gets re-written after.
Respects
BruceS
| Re: use a gambas web cgi in a phpBB forum | Lee <t.lee.davidson@xxxxxxxxx> |
| Re: use a gambas web cgi in a phpBB forum | Bruce Steers <bsteers4@xxxxxxxxx> |
| Re: use a gambas web cgi in a phpBB forum | Lee <t.lee.davidson@xxxxxxxxx> |