Page 5 of 6
Re: phpBB issues
Posted: 30 Jul 2019, 03:19
by nnnik
I haven't looked into the phpBB source - does it offer the option to let posters evaluate a BBtag into some meta BBcode?
The result would be BB-Tags the forum could evaluate like normal other BB-Tags.
While quoting or editing the post the posts source should still only display the [/code] tags and not all the rest (really broke a lot in the old forums).
Re: phpBB issues
Posted: 30 Jul 2019, 12:20
by joedf
Not sure about that, but I think I got the lag fixed.
after investigating this in depth, I found that the blocking/lag was caused mostly by the synchronous code I had written in
prism.urls.js.
I've made it completely asynchronous, and it will only parse the ahk code for links when the mouse enters a code tag for the first time for that specific code tag.
Otherwise,
prism.js was running pretty quickly already, I have also set it to defer to allow a smoother loading experience overall.
There might be still a bit of a lag because of how big the topic is, but it should still be a major improvement.
Re: phpBB issues
Posted: 31 Jul 2019, 04:32
by just me
tank wrote: ↑09 Jul 2019, 07:11
so outside me being a smart ass we do have a problem with bots on this site. I have throttled the site if x number of hits in x seconds but am still actively working on the right number for both x's
Any progress on this?
Re: phpBB issues
Posted: 02 Aug 2019, 20:38
by kczx3
FYI I just found this. Might be worth considering once stable and they create an importer for phpBB.
https://flarum.org/
Re: phpBB issues
Posted: 04 Aug 2019, 19:51
by jeeswg
- I went to my function list thread, and noticed it was working really fast.
- I've checked the speed for the 4 links that I mentioned.
- They're all working great apart from the really long base64 string thread.
- Perhaps that one could be given the 'Codebox=text' treatment.
- AFAICS the problem is solved, although maybe there's some other issue causing the base64 thread problem in IE. Thanks.
~1 second (IE)
list of every command/function/variable from across all versions - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=74&t=27321
~who knows (IE) (I'm having real problems with this page, it's making the tab hang)
~instant (Firefox)
~2 seconds (Chrome)
Base64 decode and create file from clipboard - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=64341
~instant (IE)
[Class] eAutocomplete - Custom word completion for (Rich)Edit controls - Page 2 - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=48940&start=20
~3 seconds (IE)
[Editor] Gdip Bitmap Maker - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=62550
Re: phpBB issues
Posted: 06 Aug 2019, 14:23
by joedf
@kczx3 Very cool!
@jeeswg Good to hear
Re: phpBB issues
Posted: 06 Aug 2019, 18:59
by kczx3
joedf wrote: ↑06 Aug 2019, 14:23
@kczx3 Very cool!
@jeeswg Good to hear
Um, since when could we actually mention someone in a post?
Re: phpBB issues
Posted: 07 Aug 2019, 09:40
by joedf
@kczx3
Since early April? I managed to find to the topic finally.
https://www.autohotkey.com/boards/viewtopic.php?p=100225#p100225
TLDR;
jNizM had suggested a plugin, then
Kobaltauge had managed to find a more up to date one. So I installed it, and the story goes from there
Re: phpBB issues
Posted: 08 Aug 2019, 23:43
by TAC109
joedf wrote: ↑30 Jul 2019, 12:20
Not sure about that, but I think I got the lag fixed.
after investigating this in depth, I found that the blocking/lag was caused mostly by the synchronous code I had written in
prism.urls.js.
I've made it completely asynchronous, and it will only parse the ahk code for links when the mouse enters a code tag for the first time for that specific code tag.
Otherwise,
prism.js was running pretty quickly already, I have also set it to defer to allow a smoother loading experience overall.
There might be still a bit of a lag because of how big the topic is, but it should still be a major improvement.
Unfortunately this change has caused AHK documentation lookup in code boxes to stop working on my iPad, which of course uses a touch screen.
Any chance of a fix?
Re: phpBB issues
Posted: 09 Aug 2019, 08:37
by joedf
Yeah I noticed that last night on my iPhone. I think I can fix this pretty easily.
EDIT: I added a 'ontouchstart' event, so tap a code box once to activate links. Also, I just thought of how I could this a lot more efficient. I'll post about it later.
Re: phpBB issues
Posted: 09 Aug 2019, 09:42
by joedf
New/Current version:
https://www.autohotkey.com/boards/assets/prism/prism.urls.js
Now it simply puts one "click" event per code box (instead of an anchor tag for each token) and detects the token type and produces a link that opens in a new tab/window. CSS is used for "link" styling for the tokens.
Code: Select all
// NEW VERSION
// Using global events for target case-by-case detection
// linker to docs for prism.js update
// created 7/01/2019 - updated 09/08/2019
// script by joedf
var redirectQURL = '/docs/redirect.php?topic=';
// add CSS 'link' styling
codelinkstyle = document.createElement('style');
codelinkstyle .innerHTML = "code .selector:hover, code .constant:hover, code .keyword:hover, code .symbol:hover, \
code .tag:hover, code .builtin:hover, code .x_function:hover, code .important:hover, \
code .variable:hover { \
text-decoration:underline !important; \
cursor: pointer; \
}";
document.head.appendChild(codelinkstyle);
// add events for each codebox
var cboxes = document.querySelectorAll('code.language-autohotkey');
for(var i=0;i<cboxes.length;i++) {
cboxes[i].addEventListener('click', function(e){
var citem = e.target;
if (citem.className.indexOf('token') >= 0) {
var type = citem.className.replace('token','').trim().toLowerCase();
var cURL = null;
// supported types: selector, constant, operator, and variable
if (['selector','constant','keyword','symbol','tag'].indexOf(type)>=0) {
cURL = redirectQURL+citem.innerText;
} else if (['builtin','x_function'].indexOf(type)>-1) {
cURL = redirectQURL+citem.innerText+'()';
} else if (type.indexOf('variable')>-1) {
// same as bove normal rediretor usage but remove the % symbols...
cURL = redirectQURL+citem.innerText.replace(/%/gi,'');
} else if (type.indexOf('important')>-1) {
// same as bove normal rediretor usage but remove the # symbols...
cURL = redirectQURL+citem.innerText.replace(/#/gi,'');
} else {
// do nothing? leave as is...
return false;
}
var w = window.open(cURL, '_blank');
w.focus();
return true;
}
});
}
console.log("prism.urls.js executed.");
Old version:
Code: Select all
// ORIGINAL
// with <a>nchor tags on each thing
// linker to docs for prism.js update
// created 7/01/2019 - updated 09/08/2019
// script by joedf
////////////////////////////////////
var redirectQURL = '/docs/redirect.php?topic=';
// get AHK codeboxes
var cboxes = document.querySelectorAll('code.language-autohotkey');
for(var i=0;i<cboxes.length;i++) {
['mouseenter', 'touchstart'].forEach(function(e) {
cboxes[i].addEventListener(e,function(){
if (!this.hasAttribute('highlightedlinks')) {
ctokens = this.querySelectorAll('.token:not(.punctuation):not(.comment)');
this.setAttribute('highlightedlinks','true');
for(var j=0;j<ctokens.length;j++) {
(function(index) {
setTimeout(function(){
var citem = ctokens[index];
var type = citem.className.replace('token','').trim().toLowerCase();
// supported types: selector, constant, operator, and variable
if (['selector','constant','keyword','symbol','tag'].indexOf(type)>-1) {
citem.outerHTML = '<a href="'+redirectQURL+citem.innerHTML+'">'+citem.outerHTML+'</a>';
} else if (['builtin','x_function'].indexOf(type)>-1) {
citem.outerHTML = '<a href="'+redirectQURL+citem.innerHTML+'()">'+citem.outerHTML+'</a>';
} else if (type.indexOf('variable')>-1) {
// same as bove normal rediretor usage but remove the % symbols...
citem.outerHTML = '<a href="'+redirectQURL+citem.innerHTML.replace(/%/gi,'')+'">'+citem.outerHTML+'</a>';
} else if (type.indexOf('important')>-1) {
// same as bove normal rediretor usage but remove the # symbols...
citem.outerHTML = '<a href="'+redirectQURL+citem.innerHTML.replace(/#/gi,'')+'">'+citem.outerHTML+'</a>';
} else {
// do nothing? leave as is...
}
},1);
})(j);
}
}
});
});
}
/* force the underlined link style */
codelinkstyle = document.createElement('style');
codelinkstyle .innerHTML = "code a:hover{text-decoration:underline !important;}";
document.head.appendChild(codelinkstyle);
console.log("prism.urls.js executed.");
Re: phpBB issues
Posted: 09 Aug 2019, 10:53
by joedf
Also, I've just added a download feature to codeboxes with a filename defined.
My brain works so much better when I go to bed early (ish)
For future reference:
https://www.autohotkey.com/boards/assets/javascript/core.js
Code: Select all
// joedf: add download for codeboxes
// should work for IE11, Chrome v1+, FF36+
function download_code_init(){
var boxes = document.getElementsByTagName('code');
for (var i = 0; i < boxes.length; i++) {
if (boxes[i].parentNode.parentNode.getAttribute('data-filename') != null) {
var filename = boxes[i].parentNode.parentNode.getAttribute('data-filename').trim().replace(/[<>:"\/\\\|\?\'\*]/g,'_');
var tagP = (boxes[i].parentNode.tagName.toLowerCase() == 'pre' ? boxes[i].parentNode.previousSibling : boxes[i].previousSibling);
tagP.innerHTML += ' - <a href="#" title="download '+filename+'" onclick="downloadCode(this); return false;">Download</a>';
}
}
}
// joedf: modified from https://stackoverflow.com/a/33542499/883015
window.downloadCode = function(e) {
// get Filename (regex ensures valid and safe name) and Data
var filename = e.parentNode.parentNode.getAttribute('data-filename').trim().replace(/[<>:"\/\\\|\?\'\*]/g,'_');
var data = e.parentNode.parentNode.getElementsByTagName('code')[0].innerText;
var blob = new Blob([data], {type: 'text/plain'});
if(window.navigator.msSaveOrOpenBlob) {
window.navigator.msSaveBlob(blob, filename);
} else {
var elem = window.document.createElement('a');
elem.href = window.URL.createObjectURL(blob);
elem.download = filename;
document.body.appendChild(elem);
elem.click();
document.body.removeChild(elem);
}
}
download_code_init();
EDIT: update, added filename in the tooltip-title for download link
Re: phpBB issues
Posted: 11 Aug 2019, 17:26
by TAC109
joedf wrote: ↑09 Aug 2019, 08:37
Yeah I noticed that last night on my iPhone. I think I can fix this pretty easily.
EDIT: I added a 'ontouchstart' event, so tap a code box once to activate links. Also, I just thought of how I could this a lot more efficient. I'll post about it later.
Does this work for you now? I’m still having no joy. Is this solution deployed across all themes? I use prosilver.
Re: phpBB issues
Posted: 12 Aug 2019, 12:25
by joedf
I just tested with an iPad and iPhone 5s, a desktop, and laptop, FF and Chrome.
Re: phpBB issues
Posted: 13 Aug 2019, 22:01
by TAC109
joedf wrote: ↑12 Aug 2019, 12:25
I just tested with an iPad and iPhone 5s, a desktop, and laptop, FF and Chrome.
It seems to be working now,
Re: phpBB issues
Posted: 14 Aug 2019, 00:45
by joedf
Great! Could be just a CDN or local cache refresh issue
Re: phpBB issues
Posted: 26 Aug 2019, 08:07
by jNizM
tank wrote: ↑09 Jul 2019, 07:11
so outside me being a smart ass we do have a problem with bots on this site. I have throttled the site if x number of hits in x seconds but am still actively working on the right number for both x's
This is still horrible as long time & multiple tabs user
Re: phpBB issues
Posted: 27 Aug 2019, 22:39
by joedf
ditto +1, but it's not too bad... I just let them load in the background... :/
Re: phpBB issues
Posted: 15 Feb 2020, 09:45
by just me
Hi there, still no solution.
I'm 'punished' at almost every visit at the forums, sometimes several times a day. Do you really think you need that 'punishment' for registered users? What about purchasing professional support to solve such problems? I'm willing to pay a share of the costs.
Re: phpBB issues
Posted: 15 Feb 2020, 09:51
by just me
Related:
tank wrote: ↑09 Jul 2019, 07:11
so outside me being a smart ass we do have a problem with bots on this site. I have throttled the site if x number of hits in x seconds but am still actively working on the right number for both x's