Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Newgrounds image viewer script by Braden Best
- * To use: inject this script into a NG dump item page, and click on the image
- */
- (function(){
- function push(url){
- var img = document.createElement('img'),
- img_helper = document.createElement('div');
- // Image
- img.src = url;
- img.style.position = 'absolute';
- img.style.left = '0px';
- img.style.top = '40px';
- img.style.zIndex = '10000'; // this is to push it above everything else, so the NG navbar doesn't float over it.
- // Image helper
- img_helper.innerHTML = "Click here to close image";
- img_helper.style.position = 'absolute';
- img_helper.style.left = '0px';
- img_helper.style.top = '0px';
- img_helper.style.margin = '0';
- img_helper.style.padding = '5px 0';
- img_helper.style.width = '100%';
- img_helper.style.height='30px';
- img_helper.style.background = '#fff';
- img_helper.style.color = '#000';
- img_helper.style.fontSize = '24px';
- img_helper.style.textAlign = 'center';
- img_helper.style.zIndex = '10000';
- // append to body
- document.body.appendChild(img);
- document.body.appendChild(img_helper);
- // helper on-click
- img_helper.onclick = function(){
- document.body.removeChild(img);
- document.body.removeChild(img_helper);
- img_helper.onclick = null;
- }
- }
- if(dimage) {
- dimage.onclick = function(){
- push(dimage.src);
- }
- } else {
- var orig = document.getElementByID('dimage');
- if(orig) {
- orig.onclick = function(){
- push(orig.src);
- }
- } else {
- console.log("Something went wrong. Are you on an NG dump item, specifically an image?");
- }
- }
- })();
Add Comment
Please, Sign In to add comment