var pd = { version: "1.4.9", bookmarkver: "1.4", editStrings: [ "I love ice cream.", "I hate beer.", "My favorite color is blue.", "I enjoy reading books.", "I like to go hiking.", "My favorite movie is Inception.", "I enjoy playing video games.", "I like to travel.", "I'm learning to play the guitar.", "I enjoy cooking.", "I love listening to music.", "I enjoy watching the sunset.", "I like to explore new places.", "I find joy in reading a good book.", "I appreciate a good cup of coffee.", "I enjoy spending time with my friends.", "I like learning new things.", "I find peace in long walks.", "I enjoy the sound of rain.", "I love the smell of fresh bread.", ], init: function () { pd.checks.versions(); if (window.pd_processing !== true) { if (pd.checks.location()) { $("#pd__central").find(".complete,.processing").hide(); $("#pd__form").show(); pd.setup.basicSettings(); pd.setup.applyDom(); } else { if ( confirm( "This script can only be run from your own user profile on reddit. Would you like to go there now?" ) ) { document.location = "https://old.reddit.com/u/me/overview"; } } } }, checks: { versions: function () { function checkBookmarkletVersion() { if ( typeof window.bookmarkver === "undefined" || window.bookmarkver !== pd.bookmarkver ) { if ( confirm( "There's been an update to the bookmarklet. Would you like to go to the Github repo in order to get the latest version?" ) ) { alert( 'Sadly, there]\'s no way to automatically update the bookmark. :/\nScroll down to the "Install PowerDeleteSuite" button on the github page. Replace your CURRENT bookmark with the one found there to install the latest bookmark.' ); document.location.href = "https://github.com/j0be/PowerDeleteSuite"; return false; } } return true; } function checkAppVersion() { pd.prevRunVersion = localStorage.getItem("pd_ver") ? localStorage.getItem("pd_ver") : "0"; localStorage.setItem("pd_ver", pd.version); if (pd.version !== pd.prevRunVersion) { if ( confirm( "You've gotten the latest update! You are now running PowerDeleteSuite v" + pd.version + ". Would you like to open the changelog in a new tab?" ) ) { $.ajax({ url: "/r/PowerDeleteSuite/new.json" }).then( function (data) { window.open( "https://reddit.com" + data.data.children[0].data.permalink ); }, function () { window.open("https://reddit.com/r/PowerDeleteSuite"); } ); } } return true; } return pd.debugging || (checkBookmarkletVersion() && checkAppVersion()); }, location: function () { return ( document.location.hostname.split(".").slice(-2).join(".") == "reddit.com" && document.location.href.match("/user/") && document.location.href.match("/overview") && $(".titlebox h1").first().text() === $("#header-bottom-right .user a").first().text() ); }, }, setup: { basicSettings: function () { pd.config = { uh: $("#config").innerHTML ? $("#config") .innerHTML.replace(/.*?modhash.{1}: .{1}/, "") .replace(/[^a-z0-9].*/, "") : $("#config")[0] .innerHTML.replace(/.*?modhash.{1}: .{1}/, "") .replace(/[^a-z0-9].*/, ""), user: $("#header-bottom-right .user a").first().text(), }; pd.endpoints = { comments: "/user/" + pd.config.user + "/comments/.json", submissions: "/user/" + pd.config.user + "/submitted/.json", search: "/search.json", }; }, applyDom: function () { if (pd.debugging) { $("#pd__central,#pd__style").remove(""); } document.title = pd.config.user + " | Power Delete Suite"; $(window).on("error", pd.error); $(".sitetable,.neverEndingReddit").remove(); if ($("#pd__central").length === 0) { $("body>.content[role='main']").append("
"); } if ($("#pd__style").length === 0) { $("head").first().append("