-
-
Save Utopiah/525718c8a60ee2d9e25d7724e9dbb355 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in Trydactil bind <C-X> js fetch(' | |
// note that as a 1-liner ; are mandatory. | |
const month = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ][new Date().getMonth()]; | |
const year = new Date().getFullYear(); | |
const url = `https://fabien.benetou.fr/PersonalInformationStream/WithoutNotes${month}${year}`; | |
fetch(url+'?action=source') .then( response => { return response.text() } ) .then( data => { | |
var writeURL = url + '?action=edit'; | |
var selection = window.getSelection().toString(); | |
var content = "post=1&author=PIM_Trydactil&authpw=edit_password&text="+data+'%0a* ' | |
+ window.location.href.replace(/\?utm_source.*/,''); | |
if (selection) content += '%0a** ' + selection; | |
fetch(writeURL, { method: 'POST', headers: {'Content-Type':'application/x-www-form-urlencoded'}, body: content }) | |
.then(res => res).then(res => { | |
var div = document.createElement("div"); | |
div.innerText = "Status adding URL to PIM : " + res.status; | |
div.onclick = _ => window.open(url); | |
div.style = "position:absolute; top:100px; left:100px; z-index:999; color:red; background-color:yellow;"; | |
document.body.appendChild( div ); setTimeout( _ => div.style.display = "none", 2000); | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment