-
• #6002
Though it was subtle... it was called implicitly via comments.js as well as explicitly on the page. Sneaky JS developers
Yes! Yes! Yes!
Thank you.
-
• #6003
Thank you.
No worries :)
-
• #6004
Thanks indeed. Check your stats, I suspect the quoting function may make see an uptick in usage.
-
• #6005
And with that ...
Quoting is still broken (#inb4tester)
But srs, glad that bit of it has been fixed
-
• #6006
You think I have stats on this stuff?
-
• #6007
Quoting is still broken
The failure to quote links?
I think I have a solution to that having looked at the code yesterday.
It is doing this:
comments.prototype.getWindowSelectedText = function(){ var selection = window.getSelection(); if (selection && typeof selection.toString == 'function') { return selection.toString().replace(/\n/g, "\n> "); } return false; };
Note the
.toString()
in there.It would be better if it copied the HTML fragment.
Perhaps something along the lines of:
comments.prototype.getWindowSelectedHTML = function(){ var selection = window.getSelection(); if (selection && typeof selection.getRangeAt == 'function') { // Pull a balanced tree HTML fragment from the DOM for the given selection var range = selection.getRangeAt(0); var fragment = range.cloneContents(); // We only want core HTML and link attributes, almost every other attribute // can be jettisoned var walk = function(node,func) { func(node); node = node.firstChild; while(node) { walk(node,func); node = node.nextSibling; } }; var stripAttrs = function(node) { if (node.attributes) { var names = []; for (var i = 0; i < node.attributes.length; i++) { switch (node.attributes[i].name) { case "href": break; case "title": break; case "alt": break; default: name[names.length] = node.attributes[i].name; } } for (var i = 0; i < names.length; i++) { node.removeAttribute(names[i]); } } } walk(fragment, stripAttrs); return fragment; } return false; };
I wrote that blind... I've no idea whether it would work. I'm just guessing. I wish I had a JS developer around.
-
• #6008
Oh. Sorry, no.
Was a /sarc comment about how replies worked much better in the old forum
-
• #6009
That's OK.
I wrote a working version of that idea...
var getWindowSelectedHTML = function() { var selection = window.getSelection(); if (selection && typeof selection.getRangeAt == 'function') { // Pull a balanced tree HTML fragment from the DOM for the given selection var range = selection.getRangeAt(0); var fragment = range.cloneContents(); // We only want core HTML and link attributes, almost every other attribute // can be jettisoned var walk = function(node,f) { f(node); var child = node.firstChild; while(child) { walk(child,f); child = (child.nextSibling) ? child.nextSibling : false; } return node; }; var stripAttrs = function(node) { if (typeof node.hasAttributes == 'function' && node.hasAttributes()) { var names = []; for (var i = 0; i < node.attributes.length; i++) { switch (node.attributes[i].name) { case "href": break; case "title": break; case "alt": break; default: names[names.length] = node.attributes[i].name; } } for (var i = 0; i < names.length; i++) { node.removeAttribute(names[i]); } } } fragment = walk(fragment, stripAttrs); // Now we have a clean fragment we need to get the HTML as text but a // DocumentFragment does not have an innerHTML so we need to attach it to // the DOM and ask that for the innerHTML. var scratch = document.getElementById('scratchpad'); if (scratch) { while (scratch.firstChild) { scratch.removeChild(scratch.firstChild); } } else { scratch = document.createElement("div"); scratch.id = "scratchpad"; scratch.style = "display: none;"; scratch.hidden = true; document.body.appendChild(scratch) } scratch.appendChild(fragment); return scratch.innerHTML; } return false; };
I'm not sure whether I'll use it, because HTML scares people. But the idea is nice.
It returns the HTML of the selected text, and so would preserve links, formatting, etc... whilst ensuring that the HTML is not broken.
The only downside is that in the text box that people type their reply, the HTML would show.
-
• #6010
Could it be implemented as an opt in option for users?
Thanks for keeping on hammering away at these issues though :) -
• #6011
Users have options?
-
• #6012
No, I guess not. Although there is some variation between being an admin/user in terms of what you can do?
But I expect this is another case where it looks like it might be very easy from the front end, but actually isn't at all
-
• #6013
Although there is some variation between being an admin/user in terms of what you can do?
Nope.
Very equal.
We see the same thing, the only difference is a few permissions grant me the edit functionality on other people's posts.
There is very little I can do that you cannot. I wanted it that way, to avoid creating forums that had crazy dictators on them. I have a bit of control, but not some crazy admin control panel.
Also... I found that good defaults on forums were far better for 99% of forums than a panel full of options, any of which could negatively change the site if they were set without the admin understanding the option.
In essence: Admins are just users with a few more permissions.
-
• #6014
Yep that all makes sense :)
-
• #6015
Not sure how and if it's a consistent thing, but I think on mobile browsers I sometimes end up with the
enter code here
section pre-filled in the comment reply
-
• #6016
Fat fingers?
What browser and OS?
-
• #6017
You think I have stats on this stuff?
Implements new feature
Ignores metricsHey.....You could work on my product team!
-
• #6018
I find it's really sensitive on mobile, even as you're scrolling it will think you've hit a button. The list button is in the middle so that's what I seem to get most of the time. Only seems to happen on this site.
-
• #6019
android 6, chrome, xperia z3
-
• #6021
Ooh, that's good feedback.
I'll see whether we are doing anything that affects the typical response times to clicks, swipes, etc.
-
• #6022
We use HSTS now, which dictates that every page must be served over SSL.
Sometimes, and especially on mobile networks, the SSL handshake may be interrupted by bad signal. In that moment the browser has nothing... so the only thing it can do is to tell you this and let you retry.
-
• #6023
We use HSTS now,
I still use HTFU
-
• #6024
Ah, but HSTS is HTTP Strict Transport Security.
And in things like Chrome, we actually ship as a line hard-coded into Chrome to only ever access this site via HTTPS:
https://cs.chromium.org/chromium/src/net/http/transport_security_state_static.json?l=13230 -
• #6025
Likely to be caused by using a mousedown / mouseup / touchend etc event on mobile to speed things up? The basic 'click' event on a phone introduces delay as it tries to disambiguate a genuine click from a scroll event. That delay might be exactly what you do want in this instance.
Thanks.
And with that...
Turned out to be as simple as this: https://github.com/microcosm-cc/microweb/commit/99842e25c0f836090589c31a00677f576b911eee
Though it was subtle... it was called implicitly via comments.js as well as explicitly on the page. Sneaky JS developers.