Skip to content

Instantly share code, notes, and snippets.

@Rotzbua
Last active September 9, 2018 21:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Rotzbua/691361a41722fb0ef6a25ec4a42a12f4 to your computer and use it in GitHub Desktop.
Save Rotzbua/691361a41722fb0ef6a25ec4a42a12f4 to your computer and use it in GitHub Desktop.
Greasemonkey_Script_festi.info
// ==UserScript==
// @name Add box source url as comment
// @description Privacy hint: the creation date is added.
// @license GPL-2.0-or-later
// @version 2018.09.09
// @include https://festi.info/boxes.py/*
// @include https://www.festi.info/boxes.py/*
// @updateURL https://gist.github.com/Rotzbua/691361a41722fb0ef6a25ec4a42a12f4/raw/greasemonkey.festi.info.user.js
// @noframes
// @grant none
// ==/UserScript==
// Notice: Comment is maybe removed if svg is modified by a third party program, e.g. Adobe Illustrator CC removes comment.
// get date
var currentTime = new Date();
// get uri
var uri = document.baseURI;
// check for box
if(uri.search("&render=1")===-1) {
console.log('no box found, do nothing');
return;
} else {
console.log('box found, add source url as comment');
}
// clean uri
var uri_clean = "";
uri_clean = uri.replace("&render=1", "");
uri_clean = uri_clean.replace("&render=0", "");
// create comment
var commentText = '';
commentText += '\n';
commentText += 'Note: At the moment (14.08.2018), boxes.py do not support versioning. New generated boxes might be different from previous versions.\n';
commentText += 'Creation date: ';
commentText += currentTime.toDateString() + '\n';
//commentText += currentTime.getDate() + '.' + currentTime.getMonth() + '.' + currentTime.getFullYear() + '\n';
commentText += 'Generated by URL:\n';
commentText += uri + '\n';
commentText += 'Generate new box with this settings:\n';
commentText += uri_clean + '\n';
var comment = document.createComment(commentText);
document.insertBefore(comment, document.childNodes[0]);
@Rotzbua
Copy link
Author

Rotzbua commented Aug 6, 2018

Notice: at the moment auto-update do not work with greasemonkey 4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment