Skip to content

Commit

Permalink
fix for #3, also fixed avatars not being hidden due to tumblr change.
Browse files Browse the repository at this point in the history
  • Loading branch information
Atesh committed May 29, 2013
1 parent 274a3f2 commit 7c8ae1c
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions Extensions/cleanfeed.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//* TITLE CleanFeed **//
//* VERSION 1.0 REV D **//
//* VERSION 1.0 REV E **//
//* DESCRIPTION Browse safely in public **//
//* DEVELOPER STUDIOXENIX **//
//* DETAILS This extension, when enabled, hides photo posts until you hover over them. Useful to browse Tumblr in a workspace or in public, and not worry about NSFW stuff appearing. You can also set it to hide avatars and not show non-text posts at all. To activate or disable it, click on the CleanFeed button on your sidebar. It will remember it's on/off setting. **//
Expand Down Expand Up @@ -76,6 +76,18 @@ XKit.extensions.cleanfeed = new Object({
XKit.post_listener.add("cleanfeed", XKit.extensions.cleanfeed.do);
XKit.extensions.cleanfeed.do();

$(document).keydown(XKit.extensions.cleanfeed.key_down);

},

key_down: function(e) {

if (e.altKey === true) {
if (e.which === 88) {
XKit.extensions.cleanfeed.toggle();
}
}

},

update_button: function() {
Expand Down Expand Up @@ -168,7 +180,7 @@ XKit.extensions.cleanfeed = new Object({

});

$(".post_avatar").each(function() {
$(".post_avatar_link").each(function() {

if (typeof $(this).attr('data-user-avatar-url') === "undefined" || $(this).attr('data-user-avatar-url') === "") {

Expand All @@ -181,7 +193,7 @@ XKit.extensions.cleanfeed = new Object({
if (hide === true) {

if (XKit.extensions.cleanfeed.preferences.hide_avatars.value === true) {
$(".post_avatar").not(".flat.lighter_blue").each(function() {
$(".post_avatar_link").not(".flat.lighter_blue").each(function() {
$(this).css("background-image", "url(" + XKit.extensions.cleanfeed.img_avatar + ")");
});
}
Expand All @@ -207,8 +219,13 @@ XKit.extensions.cleanfeed = new Object({
XKit.tools.remove_css("cleanfeed_full_block");
XKit.extensions.cleanfeed.added_full_block_css = false;

$(".post_avatar").each(function() {
$(this).css("background-image", "url(" + $(this).attr('data-user-avatar-url') + ")");
$(".post_avatar_link").each(function() {
var m_url = $(this).attr('data-user-avatar-url');
if (m_url.indexOf('url(') !== -1) {
$(this).css("background-image", m_url);
} else {
$(this).css("background-image", "url(" + m_url + ")");
}
});

XKit.tools.remove_css("cleanfeed_on");
Expand Down Expand Up @@ -266,4 +283,4 @@ XKit.extensions.cleanfeed = new Object({
XKit.extensions.cleanfeed.update_images(false);
}

});
});

0 comments on commit 7c8ae1c

Please sign in to comment.