Last active
August 29, 2015 13:57
-
-
Save jm3/9679847 to your computer and use it in GitHub Desktop.
zivity photoset refreak
This file contains 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 Zivity Photoset Refreak | |
// @author John Manoogian III / jm3 | |
// @namespace http://beta.zivity.com/users/jm3 | |
// @description cleans up cruft, adds button to save current photo at high res. requires: http://tampermonkey.net/ | |
// @include https://www.zivity.com/*/photosets/* | |
// @version 0.1 | |
// ==/UserScript== | |
window.addEventListener("load", function(e) { | |
unsafeWindow.save_this_photo = function() { | |
var thumb_path = unsafeWindow.big_thumbs[ unsafeWindow.current_img ].src; | |
var image_path = thumb_path.replace( /tn_large/, "large" ); | |
var w = window.open(image_path,'Photo',''); | |
}; | |
var injection_point, btn; | |
injection_point = document.getElementById('shoutout_form'); | |
if (injection_point) { | |
btn = document.createElement('div'); | |
btn.innerHTML = "<div style='text-align: left;'> <input id='save_this' type='button' onclick='save_this_photo()' value='save this photo' /></div><br />"; | |
injection_point.parentNode.insertBefore(btn, injection_point.nextSibling); | |
} | |
$("#save_this") | |
.css("background","none") | |
.css("border","none") | |
.css("color","#fff"); | |
/* rm bullshit */ | |
$("#main_row").remove(); | |
$(".subNav").remove(); | |
$("#tag_set").remove(); | |
$("#tag_line").remove(); | |
$("#search").remove(); | |
$("#prize_title").remove(); | |
$("#preview_shoutout").remove(); | |
$("#shareGoogle").remove(); | |
$("#shareTwitter").remove(); | |
$("#voting > div > h2").remove(); | |
$("#zenbox_tab").remove(); | |
/* more bullshit */ | |
$("#second_row.clearfix").css("background-color","transparent"); | |
$("#main_row.clearfix").css("border-bottom","none"); | |
$(".notifierCount").css("background-color","#000"); | |
$("#shoutout").css("background-color","#222"); | |
$("#shoutout_form").css("margin-top","500px"); | |
/* restore keyboard nav */ | |
$(document).keydown(function(e){ | |
if (e.keyCode == 37) /* left */ | |
$("img#nav_back_thumb").click(); | |
if( e.keyCode == 39 ) /* right */ | |
$("img#nav_next_thumb").click(); | |
if( e.keyCode == 32 ) {/* space */ | |
$("a#openGallery").click(); | |
/* correct for spacebar triggering page-down event */ | |
setTimeout(function(){ window.scrollTo(0,0); }, 500); | |
} | |
}); | |
}, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment