Skip to content

Instantly share code, notes, and snippets.

@Denyerec
Created February 7, 2022 12:52
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 Denyerec/047c2522d4b7529ba0bb50c96333bbb0 to your computer and use it in GitHub Desktop.
Save Denyerec/047c2522d4b7529ba0bb50c96333bbb0 to your computer and use it in GitHub Desktop.
Shootproof Filename List
// ==UserScript==
// @name Shootproof Filenames
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Reveal filenames on Shootproof without user interaction
// @author Denyer
// @run-at document-end
// @match http*://studio.shootproof.com/*/order/*
// @match http*://studio.shootproof.com/v2/*/order/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Your code here...
var dParser=new DOMParser();
var dDoc= dParser.parseFromString(document.getElementById('templateFilenameList').innerHTML, "text/html");
console.log(dDoc);
var dFilenames=dDoc.getElementById("orderFilenames").innerHTML;
console.log(dFilenames);
var dFileArr = dFilenames.split(',');
console.log(dFileArr);
//for (var i = 0, len = dFileArr.length; i < len; i++) {
// dFileArr[i] = dFileArr[i].substring(dFileArr[i].indexOf("---") + 3);
// }
dFilenames = dFileArr.join(',');
var dNewItem=document.createElement("div");
dNewItem.setAttribute("style","padding:10px;");
var dFileList=document.createElement("span");
dFileList.setAttribute("class","btn btn-default");
dFileList.setAttribute("style","cursor: text;user-select:initial; white-space:normal; text-align: left; display: block;");
dFileList.innerHTML=dFilenames;
dNewItem.appendChild(dFileList);
var dTarget = document.getElementById("bd");
dTarget.insertBefore(dNewItem, dTarget.childNodes[0]);
//dRange = document.body.createTextRange();
//dRange.moveToElementText(dFileList);
//dRange.select();
var dSelection = window.getSelection();
var dRange = document.createRange();
dRange.selectNodeContents(dFileList);
dSelection.removeAllRanges();
dSelection.addRange(dRange);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment