Coder Social home page Coder Social logo

elk-quick-quote's People

Contributors

frenzie avatar

Watchers

 avatar  avatar  avatar

Forkers

spuds

elk-quick-quote's Issues

Add to post screen / topic summary listing

In the 2.0 branch https://github.com/Spuds/elk-quick-quote/blob/20/quickQuote.js an item I added that could be pulled back into 1.1.9 (when released) is adding the quick quote button to the topic summary listing below the post area.

In 1.1.8 (and 2.0) the markup is lacking to make this easy, but there is no reason for it to be like that. I've added the necessary markup to 2.0 and 1.1.9 so the JS can grab the author and time for the quote.

Just a suggestion

Align code needs to be updated

See Spuds@bc34357

A couple of minor things .. left and right are unique BBC codes not part of align= as such those props objects need to be updated.

In seeing that, center is also a div class not a span align. Yes this is not HTML correct, center is not a block element, but as far as the user is concerned when using the editor, center is a block element and that is how ElkArte deals with it. Check the years of defending the way center worked vs left/right.

TLDR, we need to check for the centertext class in the div section and not the span section

Updated the checkCSSProps function to able to check for a class name by setting isClass value of the passed object. This allowed the consolication of centertext and tt items.

The above should be clear in the code and is 1.1 valid, hence the issue.

You can remove this function

if ((typeof Node != 'undefined') && !document.selectNodes) {
Node.prototype.selectNodes = function(xpath, resolver) {
var contextNode = this.ownerDocument || this,
result = [],
i = 0,
node,
nodes = contextNode.evaluate(xpath, contextNode, resolver || null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
while (node = nodes.snapshotItem(i++)) {
result.push(node);
}
return result;
};
Node.prototype.selectSingleNode = function(xpath, resolver) {
return document.evaluate(xpath, this.ownerDocument || this, resolver || null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
};
}

Two things I noted while working on a 2.0 version. The first defined function I could not find any usage.

The second function, selectSingleNode is only used twice and does not appear to be doing what was expected.

For example it is called as node.selectSingleNode('ancestor::pre')) where node is a node inside of a specific post. However node is used as a backup in document.evaluate(xpath, this.ownerDocument || this, resolver || null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
this will resolve as document.evaluate(xpath, this.ownerDocument, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; where this.ownerDocument is likely the entire document and not the real area of interest.

You could reverse the logic as this || this.ownerDocument but I chose to drop the entire wrapper and just make the native call in the two places used.

Wrong Selector

var postAncestor = selectionAncestor.selectSingleNode('ancestor-or-self::div[contains(@class,"inner")]');

At least in 2.0 this is a section with a class of messageContext, so you may want to check that in 1.1 as well

In the 2.0 that I'm working on this is now
postAncestor = document.evaluate('ancestor-or-self::section[contains(@class,"messageContent")]', selectionAncestor, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; since I also removed the wrapper function

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.