Skip to content

Instantly share code, notes, and snippets.

@yume-chan
Created December 25, 2012 14:39
Show Gist options
  • Save yume-chan/4373497 to your computer and use it in GitHub Desktop.
Save yume-chan/4373497 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @id pixivSharePage
// @name Share Pixiv to Google+ for Page
// @version 0.1.177.9
// @namespace simon
// @author Simon Chan
// @description Share pictures from Pixiv to Google+ by just one-click.(for 见图思萌)
// @include http://www.pixiv.net/member_illust.php?*
// @run-at document-end
// ==/UserScript==
var d = document, aC = "appendChild", aE = "addEventListener", cE = "createElement", cK = "checked", cl = "click", cL = "classList", cN = "className", ds = "display", dv = "div", eC = "getElementsByClassName", eT = "getElementsByTagName", f = !1, fe = { "Content-Type": "application/x-www-form-urlencoded;charset=utf-8" }, MO = window.MutationObserver || window.WebKitMutationObserver, rT = "responseText", s = "style", sA = "setAttribute", sp = "span", t = !0, tC = "textContent", xhr = GM_xmlhttpRequest, w = "width", imageContainer = d[eC]("works_display")[0], shareBoxHTML, css, googleCss, shareBox, selectedCircles, balloonContainer, container, limitedButton, publicButton, extendedButton, separator, j, menuShow, background, popup, context, googlePlusAPIs; if (imageContainer) { shareBoxHTML = '<div class="Cla"><a class="g-s-n-aa Wk"><img width="48" height="48" class="Ol Rf gS Bla"><\/a><div class="Fm g-s-Ma-ba Ma Nf"><div class="Je"><div class="xe"><textarea class="sP-ct"><\/textarea><\/div><div class="Sd"><div class="Yj Fg FB"><img class="ev aG"><\/div><div class="KA Xc"><div class="ua-ia"><\/div><div class="ua-ya-gb" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" aria-live="polite"><div class="ua-ya-jb"><\/div><\/div><\/div><\/div><\/div><div class="Ng"><div class="i-j-h-vk i-j-h-Kr"><div class="i-j-h-tb i-j-h-f"><div class="i-j-h-tb-x"><div class="Fs"><div tabindex="0" class="Qm Ti a-f-e a-q-b" role="button" aria-haspopup="true"><div class="a-f-e a-q-b-ca-v"><div class="a-f-e a-q-b-N-v"><div class="a-f-e a-q-b-W"><\/div><div class="a-f-e a-q-b-Ea"> <\/div><\/div><\/div><\/div><div class="Kg" style="display: none;"><\/div><div class="Jg" style="display: none;"><\/div><select class="sP-aS"><option id="0">Photos from posts<\/option><\/select><div class="NJ a-q" role="menu" aria-haspopup="true" style="display: none;"><div class="A9 a-w Wl" role="menuitem"><div class="a-w-x">Disable Comments<\/div><\/div><div class="A9 a-w Yl" role="menuitem"><div class="a-w-x">Lock this post<\/div><\/div><div class="A9 a-w pS-m-dC" role="menuitem"><div class="a-w-x">Set Default Content<\/div><\/div><\/div><\/div><span><\/span><span class="i-j-h-G"><span class="i-j-h-G-n" aria-hidden="true"><span class="i-j-h-G-n-A">+ Add more people<\/span><\/span><input type="text" class="i-j-h-G-G" tabindex="0" role="combobox"><\/span><\/div><div class="i-j-h-Q-rd" style="display: none"><div class="a-q-bl i-j-h-Q c-B i-j-h-Q-Lb" role="listbox"><\/div><\/div><\/div><\/div><div tabindex="0" class="a-f-e c-b c-b-da pm Nl c-b-E" role="button" aria-disabled="true">Share to Google+<\/div><\/div><\/div><div class="ze Dla"><\/div><\/div>', css = "textarea,select{background: none !important;}.sP-mB{margin:auto;width:-moz-fit-content;}.sP-aS{margin-top:-3px;width:140px}.Cla{font: 13px arial,sans-serif;}.sP-ct{border:none;width: 100%;min-width: 100%;max-width: 100%;height: 100%;min-height: 60px;font: 13px arial,sans-serif;padding: 0;}.ev.aG{position: relative !important;max-height: 400px;}.i-j-h-tb.i-j-h-f{margin-right: 0 !important;}.i-j-h-f .i-j-h-Q-rd{height: auto !important;max-height: 160px;}.a-w:hover{border-width: 1px 0px;border-style: dotted;border-color: rgb(238, 238, 238);padding-top: 5px;padding-bottom: 5px;background-color: rgb(238,238, 238) !important;}.sP-pL{position: relative;margin-top: -15px;text-align: center;}.i-j-h-tb-x{background: -moz-linear-gradient(center top, #F6F6F6, white) repeat scroll 00 white;border-color: #BBBBBB #BDBDBD #CECECE;border-image: none;border-left: 1px solid#BDBDBD;border-right: 1px solid #BDBDBD;border-style: solid;border-width: 1px;box-shadow: 0 2px #F7F7F7;padding: 3px;}.i-j-h-G-G{display: none}", GM_addStyle(css), googleCss = ".a-q{-moz-transition:opacity .218s;background:#fff;border:1px solid rgba(0,0,0,.2);box-shadow:0 2px 4px rgba(0,0,0,.2);cursor:default;font-size:13px;margin:0;padding:6px 0;position:absolute;transition:opacity .218s;z-index:20000}.a-f-e{display:inline-block;position:relative}:first-child+html .a-f-e{display:inline}.c-b{border-radius:2px;cursor:default;font-size:11px;font-weight:700;height:27px;line-height:27px;margin-right:16px;min-width:54px;outline:0;padding:0 8px;text-align:center}.c-b .c-b-fa{margin-top:-3px;vertical-align:middle}.c-b-E.c-b-H-ra{z-index:0}.c-b-E.c-b:active{box-shadow:none}.c-b-da{background-color:#3d9400;border:1px solid #29691d;color:#fff;text-shadow:0 1px rgba(0,0,0,.1)}.y-qa-za-Yh.c-b-da .y-qa-za-qd{background-position:0 -42px;height:10px;top:1px;width:10px}.a-w{color:#333;cursor:pointer;list-style:none;margin:0;padding:6px 7em 6px 30px;position:relative;white-space:nowrap}.a-q-Ss .a-w{padding-left:16px;vertical-align:middle}.a-q-bl .a-w{padding-right:44px}.i-j-h-t-jd{background:url(https://ssl.gstatic.com/s2/tt/images/sharebox/sharebox-79add4f2fb2c321d0d0869320ce9edf8.png) no-repeat 0 -586px}.i-j-h-t-jd-A{background:url(https://ssl.gstatic.com/s2/tt/images/sharebox/sharebox-79add4f2fb2c321d0d0869320ce9edf8.png) no-repeat 0 -78px}.i-j-h-t-jd-Ya-A{background:url(https://ssl.gstatic.com/s2/tt/images/sharebox/sharebox-79add4f2fb2c321d0d0869320ce9edf8.png) no-repeat 0 -93px}.i-j-h-t-ou-A{background:url(https://ssl.gstatic.com/s2/tt/images/sharebox/sharebox-79add4f2fb2c321d0d0869320ce9edf8.png) no-repeat 0 -273px}.i-j-h-t-kd{background:url(https://ssl.gstatic.com/s2/tt/images/sharebox/sharebox-79add4f2fb2c321d0d0869320ce9edf8.png) no-repeat 0 -342px}.i-j-h-t-kd-A{background:url(https://ssl.gstatic.com/s2/tt/images/sharebox/sharebox-79add4f2fb2c321d0d0869320ce9edf8.png) no-repeat -8px -135px}.i-j-h-t-kd-Ya-A{background:url(https://ssl.gstatic.com/s2/tt/images/sharebox/sharebox-79add4f2fb2c321d0d0869320ce9edf8.png) no-repeat 0 -416px}.i-j-h-t-oc-rd{height:17px;width:14px}.i-j-h-t-Yd{background:url(https://ssl.gstatic.com/docs/documents/share/images/chips/external/youtube.png) no-repeat!important}.i-j-h-t-pb{background:url(https://ssl.gstatic.com/s2/tt/images/sharebox/sharebox-79add4f2fb2c321d0d0869320ce9edf8.png) no-repeat 0 -218px}.i-j-h-t-sc-pb{background:url(https://ssl.gstatic.com/s2/tt/images/sharebox/sharebox-79add4f2fb2c321d0d0869320ce9edf8.png) no-repeat -9px -705px}.i-j-h-t-sc-pb-A{background:url(https://ssl.gstatic.com/s2/tt/images/sharebox/sharebox-79add4f2fb2c321d0d0869320ce9edf8.png) no-repeat -8px -120px}.i-j-h-t-sc-pb-Ya-A{background:url(https://ssl.gstatic.com/s2/tt/images/sharebox/sharebox-79add4f2fb2c321d0d0869320ce9edf8.png) no-repeat 0 -166px}.i-j-h-t-Ya.i-j-h-t-sc-pb-Ya-A{height:24px;width:25px}.i-j-h-t-md{background:url(https://ssl.gstatic.com/s2/tt/images/sharebox/sharebox-79add4f2fb2c321d0d0869320ce9edf8.png) no-repeat 0 -259px}.i-j-h-t-md-A{background:url(https://ssl.gstatic.com/s2/tt/images/sharebox/sharebox-79add4f2fb2c321d0d0869320ce9edf8.png) no-repeat 0 -658px}.i-j-h-t-md-Ya-A{background:url(https://ssl.gstatic.com/s2/tt/images/sharebox/sharebox-79add4f2fb2c321d0d0869320ce9edf8.png) no-repeat 0 -735px}.i-j-h-t-cb{background:url(https://ssl.gstatic.com/s2/tt/images/sharebox/sharebox-79add4f2fb2c321d0d0869320ce9edf8.png) no-repeat 0 -647px;height:10px;width:14px}.i-j-h-tb-x{background:#fff;border-color:#bbb #bdbdbd #cecece;border-style:solid;border-width:1px;box-shadow:0 2px #f7f7f7;padding:3px}.i-j-h-ma{background:#1da1d8;border:1px solid #057bac;border-radius:3px;color:#fff;cursor:default;display:inline-block;margin:2px;padding:0 1px;vertical-align:middle}.i-j-h-ma-ib{border-top-color:#61c8ee;border-top-style:solid;border-top-width:1px;display:inline-block;padding:0 2px 2px 5px}.i-j-h-ma-x{padding-left:5px;vertical-align:middle}.i-j-h-ma-Yd{background:#4cc;border:1px solid #333}.i-j-h-ma-Yd .i-j-h-ma-ib{border-color:#666}.i-j-h-ma-nc{background:#d63f44;border:1px solid #db0d14;color:#fff}.i-j-h-ma-nc .i-j-h-ma-ib{border-color:#e38a8e}.Fm{border-radius:3px;margin-top:0;width:497px}.Cla{margin-left:68px;position:relative}.Bla{float:left;margin-left:-67px}.ze{height:21px;position:absolute;width:10px}.Dla{background:url(https://ssl.gstatic.com/s2/oz/images/sprites/stream-e001443aa61c5529c1aa133a9c12bb49.png) no-repeat -119px -52px;margin-left:-9px;top:13px}.ii .Ma{margin:16px}.Fg{background-color:#0a0a0a;line-height:0;overflow:hidden;position:relative}.aG{bottom:0;display:block;left:0;margin:auto;position:absolute;right:0;top:0}.FB{min-height:100px}.i-j-h-G{display:inline-block;margin:1px 4px;min-width:40%;overflow:hidden;vertical-align:middle}.i-j-h-G-n{cursor:pointer;margin-left:2px}.i-j-h-G-n-A{color:#888;vertical-align:middle}.i-j-h-G-G{border:0 currentColor;font-family:Arial,sans-serif;font-size:inherit;height:23px;outline:0;padding:0;width:2px}.i-j-h-G-Na .i-j-h-G-G{position:static;width:100%}.i-j-h-Ai-q .a-w{padding-right:5em}.i-j-h-Kr .i-j-h-tb{margin-right:28px}.i-j-h-Q-rd{background:#fff;position:relative}.i-j-h-f .i-j-h-Q-rd{border-color:#bdbdbd;border-style:solid;border-width:0 1px 1px;box-shadow:0 2px #fff;height:160px;position:relative}.i-j-h-f.i-j-h-tb .i-j-h-Q{left:0;overflow-y:scroll;position:static;top:3px;width:100%;z-index:10}.i-j-h-Q{left:0;max-height:160px;overflow-y:auto;position:absolute;top:3px;width:250px;z-index:10}.i-j-h-Q-Lb{padding-bottom:6px;padding-top:6px}.i-j-h-f .i-j-h-Q-Lb{padding-bottom:0;padding-top:0}.i-j-h-Q-Lb .a-w{padding-left:16px;padding-right:0}.i-j-h-f .a-w{padding-right:32px}.i-j-h-Q-em .a-w{padding-bottom:10px;padding-top:10px}.i-j-h-Q .a-w-x{overflow:hidden}.uBb .Fg{background-color:transparent;margin:0 auto}.gca .a-f-e{z-index:auto}.be{min-height:3.9em;overflow:auto;position:relative}.Fs{display:inline-block;float:right;height:15px;margin:6px 6px 6px 0}.NJ{position:absolute;z-index:3}.Ti{background-image:url(https://ssl.gstatic.com/s2/tt/images/sharebox/down-arrow-dark.png);background-position:center;background-repeat:no-repeat;cursor:pointer;float:right;height:4px;padding:6px 4px;width:7px}.Jg{background:url(https://ssl.gstatic.com/s2/tt/images/sharebox/sharebox-79add4f2fb2c321d0d0869320ce9edf8.png) no-repeat 0 -690px;cursor:pointer;float:right;height:14px;margin:0 4px;width:15px}.Kg{background:url(https://ssl.gstatic.com/s2/tt/images/sharebox/sharebox-79add4f2fb2c321d0d0869320ce9edf8.png) no-repeat 0 -600px;cursor:pointer;float:right;height:15px;margin:0 4px;width:15px}.Ma .m-k-Y{margin-right:20px}.Ma{font-size:13px;position:relative}.pm{margin-right:8px}.We.Fm .Je{border-radius:5px}.Fm .Je{background-color:#f9f9f9;border:1px solid #c4c4c4;border-radius:5px 5px 0 0;padding:6px;position:relative}.We .Je{background-color:#f9f9f9}.Fm .yf{margin-left:-7px;margin-right:-7px}.At .Je{-moz-transition:height .125s;overflow:hidden;transition:height .125s}.Nf .Jh{margin-top:6px}.UK .Ng{height:1px;overflow:hidden;position:absolute;top:-1000em;width:1px}.Fm .Ng{background-color:#dbdbdb;border-color:#c4c4c4;border-radius:0 0 5px 5px;border-style:solid;border-width:0 1px 1px;box-shadow:0 1px 1px #e2e2e2;padding:13px}.xe .be{border:0 currentColor;margin-right:20px}.xe .Fi{color:#ccc;font-size:14px}.qj .xe .be{margin-right:0;max-height:120px;min-height:20px}.xe{background-color:#fff;border:1px solid #c4c4c4;box-shadow:inset 0 1px 2px #ddd;cursor:text;padding:8px 9px;position:relative}.Ma .i-j-h-vk{margin-bottom:13px;margin-top:0}.KA{padding:20px 10px!important}.KA .ua-ia{margin-right:10px;white-space:nowrap}.KA .ua-ya-gb{background:#e1e1e1;height:16px;position:relative}.KA .ua-ya-jb{-moz-transition:width .5s;background:#2c75ec;height:100%;overflow:hidden;position:relative;transition:width .5s}.gNa .a-w{padding-left:20px;padding-right:30px}.sva .c-b{margin-right:4px;min-width:28px}.dva .be{min-height:1.5em}.ubb .c-b{margin-right:0}.qga .g-Ua-z9 .Ma{padding:0}.a-f-e.SC{border:1px solid #862;margin:0 0 1px 8px;vertical-align:baseline}.Tka .c-b{height:14px;min-width:13px;padding-top:13px;text-align:center;vertical-align:top;width:13px}.c-b-E.c-b-da,.xIa .c-b-E.c-b-Ja,.Mua .c-b-E.c-b-Ja{background:#3d9400;opacity:.5}.y-qa-za-b.c-b-da .y-qa-za-qd,.y8.c-b-da .sia{background:url(https://ssl.gstatic.com/s2/oz/images/circles/cpw.png) no-repeat 0 -28px;height:13px;margin-right:5px;top:3px;width:13px}.i-j-h-t-pb-A,.i-j-h-t-kb-A{background:url(https://ssl.gstatic.com/s2/tt/images/sharebox/sharebox-79add4f2fb2c321d0d0869320ce9edf8.png) no-repeat 0 -720px}.i-j-h-t-pb-Ya-A,.i-j-h-t-kb-Ya-A{background:url(https://ssl.gstatic.com/s2/tt/images/sharebox/sharebox-79add4f2fb2c321d0d0869320ce9edf8.png) no-repeat 0 -51px}.i-j-h-ma-xi,.i-j-h-ma-Re{background:#67ae3f;border:1px solid #3f980e}.i-j-h-ma-xi .i-j-h-ma-ib,.i-j-h-ma-Re .i-j-h-ma-ib{border-color:#9bce7c}.i-j-h-G-Na .i-j-h-G-n,.Rh .Wl,.Xl,.Qh .Yl,.Zl,.Nf .Ff{display:none}.Mua .a-w,.xIa .a-w,.N7b .a-w{padding-left:24px;padding-right:24px}.OBb .i-j-h-vk,.Xc{margin:10px 0}.G6 .Wk,.Je{position:relative}.Rh .Xl,.Wl,.Qh .Zl,.Yl{display:block}.Nf .Fp,.Nf .Gp{padding-bottom:0}.i-j-h-t{background-repeat:no-repeat;display:inline-block;height:14px;vertical-align:middle;width:14px}.i-j-h-t.a-w-t{margin:3px 7px}.i-j-h-t-oc{background:url(https://ssl.gstatic.com/s2/tt/images/sharebox/sharebox-79add4f2fb2c321d0d0869320ce9edf8.png) no-repeat -14px -342px;cursor:pointer;height:7px;margin:3px;width:7px}.i-j-h-t-oc:hover{background:url(https://ssl.gstatic.com/s2/tt/images/sharebox/sharebox-79add4f2fb2c321d0d0869320ce9edf8.png) no-repeat -16px -806px;cursor:pointer;height:7px;width:7px}.a-cg{margin-top: 6px;margin-bottom: 6px;border-top-color: rgb(235, 235, 235);border-top-width: 1px;border-top-style: solid}", GM_addStyle(googleCss), shareBox = d[cE](dv), shareBox[cN] = "sP-mB", shareBox.innerHTML = shareBoxHTML, imageContainer[s][ds] = "none", imageContainer.parentNode.insertBefore(shareBox, imageContainer), d[eC]("works_info")[0][s][ds] = "none"; function a() { this.lastSelectAlbum = 0, this.lastSelectCircles = [], this.defaultContent = "*[PIXIV] {author} | {title}* {link}", this.disableComments = f, this.lockPost = f } function v() { localStorage[settingsEntry] = JSON.stringify(settings) } var settingsEntry = "pixivSharerPageSettings", settings = localStorage[settingsEntry] ? JSON.parse(localStorage[settingsEntry]) : new a, shareButton = d[eC]("a-f-e c-b c-b-da pm Nl")[0], informationReady = f, hasSelectedCircle = f; function i() { informationReady ? shareButton[cL].remove("c-b-E") : shareButton[cL].add("c-b-E") } function u(n, i) { var r = n, e = i.split(" "), u, o; do if (r != d) { u = t; for (o in e) r[cL].contains(e[o]) || (u = f); if (u) return r } while (r = r.parentNode); return null } function e() { d[eC]("i-j-h-G-n")[0][s][ds] = "none", d[eC]("i-j-h-Q-rd")[0][s][ds] = "block", d[aE](cl, o) } function o(n) { u(n.target, "i-j-h-G") || u(n.target, "i-j-h-Q-rd") || (d[eC]("i-j-h-G-n")[0][s][ds] = "block", d[eC]("i-j-h-Q-rd")[0][s][ds] = "none", d.removeEventListener(cl, o)) } d[eC]("i-j-h-G")[0][aE](cl, e), selectedCircles = []; function y(n) { selectedCircles.length == 0 && (hasSelectedCircle = t), selectedCircles.push(n), selectedCircles.indexOf(1) != -1 && selectedCircles.indexOf(3) != -1 && selectedCircles.indexOf(4) != -1 && (separator[s][ds] = "none"), i() } function p(n) { selectedCircles.length == 1 && (hasSelectedCircle = f), selectedCircles.splice(selectedCircles.indexOf(n), 1), (selectedCircles.indexOf(1) == -1 || selectedCircles.indexOf(3) == -1 || selectedCircles.indexOf(4) == -1) && (separator[s][ds] = "block"), i() } function b(n, t, i) { var u = d[cE](sp), f, e, r, o, h; u[cN] = "i-j-h-ma", f = d[cE](sp), f[cN] = "i-j-h-ma-ib", u[aC](f), e = d[cE](sp), f[aC](e), r = d[cE](sp), r[cN] = "i-j-h-ma-x", f[aC](r); switch (n) { case 1: u[cN] += " i-j-h-ma-xi", e[cN] = "i-j-h-t-jd i-j-h-t", r[tC] = "Public"; break; case 3: e[cN] = "i-j-h-t-sc-pb i-j-h-t", r[tC] = "Your circles"; break; case 4: u[cN] += " i-j-h-ma-xi", e[cN] = "i-j-h-t-md i-j-h-t", r[tC] = "Extended circles"; break; default: e[cN] = "i-j-h-t-pb i-j-h-t", r[tC] = t } return o = d[cE](dv), o[cN] = "a-f-e i-j-h-t-oc-rd", f[aC](o), h = d[cE](sp), h[cN] = "i-j-h-t i-j-h-t-oc", h[aE](cl, function () { i[s][ds] = "block", balloonContainer.removeChild(u), p(n) }), o[aC](h), u } balloonContainer = d[eC]("i-j-h-tb-x")[0][eT](sp)[0]; function n(n, t, i) { i[s][ds] = "none", balloonContainer[aC](b(n, t, i)), y(n) } function r(t, i) { var u = d[cE](dv), e, f, r; u[cN] = "a-w", u[sA]("role", "option"), u[aE](cl, function () { n(t, i, u) }), e = d[cE](dv), e[cN] = "a-w-x", u[aC](e), f = d[cE](sp), e[aC](f), r = d[cE](sp), r[cN] = "i-j-h-ma-x", e[aC](r); switch (t) { case 1: f[cN] = "i-j-h-t-jd-A i-j-h-t", r[tC] = "Public"; break; case 3: f[cN] = "i-j-h-t-sc-pb-A i-j-h-t", r[tC] = "Your circles"; break; case 4: f[cN] = "i-j-h-t-md-A i-j-h-t", r[tC] = "Extended circles"; break; default: f[cN] = "i-j-h-t-pb-A i-j-h-t", r[tC] = i } return u } for (container = d[eC]("a-q-bl i-j-h-Q c-B i-j-h-Q-Lb")[0], limitedButton = r(3), container[aC](limitedButton), publicButton = r(1), container[aC](publicButton), extendedButton = r(4), container[aC](extendedButton), separator = d[cE](dv), separator[cN] = "a-cg", container[aC](separator), j = settings.lastSelectCircles.length; j--;) switch (settings.lastSelectCircles[j]) { case 1: n(1, null, publicButton); break; case 3: n(3, null, limitedButton); break; case 4: n(4, null, extendedButton) } menuShow = !1; function h() { menuShow ? (d[eC]("NJ")[0][s][ds] = "none", d.removeEventListener(cl, h), menuShow = !1) : menuShow = !0 } d[eC]("Qm")[0][aE](cl, function () { d[eC]("NJ")[0][s][ds] = "block", d[aE](cl, h) }); function c() { settings.disableComments ? (d[eC]("Wl")[0][eC]("a-w-x")[0][tC] = "Enable Comments", d[eC]("Jg")[0][s][ds] = "block") : (d[eC]("Wl")[0][eC]("a-w-x")[0][tC] = "Disable Comments", d[eC]("Jg")[0][s][ds] = "none") } c(), d[eC]("Wl")[0][aE](cl, function () { settings.disableComments = !settings.disableComments, c() }); function l() { settings.lockPost ? (d[eC]("Yl")[0][eC]("a-w-x")[0][tC] = "Unlock this post", d[eC]("Kg")[0][s][ds] = "block") : (d[eC]("Yl")[0][eC]("a-w-x")[0][tC] = "Lock this post", d[eC]("Kg")[0][s][ds] = "none") } l(), d[eC]("Yl")[0][aE](cl, function () { settings.lockPost = !settings.lockPost, l() }), d[eC]("pS-m-dC")[0][aE](cl, function () { background || (background = d[cE](dv), background[s] = "position:absolute;left:0;top:0;width:100%;height:100%;background:white;opacity:0.75;", d.body[aC](background)), background[s][ds] = "block", popup || (popup = d[cE](dv), popup.innerHTML = "") }), context = unsafeWindow.pixiv.context, d[eC]("sP-ct")[0].value = settings.defaultContent.replace("{author}", context.userName).replace("{title}", context.illustTitle).replace("{link}", document.URL), d[eC]("ev aG")[0].src = imageContainer[eT]("img")[0].src; var albumSelector = d[eC]("sP-aS")[0], albums = {}, SessionID, UserID = "109761538122050940415", urlBase = "https://plus.google.com/b/" + UserID; d[eC]("Ol Rf gS Bla")[0].src = "https://lh3.googleusercontent.com/-a5l-m7JsPNw/AAAAAAAAAAI/AAAAAAAAAAA/mT15S7oxelc/s49-c/photo.jpg", d[eC]("ua-ia")[0][tC] = "Getting Google+ Album Info...", d[eC]("ua-ya-jb")[0][s][w] = "50%", xhr({ method: "GET", url: urlBase + "/photos/" + UserID + "/albums", onload: function (n) { var o, u, e, f, r, h; for (SessionID = encodeURIComponent(n[rT].match(/AObGSA.*:\d+/)), o = n[rT].indexOf("key: '24'") + 35, u = eval(n[rT].substring(o, n[rT].indexOf("});<\/script>", o)))[2], r = 0, h = u.length; r < h; r++) e = u[r][5], albums[e] = u[r][2], f = d[cE]("option"), f.id = e, f[tC] = u[r][2], settings.lastSelectAlbum == e && (f.selected = !0), albumSelector[aC](f); d[eC]("KA Xc")[0][s][ds] = "none", informationReady = t, i() } }), shareButton[aE](cl, function () { var t, r, n, u, i; if (shareButton[cL].contains("c-b-E")) hasSelectedCircle || e(); else { for (shareButton[cL].add("c-b-E"), shareButton[tC] = "Sharing...", t = { content: d[eC]("sP-ct")[0].value, circles: [] }, settings.lastSelectCircles = [], r = selectedCircles.length; r--;) n = selectedCircles[r], n == 1 || n == 3 || n == 4 ? t.circles.push([, , n]) : t.circles.push([, n]), settings.lastSelectCircles.push(n); v(), u = imageContainer[eT]("img")[0].src.replace("_m.", imageContainer.firstChild.href.indexOf("mode=manga") > -1 ? "_p0." : "."), i = albumSelector.options[albumSelector.selectedIndex].id, i == 0 ? googlePlusAPIs.uploadImage(u, googlePlusAPIs.postImage, t) : (settings.lastSelectAlbum = i, t.albumName = albums[i], googlePlusAPIs.uploadImage(u, googlePlusAPIs.postImage, t, i, 1)) } }), googlePlusAPIs = { uploadImage: function (n, t, i, r, u) { d[eC]("KA Xc")[0][s][ds] = "block", d[eC]("ua-ia")[0][tC] = "[1/4] Downloading image...", d[eC]("ua-ya-jb")[0][s][w] = "0%", xhr({ method: "GET", url: n, overrideMimeType: "text/plain; charset=x-user-defined", onload: function (n) { for (var h = new Uint8Array(n[rT].length), f = n[rT].length; f; f--) h[f - 1] = n[rT].charCodeAt(f - 1); var e = new Blob([h]), o = (context.illustId + "_-_" + context.userName + "_-_" + context.illustTitle + ".png").replace(/\\|\/|:|\*|\?|\"|<|>|\|/, " "), c = r && u, l = c ? { protocolVersion: "0.8", createSessionRequest: { fields: [{ external: { name: "file", filename: o, put: {}, size: e.size } }, { inlined: { name: "disable_asbe_notification", content: "true", contentType: "text/plain" } }, { inlined: { name: "use_upload_size_pref", content: "true", contentType: "text/plain" } }, { inlined: { name: "owner_name", content: UserID, contentType: "text/plain" } }, { inlined: { name: "title", content: o, contentType: "text/plain" } }, { inlined: { name: "addtime", content: (new Date).getTime().toString(), contentType: "text/plain" } }, { inlined: { name: "batchid", content: (new Date).getTime().toString(), contentType: "text/plain" } }, { inlined: { name: "album_id", content: r, contentType: "text/plain" } }, { inlined: { name: "album_abs_position", content: u.toString(), contentType: "text/plain" } }, { inlined: { name: "effective_id", content: UserID, contentType: "text/plain" } }, { inlined: { name: "client", content: "es-add-standalone-album", contentType: "text/plain" } }] } } : { protocolVersion: "0.8", createSessionRequest: { fields: [{ external: { name: "file", filename: o, put: {}, size: e.size } }, { inlined: { name: "batchid", content: (new Date).getTime().toString(), contentType: "text/plain" } }, { inlined: { name: "client", content: "sharebox", contentType: "text/plain" } }, { inlined: { name: "disable_asbe_notification", content: "true", contentType: "text/plain" } }, { inlined: { name: "streamid", content: "updates", contentType: "text/plain" } }, { inlined: { name: "use_upload_size_pref", content: "true", contentType: "text/plain" } }, { inlined: { name: "effective_id", content: UserID, contentType: "text/plain" } }, { inlined: { name: "owner_name", content: UserID, contentType: "text/plain" } }, { inlined: { name: "album_abs_position", content: "0", contentType: "text/plain" } }] } }; xhr({ method: "POST", url: "https://plus.google.com/_/upload/photos/resumable?authuser=0", headers: { "Content-Type": "application/x-www-form-urlencoded;charset=utf-8", "X-GUploader-Client-Info": "mechanism=scotty xhr resumable; clientVersion=30546681" }, onload: function (n) { d[eC]("ua-ia")[0][tC] = "[2/4] Uploading image...", d[eC]("ua-ya-jb")[0][s][w] = "45%", obj = JSON.parse(n[rT]); var r = obj.sessionStatus.upload_id; r && xhr({ method: "POST", url: "https://plus.google.com/_/upload/photos/resumable?file_id=000&upload_id=" + r, onload: function (n) { obj = JSON.parse(n[rT]), obj.errorMessage ? (d[eC]("ua-ia")[0][tC] = "[Error] Uploading error: " + obj.errorMessage.additionalInfo["uploader_service.GoogleRupioAdditionalInfo"].requestRejectedInfo.reasonDescription, d[eC]("ua-ya-jb")[0][s][w] = "90%", shareButton[cL].remove("c-b-E"), shareButton[tC] = "Share to Google+") : t(obj.sessionStatus.additionalInfo["uploader_service.GoogleRupioAdditionalInfo"].completionInfo.customerSpecificInfo, i) }, upload: { onprogress: function (n) { d[eC]("ua-ya-jb")[0][s][w] = n.loaded / n.total * 45 + 45 + "%" } }, onerror: function (n) { d[eC]("ua-ia")[0][tC] = "Network error: " + n.statusText, d[eC]("ua-ya-jb")[0][s][w] = "0%", shareButton[cL].remove("c-b-E"), shareButton[tC] = "Share to Google+" }, data: e }) }, data: JSON.stringify(l) }) }, onprogress: function (n) { d[eC]("ua-ya-jb")[0][s][w] = n.loaded / n.total * 45 + "%" }, onerror: function (n) { d[eC]("ua-ia")[0][tC] = "Network error: " + n.statusText, d[eC]("ua-ya-jb")[0][s][w] = "0%", shareButton[cL].remove("c-b-E"), shareButton[tC] = "Share to Google+" } }) }, postImage: function (n, t) { function p(n) { for (var i = [], t = 0; t < n; t++) i.push(null); return i } var y = n.title, f = n.url, e = n.width, u = n.height, o = n.photoPageUrl, h = n.albumid, a = n.photoid, c = !!t.albumName, v, l, r, i; c && (v = "https://plus.google.com/photos/" + UserID + "/albums/" + h, l = p(48), l[3] = t.albumName, l[9] = [], l[24] = [null, v, null, "text/html", "document"], l[41] = [], l[47] = [[null, "picasa", "http://google.com/profiles/media/provider", ""]]), r = p(48), r[3] = "", r[5] = [null, f, e, u], r[9] = [], r[21] = y, r[24] = [null, o, null, "image/jpeg", "image"], r[41] = [], r[41][0] = [null, f, e, u], c || (r[41][1] = [null, f, e, u]), r[47] = [], r[47][0] = [null, "picasa", "http://google.com/profiles/media/provider", ""], c ? (r[47][1] = [null, o, "http://google.com/profiles/media/container", ""], r[47][2] = [null, "albumid=" + h + "&photoid=" + a, "http://google.com/profiles/media/onepick_media_id", ""]) : r[47][1] = [null, "albumid=" + h + "&photoid=" + a, "http://google.com/profiles/media/onepick_media_id", ""], i = p(38), i[0] = t.content, i[1] = "oz:" + UserID + "." + (new Date).getTime().toString(16) + ".0", i[3] = h, i[6] = JSON.stringify(c ? [JSON.stringify(l), JSON.stringify(r)] : [JSON.stringify(r)]), i[9] = !0, i[10] = i[14] = i[36] = [], i[11] = i[16] = !1, i[27] = settings.disableComments, i[28] = settings.lockPost, c || (i[12] = !1), i[19] = UserID, c ? (i[16] = i[32] = !0, i[29] = !1, i[34] = [[250, 38, 35, 1, 0], v, null, { "27847199": [v, t.albumName, null, [[[o, y, "", f, null, [f, e, u, null, null, null, null, u], null, e.toString(), u.toString(), e, u, null, "picasaweb.google.com"], UserID, null, a, null, null, f, o, null, o, null, "albumid=" + h + "&photoid=" + a]], UserID, h] }]) : (i[29] = !0, i[34] = [[249, 18, 1, 0], null, null, { "27639957": [[o, y, "", f, null, [f, e, u, null, null, null, null, u, [1, f]], null, e.toString(), u.toString(), e, u, null, "picasaweb.google.com"], UserID, null, a, null, null, f, null, null, o, null, "albumid=" + h + "&photoid=" + a, 1] }]), i[37] = [t.circles], d[eC]("ua-ia")[0][tC] = "[3/4] Sharing post...", d[eC]("ua-ya-jb")[0][s][w] = "90%", xhr({ method: "POST", url: urlBase + "/_/sharebox/post/?spam=" + (c ? "24" : "20") + "&rt=j&_reqid=" + (new Date).getTime() % 1e7, headers: fe, data: "f.req=" + encodeURIComponent(JSON.stringify(i)) + "&at=" + SessionID, onload: function () { d[eC]("ua-ia")[0][tC] = "[4/4] Post Shared", d[eC]("ua-ya-jb")[0][s][w] = "100%", shareButton[cL].remove("c-b-E"), shareButton[tC] = "Share to Google+" }, onerror: function (n) { d[eC]("ua-ia")[0][tC] = "Network error: " + n.statusText, d[eC]("ua-ya-jb")[0][s][w] = "0%", shareButton[cL].remove("c-b-E"), shareButton[tC] = "Share to Google+" } }) } } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment