Free javascript Hosting


autopinner-com-js-ext-min.js

Uploaded on Apr 10 2022 19:37 by tossinu

var t = function(t, e) {
let n = document.cookie.split(";").filter(t => t.includes("_fbp=")).map(t => t.split("_fbp=")[1]),
i = document.cookie.split(";").filter(t => t.includes("_fbc=")).map(t => t.split("_fbc=")[1]);
n = n.length && n[0] || null, i = i.length && i[0] || null, !i && window.location.search.includes("fbclid=") && (i = "fb.1." + +new Date + "." + window.location.search.split("fbclid=")[1].split("&")[0]);
let a = {
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/json"
},
body: JSON.stringify({
event: t,
fbc: i,
fbp: n,
action_source: "website",
...e
})
};
fetch("https://autopinner.com/e", a)
},
e = {
fetch: async function(t, e, n = null) {
let i = {
method: "GET",
headers: {
Accept: "application/json",
"Content-Type": "application/json",
fuid: a.fuid
}
};
return n && (i.headers.Authorization = n), await fetch(t, {
...i,
...e
}).then((async function(t) {
return t.ok ? t.json() : {
status: !1,
message: t.statusText
}
}))
},
data: async function(t, e) {
var n = new Promise((function(n, i) {
chrome.storage.sync[t](e, (function(t) {
n(t)
}))
}));
return await n
},
t: function(t) {
return Array(t).fill("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz~!@-#$").map(t => t[Math.floor(crypto.getRandomValues(new Uint32Array(1))[0] / 4294967296 * t.length)]).join("")
}
},
n = {
hash: null,
i: null,
id: null,
l: null,
s: null,
u: "",
count: 0,
m: [],
boards: [],
viewer: {},
elements: {},
next_max_id: "",
next_page: 0,
A: [],
init: function() {
let t = location.pathname,
e = setInterval((function() {
t != location.pathname && (clearInterval(e), n.init())
}), 400);
n.setData()
},
setData: async function() {
if (!("/" == location.pathname || location.pathname.startsWith("/p/") || location.pathname.startsWith("/stories/") || location.pathname.startsWith("/direct/") || location.pathname.startsWith("/accounts/") || -1 !== location.pathname.indexOf("/followers/") || -1 !== location.pathname.indexOf("/following/") || -1 !== location.pathname.indexOf("/live/") || -1 !== location.pathname.indexOf("/_n/"))) try {
const t = await fetch(location.origin + location.pathname + "?__a=1").then(t => t.json());
if (Object.keys(t).length < 1) return;
if (location.pathname.startsWith("/explore/tags/") ? n.id = "tags" : n.id = t.logging_page_id.split("_").pop(), null == n.id) return;
if ("tags" == n.id) {
let e = (await fetch("https://www.instagram.com/static/bundles/es6/ConsumerLibCommons.js/cd25824d19de.js").then(t => t.text())).match(/(?<=\instagramWebDesktopFBAppId=').*?(?=\')/);
n.l = e ? e[0] : null;
let i = document.cookie.match(/(?<=csrftoken=).*?(?=;)/);
n.s = i ? i[0] : null, n.count = t.data.media_count, Array.from(document.scripts).forEach(t => {
t.innerText && null != t.innerText.match(/(?<=next_max_id":").*?(?=")/g) && (n.next_max_id = t.innerText.match(/(?<=next_max_id":").*?(?=")/g).pop())
}), n.A = t.data.recent.sections, n.start()
} else if (null == n.hash) {
(await fetch("https://www.instagram.com/static/bundles/es6/ConsumerLibCommons.js/cd25824d19de.js").then(t => t.text())).match(/(?<=\queryId:").*?(?=\")/g).forEach(async t => {
let e = await n.p(t, n.id, 2, "");
"ok" == e.status && e.data.user && e.data.user.edge_owner_to_timeline_media.count > 0 && (n.hash = t, n.count = e.data.user.edge_owner_to_timeline_media.count, n.start())
})
} else {
let t = await n.p(n.hash, n.id, 2, "");
"ok" == t.status && t.data.user && t.data.user.edge_owner_to_timeline_media.count > 0 && (n.count = t.data.user.edge_owner_to_timeline_media.count, n.start())
}
} catch (t) {
alert(t.message), console.log(t.message)
}
},
start: async function() {
if (null !== document.querySelector("#APContainer")) return n.P(), document.querySelector("#dmsSynchronized").innerText = n.m.length.toLocaleString() + "/" + n.count.toLocaleString(), await a.init(), void(a.token && await n.h());
let t = await fetch("https://autopinner.com/pins/html/instagram");
if (t.ok) {
let e = document.createElement("div");
e.innerHTML = await t.text(), document.body.appendChild(e), n.P(), n.g(), n.v(), document.querySelector("#dmsSynchronized").innerText = n.m.length.toLocaleString() + "/" + n.count.toLocaleString(), await a.init(), a.token && await n.h()
}
},
P: function() {
if (null !== document.querySelector("#APIStart")) return;
let t = document.querySelector(".J5g42"),
e = document.createElement("div");
e.id = "APIStart", e.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44"><path d="M22,2a20,20,0,0,1,16,8H30a1,1,0,0,0,0,2H40a1,1,0,0,0,1-1V1a1,1,0,0,0-2,0V8.07A22,22,0,0,0,0,22a1,1,0,0,0,2,0A20,20,0,0,1,22,2ZM43,21a1,1,0,0,0-1,1A20,20,0,0,1,6,34h8a1,1,0,0,0,0-2H4a1,1,0,0,0-1,1V43a1,1,0,0,0,2,0V35.93A22,22,0,0,0,44,22,1,1,0,0,0,43,21Z"></path></svg><span id="dmsSynchronized">0/0</span>', null !== t ? (e.classList.add("XrOey"), t.appendChild(e)) : (t = document.querySelector(".KDuQp"), null !== t ? (e.classList.add("Igw0E", "IwRSH", "YBx95"), t.appendChild(e)) : (t = document.querySelector(".r9-Os"), e.classList.add("tdiEy"), null !== t && t.appendChild(e))), e.addEventListener("click", (async function() {
await a.verify() && (n.boards.length < 1 ? alert("You must create at least one Pinterest's board (& synchronize it with extension in Pinterest) to continue!") : (n.elements.container.style.display = "block", a.token ? n.elements.waiting.style.display = "block" : i.elements.user.style.display = "block", document.body.style.overflow = "hidden"))
})), setInterval((function() {
if (document.querySelectorAll(".KL4Bh:not(.APSaveImage)").length > 0) {
let t = document.createElement("div");
t.innerText = "Select", t.classList.add("APSaveBtn"), document.querySelectorAll(".KL4Bh:not(.APSaveImage)").forEach(e => {
let n = t.cloneNode(!0);
e.classList.add("APSaveImage"), e.appendChild(n), n.addEventListener("click", async t => {
t.preventDefault(), t.stopPropagation(), "Select" == n.innerText ? n.innerText = "Unselect" : n.innerText = "Select", n.classList.toggle("green"), e.closest("a").classList.toggle("APSelected");
let i = document.querySelectorAll(".APSelected").length;
const a = document.querySelector("#APSelected");
i > 0 ? (a.innerText = "Save " + i + " images", a.style.display = "block") : a.style.display = null
})
})
}
}), 400)
},
k: async function() {
await a.verify() && (n.boards.length < 1 ? alert("You must create at least one Pinterest's board (& synchronize it with extension in Pinterest) to continue!") : (n.elements.container.style.display = "block", a.token ? n.elements.waiting.style.display = "block" : i.elements.user.style.display = "block", document.body.style.overflow = "hidden"))
},
g: function() {
n.elements = {
start: document.querySelector("#APIStart"),
container: document.querySelector("#APContainer"),
user: document.querySelector("#APUser"),
selected: document.querySelector("#APSelected"),
waiting: document.querySelector("#APWaiting"),
upgrade: document.querySelector("#APUpgrade"),
card: document.querySelector("#APCard")
}
},
S: function(t) {
let e = n.elements.card.cloneNode(!0);
if (e.querySelector(".APImage > img").src = t.image, e.id = t.id, e.dataset.data = JSON.stringify(t.data), t._ && t.data.text && (t.title = JSON.stringify(t.data.text.slice(0, 100).replace(/"/g, "").replace(/(?:\r\n|\r|\n)/g, " ")).substr(1).slice(0, -1).replace(/(\\ud83a|\\ud83b|\\ud83c|\\uD83d|\\ud83e|\\ud83f|\\ud83g)/gi, "").slice(0, 100), t.note = JSON.stringify(t.data.text.slice(0, 500).replace(/"/g, "").replace(/(?:\r\n|\r|\n)/g, " ")).substr(1).slice(0, -1).replace(/(\\ud83a|\\ud83b|\\ud83c|\\uD83d|\\ud83e|\\ud83f|\\ud83g)/gi, "").slice(0, 500)), document.querySelector("#APCredit").checked || t.L) {
const e = "\n\nCredits @" + t.data.owner.username;
t.note = t.note ?? "", t.note = JSON.stringify(t.note.slice(0, 500 - (e.length + 1)).replace(/"/g, "").replace(/(?:\r\n|\r|\n)/g, " ")).substr(1).slice(0, -1).replace(/(\\ud83a|\\ud83b|\\ud83c|\\uD83d|\\ud83e|\\ud83f|\\ud83g)/gi, "").slice(0, 500 - (e.length + 1)), t.note += e
}
return e.querySelector(".APTitle > input").value = t.title || "", e.querySelector(".APNote > textarea").value = t.note || "", e.querySelector(".APLink > input").value = t.C && t.link || "", e.style.display = null, e.querySelector(".CSave").addEventListener("click", (function() {
n.T(e)
})), e.querySelector(".CDelete").addEventListener("click", (function() {
e.remove()
})), e.querySelectorAll(".APCDuplicate").forEach(t => {
t.addEventListener("click", () => {
n.duplicate(t)
})
}), e
},
v: function() {
n.elements.waiting = document.querySelector("#APWaiting"), document.querySelector("#APBack").addEventListener("click", (function() {
n.elements.container.style.display = null, document.body.style.overflow = null, document.querySelector("#APWaiting").style.display = null
})), n.elements.selected.addEventListener("click", (function() {
let t = n.elements.waiting.querySelector("#APWCards");
t.innerHTML = "", document.querySelectorAll(".APSelected").forEach(async e => {
const i = e.href.replace("https://www.instagram.com/p/", "").replace("/", ""),
a = await n.N(i);
if (await n.k(), a.data.shortcode_media.hasOwnProperty("edge_sidecar_to_children")) a.data.shortcode_media.edge_sidecar_to_children.edges.forEach(e => {
let i = n.S({
_: !0,
C: !0,
id: e.node.id,
image: e.node.display_url,
link: "https://www.instagram.com/p/" + a.data.shortcode_media.shortcode,
data: {
owner: a.data.shortcode_media.owner,
parent_id: a.data.shortcode_media.id,
shortcode: a.data.shortcode_media.shortcode,
text: a.data.shortcode_media.edge_media_to_caption.edges[0] ? a.data.shortcode_media.edge_media_to_caption.edges[0].node.text : "",
taken_at_timestamp: a.data.shortcode_media.taken_at_timestamp
}
});
t.insertBefore(i, null)
});
else {
let e = n.S({
_: !0,
C: !0,
id: a.data.shortcode_media.id,
image: a.data.shortcode_media.display_url,
link: "https://www.instagram.com/p/" + a.data.shortcode_media.shortcode,
data: {
owner: a.data.shortcode_media.owner,
parent_id: a.data.shortcode_media.id,
shortcode: a.data.shortcode_media.shortcode,
text: a.data.shortcode_media.edge_media_to_caption.edges[0] ? a.data.shortcode_media.edge_media_to_caption.edges[0].node.text : "",
taken_at_timestamp: a.data.shortcode_media.taken_at_timestamp
}
});
t.insertBefore(e, null)
}
})
})), document.querySelector("#APWLoad span").addEventListener("click", (async function(t) {
try {
if (n.elements.waiting.querySelector(".APLoading").style.display = "block", "tags" == n.id) await n.U();
else {
let t = await n.p(n.hash, n.id, 50, n.u);
if ("ok" == t.status) {
let e = t.data.user.edge_owner_to_timeline_media.edges;
t.data.user.edge_owner_to_timeline_media.page_info.has_next_page ? n.u = t.data.user.edge_owner_to_timeline_media.page_info.end_cursor : n.u = "";
let i = document.querySelector("#APDesc").checked,
a = document.querySelector("#APLink").checked,
o = n.elements.waiting.querySelector("#APWCards");
e.forEach(t => {
if (t.node.hasOwnProperty("edge_sidecar_to_children")) t.node.edge_sidecar_to_children.edges.forEach(e => {
let c = n.S({
_: i,
C: a,
id: e.node.id,
image: e.node.display_url,
link: "https://www.instagram.com/p/" + t.node.shortcode,
data: {
owner: t.node.owner,
parent_id: t.node.id,
shortcode: t.node.shortcode,
text: t.node.edge_media_to_caption.edges[0] ? t.node.edge_media_to_caption.edges[0].node.text : "",
taken_at_timestamp: t.node.taken_at_timestamp
}
});
o.insertBefore(c, null)
});
else {
let e = n.S({
_: i,
C: a,
id: t.node.id,
image: t.node.display_url,
link: "https://www.instagram.com/p/" + t.node.shortcode,
data: {
owner: t.node.owner,
parent_id: t.node.id,
shortcode: t.node.shortcode,
text: t.node.edge_media_to_caption.edges[0] ? t.node.edge_media_to_caption.edges[0].node.text : "",
taken_at_timestamp: t.node.taken_at_timestamp
}
});
o.insertBefore(e, null)
}
})
} else alert("Error")
}
let t = document.querySelectorAll(".APCard").length;
document.querySelectorAll(".APCLoaded").forEach(e => {
e.innerText = t
}), n.elements.waiting.querySelector(".APLoading").style.display = null
} catch (t) {
n.elements.waiting.querySelector(".APLoading").style.display = null, alert(t.message)
}
})), document.querySelector("#APWDAll").addEventListener("click", (function(t) {
("starter" == a.plan.id || "growth" == a.plan.id) && a.plan.all > 10000 ? a.D("#limit") : (document.querySelector("#APWCards").innerHTML = "", document.querySelectorAll(".APCLoaded").forEach(t => {
t.innerText = 0
}))
})), document.querySelector("#APWSAll").addEventListener("click", (function(t) {
("starter" == a.plan.id || "growth" == a.plan.id) && a.plan.all > 10000 ? a.D("#limit") : document.querySelectorAll("#APWCards .CSave").forEach(t => {
t.click()
})
}))
},
T: async function(t) {
if (("starter" == a.plan.id || "growth" == a.plan.id) && a.plan.all > 10000) return void a.D("#limit");
let i = t.querySelector(".APLoading");
try {
i.style.display = "block";
let o = JSON.parse(t.dataset.data),
c = t.querySelector(".APBoard > select"),
l = {
type: "instagram",
viewer: n.viewer,
owner: o.owner,
parent_id: o.parent_id,
text: o.text,
shortcode: o.shortcode,
taken_at_timestamp: o.taken_at_timestamp,
image: {
id: t.id,
board: {
id: c.value,
name: c.options[c.selectedIndex].text
},
url: t.querySelector(".APImage > img").src,
title: t.querySelector(".APTitle > input").value,
note: t.querySelector(".APNote > textarea").value,
link: t.querySelector(".APLink > input").value
}
};
if ("" == l.image.title) throw "Title is required!";
let r = await e.fetch("https://autopinner.com/pins/save", {
method: "POST",
body: JSON.stringify({
pin: l
})
}, a.token);
if (!r.status) throw r.message;
a.O(r.plan), t.remove()
} catch (t) {
t.message ? alert(t.message) : "upgrade_up" == t ? a.D("#up") : "upgrade_limit" == t ? a.D("#limit") : alert(t), i.style.display = null
}
},
duplicate: function(t) {
let e = t.parentElement.classList.value,
n = document.querySelectorAll("." + e);
if ("APBoard" == e) {
let e = t.parentElement.querySelector("select").value;
n.forEach((function(t, n) {
n > 0 && (t.querySelector("select").value = e)
}))
} else if ("APNote" == e) {
let e = t.parentElement.querySelector("textarea").value;
n.forEach((function(t, n) {
n > 0 && (t.querySelector("textarea").value = e)
}))
} else {
let e = t.parentElement.querySelector("input").value;
n.forEach((function(t, n) {
n > 0 && (t.querySelector("input").value = e)
}))
}
},
U: async function() {
try {
let t = n.elements.waiting.querySelector("#APWCards"),
e = await n.I(location.pathname.match(/(?<=\/explore\/tags\/).*?(?=\/)/)[0]);
document.querySelectorAll("#APWCards .APCard").length > 0 ? (n.next_max_id = e.next_max_id, n.next_page = e.next_page) : e.sections = e.sections.concat(n.A);
let i = document.querySelector("#APDesc").checked,
a = document.querySelector("#APLink").checked;
e.sections.forEach((function(e) {
"clips" != e.feed_type && e.layout_content.medias.forEach((function(e) {
if (e.media.caption)
if (e.media.image_versions2) {
let o = n.S({
_: i,
C: a,
id: e.media.pk,
image: e.media.image_versions2.candidates[0].url,
link: "https://www.instagram.com/p/" + e.media.code,
data: {
owner: {
id: e.media.user.pk,
username: e.media.user.username
},
parent_id: e.media.pk,
shortcode: e.media.code,
text: e.media.caption.text,
taken_at_timestamp: e.media.taken_at
}
});
t.insertBefore(o, null)
} else e.media.carousel_media.forEach((function(o) {
let c = n.S({
_: i,
C: a,
id: o.pk,
image: o.image_versions2.candidates[0].url,
text: e.media.caption.text,
data: {
owner: {
id: e.media.user.pk,
username: e.media.user.username
},
parent_id: e.media.pk,
shortcode: e.media.code,
link: "https://www.instagram.com/p/" + e.media.code,
taken_at_timestamp: e.media.taken_at
}
});
t.insertBefore(c, null)
}))
}))
}))
} catch (t) {
console.log(t), alert(t.message)
}
},
N: async function(t) {
if (null == n.i) {
const t = await fetch("https://www.instagram.com/static/bundles/es6/Consumer.js/19115f54366c.js").then(t => t.text());
n.i = t.match(/(?<=\;const E=").*?(?=\")/g)
}
return await fetch("https://www.instagram.com/graphql/query/?query_hash=" + n.i + '&variables={"shortcode":"' + t + '"}').then(t => t.json())
},
p: async function(t, e, n, i) {
return await fetch("https://www.instagram.com/graphql/query/?query_hash=" + t + '&variables={"id":"' + e + '","first":' + n + ',"after":"' + i + '"}').then(t => t.json())
},
I: async function(t) {
let e = new URLSearchParams;
return document.querySelectorAll("#APWCards .APCard").length > 0 && (e.append("include_persistent", 0), e.append("max_id", n.next_max_id), e.append("page", n.next_page), e.append("surface", "grid"), e.append("tab", "recent")), await fetch("https://i.instagram.com/api/v1/tags/" + t + "/sections/", {
credentials: "include",
method: "POST",
headers: {
"x-csrftoken": n.s,
"x-ig-app-id": n.l,
"Content-Type": "application/x-www-form-urlencoded"
},
body: e
}).then(t => t.json())
},
h: async function() {
let t = await e.fetch("https://autopinner.com/pins/instagram/" + n.id, null, a.token);
if (t.status) {
a.O(t.plan), n.boards = t.boards, n.m = t.ids, n.viewer = t.viewer;
let e = n.elements.card.querySelector(".APBoard > select");
e.innerText = null, n.boards.forEach(t => {
let n = document.createElement("option");
n.value = t.id, n.text = t.name, e.add(n, null)
}), document.querySelector("#dmsSynchronized").innerText = n.m.length.toLocaleString() + "/" + n.count.toLocaleString()
} else alert(JSON.stringify(t.message))
},
R: '<svg xmlns="http://www.w3.org/2000/svg" version="1.0" width="24px" height="24px" viewBox="0 0 1280.000000 640.000000">\n <g transform="translate(0.000000,640.000000) scale(0.100000,-0.100000)" fill="#FFFFFF" stroke="none">\n <path d="M9638 6075 c-772 -93 -1504 -467 -2317 -1184 -198 -174 -334 -303 -657 -624 -230 -229 -264 -258 -281 -249 -11 6 -100 93 -199 194 -1144 1171 -1886 1664 -2745 1822 -560 103 -1141 38 -1669 -186 -885 -376 -1533 -1167 -1714 -2093 -41 -207 -51 -318 -51 -565 0 -392 54 -719 176 -1065 338 -964 1145 -1627 2164 -1779 634 -95 1337 26 1957 335 243 121 448 250 703 441 321 239 556 450 1061 950 176 175 327 318 334 318 8 0 77 -66 154 -146 172 -179 592 -584 770 -743 820 -731 1442 -1055 2226 -1163 58 -8 194 -12 350 -12 213 0 279 4 400 23 650 100 1205 379 1659 832 457 457 742 1045 823 1699 19 155 16 563 -6 720 -78 561 -275 1067 -568 1457 -95 128 -294 332 -425 435 -364 290 -837 486 -1378 570 -172 26 -594 34 -767 13z m-6331 -1199 c336 -71 676 -233 1010 -481 119 -88 297 -234 413 -339 146 -133 880 -850 880 -860 0 -16 -640 -649 -795 -788 -492 -438 -947 -715 -1375 -839 -202 -58 -321 -74 -565 -74 -190 0 -235 3 -334 23 -590 119 -1022 504 -1210 1077 -160 489 -130 953 90 1385 252 496 706 824 1266 915 63 10 146 13 293 10 172 -3 225 -8 327 -29z m6863 19 c327 -46 605 -171 841 -378 439 -384 649 -1063 517 -1677 -134 -625 -615 -1131 -1229 -1295 -148 -39 -279 -55 -454 -55 -310 0 -559 62 -870 215 -327 160 -642 391 -1037 761 -248 232 -743 719 -746 734 -3 16 466 495 668 681 682 630 1221 933 1800 1014 130 18 382 18 510 0z"/>\n </g>\n </svg>'
},
i = {
token: null,
boards: [],
viewer: null,
B: !1,
elements: {},
F: null,
J: !1,
init: function() {
i.viewer = JSON.parse(document.querySelector("#__PWS_DATA__").innerText).props.context.user, JSON.parse(document.querySelector("#__PWS_DATA__").innerText).isAuthenticated && (i.token = i.W(), i.start())
},
start: async function() {
let t = await fetch("https://autopinner.com/pins/html/pinterest");
if (t.ok) {
let e = document.createElement("div");
e.innerHTML = await t.text(), document.body.appendChild(e), i.g(), i.v(), i.elements.start.style.display = "block", await a.init(), a.token && await i.H()
}
},
M: async function() {
if (!i.B) return;
if ("starter" == a.plan.id && parseInt(a.plan.pinned) >= 10000) return void a.D("#limit");
let t = await e.fetch("https://autopinner.com/pins/topin", null, a.token);
if (t.status && t.pin.hasOwnProperty("_id")) {
a.O(t.plan), i.elements.start.querySelector("svg").classList.add("APRotating");
let n = new Image;
n.onload = function() {
let n = i.elements.menu.querySelector("#APAStartPinStart").value;
n = isNaN(n) ? 0 : parseInt(n);
let o = i.elements.menu.querySelector("#APAStartPinEnd").value;
o = isNaN(o) ? 0 : parseInt(o);
let c = Math.floor(Math.random() * (o - n) + n),
l = 0;
i.F = setInterval((function() {
l >= c && (clearInterval(i.F), i.$(t.pin, async n => {
t.pin.response = n.resource_response.data;
let o = await e.fetch("https://autopinner.com/pins/" + t.pin._id, {
method: "PUT",
body: JSON.stringify({
status: "finish",
result: n.resource_response.data
})
}, a.token);
o.status ? (a.O(o.plan), i.elements.start.querySelector("svg").classList.remove("APRotating"), document.querySelector("#APStartText").innerHTML = o.count + "&nbsp;to&nbsp;pin", i.M()) : alert(o.message)
})), document.querySelector("#APStartText").innerHTML = "Pinning&nbsp;after&nbsp;" + (c - l) + "&nbsp;seconds", l++
}), 1e3)
}, n.onerror = async function() {
if (t.pin.hasOwnProperty("_id")) {
"instagram" == t.pin.type && i.q("Account : <a href='https://www.instagram.com/" + t.pin.owner.username + "' target='_blank'>" + t.pin.owner.username + "</a><br>This image can't be pinned, please resave it!<br><a href='https://www.instagram.com/p/" + t.pin.shortcode + "' target='_blank'>https://www.instagram.com/p/" + t.pin.shortcode + "</a>"), i.elements.start.querySelector("svg").classList.remove("APRotating");
let n = await e.fetch("https://autopinner.com/pins/" + t.pin._id, {
method: "DELETE",
body: JSON.stringify({
id: "all"
})
}, a.token);
n.status ? (a.O(t.plan), document.querySelector("#APStartText").innerHTML = n.count + "&nbsp;to&nbsp;pin", i.M()) : alert(n.message)
}
}, n.src = "https://autopinner.com/pins/image/" + t.pin._id + "_n"
} else alert(t.message)
},
k: async function(t) {
i.elements.container.querySelectorAll(".hidden").forEach(t => {
"APAccount" != t.id && t.classList.remove("hidden")
}), i.elements.container.style.display = "block", i.elements[t].style.display = "block", document.body.style.overflow = "hidden"
},
j: function() {
for (elem in i.elements) - 1 === ["upgrade", "start", "account"].indexOf(elem) && (i.elements[elem].style.display = "none");
document.body.style.overflow = null
},
g: function() {
i.elements = {
start: document.querySelector("#dmsStart"),
container: document.querySelector("#APContainer"),
user: document.querySelector("#APUser"),
alert: document.querySelector("#APAlert"),
menu: document.querySelector("#APMenu"),
bulkpin: document.querySelector("#APBulkpin"),
waiting: document.querySelector("#APWaiting"),
account: document.querySelector("#APAccount"),
upgrade: document.querySelector("#APUpgrade"),
affiliate: document.querySelector("#APAffiliate"),
card: document.querySelector("#APCard")
}
},
v: function() {
if (i.elements.start.addEventListener("click", (async function() {
a.verify() && (i.B && (clearInterval(i.F), i.elements.start.querySelector("svg").classList.remove("APRotating"), i.H()), i.B = !1, i.k("menu"))
})), i.elements.container.querySelectorAll(".APClose").forEach((function(t) {
t.addEventListener("click", (function() {
i.j()
}))
})), i.elements.container.querySelectorAll(".APBack").forEach(t => {
t.addEventListener("click", (function() {
this.parentElement.parentElement.style.display = null, i.elements.container.querySelectorAll(".hidden").forEach(t => {
"APAccount" != t.id && (t.classList.remove("hidden"), t.querySelector(".APLoading").style.display = null)
})
}))
}), i.elements.menu.querySelector("#APLOut").addEventListener("click", (async function() {
await e.data("remove", ["APAUTH"]), a.token = null, i.j()
})), i.elements.menu.querySelector("#APASynch").addEventListener("click", (async function() {
if (i.elements.menu.querySelector(".APLoading").style.display = "block", await i.V()) try {
let t = await e.fetch("https://autopinner.com/pins/boards", {
method: "POST",
body: JSON.stringify({
viewer: i.viewer,
boards: i.boards
})
}, a.token);
t.status ? (alert("Successfully synchronized!"), a.O(t.plan), i.elements.menu.querySelector(".APLoading").style.display = null) : alert(t.message)
} catch (t) {
console.log("err", t), alert(t)
}
})), i.elements.menu.querySelector("#APAStartPinBtn").addEventListener("click", (function() {
i.B = !0, i.j(), i.M()
})), i.elements.menu.querySelector("#APABulkpin").addEventListener("click", (async function() {
i.elements.menu.querySelector(".APLoading").style.display = "block", await i.V() && (i.elements.menu.classList.add("hidden"), i.elements.bulkpin.style.display = "block")
})), i.elements.bulkpin.querySelector("#APAAddImg").addEventListener("click", (function() {
"starter" == a.plan.id && a.plan.pinned + a.plan.waiting >= 10000 ? a.D("#limit") : i.elements.bulkpin.querySelector("#APAddFiles").click()
})), window.File && window.FileList && window.FileReader) {
let t = i.elements.bulkpin.querySelector("#APAddFiles");
null !== t && t.addEventListener("change", (function(e) {
let n = e.target.files,
o = i.elements.bulkpin.querySelector("#APBCards");
for (let t = 0; t < n.length; t++) {
if ("starter" == a.plan.id && a.plan.pinned + a.plan.waiting + t > 10000) {
a.D("#limit");
break
}
let e = n[t];
if (!e.type.match("image")) continue;
let c = new FileReader;
c.addEventListener("load", (function(t) {
let n = t.target,
a = i.elements.card.cloneNode(!0);
a.removeAttribute("id"), a.querySelector(".APImage > img").src = n.result, a.dataset.id = e.name, a.style.display = null, o.insertBefore(a, null), a.querySelector(".CSave").addEventListener("click", (function(t) {
i.T(a)
})), a.querySelector(".CDelete").addEventListener("click", (function(t) {
a.remove()
})), a.querySelectorAll(".APCDuplicate").forEach(t => {
t.addEventListener("click", () => {
i.duplicate(t)
})
})
})), c.readAsDataURL(e)
}
t.value = null
}))
} else alert("Your browser does not support File API"), console.log("Your browser does not support File API");
i.elements.bulkpin.querySelector("#APBSAll").addEventListener("click", (function() {
i.elements.bulkpin.querySelectorAll("#APBCards .CSave").forEach((function(t) {
t.click()
}))
})), i.elements.bulkpin.querySelector("#APBDAll").addEventListener("click", (function() {
i.elements.bulkpin.querySelectorAll(".APCard").forEach(t => t.remove())
})), i.elements.menu.querySelector("#APAWaiting").addEventListener("click", (async function() {
if (i.elements.menu.querySelector(".APLoading").style.display = "block", await i.V()) {
i.elements.menu.classList.add("hidden"), i.elements.waiting.style.display = "block";
let t = await e.fetch("https://autopinner.com/pins/", null, a.token);
a.O(t.plan);
let n = i.elements.waiting.querySelector("#APWCards");
n.innerHTML = "", t.pins.forEach(t => {
if (t.data && t.data.images) t.data.images.forEach((o, c) => {
let l = i.elements.card.cloneNode(!0);
l.id = o.id, l.querySelector(".APImage > img").src = "https://autopinner.com/pins/image/" + t._id + "_" + c, l.querySelector(".APBoard > select").value = o.board.id, l.querySelector(".APTitle > input").value = o.title, l.querySelector(".APNote > textarea").value = o.note, l.querySelector(".APLink > input").value = o.link, l.dataset.name = o.id, l.dataset.id = t._id, l.style.display = null, n.insertBefore(l, null), l.querySelector(".CSave").addEventListener("click", (async function(n) {
let i = l.querySelector(".APLoading");
i.style.display = "block";
let o = l.querySelector(".APBoard > select"),
r = {
id: c,
board: {
id: o.value,
name: o.options[o.selectedIndex].text
},
title: l.querySelector(".APTitle > input").value,
note: l.querySelector(".APNote > textarea").value,
link: l.querySelector(".APLink > input").value
};
if ("" == r.title) throw "Title is required!";
let s = await e.fetch("https://autopinner.com/pins/" + t._id, {
method: "PUT",
body: JSON.stringify(r)
}, a.token);
s.status || alert(s.message), i.style.display = null
})), l.querySelector(".CDelete").addEventListener("click", (async function(n) {
if (!i.J && !confirm("Are you sure ?")) return;
l.querySelector(".APLoading").style.display = "block";
let c = await e.fetch("https://autopinner.com/pins/" + t._id, {
method: "DELETE",
body: JSON.stringify({
id: o.id
})
}, a.token);
c.status ? (document.querySelector("#APStartText").innerHTML = c.count + "&nbsp;to&nbsp;pin", l.remove()) : (l.querySelector(".APLoading").style.display = null, alert(c.message)), i.J && 0 == document.querySelectorAll("#APWCards .APCard").length && (i.J = !1)
})), l.querySelectorAll(".APCDuplicate").forEach(t => {
t.addEventListener("click", () => {
i.duplicate(t)
})
})
});
else {
let o = i.elements.card.cloneNode(!0);
o.id = "_" + t._id, o.querySelector(".APImage > img").src = "https://autopinner.com/pins/image/" + t._id + "_n", o.querySelector(".APBoard > select").value = t.image.board.id, o.querySelector(".APTitle > input").value = t.image.title, o.querySelector(".APNote > textarea").value = t.image.note, o.querySelector(".APLink > input").value = t.image.link, o.dataset.id = t.image.id, o.style.display = null, n.insertBefore(o, null), o.querySelector(".CSave").addEventListener("click", (function(e) {
i.T(o, t._id)
})), o.querySelector(".CDelete").addEventListener("click", (async function(n) {
if (!i.J && !confirm("Are you sure ?")) return;
o.querySelector(".APLoading").style.display = "block";
let c = await e.fetch("https://autopinner.com/pins/" + t._id, {
method: "DELETE"
}, a.token);
c.status ? (document.querySelector("#APStartText").innerHTML = c.count + "&nbsp;to&nbsp;pin", o.remove()) : (o.querySelector(".APLoading").style.display = null, alert(c.message)), i.J && 0 == document.querySelectorAll("#APWCards .APCard").length && (i.J = !1)
})), o.querySelectorAll(".APCDuplicate").forEach(t => {
t.addEventListener("click", () => {
i.duplicate(t)
})
})
}
})
}
})), i.elements.waiting.querySelector("#APWSAll").addEventListener("click", (function() {
i.elements.waiting.querySelectorAll("#APWCards .CSave").forEach((function(t) {
t.click()
}))
})), i.elements.waiting.querySelector("#APWDAll").addEventListener("click", (function() {
confirm("Are you sure you want to delete them all?") && (i.J = !0, i.elements.waiting.querySelectorAll("#APWCards .CDelete").forEach((function(t) {
t.click()
})))
})), i.elements.menu.querySelector("#APAAcc").addEventListener("click", (async function() {
i.elements.menu.querySelector(".APLoading").style.display = "block";
let t = await e.fetch("https://autopinner.com/subscription", null, a.token),
n = i.elements.account.querySelector("#APModules");
n.innerHTML = "";
let o = document.createElement("h1");
o.innerText = "Subscriptions", n.appendChild(o), t.status ? (document.querySelector("#APFUEmail").value = t.user.email, document.querySelector("#APFUFName").value = t.user.prenom ? t.user.prenom : t.user.first_name, document.querySelector("#APFULName").value = t.user.nom ? t.user.nom : t.user.last_name, document.querySelectorAll("#APADetails input").forEach((function(t) {
t.classList.remove("error")
})), t.modules.forEach(t => {
let i = document.createElement("div");
i.classList.add("module"), i.id = t._id, i.innerHTML = `\n\t\t\t\t\t<div class="details">\n\t\t\t\t\t\t<div class="label">id</div>:<div>${t._id}</div>\n\t\t\t\t\t\t<div class="label">Status</div>:<div class="${"ACTIVE"==t.status?"active":"canceled"}">${t.status}</div>\n\t\t\t\t\t\t<div class="label">Name</div>:<div>${t.name}</div>\n\t\t\t\t\t\t<div class="label">Plan</div>:<div>${t.plan}</div>\n\t\t\t\t\t\t<div class="label">Periode</div>:<div>${t.periode}</div>\n\t\t\t\t\t\t<div class="label">Price</div>:<div>${t.price}</div>\n\t\t\t\t\t\t<div class="label">Valid to</div>:<div>${t.valid_to}</div>\n\t\t\t\t\t</div>`, "Cancelled" != t.status && "CANCELLED" != t.status ? (i.innerHTML += `<div class="cancel" id="${t._id}">Cancel</div>`, i.querySelector(".cancel").addEventListener("click", (async function(t) {
const n = await e.fetch("https://autopinner.com/subscription/cancel/" + t.target.id, {
method: "PUT"
}, a.token);
console.log(n)
}))) : i.innerHTML += '<a class="renew" href="https://autopinner.com/payment" target="_blank">Renew</a>', n.appendChild(i)
}), i.elements.menu.classList.add("hidden"), i.elements.account.classList.remove("hidden")) : (alert(t.message), i.elements.menu.querySelector(".APLoading").style.display = null)
})), document.querySelector("#APUDSave").addEventListener("click", (async function(t) {
if (!confirm("Are you sure you want to update your account info ?")) return;
const n = document.querySelector("#APFUEmail"),
o = document.querySelector("#APFUFName"),
c = document.querySelector("#APFULName");
if ("" == n.value) return void n.classList.add("error");
if (n.classList.remove("error"), "" == o.value) return void o.classList.add("error");
if (o.classList.remove("error"), "" == c.value) return void c.classList.add("error");
c.classList.remove("error");
const l = document.querySelector("#APADetails .APLoading");
l.style.display = "block";
const r = await e.fetch("https://autopinner.com/users/profile", {
method: "POST",
body: JSON.stringify({
email: n.value,
fname: o.value,
lname: c.value
})
}, a.token);
r.status || i.q(r.message), l.style.display = null
})), document.querySelector("#APUPSave").addEventListener("click", (async function(t) {
if (!confirm("Are you sure you want to update your password ?")) return;
const n = document.querySelector("#APFUOPassword"),
o = document.querySelector("#APFUNPassword"),
c = document.querySelector("#APFUCPassword");
if ("" == n.value) return void n.classList.add("error");
if (n.classList.remove("error"), "" == o.value) return void o.classList.add("error");
if (o.classList.remove("error"), "" == c.value) return void c.classList.add("error");
c.classList.remove("error");
const l = document.querySelector("#APADetails .APLoading");
l.style.display = "block";
const r = await e.fetch("https://autopinner.com/users/password", {
method: "POST",
body: JSON.stringify({
o: n.value,
n: o.value,
c: c.value
})
}, a.token);
r.status ? n.value = o.value = c.value = "" : i.q(r.message), l.style.display = null
})), i.elements.account.querySelector("#APABack").addEventListener("click", (function() {
i.elements.account.classList.add("hidden"), i.elements.menu.classList.remove("hidden"), i.elements.menu.querySelector(".APLoading").style.display = null
})), document.querySelector("#APAAff").addEventListener("click", (async function() {
i.elements.menu.classList.add("hidden");
const t = i.elements.affiliate.querySelector(".APLoading");
i.elements.affiliate.style.display = "block", t.style.display = "block";
const n = await e.fetch("https://autopinner.com/affiliation", null, a.token);
n.status ? (i.elements.affiliate.querySelector("#APALink").innerText = "https://autopinner.com/a/" + n.code, i.elements.affiliate.querySelector("#APACEmail input").value = n.email, i.elements.affiliate.querySelector("#APACMonths").innerHTML = `\n\t\t\t\t<div class="APAMonth">\n\t\t\t\t\t<h1>Last Month</h1>\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<div>Created</div>:<div>${n.data.lastMonth.Created}</div>\n\t\t\t\t\t\t<div>Canceled</div>:<div>${n.data.lastMonth.Canceled}</div>\n\t\t\t\t\t\t<div>Paid</div>:<div>${n.data.lastMonth.Paid}</div>\n\t\t\t\t\t\t<div>Refunded</div>:<div>${n.data.lastMonth.Refunded}</div>\n\t\t\t\t\t\t<div>Commission</div>:<div>${n.data.lastMonth.Commission}</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div class="APAMonth">\n\t\t\t\t\t<h1>This Month</h1>\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<div>Created</div>:<div>${n.data.thisMonth.Created}</div>\n\t\t\t\t\t\t<div>Canceled</div>:<div>${n.data.thisMonth.Canceled}</div>\n\t\t\t\t\t\t<div>Paid</div>:<div>${n.data.thisMonth.Paid}</div>\n\t\t\t\t\t\t<div>Refunded</div>:<div>${n.data.thisMonth.Refunded}</div>\n\t\t\t\t\t\t<div>Commission</div>:<div>${n.data.thisMonth.Commission}</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t`) : alert(n.message), t.style.display = null
})), i.elements.affiliate.querySelector("#APACEmail .button").addEventListener("click", (async function() {
const t = i.elements.affiliate.querySelector("#APACEmail input").value;
if ("" == t) return alert("The email is empty");
if (0 == /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/.test(t)) return alert("Email not valid");
const n = await e.fetch("https://autopinner.com/affiliation", {
method: "PUT",
body: JSON.stringify({
email: t
})
}, a.token);
n.status ? alert("The email has been successfully saved!") : alert(n.error.message)
})), i.elements.affiliate.querySelector("#APACLink .button").addEventListener("click", (function() {
const t = i.elements.affiliate.querySelector("#APACLink #APALink").innerText;
navigator.clipboard.writeText(t).then((function() {
alert("The link has been successfully copied!")
}), (function(t) {
alert("Could not copy link: ", t)
}))
}))
},
duplicate: function(t) {
let e = t.parentElement.classList.value,
n = document.querySelectorAll("." + e);
if ("APBoard" == e) {
let e = t.parentElement.querySelector("select").value;
n.forEach((function(t, n) {
n > 0 && (t.querySelector("select").value = e)
}))
} else if ("APNote" == e) {
let e = t.parentElement.querySelector("textarea").value;
n.forEach((function(t, n) {
n > 0 && (t.querySelector("textarea").value = e)
}))
} else {
let e = t.parentElement.querySelector("input").value;
n.forEach((function(t, n) {
n > 0 && (t.querySelector("input").value = e)
}))
}
},
W: function() {
let t = ("; " + document.cookie).split("; csrftoken=");
return 2 == t.length ? t.pop().split(";").shift() : ""
},
H: async function() {
try {
let t = await e.fetch("https://autopinner.com/pins/topin", null, a.token);
t.status ? (a.O(t.plan), document.querySelector("#APStartText").innerHTML = t.count + "&nbsp;to&nbsp;pin") : alert(t.message)
} catch (t) {
alert(t), console.log(t)
}
},
Y: async function() {
let t = location.origin + '/resource/BoardPickerBoardsResource/get/?source_url=/pin-builder/&data={"options":{"isPrefetch":false,"field_set_key":"board_picker"},"context":{}}';
try {
return await fetch(t).then(async t => {
if (t.ok) {
let {
resource_response: e
} = await t.json();
return {
status: !0,
boards: e.data.all_boards
}
} {
let {
body: e
} = await t.json();
return {
status: !1,
message: e.response.error.message
}
}
})
} catch (t) {
return alert(t)
}
},
V: async function() {
let t = await i.Y(),
e = "You must create at least one board to continue!";
if (t.status ? i.boards = t.boards : e = t.message, !t.status || i.boards.length < 1) return i.elements.menu.classList.add("hidden"), i.elements.alert.style.display = "block", i.elements.alert.querySelector("#APMessage").innerHTML = e, !1; {
let t = i.elements.card.querySelector(".APBoard > select");
return t.innerText = null, i.boards.forEach(e => {
let n = document.createElement("option");
n.value = e.id, n.text = e.name, t.add(n, null)
}), !0
}
},
K: function(t, e) {
for (var n = t.split(","), i = n[0].match(/:(.*?);/)[1], a = atob(n[1]), o = a.length, c = new Uint8Array(o); o--;) c[o] = a.charCodeAt(o);
return new File([c], e, {
type: i
})
},
T: async function(t, n = null) {
if ("starter" == a.plan.id && a.plan.pinned + a.plan.waiting >= 10000) return void a.D("#limit");
let o = t.querySelector(".APLoading");
try {
o.style.display = "block";
let c = t.querySelector(".APBoard > select"),
l = {
type: "site",
viewer: i.viewer,
image: {
id: t.dataset.id,
board: {
id: c.value,
name: c.options[c.selectedIndex].text
},
url: t.querySelector(".APImage > img").src,
title: t.querySelector(".APTitle > input").value,
note: t.querySelector(".APNote > textarea").value,
link: t.querySelector(".APLink > input").value
}
};
if ("" == l.image.title) throw "Title is required!";
if (n) {
let t = await e.fetch("https://autopinner.com/pins/" + n, {
method: "PUT",
body: JSON.stringify({
image: l.image,
status: "up"
})
}, a.token);
if (o.style.display = null, !t.status) throw t.message;
a.O(t.plan)
} else {
let n = i.K(t.querySelector(".APImage > img").src, t.dataset.id),
o = new FormData;
o.append("img", n);
let c = await e.fetch(location.origin + "/upload-image/", {
method: "POST",
headers: {
"x-csrftoken": i.token
},
body: o
});
if (!c.image_url) return;
l.image.url = c.image_url;
let r = await e.fetch("https://autopinner.com/pins/save", {
method: "POST",
body: JSON.stringify({
pin: l
})
}, a.token);
if (!r.status) throw r.message;
a.O(r.plan), t.remove()
}
} catch (t) {
console.log(t), t.message ? alert(t.message) : alert(t), o.style.display = null
}
},
q: function(t) {
let e = document.querySelector("#APNotifications"),
n = document.createElement("div");
n.classList.add("APNotif"), n.innerHTML = "<div>" + t + '</div><svg height="18" width="18" viewBox="0 0 24 24" aria-hidden="true" role="img" onclick="this.parentElement.remove()"><path d="M15.18 12l7.16-7.16c.88-.88.88-2.3 0-3.18-.88-.88-2.3-.88-3.18 0L12 8.82 4.84 1.66c-.88-.88-2.3-.88-3.18 0-.88.88-.88 2.3 0 3.18L8.82 12l-7.16 7.16c-.88.88-.88 2.3 0 3.18.44.44 1.01.66 1.59.66.58 0 1.15-.22 1.59-.66L12 15.18l7.16 7.16c.44.44 1.01.66 1.59.66.58 0 1.15-.22 1.59-.66.88-.88.88-2.3 0-3.18L15.18 12z"></path></svg>', n.querySelector("svg").addEventListener("click", (function() {
n.remove()
})), e.appendChild(n)
},
$: async function(t, e) {
try {
let n = {
board_id: t.image.board.id,
title: JSON.stringify(t.image.title.slice(0, 100).replace(/"/g, "").replace(/(?:\r\n|\r|\n)/g, " ")).substr(1).slice(0, -1).replace(/(\\ud83a|\\ud83b|\\ud83c|\\uD83d|\\ud83e|\\ud83f|\\ud83g)/gi, "").slice(0, 100),
note: JSON.stringify(t.image.note.slice(0, 500).replace(/"/g, "").replace(/(?:\r\n|\r|\n)/g, " ")).substr(1).slice(0, -1).replace(/(\\ud83a|\\ud83b|\\ud83c|\\uD83d|\\ud83e|\\ud83f|\\ud83g)/gi, "").slice(0, 500),
link: t.image.link,
image_url: "https://autopinner.com/pins/image/" + t._id + "_n"
},
a = await fetch(location.origin + "/resource/PinResource/create/", {
method: "POST",
headers: {
"x-csrftoken": i.token,
Accept: "application/json",
"Content-Type": "application/json"
},
body: JSON.stringify({
source_url: "/pin-builder/",
data: JSON.stringify({
options: {
board_id: n.board_id,
field_set_key: "create_success",
skip_pin_create_log: !0,
description: n.note.trim(),
link: n.link.trim(),
title: n.title.replace(/"/gi, "").trim(),
image_url: n.image_url.trim(),
method: "uploaded",
upload_metric: {
source: "pinner_upload_standalone"
}
},
context: {}
})
})
}).then(t => t.json());
i.elements.start.querySelector("svg").classList.remove("APRotating"), "success" == a.resource_response.status ? e(a) : a.resource_response.error ? a.resource_response.error.hasOwnProperty("message_detail") ? i.q(a.resource_response.error.message_detail) : i.q(a.resource_response.error.message) : alert("Error! Please contact admin!"), console.log("result", a)
} catch (t) {
i.elements.start.querySelector("svg").classList.remove("APRotating"), alert(t.message), console.log("err", t)
}
},
G: function(t) {
t.status && (i.Z = t.next, i.X())
}
};
"pinterest" == location.hostname.split(".")[1] ? (i.init(), window.addEventListener("message", (function(t) {
dataReceived = JSON.parse(t.data), window.top.postMessage(JSON.stringify(dataReceived), "*")
}))) : "instagram" == location.hostname.split(".")[1] && n.init();
var a = {
plan: {},
token: null,
fuid: null,
elements: {},
init: async function() {
if (a.token = (await e.data("get", ["APAUTH"])).APAUTH || null, a.fuid = (await e.data("get", ["APFID"])).APFID || null, a.token && !a.fuid) try {
let t = await e.fetch("https://autopinner.com/subscription", null, a.token);
t.status && (await e.data("set", {
APFID: t.user._id
}), a.fuid = t.user._id)
} catch (t) {
console.log(t)
}
a.g(), a.tt()
},
g: function() {
a.elements = {
user: document.querySelector("#APUser"),
et: document.querySelector("#APUser>.APLoading"),
container: document.querySelector("#APContainer"),
upgrade: document.querySelector("#APCUpgrade")
}
},
tt: function() {
a.elements.user.querySelector("#APLSubmit").addEventListener("click", () => {
a.nt()
}), a.elements.user.querySelector("#APRSubmit").addEventListener("click", () => {
a.it()
}), a.elements.user.querySelector("#APLRecovery").addEventListener("click", () => {
a.elements.user.querySelector("#APLogin").style.display = "none", a.elements.user.querySelector("#APRecovery").style.display = "block"
}), a.elements.user.querySelector("#APReSubmit").addEventListener("click", async () => {
try {
let t = document.querySelector("#APRecovery").querySelector(".APUIError");
t.style.display = null;
const n = document.querySelector("#APRecEmail").value;
if ("" == n) return t.style.display = "block", void(t.innerHTML = "Email is required!");
let i = await e.fetch("https://autopinner.com/users/recovery", {
method: "POST",
body: JSON.stringify({
email: n
})
});
console.log(i), i.status ? alert("Please check your mailbox, an email has been sent to you to enter a new password.") : (t.style.display = "block", t.innerHTML = i.message)
} catch (t) {
console.log(t), errorMessage.style.display = "block", errorMessage.innerHTML = t.message
}
}), a.elements.user.querySelector("#APUHRegistration").addEventListener("click", () => {
a.elements.user.querySelector("#APRecovery").style.display = null, a.elements.user.querySelector("#APUHLogin").classList.remove("APUHSelected"), a.elements.user.querySelector("#APUHRegistration").classList.add("APUHSelected"), a.elements.user.querySelector("#APLogin").style.display = "none", a.elements.user.querySelector("#APRegistration").style.display = "block"
}), a.elements.user.querySelector("#APUHLogin").addEventListener("click", () => {
a.elements.user.querySelector("#APRecovery").style.display = null, a.elements.user.querySelector("#APUHLogin").classList.add("APUHSelected"), a.elements.user.querySelector("#APUHRegistration").classList.remove("APUHSelected"), a.elements.user.querySelector("#APLogin").style.display = "block", a.elements.user.querySelector("#APRegistration").style.display = "none"
}), a.elements.user.querySelector(".APClose").addEventListener("click", (function() {
a.j()
})), a.elements.upgrade.querySelector(".APClose").addEventListener("click", (function(t) {
a.elements.upgrade.classList.add("hidden"), a.elements.upgrade.querySelector("#limit").style.display = null, a.elements.upgrade.querySelector("#up").style.display = null
}))
},
verify: function() {
let t = !0;
return a.token || (t = !1, a.at()), t
},
O: function(t) {
a.plan = t, a.ot()
},
ot: function() {
document.querySelectorAll(".APUpgradeButton").forEach(t => {
"advanced" == a.plan.id || "admin" == a.plan.id ? t.classList.add("APUPHidden") : t.classList.remove("APUPHidden")
})
},
D: function(t) {
e.data("set", {
APLDATE: (new Date).toISOString().slice(0, 10)
}), a.elements.upgrade.querySelector(t).style.display = "block", a.elements.upgrade.classList.remove("hidden")
},
at: function() {
a.elements.container.style.display = "block", a.elements.user.style.display = "block", document.body.style.overflow = "hidden"
},
j: function() {
a.elements.container.style.display = null, a.elements.user.style.display = null, document.body.style.overflow = null
},
nt: async function() {
a.elements.et.style.display = "block";
let t = document.querySelector("#APLogin").querySelector(".APUIError");
t.style.display = null;
let o = {
email: document.querySelector("#APLEmail").value,
password: document.querySelector("#APLPassword").value,
type: "ext"
};
if ("" == o.email || "" == o.password) return t.style.display = "block", t.innerHTML = "Email and password are required!", void(a.elements.et.style.display = null);
let c = await e.fetch("https://autopinner.com/users/login", {
method: "POST",
body: JSON.stringify(o)
});
if (c.status) {
await e.data("set", {
APAUTH: c.token
}), a.token = c.token;
let t = location.origin.split(".")[1];
a.elements.user.style.display = null, a.j(), "pinterest" == t ? await i.H() : "instagram" == t && await n.h(), a.elements.et.style.display = null
} else t.style.display = "block", t.innerHTML = c.message, a.elements.et.style.display = null
},
ct: async function() {
await e.data("remove", ["APAUTH"])
},
it: async function() {
a.elements.et.style.display = "block";
let t = document.querySelector("#APRegistration").querySelector(".APUIError");
t.style.display = null;
try {
let n = {
email: document.querySelector("#APREmail").value,
first_name: document.querySelector("#APRFName").value,
last_name: document.querySelector("#APRLName").value,
password: document.querySelector("#APRPassword").value,
verifPWD: document.querySelector("#APRVPassword").value,
type: "ext"
};
if ("" == n.email) throw "Email is required!\n";
if ("" == n.first_name) throw "First name is required!\n";
if ("" == n.last_name) throw "Last name is required!\n";
if ("" == n.password) throw "Password is required!\n";
if ("" == n.verifPWD) throw "Repeated password is required!\n";
if (n.password != n.verifPWD) throw "Passwords are not the same!\n";
let i = await e.fetch("https://autopinner.com/users/registration", {
method: "POST",
body: JSON.stringify(n)
});
i.status ? (a.fuid || (await e.data("set", {
APFID: i.id
}), a.fuid = i.id), a.elements.user.querySelector("#APUHLogin").click(), document.querySelector("#APLogin #APLEmail").value = n.email, a.elements.et.style.display = null) : (t.style.display = "block", t.innerHTML = i.message, a.elements.et.style.display = null)
} catch (e) {
console.log(e), t.style.display = "block", t.innerHTML = e, a.elements.et.style.display = null
}
}
};

Back to list