Last active
September 9, 2018 21:15
-
-
Save Rotzbua/691361a41722fb0ef6a25ec4a42a12f4 to your computer and use it in GitHub Desktop.
Greasemonkey_Script_festi.info
This file contains hidden or 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
// ==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]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Notice: at the moment auto-update do not work with greasemonkey 4