sjehuda Author

This ECMAScript is unecessary; because, AdBlock can do it better.



It be better to add dictionary support, so it be possible to query elements of different XML Namespace.

For instance, to query Atomsub of XMPP would require this XPath query "pubsub:item/atom:entry".


Greetings.

I am intending to add statistics which be realized as "notifications" and native controllers ("alert" and "confirm").

I be glad to receive your suggestions of possible information to enumerate and display.

Thank you,

Schimon




Greetings.

From day to day, I monitor the count of intsallations and ratings of my software, here and elsewhere.

Recently, it appears, that there is a coordinated action to vote for my software, which is pleasant; yet

I am more interested to have genuine (i.e. "generic") ratings which always help me to know what may be good or bad with my software.

If the votes are genuine, and not intervention is required, then I would want to apologise for this message.

Thank you.


Greetings.

I Have created two methods to facilitate the use of XPath Queries.

Functions

Node.prototype.queryPathAll = function (xmlns, expression) {
  let data = this.ownerDocument || this;
  let nodes = data.evaluate(
    expression,
    this,
    () => xmlns,
    XPathResult.ORDERED_NODE_ITERATOR_TYPE,
    null);
  let results = [];
  let node = nodes.iterateNext();
  while (node) {
    // Add the link to the array
    results.push(node);
    // Get the next node
    node = nodes.iterateNext();
  }
  return results;
};

Node.prototype.queryPath = function (xmlns, expression) {
  let data = this.ownerDocument || this;
  return data.evaluate(
    expression,
    this,
    () => xmlns,
    XPathResult.FIRST_ORDERED_NODE_TYPE,
    null)
    .singleNodeValue;
};

Usage

Set "xmlns" to "null" for OPML, RSS, HTML, and other documents without "xmlns".

let nodeFeed = xmlFile.queryPath(xmlns.atom, "atom:feed")
let nodeNext = nodeFeed.queryPath(xmlns.atom, "atom:link[@rel='next']");
let nodePrevious = nodeFeed.queryPath(xmlns.atom, "atom:link[@rel='previous']");

let nodesEntry = nodeFeed.queryPathAll(xmlns.atom, "atom:entry");
for (const nodeEntry of nodesEntry) {
  // Your code here.
}

Namespace

xmlns = {
  "atom"      : "http://www.w3.org/2005/Atom",
  "content"   : "http://purl.org/rss/1.0/modules/content/",
  "dc"        : "http://purl.org/dc/elements/1.1/",
  "foaf"      : "http://xmlns.com/foaf/0.1/",
  "geo"       : "http://www.w3.org/2003/01/geo/wgs84_pos#",
  "metalink4" : "urn:ietf:params:xml:ns:metalink",
  "metalink"  : "http://www.metalinker.org/",
  "owl"       : "http://www.w3.org/2002/07/owl#",
  "rdf"       : "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
  "rdfs"      : "http://www.w3.org/2000/01/rdf-schema#",
  "rss"       : "http://purl.org/rss/1.0/",
  "smf"       : "http://www.simplemachines.org/xml/recent",
  "syn"       : "http://purl.org/rss/1.0/modules/syndication/",
  "xhtml"     : "http://www.w3.org/1999/xhtml",
  "xlink"     : "http://www.w3.org/1999/xlink",
  "xsl"       : "http://www.w3.org/1999/XSL/Transform"
}

For examples, please refer to the source code of Greasemonkey StremBurner (Newspaper).

https://openuserjs.org/scripts/sjehuda/Newspaper

Kindly,
Schimon


Greetings.

Pardon for commenting here. The comments are closed for ticket #2044.

Similar duplicate to #1995 ... not supported.

Martii, would this be relevant if ther would be an NPM module that does that task (i.e. implement XEP-0493: OAuth Client Login)?


No. Neither of these.

Are you imagining a directory full of .url or .webloc files that point to RSS feeds, and that selecting one from the sidebar of my script would open the RSS in the preview pane?

This might be a possibility, albeit this is not what I suggest.

Just as this script renders MarkDown files, I suggest to render files of type Atom, JSON Feed, OPML, RDF, and RSS.

I am aware that it is rare to store these files, yet it would be interesting to see another, approach, use and style (CSS Stylesheet) of rendering of syndication feeds.

Please. Install "Newspaper", and observe and review it.



I give up.

Even my attempts against it did not appear to work.

I will contact the original author for further planning.


Calling to the initial function over again with a boolean variable was enough to do the task.

Solved!


Good day!

Newspaper is an HTML feed renderer. By default it displays maximum 5 entries. Upon clicking on "See more news" it displays all entries. It does so by adding streamburner_active=0 query to the URL.

I would be glad to receive an advise about a different mean to ignore a setting.

I was thinking on changing a setting with GM.getValue/GM.setValue (e.g. "load all" = true) and to revoke that setting (i.e. false) upon click/mouse event - after rendering task is done.

Please advise,
Schimon





Thank you for your feedback; I should have done this a long time ago.

I have added more settings, albeit most do not work yet.

And, as always, you are welcome to report issues and suggest improvements



The developer has stated that support for GM API is not planned, and yet, because the summary of FREE Browser does mention "Greasemonkey style script support", I think it would be worthwhile to make attempts adhering for GM API support for FREE Browser.




The numbers are soaring, despite the message I have posted. What should I do?


Issue has been solved!

      for (linkElement of document.links) {
        linkElement.addEventListener("mouseover",
          async function(e) {
            if (e.target && e.target.nodeName == "A") {
              hyperLink = e.target;
              await xhrHyperLink(hyperLink);
            }
          },
          {
            once: true
          }
        );
      }

Thank you hacker09 and Konf!