Requested feature overview description.
When entering tags, if the tag field registers key_up or unfocus, and there is a 2 second delay, query the server and check if it is a known DNP artist, example:
document.addEventListener("DOMContentLoaded", function(){ //Original idea was to get a list of the tags by type and check //each artist tag for implementation to the following consequent IDs var consequent_conditional = 219945, consequent_avoid = 16198, inputField = document.getElementById("post_tags"), timer = null; function checkIfConditionalOrDNP(){ //This isn't a valid API endpoint, and is just an example //Example format: {"is": integer [0|1|2], "ref": string url} var req = new XMLHttpRequest(); req.open("GET", "/tags/dnptest.json", true); req.onload = function(e) { var res = JSON.parse(req.response); //Lets hook right on in to the e621's site code! :D if(res["is"]==2){ error("WARNING: The post you are uploading contains a known avoid posting artist. Continuing with this upload may result in a record on your account! Reference: <a href=\""+res["reference"]+"\">"+res["reference"]+"</a>"); }else if(res["is"]==1){ warning("WARNING: The post you are uploading contains a known conditional DNP artist, please be sure that this post does not meet the citera: <a href=\""+res["reference"]+"\">"+res["reference"]+"</a>"); } }; req.send(inputField.value); } function createOrReplaceTimer(){ //Clear it if it doesn't exist if(timer === null) clearTimeout(timer); //Create timer timer = setTimeout(function(){ checkIfConditionalOrDNP(); timer = null; },1000); } //Add the event hooks inputField.addEventListener("keyup", createOrReplaceTimer); inputField.addEventListener("blur", createOrReplaceTimer); inputField.addEventListener("paste", createOrReplaceTimer); });
Why would it be useful?
People will not be bapped as often. It will also help those who know who the artist is but doesn't know that they are DNP, making it so they don't have to flag it after they upload and see avoid_posting was automatically added.
What part(s) of the site page(s) are affected?
- Uploads
Updated by BlueDingo