phpBB issues

Post a reply


In an effort to prevent automatic submissions, we require that you complete the following challenge.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :| :mrgreen: :geek: :ugeek: :arrow: :angel: :clap: :crazy: :eh: :lolno: :problem: :shh: :shifty: :sick: :silent: :think: :thumbup: :thumbdown: :salute: :wave: :wtf: :yawn: :facepalm: :bravo: :dance: :beard: :morebeard: :xmas: :HeHe: :trollface: :cookie: :rainbow: :monkeysee: :monkeysay: :happybday: :headwall: :offtopic: :superhappy: :terms: :beer:
View more smilies

BBCode is ON
[img] is OFF
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: phpBB issues

Re: phpBB issues

Post by joedf » 27 Aug 2019, 22:39

ditto +1, but it's not too bad... I just let them load in the background... :/

Re: phpBB issues

Post by jNizM » 26 Aug 2019, 08:07

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

Post by joedf » 14 Aug 2019, 00:45

Great! Could be just a CDN or local cache refresh issue :+1:

Re: phpBB issues

Post by TAC109 » 13 Aug 2019, 22:01

joedf wrote:
12 Aug 2019, 12:25
I just tested with an iPad and iPhone 5s, a desktop, and laptop, FF and Chrome. :think:
It seems to be working now, :D

Re: phpBB issues

Post by joedf » 12 Aug 2019, 12:25

I just tested with an iPad and iPhone 5s, a desktop, and laptop, FF and Chrome. :think:

Re: phpBB issues

Post by TAC109 » 11 Aug 2019, 17:26

joedf wrote:
09 Aug 2019, 08:37
Yeah I noticed that last night on my iPhone. I think I can fix this pretty easily. :+1:
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. :think:
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

Post by joedf » 09 Aug 2019, 10:53

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) :D

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

Post by joedf » 09 Aug 2019, 09:42

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

Post by joedf » 09 Aug 2019, 08:37

Yeah I noticed that last night on my iPhone. I think I can fix this pretty easily. :+1:
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. :think:

Re: phpBB issues

Post by TAC109 » 08 Aug 2019, 23:43

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. :+1:
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

Post by joedf » 07 Aug 2019, 09:40

@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 :+1:

Re: phpBB issues

Post by kczx3 » 06 Aug 2019, 18:59

joedf wrote:
06 Aug 2019, 14:23
@kczx3 Very cool! :+1:
@jeeswg Good to hear :crazy:
Um, since when could we actually mention someone in a post?

Re: phpBB issues

Post by joedf » 06 Aug 2019, 14:23

@kczx3 Very cool! :+1:
@jeeswg Good to hear :crazy:

Re: phpBB issues

Post by jeeswg » 04 Aug 2019, 19:51

- 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

Post by kczx3 » 02 Aug 2019, 20:38

FYI I just found this. Might be worth considering once stable and they create an importer for phpBB.

https://flarum.org/

Re: phpBB issues

Post by just me » 31 Jul 2019, 04:32

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

Post by joedf » 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. :+1:

Re: phpBB issues

Post by nnnik » 30 Jul 2019, 03:19

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

Post by nnnik » 30 Jul 2019, 00:40

Visiting that page with a phone is an interesting experience.

Re: phpBB issues

Post by joedf » 29 Jul 2019, 20:32

I'll look into it again. I think prismjs offers some kind of async function or parallel parsing. Maybe I can make it somewhat smoother. :think:
Naturally, the better solution would be to have serverside parsing but that is out of the question, at least for now... :/

Top