//* TITLE FixMyPosts **// //* VERSION 1.2 REV D **// //* DESCRIPTION Fixes the reblog format of posts to reflect the blockquote-style **// //* DEVELOPER THETIMEISNEVERIGHT **// //* FRAME false **// //* BETA false **// XKit.extensions.FixMyPosts = new Object({ preferences: { "thick_quote" : { text: "Make blockquotes thicker and darker", default: false, value: false }, "condense_quote" : { text: "Condense block quotes", default: true, value: true }, "alert_on_update" : { text: "Display alert in top right corner when update is available (might be buggy!)", default: true, value: true } }, fixPosts: function() { $.FixMyPosts = new Object(); $(".post_wrapper").not(".processed").each(function(postIdx, postObj) { $(postObj).addClass("processed"); $.FixMyPosts.addedMargins = false; if ($(postObj).find(".reblog-list").length>0) { $.FixMyPosts.addedMargins = true; $.FixMyPosts.userPostArray = []; $.FixMyPosts.postTitle = ""; $.FixMyPosts.addedContent = ""; var useAskMargin = false; var postReblogs = $(postObj).find(".reblog-list"); if (postReblogs.length === 0) { postReblogs = $(postObj).find(".answer"); useAskMargin = true; } if ($(postObj).find(".contributed-content").length>0) { var commentObj = $(postObj).find(".contributed-content").first(); $.FixMyPosts.addedContent = $(commentObj).find(".reblog-content").html(); $(commentObj).remove(); } $(postReblogs).find(".reblog-list-item").each(function(reblogIdx, reblogObj) { var uname = $(reblogObj).find(".reblog-tumblelog-name").text(); console.log(uname); if ($(reblogObj).find(".reblog-title").length>0) { $.FixMyPosts.postTitle = $(reblogObj).find(".reblog-title").text(); } var postLink = $(reblogObj).find(".reblog-tumblelog-name").attr("href"); var reblogContent = ""; if ($(reblogObj).find(".reblog-content").length>0) { reblogContent = $(reblogObj).find(".reblog-content").html(); } var post = {user: uname, post: reblogContent, plink: postLink}; $.FixMyPosts.userPostArray.push(post); }); var postContent = ""; var allPosts = $.FixMyPosts.userPostArray; var blockQuoteStyle = "margin: 8px 0px;"; if (XKit.extensions.FixMyPosts.preferences.thick_quote.value) { blockQuoteStyle += " border-left: 3px solid #999999;"; } else { blockQuoteStyle += " border-left: 1px solid #666666;"; } if (XKit.extensions.FixMyPosts.preferences.condense_quote.value) { blockQuoteStyle += " padding: 0px 0px 0px 14px;"; } else { blockQuoteStyle += " padding: 0px 0px 0px 19px;"; } for (var i = 0; i < allPosts.length; i++) { var reblogItem = allPosts[i]; var newPostContent; if (reblogItem.post !== "") { newPostContent = ""; newPostContent += reblogItem.user + ":\n"; newPostContent += "
" + postContent; newPostContent += reblogItem.post; newPostContent += "
\n"; postContent = newPostContent; } } if ($.FixMyPosts.postTitle !== "") { postContent = "

" + $.FixMyPosts.postTitle.replace(/\/g,'>') + "

\n" + postContent; } if ($.FixMyPosts.addedContent !== "") { postContent += "

" + $.FixMyPosts.addedContent + "

"; } $(postReblogs).empty(); $(postReblogs).append(postContent); if (!useAskMargin) { $(postReblogs).css("margin", "15px 15px 15px 20px"); } else { $(postReblogs).css("margin", "15px 15px 15px 1px"); } $(postReblogs).css("border", "none"); } else if ($(postObj).find(".contributed-content").length>0) { var addedComment = $(postObj).find(".contributed-content").find(".reblog-content").html(); $(postObj).find(".contributed-content").empty(); $(postObj).find(".contributed-content").css("border-top", "none"); $(postObj).find(".contributed-content").append(addedComment); } if ($(postObj).find(".answer").length>0) { var postContent; if ($(postObj).find(".answer").find(".reblog-content").length>0) { postContent = $(postObj).find(".answer").find(".reblog-content").html(); } else { postContent = $(postObj).find(".answer").html(); } $(postObj).find(".answer").empty(); $(postObj).find(".answer").append(postContent); if (!$.FixMyPosts.addedMargins) { $(postObj).find(".answer").css("margin", "15px 15px 15px 1px"); } } }); }, running: false, run: function() { this.running = true; if (document.location.href.indexOf("www.tumblr.com/inbox") > -1 || document.location.href.indexOf("www.tumblr.com") === -1) { // The user is not on the dashboard, lets quit. return; } if (XKit.extensions.FixMyPosts.preferences.alert_on_update.value) { $.get("https://fixmyposts.wordpress.com/", function(data) { var myVer = "1.2 REV D"; if (data.indexOf(""+myVer+"") === -1) { var htmlAlert = "
FIXMYPOSTS UPDATE
"; $("#user_tools").first().append(htmlAlert); } }); } XKit.post_listener.add("FixMyPosts", XKit.extensions.FixMyPosts.fixPosts); XKit.extensions.FixMyPosts.fixPosts(); }, destroy: function() { this.running = false; XKit.post_listener.remove("FixMyPosts"); } });