Are you sure you want to go to an external site to donate a monetary value?
WARNING: Some countries laws may supersede the payment processors policy such as the GDPR and PayPal. While it is highly appreciated to donate, please check with your countries privacy and identity laws regarding privacy of information first. Use at your utmost discretion.
Solved by:
function setNonceUponCSP() { window.addEventListener("securitypolicyviolation", (e) => { //let message = e.originalPolicy; //messageTruncated = message.substring(message.indexOf("'nonce-") + 7); //let nonceValue = messageTruncated.substring(0, messageTruncated.indexOf("'")); let nonceValue = e.originalPolicy.match(/'nonce-(.*?)'/)[1]; cssStylesheet = document.getElementById(namespace); cssStylesheet.setAttribute('nonce', nonceValue); }, { passive : true, }); }
I didn't find a way to make it to work on first error.
Plan cancelled.
Thos program, now, takes the content, regardless of content-type header, and determines whether data is feed or is not.
GM.xmlHttpRequest (incorporated into Promise)
gmXmlhttpRequest({ method: 'GET', url: document.documentURI, headers: { "Content-Type": "text/plain", "Accept": "text/plain" }, onprogress: function(request) { request.responseType = 'text'; }, onload: function(request) { request.overrideMimeType = 'text/plain'; if (document.URL.startsWith('file:') || request.status == 200) { myResolve(request); } else { myReject("File not Found"); } }, onerror: function(request) { console.log('Error Error Error') } })
Failed.
This thread is solved, as the problem has been detected.
This thread (new issue) continues at Forging content type / mime type.
I'm attempting to forge
content-type
header.I've attempted the followings:
XHR
request = new XMLHttpRequest(); request.open('GET', document.documentURI, false); request.overrideMimeType('text/plain'); request.setRequestHeader('content-type', 'text/plain'); request.send(); //console.info(`all headers: ${request.getAllResponseHeaders()}`); console.info(`content-type header: ${request.getResponseHeader('content-type')}`); console.info(`content-type document: ${document.contentType}`);
Fetch
fetch( document.documentURI, { method: 'GET', headers: { "content-type" : "text/plain", }, } ) .then((response) => { console.info(response.headers.get('content-type')) });
Both didn't work.
and
document.characterSet
document.inputEncoding
can achieve it.let request = fetch(url) .then(response => response.arrayBuffer()) .then(buffer => { let decoder = new TextDecoder(document.inputEncoding); let text = decoder.decode(buffer); handleText(text); });
https://furbo.org/feed/atom/
Setting arbitrary MIME Type (
document.contentType
) using Open in Browser will result in the following findings:Opening as "text/plain", "text/html" will make everything work.
Opening as "text/xml" (including "application/xml" etc.) will only build HTML file, without CSS related additions.
Attempting to set MIME Type using this code has failed:
request.setRequestHeader('Content-Type', 'text/plain;charset=UTF-8');
Testing feeds:
https://www.kaidan.im/atom.xml
https://www.falkon.org/atom.xml
https://www.jsonfeed.org/feed.xml
https://furbo.org/feed/atom/
Setting arbitrary MIME Type (
document.contentType
) using Open in Browser will result in the following findings:Opening as "text/plain", "text/html" will make everything work.
Opening as "text/xml" (including "application/xml" etc.) will only build HTML file, without CSS related additions.
Attempting to set MIME Type using this code has failed:
request.setRequestHeader('Content-Type', 'text/plain;charset=UTF-8');
Testing feeds:
https://www.kaidan.im/atom.xml
https://www.falkon.org/atom.xml
https://www.jsonfeed.org/feed.xml
Here are two feeds (XML and JSON) of same server and content that do work with the userscript.
https://furbo.org/feed/
https://furbo.org/feed/json/
This is all the relevant information.
Thank you for any of your kind help.
This is the function in question.
function extensionLoader(url) { purgeStylesheets(); formatDate(); setCssStylesheet(); decorateEntry(); linksBar(); follow(url); subToMe(url); aboutPage(); donatePage(); settleFilters(); scrollDown(); statusBar(); mailTo(); }
The functions
formatDate()
,linksBar()
,aboutPage
,donatePage
andstatusBar()
do work for the XML feed, but not all the rest of the functions, such assetCssStylesheet();
.Styling functions tend to work in more cases when loading them to the generated document before setting it with the original document, but I'm interested in doing all the post-work after the HTML file is ready.
Hello,
I've rewrote Newspaper to work without XSLTProcessor, which turned out to be even easier and shorter, and now it works with all web browsers.
Background
Once a page is validated to be of type feed, the executes two main actions to generate an HTML page.
Function
renderXML(xmlFile, atomRules)
to gather data bfrom the file and generate an HTML out of it.Function
extensionLoader()
which adds CSS stylesheet and some functions of accessibility and navigation.This script has been tested successfully with all formats: Atom, ActivityStream, JSON, RDF and RSS.
Issue
However, the part of
extensionLoader()
doesn't always work, and the reason is unknown to me.Below are two feeds on the same server of same content but different formats (one is XML and the other is JSON); the function
extensionLoader()
works only with the JSON feed.https://www.jsonfeed.org/feed.xml
https://www.jsonfeed.org/feed.json
This post is not related to this thread
Please help!
Kindly,
Schimon
Why was this closed?
Don't you think this is worth attention, especially when it is concerning to Userscripts and the news SRI policy?
What would be the best place to collaborate on this suggestion if not here?
Hello,
I'm attempting to build HTML from JSON by reading it with a loop statement.
This is what I came up with thus far:
feedItems = { "div": "feed", "attributes": { "style" : "language", }, "children" : { "div": "title", "div": "subtitle", "div": "links-bar", "div": "entry", // multiple alike "attributes": { "style" : "language", }, "children" : { "div" : "title", "attributes": { "href" : ["url", "id"], "id" : "id", }, "div" : ["authors", "author"], "div" : ["date_published", "date_modified"], "div" : ["content_html", "content_text"], "div" : "image", "div" : "tags", }, } }; /* NOTE Handling attributes "attributes": { "style" : { "direction" : "language" } } */
Thank you
Yes, I am; I've just checked if something has changed since then.
I'll look into it and add Feeds for OUJS (all, users, tags), and later add a Web Browser News like the one of USO.
I don't have (the time to establish) a node.js server.
Do we have a sandbox node.js server of OUJS to make tests on?
Metablock
// @downloadURL
seems to solve this issue to some extent.Hello,
Are there web feeds for OUJS?
Thank you
🚥 Clean URL Improved (URL Control)
Clean URL Improved userscript has a special update.
Clean URL Improved has a popup box (aka tooltip) which suggests a selection of 4 links:
🔴 Original URL
🟡 Purged URL
🟢 URL with whitelisted parameters
⭕ URL with no parameters
🔗 URL found within a search parameter
TODO
Reduce amount of links when there are to identical links;
Event Listener Delegation doesn't always work (See hyperlink #4);
URL found within a search parameter (🔗) might need a check/verification that it's a valid URL.
Test hyperlinks with parameters:
Link #1 (
orderBy
,orderDir
,ref
) // TooltipLink #2 (
orderBy
,orderDir
,v
) // No tooltipLink #3 (
orderBy
,orderDir
,v
,ref
) // TooltipLink #4 (
orderBy
,orderDir
,v
,url
) // FIXME no tooltip (event listener)Test (plain) links with parameters:
https://openuserjs.org/?orderBy=updated&orderDir=desc&ref=sjehuda // Tooltip
https://openuserjs.org/?orderBy=updated&orderDir=desc&v=sjehuda // No tooltip
https://openuserjs.org/?orderBy=updated&orderDir=desc&v=sjehuda&ref=sjehuda // Tooltip
https://openuserjs.org/?orderBy=updated&orderDir=desc&v=sjehuda&ref=sjehuda&url=https://blacklistednews.com // Tooltip
Feedbacks are welcome!
Best,
Schimon
See also https://www.w3schools.com/howto/howto_css_overlay.asp
I might be over thinking, and perhaps JSCSSP is a better solution.
Here is a way to apply CSS style per element.
This is useful in case Subresource Integrity is enabled.
I might be missing here something or it is impossible to utilize pseudo-class in the fashion persented here.
Please pardon me for the mess (i.e. slice & replace).
jsonStyle = { // CSS stylesheet converted into JSON } list = Object.keys(jsonStyle); for (let i = 0; i < list.length; i++) { for (const element of document.querySelectorAll(`${list[i]}`)) { element.style = JSON.stringify(jsonStyle[`${list[i]}`]) .slice(2) .replace('"}','') .replace(/['"]+/g, '') .replace(/[',]+/g, ';'); //console.log(list[i]) //console.log(element.style) } }
I've used this tool to convert CSS to JSON https://transform.tools/css-to-js
Also posted at: ScriptCat
✂️ Scissors (Element Deleter)
Fixed Mastodon "toot" feeds.